From b958b647d4d8764e5e2603fefa9fa4a7ca46301d Mon Sep 17 00:00:00 2001 From: Nick Gerleman Date: Tue, 2 May 2023 17:56:08 -0700 Subject: [PATCH 1/3] TypeScript fixes Summary: A pending change revamps a lot of how ESLint, Prettier, and Jest are configured in the repo, along with moving the world to TypeScript (and adding tsc usage). That still needs some work to split up, but this change adds types used in our unit tests that I found were missing. Differential Revision: D45506781 fbshipit-source-id: 4fa450d986d5be5ed09849724cc63d1762a0ecbf --- javascript/src_js/wrapAsm.d.ts | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/javascript/src_js/wrapAsm.d.ts b/javascript/src_js/wrapAsm.d.ts index 022ac5f3..179923e8 100644 --- a/javascript/src_js/wrapAsm.d.ts +++ b/javascript/src_js/wrapAsm.d.ts @@ -65,12 +65,14 @@ export type Config = { * conformance fix previously disabled by "UseLegacyStretchBehaviour". */ setUseLegacyStretchBehaviour(useLegacyStretchBehaviour: boolean): void; - getErrata(): Errata, - setErrata(errata: Errata): void, + getErrata(): Errata; + setErrata(errata: Errata): void; useWebDefaults(): boolean; setUseWebDefaults(useWebDefaults: boolean): void; }; +export type DirtiedFunction = (node: Node) => void; + export type MeasureFunction = ( width: number, widthMode: MeasureMode, @@ -122,6 +124,7 @@ export type Node = { getWidth(): Value; insertChild(child: Node, index: number): void; isDirty(): boolean; + isReferenceBaseline(): boolean; markDirty(): void; removeChild(child: Node): void; reset(): void; @@ -140,6 +143,7 @@ export type Node = { setFlexShrink(flexShrink: number): void; setFlexWrap(flexWrap: Wrap): void; setHeight(height: number | "auto" | `${number}%`): void; + setIsReferenceBaseline(isReferenceBaseline: boolean): void; setHeightAuto(): void; setHeightPercent(height: number): void; setJustifyContent(justifyContent: Justify): void; @@ -151,6 +155,7 @@ export type Node = { setMaxHeightPercent(maxHeight: number): void; setMaxWidth(maxWidth: number | `${number}%`): void; setMaxWidthPercent(maxWidth: number): void; + setDirtiedFunc(dirtiedFunc: DirtiedFunction | null): void; setMeasureFunc(measureFunc: MeasureFunction | null): void; setMinHeight(minHeight: number | `${number}%`): void; setMinHeightPercent(minHeight: number): void; @@ -165,19 +170,20 @@ export type Node = { setWidth(width: number | "auto" | `${number}%`): void; setWidthAuto(): void; setWidthPercent(width: number): void; + unsetDirtiedFunc(): void; unsetMeasureFunc(): void; }; export type Yoga = { Config: { create(): Config; - destroy(config: Config): any; + destroy(config: Config): void; }; Node: { - create(): Node; + create(config?: Config): Node; createDefault(): Node; createWithConfig(config: Config): Node; - destroy(node: Node): any; + destroy(node: Node): void; }; } & typeof YGEnums; -- 2.50.1.windows.1 From 940ac559b4282a34e10e1493331332083af27bf4 Mon Sep 17 00:00:00 2001 From: Nick Gerleman Date: Tue, 2 May 2023 17:56:08 -0700 Subject: [PATCH 2/3] Lint and typecheck TypeScript Summary: This change starts to enlighten linting and other repo configuration to TypeScript. This was previously special-cased out of linting, and meant we were not linting everything. It is also a precondition to do real typechecking and linting our definitions with type information. 1. Add TypeScript dependencies 1. Configure ESLint, Babel, tsc for TypeScript 1. Run tsc as part of linting (OSS only for now) This is continued in another change with adding types to scripts and config files, but more importantly converting hand-written tests and test generation to TypeScript, so we get real-world usage to typecheck against for testing. Differential Revision: D45508576 fbshipit-source-id: 1917c2785d5a0df5348158abd3f0551869c93d7e --- javascript/.babelrc.js | 5 +- javascript/.eslintrc.js | 44 ++++-- javascript/just.config.js | 7 +- javascript/package.json | 4 + javascript/tsconfig.json | 18 +++ javascript/yarn.lock | 295 ++++++++++++++++++++++++++++++++++++++ 6 files changed, 361 insertions(+), 12 deletions(-) create mode 100644 javascript/tsconfig.json diff --git a/javascript/.babelrc.js b/javascript/.babelrc.js index 6a57844c..cdd941ed 100644 --- a/javascript/.babelrc.js +++ b/javascript/.babelrc.js @@ -8,7 +8,8 @@ */ module.exports = { - "presets": [ - ["@babel/preset-env", {"targets": "defaults"}] + presets: [ + ["@babel/preset-env", { targets: "defaults" }], + "@babel/preset-typescript", ], }; diff --git a/javascript/.eslintrc.js b/javascript/.eslintrc.js index 4f7f120a..2baa5f0f 100644 --- a/javascript/.eslintrc.js +++ b/javascript/.eslintrc.js @@ -7,15 +7,13 @@ * @format */ +const path = require("path"); + module.exports = { root: true, - ignorePatterns: ["dist/**", "**/*.d.ts"], - parser: "@babel/eslint-parser", - extends: [ - "eslint:recommended", - "plugin:jest/recommended", - "plugin:prettier/recommended", - ], + ignorePatterns: ["dist/**", "tests/generated/**"], + extends: ["eslint:recommended", "plugin:prettier/recommended"], + plugins: ["prettier"], rules: { "no-var": "error", "prefer-arrow-callback": "error", @@ -26,14 +24,42 @@ module.exports = { }, env: { commonjs: true, - es6: true, + es2018: true, }, overrides: [ { - files: ["jest.*", "just.config.js", "tests/**"], + files: ["**/*.js"], + parser: "@babel/eslint-parser", + parserOptions: { + babelOptions: { + configFile: path.join(__dirname, ".babelrc.js"), + }, + }, + }, + { + files: ["**/*.ts"], + extends: ["plugin:@typescript-eslint/recommended"], + parser: "@typescript-eslint/parser", + parserOptions: { + project: path.join(__dirname, "tsconfig.json"), + }, + plugins: ["@typescript-eslint"], + rules: { + "@typescript-eslint/no-var-requires": "off", + }, + }, + { + files: ["**/.eslintrc.js", "**/just.config.js"], env: { node: true, }, + }, + { + files: ["jest.*", "tests/**"], + env: { + node: true, + }, + extends: ["plugin:jest/recommended"], globals: { getMeasureCounter: "writable", getMeasureCounterMax: "writable", diff --git a/javascript/just.config.js b/javascript/just.config.js index cabc413a..df09aedf 100644 --- a/javascript/just.config.js +++ b/javascript/just.config.js @@ -19,6 +19,7 @@ const { series, spawn, task, + tscTask, } = require("just-scripts"); const glob = require("glob"); @@ -83,7 +84,11 @@ task( task( "lint", - series(eslintTask({ fix: argv().fix }), clangFormatTask({ fix: argv().fix })) + parallel( + clangFormatTask({ fix: argv().fix }), + eslintTask({ fix: argv().fix }), + tscTask() + ) ); function babelTransformTask(opts) { diff --git a/javascript/package.json b/javascript/package.json index 11c2f932..bf3f8f18 100644 --- a/javascript/package.json +++ b/javascript/package.json @@ -42,6 +42,9 @@ "@babel/core": "^7.20.7", "@babel/eslint-parser": "^7.19.1", "@babel/preset-env": "^7.20.2", + "@babel/preset-typescript": "^7.21.4", + "@typescript-eslint/eslint-plugin": "^5.30.5", + "@typescript-eslint/parser": "^5.30.5", "clang-format": "^1.8.0", "eslint": "^8.30.0", "eslint-config-prettier": "^8.5.0", @@ -51,6 +54,7 @@ "jest": "^29.3.1", "just-scripts": "^2.1.0", "prettier": "^2.4.1", + "typescript": "5.0.4", "which": "^3.0.0" } } diff --git a/javascript/tsconfig.json b/javascript/tsconfig.json new file mode 100644 index 00000000..5bce5bdc --- /dev/null +++ b/javascript/tsconfig.json @@ -0,0 +1,18 @@ +{ + "compilerOptions": { + "target": "es2018", + "module": "commonjs", + "strict": true, + "esModuleInterop": true, + "skipLibCheck": true, + "forceConsistentCasingInFileNames": true, + "noEmit": true, + "baseUrl": ".", + "paths": { + "yoga-layout": ["src_js"] + } + }, + "ts-node": { + "transpileOnly": true + } +} diff --git a/javascript/yarn.lock b/javascript/yarn.lock index 0cfd027e..2f3b788d 100644 --- a/javascript/yarn.lock +++ b/javascript/yarn.lock @@ -33,6 +33,13 @@ dependencies: "@babel/highlight" "^7.18.6" +"@babel/code-frame@^7.21.4": + version "7.21.4" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.21.4.tgz#d0fa9e4413aca81f2b23b9442797bda1826edb39" + integrity sha512-LYvhNKfwWSPpocw8GI7gpK2nq3HSDuEPC/uSYaALSJu9xjsalaaYFOq0Pwt5KmVqwEbZlDu81aLXwBOmD/Fv9g== + dependencies: + "@babel/highlight" "^7.18.6" + "@babel/compat-data@^7.17.7", "@babel/compat-data@^7.20.1", "@babel/compat-data@^7.20.5": version "7.20.5" resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.20.5.tgz#86f172690b093373a933223b4745deeb6049e733" @@ -77,6 +84,16 @@ "@jridgewell/gen-mapping" "^0.3.2" jsesc "^2.5.1" +"@babel/generator@^7.21.5": + version "7.21.5" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.21.5.tgz#c0c0e5449504c7b7de8236d99338c3e2a340745f" + integrity sha512-SrKK/sRv8GesIW1bDagf9cCG38IOMYZusoe1dfg0D8aiUe3Amvoj1QtjTPAWcfrZFvIwlleLb0gxzQidL9w14w== + dependencies: + "@babel/types" "^7.21.5" + "@jridgewell/gen-mapping" "^0.3.2" + "@jridgewell/trace-mapping" "^0.3.17" + jsesc "^2.5.1" + "@babel/helper-annotate-as-pure@^7.18.6": version "7.18.6" resolved "https://registry.yarnpkg.com/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.18.6.tgz#eaa49f6f80d5a33f9a5dd2276e6d6e451be0a6bb" @@ -116,6 +133,21 @@ "@babel/helper-replace-supers" "^7.20.7" "@babel/helper-split-export-declaration" "^7.18.6" +"@babel/helper-create-class-features-plugin@^7.21.0": + version "7.21.8" + resolved "https://registry.yarnpkg.com/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.21.8.tgz#205b26330258625ef8869672ebca1e0dee5a0f02" + integrity sha512-+THiN8MqiH2AczyuZrnrKL6cAxFRRQDKW9h1YkBvbgKmAm6mwiacig1qT73DHIWMGo40GRnsEfN3LA+E6NtmSw== + dependencies: + "@babel/helper-annotate-as-pure" "^7.18.6" + "@babel/helper-environment-visitor" "^7.21.5" + "@babel/helper-function-name" "^7.21.0" + "@babel/helper-member-expression-to-functions" "^7.21.5" + "@babel/helper-optimise-call-expression" "^7.18.6" + "@babel/helper-replace-supers" "^7.21.5" + "@babel/helper-skip-transparent-expression-wrappers" "^7.20.0" + "@babel/helper-split-export-declaration" "^7.18.6" + semver "^6.3.0" + "@babel/helper-create-regexp-features-plugin@^7.18.6", "@babel/helper-create-regexp-features-plugin@^7.20.5": version "7.20.5" resolved "https://registry.yarnpkg.com/@babel/helper-create-regexp-features-plugin/-/helper-create-regexp-features-plugin-7.20.5.tgz#5ea79b59962a09ec2acf20a963a01ab4d076ccca" @@ -141,6 +173,11 @@ resolved "https://registry.yarnpkg.com/@babel/helper-environment-visitor/-/helper-environment-visitor-7.18.9.tgz#0c0cee9b35d2ca190478756865bb3528422f51be" integrity sha512-3r/aACDJ3fhQ/EVgFy0hpj8oHyHpQc+LPtJoY9SzTThAsStm4Ptegq92vqKoE3vD706ZVFWITnMnxucw+S9Ipg== +"@babel/helper-environment-visitor@^7.21.5": + version "7.21.5" + resolved "https://registry.yarnpkg.com/@babel/helper-environment-visitor/-/helper-environment-visitor-7.21.5.tgz#c769afefd41d171836f7cb63e295bedf689d48ba" + integrity sha512-IYl4gZ3ETsWocUWgsFZLM5i1BYx9SoemminVEXadgLBa9TdeorzgLKm8wWLA6J1N/kT3Kch8XIk1laNzYoHKvQ== + "@babel/helper-explode-assignable-expression@^7.18.6": version "7.18.6" resolved "https://registry.yarnpkg.com/@babel/helper-explode-assignable-expression/-/helper-explode-assignable-expression-7.18.6.tgz#41f8228ef0a6f1a036b8dfdfec7ce94f9a6bc096" @@ -156,6 +193,14 @@ "@babel/template" "^7.18.10" "@babel/types" "^7.19.0" +"@babel/helper-function-name@^7.21.0": + version "7.21.0" + resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.21.0.tgz#d552829b10ea9f120969304023cd0645fa00b1b4" + integrity sha512-HfK1aMRanKHpxemaY2gqBmL04iAPOPRj7DxtNbiDOrJK+gdwkiNRVpCpUJYbUT+aZyemKN8brqTOxzCaG6ExRg== + dependencies: + "@babel/template" "^7.20.7" + "@babel/types" "^7.21.0" + "@babel/helper-hoist-variables@^7.18.6": version "7.18.6" resolved "https://registry.yarnpkg.com/@babel/helper-hoist-variables/-/helper-hoist-variables-7.18.6.tgz#d4d2c8fb4baeaa5c68b99cc8245c56554f926678" @@ -170,6 +215,13 @@ dependencies: "@babel/types" "^7.20.7" +"@babel/helper-member-expression-to-functions@^7.21.5": + version "7.21.5" + resolved "https://registry.yarnpkg.com/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.21.5.tgz#3b1a009af932e586af77c1030fba9ee0bde396c0" + integrity sha512-nIcGfgwpH2u4n9GG1HpStW5Ogx7x7ekiFHbjjFRKXbn5zUvqO9ZgotCO4x1aNbKn/x/xOUaXEhyNHCwtFCpxWg== + dependencies: + "@babel/types" "^7.21.5" + "@babel/helper-module-imports@^7.18.6": version "7.18.6" resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.18.6.tgz#1e3ebdbbd08aad1437b428c50204db13c5a3ca6e" @@ -177,6 +229,13 @@ dependencies: "@babel/types" "^7.18.6" +"@babel/helper-module-imports@^7.21.4": + version "7.21.4" + resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.21.4.tgz#ac88b2f76093637489e718a90cec6cf8a9b029af" + integrity sha512-orajc5T2PsRYUN3ZryCEFeMDYwyw09c/pZeaQEZPH0MpKzSvn3e0uXsDBu3k03VI+9DBiRo+l22BfKTpKwa/Wg== + dependencies: + "@babel/types" "^7.21.4" + "@babel/helper-module-transforms@^7.18.6", "@babel/helper-module-transforms@^7.19.6", "@babel/helper-module-transforms@^7.20.7": version "7.20.7" resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.20.7.tgz#7a6c9a1155bef55e914af574153069c9d9470c43" @@ -191,6 +250,20 @@ "@babel/traverse" "^7.20.7" "@babel/types" "^7.20.7" +"@babel/helper-module-transforms@^7.21.5": + version "7.21.5" + resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.21.5.tgz#d937c82e9af68d31ab49039136a222b17ac0b420" + integrity sha512-bI2Z9zBGY2q5yMHoBvJ2a9iX3ZOAzJPm7Q8Yz6YeoUjU/Cvhmi2G4QyTNyPBqqXSgTjUxRg3L0xV45HvkNWWBw== + dependencies: + "@babel/helper-environment-visitor" "^7.21.5" + "@babel/helper-module-imports" "^7.21.4" + "@babel/helper-simple-access" "^7.21.5" + "@babel/helper-split-export-declaration" "^7.18.6" + "@babel/helper-validator-identifier" "^7.19.1" + "@babel/template" "^7.20.7" + "@babel/traverse" "^7.21.5" + "@babel/types" "^7.21.5" + "@babel/helper-optimise-call-expression@^7.18.6": version "7.18.6" resolved "https://registry.yarnpkg.com/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.18.6.tgz#9369aa943ee7da47edab2cb4e838acf09d290ffe" @@ -203,6 +276,11 @@ resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.20.2.tgz#d1b9000752b18d0877cff85a5c376ce5c3121629" integrity sha512-8RvlJG2mj4huQ4pZ+rU9lqKi9ZKiRmuvGuM2HlWmkmgOhbs6zEAw6IEiJ5cQqGbDzGZOhwuOQNtZMi/ENLjZoQ== +"@babel/helper-plugin-utils@^7.21.5": + version "7.21.5" + resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.21.5.tgz#345f2377d05a720a4e5ecfa39cbf4474a4daed56" + integrity sha512-0WDaIlXKOX/3KfBK/dwP1oQGiPh6rjMkT7HIRv7i5RR2VUMwrx5ZL0dwBkKx7+SW1zwNdgjHd34IMk5ZjTeHVg== + "@babel/helper-remap-async-to-generator@^7.18.9": version "7.18.9" resolved "https://registry.yarnpkg.com/@babel/helper-remap-async-to-generator/-/helper-remap-async-to-generator-7.18.9.tgz#997458a0e3357080e54e1d79ec347f8a8cd28519" @@ -225,6 +303,18 @@ "@babel/traverse" "^7.20.7" "@babel/types" "^7.20.7" +"@babel/helper-replace-supers@^7.21.5": + version "7.21.5" + resolved "https://registry.yarnpkg.com/@babel/helper-replace-supers/-/helper-replace-supers-7.21.5.tgz#a6ad005ba1c7d9bc2973dfde05a1bba7065dde3c" + integrity sha512-/y7vBgsr9Idu4M6MprbOVUfH3vs7tsIfnVWv/Ml2xgwvyH6LTngdfbf5AdsKwkJy4zgy1X/kuNrEKvhhK28Yrg== + dependencies: + "@babel/helper-environment-visitor" "^7.21.5" + "@babel/helper-member-expression-to-functions" "^7.21.5" + "@babel/helper-optimise-call-expression" "^7.18.6" + "@babel/template" "^7.20.7" + "@babel/traverse" "^7.21.5" + "@babel/types" "^7.21.5" + "@babel/helper-simple-access@^7.20.2": version "7.20.2" resolved "https://registry.yarnpkg.com/@babel/helper-simple-access/-/helper-simple-access-7.20.2.tgz#0ab452687fe0c2cfb1e2b9e0015de07fc2d62dd9" @@ -232,6 +322,13 @@ dependencies: "@babel/types" "^7.20.2" +"@babel/helper-simple-access@^7.21.5": + version "7.21.5" + resolved "https://registry.yarnpkg.com/@babel/helper-simple-access/-/helper-simple-access-7.21.5.tgz#d697a7971a5c39eac32c7e63c0921c06c8a249ee" + integrity sha512-ENPDAMC1wAjR0uaCUwliBdiSl1KBJAVnMTzXqi64c2MG8MPR6ii4qf7bSXDqSFbr4W6W028/rf5ivoHop5/mkg== + dependencies: + "@babel/types" "^7.21.5" + "@babel/helper-skip-transparent-expression-wrappers@^7.20.0": version "7.20.0" resolved "https://registry.yarnpkg.com/@babel/helper-skip-transparent-expression-wrappers/-/helper-skip-transparent-expression-wrappers-7.20.0.tgz#fbe4c52f60518cab8140d77101f0e63a8a230684" @@ -251,6 +348,11 @@ resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.19.4.tgz#38d3acb654b4701a9b77fb0615a96f775c3a9e63" integrity sha512-nHtDoQcuqFmwYNYPz3Rah5ph2p8PFeFCsZk9A/48dPc/rGocJ5J3hAAZ7pb76VWX3fZKu+uEr/FhH5jLx7umrw== +"@babel/helper-string-parser@^7.21.5": + version "7.21.5" + resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.21.5.tgz#2b3eea65443c6bdc31c22d037c65f6d323b6b2bd" + integrity sha512-5pTUx3hAJaZIdW99sJ6ZUUgWq/Y+Hja7TowEnLNMm1VivRgZQL3vpBY3qUACVsvw+yQU6+YgfBVmcbLaZtrA1w== + "@babel/helper-validator-identifier@^7.18.6", "@babel/helper-validator-identifier@^7.19.1": version "7.19.1" resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.19.1.tgz#7eea834cf32901ffdc1a7ee555e2f9c27e249ca2" @@ -261,6 +363,11 @@ resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.18.6.tgz#bf0d2b5a509b1f336099e4ff36e1a63aa5db4db8" integrity sha512-XO7gESt5ouv/LRJdrVjkShckw6STTaB7l9BrpBaAHDeF5YZT+01PCwmR0SJHnkW6i8OwW/EVWRShfi4j2x+KQw== +"@babel/helper-validator-option@^7.21.0": + version "7.21.0" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.21.0.tgz#8224c7e13ace4bafdc4004da2cf064ef42673180" + integrity sha512-rmL/B8/f0mKS2baE9ZpyTcTavvEuWhTTW8amjzXNvYG4AwBsqTLikfXsEofsJEfKHf+HQVQbFOHy6o+4cnC/fQ== + "@babel/helper-wrap-function@^7.18.9": version "7.20.5" resolved "https://registry.yarnpkg.com/@babel/helper-wrap-function/-/helper-wrap-function-7.20.5.tgz#75e2d84d499a0ab3b31c33bcfe59d6b8a45f62e3" @@ -294,6 +401,11 @@ resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.20.7.tgz#66fe23b3c8569220817d5feb8b9dcdc95bb4f71b" integrity sha512-T3Z9oHybU+0vZlY9CiDSJQTD5ZapcW18ZctFMi0MOAl/4BjFF4ul7NVSARLdbGO5vDqy9eQiGTV0LtKfvCYvcg== +"@babel/parser@^7.21.5": + version "7.21.8" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.21.8.tgz#642af7d0333eab9c0ad70b14ac5e76dbde7bfdf8" + integrity sha512-6zavDGdzG3gUqAdWvlLFfk+36RilI+Pwyuuh7HItyeScCWP3k6i8vKclAQ0bM/0y/Kz/xiwvxhMv9MgTJP5gmA== + "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression@^7.18.6": version "7.18.6" resolved "https://registry.yarnpkg.com/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression/-/plugin-bugfix-safari-id-destructuring-collision-in-function-expression-7.18.6.tgz#da5b8f9a580acdfbe53494dba45ea389fb09a4d2" @@ -502,6 +614,13 @@ dependencies: "@babel/helper-plugin-utils" "^7.8.0" +"@babel/plugin-syntax-jsx@^7.21.4": + version "7.21.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.21.4.tgz#f264ed7bf40ffc9ec239edabc17a50c4f5b6fea2" + integrity sha512-5hewiLct5OKyh6PLKEYaFclcqtIgCb6bmELouxjF6up5q3Sov7rOayW4RwhbaBL0dit8rA80GNfY+UuDp2mBbQ== + dependencies: + "@babel/helper-plugin-utils" "^7.20.2" + "@babel/plugin-syntax-jsx@^7.7.2": version "7.18.6" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.18.6.tgz#a8feef63b010150abd97f1649ec296e849943ca0" @@ -565,6 +684,13 @@ dependencies: "@babel/helper-plugin-utils" "^7.14.5" +"@babel/plugin-syntax-typescript@^7.20.0": + version "7.21.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.21.4.tgz#2751948e9b7c6d771a8efa59340c15d4a2891ff8" + integrity sha512-xz0D39NvhQn4t4RNsHmDnnsaQizIlUkdtYvLs8La1BlfjQ6JEwxkJGeqJMW2tAXx+q6H+WFuUTXNdYVpEya0YA== + dependencies: + "@babel/helper-plugin-utils" "^7.20.2" + "@babel/plugin-syntax-typescript@^7.7.2": version "7.20.0" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.20.0.tgz#4e9a0cfc769c85689b77a2e642d24e9f697fc8c7" @@ -702,6 +828,15 @@ "@babel/helper-plugin-utils" "^7.20.2" "@babel/helper-simple-access" "^7.20.2" +"@babel/plugin-transform-modules-commonjs@^7.21.5": + version "7.21.5" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.21.5.tgz#d69fb947eed51af91de82e4708f676864e5e47bc" + integrity sha512-OVryBEgKUbtqMoB7eG2rs6UFexJi6Zj6FDXx+esBLPTCxCNxAY9o+8Di7IsUGJ+AVhp5ncK0fxWUBd0/1gPhrQ== + dependencies: + "@babel/helper-module-transforms" "^7.21.5" + "@babel/helper-plugin-utils" "^7.21.5" + "@babel/helper-simple-access" "^7.21.5" + "@babel/plugin-transform-modules-systemjs@^7.19.6": version "7.19.6" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.19.6.tgz#59e2a84064b5736a4471b1aa7b13d4431d327e0d" @@ -808,6 +943,16 @@ dependencies: "@babel/helper-plugin-utils" "^7.18.9" +"@babel/plugin-transform-typescript@^7.21.3": + version "7.21.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.21.3.tgz#316c5be579856ea890a57ebc5116c5d064658f2b" + integrity sha512-RQxPz6Iqt8T0uw/WsJNReuBpWpBqs/n7mNo18sKLoTbMp+UrEekhH+pKSVC7gWz+DNjo9gryfV8YzCiT45RgMw== + dependencies: + "@babel/helper-annotate-as-pure" "^7.18.6" + "@babel/helper-create-class-features-plugin" "^7.21.0" + "@babel/helper-plugin-utils" "^7.20.2" + "@babel/plugin-syntax-typescript" "^7.20.0" + "@babel/plugin-transform-unicode-escapes@^7.18.10": version "7.18.10" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-unicode-escapes/-/plugin-transform-unicode-escapes-7.18.10.tgz#1ecfb0eda83d09bbcb77c09970c2dd55832aa246" @@ -915,6 +1060,17 @@ "@babel/types" "^7.4.4" esutils "^2.0.2" +"@babel/preset-typescript@^7.21.4": + version "7.21.5" + resolved "https://registry.yarnpkg.com/@babel/preset-typescript/-/preset-typescript-7.21.5.tgz#68292c884b0e26070b4d66b202072d391358395f" + integrity sha512-iqe3sETat5EOrORXiQ6rWfoOg2y68Cs75B9wNxdPW4kixJxh7aXQE1KPdWLDniC24T/6dSnguF33W9j/ZZQcmA== + dependencies: + "@babel/helper-plugin-utils" "^7.21.5" + "@babel/helper-validator-option" "^7.21.0" + "@babel/plugin-syntax-jsx" "^7.21.4" + "@babel/plugin-transform-modules-commonjs" "^7.21.5" + "@babel/plugin-transform-typescript" "^7.21.3" + "@babel/runtime@^7.8.4": version "7.20.7" resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.20.7.tgz#fcb41a5a70550e04a7b708037c7c32f7f356d8fd" @@ -947,6 +1103,22 @@ debug "^4.1.0" globals "^11.1.0" +"@babel/traverse@^7.21.5": + version "7.21.5" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.21.5.tgz#ad22361d352a5154b498299d523cf72998a4b133" + integrity sha512-AhQoI3YjWi6u/y/ntv7k48mcrCXmus0t79J9qPNlk/lAsFlCiJ047RmbfMOawySTHtywXhbXgpx/8nXMYd+oFw== + dependencies: + "@babel/code-frame" "^7.21.4" + "@babel/generator" "^7.21.5" + "@babel/helper-environment-visitor" "^7.21.5" + "@babel/helper-function-name" "^7.21.0" + "@babel/helper-hoist-variables" "^7.18.6" + "@babel/helper-split-export-declaration" "^7.18.6" + "@babel/parser" "^7.21.5" + "@babel/types" "^7.21.5" + debug "^4.1.0" + globals "^11.1.0" + "@babel/types@^7.0.0", "@babel/types@^7.18.6", "@babel/types@^7.18.9", "@babel/types@^7.19.0", "@babel/types@^7.20.0", "@babel/types@^7.20.2", "@babel/types@^7.20.5", "@babel/types@^7.20.7", "@babel/types@^7.3.0", "@babel/types@^7.3.3", "@babel/types@^7.4.4": version "7.20.7" resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.20.7.tgz#54ec75e252318423fc07fb644dc6a58a64c09b7f" @@ -956,6 +1128,15 @@ "@babel/helper-validator-identifier" "^7.19.1" to-fast-properties "^2.0.0" +"@babel/types@^7.21.0", "@babel/types@^7.21.4", "@babel/types@^7.21.5": + version "7.21.5" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.21.5.tgz#18dfbd47c39d3904d5db3d3dc2cc80bedb60e5b6" + integrity sha512-m4AfNvVF2mVC/F7fDEdH2El3HzUg9It/XsCxZiOTTA3m3qYfcSVSbTfM6Q9xG+hYDniZssYhlXKKUMD5m8tF4Q== + dependencies: + "@babel/helper-string-parser" "^7.21.5" + "@babel/helper-validator-identifier" "^7.19.1" + to-fast-properties "^2.0.0" + "@bcoe/v8-coverage@^0.2.3": version "0.2.3" resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" @@ -966,6 +1147,18 @@ resolved "https://registry.yarnpkg.com/@colors/colors/-/colors-1.5.0.tgz#bb504579c1cae923e6576a4f5da43d25f97bdbd9" integrity sha512-ooWCrlZP11i8GImSjTHYHLkvFDP48nS4+204nGb1RiX/WXYHmJA2III9/e2DWVabCESdW7hBAEzHRqUn9OUVvQ== +"@eslint-community/eslint-utils@^4.2.0": + version "4.4.0" + resolved "https://registry.yarnpkg.com/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz#a23514e8fb9af1269d5f7788aa556798d61c6b59" + integrity sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA== + dependencies: + eslint-visitor-keys "^3.3.0" + +"@eslint-community/regexpp@^4.4.0": + version "4.5.1" + resolved "https://registry.yarnpkg.com/@eslint-community/regexpp/-/regexpp-4.5.1.tgz#cdd35dce4fa1a89a4fd42b1599eb35b3af408884" + integrity sha512-Z5ba73P98O1KUYCCJTUeVpja9RcGoMdncZ6T49FCUl2lN38JtCJ+3WgIDBv0AuY4WChU5PmtJmOCTlN6FZTFKQ== + "@eslint/eslintrc@^1.4.0": version "1.4.0" resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-1.4.0.tgz#8ec64e0df3e7a1971ee1ff5158da87389f167a63" @@ -1248,6 +1441,14 @@ "@jridgewell/resolve-uri" "3.1.0" "@jridgewell/sourcemap-codec" "1.4.14" +"@jridgewell/trace-mapping@^0.3.17": + version "0.3.18" + resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.18.tgz#25783b2086daf6ff1dcb53c9249ae480e4dd4cd6" + integrity sha512-w+niJYzMHdd7USdiH2U6869nqhD2nbfZXND5Yp93qIbEmnDNk7PD48o+YchRVpzMU7M6jVCbenTR7PA1FLQ9pA== + dependencies: + "@jridgewell/resolve-uri" "3.1.0" + "@jridgewell/sourcemap-codec" "1.4.14" + "@nicolo-ribaudo/chokidar-2@2.1.8-no-fsevents.3": version "2.1.8-no-fsevents.3" resolved "https://registry.yarnpkg.com/@nicolo-ribaudo/chokidar-2/-/chokidar-2-2.1.8-no-fsevents.3.tgz#323d72dd25103d0c4fbdce89dadf574a787b1f9b" @@ -1422,6 +1623,32 @@ dependencies: "@types/yargs-parser" "*" +"@typescript-eslint/eslint-plugin@^5.30.5": + version "5.59.2" + resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.59.2.tgz#684a2ce7182f3b4dac342eef7caa1c2bae476abd" + integrity sha512-yVrXupeHjRxLDcPKL10sGQ/QlVrA8J5IYOEWVqk0lJaSZP7X5DfnP7Ns3cc74/blmbipQ1htFNVGsHX6wsYm0A== + dependencies: + "@eslint-community/regexpp" "^4.4.0" + "@typescript-eslint/scope-manager" "5.59.2" + "@typescript-eslint/type-utils" "5.59.2" + "@typescript-eslint/utils" "5.59.2" + debug "^4.3.4" + grapheme-splitter "^1.0.4" + ignore "^5.2.0" + natural-compare-lite "^1.4.0" + semver "^7.3.7" + tsutils "^3.21.0" + +"@typescript-eslint/parser@^5.30.5": + version "5.59.2" + resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.59.2.tgz#c2c443247901d95865b9f77332d9eee7c55655e8" + integrity sha512-uq0sKyw6ao1iFOZZGk9F8Nro/8+gfB5ezl1cA06SrqbgJAt0SRoFhb9pXaHvkrxUpZaoLxt8KlovHNk8Gp6/HQ== + dependencies: + "@typescript-eslint/scope-manager" "5.59.2" + "@typescript-eslint/types" "5.59.2" + "@typescript-eslint/typescript-estree" "5.59.2" + debug "^4.3.4" + "@typescript-eslint/scope-manager@5.47.0": version "5.47.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.47.0.tgz#f58144a6b0ff58b996f92172c488813aee9b09df" @@ -1430,11 +1657,34 @@ "@typescript-eslint/types" "5.47.0" "@typescript-eslint/visitor-keys" "5.47.0" +"@typescript-eslint/scope-manager@5.59.2": + version "5.59.2" + resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.59.2.tgz#f699fe936ee4e2c996d14f0fdd3a7da5ba7b9a4c" + integrity sha512-dB1v7ROySwQWKqQ8rEWcdbTsFjh2G0vn8KUyvTXdPoyzSL6lLGkiXEV5CvpJsEe9xIdKV+8Zqb7wif2issoOFA== + dependencies: + "@typescript-eslint/types" "5.59.2" + "@typescript-eslint/visitor-keys" "5.59.2" + +"@typescript-eslint/type-utils@5.59.2": + version "5.59.2" + resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.59.2.tgz#0729c237503604cd9a7084b5af04c496c9a4cdcf" + integrity sha512-b1LS2phBOsEy/T381bxkkywfQXkV1dWda/z0PhnIy3bC5+rQWQDS7fk9CSpcXBccPY27Z6vBEuaPBCKCgYezyQ== + dependencies: + "@typescript-eslint/typescript-estree" "5.59.2" + "@typescript-eslint/utils" "5.59.2" + debug "^4.3.4" + tsutils "^3.21.0" + "@typescript-eslint/types@5.47.0": version "5.47.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.47.0.tgz#67490def406eaa023dbbd8da42ee0d0c9b5229d3" integrity sha512-eslFG0Qy8wpGzDdYKu58CEr3WLkjwC5Usa6XbuV89ce/yN5RITLe1O8e+WFEuxnfftHiJImkkOBADj58ahRxSg== +"@typescript-eslint/types@5.59.2": + version "5.59.2" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.59.2.tgz#b511d2b9847fe277c5cb002a2318bd329ef4f655" + integrity sha512-LbJ/HqoVs2XTGq5shkiKaNTuVv5tTejdHgfdjqRUGdYhjW1crm/M7og2jhVskMt8/4wS3T1+PfFvL1K3wqYj4w== + "@typescript-eslint/typescript-estree@5.47.0": version "5.47.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.47.0.tgz#ed971a11c5c928646d6ba7fc9dfdd6e997649aca" @@ -1448,6 +1698,33 @@ semver "^7.3.7" tsutils "^3.21.0" +"@typescript-eslint/typescript-estree@5.59.2": + version "5.59.2" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.59.2.tgz#6e2fabd3ba01db5d69df44e0b654c0b051fe9936" + integrity sha512-+j4SmbwVmZsQ9jEyBMgpuBD0rKwi9RxRpjX71Brr73RsYnEr3Lt5QZ624Bxphp8HUkSKfqGnPJp1kA5nl0Sh7Q== + dependencies: + "@typescript-eslint/types" "5.59.2" + "@typescript-eslint/visitor-keys" "5.59.2" + debug "^4.3.4" + globby "^11.1.0" + is-glob "^4.0.3" + semver "^7.3.7" + tsutils "^3.21.0" + +"@typescript-eslint/utils@5.59.2": + version "5.59.2" + resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.59.2.tgz#0c45178124d10cc986115885688db6abc37939f4" + integrity sha512-kSuF6/77TZzyGPhGO4uVp+f0SBoYxCDf+lW3GKhtKru/L8k/Hd7NFQxyWUeY7Z/KGB2C6Fe3yf2vVi4V9TsCSQ== + dependencies: + "@eslint-community/eslint-utils" "^4.2.0" + "@types/json-schema" "^7.0.9" + "@types/semver" "^7.3.12" + "@typescript-eslint/scope-manager" "5.59.2" + "@typescript-eslint/types" "5.59.2" + "@typescript-eslint/typescript-estree" "5.59.2" + eslint-scope "^5.1.1" + semver "^7.3.7" + "@typescript-eslint/utils@^5.10.0": version "5.47.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.47.0.tgz#b5005f7d2696769a1fdc1e00897005a25b3a0ec7" @@ -1470,6 +1747,14 @@ "@typescript-eslint/types" "5.47.0" eslint-visitor-keys "^3.3.0" +"@typescript-eslint/visitor-keys@5.59.2": + version "5.59.2" + resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.59.2.tgz#37a419dc2723a3eacbf722512b86d6caf7d3b750" + integrity sha512-EEpsO8m3RASrKAHI9jpavNv9NlEUebV4qmF1OWxSTtKSFBpC1NCmWazDQHFivRf0O1DV11BA645yrLEVQ0/Lig== + dependencies: + "@typescript-eslint/types" "5.59.2" + eslint-visitor-keys "^3.3.0" + acorn-jsx@^5.3.2: version "5.3.2" resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.3.2.tgz#7ed5bb55908b3b2f1bc55c6af1653bada7f07937" @@ -3465,6 +3750,11 @@ ms@2.1.2: resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== +natural-compare-lite@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/natural-compare-lite/-/natural-compare-lite-1.4.0.tgz#17b09581988979fddafe0201e931ba933c96cbb4" + integrity sha512-Tj+HTDSJJKaZnfiuw+iaF9skdPpTo2GtEly5JHnWV/hfv2Qj/9RKsGISQtLh2ox3l5EAGw487hnBee0sIJ6v2g== + natural-compare@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" @@ -4100,6 +4390,11 @@ type@^2.7.2: resolved "https://registry.yarnpkg.com/type/-/type-2.7.2.tgz#2376a15a3a28b1efa0f5350dcf72d24df6ef98d0" integrity sha512-dzlvlNlt6AXU7EBSfpAscydQ7gXB+pPGsPnfJnZpiNJBDj7IaJzQlBZYGdEi4R9HmPdBv2XmWJ6YUtoTa7lmCw== +typescript@5.0.4: + version "5.0.4" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.0.4.tgz#b217fd20119bd61a94d4011274e0ab369058da3b" + integrity sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw== + undertaker-registry@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/undertaker-registry/-/undertaker-registry-1.0.1.tgz#5e4bda308e4a8a2ae584f9b9a4359a499825cc50" -- 2.50.1.windows.1 From 66225e7f80562adda75956c442f9eee33ef72b97 Mon Sep 17 00:00:00 2001 From: Nick Gerleman Date: Tue, 2 May 2023 17:56:33 -0700 Subject: [PATCH 3/3] Add types to scripts and config files Summary: Now that we have some TypeScript infra set up, move scripts (mainly the benchmarking one) and config files to TypeScript. Starts to move away a bit from the magic globals used in the JS environment. Differential Revision: D45511176 fbshipit-source-id: 541b967a276d2894e68b505169fc69096589d8c4 --- javascript/{jest.config.js => jest.config.ts} | 11 +- javascript/jest.setup.js | 24 -- javascript/jest.setup.ts | 24 ++ javascript/{just.config.js => just.config.ts} | 52 ++-- javascript/package.json | 5 + ...GBenchmark.test.js => YGBenchmark.test.ts} | 17 +- javascript/tests/YGMeasureCacheTest.test.js | 2 + javascript/tests/YGMeasureTest.test.js | 10 +- javascript/tests/bin/run-bench.ts | 67 +++++ javascript/tests/run-bench.js | 70 ------ .../{tools.js => tools/MeasureCounter.ts} | 28 ++- javascript/tests/tools/globals.ts | 27 ++ javascript/yarn.lock | 238 ++++++++++++++++++ 13 files changed, 438 insertions(+), 137 deletions(-) rename javascript/{jest.config.js => jest.config.ts} (56%) delete mode 100644 javascript/jest.setup.js create mode 100644 javascript/jest.setup.ts rename javascript/{just.config.js => just.config.ts} (71%) rename javascript/tests/Benchmarks/{YGBenchmark.test.js => YGBenchmark.test.ts} (83%) create mode 100644 javascript/tests/bin/run-bench.ts delete mode 100644 javascript/tests/run-bench.js rename javascript/tests/{tools.js => tools/MeasureCounter.ts} (67%) create mode 100644 javascript/tests/tools/globals.ts diff --git a/javascript/jest.config.js b/javascript/jest.config.ts similarity index 56% rename from javascript/jest.config.js rename to javascript/jest.config.ts index b1c4e027..62e9f159 100644 --- a/javascript/jest.config.js +++ b/javascript/jest.config.ts @@ -7,8 +7,11 @@ * @format */ -module.exports = { - setupFiles: ["./jest.setup.js", "./tests/tools.js"], - testRegex: "/tests/.*\\.test\\.js$", - watchman: false, +import type { Config } from "jest"; + +const config: Config = { + setupFiles: ["./jest.setup.ts"], + testRegex: "/tests/.*\\.test\\.[jt]s$", }; + +export default config; diff --git a/javascript/jest.setup.js b/javascript/jest.setup.js deleted file mode 100644 index b1bbfc79..00000000 --- a/javascript/jest.setup.js +++ /dev/null @@ -1,24 +0,0 @@ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -module.exports = async () => { - if (process.env["SYNC"] == true && process.env["WASM"] == true) { - global.Yoga = require("./dist/entrypoint/wasm-sync"); - } else if (process.env["SYNC"] == true) { - global.Yoga = require("./dist/entrypoint/asmjs-sync"); - } else if (process.env["WASM"] == true) { - global.Yoga = await require("./dist/entrypoint/wasm-async").loadYoga(); - } else { - global.Yoga = await require("./dist/entrypoint/asmjs-async").loadYoga(); - } -}; - -Object.defineProperty(global, "YGBENCHMARK", { - get: () => global.test, -}); diff --git a/javascript/jest.setup.ts b/javascript/jest.setup.ts new file mode 100644 index 00000000..72dd73fd --- /dev/null +++ b/javascript/jest.setup.ts @@ -0,0 +1,24 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @format + */ + +module.exports = async () => { + if (process.env["SYNC"] === "1" && process.env["WASM"] === "1") { + globalThis.Yoga = require("./dist/entrypoint/wasm-sync"); + } else if (process.env["SYNC"] === "1") { + globalThis.Yoga = require("./dist/entrypoint/asmjs-sync"); + } else if (process.env["WASM"] === "1") { + globalThis.Yoga = await require("./dist/entrypoint/wasm-async").loadYoga(); + } else { + globalThis.Yoga = await require("./dist/entrypoint/asmjs-async").loadYoga(); + } +}; + +Object.defineProperty(globalThis, "YGBENCHMARK", { + get: () => globalThis.test, +}); diff --git a/javascript/just.config.js b/javascript/just.config.ts similarity index 71% rename from javascript/just.config.js rename to javascript/just.config.ts index df09aedf..f52c2ee1 100644 --- a/javascript/just.config.js +++ b/javascript/just.config.ts @@ -7,7 +7,7 @@ * @format */ -const { +import { argv, cleanTask, copyTask, @@ -20,10 +20,11 @@ const { spawn, task, tscTask, -} = require("just-scripts"); +} from "just-scripts"; -const glob = require("glob"); -const which = require("which"); +import glob from "glob"; +import path from "path"; +import which from "which"; const node = process.execPath; @@ -40,19 +41,22 @@ task( ) ); -function defineFlavor(flavor, env) { +function defineFlavor(flavor: string, env: NodeJS.ProcessEnv) { task(`cmake-build:${flavor}`, cmakeBuildTask({ targets: [flavor] })); - task(`jest:${flavor}`, jestTask({ env })); + task( + `jest:${flavor}`, + jestTask({ config: path.join(__dirname, "jest.config.ts"), env }) + ); task( `test:${flavor}`, series("prepare-for-build", `cmake-build:${flavor}`, `jest:${flavor}`) ); } -defineFlavor("asmjs-async", { WASM: 0, SYNC: 0 }); -defineFlavor("asmjs-sync", { WASM: 0, SYNC: 1 }); -defineFlavor("wasm-async", { WASM: 1, SYNC: 0 }); -defineFlavor("wasm-sync", { WASM: 1, SYNC: 1 }); +defineFlavor("asmjs-async", { WASM: "0", SYNC: "0" }); +defineFlavor("asmjs-sync", { WASM: "0", SYNC: "1" }); +defineFlavor("wasm-async", { WASM: "1", SYNC: "0" }); +defineFlavor("wasm-sync", { WASM: "1", SYNC: "1" }); task("cmake-build:all", cmakeBuildTask()); task( @@ -85,13 +89,18 @@ task( task( "lint", parallel( - clangFormatTask({ fix: argv().fix }), - eslintTask({ fix: argv().fix }), - tscTask() + tscTask(), + series( + eslintTask({ fix: argv().fix }), + clangFormatTask({ fix: argv().fix }) + ) ) ); -function babelTransformTask(opts) { +function babelTransformTask(opts: { + paths: ReadonlyArray; + dest: string; +}) { return () => { const args = [...opts.paths, "--source-maps", "--out-dir", opts.dest]; logger.info(`Transforming [${opts.paths.join(",")}] to '${opts.dest}'`); @@ -102,11 +111,14 @@ function babelTransformTask(opts) { function runBenchTask() { return () => { - const files = glob.sync("./tests/Benchmarks/**/*.js"); - const args = ["./tests/run-bench.js", ...files]; + const files = glob.sync("./tests/Benchmarks/**/*"); + const args = ["./tests/bin/run-bench.ts", ...files]; logger.info(args.join(" ")); - return spawn(node, args, { stdio: "inherit" }); + return spawn(node, args, { + stdio: "inherit", + env: { NODE_OPTIONS: "-r ts-node/register" }, + }); }; } @@ -128,7 +140,7 @@ function emcmakeGenerateTask() { }; } -function cmakeBuildTask(opts) { +function cmakeBuildTask(opts?: { targets?: ReadonlyArray }) { return () => { const cmake = which.sync("cmake"); const args = [ @@ -142,10 +154,10 @@ function cmakeBuildTask(opts) { }; } -function clangFormatTask(opts) { +function clangFormatTask(opts?: { fix?: boolean }) { return () => { const args = [ - ...(opts.fix ? ["-i"] : ["--dry-run", "--Werror"]), + ...(opts?.fix ? ["-i"] : ["--dry-run", "--Werror"]), ...glob.sync("**/*.{h,hh,hpp,c,cpp,cc,m,mm}"), ]; logger.info(["clang-format", ...args].join(" ")); diff --git a/javascript/package.json b/javascript/package.json index bf3f8f18..7aa94eec 100644 --- a/javascript/package.json +++ b/javascript/package.json @@ -43,6 +43,10 @@ "@babel/eslint-parser": "^7.19.1", "@babel/preset-env": "^7.20.2", "@babel/preset-typescript": "^7.21.4", + "@types/glob": "^8.1.0", + "@types/jest": "^29.5.1", + "@types/node": "^16.18.25", + "@types/which": "^3.0.0", "@typescript-eslint/eslint-plugin": "^5.30.5", "@typescript-eslint/parser": "^5.30.5", "clang-format": "^1.8.0", @@ -54,6 +58,7 @@ "jest": "^29.3.1", "just-scripts": "^2.1.0", "prettier": "^2.4.1", + "ts-node": "^10.9.1", "typescript": "5.0.4", "which": "^3.0.0" } diff --git a/javascript/tests/Benchmarks/YGBenchmark.test.js b/javascript/tests/Benchmarks/YGBenchmark.test.ts similarity index 83% rename from javascript/tests/Benchmarks/YGBenchmark.test.js rename to javascript/tests/Benchmarks/YGBenchmark.test.ts index d41bfe6c..384530cf 100644 --- a/javascript/tests/Benchmarks/YGBenchmark.test.js +++ b/javascript/tests/Benchmarks/YGBenchmark.test.ts @@ -5,6 +5,9 @@ * LICENSE file in the root directory of this source tree. */ +import { getMeasureCounter } from "../tools/MeasureCounter"; +import { Yoga, YGBENCHMARK } from "../tools/globals"; + const ITERATIONS = 2000; YGBENCHMARK("Stack with flex", () => { @@ -12,7 +15,7 @@ YGBENCHMARK("Stack with flex", () => { root.setWidth(100); root.setHeight(100); - const measureCounter = getMeasureCounter(Yoga); + const measureCounter = getMeasureCounter(); for (let i = 0; i < ITERATIONS; i++) { const child = Yoga.Node.create(); @@ -21,14 +24,14 @@ YGBENCHMARK("Stack with flex", () => { root.insertChild(child, 0); } - root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); + root.calculateLayout(undefined, undefined, Yoga.DIRECTION_LTR); root.freeRecursive(); }); YGBENCHMARK("Align stretch in undefined axis", () => { const root = Yoga.Node.create(); - const measureCounter = getMeasureCounter(Yoga); + const measureCounter = getMeasureCounter(); for (let i = 0; i < ITERATIONS; i++) { const child = Yoga.Node.create(); @@ -37,14 +40,14 @@ YGBENCHMARK("Align stretch in undefined axis", () => { root.insertChild(child, 0); } - root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); + root.calculateLayout(undefined, undefined, Yoga.DIRECTION_LTR); root.freeRecursive(); }); YGBENCHMARK("Nested flex", () => { const root = Yoga.Node.create(); - const measureCounter = getMeasureCounter(Yoga); + const measureCounter = getMeasureCounter(); const iterations = Math.pow(ITERATIONS, 1 / 2); @@ -61,7 +64,7 @@ YGBENCHMARK("Nested flex", () => { } } - root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); + root.calculateLayout(undefined, undefined, Yoga.DIRECTION_LTR); root.freeRecursive(); }); @@ -104,6 +107,6 @@ YGBENCHMARK("Huge nested layout", () => { } } - root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); + root.calculateLayout(undefined, undefined, Yoga.DIRECTION_LTR); root.freeRecursive(); }); diff --git a/javascript/tests/YGMeasureCacheTest.test.js b/javascript/tests/YGMeasureCacheTest.test.js index 08c4e485..5f1ab3e0 100644 --- a/javascript/tests/YGMeasureCacheTest.test.js +++ b/javascript/tests/YGMeasureCacheTest.test.js @@ -5,6 +5,8 @@ * LICENSE file in the root directory of this source tree. */ +import { getMeasureCounterMax } from "./tools/MeasureCounter"; + test("measure_once_single_flexible_child", () => { const root = Yoga.Node.create(); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); diff --git a/javascript/tests/YGMeasureTest.test.js b/javascript/tests/YGMeasureTest.test.js index b269ffb6..7703d223 100644 --- a/javascript/tests/YGMeasureTest.test.js +++ b/javascript/tests/YGMeasureTest.test.js @@ -5,12 +5,14 @@ * LICENSE file in the root directory of this source tree. */ +import { getMeasureCounter } from "./tools/MeasureCounter"; + test("dont_measure_single_grow_shrink_child", () => { const root = Yoga.Node.create(); root.setWidth(100); root.setHeight(100); - const measureCounter = getMeasureCounter(Yoga, null, 100, 100); + const measureCounter = getMeasureCounter(null, 100, 100); const root_child0 = Yoga.Node.create(); root_child0.setMeasureFunc(measureCounter.inc); @@ -25,9 +27,9 @@ test("dont_measure_single_grow_shrink_child", () => { }); test("dont_fail_with_incomplete_measure_dimensions", () => { - const heightOnlyCallback = getMeasureCounter(Yoga, () => ({ height: 10 })); - const widthOnlyCallback = getMeasureCounter(Yoga, () => ({ width: 10 })); - const emptyCallback = getMeasureCounter(Yoga, () => ({})); + const heightOnlyCallback = getMeasureCounter(() => ({ height: 10 })); + const widthOnlyCallback = getMeasureCounter(() => ({ width: 10 })); + const emptyCallback = getMeasureCounter(() => ({})); const root = Yoga.Node.create(); root.setWidth(100); diff --git a/javascript/tests/bin/run-bench.ts b/javascript/tests/bin/run-bench.ts new file mode 100644 index 00000000..f71d5cf6 --- /dev/null +++ b/javascript/tests/bin/run-bench.ts @@ -0,0 +1,67 @@ +#!/usr/bin/env ts-node +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @format + */ + +import path from "path"; + +const WARMUP_ITERATIONS = 3; +const BENCHMARK_ITERATIONS = 10; + +const testFiles = process.argv.slice(2); + +const testResults = new Map>(); + +for (const type of ["asmjs", "wasm"]) { + globalThis.Yoga = require(type === "asmjs" + ? "../../dist/entrypoint/asmjs-sync" + : "../../dist/entrypoint/wasm-sync"); + + for (const file of testFiles) { + globalThis.YGBENCHMARK = (name: string, fn: () => void) => { + let testEntry = testResults.get(name); + + if (testEntry === undefined) + testResults.set(name, (testEntry = new Map())); + + for (let t = 0; t < WARMUP_ITERATIONS; ++t) fn(); + + const start = Date.now(); + + for (let t = 0; t < BENCHMARK_ITERATIONS; ++t) fn(); + + const end = Date.now(); + + testEntry.set(type, (end - start) / BENCHMARK_ITERATIONS); + }; + + const modulePath = path.resolve(file); + + delete require.cache[require.resolve("../tools/globals")]; + delete require.cache[modulePath]; + require(modulePath); + } +} + +console.log( + `Note: those tests are independants; there is no time relation to be expected between them` +); + +for (const [name, results] of testResults) { + console.log(); + + const min = Math.min(Infinity, ...results.values()); + + console.log(name); + + for (const [type, result] of results) { + console.log( + ` - ${type}: ${result}ms (${Math.round((result / min) * 10000) / 100}%)` + ); + } +} diff --git a/javascript/tests/run-bench.js b/javascript/tests/run-bench.js deleted file mode 100644 index 57940928..00000000 --- a/javascript/tests/run-bench.js +++ /dev/null @@ -1,70 +0,0 @@ -#!/usr/bin/env node -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -require(`./tools`); - -const fs = require(`fs`); -const vm = require(`vm`); - -const WARMUP_ITERATIONS = 3; -const BENCHMARK_ITERATIONS = 10; - -const testFiles = process.argv.slice(2).map((file) => { - return fs.readFileSync(file).toString(); -}); - -const testResults = new Map(); - -for (const type of ["asmjs", "wasm"]) { - for (const file of testFiles) { - vm.runInNewContext( - file, - Object.assign(Object.create(global), { - Yoga: require(type === "asmjs" - ? "../dist/entrypoint/asmjs-sync" - : "../dist/entrypoint/wasm-sync"), - YGBENCHMARK: function (name, fn) { - let testEntry = testResults.get(name); - - if (testEntry === undefined) - testResults.set(name, (testEntry = new Map())); - - for (let t = 0; t < WARMUP_ITERATIONS; ++t) fn(); - - const start = Date.now(); - - for (let t = 0; t < BENCHMARK_ITERATIONS; ++t) fn(); - - const end = Date.now(); - - testEntry.set(type, (end - start) / BENCHMARK_ITERATIONS); - }, - }) - ); - } -} - -console.log( - `Note: those tests are independants; there is no time relation to be expected between them` -); - -for (const [name, results] of testResults) { - console.log(); - - const min = Math.min(Infinity, ...results.values()); - - console.log(name); - - for (const [type, result] of results) { - console.log( - ` - ${type}: ${result}ms (${Math.round((result / min) * 10000) / 100}%)` - ); - } -} diff --git a/javascript/tests/tools.js b/javascript/tests/tools/MeasureCounter.ts similarity index 67% rename from javascript/tests/tools.js rename to javascript/tests/tools/MeasureCounter.ts index a72464ee..20570631 100644 --- a/javascript/tests/tools.js +++ b/javascript/tests/tools/MeasureCounter.ts @@ -7,7 +7,19 @@ * @format */ -global.getMeasureCounter = function (Yoga, cb, staticWidth, staticHeight) { +import type { MeasureFunction } from "yoga-layout"; +import { Yoga } from "./globals"; + +export type MeasureCounter = { + inc: MeasureFunction; + get: () => number; +}; + +export function getMeasureCounter( + cb?: MeasureFunction | null, + staticWidth = 0, + staticHeight = 0 +): MeasureCounter { let counter = 0; return { @@ -23,10 +35,10 @@ global.getMeasureCounter = function (Yoga, cb, staticWidth, staticHeight) { return counter; }, }; -}; +} -global.getMeasureCounterMax = function (Yoga) { - return getMeasureCounter(Yoga, (width, widthMode, height, heightMode) => { +export function getMeasureCounterMax(): MeasureCounter { + return getMeasureCounter((width, widthMode, height, heightMode) => { const measuredWidth = widthMode === Yoga.MEASURE_MODE_UNDEFINED ? 10 : width; const measuredHeight = @@ -34,10 +46,10 @@ global.getMeasureCounterMax = function (Yoga) { return { width: measuredWidth, height: measuredHeight }; }); -}; +} -global.getMeasureCounterMin = function (Yoga) { - return getMeasureCounter(Yoga, (width, widthMode, height, heightMode) => { +export function getMeasureCounterMin(): MeasureCounter { + return getMeasureCounter((width, widthMode, height, heightMode) => { const measuredWidth = widthMode === Yoga.MEASURE_MODE_UNDEFINED || (widthMode == Yoga.MEASURE_MODE_AT_MOST && width > 10) @@ -51,4 +63,4 @@ global.getMeasureCounterMin = function (Yoga) { return { width: measuredWidth, height: measuredHeight }; }); -}; +} diff --git a/javascript/tests/tools/globals.ts b/javascript/tests/tools/globals.ts new file mode 100644 index 00000000..1f5131bd --- /dev/null +++ b/javascript/tests/tools/globals.ts @@ -0,0 +1,27 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +import type { Yoga } from "yoga-layout"; + +declare global { + // eslint-disable-next-line no-var + var Yoga: Yoga | undefined; + // eslint-disable-next-line no-var + var YGBENCHMARK: (title: string, fn: () => void) => void; +} + +if (globalThis.Yoga === undefined) { + throw new Error('Expected "Yoga" global to be set'); +} +if (globalThis.YGBENCHMARK === undefined) { + throw new Error('Expected "YGBENCHMARK" global to be set'); +} + +const yoga = globalThis.Yoga; +const benchmark = globalThis.YGBENCHMARK; + +export { yoga as Yoga, benchmark as YGBENCHMARK }; diff --git a/javascript/yarn.lock b/javascript/yarn.lock index 2f3b788d..4acedeb3 100644 --- a/javascript/yarn.lock +++ b/javascript/yarn.lock @@ -1147,6 +1147,13 @@ resolved "https://registry.yarnpkg.com/@colors/colors/-/colors-1.5.0.tgz#bb504579c1cae923e6576a4f5da43d25f97bdbd9" integrity sha512-ooWCrlZP11i8GImSjTHYHLkvFDP48nS4+204nGb1RiX/WXYHmJA2III9/e2DWVabCESdW7hBAEzHRqUn9OUVvQ== +"@cspotcode/source-map-support@^0.8.0": + version "0.8.1" + resolved "https://registry.yarnpkg.com/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz#00629c35a688e05a88b1cda684fb9d5e73f000a1" + integrity sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw== + dependencies: + "@jridgewell/trace-mapping" "0.3.9" + "@eslint-community/eslint-utils@^4.2.0": version "4.4.0" resolved "https://registry.yarnpkg.com/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz#a23514e8fb9af1269d5f7788aa556798d61c6b59" @@ -1272,6 +1279,13 @@ dependencies: jest-get-type "^29.2.0" +"@jest/expect-utils@^29.5.0": + version "29.5.0" + resolved "https://registry.yarnpkg.com/@jest/expect-utils/-/expect-utils-29.5.0.tgz#f74fad6b6e20f924582dc8ecbf2cb800fe43a036" + integrity sha512-fmKzsidoXQT2KwnrwE0SQq3uj8Z763vzR8LnLBwC2qYWEFpjX8daRsk6rHUM1QvNlEW/UJXNXm59ztmJJWs2Mg== + dependencies: + jest-get-type "^29.4.3" + "@jest/expect@^29.3.1": version "29.3.1" resolved "https://registry.yarnpkg.com/@jest/expect/-/expect-29.3.1.tgz#456385b62894349c1d196f2d183e3716d4c6a6cd" @@ -1339,6 +1353,13 @@ dependencies: "@sinclair/typebox" "^0.24.1" +"@jest/schemas@^29.4.3": + version "29.4.3" + resolved "https://registry.yarnpkg.com/@jest/schemas/-/schemas-29.4.3.tgz#39cf1b8469afc40b6f5a2baaa146e332c4151788" + integrity sha512-VLYKXQmtmuEz6IxJsrZwzG9NvtkQsWNnWMsKxqWNu3+CnfzJQhp0WDDKWLVV9hLKr0l3SLLFRqcYHjhtyuDVxg== + dependencies: + "@sinclair/typebox" "^0.25.16" + "@jest/source-map@^29.2.0": version "29.2.0" resolved "https://registry.yarnpkg.com/@jest/source-map/-/source-map-29.2.0.tgz#ab3420c46d42508dcc3dc1c6deee0b613c235744" @@ -1401,6 +1422,18 @@ "@types/yargs" "^17.0.8" chalk "^4.0.0" +"@jest/types@^29.5.0": + version "29.5.0" + resolved "https://registry.yarnpkg.com/@jest/types/-/types-29.5.0.tgz#f59ef9b031ced83047c67032700d8c807d6e1593" + integrity sha512-qbu7kN6czmVRc3xWFQcAN03RAUamgppVUdXrvl1Wr3jlNF93o9mJbGcDWrwGB6ht44u7efB1qCFgVQmca24Uog== + dependencies: + "@jest/schemas" "^29.4.3" + "@types/istanbul-lib-coverage" "^2.0.0" + "@types/istanbul-reports" "^3.0.0" + "@types/node" "*" + "@types/yargs" "^17.0.8" + chalk "^4.0.0" + "@jridgewell/gen-mapping@^0.1.0": version "0.1.1" resolved "https://registry.yarnpkg.com/@jridgewell/gen-mapping/-/gen-mapping-0.1.1.tgz#e5d2e450306a9491e3bd77e323e38d7aff315996" @@ -1423,6 +1456,11 @@ resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz#2203b118c157721addfe69d47b70465463066d78" integrity sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w== +"@jridgewell/resolve-uri@^3.0.3": + version "3.1.1" + resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz#c08679063f279615a3326583ba3a90d1d82cc721" + integrity sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA== + "@jridgewell/set-array@^1.0.0", "@jridgewell/set-array@^1.0.1": version "1.1.2" resolved "https://registry.yarnpkg.com/@jridgewell/set-array/-/set-array-1.1.2.tgz#7c6cf998d6d20b914c0a55a91ae928ff25965e72" @@ -1433,6 +1471,14 @@ resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz#add4c98d341472a289190b424efbdb096991bb24" integrity sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw== +"@jridgewell/trace-mapping@0.3.9": + version "0.3.9" + resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz#6534fd5933a53ba7cbf3a17615e273a0d1273ff9" + integrity sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ== + dependencies: + "@jridgewell/resolve-uri" "^3.0.3" + "@jridgewell/sourcemap-codec" "^1.4.10" + "@jridgewell/trace-mapping@^0.3.12", "@jridgewell/trace-mapping@^0.3.15", "@jridgewell/trace-mapping@^0.3.8", "@jridgewell/trace-mapping@^0.3.9": version "0.3.17" resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.17.tgz#793041277af9073b0951a7fe0f0d8c4c98c36985" @@ -1508,6 +1554,11 @@ resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.24.51.tgz#645f33fe4e02defe26f2f5c0410e1c094eac7f5f" integrity sha512-1P1OROm/rdubP5aFDSZQILU0vrLCJ4fvHt6EoqHEM+2D/G5MK3bIaymUKLit8Js9gbns5UyJnkP/TZROLw4tUA== +"@sinclair/typebox@^0.25.16": + version "0.25.24" + resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.25.24.tgz#8c7688559979f7079aacaf31aa881c3aa410b718" + integrity sha512-XJfwUVUKDHF5ugKwIcxEgc9k8b7HbznCp6eUfWgu710hMPNIO4aw4/zB5RogDQz8nd6gyCDpU9O/m6qYEWY6yQ== + "@sinonjs/commons@^1.7.0": version "1.8.6" resolved "https://registry.yarnpkg.com/@sinonjs/commons/-/commons-1.8.6.tgz#80c516a4dc264c2a69115e7578d62581ff455ed9" @@ -1522,6 +1573,26 @@ dependencies: "@sinonjs/commons" "^1.7.0" +"@tsconfig/node10@^1.0.7": + version "1.0.9" + resolved "https://registry.yarnpkg.com/@tsconfig/node10/-/node10-1.0.9.tgz#df4907fc07a886922637b15e02d4cebc4c0021b2" + integrity sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA== + +"@tsconfig/node12@^1.0.7": + version "1.0.11" + resolved "https://registry.yarnpkg.com/@tsconfig/node12/-/node12-1.0.11.tgz#ee3def1f27d9ed66dac6e46a295cffb0152e058d" + integrity sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag== + +"@tsconfig/node14@^1.0.0": + version "1.0.3" + resolved "https://registry.yarnpkg.com/@tsconfig/node14/-/node14-1.0.3.tgz#e4386316284f00b98435bf40f72f75a09dabf6c1" + integrity sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow== + +"@tsconfig/node16@^1.0.2": + version "1.0.3" + resolved "https://registry.yarnpkg.com/@tsconfig/node16/-/node16-1.0.3.tgz#472eaab5f15c1ffdd7f8628bd4c4f753995ec79e" + integrity sha512-yOlFc+7UtL/89t2ZhjPvvB/DeAr3r+Dq58IgzsFkOAvVC6NMJXmCGjbptdXdR9qsX7pKcTL+s87FtYREi2dEEQ== + "@types/babel__core@^7.1.14": version "7.1.20" resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.1.20.tgz#e168cdd612c92a2d335029ed62ac94c95b362359" @@ -1555,6 +1626,14 @@ dependencies: "@babel/types" "^7.3.0" +"@types/glob@^8.1.0": + version "8.1.0" + resolved "https://registry.yarnpkg.com/@types/glob/-/glob-8.1.0.tgz#b63e70155391b0584dce44e7ea25190bbc38f2fc" + integrity sha512-IO+MJPVhoqz+28h1qLAcBEH2+xHMK6MTyHJc7MTnnYb6wsoLR29POVGJ7LycmVXIqyy/4/2ShP5sUwTXuOwb/w== + dependencies: + "@types/minimatch" "^5.1.2" + "@types/node" "*" + "@types/graceful-fs@^4.1.3": version "4.1.5" resolved "https://registry.yarnpkg.com/@types/graceful-fs/-/graceful-fs-4.1.5.tgz#21ffba0d98da4350db64891f92a9e5db3cdb4e15" @@ -1581,11 +1660,24 @@ dependencies: "@types/istanbul-lib-report" "*" +"@types/jest@^29.5.1": + version "29.5.1" + resolved "https://registry.yarnpkg.com/@types/jest/-/jest-29.5.1.tgz#83c818aa9a87da27d6da85d3378e5a34d2f31a47" + integrity sha512-tEuVcHrpaixS36w7hpsfLBLpjtMRJUE09/MHXn923LOVojDwyC14cWcfc0rDs0VEfUyYmt/+iX1kxxp+gZMcaQ== + dependencies: + expect "^29.0.0" + pretty-format "^29.0.0" + "@types/json-schema@^7.0.9": version "7.0.11" resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.11.tgz#d421b6c527a3037f7c84433fd2c4229e016863d3" integrity sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ== +"@types/minimatch@^5.1.2": + version "5.1.2" + resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-5.1.2.tgz#07508b45797cb81ec3f273011b054cd0755eddca" + integrity sha512-K0VQKziLUWkVKiRVrx4a40iPaxTUefQmjtkQofBkYRcoaaL/8rhwDWww9qWbrgicNOgnpIsMxyNIUM4+n6dUIA== + "@types/node@*": version "18.11.17" resolved "https://registry.yarnpkg.com/@types/node/-/node-18.11.17.tgz#5c009e1d9c38f4a2a9d45c0b0c493fe6cdb4bcb5" @@ -1596,6 +1688,11 @@ resolved "https://registry.yarnpkg.com/@types/node/-/node-12.20.24.tgz#c37ac69cb2948afb4cef95f424fa0037971a9a5c" integrity sha512-yxDeaQIAJlMav7fH5AQqPH1u8YIuhYJXYBzxaQ4PifsU0GDO38MSdmEDeRlIxrKbC6NbEaaEHDanWb+y30U8SQ== +"@types/node@^16.18.25": + version "16.18.25" + resolved "https://registry.yarnpkg.com/@types/node/-/node-16.18.25.tgz#8863940fefa1234d3fcac7a4b7a48a6c992d67af" + integrity sha512-rUDO6s9Q/El1R1I21HG4qw/LstTHCPO/oQNAwI/4b2f9EWvMnqt4d3HJwPMawfZ3UvodB8516Yg+VAq54YM+eA== + "@types/prettier@^2.1.5": version "2.7.2" resolved "https://registry.yarnpkg.com/@types/prettier/-/prettier-2.7.2.tgz#6c2324641cc4ba050a8c710b2b251b377581fbf0" @@ -1611,6 +1708,11 @@ resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-2.0.1.tgz#20f18294f797f2209b5f65c8e3b5c8e8261d127c" integrity sha512-Hl219/BT5fLAaz6NDkSuhzasy49dwQS/DSdu4MdggFB8zcXv7vflBI3xp7FEmkmdDkBUI2bPUNeMttp2knYdxw== +"@types/which@^3.0.0": + version "3.0.0" + resolved "https://registry.yarnpkg.com/@types/which/-/which-3.0.0.tgz#849afdd9fdcb0b67339b9cfc80fa6ea4e0253fc5" + integrity sha512-ASCxdbsrwNfSMXALlC3Decif9rwDMu+80KGp5zI2RLRotfMsTv7fHL8W8VDp24wymzDyIFudhUeSCugrgRFfHQ== + "@types/yargs-parser@*": version "21.0.0" resolved "https://registry.yarnpkg.com/@types/yargs-parser/-/yargs-parser-21.0.0.tgz#0c60e537fa790f5f9472ed2776c2b71ec117351b" @@ -1760,6 +1862,16 @@ acorn-jsx@^5.3.2: resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.3.2.tgz#7ed5bb55908b3b2f1bc55c6af1653bada7f07937" integrity sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ== +acorn-walk@^8.1.1: + version "8.2.0" + resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-8.2.0.tgz#741210f2e2426454508853a2f44d0ab83b7f69c1" + integrity sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA== + +acorn@^8.4.1: + version "8.8.2" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.8.2.tgz#1b2f25db02af965399b9776b0c2c391276d37c4a" + integrity sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw== + acorn@^8.8.0: version "8.8.1" resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.8.1.tgz#0a3f9cbecc4ec3bea6f0a80b66ae8dd2da250b73" @@ -1819,6 +1931,11 @@ anymatch@^3.0.3, anymatch@~3.1.2: normalize-path "^3.0.0" picomatch "^2.0.4" +arg@^4.1.0: + version "4.1.3" + resolved "https://registry.yarnpkg.com/arg/-/arg-4.1.3.tgz#269fc7ad5b8e42cb63c896d5666017261c144089" + integrity sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA== + argparse@^1.0.7: version "1.0.10" resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" @@ -2285,6 +2402,11 @@ core-js-compat@^3.25.1: dependencies: browserslist "^4.21.4" +create-require@^1.1.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/create-require/-/create-require-1.1.1.tgz#c1d7e8f1e5f6cfc9ff65f9cd352d37348756c333" + integrity sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ== + cross-spawn@^7.0.2, cross-spawn@^7.0.3: version "7.0.3" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6" @@ -2344,6 +2466,16 @@ diff-sequences@^29.3.1: resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-29.3.1.tgz#104b5b95fe725932421a9c6e5b4bef84c3f2249e" integrity sha512-hlM3QR272NXCi4pq+N4Kok4kOp6EsgOM3ZSpJI7Da3UAs+Ttsi8MRmB6trM/lhyzUxGfOgnpkHtgqm5Q/CTcfQ== +diff-sequences@^29.4.3: + version "29.4.3" + resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-29.4.3.tgz#9314bc1fabe09267ffeca9cbafc457d8499a13f2" + integrity sha512-ofrBgwpPhCD85kMKtE9RYFFq6OC1A89oW2vvgWZNCwxrUpRUILopY7lsYyMDSjc8g6U6aiO0Qubg6r4Wgt5ZnA== + +diff@^4.0.1: + version "4.0.2" + resolved "https://registry.yarnpkg.com/diff/-/diff-4.0.2.tgz#60f3aecb89d5fae520c11aa19efc2bb982aade7d" + integrity sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A== + dir-glob@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/dir-glob/-/dir-glob-3.0.1.tgz#56dbf73d992a4a93ba1584f4534063fd2e41717f" @@ -2603,6 +2735,17 @@ exit@^0.1.2: resolved "https://registry.yarnpkg.com/exit/-/exit-0.1.2.tgz#0632638f8d877cc82107d30a0fff1a17cba1cd0c" integrity sha512-Zk/eNKV2zbjpKzrsQ+n1G6poVbErQxJ0LBOJXaKZ1EViLzH+hrLu9cdXI4zw9dBQJslwBEpbQ2P1oS7nDxs6jQ== +expect@^29.0.0: + version "29.5.0" + resolved "https://registry.yarnpkg.com/expect/-/expect-29.5.0.tgz#68c0509156cb2a0adb8865d413b137eeaae682f7" + integrity sha512-yM7xqUrCO2JdpFo4XpM82t+PJBFybdqoQuJLDGeDX2ij8NZzqRHyu3Hp188/JX7SWqud+7t4MUdvcgGBICMHZg== + dependencies: + "@jest/expect-utils" "^29.5.0" + jest-get-type "^29.4.3" + jest-matcher-utils "^29.5.0" + jest-message-util "^29.5.0" + jest-util "^29.5.0" + expect@^29.3.1: version "29.3.1" resolved "https://registry.yarnpkg.com/expect/-/expect-29.3.1.tgz#92877aad3f7deefc2e3f6430dd195b92295554a6" @@ -3142,6 +3285,16 @@ jest-diff@^29.3.1: jest-get-type "^29.2.0" pretty-format "^29.3.1" +jest-diff@^29.5.0: + version "29.5.0" + resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-29.5.0.tgz#e0d83a58eb5451dcc1fa61b1c3ee4e8f5a290d63" + integrity sha512-LtxijLLZBduXnHSniy0WMdaHjmQnt3g5sa16W4p0HqukYTTsyTW3GD1q41TyGl5YFXj/5B2U6dlh5FM1LIMgxw== + dependencies: + chalk "^4.0.0" + diff-sequences "^29.4.3" + jest-get-type "^29.4.3" + pretty-format "^29.5.0" + jest-docblock@^29.2.0: version "29.2.0" resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-29.2.0.tgz#307203e20b637d97cee04809efc1d43afc641e82" @@ -3177,6 +3330,11 @@ jest-get-type@^29.2.0: resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-29.2.0.tgz#726646f927ef61d583a3b3adb1ab13f3a5036408" integrity sha512-uXNJlg8hKFEnDgFsrCjznB+sTxdkuqiCL6zMgA75qEbAJjJYTs9XPrvDctrEig2GDow22T/LvHgO57iJhXB/UA== +jest-get-type@^29.4.3: + version "29.4.3" + resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-29.4.3.tgz#1ab7a5207c995161100b5187159ca82dd48b3dd5" + integrity sha512-J5Xez4nRRMjk8emnTpWrlkyb9pfRQQanDrvWHhsR1+VUfbwxi30eVcZFlcdGInRibU4G5LwHXpI7IRHU0CY+gg== + jest-haste-map@^29.3.1: version "29.3.1" resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-29.3.1.tgz#af83b4347f1dae5ee8c2fb57368dc0bb3e5af843" @@ -3214,6 +3372,16 @@ jest-matcher-utils@^29.3.1: jest-get-type "^29.2.0" pretty-format "^29.3.1" +jest-matcher-utils@^29.5.0: + version "29.5.0" + resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-29.5.0.tgz#d957af7f8c0692c5453666705621ad4abc2c59c5" + integrity sha512-lecRtgm/rjIK0CQ7LPQwzCs2VwW6WAahA55YBuI+xqmhm7LAaxokSB8C97yJeYyT+HvQkH741StzpU41wohhWw== + dependencies: + chalk "^4.0.0" + jest-diff "^29.5.0" + jest-get-type "^29.4.3" + pretty-format "^29.5.0" + jest-message-util@^29.3.1: version "29.3.1" resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-29.3.1.tgz#37bc5c468dfe5120712053dd03faf0f053bd6adb" @@ -3229,6 +3397,21 @@ jest-message-util@^29.3.1: slash "^3.0.0" stack-utils "^2.0.3" +jest-message-util@^29.5.0: + version "29.5.0" + resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-29.5.0.tgz#1f776cac3aca332ab8dd2e3b41625435085c900e" + integrity sha512-Kijeg9Dag6CKtIDA7O21zNTACqD5MD/8HfIV8pdD94vFyFuer52SigdC3IQMhab3vACxXMiFk+yMHNdbqtyTGA== + dependencies: + "@babel/code-frame" "^7.12.13" + "@jest/types" "^29.5.0" + "@types/stack-utils" "^2.0.0" + chalk "^4.0.0" + graceful-fs "^4.2.9" + micromatch "^4.0.4" + pretty-format "^29.5.0" + slash "^3.0.0" + stack-utils "^2.0.3" + jest-mock@^29.3.1: version "29.3.1" resolved "https://registry.yarnpkg.com/jest-mock/-/jest-mock-29.3.1.tgz#60287d92e5010979d01f218c6b215b688e0f313e" @@ -3368,6 +3551,18 @@ jest-util@^29.3.1: graceful-fs "^4.2.9" picomatch "^2.2.3" +jest-util@^29.5.0: + version "29.5.0" + resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-29.5.0.tgz#24a4d3d92fc39ce90425311b23c27a6e0ef16b8f" + integrity sha512-RYMgG/MTadOr5t8KdhejfvUU82MxsCu5MF6KuDUHl+NuwzUt+Sm6jJWxTJVrDR1j5M/gJVCPKQEpWXY+yIQ6lQ== + dependencies: + "@jest/types" "^29.5.0" + "@types/node" "*" + chalk "^4.0.0" + ci-info "^3.2.0" + graceful-fs "^4.2.9" + picomatch "^2.2.3" + jest-validate@^29.3.1: version "29.3.1" resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-29.3.1.tgz#d56fefaa2e7d1fde3ecdc973c7f7f8f25eea704a" @@ -3650,6 +3845,11 @@ make-dir@^3.0.0: dependencies: semver "^6.0.0" +make-error@^1.1.1: + version "1.3.6" + resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.6.tgz#2eb2e37ea9b67c4891f684a1394799af484cf7a2" + integrity sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw== + make-iterator@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/make-iterator/-/make-iterator-1.0.1.tgz#29b33f312aa8f547c4a5e490f56afcec99133ad6" @@ -3971,6 +4171,15 @@ prettier@^2.4.1: resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.8.1.tgz#4e1fd11c34e2421bc1da9aea9bd8127cd0a35efc" integrity sha512-lqGoSJBQNJidqCHE80vqZJHWHRFoNYsSpP9AjFhlhi9ODCJA541svILes/+/1GM3VaL/abZi7cpFzOpdR9UPKg== +pretty-format@^29.0.0, pretty-format@^29.5.0: + version "29.5.0" + resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-29.5.0.tgz#283134e74f70e2e3e7229336de0e4fce94ccde5a" + integrity sha512-V2mGkI31qdttvTFX7Mt4efOqHXqJWMu4/r66Xh3Z3BwZaPfPJgp6/gbwoujRpPUtfEF6AUUWx3Jim3GCw5g/Qw== + dependencies: + "@jest/schemas" "^29.4.3" + ansi-styles "^5.0.0" + react-is "^18.0.0" + pretty-format@^29.3.1: version "29.3.1" resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-29.3.1.tgz#1841cac822b02b4da8971dacb03e8a871b4722da" @@ -4346,6 +4555,25 @@ to-regex-range@^5.0.1: dependencies: is-number "^7.0.0" +ts-node@^10.9.1: + version "10.9.1" + resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-10.9.1.tgz#e73de9102958af9e1f0b168a6ff320e25adcff4b" + integrity sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw== + dependencies: + "@cspotcode/source-map-support" "^0.8.0" + "@tsconfig/node10" "^1.0.7" + "@tsconfig/node12" "^1.0.7" + "@tsconfig/node14" "^1.0.0" + "@tsconfig/node16" "^1.0.2" + acorn "^8.4.1" + acorn-walk "^8.1.1" + arg "^4.1.0" + create-require "^1.1.0" + diff "^4.0.1" + make-error "^1.1.1" + v8-compile-cache-lib "^3.0.1" + yn "3.1.1" + tslib@^1.8.1: version "1.14.1" resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" @@ -4469,6 +4697,11 @@ uri-js@^4.2.2: dependencies: punycode "^2.1.0" +v8-compile-cache-lib@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz#6336e8d71965cb3d35a1bbb7868445a7c05264bf" + integrity sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg== + v8-to-istanbul@^9.0.1: version "9.0.1" resolved "https://registry.yarnpkg.com/v8-to-istanbul/-/v8-to-istanbul-9.0.1.tgz#b6f994b0b5d4ef255e17a0d17dc444a9f5132fa4" @@ -4595,6 +4828,11 @@ yargs@^17.3.1: y18n "^5.0.5" yargs-parser "^21.1.1" +yn@3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/yn/-/yn-3.1.1.tgz#1e87401a09d767c1d5eab26a6e4c185182d2eb50" + integrity sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q== + yocto-queue@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-0.1.0.tgz#0294eb3dee05028d31ee1a5fa2c556a6aaf10a1b" -- 2.50.1.windows.1