From 7113067c28855117d2330a08b9f37c3ced45d63d Mon Sep 17 00:00:00 2001 From: songbeibei Date: Mon, 22 Nov 2021 20:24:23 +0800 Subject: [PATCH 1/8] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=95=86=E6=A0=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- compiler/.eslintrc | 15 + compiler/compiler/.eslintrc | 104 + compiler/compiler/README.md | 81 + compiler/compiler/babel.config.js | 35 + compiler/compiler/build_declarations_file.js | 128 + compiler/compiler/build_parser.js | 48 + compiler/compiler/main.js | 154 + compiler/compiler/npm-install.js | 51 + compiler/compiler/package-lock.json | 5700 +++++++++++++++++ compiler/compiler/package.json | 46 + compiler/compiler/sample/app.ets | 24 + compiler/compiler/sample/manifest.json | 35 + compiler/compiler/sample/pages/home.ets | 46 + .../compiler/sample/pages/home_preview.ets | 56 + compiler/compiler/sample/pages/index.ets | 48 + .../sample/pages/testcases/component-01.ets | 34 + .../pages/testcases/componentGridTest.ets | 70 + .../pages/testcases/componentListTest.ets | 64 + .../sample/pages/testcases/constructor-01.ets | 36 + .../sample/pages/testcases/constructor-02.ets | 30 + .../sample/pages/testcases/constructor-03.ets | 30 + .../expected/component-01-expected.js | 27 + .../expected/constructor-01-expected.js | 34 + .../expected/constructor-02-expected.js | 29 + .../expected/constructor-03-expected.js | 29 + .../testcases/expected/link-01-expected.js | 52 + .../testcases/expected/new-01-expected.js | 25 + .../testcases/expected/new-02-expected.js | 25 + .../testcases/expected/new-03-expected.js | 30 + .../testcases/expected/new-04-expected.js | 30 + .../testcases/expected/struct-01-expected.js | 22 + .../testcases/expected/struct-02-expected.js | 20 + .../pages/testcases/forEachComplexModel.ets | 62 + .../pages/testcases/forEachSimpleModel.ets | 58 + .../compiler/sample/pages/testcases/image.ets | 34 + .../sample/pages/testcases/import-api-01.ets | 37 + .../sample/pages/testcases/link-01.ets | 52 + .../sample/pages/testcases/linkArrayModel.ets | 48 + .../sample/pages/testcases/linkPropCombo.ets | 49 + .../pages/testcases/linkSimpleModel.ets | 41 + .../sample/pages/testcases/new-01.ets | 31 + .../sample/pages/testcases/new-0101.ets | 31 + .../sample/pages/testcases/new-02.ets | 30 + .../sample/pages/testcases/new-03.ets | 38 + .../sample/pages/testcases/new-04.ets | 39 + .../sample/pages/testcases/onclicktest.ets | 55 + .../pages/testcases/propSimpleModel.ets | 62 + .../pages/testcases/showcaseCovid19.ets | 3577 +++++++++++ .../sample/pages/testcases/simpleText.ets | 84 + .../sample/pages/testcases/stacktestsuite.ets | 148 + .../pages/testcases/stateArrayReverse.ets | 72 + .../testcases/stateArrayReverseCustomView.ets | 94 + .../pages/testcases/stateComplexType.ets | 62 + .../pages/testcases/stateStateBindingProp.ets | 107 + .../sample/pages/testcases/struct-01.ets | 21 + .../sample/pages/testcases/struct-02.ets | 20 + compiler/compiler/sample/pages/todo.ets | 178 + compiler/compiler/src/compile_info.ts | 233 + compiler/compiler/src/component_map.ts | 455 ++ compiler/compiler/src/create.ts | 109 + compiler/compiler/src/gen_abc_plugin.ts | 123 + compiler/compiler/src/pre_define.ts | 173 + compiler/compiler/src/pre_process.ts | 44 + .../compiler/src/process_component_build.ts | 702 ++ .../compiler/src/process_component_class.ts | 400 ++ .../src/process_component_constructor.ts | 95 + .../compiler/src/process_component_member.ts | 899 +++ .../compiler/src/process_custom_component.ts | 393 ++ compiler/compiler/src/process_import.ts | 278 + .../compiler/src/process_system_module.ts | 20 + compiler/compiler/src/process_ui_syntax.ts | 410 ++ compiler/compiler/src/result_process.ts | 67 + compiler/compiler/src/utils.ts | 158 + compiler/compiler/src/validate_ui_syntax.ts | 802 +++ .../syntax_parser/src/parse_extend.peg | 26 + .../syntax_parser/src/syntax_parser.peg | 116 + compiler/compiler/test/README.md | 83 + compiler/compiler/test/pages/AMDComponent.ets | 31 + .../compiler/test/pages/DefaultComponent.ets | 31 + .../compiler/test/pages/ExportComponent.ets | 119 + .../test/pages/ExportStarComponent.ets | 17 + .../compiler/test/pages/LinkComponent.ets | 120 + .../test/pages/NamespaceComponent.ets | 63 + compiler/compiler/test/pages/TsModule.ts | 25 + compiler/compiler/test/test.ts | 67 + .../compiler/test/ut/animation/animation.ts | 119 + compiler/compiler/test/ut/build/build.ts | 59 + .../compiler/test/ut/component/component.ts | 68 + .../test/ut/component/customComponent.ts | 157 + compiler/compiler/test/ut/constructor/id.ts | 249 + compiler/compiler/test/ut/constructor/link.ts | 88 + .../test/ut/constructor/observedObjectLink.ts | 142 + compiler/compiler/test/ut/constructor/prop.ts | 91 + .../test/ut/constructor/provideConsume.ts | 130 + .../compiler/test/ut/constructor/state.ts | 121 + .../test/ut/customDialog/customDialog.ts | 159 + .../compiler/test/ut/decorator/builder.ts | 86 + compiler/compiler/test/ut/decorator/extend.ts | 85 + compiler/compiler/test/ut/decorator/watch.ts | 168 + .../test/ut/decorator/watchWithAnimateTo.ts | 148 + .../test/ut/geometryReader/geometryReader.ts | 58 + .../compiler/test/ut/gesture/panGestrue.ts | 279 + .../compiler/test/ut/gesture/pinchGesture.ts | 107 + .../test/ut/gesture/rotationGesture.ts | 108 + .../compiler/test/ut/gesture/tapGesture.ts | 177 + compiler/compiler/test/ut/import/importEts.ts | 408 ++ .../test/ut/import/importSystemApi.ts | 55 + compiler/compiler/test/ut/import/importTs.ts | 162 + .../test/ut/link/createLinkReference.ts | 186 + .../test/ut/preview/previewDecorator.ts | 138 + .../test/ut/render/forEach/forEach01.ts | 69 + .../test/ut/render/forEach/forEach02.ts | 64 + .../test/ut/render/forEach/forEach03.ts | 77 + .../test/ut/render/forEach/forEach04.ts | 65 + .../ut/render/forEach/forEachComplexModel.ts | 131 + .../ut/render/forEach/forEachSimpleModel.ts | 85 + compiler/compiler/test/ut/render/if/if.ts | 207 + .../test/ut/render/if/ifIncludeForEach.ts | 131 + compiler/compiler/test/ut/struct/struct_01.ts | 39 + compiler/compiler/test/ut/struct/struct_02.ts | 28 + .../compiler/test/ut/transition/transition.ts | 111 + compiler/compiler/tsconfig.json | 26 + compiler/compiler/uglify-source.js | 44 + compiler/compiler/webpack.config.js | 188 + compiler/sample/app.ets | 16 + compiler/sample/pages/home.ets | 16 + compiler/sample/pages/home_preview.ets | 16 + compiler/sample/pages/index.ets | 16 + .../sample/pages/testcases/component-01.ets | 15 + .../pages/testcases/componentGridTest.ets | 15 + .../pages/testcases/componentListTest.ets | 16 + .../sample/pages/testcases/constructor-01.ets | 16 + .../sample/pages/testcases/constructor-02.ets | 15 + .../sample/pages/testcases/constructor-03.ets | 15 + .../expected/component-01-expected.js | 16 + .../expected/constructor-01-expected.js | 16 + .../expected/constructor-02-expected.js | 15 + .../expected/constructor-03-expected.js | 15 + .../testcases/expected/link-01-expected.js | 16 + .../testcases/expected/new-01-expected.js | 15 + .../testcases/expected/new-02-expected.js | 15 + .../testcases/expected/new-03-expected.js | 15 + .../testcases/expected/new-04-expected.js | 15 + .../testcases/expected/struct-01-expected.js | 16 + .../testcases/expected/struct-02-expected.js | 16 + .../pages/testcases/forEachComplexModel.ets | 15 + .../pages/testcases/forEachSimpleModel.ets | 15 + compiler/sample/pages/testcases/image.ets | 16 + .../sample/pages/testcases/import-api-01.ets | 16 + compiler/sample/pages/testcases/link-01.ets | 16 + .../sample/pages/testcases/linkArrayModel.ets | 16 + .../sample/pages/testcases/linkPropCombo.ets | 16 + .../pages/testcases/linkSimpleModel.ets | 16 + compiler/sample/pages/testcases/new-01.ets | 16 + compiler/sample/pages/testcases/new-0101.ets | 16 + compiler/sample/pages/testcases/new-02.ets | 15 + compiler/sample/pages/testcases/new-03.ets | 15 + compiler/sample/pages/testcases/new-04.ets | 16 + .../sample/pages/testcases/onclicktest.ets | 14 + .../pages/testcases/propSimpleModel.ets | 15 + .../pages/testcases/showcaseCovid19.ets | 16 + .../sample/pages/testcases/simpleText.ets | 16 + .../sample/pages/testcases/stacktestsuite.ets | 14 + .../pages/testcases/stateArrayReverse.ets | 16 + .../testcases/stateArrayReverseCustomView.ets | 16 + .../pages/testcases/stateComplexType.ets | 16 + .../pages/testcases/stateStateBindingProp.ets | 16 + compiler/sample/pages/testcases/struct-01.ets | 15 + compiler/sample/pages/testcases/struct-02.ets | 16 + compiler/sample/pages/todo.ets | 16 + compiler/test/pages/AMDComponent.ets | 15 + compiler/test/pages/DefaultComponent.ets | 15 + compiler/test/pages/ExportComponent.ets | 16 + compiler/test/pages/ExportStarComponent.ets | 16 + compiler/test/pages/LinkComponent.ets | 15 + compiler/test/pages/NamespaceComponent.ets | 15 + 176 files changed, 23868 insertions(+) create mode 100644 compiler/compiler/.eslintrc create mode 100644 compiler/compiler/README.md create mode 100644 compiler/compiler/babel.config.js create mode 100644 compiler/compiler/build_declarations_file.js create mode 100644 compiler/compiler/build_parser.js create mode 100644 compiler/compiler/main.js create mode 100644 compiler/compiler/npm-install.js create mode 100644 compiler/compiler/package-lock.json create mode 100644 compiler/compiler/package.json create mode 100644 compiler/compiler/sample/app.ets create mode 100644 compiler/compiler/sample/manifest.json create mode 100644 compiler/compiler/sample/pages/home.ets create mode 100644 compiler/compiler/sample/pages/home_preview.ets create mode 100644 compiler/compiler/sample/pages/index.ets create mode 100644 compiler/compiler/sample/pages/testcases/component-01.ets create mode 100644 compiler/compiler/sample/pages/testcases/componentGridTest.ets create mode 100644 compiler/compiler/sample/pages/testcases/componentListTest.ets create mode 100644 compiler/compiler/sample/pages/testcases/constructor-01.ets create mode 100644 compiler/compiler/sample/pages/testcases/constructor-02.ets create mode 100644 compiler/compiler/sample/pages/testcases/constructor-03.ets create mode 100644 compiler/compiler/sample/pages/testcases/expected/component-01-expected.js create mode 100644 compiler/compiler/sample/pages/testcases/expected/constructor-01-expected.js create mode 100644 compiler/compiler/sample/pages/testcases/expected/constructor-02-expected.js create mode 100644 compiler/compiler/sample/pages/testcases/expected/constructor-03-expected.js create mode 100644 compiler/compiler/sample/pages/testcases/expected/link-01-expected.js create mode 100644 compiler/compiler/sample/pages/testcases/expected/new-01-expected.js create mode 100644 compiler/compiler/sample/pages/testcases/expected/new-02-expected.js create mode 100644 compiler/compiler/sample/pages/testcases/expected/new-03-expected.js create mode 100644 compiler/compiler/sample/pages/testcases/expected/new-04-expected.js create mode 100644 compiler/compiler/sample/pages/testcases/expected/struct-01-expected.js create mode 100644 compiler/compiler/sample/pages/testcases/expected/struct-02-expected.js create mode 100644 compiler/compiler/sample/pages/testcases/forEachComplexModel.ets create mode 100644 compiler/compiler/sample/pages/testcases/forEachSimpleModel.ets create mode 100644 compiler/compiler/sample/pages/testcases/image.ets create mode 100644 compiler/compiler/sample/pages/testcases/import-api-01.ets create mode 100644 compiler/compiler/sample/pages/testcases/link-01.ets create mode 100644 compiler/compiler/sample/pages/testcases/linkArrayModel.ets create mode 100644 compiler/compiler/sample/pages/testcases/linkPropCombo.ets create mode 100644 compiler/compiler/sample/pages/testcases/linkSimpleModel.ets create mode 100644 compiler/compiler/sample/pages/testcases/new-01.ets create mode 100644 compiler/compiler/sample/pages/testcases/new-0101.ets create mode 100644 compiler/compiler/sample/pages/testcases/new-02.ets create mode 100644 compiler/compiler/sample/pages/testcases/new-03.ets create mode 100644 compiler/compiler/sample/pages/testcases/new-04.ets create mode 100644 compiler/compiler/sample/pages/testcases/onclicktest.ets create mode 100644 compiler/compiler/sample/pages/testcases/propSimpleModel.ets create mode 100644 compiler/compiler/sample/pages/testcases/showcaseCovid19.ets create mode 100644 compiler/compiler/sample/pages/testcases/simpleText.ets create mode 100644 compiler/compiler/sample/pages/testcases/stacktestsuite.ets create mode 100644 compiler/compiler/sample/pages/testcases/stateArrayReverse.ets create mode 100644 compiler/compiler/sample/pages/testcases/stateArrayReverseCustomView.ets create mode 100644 compiler/compiler/sample/pages/testcases/stateComplexType.ets create mode 100644 compiler/compiler/sample/pages/testcases/stateStateBindingProp.ets create mode 100644 compiler/compiler/sample/pages/testcases/struct-01.ets create mode 100644 compiler/compiler/sample/pages/testcases/struct-02.ets create mode 100644 compiler/compiler/sample/pages/todo.ets create mode 100644 compiler/compiler/src/compile_info.ts create mode 100644 compiler/compiler/src/component_map.ts create mode 100644 compiler/compiler/src/create.ts create mode 100644 compiler/compiler/src/gen_abc_plugin.ts create mode 100644 compiler/compiler/src/pre_define.ts create mode 100644 compiler/compiler/src/pre_process.ts create mode 100644 compiler/compiler/src/process_component_build.ts create mode 100644 compiler/compiler/src/process_component_class.ts create mode 100644 compiler/compiler/src/process_component_constructor.ts create mode 100644 compiler/compiler/src/process_component_member.ts create mode 100644 compiler/compiler/src/process_custom_component.ts create mode 100644 compiler/compiler/src/process_import.ts create mode 100644 compiler/compiler/src/process_system_module.ts create mode 100644 compiler/compiler/src/process_ui_syntax.ts create mode 100644 compiler/compiler/src/result_process.ts create mode 100644 compiler/compiler/src/utils.ts create mode 100644 compiler/compiler/src/validate_ui_syntax.ts create mode 100644 compiler/compiler/syntax_parser/src/parse_extend.peg create mode 100644 compiler/compiler/syntax_parser/src/syntax_parser.peg create mode 100644 compiler/compiler/test/README.md create mode 100644 compiler/compiler/test/pages/AMDComponent.ets create mode 100644 compiler/compiler/test/pages/DefaultComponent.ets create mode 100644 compiler/compiler/test/pages/ExportComponent.ets create mode 100644 compiler/compiler/test/pages/ExportStarComponent.ets create mode 100644 compiler/compiler/test/pages/LinkComponent.ets create mode 100644 compiler/compiler/test/pages/NamespaceComponent.ets create mode 100644 compiler/compiler/test/pages/TsModule.ts create mode 100644 compiler/compiler/test/test.ts create mode 100644 compiler/compiler/test/ut/animation/animation.ts create mode 100644 compiler/compiler/test/ut/build/build.ts create mode 100644 compiler/compiler/test/ut/component/component.ts create mode 100644 compiler/compiler/test/ut/component/customComponent.ts create mode 100644 compiler/compiler/test/ut/constructor/id.ts create mode 100644 compiler/compiler/test/ut/constructor/link.ts create mode 100644 compiler/compiler/test/ut/constructor/observedObjectLink.ts create mode 100644 compiler/compiler/test/ut/constructor/prop.ts create mode 100644 compiler/compiler/test/ut/constructor/provideConsume.ts create mode 100644 compiler/compiler/test/ut/constructor/state.ts create mode 100644 compiler/compiler/test/ut/customDialog/customDialog.ts create mode 100644 compiler/compiler/test/ut/decorator/builder.ts create mode 100644 compiler/compiler/test/ut/decorator/extend.ts create mode 100644 compiler/compiler/test/ut/decorator/watch.ts create mode 100644 compiler/compiler/test/ut/decorator/watchWithAnimateTo.ts create mode 100644 compiler/compiler/test/ut/geometryReader/geometryReader.ts create mode 100644 compiler/compiler/test/ut/gesture/panGestrue.ts create mode 100644 compiler/compiler/test/ut/gesture/pinchGesture.ts create mode 100644 compiler/compiler/test/ut/gesture/rotationGesture.ts create mode 100644 compiler/compiler/test/ut/gesture/tapGesture.ts create mode 100644 compiler/compiler/test/ut/import/importEts.ts create mode 100644 compiler/compiler/test/ut/import/importSystemApi.ts create mode 100644 compiler/compiler/test/ut/import/importTs.ts create mode 100644 compiler/compiler/test/ut/link/createLinkReference.ts create mode 100644 compiler/compiler/test/ut/preview/previewDecorator.ts create mode 100644 compiler/compiler/test/ut/render/forEach/forEach01.ts create mode 100644 compiler/compiler/test/ut/render/forEach/forEach02.ts create mode 100644 compiler/compiler/test/ut/render/forEach/forEach03.ts create mode 100644 compiler/compiler/test/ut/render/forEach/forEach04.ts create mode 100644 compiler/compiler/test/ut/render/forEach/forEachComplexModel.ts create mode 100644 compiler/compiler/test/ut/render/forEach/forEachSimpleModel.ts create mode 100644 compiler/compiler/test/ut/render/if/if.ts create mode 100644 compiler/compiler/test/ut/render/if/ifIncludeForEach.ts create mode 100644 compiler/compiler/test/ut/struct/struct_01.ts create mode 100644 compiler/compiler/test/ut/struct/struct_02.ts create mode 100644 compiler/compiler/test/ut/transition/transition.ts create mode 100644 compiler/compiler/tsconfig.json create mode 100644 compiler/compiler/uglify-source.js create mode 100644 compiler/compiler/webpack.config.js diff --git a/compiler/.eslintrc b/compiler/.eslintrc index 4d857e85c..4d0ce2fbc 100644 --- a/compiler/.eslintrc +++ b/compiler/.eslintrc @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + { "parserOptions": { "ecmaVersion": 7, diff --git a/compiler/compiler/.eslintrc b/compiler/compiler/.eslintrc new file mode 100644 index 000000000..4d0ce2fbc --- /dev/null +++ b/compiler/compiler/.eslintrc @@ -0,0 +1,104 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + +{ + "parserOptions": { + "ecmaVersion": 7, + "sourceType": "module" + }, + + "env": { + "es6": true, + "node": true, + "mocha": true + }, + + "extends": "eslint:recommended", + "parser": "@typescript-eslint/parser", + + "rules": { + "camelcase": [2, { "properties": "never" }], + "accessor-pairs": 2, + "arrow-spacing": 2, + "block-spacing": 2, + "brace-style": 2, + "comma-dangle": 2, + "comma-spacing": 2, + "comma-style": 2, + "curly": 2, + "dot-location": [2, "property"], + "eol-last": 2, + "eqeqeq": 2, + "indent": [2, 2, { "SwitchCase": 1 }], + "key-spacing": 2, + "keyword-spacing": 2, + "new-cap": 2, + "new-parens": 2, + "no-array-constructor": 2, + "no-caller": 2, + "no-eval": 2, + "no-extend-native": 2, + "no-extra-bind": 2, + "no-extra-parens": 2, + "no-floating-decimal": 2, + "no-implied-eval": 2, + "no-iterator": 2, + "no-label-var": 2, + "no-labels": 2, + "no-lone-blocks": 2, + "no-multi-spaces": 2, + "no-multi-str": 2, + "no-multiple-empty-lines": [2, { "max": 1 }], + "no-new-object": 2, + "no-new-wrappers": 2, + "no-octal-escape": 2, + "no-proto": 2, + "no-return-assign": 2, + "no-self-compare": 2, + "no-sequences": 2, + "func-call-spacing": 2, + "no-throw-literal": 2, + "no-trailing-spaces": 2, + "no-undef-init": 2, + "no-unmodified-loop-condition": 2, + "no-unneeded-ternary": [2, { "defaultAssignment": false }], + "no-unused-vars": [2, { "vars": "all", "args": "none" }], + "no-useless-computed-key": 2, + "no-useless-constructor": 2, + "no-whitespace-before-property": 2, + "one-var": [2, { "initialized": "never" }], + "padded-blocks": [2, "never"], + "quotes": [2, "single", {"avoidEscape": true, "allowTemplateLiterals": true}], + "semi": 2, + "semi-spacing": 2, + "space-before-blocks": 2, + "space-before-function-paren": [2, "never"], + "space-in-parens": 2, + "space-infix-ops": 2, + "space-unary-ops": [2, { "words": true, "nonwords": false }], + "spaced-comment": 2, + "template-curly-spacing": 2, + "wrap-iife": [2, "any"], + "no-var": 2, + "prefer-const": 2, + "array-bracket-spacing": 2 + }, + + "settings": { + "flowtype": { + "onlyFilesWithFlowAnnotation": true + } + } +} diff --git a/compiler/compiler/README.md b/compiler/compiler/README.md new file mode 100644 index 000000000..f3d80c2f2 --- /dev/null +++ b/compiler/compiler/README.md @@ -0,0 +1,81 @@ +# compiler + +**The compiler tool chain for ace2.0.** + +## Usage +Here are simplified instructions of how to get started. The following commands work both on **Windows** and **Linux** platforms. + +### 1. Install + +First, enter the root directory of the compiler: +``` +$ cd compiler/ +``` +And then install the npm dependencies(You must have node&npm installed): +``` +$ npm install +``` +**Note**: If some errors occur, delete the generated package `node_modules`, please check the following items: + +First, check whether your node version is 12.x or later; +Secondly, config npm proxy and run `npm install` again. +``` +npm config set strict-ssl false +npm config set registry https://cmc.centralrepo.rnd.huawei.com/npm/ +``` + +### 2. Quick Start + +For a quick start + +In the root directory of `compiler/`: +``` +$ npm run build +$ npm run compile +``` +The `sample` project will be compiled. The output is in the `sample/build` directory. + +### 3. Create a new project + +The way to create a new project + +In the root directory of `compiler/`: +``` +$ npm run build +$ npm run create [projectName] +``` + +**Note**: If `projectName` is empty, create the `HelloAce` project by default. + +For example, use the following line to create a project named `foo`: +``` +$ npm run create foo +``` +The directory structure of project `foo`: +- foo + - pages + - index.ets + - app.ets + - manifest.json + +### 4. Create a new page + +For example, create a file `bar.ets` in the `page` directory. And then add the following lines to `"page"` field in `manifest.json`: +``` + "pages": [ + "pages/index", + "pages/bar" + ] +``` + +### 5. Compile a project + +The way to compile a project + +In the root directory of `compiler/`: +``` +$ npm run build +$ npm run compile [projectName] +``` + +**Note**: If `projectName` is empty, compile the `sample` project by default. In the project root directory, the compilation result is in the `build` directory. diff --git a/compiler/compiler/babel.config.js b/compiler/compiler/babel.config.js new file mode 100644 index 000000000..1c8aa7051 --- /dev/null +++ b/compiler/compiler/babel.config.js @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2020 Huawei Device Co., Ltd. + * 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. + */ + +module.exports = function(api) { + api.cache(true); + + const presets = ['@babel/preset-env', '@babel/typescript']; + const plugins = [ + '@babel/plugin-transform-modules-commonjs', + '@babel/plugin-proposal-class-properties', + [ + '@babel/plugin-transform-arrow-functions', + { + spec: true + } + ] + ]; + + return { + presets, + plugins + }; +}; diff --git a/compiler/compiler/build_declarations_file.js b/compiler/compiler/build_declarations_file.js new file mode 100644 index 000000000..3b016b636 --- /dev/null +++ b/compiler/compiler/build_declarations_file.js @@ -0,0 +1,128 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + +const ts = require('typescript') +const path = require('path') +const fs = require('fs') + +generateTargetFile(process.argv[2], process.argv[3]); +function generateTargetFile(filePath, output) { + const files = []; + const globalTsFile = path.resolve(filePath, '../../global.d.ts'); + if (fs.existsSync(globalTsFile)) { + files.push(globalTsFile); + } + readFile(filePath, files); + if (!fs.existsSync(output)) { + mkDir(output); + } + const license = `/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */`; + files.forEach((item) => { + const content = fs.readFileSync(item, 'utf8'); + const fileName = path.resolve(output, path.basename(item)); + const newContent = license + '\n\n' + processsFile(content, fileName); + fs.writeFile(fileName, newContent, err => { + if (err) { + console.error(err); + return; + } + }); + }); +} + +function readFile(dir, fileDir) { + const files = fs.readdirSync(dir); + files.forEach((element) => { + const filePath = path.join(dir, element); + const status = fs.statSync(filePath); + if (status.isDirectory()) { + readFile(filePath, fileDir); + } else { + fileDir.push(filePath); + } + }); +} + +function mkDir(filePath) { + const parent = path.join(filePath, '..'); + if (!(fs.existsSync(parent) && !fs.statSync(parent).isFile())) { + mkDir(parent); + } + fs.mkdirSync(filePath); +} + +function processsFile(content, fileName) { + let sourceFile = ts.createSourceFile(fileName, content, ts.ScriptTarget.Latest, true, ts.ScriptKind.TS); + const newStatements = []; + if (sourceFile.statements && sourceFile.statements.length) { + sourceFile.statements.forEach((node) => { + if (!ts.isImportDeclaration(node)) { + if (node.modifiers && node.modifiers.length && node.modifiers[0].kind === ts.SyntaxKind.ExportKeyword) { + node.modifiers.splice(0, 1); + } + if (isVariable(node)) { + const name = node.declarationList.declarations[0].name.getText(); + const type = node.declarationList.declarations[0].type.getText(); + if (name.indexOf(type) !== -1) { + const declarationNode = ts.factory.updateVariableDeclaration(node.declarationList.declarations[0], + ts.factory.createIdentifier(type), node.declarationList.declarations[0].exclamationToken, + node.declarationList.declarations[0].type, node.declarationList.declarations[0].initializer); + node.declarationList = ts.factory.updateVariableDeclarationList(node.declarationList, [declarationNode]); + } + } + newStatements.push(node); + } + }); + } + sourceFile = ts.factory.updateSourceFile(sourceFile, newStatements); + const printer = ts.createPrinter({ removeComments: true, newLine: ts.NewLineKind.LineFeed }); + const result = printer.printNode(ts.EmitHint.Unspecified, sourceFile, sourceFile); + return result; +} + +function isVariable(node) { + if (ts.isVariableStatement(node) && node.declarationList && node.declarationList.declarations && + node.declarationList.declarations.length && ts.isVariableDeclaration(node.declarationList.declarations[0]) && + node.declarationList.declarations[0].name && node.declarationList.declarations[0].type) { + return true; + } + return false; +} + +generateComponentConfig(process.argv[4]); +function generateComponentConfig(dir) { + const configFile = path.resolve(dir, 'component_map.js'); + if (fs.existsSync(configFile)) { + const { COMPONENT_MAP } = require(configFile); + try { + fs.writeFileSync(path.resolve(dir, '../component_config.json'), JSON.stringify(COMPONENT_MAP)); + } catch (error) { + console.error(error); + } + } +} diff --git a/compiler/compiler/build_parser.js b/compiler/compiler/build_parser.js new file mode 100644 index 000000000..03f79ad7d --- /dev/null +++ b/compiler/compiler/build_parser.js @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + +const util = require('util'); +const childProcess = require('child_process'); +const exec = util.promisify(childProcess.exec); +const fs = require('fs'); +const path = require('path'); + +function generateSyntaxParser(inputFile, nodePath) { + const readDirPath = path.resolve(__dirname, './syntax_parser/src'); + const readDirSubFiles = fs.readdirSync(readDirPath); + const catalogPath = path.resolve(inputFile, '..'); + const catalogSubFiles = fs.readdirSync(catalogPath) + const parserPath = path.resolve(__dirname, './node_modules/pegjs/bin/pegjs'); + + if (catalogSubFiles.includes('dist')) { + exec('rm -rf ' + catalogPath + '/dist/*.js'); + } else { + exec('mkdir ' + catalogPath + '/dist'); + } + + ;(async function transJs () { + if (readDirSubFiles.length) { + for (let item of readDirSubFiles) { + let name = path.basename(item, '.peg'); + if (name){ + await exec(nodePath + ' ' + parserPath + ' -o ' + + catalogPath + '/dist/' + name + '.js ' + readDirPath + '/' + item); + } + } + } + })() +} + +generateSyntaxParser(process.argv[2], process.argv[0]); diff --git a/compiler/compiler/main.js b/compiler/compiler/main.js new file mode 100644 index 000000000..b356e486b --- /dev/null +++ b/compiler/compiler/main.js @@ -0,0 +1,154 @@ +/* + * Copyright (c) 2020 Huawei Device Co., Ltd. + * 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. + */ + +const fs = require('fs'); +const path = require('path'); + +const { readFile } = require('./lib/utils'); +const { WORKERS_DIR } = require('./lib/pre_define'); + +const { + configure, + getLogger +} = require('log4js'); + +configure({ + appenders: { 'ETS': {type: 'stderr', layout: {type: 'messagePassThrough'}}}, + categories: {'default': {appenders: ['ETS'], level: 'info'}} +}); +const logger = getLogger('ETS'); + +const staticPreviewPage = process.env.aceStaticPreview; +const abilityConfig = { + abilityType: process.env.abilityType || 'page', + abilityEntryFile: null +}; +const projectConfig = {}; +const resources = { + app: {}, + sys: {} +}; + +function initProjectConfig(projectConfig) { + projectConfig.entryObj = {}; + projectConfig.projectPath = projectConfig.projectPath || process.env.aceModuleRoot || + path.join(process.cwd(), 'sample'); + projectConfig.buildPath = projectConfig.buildPath || process.env.aceModuleBuild || + path.resolve(projectConfig.projectPath, 'build'); + projectConfig.manifestFilePath = projectConfig.manifestFilePath || process.env.aceManifestPath || + path.join(projectConfig.projectPath, 'manifest.json'); +} + +function loadEntryObj(projectConfig) { + initProjectConfig(projectConfig); + setEntryFile(projectConfig); + + if(staticPreviewPage) { + projectConfig.entryObj['./' + staticPreviewPage] = projectConfig.projectPath + path.sep + + staticPreviewPage + '.ets?entry'; + } else if (abilityConfig.abilityType === 'page') { + let manifest = {}; + try { + const jsonString = fs.readFileSync(projectConfig.manifestFilePath).toString(); + manifest = JSON.parse(jsonString); + } catch (error) { + throw Error(`\u001b[31m ERROR: the manifest file '${projectConfig.manifestFilePath}' is lost or format is invalid. \u001b[39m`).message; + } + if (manifest.pages) { + const pages = manifest.pages; + pages.forEach((element) => { + const fileName = projectConfig.projectPath + path.sep + element + '.ets'; + if (fs.existsSync(fileName)) { + projectConfig.entryObj['./' + element] = fileName + '?entry'; + } else { + throw Error(`\u001b[31m ERROR: page '${fileName}' does not exist. \u001b[39m`).message; + } + }); + } else { + throw Error(`\u001b[31m ERROR: missing pages attribute in '${projectConfig.manifestFilePath}'. \u001b[39m`).message; + } + } +} + +function setEntryFile(projectConfig) { + const entryFileName = abilityConfig.abilityType === 'page' ? 'app' : abilityConfig.abilityType; + const extendFile = entryFileName === 'app' ? '.ets' : '.ts'; + abilityConfig.abilityEntryFile = entryFileName + extendFile; + const entryFilePath = path.join(projectConfig.projectPath, abilityConfig.abilityEntryFile); + if (!fs.existsSync(entryFilePath)) { + throw Error(`\u001b[31m ERROR: missing ${entryFilePath}. \u001b[39m`).message; + } + projectConfig.entryObj[`./${entryFileName}`] = projectConfig.projectPath + `/${abilityConfig.abilityEntryFile}?entry`; +} + +function loadWorker(projectConfig) { + const workerPath = path.resolve(projectConfig.projectPath, WORKERS_DIR); + if (fs.existsSync(workerPath)) { + const workerFiles = []; + readFile(workerPath, workerFiles); + workerFiles.forEach((item) => { + if (/\.(ts|js)$/.test(item)) { + const relativePath = path.relative(workerPath, item).replace(/\.(ts|js)$/, ''); + projectConfig.entryObj[`./${WORKERS_DIR}/` + relativePath] = item; + } + }) + } +} + +;(function initSystemResource() { + const sysResourcePath = path.resolve('./sysResource.js'); + if (fs.existsSync(sysResourcePath)) { + resources.sys = require(sysResourcePath).sys; + } +})() + +function readAppResource(resources, filePath) { + if (fs.existsSync(filePath)) { + const appResource = fs.readFileSync(filePath, "utf-8"); + const resourceArr = appResource.split(/\n/); + let resourceMap = new Map(); + for (let i = 0; i < resourceArr.length; i++) { + if (!resourceArr[i].length) { + continue; + } + const resourceData = resourceArr[i].split(/\s/); + if (resourceData.length === 3 && Number(resourceData[2]) !== NaN ) { + if (resourceMap.get(resourceData[0])) { + const resourceKeys = resourceMap.get(resourceData[0]); + if (!resourceKeys[resourceData[1]] || resourceKeys[resourceData[1]] !== Number(resourceData[2])) { + resourceKeys[resourceData[1]] = Number(resourceData[2]); + } + } else { + let obj = {}; + obj[resourceData[1]] = Number(resourceData[2]); + resourceMap.set(resourceData[0], obj); + } + } else { + logger.warn(`\u001b[31m ETS:WARN The format of file '${filePath}' is incorrect. \u001b[39m`); + break; + } + } + for (let [key, value] of resourceMap) { + resources.app[key] = value; + } + } +} + +exports.projectConfig = projectConfig; +exports.loadEntryObj = loadEntryObj; +exports.readAppResource = readAppResource; +exports.resources = resources; +exports.loadWorker = loadWorker; +exports.abilityConfig = abilityConfig; diff --git a/compiler/compiler/npm-install.js b/compiler/compiler/npm-install.js new file mode 100644 index 000000000..32ae7ec45 --- /dev/null +++ b/compiler/compiler/npm-install.js @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + +'use strict'; +const path = require('path'); +const fs = require('fs'); +const exec = require('child_process').exec; + +const arkDir = path.resolve(__dirname, 'bin', "ark"); +if (!fs.existsSync(arkDir)) { + return; +} + +let isWin = !1; +let isMac = !1; + +if (fs.existsSync(path.join(arkDir, "build-win"))) { + isWin = !0; +} else if (fs.existsSync(path.join(arkDir, "build-mac"))) { + isMac = !0; +} else if (!fs.existsSync(path.join(arkDir, "build"))) { + throw Error("Error: find build fail").message; +} + +let cwd; +if (isWin) { + cwd = path.join(arkDir, "build-win"); +} else if (isMac) { + cwd = path.join(arkDir, "build-mac"); +} else { + cwd = path.join(arkDir, "build"); +} + +exec('npm install', { cwd: cwd }, function(err, stdout, stderr) { + console.log('[31m', stdout, '[39m'); + if (err !== null) { + console.error('[31m', `npm install filed: ${err}`, '[39m'); + } +}); diff --git a/compiler/compiler/package-lock.json b/compiler/compiler/package-lock.json new file mode 100644 index 000000000..7fa081a90 --- /dev/null +++ b/compiler/compiler/package-lock.json @@ -0,0 +1,5700 @@ +{ + "name": "compilier", + "version": "0.0.1", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "@babel/cli": { + "version": "7.15.4", + "resolved": "https://registry.nlark.com/@babel/cli/download/@babel/cli-7.15.4.tgz", + "integrity": "sha1-AOIeGStzjex5AMi7NicON3IXwKQ=", + "dev": true, + "requires": { + "@nicolo-ribaudo/chokidar-2": "2.1.8-no-fsevents.2", + "chokidar": "^3.4.0", + "commander": "^4.0.1", + "convert-source-map": "^1.1.0", + "fs-readdir-recursive": "^1.1.0", + "glob": "^7.0.0", + "make-dir": "^2.1.0", + "slash": "^2.0.0", + "source-map": "^0.5.0" + }, + "dependencies": { + "commander": { + "version": "4.1.1", + "resolved": "https://registry.nlark.com/commander/download/commander-4.1.1.tgz", + "integrity": "sha1-n9YCvZNilOnp70aj9NaWQESxgGg=", + "dev": true + }, + "slash": { + "version": "2.0.0", + "resolved": "https://registry.nlark.com/slash/download/slash-2.0.0.tgz", + "integrity": "sha1-3lUoUaF1nfOo8gZTVEL17E3eq0Q=", + "dev": true + }, + "source-map": { + "version": "0.5.7", + "resolved": "https://registry.nlark.com/source-map/download/source-map-0.5.7.tgz?cache=0&sync_timestamp=1624608014898&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fsource-map%2Fdownload%2Fsource-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", + "dev": true + } + } + }, + "@babel/code-frame": { + "version": "7.14.5", + "resolved": "https://registry.nlark.com/@babel/code-frame/download/@babel/code-frame-7.14.5.tgz", + "integrity": "sha1-I7CNdA6D9JxeWZRfvxtD6Au/Tts=", + "dev": true, + "requires": { + "@babel/highlight": "^7.14.5" + } + }, + "@babel/compat-data": { + "version": "7.15.0", + "resolved": "https://registry.nlark.com/@babel/compat-data/download/@babel/compat-data-7.15.0.tgz", + "integrity": "sha1-Lbr4uFM0eWyvuw9Xk6kKL8AQsXY=", + "dev": true + }, + "@babel/core": { + "version": "7.15.4", + "resolved": "https://registry.nlark.com/@babel/core/download/@babel/core-7.15.4.tgz?cache=0&sync_timestamp=1630618926729&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40babel%2Fcore%2Fdownload%2F%40babel%2Fcore-7.15.4.tgz", + "integrity": "sha1-pw0GxYrh/OOcI/jv15+dXriy85c=", + "dev": true, + "requires": { + "@babel/code-frame": "^7.14.5", + "@babel/generator": "^7.15.4", + "@babel/helper-compilation-targets": "^7.15.4", + "@babel/helper-module-transforms": "^7.15.4", + "@babel/helpers": "^7.15.4", + "@babel/parser": "^7.15.4", + "@babel/template": "^7.15.4", + "@babel/traverse": "^7.15.4", + "@babel/types": "^7.15.4", + "convert-source-map": "^1.7.0", + "debug": "^4.1.0", + "gensync": "^1.0.0-beta.2", + "json5": "^2.1.2", + "semver": "^6.3.0", + "source-map": "^0.5.0" + }, + "dependencies": { + "semver": { + "version": "6.3.0", + "resolved": "https://registry.nlark.com/semver/download/semver-6.3.0.tgz?cache=0&sync_timestamp=1624607961409&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fsemver%2Fdownload%2Fsemver-6.3.0.tgz", + "integrity": "sha1-7gpkyK9ejO6mdoexM3YeG+y9HT0=", + "dev": true + }, + "source-map": { + "version": "0.5.7", + "resolved": "https://registry.nlark.com/source-map/download/source-map-0.5.7.tgz?cache=0&sync_timestamp=1624608014898&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fsource-map%2Fdownload%2Fsource-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", + "dev": true + } + } + }, + "@babel/generator": { + "version": "7.15.4", + "resolved": "https://registry.nlark.com/@babel/generator/download/@babel/generator-7.15.4.tgz", + "integrity": "sha1-hayxWaJnymMk+Xk5hpke4gIqBbA=", + "dev": true, + "requires": { + "@babel/types": "^7.15.4", + "jsesc": "^2.5.1", + "source-map": "^0.5.0" + }, + "dependencies": { + "source-map": { + "version": "0.5.7", + "resolved": "https://registry.nlark.com/source-map/download/source-map-0.5.7.tgz?cache=0&sync_timestamp=1624608014898&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fsource-map%2Fdownload%2Fsource-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", + "dev": true + } + } + }, + "@babel/helper-annotate-as-pure": { + "version": "7.15.4", + "resolved": "https://registry.nlark.com/@babel/helper-annotate-as-pure/download/@babel/helper-annotate-as-pure-7.15.4.tgz", + "integrity": "sha1-PQ5DsAxeSf22xX5CFgGnpljV+DU=", + "dev": true, + "requires": { + "@babel/types": "^7.15.4" + } + }, + "@babel/helper-builder-binary-assignment-operator-visitor": { + "version": "7.15.4", + "resolved": "https://registry.nlark.com/@babel/helper-builder-binary-assignment-operator-visitor/download/@babel/helper-builder-binary-assignment-operator-visitor-7.15.4.tgz", + "integrity": "sha1-Ia2BX2CbhO4OMFhnbDPPbRZwUl8=", + "dev": true, + "requires": { + "@babel/helper-explode-assignable-expression": "^7.15.4", + "@babel/types": "^7.15.4" + } + }, + "@babel/helper-compilation-targets": { + "version": "7.15.4", + "resolved": "https://registry.nlark.com/@babel/helper-compilation-targets/download/@babel/helper-compilation-targets-7.15.4.tgz", + "integrity": "sha1-z22U8w++/BORI+J91rAvZa7tt7k=", + "dev": true, + "requires": { + "@babel/compat-data": "^7.15.0", + "@babel/helper-validator-option": "^7.14.5", + "browserslist": "^4.16.6", + "semver": "^6.3.0" + }, + "dependencies": { + "semver": { + "version": "6.3.0", + "resolved": "https://registry.nlark.com/semver/download/semver-6.3.0.tgz?cache=0&sync_timestamp=1624607961409&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fsemver%2Fdownload%2Fsemver-6.3.0.tgz", + "integrity": "sha1-7gpkyK9ejO6mdoexM3YeG+y9HT0=", + "dev": true + } + } + }, + "@babel/helper-create-class-features-plugin": { + "version": "7.15.4", + "resolved": "https://registry.nlark.com/@babel/helper-create-class-features-plugin/download/@babel/helper-create-class-features-plugin-7.15.4.tgz", + "integrity": "sha1-f5d8F70SpfujY8sZvqCQOUvzfS4=", + "dev": true, + "requires": { + "@babel/helper-annotate-as-pure": "^7.15.4", + "@babel/helper-function-name": "^7.15.4", + "@babel/helper-member-expression-to-functions": "^7.15.4", + "@babel/helper-optimise-call-expression": "^7.15.4", + "@babel/helper-replace-supers": "^7.15.4", + "@babel/helper-split-export-declaration": "^7.15.4" + } + }, + "@babel/helper-create-regexp-features-plugin": { + "version": "7.14.5", + "resolved": "https://registry.nlark.com/@babel/helper-create-regexp-features-plugin/download/@babel/helper-create-regexp-features-plugin-7.14.5.tgz", + "integrity": "sha1-x9WsXpz2IcJgV3Ivt6ikxYiTWMQ=", + "dev": true, + "requires": { + "@babel/helper-annotate-as-pure": "^7.14.5", + "regexpu-core": "^4.7.1" + } + }, + "@babel/helper-define-polyfill-provider": { + "version": "0.2.3", + "resolved": "https://registry.nlark.com/@babel/helper-define-polyfill-provider/download/@babel/helper-define-polyfill-provider-0.2.3.tgz", + "integrity": "sha1-BSXt7FCUZTooJojTTYRuTHXpwLY=", + "dev": true, + "requires": { + "@babel/helper-compilation-targets": "^7.13.0", + "@babel/helper-module-imports": "^7.12.13", + "@babel/helper-plugin-utils": "^7.13.0", + "@babel/traverse": "^7.13.0", + "debug": "^4.1.1", + "lodash.debounce": "^4.0.8", + "resolve": "^1.14.2", + "semver": "^6.1.2" + }, + "dependencies": { + "semver": { + "version": "6.3.0", + "resolved": "https://registry.nlark.com/semver/download/semver-6.3.0.tgz?cache=0&sync_timestamp=1624607961409&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fsemver%2Fdownload%2Fsemver-6.3.0.tgz", + "integrity": "sha1-7gpkyK9ejO6mdoexM3YeG+y9HT0=", + "dev": true + } + } + }, + "@babel/helper-explode-assignable-expression": { + "version": "7.15.4", + "resolved": "https://registry.nlark.com/@babel/helper-explode-assignable-expression/download/@babel/helper-explode-assignable-expression-7.15.4.tgz", + "integrity": "sha1-+a7J0hnycer5K59WFZjKayaCYAw=", + "dev": true, + "requires": { + "@babel/types": "^7.15.4" + } + }, + "@babel/helper-function-name": { + "version": "7.15.4", + "resolved": "https://registry.nlark.com/@babel/helper-function-name/download/@babel/helper-function-name-7.15.4.tgz", + "integrity": "sha1-hFdE2vxDgaSl+2r6bD02+Yp4frw=", + "dev": true, + "requires": { + "@babel/helper-get-function-arity": "^7.15.4", + "@babel/template": "^7.15.4", + "@babel/types": "^7.15.4" + } + }, + "@babel/helper-get-function-arity": { + "version": "7.15.4", + "resolved": "https://registry.nlark.com/@babel/helper-get-function-arity/download/@babel/helper-get-function-arity-7.15.4.tgz", + "integrity": "sha1-CYgYk0oTf854tTaj4BWGS+Hih5s=", + "dev": true, + "requires": { + "@babel/types": "^7.15.4" + } + }, + "@babel/helper-hoist-variables": { + "version": "7.15.4", + "resolved": "https://registry.nlark.com/@babel/helper-hoist-variables/download/@babel/helper-hoist-variables-7.15.4.tgz", + "integrity": "sha1-CZk6MlnA6Rj5nRBCYd/fwDPxeN8=", + "dev": true, + "requires": { + "@babel/types": "^7.15.4" + } + }, + "@babel/helper-member-expression-to-functions": { + "version": "7.15.4", + "resolved": "https://registry.nlark.com/@babel/helper-member-expression-to-functions/download/@babel/helper-member-expression-to-functions-7.15.4.tgz", + "integrity": "sha1-v9NNybupgkpGWLAxfsL9VxpR5u8=", + "dev": true, + "requires": { + "@babel/types": "^7.15.4" + } + }, + "@babel/helper-module-imports": { + "version": "7.15.4", + "resolved": "https://registry.nlark.com/@babel/helper-module-imports/download/@babel/helper-module-imports-7.15.4.tgz", + "integrity": "sha1-4YAH0jBjLeoZtHhTuYRHbntOED8=", + "dev": true, + "requires": { + "@babel/types": "^7.15.4" + } + }, + "@babel/helper-module-transforms": { + "version": "7.15.4", + "resolved": "https://registry.nlark.com/@babel/helper-module-transforms/download/@babel/helper-module-transforms-7.15.4.tgz", + "integrity": "sha1-lizGKaf3+aCC3WLQMH+nX+h4jXw=", + "dev": true, + "requires": { + "@babel/helper-module-imports": "^7.15.4", + "@babel/helper-replace-supers": "^7.15.4", + "@babel/helper-simple-access": "^7.15.4", + "@babel/helper-split-export-declaration": "^7.15.4", + "@babel/helper-validator-identifier": "^7.14.9", + "@babel/template": "^7.15.4", + "@babel/traverse": "^7.15.4", + "@babel/types": "^7.15.4" + } + }, + "@babel/helper-optimise-call-expression": { + "version": "7.15.4", + "resolved": "https://registry.nlark.com/@babel/helper-optimise-call-expression/download/@babel/helper-optimise-call-expression-7.15.4.tgz", + "integrity": "sha1-8xClEho7nMUtmrGRIr1ymCLe4XE=", + "dev": true, + "requires": { + "@babel/types": "^7.15.4" + } + }, + "@babel/helper-plugin-utils": { + "version": "7.14.5", + "resolved": "https://registry.nlark.com/@babel/helper-plugin-utils/download/@babel/helper-plugin-utils-7.14.5.tgz", + "integrity": "sha1-WsgizpfuxGdBq3ClF5ceRDpwxak=", + "dev": true + }, + "@babel/helper-remap-async-to-generator": { + "version": "7.15.4", + "resolved": "https://registry.nlark.com/@babel/helper-remap-async-to-generator/download/@babel/helper-remap-async-to-generator-7.15.4.tgz", + "integrity": "sha1-JjfAcx5MkPv1isWLULK1oZL8lw8=", + "dev": true, + "requires": { + "@babel/helper-annotate-as-pure": "^7.15.4", + "@babel/helper-wrap-function": "^7.15.4", + "@babel/types": "^7.15.4" + } + }, + "@babel/helper-replace-supers": { + "version": "7.15.4", + "resolved": "https://registry.nlark.com/@babel/helper-replace-supers/download/@babel/helper-replace-supers-7.15.4.tgz", + "integrity": "sha1-UqirJrqRjH9t7ihiiwcHGse3NHo=", + "dev": true, + "requires": { + "@babel/helper-member-expression-to-functions": "^7.15.4", + "@babel/helper-optimise-call-expression": "^7.15.4", + "@babel/traverse": "^7.15.4", + "@babel/types": "^7.15.4" + } + }, + "@babel/helper-simple-access": { + "version": "7.15.4", + "resolved": "https://registry.nlark.com/@babel/helper-simple-access/download/@babel/helper-simple-access-7.15.4.tgz", + "integrity": "sha1-rDaJBavx3o6XgUNLY12PhnS8wTs=", + "dev": true, + "requires": { + "@babel/types": "^7.15.4" + } + }, + "@babel/helper-skip-transparent-expression-wrappers": { + "version": "7.15.4", + "resolved": "https://registry.nlark.com/@babel/helper-skip-transparent-expression-wrappers/download/@babel/helper-skip-transparent-expression-wrappers-7.15.4.tgz", + "integrity": "sha1-cH29uh9K0Po0+RFPyBl67H1dous=", + "dev": true, + "requires": { + "@babel/types": "^7.15.4" + } + }, + "@babel/helper-split-export-declaration": { + "version": "7.15.4", + "resolved": "https://registry.nlark.com/@babel/helper-split-export-declaration/download/@babel/helper-split-export-declaration-7.15.4.tgz", + "integrity": "sha1-rsq5Lc2+9qEKo7YqsgSwhfd24lc=", + "dev": true, + "requires": { + "@babel/types": "^7.15.4" + } + }, + "@babel/helper-validator-identifier": { + "version": "7.14.9", + "resolved": "https://registry.nlark.com/@babel/helper-validator-identifier/download/@babel/helper-validator-identifier-7.14.9.tgz?cache=0&sync_timestamp=1627804408187&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40babel%2Fhelper-validator-identifier%2Fdownload%2F%40babel%2Fhelper-validator-identifier-7.14.9.tgz", + "integrity": "sha1-ZlTRcbICT22O4VG/JQlpmRkTHUg=", + "dev": true + }, + "@babel/helper-validator-option": { + "version": "7.14.5", + "resolved": "https://registry.nlark.com/@babel/helper-validator-option/download/@babel/helper-validator-option-7.14.5.tgz", + "integrity": "sha1-bnKh//GNXfy4eOHmLxoCHEty1aM=", + "dev": true + }, + "@babel/helper-wrap-function": { + "version": "7.15.4", + "resolved": "https://registry.nlark.com/@babel/helper-wrap-function/download/@babel/helper-wrap-function-7.15.4.tgz", + "integrity": "sha1-b3VLJEbPrz1hJSPmq415wnw6Pec=", + "dev": true, + "requires": { + "@babel/helper-function-name": "^7.15.4", + "@babel/template": "^7.15.4", + "@babel/traverse": "^7.15.4", + "@babel/types": "^7.15.4" + } + }, + "@babel/helpers": { + "version": "7.15.4", + "resolved": "https://registry.nlark.com/@babel/helpers/download/@babel/helpers-7.15.4.tgz", + "integrity": "sha1-X0DwIFCjAnEho89I1JfAXFVer0M=", + "dev": true, + "requires": { + "@babel/template": "^7.15.4", + "@babel/traverse": "^7.15.4", + "@babel/types": "^7.15.4" + } + }, + "@babel/highlight": { + "version": "7.14.5", + "resolved": "https://registry.nlark.com/@babel/highlight/download/@babel/highlight-7.14.5.tgz", + "integrity": "sha1-aGGlLwOWZAUAH2qlNKAaJNmejNk=", + "dev": true, + "requires": { + "@babel/helper-validator-identifier": "^7.14.5", + "chalk": "^2.0.0", + "js-tokens": "^4.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.nlark.com/ansi-styles/download/ansi-styles-3.2.1.tgz", + "integrity": "sha1-QfuyAkPlCxK+DwS43tvwdSDOhB0=", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.nlark.com/chalk/download/chalk-2.4.2.tgz?cache=0&sync_timestamp=1627646614989&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fchalk%2Fdownload%2Fchalk-2.4.2.tgz", + "integrity": "sha1-zUJUFnelQzPPVBpJEIwUMrRMlCQ=", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "color-convert": { + "version": "1.9.3", + "resolved": "https://registry.nlark.com/color-convert/download/color-convert-1.9.3.tgz?cache=0&sync_timestamp=1624607968569&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fcolor-convert%2Fdownload%2Fcolor-convert-1.9.3.tgz", + "integrity": "sha1-u3GFBpDh8TZWfeYp0tVHHe2kweg=", + "dev": true, + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.nlark.com/color-name/download/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", + "dev": true + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.nlark.com/has-flag/download/has-flag-3.0.0.tgz?cache=0&sync_timestamp=1626716578584&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fhas-flag%2Fdownload%2Fhas-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.nlark.com/supports-color/download/supports-color-5.5.0.tgz?cache=0&sync_timestamp=1626703455199&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fsupports-color%2Fdownload%2Fsupports-color-5.5.0.tgz", + "integrity": "sha1-4uaaRKyHcveKHsCzW2id9lMO/I8=", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "@babel/parser": { + "version": "7.15.4", + "resolved": "https://registry.nlark.com/@babel/parser/download/@babel/parser-7.15.4.tgz", + "integrity": "sha1-AvKTG4IlEtOq0X1HWug9p0olWoQ=", + "dev": true + }, + "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": { + "version": "7.15.4", + "resolved": "https://registry.nlark.com/@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining/download/@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining-7.15.4.tgz", + "integrity": "sha1-296rsegPYi2fC1g++ymZYF4KVn4=", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.14.5", + "@babel/helper-skip-transparent-expression-wrappers": "^7.15.4", + "@babel/plugin-proposal-optional-chaining": "^7.14.5" + } + }, + "@babel/plugin-proposal-async-generator-functions": { + "version": "7.15.4", + "resolved": "https://registry.nlark.com/@babel/plugin-proposal-async-generator-functions/download/@babel/plugin-proposal-async-generator-functions-7.15.4.tgz", + "integrity": "sha1-+Cqr6WwTXSzqqRf+ufX8oxY1J34=", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.14.5", + "@babel/helper-remap-async-to-generator": "^7.15.4", + "@babel/plugin-syntax-async-generators": "^7.8.4" + } + }, + "@babel/plugin-proposal-class-properties": { + "version": "7.14.5", + "resolved": "https://registry.nlark.com/@babel/plugin-proposal-class-properties/download/@babel/plugin-proposal-class-properties-7.14.5.tgz?cache=0&sync_timestamp=1624608012853&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40babel%2Fplugin-proposal-class-properties%2Fdownload%2F%40babel%2Fplugin-proposal-class-properties-7.14.5.tgz", + "integrity": "sha1-QNHuFAxbHjGjUPT17tlFCWVZtC4=", + "dev": true, + "requires": { + "@babel/helper-create-class-features-plugin": "^7.14.5", + "@babel/helper-plugin-utils": "^7.14.5" + } + }, + "@babel/plugin-proposal-class-static-block": { + "version": "7.15.4", + "resolved": "https://registry.nlark.com/@babel/plugin-proposal-class-static-block/download/@babel/plugin-proposal-class-static-block-7.15.4.tgz", + "integrity": "sha1-PnymEoRTwInotHepn5cMY/wcuNc=", + "dev": true, + "requires": { + "@babel/helper-create-class-features-plugin": "^7.15.4", + "@babel/helper-plugin-utils": "^7.14.5", + "@babel/plugin-syntax-class-static-block": "^7.14.5" + } + }, + "@babel/plugin-proposal-dynamic-import": { + "version": "7.14.5", + "resolved": "https://registry.nlark.com/@babel/plugin-proposal-dynamic-import/download/@babel/plugin-proposal-dynamic-import-7.14.5.tgz", + "integrity": "sha1-DGYX30YcDB+P/ztHzVl3I2AQHSw=", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.14.5", + "@babel/plugin-syntax-dynamic-import": "^7.8.3" + } + }, + "@babel/plugin-proposal-export-namespace-from": { + "version": "7.14.5", + "resolved": "https://registry.nlark.com/@babel/plugin-proposal-export-namespace-from/download/@babel/plugin-proposal-export-namespace-from-7.14.5.tgz", + "integrity": "sha1-260kQxDObM0IMHIWfYzqg6Uvr3Y=", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.14.5", + "@babel/plugin-syntax-export-namespace-from": "^7.8.3" + } + }, + "@babel/plugin-proposal-json-strings": { + "version": "7.14.5", + "resolved": "https://registry.nlark.com/@babel/plugin-proposal-json-strings/download/@babel/plugin-proposal-json-strings-7.14.5.tgz", + "integrity": "sha1-ON5g2zYug6PYyUSshY3fnwwiOes=", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.14.5", + "@babel/plugin-syntax-json-strings": "^7.8.3" + } + }, + "@babel/plugin-proposal-logical-assignment-operators": { + "version": "7.14.5", + "resolved": "https://registry.nlark.com/@babel/plugin-proposal-logical-assignment-operators/download/@babel/plugin-proposal-logical-assignment-operators-7.14.5.tgz", + "integrity": "sha1-bmIpwqmbAqspFfglceDMZGpAxzg=", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.14.5", + "@babel/plugin-syntax-logical-assignment-operators": "^7.10.4" + } + }, + "@babel/plugin-proposal-nullish-coalescing-operator": { + "version": "7.14.5", + "resolved": "https://registry.nlark.com/@babel/plugin-proposal-nullish-coalescing-operator/download/@babel/plugin-proposal-nullish-coalescing-operator-7.14.5.tgz?cache=0&sync_timestamp=1624607953699&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40babel%2Fplugin-proposal-nullish-coalescing-operator%2Fdownload%2F%40babel%2Fplugin-proposal-nullish-coalescing-operator-7.14.5.tgz", + "integrity": "sha1-7jhYnOAOLMWbKZ7D6kBvzToP2vY=", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.14.5", + "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3" + } + }, + "@babel/plugin-proposal-numeric-separator": { + "version": "7.14.5", + "resolved": "https://registry.nlark.com/@babel/plugin-proposal-numeric-separator/download/@babel/plugin-proposal-numeric-separator-7.14.5.tgz", + "integrity": "sha1-g2Mb8z2aUd8YTCECoGmsDFjAXxg=", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.14.5", + "@babel/plugin-syntax-numeric-separator": "^7.10.4" + } + }, + "@babel/plugin-proposal-object-rest-spread": { + "version": "7.14.7", + "resolved": "https://registry.nlark.com/@babel/plugin-proposal-object-rest-spread/download/@babel/plugin-proposal-object-rest-spread-7.14.7.tgz?cache=0&sync_timestamp=1624608013147&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40babel%2Fplugin-proposal-object-rest-spread%2Fdownload%2F%40babel%2Fplugin-proposal-object-rest-spread-7.14.7.tgz", + "integrity": "sha1-WSCis99/eQHfAgWXTAZBsT/Z02M=", + "dev": true, + "requires": { + "@babel/compat-data": "^7.14.7", + "@babel/helper-compilation-targets": "^7.14.5", + "@babel/helper-plugin-utils": "^7.14.5", + "@babel/plugin-syntax-object-rest-spread": "^7.8.3", + "@babel/plugin-transform-parameters": "^7.14.5" + } + }, + "@babel/plugin-proposal-optional-catch-binding": { + "version": "7.14.5", + "resolved": "https://registry.nlark.com/@babel/plugin-proposal-optional-catch-binding/download/@babel/plugin-proposal-optional-catch-binding-7.14.5.tgz", + "integrity": "sha1-k53W7d7/Omf997PwRLU0cmJZjDw=", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.14.5", + "@babel/plugin-syntax-optional-catch-binding": "^7.8.3" + } + }, + "@babel/plugin-proposal-optional-chaining": { + "version": "7.14.5", + "resolved": "https://registry.nlark.com/@babel/plugin-proposal-optional-chaining/download/@babel/plugin-proposal-optional-chaining-7.14.5.tgz", + "integrity": "sha1-+oNlHmCjYOPxN5fu8AuNUZaVtgM=", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.14.5", + "@babel/helper-skip-transparent-expression-wrappers": "^7.14.5", + "@babel/plugin-syntax-optional-chaining": "^7.8.3" + } + }, + "@babel/plugin-proposal-private-methods": { + "version": "7.14.5", + "resolved": "https://registry.nlark.com/@babel/plugin-proposal-private-methods/download/@babel/plugin-proposal-private-methods-7.14.5.tgz?cache=0&sync_timestamp=1624607954131&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40babel%2Fplugin-proposal-private-methods%2Fdownload%2F%40babel%2Fplugin-proposal-private-methods-7.14.5.tgz", + "integrity": "sha1-N0RklZlrKUXzD1vltg1eKqT1eS0=", + "dev": true, + "requires": { + "@babel/helper-create-class-features-plugin": "^7.14.5", + "@babel/helper-plugin-utils": "^7.14.5" + } + }, + "@babel/plugin-proposal-private-property-in-object": { + "version": "7.15.4", + "resolved": "https://registry.nlark.com/@babel/plugin-proposal-private-property-in-object/download/@babel/plugin-proposal-private-property-in-object-7.15.4.tgz", + "integrity": "sha1-VcXjtNAmH9RP5jfj9iTPsPSE4+U=", + "dev": true, + "requires": { + "@babel/helper-annotate-as-pure": "^7.15.4", + "@babel/helper-create-class-features-plugin": "^7.15.4", + "@babel/helper-plugin-utils": "^7.14.5", + "@babel/plugin-syntax-private-property-in-object": "^7.14.5" + } + }, + "@babel/plugin-proposal-unicode-property-regex": { + "version": "7.14.5", + "resolved": "https://registry.nlark.com/@babel/plugin-proposal-unicode-property-regex/download/@babel/plugin-proposal-unicode-property-regex-7.14.5.tgz", + "integrity": "sha1-D5XuDnV6XWR/N42qDsp+k/qou+g=", + "dev": true, + "requires": { + "@babel/helper-create-regexp-features-plugin": "^7.14.5", + "@babel/helper-plugin-utils": "^7.14.5" + } + }, + "@babel/plugin-syntax-async-generators": { + "version": "7.8.4", + "resolved": "https://registry.nlark.com/@babel/plugin-syntax-async-generators/download/@babel/plugin-syntax-async-generators-7.8.4.tgz", + "integrity": "sha1-qYP7Gusuw/btBCohD2QOkOeG/g0=", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.8.0" + } + }, + "@babel/plugin-syntax-class-properties": { + "version": "7.12.13", + "resolved": "https://registry.nlark.com/@babel/plugin-syntax-class-properties/download/@babel/plugin-syntax-class-properties-7.12.13.tgz", + "integrity": "sha1-tcmHJ0xKOoK4lxR5aTGmtTVErhA=", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.12.13" + } + }, + "@babel/plugin-syntax-class-static-block": { + "version": "7.14.5", + "resolved": "https://registry.nlark.com/@babel/plugin-syntax-class-static-block/download/@babel/plugin-syntax-class-static-block-7.14.5.tgz", + "integrity": "sha1-GV34mxRrS3izv4l/16JXyEZZ1AY=", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.14.5" + } + }, + "@babel/plugin-syntax-dynamic-import": { + "version": "7.8.3", + "resolved": "https://registry.nlark.com/@babel/plugin-syntax-dynamic-import/download/@babel/plugin-syntax-dynamic-import-7.8.3.tgz?cache=0&sync_timestamp=1624608013305&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40babel%2Fplugin-syntax-dynamic-import%2Fdownload%2F%40babel%2Fplugin-syntax-dynamic-import-7.8.3.tgz", + "integrity": "sha1-Yr+Ysto80h1iYVT8lu5bPLaOrLM=", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.8.0" + } + }, + "@babel/plugin-syntax-export-namespace-from": { + "version": "7.8.3", + "resolved": "https://registry.nlark.com/@babel/plugin-syntax-export-namespace-from/download/@babel/plugin-syntax-export-namespace-from-7.8.3.tgz", + "integrity": "sha1-AolkqbqA28CUyRXEh618TnpmRlo=", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.8.3" + } + }, + "@babel/plugin-syntax-json-strings": { + "version": "7.8.3", + "resolved": "https://registry.nlark.com/@babel/plugin-syntax-json-strings/download/@babel/plugin-syntax-json-strings-7.8.3.tgz", + "integrity": "sha1-AcohtmjNghjJ5kDLbdiMVBKyyWo=", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.8.0" + } + }, + "@babel/plugin-syntax-logical-assignment-operators": { + "version": "7.10.4", + "resolved": "https://registry.nlark.com/@babel/plugin-syntax-logical-assignment-operators/download/@babel/plugin-syntax-logical-assignment-operators-7.10.4.tgz", + "integrity": "sha1-ypHvRjA1MESLkGZSusLp/plB9pk=", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.10.4" + } + }, + "@babel/plugin-syntax-nullish-coalescing-operator": { + "version": "7.8.3", + "resolved": "https://registry.nlark.com/@babel/plugin-syntax-nullish-coalescing-operator/download/@babel/plugin-syntax-nullish-coalescing-operator-7.8.3.tgz", + "integrity": "sha1-Fn7XA2iIYIH3S1w2xlqIwDtm0ak=", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.8.0" + } + }, + "@babel/plugin-syntax-numeric-separator": { + "version": "7.10.4", + "resolved": "https://registry.nlark.com/@babel/plugin-syntax-numeric-separator/download/@babel/plugin-syntax-numeric-separator-7.10.4.tgz", + "integrity": "sha1-ubBws+M1cM2f0Hun+pHA3Te5r5c=", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.10.4" + } + }, + "@babel/plugin-syntax-object-rest-spread": { + "version": "7.8.3", + "resolved": "https://registry.nlark.com/@babel/plugin-syntax-object-rest-spread/download/@babel/plugin-syntax-object-rest-spread-7.8.3.tgz", + "integrity": "sha1-YOIl7cvZimQDMqLnLdPmbxr1WHE=", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.8.0" + } + }, + "@babel/plugin-syntax-optional-catch-binding": { + "version": "7.8.3", + "resolved": "https://registry.nlark.com/@babel/plugin-syntax-optional-catch-binding/download/@babel/plugin-syntax-optional-catch-binding-7.8.3.tgz", + "integrity": "sha1-YRGiZbz7Ag6579D9/X0mQCue1sE=", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.8.0" + } + }, + "@babel/plugin-syntax-optional-chaining": { + "version": "7.8.3", + "resolved": "https://registry.nlark.com/@babel/plugin-syntax-optional-chaining/download/@babel/plugin-syntax-optional-chaining-7.8.3.tgz", + "integrity": "sha1-T2nCq5UWfgGAzVM2YT+MV4j31Io=", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.8.0" + } + }, + "@babel/plugin-syntax-private-property-in-object": { + "version": "7.14.5", + "resolved": "https://registry.nlark.com/@babel/plugin-syntax-private-property-in-object/download/@babel/plugin-syntax-private-property-in-object-7.14.5.tgz", + "integrity": "sha1-DcZnHsDqIrbpShEU+FeXDNOd4a0=", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.14.5" + } + }, + "@babel/plugin-syntax-top-level-await": { + "version": "7.14.5", + "resolved": "https://registry.nlark.com/@babel/plugin-syntax-top-level-await/download/@babel/plugin-syntax-top-level-await-7.14.5.tgz", + "integrity": "sha1-wc/a3DWmRiQAAfBhOCR7dBw02Uw=", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.14.5" + } + }, + "@babel/plugin-syntax-typescript": { + "version": "7.14.5", + "resolved": "https://registry.nlark.com/@babel/plugin-syntax-typescript/download/@babel/plugin-syntax-typescript-7.14.5.tgz", + "integrity": "sha1-uCxs5HGxZbXOQgz5KRTW+0YiVxY=", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.14.5" + } + }, + "@babel/plugin-transform-arrow-functions": { + "version": "7.14.5", + "resolved": "https://registry.nlark.com/@babel/plugin-transform-arrow-functions/download/@babel/plugin-transform-arrow-functions-7.14.5.tgz?cache=0&sync_timestamp=1624607954413&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40babel%2Fplugin-transform-arrow-functions%2Fdownload%2F%40babel%2Fplugin-transform-arrow-functions-7.14.5.tgz", + "integrity": "sha1-9xh9lYinaN0IC/TJ/+EX6mL3hio=", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.14.5" + } + }, + "@babel/plugin-transform-async-to-generator": { + "version": "7.14.5", + "resolved": "https://registry.nlark.com/@babel/plugin-transform-async-to-generator/download/@babel/plugin-transform-async-to-generator-7.14.5.tgz", + "integrity": "sha1-cseJCE2PIJSsuUVjOUPvhEPTnmc=", + "dev": true, + "requires": { + "@babel/helper-module-imports": "^7.14.5", + "@babel/helper-plugin-utils": "^7.14.5", + "@babel/helper-remap-async-to-generator": "^7.14.5" + } + }, + "@babel/plugin-transform-block-scoped-functions": { + "version": "7.14.5", + "resolved": "https://registry.nlark.com/@babel/plugin-transform-block-scoped-functions/download/@babel/plugin-transform-block-scoped-functions-7.14.5.tgz", + "integrity": "sha1-5IZB2ZnUvBV6Z+8zautUvET9OtQ=", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.14.5" + } + }, + "@babel/plugin-transform-block-scoping": { + "version": "7.15.3", + "resolved": "https://registry.nlark.com/@babel/plugin-transform-block-scoping/download/@babel/plugin-transform-block-scoping-7.15.3.tgz", + "integrity": "sha1-lMgabi/CMLzObvU3rJah5NKzr68=", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.14.5" + } + }, + "@babel/plugin-transform-classes": { + "version": "7.15.4", + "resolved": "https://registry.nlark.com/@babel/plugin-transform-classes/download/@babel/plugin-transform-classes-7.15.4.tgz", + "integrity": "sha1-UK7heq9/MyrkTjvOTC4QU01dO/E=", + "dev": true, + "requires": { + "@babel/helper-annotate-as-pure": "^7.15.4", + "@babel/helper-function-name": "^7.15.4", + "@babel/helper-optimise-call-expression": "^7.15.4", + "@babel/helper-plugin-utils": "^7.14.5", + "@babel/helper-replace-supers": "^7.15.4", + "@babel/helper-split-export-declaration": "^7.15.4", + "globals": "^11.1.0" + } + }, + "@babel/plugin-transform-computed-properties": { + "version": "7.14.5", + "resolved": "https://registry.nlark.com/@babel/plugin-transform-computed-properties/download/@babel/plugin-transform-computed-properties-7.14.5.tgz", + "integrity": "sha1-G514mHQg0RIj1BGVRhzEO5dLIE8=", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.14.5" + } + }, + "@babel/plugin-transform-destructuring": { + "version": "7.14.7", + "resolved": "https://registry.nlark.com/@babel/plugin-transform-destructuring/download/@babel/plugin-transform-destructuring-7.14.7.tgz?cache=0&sync_timestamp=1624607954836&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40babel%2Fplugin-transform-destructuring%2Fdownload%2F%40babel%2Fplugin-transform-destructuring-7.14.7.tgz", + "integrity": "sha1-CtWO034j4iCE0QnxhSYINeVVdXY=", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.14.5" + } + }, + "@babel/plugin-transform-dotall-regex": { + "version": "7.14.5", + "resolved": "https://registry.nlark.com/@babel/plugin-transform-dotall-regex/download/@babel/plugin-transform-dotall-regex-7.14.5.tgz", + "integrity": "sha1-L2v3bka9+AQ7Tn4WzyRTJim6DHo=", + "dev": true, + "requires": { + "@babel/helper-create-regexp-features-plugin": "^7.14.5", + "@babel/helper-plugin-utils": "^7.14.5" + } + }, + "@babel/plugin-transform-duplicate-keys": { + "version": "7.14.5", + "resolved": "https://registry.nlark.com/@babel/plugin-transform-duplicate-keys/download/@babel/plugin-transform-duplicate-keys-7.14.5.tgz", + "integrity": "sha1-NlpIRIgb3xUB46nwJw5/D5EXeVQ=", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.14.5" + } + }, + "@babel/plugin-transform-exponentiation-operator": { + "version": "7.14.5", + "resolved": "https://registry.nlark.com/@babel/plugin-transform-exponentiation-operator/download/@babel/plugin-transform-exponentiation-operator-7.14.5.tgz", + "integrity": "sha1-UVS43Wo9/m2Qkj1hckvT3uuQtJM=", + "dev": true, + "requires": { + "@babel/helper-builder-binary-assignment-operator-visitor": "^7.14.5", + "@babel/helper-plugin-utils": "^7.14.5" + } + }, + "@babel/plugin-transform-for-of": { + "version": "7.15.4", + "resolved": "https://registry.nlark.com/@babel/plugin-transform-for-of/download/@babel/plugin-transform-for-of-7.15.4.tgz", + "integrity": "sha1-JcYszicYz7KXFfQW511SY/s2qMI=", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.14.5" + } + }, + "@babel/plugin-transform-function-name": { + "version": "7.14.5", + "resolved": "https://registry.nlark.com/@babel/plugin-transform-function-name/download/@babel/plugin-transform-function-name-7.14.5.tgz", + "integrity": "sha1-6Bxl7LkAdG1/MYAva+0fUtkV1vI=", + "dev": true, + "requires": { + "@babel/helper-function-name": "^7.14.5", + "@babel/helper-plugin-utils": "^7.14.5" + } + }, + "@babel/plugin-transform-literals": { + "version": "7.14.5", + "resolved": "https://registry.nlark.com/@babel/plugin-transform-literals/download/@babel/plugin-transform-literals-7.14.5.tgz", + "integrity": "sha1-QdBsf/XU0J489Fh70+zzkwxzD3g=", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.14.5" + } + }, + "@babel/plugin-transform-member-expression-literals": { + "version": "7.14.5", + "resolved": "https://registry.nlark.com/@babel/plugin-transform-member-expression-literals/download/@babel/plugin-transform-member-expression-literals-7.14.5.tgz", + "integrity": "sha1-s5zVISor8jWmF9Mg7CtIvMCRuKc=", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.14.5" + } + }, + "@babel/plugin-transform-modules-amd": { + "version": "7.14.5", + "resolved": "https://registry.nlark.com/@babel/plugin-transform-modules-amd/download/@babel/plugin-transform-modules-amd-7.14.5.tgz", + "integrity": "sha1-T9nOfjQRy4uDhISAtwQdgwBIWPc=", + "dev": true, + "requires": { + "@babel/helper-module-transforms": "^7.14.5", + "@babel/helper-plugin-utils": "^7.14.5", + "babel-plugin-dynamic-import-node": "^2.3.3" + } + }, + "@babel/plugin-transform-modules-commonjs": { + "version": "7.15.4", + "resolved": "https://registry.nlark.com/@babel/plugin-transform-modules-commonjs/download/@babel/plugin-transform-modules-commonjs-7.15.4.tgz", + "integrity": "sha1-ggEQEkDqu1p2wI72GylU92e2tME=", + "dev": true, + "requires": { + "@babel/helper-module-transforms": "^7.15.4", + "@babel/helper-plugin-utils": "^7.14.5", + "@babel/helper-simple-access": "^7.15.4", + "babel-plugin-dynamic-import-node": "^2.3.3" + } + }, + "@babel/plugin-transform-modules-systemjs": { + "version": "7.15.4", + "resolved": "https://registry.nlark.com/@babel/plugin-transform-modules-systemjs/download/@babel/plugin-transform-modules-systemjs-7.15.4.tgz", + "integrity": "sha1-tCiQxzSaeMgncZ8dLQzTjH0mgTI=", + "dev": true, + "requires": { + "@babel/helper-hoist-variables": "^7.15.4", + "@babel/helper-module-transforms": "^7.15.4", + "@babel/helper-plugin-utils": "^7.14.5", + "@babel/helper-validator-identifier": "^7.14.9", + "babel-plugin-dynamic-import-node": "^2.3.3" + } + }, + "@babel/plugin-transform-modules-umd": { + "version": "7.14.5", + "resolved": "https://registry.nlark.com/@babel/plugin-transform-modules-umd/download/@babel/plugin-transform-modules-umd-7.14.5.tgz", + "integrity": "sha1-+2Yt/uaXzOJ0p82lJRkKeQlqpuA=", + "dev": true, + "requires": { + "@babel/helper-module-transforms": "^7.14.5", + "@babel/helper-plugin-utils": "^7.14.5" + } + }, + "@babel/plugin-transform-named-capturing-groups-regex": { + "version": "7.14.9", + "resolved": "https://registry.nlark.com/@babel/plugin-transform-named-capturing-groups-regex/download/@babel/plugin-transform-named-capturing-groups-regex-7.14.9.tgz?cache=0&sync_timestamp=1627804419952&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40babel%2Fplugin-transform-named-capturing-groups-regex%2Fdownload%2F%40babel%2Fplugin-transform-named-capturing-groups-regex-7.14.9.tgz", + "integrity": "sha1-xo9cXRLS66ujdi5XwsT2NHpG57I=", + "dev": true, + "requires": { + "@babel/helper-create-regexp-features-plugin": "^7.14.5" + } + }, + "@babel/plugin-transform-new-target": { + "version": "7.14.5", + "resolved": "https://registry.nlark.com/@babel/plugin-transform-new-target/download/@babel/plugin-transform-new-target-7.14.5.tgz", + "integrity": "sha1-Mb2ui5JdyEB26/zSqZQBQ67X2/g=", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.14.5" + } + }, + "@babel/plugin-transform-object-super": { + "version": "7.14.5", + "resolved": "https://registry.nlark.com/@babel/plugin-transform-object-super/download/@babel/plugin-transform-object-super-7.14.5.tgz", + "integrity": "sha1-0LX66snphZehYanPeMUn7ZNM3EU=", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.14.5", + "@babel/helper-replace-supers": "^7.14.5" + } + }, + "@babel/plugin-transform-parameters": { + "version": "7.15.4", + "resolved": "https://registry.nlark.com/@babel/plugin-transform-parameters/download/@babel/plugin-transform-parameters-7.15.4.tgz", + "integrity": "sha1-XyKFzDFgv0jIUCQycWtIUE0p7WI=", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.14.5" + } + }, + "@babel/plugin-transform-property-literals": { + "version": "7.14.5", + "resolved": "https://registry.nlark.com/@babel/plugin-transform-property-literals/download/@babel/plugin-transform-property-literals-7.14.5.tgz", + "integrity": "sha1-DduqH4PbNgbxzfSEb6HftHNFizQ=", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.14.5" + } + }, + "@babel/plugin-transform-regenerator": { + "version": "7.14.5", + "resolved": "https://registry.nlark.com/@babel/plugin-transform-regenerator/download/@babel/plugin-transform-regenerator-7.14.5.tgz", + "integrity": "sha1-lnb9VwftKPUicnxbPAqoVERAsE8=", + "dev": true, + "requires": { + "regenerator-transform": "^0.14.2" + } + }, + "@babel/plugin-transform-reserved-words": { + "version": "7.14.5", + "resolved": "https://registry.nlark.com/@babel/plugin-transform-reserved-words/download/@babel/plugin-transform-reserved-words-7.14.5.tgz", + "integrity": "sha1-xEWJtmHP2++NQwDcx0ad/6kvgwQ=", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.14.5" + } + }, + "@babel/plugin-transform-shorthand-properties": { + "version": "7.14.5", + "resolved": "https://registry.nlark.com/@babel/plugin-transform-shorthand-properties/download/@babel/plugin-transform-shorthand-properties-7.14.5.tgz?cache=0&sync_timestamp=1624607955296&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40babel%2Fplugin-transform-shorthand-properties%2Fdownload%2F%40babel%2Fplugin-transform-shorthand-properties-7.14.5.tgz", + "integrity": "sha1-l/E4VfFAkzjYyty6ymcK154JGlg=", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.14.5" + } + }, + "@babel/plugin-transform-spread": { + "version": "7.14.6", + "resolved": "https://registry.nlark.com/@babel/plugin-transform-spread/download/@babel/plugin-transform-spread-7.14.6.tgz?cache=0&sync_timestamp=1624607955440&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40babel%2Fplugin-transform-spread%2Fdownload%2F%40babel%2Fplugin-transform-spread-7.14.6.tgz", + "integrity": "sha1-a9QOV/596UqpBIUZY7VhZlL3MUQ=", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.14.5", + "@babel/helper-skip-transparent-expression-wrappers": "^7.14.5" + } + }, + "@babel/plugin-transform-sticky-regex": { + "version": "7.14.5", + "resolved": "https://registry.nlark.com/@babel/plugin-transform-sticky-regex/download/@babel/plugin-transform-sticky-regex-7.14.5.tgz", + "integrity": "sha1-W2F1Qmdei3dhKUOB88KMYz9Arrk=", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.14.5" + } + }, + "@babel/plugin-transform-template-literals": { + "version": "7.14.5", + "resolved": "https://registry.nlark.com/@babel/plugin-transform-template-literals/download/@babel/plugin-transform-template-literals-7.14.5.tgz?cache=0&sync_timestamp=1624607976904&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40babel%2Fplugin-transform-template-literals%2Fdownload%2F%40babel%2Fplugin-transform-template-literals-7.14.5.tgz", + "integrity": "sha1-pfK8Izk32EU4hdxza92Nn/q/PZM=", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.14.5" + } + }, + "@babel/plugin-transform-typeof-symbol": { + "version": "7.14.5", + "resolved": "https://registry.nlark.com/@babel/plugin-transform-typeof-symbol/download/@babel/plugin-transform-typeof-symbol-7.14.5.tgz", + "integrity": "sha1-Oa8nOemJor0pG/a1PxaYFCPUV9Q=", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.14.5" + } + }, + "@babel/plugin-transform-typescript": { + "version": "7.15.4", + "resolved": "https://registry.nlark.com/@babel/plugin-transform-typescript/download/@babel/plugin-transform-typescript-7.15.4.tgz?cache=0&sync_timestamp=1630620772635&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40babel%2Fplugin-transform-typescript%2Fdownload%2F%40babel%2Fplugin-transform-typescript-7.15.4.tgz", + "integrity": "sha1-23oGLc+L5fwJa8DutAoT+/ofolE=", + "dev": true, + "requires": { + "@babel/helper-create-class-features-plugin": "^7.15.4", + "@babel/helper-plugin-utils": "^7.14.5", + "@babel/plugin-syntax-typescript": "^7.14.5" + } + }, + "@babel/plugin-transform-unicode-escapes": { + "version": "7.14.5", + "resolved": "https://registry.nlark.com/@babel/plugin-transform-unicode-escapes/download/@babel/plugin-transform-unicode-escapes-7.14.5.tgz", + "integrity": "sha1-nUvSpoHjxdes9PV/qeURddkdDGs=", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.14.5" + } + }, + "@babel/plugin-transform-unicode-regex": { + "version": "7.14.5", + "resolved": "https://registry.nlark.com/@babel/plugin-transform-unicode-regex/download/@babel/plugin-transform-unicode-regex-7.14.5.tgz", + "integrity": "sha1-TNCbbIQl3YElXHzrP7GDbnQUOC4=", + "dev": true, + "requires": { + "@babel/helper-create-regexp-features-plugin": "^7.14.5", + "@babel/helper-plugin-utils": "^7.14.5" + } + }, + "@babel/preset-env": { + "version": "7.15.4", + "resolved": "https://registry.nlark.com/@babel/preset-env/download/@babel/preset-env-7.15.4.tgz?cache=0&sync_timestamp=1630619344894&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40babel%2Fpreset-env%2Fdownload%2F%40babel%2Fpreset-env-7.15.4.tgz", + "integrity": "sha1-GX5/madVxIjwr0Ea8XnL0Q3m6BU=", + "dev": true, + "requires": { + "@babel/compat-data": "^7.15.0", + "@babel/helper-compilation-targets": "^7.15.4", + "@babel/helper-plugin-utils": "^7.14.5", + "@babel/helper-validator-option": "^7.14.5", + "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": "^7.15.4", + "@babel/plugin-proposal-async-generator-functions": "^7.15.4", + "@babel/plugin-proposal-class-properties": "^7.14.5", + "@babel/plugin-proposal-class-static-block": "^7.15.4", + "@babel/plugin-proposal-dynamic-import": "^7.14.5", + "@babel/plugin-proposal-export-namespace-from": "^7.14.5", + "@babel/plugin-proposal-json-strings": "^7.14.5", + "@babel/plugin-proposal-logical-assignment-operators": "^7.14.5", + "@babel/plugin-proposal-nullish-coalescing-operator": "^7.14.5", + "@babel/plugin-proposal-numeric-separator": "^7.14.5", + "@babel/plugin-proposal-object-rest-spread": "^7.14.7", + "@babel/plugin-proposal-optional-catch-binding": "^7.14.5", + "@babel/plugin-proposal-optional-chaining": "^7.14.5", + "@babel/plugin-proposal-private-methods": "^7.14.5", + "@babel/plugin-proposal-private-property-in-object": "^7.15.4", + "@babel/plugin-proposal-unicode-property-regex": "^7.14.5", + "@babel/plugin-syntax-async-generators": "^7.8.4", + "@babel/plugin-syntax-class-properties": "^7.12.13", + "@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-json-strings": "^7.8.3", + "@babel/plugin-syntax-logical-assignment-operators": "^7.10.4", + "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3", + "@babel/plugin-syntax-numeric-separator": "^7.10.4", + "@babel/plugin-syntax-object-rest-spread": "^7.8.3", + "@babel/plugin-syntax-optional-catch-binding": "^7.8.3", + "@babel/plugin-syntax-optional-chaining": "^7.8.3", + "@babel/plugin-syntax-private-property-in-object": "^7.14.5", + "@babel/plugin-syntax-top-level-await": "^7.14.5", + "@babel/plugin-transform-arrow-functions": "^7.14.5", + "@babel/plugin-transform-async-to-generator": "^7.14.5", + "@babel/plugin-transform-block-scoped-functions": "^7.14.5", + "@babel/plugin-transform-block-scoping": "^7.15.3", + "@babel/plugin-transform-classes": "^7.15.4", + "@babel/plugin-transform-computed-properties": "^7.14.5", + "@babel/plugin-transform-destructuring": "^7.14.7", + "@babel/plugin-transform-dotall-regex": "^7.14.5", + "@babel/plugin-transform-duplicate-keys": "^7.14.5", + "@babel/plugin-transform-exponentiation-operator": "^7.14.5", + "@babel/plugin-transform-for-of": "^7.15.4", + "@babel/plugin-transform-function-name": "^7.14.5", + "@babel/plugin-transform-literals": "^7.14.5", + "@babel/plugin-transform-member-expression-literals": "^7.14.5", + "@babel/plugin-transform-modules-amd": "^7.14.5", + "@babel/plugin-transform-modules-commonjs": "^7.15.4", + "@babel/plugin-transform-modules-systemjs": "^7.15.4", + "@babel/plugin-transform-modules-umd": "^7.14.5", + "@babel/plugin-transform-named-capturing-groups-regex": "^7.14.9", + "@babel/plugin-transform-new-target": "^7.14.5", + "@babel/plugin-transform-object-super": "^7.14.5", + "@babel/plugin-transform-parameters": "^7.15.4", + "@babel/plugin-transform-property-literals": "^7.14.5", + "@babel/plugin-transform-regenerator": "^7.14.5", + "@babel/plugin-transform-reserved-words": "^7.14.5", + "@babel/plugin-transform-shorthand-properties": "^7.14.5", + "@babel/plugin-transform-spread": "^7.14.6", + "@babel/plugin-transform-sticky-regex": "^7.14.5", + "@babel/plugin-transform-template-literals": "^7.14.5", + "@babel/plugin-transform-typeof-symbol": "^7.14.5", + "@babel/plugin-transform-unicode-escapes": "^7.14.5", + "@babel/plugin-transform-unicode-regex": "^7.14.5", + "@babel/preset-modules": "^0.1.4", + "@babel/types": "^7.15.4", + "babel-plugin-polyfill-corejs2": "^0.2.2", + "babel-plugin-polyfill-corejs3": "^0.2.2", + "babel-plugin-polyfill-regenerator": "^0.2.2", + "core-js-compat": "^3.16.0", + "semver": "^6.3.0" + }, + "dependencies": { + "semver": { + "version": "6.3.0", + "resolved": "https://registry.nlark.com/semver/download/semver-6.3.0.tgz?cache=0&sync_timestamp=1624607961409&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fsemver%2Fdownload%2Fsemver-6.3.0.tgz", + "integrity": "sha1-7gpkyK9ejO6mdoexM3YeG+y9HT0=", + "dev": true + } + } + }, + "@babel/preset-modules": { + "version": "0.1.4", + "resolved": "https://registry.nlark.com/@babel/preset-modules/download/@babel/preset-modules-0.1.4.tgz", + "integrity": "sha1-Ni8raMZihClw/bXiVP/I/BwuQV4=", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.0.0", + "@babel/plugin-proposal-unicode-property-regex": "^7.4.4", + "@babel/plugin-transform-dotall-regex": "^7.4.4", + "@babel/types": "^7.4.4", + "esutils": "^2.0.2" + } + }, + "@babel/preset-typescript": { + "version": "7.15.0", + "resolved": "https://registry.nlark.com/@babel/preset-typescript/download/@babel/preset-typescript-7.15.0.tgz", + "integrity": "sha1-6PymOKGg9k8U4RGff+RQAneECUU=", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.14.5", + "@babel/helper-validator-option": "^7.14.5", + "@babel/plugin-transform-typescript": "^7.15.0" + } + }, + "@babel/runtime": { + "version": "7.15.4", + "resolved": "https://registry.nlark.com/@babel/runtime/download/@babel/runtime-7.15.4.tgz", + "integrity": "sha1-/RfRa/34eObdAtGXU6OfqKjZyEo=", + "dev": true, + "requires": { + "regenerator-runtime": "^0.13.4" + } + }, + "@babel/template": { + "version": "7.15.4", + "resolved": "https://registry.nlark.com/@babel/template/download/@babel/template-7.15.4.tgz", + "integrity": "sha1-UYmNNdzz+qZwxO5q/P1RfuE58ZQ=", + "dev": true, + "requires": { + "@babel/code-frame": "^7.14.5", + "@babel/parser": "^7.15.4", + "@babel/types": "^7.15.4" + } + }, + "@babel/traverse": { + "version": "7.15.4", + "resolved": "https://registry.nlark.com/@babel/traverse/download/@babel/traverse-7.15.4.tgz", + "integrity": "sha1-/4UQNnoUS/v/VS2eGOKPPiiJwi0=", + "dev": true, + "requires": { + "@babel/code-frame": "^7.14.5", + "@babel/generator": "^7.15.4", + "@babel/helper-function-name": "^7.15.4", + "@babel/helper-hoist-variables": "^7.15.4", + "@babel/helper-split-export-declaration": "^7.15.4", + "@babel/parser": "^7.15.4", + "@babel/types": "^7.15.4", + "debug": "^4.1.0", + "globals": "^11.1.0" + } + }, + "@babel/types": { + "version": "7.15.4", + "resolved": "https://registry.nlark.com/@babel/types/download/@babel/types-7.15.4.tgz", + "integrity": "sha1-dO64bb1nSNJ0E5ZVe5hg5X/OCg0=", + "dev": true, + "requires": { + "@babel/helper-validator-identifier": "^7.14.9", + "to-fast-properties": "^2.0.0" + } + }, + "@discoveryjs/json-ext": { + "version": "0.5.3", + "resolved": "https://registry.nlark.com/@discoveryjs/json-ext/download/@discoveryjs/json-ext-0.5.3.tgz", + "integrity": "sha1-kEIPn5xtOYfxdqGafY52QnGi9V0=" + }, + "@eslint/eslintrc": { + "version": "0.4.3", + "resolved": "https://registry.nlark.com/@eslint/eslintrc/download/@eslint/eslintrc-0.4.3.tgz?cache=0&sync_timestamp=1628296902668&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40eslint%2Feslintrc%2Fdownload%2F%40eslint%2Feslintrc-0.4.3.tgz", + "integrity": "sha1-nkKYHvA1vrPdSa3ResuW6P9vOUw=", + "dev": true, + "requires": { + "ajv": "^6.12.4", + "debug": "^4.1.1", + "espree": "^7.3.0", + "globals": "^13.9.0", + "ignore": "^4.0.6", + "import-fresh": "^3.2.1", + "js-yaml": "^3.13.1", + "minimatch": "^3.0.4", + "strip-json-comments": "^3.1.1" + }, + "dependencies": { + "globals": { + "version": "13.11.0", + "resolved": "https://registry.nlark.com/globals/download/globals-13.11.0.tgz", + "integrity": "sha1-QO9njaEX/nvS4o8fqySVG9AlW+c=", + "dev": true, + "requires": { + "type-fest": "^0.20.2" + } + }, + "ignore": { + "version": "4.0.6", + "resolved": "https://registry.nlark.com/ignore/download/ignore-4.0.6.tgz", + "integrity": "sha1-dQ49tYYgh7RzfrrIIH/9HvJ7Jfw=", + "dev": true + } + } + }, + "@humanwhocodes/config-array": { + "version": "0.5.0", + "resolved": "https://registry.nlark.com/@humanwhocodes/config-array/download/@humanwhocodes/config-array-0.5.0.tgz?cache=0&sync_timestamp=1625263855104&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40humanwhocodes%2Fconfig-array%2Fdownload%2F%40humanwhocodes%2Fconfig-array-0.5.0.tgz", + "integrity": "sha1-FAeWfUxu7Nc4j4Os8er00Mbljvk=", + "dev": true, + "requires": { + "@humanwhocodes/object-schema": "^1.2.0", + "debug": "^4.1.1", + "minimatch": "^3.0.4" + } + }, + "@humanwhocodes/object-schema": { + "version": "1.2.0", + "resolved": "https://registry.nlark.com/@humanwhocodes/object-schema/download/@humanwhocodes/object-schema-1.2.0.tgz?cache=0&sync_timestamp=1625263889550&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40humanwhocodes%2Fobject-schema%2Fdownload%2F%40humanwhocodes%2Fobject-schema-1.2.0.tgz", + "integrity": "sha1-h956+cIxgm/daKxyWPd8Qp4OX88=", + "dev": true + }, + "@nicolo-ribaudo/chokidar-2": { + "version": "2.1.8-no-fsevents.2", + "resolved": "https://registry.nlark.com/@nicolo-ribaudo/chokidar-2/download/@nicolo-ribaudo/chokidar-2-2.1.8-no-fsevents.2.tgz", + "integrity": "sha1-4yTAokelVnGS3XGAZHcJ1+L6+Us=", + "dev": true, + "optional": true, + "requires": { + "anymatch": "^2.0.0", + "async-each": "^1.0.1", + "braces": "^2.3.2", + "glob-parent": "^5.1.2", + "inherits": "^2.0.3", + "is-binary-path": "^1.0.0", + "is-glob": "^4.0.0", + "normalize-path": "^3.0.0", + "path-is-absolute": "^1.0.0", + "readdirp": "^2.2.1", + "upath": "^1.1.1" + }, + "dependencies": { + "anymatch": { + "version": "2.0.0", + "resolved": "https://registry.nlark.com/anymatch/download/anymatch-2.0.0.tgz", + "integrity": "sha1-vLJLTzeTTZqnrBe0ra+J58du8us=", + "dev": true, + "optional": true, + "requires": { + "micromatch": "^3.1.4", + "normalize-path": "^2.1.1" + }, + "dependencies": { + "normalize-path": { + "version": "2.1.1", + "resolved": "https://registry.nlark.com/normalize-path/download/normalize-path-2.1.1.tgz", + "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=", + "dev": true, + "optional": true, + "requires": { + "remove-trailing-separator": "^1.0.1" + } + } + } + }, + "braces": { + "version": "2.3.2", + "resolved": "https://registry.nlark.com/braces/download/braces-2.3.2.tgz", + "integrity": "sha1-WXn9PxTNUxVl5fot8av/8d+u5yk=", + "dev": true, + "optional": true, + "requires": { + "arr-flatten": "^1.1.0", + "array-unique": "^0.3.2", + "extend-shallow": "^2.0.1", + "fill-range": "^4.0.0", + "isobject": "^3.0.1", + "repeat-element": "^1.1.2", + "snapdragon": "^0.8.1", + "snapdragon-node": "^2.0.1", + "split-string": "^3.0.2", + "to-regex": "^3.0.1" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.nlark.com/extend-shallow/download/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "optional": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "fill-range": { + "version": "4.0.0", + "resolved": "https://registry.nlark.com/fill-range/download/fill-range-4.0.0.tgz", + "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=", + "dev": true, + "optional": true, + "requires": { + "extend-shallow": "^2.0.1", + "is-number": "^3.0.0", + "repeat-string": "^1.6.1", + "to-regex-range": "^2.1.0" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.nlark.com/extend-shallow/download/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "optional": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "is-number": { + "version": "3.0.0", + "resolved": "https://registry.nlark.com/is-number/download/is-number-3.0.0.tgz", + "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "dev": true, + "optional": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.nlark.com/kind-of/download/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "optional": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "micromatch": { + "version": "3.1.10", + "resolved": "https://registry.nlark.com/micromatch/download/micromatch-3.1.10.tgz", + "integrity": "sha1-cIWbyVyYQJUvNZoGij/En57PrCM=", + "dev": true, + "optional": true, + "requires": { + "arr-diff": "^4.0.0", + "array-unique": "^0.3.2", + "braces": "^2.3.1", + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "extglob": "^2.0.4", + "fragment-cache": "^0.2.1", + "kind-of": "^6.0.2", + "nanomatch": "^1.2.9", + "object.pick": "^1.3.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.2" + } + }, + "to-regex-range": { + "version": "2.1.1", + "resolved": "https://registry.nlark.com/to-regex-range/download/to-regex-range-2.1.1.tgz", + "integrity": "sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg=", + "dev": true, + "optional": true, + "requires": { + "is-number": "^3.0.0", + "repeat-string": "^1.6.1" + } + } + } + }, + "@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "https://registry.nlark.com/@nodelib/fs.scandir/download/@nodelib/fs.scandir-2.1.5.tgz", + "integrity": "sha1-dhnC6yGyVIP20WdUi0z9WnSIw9U=", + "requires": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + } + }, + "@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "https://registry.nlark.com/@nodelib/fs.stat/download/@nodelib/fs.stat-2.0.5.tgz", + "integrity": "sha1-W9Jir5Tp0lvR5xsF3u1Eh2oiLos=" + }, + "@nodelib/fs.walk": { + "version": "1.2.8", + "resolved": "https://registry.nlark.com/@nodelib/fs.walk/download/@nodelib/fs.walk-1.2.8.tgz", + "integrity": "sha1-6Vc36LtnRt3t9pxVaVNJTxlv5po=", + "requires": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + } + }, + "@types/eslint": { + "version": "7.28.0", + "resolved": "https://registry.nlark.com/@types/eslint/download/@types/eslint-7.28.0.tgz?cache=0&sync_timestamp=1629707594595&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40types%2Feslint%2Fdownload%2F%40types%2Feslint-7.28.0.tgz", + "integrity": "sha1-fkHySB0wHGjhT0g/4QsBd1POjVo=", + "requires": { + "@types/estree": "*", + "@types/json-schema": "*" + } + }, + "@types/eslint-scope": { + "version": "3.7.1", + "resolved": "https://registry.nlark.com/@types/eslint-scope/download/@types/eslint-scope-3.7.1.tgz", + "integrity": "sha1-jcOQp7T53Z8ShGKe/OmC5BYSEW4=", + "requires": { + "@types/eslint": "*", + "@types/estree": "*" + } + }, + "@types/estree": { + "version": "0.0.50", + "resolved": "https://registry.nlark.com/@types/estree/download/@types/estree-0.0.50.tgz", + "integrity": "sha1-Hgyqk2TT/M0pMcPtlv2+ql1MyoM=" + }, + "@types/glob": { + "version": "7.1.4", + "resolved": "https://registry.nlark.com/@types/glob/download/@types/glob-7.1.4.tgz", + "integrity": "sha1-6lniHS7lxReRTLS8jkFTuZ5WZnI=", + "requires": { + "@types/minimatch": "*", + "@types/node": "*" + } + }, + "@types/json-schema": { + "version": "7.0.9", + "resolved": "https://registry.nlark.com/@types/json-schema/download/@types/json-schema-7.0.9.tgz", + "integrity": "sha1-l+3JA36gw4WFMgsolk3eOznkZg0=" + }, + "@types/minimatch": { + "version": "3.0.5", + "resolved": "https://registry.nlark.com/@types/minimatch/download/@types/minimatch-3.0.5.tgz?cache=0&sync_timestamp=1629708337307&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40types%2Fminimatch%2Fdownload%2F%40types%2Fminimatch-3.0.5.tgz", + "integrity": "sha1-EAHMXmo3BLg8I2An538vWOoBD0A=" + }, + "@types/node": { + "version": "16.7.10", + "resolved": "https://registry.nlark.com/@types/node/download/@types/node-16.7.10.tgz", + "integrity": "sha1-eqcyzEc0HBKha31WL1GcI4O21Pw=" + }, + "@types/source-list-map": { + "version": "0.1.2", + "resolved": "https://registry.nlark.com/@types/source-list-map/download/@types/source-list-map-0.1.2.tgz", + "integrity": "sha1-AHiDYGP/rxdBI0m7o2QIfgrALsk=" + }, + "@types/tapable": { + "version": "1.0.8", + "resolved": "https://registry.nlark.com/@types/tapable/download/@types/tapable-1.0.8.tgz?cache=0&sync_timestamp=1629709441343&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40types%2Ftapable%2Fdownload%2F%40types%2Ftapable-1.0.8.tgz", + "integrity": "sha1-uUpDkchWZse3Mpn9OtedT6pDUxA=" + }, + "@types/uglify-js": { + "version": "3.13.1", + "resolved": "https://registry.nlark.com/@types/uglify-js/download/@types/uglify-js-3.13.1.tgz?cache=0&sync_timestamp=1629709602784&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40types%2Fuglify-js%2Fdownload%2F%40types%2Fuglify-js-3.13.1.tgz", + "integrity": "sha1-XoienoHpQkXHW2RQYA4cXqKHiuo=", + "requires": { + "source-map": "^0.6.1" + } + }, + "@types/webpack": { + "version": "4.41.30", + "resolved": "https://registry.nlark.com/@types/webpack/download/@types/webpack-4.41.30.tgz", + "integrity": "sha1-/T220NQeFFqO7q/NPEp8zekGjdw=", + "requires": { + "@types/node": "*", + "@types/tapable": "^1", + "@types/uglify-js": "*", + "@types/webpack-sources": "*", + "anymatch": "^3.0.0", + "source-map": "^0.6.0" + } + }, + "@types/webpack-sources": { + "version": "3.2.0", + "resolved": "https://registry.nlark.com/@types/webpack-sources/download/@types/webpack-sources-3.2.0.tgz?cache=0&sync_timestamp=1629709756861&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40types%2Fwebpack-sources%2Fdownload%2F%40types%2Fwebpack-sources-3.2.0.tgz", + "integrity": "sha1-FtdZuglsKJA0smVT0t8b9FJI04s=", + "requires": { + "@types/node": "*", + "@types/source-list-map": "*", + "source-map": "^0.7.3" + }, + "dependencies": { + "source-map": { + "version": "0.7.3", + "resolved": "https://registry.nlark.com/source-map/download/source-map-0.7.3.tgz?cache=0&sync_timestamp=1624608014898&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fsource-map%2Fdownload%2Fsource-map-0.7.3.tgz", + "integrity": "sha1-UwL4FpAxc1ImVECS5kmB91F1A4M=" + } + } + }, + "@typescript-eslint/parser": { + "version": "4.30.0", + "resolved": "https://registry.nlark.com/@typescript-eslint/parser/download/@typescript-eslint/parser-4.30.0.tgz", + "integrity": "sha1-ar1yD2a9eQ8+DoDDvncYDI/LGS0=", + "dev": true, + "requires": { + "@typescript-eslint/scope-manager": "4.30.0", + "@typescript-eslint/types": "4.30.0", + "@typescript-eslint/typescript-estree": "4.30.0", + "debug": "^4.3.1" + } + }, + "@typescript-eslint/scope-manager": { + "version": "4.30.0", + "resolved": "https://registry.nlark.com/@typescript-eslint/scope-manager/download/@typescript-eslint/scope-manager-4.30.0.tgz?cache=0&sync_timestamp=1630474454313&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40typescript-eslint%2Fscope-manager%2Fdownload%2F%40typescript-eslint%2Fscope-manager-4.30.0.tgz", + "integrity": "sha1-Gj/7s4WxoGvoXNUWWiIyTwaahe4=", + "dev": true, + "requires": { + "@typescript-eslint/types": "4.30.0", + "@typescript-eslint/visitor-keys": "4.30.0" + } + }, + "@typescript-eslint/types": { + "version": "4.30.0", + "resolved": "https://registry.nlark.com/@typescript-eslint/types/download/@typescript-eslint/types-4.30.0.tgz?cache=0&sync_timestamp=1630474457027&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40typescript-eslint%2Ftypes%2Fdownload%2F%40typescript-eslint%2Ftypes-4.30.0.tgz", + "integrity": "sha1-+52bA1hCbxhof7qC6wsPhpeAIE8=", + "dev": true + }, + "@typescript-eslint/typescript-estree": { + "version": "4.30.0", + "resolved": "https://registry.nlark.com/@typescript-eslint/typescript-estree/download/@typescript-eslint/typescript-estree-4.30.0.tgz?cache=0&sync_timestamp=1630474515380&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40typescript-eslint%2Ftypescript-estree%2Fdownload%2F%40typescript-eslint%2Ftypescript-estree-4.30.0.tgz", + "integrity": "sha1-rleDPacqdT9IRs0wU3WMdxZwwqw=", + "dev": true, + "requires": { + "@typescript-eslint/types": "4.30.0", + "@typescript-eslint/visitor-keys": "4.30.0", + "debug": "^4.3.1", + "globby": "^11.0.3", + "is-glob": "^4.0.1", + "semver": "^7.3.5", + "tsutils": "^3.21.0" + }, + "dependencies": { + "array-union": { + "version": "2.1.0", + "resolved": "https://registry.nlark.com/array-union/download/array-union-2.1.0.tgz", + "integrity": "sha1-t5hCCtvrHego2ErNii4j0+/oXo0=", + "dev": true + }, + "globby": { + "version": "11.0.4", + "resolved": "https://registry.nlark.com/globby/download/globby-11.0.4.tgz", + "integrity": "sha1-LLr/d8Lypi5x6bKBOme5ejowAaU=", + "dev": true, + "requires": { + "array-union": "^2.1.0", + "dir-glob": "^3.0.1", + "fast-glob": "^3.1.1", + "ignore": "^5.1.4", + "merge2": "^1.3.0", + "slash": "^3.0.0" + } + } + } + }, + "@typescript-eslint/visitor-keys": { + "version": "4.30.0", + "resolved": "https://registry.nlark.com/@typescript-eslint/visitor-keys/download/@typescript-eslint/visitor-keys-4.30.0.tgz", + "integrity": "sha1-pHxicvxxsMYn0WkfaOrs9K1xRF4=", + "dev": true, + "requires": { + "@typescript-eslint/types": "4.30.0", + "eslint-visitor-keys": "^2.0.0" + } + }, + "@ungap/promise-all-settled": { + "version": "1.1.2", + "resolved": "https://registry.nlark.com/@ungap/promise-all-settled/download/@ungap/promise-all-settled-1.1.2.tgz", + "integrity": "sha1-qlgEJxHW4ydd033Fl+XTHowpCkQ=", + "dev": true + }, + "@webassemblyjs/ast": { + "version": "1.11.1", + "resolved": "https://registry.nlark.com/@webassemblyjs/ast/download/@webassemblyjs/ast-1.11.1.tgz?cache=0&sync_timestamp=1625473420080&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40webassemblyjs%2Fast%2Fdownload%2F%40webassemblyjs%2Fast-1.11.1.tgz", + "integrity": "sha1-K/12fq4aaZb0Mv9+jX/HVnnAtqc=", + "requires": { + "@webassemblyjs/helper-numbers": "1.11.1", + "@webassemblyjs/helper-wasm-bytecode": "1.11.1" + } + }, + "@webassemblyjs/floating-point-hex-parser": { + "version": "1.11.1", + "resolved": "https://registry.nlark.com/@webassemblyjs/floating-point-hex-parser/download/@webassemblyjs/floating-point-hex-parser-1.11.1.tgz", + "integrity": "sha1-9sYacF8P16auyqToGY8j2dwXnk8=" + }, + "@webassemblyjs/helper-api-error": { + "version": "1.11.1", + "resolved": "https://registry.nlark.com/@webassemblyjs/helper-api-error/download/@webassemblyjs/helper-api-error-1.11.1.tgz?cache=0&sync_timestamp=1625473346773&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40webassemblyjs%2Fhelper-api-error%2Fdownload%2F%40webassemblyjs%2Fhelper-api-error-1.11.1.tgz", + "integrity": "sha1-GmMZLYeI5cASgAump6RscFKI/RY=" + }, + "@webassemblyjs/helper-buffer": { + "version": "1.11.1", + "resolved": "https://registry.nlark.com/@webassemblyjs/helper-buffer/download/@webassemblyjs/helper-buffer-1.11.1.tgz", + "integrity": "sha1-gyqQDrREiEzemnytRn+BUA9eWrU=" + }, + "@webassemblyjs/helper-numbers": { + "version": "1.11.1", + "resolved": "https://registry.nlark.com/@webassemblyjs/helper-numbers/download/@webassemblyjs/helper-numbers-1.11.1.tgz", + "integrity": "sha1-ZNgdohn7u6HjvRv8dPboxOEKYq4=", + "requires": { + "@webassemblyjs/floating-point-hex-parser": "1.11.1", + "@webassemblyjs/helper-api-error": "1.11.1", + "@xtuc/long": "4.2.2" + } + }, + "@webassemblyjs/helper-wasm-bytecode": { + "version": "1.11.1", + "resolved": "https://registry.nlark.com/@webassemblyjs/helper-wasm-bytecode/download/@webassemblyjs/helper-wasm-bytecode-1.11.1.tgz", + "integrity": "sha1-8ygkHkHnsZnQsgwY6IQpxEMyleE=" + }, + "@webassemblyjs/helper-wasm-section": { + "version": "1.11.1", + "resolved": "https://registry.nlark.com/@webassemblyjs/helper-wasm-section/download/@webassemblyjs/helper-wasm-section-1.11.1.tgz?cache=0&sync_timestamp=1625473466570&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40webassemblyjs%2Fhelper-wasm-section%2Fdownload%2F%40webassemblyjs%2Fhelper-wasm-section-1.11.1.tgz", + "integrity": "sha1-Ie4GWntjXzGec48N1zv72igcCXo=", + "requires": { + "@webassemblyjs/ast": "1.11.1", + "@webassemblyjs/helper-buffer": "1.11.1", + "@webassemblyjs/helper-wasm-bytecode": "1.11.1", + "@webassemblyjs/wasm-gen": "1.11.1" + } + }, + "@webassemblyjs/ieee754": { + "version": "1.11.1", + "resolved": "https://registry.nlark.com/@webassemblyjs/ieee754/download/@webassemblyjs/ieee754-1.11.1.tgz", + "integrity": "sha1-ljkp6bvQVwnn4SJDoJkYCBKZJhQ=", + "requires": { + "@xtuc/ieee754": "^1.2.0" + } + }, + "@webassemblyjs/leb128": { + "version": "1.11.1", + "resolved": "https://registry.nlark.com/@webassemblyjs/leb128/download/@webassemblyjs/leb128-1.11.1.tgz", + "integrity": "sha1-zoFLRVdOk9drrh+yZEq5zdlSeqU=", + "requires": { + "@xtuc/long": "4.2.2" + } + }, + "@webassemblyjs/utf8": { + "version": "1.11.1", + "resolved": "https://registry.nlark.com/@webassemblyjs/utf8/download/@webassemblyjs/utf8-1.11.1.tgz", + "integrity": "sha1-0fi3ZDaefG5rrjUOhU3smlnwo/8=" + }, + "@webassemblyjs/wasm-edit": { + "version": "1.11.1", + "resolved": "https://registry.nlark.com/@webassemblyjs/wasm-edit/download/@webassemblyjs/wasm-edit-1.11.1.tgz?cache=0&sync_timestamp=1625473422937&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40webassemblyjs%2Fwasm-edit%2Fdownload%2F%40webassemblyjs%2Fwasm-edit-1.11.1.tgz", + "integrity": "sha1-rSBuv0v5WgWM6YgKjAksXeyBk9Y=", + "requires": { + "@webassemblyjs/ast": "1.11.1", + "@webassemblyjs/helper-buffer": "1.11.1", + "@webassemblyjs/helper-wasm-bytecode": "1.11.1", + "@webassemblyjs/helper-wasm-section": "1.11.1", + "@webassemblyjs/wasm-gen": "1.11.1", + "@webassemblyjs/wasm-opt": "1.11.1", + "@webassemblyjs/wasm-parser": "1.11.1", + "@webassemblyjs/wast-printer": "1.11.1" + } + }, + "@webassemblyjs/wasm-gen": { + "version": "1.11.1", + "resolved": "https://registry.nlark.com/@webassemblyjs/wasm-gen/download/@webassemblyjs/wasm-gen-1.11.1.tgz?cache=0&sync_timestamp=1625473464969&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40webassemblyjs%2Fwasm-gen%2Fdownload%2F%40webassemblyjs%2Fwasm-gen-1.11.1.tgz", + "integrity": "sha1-hsXqMEhJdZt9iMR6MvTwOa48j3Y=", + "requires": { + "@webassemblyjs/ast": "1.11.1", + "@webassemblyjs/helper-wasm-bytecode": "1.11.1", + "@webassemblyjs/ieee754": "1.11.1", + "@webassemblyjs/leb128": "1.11.1", + "@webassemblyjs/utf8": "1.11.1" + } + }, + "@webassemblyjs/wasm-opt": { + "version": "1.11.1", + "resolved": "https://registry.nlark.com/@webassemblyjs/wasm-opt/download/@webassemblyjs/wasm-opt-1.11.1.tgz?cache=0&sync_timestamp=1625473467198&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40webassemblyjs%2Fwasm-opt%2Fdownload%2F%40webassemblyjs%2Fwasm-opt-1.11.1.tgz", + "integrity": "sha1-ZXtMIgL0zzs0X4pMZGHIwkGJhfI=", + "requires": { + "@webassemblyjs/ast": "1.11.1", + "@webassemblyjs/helper-buffer": "1.11.1", + "@webassemblyjs/wasm-gen": "1.11.1", + "@webassemblyjs/wasm-parser": "1.11.1" + } + }, + "@webassemblyjs/wasm-parser": { + "version": "1.11.1", + "resolved": "https://registry.nlark.com/@webassemblyjs/wasm-parser/download/@webassemblyjs/wasm-parser-1.11.1.tgz?cache=0&sync_timestamp=1625473417746&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40webassemblyjs%2Fwasm-parser%2Fdownload%2F%40webassemblyjs%2Fwasm-parser-1.11.1.tgz", + "integrity": "sha1-hspzRTT0F+m9PGfHocddi+QfsZk=", + "requires": { + "@webassemblyjs/ast": "1.11.1", + "@webassemblyjs/helper-api-error": "1.11.1", + "@webassemblyjs/helper-wasm-bytecode": "1.11.1", + "@webassemblyjs/ieee754": "1.11.1", + "@webassemblyjs/leb128": "1.11.1", + "@webassemblyjs/utf8": "1.11.1" + } + }, + "@webassemblyjs/wast-printer": { + "version": "1.11.1", + "resolved": "https://registry.nlark.com/@webassemblyjs/wast-printer/download/@webassemblyjs/wast-printer-1.11.1.tgz?cache=0&sync_timestamp=1625473465901&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40webassemblyjs%2Fwast-printer%2Fdownload%2F%40webassemblyjs%2Fwast-printer-1.11.1.tgz", + "integrity": "sha1-0Mc77ajuxUJvEK6O9VzuXnCEwvA=", + "requires": { + "@webassemblyjs/ast": "1.11.1", + "@xtuc/long": "4.2.2" + } + }, + "@webpack-cli/configtest": { + "version": "1.0.4", + "resolved": "https://registry.nlark.com/@webpack-cli/configtest/download/@webpack-cli/configtest-1.0.4.tgz", + "integrity": "sha1-8DzmMRwIg6g9BFaeLAPGI4MW0qo=" + }, + "@webpack-cli/info": { + "version": "1.3.0", + "resolved": "https://registry.nlark.com/@webpack-cli/info/download/@webpack-cli/info-1.3.0.tgz", + "integrity": "sha1-nXijEQGpYJl6Ss1B/9m5MAYn/is=", + "requires": { + "envinfo": "^7.7.3" + } + }, + "@webpack-cli/serve": { + "version": "1.5.2", + "resolved": "https://registry.nlark.com/@webpack-cli/serve/download/@webpack-cli/serve-1.5.2.tgz", + "integrity": "sha1-6lhLY3/2PFpHf28hYEtaIFtyyew=" + }, + "@xtuc/ieee754": { + "version": "1.2.0", + "resolved": "https://registry.nlark.com/@xtuc/ieee754/download/@xtuc/ieee754-1.2.0.tgz", + "integrity": "sha1-7vAUoxRa5Hehy8AM0eVSM23Ot5A=" + }, + "@xtuc/long": { + "version": "4.2.2", + "resolved": "https://registry.nlark.com/@xtuc/long/download/@xtuc/long-4.2.2.tgz", + "integrity": "sha1-0pHGpOl5ibXGHZrPOWrk/hM6cY0=" + }, + "acorn": { + "version": "8.4.1", + "resolved": "https://registry.nlark.com/acorn/download/acorn-8.4.1.tgz", + "integrity": "sha1-VsNiUfx8q8cJatwY8Fr+gUMhoow=" + }, + "acorn-import-assertions": { + "version": "1.7.6", + "resolved": "https://registry.nlark.com/acorn-import-assertions/download/acorn-import-assertions-1.7.6.tgz", + "integrity": "sha1-WA4//K5ncO6+7HbDuXIyAenQH3g=" + }, + "acorn-jsx": { + "version": "5.3.2", + "resolved": "https://registry.nlark.com/acorn-jsx/download/acorn-jsx-5.3.2.tgz?cache=0&sync_timestamp=1625793705701&other_urls=https%3A%2F%2Fregistry.nlark.com%2Facorn-jsx%2Fdownload%2Facorn-jsx-5.3.2.tgz", + "integrity": "sha1-ftW7VZCLOy8bxVxq8WU7rafweTc=", + "dev": true + }, + "ajv": { + "version": "6.12.6", + "resolved": "https://registry.nlark.com/ajv/download/ajv-6.12.6.tgz", + "integrity": "sha1-uvWmLoArB9l3A0WG+MO69a3ybfQ=", + "requires": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + } + }, + "ajv-keywords": { + "version": "3.5.2", + "resolved": "https://registry.nlark.com/ajv-keywords/download/ajv-keywords-3.5.2.tgz", + "integrity": "sha1-MfKdpatuANHC0yms97WSlhTVAU0=" + }, + "ansi-colors": { + "version": "4.1.1", + "resolved": "https://registry.nlark.com/ansi-colors/download/ansi-colors-4.1.1.tgz", + "integrity": "sha1-y7muJWv3UK8eqzRPIpqif+lLo0g=", + "dev": true + }, + "ansi-regex": { + "version": "5.0.0", + "resolved": "https://registry.nlark.com/ansi-regex/download/ansi-regex-5.0.0.tgz", + "integrity": "sha1-OIU59VF5vzkznIGvMKZU1p+Hy3U=", + "dev": true + }, + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.nlark.com/ansi-styles/download/ansi-styles-4.3.0.tgz", + "integrity": "sha1-7dgDYornHATIWuegkG7a00tkiTc=", + "requires": { + "color-convert": "^2.0.1" + } + }, + "anymatch": { + "version": "3.1.2", + "resolved": "https://registry.nlark.com/anymatch/download/anymatch-3.1.2.tgz", + "integrity": "sha1-wFV8CWrzLxBhmPT04qODU343hxY=", + "requires": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + } + }, + "arg": { + "version": "4.1.3", + "resolved": "https://registry.nlark.com/arg/download/arg-4.1.3.tgz?cache=0&sync_timestamp=1629166495886&other_urls=https%3A%2F%2Fregistry.nlark.com%2Farg%2Fdownload%2Farg-4.1.3.tgz", + "integrity": "sha1-Jp/HrVuOQstjyJbVZmAXJhwUQIk=", + "dev": true + }, + "argparse": { + "version": "1.0.10", + "resolved": "https://registry.nlark.com/argparse/download/argparse-1.0.10.tgz", + "integrity": "sha1-vNZ5HqWuCXJeF+WtmIE0zUCz2RE=", + "dev": true, + "requires": { + "sprintf-js": "~1.0.2" + } + }, + "arr-diff": { + "version": "4.0.0", + "resolved": "https://registry.nlark.com/arr-diff/download/arr-diff-4.0.0.tgz", + "integrity": "sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA=", + "dev": true, + "optional": true + }, + "arr-flatten": { + "version": "1.1.0", + "resolved": "https://registry.nlark.com/arr-flatten/download/arr-flatten-1.1.0.tgz", + "integrity": "sha1-NgSLv/TntH4TZkQxbJlmnqWukfE=", + "dev": true, + "optional": true + }, + "arr-union": { + "version": "3.1.0", + "resolved": "https://registry.nlark.com/arr-union/download/arr-union-3.1.0.tgz", + "integrity": "sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ=", + "dev": true, + "optional": true + }, + "array-union": { + "version": "1.0.2", + "resolved": "https://registry.nlark.com/array-union/download/array-union-1.0.2.tgz", + "integrity": "sha1-mjRBDk9OPaI96jdb5b5w8kd47Dk=", + "requires": { + "array-uniq": "^1.0.1" + } + }, + "array-uniq": { + "version": "1.0.3", + "resolved": "https://registry.nlark.com/array-uniq/download/array-uniq-1.0.3.tgz", + "integrity": "sha1-r2rId6Jcx/dOBYiUdThY39sk/bY=" + }, + "array-unique": { + "version": "0.3.2", + "resolved": "https://registry.nlark.com/array-unique/download/array-unique-0.3.2.tgz", + "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=", + "dev": true, + "optional": true + }, + "assertion-error": { + "version": "1.1.0", + "resolved": "https://registry.nlark.com/assertion-error/download/assertion-error-1.1.0.tgz", + "integrity": "sha1-5gtrDo8wG9l+U3UhW9pAbIURjAs=", + "dev": true + }, + "assign-symbols": { + "version": "1.0.0", + "resolved": "https://registry.nlark.com/assign-symbols/download/assign-symbols-1.0.0.tgz", + "integrity": "sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c=", + "dev": true, + "optional": true + }, + "astral-regex": { + "version": "2.0.0", + "resolved": "https://registry.nlark.com/astral-regex/download/astral-regex-2.0.0.tgz", + "integrity": "sha1-SDFDxWeu7UeFdZwIZXhtx319LjE=", + "dev": true + }, + "async-each": { + "version": "1.0.3", + "resolved": "https://registry.nlark.com/async-each/download/async-each-1.0.3.tgz", + "integrity": "sha1-tyfb+H12UWAvBvTUrDh/R9kbDL8=", + "dev": true, + "optional": true + }, + "atob": { + "version": "2.1.2", + "resolved": "https://registry.nlark.com/atob/download/atob-2.1.2.tgz", + "integrity": "sha1-bZUX654DDSQ2ZmZR6GvZ9vE1M8k=", + "dev": true, + "optional": true + }, + "babel-plugin-dynamic-import-node": { + "version": "2.3.3", + "resolved": "https://registry.nlark.com/babel-plugin-dynamic-import-node/download/babel-plugin-dynamic-import-node-2.3.3.tgz?cache=0&sync_timestamp=1624608029217&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fbabel-plugin-dynamic-import-node%2Fdownload%2Fbabel-plugin-dynamic-import-node-2.3.3.tgz", + "integrity": "sha1-hP2hnJduxcbe/vV/lCez3vZuF6M=", + "dev": true, + "requires": { + "object.assign": "^4.1.0" + } + }, + "babel-plugin-polyfill-corejs2": { + "version": "0.2.2", + "resolved": "https://registry.nlark.com/babel-plugin-polyfill-corejs2/download/babel-plugin-polyfill-corejs2-0.2.2.tgz", + "integrity": "sha1-6RJHheb9lPlLYYp5VOVpMFO/Uyc=", + "dev": true, + "requires": { + "@babel/compat-data": "^7.13.11", + "@babel/helper-define-polyfill-provider": "^0.2.2", + "semver": "^6.1.1" + }, + "dependencies": { + "semver": { + "version": "6.3.0", + "resolved": "https://registry.nlark.com/semver/download/semver-6.3.0.tgz?cache=0&sync_timestamp=1624607961409&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fsemver%2Fdownload%2Fsemver-6.3.0.tgz", + "integrity": "sha1-7gpkyK9ejO6mdoexM3YeG+y9HT0=", + "dev": true + } + } + }, + "babel-plugin-polyfill-corejs3": { + "version": "0.2.4", + "resolved": "https://registry.nlark.com/babel-plugin-polyfill-corejs3/download/babel-plugin-polyfill-corejs3-0.2.4.tgz", + "integrity": "sha1-aMuBMWsOjZ1yGpLgAJ7G7NTNLKk=", + "dev": true, + "requires": { + "@babel/helper-define-polyfill-provider": "^0.2.2", + "core-js-compat": "^3.14.0" + } + }, + "babel-plugin-polyfill-regenerator": { + "version": "0.2.2", + "resolved": "https://registry.nlark.com/babel-plugin-polyfill-regenerator/download/babel-plugin-polyfill-regenerator-0.2.2.tgz", + "integrity": "sha1-sxDI1kKsraNIwfo7Pmzg6FG+4Hc=", + "dev": true, + "requires": { + "@babel/helper-define-polyfill-provider": "^0.2.2" + } + }, + "balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.nlark.com/balanced-match/download/balanced-match-1.0.2.tgz", + "integrity": "sha1-6D46fj8wCzTLnYf2FfoMvzV2kO4=" + }, + "base": { + "version": "0.11.2", + "resolved": "https://registry.nlark.com/base/download/base-0.11.2.tgz", + "integrity": "sha1-e95c7RRbbVUakNuH+DxVi060io8=", + "dev": true, + "optional": true, + "requires": { + "cache-base": "^1.0.1", + "class-utils": "^0.3.5", + "component-emitter": "^1.2.1", + "define-property": "^1.0.0", + "isobject": "^3.0.1", + "mixin-deep": "^1.2.0", + "pascalcase": "^0.1.1" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "resolved": "https://registry.nlark.com/define-property/download/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "dev": true, + "optional": true, + "requires": { + "is-descriptor": "^1.0.0" + } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.nlark.com/is-accessor-descriptor/download/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha1-FpwvbT3x+ZJhgHI2XJsOofaHhlY=", + "dev": true, + "optional": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.nlark.com/is-data-descriptor/download/is-data-descriptor-1.0.0.tgz", + "integrity": "sha1-2Eh2Mh0Oet0DmQQGq7u9NrqSaMc=", + "dev": true, + "optional": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.nlark.com/is-descriptor/download/is-descriptor-1.0.2.tgz", + "integrity": "sha1-OxWXRqZmBLBPjIFSS6NlxfFNhuw=", + "dev": true, + "optional": true, + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + } + } + }, + "big.js": { + "version": "5.2.2", + "resolved": "https://registry.nlark.com/big.js/download/big.js-5.2.2.tgz", + "integrity": "sha1-ZfCvOC9Xi83HQr2cKB6cstd2gyg=" + }, + "binary-extensions": { + "version": "1.13.1", + "resolved": "https://registry.nlark.com/binary-extensions/download/binary-extensions-1.13.1.tgz", + "integrity": "sha1-WYr+VHVbKGilMw0q/51Ou1Mgm2U=", + "dev": true, + "optional": true + }, + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.nlark.com/brace-expansion/download/brace-expansion-1.1.11.tgz", + "integrity": "sha1-PH/L9SnYcibz0vUrlm/1Jx60Qd0=", + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "braces": { + "version": "3.0.2", + "resolved": "https://registry.nlark.com/braces/download/braces-3.0.2.tgz", + "integrity": "sha1-NFThpGLujVmeI23zNs2epPiv4Qc=", + "requires": { + "fill-range": "^7.0.1" + } + }, + "browser-stdout": { + "version": "1.3.1", + "resolved": "https://registry.nlark.com/browser-stdout/download/browser-stdout-1.3.1.tgz", + "integrity": "sha1-uqVZ7hTO1zRSIputcyZGfGH6vWA=", + "dev": true + }, + "browserslist": { + "version": "4.16.8", + "resolved": "https://registry.nlark.com/browserslist/download/browserslist-4.16.8.tgz?cache=0&sync_timestamp=1629302575089&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fbrowserslist%2Fdownload%2Fbrowserslist-4.16.8.tgz", + "integrity": "sha1-y4aLC1VPE3um4z3g7P8u2kA8T7A=", + "requires": { + "caniuse-lite": "^1.0.30001251", + "colorette": "^1.3.0", + "electron-to-chromium": "^1.3.811", + "escalade": "^3.1.1", + "node-releases": "^1.1.75" + } + }, + "buffer-from": { + "version": "1.1.2", + "resolved": "https://registry.nlark.com/buffer-from/download/buffer-from-1.1.2.tgz?cache=0&sync_timestamp=1627578361955&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fbuffer-from%2Fdownload%2Fbuffer-from-1.1.2.tgz", + "integrity": "sha1-KxRqb9cugLT1XSVfNe1Zo6mkG9U=" + }, + "cache-base": { + "version": "1.0.1", + "resolved": "https://registry.nlark.com/cache-base/download/cache-base-1.0.1.tgz", + "integrity": "sha1-Cn9GQWgxyLZi7jb+TnxZ129marI=", + "dev": true, + "optional": true, + "requires": { + "collection-visit": "^1.0.0", + "component-emitter": "^1.2.1", + "get-value": "^2.0.6", + "has-value": "^1.0.0", + "isobject": "^3.0.1", + "set-value": "^2.0.0", + "to-object-path": "^0.3.0", + "union-value": "^1.0.0", + "unset-value": "^1.0.0" + } + }, + "call-bind": { + "version": "1.0.2", + "resolved": "https://registry.nlark.com/call-bind/download/call-bind-1.0.2.tgz", + "integrity": "sha1-sdTonmiBGcPJqQOtMKuy9qkZvjw=", + "dev": true, + "requires": { + "function-bind": "^1.1.1", + "get-intrinsic": "^1.0.2" + } + }, + "callsites": { + "version": "3.1.0", + "resolved": "https://registry.nlark.com/callsites/download/callsites-3.1.0.tgz?cache=0&sync_timestamp=1628464907898&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fcallsites%2Fdownload%2Fcallsites-3.1.0.tgz", + "integrity": "sha1-s2MKvYlDQy9Us/BRkjjjPNffL3M=", + "dev": true + }, + "camelcase": { + "version": "6.2.0", + "resolved": "https://registry.nlark.com/camelcase/download/camelcase-6.2.0.tgz", + "integrity": "sha1-kkr4gcnVJaydh/QNlk5c6pgqGAk=", + "dev": true + }, + "caniuse-lite": { + "version": "1.0.30001252", + "resolved": "https://registry.nlark.com/caniuse-lite/download/caniuse-lite-1.0.30001252.tgz", + "integrity": "sha1-yxbk49r+lI/EqbszB66gVLkSAZo=" + }, + "chai": { + "version": "4.3.4", + "resolved": "https://registry.nlark.com/chai/download/chai-4.3.4.tgz?cache=0&sync_timestamp=1624607982671&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fchai%2Fdownload%2Fchai-4.3.4.tgz", + "integrity": "sha1-tV5lWzHh6scJm+TAjCGWT84ubEk=", + "dev": true, + "requires": { + "assertion-error": "^1.1.0", + "check-error": "^1.0.2", + "deep-eql": "^3.0.1", + "get-func-name": "^2.0.0", + "pathval": "^1.1.1", + "type-detect": "^4.0.5" + } + }, + "chalk": { + "version": "4.1.2", + "resolved": "https://registry.nlark.com/chalk/download/chalk-4.1.2.tgz?cache=0&sync_timestamp=1627646614989&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fchalk%2Fdownload%2Fchalk-4.1.2.tgz", + "integrity": "sha1-qsTit3NKdAhnrrFr8CqtVWoeegE=", + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "check-error": { + "version": "1.0.2", + "resolved": "https://registry.nlark.com/check-error/download/check-error-1.0.2.tgz", + "integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=", + "dev": true + }, + "chokidar": { + "version": "3.5.2", + "resolved": "https://registry.nlark.com/chokidar/download/chokidar-3.5.2.tgz", + "integrity": "sha1-26OXb8rbAW9m/TZQIdkWANAcHnU=", + "dev": true, + "optional": true, + "requires": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "fsevents": "~2.3.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + }, + "dependencies": { + "binary-extensions": { + "version": "2.2.0", + "resolved": "https://registry.nlark.com/binary-extensions/download/binary-extensions-2.2.0.tgz", + "integrity": "sha1-dfUC7q+f/eQvyYgpZFvk6na9ni0=", + "dev": true, + "optional": true + }, + "is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.nlark.com/is-binary-path/download/is-binary-path-2.1.0.tgz", + "integrity": "sha1-6h9/O4DwZCNug0cPhsCcJU+0Wwk=", + "dev": true, + "optional": true, + "requires": { + "binary-extensions": "^2.0.0" + } + }, + "readdirp": { + "version": "3.6.0", + "resolved": "https://registry.nlark.com/readdirp/download/readdirp-3.6.0.tgz", + "integrity": "sha1-dKNwvYVxFuJFspzJc0DNQxoCpsc=", + "dev": true, + "optional": true, + "requires": { + "picomatch": "^2.2.1" + } + } + } + }, + "chrome-trace-event": { + "version": "1.0.3", + "resolved": "https://registry.nlark.com/chrome-trace-event/download/chrome-trace-event-1.0.3.tgz", + "integrity": "sha1-EBXs7UdB4V0GZkqVfbv1DQQeJqw=" + }, + "class-utils": { + "version": "0.3.6", + "resolved": "https://registry.nlark.com/class-utils/download/class-utils-0.3.6.tgz", + "integrity": "sha1-+TNprouafOAv1B+q0MqDAzGQxGM=", + "dev": true, + "optional": true, + "requires": { + "arr-union": "^3.1.0", + "define-property": "^0.2.5", + "isobject": "^3.0.0", + "static-extend": "^0.1.1" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.nlark.com/define-property/download/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "optional": true, + "requires": { + "is-descriptor": "^0.1.0" + } + } + } + }, + "clean-webpack-plugin": { + "version": "3.0.0", + "resolved": "https://registry.nlark.com/clean-webpack-plugin/download/clean-webpack-plugin-3.0.0.tgz?cache=0&sync_timestamp=1630504808165&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fclean-webpack-plugin%2Fdownload%2Fclean-webpack-plugin-3.0.0.tgz", + "integrity": "sha1-qZ2Ow0wcYopFQVZ6p7RXRGRgxis=", + "requires": { + "@types/webpack": "^4.4.31", + "del": "^4.1.1" + } + }, + "cliui": { + "version": "7.0.4", + "resolved": "https://registry.nlark.com/cliui/download/cliui-7.0.4.tgz", + "integrity": "sha1-oCZe5lVHb8gHrqnfPfjfd4OAi08=", + "dev": true, + "requires": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^7.0.0" + } + }, + "clone-deep": { + "version": "4.0.1", + "resolved": "https://registry.nlark.com/clone-deep/download/clone-deep-4.0.1.tgz", + "integrity": "sha1-wZ/Zvbv4WUK0/ZechNz31fB8I4c=", + "requires": { + "is-plain-object": "^2.0.4", + "kind-of": "^6.0.2", + "shallow-clone": "^3.0.0" + } + }, + "collection-visit": { + "version": "1.0.0", + "resolved": "https://registry.nlark.com/collection-visit/download/collection-visit-1.0.0.tgz", + "integrity": "sha1-S8A3PBZLwykbTTaMgpzxqApZ3KA=", + "dev": true, + "optional": true, + "requires": { + "map-visit": "^1.0.0", + "object-visit": "^1.0.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.nlark.com/color-convert/download/color-convert-2.0.1.tgz?cache=0&sync_timestamp=1624607968569&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fcolor-convert%2Fdownload%2Fcolor-convert-2.0.1.tgz", + "integrity": "sha1-ctOmjVmMm9s68q0ehPIdiWq9TeM=", + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.nlark.com/color-name/download/color-name-1.1.4.tgz", + "integrity": "sha1-wqCah6y95pVD3m9j+jmVyCbFNqI=" + }, + "colorette": { + "version": "1.3.0", + "resolved": "https://registry.nlark.com/colorette/download/colorette-1.3.0.tgz", + "integrity": "sha1-/0XS8O2yRAadO3cq3rBP7TjQoK8=" + }, + "commander": { + "version": "2.20.3", + "resolved": "https://registry.nlark.com/commander/download/commander-2.20.3.tgz", + "integrity": "sha1-/UhehMA+tIgcIHIrpIA16FMa6zM=" + }, + "component-emitter": { + "version": "1.3.0", + "resolved": "https://registry.nlark.com/component-emitter/download/component-emitter-1.3.0.tgz", + "integrity": "sha1-FuQHD7qK4ptnnyIVhT7hgasuq8A=", + "dev": true, + "optional": true + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.nlark.com/concat-map/download/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" + }, + "convert-source-map": { + "version": "1.8.0", + "resolved": "https://registry.nlark.com/convert-source-map/download/convert-source-map-1.8.0.tgz?cache=0&sync_timestamp=1624608042394&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fconvert-source-map%2Fdownload%2Fconvert-source-map-1.8.0.tgz", + "integrity": "sha1-8zc8MtIbTXgN2ABFFGhPt5HKQ2k=", + "dev": true, + "requires": { + "safe-buffer": "~5.1.1" + }, + "dependencies": { + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.nlark.com/safe-buffer/download/safe-buffer-5.1.2.tgz", + "integrity": "sha1-mR7GnSluAxN0fVm9/St0XDX4go0=", + "dev": true + } + } + }, + "copy-descriptor": { + "version": "0.1.1", + "resolved": "https://registry.nlark.com/copy-descriptor/download/copy-descriptor-0.1.1.tgz", + "integrity": "sha1-Z29us8OZl8LuGsOpJP1hJHSPV40=", + "dev": true, + "optional": true + }, + "copy-webpack-plugin": { + "version": "8.1.1", + "resolved": "https://registry.nlark.com/copy-webpack-plugin/download/copy-webpack-plugin-8.1.1.tgz", + "integrity": "sha1-P2l+FidkklwvDSNfOAZ2ElUI/SY=", + "requires": { + "fast-glob": "^3.2.5", + "glob-parent": "^5.1.1", + "globby": "^11.0.3", + "normalize-path": "^3.0.0", + "p-limit": "^3.1.0", + "schema-utils": "^3.0.0", + "serialize-javascript": "^5.0.1" + }, + "dependencies": { + "array-union": { + "version": "2.1.0", + "resolved": "https://registry.nlark.com/array-union/download/array-union-2.1.0.tgz", + "integrity": "sha1-t5hCCtvrHego2ErNii4j0+/oXo0=" + }, + "globby": { + "version": "11.0.4", + "resolved": "https://registry.nlark.com/globby/download/globby-11.0.4.tgz", + "integrity": "sha1-LLr/d8Lypi5x6bKBOme5ejowAaU=", + "requires": { + "array-union": "^2.1.0", + "dir-glob": "^3.0.1", + "fast-glob": "^3.1.1", + "ignore": "^5.1.4", + "merge2": "^1.3.0", + "slash": "^3.0.0" + } + } + } + }, + "core-js-compat": { + "version": "3.17.2", + "resolved": "https://registry.nlark.com/core-js-compat/download/core-js-compat-3.17.2.tgz?cache=0&sync_timestamp=1630603307523&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fcore-js-compat%2Fdownload%2Fcore-js-compat-3.17.2.tgz", + "integrity": "sha1-9GGrlQwKD/7fwyfevyi35RiVCTY=", + "dev": true, + "requires": { + "browserslist": "^4.16.8", + "semver": "7.0.0" + }, + "dependencies": { + "semver": { + "version": "7.0.0", + "resolved": "https://registry.nlark.com/semver/download/semver-7.0.0.tgz?cache=0&sync_timestamp=1624607961409&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fsemver%2Fdownload%2Fsemver-7.0.0.tgz", + "integrity": "sha1-XzyjV2HkfgWyBsba/yz4FPAxa44=", + "dev": true + } + } + }, + "core-util-is": { + "version": "1.0.3", + "resolved": "https://registry.nlark.com/core-util-is/download/core-util-is-1.0.3.tgz", + "integrity": "sha1-pgQtNjTCsn6TKPg3uWX6yDgI24U=" + }, + "create-require": { + "version": "1.1.1", + "resolved": "https://registry.nlark.com/create-require/download/create-require-1.1.1.tgz", + "integrity": "sha1-wdfo8eX2z8n/ZfnNNS03NIdWwzM=", + "dev": true + }, + "cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.nlark.com/cross-spawn/download/cross-spawn-7.0.3.tgz?cache=0&sync_timestamp=1624608055915&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fcross-spawn%2Fdownload%2Fcross-spawn-7.0.3.tgz", + "integrity": "sha1-9zqFudXUHQRVUcF34ogtSshXKKY=", + "requires": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + } + }, + "date-format": { + "version": "3.0.0", + "resolved": "https://registry.nlark.com/date-format/download/date-format-3.0.0.tgz", + "integrity": "sha1-64eANlx9KxURB4+0keZHl4DzrZU=" + }, + "debug": { + "version": "4.3.2", + "resolved": "https://registry.nlark.com/debug/download/debug-4.3.2.tgz?cache=0&sync_timestamp=1625374653719&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fdebug%2Fdownload%2Fdebug-4.3.2.tgz", + "integrity": "sha1-8KScGKyHeeMdSgxgKd+3aHPHQos=", + "requires": { + "ms": "2.1.2" + } + }, + "decamelize": { + "version": "4.0.0", + "resolved": "https://registry.nlark.com/decamelize/download/decamelize-4.0.0.tgz", + "integrity": "sha1-qkcte/Zg6xXzSU79UxyrfypwmDc=", + "dev": true + }, + "deccjsunit": { + "version": "1.0.3", + "resolved": "https://registry.nlark.com/deccjsunit/download/deccjsunit-1.0.3.tgz", + "integrity": "sha1-AcMxIKje4SsaoQiZGE14pszfiKI=" + }, + "decode-uri-component": { + "version": "0.2.0", + "resolved": "https://registry.nlark.com/decode-uri-component/download/decode-uri-component-0.2.0.tgz", + "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=", + "dev": true, + "optional": true + }, + "deep-eql": { + "version": "3.0.1", + "resolved": "https://registry.nlark.com/deep-eql/download/deep-eql-3.0.1.tgz", + "integrity": "sha1-38lARACtHI/gI+faHfHBR8S0RN8=", + "dev": true, + "requires": { + "type-detect": "^4.0.0" + } + }, + "deep-is": { + "version": "0.1.3", + "resolved": "https://registry.nlark.com/deep-is/download/deep-is-0.1.3.tgz", + "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=", + "dev": true + }, + "define-properties": { + "version": "1.1.3", + "resolved": "https://registry.nlark.com/define-properties/download/define-properties-1.1.3.tgz", + "integrity": "sha1-z4jabL7ib+bbcJT2HYcMvYTO6fE=", + "dev": true, + "requires": { + "object-keys": "^1.0.12" + } + }, + "define-property": { + "version": "2.0.2", + "resolved": "https://registry.nlark.com/define-property/download/define-property-2.0.2.tgz", + "integrity": "sha1-1Flono1lS6d+AqgX+HENcCyxbp0=", + "dev": true, + "optional": true, + "requires": { + "is-descriptor": "^1.0.2", + "isobject": "^3.0.1" + }, + "dependencies": { + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.nlark.com/is-accessor-descriptor/download/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha1-FpwvbT3x+ZJhgHI2XJsOofaHhlY=", + "dev": true, + "optional": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.nlark.com/is-data-descriptor/download/is-data-descriptor-1.0.0.tgz", + "integrity": "sha1-2Eh2Mh0Oet0DmQQGq7u9NrqSaMc=", + "dev": true, + "optional": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.nlark.com/is-descriptor/download/is-descriptor-1.0.2.tgz", + "integrity": "sha1-OxWXRqZmBLBPjIFSS6NlxfFNhuw=", + "dev": true, + "optional": true, + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + } + } + }, + "del": { + "version": "4.1.1", + "resolved": "https://registry.nlark.com/del/download/del-4.1.1.tgz", + "integrity": "sha1-no8RciLqRKMf86FWwEm5kFKp8LQ=", + "requires": { + "@types/glob": "^7.1.1", + "globby": "^6.1.0", + "is-path-cwd": "^2.0.0", + "is-path-in-cwd": "^2.0.0", + "p-map": "^2.0.0", + "pify": "^4.0.1", + "rimraf": "^2.6.3" + } + }, + "diff": { + "version": "5.0.0", + "resolved": "https://registry.nlark.com/diff/download/diff-5.0.0.tgz?cache=0&sync_timestamp=1624608104914&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fdiff%2Fdownload%2Fdiff-5.0.0.tgz", + "integrity": "sha1-ftatdthZ0DB4fsNYVfWx2vMdhSs=", + "dev": true + }, + "dir-glob": { + "version": "3.0.1", + "resolved": "https://registry.nlark.com/dir-glob/download/dir-glob-3.0.1.tgz", + "integrity": "sha1-Vtv3PZkqSpO6FYT0U0Bj/S5BcX8=", + "requires": { + "path-type": "^4.0.0" + } + }, + "doctrine": { + "version": "3.0.0", + "resolved": "https://registry.nlark.com/doctrine/download/doctrine-3.0.0.tgz", + "integrity": "sha1-rd6+rXKmV023g2OdyHoSF3OXOWE=", + "dev": true, + "requires": { + "esutils": "^2.0.2" + } + }, + "electron-to-chromium": { + "version": "1.3.828", + "resolved": "https://registry.nlark.com/electron-to-chromium/download/electron-to-chromium-1.3.828.tgz", + "integrity": "sha1-De6XW1v0XWNXryZvNQ/NtnNqXkA=" + }, + "emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.nlark.com/emoji-regex/download/emoji-regex-8.0.0.tgz", + "integrity": "sha1-6Bj9ac5cz8tARZT4QpY79TFkzDc=", + "dev": true + }, + "emojis-list": { + "version": "3.0.0", + "resolved": "https://registry.nlark.com/emojis-list/download/emojis-list-3.0.0.tgz", + "integrity": "sha1-VXBmIEatKeLpFucariYKvf9Pang=" + }, + "enhanced-resolve": { + "version": "4.5.0", + "resolved": "https://registry.nlark.com/enhanced-resolve/download/enhanced-resolve-4.5.0.tgz", + "integrity": "sha1-Lzz9hNvjtIfxjy2y7x4GSlccpew=", + "requires": { + "graceful-fs": "^4.1.2", + "memory-fs": "^0.5.0", + "tapable": "^1.0.0" + } + }, + "enquirer": { + "version": "2.3.6", + "resolved": "https://registry.nlark.com/enquirer/download/enquirer-2.3.6.tgz", + "integrity": "sha1-Kn/l3WNKHkElqXXsmU/1RW3Dc00=", + "dev": true, + "requires": { + "ansi-colors": "^4.1.1" + } + }, + "envinfo": { + "version": "7.8.1", + "resolved": "https://registry.nlark.com/envinfo/download/envinfo-7.8.1.tgz", + "integrity": "sha1-Bjd+Pl9NN5/qesWS1a2JJ+DE1HU=" + }, + "errno": { + "version": "0.1.8", + "resolved": "https://registry.nlark.com/errno/download/errno-0.1.8.tgz", + "integrity": "sha1-i7Ppx9Rjvkl2/4iPdrSAnrwugR8=", + "requires": { + "prr": "~1.0.1" + } + }, + "es-module-lexer": { + "version": "0.7.1", + "resolved": "https://registry.nlark.com/es-module-lexer/download/es-module-lexer-0.7.1.tgz", + "integrity": "sha1-wsjg9G8t8GJ0za8N0/OzPgoLJn0=" + }, + "escalade": { + "version": "3.1.1", + "resolved": "https://registry.nlark.com/escalade/download/escalade-3.1.1.tgz", + "integrity": "sha1-2M/ccACWXFoBdLSoLqpcBVJ0LkA=" + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.nlark.com/escape-string-regexp/download/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "dev": true + }, + "eslint": { + "version": "7.32.0", + "resolved": "https://registry.nlark.com/eslint/download/eslint-7.32.0.tgz", + "integrity": "sha1-xtMooUvj+wjI0dIeEsAv23oqgS0=", + "dev": true, + "requires": { + "@babel/code-frame": "7.12.11", + "@eslint/eslintrc": "^0.4.3", + "@humanwhocodes/config-array": "^0.5.0", + "ajv": "^6.10.0", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.2", + "debug": "^4.0.1", + "doctrine": "^3.0.0", + "enquirer": "^2.3.5", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^5.1.1", + "eslint-utils": "^2.1.0", + "eslint-visitor-keys": "^2.0.0", + "espree": "^7.3.1", + "esquery": "^1.4.0", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "^6.0.1", + "functional-red-black-tree": "^1.0.1", + "glob-parent": "^5.1.2", + "globals": "^13.6.0", + "ignore": "^4.0.6", + "import-fresh": "^3.0.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "js-yaml": "^3.13.1", + "json-stable-stringify-without-jsonify": "^1.0.1", + "levn": "^0.4.1", + "lodash.merge": "^4.6.2", + "minimatch": "^3.0.4", + "natural-compare": "^1.4.0", + "optionator": "^0.9.1", + "progress": "^2.0.0", + "regexpp": "^3.1.0", + "semver": "^7.2.1", + "strip-ansi": "^6.0.0", + "strip-json-comments": "^3.1.0", + "table": "^6.0.9", + "text-table": "^0.2.0", + "v8-compile-cache": "^2.0.3" + }, + "dependencies": { + "@babel/code-frame": { + "version": "7.12.11", + "resolved": "https://registry.nlark.com/@babel/code-frame/download/@babel/code-frame-7.12.11.tgz", + "integrity": "sha1-9K1DWqJj25NbjxDyxVLSP7cWpj8=", + "dev": true, + "requires": { + "@babel/highlight": "^7.10.4" + } + }, + "escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.nlark.com/escape-string-regexp/download/escape-string-regexp-4.0.0.tgz", + "integrity": "sha1-FLqDpdNz49MR5a/KKc9b+tllvzQ=", + "dev": true + }, + "globals": { + "version": "13.11.0", + "resolved": "https://registry.nlark.com/globals/download/globals-13.11.0.tgz", + "integrity": "sha1-QO9njaEX/nvS4o8fqySVG9AlW+c=", + "dev": true, + "requires": { + "type-fest": "^0.20.2" + } + }, + "ignore": { + "version": "4.0.6", + "resolved": "https://registry.nlark.com/ignore/download/ignore-4.0.6.tgz", + "integrity": "sha1-dQ49tYYgh7RzfrrIIH/9HvJ7Jfw=", + "dev": true + } + } + }, + "eslint-scope": { + "version": "5.1.1", + "resolved": "https://registry.nlark.com/eslint-scope/download/eslint-scope-5.1.1.tgz?cache=0&sync_timestamp=1627061754690&other_urls=https%3A%2F%2Fregistry.nlark.com%2Feslint-scope%2Fdownload%2Feslint-scope-5.1.1.tgz", + "integrity": "sha1-54blmmbLkrP2wfsNUIqrF0hI9Iw=", + "requires": { + "esrecurse": "^4.3.0", + "estraverse": "^4.1.1" + } + }, + "eslint-utils": { + "version": "2.1.0", + "resolved": "https://registry.nlark.com/eslint-utils/download/eslint-utils-2.1.0.tgz?cache=0&sync_timestamp=1624608042629&other_urls=https%3A%2F%2Fregistry.nlark.com%2Feslint-utils%2Fdownload%2Feslint-utils-2.1.0.tgz", + "integrity": "sha1-0t5eA0JOcH3BDHQGjd7a5wh0Gyc=", + "dev": true, + "requires": { + "eslint-visitor-keys": "^1.1.0" + }, + "dependencies": { + "eslint-visitor-keys": { + "version": "1.3.0", + "resolved": "https://registry.nlark.com/eslint-visitor-keys/download/eslint-visitor-keys-1.3.0.tgz", + "integrity": "sha1-MOvR73wv3/AcOk8VEESvJfqwUj4=", + "dev": true + } + } + }, + "eslint-visitor-keys": { + "version": "2.1.0", + "resolved": "https://registry.nlark.com/eslint-visitor-keys/download/eslint-visitor-keys-2.1.0.tgz", + "integrity": "sha1-9lMoJZMFknOSyTjtROsKXJsr0wM=", + "dev": true + }, + "espree": { + "version": "7.3.1", + "resolved": "https://registry.nlark.com/espree/download/espree-7.3.1.tgz?cache=0&sync_timestamp=1625021052689&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fespree%2Fdownload%2Fespree-7.3.1.tgz", + "integrity": "sha1-8t8zC3Usb1UBn4vYm3ZgA5wbu7Y=", + "dev": true, + "requires": { + "acorn": "^7.4.0", + "acorn-jsx": "^5.3.1", + "eslint-visitor-keys": "^1.3.0" + }, + "dependencies": { + "acorn": { + "version": "7.4.1", + "resolved": "https://registry.nlark.com/acorn/download/acorn-7.4.1.tgz", + "integrity": "sha1-/q7SVZc9LndVW4PbwIhRpsY1IPo=", + "dev": true + }, + "eslint-visitor-keys": { + "version": "1.3.0", + "resolved": "https://registry.nlark.com/eslint-visitor-keys/download/eslint-visitor-keys-1.3.0.tgz", + "integrity": "sha1-MOvR73wv3/AcOk8VEESvJfqwUj4=", + "dev": true + } + } + }, + "esprima": { + "version": "4.0.1", + "resolved": "https://registry.nlark.com/esprima/download/esprima-4.0.1.tgz", + "integrity": "sha1-E7BM2z5sXRnfkatph6hpVhmwqnE=", + "dev": true + }, + "esquery": { + "version": "1.4.0", + "resolved": "https://registry.nlark.com/esquery/download/esquery-1.4.0.tgz", + "integrity": "sha1-IUj/w4uC6McFff7UhCWz5h8PJKU=", + "dev": true, + "requires": { + "estraverse": "^5.1.0" + }, + "dependencies": { + "estraverse": { + "version": "5.2.0", + "resolved": "https://registry.nlark.com/estraverse/download/estraverse-5.2.0.tgz?cache=0&sync_timestamp=1624607974054&other_urls=https%3A%2F%2Fregistry.nlark.com%2Festraverse%2Fdownload%2Festraverse-5.2.0.tgz", + "integrity": "sha1-MH30JUfmzHMk088DwVXVzbjFOIA=", + "dev": true + } + } + }, + "esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.nlark.com/esrecurse/download/esrecurse-4.3.0.tgz", + "integrity": "sha1-eteWTWeauyi+5yzsY3WLHF0smSE=", + "requires": { + "estraverse": "^5.2.0" + }, + "dependencies": { + "estraverse": { + "version": "5.2.0", + "resolved": "https://registry.nlark.com/estraverse/download/estraverse-5.2.0.tgz?cache=0&sync_timestamp=1624607974054&other_urls=https%3A%2F%2Fregistry.nlark.com%2Festraverse%2Fdownload%2Festraverse-5.2.0.tgz", + "integrity": "sha1-MH30JUfmzHMk088DwVXVzbjFOIA=" + } + } + }, + "estraverse": { + "version": "4.3.0", + "resolved": "https://registry.nlark.com/estraverse/download/estraverse-4.3.0.tgz?cache=0&sync_timestamp=1624607974054&other_urls=https%3A%2F%2Fregistry.nlark.com%2Festraverse%2Fdownload%2Festraverse-4.3.0.tgz", + "integrity": "sha1-OYrT88WiSUi+dyXoPRGn3ijNvR0=" + }, + "esutils": { + "version": "2.0.3", + "resolved": "https://registry.nlark.com/esutils/download/esutils-2.0.3.tgz", + "integrity": "sha1-dNLrTeC42hKTcRkQ1Qd1ubcQ72Q=", + "dev": true + }, + "events": { + "version": "3.3.0", + "resolved": "https://registry.nlark.com/events/download/events-3.3.0.tgz", + "integrity": "sha1-Mala0Kkk4tLEGagTrrLE6HjqdAA=" + }, + "execa": { + "version": "5.1.1", + "resolved": "https://registry.nlark.com/execa/download/execa-5.1.1.tgz", + "integrity": "sha1-+ArZy/Qpj3vR1MlVXCHpN0HEEd0=", + "requires": { + "cross-spawn": "^7.0.3", + "get-stream": "^6.0.0", + "human-signals": "^2.1.0", + "is-stream": "^2.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^4.0.1", + "onetime": "^5.1.2", + "signal-exit": "^3.0.3", + "strip-final-newline": "^2.0.0" + } + }, + "expand-brackets": { + "version": "2.1.4", + "resolved": "https://registry.nlark.com/expand-brackets/download/expand-brackets-2.1.4.tgz", + "integrity": "sha1-t3c14xXOMPa27/D4OwQVGiJEliI=", + "dev": true, + "optional": true, + "requires": { + "debug": "^2.3.3", + "define-property": "^0.2.5", + "extend-shallow": "^2.0.1", + "posix-character-classes": "^0.1.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.1" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.nlark.com/debug/download/debug-2.6.9.tgz?cache=0&sync_timestamp=1625374653719&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fdebug%2Fdownload%2Fdebug-2.6.9.tgz", + "integrity": "sha1-XRKFFd8TT/Mn6QpMk/Tgd6U2NB8=", + "dev": true, + "optional": true, + "requires": { + "ms": "2.0.0" + } + }, + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.nlark.com/define-property/download/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "optional": true, + "requires": { + "is-descriptor": "^0.1.0" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.nlark.com/extend-shallow/download/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "optional": true, + "requires": { + "is-extendable": "^0.1.0" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.nlark.com/ms/download/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true, + "optional": true + } + } + }, + "extend-shallow": { + "version": "3.0.2", + "resolved": "https://registry.nlark.com/extend-shallow/download/extend-shallow-3.0.2.tgz", + "integrity": "sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg=", + "dev": true, + "optional": true, + "requires": { + "assign-symbols": "^1.0.0", + "is-extendable": "^1.0.1" + }, + "dependencies": { + "is-extendable": { + "version": "1.0.1", + "resolved": "https://registry.nlark.com/is-extendable/download/is-extendable-1.0.1.tgz", + "integrity": "sha1-p0cPnkJnM9gb2B4RVSZOOjUHyrQ=", + "dev": true, + "optional": true, + "requires": { + "is-plain-object": "^2.0.4" + } + } + } + }, + "extglob": { + "version": "2.0.4", + "resolved": "https://registry.nlark.com/extglob/download/extglob-2.0.4.tgz", + "integrity": "sha1-rQD+TcYSqSMuhxhxHcXLWrAoVUM=", + "dev": true, + "optional": true, + "requires": { + "array-unique": "^0.3.2", + "define-property": "^1.0.0", + "expand-brackets": "^2.1.4", + "extend-shallow": "^2.0.1", + "fragment-cache": "^0.2.1", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.1" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "resolved": "https://registry.nlark.com/define-property/download/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "dev": true, + "optional": true, + "requires": { + "is-descriptor": "^1.0.0" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.nlark.com/extend-shallow/download/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "optional": true, + "requires": { + "is-extendable": "^0.1.0" + } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.nlark.com/is-accessor-descriptor/download/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha1-FpwvbT3x+ZJhgHI2XJsOofaHhlY=", + "dev": true, + "optional": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.nlark.com/is-data-descriptor/download/is-data-descriptor-1.0.0.tgz", + "integrity": "sha1-2Eh2Mh0Oet0DmQQGq7u9NrqSaMc=", + "dev": true, + "optional": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.nlark.com/is-descriptor/download/is-descriptor-1.0.2.tgz", + "integrity": "sha1-OxWXRqZmBLBPjIFSS6NlxfFNhuw=", + "dev": true, + "optional": true, + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + } + } + }, + "fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.nlark.com/fast-deep-equal/download/fast-deep-equal-3.1.3.tgz?cache=0&sync_timestamp=1624607945641&other_urls=https%3A%2F%2Fregistry.nlark.com%2Ffast-deep-equal%2Fdownload%2Ffast-deep-equal-3.1.3.tgz", + "integrity": "sha1-On1WtVnWy8PrUSMlJE5hmmXGxSU=" + }, + "fast-glob": { + "version": "3.2.7", + "resolved": "https://registry.nlark.com/fast-glob/download/fast-glob-3.2.7.tgz?cache=0&sync_timestamp=1625772623128&other_urls=https%3A%2F%2Fregistry.nlark.com%2Ffast-glob%2Fdownload%2Ffast-glob-3.2.7.tgz", + "integrity": "sha1-/Wy3otfpqnp4RhEehaGW1rL3ZqE=", + "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.nlark.com/fast-json-stable-stringify/download/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha1-h0v2nG9ATCtdmcSBNBOZ/VWJJjM=" + }, + "fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.nlark.com/fast-levenshtein/download/fast-levenshtein-2.0.6.tgz", + "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=", + "dev": true + }, + "fastest-levenshtein": { + "version": "1.0.12", + "resolved": "https://registry.nlark.com/fastest-levenshtein/download/fastest-levenshtein-1.0.12.tgz", + "integrity": "sha1-mZD306iMxan/0fF0V0UlFwDUl+I=" + }, + "fastq": { + "version": "1.12.0", + "resolved": "https://registry.nlark.com/fastq/download/fastq-1.12.0.tgz?cache=0&sync_timestamp=1629360956808&other_urls=https%3A%2F%2Fregistry.nlark.com%2Ffastq%2Fdownload%2Ffastq-1.12.0.tgz", + "integrity": "sha1-7XtqtdYjk/ssxZHIU2UqXDGL95Q=", + "requires": { + "reusify": "^1.0.4" + } + }, + "file-entry-cache": { + "version": "6.0.1", + "resolved": "https://registry.nlark.com/file-entry-cache/download/file-entry-cache-6.0.1.tgz", + "integrity": "sha1-IRst2WWcsDlLBz5zI6w8kz1SICc=", + "dev": true, + "requires": { + "flat-cache": "^3.0.4" + } + }, + "fill-range": { + "version": "7.0.1", + "resolved": "https://registry.nlark.com/fill-range/download/fill-range-7.0.1.tgz", + "integrity": "sha1-GRmmp8df44ssfHflGYU12prN2kA=", + "requires": { + "to-regex-range": "^5.0.1" + } + }, + "find-up": { + "version": "4.1.0", + "resolved": "https://registry.nlark.com/find-up/download/find-up-4.1.0.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.nlark.com%2Ffind-up%2Fdownload%2Ffind-up-4.1.0.tgz", + "integrity": "sha1-l6/n1s3AvFkoWEt8jXsW6KmqXRk=", + "requires": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + } + }, + "flat": { + "version": "5.0.2", + "resolved": "https://registry.nlark.com/flat/download/flat-5.0.2.tgz", + "integrity": "sha1-jKb+MyBp/6nTJMMnGYxZglnOskE=", + "dev": true + }, + "flat-cache": { + "version": "3.0.4", + "resolved": "https://registry.nlark.com/flat-cache/download/flat-cache-3.0.4.tgz", + "integrity": "sha1-YbAzgwKy/p+Vfcwy/CqH8cMEixE=", + "dev": true, + "requires": { + "flatted": "^3.1.0", + "rimraf": "^3.0.2" + }, + "dependencies": { + "flatted": { + "version": "3.2.2", + "resolved": "https://registry.nlark.com/flatted/download/flatted-3.2.2.tgz?cache=0&sync_timestamp=1627541251258&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fflatted%2Fdownload%2Fflatted-3.2.2.tgz", + "integrity": "sha1-ZL/tXLaP48p4s+shStl7Y77c5WE=", + "dev": true + }, + "rimraf": { + "version": "3.0.2", + "resolved": "https://registry.nlark.com/rimraf/download/rimraf-3.0.2.tgz", + "integrity": "sha1-8aVAK6YiCtUswSgrrBrjqkn9Bho=", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + } + } + }, + "flatted": { + "version": "2.0.2", + "resolved": "https://registry.nlark.com/flatted/download/flatted-2.0.2.tgz?cache=0&sync_timestamp=1627541251258&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fflatted%2Fdownload%2Fflatted-2.0.2.tgz", + "integrity": "sha1-RXWyHivO50NKqb5mL0t7X5wrUTg=" + }, + "for-in": { + "version": "1.0.2", + "resolved": "https://registry.nlark.com/for-in/download/for-in-1.0.2.tgz", + "integrity": "sha1-gQaNKVqBQuwKxybG4iAMMPttXoA=", + "dev": true, + "optional": true + }, + "fragment-cache": { + "version": "0.2.1", + "resolved": "https://registry.nlark.com/fragment-cache/download/fragment-cache-0.2.1.tgz", + "integrity": "sha1-QpD60n8T6Jvn8zeZxrxaCr//DRk=", + "dev": true, + "optional": true, + "requires": { + "map-cache": "^0.2.2" + } + }, + "fs-extra": { + "version": "8.1.0", + "resolved": "https://registry.nlark.com/fs-extra/download/fs-extra-8.1.0.tgz", + "integrity": "sha1-SdQ8RaiM2Wd2aMt74bRu/bjS4cA=", + "requires": { + "graceful-fs": "^4.2.0", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + } + }, + "fs-readdir-recursive": { + "version": "1.1.0", + "resolved": "https://registry.nlark.com/fs-readdir-recursive/download/fs-readdir-recursive-1.1.0.tgz", + "integrity": "sha1-4y/AMKLM7kSmtTcTCNpUvgs5fSc=", + "dev": true + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.nlark.com/fs.realpath/download/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" + }, + "fsevents": { + "version": "2.3.2", + "resolved": "https://registry.nlark.com/fsevents/download/fsevents-2.3.2.tgz", + "integrity": "sha1-ilJveLj99GI7cJ4Ll1xSwkwC/Ro=", + "dev": true, + "optional": true + }, + "function-bind": { + "version": "1.1.1", + "resolved": "https://registry.nlark.com/function-bind/download/function-bind-1.1.1.tgz", + "integrity": "sha1-pWiZ0+o8m6uHS7l3O3xe3pL0iV0=" + }, + "functional-red-black-tree": { + "version": "1.0.1", + "resolved": "https://registry.nlark.com/functional-red-black-tree/download/functional-red-black-tree-1.0.1.tgz", + "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=", + "dev": true + }, + "gensync": { + "version": "1.0.0-beta.2", + "resolved": "https://registry.nlark.com/gensync/download/gensync-1.0.0-beta.2.tgz", + "integrity": "sha1-MqbudsPX9S1GsrGuXZP+qFgKJeA=", + "dev": true + }, + "get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.nlark.com/get-caller-file/download/get-caller-file-2.0.5.tgz", + "integrity": "sha1-T5RBKoLbMvNuOwuXQfipf+sDH34=", + "dev": true + }, + "get-func-name": { + "version": "2.0.0", + "resolved": "https://registry.nlark.com/get-func-name/download/get-func-name-2.0.0.tgz?cache=0&sync_timestamp=1624607980603&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fget-func-name%2Fdownload%2Fget-func-name-2.0.0.tgz", + "integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=", + "dev": true + }, + "get-intrinsic": { + "version": "1.1.1", + "resolved": "https://registry.nlark.com/get-intrinsic/download/get-intrinsic-1.1.1.tgz", + "integrity": "sha1-FfWfN2+FXERpY5SPDSTNNje0q8Y=", + "dev": true, + "requires": { + "function-bind": "^1.1.1", + "has": "^1.0.3", + "has-symbols": "^1.0.1" + } + }, + "get-stream": { + "version": "6.0.1", + "resolved": "https://registry.nlark.com/get-stream/download/get-stream-6.0.1.tgz", + "integrity": "sha1-omLY7vZ6ztV8KFKtYWdSakPL97c=" + }, + "get-value": { + "version": "2.0.6", + "resolved": "https://registry.nlark.com/get-value/download/get-value-2.0.6.tgz", + "integrity": "sha1-3BXKHGcjh8p2vTesCjlbogQqLCg=", + "dev": true, + "optional": true + }, + "glob": { + "version": "7.1.7", + "resolved": "https://registry.nlark.com/glob/download/glob-7.1.7.tgz", + "integrity": "sha1-Oxk+kjPwHULQs/eClLvutBj5SpA=", + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.nlark.com/glob-parent/download/glob-parent-5.1.2.tgz?cache=0&sync_timestamp=1626761012320&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fglob-parent%2Fdownload%2Fglob-parent-5.1.2.tgz", + "integrity": "sha1-hpgyxYA0/mikCTwX3BXoNA2EAcQ=", + "requires": { + "is-glob": "^4.0.1" + } + }, + "glob-to-regexp": { + "version": "0.4.1", + "resolved": "https://registry.nlark.com/glob-to-regexp/download/glob-to-regexp-0.4.1.tgz", + "integrity": "sha1-x1KXCHyFG5pXi9IX3VmpL1n+VG4=" + }, + "globals": { + "version": "11.12.0", + "resolved": "https://registry.nlark.com/globals/download/globals-11.12.0.tgz", + "integrity": "sha1-q4eVM4hooLq9hSV1gBjCp+uVxC4=", + "dev": true + }, + "globby": { + "version": "6.1.0", + "resolved": "https://registry.nlark.com/globby/download/globby-6.1.0.tgz", + "integrity": "sha1-9abXDoOV4hyFj7BInWTfAkJNUGw=", + "requires": { + "array-union": "^1.0.1", + "glob": "^7.0.3", + "object-assign": "^4.0.1", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0" + }, + "dependencies": { + "pify": { + "version": "2.3.0", + "resolved": "https://registry.nlark.com/pify/download/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=" + } + } + }, + "graceful-fs": { + "version": "4.2.8", + "resolved": "https://registry.nlark.com/graceful-fs/download/graceful-fs-4.2.8.tgz?cache=0&sync_timestamp=1628194007768&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fgraceful-fs%2Fdownload%2Fgraceful-fs-4.2.8.tgz", + "integrity": "sha1-5BK40z9eAGWTy9PO5t+fLOu+gCo=" + }, + "growl": { + "version": "1.10.5", + "resolved": "https://registry.nlark.com/growl/download/growl-1.10.5.tgz", + "integrity": "sha1-8nNdwig2dPpnR4sQGBBZNVw2nl4=", + "dev": true + }, + "has": { + "version": "1.0.3", + "resolved": "https://registry.nlark.com/has/download/has-1.0.3.tgz", + "integrity": "sha1-ci18v8H2qoJB8W3YFOAR4fQeh5Y=", + "requires": { + "function-bind": "^1.1.1" + } + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.nlark.com/has-flag/download/has-flag-4.0.0.tgz?cache=0&sync_timestamp=1626716578584&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fhas-flag%2Fdownload%2Fhas-flag-4.0.0.tgz", + "integrity": "sha1-lEdx/ZyByBJlxNaUGGDaBrtZR5s=" + }, + "has-symbols": { + "version": "1.0.2", + "resolved": "https://registry.nlark.com/has-symbols/download/has-symbols-1.0.2.tgz", + "integrity": "sha1-Fl0wcMADCXUqEjakeTMeOsVvFCM=", + "dev": true + }, + "has-value": { + "version": "1.0.0", + "resolved": "https://registry.nlark.com/has-value/download/has-value-1.0.0.tgz", + "integrity": "sha1-GLKB2lhbHFxR3vJMkw7SmgvmsXc=", + "dev": true, + "optional": true, + "requires": { + "get-value": "^2.0.6", + "has-values": "^1.0.0", + "isobject": "^3.0.0" + } + }, + "has-values": { + "version": "1.0.0", + "resolved": "https://registry.nlark.com/has-values/download/has-values-1.0.0.tgz", + "integrity": "sha1-lbC2P+whRmGab+V/51Yo1aOe/k8=", + "dev": true, + "optional": true, + "requires": { + "is-number": "^3.0.0", + "kind-of": "^4.0.0" + }, + "dependencies": { + "is-number": { + "version": "3.0.0", + "resolved": "https://registry.nlark.com/is-number/download/is-number-3.0.0.tgz", + "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "dev": true, + "optional": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.nlark.com/kind-of/download/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "optional": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "kind-of": { + "version": "4.0.0", + "resolved": "https://registry.nlark.com/kind-of/download/kind-of-4.0.0.tgz", + "integrity": "sha1-IIE989cSkosgc3hpGkUGb65y3Vc=", + "dev": true, + "optional": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "he": { + "version": "1.2.0", + "resolved": "https://registry.nlark.com/he/download/he-1.2.0.tgz", + "integrity": "sha1-hK5l+n6vsWX922FWauFLrwVmTw8=", + "dev": true + }, + "human-signals": { + "version": "2.1.0", + "resolved": "https://registry.nlark.com/human-signals/download/human-signals-2.1.0.tgz", + "integrity": "sha1-3JH8ukLk0G5Kuu0zs+ejwC9RTqA=" + }, + "ignore": { + "version": "5.1.8", + "resolved": "https://registry.nlark.com/ignore/download/ignore-5.1.8.tgz", + "integrity": "sha1-8VCotQo0KJsz4i9YiavU2AFvDlc=" + }, + "import-fresh": { + "version": "3.3.0", + "resolved": "https://registry.nlark.com/import-fresh/download/import-fresh-3.3.0.tgz", + "integrity": "sha1-NxYsJfy566oublPVtNiM4X2eDCs=", + "dev": true, + "requires": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + }, + "dependencies": { + "resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.nlark.com/resolve-from/download/resolve-from-4.0.0.tgz?cache=0&sync_timestamp=1624607952279&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fresolve-from%2Fdownload%2Fresolve-from-4.0.0.tgz", + "integrity": "sha1-SrzYUq0y3Xuqv+m0DgCjbbXzkuY=", + "dev": true + } + } + }, + "import-local": { + "version": "3.0.2", + "resolved": "https://registry.nlark.com/import-local/download/import-local-3.0.2.tgz", + "integrity": "sha1-qM/QQx0d5KIZlwPQA+PmI2T6bbY=", + "requires": { + "pkg-dir": "^4.2.0", + "resolve-cwd": "^3.0.0" + } + }, + "imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.nlark.com/imurmurhash/download/imurmurhash-0.1.4.tgz", + "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", + "dev": true + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.nlark.com/inflight/download/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.4", + "resolved": "https://registry.nlark.com/inherits/download/inherits-2.0.4.tgz", + "integrity": "sha1-D6LGT5MpF8NDOg3tVTY6rjdBa3w=" + }, + "interpret": { + "version": "2.2.0", + "resolved": "https://registry.nlark.com/interpret/download/interpret-2.2.0.tgz?cache=0&sync_timestamp=1624607963441&other_urls=https%3A%2F%2Fregistry.nlark.com%2Finterpret%2Fdownload%2Finterpret-2.2.0.tgz", + "integrity": "sha1-GnigtZZcQKVBbQB61vUK0nxBffk=" + }, + "is-accessor-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.nlark.com/is-accessor-descriptor/download/is-accessor-descriptor-0.1.6.tgz", + "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", + "dev": true, + "optional": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.nlark.com/kind-of/download/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "optional": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "is-binary-path": { + "version": "1.0.1", + "resolved": "https://registry.nlark.com/is-binary-path/download/is-binary-path-1.0.1.tgz", + "integrity": "sha1-dfFmQrSA8YenEcgUFh/TpKdlWJg=", + "dev": true, + "optional": true, + "requires": { + "binary-extensions": "^1.0.0" + } + }, + "is-buffer": { + "version": "1.1.6", + "resolved": "https://registry.nlark.com/is-buffer/download/is-buffer-1.1.6.tgz", + "integrity": "sha1-76ouqdqg16suoTqXsritUf776L4=", + "dev": true, + "optional": true + }, + "is-core-module": { + "version": "2.6.0", + "resolved": "https://registry.nlark.com/is-core-module/download/is-core-module-2.6.0.tgz?cache=0&sync_timestamp=1629225103688&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fis-core-module%2Fdownload%2Fis-core-module-2.6.0.tgz", + "integrity": "sha1-11U7JSb+Wbkro+QMjfdX7Ipwnhk=", + "requires": { + "has": "^1.0.3" + } + }, + "is-data-descriptor": { + "version": "0.1.4", + "resolved": "https://registry.nlark.com/is-data-descriptor/download/is-data-descriptor-0.1.4.tgz", + "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", + "dev": true, + "optional": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.nlark.com/kind-of/download/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "optional": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "is-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.nlark.com/is-descriptor/download/is-descriptor-0.1.6.tgz", + "integrity": "sha1-Nm2CQN3kh8pRgjsaufB6EKeCUco=", + "dev": true, + "optional": true, + "requires": { + "is-accessor-descriptor": "^0.1.6", + "is-data-descriptor": "^0.1.4", + "kind-of": "^5.0.0" + }, + "dependencies": { + "kind-of": { + "version": "5.1.0", + "resolved": "https://registry.nlark.com/kind-of/download/kind-of-5.1.0.tgz", + "integrity": "sha1-cpyR4thXt6QZofmqZWhcTDP1hF0=", + "dev": true, + "optional": true + } + } + }, + "is-extendable": { + "version": "0.1.1", + "resolved": "https://registry.nlark.com/is-extendable/download/is-extendable-0.1.1.tgz", + "integrity": "sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik=", + "dev": true, + "optional": true + }, + "is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.nlark.com/is-extglob/download/is-extglob-2.1.1.tgz", + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=" + }, + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.nlark.com/is-fullwidth-code-point/download/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha1-8Rb4Bk/pCz94RKOJl8C3UFEmnx0=", + "dev": true + }, + "is-glob": { + "version": "4.0.1", + "resolved": "https://registry.nlark.com/is-glob/download/is-glob-4.0.1.tgz", + "integrity": "sha1-dWfb6fL14kZ7x3q4PEopSCQHpdw=", + "requires": { + "is-extglob": "^2.1.1" + } + }, + "is-number": { + "version": "7.0.0", + "resolved": "https://registry.nlark.com/is-number/download/is-number-7.0.0.tgz", + "integrity": "sha1-dTU0W4lnNNX4DE0GxQlVUnoU8Ss=" + }, + "is-path-cwd": { + "version": "2.2.0", + "resolved": "https://registry.nlark.com/is-path-cwd/download/is-path-cwd-2.2.0.tgz", + "integrity": "sha1-Z9Q7gmZKe1GR/ZEZEn6zAASKn9s=" + }, + "is-path-in-cwd": { + "version": "2.1.0", + "resolved": "https://registry.nlark.com/is-path-in-cwd/download/is-path-in-cwd-2.1.0.tgz", + "integrity": "sha1-v+Lcomxp85cmWkAJljYCk1oFOss=", + "requires": { + "is-path-inside": "^2.1.0" + } + }, + "is-path-inside": { + "version": "2.1.0", + "resolved": "https://registry.nlark.com/is-path-inside/download/is-path-inside-2.1.0.tgz", + "integrity": "sha1-fJgQWH1lmkDSe8201WFuqwWUlLI=", + "requires": { + "path-is-inside": "^1.0.2" + } + }, + "is-plain-obj": { + "version": "2.1.0", + "resolved": "https://registry.nlark.com/is-plain-obj/download/is-plain-obj-2.1.0.tgz", + "integrity": "sha1-ReQuN/zPH0Dajl927iFRWEDAkoc=", + "dev": true + }, + "is-plain-object": { + "version": "2.0.4", + "resolved": "https://registry.nlark.com/is-plain-object/download/is-plain-object-2.0.4.tgz?cache=0&sync_timestamp=1624608043754&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fis-plain-object%2Fdownload%2Fis-plain-object-2.0.4.tgz", + "integrity": "sha1-LBY7P6+xtgbZ0Xko8FwqHDjgdnc=", + "requires": { + "isobject": "^3.0.1" + } + }, + "is-stream": { + "version": "2.0.1", + "resolved": "https://registry.nlark.com/is-stream/download/is-stream-2.0.1.tgz?cache=0&sync_timestamp=1628592752355&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fis-stream%2Fdownload%2Fis-stream-2.0.1.tgz", + "integrity": "sha1-+sHj1TuXrVqdCunO8jifWBClwHc=" + }, + "is-windows": { + "version": "1.0.2", + "resolved": "https://registry.nlark.com/is-windows/download/is-windows-1.0.2.tgz", + "integrity": "sha1-0YUOuXkezRjmGCzhKjDzlmNLsZ0=", + "dev": true, + "optional": true + }, + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.nlark.com/isarray/download/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" + }, + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.nlark.com/isexe/download/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=" + }, + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.nlark.com/isobject/download/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=" + }, + "jest-worker": { + "version": "27.1.0", + "resolved": "https://registry.nlark.com/jest-worker/download/jest-worker-27.1.0.tgz", + "integrity": "sha1-ZfSojjcUjtmEuoyoSS1rN2k4wKo=", + "requires": { + "@types/node": "*", + "merge-stream": "^2.0.0", + "supports-color": "^8.0.0" + }, + "dependencies": { + "supports-color": { + "version": "8.1.1", + "resolved": "https://registry.nlark.com/supports-color/download/supports-color-8.1.1.tgz?cache=0&sync_timestamp=1626703455199&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fsupports-color%2Fdownload%2Fsupports-color-8.1.1.tgz", + "integrity": "sha1-zW/BfihQDP9WwbhsCn/UpUpzAFw=", + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, + "js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.nlark.com/js-tokens/download/js-tokens-4.0.0.tgz", + "integrity": "sha1-GSA/tZmR35jjoocFDUZHzerzJJk=", + "dev": true + }, + "js-yaml": { + "version": "3.14.1", + "resolved": "https://registry.nlark.com/js-yaml/download/js-yaml-3.14.1.tgz?cache=0&sync_timestamp=1624607946901&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fjs-yaml%2Fdownload%2Fjs-yaml-3.14.1.tgz", + "integrity": "sha1-2ugS/bOCX6MGYJqHFzg8UMNqBTc=", + "dev": true, + "requires": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + } + }, + "jsesc": { + "version": "2.5.2", + "resolved": "https://registry.nlark.com/jsesc/download/jsesc-2.5.2.tgz", + "integrity": "sha1-gFZNLkg9rPbo7yCWUKZ98/DCg6Q=", + "dev": true + }, + "json-parse-better-errors": { + "version": "1.0.2", + "resolved": "https://registry.nlark.com/json-parse-better-errors/download/json-parse-better-errors-1.0.2.tgz", + "integrity": "sha1-u4Z8+zRQ5pEHwTHRxRS6s9yLyqk=" + }, + "json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.nlark.com/json-schema-traverse/download/json-schema-traverse-0.4.1.tgz", + "integrity": "sha1-afaofZUTq4u4/mO9sJecRI5oRmA=" + }, + "json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.nlark.com/json-stable-stringify-without-jsonify/download/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=", + "dev": true + }, + "json5": { + "version": "2.2.0", + "resolved": "https://registry.nlark.com/json5/download/json5-2.2.0.tgz?cache=0&sync_timestamp=1624607963605&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fjson5%2Fdownload%2Fjson5-2.2.0.tgz", + "integrity": "sha1-Lf7+cgxrpSXZ69kJlQ8FFTFsiaM=", + "requires": { + "minimist": "^1.2.5" + } + }, + "jsonfile": { + "version": "4.0.0", + "resolved": "https://registry.nlark.com/jsonfile/download/jsonfile-4.0.0.tgz", + "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=", + "requires": { + "graceful-fs": "^4.1.6" + } + }, + "kind-of": { + "version": "6.0.3", + "resolved": "https://registry.nlark.com/kind-of/download/kind-of-6.0.3.tgz", + "integrity": "sha1-B8BQNKbDSfoG4k+jWqdttFgM5N0=" + }, + "levn": { + "version": "0.4.1", + "resolved": "https://registry.nlark.com/levn/download/levn-0.4.1.tgz", + "integrity": "sha1-rkViwAdHO5MqYgDUAyaN0v/8at4=", + "dev": true, + "requires": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + } + }, + "loader-runner": { + "version": "4.2.0", + "resolved": "https://registry.nlark.com/loader-runner/download/loader-runner-4.2.0.tgz", + "integrity": "sha1-1wIjgNZtFMX7HUlriYZOvP1Hg4Q=" + }, + "loader-utils": { + "version": "2.0.0", + "resolved": "https://registry.nlark.com/loader-utils/download/loader-utils-2.0.0.tgz?cache=0&sync_timestamp=1624607974187&other_urls=https%3A%2F%2Fregistry.nlark.com%2Floader-utils%2Fdownload%2Floader-utils-2.0.0.tgz", + "integrity": "sha1-5MrOW4FtQloWa18JfhDNErNgZLA=", + "requires": { + "big.js": "^5.2.2", + "emojis-list": "^3.0.0", + "json5": "^2.1.2" + } + }, + "locate-path": { + "version": "5.0.0", + "resolved": "https://registry.nlark.com/locate-path/download/locate-path-5.0.0.tgz", + "integrity": "sha1-Gvujlq/WdqbUJQTQpno6frn2KqA=", + "requires": { + "p-locate": "^4.1.0" + } + }, + "lodash.clonedeep": { + "version": "4.5.0", + "resolved": "https://registry.nlark.com/lodash.clonedeep/download/lodash.clonedeep-4.5.0.tgz", + "integrity": "sha1-4j8/nE+Pvd6HJSnBBxhXoIblzO8=", + "dev": true + }, + "lodash.debounce": { + "version": "4.0.8", + "resolved": "https://registry.nlark.com/lodash.debounce/download/lodash.debounce-4.0.8.tgz", + "integrity": "sha1-gteb/zCmfEAF/9XiUVMArZyk168=", + "dev": true + }, + "lodash.merge": { + "version": "4.6.2", + "resolved": "https://registry.nlark.com/lodash.merge/download/lodash.merge-4.6.2.tgz", + "integrity": "sha1-VYqlO0O2YeGSWgr9+japoQhf5Xo=", + "dev": true + }, + "lodash.truncate": { + "version": "4.4.2", + "resolved": "https://registry.nlark.com/lodash.truncate/download/lodash.truncate-4.4.2.tgz", + "integrity": "sha1-WjUNoLERO4N+z//VgSy+WNbq4ZM=", + "dev": true + }, + "log-symbols": { + "version": "4.0.0", + "resolved": "https://registry.nlark.com/log-symbols/download/log-symbols-4.0.0.tgz", + "integrity": "sha1-abPMRtIPRI7M23XqH6cz2eghySA=", + "dev": true, + "requires": { + "chalk": "^4.0.0" + } + }, + "log4js": { + "version": "6.3.0", + "resolved": "https://registry.nlark.com/log4js/download/log4js-6.3.0.tgz", + "integrity": "sha1-EN+vu0NDUaPjAnegC5h5RG9xW8s=", + "requires": { + "date-format": "^3.0.0", + "debug": "^4.1.1", + "flatted": "^2.0.1", + "rfdc": "^1.1.4", + "streamroller": "^2.2.4" + } + }, + "lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.nlark.com/lru-cache/download/lru-cache-6.0.0.tgz", + "integrity": "sha1-bW/mVw69lqr5D8rR2vo7JWbbOpQ=", + "requires": { + "yallist": "^4.0.0" + } + }, + "make-dir": { + "version": "2.1.0", + "resolved": "https://registry.nlark.com/make-dir/download/make-dir-2.1.0.tgz", + "integrity": "sha1-XwMQ4YuL6JjMBwCSlaMK5B6R5vU=", + "dev": true, + "requires": { + "pify": "^4.0.1", + "semver": "^5.6.0" + }, + "dependencies": { + "semver": { + "version": "5.7.1", + "resolved": "https://registry.nlark.com/semver/download/semver-5.7.1.tgz?cache=0&sync_timestamp=1624607961409&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fsemver%2Fdownload%2Fsemver-5.7.1.tgz", + "integrity": "sha1-qVT5Ma66UI0we78Gnv8MAclhFvc=", + "dev": true + } + } + }, + "make-error": { + "version": "1.3.6", + "resolved": "https://registry.nlark.com/make-error/download/make-error-1.3.6.tgz", + "integrity": "sha1-LrLjfqm2fEiR9oShOUeZr0hM96I=", + "dev": true + }, + "map-cache": { + "version": "0.2.2", + "resolved": "https://registry.nlark.com/map-cache/download/map-cache-0.2.2.tgz", + "integrity": "sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8=", + "dev": true, + "optional": true + }, + "map-visit": { + "version": "1.0.0", + "resolved": "https://registry.nlark.com/map-visit/download/map-visit-1.0.0.tgz", + "integrity": "sha1-7Nyo8TFE5mDxtb1B8S80edmN+48=", + "dev": true, + "optional": true, + "requires": { + "object-visit": "^1.0.0" + } + }, + "memory-fs": { + "version": "0.5.0", + "resolved": "https://registry.nlark.com/memory-fs/download/memory-fs-0.5.0.tgz", + "integrity": "sha1-MkwBKIuIZSlm0WHbd4OHIIRajjw=", + "requires": { + "errno": "^0.1.3", + "readable-stream": "^2.0.1" + } + }, + "merge-stream": { + "version": "2.0.0", + "resolved": "https://registry.nlark.com/merge-stream/download/merge-stream-2.0.0.tgz", + "integrity": "sha1-UoI2KaFN0AyXcPtq1H3GMQ8sH2A=" + }, + "merge2": { + "version": "1.4.1", + "resolved": "https://registry.nlark.com/merge2/download/merge2-1.4.1.tgz", + "integrity": "sha1-Q2iJL4hekHRVpv19xVwMnUBJkK4=" + }, + "micromatch": { + "version": "4.0.4", + "resolved": "https://registry.nlark.com/micromatch/download/micromatch-4.0.4.tgz", + "integrity": "sha1-iW1Rnf6dsl/OlM63pQCRm/iB6/k=", + "requires": { + "braces": "^3.0.1", + "picomatch": "^2.2.3" + } + }, + "mime-db": { + "version": "1.49.0", + "resolved": "https://registry.nlark.com/mime-db/download/mime-db-1.49.0.tgz", + "integrity": "sha1-89/eYMmenPO8lwHWh3ePU3ABy+0=" + }, + "mime-types": { + "version": "2.1.32", + "resolved": "https://registry.nlark.com/mime-types/download/mime-types-2.1.32.tgz?cache=0&sync_timestamp=1627407652875&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fmime-types%2Fdownload%2Fmime-types-2.1.32.tgz", + "integrity": "sha1-HQDonn3n/gIAjbYQAdngKFJnD9U=", + "requires": { + "mime-db": "1.49.0" + } + }, + "mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.nlark.com/mimic-fn/download/mimic-fn-2.1.0.tgz", + "integrity": "sha1-ftLCzMyvhNP/y3pptXcR/CCDQBs=" + }, + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.nlark.com/minimatch/download/minimatch-3.0.4.tgz?cache=0&sync_timestamp=1624607996146&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fminimatch%2Fdownload%2Fminimatch-3.0.4.tgz", + "integrity": "sha1-UWbihkV/AzBgZL5Ul+jbsMPTIIM=", + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "minimist": { + "version": "1.2.5", + "resolved": "https://registry.nlark.com/minimist/download/minimist-1.2.5.tgz?cache=0&sync_timestamp=1624607886507&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fminimist%2Fdownload%2Fminimist-1.2.5.tgz", + "integrity": "sha1-Z9ZgFLZqaoqqDAg8X9WN9OTpdgI=" + }, + "mixin-deep": { + "version": "1.3.2", + "resolved": "https://registry.nlark.com/mixin-deep/download/mixin-deep-1.3.2.tgz", + "integrity": "sha1-ESC0PcNZp4Xc5ltVuC4lfM9HlWY=", + "dev": true, + "optional": true, + "requires": { + "for-in": "^1.0.2", + "is-extendable": "^1.0.1" + }, + "dependencies": { + "is-extendable": { + "version": "1.0.1", + "resolved": "https://registry.nlark.com/is-extendable/download/is-extendable-1.0.1.tgz", + "integrity": "sha1-p0cPnkJnM9gb2B4RVSZOOjUHyrQ=", + "dev": true, + "optional": true, + "requires": { + "is-plain-object": "^2.0.4" + } + } + } + }, + "mocha": { + "version": "8.4.0", + "resolved": "https://registry.nlark.com/mocha/download/mocha-8.4.0.tgz", + "integrity": "sha1-Z3voi/FZgKPK4Dpz4QoPw5l/DP8=", + "dev": true, + "requires": { + "@ungap/promise-all-settled": "1.1.2", + "ansi-colors": "4.1.1", + "browser-stdout": "1.3.1", + "chokidar": "3.5.1", + "debug": "4.3.1", + "diff": "5.0.0", + "escape-string-regexp": "4.0.0", + "find-up": "5.0.0", + "glob": "7.1.6", + "growl": "1.10.5", + "he": "1.2.0", + "js-yaml": "4.0.0", + "log-symbols": "4.0.0", + "minimatch": "3.0.4", + "ms": "2.1.3", + "nanoid": "3.1.20", + "serialize-javascript": "5.0.1", + "strip-json-comments": "3.1.1", + "supports-color": "8.1.1", + "which": "2.0.2", + "wide-align": "1.1.3", + "workerpool": "6.1.0", + "yargs": "16.2.0", + "yargs-parser": "20.2.4", + "yargs-unparser": "2.0.0" + }, + "dependencies": { + "argparse": { + "version": "2.0.1", + "resolved": "https://registry.nlark.com/argparse/download/argparse-2.0.1.tgz", + "integrity": "sha1-JG9Q88p4oyQPbJl+ipvR6sSeSzg=", + "dev": true + }, + "binary-extensions": { + "version": "2.2.0", + "resolved": "https://registry.nlark.com/binary-extensions/download/binary-extensions-2.2.0.tgz", + "integrity": "sha1-dfUC7q+f/eQvyYgpZFvk6na9ni0=", + "dev": true + }, + "chokidar": { + "version": "3.5.1", + "resolved": "https://registry.nlark.com/chokidar/download/chokidar-3.5.1.tgz", + "integrity": "sha1-7pznu+vSt59J8wR5nVRo4x4U5oo=", + "dev": true, + "requires": { + "anymatch": "~3.1.1", + "braces": "~3.0.2", + "fsevents": "~2.3.1", + "glob-parent": "~5.1.0", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.5.0" + } + }, + "debug": { + "version": "4.3.1", + "resolved": "https://registry.nlark.com/debug/download/debug-4.3.1.tgz?cache=0&sync_timestamp=1625374653719&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fdebug%2Fdownload%2Fdebug-4.3.1.tgz", + "integrity": "sha1-8NIpxQXgxtjEmsVT0bE9wYP2su4=", + "dev": true, + "requires": { + "ms": "2.1.2" + }, + "dependencies": { + "ms": { + "version": "2.1.2", + "resolved": "https://registry.nlark.com/ms/download/ms-2.1.2.tgz", + "integrity": "sha1-0J0fNXtEP0kzgqjrPM0YOHKuYAk=", + "dev": true + } + } + }, + "escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.nlark.com/escape-string-regexp/download/escape-string-regexp-4.0.0.tgz", + "integrity": "sha1-FLqDpdNz49MR5a/KKc9b+tllvzQ=", + "dev": true + }, + "find-up": { + "version": "5.0.0", + "resolved": "https://registry.nlark.com/find-up/download/find-up-5.0.0.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.nlark.com%2Ffind-up%2Fdownload%2Ffind-up-5.0.0.tgz", + "integrity": "sha1-TJKBnstwg1YeT0okCoa+UZj1Nvw=", + "dev": true, + "requires": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + } + }, + "glob": { + "version": "7.1.6", + "resolved": "https://registry.nlark.com/glob/download/glob-7.1.6.tgz", + "integrity": "sha1-FB8zuBp8JJLhJVlDB0gMRmeSeKY=", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.nlark.com/is-binary-path/download/is-binary-path-2.1.0.tgz", + "integrity": "sha1-6h9/O4DwZCNug0cPhsCcJU+0Wwk=", + "dev": true, + "requires": { + "binary-extensions": "^2.0.0" + } + }, + "js-yaml": { + "version": "4.0.0", + "resolved": "https://registry.nlark.com/js-yaml/download/js-yaml-4.0.0.tgz?cache=0&sync_timestamp=1624607946901&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fjs-yaml%2Fdownload%2Fjs-yaml-4.0.0.tgz", + "integrity": "sha1-9Ca8D/S0BRkmzViMcRExg0CaEh8=", + "dev": true, + "requires": { + "argparse": "^2.0.1" + } + }, + "locate-path": { + "version": "6.0.0", + "resolved": "https://registry.nlark.com/locate-path/download/locate-path-6.0.0.tgz", + "integrity": "sha1-VTIeswn+u8WcSAHZMackUqaB0oY=", + "dev": true, + "requires": { + "p-locate": "^5.0.0" + } + }, + "ms": { + "version": "2.1.3", + "resolved": "https://registry.nlark.com/ms/download/ms-2.1.3.tgz", + "integrity": "sha1-V0yBOM4dK1hh8LRFedut1gxmFbI=", + "dev": true + }, + "p-locate": { + "version": "5.0.0", + "resolved": "https://registry.nlark.com/p-locate/download/p-locate-5.0.0.tgz?cache=0&sync_timestamp=1629892708584&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fp-locate%2Fdownload%2Fp-locate-5.0.0.tgz", + "integrity": "sha1-g8gxXGeFAF470CGDlBHJ4RDm2DQ=", + "dev": true, + "requires": { + "p-limit": "^3.0.2" + } + }, + "readdirp": { + "version": "3.5.0", + "resolved": "https://registry.nlark.com/readdirp/download/readdirp-3.5.0.tgz", + "integrity": "sha1-m6dMAZsV02UnjS6Ru4xI17TULJ4=", + "dev": true, + "requires": { + "picomatch": "^2.2.1" + } + }, + "supports-color": { + "version": "8.1.1", + "resolved": "https://registry.nlark.com/supports-color/download/supports-color-8.1.1.tgz?cache=0&sync_timestamp=1626703455199&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fsupports-color%2Fdownload%2Fsupports-color-8.1.1.tgz", + "integrity": "sha1-zW/BfihQDP9WwbhsCn/UpUpzAFw=", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.nlark.com/ms/download/ms-2.1.2.tgz", + "integrity": "sha1-0J0fNXtEP0kzgqjrPM0YOHKuYAk=" + }, + "nanoid": { + "version": "3.1.20", + "resolved": "https://registry.nlark.com/nanoid/download/nanoid-3.1.20.tgz", + "integrity": "sha1-utwmPGsdzxS3HvqoX2q0wdbPx4g=", + "dev": true + }, + "nanomatch": { + "version": "1.2.13", + "resolved": "https://registry.nlark.com/nanomatch/download/nanomatch-1.2.13.tgz", + "integrity": "sha1-uHqKpPwN6P5r6IiVs4mD/yZb0Rk=", + "dev": true, + "optional": true, + "requires": { + "arr-diff": "^4.0.0", + "array-unique": "^0.3.2", + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "fragment-cache": "^0.2.1", + "is-windows": "^1.0.2", + "kind-of": "^6.0.2", + "object.pick": "^1.3.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.1" + } + }, + "natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.nlark.com/natural-compare/download/natural-compare-1.4.0.tgz?cache=0&sync_timestamp=1624608011507&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fnatural-compare%2Fdownload%2Fnatural-compare-1.4.0.tgz", + "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", + "dev": true + }, + "neo-async": { + "version": "2.6.2", + "resolved": "https://registry.nlark.com/neo-async/download/neo-async-2.6.2.tgz", + "integrity": "sha1-tKr7k+OustgXTKU88WOrfXMIMF8=" + }, + "node-releases": { + "version": "1.1.75", + "resolved": "https://registry.nlark.com/node-releases/download/node-releases-1.1.75.tgz?cache=0&sync_timestamp=1629280320667&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fnode-releases%2Fdownload%2Fnode-releases-1.1.75.tgz", + "integrity": "sha1-bdjIdrmJehuOWgLeJq+nm7VOu/4=" + }, + "normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.nlark.com/normalize-path/download/normalize-path-3.0.0.tgz", + "integrity": "sha1-Dc1p/yOhybEf0JeDFmRKA4ghamU=" + }, + "npm-run-path": { + "version": "4.0.1", + "resolved": "https://registry.nlark.com/npm-run-path/download/npm-run-path-4.0.1.tgz", + "integrity": "sha1-t+zR5e1T2o43pV4cImnguX7XSOo=", + "requires": { + "path-key": "^3.0.0" + } + }, + "object-assign": { + "version": "4.1.1", + "resolved": "https://registry.nlark.com/object-assign/download/object-assign-4.1.1.tgz", + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" + }, + "object-copy": { + "version": "0.1.0", + "resolved": "https://registry.nlark.com/object-copy/download/object-copy-0.1.0.tgz", + "integrity": "sha1-fn2Fi3gb18mRpBupde04EnVOmYw=", + "dev": true, + "optional": true, + "requires": { + "copy-descriptor": "^0.1.0", + "define-property": "^0.2.5", + "kind-of": "^3.0.3" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.nlark.com/define-property/download/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "optional": true, + "requires": { + "is-descriptor": "^0.1.0" + } + }, + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.nlark.com/kind-of/download/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "optional": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "object-keys": { + "version": "1.1.1", + "resolved": "https://registry.nlark.com/object-keys/download/object-keys-1.1.1.tgz", + "integrity": "sha1-HEfyct8nfzsdrwYWd9nILiMixg4=", + "dev": true + }, + "object-visit": { + "version": "1.0.1", + "resolved": "https://registry.nlark.com/object-visit/download/object-visit-1.0.1.tgz", + "integrity": "sha1-95xEk68MU3e1n+OdOV5BBC3QRbs=", + "dev": true, + "optional": true, + "requires": { + "isobject": "^3.0.0" + } + }, + "object.assign": { + "version": "4.1.2", + "resolved": "https://registry.nlark.com/object.assign/download/object.assign-4.1.2.tgz", + "integrity": "sha1-DtVKNC7Os3s4/3brgxoOeIy2OUA=", + "dev": true, + "requires": { + "call-bind": "^1.0.0", + "define-properties": "^1.1.3", + "has-symbols": "^1.0.1", + "object-keys": "^1.1.1" + } + }, + "object.pick": { + "version": "1.3.0", + "resolved": "https://registry.nlark.com/object.pick/download/object.pick-1.3.0.tgz", + "integrity": "sha1-h6EKxMFpS9Lhy/U1kaZhQftd10c=", + "dev": true, + "optional": true, + "requires": { + "isobject": "^3.0.1" + } + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.nlark.com/once/download/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "requires": { + "wrappy": "1" + } + }, + "onetime": { + "version": "5.1.2", + "resolved": "https://registry.nlark.com/onetime/download/onetime-5.1.2.tgz", + "integrity": "sha1-0Oluu1awdHbfHdnEgG5SN5hcpF4=", + "requires": { + "mimic-fn": "^2.1.0" + } + }, + "optionator": { + "version": "0.9.1", + "resolved": "https://registry.nlark.com/optionator/download/optionator-0.9.1.tgz", + "integrity": "sha1-TyNqY3Pa4FZqbUPhMmZ09QwpFJk=", + "dev": true, + "requires": { + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0", + "word-wrap": "^1.2.3" + } + }, + "p-limit": { + "version": "3.1.0", + "resolved": "https://registry.nlark.com/p-limit/download/p-limit-3.1.0.tgz?cache=0&sync_timestamp=1628813055527&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fp-limit%2Fdownload%2Fp-limit-3.1.0.tgz", + "integrity": "sha1-4drMvnjQ0TiMoYxk/qOOPlfjcGs=", + "requires": { + "yocto-queue": "^0.1.0" + } + }, + "p-locate": { + "version": "4.1.0", + "resolved": "https://registry.nlark.com/p-locate/download/p-locate-4.1.0.tgz?cache=0&sync_timestamp=1629892708584&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fp-locate%2Fdownload%2Fp-locate-4.1.0.tgz", + "integrity": "sha1-o0KLtwiLOmApL2aRkni3wpetTwc=", + "requires": { + "p-limit": "^2.2.0" + }, + "dependencies": { + "p-limit": { + "version": "2.3.0", + "resolved": "https://registry.nlark.com/p-limit/download/p-limit-2.3.0.tgz?cache=0&sync_timestamp=1628813055527&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fp-limit%2Fdownload%2Fp-limit-2.3.0.tgz", + "integrity": "sha1-PdM8ZHohT9//2DWTPrCG2g3CHbE=", + "requires": { + "p-try": "^2.0.0" + } + } + } + }, + "p-map": { + "version": "2.1.0", + "resolved": "https://registry.nlark.com/p-map/download/p-map-2.1.0.tgz?cache=0&sync_timestamp=1627082442645&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fp-map%2Fdownload%2Fp-map-2.1.0.tgz", + "integrity": "sha1-MQko/u+cnsxltosXaTAYpmXOoXU=" + }, + "p-try": { + "version": "2.2.0", + "resolved": "https://registry.nlark.com/p-try/download/p-try-2.2.0.tgz", + "integrity": "sha1-yyhoVA4xPWHeWPr741zpAE1VQOY=" + }, + "parent-module": { + "version": "1.0.1", + "resolved": "https://registry.nlark.com/parent-module/download/parent-module-1.0.1.tgz", + "integrity": "sha1-aR0nCeeMefrjoVZiJFLQB2LKqqI=", + "dev": true, + "requires": { + "callsites": "^3.0.0" + } + }, + "pascalcase": { + "version": "0.1.1", + "resolved": "https://registry.nlark.com/pascalcase/download/pascalcase-0.1.1.tgz", + "integrity": "sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ=", + "dev": true, + "optional": true + }, + "path-exists": { + "version": "4.0.0", + "resolved": "https://registry.nlark.com/path-exists/download/path-exists-4.0.0.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fpath-exists%2Fdownload%2Fpath-exists-4.0.0.tgz", + "integrity": "sha1-UTvb4tO5XXdi6METfvoZXGxhtbM=" + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.nlark.com/path-is-absolute/download/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" + }, + "path-is-inside": { + "version": "1.0.2", + "resolved": "https://registry.nlark.com/path-is-inside/download/path-is-inside-1.0.2.tgz", + "integrity": "sha1-NlQX3t5EQw0cEa9hAn+s8HS9/FM=" + }, + "path-key": { + "version": "3.1.1", + "resolved": "https://registry.nlark.com/path-key/download/path-key-3.1.1.tgz", + "integrity": "sha1-WB9q3mWMu6ZaDTOA3ndTKVBU83U=" + }, + "path-parse": { + "version": "1.0.7", + "resolved": "https://registry.nlark.com/path-parse/download/path-parse-1.0.7.tgz", + "integrity": "sha1-+8EUtgykKzDZ2vWFjkvWi77bZzU=" + }, + "path-type": { + "version": "4.0.0", + "resolved": "https://registry.nlark.com/path-type/download/path-type-4.0.0.tgz", + "integrity": "sha1-hO0BwKe6OAr+CdkKjBgNzZ0DBDs=" + }, + "pathval": { + "version": "1.1.1", + "resolved": "https://registry.nlark.com/pathval/download/pathval-1.1.1.tgz", + "integrity": "sha1-hTTnenfOesWiUS6iHg/bj89sPY0=", + "dev": true + }, + "pegjs": { + "version": "0.10.0", + "resolved": "https://registry.npm.taobao.org/pegjs/download/pegjs-0.10.0.tgz", + "integrity": "sha1-z4uvrm7d/0tafvsYUmnqr0YQ3b0=" + }, + "picomatch": { + "version": "2.3.0", + "resolved": "https://registry.nlark.com/picomatch/download/picomatch-2.3.0.tgz", + "integrity": "sha1-8fBh3o9qS/AiiS4tEoI0+5gwKXI=" + }, + "pify": { + "version": "4.0.1", + "resolved": "https://registry.nlark.com/pify/download/pify-4.0.1.tgz", + "integrity": "sha1-SyzSXFDVmHNcUCkiJP2MbfQeMjE=" + }, + "pinkie": { + "version": "2.0.4", + "resolved": "https://registry.nlark.com/pinkie/download/pinkie-2.0.4.tgz", + "integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=" + }, + "pinkie-promise": { + "version": "2.0.1", + "resolved": "https://registry.nlark.com/pinkie-promise/download/pinkie-promise-2.0.1.tgz", + "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=", + "requires": { + "pinkie": "^2.0.0" + } + }, + "pkg-dir": { + "version": "4.2.0", + "resolved": "https://registry.nlark.com/pkg-dir/download/pkg-dir-4.2.0.tgz?cache=0&sync_timestamp=1624607963968&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fpkg-dir%2Fdownload%2Fpkg-dir-4.2.0.tgz", + "integrity": "sha1-8JkTPfft5CLoHR2ESCcO6z5CYfM=", + "requires": { + "find-up": "^4.0.0" + } + }, + "posix-character-classes": { + "version": "0.1.1", + "resolved": "https://registry.nlark.com/posix-character-classes/download/posix-character-classes-0.1.1.tgz", + "integrity": "sha1-AerA/jta9xoqbAL+q7jB/vfgDqs=", + "dev": true, + "optional": true + }, + "prelude-ls": { + "version": "1.2.1", + "resolved": "https://registry.nlark.com/prelude-ls/download/prelude-ls-1.2.1.tgz", + "integrity": "sha1-3rxkidem5rDnYRiIzsiAM30xY5Y=", + "dev": true + }, + "process-nextick-args": { + "version": "2.0.1", + "resolved": "https://registry.nlark.com/process-nextick-args/download/process-nextick-args-2.0.1.tgz", + "integrity": "sha1-eCDZsWEgzFXKmud5JoCufbptf+I=" + }, + "progress": { + "version": "2.0.3", + "resolved": "https://registry.nlark.com/progress/download/progress-2.0.3.tgz?cache=0&sync_timestamp=1624607996383&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fprogress%2Fdownload%2Fprogress-2.0.3.tgz", + "integrity": "sha1-foz42PW48jnBvGi+tOt4Vn1XLvg=", + "dev": true + }, + "prr": { + "version": "1.0.1", + "resolved": "https://registry.nlark.com/prr/download/prr-1.0.1.tgz", + "integrity": "sha1-0/wRS6BplaRexok/SEzrHXj19HY=" + }, + "punycode": { + "version": "2.1.1", + "resolved": "https://registry.nlark.com/punycode/download/punycode-2.1.1.tgz", + "integrity": "sha1-tYsBCsQMIsVldhbI0sLALHv0eew=" + }, + "queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.nlark.com/queue-microtask/download/queue-microtask-1.2.3.tgz", + "integrity": "sha1-SSkii7xyTfrEPg77BYyve2z7YkM=" + }, + "randombytes": { + "version": "2.1.0", + "resolved": "https://registry.nlark.com/randombytes/download/randombytes-2.1.0.tgz", + "integrity": "sha1-32+ENy8CcNxlzfYpE0mrekc9Tyo=", + "requires": { + "safe-buffer": "^5.1.0" + } + }, + "readable-stream": { + "version": "2.3.7", + "resolved": "https://registry.nlark.com/readable-stream/download/readable-stream-2.3.7.tgz", + "integrity": "sha1-Hsoc9xGu+BTAT2IlKjamL2yyO1c=", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + }, + "dependencies": { + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.nlark.com/safe-buffer/download/safe-buffer-5.1.2.tgz", + "integrity": "sha1-mR7GnSluAxN0fVm9/St0XDX4go0=" + } + } + }, + "readdirp": { + "version": "2.2.1", + "resolved": "https://registry.nlark.com/readdirp/download/readdirp-2.2.1.tgz", + "integrity": "sha1-DodiKjMlqjPokihcr4tOhGUppSU=", + "dev": true, + "optional": true, + "requires": { + "graceful-fs": "^4.1.11", + "micromatch": "^3.1.10", + "readable-stream": "^2.0.2" + }, + "dependencies": { + "braces": { + "version": "2.3.2", + "resolved": "https://registry.nlark.com/braces/download/braces-2.3.2.tgz", + "integrity": "sha1-WXn9PxTNUxVl5fot8av/8d+u5yk=", + "dev": true, + "optional": true, + "requires": { + "arr-flatten": "^1.1.0", + "array-unique": "^0.3.2", + "extend-shallow": "^2.0.1", + "fill-range": "^4.0.0", + "isobject": "^3.0.1", + "repeat-element": "^1.1.2", + "snapdragon": "^0.8.1", + "snapdragon-node": "^2.0.1", + "split-string": "^3.0.2", + "to-regex": "^3.0.1" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.nlark.com/extend-shallow/download/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "optional": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "fill-range": { + "version": "4.0.0", + "resolved": "https://registry.nlark.com/fill-range/download/fill-range-4.0.0.tgz", + "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=", + "dev": true, + "optional": true, + "requires": { + "extend-shallow": "^2.0.1", + "is-number": "^3.0.0", + "repeat-string": "^1.6.1", + "to-regex-range": "^2.1.0" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.nlark.com/extend-shallow/download/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "optional": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "is-number": { + "version": "3.0.0", + "resolved": "https://registry.nlark.com/is-number/download/is-number-3.0.0.tgz", + "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "dev": true, + "optional": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.nlark.com/kind-of/download/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "optional": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "micromatch": { + "version": "3.1.10", + "resolved": "https://registry.nlark.com/micromatch/download/micromatch-3.1.10.tgz", + "integrity": "sha1-cIWbyVyYQJUvNZoGij/En57PrCM=", + "dev": true, + "optional": true, + "requires": { + "arr-diff": "^4.0.0", + "array-unique": "^0.3.2", + "braces": "^2.3.1", + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "extglob": "^2.0.4", + "fragment-cache": "^0.2.1", + "kind-of": "^6.0.2", + "nanomatch": "^1.2.9", + "object.pick": "^1.3.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.2" + } + }, + "to-regex-range": { + "version": "2.1.1", + "resolved": "https://registry.nlark.com/to-regex-range/download/to-regex-range-2.1.1.tgz", + "integrity": "sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg=", + "dev": true, + "optional": true, + "requires": { + "is-number": "^3.0.0", + "repeat-string": "^1.6.1" + } + } + } + }, + "rechoir": { + "version": "0.7.1", + "resolved": "https://registry.nlark.com/rechoir/download/rechoir-0.7.1.tgz", + "integrity": "sha1-lHipahyhNbXoj8An8D7pLWxkVoY=", + "requires": { + "resolve": "^1.9.0" + } + }, + "regenerate": { + "version": "1.4.2", + "resolved": "https://registry.nlark.com/regenerate/download/regenerate-1.4.2.tgz", + "integrity": "sha1-uTRtiCfo9aMve6KWN9OYtpAUhIo=", + "dev": true + }, + "regenerate-unicode-properties": { + "version": "8.2.0", + "resolved": "https://registry.nlark.com/regenerate-unicode-properties/download/regenerate-unicode-properties-8.2.0.tgz", + "integrity": "sha1-5d5xEdZV57pgwFfb6f83yH5lzew=", + "dev": true, + "requires": { + "regenerate": "^1.4.0" + } + }, + "regenerator-runtime": { + "version": "0.13.9", + "resolved": "https://registry.nlark.com/regenerator-runtime/download/regenerator-runtime-0.13.9.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fregenerator-runtime%2Fdownload%2Fregenerator-runtime-0.13.9.tgz", + "integrity": "sha1-iSV0Kpj/2QgUmI11Zq0wyjsmO1I=", + "dev": true + }, + "regenerator-transform": { + "version": "0.14.5", + "resolved": "https://registry.nlark.com/regenerator-transform/download/regenerator-transform-0.14.5.tgz?cache=0&sync_timestamp=1627057533376&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fregenerator-transform%2Fdownload%2Fregenerator-transform-0.14.5.tgz", + "integrity": "sha1-yY2hVGg2ccnE3LFuznNlF+G3/rQ=", + "dev": true, + "requires": { + "@babel/runtime": "^7.8.4" + } + }, + "regex-not": { + "version": "1.0.2", + "resolved": "https://registry.nlark.com/regex-not/download/regex-not-1.0.2.tgz", + "integrity": "sha1-H07OJ+ALC2XgJHpoEOaoXYOldSw=", + "dev": true, + "optional": true, + "requires": { + "extend-shallow": "^3.0.2", + "safe-regex": "^1.1.0" + } + }, + "regexpp": { + "version": "3.2.0", + "resolved": "https://registry.nlark.com/regexpp/download/regexpp-3.2.0.tgz", + "integrity": "sha1-BCWido2PI7rXDKS5BGH6LxIT4bI=", + "dev": true + }, + "regexpu-core": { + "version": "4.7.1", + "resolved": "https://registry.nlark.com/regexpu-core/download/regexpu-core-4.7.1.tgz", + "integrity": "sha1-LepamgcjMpj78NuR+pq8TG4PitY=", + "dev": true, + "requires": { + "regenerate": "^1.4.0", + "regenerate-unicode-properties": "^8.2.0", + "regjsgen": "^0.5.1", + "regjsparser": "^0.6.4", + "unicode-match-property-ecmascript": "^1.0.4", + "unicode-match-property-value-ecmascript": "^1.2.0" + } + }, + "regjsgen": { + "version": "0.5.2", + "resolved": "https://registry.nlark.com/regjsgen/download/regjsgen-0.5.2.tgz", + "integrity": "sha1-kv8pX7He7L9uzaslQ9IH6RqjNzM=", + "dev": true + }, + "regjsparser": { + "version": "0.6.9", + "resolved": "https://registry.nlark.com/regjsparser/download/regjsparser-0.6.9.tgz", + "integrity": "sha1-tInu98mizkNydicBFCnPgzpxg+Y=", + "dev": true, + "requires": { + "jsesc": "~0.5.0" + }, + "dependencies": { + "jsesc": { + "version": "0.5.0", + "resolved": "https://registry.nlark.com/jsesc/download/jsesc-0.5.0.tgz", + "integrity": "sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0=", + "dev": true + } + } + }, + "remove-trailing-separator": { + "version": "1.1.0", + "resolved": "https://registry.nlark.com/remove-trailing-separator/download/remove-trailing-separator-1.1.0.tgz", + "integrity": "sha1-wkvOKig62tW8P1jg1IJJuSN52O8=", + "dev": true, + "optional": true + }, + "repeat-element": { + "version": "1.1.4", + "resolved": "https://registry.nlark.com/repeat-element/download/repeat-element-1.1.4.tgz", + "integrity": "sha1-vmgVIIR6tYx1aKx1+/rSjtQtOek=", + "dev": true, + "optional": true + }, + "repeat-string": { + "version": "1.6.1", + "resolved": "https://registry.nlark.com/repeat-string/download/repeat-string-1.6.1.tgz", + "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=", + "dev": true, + "optional": true + }, + "require-directory": { + "version": "2.1.1", + "resolved": "https://registry.nlark.com/require-directory/download/require-directory-2.1.1.tgz", + "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", + "dev": true + }, + "require-from-string": { + "version": "2.0.2", + "resolved": "https://registry.nlark.com/require-from-string/download/require-from-string-2.0.2.tgz", + "integrity": "sha1-iaf92TgmEmcxjq/hT5wy5ZjDaQk=", + "dev": true + }, + "resolve": { + "version": "1.20.0", + "resolved": "https://registry.nlark.com/resolve/download/resolve-1.20.0.tgz", + "integrity": "sha1-YpoBP7P3B1XW8LeTXMHCxTeLGXU=", + "requires": { + "is-core-module": "^2.2.0", + "path-parse": "^1.0.6" + } + }, + "resolve-cwd": { + "version": "3.0.0", + "resolved": "https://registry.nlark.com/resolve-cwd/download/resolve-cwd-3.0.0.tgz", + "integrity": "sha1-DwB18bslRHZs9zumpuKt/ryxPy0=", + "requires": { + "resolve-from": "^5.0.0" + } + }, + "resolve-from": { + "version": "5.0.0", + "resolved": "https://registry.nlark.com/resolve-from/download/resolve-from-5.0.0.tgz?cache=0&sync_timestamp=1624607952279&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fresolve-from%2Fdownload%2Fresolve-from-5.0.0.tgz", + "integrity": "sha1-w1IlhD3493bfIcV1V7wIfp39/Gk=" + }, + "resolve-url": { + "version": "0.2.1", + "resolved": "https://registry.nlark.com/resolve-url/download/resolve-url-0.2.1.tgz", + "integrity": "sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo=", + "dev": true, + "optional": true + }, + "ret": { + "version": "0.1.15", + "resolved": "https://registry.nlark.com/ret/download/ret-0.1.15.tgz", + "integrity": "sha1-uKSCXVvbH8P29Twrwz+BOIaBx7w=", + "dev": true, + "optional": true + }, + "reusify": { + "version": "1.0.4", + "resolved": "https://registry.nlark.com/reusify/download/reusify-1.0.4.tgz", + "integrity": "sha1-kNo4Kx4SbvwCFG6QhFqI2xKSXXY=" + }, + "rfdc": { + "version": "1.3.0", + "resolved": "https://registry.nlark.com/rfdc/download/rfdc-1.3.0.tgz", + "integrity": "sha1-0LfEQasnINBdxM8m4ByJYx2doIs=" + }, + "rimraf": { + "version": "2.7.1", + "resolved": "https://registry.nlark.com/rimraf/download/rimraf-2.7.1.tgz", + "integrity": "sha1-NXl/E6f9rcVmFCwp1PB8ytSD4+w=", + "requires": { + "glob": "^7.1.3" + } + }, + "run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.nlark.com/run-parallel/download/run-parallel-1.2.0.tgz", + "integrity": "sha1-ZtE2jae9+SHrnZW9GpIp5/IaQ+4=", + "requires": { + "queue-microtask": "^1.2.2" + } + }, + "safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.nlark.com/safe-buffer/download/safe-buffer-5.2.1.tgz", + "integrity": "sha1-Hq+fqb2x/dTsdfWPnNtOa3gn7sY=" + }, + "safe-regex": { + "version": "1.1.0", + "resolved": "https://registry.nlark.com/safe-regex/download/safe-regex-1.1.0.tgz", + "integrity": "sha1-QKNmnzsHfR6UPURinhV91IAjvy4=", + "dev": true, + "optional": true, + "requires": { + "ret": "~0.1.10" + } + }, + "schema-utils": { + "version": "3.1.1", + "resolved": "https://registry.nlark.com/schema-utils/download/schema-utils-3.1.1.tgz?cache=0&sync_timestamp=1626694902084&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fschema-utils%2Fdownload%2Fschema-utils-3.1.1.tgz", + "integrity": "sha1-vHTEtraZXB2I92qLd76nIZ4MgoE=", + "requires": { + "@types/json-schema": "^7.0.8", + "ajv": "^6.12.5", + "ajv-keywords": "^3.5.2" + } + }, + "semver": { + "version": "7.3.5", + "resolved": "https://registry.nlark.com/semver/download/semver-7.3.5.tgz?cache=0&sync_timestamp=1624607961409&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fsemver%2Fdownload%2Fsemver-7.3.5.tgz", + "integrity": "sha1-C2Ich5NI2JmOSw5L6Us/EuYBjvc=", + "requires": { + "lru-cache": "^6.0.0" + } + }, + "serialize-javascript": { + "version": "5.0.1", + "resolved": "https://registry.nlark.com/serialize-javascript/download/serialize-javascript-5.0.1.tgz?cache=0&sync_timestamp=1624608021459&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fserialize-javascript%2Fdownload%2Fserialize-javascript-5.0.1.tgz", + "integrity": "sha1-eIbshIBJpGJGepfT2Rjrsqr5NPQ=", + "requires": { + "randombytes": "^2.1.0" + } + }, + "set-value": { + "version": "2.0.1", + "resolved": "https://registry.nlark.com/set-value/download/set-value-2.0.1.tgz", + "integrity": "sha1-oY1AUw5vB95CKMfe/kInr4ytAFs=", + "dev": true, + "optional": true, + "requires": { + "extend-shallow": "^2.0.1", + "is-extendable": "^0.1.1", + "is-plain-object": "^2.0.3", + "split-string": "^3.0.1" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.nlark.com/extend-shallow/download/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "optional": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "shallow-clone": { + "version": "3.0.1", + "resolved": "https://registry.nlark.com/shallow-clone/download/shallow-clone-3.0.1.tgz", + "integrity": "sha1-jymBrZJTH1UDWwH7IwdppA4C76M=", + "requires": { + "kind-of": "^6.0.2" + } + }, + "shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.nlark.com/shebang-command/download/shebang-command-2.0.0.tgz", + "integrity": "sha1-zNCvT4g1+9wmW4JGGq8MNmY/NOo=", + "requires": { + "shebang-regex": "^3.0.0" + } + }, + "shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.nlark.com/shebang-regex/download/shebang-regex-3.0.0.tgz?cache=0&sync_timestamp=1628896660639&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fshebang-regex%2Fdownload%2Fshebang-regex-3.0.0.tgz", + "integrity": "sha1-rhbxZE2HPsrYQ7AwexQzYtTEIXI=" + }, + "signal-exit": { + "version": "3.0.3", + "resolved": "https://registry.nlark.com/signal-exit/download/signal-exit-3.0.3.tgz", + "integrity": "sha1-oUEMLt2PB3sItOJTyOrPyvBXRhw=" + }, + "slash": { + "version": "3.0.0", + "resolved": "https://registry.nlark.com/slash/download/slash-3.0.0.tgz", + "integrity": "sha1-ZTm+hwwWWtvVJAIg2+Nh8bxNRjQ=" + }, + "slice-ansi": { + "version": "4.0.0", + "resolved": "https://registry.nlark.com/slice-ansi/download/slice-ansi-4.0.0.tgz", + "integrity": "sha1-UA6N0P1VsFgVCGJVsxla3ypF/ms=", + "dev": true, + "requires": { + "ansi-styles": "^4.0.0", + "astral-regex": "^2.0.0", + "is-fullwidth-code-point": "^3.0.0" + } + }, + "snapdragon": { + "version": "0.8.2", + "resolved": "https://registry.nlark.com/snapdragon/download/snapdragon-0.8.2.tgz", + "integrity": "sha1-ZJIufFZbDhQgS6GqfWlkJ40lGC0=", + "dev": true, + "optional": true, + "requires": { + "base": "^0.11.1", + "debug": "^2.2.0", + "define-property": "^0.2.5", + "extend-shallow": "^2.0.1", + "map-cache": "^0.2.2", + "source-map": "^0.5.6", + "source-map-resolve": "^0.5.0", + "use": "^3.1.0" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.nlark.com/debug/download/debug-2.6.9.tgz?cache=0&sync_timestamp=1625374653719&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fdebug%2Fdownload%2Fdebug-2.6.9.tgz", + "integrity": "sha1-XRKFFd8TT/Mn6QpMk/Tgd6U2NB8=", + "dev": true, + "optional": true, + "requires": { + "ms": "2.0.0" + } + }, + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.nlark.com/define-property/download/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "optional": true, + "requires": { + "is-descriptor": "^0.1.0" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.nlark.com/extend-shallow/download/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "optional": true, + "requires": { + "is-extendable": "^0.1.0" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.nlark.com/ms/download/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true, + "optional": true + }, + "source-map": { + "version": "0.5.7", + "resolved": "https://registry.nlark.com/source-map/download/source-map-0.5.7.tgz?cache=0&sync_timestamp=1624608014898&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fsource-map%2Fdownload%2Fsource-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", + "dev": true, + "optional": true + } + } + }, + "snapdragon-node": { + "version": "2.1.1", + "resolved": "https://registry.nlark.com/snapdragon-node/download/snapdragon-node-2.1.1.tgz", + "integrity": "sha1-bBdfhv8UvbByRWPo88GwIaKGhTs=", + "dev": true, + "optional": true, + "requires": { + "define-property": "^1.0.0", + "isobject": "^3.0.0", + "snapdragon-util": "^3.0.1" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "resolved": "https://registry.nlark.com/define-property/download/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "dev": true, + "optional": true, + "requires": { + "is-descriptor": "^1.0.0" + } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.nlark.com/is-accessor-descriptor/download/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha1-FpwvbT3x+ZJhgHI2XJsOofaHhlY=", + "dev": true, + "optional": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.nlark.com/is-data-descriptor/download/is-data-descriptor-1.0.0.tgz", + "integrity": "sha1-2Eh2Mh0Oet0DmQQGq7u9NrqSaMc=", + "dev": true, + "optional": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.nlark.com/is-descriptor/download/is-descriptor-1.0.2.tgz", + "integrity": "sha1-OxWXRqZmBLBPjIFSS6NlxfFNhuw=", + "dev": true, + "optional": true, + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + } + } + }, + "snapdragon-util": { + "version": "3.0.1", + "resolved": "https://registry.nlark.com/snapdragon-util/download/snapdragon-util-3.0.1.tgz", + "integrity": "sha1-+VZHlIbyrNeXAGk/b3uAXkWrVuI=", + "dev": true, + "optional": true, + "requires": { + "kind-of": "^3.2.0" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.nlark.com/kind-of/download/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "optional": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.nlark.com/source-map/download/source-map-0.6.1.tgz?cache=0&sync_timestamp=1624608014898&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fsource-map%2Fdownload%2Fsource-map-0.6.1.tgz", + "integrity": "sha1-dHIq8y6WFOnCh6jQu95IteLxomM=" + }, + "source-map-resolve": { + "version": "0.5.3", + "resolved": "https://registry.nlark.com/source-map-resolve/download/source-map-resolve-0.5.3.tgz", + "integrity": "sha1-GQhmvs51U+H48mei7oLGBrVQmho=", + "dev": true, + "optional": true, + "requires": { + "atob": "^2.1.2", + "decode-uri-component": "^0.2.0", + "resolve-url": "^0.2.1", + "source-map-url": "^0.4.0", + "urix": "^0.1.0" + } + }, + "source-map-support": { + "version": "0.5.19", + "resolved": "https://registry.nlark.com/source-map-support/download/source-map-support-0.5.19.tgz?cache=0&sync_timestamp=1624608061410&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fsource-map-support%2Fdownload%2Fsource-map-support-0.5.19.tgz", + "integrity": "sha1-qYti+G3K9PZzmWSMCFKRq56P7WE=", + "requires": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + } + }, + "source-map-url": { + "version": "0.4.1", + "resolved": "https://registry.nlark.com/source-map-url/download/source-map-url-0.4.1.tgz", + "integrity": "sha1-CvZmBadFpaL5HPG7+KevvCg97FY=", + "dev": true, + "optional": true + }, + "split-string": { + "version": "3.1.0", + "resolved": "https://registry.nlark.com/split-string/download/split-string-3.1.0.tgz", + "integrity": "sha1-fLCd2jqGWFcFxks5pkZgOGguj+I=", + "dev": true, + "optional": true, + "requires": { + "extend-shallow": "^3.0.0" + } + }, + "sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.nlark.com/sprintf-js/download/sprintf-js-1.0.3.tgz", + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", + "dev": true + }, + "static-extend": { + "version": "0.1.2", + "resolved": "https://registry.nlark.com/static-extend/download/static-extend-0.1.2.tgz", + "integrity": "sha1-YICcOcv/VTNyJv1eC1IPNB8ftcY=", + "dev": true, + "optional": true, + "requires": { + "define-property": "^0.2.5", + "object-copy": "^0.1.0" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.nlark.com/define-property/download/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "optional": true, + "requires": { + "is-descriptor": "^0.1.0" + } + } + } + }, + "streamroller": { + "version": "2.2.4", + "resolved": "https://registry.nlark.com/streamroller/download/streamroller-2.2.4.tgz", + "integrity": "sha1-wZjO1C25QIamGTYIGHzoCl8rDlM=", + "requires": { + "date-format": "^2.1.0", + "debug": "^4.1.1", + "fs-extra": "^8.1.0" + }, + "dependencies": { + "date-format": { + "version": "2.1.0", + "resolved": "https://registry.nlark.com/date-format/download/date-format-2.1.0.tgz", + "integrity": "sha1-MdW16iEc9f12TNOLr50DPffhJc8=" + } + } + }, + "string-width": { + "version": "4.2.2", + "resolved": "https://registry.nlark.com/string-width/download/string-width-4.2.2.tgz", + "integrity": "sha1-2v1PlVmnWFz7pSnGoKT3NIjr1MU=", + "dev": true, + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.0" + } + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.nlark.com/string_decoder/download/string_decoder-1.1.1.tgz", + "integrity": "sha1-nPFhG6YmhdcDCunkujQUnDrwP8g=", + "requires": { + "safe-buffer": "~5.1.0" + }, + "dependencies": { + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.nlark.com/safe-buffer/download/safe-buffer-5.1.2.tgz", + "integrity": "sha1-mR7GnSluAxN0fVm9/St0XDX4go0=" + } + } + }, + "strip-ansi": { + "version": "6.0.0", + "resolved": "https://registry.nlark.com/strip-ansi/download/strip-ansi-6.0.0.tgz", + "integrity": "sha1-CxVx3XZpzNTz4G4U7x7tJiJa5TI=", + "dev": true, + "requires": { + "ansi-regex": "^5.0.0" + } + }, + "strip-final-newline": { + "version": "2.0.0", + "resolved": "https://registry.nlark.com/strip-final-newline/download/strip-final-newline-2.0.0.tgz", + "integrity": "sha1-ibhS+y/L6Tb29LMYevsKEsGrWK0=" + }, + "strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.nlark.com/strip-json-comments/download/strip-json-comments-3.1.1.tgz", + "integrity": "sha1-MfEoGzgyYwQ0gxwxDAHMzajL4AY=", + "dev": true + }, + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.nlark.com/supports-color/download/supports-color-7.2.0.tgz?cache=0&sync_timestamp=1626703455199&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fsupports-color%2Fdownload%2Fsupports-color-7.2.0.tgz", + "integrity": "sha1-G33NyzK4E4gBs+R4umpRyqiWSNo=", + "requires": { + "has-flag": "^4.0.0" + } + }, + "table": { + "version": "6.7.1", + "resolved": "https://registry.nlark.com/table/download/table-6.7.1.tgz", + "integrity": "sha1-7gVZK3FDgxqMlPPO5qrkwczvM+I=", + "dev": true, + "requires": { + "ajv": "^8.0.1", + "lodash.clonedeep": "^4.5.0", + "lodash.truncate": "^4.4.2", + "slice-ansi": "^4.0.0", + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0" + }, + "dependencies": { + "ajv": { + "version": "8.6.2", + "resolved": "https://registry.nlark.com/ajv/download/ajv-8.6.2.tgz", + "integrity": "sha1-L7ReDl/LwIEzJsHD2lNdGIG7BXE=", + "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.nlark.com/json-schema-traverse/download/json-schema-traverse-1.0.0.tgz", + "integrity": "sha1-rnvLNlard6c7pcSb9lTzjmtoYOI=", + "dev": true + } + } + }, + "tapable": { + "version": "1.1.3", + "resolved": "https://registry.nlark.com/tapable/download/tapable-1.1.3.tgz", + "integrity": "sha1-ofzMBrWNth/XpF2i2kT186Pme6I=" + }, + "terser": { + "version": "5.7.2", + "resolved": "https://registry.nlark.com/terser/download/terser-5.7.2.tgz", + "integrity": "sha1-1Nle1Pi/c1y5M+gC8qGCmr9UXj8=", + "requires": { + "commander": "^2.20.0", + "source-map": "~0.7.2", + "source-map-support": "~0.5.19" + }, + "dependencies": { + "source-map": { + "version": "0.7.3", + "resolved": "https://registry.nlark.com/source-map/download/source-map-0.7.3.tgz?cache=0&sync_timestamp=1624608014898&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fsource-map%2Fdownload%2Fsource-map-0.7.3.tgz", + "integrity": "sha1-UwL4FpAxc1ImVECS5kmB91F1A4M=" + } + } + }, + "terser-webpack-plugin": { + "version": "5.2.2", + "resolved": "https://registry.nlark.com/terser-webpack-plugin/download/terser-webpack-plugin-5.2.2.tgz?cache=0&sync_timestamp=1630630911890&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fterser-webpack-plugin%2Fdownload%2Fterser-webpack-plugin-5.2.2.tgz", + "integrity": "sha1-1/0IEJ1HuNTsfb/u5rGP4akULYw=", + "requires": { + "jest-worker": "^27.0.6", + "p-limit": "^3.1.0", + "schema-utils": "^3.1.1", + "serialize-javascript": "^6.0.0", + "source-map": "^0.6.1", + "terser": "^5.7.2" + }, + "dependencies": { + "serialize-javascript": { + "version": "6.0.0", + "resolved": "https://registry.nlark.com/serialize-javascript/download/serialize-javascript-6.0.0.tgz?cache=0&sync_timestamp=1624608021459&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fserialize-javascript%2Fdownload%2Fserialize-javascript-6.0.0.tgz", + "integrity": "sha1-765diPRdeSQUHai1w6en5mP+/rg=", + "requires": { + "randombytes": "^2.1.0" + } + } + } + }, + "text-table": { + "version": "0.2.0", + "resolved": "https://registry.nlark.com/text-table/download/text-table-0.2.0.tgz", + "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=", + "dev": true + }, + "to-fast-properties": { + "version": "2.0.0", + "resolved": "https://registry.nlark.com/to-fast-properties/download/to-fast-properties-2.0.0.tgz?cache=0&sync_timestamp=1628418893613&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fto-fast-properties%2Fdownload%2Fto-fast-properties-2.0.0.tgz", + "integrity": "sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4=", + "dev": true + }, + "to-object-path": { + "version": "0.3.0", + "resolved": "https://registry.nlark.com/to-object-path/download/to-object-path-0.3.0.tgz", + "integrity": "sha1-KXWIt7Dn4KwI4E5nL4XB9JmeF68=", + "dev": true, + "optional": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.nlark.com/kind-of/download/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "optional": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "to-regex": { + "version": "3.0.2", + "resolved": "https://registry.nlark.com/to-regex/download/to-regex-3.0.2.tgz", + "integrity": "sha1-E8/dmzNlUvMLUfM6iuG0Knp1mc4=", + "dev": true, + "optional": true, + "requires": { + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "regex-not": "^1.0.2", + "safe-regex": "^1.1.0" + } + }, + "to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.nlark.com/to-regex-range/download/to-regex-range-5.0.1.tgz", + "integrity": "sha1-FkjESq58jZiKMmAY7XL1tN0DkuQ=", + "requires": { + "is-number": "^7.0.0" + } + }, + "ts-loader": { + "version": "8.3.0", + "resolved": "https://registry.nlark.com/ts-loader/download/ts-loader-8.3.0.tgz", + "integrity": "sha1-gzYEltb4AE+rNYJSeRMsk0Eu3zM=", + "requires": { + "chalk": "^4.1.0", + "enhanced-resolve": "^4.0.0", + "loader-utils": "^2.0.0", + "micromatch": "^4.0.0", + "semver": "^7.3.4" + } + }, + "ts-node": { + "version": "9.1.1", + "resolved": "https://registry.nlark.com/ts-node/download/ts-node-9.1.1.tgz?cache=0&sync_timestamp=1629311301535&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fts-node%2Fdownload%2Fts-node-9.1.1.tgz", + "integrity": "sha1-UamkUKPpWUAb2l8ASnLVS5NtN20=", + "dev": true, + "requires": { + "arg": "^4.1.0", + "create-require": "^1.1.0", + "diff": "^4.0.1", + "make-error": "^1.1.1", + "source-map-support": "^0.5.17", + "yn": "3.1.1" + }, + "dependencies": { + "diff": { + "version": "4.0.2", + "resolved": "https://registry.nlark.com/diff/download/diff-4.0.2.tgz?cache=0&sync_timestamp=1624608104914&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fdiff%2Fdownload%2Fdiff-4.0.2.tgz", + "integrity": "sha1-YPOuy4nV+uUgwRqhnvwruYKq3n0=", + "dev": true + } + } + }, + "tslib": { + "version": "1.14.1", + "resolved": "https://registry.nlark.com/tslib/download/tslib-1.14.1.tgz", + "integrity": "sha1-zy04vcNKE0vK8QkcQfZhni9nLQA=", + "dev": true + }, + "tsutils": { + "version": "3.21.0", + "resolved": "https://registry.nlark.com/tsutils/download/tsutils-3.21.0.tgz", + "integrity": "sha1-tIcX05TOpsHglpg+7Vjp1hcVtiM=", + "dev": true, + "requires": { + "tslib": "^1.8.1" + } + }, + "type-check": { + "version": "0.4.0", + "resolved": "https://registry.nlark.com/type-check/download/type-check-0.4.0.tgz", + "integrity": "sha1-B7ggO/pwVsBlcFDjzNLDdzC6uPE=", + "dev": true, + "requires": { + "prelude-ls": "^1.2.1" + } + }, + "type-detect": { + "version": "4.0.8", + "resolved": "https://registry.nlark.com/type-detect/download/type-detect-4.0.8.tgz?cache=0&sync_timestamp=1624607980886&other_urls=https%3A%2F%2Fregistry.nlark.com%2Ftype-detect%2Fdownload%2Ftype-detect-4.0.8.tgz", + "integrity": "sha1-dkb7XxiHHPu3dJ5pvTmmOI63RQw=", + "dev": true + }, + "type-fest": { + "version": "0.20.2", + "resolved": "https://registry.nlark.com/type-fest/download/type-fest-0.20.2.tgz", + "integrity": "sha1-G/IH9LKPkVg2ZstfvTJ4hzAc1fQ=", + "dev": true + }, + "typescript": { + "version": "4.4.2", + "resolved": "https://registry.nlark.com/typescript/download/typescript-4.4.2.tgz?cache=0&sync_timestamp=1630566990929&other_urls=https%3A%2F%2Fregistry.nlark.com%2Ftypescript%2Fdownload%2Ftypescript-4.4.2.tgz", + "integrity": "sha1-bWGGQNQw41aaHftE99fmAM7T7oY=" + }, + "uglify-es": { + "version": "3.3.10", + "resolved": "https://registry.nlark.com/uglify-es/download/uglify-es-3.3.10.tgz", + "integrity": "sha1-iwt5ks6+IO3CbeG/MlzveXuPP6U=", + "dev": true, + "requires": { + "commander": "~2.14.1", + "source-map": "~0.6.1" + }, + "dependencies": { + "commander": { + "version": "2.14.1", + "resolved": "https://registry.nlark.com/commander/download/commander-2.14.1.tgz", + "integrity": "sha1-IjUSPjevjKPGXfRbAm29NXsBuao=", + "dev": true + } + } + }, + "unicode-canonical-property-names-ecmascript": { + "version": "1.0.4", + "resolved": "https://registry.nlark.com/unicode-canonical-property-names-ecmascript/download/unicode-canonical-property-names-ecmascript-1.0.4.tgz", + "integrity": "sha1-JhmADEyCWADv3YNDr33Zkzy+KBg=", + "dev": true + }, + "unicode-match-property-ecmascript": { + "version": "1.0.4", + "resolved": "https://registry.nlark.com/unicode-match-property-ecmascript/download/unicode-match-property-ecmascript-1.0.4.tgz", + "integrity": "sha1-jtKjJWmWG86SJ9Cc0/+7j+1fAgw=", + "dev": true, + "requires": { + "unicode-canonical-property-names-ecmascript": "^1.0.4", + "unicode-property-aliases-ecmascript": "^1.0.4" + } + }, + "unicode-match-property-value-ecmascript": { + "version": "1.2.0", + "resolved": "https://registry.nlark.com/unicode-match-property-value-ecmascript/download/unicode-match-property-value-ecmascript-1.2.0.tgz", + "integrity": "sha1-DZH2AO7rMJaqlisdb8iIduZOpTE=", + "dev": true + }, + "unicode-property-aliases-ecmascript": { + "version": "1.1.0", + "resolved": "https://registry.nlark.com/unicode-property-aliases-ecmascript/download/unicode-property-aliases-ecmascript-1.1.0.tgz", + "integrity": "sha1-3Vepn2IHvt/0Yoq++5TFDblByPQ=", + "dev": true + }, + "union-value": { + "version": "1.0.1", + "resolved": "https://registry.nlark.com/union-value/download/union-value-1.0.1.tgz", + "integrity": "sha1-C2/nuDWuzaYcbqTU8CwUIh4QmEc=", + "dev": true, + "optional": true, + "requires": { + "arr-union": "^3.1.0", + "get-value": "^2.0.6", + "is-extendable": "^0.1.1", + "set-value": "^2.0.1" + } + }, + "universalify": { + "version": "0.1.2", + "resolved": "https://registry.nlark.com/universalify/download/universalify-0.1.2.tgz", + "integrity": "sha1-tkb2m+OULavOzJ1mOcgNwQXvqmY=" + }, + "unset-value": { + "version": "1.0.0", + "resolved": "https://registry.nlark.com/unset-value/download/unset-value-1.0.0.tgz", + "integrity": "sha1-g3aHP30jNRef+x5vw6jtDfyKtVk=", + "dev": true, + "optional": true, + "requires": { + "has-value": "^0.3.1", + "isobject": "^3.0.0" + }, + "dependencies": { + "has-value": { + "version": "0.3.1", + "resolved": "https://registry.nlark.com/has-value/download/has-value-0.3.1.tgz", + "integrity": "sha1-ex9YutpiyoJ+wKIHgCVlSEWZXh8=", + "dev": true, + "optional": true, + "requires": { + "get-value": "^2.0.3", + "has-values": "^0.1.4", + "isobject": "^2.0.0" + }, + "dependencies": { + "isobject": { + "version": "2.1.0", + "resolved": "https://registry.nlark.com/isobject/download/isobject-2.1.0.tgz", + "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=", + "dev": true, + "optional": true, + "requires": { + "isarray": "1.0.0" + } + } + } + }, + "has-values": { + "version": "0.1.4", + "resolved": "https://registry.nlark.com/has-values/download/has-values-0.1.4.tgz", + "integrity": "sha1-bWHeldkd/Km5oCCJrThL/49it3E=", + "dev": true, + "optional": true + } + } + }, + "upath": { + "version": "1.2.0", + "resolved": "https://registry.nlark.com/upath/download/upath-1.2.0.tgz", + "integrity": "sha1-j2bbzVWog6za5ECK+LA1pQRMGJQ=", + "dev": true, + "optional": true + }, + "uri-js": { + "version": "4.4.1", + "resolved": "https://registry.nlark.com/uri-js/download/uri-js-4.4.1.tgz", + "integrity": "sha1-mxpSWVIlhZ5V9mnZKPiMbFfyp34=", + "requires": { + "punycode": "^2.1.0" + } + }, + "urix": { + "version": "0.1.0", + "resolved": "https://registry.nlark.com/urix/download/urix-0.1.0.tgz", + "integrity": "sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI=", + "dev": true, + "optional": true + }, + "use": { + "version": "3.1.1", + "resolved": "https://registry.nlark.com/use/download/use-3.1.1.tgz", + "integrity": "sha1-1QyMrHmhn7wg8pEfVuuXP04QBw8=", + "dev": true, + "optional": true + }, + "util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.nlark.com/util-deprecate/download/util-deprecate-1.0.2.tgz?cache=0&sync_timestamp=1624607944834&other_urls=https%3A%2F%2Fregistry.nlark.com%2Futil-deprecate%2Fdownload%2Futil-deprecate-1.0.2.tgz", + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" + }, + "v8-compile-cache": { + "version": "2.3.0", + "resolved": "https://registry.nlark.com/v8-compile-cache/download/v8-compile-cache-2.3.0.tgz", + "integrity": "sha1-LeGWGMZtwkfc+2+ZM4A12CRaLO4=" + }, + "watchpack": { + "version": "2.2.0", + "resolved": "https://registry.nlark.com/watchpack/download/watchpack-2.2.0.tgz", + "integrity": "sha1-R9ePVBX+VQ7NdA+Z/iiCMjpYsc4=", + "requires": { + "glob-to-regexp": "^0.4.1", + "graceful-fs": "^4.1.2" + } + }, + "webpack": { + "version": "5.51.2", + "resolved": "https://registry.nlark.com/webpack/download/webpack-5.51.2.tgz?cache=0&sync_timestamp=1630589182625&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fwebpack%2Fdownload%2Fwebpack-5.51.2.tgz", + "integrity": "sha1-92XSWLC/ar2jxfIb+FWiVyDpeW8=", + "requires": { + "@types/eslint-scope": "^3.7.0", + "@types/estree": "^0.0.50", + "@webassemblyjs/ast": "1.11.1", + "@webassemblyjs/wasm-edit": "1.11.1", + "@webassemblyjs/wasm-parser": "1.11.1", + "acorn": "^8.4.1", + "acorn-import-assertions": "^1.7.6", + "browserslist": "^4.14.5", + "chrome-trace-event": "^1.0.2", + "enhanced-resolve": "^5.8.0", + "es-module-lexer": "^0.7.1", + "eslint-scope": "5.1.1", + "events": "^3.2.0", + "glob-to-regexp": "^0.4.1", + "graceful-fs": "^4.2.4", + "json-parse-better-errors": "^1.0.2", + "loader-runner": "^4.2.0", + "mime-types": "^2.1.27", + "neo-async": "^2.6.2", + "schema-utils": "^3.1.0", + "tapable": "^2.1.1", + "terser-webpack-plugin": "^5.1.3", + "watchpack": "^2.2.0", + "webpack-sources": "^3.2.0" + }, + "dependencies": { + "enhanced-resolve": { + "version": "5.8.2", + "resolved": "https://registry.nlark.com/enhanced-resolve/download/enhanced-resolve-5.8.2.tgz", + "integrity": "sha1-Fd3HeTRcu3PpfGEc0AwBwee/TYs=", + "requires": { + "graceful-fs": "^4.2.4", + "tapable": "^2.2.0" + } + }, + "tapable": { + "version": "2.2.0", + "resolved": "https://registry.nlark.com/tapable/download/tapable-2.2.0.tgz", + "integrity": "sha1-XDc9KB2cZyhIIT0OA30cQWWrQms=" + } + } + }, + "webpack-cli": { + "version": "4.8.0", + "resolved": "https://registry.nlark.com/webpack-cli/download/webpack-cli-4.8.0.tgz", + "integrity": "sha1-X8PIuUAdPIpD4q/OrPqCYZYjONE=", + "requires": { + "@discoveryjs/json-ext": "^0.5.0", + "@webpack-cli/configtest": "^1.0.4", + "@webpack-cli/info": "^1.3.0", + "@webpack-cli/serve": "^1.5.2", + "colorette": "^1.2.1", + "commander": "^7.0.0", + "execa": "^5.0.0", + "fastest-levenshtein": "^1.0.12", + "import-local": "^3.0.2", + "interpret": "^2.2.0", + "rechoir": "^0.7.0", + "v8-compile-cache": "^2.2.0", + "webpack-merge": "^5.7.3" + }, + "dependencies": { + "commander": { + "version": "7.2.0", + "resolved": "https://registry.nlark.com/commander/download/commander-7.2.0.tgz", + "integrity": "sha1-o2y1fQtQHOEI5NIFWaFQo5HZerc=" + } + } + }, + "webpack-merge": { + "version": "5.8.0", + "resolved": "https://registry.nlark.com/webpack-merge/download/webpack-merge-5.8.0.tgz?cache=0&sync_timestamp=1624607912484&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fwebpack-merge%2Fdownload%2Fwebpack-merge-5.8.0.tgz", + "integrity": "sha1-Kznb8ir4d3atdEw5AiNzHTCmj2E=", + "requires": { + "clone-deep": "^4.0.1", + "wildcard": "^2.0.0" + } + }, + "webpack-sources": { + "version": "3.2.0", + "resolved": "https://registry.nlark.com/webpack-sources/download/webpack-sources-3.2.0.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fwebpack-sources%2Fdownload%2Fwebpack-sources-3.2.0.tgz", + "integrity": "sha1-sWlzvPhE682zr94y7aHATQuQ+J0=" + }, + "which": { + "version": "2.0.2", + "resolved": "https://registry.nlark.com/which/download/which-2.0.2.tgz", + "integrity": "sha1-fGqN0KY2oDJ+ELWckobu6T8/UbE=", + "requires": { + "isexe": "^2.0.0" + } + }, + "wide-align": { + "version": "1.1.3", + "resolved": "https://registry.nlark.com/wide-align/download/wide-align-1.1.3.tgz", + "integrity": "sha1-rgdOa9wMFKQx6ATmJFScYzsABFc=", + "dev": true, + "requires": { + "string-width": "^1.0.2 || 2" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.nlark.com/ansi-regex/download/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.nlark.com/is-fullwidth-code-point/download/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true + }, + "string-width": { + "version": "2.1.1", + "resolved": "https://registry.nlark.com/string-width/download/string-width-2.1.1.tgz", + "integrity": "sha1-q5Pyeo3BPSjKyBXEYhQ6bZASrp4=", + "dev": true, + "requires": { + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^4.0.0" + } + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.nlark.com/strip-ansi/download/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "^3.0.0" + } + } + } + }, + "wildcard": { + "version": "2.0.0", + "resolved": "https://registry.nlark.com/wildcard/download/wildcard-2.0.0.tgz", + "integrity": "sha1-p30g5SAMb6qsl55LOq3Hs91/j+w=" + }, + "word-wrap": { + "version": "1.2.3", + "resolved": "https://registry.nlark.com/word-wrap/download/word-wrap-1.2.3.tgz", + "integrity": "sha1-YQY29rH3A4kb00dxzLF/uTtHB5w=", + "dev": true + }, + "workerpool": { + "version": "6.1.0", + "resolved": "https://registry.nlark.com/workerpool/download/workerpool-6.1.0.tgz", + "integrity": "sha1-qOA4tMlFaVloUt56jqQiju/es3s=", + "dev": true + }, + "wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.nlark.com/wrap-ansi/download/wrap-ansi-7.0.0.tgz", + "integrity": "sha1-Z+FFz/UQpqaYS98RUpEdadLrnkM=", + "dev": true, + "requires": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + } + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.nlark.com/wrappy/download/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" + }, + "y18n": { + "version": "5.0.8", + "resolved": "https://registry.nlark.com/y18n/download/y18n-5.0.8.tgz", + "integrity": "sha1-f0k00PfKjFb5UxSTndzS3ZHOHVU=", + "dev": true + }, + "yallist": { + "version": "4.0.0", + "resolved": "https://registry.nlark.com/yallist/download/yallist-4.0.0.tgz?cache=0&sync_timestamp=1624607893982&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fyallist%2Fdownload%2Fyallist-4.0.0.tgz", + "integrity": "sha1-m7knkNnA7/7GO+c1GeEaNQGaOnI=" + }, + "yargs": { + "version": "16.2.0", + "resolved": "https://registry.nlark.com/yargs/download/yargs-16.2.0.tgz", + "integrity": "sha1-HIK/D2tqZur85+8w43b0mhJHf2Y=", + "dev": true, + "requires": { + "cliui": "^7.0.2", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.0", + "y18n": "^5.0.5", + "yargs-parser": "^20.2.2" + } + }, + "yargs-parser": { + "version": "20.2.4", + "resolved": "https://registry.nlark.com/yargs-parser/download/yargs-parser-20.2.4.tgz?cache=0&sync_timestamp=1624608003030&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fyargs-parser%2Fdownload%2Fyargs-parser-20.2.4.tgz", + "integrity": "sha1-tCiQ8UVmeW+Fro46JSkNIF8VSlQ=", + "dev": true + }, + "yargs-unparser": { + "version": "2.0.0", + "resolved": "https://registry.nlark.com/yargs-unparser/download/yargs-unparser-2.0.0.tgz", + "integrity": "sha1-8TH5ImkRrl2a04xDL+gJNmwjJes=", + "dev": true, + "requires": { + "camelcase": "^6.0.0", + "decamelize": "^4.0.0", + "flat": "^5.0.2", + "is-plain-obj": "^2.1.0" + } + }, + "yn": { + "version": "3.1.1", + "resolved": "https://registry.nlark.com/yn/download/yn-3.1.1.tgz", + "integrity": "sha1-HodAGgnXZ8HV6rJqbkwYUYLS61A=", + "dev": true + }, + "yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.nlark.com/yocto-queue/download/yocto-queue-0.1.0.tgz?cache=0&sync_timestamp=1628812679256&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fyocto-queue%2Fdownload%2Fyocto-queue-0.1.0.tgz", + "integrity": "sha1-ApTrPe4FAo0x7hpfosVWpqrxChs=" + } + } +} diff --git a/compiler/compiler/package.json b/compiler/compiler/package.json new file mode 100644 index 000000000..fe0cde331 --- /dev/null +++ b/compiler/compiler/package.json @@ -0,0 +1,46 @@ +{ + "name": "compilier", + "version": "0.0.1", + "description": "Transpile ace2.0 ui-syntax to support UI control render, Component and State management.", + "private": true, + "keywords": [ + "ace", + "loader", + "webpack" + ], + "scripts": { + "lint": "eslint --fix ./src --ext .ts", + "build": "npm run generateSyntaxParser && npm run generateDeclarations && ./node_modules/.bin/babel ./src --out-dir lib --extensions .ts", + "create": "node ./lib/create.js --env projectName", + "compile": "webpack --config webpack.config.js --env buildMode=debug projectName", + "test": "npm run build && mocha -r ts-node/register test/test.ts", + "generateDeclarations": "node ./build_declarations_file.js ../../../interface/sdk-js/api/@internal/component/ets ./declarations ./lib", + "generateSyntaxParser": "node build_parser.js ./syntax_parser/dist", + "postinstall": "node npm-install.js" + }, + "devDependencies": { + "@babel/cli": "^7.8.4", + "@babel/core": "^7.9.0", + "@babel/plugin-proposal-class-properties": "^7.8.3", + "@babel/preset-env": "^7.9.0", + "@babel/preset-typescript": "^7.12.7", + "@babel/runtime": "^7.0.0", + "@typescript-eslint/parser": "^4.11.0", + "chai": "^4.2.0", + "eslint": "^7.16.0", + "mocha": "^8.2.1", + "ts-node": "^9.1.1", + "uglify-es": "^3.3.10" + }, + "dependencies": { + "clean-webpack-plugin": "^3.0.0", + "copy-webpack-plugin": "^8.1.0", + "deccjsunit": "1.0.3", + "log4js": "^6.3.0", + "pegjs": "^0.10.0", + "ts-loader": "^8.0.12", + "typescript": "^4.1.3", + "webpack": "^5.48.0", + "webpack-cli": "^4.2.0" + } +} diff --git a/compiler/compiler/sample/app.ets b/compiler/compiler/sample/app.ets new file mode 100644 index 000000000..8e35f7b00 --- /dev/null +++ b/compiler/compiler/sample/app.ets @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + + +export default { + onCreate() { + console.info('Application onCreate') + }, + onDestroy() { + console.info('Application onDestroy') + }, +} diff --git a/compiler/compiler/sample/manifest.json b/compiler/compiler/sample/manifest.json new file mode 100644 index 000000000..97155b8f1 --- /dev/null +++ b/compiler/compiler/sample/manifest.json @@ -0,0 +1,35 @@ +{ + "appID": "com.huawei.ace.helloworld", + "appName": "HelloAce", + "versionName": "1.0.0", + "versionCode": 1, + "minPlatformVersion": "1.0.1", + "pages": [ + "pages/todo", + "pages/index", + "pages/home", + "pages/home_preview", + + "pages/testcases/componentGridTest", + "pages/testcases/componentListTest", + "pages/testcases/image", + "pages/testcases/onclicktest", + "pages/testcases/simpleText", + "pages/testcases/stacktestsuite", + + "pages/testcases/forEachComplexModel", + "pages/testcases/forEachSimpleModel", + "pages/testcases/linkArrayModel", + "pages/testcases/linkPropCombo", + "pages/testcases/linkSimpleModel", + "pages/testcases/propSimpleModel", + "pages/testcases/stateArrayReverse", + "pages/testcases/stateArrayReverseCustomView", + "pages/testcases/stateComplexType", + "pages/testcases/stateStateBindingProp" + ], + "window": { + "designWidth": 750, + "autoDesignWidth": false + } +} \ No newline at end of file diff --git a/compiler/compiler/sample/pages/home.ets b/compiler/compiler/sample/pages/home.ets new file mode 100644 index 000000000..65b5d3974 --- /dev/null +++ b/compiler/compiler/sample/pages/home.ets @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + + +@Entry +@Component +struct HomeComponent { + private value1: string = "hello world 1" + private value2: string = "hello world 2" + private value3: string = "hello world 3" + + build() { + Column() { + Row() { + Text(this.value1) + Text(this.value2) + Text(this.value3) + } + Row() { + Button() { + Text(this.value1) + .fontSize(20) + } + .width(100) + .height(20) + Text(this.value2) + .fontSize(100) + Text(this.value3) + } + .width(20) + } + .height(500) + } +} \ No newline at end of file diff --git a/compiler/compiler/sample/pages/home_preview.ets b/compiler/compiler/sample/pages/home_preview.ets new file mode 100644 index 000000000..53fe3642d --- /dev/null +++ b/compiler/compiler/sample/pages/home_preview.ets @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + + +@Entry +@Component +struct HomePreviewComponent { + private value1: string = "hello world 1" + private value2: string = "hello world 2" + private value3: string = "hello world 3" + + build() { + Column() { + Row() { + Text(this.value1) + Text(this.value2) + Text(this.value3) + } + Row() { + Button() { + Text(this.value1) + .fontSize(20) + } + .width(100) + .height(20) + Text(this.value2) + .fontSize(100) + Text(this.value3) + } + .width(20) + } + .height(500) + } +} + +@Preview +@Component +struct HomePreviewComponent_Preview { + build() { + Column() { + HomePreviewComponent() + } + } +} diff --git a/compiler/compiler/sample/pages/index.ets b/compiler/compiler/sample/pages/index.ets new file mode 100644 index 000000000..9708e4ba0 --- /dev/null +++ b/compiler/compiler/sample/pages/index.ets @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + + +@Component +struct Banner { + private value1: string = "hello world 4" + private value2: string = "hello world 5" + private value3: string = "hello world 6" + + build() { + Column() { + Text(this.value1) + Text(this.value2) + Text(this.value3) + } + } +} + +@Component +@Entry +struct MyComponent { + private value1: string = "hello world 1" + private value2: string = "hello world 2" + private value3: string = "hello world 3" + @State private idx:number = 0 + + build() { + Column() { + Text(this.value1) + Text(this.value2) + Text(this.value3) + Banner() + } + } +} diff --git a/compiler/compiler/sample/pages/testcases/component-01.ets b/compiler/compiler/sample/pages/testcases/component-01.ets new file mode 100644 index 000000000..27c1a6be7 --- /dev/null +++ b/compiler/compiler/sample/pages/testcases/component-01.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + +@Component +@Entry +struct MyComponent1 { + private value1: string = "hello world 1" + private value2: string = "hello world 2" + private value3: string = "hello world 3" + + constructor() { + console.info('into constructor'); + } + + build() { + new Column() { + new Text(this.value1) + Text(this.value2) + Text(this.value3) + } + } +} \ No newline at end of file diff --git a/compiler/compiler/sample/pages/testcases/componentGridTest.ets b/compiler/compiler/sample/pages/testcases/componentGridTest.ets new file mode 100644 index 000000000..54d1cd8e3 --- /dev/null +++ b/compiler/compiler/sample/pages/testcases/componentGridTest.ets @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + +@Entry +@Component +struct GridRootView { + changeColor:boolean = true; + dataArrayA:string[] = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]; + @State itemColor:number = 0xffff00; + + build(){ + Column(){ + Text('--------------- Grid : foreach test --------------->') + Grid(){ + ForEach( + this.dataArrayA, //Data array + (item) => { + GridItem(){ + Text(item) + }.width(100).height(50).backgroundColor(0x00ff00) + }, + item => item + ) + } + .height(100).width(650) + .columnsTemplate("1fr 1fr 1fr 1fr 1fr 1fr 1fr").columnsGap(50) //Grid + Text('--------------- Grid : item start-end test --------------->') + Grid(){ + GridItem(){ + Text('1').fontSize(11) + } + .height(100).width(150).backgroundColor(0x00ff00).borderWidth(2.0) + GridItem(){ + Text('2').fontSize(22) + } + .height(100).width(150).backgroundColor(0x00ffff).borderWidth(2.0).borderStyle(2) + GridItem(){ + Text('3').fontSize(33) + } + .height(100).width(150).backgroundColor(0x0000ff).borderWidth(2.0).borderColor(0xff46f7).borderStyle(1) + GridItem(){ + Text('click me').fontSize(24) + } + .height(100).width(150).backgroundColor(this.itemColor).borderWidth(2.0).borderColor(0xff46f7).borderStyle(3) + .onClick(() => { + if (this.changeColor == true) { + this.itemColor = 0x0000ff; + } else { + this.itemColor = 0xffff00; + } + this.changeColor = !this.changeColor; + }) + } + .width(350).height(250) + .columnsTemplate("1fr 1fr 1fr").rowsTemplate("1fr 1fr").columnsGap(50).rowsGap(50) + } + } +} diff --git a/compiler/compiler/sample/pages/testcases/componentListTest.ets b/compiler/compiler/sample/pages/testcases/componentListTest.ets new file mode 100644 index 000000000..1b60675ed --- /dev/null +++ b/compiler/compiler/sample/pages/testcases/componentListTest.ets @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + + +@Entry +@Component +struct ListRootView { + + dataArrayList:string[] = [ + "item0", "item1", "item2", "item3", "item4", "item5", "item6", "item7", "item8", "item9", + "item10", "item11", "item12", "item13", "item14", "item15", "item16", "item17", "item18", "item19", + "item20", "item21", "item22", "item23", "item24", "item25", "item26", "item27", "item28", "item29", + ]; + + @State listidx:number = 50; + + build(){ + Column(){ + Text('--------------- List :foreach test --------------->') + Text("index:" + this.listidx) + List(){ + ForEach( + this.dataArrayList, + (item) => { + ListItem(){ + Text(item) + } + .backgroundColor(0x6495ED).height(50) + .onClick(() => { + this.listidx ++; + }) + }, + (item) => item + ) + } + .height(600).width(500) + .divider({ strokeWidth: 2, color:"#FF00ff"}).scrollBar(BarState.Off) + .onReachStart(() => { + console.info("list-demo reachStart "); + }) + .onReachEnd(() => { + console.info("list-demo reachEnd "); + }) + .onScrollStop(() => { + console.info("list-demo scrollStop "); + }) + .onScroll((offset: number, state: ScrollState) => { + console.info('list-demo scroll:offset:' + offset + ",State:" + state) + }) + } + } +} \ No newline at end of file diff --git a/compiler/compiler/sample/pages/testcases/constructor-01.ets b/compiler/compiler/sample/pages/testcases/constructor-01.ets new file mode 100644 index 000000000..77aac86c2 --- /dev/null +++ b/compiler/compiler/sample/pages/testcases/constructor-01.ets @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + + +class DataModel{ + private myData1: number = 0 +} + +@Entry +@Component +struct MyStateComponent { + @State myState1: any = { count: 0 } + @State myState2: number = 0 + @State myState3: boolean = false + @State myState4: string = 'Home' + @State myState5: DataModel = new DataModel() + + private myVar : number = 0 + private myVar2 : number + + build() { + + } +} \ No newline at end of file diff --git a/compiler/compiler/sample/pages/testcases/constructor-02.ets b/compiler/compiler/sample/pages/testcases/constructor-02.ets new file mode 100644 index 000000000..72eb63327 --- /dev/null +++ b/compiler/compiler/sample/pages/testcases/constructor-02.ets @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + +@Entry +@Component +struct MyLinkComponent { + @Link myLink1?: any + @Link myLink2?: number + @Link myLink3?: boolean + @Link myLink4?: string + + private myVar: number = 0 + private myVar2: number + + build() { + + } +} \ No newline at end of file diff --git a/compiler/compiler/sample/pages/testcases/constructor-03.ets b/compiler/compiler/sample/pages/testcases/constructor-03.ets new file mode 100644 index 000000000..4a482cb70 --- /dev/null +++ b/compiler/compiler/sample/pages/testcases/constructor-03.ets @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + +@Entry +@Component +struct MyPropComponent { + @Prop myProp1?: any + @Prop myProp2?: number + @Prop myProp3?: boolean + @Prop myProp4?: string + + private myVar: number = 0 + private myVar2: number + + build() { + + } +} \ No newline at end of file diff --git a/compiler/compiler/sample/pages/testcases/expected/component-01-expected.js b/compiler/compiler/sample/pages/testcases/expected/component-01-expected.js new file mode 100644 index 000000000..ae202268d --- /dev/null +++ b/compiler/compiler/sample/pages/testcases/expected/component-01-expected.js @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + + +class MyComponent extends View { + constructor() { + super(); + this.value1 = value1; + this.value2 = value2; + this.value3 = value3; + console.info('into constructor'); + } + render() { return new Column(new Text(this.value1), new Text(this.value2), new Text(this.value3)); } +} +loadDocument(new MyComponent()); diff --git a/compiler/compiler/sample/pages/testcases/expected/constructor-01-expected.js b/compiler/compiler/sample/pages/testcases/expected/constructor-01-expected.js new file mode 100644 index 000000000..53ca41c94 --- /dev/null +++ b/compiler/compiler/sample/pages/testcases/expected/constructor-01-expected.js @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + + +class MyStateComponent extends View { + constructor(inputParams) { + super(); + this.myState1 = { count: 0 }; + this.myState2 = 0; + this.myState3 = false; + this.myState4 = 'Home'; + this.myVar = 0; + Object.assign(this, inputParams); + this.createState("myState1"); + this.createState("myState2"); + this.createState("myState3"); + this.createState("myState4"); + } + render() { + } +} +loadDocument(new MyStateComponent()); diff --git a/compiler/compiler/sample/pages/testcases/expected/constructor-02-expected.js b/compiler/compiler/sample/pages/testcases/expected/constructor-02-expected.js new file mode 100644 index 000000000..6c5de4e0c --- /dev/null +++ b/compiler/compiler/sample/pages/testcases/expected/constructor-02-expected.js @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + +class MyLinkComponent extends View { + constructor(inputParams) { + super(); + this.myVar = 0; + Object.assign(this, inputParams); + this.createLink("myState1"); + this.createLink("myState2"); + this.createLink("myState3"); + this.createLink("myState4"); + } + render() { + } +} +loadDocument(new MyLinkComponent()); diff --git a/compiler/compiler/sample/pages/testcases/expected/constructor-03-expected.js b/compiler/compiler/sample/pages/testcases/expected/constructor-03-expected.js new file mode 100644 index 000000000..67382c3d3 --- /dev/null +++ b/compiler/compiler/sample/pages/testcases/expected/constructor-03-expected.js @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + +class MyPropComponent extends View { + constructor(inputParams) { + super(); + this.myVar = 0; + Object.assign(this, inputParams); + this.createProp("myProp1"); + this.createProp("myProp2"); + this.createProp("myProp3"); + this.createProp("myProp4"); + } + render() { + } +} +loadDocument(new MyPropComponent()); diff --git a/compiler/compiler/sample/pages/testcases/expected/link-01-expected.js b/compiler/compiler/sample/pages/testcases/expected/link-01-expected.js new file mode 100644 index 000000000..d0ba0a588 --- /dev/null +++ b/compiler/compiler/sample/pages/testcases/expected/link-01-expected.js @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + + +class MyLinkTestComponent extends View { + constructor(inputParams) { + super(); + this.myVar = 0; + Object.assign(this, inputParams); + this.createLink("myLink1"); + this.createLink("myLink2"); + this.createLink("myLink3"); + this.createLink("myLink4"); + } + render() { + } +} +class LinkTest extends View { + constructor(inputParams) { + super(); + this.myState1 = { count: 0 }; + this.myState2 = 0; + this.myState3 = false; + this.myState4 = 'Home'; + Object.assign(this, inputParams); + this.createState("myState1"); + this.createState("myState2"); + this.createState("myState3"); + this.createState("myState4"); + } + render() { return new Row(new MyLinkTestComponent({ + myLink1: createLinkReference(this, "myState1"), + myLink2: createLinkReference(this, "myState2"), + myLink3: createLinkReference(this, "myState3"), + myLink4: createLinkReference(this, "myState4"), + myVar: 100, + myVar2: 100, + })); } +} +loadDocument(new LinkTest()); diff --git a/compiler/compiler/sample/pages/testcases/expected/new-01-expected.js b/compiler/compiler/sample/pages/testcases/expected/new-01-expected.js new file mode 100644 index 000000000..7e46d89c6 --- /dev/null +++ b/compiler/compiler/sample/pages/testcases/expected/new-01-expected.js @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + +class MyComponent extends View { + constructor(value1 = "hello world 1", value2 = "hello world 2", value3 = "hello world 3") { + super(); + this.value1 = value1; + this.value2 = value2; + this.value3 = value3; + } + render() { return new Column(new Text(this.value1), new Text(this.value2), new Text(this.value3)); } +} +loadDocument(new MyComponent()); diff --git a/compiler/compiler/sample/pages/testcases/expected/new-02-expected.js b/compiler/compiler/sample/pages/testcases/expected/new-02-expected.js new file mode 100644 index 000000000..7e46d89c6 --- /dev/null +++ b/compiler/compiler/sample/pages/testcases/expected/new-02-expected.js @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + +class MyComponent extends View { + constructor(value1 = "hello world 1", value2 = "hello world 2", value3 = "hello world 3") { + super(); + this.value1 = value1; + this.value2 = value2; + this.value3 = value3; + } + render() { return new Column(new Text(this.value1), new Text(this.value2), new Text(this.value3)); } +} +loadDocument(new MyComponent()); diff --git a/compiler/compiler/sample/pages/testcases/expected/new-03-expected.js b/compiler/compiler/sample/pages/testcases/expected/new-03-expected.js new file mode 100644 index 000000000..9bf4eae84 --- /dev/null +++ b/compiler/compiler/sample/pages/testcases/expected/new-03-expected.js @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + +class Banner extends View { + constructor(value1 = "hello world 2") { + super(); + this.value1 = value1; + } + render() { return new Column(new Text(this.value1)); } +} +class MyComponent extends View { + constructor(value1 = "hello world 1") { + super(); + this.value1 = value1; + } + render() { return new Column(new Text(this.value1), new Banner()); } +} +loadDocument(new MyComponent()); diff --git a/compiler/compiler/sample/pages/testcases/expected/new-04-expected.js b/compiler/compiler/sample/pages/testcases/expected/new-04-expected.js new file mode 100644 index 000000000..9bf4eae84 --- /dev/null +++ b/compiler/compiler/sample/pages/testcases/expected/new-04-expected.js @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + +class Banner extends View { + constructor(value1 = "hello world 2") { + super(); + this.value1 = value1; + } + render() { return new Column(new Text(this.value1)); } +} +class MyComponent extends View { + constructor(value1 = "hello world 1") { + super(); + this.value1 = value1; + } + render() { return new Column(new Text(this.value1), new Banner()); } +} +loadDocument(new MyComponent()); diff --git a/compiler/compiler/sample/pages/testcases/expected/struct-01-expected.js b/compiler/compiler/sample/pages/testcases/expected/struct-01-expected.js new file mode 100644 index 000000000..fa4b84a95 --- /dev/null +++ b/compiler/compiler/sample/pages/testcases/expected/struct-01-expected.js @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + + +class MyComponent extends View { + render() { + } + constructor() { super(); } +} +loadDocument(new MyComponent()); diff --git a/compiler/compiler/sample/pages/testcases/expected/struct-02-expected.js b/compiler/compiler/sample/pages/testcases/expected/struct-02-expected.js new file mode 100644 index 000000000..11297a9a4 --- /dev/null +++ b/compiler/compiler/sample/pages/testcases/expected/struct-02-expected.js @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + + +class MyComponent { + build() { + } +} diff --git a/compiler/compiler/sample/pages/testcases/forEachComplexModel.ets b/compiler/compiler/sample/pages/testcases/forEachComplexModel.ets new file mode 100644 index 000000000..5b0a58a80 --- /dev/null +++ b/compiler/compiler/sample/pages/testcases/forEachComplexModel.ets @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + +// class without @Component convert tool will not process. +class Month { + year: number = 2010; // why add assignment here, TS grammar required, if not it will omit by TSC. + month: number = 2; + days: number[] = [1, 2]; + + constructor(year:number, month:number, days:number[]){ + this.year = year; + this.month = month; + this.days = days; + } +} + +@Component +@Entry +struct CalendarDemo { + +// simulate with 6 months +@State calendar : Month[] = [ + new Month(2020, 1, [...Array(31).keys()]), + new Month(2020, 2, [...Array(28).keys()]), + new Month(2020, 3, [...Array(31).keys()]) +] + + build() { + Column() { + Button() { + Text('next month') + }.onClick(() => { + this.calendar.shift() + this.calendar.push(new Month(2020, 4, [...Array(30).keys()])) + }) + + ForEach(this.calendar, + (item: Month) => { + Row() { + ForEach(item.days, + (day : number) => { + Text(`${day}`) + }, + (day : number) => day.toString()) // inner ForEach + } + }, + (item: Month) => (item.year * 12 + item.month).toString()) // outer ForEach + } + } +} \ No newline at end of file diff --git a/compiler/compiler/sample/pages/testcases/forEachSimpleModel.ets b/compiler/compiler/sample/pages/testcases/forEachSimpleModel.ets new file mode 100644 index 000000000..ad1a0a2de --- /dev/null +++ b/compiler/compiler/sample/pages/testcases/forEachSimpleModel.ets @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + +@Entry +@Component +struct MyComponent2 { + @State arr: number[] = [10, 20, 30] + + build() { + Column() { + Button() { + Text('Reverse Array') + .fontSize(30) + }.onClick(() => { + this.arr.reverse() + }).width(80).height(40) + Button() { + Text('clear Array') + .fontSize(30) + }.onClick(() => { + this.arr.splice(0, 1) + }).width(80).height(40) + Button() { + Text('replace Array item') + .fontSize(30) + }.onClick(() => { + this.arr.splice(0, 1, 40) + }).width(80).height(40) + Button() { + Text('replace Array') + .fontSize(30) + }.onClick(() => { + let newArr = [30, 40, 50] + this.arr = newArr + }).width(80).height(40) + + ForEach(this.arr, // Parameter 1: array to be iterated + (item: number) => { // Parameter 2: item generator + Text(`item value: ${item}`) + .fontSize(20) + }, + (item: number) => item.toString() // Parameter 3: unique key generator, which is optional but recommended. + ) + }.height(800) + } +} diff --git a/compiler/compiler/sample/pages/testcases/image.ets b/compiler/compiler/sample/pages/testcases/image.ets new file mode 100644 index 000000000..26ba6d705 --- /dev/null +++ b/compiler/compiler/sample/pages/testcases/image.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + + +@Entry +@Component +struct UserView1 { + + build(){ + Column() { + Image('/common/seaman2.png') + .alt("/common/seaman2.png") + .onComplete((e) => { + console.log('load image, width2: ' + e.width) + console.log('load image, height3: ' + e.height) + }) + .onError(() => { + console.log('load image error1') + }) + } + } +} \ No newline at end of file diff --git a/compiler/compiler/sample/pages/testcases/import-api-01.ets b/compiler/compiler/sample/pages/testcases/import-api-01.ets new file mode 100644 index 000000000..e2e3ceaa4 --- /dev/null +++ b/compiler/compiler/sample/pages/testcases/import-api-01.ets @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + + +import fetch from '@system.fetch' +import router from '@system.router' + +@Entry +@Component +struct HomeComponent { + private value1: string = "hello world 1" + private value2: string = "hello world 2" + private value3: string = "hello world 3" + + build() { + Column() { + if (this.value1 === 'Hello') { + Text(this.value1) + } else if (this.value1 === '') { + Button() + } + } + .height(500) + } +} \ No newline at end of file diff --git a/compiler/compiler/sample/pages/testcases/link-01.ets b/compiler/compiler/sample/pages/testcases/link-01.ets new file mode 100644 index 000000000..aff09ab50 --- /dev/null +++ b/compiler/compiler/sample/pages/testcases/link-01.ets @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + + +@Component +struct MyLinkTestComponent { + @Link myLink1?: any + @Link myLink2?: number + @Link myLink3?: boolean + @Link myLink4?: string + + private myVar: number = 0 + private myVar2: number + + build() { + + } +} + +@Entry +@Component +struct LinkTest { + @State myState1: any = { count: 0 } + @State myState2: number = 0 + @State myState3: boolean = false + @State myState4: string = 'Home' + + build() { + Row() { + MyLinkTestComponent({ + myLink1: $myState1, + myLink2: $myState2, + myLink3: $myState3, + myLink4: $myState4, + myVar: 100, + myVar2: 100, + }) + } + } +} \ No newline at end of file diff --git a/compiler/compiler/sample/pages/testcases/linkArrayModel.ets b/compiler/compiler/sample/pages/testcases/linkArrayModel.ets new file mode 100644 index 000000000..f4901f8b6 --- /dev/null +++ b/compiler/compiler/sample/pages/testcases/linkArrayModel.ets @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + + +@Component +@Entry +struct Parent { + @State arr: number[] = [1, 2, 3] + build() { + Column() { + Child({items: $arr}) + ForEach(this.arr, + item => {Text(`${item}`)}, + item => item) + } + } +} + +@Component +struct Child { + @Link items: number[] + build() { + Column() { + Button() { + Text("Button1: push") + }.onClick(() => { + this.items.push(100) + }) + Button() { + Text("Button2: replace whole item") + }.onClick(() => { + this.items = [100, 200, 300] + }) + } + } +} diff --git a/compiler/compiler/sample/pages/testcases/linkPropCombo.ets b/compiler/compiler/sample/pages/testcases/linkPropCombo.ets new file mode 100644 index 000000000..03d834813 --- /dev/null +++ b/compiler/compiler/sample/pages/testcases/linkPropCombo.ets @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + + +@Component +@Entry +struct ParentView { + @State counter:number = 0; + build() { + Column() { + ChildA({counterVal: this.counter}) + ChildB({counterRef: $counter}) + } + } +} + +@Component +struct ChildA { + @Prop counterVal: number; + build() { + Button() { + Text(`ChildA: (${this.counterVal}) +1`) + } + .onClick(() => this.counterVal += 1) + } +} + +@Component +struct ChildB { + @Link counterRef: number; + build() { + Button() { + Text(`ChildB: (${this.counterRef}) +1`) + } + .onClick(() => this.counterRef += 1) + } +} \ No newline at end of file diff --git a/compiler/compiler/sample/pages/testcases/linkSimpleModel.ets b/compiler/compiler/sample/pages/testcases/linkSimpleModel.ets new file mode 100644 index 000000000..4f2947eb8 --- /dev/null +++ b/compiler/compiler/sample/pages/testcases/linkSimpleModel.ets @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + + +@Component +@Entry +struct Player { + @State isPlaying: boolean = false + build() { + Column() { + PlayButton({ buttonPlaying: $isPlaying }) + Text(`Player is ${this.isPlaying? '':'not'} playing`) + } + } +} + +@Component +struct PlayButton { + @Link buttonPlaying: boolean + build() { + Column() { + Button() { + Image(this.buttonPlaying? "play.png": "pause.png") + }.onClick(() => { + this.buttonPlaying = !this.buttonPlaying + }) + } + } +} diff --git a/compiler/compiler/sample/pages/testcases/new-01.ets b/compiler/compiler/sample/pages/testcases/new-01.ets new file mode 100644 index 000000000..7f6c51a5c --- /dev/null +++ b/compiler/compiler/sample/pages/testcases/new-01.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + + +@Component +@Entry +struct MyComponent3 { + private value1: string = "hello world 1" + private value2: string = "hello world 2" + private value3: string = "hello world 3" + + build() { + Column() { + Text(this.value1) + Text(this.value2) + Text(this.value3) + } + } +} \ No newline at end of file diff --git a/compiler/compiler/sample/pages/testcases/new-0101.ets b/compiler/compiler/sample/pages/testcases/new-0101.ets new file mode 100644 index 000000000..7f6c51a5c --- /dev/null +++ b/compiler/compiler/sample/pages/testcases/new-0101.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + + +@Component +@Entry +struct MyComponent3 { + private value1: string = "hello world 1" + private value2: string = "hello world 2" + private value3: string = "hello world 3" + + build() { + Column() { + Text(this.value1) + Text(this.value2) + Text(this.value3) + } + } +} \ No newline at end of file diff --git a/compiler/compiler/sample/pages/testcases/new-02.ets b/compiler/compiler/sample/pages/testcases/new-02.ets new file mode 100644 index 000000000..d60117669 --- /dev/null +++ b/compiler/compiler/sample/pages/testcases/new-02.ets @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + +@Component +@Entry +struct MyComponent4 { + private value1: string = "hello world 1" + private value2: string = "hello world 2" + private value3: string = "hello world 3" + + build() { + new Column() { + new Text(this.value1) + Text(this.value2) + Text(this.value3) + } + } +} \ No newline at end of file diff --git a/compiler/compiler/sample/pages/testcases/new-03.ets b/compiler/compiler/sample/pages/testcases/new-03.ets new file mode 100644 index 000000000..de28fd142 --- /dev/null +++ b/compiler/compiler/sample/pages/testcases/new-03.ets @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + +@Component +struct Banner { + private value1: string = "hello world 2"; + + build() { + Column() { + Text(this.value1); + } + } +} + +@Component +@Entry +struct MyComponent5 { + private value1: string = "hello world 1" + + build() { + Column() { + Text(this.value1) + Banner() + } + } +} \ No newline at end of file diff --git a/compiler/compiler/sample/pages/testcases/new-04.ets b/compiler/compiler/sample/pages/testcases/new-04.ets new file mode 100644 index 000000000..b8f1c7ecb --- /dev/null +++ b/compiler/compiler/sample/pages/testcases/new-04.ets @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + + +@Component +struct Banner { + private value1: string = "hello world 2"; + + build() { + Column() { + Text(this.value1); + } + } +} + +@Component +@Entry +struct MyComponent6 { + private value1: string = "hello world 1" + + build() { + Column() { + Text(this.value1) + new Banner() + } + } +} \ No newline at end of file diff --git a/compiler/compiler/sample/pages/testcases/onclicktest.ets b/compiler/compiler/sample/pages/testcases/onclicktest.ets new file mode 100644 index 000000000..305ff1e58 --- /dev/null +++ b/compiler/compiler/sample/pages/testcases/onclicktest.ets @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + +@Entry +@Component +struct TestView1 { + + @State + clicked:number = 0; + + onClicked() { + this.clicked = this.clicked + 1; + } + + build() { + Column(){ + Text("Clicked: " + this.onClicked) + Image("pages/pictures/0.jpeg") + .width(800).height(400).margin(50) + .onClick(this.onClicked.bind(this)) + Text("Test text\ntest text") + .onClick(this.onClicked.bind(this)) + Row(){ + Text("test") + Text("test") + Text("test") + } + .onClick(this.onClicked.bind(this)) + Stack(){ + Image("pages/pictures/0.jpeg") + Text("Test text") + } + .onClick(this.onClicked.bind(this)) + Column(){ + Text("test") + Text("test") + Text("test") + } + .onClick(this.onClicked.bind(this)) + } + .alignItems(HorizontalAlign.Center) + } // render +} diff --git a/compiler/compiler/sample/pages/testcases/propSimpleModel.ets b/compiler/compiler/sample/pages/testcases/propSimpleModel.ets new file mode 100644 index 000000000..6d7b371b0 --- /dev/null +++ b/compiler/compiler/sample/pages/testcases/propSimpleModel.ets @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + +@Component +@Entry +struct ParentComponent { + @State countDownStartValue: number = 10; // 10 Nuggets default start value in a Game + build() { + Column() { + Text(`Grant ${this.countDownStartValue} nuggets to play.`) + Button() { + Text("+1 - Nuggets in New Game") + }.onClick(() => { + this.countDownStartValue += 1 + }) + Button() { + Text("-1 - Nuggets in New Game") + }.onClick(() => { + this.countDownStartValue -= 1 + }) + + // when creatng ChildComponent, the initial value of its @Prop variable must be supplied in a named constructor parameter + // also regular costOfOneAttempt (non-Prop) variable is initialied + CountDownComponent({ count: this.countDownStartValue, costOfOneAttempt: 2 }) + } + } +} + +@Component +struct CountDownComponent { + + @Prop count: number + costOfOneAttempt?: number + + build() { + Column() { + if (this.count> 0) { + Text(`You have ${this.count} Nuggets left`) + } else { + Text("Game over!"); + } + + Button() { + Text("Try again") + }.onClick(() => { + this.count -= this.costOfOneAttempt; + }) + } + } +} diff --git a/compiler/compiler/sample/pages/testcases/showcaseCovid19.ets b/compiler/compiler/sample/pages/testcases/showcaseCovid19.ets new file mode 100644 index 000000000..14a8a57a8 --- /dev/null +++ b/compiler/compiler/sample/pages/testcases/showcaseCovid19.ets @@ -0,0 +1,3577 @@ + + +/** + * COVID Showcase App + * + * Made for the purpose of comparing ACE-Diff with ACE-JSF. + * Read the README.md file in the same directory for build instructions + * + * ACE @ Web Helsinki + * + + */ + + /* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + + + +const enum FlexAlign { + AUTO, + + // align to the start of the axis, can be both used in MainAxisAlign and CrossAxisAlign. + FLEX_START, + + // align to the center of the axis, can be both used in MainAxisAlign and CrossAxisAlign. + CENTER, + + // align to the end of the axis, can be both used in MainAxisAlign and CrossAxisAlign. + FLEX_END, + + // stretch the cross size, only used in CrossAxisAlign. + STRETCH, + + // adjust the cross position according to the textBaseline, only used in CrossAxisAlign. + BASELINE, + + // align the children on both ends, only used in MainAxisAlign. + SPACE_BETWEEN, + + // align the child with equivalent space, only used in MainAxisAlign. + SPACE_AROUND +} + +const enum TextOverflow { + CLIP, + ELLIPSIS, + NONE, +} + +class MonthData { + month: number = 0; + new_cases: number = 0; + incidence: number = 0; + new_dead: number = 0; + incidence_dead: number = 0; + + constructor(month: number, new_cases: number, incidence: number, new_dead: number, incidence_dead: number) { + this.month = month; + this.new_cases = new_cases; + this.incidence = incidence; + this.new_dead = new_dead; + this.incidence_dead = incidence_dead; + } +} + +class MonthVM { + data: MonthData = undefined; + dirLabel: string = ''; + dirColor: string = ''; + constructor(data: MonthData, dirLabel: string, dirColor: string) { + this.data = data; + this.dirLabel = dirLabel; + this.dirColor = dirColor; + } +} + +class CountryTrendVM { + id: number = 0; + height: number = 0; + color: string = ''; + isVisible: boolean = false; + constructor(id: number, height: number, color: string, isVisible: boolean) { + this.id = id; + this.height = height; + this.color = color; + this.isVisible = isVisible; + } +} + + +// non-mutaitng Model holding basic data about a country +// no need to observe instances +class CountryData { + name: string = ''; + continent: string = ''; + alpha2: string = ''; + population: number = 0; + months: Array = undefined; + maxCases: number = 0; + + constructor(name: string, + continent: string, + alpha2: string, + population: number, + maxCases: number, + months: Array) { + this.name = name; + this.continent = continent; + this.alpha2 = alpha2; + this.population = population; + this.maxCases = maxCases; + this.months = months; + } + + compareName(c2: CountryData): number { + return (this.name == c2.name) ? 0 : (this.name < c2.name) ? -1 : 1; + // FXXME V8 ICU issue workaround, do not use: return this.name.localeCompare(c2.name); + } +} + +// mutating part of Country model +// needs to be wrapped by an Observable +class CountryVM { + show: boolean = false; + data: CountryData = undefined; + + constructor(show: boolean, data: CountryData) { + this.show = show; + this.data = data; + } +} + +// singleton, mutating object about how to vide countries +class CountriesPresentation { + // first country to show in View + firstCountry_: number = 0; + + // sorting by country name: +1: A..Z; -1: Z..A + countriesSortDirection: number = 0; + + // total number of countries in VM, i.e. after filtering + countriesN: number = 0; + + static readonly TOTAL_COUNTRIES = 183;// change when data set updated + static readonly SHOW_COUNTRIES = 25; + static readonly SHIFT_BY = 18; + + static readonly N_REGULAR_FONT_SIZE = 18; + static readonly REGULAR_FONT_SIZE = CountriesPresentation.N_REGULAR_FONT_SIZE + 'px'; + + constructor() { + this.firstCountry_ = 0; + this.countriesSortDirection = 1; // A..Z order + this.countriesN = CountriesPresentation.TOTAL_COUNTRIES; + } + + firstCountry(): number { + return this.firstCountry_; + } + + lastCountry(): number { + return this.firstCountry_ + CountriesPresentation.SHOW_COUNTRIES; + } + // shift visible countries by + shiftBy(byCount: number): void { + this.firstCountry_ = Math.max(0, + Math.min(this.firstCountry_ + byCount, + this.countriesN - CountriesPresentation.SHOW_COUNTRIES) + ); + console.log(`shiftCountries this.firstCountry=${this.firstCountry}`); + } + + // after applying filters reset firstCountry and sorting direction, + // and recalc number of to be shown countries + resetByFilters(countriesData: any): void { + this.countriesN = countriesData.filter((c) => c.show).length; + this.firstCountry_ = 0; + this.countriesSortDirection = 1 + console.log(`CountriesPresentation: setCountriesN(${this.countriesN}) `); + } + + // reverse sorting direction of visible countries + reverseDirection(): void { + this.countriesSortDirection *= -1; + } +} + + +// similar to CountryPresentation, singleton mutating object about how to present +// months' data of each country +class MonthsPresentation { + firstMonth_: number = 8; + + constructor() { + this.firstMonth_ = 8; + } + + firstMonth(): number { + return this.firstMonth_; + } + lastMonth(): number { + return this.firstMonth_ + 2; + } + + shiftBy(byCount) { + this.firstMonth_ = Math.max(0, Math.min(this.firstMonth_ + byCount, 8)); + console.log(`shiftMonths this.firstMonth=${this.firstMonth_}`); + } +} + +var initCountriesData = function (): Array { + var result = new Array(); + APP_DATA.forEach((country: any) => { + let countryVM = new CountryVM( + /*show */ true, + new CountryData(country.name, country.continent, country.alpha2, country.population, country.maxCases, country.months) + ); + result.push(countryVM); + }); + console.log(`initCountriesData: result.length ${result.length}`); + return result; +} + + +// -------------------- PageView ------------------------------------------------------------ + +@Entry +@Component +struct PageView { + + @State showFilters: boolean = false; + @State countriesPresentation: CountriesPresentation = new CountriesPresentation(); + @State monthsPresentation: MonthsPresentation = new MonthsPresentation(); + + countriesData: Array = initCountriesData(); + + /* + constructor(id: string, parent: View, params: { countriesData: Array }) { + super(id, parent); + console.log(`Create PageView`); + + // Properties 'firstCountry', 'countriesSortDirection', 'firstMonth' only + // change in this View when also 'showFilters' changes. + // same applies to countriesData + // Hence, we do not need to make countriesPresentation and monthsPresentation + // a @State variable + this.setInitialObjectState({ + showFilters: false, + countriesPresentation: new CountriesPresentation(), + monthsPresentation: new MonthsPresentation(), + countriesData: [] + }); + + this.updateObjectState(params); + + this.createState("showFilters"); + this.createState("countriesPresentation"); + this.createState("monthsPresentation"); + + this.____is_initialized___ = true; + } + +render(): ViewAbstract { + console.log(`Render PageView`); + // if ... {} else {} + return this.showFilters ? new Column( + new FiltersView("FiltersView", this, { countriesVM: this.countriesData }), + new Row( + new Button("Apply Filters").onClick(() => this.onApplyFiltersPressed()) + .height('50px') + .width('300px'), + new Button("Dump MemInfo").onClick(() => { + dumpMemoryStats("FiltersView visile"); + }).width('300px') + ) + ).setUniqueKey("Filters") + : new Column( + new Row( + new Button("Show Filters") + .onClick(() => this.showFilters = true).width('300px'), + new Button("Dump MemInfo") + .onClick(() => { + dumpMemoryStats("StatsView visible"); + }).width('300px'), + ), + new StatsView("StatsView", this, { + countriesData: this.countriesData, + countriesPresentation: createLinkReference(this, "countriesPresentation"), + monthsPresentation: createLinkReference(this, "monthsPresentation") + }).setUniqueKey("StatsView") + ).setUniqueKey("Stats") + } + */ + + onApplyFiltersPressed(): void { + this.showFilters = false; + this.countriesPresentation.resetByFilters(this.countriesData); + this.monthsPresentation.firstMonth_ = 8; + } + + build() { + Column() { + if (this.showFilters) { + Column() { + FiltersView({ countriesVM: this.countriesData }) + Row() { + Button("Apply Filters").onClick(() => { this.onApplyFiltersPressed() } ).height('50px').width('300px') + Button("Dump MemInfo").onClick(() => { dumpMemoryStats("FiltersView visile") }).width('300px') + }.wrapContent() + }.wrapContent() + } else { + Column() { + Row() { + Button("Show Filters") + .width('300px') + .onClick(() => { this.showFilters = true } ) + Button("Dump MemInfo") + .width('300px') + .onClick(() => { dumpMemoryStats("StatsView visible") }) + }.wrapContent() + StatsView({countriesData: this.countriesData, countriesPresentation: $countriesPresentation, monthsPresentation: $monthsPresentation}) + .setUniqueKey("StatsView") + }.wrapContent() + } + }.wrapContent().setUniqueKey("Page") + } +} + + +// -------------------- StatsView ------------------------------------------------------------ + +@Component +struct StatsView { + + // just a regular class variable + countriesData: Array; + + @Link countriesPresentation: CountriesPresentation; + + @Link monthsPresentation: MonthsPresentation; + + /* + constructor(id: string, parent: PageView, + params: { + countriesData: Array, + countriesPresentation: LinkReference, + monthsPresentation: LinkReference + }) { + super(id, parent); + console.log(`Create StatsView`); + + this.setInitialObjectState({ countriesData: [] }) + this.updateObjectState(params); + + this.createLink("countriesPresentation"); + this.createLink("monthsPresentation"); + + this.____is_initialized___ = true; + } + + render(): Flex { + console.log(`Render StatsView`); + return new Column( + new StatsViewHeading("160", this, + { monthsPresentation: createLinkReference(this, "monthsPresentation") }) + .setUniqueKey("Heading"), // all children of Column have unique keys + + new ForEach("161", this, + this.countriesVM(), + (country: CountryVM) => new CountryStatsView("140", this, + { countryData: country, monthsPresentation: createLinkReference(this, "monthsPresentation") }), + (country: CountryVM) => country.data.alpha2 + ).setUniqueKey("Countries"), + new Row( + new Button("Prev").onClick(() => this.countriesPresentation.shiftBy(-CountriesPresentation.SHIFT_BY)).setUniqueKey("Prev"), + new Button("Next").onClick(() => this.countriesPresentation.shiftBy(CountriesPresentation.SHIFT_BY)).setUniqueKey("Next"), + new Button(this.countriesPresentation.countriesSortDirection > 0 ? "Z..A" : "A..Z").onClick(() => this.countriesPresentation.reverseDirection()).setUniqueKey("Sort"), + new Button("Earier").onClick(() => this.monthsPresentation.shiftBy(-1)).setUniqueKey("Earlier"), + new Button("Later").onClick(() => this.monthsPresentation.shiftBy(1)).setUniqueKey("Later"), + ).height('100px').setUniqueKey("Buttons_Row") // all children of Column have unique keys + ).wrapContent() + } + + */ + + build() { + Column() { + StatsViewHeading({ monthsPresentation: $monthsPresentation }).setUniqueKey("Heading") + CountriesStatsView({ countriesPresentation: $countriesPresentation, monthsPresentation: $monthsPresentation, countriesData: this.countriesData}).setUniqueKey("CSV") + Row() { + Button("Prev").onClick(() => { this.countriesPresentation.shiftBy(-CountriesPresentation.SHIFT_BY) } ).setUniqueKey("Prev") + Button("Next").onClick(() => { this.countriesPresentation.shiftBy(CountriesPresentation.SHIFT_BY) } ).setUniqueKey("Next") + Button(this.countriesPresentation.countriesSortDirection > 0 ? "Z..A" : "A..Z").onClick(() => { this.countriesPresentation.reverseDirection() } ).setUniqueKey("Sort") + Button("Earier").onClick(() => { this.monthsPresentation.shiftBy(-1) } ).setUniqueKey("Earlier") + Button("Later").onClick(() => { this.monthsPresentation.shiftBy(1) } ).setUniqueKey("Later") + }.height('100px').setUniqueKey("Buttons_Row") + }.wrapContent() + } +} + + + +@Component +struct StatsViewHeading { + + static monthsLabel: string[] = ["February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]; + + @Link monthsPresentation: MonthsPresentation; + + /* + constructor(id: string, parent: StatsView, params: { monthsPresentation: LinkReference }) { + super(id, parent); + console.log(`Create StatsViewHeading`); + + this.setInitialObjectState({}) + this.updateObjectState(params); + + this.createLink("monthsPresentation"); + + this.____is_initialized___ = true; + } + + render(): ViewAbstract { + return new Row( + new Text("Territory").fontSize(CountriesPresentation.REGULAR_FONT_SIZE).fontWeight("bold").width('222px').setUniqueKey("Territory"), // all children of Row need unique Key + new ForEach("171", this, + StatsViewHeading.monthsLabel.slice(this.monthsPresentation.firstMonth(), this.monthsPresentation.lastMonth()), + (month) => new Text(month).fontSize(CountriesPresentation.REGULAR_FONT_SIZE).fontWeight("bold").width('182px'), + (month) => month + ), + new Text("Trend").fontSize(CountriesPresentation.REGULAR_FONT_SIZE).fontWeight("bold").width('110px').setUniqueKey("Trend"), // all children of Row need unique Key + ).height('50px'); + } + */ + + build() { + Row() { + Text("Territory").fontSize(CountriesPresentation.REGULAR_FONT_SIZE).fontWeight("bold").width('222px').setUniqueKey("Territory") // all children of Row need unique Key + ForEach( + StatsViewHeading.monthsLabel.slice(this.monthsPresentation.firstMonth(), this.monthsPresentation.lastMonth()), + (month) => { Text(month).fontSize(CountriesPresentation.REGULAR_FONT_SIZE).fontWeight("bold").width('182px') }, + (month) => month + ) + Text("Trend").fontSize(CountriesPresentation.REGULAR_FONT_SIZE).fontWeight("bold").width('110px').setUniqueKey("Trend") // all children of Row need unique Key + }.height('50px') + } +} + + + +@Component +struct CountriesStatsView { + + @Link countriesPresentation: CountriesPresentation; + @Link monthsPresentation: MonthsPresentation; + countriesData: Array; + + filteredCountries(): Array { + var result = this.countriesData.filter((c) => c.show); + console.log("update filteredCountries, length: " + result.length); + return result; + } + + countriesVM(): Array { + console.log("update countriesVM, ..."); + var result = this.filteredCountries() + .slice(this.countriesPresentation.firstCountry(), this.countriesPresentation.lastCountry()) + .sort(function (c1: CountryVM, c2: CountryVM) { + return this.countriesPresentation.countriesSortDirection * c1.data.compareName(c2.data) + }.bind(this) + ); + + console.log("update countriesVM, length: " + result.length); + return result; + } + +// do not put curley brackets around the item gen function below, compiler will not generate needed return + build() { + Column() { + ForEach(this.countriesVM(), + (country) => CountryStatsView({ monthsPresentation: $monthsPresentation, countryData: country}), + (country) => country.data.alpha2 + ).setUniqueKey("ForEach") + }.wrapContent().setUniqueKey("ForEach_Col") + } +} + + +@Component +struct CountryStatsView { + + @State countryData: CountryVM = new CountryVM(false, undefined); // dummy init + @Link monthsPresentation: MonthsPresentation; + + /* + constructor(id: string, parent: StatsView, + params: { countryData: CountryVM, monthsPresentation: LinkReference }) { + super(id, parent); + console.log(`Create CountryStatsView`); + + // we need to init the @State countryData variable with a dummy + this.setInitialObjectState({ countryData: new CountryVM(false, undefined) }) + this.updateObjectState(params); + + // countryData is wrapped with an ObservableObject already + // createState will pick up the Obs.Object and have the View subscribe to it. + this.createState("countryData"); + this.createLink("monthsPresentation"); + + this.____is_initialized___ = true; + console.log(`Create CountryStatsView of ${this.countryData.data.name}`); + } +*/ + + build() { + Row() { + Image(`pictures/diff/flags/${this.countryData.data.alpha2}.png`).width('32px').height('32px').marginRight('5px').setUniqueKey("Country_Flag") + Row() { + Text(this.countryData.data.name).fontSize(CountriesPresentation.REGULAR_FONT_SIZE).textOverflow(TextOverflow.Ellipsis).maxLines(1) + }.justifyContent(FlexAlign.start).width('190px').height('50px').setUniqueKey("Country_Name") + CountryMonthsStatView({ countryData: $countryData, monthsPresentation: $monthsPresentation }).setUniqueKey("CountryMonthsStatView") + CountryTrendView({ countryData: $countryData, monthsPresentation: $monthsPresentation }).setUniqueKey("CountryTrendView") + }.alignItems(FlexAlign.start).justifyContent(FlexAlign.Center).wrapContent().height('50px') + } +} + +@Component +struct CountryMonthsStatView { + + @Link countryData: CountryVM; + @Link monthsPresentation: MonthsPresentation; + + areCasesRising(monthIndex: number): boolean { + const caseData: MonthData[] = this.countryData.data.months; + return ((monthIndex == 0) && (caseData[monthIndex] != undefined) && (caseData[monthIndex].new_cases > 0) || + ((caseData[monthIndex - 1] != undefined) && (caseData[monthIndex] != undefined) && (caseData[monthIndex].new_cases > caseData[monthIndex - 1].new_cases))); + } + + areCasesDeclining(monthIndex: number): boolean { + const caseData: MonthData[] = this.countryData.data.months; + return ((monthIndex > 0) && (caseData[monthIndex] != undefined) && (caseData[monthIndex - 1] != undefined) && (caseData[monthIndex].new_cases < caseData[monthIndex - 1].new_cases)); + } + + /* + constructor(id: string, parent: CountryStatsView, params: { countryData: LinkReference, monthsPresentation: LinkReference }) { + super(id, parent); + console.log(`Create CountryMonthsStatView`); + + this.setInitialObjectState({}) + this.updateObjectState(params); + + this.createLink("countryData"); + this.createLink("monthsPresentation"); + + this.____is_initialized___ = true; + console.log(`Create CountryMonthsStatView of ${this.countryData.data.name}`); + } +*/ + + calcVM(): Array { + console.log(`Render CountryMonthsStatView of ${this.countryData.data.name}`); + var vm: MonthVM[] = []; + for (var monthsIndex = this.monthsPresentation.firstMonth(); monthsIndex < this.monthsPresentation.lastMonth(); monthsIndex++) { + vm.push(new MonthVM( + this.countryData.data.months[monthsIndex], + this.areCasesDeclining(monthsIndex) ? "▼" : this.areCasesRising(monthsIndex) ? "▲" : "►", + this.areCasesDeclining(monthsIndex) ? "#228B22" : this.areCasesRising(monthsIndex) ? "#ff4500" : "#000000", + )); + } + return vm; + } + + build() { + Row() { + ForEach(this.calcVM(), + (month) => { + Row() { + Row() { + Text(month.data.new_cases.toString()) + } + .justifyContent(FlexAlign.end).width('110px').height('50px') + Text(month.dirLabel) + .color(month.dirColor) + .fontSize(CountriesPresentation.REGULAR_FONT_SIZE) + .height('50px').width('18px') + Row() { + Text(month.data.incidence.toString()) + .fontSize(CountriesPresentation.REGULAR_FONT_SIZE) + .color(CountryTrendView.calcBarColor(month.data.incidence)) + } + .justifyContent(FlexAlign.end).width('70px').height('50px') + } + .width((110 + 70) + 'px').height('50px') + }, + (month) => month.data.month.toString() + ) + } + .wrapContent().width((2 * (110 + 90)) + 'px').height('50px') + } +} + + +@Component +struct CountryTrendView { + + @Link countryData: CountryVM; + @Link monthsPresentation: MonthsPresentation; + + /* + constructor(id: string, parent: CountryStatsView, params: { countryData: LinkReference, monthsPresentation: LinkReference }) { + super(id, parent); + + console.log(`Create CountryTrendView`); + + this.setInitialObjectState({}) + this.updateObjectState(params); + + this.createLink("countryData"); + this.createLink("monthsPresentation"); + + this.____is_initialized___ = true; + console.log(`Create CountryTrendView of ${this.countryData.data.name}`); + } +*/ + + calcBarHeight(monthCases: number): number { + let result = (this.countryData.data.maxCases == 0) ? 1 : 1 + (39 * monthCases / this.countryData.data.maxCases); + console.log(`bar height ${result} maxCases ${this.countryData.data.maxCases}`); + return result; + } + + static calcBarColor(incidence: number): string { + return (incidence >= 500) ? "#a52729" : (incidence >= 250) ? "#7e2e1f" : (incidence >= 100) ? "#98503C" : (incidence >= 50) ? "#a5714E" : (incidence >= 35) ? "#b99c6b" : "#d5c4a1"; + } + + calcVM(): Array { + console.log(`Render CountryTrendView of ${this.countryData.data.name} for ${this.countryData.data.months.length} months`); + const vm: CountryTrendVM[] = []; + for (var i = 0; i < this.countryData.data.months.length; i++) { + const isVisible: boolean = (this.monthsPresentation.firstMonth() <= i) && (i < this.monthsPresentation.lastMonth()); + vm.push(new CountryTrendVM( + this.countryData.data.months[i].month, + this.calcBarHeight(this.countryData.data.months[i].new_cases), + CountryTrendView.calcBarColor(this.countryData.data.months[i].incidence), + isVisible + )); + } + return vm; + } + + build() { + Row() { + ForEach(this.calcVM(), + (m) => { + Column() { + if (m.isVisible) { + Column() { + Column() { + /* emtry */ } + .height(Math.max(0, m.height - 2) + 'px') + .width('5px') + .backgroundColor(m.color) + Column() { + /* emtry */ } + .height('2px').width('5px').backgroundColor("#000000") + } // Column + .height(m.height).width('5px').marginRight('1px') + } else { + Column() { + /* emtry */ } + .height(m.height + 'px') + .width('5px') + .backgroundColor(m.color) + .marginRight('1px') + } // else + }.wrapContent().height(m.height + 'px') + }, // ForEach item gen func + (m) => m.id // ForEach id gen func + ) // ForEach + } // Row + .wrapContent().alignItems(FlexAlign.end).height('50px').width('60px').marginLeft('10px') + } +} + + + + +// -------------------- FiltersView ------------------------------------------------------------ + +@Component +struct FiltersView { + + // @State hack against mising @Observed / observableObject for all ContryVM instances + @State countryHasChanged: boolean = false; + + // regular parameter + countriesVM: Array = []; + + static CONTINENTS = ["Asia", "Europe", "Africa", "North America", "South America", "Oceania"]; + + /* constructor(id: string, parent: PageView, params: { countriesVM: Array }) { + super(id, parent); + console.log(`Create FiltersView`); + + this.setInitialObjectState({ countriesVM: [] }) + this.updateObjectState(params); + this.createState("countryHasChanged") + this.____is_initialized___ = true; + } + */ + + getCovidDataByContinent(ct: string): Array < CountryVM > { + let result = this.countriesVM.filter((c: CountryVM) => c.data.continent == ct); + console.log(`getCovidDataByContinent(${ct}) returns length ${result.length}`); + return result; + } + + toggleContinent(conti: string): void { + console.log(`toggleContinent ...${conti}`); + let data: Array < CountryVM > = this.getCovidDataByContinent(conti); + let newValue: boolean = (data.length > 0) ? !data[0].show : false; + data.forEach((c: CountryVM) => c.show = newValue); + + // FIXME: hack to make this vew render and take chnaged 'show' CountryVM instances into account + // this need @Observed CountryVM / createdObservableObject to work efficiently. + this.countryHasChanged = !this.countryHasChanged + } + + build() { + Column() { + ForEach( + FiltersView.CONTINENTS, + (conti) => { + Column() { + Button(conti) + .onClick(() => { this.toggleContinent(conti) } ) + .height('50px') + .width('400px') + .setUniqueKey("Button_" + conti) + ContinentFiltersView({ countriesVM: this.getCovidDataByContinent(conti) }).setUniqueKey("ContinentFiltersView_" + conti) // all children of Row need unique Key + }.wrapContent().setUniqueKey("ContinentFiltersView_row_" + conti) + }, + (conti) => conti + ) + }.wrapContent().width('740px'); + } +} + + +@Component +struct ContinentFiltersView { + // regular variable + countriesVM: Array = []; + + /* + constructor(id: string, parent: FiltersView, params: { countriesVM: Array }) { + super(id, parent); + this.setInitialObjectState({ countriesVM: [] }) + this.updateObjectState(params); + + console.log(`Create ContinentFiltersView for ${this.countriesVM.length} countries`); + this.____is_initialized___ = true; + } +*/ + + build() { + Row() { + ForEach( + this.countriesVM, + (country) => { + CountryFiltersView({ countryVM: country }) + }, + (country) => country.data.alpha2 + ) // ForEach + }.wrap(true).wrapContent() + } +} + + +@Component +struct CountryFiltersView { + @State countryVM: CountryVM = new CountryVM(true, undefined); + + /* + constructor(id: string, parent: ContinentFiltersView, params: { countryVM: CountryVM }) { + super(id, parent); + console.log(`Create CountryFiltersView ...`); + + this.setInitialObjectState({ countriesVM: [] }) + this.updateObjectState(params); + + // individdual countryVM is wrapped inside a ObservableObject alredy. + // createState will take it and register this View to the Obs.Object. + this.createState("countryVM"); + this.____is_initialized___ = true; + + console.log(`Create CountryFiltersView for ${this.countryVM.data.name}`); + } +*/ + + build() { + Row() { + // country flag + Image(`pictures/diff/flags/${this.countryVM.data.alpha2}.png`) + .width('32px').height('32px') + .marginTop('4px').marginBottom('4px').marginRight('10px') + + // country 2-letter code + Text(this.countryVM.data.alpha2) + .fontSize(CountriesPresentation.REGULAR_FONT_SIZE) + .fontWeight(this.countryVM.show ? 'bold' : 'normal').width('50px').height('40px') + }.wrapContent() + .width('90px').height('40px') + .backgroundColor(this.countryVM.show ? '#ffffff' : '#c0c0c0') + } +} + + +const APP_DATA = [ + { + "name": "Afghanistan", "continent": "Asia", "alpha2": "af", "population": 38928341, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 174, "incidence": 0, "new_dead": 3, "incidence_dead": 0 }, + { "month": 4, "new_cases": 1952, "incidence": 1, "new_dead": 60, "incidence_dead": 0 }, + { "month": 5, "new_cases": 13081, "incidence": 8, "new_dead": 194, "incidence_dead": 0.1 }, + { "month": 6, "new_cases": 16299, "incidence": 10, "new_dead": 494, "incidence_dead": 0.3 }, + { "month": 7, "new_cases": 5158, "incidence": 3, "new_dead": 532, "incidence_dead": 0.3 }, + { "month": 8, "new_cases": 1494, "incidence": 1, "new_dead": 119, "incidence_dead": 0.1 }, + { "month": 9, "new_cases": 1109, "incidence": 1, "new_dead": 57, "incidence_dead": 0 }, + { "month": 10, "new_cases": 2157, "incidence": 1, "new_dead": 78, "incidence_dead": 0.1 }, + { "month": 11, "new_cases": 4849, "incidence": 3, "new_dead": 257, "incidence_dead": 0.2 }, + ], + maxCases: 16299 + }, + { + "name": "Albania", "continent": "Europe", "alpha2": "al", "population": 2877800, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 241, "incidence": 2, "new_dead": 14, "incidence_dead": 0.1 }, + { "month": 4, "new_cases": 530, "incidence": 5, "new_dead": 16, "incidence_dead": 0.1 }, + { "month": 5, "new_cases": 364, "incidence": 3, "new_dead": 2, "incidence_dead": 0 }, + { "month": 6, "new_cases": 1398, "incidence": 12, "new_dead": 29, "incidence_dead": 0.3 }, + { "month": 7, "new_cases": 2741, "incidence": 24, "new_dead": 95, "incidence_dead": 0.8 }, + { "month": 8, "new_cases": 4237, "incidence": 37, "new_dead": 127, "incidence_dead": 1.1 }, + { "month": 9, "new_cases": 4136, "incidence": 36, "new_dead": 103, "incidence_dead": 0.9 }, + { "month": 10, "new_cases": 7226, "incidence": 63, "new_dead": 122, "incidence_dead": 1.1 }, + { "month": 11, "new_cases": 17307, "incidence": 150, "new_dead": 301, "incidence_dead": 2.6 }, + ], + maxCases: 17307 + }, + { + "name": "Algeria", "continent": "Africa", "alpha2": "dz", "population": 43851043, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 715, "incidence": 0, "new_dead": 43, "incidence_dead": 0 }, + { "month": 4, "new_cases": 3290, "incidence": 2, "new_dead": 406, "incidence_dead": 0.2 }, + { "month": 5, "new_cases": 5388, "incidence": 3, "new_dead": 203, "incidence_dead": 0.1 }, + { "month": 6, "new_cases": 4513, "incidence": 3, "new_dead": 259, "incidence_dead": 0.1 }, + { "month": 7, "new_cases": 16487, "incidence": 9, "new_dead": 298, "incidence_dead": 0.2 }, + { "month": 8, "new_cases": 14100, "incidence": 8, "new_dead": 300, "incidence_dead": 0.2 }, + { "month": 9, "new_cases": 7036, "incidence": 4, "new_dead": 226, "incidence_dead": 0.1 }, + { "month": 10, "new_cases": 6412, "incidence": 4, "new_dead": 228, "incidence_dead": 0.1 }, + { "month": 11, "new_cases": 25257, "incidence": 14, "new_dead": 467, "incidence_dead": 0.3 }, + ], + maxCases: 25257 + }, + { + "name": "Andorra", "continent": "Europe", "alpha2": "ad", "population": 77265, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 375, "incidence": 121, "new_dead": 11, "incidence_dead": 3.6 }, + { "month": 4, "new_cases": 369, "incidence": 119, "new_dead": 30, "incidence_dead": 9.7 }, + { "month": 5, "new_cases": 19, "incidence": 6, "new_dead": 9, "incidence_dead": 2.9 }, + { "month": 6, "new_cases": 91, "incidence": 29, "new_dead": 1, "incidence_dead": 0.3 }, + { "month": 7, "new_cases": 70, "incidence": 23, "new_dead": 0, "incidence_dead": 0 }, + { "month": 8, "new_cases": 251, "incidence": 81, "new_dead": 1, "incidence_dead": 0.3 }, + { "month": 9, "new_cases": 874, "incidence": 283, "new_dead": 0, "incidence_dead": 0 }, + { "month": 10, "new_cases": 2706, "incidence": 876, "new_dead": 22, "incidence_dead": 7.1 }, + { "month": 11, "new_cases": 1989, "incidence": 644, "new_dead": 1, "incidence_dead": 0.3 }, + ], + maxCases: 2706 + }, + { + "name": "Angola", "continent": "Africa", "alpha2": "ao", "population": 32866268, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 6, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 4, "new_cases": 20, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 5, "new_cases": 59, "incidence": 0, "new_dead": 2, "incidence_dead": 0 }, + { "month": 6, "new_cases": 198, "incidence": 0, "new_dead": 9, "incidence_dead": 0 }, + { "month": 7, "new_cases": 864, "incidence": 1, "new_dead": 39, "incidence_dead": 0 }, + { "month": 8, "new_cases": 1506, "incidence": 1, "new_dead": 56, "incidence_dead": 0 }, + { "month": 9, "new_cases": 2318, "incidence": 2, "new_dead": 75, "incidence_dead": 0.1 }, + { "month": 10, "new_cases": 5833, "incidence": 4, "new_dead": 101, "incidence_dead": 0.1 }, + { "month": 11, "new_cases": 4334, "incidence": 3, "new_dead": 64, "incidence_dead": 0 }, + ], + maxCases: 5833 + }, + { + "name": "Antigua and Barbuda", "continent": "North America", "alpha2": "ag", "population": 97928, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 6, "incidence": 2, "new_dead": 0, "incidence_dead": 0 }, + { "month": 4, "new_cases": 17, "incidence": 4, "new_dead": 2, "incidence_dead": 0.5 }, + { "month": 5, "new_cases": 2, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, + { "month": 6, "new_cases": 43, "incidence": 11, "new_dead": 0, "incidence_dead": 0 }, + { "month": 7, "new_cases": 22, "incidence": 6, "new_dead": 0, "incidence_dead": 0 }, + { "month": 8, "new_cases": 3, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, + { "month": 9, "new_cases": 7, "incidence": 2, "new_dead": 0, "incidence_dead": 0 }, + { "month": 10, "new_cases": 27, "incidence": 7, "new_dead": 0, "incidence_dead": 0 }, + { "month": 11, "new_cases": 13, "incidence": 3, "new_dead": 1, "incidence_dead": 0.3 }, + ], + maxCases: 43 + }, + { + "name": "Argentina", "continent": "South America", "alpha2": "ar", "population": 45195777, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 1053, "incidence": 1, "new_dead": 26, "incidence_dead": 0 }, + { "month": 4, "new_cases": 3374, "incidence": 2, "new_dead": 191, "incidence_dead": 0.1 }, + { "month": 5, "new_cases": 12423, "incidence": 7, "new_dead": 321, "incidence_dead": 0.2 }, + { "month": 6, "new_cases": 47679, "incidence": 26, "new_dead": 768, "incidence_dead": 0.4 }, + { "month": 7, "new_cases": 126772, "incidence": 70, "new_dead": 2236, "incidence_dead": 1.2 }, + { "month": 8, "new_cases": 226433, "incidence": 125, "new_dead": 5117, "incidence_dead": 2.8 }, + { "month": 9, "new_cases": 333266, "incidence": 184, "new_dead": 8277, "incidence_dead": 4.6 }, + { "month": 10, "new_cases": 415923, "incidence": 230, "new_dead": 14065, "incidence_dead": 7.8 }, + { "month": 11, "new_cases": 257609, "incidence": 142, "new_dead": 7728, "incidence_dead": 4.3 }, + ], + maxCases: 415923 + }, + { + "name": "Armenia", "continent": "Asia", "alpha2": "am", "population": 2963234, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 531, "incidence": 4, "new_dead": 2, "incidence_dead": 0 }, + { "month": 4, "new_cases": 1534, "incidence": 13, "new_dead": 29, "incidence_dead": 0.2 }, + { "month": 5, "new_cases": 7216, "incidence": 61, "new_dead": 99, "incidence_dead": 0.8 }, + { "month": 6, "new_cases": 16260, "incidence": 137, "new_dead": 312, "incidence_dead": 2.6 }, + { "month": 7, "new_cases": 13008, "incidence": 110, "new_dead": 295, "incidence_dead": 2.5 }, + { "month": 8, "new_cases": 5231, "incidence": 44, "new_dead": 141, "incidence_dead": 1.2 }, + { "month": 9, "new_cases": 6578, "incidence": 55, "new_dead": 80, "incidence_dead": 0.7 }, + { "month": 10, "new_cases": 39454, "incidence": 333, "new_dead": 382, "incidence_dead": 3.2 }, + { "month": 11, "new_cases": 45311, "incidence": 382, "new_dead": 823, "incidence_dead": 6.9 }, + ], + maxCases: 45311 + }, + { + "name": "Australia", "continent": "Oceania", "alpha2": "au", "population": 25499881, "months": [ + { "month": 2, "new_cases": 16, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 4534, "incidence": 4, "new_dead": 17, "incidence_dead": 0 }, + { "month": 4, "new_cases": 2207, "incidence": 2, "new_dead": 75, "incidence_dead": 0.1 }, + { "month": 5, "new_cases": 436, "incidence": 0, "new_dead": 10, "incidence_dead": 0 }, + { "month": 6, "new_cases": 718, "incidence": 1, "new_dead": 1, "incidence_dead": 0 }, + { "month": 7, "new_cases": 9360, "incidence": 9, "new_dead": 97, "incidence_dead": 0.1 }, + { "month": 8, "new_cases": 8539, "incidence": 8, "new_dead": 456, "incidence_dead": 0.4 }, + { "month": 9, "new_cases": 1277, "incidence": 1, "new_dead": 231, "incidence_dead": 0.2 }, + { "month": 10, "new_cases": 499, "incidence": 0, "new_dead": 19, "incidence_dead": 0 }, + { "month": 11, "new_cases": 317, "incidence": 0, "new_dead": 1, "incidence_dead": 0 }, + ], + maxCases: 9360 + }, + { + "name": "Austria", "continent": "Europe", "alpha2": "at", "population": 9006400, "months": [ + { "month": 2, "new_cases": 7, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 10171, "incidence": 28, "new_dead": 127, "incidence_dead": 0.4 }, + { "month": 4, "new_cases": 5272, "incidence": 15, "new_dead": 456, "incidence_dead": 1.3 }, + { "month": 5, "new_cases": 1279, "incidence": 4, "new_dead": 84, "incidence_dead": 0.2 }, + { "month": 6, "new_cases": 1035, "incidence": 3, "new_dead": 37, "incidence_dead": 0.1 }, + { "month": 7, "new_cases": 3364, "incidence": 9, "new_dead": 13, "incidence_dead": 0 }, + { "month": 8, "new_cases": 6308, "incidence": 18, "new_dead": 15, "incidence_dead": 0 }, + { "month": 9, "new_cases": 17375, "incidence": 48, "new_dead": 66, "incidence_dead": 0.2 }, + { "month": 10, "new_cases": 60112, "incidence": 167, "new_dead": 310, "incidence_dead": 0.9 }, + { "month": 11, "new_cases": 177531, "incidence": 493, "new_dead": 2075, "incidence_dead": 5.8 }, + ], + maxCases: 177531 + }, + { + "name": "Azerbaijan", "continent": "Asia", "alpha2": "az", "population": 10139175, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 295, "incidence": 1, "new_dead": 4, "incidence_dead": 0 }, + { "month": 4, "new_cases": 1506, "incidence": 4, "new_dead": 19, "incidence_dead": 0 }, + { "month": 5, "new_cases": 3690, "incidence": 9, "new_dead": 39, "incidence_dead": 0.1 }, + { "month": 6, "new_cases": 12030, "incidence": 30, "new_dead": 150, "incidence_dead": 0.4 }, + { "month": 7, "new_cases": 14354, "incidence": 35, "new_dead": 235, "incidence_dead": 0.6 }, + { "month": 8, "new_cases": 4557, "incidence": 11, "new_dead": 86, "incidence_dead": 0.2 }, + { "month": 9, "new_cases": 3794, "incidence": 9, "new_dead": 57, "incidence_dead": 0.1 }, + { "month": 10, "new_cases": 15040, "incidence": 37, "new_dead": 139, "incidence_dead": 0.3 }, + { "month": 11, "new_cases": 65907, "incidence": 163, "new_dead": 662, "incidence_dead": 1.6 }, + ], + maxCases: 65907 + }, + { + "name": "Bahamas", "continent": "North America", "alpha2": "bs", "population": 393248, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 13, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, + { "month": 4, "new_cases": 67, "incidence": 4, "new_dead": 10, "incidence_dead": 0.6 }, + { "month": 5, "new_cases": 21, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, + { "month": 6, "new_cases": 2, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 7, "new_cases": 470, "incidence": 30, "new_dead": 3, "incidence_dead": 0.2 }, + { "month": 8, "new_cases": 1643, "incidence": 104, "new_dead": 36, "incidence_dead": 2.3 }, + { "month": 9, "new_cases": 1906, "incidence": 121, "new_dead": 46, "incidence_dead": 2.9 }, + { "month": 10, "new_cases": 2591, "incidence": 165, "new_dead": 48, "incidence_dead": 3.1 }, + { "month": 11, "new_cases": 827, "incidence": 53, "new_dead": 19, "incidence_dead": 1.2 }, + ], + maxCases: 2591 + }, + { + "name": "Bahrain", "continent": "Asia", "alpha2": "bh", "population": 1701583, "months": [ + { "month": 2, "new_cases": 40, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 526, "incidence": 8, "new_dead": 3, "incidence_dead": 0 }, + { "month": 4, "new_cases": 2473, "incidence": 36, "new_dead": 4, "incidence_dead": 0.1 }, + { "month": 5, "new_cases": 8358, "incidence": 123, "new_dead": 11, "incidence_dead": 0.2 }, + { "month": 6, "new_cases": 15360, "incidence": 226, "new_dead": 68, "incidence_dead": 1 }, + { "month": 7, "new_cases": 14224, "incidence": 209, "new_dead": 60, "incidence_dead": 0.9 }, + { "month": 8, "new_cases": 10990, "incidence": 161, "new_dead": 43, "incidence_dead": 0.6 }, + { "month": 9, "new_cases": 18892, "incidence": 278, "new_dead": 61, "incidence_dead": 0.9 }, + { "month": 10, "new_cases": 10781, "incidence": 158, "new_dead": 70, "incidence_dead": 1 }, + { "month": 11, "new_cases": 5311, "incidence": 78, "new_dead": 20, "incidence_dead": 0.3 }, + ], + maxCases: 18892 + }, + { + "name": "Bangladesh", "continent": "Asia", "alpha2": "bd", "population": 164689383, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 48, "incidence": 0, "new_dead": 4, "incidence_dead": 0 }, + { "month": 4, "new_cases": 7616, "incidence": 1, "new_dead": 163, "incidence_dead": 0 }, + { "month": 5, "new_cases": 39486, "incidence": 6, "new_dead": 482, "incidence_dead": 0.1 }, + { "month": 6, "new_cases": 98330, "incidence": 15, "new_dead": 1197, "incidence_dead": 0.2 }, + { "month": 7, "new_cases": 92178, "incidence": 14, "new_dead": 1264, "incidence_dead": 0.2 }, + { "month": 8, "new_cases": 75335, "incidence": 11, "new_dead": 1170, "incidence_dead": 0.2 }, + { "month": 9, "new_cases": 50483, "incidence": 8, "new_dead": 970, "incidence_dead": 0.1 }, + { "month": 10, "new_cases": 44205, "incidence": 7, "new_dead": 672, "incidence_dead": 0.1 }, + { "month": 11, "new_cases": 57248, "incidence": 9, "new_dead": 721, "incidence_dead": 0.1 }, + ], + maxCases: 98330 + }, + { + "name": "Barbados", "continent": "North America", "alpha2": "bb", "population": 287371, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 32, "incidence": 3, "new_dead": 0, "incidence_dead": 0 }, + { "month": 4, "new_cases": 47, "incidence": 4, "new_dead": 6, "incidence_dead": 0.5 }, + { "month": 5, "new_cases": 11, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, + { "month": 6, "new_cases": 5, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 7, "new_cases": 13, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, + { "month": 8, "new_cases": 64, "incidence": 6, "new_dead": 0, "incidence_dead": 0 }, + { "month": 9, "new_cases": 16, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, + { "month": 10, "new_cases": 47, "incidence": 4, "new_dead": 0, "incidence_dead": 0 }, + { "month": 11, "new_cases": 39, "incidence": 3, "new_dead": 0, "incidence_dead": 0 }, + ], + maxCases: 64 + }, + { + "name": "Belarus", "continent": "Europe", "alpha2": "by", "population": 9449321, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 151, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 4, "new_cases": 13875, "incidence": 37, "new_dead": 88, "incidence_dead": 0.2 }, + { "month": 5, "new_cases": 28529, "incidence": 75, "new_dead": 146, "incidence_dead": 0.4 }, + { "month": 6, "new_cases": 19562, "incidence": 52, "new_dead": 157, "incidence_dead": 0.4 }, + { "month": 7, "new_cases": 5690, "incidence": 15, "new_dead": 167, "incidence_dead": 0.4 }, + { "month": 8, "new_cases": 4035, "incidence": 11, "new_dead": 122, "incidence_dead": 0.3 }, + { "month": 9, "new_cases": 6788, "incidence": 18, "new_dead": 152, "incidence_dead": 0.4 }, + { "month": 10, "new_cases": 19851, "incidence": 53, "new_dead": 147, "incidence_dead": 0.4 }, + { "month": 11, "new_cases": 38165, "incidence": 101, "new_dead": 178, "incidence_dead": 0.5 }, + ], + maxCases: 38165 + }, + { + "name": "Belgium", "continent": "Europe", "alpha2": "be", "population": 11589616, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 12774, "incidence": 28, "new_dead": 702, "incidence_dead": 1.5 }, + { "month": 4, "new_cases": 35744, "incidence": 77, "new_dead": 6889, "incidence_dead": 14.9 }, + { "month": 5, "new_cases": 9862, "incidence": 21, "new_dead": 1873, "incidence_dead": 4 }, + { "month": 6, "new_cases": 3046, "incidence": 7, "new_dead": 280, "incidence_dead": 0.6 }, + { "month": 7, "new_cases": 7324, "incidence": 16, "new_dead": 94, "incidence_dead": 0.2 }, + { "month": 8, "new_cases": 16485, "incidence": 36, "new_dead": 54, "incidence_dead": 0.1 }, + { "month": 9, "new_cases": 33216, "incidence": 72, "new_dead": 121, "incidence_dead": 0.3 }, + { "month": 10, "new_cases": 310777, "incidence": 670, "new_dead": 1609, "incidence_dead": 3.5 }, + { "month": 11, "new_cases": 148116, "incidence": 320, "new_dead": 5020, "incidence_dead": 10.8 }, + ], + maxCases: 310777 + }, + { + "name": "Belize", "continent": "North America", "alpha2": "bz", "population": 397621, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 2, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 4, "new_cases": 15, "incidence": 1, "new_dead": 1, "incidence_dead": 0.1 }, + { "month": 5, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 6, "new_cases": 6, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 7, "new_cases": 24, "incidence": 2, "new_dead": 0, "incidence_dead": 0 }, + { "month": 8, "new_cases": 959, "incidence": 60, "new_dead": 11, "incidence_dead": 0.7 }, + { "month": 9, "new_cases": 985, "incidence": 62, "new_dead": 14, "incidence_dead": 0.9 }, + { "month": 10, "new_cases": 1495, "incidence": 94, "new_dead": 32, "incidence_dead": 2 }, + { "month": 11, "new_cases": 2367, "incidence": 149, "new_dead": 89, "incidence_dead": 5.6 }, + ], + maxCases: 2367 + }, + { + "name": "Benin", "continent": "Africa", "alpha2": "bj", "population": 12123198, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 8, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 4, "new_cases": 55, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 5, "new_cases": 168, "incidence": 0, "new_dead": 2, "incidence_dead": 0 }, + { "month": 6, "new_cases": 967, "incidence": 2, "new_dead": 18, "incidence_dead": 0 }, + { "month": 7, "new_cases": 606, "incidence": 1, "new_dead": 15, "incidence_dead": 0 }, + { "month": 8, "new_cases": 340, "incidence": 1, "new_dead": 4, "incidence_dead": 0 }, + { "month": 9, "new_cases": 212, "incidence": 0, "new_dead": 1, "incidence_dead": 0 }, + { "month": 10, "new_cases": 286, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, + { "month": 11, "new_cases": 372, "incidence": 1, "new_dead": 2, "incidence_dead": 0 }, + ], + maxCases: 967 + }, + { + "name": "Bhutan", "continent": "Asia", "alpha2": "bt", "population": 771612, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 3, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 4, "new_cases": 3, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 5, "new_cases": 36, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, + { "month": 6, "new_cases": 34, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, + { "month": 7, "new_cases": 24, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, + { "month": 8, "new_cases": 124, "incidence": 4, "new_dead": 0, "incidence_dead": 0 }, + { "month": 9, "new_cases": 57, "incidence": 2, "new_dead": 0, "incidence_dead": 0 }, + { "month": 10, "new_cases": 67, "incidence": 2, "new_dead": 0, "incidence_dead": 0 }, + { "month": 11, "new_cases": 61, "incidence": 2, "new_dead": 0, "incidence_dead": 0 }, + ], + maxCases: 124 + }, + { + "name": "Bolivia", "continent": "South America", "alpha2": "bo", "population": 11673029, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 105, "incidence": 0, "new_dead": 5, "incidence_dead": 0 }, + { "month": 4, "new_cases": 1060, "incidence": 2, "new_dead": 56, "incidence_dead": 0.1 }, + { "month": 5, "new_cases": 8815, "incidence": 19, "new_dead": 251, "incidence_dead": 0.5 }, + { "month": 6, "new_cases": 23237, "incidence": 50, "new_dead": 810, "incidence_dead": 1.7 }, + { "month": 7, "new_cases": 43570, "incidence": 93, "new_dead": 1854, "incidence_dead": 4 }, + { "month": 8, "new_cases": 39809, "incidence": 85, "new_dead": 2050, "incidence_dead": 4.4 }, + { "month": 9, "new_cases": 18713, "incidence": 40, "new_dead": 2938, "incidence_dead": 6.3 }, + { "month": 10, "new_cases": 6446, "incidence": 14, "new_dead": 760, "incidence_dead": 1.6 }, + { "month": 11, "new_cases": 2951, "incidence": 6, "new_dead": 232, "incidence_dead": 0.5 }, + ], + maxCases: 43570 + }, + { + "name": "Bosnia and Herzegovina", "continent": "Europe", "alpha2": "ba", "population": 3280815, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 418, "incidence": 3, "new_dead": 12, "incidence_dead": 0.1 }, + { "month": 4, "new_cases": 1337, "incidence": 10, "new_dead": 56, "incidence_dead": 0.4 }, + { "month": 5, "new_cases": 753, "incidence": 6, "new_dead": 84, "incidence_dead": 0.6 }, + { "month": 6, "new_cases": 1943, "incidence": 15, "new_dead": 33, "incidence_dead": 0.3 }, + { "month": 7, "new_cases": 7423, "incidence": 57, "new_dead": 153, "incidence_dead": 1.2 }, + { "month": 8, "new_cases": 8088, "incidence": 62, "new_dead": 270, "incidence_dead": 2.1 }, + { "month": 9, "new_cases": 7505, "incidence": 57, "new_dead": 247, "incidence_dead": 1.9 }, + { "month": 10, "new_cases": 22621, "incidence": 172, "new_dead": 378, "incidence_dead": 2.9 }, + { "month": 11, "new_cases": 37811, "incidence": 288, "new_dead": 1447, "incidence_dead": 11 }, + ], + maxCases: 37811 + }, + { + "name": "Botswana", "continent": "Africa", "alpha2": "bw", "population": 2351625, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 1, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 4, "new_cases": 19, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 5, "new_cases": 12, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 6, "new_cases": 192, "incidence": 2, "new_dead": 0, "incidence_dead": 0 }, + { "month": 7, "new_cases": 577, "incidence": 6, "new_dead": 1, "incidence_dead": 0 }, + { "month": 8, "new_cases": 829, "incidence": 9, "new_dead": 4, "incidence_dead": 0 }, + { "month": 9, "new_cases": 1539, "incidence": 16, "new_dead": 10, "incidence_dead": 0.1 }, + { "month": 10, "new_cases": 3470, "incidence": 37, "new_dead": 8, "incidence_dead": 0.1 }, + { "month": 11, "new_cases": 4100, "incidence": 44, "new_dead": 10, "incidence_dead": 0.1 }, + ], + maxCases: 4100 + }, + { + "name": "Brazil", "continent": "South America", "alpha2": "br", "population": 212559409, "months": [ + { "month": 2, "new_cases": 1, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 5715, "incidence": 1, "new_dead": 200, "incidence_dead": 0 }, + { "month": 4, "new_cases": 81470, "incidence": 10, "new_dead": 5805, "incidence_dead": 0.7 }, + { "month": 5, "new_cases": 427662, "incidence": 50, "new_dead": 23308, "incidence_dead": 2.7 }, + { "month": 6, "new_cases": 887192, "incidence": 104, "new_dead": 30280, "incidence_dead": 3.6 }, + { "month": 7, "new_cases": 1260444, "incidence": 148, "new_dead": 32881, "incidence_dead": 3.9 }, + { "month": 8, "new_cases": 1245787, "incidence": 147, "new_dead": 28906, "incidence_dead": 3.4 }, + { "month": 9, "new_cases": 902663, "incidence": 106, "new_dead": 22571, "incidence_dead": 2.7 }, + { "month": 10, "new_cases": 724670, "incidence": 85, "new_dead": 15932, "incidence_dead": 1.9 }, + { "month": 11, "new_cases": 800273, "incidence": 94, "new_dead": 13236, "incidence_dead": 1.6 }, + ], + maxCases: 1260444 + }, + { + "name": "Brunei", "continent": "Asia", "alpha2": "bn", "population": 437483, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 128, "incidence": 7, "new_dead": 0, "incidence_dead": 0 }, + { "month": 4, "new_cases": 9, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, + { "month": 5, "new_cases": 3, "incidence": 0, "new_dead": 1, "incidence_dead": 0.1 }, + { "month": 6, "new_cases": 0, "incidence": 0, "new_dead": 1, "incidence_dead": 0.1 }, + { "month": 7, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 8, "new_cases": 3, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 9, "new_cases": 2, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 10, "new_cases": 2, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 11, "new_cases": 2, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + ], + maxCases: 128 + }, + { + "name": "Bulgaria", "continent": "Europe", "alpha2": "bg", "population": 6948445, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 395, "incidence": 1, "new_dead": 7, "incidence_dead": 0 }, + { "month": 4, "new_cases": 1107, "incidence": 4, "new_dead": 58, "incidence_dead": 0.2 }, + { "month": 5, "new_cases": 1007, "incidence": 4, "new_dead": 74, "incidence_dead": 0.3 }, + { "month": 6, "new_cases": 2476, "incidence": 9, "new_dead": 90, "incidence_dead": 0.3 }, + { "month": 7, "new_cases": 6701, "incidence": 24, "new_dead": 153, "incidence_dead": 0.6 }, + { "month": 8, "new_cases": 4576, "incidence": 16, "new_dead": 246, "incidence_dead": 0.9 }, + { "month": 9, "new_cases": 4567, "incidence": 16, "new_dead": 196, "incidence_dead": 0.7 }, + { "month": 10, "new_cases": 32011, "incidence": 115, "new_dead": 454, "incidence_dead": 1.6 }, + { "month": 11, "new_cases": 92456, "incidence": 333, "new_dead": 2756, "incidence_dead": 9.9 }, + ], + maxCases: 92456 + }, + { + "name": "Burkina Faso", "continent": "Africa", "alpha2": "bf", "population": 20903278, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 260, "incidence": 0, "new_dead": 13, "incidence_dead": 0 }, + { "month": 4, "new_cases": 384, "incidence": 0, "new_dead": 29, "incidence_dead": 0 }, + { "month": 5, "new_cases": 202, "incidence": 0, "new_dead": 10, "incidence_dead": 0 }, + { "month": 6, "new_cases": 115, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 7, "new_cases": 144, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 8, "new_cases": 262, "incidence": 0, "new_dead": 2, "incidence_dead": 0 }, + { "month": 9, "new_cases": 688, "incidence": 1, "new_dead": 3, "incidence_dead": 0 }, + { "month": 10, "new_cases": 444, "incidence": 1, "new_dead": 9, "incidence_dead": 0 }, + { "month": 11, "new_cases": 386, "incidence": 0, "new_dead": 1, "incidence_dead": 0 }, + ], + maxCases: 688 + }, + { + "name": "Burundi", "continent": "Africa", "alpha2": "bi", "population": 11890781, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 4, "new_cases": 9, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 5, "new_cases": 52, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 6, "new_cases": 107, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 7, "new_cases": 217, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 8, "new_cases": 58, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 9, "new_cases": 63, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 10, "new_cases": 77, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 11, "new_cases": 103, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + ], + maxCases: 217 + }, + { + "name": "Cambodia", "continent": "Asia", "alpha2": "kh", "population": 16718971, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 108, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 4, "new_cases": 13, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 5, "new_cases": 3, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 6, "new_cases": 16, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 7, "new_cases": 98, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 8, "new_cases": 35, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 9, "new_cases": 3, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 10, "new_cases": 14, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 11, "new_cases": 35, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + ], + maxCases: 108 + }, + { + "name": "Cameroon", "continent": "Africa", "alpha2": "cm", "population": 26545864, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 192, "incidence": 0, "new_dead": 5, "incidence_dead": 0 }, + { "month": 4, "new_cases": 1639, "incidence": 2, "new_dead": 55, "incidence_dead": 0.1 }, + { "month": 5, "new_cases": 4072, "incidence": 4, "new_dead": 130, "incidence_dead": 0.1 }, + { "month": 6, "new_cases": 6688, "incidence": 6, "new_dead": 122, "incidence_dead": 0.1 }, + { "month": 7, "new_cases": 4663, "incidence": 4, "new_dead": 78, "incidence_dead": 0.1 }, + { "month": 8, "new_cases": 1887, "incidence": 2, "new_dead": 20, "incidence_dead": 0 }, + { "month": 9, "new_cases": 1696, "incidence": 2, "new_dead": 7, "incidence_dead": 0 }, + { "month": 10, "new_cases": 955, "incidence": 1, "new_dead": 8, "incidence_dead": 0 }, + { "month": 11, "new_cases": 2652, "incidence": 2, "new_dead": 11, "incidence_dead": 0 }, + ], + maxCases: 6688 + }, + { + "name": "Canada", "continent": "North America", "alpha2": "ca", "population": 37742157, "months": [ + { "month": 2, "new_cases": 16, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 8507, "incidence": 6, "new_dead": 100, "incidence_dead": 0.1 }, + { "month": 4, "new_cases": 45930, "incidence": 30, "new_dead": 3209, "incidence_dead": 2.1 }, + { "month": 5, "new_cases": 38022, "incidence": 25, "new_dead": 4064, "incidence_dead": 2.7 }, + { "month": 6, "new_cases": 13618, "incidence": 9, "new_dead": 1276, "incidence_dead": 0.8 }, + { "month": 7, "new_cases": 12184, "incidence": 8, "new_dead": 330, "incidence_dead": 0.2 }, + { "month": 8, "new_cases": 12637, "incidence": 8, "new_dead": 193, "incidence_dead": 0.1 }, + { "month": 9, "new_cases": 30189, "incidence": 20, "new_dead": 173, "incidence_dead": 0.1 }, + { "month": 10, "new_cases": 76206, "incidence": 50, "new_dead": 841, "incidence_dead": 0.6 }, + { "month": 11, "new_cases": 144244, "incidence": 96, "new_dead": 1960, "incidence_dead": 1.3 }, + ], + maxCases: 144244 + }, + { + "name": "Cape Verde", "continent": "Africa", "alpha2": "cv", "population": 555988, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 5, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 4, "new_cases": 115, "incidence": 5, "new_dead": 0, "incidence_dead": 0 }, + { "month": 5, "new_cases": 314, "incidence": 14, "new_dead": 3, "incidence_dead": 0.1 }, + { "month": 6, "new_cases": 792, "incidence": 36, "new_dead": 11, "incidence_dead": 0.5 }, + { "month": 7, "new_cases": 1224, "incidence": 55, "new_dead": 8, "incidence_dead": 0.4 }, + { "month": 8, "new_cases": 1433, "incidence": 64, "new_dead": 17, "incidence_dead": 0.8 }, + { "month": 9, "new_cases": 2140, "incidence": 96, "new_dead": 20, "incidence_dead": 0.9 }, + { "month": 10, "new_cases": 2769, "incidence": 125, "new_dead": 35, "incidence_dead": 1.6 }, + { "month": 11, "new_cases": 1968, "incidence": 88, "new_dead": 10, "incidence_dead": 0.4 }, + ], + maxCases: 2769 + }, + { + "name": "Central African Republic", "continent": "Africa", "alpha2": "cf", "population": 4829764, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 2, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 4, "new_cases": 47, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 5, "new_cases": 961, "incidence": 5, "new_dead": 1, "incidence_dead": 0 }, + { "month": 6, "new_cases": 2734, "incidence": 14, "new_dead": 45, "incidence_dead": 0.2 }, + { "month": 7, "new_cases": 863, "incidence": 4, "new_dead": 12, "incidence_dead": 0.1 }, + { "month": 8, "new_cases": 103, "incidence": 1, "new_dead": 3, "incidence_dead": 0 }, + { "month": 9, "new_cases": 118, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, + { "month": 10, "new_cases": 37, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 11, "new_cases": 47, "incidence": 0, "new_dead": 1, "incidence_dead": 0 }, + ], + maxCases: 2734 + }, + { + "name": "Chad", "continent": "Africa", "alpha2": "td", "population": 16425859, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 6, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 4, "new_cases": 66, "incidence": 0, "new_dead": 3, "incidence_dead": 0 }, + { "month": 5, "new_cases": 705, "incidence": 1, "new_dead": 60, "incidence_dead": 0.1 }, + { "month": 6, "new_cases": 88, "incidence": 0, "new_dead": 9, "incidence_dead": 0 }, + { "month": 7, "new_cases": 70, "incidence": 0, "new_dead": 1, "incidence_dead": 0 }, + { "month": 8, "new_cases": 77, "incidence": 0, "new_dead": 2, "incidence_dead": 0 }, + { "month": 9, "new_cases": 187, "incidence": 0, "new_dead": 8, "incidence_dead": 0 }, + { "month": 10, "new_cases": 283, "incidence": 0, "new_dead": 13, "incidence_dead": 0 }, + { "month": 11, "new_cases": 205, "incidence": 0, "new_dead": 3, "incidence_dead": 0 }, + ], + maxCases: 705 + }, + { + "name": "Chile", "continent": "South America", "alpha2": "cl", "population": 19116209, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 2842, "incidence": 4, "new_dead": 11, "incidence_dead": 0 }, + { "month": 4, "new_cases": 14858, "incidence": 19, "new_dead": 215, "incidence_dead": 0.3 }, + { "month": 5, "new_cases": 105848, "incidence": 138, "new_dead": 827, "incidence_dead": 1.1 }, + { "month": 6, "new_cases": 155843, "incidence": 204, "new_dead": 4634, "incidence_dead": 6.1 }, + { "month": 7, "new_cases": 76274, "incidence": 100, "new_dead": 3769, "incidence_dead": 4.9 }, + { "month": 8, "new_cases": 56059, "incidence": 73, "new_dead": 1832, "incidence_dead": 2.4 }, + { "month": 9, "new_cases": 51265, "incidence": 67, "new_dead": 1452, "incidence_dead": 1.9 }, + { "month": 10, "new_cases": 47265, "incidence": 62, "new_dead": 1466, "incidence_dead": 1.9 }, + { "month": 11, "new_cases": 41487, "incidence": 54, "new_dead": 1203, "incidence_dead": 1.6 }, + ], + maxCases: 155843 + }, + { + "name": "China", "continent": "Asia", "alpha2": "cn", "population": 1439323774, "months": [ + { "month": 2, "new_cases": 69554, "incidence": 1, "new_dead": 2624, "incidence_dead": 0 }, + { "month": 3, "new_cases": 2923, "incidence": 0, "new_dead": 472, "incidence_dead": 0 }, + { "month": 4, "new_cases": 1677, "incidence": 0, "new_dead": 1328, "incidence_dead": 0 }, + { "month": 5, "new_cases": 190, "incidence": 0, "new_dead": 1, "incidence_dead": 0 }, + { "month": 6, "new_cases": 639, "incidence": 0, "new_dead": 3, "incidence_dead": 0 }, + { "month": 7, "new_cases": 2870, "incidence": 0, "new_dead": 20, "incidence_dead": 0 }, + { "month": 8, "new_cases": 2259, "incidence": 0, "new_dead": 62, "incidence_dead": 0 }, + { "month": 9, "new_cases": 631, "incidence": 0, "new_dead": 16, "incidence_dead": 0 }, + { "month": 10, "new_cases": 821, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 11, "new_cases": 1536, "incidence": 0, "new_dead": 4, "incidence_dead": 0 }, + ], + maxCases: 69554 + }, + { + "name": "Colombia", "continent": "South America", "alpha2": "co", "population": 50882884, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 905, "incidence": 0, "new_dead": 14, "incidence_dead": 0 }, + { "month": 4, "new_cases": 5601, "incidence": 3, "new_dead": 277, "incidence_dead": 0.1 }, + { "month": 5, "new_cases": 22876, "incidence": 11, "new_dead": 646, "incidence_dead": 0.3 }, + { "month": 6, "new_cases": 68463, "incidence": 34, "new_dead": 2395, "incidence_dead": 1.2 }, + { "month": 7, "new_cases": 197662, "incidence": 97, "new_dead": 6771, "incidence_dead": 3.3 }, + { "month": 8, "new_cases": 319586, "incidence": 157, "new_dead": 9557, "incidence_dead": 4.7 }, + { "month": 9, "new_cases": 214585, "incidence": 105, "new_dead": 6336, "incidence_dead": 3.1 }, + { "month": 10, "new_cases": 244505, "incidence": 120, "new_dead": 5316, "incidence_dead": 2.6 }, + { "month": 11, "new_cases": 242622, "incidence": 119, "new_dead": 5452, "incidence_dead": 2.7 }, + ], + maxCases: 319586 + }, + { + "name": "Comoros", "continent": "Africa", "alpha2": "km", "population": 869595, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 4, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 5, "new_cases": 105, "incidence": 3, "new_dead": 1, "incidence_dead": 0 }, + { "month": 6, "new_cases": 197, "incidence": 6, "new_dead": 5, "incidence_dead": 0.1 }, + { "month": 7, "new_cases": 75, "incidence": 2, "new_dead": 0, "incidence_dead": 0 }, + { "month": 8, "new_cases": 45, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, + { "month": 9, "new_cases": 56, "incidence": 2, "new_dead": 0, "incidence_dead": 0 }, + { "month": 10, "new_cases": 66, "incidence": 2, "new_dead": 0, "incidence_dead": 0 }, + { "month": 11, "new_cases": 66, "incidence": 2, "new_dead": 0, "incidence_dead": 0 }, + ], + maxCases: 197 + }, + { + "name": "Congo", "continent": "Africa", "alpha2": "cg", "population": 5518092, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 18, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 4, "new_cases": 201, "incidence": 1, "new_dead": 7, "incidence_dead": 0 }, + { "month": 5, "new_cases": 391, "incidence": 2, "new_dead": 11, "incidence_dead": 0 }, + { "month": 6, "new_cases": 476, "incidence": 2, "new_dead": 17, "incidence_dead": 0.1 }, + { "month": 7, "new_cases": 2113, "incidence": 10, "new_dead": 17, "incidence_dead": 0.1 }, + { "month": 8, "new_cases": 779, "incidence": 4, "new_dead": 24, "incidence_dead": 0.1 }, + { "month": 9, "new_cases": 1110, "incidence": 5, "new_dead": 11, "incidence_dead": 0 }, + { "month": 10, "new_cases": 201, "incidence": 1, "new_dead": 3, "incidence_dead": 0 }, + { "month": 11, "new_cases": 484, "incidence": 2, "new_dead": 2, "incidence_dead": 0 }, + ], + maxCases: 2113 + }, + { + "name": "Costa Rica", "continent": "North America", "alpha2": "cr", "population": 5094114, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 346, "incidence": 2, "new_dead": 1, "incidence_dead": 0 }, + { "month": 4, "new_cases": 372, "incidence": 2, "new_dead": 4, "incidence_dead": 0 }, + { "month": 5, "new_cases": 337, "incidence": 2, "new_dead": 4, "incidence_dead": 0 }, + { "month": 6, "new_cases": 2403, "incidence": 12, "new_dead": 6, "incidence_dead": 0 }, + { "month": 7, "new_cases": 14361, "incidence": 70, "new_dead": 134, "incidence_dead": 0.7 }, + { "month": 8, "new_cases": 23467, "incidence": 115, "new_dead": 286, "incidence_dead": 1.4 }, + { "month": 9, "new_cases": 34473, "incidence": 169, "new_dead": 468, "incidence_dead": 2.3 }, + { "month": 10, "new_cases": 34211, "incidence": 168, "new_dead": 481, "incidence_dead": 2.4 }, + { "month": 11, "new_cases": 29667, "incidence": 146, "new_dead": 341, "incidence_dead": 1.7 }, + ], + maxCases: 34473 + }, + { + "name": "Cote d'Ivoire", "continent": "Africa", "alpha2": "ci", "population": 26378275, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 178, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 4, "new_cases": 1096, "incidence": 1, "new_dead": 13, "incidence_dead": 0 }, + { "month": 5, "new_cases": 1558, "incidence": 1, "new_dead": 19, "incidence_dead": 0 }, + { "month": 6, "new_cases": 6666, "incidence": 6, "new_dead": 35, "incidence_dead": 0 }, + { "month": 7, "new_cases": 6548, "incidence": 6, "new_dead": 34, "incidence_dead": 0 }, + { "month": 8, "new_cases": 2020, "incidence": 2, "new_dead": 15, "incidence_dead": 0 }, + { "month": 9, "new_cases": 1657, "incidence": 2, "new_dead": 3, "incidence_dead": 0 }, + { "month": 10, "new_cases": 992, "incidence": 1, "new_dead": 6, "incidence_dead": 0 }, + { "month": 11, "new_cases": 615, "incidence": 1, "new_dead": 6, "incidence_dead": 0 }, + ], + maxCases: 6666 + }, + { + "name": "Croatia", "continent": "Europe", "alpha2": "hr", "population": 4105268, "months": [ + { "month": 2, "new_cases": 5, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 861, "incidence": 5, "new_dead": 5, "incidence_dead": 0 }, + { "month": 4, "new_cases": 1209, "incidence": 7, "new_dead": 63, "incidence_dead": 0.4 }, + { "month": 5, "new_cases": 170, "incidence": 1, "new_dead": 34, "incidence_dead": 0.2 }, + { "month": 6, "new_cases": 531, "incidence": 3, "new_dead": 4, "incidence_dead": 0 }, + { "month": 7, "new_cases": 2362, "incidence": 14, "new_dead": 38, "incidence_dead": 0.2 }, + { "month": 8, "new_cases": 5130, "incidence": 31, "new_dead": 41, "incidence_dead": 0.2 }, + { "month": 9, "new_cases": 6324, "incidence": 39, "new_dead": 94, "incidence_dead": 0.6 }, + { "month": 10, "new_cases": 32723, "incidence": 199, "new_dead": 266, "incidence_dead": 1.6 }, + { "month": 11, "new_cases": 79126, "incidence": 482, "new_dead": 1240, "incidence_dead": 7.6 }, + ], + maxCases: 79126 + }, + { + "name": "Cuba", "continent": "North America", "alpha2": "cu", "population": 11326616, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 183, "incidence": 0, "new_dead": 5, "incidence_dead": 0 }, + { "month": 4, "new_cases": 1315, "incidence": 3, "new_dead": 55, "incidence_dead": 0.1 }, + { "month": 5, "new_cases": 544, "incidence": 1, "new_dead": 22, "incidence_dead": 0 }, + { "month": 6, "new_cases": 296, "incidence": 1, "new_dead": 3, "incidence_dead": 0 }, + { "month": 7, "new_cases": 267, "incidence": 1, "new_dead": 1, "incidence_dead": 0 }, + { "month": 8, "new_cases": 1424, "incidence": 3, "new_dead": 7, "incidence_dead": 0 }, + { "month": 9, "new_cases": 1565, "incidence": 3, "new_dead": 28, "incidence_dead": 0.1 }, + { "month": 10, "new_cases": 1290, "incidence": 3, "new_dead": 6, "incidence_dead": 0 }, + { "month": 11, "new_cases": 1397, "incidence": 3, "new_dead": 7, "incidence_dead": 0 }, + ], + maxCases: 1565 + }, + { + "name": "Cyprus", "continent": "Europe", "alpha2": "cy", "population": 875899, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 260, "incidence": 7, "new_dead": 7, "incidence_dead": 0.2 }, + { "month": 4, "new_cases": 588, "incidence": 17, "new_dead": 7, "incidence_dead": 0.2 }, + { "month": 5, "new_cases": 94, "incidence": 3, "new_dead": 2, "incidence_dead": 0.1 }, + { "month": 6, "new_cases": 54, "incidence": 2, "new_dead": 2, "incidence_dead": 0.1 }, + { "month": 7, "new_cases": 116, "incidence": 3, "new_dead": 0, "incidence_dead": 0 }, + { "month": 8, "new_cases": 374, "incidence": 11, "new_dead": 1, "incidence_dead": 0 }, + { "month": 9, "new_cases": 267, "incidence": 8, "new_dead": 2, "incidence_dead": 0.1 }, + { "month": 10, "new_cases": 2611, "incidence": 75, "new_dead": 4, "incidence_dead": 0.1 }, + { "month": 11, "new_cases": 6199, "incidence": 177, "new_dead": 23, "incidence_dead": 0.7 }, + ], + maxCases: 6199 + }, + { + "name": "Czechia", "continent": "Europe", "alpha2": "cz", "population": 10708982, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 3305, "incidence": 8, "new_dead": 30, "incidence_dead": 0.1 }, + { "month": 4, "new_cases": 4374, "incidence": 10, "new_dead": 205, "incidence_dead": 0.5 }, + { "month": 5, "new_cases": 1586, "incidence": 4, "new_dead": 84, "incidence_dead": 0.2 }, + { "month": 6, "new_cases": 2686, "incidence": 6, "new_dead": 29, "incidence_dead": 0.1 }, + { "month": 7, "new_cases": 4620, "incidence": 11, "new_dead": 33, "incidence_dead": 0.1 }, + { "month": 8, "new_cases": 8044, "incidence": 19, "new_dead": 42, "incidence_dead": 0.1 }, + { "month": 9, "new_cases": 46145, "incidence": 108, "new_dead": 231, "incidence_dead": 0.5 }, + { "month": 10, "new_cases": 264339, "incidence": 617, "new_dead": 2596, "incidence_dead": 6.1 }, + { "month": 11, "new_cases": 188196, "incidence": 439, "new_dead": 5044, "incidence_dead": 11.8 }, + ], + maxCases: 264339 + }, + { + "name": "Democratic Republic of Congo", "continent": "Africa", "alpha2": "cd", "population": 89561404, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 97, "incidence": 0, "new_dead": 7, "incidence_dead": 0 }, + { "month": 4, "new_cases": 474, "incidence": 0, "new_dead": 23, "incidence_dead": 0 }, + { "month": 5, "new_cases": 2498, "incidence": 1, "new_dead": 41, "incidence_dead": 0 }, + { "month": 6, "new_cases": 3969, "incidence": 1, "new_dead": 98, "incidence_dead": 0 }, + { "month": 7, "new_cases": 2031, "incidence": 1, "new_dead": 45, "incidence_dead": 0 }, + { "month": 8, "new_cases": 1027, "incidence": 0, "new_dead": 43, "incidence_dead": 0 }, + { "month": 9, "new_cases": 562, "incidence": 0, "new_dead": 14, "incidence_dead": 0 }, + { "month": 10, "new_cases": 647, "incidence": 0, "new_dead": 35, "incidence_dead": 0 }, + { "month": 11, "new_cases": 1466, "incidence": 0, "new_dead": 26, "incidence_dead": 0 }, + ], + maxCases: 3969 + }, + { + "name": "Denmark", "continent": "Europe", "alpha2": "dk", "population": 5792203, "months": [ + { "month": 2, "new_cases": 2, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 3036, "incidence": 13, "new_dead": 89, "incidence_dead": 0.4 }, + { "month": 4, "new_cases": 6317, "incidence": 27, "new_dead": 362, "incidence_dead": 1.6 }, + { "month": 5, "new_cases": 2513, "incidence": 11, "new_dead": 122, "incidence_dead": 0.5 }, + { "month": 6, "new_cases": 1099, "incidence": 5, "new_dead": 31, "incidence_dead": 0.1 }, + { "month": 7, "new_cases": 1060, "incidence": 5, "new_dead": 10, "incidence_dead": 0 }, + { "month": 8, "new_cases": 3382, "incidence": 15, "new_dead": 9, "incidence_dead": 0 }, + { "month": 9, "new_cases": 11069, "incidence": 48, "new_dead": 26, "incidence_dead": 0.1 }, + { "month": 10, "new_cases": 18384, "incidence": 79, "new_dead": 71, "incidence_dead": 0.3 }, + { "month": 11, "new_cases": 34139, "incidence": 147, "new_dead": 116, "incidence_dead": 0.5 }, + ], + maxCases: 34139 + }, + { + "name": "Djibouti", "continent": "Africa", "alpha2": "dj", "population": 988002, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 29, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, + { "month": 4, "new_cases": 1059, "incidence": 27, "new_dead": 1, "incidence_dead": 0 }, + { "month": 5, "new_cases": 2265, "incidence": 57, "new_dead": 22, "incidence_dead": 0.6 }, + { "month": 6, "new_cases": 1328, "incidence": 34, "new_dead": 30, "incidence_dead": 0.8 }, + { "month": 7, "new_cases": 402, "incidence": 10, "new_dead": 4, "incidence_dead": 0.1 }, + { "month": 8, "new_cases": 303, "incidence": 8, "new_dead": 2, "incidence_dead": 0.1 }, + { "month": 9, "new_cases": 29, "incidence": 1, "new_dead": 1, "incidence_dead": 0 }, + { "month": 10, "new_cases": 145, "incidence": 4, "new_dead": 0, "incidence_dead": 0 }, + { "month": 11, "new_cases": 118, "incidence": 3, "new_dead": 0, "incidence_dead": 0 }, + ], + maxCases: 2265 + }, + { + "name": "Dominica", "continent": "North America", "alpha2": "dm", "population": 71991, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 11, "incidence": 4, "new_dead": 0, "incidence_dead": 0 }, + { "month": 4, "new_cases": 4, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, + { "month": 5, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 6, "new_cases": 2, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, + { "month": 7, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 8, "new_cases": 2, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, + { "month": 9, "new_cases": 10, "incidence": 3, "new_dead": 0, "incidence_dead": 0 }, + { "month": 10, "new_cases": 20, "incidence": 7, "new_dead": 0, "incidence_dead": 0 }, + { "month": 11, "new_cases": 35, "incidence": 12, "new_dead": 0, "incidence_dead": 0 }, + ], + maxCases: 35 + }, + { + "name": "Dominican Republic", "continent": "North America", "alpha2": "do", "population": 10847904, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 1108, "incidence": 3, "new_dead": 50, "incidence_dead": 0.1 }, + { "month": 4, "new_cases": 5863, "incidence": 14, "new_dead": 250, "incidence_dead": 0.6 }, + { "month": 5, "new_cases": 10313, "incidence": 24, "new_dead": 201, "incidence_dead": 0.5 }, + { "month": 6, "new_cases": 15283, "incidence": 35, "new_dead": 245, "incidence_dead": 0.6 }, + { "month": 7, "new_cases": 37081, "incidence": 85, "new_dead": 413, "incidence_dead": 1 }, + { "month": 8, "new_cases": 25066, "incidence": 58, "new_dead": 550, "incidence_dead": 1.3 }, + { "month": 9, "new_cases": 17494, "incidence": 40, "new_dead": 395, "incidence_dead": 0.9 }, + { "month": 10, "new_cases": 14809, "incidence": 34, "new_dead": 140, "incidence_dead": 0.3 }, + { "month": 11, "new_cases": 16970, "incidence": 39, "new_dead": 86, "incidence_dead": 0.2 }, + ], + maxCases: 37081 + }, + { + "name": "Ecuador", "continent": "South America", "alpha2": "ec", "population": 17643060, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 2234, "incidence": 3, "new_dead": 73, "incidence_dead": 0.1 }, + { "month": 4, "new_cases": 22694, "incidence": 32, "new_dead": 825, "incidence_dead": 1.2 }, + { "month": 5, "new_cases": 14164, "incidence": 20, "new_dead": 2458, "incidence_dead": 3.5 }, + { "month": 6, "new_cases": 17334, "incidence": 25, "new_dead": 1169, "incidence_dead": 1.7 }, + { "month": 7, "new_cases": 28923, "incidence": 41, "new_dead": 1175, "incidence_dead": 1.7 }, + { "month": 8, "new_cases": 28412, "incidence": 40, "new_dead": 854, "incidence_dead": 1.2 }, + { "month": 9, "new_cases": 23280, "incidence": 33, "new_dead": 4799, "incidence_dead": 6.8 }, + { "month": 10, "new_cases": 31145, "incidence": 44, "new_dead": 1315, "incidence_dead": 1.9 }, + { "month": 11, "new_cases": 24493, "incidence": 35, "new_dead": 791, "incidence_dead": 1.1 }, + ], + maxCases: 31145 + }, + { + "name": "Egypt", "continent": "Africa", "alpha2": "eg", "population": 102334403, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 709, "incidence": 0, "new_dead": 45, "incidence_dead": 0 }, + { "month": 4, "new_cases": 4827, "incidence": 1, "new_dead": 346, "incidence_dead": 0.1 }, + { "month": 5, "new_cases": 19448, "incidence": 5, "new_dead": 567, "incidence_dead": 0.1 }, + { "month": 6, "new_cases": 43326, "incidence": 11, "new_dead": 1994, "incidence_dead": 0.5 }, + { "month": 7, "new_cases": 25767, "incidence": 6, "new_dead": 1852, "incidence_dead": 0.5 }, + { "month": 8, "new_cases": 4861, "incidence": 1, "new_dead": 616, "incidence_dead": 0.2 }, + { "month": 9, "new_cases": 4259, "incidence": 1, "new_dead": 509, "incidence_dead": 0.1 }, + { "month": 10, "new_cases": 4357, "incidence": 1, "new_dead": 336, "incidence_dead": 0.1 }, + { "month": 11, "new_cases": 8356, "incidence": 2, "new_dead": 384, "incidence_dead": 0.1 }, + ], + maxCases: 43326 + }, + { + "name": "El Salvador", "continent": "North America", "alpha2": "sv", "population": 6486201, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 31, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 4, "new_cases": 363, "incidence": 1, "new_dead": 9, "incidence_dead": 0 }, + { "month": 5, "new_cases": 2122, "incidence": 8, "new_dead": 36, "incidence_dead": 0.1 }, + { "month": 6, "new_cases": 3921, "incidence": 15, "new_dead": 128, "incidence_dead": 0.5 }, + { "month": 7, "new_cases": 10194, "incidence": 39, "new_dead": 274, "incidence_dead": 1.1 }, + { "month": 8, "new_cases": 9097, "incidence": 35, "new_dead": 269, "incidence_dead": 1 }, + { "month": 9, "new_cases": 3348, "incidence": 13, "new_dead": 126, "incidence_dead": 0.5 }, + { "month": 10, "new_cases": 4368, "incidence": 17, "new_dead": 132, "incidence_dead": 0.5 }, + { "month": 11, "new_cases": 4960, "incidence": 19, "new_dead": 139, "incidence_dead": 0.5 }, + ], + maxCases: 10194 + }, + { + "name": "Equatorial Guinea", "continent": "Africa", "alpha2": "gq", "population": 1402985, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 11, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 4, "new_cases": 303, "incidence": 5, "new_dead": 0, "incidence_dead": 0 }, + { "month": 5, "new_cases": 991, "incidence": 18, "new_dead": 11, "incidence_dead": 0.2 }, + { "month": 6, "new_cases": 695, "incidence": 12, "new_dead": 20, "incidence_dead": 0.4 }, + { "month": 7, "new_cases": 2820, "incidence": 50, "new_dead": 51, "incidence_dead": 0.9 }, + { "month": 8, "new_cases": 120, "incidence": 2, "new_dead": 0, "incidence_dead": 0 }, + { "month": 9, "new_cases": 89, "incidence": 2, "new_dead": 0, "incidence_dead": 0 }, + { "month": 10, "new_cases": 58, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, + { "month": 11, "new_cases": 65, "incidence": 1, "new_dead": 2, "incidence_dead": 0 }, + ], + maxCases: 2820 + }, + { + "name": "Eritrea", "continent": "Africa", "alpha2": "er", "population": 3546427, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 14, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 4, "new_cases": 24, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 5, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 6, "new_cases": 164, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, + { "month": 7, "new_cases": 76, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, + { "month": 8, "new_cases": 40, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 9, "new_cases": 56, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 10, "new_cases": 88, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, + { "month": 11, "new_cases": 114, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, + ], + maxCases: 164 + }, + { + "name": "Estonia", "continent": "Europe", "alpha2": "ee", "population": 1326539, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 744, "incidence": 14, "new_dead": 3, "incidence_dead": 0.1 }, + { "month": 4, "new_cases": 944, "incidence": 18, "new_dead": 48, "incidence_dead": 0.9 }, + { "month": 5, "new_cases": 180, "incidence": 3, "new_dead": 16, "incidence_dead": 0.3 }, + { "month": 6, "new_cases": 120, "incidence": 2, "new_dead": 1, "incidence_dead": 0 }, + { "month": 7, "new_cases": 75, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, + { "month": 8, "new_cases": 311, "incidence": 6, "new_dead": -5, "incidence_dead": -0.1 }, + { "month": 9, "new_cases": 996, "incidence": 19, "new_dead": 0, "incidence_dead": 0 }, + { "month": 10, "new_cases": 1534, "incidence": 29, "new_dead": 9, "incidence_dead": 0.2 }, + { "month": 11, "new_cases": 7403, "incidence": 140, "new_dead": 45, "incidence_dead": 0.8 }, + ], + maxCases: 7403 + }, + { + "name": "Eswatini", "continent": "Africa", "alpha2": "sz", "population": 1160164, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 8, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 4, "new_cases": 91, "incidence": 2, "new_dead": 0, "incidence_dead": 0 }, + { "month": 5, "new_cases": 185, "incidence": 4, "new_dead": 1, "incidence_dead": 0 }, + { "month": 6, "new_cases": 527, "incidence": 11, "new_dead": 9, "incidence_dead": 0.2 }, + { "month": 7, "new_cases": 1836, "incidence": 40, "new_dead": 30, "incidence_dead": 0.6 }, + { "month": 8, "new_cases": 1929, "incidence": 42, "new_dead": 50, "incidence_dead": 1.1 }, + { "month": 9, "new_cases": 905, "incidence": 20, "new_dead": 18, "incidence_dead": 0.4 }, + { "month": 10, "new_cases": 435, "incidence": 9, "new_dead": 8, "incidence_dead": 0.2 }, + { "month": 11, "new_cases": 502, "incidence": 11, "new_dead": 5, "incidence_dead": 0.1 }, + ], + maxCases: 1929 + }, + { + "name": "Ethiopia", "continent": "Africa", "alpha2": "et", "population": 114963583, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 25, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 4, "new_cases": 105, "incidence": 0, "new_dead": 1, "incidence_dead": 0 }, + { "month": 5, "new_cases": 1041, "incidence": 0, "new_dead": 8, "incidence_dead": 0 }, + { "month": 6, "new_cases": 4674, "incidence": 1, "new_dead": 92, "incidence_dead": 0 }, + { "month": 7, "new_cases": 11684, "incidence": 3, "new_dead": 171, "incidence_dead": 0 }, + { "month": 8, "new_cases": 34601, "incidence": 8, "new_dead": 535, "incidence_dead": 0.1 }, + { "month": 9, "new_cases": 23237, "incidence": 5, "new_dead": 389, "incidence_dead": 0.1 }, + { "month": 10, "new_cases": 20801, "incidence": 5, "new_dead": 271, "incidence_dead": 0.1 }, + { "month": 11, "new_cases": 13905, "incidence": 3, "new_dead": 237, "incidence_dead": 0.1 }, + ], + maxCases: 34601 + }, + { + "name": "Fiji", "continent": "Oceania", "alpha2": "fj", "population": 896444, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 4, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 4, "new_cases": 13, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 5, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 6, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 7, "new_cases": 9, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 8, "new_cases": 1, "incidence": 0, "new_dead": 1, "incidence_dead": 0 }, + { "month": 9, "new_cases": 4, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 10, "new_cases": 2, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 11, "new_cases": 8, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + ], + maxCases: 13 + }, + { + "name": "Finland", "continent": "Europe", "alpha2": "fi", "population": 5540718, "months": [ + { "month": 2, "new_cases": 2, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 1415, "incidence": 6, "new_dead": 16, "incidence_dead": 0.1 }, + { "month": 4, "new_cases": 3577, "incidence": 16, "new_dead": 194, "incidence_dead": 0.9 }, + { "month": 5, "new_cases": 1864, "incidence": 8, "new_dead": 109, "incidence_dead": 0.5 }, + { "month": 6, "new_cases": 355, "incidence": 2, "new_dead": 8, "incidence_dead": 0 }, + { "month": 7, "new_cases": 218, "incidence": 1, "new_dead": 1, "incidence_dead": 0 }, + { "month": 8, "new_cases": 654, "incidence": 3, "new_dead": 7, "incidence_dead": 0 }, + { "month": 9, "new_cases": 1906, "incidence": 9, "new_dead": 8, "incidence_dead": 0 }, + { "month": 10, "new_cases": 6121, "incidence": 28, "new_dead": 14, "incidence_dead": 0.1 }, + { "month": 11, "new_cases": 8799, "incidence": 40, "new_dead": 41, "incidence_dead": 0.2 }, + ], + maxCases: 8799 + }, + { + "name": "France", "continent": "Europe", "alpha2": "fr", "population": 65273512, "months": [ + { "month": 2, "new_cases": 95, "incidence": 0, "new_dead": 1, "incidence_dead": 0 }, + { "month": 3, "new_cases": 52178, "incidence": 20, "new_dead": 3524, "incidence_dead": 1.3 }, + { "month": 4, "new_cases": 116583, "incidence": 45, "new_dead": 20823, "incidence_dead": 8 }, + { "month": 5, "new_cases": 22114, "incidence": 8, "new_dead": 4456, "incidence_dead": 1.7 }, + { "month": 6, "new_cases": 13269, "incidence": 5, "new_dead": 1041, "incidence_dead": 0.4 }, + { "month": 7, "new_cases": 22995, "incidence": 9, "new_dead": 422, "incidence_dead": 0.2 }, + { "month": 8, "new_cases": 93921, "incidence": 36, "new_dead": 378, "incidence_dead": 0.1 }, + { "month": 9, "new_cases": 284733, "incidence": 109, "new_dead": 1332, "incidence_dead": 0.5 }, + { "month": 10, "new_cases": 808471, "incidence": 310, "new_dead": 4849, "incidence_dead": 1.9 }, + { "month": 11, "new_cases": 862510, "incidence": 330, "new_dead": 15992, "incidence_dead": 6.1 }, + ], + maxCases: 862510 + }, + { + "name": "Gabon", "continent": "Africa", "alpha2": "ga", "population": 2225728, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 15, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 4, "new_cases": 260, "incidence": 3, "new_dead": 2, "incidence_dead": 0 }, + { "month": 5, "new_cases": 2379, "incidence": 27, "new_dead": 14, "incidence_dead": 0.2 }, + { "month": 6, "new_cases": 2739, "incidence": 31, "new_dead": 25, "incidence_dead": 0.3 }, + { "month": 7, "new_cases": 1958, "incidence": 22, "new_dead": 7, "incidence_dead": 0.1 }, + { "month": 8, "new_cases": 1181, "incidence": 13, "new_dead": 4, "incidence_dead": 0 }, + { "month": 9, "new_cases": 233, "incidence": 3, "new_dead": 1, "incidence_dead": 0 }, + { "month": 10, "new_cases": 202, "incidence": 2, "new_dead": 1, "incidence_dead": 0 }, + { "month": 11, "new_cases": 246, "incidence": 3, "new_dead": 5, "incidence_dead": 0.1 }, + ], + maxCases: 2739 + }, + { + "name": "Gambia", "continent": "Africa", "alpha2": "gm", "population": 2416664, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 3, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 4, "new_cases": 7, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 5, "new_cases": 14, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 6, "new_cases": 24, "incidence": 0, "new_dead": 1, "incidence_dead": 0 }, + { "month": 7, "new_cases": 449, "incidence": 5, "new_dead": 7, "incidence_dead": 0.1 }, + { "month": 8, "new_cases": 2465, "incidence": 26, "new_dead": 87, "incidence_dead": 0.9 }, + { "month": 9, "new_cases": 616, "incidence": 6, "new_dead": 16, "incidence_dead": 0.2 }, + { "month": 10, "new_cases": 93, "incidence": 1, "new_dead": 7, "incidence_dead": 0.1 }, + { "month": 11, "new_cases": 70, "incidence": 1, "new_dead": 4, "incidence_dead": 0 }, + ], + maxCases: 2465 + }, + { + "name": "Georgia", "continent": "Asia", "alpha2": "ge", "population": 3989175, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 109, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, + { "month": 4, "new_cases": 429, "incidence": 3, "new_dead": 5, "incidence_dead": 0 }, + { "month": 5, "new_cases": 244, "incidence": 2, "new_dead": 6, "incidence_dead": 0 }, + { "month": 6, "new_cases": 145, "incidence": 1, "new_dead": 3, "incidence_dead": 0 }, + { "month": 7, "new_cases": 240, "incidence": 2, "new_dead": 2, "incidence_dead": 0 }, + { "month": 8, "new_cases": 319, "incidence": 2, "new_dead": 2, "incidence_dead": 0 }, + { "month": 9, "new_cases": 4705, "incidence": 29, "new_dead": 20, "incidence_dead": 0.1 }, + { "month": 10, "new_cases": 32744, "incidence": 205, "new_dead": 268, "incidence_dead": 1.7 }, + { "month": 11, "new_cases": 96648, "incidence": 606, "new_dead": 960, "incidence_dead": 6 }, + ], + maxCases: 96648 + }, + { + "name": "Germany", "continent": "Europe", "alpha2": "de", "population": 83783945, "months": [ + { "month": 2, "new_cases": 74, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 71729, "incidence": 21, "new_dead": 773, "incidence_dead": 0.2 }, + { "month": 4, "new_cases": 91201, "incidence": 27, "new_dead": 5848, "incidence_dead": 1.7 }, + { "month": 5, "new_cases": 20401, "incidence": 6, "new_dead": 1917, "incidence_dead": 0.6 }, + { "month": 6, "new_cases": 12008, "incidence": 4, "new_dead": 450, "incidence_dead": 0.1 }, + { "month": 7, "new_cases": 14981, "incidence": 4, "new_dead": 157, "incidence_dead": 0 }, + { "month": 8, "new_cases": 34403, "incidence": 10, "new_dead": 156, "incidence_dead": 0 }, + { "month": 9, "new_cases": 48111, "incidence": 14, "new_dead": 192, "incidence_dead": 0.1 }, + { "month": 10, "new_cases": 238877, "incidence": 71, "new_dead": 988, "incidence_dead": 0.3 }, + { "month": 11, "new_cases": 538122, "incidence": 161, "new_dead": 6211, "incidence_dead": 1.9 }, + ], + maxCases: 538122 + }, + { + "name": "Ghana", "continent": "Africa", "alpha2": "gh", "population": 31072945, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 158, "incidence": 0, "new_dead": 4, "incidence_dead": 0 }, + { "month": 4, "new_cases": 1913, "incidence": 2, "new_dead": 12, "incidence_dead": 0 }, + { "month": 5, "new_cases": 5996, "incidence": 5, "new_dead": 19, "incidence_dead": 0 }, + { "month": 6, "new_cases": 9671, "incidence": 8, "new_dead": 76, "incidence_dead": 0.1 }, + { "month": 7, "new_cases": 17760, "incidence": 14, "new_dead": 70, "incidence_dead": 0.1 }, + { "month": 8, "new_cases": 8797, "incidence": 7, "new_dead": 94, "incidence_dead": 0.1 }, + { "month": 9, "new_cases": 2328, "incidence": 2, "new_dead": 25, "incidence_dead": 0 }, + { "month": 10, "new_cases": 1429, "incidence": 1, "new_dead": 19, "incidence_dead": 0 }, + { "month": 11, "new_cases": 3612, "incidence": 3, "new_dead": 3, "incidence_dead": 0 }, + ], + maxCases: 17760 + }, + { + "name": "Greece", "continent": "Europe", "alpha2": "gr", "population": 10423056, "months": [ + { "month": 2, "new_cases": 3, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 1310, "incidence": 3, "new_dead": 48, "incidence_dead": 0.1 }, + { "month": 4, "new_cases": 1277, "incidence": 3, "new_dead": 91, "incidence_dead": 0.2 }, + { "month": 5, "new_cases": 326, "incidence": 1, "new_dead": 35, "incidence_dead": 0.1 }, + { "month": 6, "new_cases": 492, "incidence": 1, "new_dead": 17, "incidence_dead": 0 }, + { "month": 7, "new_cases": 1068, "incidence": 3, "new_dead": 14, "incidence_dead": 0 }, + { "month": 8, "new_cases": 5840, "incidence": 14, "new_dead": 60, "incidence_dead": 0.1 }, + { "month": 9, "new_cases": 8158, "incidence": 20, "new_dead": 125, "incidence_dead": 0.3 }, + { "month": 10, "new_cases": 20776, "incidence": 50, "new_dead": 235, "incidence_dead": 0.6 }, + { "month": 11, "new_cases": 66020, "incidence": 158, "new_dead": 1780, "incidence_dead": 4.3 }, + ], + maxCases: 66020 + }, + { + "name": "Grenada", "continent": "North America", "alpha2": "gd", "population": 112519, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 8, "incidence": 2, "new_dead": 0, "incidence_dead": 0 }, + { "month": 4, "new_cases": 11, "incidence": 2, "new_dead": 0, "incidence_dead": 0 }, + { "month": 5, "new_cases": 3, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, + { "month": 6, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 7, "new_cases": 1, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 8, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 9, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 10, "new_cases": 4, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, + { "month": 11, "new_cases": 13, "incidence": 3, "new_dead": 0, "incidence_dead": 0 }, + ], + maxCases: 13 + }, + { + "name": "Guatemala", "continent": "North America", "alpha2": "gt", "population": 17915567, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 37, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 4, "new_cases": 561, "incidence": 1, "new_dead": 15, "incidence_dead": 0 }, + { "month": 5, "new_cases": 4488, "incidence": 6, "new_dead": 92, "incidence_dead": 0.1 }, + { "month": 6, "new_cases": 13009, "incidence": 18, "new_dead": 665, "incidence_dead": 0.9 }, + { "month": 7, "new_cases": 31693, "incidence": 44, "new_dead": 1151, "incidence_dead": 1.6 }, + { "month": 8, "new_cases": 24285, "incidence": 34, "new_dead": 836, "incidence_dead": 1.2 }, + { "month": 9, "new_cases": 17672, "incidence": 25, "new_dead": 486, "incidence_dead": 0.7 }, + { "month": 10, "new_cases": 16193, "incidence": 23, "new_dead": 483, "incidence_dead": 0.7 }, + { "month": 11, "new_cases": 14123, "incidence": 20, "new_dead": 442, "incidence_dead": 0.6 }, + ], + maxCases: 31693 + }, + { + "name": "Guinea", "continent": "Africa", "alpha2": "gn", "population": 13132792, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 21, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 4, "new_cases": 1473, "incidence": 3, "new_dead": 6, "incidence_dead": 0 }, + { "month": 5, "new_cases": 2211, "incidence": 4, "new_dead": 16, "incidence_dead": 0 }, + { "month": 6, "new_cases": 1685, "incidence": 3, "new_dead": 10, "incidence_dead": 0 }, + { "month": 7, "new_cases": 1917, "incidence": 4, "new_dead": 13, "incidence_dead": 0 }, + { "month": 8, "new_cases": 2101, "incidence": 4, "new_dead": 13, "incidence_dead": 0 }, + { "month": 9, "new_cases": 1243, "incidence": 2, "new_dead": 7, "incidence_dead": 0 }, + { "month": 10, "new_cases": 1420, "incidence": 3, "new_dead": 6, "incidence_dead": 0 }, + { "month": 11, "new_cases": 1047, "incidence": 2, "new_dead": 4, "incidence_dead": 0 }, + ], + maxCases: 2211 + }, + { + "name": "Guinea-Bissau", "continent": "Africa", "alpha2": "gw", "population": 1967998, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 6, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 4, "new_cases": 197, "incidence": 3, "new_dead": 0, "incidence_dead": 0 }, + { "month": 5, "new_cases": 1051, "incidence": 13, "new_dead": 7, "incidence_dead": 0.1 }, + { "month": 6, "new_cases": 398, "incidence": 5, "new_dead": 16, "incidence_dead": 0.2 }, + { "month": 7, "new_cases": 327, "incidence": 4, "new_dead": 2, "incidence_dead": 0 }, + { "month": 8, "new_cases": 224, "incidence": 3, "new_dead": 8, "incidence_dead": 0.1 }, + { "month": 9, "new_cases": 119, "incidence": 2, "new_dead": 5, "incidence_dead": 0.1 }, + { "month": 10, "new_cases": 89, "incidence": 1, "new_dead": 2, "incidence_dead": 0 }, + { "month": 11, "new_cases": 28, "incidence": 0, "new_dead": 3, "incidence_dead": 0 }, + ], + maxCases: 1051 + }, + { + "name": "Guyana", "continent": "South America", "alpha2": "gy", "population": 786559, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 11, "incidence": 0, "new_dead": 1, "incidence_dead": 0 }, + { "month": 4, "new_cases": 70, "incidence": 2, "new_dead": 7, "incidence_dead": 0.2 }, + { "month": 5, "new_cases": 71, "incidence": 2, "new_dead": 3, "incidence_dead": 0.1 }, + { "month": 6, "new_cases": 92, "incidence": 3, "new_dead": 0, "incidence_dead": 0 }, + { "month": 7, "new_cases": 168, "incidence": 5, "new_dead": 8, "incidence_dead": 0.3 }, + { "month": 8, "new_cases": 893, "incidence": 28, "new_dead": 19, "incidence_dead": 0.6 }, + { "month": 9, "new_cases": 1588, "incidence": 50, "new_dead": 41, "incidence_dead": 1.3 }, + { "month": 10, "new_cases": 1268, "incidence": 40, "new_dead": 44, "incidence_dead": 1.4 }, + { "month": 11, "new_cases": 1244, "incidence": 40, "new_dead": 27, "incidence_dead": 0.9 }, + ], + maxCases: 1588 + }, + { + "name": "Haiti", "continent": "North America", "alpha2": "ht", "population": 11402533, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 13, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 4, "new_cases": 66, "incidence": 0, "new_dead": 7, "incidence_dead": 0 }, + { "month": 5, "new_cases": 2043, "incidence": 4, "new_dead": 36, "incidence_dead": 0.1 }, + { "month": 6, "new_cases": 3851, "incidence": 8, "new_dead": 61, "incidence_dead": 0.1 }, + { "month": 7, "new_cases": 1449, "incidence": 3, "new_dead": 56, "incidence_dead": 0.1 }, + { "month": 8, "new_cases": 800, "incidence": 2, "new_dead": 40, "incidence_dead": 0.1 }, + { "month": 9, "new_cases": 542, "incidence": 1, "new_dead": 28, "incidence_dead": 0.1 }, + { "month": 10, "new_cases": 291, "incidence": 1, "new_dead": 3, "incidence_dead": 0 }, + { "month": 11, "new_cases": 237, "incidence": 1, "new_dead": 1, "incidence_dead": 0 }, + ], + maxCases: 3851 + }, + { + "name": "Honduras", "continent": "North America", "alpha2": "hn", "population": 9904608, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 139, "incidence": 0, "new_dead": 6, "incidence_dead": 0 }, + { "month": 4, "new_cases": 630, "incidence": 2, "new_dead": 64, "incidence_dead": 0.2 }, + { "month": 5, "new_cases": 4431, "incidence": 11, "new_dead": 141, "incidence_dead": 0.4 }, + { "month": 6, "new_cases": 14356, "incidence": 36, "new_dead": 285, "incidence_dead": 0.7 }, + { "month": 7, "new_cases": 22456, "incidence": 57, "new_dead": 840, "incidence_dead": 2.1 }, + { "month": 8, "new_cases": 19000, "incidence": 48, "new_dead": 536, "incidence_dead": 1.4 }, + { "month": 9, "new_cases": 15886, "incidence": 40, "new_dead": 480, "incidence_dead": 1.2 }, + { "month": 10, "new_cases": 19988, "incidence": 50, "new_dead": 316, "incidence_dead": 0.8 }, + { "month": 11, "new_cases": 11365, "incidence": 29, "new_dead": 249, "incidence_dead": 0.6 }, + ], + maxCases: 22456 + }, + { + "name": "Hungary", "continent": "Europe", "alpha2": "hu", "population": 9660350, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 490, "incidence": 1, "new_dead": 15, "incidence_dead": 0 }, + { "month": 4, "new_cases": 2283, "incidence": 6, "new_dead": 296, "incidence_dead": 0.8 }, + { "month": 5, "new_cases": 1101, "incidence": 3, "new_dead": 214, "incidence_dead": 0.6 }, + { "month": 6, "new_cases": 279, "incidence": 1, "new_dead": 59, "incidence_dead": 0.2 }, + { "month": 7, "new_cases": 350, "incidence": 1, "new_dead": 11, "incidence_dead": 0 }, + { "month": 8, "new_cases": 1634, "incidence": 4, "new_dead": 19, "incidence_dead": 0 }, + { "month": 9, "new_cases": 20322, "incidence": 53, "new_dead": 150, "incidence_dead": 0.4 }, + { "month": 10, "new_cases": 48860, "incidence": 126, "new_dead": 985, "incidence_dead": 2.5 }, + { "month": 11, "new_cases": 141801, "incidence": 367, "new_dead": 3073, "incidence_dead": 8 }, + ], + maxCases: 141801 + }, + { + "name": "Iceland", "continent": "Europe", "alpha2": "is", "population": 341250, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 1134, "incidence": 83, "new_dead": 1, "incidence_dead": 0.1 }, + { "month": 4, "new_cases": 662, "incidence": 48, "new_dead": 8, "incidence_dead": 0.6 }, + { "month": 5, "new_cases": 9, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, + { "month": 6, "new_cases": 18, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, + { "month": 7, "new_cases": 61, "incidence": 4, "new_dead": 0, "incidence_dead": 0 }, + { "month": 8, "new_cases": 222, "incidence": 16, "new_dead": 0, "incidence_dead": 0 }, + { "month": 9, "new_cases": 621, "incidence": 45, "new_dead": 0, "incidence_dead": 0 }, + { "month": 10, "new_cases": 2137, "incidence": 157, "new_dead": 2, "incidence_dead": 0.1 }, + { "month": 11, "new_cases": 527, "incidence": 39, "new_dead": 14, "incidence_dead": 1 }, + ], + maxCases: 2137 + }, + { + "name": "India", "continent": "Asia", "alpha2": "in", "population": 1380004385, "months": [ + { "month": 2, "new_cases": 2, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 1394, "incidence": 0, "new_dead": 34, "incidence_dead": 0 }, + { "month": 4, "new_cases": 33466, "incidence": 1, "new_dead": 1119, "incidence_dead": 0 }, + { "month": 5, "new_cases": 155746, "incidence": 3, "new_dead": 4254, "incidence_dead": 0.1 }, + { "month": 6, "new_cases": 394872, "incidence": 7, "new_dead": 11992, "incidence_dead": 0.2 }, + { "month": 7, "new_cases": 1110507, "incidence": 20, "new_dead": 19111, "incidence_dead": 0.3 }, + { "month": 8, "new_cases": 1995178, "incidence": 36, "new_dead": 28777, "incidence_dead": 0.5 }, + { "month": 9, "new_cases": 2621418, "incidence": 47, "new_dead": 33390, "incidence_dead": 0.6 }, + { "month": 10, "new_cases": 1871498, "incidence": 34, "new_dead": 23433, "incidence_dead": 0.4 }, + { "month": 11, "new_cases": 1278727, "incidence": 23, "new_dead": 15510, "incidence_dead": 0.3 }, + ], + maxCases: 2621418 + }, + { + "name": "Indonesia", "continent": "Asia", "alpha2": "id", "population": 273523621, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 1526, "incidence": 0, "new_dead": 135, "incidence_dead": 0 }, + { "month": 4, "new_cases": 8590, "incidence": 1, "new_dead": 656, "incidence_dead": 0.1 }, + { "month": 5, "new_cases": 16355, "incidence": 1, "new_dead": 821, "incidence_dead": 0.1 }, + { "month": 6, "new_cases": 29912, "incidence": 3, "new_dead": 1263, "incidence_dead": 0.1 }, + { "month": 7, "new_cases": 51991, "incidence": 5, "new_dead": 2255, "incidence_dead": 0.2 }, + { "month": 8, "new_cases": 66420, "incidence": 6, "new_dead": 2286, "incidence_dead": 0.2 }, + { "month": 9, "new_cases": 112212, "incidence": 10, "new_dead": 3323, "incidence_dead": 0.3 }, + { "month": 10, "new_cases": 123080, "incidence": 11, "new_dead": 3129, "incidence_dead": 0.3 }, + { "month": 11, "new_cases": 128795, "incidence": 12, "new_dead": 3076, "incidence_dead": 0.3 }, + ], + maxCases: 128795 + }, + { + "name": "Iraq", "continent": "Asia", "alpha2": "iq", "population": 40222503, "months": [ + { "month": 2, "new_cases": 12, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 681, "incidence": 0, "new_dead": 48, "incidence_dead": 0 }, + { "month": 4, "new_cases": 1391, "incidence": 1, "new_dead": 43, "incidence_dead": 0 }, + { "month": 5, "new_cases": 4354, "incidence": 3, "new_dead": 112, "incidence_dead": 0.1 }, + { "month": 6, "new_cases": 42670, "incidence": 27, "new_dead": 1738, "incidence_dead": 1.1 }, + { "month": 7, "new_cases": 75500, "incidence": 47, "new_dead": 2798, "incidence_dead": 1.7 }, + { "month": 8, "new_cases": 110325, "incidence": 69, "new_dead": 2301, "incidence_dead": 1.4 }, + { "month": 9, "new_cases": 128047, "incidence": 80, "new_dead": 2139, "incidence_dead": 1.3 }, + { "month": 10, "new_cases": 109649, "incidence": 68, "new_dead": 1729, "incidence_dead": 1.1 }, + { "month": 11, "new_cases": 79919, "incidence": 50, "new_dead": 1348, "incidence_dead": 0.8 }, + ], + maxCases: 128047 + }, + { + "name": "Ireland", "continent": "Europe", "alpha2": "ie", "population": 4937796, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 3234, "incidence": 16, "new_dead": 70, "incidence_dead": 0.4 }, + { "month": 4, "new_cases": 17377, "incidence": 88, "new_dead": 1161, "incidence_dead": 5.9 }, + { "month": 5, "new_cases": 4378, "incidence": 22, "new_dead": 420, "incidence_dead": 2.1 }, + { "month": 6, "new_cases": 483, "incidence": 2, "new_dead": 84, "incidence_dead": 0.4 }, + { "month": 7, "new_cases": 592, "incidence": 3, "new_dead": 27, "incidence_dead": 0.1 }, + { "month": 8, "new_cases": 2746, "incidence": 14, "new_dead": 14, "incidence_dead": 0.1 }, + { "month": 9, "new_cases": 7344, "incidence": 37, "new_dead": 27, "incidence_dead": 0.1 }, + { "month": 10, "new_cases": 25301, "incidence": 128, "new_dead": 109, "incidence_dead": 0.6 }, + { "month": 11, "new_cases": 11088, "incidence": 56, "new_dead": 140, "incidence_dead": 0.7 }, + ], + maxCases: 25301 + }, + { + "name": "Israel", "continent": "Asia", "alpha2": "il", "population": 8655541, "months": [ + { "month": 2, "new_cases": 5, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 5711, "incidence": 16, "new_dead": 20, "incidence_dead": 0.1 }, + { "month": 4, "new_cases": 10179, "incidence": 29, "new_dead": 204, "incidence_dead": 0.6 }, + { "month": 5, "new_cases": 1183, "incidence": 3, "new_dead": 62, "incidence_dead": 0.2 }, + { "month": 6, "new_cases": 8359, "incidence": 24, "new_dead": 40, "incidence_dead": 0.1 }, + { "month": 7, "new_cases": 46296, "incidence": 134, "new_dead": 237, "incidence_dead": 0.7 }, + { "month": 8, "new_cases": 45172, "incidence": 130, "new_dead": 389, "incidence_dead": 1.1 }, + { "month": 9, "new_cases": 130505, "incidence": 377, "new_dead": 651, "incidence_dead": 1.9 }, + { "month": 10, "new_cases": 66938, "incidence": 193, "new_dead": 957, "incidence_dead": 2.8 }, + { "month": 11, "new_cases": 22842, "incidence": 66, "new_dead": 311, "incidence_dead": 0.9 }, + ], + maxCases: 130505 + }, + { + "name": "Italy", "continent": "Europe", "alpha2": "it", "population": 60461828, "months": [ + { "month": 2, "new_cases": 1126, "incidence": 0, "new_dead": 28, "incidence_dead": 0 }, + { "month": 3, "new_cases": 104664, "incidence": 43, "new_dead": 12399, "incidence_dead": 5.1 }, + { "month": 4, "new_cases": 99671, "incidence": 41, "new_dead": 15539, "incidence_dead": 6.4 }, + { "month": 5, "new_cases": 27534, "incidence": 11, "new_dead": 5448, "incidence_dead": 2.3 }, + { "month": 6, "new_cases": 7581, "incidence": 3, "new_dead": 1352, "incidence_dead": 0.6 }, + { "month": 7, "new_cases": 6959, "incidence": 3, "new_dead": 374, "incidence_dead": 0.2 }, + { "month": 8, "new_cases": 21677, "incidence": 9, "new_dead": 342, "incidence_dead": 0.1 }, + { "month": 9, "new_cases": 45647, "incidence": 19, "new_dead": 411, "incidence_dead": 0.2 }, + { "month": 10, "new_cases": 364569, "incidence": 151, "new_dead": 2724, "incidence_dead": 1.1 }, + { "month": 11, "new_cases": 922124, "incidence": 381, "new_dead": 16958, "incidence_dead": 7 }, + ], + maxCases: 922124 + }, + { + "name": "Jamaica", "continent": "North America", "alpha2": "jm", "population": 2961161, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 35, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 4, "new_cases": 386, "incidence": 3, "new_dead": 7, "incidence_dead": 0.1 }, + { "month": 5, "new_cases": 164, "incidence": 1, "new_dead": 1, "incidence_dead": 0 }, + { "month": 6, "new_cases": 116, "incidence": 1, "new_dead": 1, "incidence_dead": 0 }, + { "month": 7, "new_cases": 176, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, + { "month": 8, "new_cases": 1581, "incidence": 13, "new_dead": 11, "incidence_dead": 0.1 }, + { "month": 9, "new_cases": 4023, "incidence": 34, "new_dead": 86, "incidence_dead": 0.7 }, + { "month": 10, "new_cases": 2612, "incidence": 22, "new_dead": 99, "incidence_dead": 0.8 }, + { "month": 11, "new_cases": 1669, "incidence": 14, "new_dead": 51, "incidence_dead": 0.4 }, + ], + maxCases: 4023 + }, + { + "name": "Japan", "continent": "Asia", "alpha2": "jp", "population": 126476458, "months": [ + { "month": 2, "new_cases": 230, "incidence": 0, "new_dead": 5, "incidence_dead": 0 }, + { "month": 3, "new_cases": 2010, "incidence": 0, "new_dead": 61, "incidence_dead": 0 }, + { "month": 4, "new_cases": 12029, "incidence": 2, "new_dead": 414, "incidence_dead": 0.1 }, + { "month": 5, "new_cases": 2467, "incidence": 0, "new_dead": 417, "incidence_dead": 0.1 }, + { "month": 6, "new_cases": 1864, "incidence": 0, "new_dead": 74, "incidence_dead": 0 }, + { "month": 7, "new_cases": 17619, "incidence": 3, "new_dead": 36, "incidence_dead": 0 }, + { "month": 8, "new_cases": 32162, "incidence": 6, "new_dead": 290, "incidence_dead": 0.1 }, + { "month": 9, "new_cases": 15195, "incidence": 3, "new_dead": 277, "incidence_dead": 0.1 }, + { "month": 10, "new_cases": 17736, "incidence": 4, "new_dead": 194, "incidence_dead": 0 }, + { "month": 11, "new_cases": 47635, "incidence": 9, "new_dead": 307, "incidence_dead": 0.1 }, + ], + maxCases: 47635 + }, + { + "name": "Jordan", "continent": "Asia", "alpha2": "jo", "population": 10203140, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 273, "incidence": 1, "new_dead": 4, "incidence_dead": 0 }, + { "month": 4, "new_cases": 179, "incidence": 0, "new_dead": 3, "incidence_dead": 0 }, + { "month": 5, "new_cases": 286, "incidence": 1, "new_dead": 1, "incidence_dead": 0 }, + { "month": 6, "new_cases": 393, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, + { "month": 7, "new_cases": 61, "incidence": 0, "new_dead": 2, "incidence_dead": 0 }, + { "month": 8, "new_cases": 841, "incidence": 2, "new_dead": 4, "incidence_dead": 0 }, + { "month": 9, "new_cases": 9791, "incidence": 24, "new_dead": 46, "incidence_dead": 0.1 }, + { "month": 10, "new_cases": 60782, "incidence": 149, "new_dead": 768, "incidence_dead": 1.9 }, + { "month": 11, "new_cases": 146823, "incidence": 360, "new_dead": 1922, "incidence_dead": 4.7 }, + ], + maxCases: 146823 + }, + { + "name": "Kazakhstan", "continent": "Asia", "alpha2": "kz", "population": 18776707, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 339, "incidence": 0, "new_dead": 1, "incidence_dead": 0 }, + { "month": 4, "new_cases": 3059, "incidence": 4, "new_dead": 23, "incidence_dead": 0 }, + { "month": 5, "new_cases": 7456, "incidence": 10, "new_dead": 15, "incidence_dead": 0 }, + { "month": 6, "new_cases": 11450, "incidence": 15, "new_dead": 148, "incidence_dead": 0.2 }, + { "month": 7, "new_cases": 68059, "incidence": 91, "new_dead": 605, "incidence_dead": 0.8 }, + { "month": 8, "new_cases": 40306, "incidence": 54, "new_dead": 988, "incidence_dead": 1.3 }, + { "month": 9, "new_cases": 10034, "incidence": 13, "new_dead": 297, "incidence_dead": 0.4 }, + { "month": 10, "new_cases": 8992, "incidence": 12, "new_dead": 148, "incidence_dead": 0.2 }, + { "month": 11, "new_cases": 24864, "incidence": 33, "new_dead": 207, "incidence_dead": 0.3 }, + ], + maxCases: 68059 + }, + { + "name": "Kenya", "continent": "Africa", "alpha2": "ke", "population": 53771300, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 58, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 4, "new_cases": 337, "incidence": 0, "new_dead": 16, "incidence_dead": 0 }, + { "month": 5, "new_cases": 1566, "incidence": 1, "new_dead": 47, "incidence_dead": 0 }, + { "month": 6, "new_cases": 4404, "incidence": 2, "new_dead": 84, "incidence_dead": 0 }, + { "month": 7, "new_cases": 14270, "incidence": 7, "new_dead": 193, "incidence_dead": 0.1 }, + { "month": 8, "new_cases": 13565, "incidence": 6, "new_dead": 236, "incidence_dead": 0.1 }, + { "month": 9, "new_cases": 4328, "incidence": 2, "new_dead": 134, "incidence_dead": 0.1 }, + { "month": 10, "new_cases": 16663, "incidence": 8, "new_dead": 270, "incidence_dead": 0.1 }, + { "month": 11, "new_cases": 28426, "incidence": 13, "new_dead": 488, "incidence_dead": 0.2 }, + ], + maxCases: 28426 + }, + { + "name": "Kuwait", "continent": "Asia", "alpha2": "kw", "population": 4270563, "months": [ + { "month": 2, "new_cases": 44, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 244, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, + { "month": 4, "new_cases": 3735, "incidence": 22, "new_dead": 25, "incidence_dead": 0.1 }, + { "month": 5, "new_cases": 23019, "incidence": 135, "new_dead": 186, "incidence_dead": 1.1 }, + { "month": 6, "new_cases": 19152, "incidence": 112, "new_dead": 142, "incidence_dead": 0.8 }, + { "month": 7, "new_cases": 20762, "incidence": 122, "new_dead": 93, "incidence_dead": 0.5 }, + { "month": 8, "new_cases": 18152, "incidence": 106, "new_dead": 84, "incidence_dead": 0.5 }, + { "month": 9, "new_cases": 20073, "incidence": 118, "new_dead": 79, "incidence_dead": 0.5 }, + { "month": 10, "new_cases": 20744, "incidence": 121, "new_dead": 169, "incidence_dead": 1 }, + { "month": 11, "new_cases": 16709, "incidence": 98, "new_dead": 101, "incidence_dead": 0.6 }, + ], + maxCases: 23019 + }, + { + "name": "Kyrgyzstan", "continent": "Asia", "alpha2": "kg", "population": 6524191, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 104, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 4, "new_cases": 639, "incidence": 2, "new_dead": 7, "incidence_dead": 0 }, + { "month": 5, "new_cases": 1002, "incidence": 4, "new_dead": 8, "incidence_dead": 0 }, + { "month": 6, "new_cases": 3758, "incidence": 14, "new_dead": 45, "incidence_dead": 0.2 }, + { "month": 7, "new_cases": 30299, "incidence": 116, "new_dead": 1317, "incidence_dead": 5 }, + { "month": 8, "new_cases": 8093, "incidence": 31, "new_dead": -320, "incidence_dead": -1.2 }, + { "month": 9, "new_cases": 2771, "incidence": 11, "new_dead": 6, "incidence_dead": 0 }, + { "month": 10, "new_cases": 12209, "incidence": 47, "new_dead": 80, "incidence_dead": 0.3 }, + { "month": 11, "new_cases": 14300, "incidence": 55, "new_dead": 131, "incidence_dead": 0.5 }, + ], + maxCases: 30299 + }, + { + "name": "Laos", "continent": "Asia", "alpha2": "la", "population": 7275556, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 7, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 4, "new_cases": 10, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 5, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 6, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 7, "new_cases": 1, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 8, "new_cases": 2, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 9, "new_cases": 1, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 10, "new_cases": 1, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 11, "new_cases": 15, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + ], + maxCases: 15 + }, + { + "name": "Latvia", "continent": "Europe", "alpha2": "lv", "population": 1886202, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 397, "incidence": 5, "new_dead": 0, "incidence_dead": 0 }, + { "month": 4, "new_cases": 460, "incidence": 6, "new_dead": 14, "incidence_dead": 0.2 }, + { "month": 5, "new_cases": 208, "incidence": 3, "new_dead": 9, "incidence_dead": 0.1 }, + { "month": 6, "new_cases": 52, "incidence": 1, "new_dead": 6, "incidence_dead": 0.1 }, + { "month": 7, "new_cases": 113, "incidence": 1, "new_dead": 2, "incidence_dead": 0 }, + { "month": 8, "new_cases": 165, "incidence": 2, "new_dead": 2, "incidence_dead": 0 }, + { "month": 9, "new_cases": 428, "incidence": 6, "new_dead": 3, "incidence_dead": 0 }, + { "month": 10, "new_cases": 4070, "incidence": 54, "new_dead": 34, "incidence_dead": 0.5 }, + { "month": 11, "new_cases": 11181, "incidence": 148, "new_dead": 135, "incidence_dead": 1.8 }, + ], + maxCases: 11181 + }, + { + "name": "Lebanon", "continent": "Asia", "alpha2": "lb", "population": 6825442, "months": [ + { "month": 2, "new_cases": 3, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 466, "incidence": 2, "new_dead": 11, "incidence_dead": 0 }, + { "month": 4, "new_cases": 255, "incidence": 1, "new_dead": 12, "incidence_dead": 0 }, + { "month": 5, "new_cases": 495, "incidence": 2, "new_dead": 3, "incidence_dead": 0 }, + { "month": 6, "new_cases": 558, "incidence": 2, "new_dead": 7, "incidence_dead": 0 }, + { "month": 7, "new_cases": 2777, "incidence": 10, "new_dead": 27, "incidence_dead": 0.1 }, + { "month": 8, "new_cases": 12753, "incidence": 47, "new_dead": 106, "incidence_dead": 0.4 }, + { "month": 9, "new_cases": 22326, "incidence": 82, "new_dead": 200, "incidence_dead": 0.7 }, + { "month": 10, "new_cases": 41594, "incidence": 152, "new_dead": 270, "incidence_dead": 1 }, + { "month": 11, "new_cases": 46716, "incidence": 171, "new_dead": 381, "incidence_dead": 1.4 }, + ], + maxCases: 46716 + }, + { + "name": "Lesotho", "continent": "Africa", "alpha2": "ls", "population": 2142252, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 4, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 5, "new_cases": 1, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 6, "new_cases": 25, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 7, "new_cases": 577, "incidence": 7, "new_dead": 12, "incidence_dead": 0.1 }, + { "month": 8, "new_cases": 481, "incidence": 6, "new_dead": 18, "incidence_dead": 0.2 }, + { "month": 9, "new_cases": 510, "incidence": 6, "new_dead": 5, "incidence_dead": 0.1 }, + { "month": 10, "new_cases": 358, "incidence": 4, "new_dead": 8, "incidence_dead": 0.1 }, + { "month": 11, "new_cases": 156, "incidence": 2, "new_dead": 0, "incidence_dead": 0 }, + ], + maxCases: 577 + }, + { + "name": "Liberia", "continent": "Africa", "alpha2": "lr", "population": 5057677, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 2, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 4, "new_cases": 138, "incidence": 1, "new_dead": 15, "incidence_dead": 0.1 }, + { "month": 5, "new_cases": 147, "incidence": 1, "new_dead": 11, "incidence_dead": 0.1 }, + { "month": 6, "new_cases": 492, "incidence": 2, "new_dead": 9, "incidence_dead": 0 }, + { "month": 7, "new_cases": 406, "incidence": 2, "new_dead": 39, "incidence_dead": 0.2 }, + { "month": 8, "new_cases": 118, "incidence": 1, "new_dead": 7, "incidence_dead": 0 }, + { "month": 9, "new_cases": 39, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 10, "new_cases": 83, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 11, "new_cases": 169, "incidence": 1, "new_dead": 1, "incidence_dead": 0 }, + ], + maxCases: 492 + }, + { + "name": "Libya", "continent": "Africa", "alpha2": "ly", "population": 6871287, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 9, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 4, "new_cases": 51, "incidence": 0, "new_dead": 2, "incidence_dead": 0 }, + { "month": 5, "new_cases": 95, "incidence": 0, "new_dead": 2, "incidence_dead": 0 }, + { "month": 6, "new_cases": 668, "incidence": 2, "new_dead": 19, "incidence_dead": 0.1 }, + { "month": 7, "new_cases": 2797, "incidence": 10, "new_dead": 50, "incidence_dead": 0.2 }, + { "month": 8, "new_cases": 10345, "incidence": 38, "new_dead": 163, "incidence_dead": 0.6 }, + { "month": 9, "new_cases": 20559, "incidence": 75, "new_dead": 314, "incidence_dead": 1.1 }, + { "month": 10, "new_cases": 26570, "incidence": 97, "new_dead": 306, "incidence_dead": 1.1 }, + { "month": 11, "new_cases": 21714, "incidence": 79, "new_dead": 326, "incidence_dead": 1.2 }, + ], + maxCases: 26570 + }, + { + "name": "Liechtenstein", "continent": "Europe", "alpha2": "li", "population": 38137, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 67, "incidence": 44, "new_dead": 0, "incidence_dead": 0 }, + { "month": 4, "new_cases": 14, "incidence": 9, "new_dead": 0, "incidence_dead": 0 }, + { "month": 5, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 6, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 7, "new_cases": 6, "incidence": 4, "new_dead": 0, "incidence_dead": 0 }, + { "month": 8, "new_cases": 19, "incidence": 12, "new_dead": 0, "incidence_dead": 0 }, + { "month": 9, "new_cases": 11, "incidence": 7, "new_dead": 0, "incidence_dead": 0 }, + { "month": 10, "new_cases": 415, "incidence": 272, "new_dead": 2, "incidence_dead": 1.3 }, + { "month": 11, "new_cases": 737, "incidence": 483, "new_dead": 13, "incidence_dead": 8.5 }, + ], + maxCases: 737 + }, + { + "name": "Lithuania", "continent": "Europe", "alpha2": "lt", "population": 2722291, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 536, "incidence": 5, "new_dead": 7, "incidence_dead": 0.1 }, + { "month": 4, "new_cases": 848, "incidence": 8, "new_dead": 37, "incidence_dead": 0.3 }, + { "month": 5, "new_cases": 290, "incidence": 3, "new_dead": 25, "incidence_dead": 0.2 }, + { "month": 6, "new_cases": 142, "incidence": 1, "new_dead": 8, "incidence_dead": 0.1 }, + { "month": 7, "new_cases": 258, "incidence": 2, "new_dead": 2, "incidence_dead": 0 }, + { "month": 8, "new_cases": 831, "incidence": 8, "new_dead": 6, "incidence_dead": 0.1 }, + { "month": 9, "new_cases": 1787, "incidence": 16, "new_dead": 6, "incidence_dead": 0.1 }, + { "month": 10, "new_cases": 10131, "incidence": 93, "new_dead": 73, "incidence_dead": 0.7 }, + { "month": 11, "new_cases": 46501, "incidence": 427, "new_dead": 341, "incidence_dead": 3.1 }, + ], + maxCases: 46501 + }, + { + "name": "Luxembourg", "continent": "Europe", "alpha2": "lu", "population": 625976, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 2177, "incidence": 87, "new_dead": 22, "incidence_dead": 0.9 }, + { "month": 4, "new_cases": 1606, "incidence": 64, "new_dead": 67, "incidence_dead": 2.7 }, + { "month": 5, "new_cases": 234, "incidence": 9, "new_dead": 20, "incidence_dead": 0.8 }, + { "month": 6, "new_cases": 281, "incidence": 11, "new_dead": 0, "incidence_dead": 0 }, + { "month": 7, "new_cases": 2396, "incidence": 96, "new_dead": 4, "incidence_dead": 0.2 }, + { "month": 8, "new_cases": -70, "incidence": -3, "new_dead": 10, "incidence_dead": 0.4 }, + { "month": 9, "new_cases": 1884, "incidence": 75, "new_dead": 0, "incidence_dead": 0 }, + { "month": 10, "new_cases": 8625, "incidence": 344, "new_dead": 28, "incidence_dead": 1.1 }, + { "month": 11, "new_cases": 17544, "incidence": 701, "new_dead": 169, "incidence_dead": 6.7 }, + ], + maxCases: 17544 + }, + { + "name": "Madagascar", "continent": "Africa", "alpha2": "mg", "population": 27691019, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 54, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 4, "new_cases": 71, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 5, "new_cases": 643, "incidence": 1, "new_dead": 5, "incidence_dead": 0 }, + { "month": 6, "new_cases": 1443, "incidence": 1, "new_dead": 14, "incidence_dead": 0 }, + { "month": 7, "new_cases": 8654, "incidence": 8, "new_dead": 86, "incidence_dead": 0.1 }, + { "month": 8, "new_cases": 3995, "incidence": 4, "new_dead": 86, "incidence_dead": 0.1 }, + { "month": 9, "new_cases": 1545, "incidence": 1, "new_dead": 38, "incidence_dead": 0 }, + { "month": 10, "new_cases": 703, "incidence": 1, "new_dead": 14, "incidence_dead": 0 }, + { "month": 11, "new_cases": 230, "incidence": 0, "new_dead": 7, "incidence_dead": 0 }, + ], + maxCases: 8654 + }, + { + "name": "Malawi", "continent": "Africa", "alpha2": "mw", "population": 19129955, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 4, "new_cases": 34, "incidence": 0, "new_dead": 2, "incidence_dead": 0 }, + { "month": 5, "new_cases": 247, "incidence": 0, "new_dead": 1, "incidence_dead": 0 }, + { "month": 6, "new_cases": 940, "incidence": 1, "new_dead": 10, "incidence_dead": 0 }, + { "month": 7, "new_cases": 2854, "incidence": 4, "new_dead": 100, "incidence_dead": 0.1 }, + { "month": 8, "new_cases": 1488, "incidence": 2, "new_dead": 61, "incidence_dead": 0.1 }, + { "month": 9, "new_cases": 207, "incidence": 0, "new_dead": 4, "incidence_dead": 0 }, + { "month": 10, "new_cases": 157, "incidence": 0, "new_dead": 5, "incidence_dead": 0 }, + { "month": 11, "new_cases": 98, "incidence": 0, "new_dead": 1, "incidence_dead": 0 }, + ], + maxCases: 2854 + }, + { + "name": "Malaysia", "continent": "Asia", "alpha2": "my", "population": 32365998, "months": [ + { "month": 2, "new_cases": 17, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 2741, "incidence": 2, "new_dead": 41, "incidence_dead": 0 }, + { "month": 4, "new_cases": 3236, "incidence": 2, "new_dead": 59, "incidence_dead": 0 }, + { "month": 5, "new_cases": 1817, "incidence": 1, "new_dead": 13, "incidence_dead": 0 }, + { "month": 6, "new_cases": 820, "incidence": 1, "new_dead": 6, "incidence_dead": 0 }, + { "month": 7, "new_cases": 337, "incidence": 0, "new_dead": 4, "incidence_dead": 0 }, + { "month": 8, "new_cases": 364, "incidence": 0, "new_dead": 2, "incidence_dead": 0 }, + { "month": 9, "new_cases": 1884, "incidence": 1, "new_dead": 9, "incidence_dead": 0 }, + { "month": 10, "new_cases": 20324, "incidence": 16, "new_dead": 113, "incidence_dead": 0.1 }, + { "month": 11, "new_cases": 34149, "incidence": 26, "new_dead": 111, "incidence_dead": 0.1 }, + ], + maxCases: 34149 + }, + { + "name": "Maldives", "continent": "Asia", "alpha2": "mv", "population": 540542, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 14, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, + { "month": 4, "new_cases": 450, "incidence": 21, "new_dead": 0, "incidence_dead": 0 }, + { "month": 5, "new_cases": 1305, "incidence": 60, "new_dead": 4, "incidence_dead": 0.2 }, + { "month": 6, "new_cases": 588, "incidence": 27, "new_dead": 4, "incidence_dead": 0.2 }, + { "month": 7, "new_cases": 1432, "incidence": 66, "new_dead": 7, "incidence_dead": 0.3 }, + { "month": 8, "new_cases": 4011, "incidence": 186, "new_dead": 12, "incidence_dead": 0.6 }, + { "month": 9, "new_cases": 2487, "incidence": 115, "new_dead": 6, "incidence_dead": 0.3 }, + { "month": 10, "new_cases": 1368, "incidence": 63, "new_dead": 4, "incidence_dead": 0.2 }, + { "month": 11, "new_cases": 1352, "incidence": 63, "new_dead": 8, "incidence_dead": 0.4 }, + ], + maxCases: 4011 + }, + { + "name": "Mali", "continent": "Africa", "alpha2": "ml", "population": 20250834, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 26, "incidence": 0, "new_dead": 1, "incidence_dead": 0 }, + { "month": 4, "new_cases": 462, "incidence": 1, "new_dead": 24, "incidence_dead": 0 }, + { "month": 5, "new_cases": 775, "incidence": 1, "new_dead": 51, "incidence_dead": 0.1 }, + { "month": 6, "new_cases": 916, "incidence": 1, "new_dead": 39, "incidence_dead": 0 }, + { "month": 7, "new_cases": 354, "incidence": 0, "new_dead": 8, "incidence_dead": 0 }, + { "month": 8, "new_cases": 241, "incidence": 0, "new_dead": 2, "incidence_dead": 0 }, + { "month": 9, "new_cases": 342, "incidence": 0, "new_dead": 5, "incidence_dead": 0 }, + { "month": 10, "new_cases": 436, "incidence": 1, "new_dead": 5, "incidence_dead": 0 }, + { "month": 11, "new_cases": 1156, "incidence": 1, "new_dead": 20, "incidence_dead": 0 }, + ], + maxCases: 1156 + }, + { + "name": "Malta", "continent": "Europe", "alpha2": "mt", "population": 441539, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 166, "incidence": 9, "new_dead": 0, "incidence_dead": 0 }, + { "month": 4, "new_cases": 296, "incidence": 17, "new_dead": 3, "incidence_dead": 0.2 }, + { "month": 5, "new_cases": 153, "incidence": 9, "new_dead": 5, "incidence_dead": 0.3 }, + { "month": 6, "new_cases": 52, "incidence": 3, "new_dead": 0, "incidence_dead": 0 }, + { "month": 7, "new_cases": 154, "incidence": 9, "new_dead": 0, "incidence_dead": 0 }, + { "month": 8, "new_cases": 1059, "incidence": 60, "new_dead": 3, "incidence_dead": 0.2 }, + { "month": 9, "new_cases": 1175, "incidence": 67, "new_dead": 23, "incidence_dead": 1.3 }, + { "month": 10, "new_cases": 2984, "incidence": 169, "new_dead": 27, "incidence_dead": 1.5 }, + { "month": 11, "new_cases": 3831, "incidence": 217, "new_dead": 75, "incidence_dead": 4.2 }, + ], + maxCases: 3831 + }, + { + "name": "Marshall Islands", "continent": "Oceania", "alpha2": "mh", "population": 59194, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 4, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 5, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 6, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 7, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 8, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 9, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 10, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 11, "new_cases": 2, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, + ], + maxCases: 2 + }, + { + "name": "Mauritania", "continent": "Africa", "alpha2": "mr", "population": 4649660, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 5, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 4, "new_cases": 2, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 5, "new_cases": 522, "incidence": 3, "new_dead": 22, "incidence_dead": 0.1 }, + { "month": 6, "new_cases": 3833, "incidence": 21, "new_dead": 106, "incidence_dead": 0.6 }, + { "month": 7, "new_cases": 1947, "incidence": 10, "new_dead": 28, "incidence_dead": 0.2 }, + { "month": 8, "new_cases": 738, "incidence": 4, "new_dead": 2, "incidence_dead": 0 }, + { "month": 9, "new_cases": 454, "incidence": 2, "new_dead": 2, "incidence_dead": 0 }, + { "month": 10, "new_cases": 201, "incidence": 1, "new_dead": 2, "incidence_dead": 0 }, + { "month": 11, "new_cases": 898, "incidence": 5, "new_dead": 14, "incidence_dead": 0.1 }, + ], + maxCases: 3833 + }, + { + "name": "Mauritius", "continent": "Africa", "alpha2": "mu", "population": 1271767, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 140, "incidence": 3, "new_dead": 4, "incidence_dead": 0.1 }, + { "month": 4, "new_cases": 189, "incidence": 4, "new_dead": 5, "incidence_dead": 0.1 }, + { "month": 5, "new_cases": 3, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 6, "new_cases": 6, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 7, "new_cases": 3, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 8, "new_cases": 12, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 9, "new_cases": 25, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 10, "new_cases": 60, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, + { "month": 11, "new_cases": 63, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, + ], + maxCases: 189 + }, + { + "name": "Mexico", "continent": "North America", "alpha2": "mx", "population": 128932753, "months": [ + { "month": 2, "new_cases": 3, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 1211, "incidence": 0, "new_dead": 28, "incidence_dead": 0 }, + { "month": 4, "new_cases": 18009, "incidence": 3, "new_dead": 1830, "incidence_dead": 0.4 }, + { "month": 5, "new_cases": 71440, "incidence": 14, "new_dead": 8071, "incidence_dead": 1.6 }, + { "month": 6, "new_cases": 135425, "incidence": 26, "new_dead": 17839, "incidence_dead": 3.5 }, + { "month": 7, "new_cases": 198548, "incidence": 38, "new_dead": 18919, "incidence_dead": 3.7 }, + { "month": 8, "new_cases": 174923, "incidence": 34, "new_dead": 17726, "incidence_dead": 3.4 }, + { "month": 9, "new_cases": 143656, "incidence": 28, "new_dead": 13232, "incidence_dead": 2.6 }, + { "month": 10, "new_cases": 181746, "incidence": 35, "new_dead": 14107, "incidence_dead": 2.7 }, + { "month": 11, "new_cases": 188581, "incidence": 37, "new_dead": 14187, "incidence_dead": 2.8 }, + ], + maxCases: 198548 + }, + { + "name": "Moldova", "continent": "Europe", "alpha2": "md", "population": 4033963, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 352, "incidence": 2, "new_dead": 3, "incidence_dead": 0 }, + { "month": 4, "new_cases": 3544, "incidence": 22, "new_dead": 112, "incidence_dead": 0.7 }, + { "month": 5, "new_cases": 4354, "incidence": 27, "new_dead": 179, "incidence_dead": 1.1 }, + { "month": 6, "new_cases": 8362, "incidence": 52, "new_dead": 250, "incidence_dead": 1.5 }, + { "month": 7, "new_cases": 8120, "incidence": 50, "new_dead": 233, "incidence_dead": 1.4 }, + { "month": 8, "new_cases": 12187, "incidence": 76, "new_dead": 217, "incidence_dead": 1.3 }, + { "month": 9, "new_cases": 16122, "incidence": 100, "new_dead": 325, "incidence_dead": 2 }, + { "month": 10, "new_cases": 22998, "incidence": 143, "new_dead": 465, "incidence_dead": 2.9 }, + { "month": 11, "new_cases": 31324, "incidence": 194, "new_dead": 519, "incidence_dead": 3.2 }, + ], + maxCases: 31324 + }, + { + "name": "Monaco", "continent": "Europe", "alpha2": "mc", "population": 39244, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 51, "incidence": 32, "new_dead": 0, "incidence_dead": 0 }, + { "month": 4, "new_cases": 43, "incidence": 27, "new_dead": 3, "incidence_dead": 1.9 }, + { "month": 5, "new_cases": 4, "incidence": 3, "new_dead": 0, "incidence_dead": 0 }, + { "month": 6, "new_cases": 4, "incidence": 3, "new_dead": 0, "incidence_dead": 0 }, + { "month": 7, "new_cases": 17, "incidence": 11, "new_dead": 0, "incidence_dead": 0 }, + { "month": 8, "new_cases": 34, "incidence": 22, "new_dead": 0, "incidence_dead": 0 }, + { "month": 9, "new_cases": 64, "incidence": 41, "new_dead": -2, "incidence_dead": -1.3 }, + { "month": 10, "new_cases": 141, "incidence": 90, "new_dead": 0, "incidence_dead": 0 }, + { "month": 11, "new_cases": 250, "incidence": 159, "new_dead": 1, "incidence_dead": 0.6 }, + ], + maxCases: 250 + }, + { + "name": "Mongolia", "continent": "Asia", "alpha2": "mn", "population": 3278292, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 11, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 4, "new_cases": 26, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 5, "new_cases": 141, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, + { "month": 6, "new_cases": 41, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 7, "new_cases": 71, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, + { "month": 8, "new_cases": 13, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 9, "new_cases": 9, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 10, "new_cases": 33, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 11, "new_cases": 455, "incidence": 3, "new_dead": 0, "incidence_dead": 0 }, + ], + maxCases: 455 + }, + { + "name": "Montenegro", "continent": "Europe", "alpha2": "me", "population": 628062, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 107, "incidence": 4, "new_dead": 1, "incidence_dead": 0 }, + { "month": 4, "new_cases": 213, "incidence": 8, "new_dead": 5, "incidence_dead": 0.2 }, + { "month": 5, "new_cases": 2, "incidence": 0, "new_dead": 2, "incidence_dead": 0.1 }, + { "month": 6, "new_cases": 224, "incidence": 9, "new_dead": 3, "incidence_dead": 0.1 }, + { "month": 7, "new_cases": 2525, "incidence": 101, "new_dead": 36, "incidence_dead": 1.4 }, + { "month": 8, "new_cases": 1762, "incidence": 70, "new_dead": 52, "incidence_dead": 2.1 }, + { "month": 9, "new_cases": 5937, "incidence": 236, "new_dead": 69, "incidence_dead": 2.7 }, + { "month": 10, "new_cases": 7569, "incidence": 301, "new_dead": 132, "incidence_dead": 5.3 }, + { "month": 11, "new_cases": 16924, "incidence": 674, "new_dead": 198, "incidence_dead": 7.9 }, + ], + maxCases: 16924 + }, + { + "name": "Morocco", "continent": "Africa", "alpha2": "ma", "population": 36910558, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 616, "incidence": 0, "new_dead": 35, "incidence_dead": 0 }, + { "month": 4, "new_cases": 3806, "incidence": 3, "new_dead": 134, "incidence_dead": 0.1 }, + { "month": 5, "new_cases": 3384, "incidence": 2, "new_dead": 35, "incidence_dead": 0 }, + { "month": 6, "new_cases": 4726, "incidence": 3, "new_dead": 23, "incidence_dead": 0 }, + { "month": 7, "new_cases": 11789, "incidence": 8, "new_dead": 125, "incidence_dead": 0.1 }, + { "month": 8, "new_cases": 38268, "incidence": 26, "new_dead": 788, "incidence_dead": 0.5 }, + { "month": 9, "new_cases": 61063, "incidence": 41, "new_dead": 1053, "incidence_dead": 0.7 }, + { "month": 10, "new_cases": 95431, "incidence": 65, "new_dead": 1501, "incidence_dead": 1 }, + { "month": 11, "new_cases": 137252, "incidence": 93, "new_dead": 2151, "incidence_dead": 1.5 }, + ], + maxCases: 137252 + }, + { + "name": "Mozambique", "continent": "Africa", "alpha2": "mz", "population": 31255435, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 7, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 4, "new_cases": 68, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 5, "new_cases": 178, "incidence": 0, "new_dead": 1, "incidence_dead": 0 }, + { "month": 6, "new_cases": 635, "incidence": 1, "new_dead": 4, "incidence_dead": 0 }, + { "month": 7, "new_cases": 975, "incidence": 1, "new_dead": 5, "incidence_dead": 0 }, + { "month": 8, "new_cases": 2052, "incidence": 2, "new_dead": 12, "incidence_dead": 0 }, + { "month": 9, "new_cases": 4812, "incidence": 4, "new_dead": 38, "incidence_dead": 0 }, + { "month": 10, "new_cases": 4141, "incidence": 3, "new_dead": 31, "incidence_dead": 0 }, + { "month": 11, "new_cases": 2832, "incidence": 2, "new_dead": 39, "incidence_dead": 0 }, + ], + maxCases: 4812 + }, + { + "name": "Myanmar", "continent": "Asia", "alpha2": "mm", "population": 54409794, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 7, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 4, "new_cases": 136, "incidence": 0, "new_dead": 5, "incidence_dead": 0 }, + { "month": 5, "new_cases": 73, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 6, "new_cases": 75, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 7, "new_cases": 54, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 8, "new_cases": 529, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 9, "new_cases": 12491, "incidence": 6, "new_dead": 304, "incidence_dead": 0.1 }, + { "month": 10, "new_cases": 39333, "incidence": 18, "new_dead": 927, "incidence_dead": 0.4 }, + { "month": 11, "new_cases": 38007, "incidence": 17, "new_dead": 704, "incidence_dead": 0.3 }, + ], + maxCases: 39333 + }, + { + "name": "Namibia", "continent": "Africa", "alpha2": "na", "population": 2540916, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 9, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 4, "new_cases": 5, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 5, "new_cases": 8, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 6, "new_cases": 181, "incidence": 2, "new_dead": 0, "incidence_dead": 0 }, + { "month": 7, "new_cases": 1924, "incidence": 19, "new_dead": 9, "incidence_dead": 0.1 }, + { "month": 8, "new_cases": 5421, "incidence": 53, "new_dead": 65, "incidence_dead": 0.6 }, + { "month": 9, "new_cases": 3715, "incidence": 37, "new_dead": 46, "incidence_dead": 0.5 }, + { "month": 10, "new_cases": 1670, "incidence": 16, "new_dead": 12, "incidence_dead": 0.1 }, + { "month": 11, "new_cases": 1445, "incidence": 14, "new_dead": 18, "incidence_dead": 0.2 }, + ], + maxCases: 5421 + }, + { + "name": "Nepal", "continent": "Asia", "alpha2": "np", "population": 29136808, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 4, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 4, "new_cases": 52, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 5, "new_cases": 1515, "incidence": 1, "new_dead": 7, "incidence_dead": 0 }, + { "month": 6, "new_cases": 11992, "incidence": 10, "new_dead": 21, "incidence_dead": 0 }, + { "month": 7, "new_cases": 6207, "incidence": 5, "new_dead": 27, "incidence_dead": 0 }, + { "month": 8, "new_cases": 19689, "incidence": 17, "new_dead": 172, "incidence_dead": 0.1 }, + { "month": 9, "new_cases": 38357, "incidence": 33, "new_dead": 270, "incidence_dead": 0.2 }, + { "month": 10, "new_cases": 92926, "incidence": 80, "new_dead": 439, "incidence_dead": 0.4 }, + { "month": 11, "new_cases": 62709, "incidence": 54, "new_dead": 571, "incidence_dead": 0.5 }, + ], + maxCases: 92926 + }, + { + "name": "Netherlands", "continent": "Europe", "alpha2": "nl", "population": 17134873, "months": [ + { "month": 2, "new_cases": 5, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 12661, "incidence": 18, "new_dead": 1039, "incidence_dead": 1.5 }, + { "month": 4, "new_cases": 26845, "incidence": 39, "new_dead": 3771, "incidence_dead": 5.5 }, + { "month": 5, "new_cases": 7133, "incidence": 10, "new_dead": 1164, "incidence_dead": 1.7 }, + { "month": 6, "new_cases": 3838, "incidence": 6, "new_dead": 157, "incidence_dead": 0.2 }, + { "month": 7, "new_cases": 4107, "incidence": 6, "new_dead": 34, "incidence_dead": 0 }, + { "month": 8, "new_cases": 18642, "incidence": 27, "new_dead": 86, "incidence_dead": 0.1 }, + { "month": 9, "new_cases": 52756, "incidence": 77, "new_dead": 205, "incidence_dead": 0.3 }, + { "month": 10, "new_cases": 231652, "incidence": 338, "new_dead": 1002, "incidence_dead": 1.5 }, + { "month": 11, "new_cases": 174290, "incidence": 254, "new_dead": 1994, "incidence_dead": 2.9 }, + ], + maxCases: 231652 + }, + { + "name": "New Zealand", "continent": "Oceania", "alpha2": "nz", "population": 4822233, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 646, "incidence": 3, "new_dead": 0, "incidence_dead": 0 }, + { "month": 4, "new_cases": 832, "incidence": 4, "new_dead": 18, "incidence_dead": 0.1 }, + { "month": 5, "new_cases": 25, "incidence": 0, "new_dead": 3, "incidence_dead": 0 }, + { "month": 6, "new_cases": 24, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 7, "new_cases": 34, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 8, "new_cases": 190, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, + { "month": 9, "new_cases": 96, "incidence": 0, "new_dead": 3, "incidence_dead": 0 }, + { "month": 10, "new_cases": 111, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, + { "month": 11, "new_cases": 100, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, + ], + maxCases: 832 + }, + { + "name": "Nicaragua", "continent": "North America", "alpha2": "ni", "population": 6624554, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 4, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 4, "new_cases": 9, "incidence": 0, "new_dead": 2, "incidence_dead": 0 }, + { "month": 5, "new_cases": 745, "incidence": 3, "new_dead": 32, "incidence_dead": 0.1 }, + { "month": 6, "new_cases": 1760, "incidence": 7, "new_dead": 48, "incidence_dead": 0.2 }, + { "month": 7, "new_cases": 1153, "incidence": 4, "new_dead": 33, "incidence_dead": 0.1 }, + { "month": 8, "new_cases": 822, "incidence": 3, "new_dead": 21, "incidence_dead": 0.1 }, + { "month": 9, "new_cases": 676, "incidence": 3, "new_dead": 14, "incidence_dead": 0.1 }, + { "month": 10, "new_cases": 344, "incidence": 1, "new_dead": 5, "incidence_dead": 0 }, + { "month": 11, "new_cases": 270, "incidence": 1, "new_dead": 4, "incidence_dead": 0 }, + ], + maxCases: 1760 + }, + { + "name": "Niger", "continent": "Africa", "alpha2": "ne", "population": 24206636, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 26, "incidence": 0, "new_dead": 2, "incidence_dead": 0 }, + { "month": 4, "new_cases": 692, "incidence": 1, "new_dead": 29, "incidence_dead": 0 }, + { "month": 5, "new_cases": 239, "incidence": 0, "new_dead": 32, "incidence_dead": 0 }, + { "month": 6, "new_cases": 117, "incidence": 0, "new_dead": 3, "incidence_dead": 0 }, + { "month": 7, "new_cases": 59, "incidence": 0, "new_dead": 2, "incidence_dead": 0 }, + { "month": 8, "new_cases": 42, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 9, "new_cases": 21, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 10, "new_cases": 23, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 11, "new_cases": 328, "incidence": 0, "new_dead": 3, "incidence_dead": 0 }, + ], + maxCases: 692 + }, + { + "name": "Nigeria", "continent": "Africa", "alpha2": "ng", "population": 206139587, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 134, "incidence": 0, "new_dead": 1, "incidence_dead": 0 }, + { "month": 4, "new_cases": 1797, "incidence": 0, "new_dead": 56, "incidence_dead": 0 }, + { "month": 5, "new_cases": 8230, "incidence": 1, "new_dead": 229, "incidence_dead": 0 }, + { "month": 6, "new_cases": 15532, "incidence": 2, "new_dead": 303, "incidence_dead": 0 }, + { "month": 7, "new_cases": 17457, "incidence": 2, "new_dead": 289, "incidence_dead": 0 }, + { "month": 8, "new_cases": 10857, "incidence": 1, "new_dead": 134, "incidence_dead": 0 }, + { "month": 9, "new_cases": 4840, "incidence": 1, "new_dead": 99, "incidence_dead": 0 }, + { "month": 10, "new_cases": 4005, "incidence": 0, "new_dead": 32, "incidence_dead": 0 }, + { "month": 11, "new_cases": 4704, "incidence": 1, "new_dead": 29, "incidence_dead": 0 }, + ], + maxCases: 17457 + }, + { + "name": "North Macedonia", "continent": "Europe", "alpha2": "mk", "population": 2083380, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 328, "incidence": 4, "new_dead": 8, "incidence_dead": 0.1 }, + { "month": 4, "new_cases": 1136, "incidence": 14, "new_dead": 68, "incidence_dead": 0.8 }, + { "month": 5, "new_cases": 761, "incidence": 9, "new_dead": 56, "incidence_dead": 0.7 }, + { "month": 6, "new_cases": 4108, "incidence": 49, "new_dead": 169, "incidence_dead": 2 }, + { "month": 7, "new_cases": 4420, "incidence": 53, "new_dead": 184, "incidence_dead": 2.2 }, + { "month": 8, "new_cases": 3587, "incidence": 43, "new_dead": 117, "incidence_dead": 1.4 }, + { "month": 9, "new_cases": 3636, "incidence": 44, "new_dead": 136, "incidence_dead": 1.6 }, + { "month": 10, "new_cases": 13595, "incidence": 163, "new_dead": 255, "incidence_dead": 3.1 }, + { "month": 11, "new_cases": 30306, "incidence": 364, "new_dead": 769, "incidence_dead": 9.2 }, + ], + maxCases: 30306 + }, + { + "name": "Norway", "continent": "Europe", "alpha2": "no", "population": 5421242, "months": [ + { "month": 2, "new_cases": 14, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 4626, "incidence": 21, "new_dead": 36, "incidence_dead": 0.2 }, + { "month": 4, "new_cases": 3097, "incidence": 14, "new_dead": 171, "incidence_dead": 0.8 }, + { "month": 5, "new_cases": 702, "incidence": 3, "new_dead": 26, "incidence_dead": 0.1 }, + { "month": 6, "new_cases": 439, "incidence": 2, "new_dead": 14, "incidence_dead": 0.1 }, + { "month": 7, "new_cases": 361, "incidence": 2, "new_dead": 5, "incidence_dead": 0 }, + { "month": 8, "new_cases": 1542, "incidence": 7, "new_dead": 9, "incidence_dead": 0 }, + { "month": 9, "new_cases": 3245, "incidence": 15, "new_dead": 10, "incidence_dead": 0 }, + { "month": 10, "new_cases": 6304, "incidence": 29, "new_dead": 8, "incidence_dead": 0 }, + { "month": 11, "new_cases": 15819, "incidence": 73, "new_dead": 50, "incidence_dead": 0.2 }, + ], + maxCases: 15819 + }, + { + "name": "Oman", "continent": "Asia", "alpha2": "om", "population": 5106622, "months": [ + { "month": 2, "new_cases": 4, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 186, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, + { "month": 4, "new_cases": 2156, "incidence": 11, "new_dead": 10, "incidence_dead": 0 }, + { "month": 5, "new_cases": 9089, "incidence": 44, "new_dead": 38, "incidence_dead": 0.2 }, + { "month": 6, "new_cases": 28633, "incidence": 140, "new_dead": 127, "incidence_dead": 0.6 }, + { "month": 7, "new_cases": 39089, "incidence": 191, "new_dead": 245, "incidence_dead": 1.2 }, + { "month": 8, "new_cases": 6563, "incidence": 32, "new_dead": 264, "incidence_dead": 1.3 }, + { "month": 9, "new_cases": 12863, "incidence": 63, "new_dead": 250, "incidence_dead": 1.2 }, + { "month": 10, "new_cases": 15849, "incidence": 78, "new_dead": 273, "incidence_dead": 1.3 }, + { "month": 11, "new_cases": 9265, "incidence": 45, "new_dead": 215, "incidence_dead": 1.1 }, + ], + maxCases: 39089 + }, + { + "name": "Pakistan", "continent": "Asia", "alpha2": "pk", "population": 220892331, "months": [ + { "month": 2, "new_cases": 2, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 2114, "incidence": 0, "new_dead": 25, "incidence_dead": 0 }, + { "month": 4, "new_cases": 15996, "incidence": 2, "new_dead": 390, "incidence_dead": 0 }, + { "month": 5, "new_cases": 54346, "incidence": 6, "new_dead": 1126, "incidence_dead": 0.1 }, + { "month": 6, "new_cases": 141010, "incidence": 16, "new_dead": 2852, "incidence_dead": 0.3 }, + { "month": 7, "new_cases": 64835, "incidence": 7, "new_dead": 1556, "incidence_dead": 0.2 }, + { "month": 8, "new_cases": 17544, "incidence": 2, "new_dead": 343, "incidence_dead": 0 }, + { "month": 9, "new_cases": 16957, "incidence": 2, "new_dead": 190, "incidence_dead": 0 }, + { "month": 10, "new_cases": 21164, "incidence": 2, "new_dead": 339, "incidence_dead": 0 }, + { "month": 11, "new_cases": 66512, "incidence": 8, "new_dead": 1268, "incidence_dead": 0.1 }, + ], + maxCases: 141010 + }, + { + "name": "Panama", "continent": "North America", "alpha2": "pa", "population": 4314768, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 1180, "incidence": 7, "new_dead": 29, "incidence_dead": 0.2 }, + { "month": 4, "new_cases": 5351, "incidence": 31, "new_dead": 158, "incidence_dead": 0.9 }, + { "month": 5, "new_cases": 6931, "incidence": 40, "new_dead": 148, "incidence_dead": 0.9 }, + { "month": 6, "new_cases": 20087, "incidence": 116, "new_dead": 295, "incidence_dead": 1.7 }, + { "month": 7, "new_cases": 31706, "incidence": 184, "new_dead": 790, "incidence_dead": 4.6 }, + { "month": 8, "new_cases": 27726, "incidence": 161, "new_dead": 581, "incidence_dead": 3.4 }, + { "month": 9, "new_cases": 19613, "incidence": 114, "new_dead": 370, "incidence_dead": 2.1 }, + { "month": 10, "new_cases": 21003, "incidence": 122, "new_dead": 328, "incidence_dead": 1.9 }, + { "month": 11, "new_cases": 32208, "incidence": 187, "new_dead": 379, "incidence_dead": 2.2 }, + ], + maxCases: 32208 + }, + { + "name": "Papua New Guinea", "continent": "Oceania", "alpha2": "pg", "population": 8947027, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 4, "new_cases": 7, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 5, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 6, "new_cases": 3, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 7, "new_cases": 61, "incidence": 0, "new_dead": 1, "incidence_dead": 0 }, + { "month": 8, "new_cases": 387, "incidence": 1, "new_dead": 3, "incidence_dead": 0 }, + { "month": 9, "new_cases": 75, "incidence": 0, "new_dead": 2, "incidence_dead": 0 }, + { "month": 10, "new_cases": 55, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 11, "new_cases": 67, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + ], + maxCases: 387 + }, + { + "name": "Paraguay", "continent": "South America", "alpha2": "py", "population": 7132530, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 64, "incidence": 0, "new_dead": 2, "incidence_dead": 0 }, + { "month": 4, "new_cases": 201, "incidence": 1, "new_dead": 7, "incidence_dead": 0 }, + { "month": 5, "new_cases": 720, "incidence": 3, "new_dead": 1, "incidence_dead": 0 }, + { "month": 6, "new_cases": 1235, "incidence": 4, "new_dead": 6, "incidence_dead": 0 }, + { "month": 7, "new_cases": 3117, "incidence": 11, "new_dead": 32, "incidence_dead": 0.1 }, + { "month": 8, "new_cases": 12324, "incidence": 43, "new_dead": 277, "incidence_dead": 1 }, + { "month": 9, "new_cases": 23096, "incidence": 81, "new_dead": 531, "incidence_dead": 1.9 }, + { "month": 10, "new_cases": 22427, "incidence": 79, "new_dead": 547, "incidence_dead": 1.9 }, + { "month": 11, "new_cases": 19239, "incidence": 67, "new_dead": 352, "incidence_dead": 1.2 }, + ], + maxCases: 23096 + }, + { + "name": "Peru", "continent": "South America", "alpha2": "pe", "population": 32971846, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 1064, "incidence": 1, "new_dead": 27, "incidence_dead": 0 }, + { "month": 4, "new_cases": 35911, "incidence": 27, "new_dead": 1021, "incidence_dead": 0.8 }, + { "month": 5, "new_cases": 127500, "incidence": 97, "new_dead": 3455, "incidence_dead": 2.6 }, + { "month": 6, "new_cases": 120737, "incidence": 92, "new_dead": 5171, "incidence_dead": 3.9 }, + { "month": 7, "new_cases": 122279, "incidence": 93, "new_dead": 9344, "incidence_dead": 7.1 }, + { "month": 8, "new_cases": 239674, "incidence": 182, "new_dead": 9767, "incidence_dead": 7.4 }, + { "month": 9, "new_cases": 164602, "incidence": 125, "new_dead": 3608, "incidence_dead": 2.7 }, + { "month": 10, "new_cases": 88412, "incidence": 67, "new_dead": 2015, "incidence_dead": 1.5 }, + { "month": 11, "new_cases": 62350, "incidence": 47, "new_dead": 1512, "incidence_dead": 1.1 }, + ], + maxCases: 239674 + }, + { + "name": "Philippines", "continent": "Asia", "alpha2": "ph", "population": 109581085, "months": [ + { "month": 2, "new_cases": 2, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 2081, "incidence": 0, "new_dead": 87, "incidence_dead": 0 }, + { "month": 4, "new_cases": 6404, "incidence": 1, "new_dead": 480, "incidence_dead": 0.1 }, + { "month": 5, "new_cases": 9598, "incidence": 2, "new_dead": 389, "incidence_dead": 0.1 }, + { "month": 6, "new_cases": 19428, "incidence": 4, "new_dead": 309, "incidence_dead": 0.1 }, + { "month": 7, "new_cases": 55840, "incidence": 13, "new_dead": 757, "incidence_dead": 0.2 }, + { "month": 8, "new_cases": 127465, "incidence": 29, "new_dead": 1535, "incidence_dead": 0.4 }, + { "month": 9, "new_cases": 90875, "incidence": 21, "new_dead": 1946, "incidence_dead": 0.4 }, + { "month": 10, "new_cases": 69035, "incidence": 16, "new_dead": 1717, "incidence_dead": 0.4 }, + { "month": 11, "new_cases": 50901, "incidence": 12, "new_dead": 1171, "incidence_dead": 0.3 }, + ], + maxCases: 127465 + }, + { + "name": "Poland", "continent": "Europe", "alpha2": "pl", "population": 37846605, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 2310, "incidence": 2, "new_dead": 32, "incidence_dead": 0 }, + { "month": 4, "new_cases": 10566, "incidence": 7, "new_dead": 611, "incidence_dead": 0.4 }, + { "month": 5, "new_cases": 10909, "incidence": 7, "new_dead": 420, "incidence_dead": 0.3 }, + { "month": 6, "new_cases": 10607, "incidence": 7, "new_dead": 399, "incidence_dead": 0.3 }, + { "month": 7, "new_cases": 11295, "incidence": 7, "new_dead": 253, "incidence_dead": 0.2 }, + { "month": 8, "new_cases": 21684, "incidence": 14, "new_dead": 323, "incidence_dead": 0.2 }, + { "month": 9, "new_cases": 24142, "incidence": 16, "new_dead": 474, "incidence_dead": 0.3 }, + { "month": 10, "new_cases": 271217, "incidence": 179, "new_dead": 3118, "incidence_dead": 2.1 }, + { "month": 11, "new_cases": 628080, "incidence": 415, "new_dead": 11519, "incidence_dead": 7.6 }, + ], + maxCases: 628080 + }, + { + "name": "Portugal", "continent": "Europe", "alpha2": "pt", "population": 10196707, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 7441, "incidence": 18, "new_dead": 159, "incidence_dead": 0.4 }, + { "month": 4, "new_cases": 17602, "incidence": 43, "new_dead": 829, "incidence_dead": 2 }, + { "month": 5, "new_cases": 7455, "incidence": 18, "new_dead": 421, "incidence_dead": 1 }, + { "month": 6, "new_cases": 9641, "incidence": 24, "new_dead": 166, "incidence_dead": 0.4 }, + { "month": 7, "new_cases": 8931, "incidence": 22, "new_dead": 159, "incidence_dead": 0.4 }, + { "month": 8, "new_cases": 6940, "incidence": 17, "new_dead": 87, "incidence_dead": 0.2 }, + { "month": 9, "new_cases": 17530, "incidence": 43, "new_dead": 149, "incidence_dead": 0.4 }, + { "month": 10, "new_cases": 65737, "incidence": 161, "new_dead": 536, "incidence_dead": 1.3 }, + { "month": 11, "new_cases": 156782, "incidence": 384, "new_dead": 1998, "incidence_dead": 4.9 }, + ], + maxCases: 156782 + }, + { + "name": "Qatar", "continent": "Asia", "alpha2": "qa", "population": 2881060, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 780, "incidence": 7, "new_dead": 1, "incidence_dead": 0 }, + { "month": 4, "new_cases": 12628, "incidence": 110, "new_dead": 8, "incidence_dead": 0.1 }, + { "month": 5, "new_cases": 43501, "incidence": 377, "new_dead": 28, "incidence_dead": 0.2 }, + { "month": 6, "new_cases": 39178, "incidence": 340, "new_dead": 75, "incidence_dead": 0.7 }, + { "month": 7, "new_cases": 14607, "incidence": 127, "new_dead": 61, "incidence_dead": 0.5 }, + { "month": 8, "new_cases": 8083, "incidence": 70, "new_dead": 23, "incidence_dead": 0.2 }, + { "month": 9, "new_cases": 6982, "incidence": 61, "new_dead": 17, "incidence_dead": 0.1 }, + { "month": 10, "new_cases": 6796, "incidence": 59, "new_dead": 18, "incidence_dead": 0.2 }, + { "month": 11, "new_cases": 6277, "incidence": 54, "new_dead": 5, "incidence_dead": 0 }, + ], + maxCases: 43501 + }, + { + "name": "Romania", "continent": "Europe", "alpha2": "ro", "population": 19237682, "months": [ + { "month": 2, "new_cases": 2, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 2242, "incidence": 3, "new_dead": 79, "incidence_dead": 0.1 }, + { "month": 4, "new_cases": 9995, "incidence": 13, "new_dead": 635, "incidence_dead": 0.8 }, + { "month": 5, "new_cases": 7017, "incidence": 9, "new_dead": 549, "incidence_dead": 0.7 }, + { "month": 6, "new_cases": 7713, "incidence": 10, "new_dead": 385, "incidence_dead": 0.5 }, + { "month": 7, "new_cases": 23916, "incidence": 31, "new_dead": 692, "incidence_dead": 0.9 }, + { "month": 8, "new_cases": 36654, "incidence": 48, "new_dead": 1278, "incidence_dead": 1.7 }, + { "month": 9, "new_cases": 40032, "incidence": 52, "new_dead": 1204, "incidence_dead": 1.6 }, + { "month": 10, "new_cases": 113767, "incidence": 148, "new_dead": 2143, "incidence_dead": 2.8 }, + { "month": 11, "new_cases": 234023, "incidence": 304, "new_dead": 4363, "incidence_dead": 5.7 }, + ], + maxCases: 234023 + }, + { + "name": "Russia", "continent": "Europe", "alpha2": "ru", "population": 145934460, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 2335, "incidence": 0, "new_dead": 16, "incidence_dead": 0 }, + { "month": 4, "new_cases": 104161, "incidence": 18, "new_dead": 1056, "incidence_dead": 0.2 }, + { "month": 5, "new_cases": 299345, "incidence": 51, "new_dead": 3620, "incidence_dead": 0.6 }, + { "month": 6, "new_cases": 241086, "incidence": 41, "new_dead": 4613, "incidence_dead": 0.8 }, + { "month": 7, "new_cases": 191532, "incidence": 33, "new_dead": 4633, "incidence_dead": 0.8 }, + { "month": 8, "new_cases": 153941, "incidence": 26, "new_dead": 3189, "incidence_dead": 0.5 }, + { "month": 9, "new_cases": 178397, "incidence": 31, "new_dead": 3502, "incidence_dead": 0.6 }, + { "month": 10, "new_cases": 435468, "incidence": 75, "new_dead": 7157, "incidence_dead": 1.2 }, + { "month": 11, "new_cases": 669669, "incidence": 115, "new_dead": 11704, "incidence_dead": 2 }, + ], + maxCases: 669669 + }, + { + "name": "Rwanda", "continent": "Africa", "alpha2": "rw", "population": 12952209, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 74, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 4, "new_cases": 168, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 5, "new_cases": 127, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 6, "new_cases": 655, "incidence": 1, "new_dead": 1, "incidence_dead": 0 }, + { "month": 7, "new_cases": 997, "incidence": 2, "new_dead": 3, "incidence_dead": 0 }, + { "month": 8, "new_cases": 2041, "incidence": 4, "new_dead": 11, "incidence_dead": 0 }, + { "month": 9, "new_cases": 777, "incidence": 1, "new_dead": 13, "incidence_dead": 0 }, + { "month": 10, "new_cases": 297, "incidence": 1, "new_dead": 6, "incidence_dead": 0 }, + { "month": 11, "new_cases": 797, "incidence": 2, "new_dead": 14, "incidence_dead": 0 }, + ], + maxCases: 2041 + }, + { + "name": "Saint Kitts and Nevis", "continent": "North America", "alpha2": "kn", "population": 53192, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 6, "incidence": 3, "new_dead": 0, "incidence_dead": 0 }, + { "month": 4, "new_cases": 7, "incidence": 3, "new_dead": 0, "incidence_dead": 0 }, + { "month": 5, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 6, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 7, "new_cases": 2, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, + { "month": 8, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 9, "new_cases": 2, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, + { "month": 10, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 11, "new_cases": 3, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, + ], + maxCases: 7 + }, + { + "name": "Saint Lucia", "continent": "North America", "alpha2": "lc", "population": 183629, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 12, "incidence": 2, "new_dead": 0, "incidence_dead": 0 }, + { "month": 4, "new_cases": 4, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, + { "month": 5, "new_cases": 1, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 6, "new_cases": 1, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 7, "new_cases": 6, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, + { "month": 8, "new_cases": 1, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 9, "new_cases": 1, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 10, "new_cases": 51, "incidence": 7, "new_dead": 0, "incidence_dead": 0 }, + { "month": 11, "new_cases": 181, "incidence": 25, "new_dead": 1, "incidence_dead": 0.1 }, + ], + maxCases: 181 + }, + { + "name": "Saint Vincent and the Grenadines", "continent": "North America", "alpha2": "vc", "population": 110947, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 4, "new_cases": 15, "incidence": 3, "new_dead": 0, "incidence_dead": 0 }, + { "month": 5, "new_cases": 10, "incidence": 2, "new_dead": 0, "incidence_dead": 0 }, + { "month": 6, "new_cases": 3, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, + { "month": 7, "new_cases": 25, "incidence": 6, "new_dead": 0, "incidence_dead": 0 }, + { "month": 8, "new_cases": 6, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, + { "month": 9, "new_cases": 4, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, + { "month": 10, "new_cases": 10, "incidence": 2, "new_dead": 0, "incidence_dead": 0 }, + { "month": 11, "new_cases": 11, "incidence": 2, "new_dead": 0, "incidence_dead": 0 }, + ], + maxCases: 25 + }, + { + "name": "Samoa", "continent": "Oceania", "alpha2": "ws", "population": 198410, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 4, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 5, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 6, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 7, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 8, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 9, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 10, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 11, "new_cases": 1, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + ], + maxCases: 1 + }, + { + "name": "San Marino", "continent": "Europe", "alpha2": "sm", "population": 33938, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 235, "incidence": 173, "new_dead": 25, "incidence_dead": 18.4 }, + { "month": 4, "new_cases": 333, "incidence": 245, "new_dead": 15, "incidence_dead": 11 }, + { "month": 5, "new_cases": 102, "incidence": 75, "new_dead": 1, "incidence_dead": 0.7 }, + { "month": 6, "new_cases": 27, "incidence": 20, "new_dead": 0, "incidence_dead": 0 }, + { "month": 7, "new_cases": 1, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, + { "month": 8, "new_cases": 16, "incidence": 12, "new_dead": 0, "incidence_dead": 0 }, + { "month": 9, "new_cases": 17, "incidence": 13, "new_dead": 0, "incidence_dead": 0 }, + { "month": 10, "new_cases": 196, "incidence": 144, "new_dead": 0, "incidence_dead": 0 }, + { "month": 11, "new_cases": 684, "incidence": 504, "new_dead": 4, "incidence_dead": 2.9 }, + ], + maxCases: 684 + }, + { + "name": "Sao Tome and Principe", "continent": "Africa", "alpha2": "st", "population": 219161, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 4, "new_cases": 10, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, + { "month": 5, "new_cases": 469, "incidence": 53, "new_dead": 11, "incidence_dead": 1.3 }, + { "month": 6, "new_cases": 231, "incidence": 26, "new_dead": 1, "incidence_dead": 0.1 }, + { "month": 7, "new_cases": 157, "incidence": 18, "new_dead": 2, "incidence_dead": 0.2 }, + { "month": 8, "new_cases": 25, "incidence": 3, "new_dead": 0, "incidence_dead": 0 }, + { "month": 9, "new_cases": 15, "incidence": 2, "new_dead": 0, "incidence_dead": 0 }, + { "month": 10, "new_cases": 34, "incidence": 4, "new_dead": 1, "incidence_dead": 0.1 }, + { "month": 11, "new_cases": 46, "incidence": 5, "new_dead": 1, "incidence_dead": 0.1 }, + ], + maxCases: 469 + }, + { + "name": "Saudi Arabia", "continent": "Asia", "alpha2": "sa", "population": 34813867, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 1562, "incidence": 1, "new_dead": 9, "incidence_dead": 0 }, + { "month": 4, "new_cases": 21190, "incidence": 15, "new_dead": 152, "incidence_dead": 0.1 }, + { "month": 5, "new_cases": 62508, "incidence": 45, "new_dead": 341, "incidence_dead": 0.2 }, + { "month": 6, "new_cases": 105562, "incidence": 76, "new_dead": 1146, "incidence_dead": 0.8 }, + { "month": 7, "new_cases": 85082, "incidence": 61, "new_dead": 1217, "incidence_dead": 0.9 }, + { "month": 8, "new_cases": 39867, "incidence": 29, "new_dead": 1031, "incidence_dead": 0.7 }, + { "month": 9, "new_cases": 18833, "incidence": 14, "new_dead": 871, "incidence_dead": 0.6 }, + { "month": 10, "new_cases": 12677, "incidence": 9, "new_dead": 634, "incidence_dead": 0.5 }, + { "month": 11, "new_cases": 10078, "incidence": 7, "new_dead": 494, "incidence_dead": 0.4 }, + ], + maxCases: 105562 + }, + { + "name": "Senegal", "continent": "Africa", "alpha2": "sn", "population": 16743930, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 174, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 4, "new_cases": 758, "incidence": 1, "new_dead": 8, "incidence_dead": 0 }, + { "month": 5, "new_cases": 2712, "incidence": 4, "new_dead": 33, "incidence_dead": 0 }, + { "month": 6, "new_cases": 3148, "incidence": 5, "new_dead": 70, "incidence_dead": 0.1 }, + { "month": 7, "new_cases": 3439, "incidence": 5, "new_dead": 93, "incidence_dead": 0.1 }, + { "month": 8, "new_cases": 3379, "incidence": 5, "new_dead": 79, "incidence_dead": 0.1 }, + { "month": 9, "new_cases": 1371, "incidence": 2, "new_dead": 27, "incidence_dead": 0 }, + { "month": 10, "new_cases": 634, "incidence": 1, "new_dead": 13, "incidence_dead": 0 }, + { "month": 11, "new_cases": 473, "incidence": 1, "new_dead": 9, "incidence_dead": 0 }, + ], + maxCases: 3439 + }, + { + "name": "Serbia", "continent": "Europe", "alpha2": "rs", "population": 6804596, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 899, "incidence": 3, "new_dead": 15, "incidence_dead": 0.1 }, + { "month": 4, "new_cases": 8109, "incidence": 30, "new_dead": 163, "incidence_dead": 0.6 }, + { "month": 5, "new_cases": 2403, "incidence": 9, "new_dead": 64, "incidence_dead": 0.2 }, + { "month": 6, "new_cases": 3152, "incidence": 12, "new_dead": 34, "incidence_dead": 0.1 }, + { "month": 7, "new_cases": 10988, "incidence": 40, "new_dead": 296, "incidence_dead": 1.1 }, + { "month": 8, "new_cases": 5854, "incidence": 22, "new_dead": 140, "incidence_dead": 0.5 }, + { "month": 9, "new_cases": 2145, "incidence": 8, "new_dead": 36, "incidence_dead": 0.1 }, + { "month": 10, "new_cases": 13403, "incidence": 49, "new_dead": 71, "incidence_dead": 0.3 }, + { "month": 11, "new_cases": 128484, "incidence": 472, "new_dead": 784, "incidence_dead": 2.9 }, + ], + maxCases: 128484 + }, + { + "name": "Seychelles", "continent": "Africa", "alpha2": "sc", "population": 98340, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 8, "incidence": 2, "new_dead": 0, "incidence_dead": 0 }, + { "month": 4, "new_cases": 1, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 5, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 6, "new_cases": 70, "incidence": 18, "new_dead": 0, "incidence_dead": 0 }, + { "month": 7, "new_cases": 33, "incidence": 8, "new_dead": 0, "incidence_dead": 0 }, + { "month": 8, "new_cases": 22, "incidence": 6, "new_dead": 0, "incidence_dead": 0 }, + { "month": 9, "new_cases": 8, "incidence": 2, "new_dead": 0, "incidence_dead": 0 }, + { "month": 10, "new_cases": 9, "incidence": 2, "new_dead": 0, "incidence_dead": 0 }, + { "month": 11, "new_cases": 30, "incidence": 8, "new_dead": 0, "incidence_dead": 0 }, + ], + maxCases: 70 + }, + { + "name": "Sierra Leone", "continent": "Africa", "alpha2": "sl", "population": 7976985, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 4, "new_cases": 123, "incidence": 0, "new_dead": 6, "incidence_dead": 0 }, + { "month": 5, "new_cases": 737, "incidence": 2, "new_dead": 39, "incidence_dead": 0.1 }, + { "month": 6, "new_cases": 601, "incidence": 2, "new_dead": 14, "incidence_dead": 0 }, + { "month": 7, "new_cases": 361, "incidence": 1, "new_dead": 7, "incidence_dead": 0 }, + { "month": 8, "new_cases": 199, "incidence": 1, "new_dead": 3, "incidence_dead": 0 }, + { "month": 9, "new_cases": 209, "incidence": 1, "new_dead": 2, "incidence_dead": 0 }, + { "month": 10, "new_cases": 135, "incidence": 0, "new_dead": 2, "incidence_dead": 0 }, + { "month": 11, "new_cases": 46, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + ], + maxCases: 737 + }, + { + "name": "Singapore", "continent": "Asia", "alpha2": "sg", "population": 5850343, "months": [ + { "month": 2, "new_cases": 89, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 824, "incidence": 4, "new_dead": 1, "incidence_dead": 0 }, + { "month": 4, "new_cases": 15243, "incidence": 65, "new_dead": 12, "incidence_dead": 0.1 }, + { "month": 5, "new_cases": 18715, "incidence": 80, "new_dead": 8, "incidence_dead": 0 }, + { "month": 6, "new_cases": 9023, "incidence": 39, "new_dead": 3, "incidence_dead": 0 }, + { "month": 7, "new_cases": 8298, "incidence": 35, "new_dead": 1, "incidence_dead": 0 }, + { "month": 8, "new_cases": 4607, "incidence": 20, "new_dead": 0, "incidence_dead": 0 }, + { "month": 9, "new_cases": 953, "incidence": 4, "new_dead": 0, "incidence_dead": 0 }, + { "month": 10, "new_cases": 250, "incidence": 1, "new_dead": 1, "incidence_dead": 0 }, + { "month": 11, "new_cases": 203, "incidence": 1, "new_dead": 1, "incidence_dead": 0 }, + ], + maxCases: 18715 + }, + { + "name": "Slovakia", "continent": "Europe", "alpha2": "sk", "population": 5459643, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 362, "incidence": 2, "new_dead": 0, "incidence_dead": 0 }, + { "month": 4, "new_cases": 1033, "incidence": 5, "new_dead": 22, "incidence_dead": 0.1 }, + { "month": 5, "new_cases": 125, "incidence": 1, "new_dead": 5, "incidence_dead": 0 }, + { "month": 6, "new_cases": 146, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, + { "month": 7, "new_cases": 625, "incidence": 3, "new_dead": 1, "incidence_dead": 0 }, + { "month": 8, "new_cases": 1625, "incidence": 7, "new_dead": 4, "incidence_dead": 0 }, + { "month": 9, "new_cases": 6224, "incidence": 29, "new_dead": 15, "incidence_dead": 0.1 }, + { "month": 10, "new_cases": 47523, "incidence": 218, "new_dead": 171, "incidence_dead": 0.8 }, + { "month": 11, "new_cases": 48265, "incidence": 221, "new_dead": 620, "incidence_dead": 2.8 }, + ], + maxCases: 48265 + }, + { + "name": "Slovenia", "continent": "Europe", "alpha2": "si", "population": 2078932, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 800, "incidence": 10, "new_dead": 14, "incidence_dead": 0.2 }, + { "month": 4, "new_cases": 627, "incidence": 8, "new_dead": 76, "incidence_dead": 0.9 }, + { "month": 5, "new_cases": 44, "incidence": 1, "new_dead": 17, "incidence_dead": 0.2 }, + { "month": 6, "new_cases": 127, "incidence": 2, "new_dead": 3, "incidence_dead": 0 }, + { "month": 7, "new_cases": 556, "incidence": 7, "new_dead": 8, "incidence_dead": 0.1 }, + { "month": 8, "new_cases": 727, "incidence": 9, "new_dead": 14, "incidence_dead": 0.2 }, + { "month": 9, "new_cases": 2807, "incidence": 34, "new_dead": 17, "incidence_dead": 0.2 }, + { "month": 10, "new_cases": 28617, "incidence": 344, "new_dead": 188, "incidence_dead": 2.3 }, + { "month": 11, "new_cases": 41507, "incidence": 499, "new_dead": 1097, "incidence_dead": 13.2 }, + ], + maxCases: 41507 + }, + { + "name": "Solomon Islands", "continent": "Oceania", "alpha2": "sb", "population": 686878, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 4, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 5, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 6, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 7, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 8, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 9, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 10, "new_cases": 6, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 11, "new_cases": 9, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + ], + maxCases: 9 + }, + { + "name": "Somalia", "continent": "Africa", "alpha2": "so", "population": 15893219, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 4, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 4, "new_cases": 596, "incidence": 1, "new_dead": 27, "incidence_dead": 0 }, + { "month": 5, "new_cases": 1375, "incidence": 2, "new_dead": 50, "incidence_dead": 0.1 }, + { "month": 6, "new_cases": 948, "incidence": 1, "new_dead": 12, "incidence_dead": 0 }, + { "month": 7, "new_cases": 288, "incidence": 0, "new_dead": 3, "incidence_dead": 0 }, + { "month": 8, "new_cases": 98, "incidence": 0, "new_dead": 5, "incidence_dead": 0 }, + { "month": 9, "new_cases": 278, "incidence": 0, "new_dead": 1, "incidence_dead": 0 }, + { "month": 10, "new_cases": 353, "incidence": 1, "new_dead": 5, "incidence_dead": 0 }, + { "month": 11, "new_cases": 510, "incidence": 1, "new_dead": 9, "incidence_dead": 0 }, + ], + maxCases: 1375 + }, + { + "name": "South Africa", "continent": "Africa", "alpha2": "za", "population": 59308690, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 1352, "incidence": 1, "new_dead": 4, "incidence_dead": 0 }, + { "month": 4, "new_cases": 4294, "incidence": 2, "new_dead": 98, "incidence_dead": 0 }, + { "month": 5, "new_cases": 27036, "incidence": 11, "new_dead": 580, "incidence_dead": 0.2 }, + { "month": 6, "new_cases": 118526, "incidence": 50, "new_dead": 1974, "incidence_dead": 0.8 }, + { "month": 7, "new_cases": 341974, "incidence": 144, "new_dead": 5348, "incidence_dead": 2.3 }, + { "month": 8, "new_cases": 133858, "incidence": 56, "new_dead": 6144, "incidence_dead": 2.6 }, + { "month": 9, "new_cases": 47298, "incidence": 20, "new_dead": 2585, "incidence_dead": 1.1 }, + { "month": 10, "new_cases": 51113, "incidence": 22, "new_dead": 2542, "incidence_dead": 1.1 }, + { "month": 11, "new_cases": 64552, "incidence": 27, "new_dead": 2259, "incidence_dead": 1 }, + ], + maxCases: 341974 + }, + { + "name": "South Korea", "continent": "Asia", "alpha2": "kr", "population": 51269183, "months": [ + { "month": 2, "new_cases": 3139, "incidence": 2, "new_dead": 15, "incidence_dead": 0 }, + { "month": 3, "new_cases": 6636, "incidence": 3, "new_dead": 146, "incidence_dead": 0.1 }, + { "month": 4, "new_cases": 988, "incidence": 0, "new_dead": 86, "incidence_dead": 0 }, + { "month": 5, "new_cases": 729, "incidence": 0, "new_dead": 23, "incidence_dead": 0 }, + { "month": 6, "new_cases": 1347, "incidence": 1, "new_dead": 11, "incidence_dead": 0 }, + { "month": 7, "new_cases": 1486, "incidence": 1, "new_dead": 19, "incidence_dead": 0 }, + { "month": 8, "new_cases": 5846, "incidence": 3, "new_dead": 23, "incidence_dead": 0 }, + { "month": 9, "new_cases": 3707, "incidence": 2, "new_dead": 91, "incidence_dead": 0 }, + { "month": 10, "new_cases": 2746, "incidence": 1, "new_dead": 51, "incidence_dead": 0 }, + { "month": 11, "new_cases": 8017, "incidence": 4, "new_dead": 60, "incidence_dead": 0 }, + ], + maxCases: 8017 + }, + { + "name": "South Sudan", "continent": "Africa", "alpha2": "ss", "population": 11193729, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 4, "new_cases": 34, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 5, "new_cases": 959, "incidence": 2, "new_dead": 6, "incidence_dead": 0 }, + { "month": 6, "new_cases": 1013, "incidence": 2, "new_dead": 28, "incidence_dead": 0.1 }, + { "month": 7, "new_cases": 315, "incidence": 1, "new_dead": 8, "incidence_dead": 0 }, + { "month": 8, "new_cases": 205, "incidence": 0, "new_dead": 1, "incidence_dead": 0 }, + { "month": 9, "new_cases": 177, "incidence": 0, "new_dead": 2, "incidence_dead": 0 }, + { "month": 10, "new_cases": 201, "incidence": 0, "new_dead": 9, "incidence_dead": 0 }, + { "month": 11, "new_cases": 204, "incidence": 0, "new_dead": 3, "incidence_dead": 0 }, + ], + maxCases: 1013 + }, + { + "name": "Spain", "continent": "Europe", "alpha2": "es", "population": 46754783, "months": [ + { "month": 2, "new_cases": 44, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 95878, "incidence": 51, "new_dead": 8463, "incidence_dead": 4.5 }, + { "month": 4, "new_cases": 117512, "incidence": 63, "new_dead": 16079, "incidence_dead": 8.6 }, + { "month": 5, "new_cases": 26044, "incidence": 14, "new_dead": 2584, "incidence_dead": 1.4 }, + { "month": 6, "new_cases": 9792, "incidence": 5, "new_dead": 1228, "incidence_dead": 0.7 }, + { "month": 7, "new_cases": 39251, "incidence": 21, "new_dead": 90, "incidence_dead": 0 }, + { "month": 8, "new_cases": 174336, "incidence": 93, "new_dead": 649, "incidence_dead": 0.3 }, + { "month": 9, "new_cases": 306330, "incidence": 164, "new_dead": 2697, "incidence_dead": 1.4 }, + { "month": 10, "new_cases": 416490, "incidence": 223, "new_dead": 4087, "incidence_dead": 2.2 }, + { "month": 11, "new_cases": 462509, "incidence": 247, "new_dead": 9191, "incidence_dead": 4.9 }, + ], + maxCases: 462509 + }, + { + "name": "Sri Lanka", "continent": "Asia", "alpha2": "lk", "population": 21413250, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 142, "incidence": 0, "new_dead": 1, "incidence_dead": 0 }, + { "month": 4, "new_cases": 520, "incidence": 1, "new_dead": 5, "incidence_dead": 0 }, + { "month": 5, "new_cases": 970, "incidence": 1, "new_dead": 3, "incidence_dead": 0 }, + { "month": 6, "new_cases": 414, "incidence": 0, "new_dead": 1, "incidence_dead": 0 }, + { "month": 7, "new_cases": 768, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, + { "month": 8, "new_cases": 234, "incidence": 0, "new_dead": 1, "incidence_dead": 0 }, + { "month": 9, "new_cases": 331, "incidence": 0, "new_dead": 1, "incidence_dead": 0 }, + { "month": 10, "new_cases": 7283, "incidence": 9, "new_dead": 7, "incidence_dead": 0 }, + { "month": 11, "new_cases": 13324, "incidence": 16, "new_dead": 98, "incidence_dead": 0.1 }, + ], + maxCases: 13324 + }, + { + "name": "Sudan", "continent": "Africa", "alpha2": "sd", "population": 43849269, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 6, "incidence": 0, "new_dead": 1, "incidence_dead": 0 }, + { "month": 4, "new_cases": 435, "incidence": 0, "new_dead": 29, "incidence_dead": 0 }, + { "month": 5, "new_cases": 4584, "incidence": 3, "new_dead": 255, "incidence_dead": 0.1 }, + { "month": 6, "new_cases": 4231, "incidence": 2, "new_dead": 286, "incidence_dead": 0.2 }, + { "month": 7, "new_cases": 2387, "incidence": 1, "new_dead": 174, "incidence_dead": 0.1 }, + { "month": 8, "new_cases": 1545, "incidence": 1, "new_dead": 77, "incidence_dead": 0 }, + { "month": 9, "new_cases": 451, "incidence": 0, "new_dead": 13, "incidence_dead": 0 }, + { "month": 10, "new_cases": 164, "incidence": 0, "new_dead": 1, "incidence_dead": 0 }, + { "month": 11, "new_cases": 4006, "incidence": 2, "new_dead": 412, "incidence_dead": 0.2 }, + ], + maxCases: 4584 + }, + { + "name": "Suriname", "continent": "South America", "alpha2": "sr", "population": 586634, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 8, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 4, "new_cases": 1, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 5, "new_cases": 13, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, + { "month": 6, "new_cases": 492, "incidence": 21, "new_dead": 12, "incidence_dead": 0.5 }, + { "month": 7, "new_cases": 1135, "incidence": 48, "new_dead": 13, "incidence_dead": 0.6 }, + { "month": 8, "new_cases": 2384, "incidence": 102, "new_dead": 45, "incidence_dead": 1.9 }, + { "month": 9, "new_cases": 843, "incidence": 36, "new_dead": 33, "incidence_dead": 1.4 }, + { "month": 10, "new_cases": 326, "incidence": 14, "new_dead": 7, "incidence_dead": 0.3 }, + { "month": 11, "new_cases": 109, "incidence": 5, "new_dead": 6, "incidence_dead": 0.3 }, + ], + maxCases: 2384 + }, + { + "name": "Sweden", "continent": "Europe", "alpha2": "se", "population": 10099270, "months": [ + { "month": 2, "new_cases": 13, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 4820, "incidence": 12, "new_dead": 384, "incidence_dead": 1 }, + { "month": 4, "new_cases": 16767, "incidence": 42, "new_dead": 2569, "incidence_dead": 6.4 }, + { "month": 5, "new_cases": 17060, "incidence": 42, "new_dead": 1719, "incidence_dead": 4.3 }, + { "month": 6, "new_cases": 29263, "incidence": 72, "new_dead": 842, "incidence_dead": 2.1 }, + { "month": 7, "new_cases": 9152, "incidence": 23, "new_dead": 251, "incidence_dead": 0.6 }, + { "month": 8, "new_cases": 7303, "incidence": 18, "new_dead": 42, "incidence_dead": 0.1 }, + { "month": 9, "new_cases": 8484, "incidence": 21, "new_dead": 85, "incidence_dead": 0.2 }, + { "month": 10, "new_cases": 31492, "incidence": 78, "new_dead": 84, "incidence_dead": 0.2 }, + { "month": 11, "new_cases": 118774, "incidence": 294, "new_dead": 704, "incidence_dead": 1.7 }, + ], + maxCases: 118774 + }, + { + "name": "Switzerland", "continent": "Europe", "alpha2": "ch", "population": 8654618, "months": [ + { "month": 2, "new_cases": 17, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 16587, "incidence": 48, "new_dead": 432, "incidence_dead": 1.2 }, + { "month": 4, "new_cases": 12981, "incidence": 37, "new_dead": 1304, "incidence_dead": 3.8 }, + { "month": 5, "new_cases": 1276, "incidence": 4, "new_dead": 183, "incidence_dead": 0.5 }, + { "month": 6, "new_cases": 852, "incidence": 2, "new_dead": 43, "incidence_dead": 0.1 }, + { "month": 7, "new_cases": 3518, "incidence": 10, "new_dead": 18, "incidence_dead": 0.1 }, + { "month": 8, "new_cases": 6945, "incidence": 20, "new_dead": 25, "incidence_dead": 0.1 }, + { "month": 9, "new_cases": 11105, "incidence": 32, "new_dead": 68, "incidence_dead": 0.2 }, + { "month": 10, "new_cases": 100969, "incidence": 292, "new_dead": 223, "incidence_dead": 0.6 }, + { "month": 11, "new_cases": 172821, "incidence": 499, "new_dead": 2518, "incidence_dead": 7.3 }, + ], + maxCases: 172821 + }, + { + "name": "Tajikistan", "continent": "Asia", "alpha2": "tj", "population": 9537642, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 4, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 5, "new_cases": 3915, "incidence": 10, "new_dead": 45, "incidence_dead": 0.1 }, + { "month": 6, "new_cases": 1970, "incidence": 5, "new_dead": 5, "incidence_dead": 0 }, + { "month": 7, "new_cases": 1509, "incidence": 4, "new_dead": 8, "incidence_dead": 0 }, + { "month": 8, "new_cases": 1174, "incidence": 3, "new_dead": 8, "incidence_dead": 0 }, + { "month": 9, "new_cases": 1186, "incidence": 3, "new_dead": 8, "incidence_dead": 0 }, + { "month": 10, "new_cases": 1248, "incidence": 3, "new_dead": 6, "incidence_dead": 0 }, + { "month": 11, "new_cases": 1177, "incidence": 3, "new_dead": 4, "incidence_dead": 0 }, + ], + maxCases: 3915 + }, + { + "name": "Tanzania", "continent": "Africa", "alpha2": "tz", "population": 59734213, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 18, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 4, "new_cases": 461, "incidence": 0, "new_dead": 15, "incidence_dead": 0 }, + { "month": 5, "new_cases": 29, "incidence": 0, "new_dead": 5, "incidence_dead": 0 }, + { "month": 6, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 7, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 8, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 9, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 10, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 11, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + ], + maxCases: 461 + }, + { + "name": "Thailand", "continent": "Asia", "alpha2": "th", "population": 69799978, "months": [ + { "month": 2, "new_cases": 23, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 1609, "incidence": 1, "new_dead": 9, "incidence_dead": 0 }, + { "month": 4, "new_cases": 1303, "incidence": 0, "new_dead": 44, "incidence_dead": 0 }, + { "month": 5, "new_cases": 127, "incidence": 0, "new_dead": 3, "incidence_dead": 0 }, + { "month": 6, "new_cases": 90, "incidence": 0, "new_dead": 1, "incidence_dead": 0 }, + { "month": 7, "new_cases": 139, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 8, "new_cases": 107, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 9, "new_cases": 152, "incidence": 0, "new_dead": 1, "incidence_dead": 0 }, + { "month": 10, "new_cases": 215, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 11, "new_cases": 224, "incidence": 0, "new_dead": 1, "incidence_dead": 0 }, + ], + maxCases: 1609 + }, + { + "name": "Timor", "continent": "Asia", "alpha2": "tl", "population": 1318442, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 4, "new_cases": 23, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 5, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 6, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 7, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 8, "new_cases": 3, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 9, "new_cases": 1, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 10, "new_cases": 2, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 11, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + ], + maxCases: 23 + }, + { + "name": "Togo", "continent": "Africa", "alpha2": "tg", "population": 8278737, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 33, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 4, "new_cases": 82, "incidence": 0, "new_dead": 8, "incidence_dead": 0 }, + { "month": 5, "new_cases": 326, "incidence": 1, "new_dead": 4, "incidence_dead": 0 }, + { "month": 6, "new_cases": 208, "incidence": 1, "new_dead": 1, "incidence_dead": 0 }, + { "month": 7, "new_cases": 291, "incidence": 1, "new_dead": 5, "incidence_dead": 0 }, + { "month": 8, "new_cases": 459, "incidence": 1, "new_dead": 9, "incidence_dead": 0 }, + { "month": 9, "new_cases": 384, "incidence": 1, "new_dead": 20, "incidence_dead": 0.1 }, + { "month": 10, "new_cases": 547, "incidence": 2, "new_dead": 9, "incidence_dead": 0 }, + { "month": 11, "new_cases": 643, "incidence": 2, "new_dead": 7, "incidence_dead": 0 }, + ], + maxCases: 643 + }, + { + "name": "Trinidad and Tobago", "continent": "North America", "alpha2": "tt", "population": 1399491, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 85, "incidence": 2, "new_dead": 2, "incidence_dead": 0 }, + { "month": 4, "new_cases": 29, "incidence": 1, "new_dead": 5, "incidence_dead": 0.1 }, + { "month": 5, "new_cases": 1, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 6, "new_cases": 13, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 7, "new_cases": 39, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, + { "month": 8, "new_cases": 1590, "incidence": 28, "new_dead": 14, "incidence_dead": 0.3 }, + { "month": 9, "new_cases": 2772, "incidence": 50, "new_dead": 54, "incidence_dead": 1 }, + { "month": 10, "new_cases": 1161, "incidence": 21, "new_dead": 32, "incidence_dead": 0.6 }, + { "month": 11, "new_cases": 977, "incidence": 17, "new_dead": 12, "incidence_dead": 0.2 }, + ], + maxCases: 2772 + }, + { + "name": "Tunisia", "continent": "Africa", "alpha2": "tn", "population": 11818618, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 393, "incidence": 1, "new_dead": 9, "incidence_dead": 0 }, + { "month": 4, "new_cases": 600, "incidence": 1, "new_dead": 31, "incidence_dead": 0.1 }, + { "month": 5, "new_cases": 83, "incidence": 0, "new_dead": 7, "incidence_dead": 0 }, + { "month": 6, "new_cases": 97, "incidence": 0, "new_dead": 2, "incidence_dead": 0 }, + { "month": 7, "new_cases": 361, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, + { "month": 8, "new_cases": 2268, "incidence": 5, "new_dead": 27, "incidence_dead": 0.1 }, + { "month": 9, "new_cases": 14610, "incidence": 31, "new_dead": 188, "incidence_dead": 0.4 }, + { "month": 10, "new_cases": 41400, "incidence": 88, "new_dead": 1052, "incidence_dead": 2.2 }, + { "month": 11, "new_cases": 36956, "incidence": 78, "new_dead": 1943, "incidence_dead": 4.1 }, + ], + maxCases: 41400 + }, + { + "name": "Turkey", "continent": "Asia", "alpha2": "tr", "population": 84339067, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 13530, "incidence": 4, "new_dead": 213, "incidence_dead": 0.1 }, + { "month": 4, "new_cases": 106673, "incidence": 32, "new_dead": 2960, "incidence_dead": 0.9 }, + { "month": 5, "new_cases": 43738, "incidence": 13, "new_dead": 1366, "incidence_dead": 0.4 }, + { "month": 6, "new_cases": 35964, "incidence": 11, "new_dead": 591, "incidence_dead": 0.2 }, + { "month": 7, "new_cases": 30967, "incidence": 9, "new_dead": 560, "incidence_dead": 0.2 }, + { "month": 8, "new_cases": 39260, "incidence": 12, "new_dead": 679, "incidence_dead": 0.2 }, + { "month": 9, "new_cases": 48530, "incidence": 14, "new_dead": 1825, "incidence_dead": 0.5 }, + { "month": 10, "new_cases": 56704, "incidence": 17, "new_dead": 2057, "incidence_dead": 0.6 }, + { "month": 11, "new_cases": 263480, "incidence": 78, "new_dead": 3494, "incidence_dead": 1 }, + ], + maxCases: 263480 + }, + { + "name": "Uganda", "continent": "Africa", "alpha2": "ug", "population": 45741000, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 43, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 4, "new_cases": 39, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 5, "new_cases": 334, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 6, "new_cases": 472, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 7, "new_cases": 265, "incidence": 0, "new_dead": 2, "incidence_dead": 0 }, + { "month": 8, "new_cases": 1818, "incidence": 1, "new_dead": 29, "incidence_dead": 0 }, + { "month": 9, "new_cases": 5157, "incidence": 3, "new_dead": 43, "incidence_dead": 0 }, + { "month": 10, "new_cases": 4366, "incidence": 2, "new_dead": 36, "incidence_dead": 0 }, + { "month": 11, "new_cases": 7964, "incidence": 4, "new_dead": 94, "incidence_dead": 0.1 }, + ], + maxCases: 7964 + }, + { + "name": "Ukraine", "continent": "Europe", "alpha2": "ua", "population": 43733759, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 644, "incidence": 0, "new_dead": 16, "incidence_dead": 0 }, + { "month": 4, "new_cases": 9761, "incidence": 6, "new_dead": 244, "incidence_dead": 0.1 }, + { "month": 5, "new_cases": 13266, "incidence": 8, "new_dead": 447, "incidence_dead": 0.3 }, + { "month": 6, "new_cases": 21582, "incidence": 12, "new_dead": 465, "incidence_dead": 0.3 }, + { "month": 7, "new_cases": 26150, "incidence": 15, "new_dead": 544, "incidence_dead": 0.3 }, + { "month": 8, "new_cases": 52728, "incidence": 30, "new_dead": 888, "incidence_dead": 0.5 }, + { "month": 9, "new_cases": 90314, "incidence": 52, "new_dead": 1616, "incidence_dead": 0.9 }, + { "month": 10, "new_cases": 184884, "incidence": 106, "new_dead": 3178, "incidence_dead": 1.8 }, + { "month": 11, "new_cases": 353013, "incidence": 202, "new_dead": 5332, "incidence_dead": 3 }, + ], + maxCases: 353013 + }, + { + "name": "United Arab Emirates", "continent": "Asia", "alpha2": "ae", "population": 9890400, "months": [ + { "month": 2, "new_cases": 17, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 643, "incidence": 2, "new_dead": 4, "incidence_dead": 0 }, + { "month": 4, "new_cases": 11817, "incidence": 30, "new_dead": 99, "incidence_dead": 0.3 }, + { "month": 5, "new_cases": 22076, "incidence": 56, "new_dead": 159, "incidence_dead": 0.4 }, + { "month": 6, "new_cases": 14110, "incidence": 36, "new_dead": 51, "incidence_dead": 0.1 }, + { "month": 7, "new_cases": 11839, "incidence": 30, "new_dead": 36, "incidence_dead": 0.1 }, + { "month": 8, "new_cases": 9725, "incidence": 25, "new_dead": 33, "incidence_dead": 0.1 }, + { "month": 9, "new_cases": 23959, "incidence": 61, "new_dead": 35, "incidence_dead": 0.1 }, + { "month": 10, "new_cases": 38439, "incidence": 97, "new_dead": 76, "incidence_dead": 0.2 }, + { "month": 11, "new_cases": 36231, "incidence": 92, "new_dead": 77, "incidence_dead": 0.2 }, + ], + maxCases: 38439 + }, + { + "name": "United Kingdom", "continent": "Europe", "alpha2": "gb", "population": 67886004, "months": [ + { "month": 2, "new_cases": 59, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 38754, "incidence": 14, "new_dead": 2456, "incidence_dead": 0.9 }, + { "month": 4, "new_cases": 139956, "incidence": 52, "new_dead": 24297, "incidence_dead": 8.9 }, + { "month": 5, "new_cases": 78768, "incidence": 29, "new_dead": 10773, "incidence_dead": 4 }, + { "month": 6, "new_cases": 27677, "incidence": 10, "new_dead": 2952, "incidence_dead": 1.1 }, + { "month": 7, "new_cases": 19577, "incidence": 7, "new_dead": 795, "incidence_dead": 0.3 }, + { "month": 8, "new_cases": 33290, "incidence": 12, "new_dead": 315, "incidence_dead": 0.1 }, + { "month": 9, "new_cases": 117763, "incidence": 43, "new_dead": 644, "incidence_dead": 0.2 }, + { "month": 10, "new_cases": 558947, "incidence": 206, "new_dead": 4412, "incidence_dead": 1.6 }, + { "month": 11, "new_cases": 618940, "incidence": 228, "new_dead": 11900, "incidence_dead": 4.4 }, + ], + maxCases: 618940 + }, + { + "name": "United States", "continent": "North America", "alpha2": "us", "population": 331002647, "months": [ + { "month": 2, "new_cases": 17, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 192152, "incidence": 15, "new_dead": 5277, "incidence_dead": 0.4 }, + { "month": 4, "new_cases": 884047, "incidence": 67, "new_dead": 60738, "incidence_dead": 4.6 }, + { "month": 5, "new_cases": 718241, "incidence": 54, "new_dead": 41703, "incidence_dead": 3.1 }, + { "month": 6, "new_cases": 842906, "incidence": 64, "new_dead": 20112, "incidence_dead": 1.5 }, + { "month": 7, "new_cases": 1915966, "incidence": 145, "new_dead": 26446, "incidence_dead": 2 }, + { "month": 8, "new_cases": 1463760, "incidence": 111, "new_dead": 29532, "incidence_dead": 2.2 }, + { "month": 9, "new_cases": 1202896, "incidence": 91, "new_dead": 23418, "incidence_dead": 1.8 }, + { "month": 10, "new_cases": 1917201, "incidence": 145, "new_dead": 23974, "incidence_dead": 1.8 }, + { "month": 11, "new_cases": 4462302, "incidence": 337, "new_dead": 36964, "incidence_dead": 2.8 }, + ], + maxCases: 4462302 + }, + { + "name": "Uruguay", "continent": "South America", "alpha2": "uy", "population": 3473727, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 334, "incidence": 2, "new_dead": 0, "incidence_dead": 0 }, + { "month": 4, "new_cases": 305, "incidence": 2, "new_dead": 16, "incidence_dead": 0.1 }, + { "month": 5, "new_cases": 180, "incidence": 1, "new_dead": 5, "incidence_dead": 0 }, + { "month": 6, "new_cases": 113, "incidence": 1, "new_dead": 5, "incidence_dead": 0 }, + { "month": 7, "new_cases": 328, "incidence": 2, "new_dead": 8, "incidence_dead": 0.1 }, + { "month": 8, "new_cases": 331, "incidence": 2, "new_dead": 9, "incidence_dead": 0.1 }, + { "month": 9, "new_cases": 451, "incidence": 3, "new_dead": 4, "incidence_dead": 0 }, + { "month": 10, "new_cases": 1078, "incidence": 8, "new_dead": 10, "incidence_dead": 0.1 }, + { "month": 11, "new_cases": 2733, "incidence": 20, "new_dead": 19, "incidence_dead": 0.1 }, + ], + maxCases: 2733 + }, + { + "name": "Uzbekistan", "continent": "Asia", "alpha2": "uz", "population": 33469199, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 171, "incidence": 0, "new_dead": 1, "incidence_dead": 0 }, + { "month": 4, "new_cases": 1867, "incidence": 1, "new_dead": 7, "incidence_dead": 0 }, + { "month": 5, "new_cases": 1584, "incidence": 1, "new_dead": 6, "incidence_dead": 0 }, + { "month": 6, "new_cases": 4880, "incidence": 4, "new_dead": 11, "incidence_dead": 0 }, + { "month": 7, "new_cases": 15506, "incidence": 12, "new_dead": 115, "incidence_dead": 0.1 }, + { "month": 8, "new_cases": 17884, "incidence": 13, "new_dead": 179, "incidence_dead": 0.1 }, + { "month": 9, "new_cases": 14824, "incidence": 11, "new_dead": 150, "incidence_dead": 0.1 }, + { "month": 10, "new_cases": 10215, "incidence": 8, "new_dead": 96, "incidence_dead": 0.1 }, + { "month": 11, "new_cases": 6162, "incidence": 5, "new_dead": 44, "incidence_dead": 0 }, + ], + maxCases: 17884 + }, + { + "name": "Vanuatu", "continent": "Oceania", "alpha2": "vu", "population": 307150, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 4, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 5, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 6, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 7, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 8, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 9, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 10, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 11, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + ], + maxCases: 0 + }, + { + "name": "Venezuela", "continent": "South America", "alpha2": "ve", "population": 28435943, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 133, "incidence": 0, "new_dead": 2, "incidence_dead": 0 }, + { "month": 4, "new_cases": 198, "incidence": 0, "new_dead": 13, "incidence_dead": 0 }, + { "month": 5, "new_cases": 1177, "incidence": 1, "new_dead": -2, "incidence_dead": 0 }, + { "month": 6, "new_cases": 4322, "incidence": 4, "new_dead": 37, "incidence_dead": 0 }, + { "month": 7, "new_cases": 12742, "incidence": 11, "new_dead": 113, "incidence_dead": 0.1 }, + { "month": 8, "new_cases": 28154, "incidence": 25, "new_dead": 222, "incidence_dead": 0.2 }, + { "month": 9, "new_cases": 28394, "incidence": 25, "new_dead": 242, "incidence_dead": 0.2 }, + { "month": 10, "new_cases": 16891, "incidence": 15, "new_dead": 170, "incidence_dead": 0.1 }, + { "month": 11, "new_cases": 10381, "incidence": 9, "new_dead": 99, "incidence_dead": 0.1 }, + ], + maxCases: 28394 + }, + { + "name": "Vietnam", "continent": "Asia", "alpha2": "vn", "population": 97338583, "months": [ + { "month": 2, "new_cases": 14, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 196, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 4, "new_cases": 58, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 5, "new_cases": 58, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 6, "new_cases": 27, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 7, "new_cases": 203, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 8, "new_cases": 486, "incidence": 0, "new_dead": 31, "incidence_dead": 0 }, + { "month": 9, "new_cases": 50, "incidence": 0, "new_dead": 1, "incidence_dead": 0 }, + { "month": 10, "new_cases": 86, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 11, "new_cases": 167, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + ], + maxCases: 486 + }, + { + "name": "Yemen", "continent": "Asia", "alpha2": "ye", "population": 29825968, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 4, "new_cases": 5, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 5, "new_cases": 317, "incidence": 0, "new_dead": 78, "incidence_dead": 0.1 }, + { "month": 6, "new_cases": 835, "incidence": 1, "new_dead": 232, "incidence_dead": 0.2 }, + { "month": 7, "new_cases": 570, "incidence": 0, "new_dead": 181, "incidence_dead": 0.2 }, + { "month": 8, "new_cases": 230, "incidence": 0, "new_dead": 73, "incidence_dead": 0.1 }, + { "month": 9, "new_cases": 76, "incidence": 0, "new_dead": 21, "incidence_dead": 0 }, + { "month": 10, "new_cases": 29, "incidence": 0, "new_dead": 12, "incidence_dead": 0 }, + { "month": 11, "new_cases": 128, "incidence": 0, "new_dead": 20, "incidence_dead": 0 }, + ], + maxCases: 835 + }, + { + "name": "Zambia", "continent": "Africa", "alpha2": "zm", "population": 18383956, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 33, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 4, "new_cases": 71, "incidence": 0, "new_dead": 2, "incidence_dead": 0 }, + { "month": 5, "new_cases": 951, "incidence": 1, "new_dead": 4, "incidence_dead": 0 }, + { "month": 6, "new_cases": 537, "incidence": 1, "new_dead": 17, "incidence_dead": 0 }, + { "month": 7, "new_cases": 4369, "incidence": 6, "new_dead": 127, "incidence_dead": 0.2 }, + { "month": 8, "new_cases": 6134, "incidence": 8, "new_dead": 137, "incidence_dead": 0.2 }, + { "month": 9, "new_cases": 2662, "incidence": 4, "new_dead": 44, "incidence_dead": 0.1 }, + { "month": 10, "new_cases": 1673, "incidence": 2, "new_dead": 17, "incidence_dead": 0 }, + { "month": 11, "new_cases": 1215, "incidence": 2, "new_dead": 8, "incidence_dead": 0 }, + ], + maxCases: 6134 + }, + { + "name": "Zimbabwe", "continent": "Africa", "alpha2": "zw", "population": 14862927, "months": [ + { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 3, "new_cases": 7, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 4, "new_cases": 32, "incidence": 0, "new_dead": 3, "incidence_dead": 0 }, + { "month": 5, "new_cases": 138, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, + { "month": 6, "new_cases": 413, "incidence": 1, "new_dead": 3, "incidence_dead": 0 }, + { "month": 7, "new_cases": 2578, "incidence": 4, "new_dead": 60, "incidence_dead": 0.1 }, + { "month": 8, "new_cases": 3328, "incidence": 6, "new_dead": 135, "incidence_dead": 0.2 }, + { "month": 9, "new_cases": 1341, "incidence": 2, "new_dead": 26, "incidence_dead": 0 }, + { "month": 10, "new_cases": 529, "incidence": 1, "new_dead": 15, "incidence_dead": 0 }, + { "month": 11, "new_cases": 1583, "incidence": 3, "new_dead": 33, "incidence_dead": 0.1 }, + ], + maxCases: 3328 + }, + ]; diff --git a/compiler/compiler/sample/pages/testcases/simpleText.ets b/compiler/compiler/sample/pages/testcases/simpleText.ets new file mode 100644 index 000000000..9a982d6b0 --- /dev/null +++ b/compiler/compiler/sample/pages/testcases/simpleText.ets @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + + +@Entry +@Component +struct UserView { + + @State + button_name:string = "Before Click"; + + @State + currentView:string = "opacity"; + + build(){ + Column() { + if(this.currentView === "opacity") { + Column(){ + Row(){ + Text("Row Text1") + } + .width(100).height(100).opacity(0.5).backgroundColor("#c4b0dd") + Row(){ + Text("Row Text2") + } + .width(100).height(100).opacity(1).backgroundColor("#c4b0dd") + Text("Column Text1").height(100).backgroundColor("#c4b0de") + Text("Column Text2").height(100).backgroundColor("#c4deb0").opacity(0.5) + Image("pages/pictures/0.jpeg").width(600).height(300) + Image("pages/pictures/0.jpeg").width(600).height(300).opacity(0.5) + Button("Button1").height(100).backgroundColor("#c4deb0") + Button("Button2").height(100).backgroundColor("#c4deb0").opacity(0.5) + Divider().height(10).color("red") + Divider().height(10).color("red").opacity(0.5) + } + .width(700).backgroundColor("#b0c4de").margin(20) + } else if(this.currentView === "button") { + Button("V8 Button test:" + this.button_name) + .width(600).height(100).backgroundColor("#b0c4de").margin(50) + .onClick(() => { + console.log("V8 Button test click start"); + this.button_name = "After click"; + console.log("V8 Button test click end"); + }) + } else if(this.currentView === "text") { + Text("V8 Text test") + .width(600).height(100).backgroundColor("#b0c4de") + .margin(50).fontColor("#ff33aa").fontSize(50).fontWeight("bold") + } else if(this.currentView === "image") { + Image("pages/pictures/0.jpeg").width(800).height(400).margin(50) + } else if(this.currentView === "column") { + Column(){ + Text("Column Text1").height(100).backgroundColor("#c4b0de") + Text("Column Text2").height(100).backgroundColor("#c4deb0") + Image("pages/pictures/0.jpeg").width(600).height(300) + Text("Column Text3").height(100).backgroundColor("#c4b0de") + Text("Column Text4").height(100).backgroundColor("#c4deb0") + } + .width(700).height(1000).backgroundColor("#b0c4de").margin(20) + } else if(this.currentView === "row") { + Row(){ + Text("Text1").height(100).backgroundColor("#c4b0de") + Text("Text2").height(100).backgroundColor("#c4deb0") + Image("pages/pictures/0.jpeg").width(300).height(150) + Text("Text3").height(100).backgroundColor("#c4b0de") + Text("Text4").height(100).backgroundColor("#c4deb0") + } + .width(700).height(200).backgroundColor("#b0c4de").margin(20) + } + } + } +} \ No newline at end of file diff --git a/compiler/compiler/sample/pages/testcases/stacktestsuite.ets b/compiler/compiler/sample/pages/testcases/stacktestsuite.ets new file mode 100644 index 000000000..56908b36b --- /dev/null +++ b/compiler/compiler/sample/pages/testcases/stacktestsuite.ets @@ -0,0 +1,148 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + +class Test { + align:number = 0; + fit:number = 0; + overflow:number = 0; + text:number = 0; + width:number = 0; + constructor(align:number, fit:number, overflow:number, text:number, width:number) { + this.align = align; + this.fit = fit; + this.overflow = overflow; + this.text = text; + this.width = width; + } +} + +@Entry +@Component +struct TestView { + + @State + currentTest:Test = new Test(0, 0, 0, 0, 0); + + aligns:string[] = [ + "TopLeft", + "TopCenter", + "TopRight", + "CenterLeft", + "Center", + "CenterRight", + "BottomLeft", + "BottomCenter", + "BottomRight" + ]; + + stackFits:string[] = [ + "Keep", + "Stretch", + "Inherit", + "FirstChild" + ]; + + overflows:string[] = [ + "Clip", + "Observable" + ]; + + texts:string[] = [ + "Test text", + "This is a very long text for demonstration purposes." + ]; + + widths:number[] = [ + 200, + 500, + 800 + ]; + + alignToText(align) { + if (align >= this.aligns.length) + return "Unknown (" + align + ")"; + + return "Align." + this.aligns[align] + "(" + /*Align[this.aligns[align]]*/ + ")"; + } // alignToText + + fitToText(fit) { + if (fit >= this.stackFits.length) + return "Unknown (" + fit + ")"; + + return "StackFit." + this.stackFits[fit] + "(" + /*StackFit[this.stackFits[fit]]*/ + ")"; + } + + overflowToText(overflow) { + if (overflow >= this.overflows.length) + return "Unknown (" + overflow + ")"; + + return "Overflow." + this.overflows[overflow] + "(" + /*Overflow[this.overflows[overflow]]*/ + ")"; + } + + build() { + Column(){ + Row(){ + Button("Alignment") + .onClick(() => { + this.currentTest.align = (this.currentTest.align + 1) % this.aligns.length; + }) + Text(this.alignToText(this.currentTest.align)) + } + Row(){ + Button("Fit") + .onClick(() => { + this.currentTest.fit = (this.currentTest.fit + 1) % this.stackFits.length; + }) + Text(this.fitToText(this.currentTest.fit)) + } + Row(){ + Button("Overflow") + .onClick(() => { + this.currentTest.overflow = (this.currentTest.overflow + 1) % this.overflows.length; + }) + Text(this.overflowToText(this.currentTest.overflow)) + } + Row(){ + Button("Text") + .onClick(() => { + this.currentTest.text = (this.currentTest.text + 1) % this.texts.length; + }) + Text(this.texts[this.currentTest.text]) + } + Row(){ + Button("Width") + .onClick(() => { + this.currentTest.width = (this.currentTest.width + 1) % this.widths.length; + }) + Text("" + this.widths[this.currentTest.width]) + } + Stack(){ + Column(){ + + } + .width(350).height(400).backgroundColor(0xaaaaaa) + Text(this.texts[this.currentTest.text]).backgroundColor(0x00aaff).fontColor("#ffffff") + .width(this.widths[this.currentTest.width]) + } + //.alignment(Align[this.aligns[this.currentTest.align]]).stackFit(StackFit[this.stackFits[this.currentTest.fit]]) + //.Overflow(Overflow[this.overflows[this.currentTest.overflow]]).backgroundColor(0x0000cd).width(500.0).height(400.0) + Stack(){ + Text("test1") + Text("Test2") + } + } + .alignItems(HorizontalAlign.Center) + } +} \ No newline at end of file diff --git a/compiler/compiler/sample/pages/testcases/stateArrayReverse.ets b/compiler/compiler/sample/pages/testcases/stateArrayReverse.ets new file mode 100644 index 000000000..bc8e5eb5b --- /dev/null +++ b/compiler/compiler/sample/pages/testcases/stateArrayReverse.ets @@ -0,0 +1,72 @@ + +/* + StateArrayReverse test case + + The purpose of this test case is verify what happens when re-ordering the Widgets / Components + of same type. Here, the test is done with built-in text (not with a own subclass of JSView) + + The expectation is that TextElement objects are created only once, then put to new order. + For this to work, each time a TextComponent is created it needs to be assigned the same unique key. + + This is why anArray is not a simple array of strings. strings are not uniquely identifyable + (in SwiftUI). Therefore, the app needs to provide a unique id for each array item. + We do so by making each array item an object with a unique id. + + TODO this id should be used as the 'key' argument when creating a Text. + +*/ + +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + + +class Item1 { + id:number; + label:string; + + constructor(id:number, label:string){ + this.id = id; + this.label = label; + } +} + +@Entry +@Component +struct ShufflingArrayContainer1 { + + @State anArray:Item1[] = [ + new Item1(1, "Text 1"), + new Item1(2, "Text 2"), + new Item1(3, "Text 3"), + new Item1(4, "Text 4"), + new Item1(5, "Text 5") + ]; + + build() { + Column(){ + ForEach(this.anArray, + (item:Item1) => {Text(item.label)}, + (item:Item1) => item.id.toString() + ) //ForEach + Button("Reverse array") + .width(500.0) + .height(150.0) + .onClick(() => { + this.anArray.reverse(); + console.log("onClick handler on ShufflingArrayContainer1, this.anArray: " + JSON.stringify(this.anArray)); + }) //Button + } // Column + } // build +} // class diff --git a/compiler/compiler/sample/pages/testcases/stateArrayReverseCustomView.ets b/compiler/compiler/sample/pages/testcases/stateArrayReverseCustomView.ets new file mode 100644 index 000000000..f6e3bc1ba --- /dev/null +++ b/compiler/compiler/sample/pages/testcases/stateArrayReverseCustomView.ets @@ -0,0 +1,94 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + + +class Item{ + id:number = 0; + label:string = ''; + + constructor(id:number, label:string){ + this.id = id; + this.label = label; + } +} + +@Component +struct CustomRow { + item:Item; + + build(){ + Row(){ + Text("label: ") + Text(this.item.label) + Text(", cap: ") + Text(this.item.label.toUpperCase()) + Text(", rev: ") + Text(this.item.label.split("").reverse().join("")) + } + } +} + +@Component +struct CustomText { + item:Item; + + build() { + Column() { + Text(this.item.label) + } + } +} + +@Entry +@Component +struct ShufflingArrayContainer { + @State anArray:Item[] = [ + new Item(1, "Text 1"), + new Item(2, "Text 2"), + new Item(3, "Text 3"), + new Item(4, "Text 4"), + new Item(5, "Text 5") + ]; + + build() { + Column(){ + ForEach(this.anArray, + (item:Item) => {CustomRow({ item:item })}, + (item:Item) => item.id.toString() + ) //ForEach + Button("Reverse anArray") + .width(500.0) + .height(150.0) + .onClick(() => { + // replace entire array + this.anArray = (this.anArray[0].id == 1) ? + [ + new Item(10, "Text A"), + new Item(20, "Text B"), + new Item(30, "Text C"), + new Item(40, "Text D"), + new Item(50, "Text E") + ] : [ + new Item(1, "Text 1"), + new Item(2, "Text 2"), + new Item(3, "Text 3"), + new Item(4, "Text 4"), + new Item(5, "Text 5") + ]; + console.log("click handler on ShufflingArrayContainer, this.anArray: " + JSON.stringify(this.anArray)); + }) // click + } //Column + } //build +} //struct diff --git a/compiler/compiler/sample/pages/testcases/stateComplexType.ets b/compiler/compiler/sample/pages/testcases/stateComplexType.ets new file mode 100644 index 000000000..6071b5aec --- /dev/null +++ b/compiler/compiler/sample/pages/testcases/stateComplexType.ets @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + + +// Customize the status data class. +class Model { + value: string = ''; + constructor(value: string) { + this.value = value; + } +} + +@Entry +@Component +struct EntryComponent { + build() { + Column(){ + MyComponentState() //MyComponent1 in this document + MyComponentState() //MyComponent2 in this document + } + } +} + +@Component +struct MyComponentState { + + @State title: Model = new Model('Hello World') + @State count: number = 0 + private toggle: boolean = true + + build() { + + Column(){ + Text(`${this.title.value}`) + Button() + .onClick(() => { + this.toggle != this.toggle; + this.title.value = this.toggle ? 'Hello World' : 'Hello Ace'; + }) // Modify the internal status data of MyComponent using the anonymous method. + + Button() { + Text(`click times: ${this.count}`) + .fontSize(10) + }.onClick(() => { + this.count += 1 + }) + } + + } +} diff --git a/compiler/compiler/sample/pages/testcases/stateStateBindingProp.ets b/compiler/compiler/sample/pages/testcases/stateStateBindingProp.ets new file mode 100644 index 000000000..5e4ae423a --- /dev/null +++ b/compiler/compiler/sample/pages/testcases/stateStateBindingProp.ets @@ -0,0 +1,107 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + + +class GreenButtonState { + width:number = 0; + + constructor(width:number) { + this.width = width; + } +} + +@Component +struct GreenButton { + @Link greenButtonState:GreenButtonState; + + build() { + Button("Green Button") + .width(this.greenButtonState.width) + .height(150.0) + .backgroundColor("#00ff00") + .onClick(() => { + this.greenButtonState.width = (this.greenButtonState.width < 700) ? this.greenButtonState.width + 125 : 100; + console.log("onClick handler on GreenButton, updated value this.greenButtonState.width: " + this.greenButtonState.width); + }) + } +} + +@Component +struct RedButton { + @State redButtonState:number = 100; + + build() { + Button("Red Button") + .width(this.redButtonState) + .height(150.0) + .backgroundColor("#ff0000") + .onClick(() => { + this.redButtonState = (this.redButtonState < 700) ? this.redButtonState + 80 : 100; + console.log("onClick handler on RedButton, updated value this.redButtonState: " + this.redButtonState); + }) + } +} + +@Component +struct YellowButton { + @Prop yellowButtonState:number; + + build(){ + Button("Yellow Button") + .width(this.yellowButtonState) + .height(150.0) + .backgroundColor("#ffff00") + .onClick(() => { + this.yellowButtonState += 50.0; + console.log("onClick handler on YellowButton, updated value this.yellowButtonState: " + this.yellowButtonState); + }) + } +} + +@Entry +@Component +struct ShufflingContainer { + @State shuffle:boolean = false; + @State greenButtonState:GreenButtonState = new GreenButtonState(300); + @State yellowButtonProp:number = 100; + + build() { + Column(){ + Button(`Parent View: ${this.shuffle ? 'Shuffle to Red before Green' : 'Shuffle to Green before Red'}`) + .width(700.0) + .height(150.0) + .onClick(() => { + this.shuffle = !this.shuffle + console.log("onClick handler on ShufflingContainer, updated value this.shuffle: " + this.shuffle); + }) //Button "B1" + Button("Parent View: Set yellowButtonProp") + .width(700.0) + .height(150.0) + .onClick(() => { + this.yellowButtonProp = (this.yellowButtonProp < 700) ? this.yellowButtonProp + 100 : 100; + console.log("onClick handler on ShufflingContainer, updated value of yellowButtonProp: " + this.yellowButtonProp); + }) //Button "B2" + if(this.shuffle) { + GreenButton({ greenButtonState: $greenButtonState }) + RedButton() + YellowButton({ yellowButtonState: this.yellowButtonProp }) + } else { + RedButton() + YellowButton({ yellowButtonState: this.yellowButtonProp }) + GreenButton({ greenButtonState: $greenButtonState }) + } + } + } +} \ No newline at end of file diff --git a/compiler/compiler/sample/pages/testcases/struct-01.ets b/compiler/compiler/sample/pages/testcases/struct-01.ets new file mode 100644 index 000000000..941dd29f7 --- /dev/null +++ b/compiler/compiler/sample/pages/testcases/struct-01.ets @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + +@Component +@Entry +struct MyComponent7 { + build() { + } +} \ No newline at end of file diff --git a/compiler/compiler/sample/pages/testcases/struct-02.ets b/compiler/compiler/sample/pages/testcases/struct-02.ets new file mode 100644 index 000000000..3ecc7a771 --- /dev/null +++ b/compiler/compiler/sample/pages/testcases/struct-02.ets @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + + +struct MyComponent8 { + build() { + } +} \ No newline at end of file diff --git a/compiler/compiler/sample/pages/todo.ets b/compiler/compiler/sample/pages/todo.ets new file mode 100644 index 000000000..033ff0d97 --- /dev/null +++ b/compiler/compiler/sample/pages/todo.ets @@ -0,0 +1,178 @@ + +/** + * ACE @ Web Helsinki + * + * eDSL version of TODO application + * + * ( unverified due to lack of working eDSL transpiler ) + * + * For comparison, the plain JS version of this app that works with ACE-Diff can be found here + * https://rnd-gitlab-eu-c.huawei.com/zidanehbs/ace/ace/-/blob/fin-hmf-dev-ace-diff-clean/samples/common/res/hi_topapp/assets/js/default/acediff/todoListForEach.js + * This is the ouput the eDSL transpiler should generate. + */ + +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + + +let tasks: Array = [ + { label: "Wash the car" }, + { label: "Buy some milk" }, + { label: "Make the report" }, + { label: "Buy flight tickets" }, + { label: "Update profile" }, + { label: "Change tyres" }, + { label: "Walk the dog" }, + { label: "Feed the dog" }, + { label: "Paint the walls" }, + { label: "Wash dishes" }, + { label: "Water flowers" }, + { label: "Call parents" }, + { label: "Refactor: align_component.cpp" }, + { label: "Refactor: align_component.h" }, + { label: "Refactor: arc_component.cpp" }, + { label: "Refactor: arc_component.h" }, + { label: "Refactor: block_component.cpp" }, + { label: "Refactor: block_component.h" }, + { label: "Refactor: box_base_component.cpp" }, + { label: "Refactor: box_base_component.h" }, + { label: "Refactor: box_component.cpp" }, + { label: "Refactor: box_component.h" }, + { label: "Refactor: bubble_component.cpp" }, + { label: "Refactor: bubble_component.h" }, + { label: "Refactor: button_component.cpp" }, + { label: "Refactor: button_component.h" }, + { label: "Refactor: calendar_component.cpp" }, + { label: "Refactor: calendar_component.h" }, + { label: "Refactor: calendar_data_adapter.cpp" }, + { label: "Refactor: calendar_data_adapter.h" }, + { label: "Refactor: chart_component.cpp" }, + { label: "Refactor: chart_component.h" }, + { label: "Refactor: checkable_component.cpp" }, + { label: "Refactor: checkable_component.h" }, + { label: "Refactor: clip_component.cpp" }, + { label: "Refactor: clip_component.h" }, + { label: "Refactor: component.cpp" }, + { label: "Refactor: component_group.h" }, + { label: "Refactor: component.h" }, + { label: "Refactor: composed_component.cpp" }, + { label: "Refactor: composed_component.h" }, + { label: "Refactor: constants.cpp" }, + { label: "Refactor: constants.h" }, + { label: "Refactor: sole_child_component.h" }, + { label: "Refactor: stack_component.h" }, + { label: "Refactor: stage_component.h" }, + { label: "Refactor: swiper_component.h" }, + { label: "Refactor: tab_bar_component.cpp" }, + { label: "Refactor: tab_bar_component.h" }, + { label: "Refactor: tab_bar_indicator_component.cpp" }, + { label: "Refactor: tab_bar_indicator_component.h" }, + { label: "Refactor: tab_bar_item_component.cpp" }, + { label: "Refactor: tab_bar_item_component.h" }, + { label: "Refactor: tab_content_component.cpp" }, + { label: "Refactor: tab_content_component.h" }, + { label: "Refactor: tab_controller.cpp" }, + { label: "Refactor: tab_controller.h" }, + { label: "Refactor: test" }, + { label: "Refactor: text_component.cpp" }, + { label: "Refactor: text_component.h" }, + { label: "Refactor: text_field_component.cpp" }, + { label: "Refactor: text_field_component.h" }, + { label: "Refactor: text_field_controller.cpp" }, + { label: "Refactor: text_field_controller.h" }, + { label: "Refactor: text_overlay_component.cpp" }, + { label: "Refactor: text_overlay_component.h" }, + { label: "Refactor: text_span_component.cpp" }, + { label: "Refactor: text_span_component.h" }, + { label: "Refactor: texture_component.cpp" }, + { label: "Refactor: texture_component.h" }, + { label: "Refactor: toast_component.cpp" }, + { label: "Refactor: toast_component.h" }, + { label: "Refactor: toggle_component.cpp" }, + { label: "Refactor: toggle_component.h" }, + { label: "Refactor: touch_listener_component.h" }, + { label: "Refactor: track_component.cpp" }, + { label: "Refactor: track_component.h" }, + { label: "Refactor: transform_component.cpp" }, + { label: "Refactor: transform_component.h" }, + { label: "Refactor: transition_component.cpp" }, + { label: "Refactor: transition_component.h" }, + { label: "Refactor: triangle_component.cpp" }, + { label: "Refactor: triangle_component.h" }, + { label: "Refactor: tween_component.cpp" }, + { label: "Refactor: tween_component.h" }, + { label: "Refactor: video_component.cpp" }, + { label: "Refactor: video_component.h" }, + { label: "Refactor: watch_slider_component.cpp" }, + { label: "Refactor: watch_slider_component.h" }, + { label: "Refactor: wrap_component.h" }, + { /* not used */ } +] + +// Add ID for each task +tasks.forEach(function (item, index) { + item.id = index + tasks[index] = item +}) + +let tasksCount: number = tasks.length - 1 +let screenCount: number = 20 + +@Entry +@Component +struct RootView { + @State idx: number = 0 + + build() { + Column () { + Column() { + Row() { + Button("Next task") + .onClick(() => { + if (this.idx < tasksCount - screenCount) + this.idx++ + }) + Button("Prev task") + .onClick(() => { + if (this.idx > 0) + this.idx-- + }) + } + } + ForEach( + /* first parameter is an expression of type array. + the point of not just using an array here is to clarify ForEach can not just perate on the + source array (as repeat implementation in ACE-Light did) */ + tasks.slice(this.idx, this.idx + screenCount), + + /* the third, builder function take an item as input and creates a single View from it */ + item => { + Text((item.id + 1) + " : " + item.label) + }, + + /* second parameter is a arrow function that takes an item as input + and returns a persistent nique id (or key ) */ + item => item.id + ) // ForEach + Text("--- Page navigation ---") + Row() { + Button("First") + .onClick(() => this.idx = 0) + Button("End") + .onClick(() => this.idx = tasksCount - screenCount) + } + } + } // build +} // struct diff --git a/compiler/compiler/src/compile_info.ts b/compiler/compiler/src/compile_info.ts new file mode 100644 index 000000000..41693a175 --- /dev/null +++ b/compiler/compiler/src/compile_info.ts @@ -0,0 +1,233 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + +import Stats from 'webpack/lib/Stats'; +import Compiler from 'webpack/lib/Compiler'; +import { + configure, + getLogger +} from 'log4js'; +import RawSource from 'webpack-sources/lib/RawSource'; + +import { + BUILDIN_STYLE_NAMES, + EXTEND_ATTRIBUTE +} from './component_map'; +import { transformLog } from './process_ui_syntax'; +import { + dollarCollection, + componentCollection, + moduleCollection +} from './validate_ui_syntax'; +import { decoratorParamSet } from './process_component_member'; +import { appComponentCollection } from './process_component_build'; +import { projectConfig } from '../main'; + +configure({ + appenders: { 'ETS': {type: 'stderr', layout: {type: 'messagePassThrough'}}}, + categories: {'default': {appenders: ['ETS'], level: 'info'}} +}); +export const logger = getLogger('ETS'); + +const props: string[] = []; + +interface Info { + message?: string; + issue?: { + message: string, + file: string, + location: { start?: { line: number, column: number } } + }; +} + +export class ResultStates { + private mStats: Stats; + private mErrorCount: number = 0; + private mWarningCount: number = 0; + private warningCount: number = 0; + private noteCount: number = 0; + private red: string = '\u001b[31m'; + private yellow: string = '\u001b[33m'; + private blue: string = '\u001b[34m'; + private reset: string = '\u001b[39m'; + + public apply(compiler: Compiler): void { + compiler.hooks.compilation.tap('SourcemapFixer', compilation => { + compilation.hooks.afterProcessAssets.tap('SourcemapFixer', assets => { + Reflect.ownKeys(assets).forEach(key => { + if (/\.map$/.test(key.toString())) { + assets[key]._value = assets[key]._value.toString().replace('.ets?entry', '.ets'); + } + }); + } + ); + }); + + compiler.hooks.done.tap('Result States', (stats: Stats) => { + this.mStats = stats; + this.warningCount = 0; + this.noteCount = 0; + if (this.mStats.compilation.errors) { + this.mErrorCount = this.mStats.compilation.errors.length; + } + if (this.mStats.compilation.warnings) { + this.mWarningCount = this.mStats.compilation.warnings.length; + } + props.push(...dollarCollection, ...decoratorParamSet, ...BUILDIN_STYLE_NAMES); + this.printResult(); + }); + + if (!projectConfig.isPreview) { + compiler.hooks.compilation.tap('Collect Components And Modules', compilation => { + compilation.hooks.additionalAssets.tapAsync('Collect Components And Modules', callback => { + compilation.assets['./component_collection.txt'] = + new RawSource(Array.from(appComponentCollection).join(",")); + compilation.assets['./module_collection.txt'] = + new RawSource(moduleCollection.size === 0 ? 'NULL' : Array.from(moduleCollection).join(",")); + callback(); + }); + }) + } + } + + private printResult(): void { + this.printWarning(); + this.printError(); + if (this.mErrorCount + this.warningCount + this.noteCount > 0) { + let result: string; + let resultInfo: string = ''; + if (this.mErrorCount > 0) { + resultInfo += `ERROR:${this.mErrorCount}`; + result = 'FAIL '; + } else { + result = 'SUCCESS '; + } + if (this.warningCount > 0) { + resultInfo += ` WARN:${this.warningCount}`; + } + if (this.noteCount > 0) { + resultInfo += ` NOTE:${this.noteCount}`; + } + logger.info(this.blue, 'COMPILE RESULT:' + result + `{${resultInfo}}`, this.reset); + } else { + console.info(this.blue, 'COMPILE RESULT:SUCCESS ', this.reset); + } + } + + private printWarning(): void { + if (this.mWarningCount > 0) { + const warnings: Info[] = this.mStats.compilation.warnings; + const length: number = warnings.length; + for (let index = 0; index < length; index++) { + const message: string = warnings[index].message.replace(/^Module Warning\s*.*:\n/, '') + .replace(/\(Emitted value instead of an instance of Error\) BUILD/, ''); + if (/^NOTE/.test(message)) { + this.noteCount++; + logger.info(this.blue, message, this.reset, '\n'); + } else { + this.warningCount++; + logger.warn(this.yellow, message.replace(/^WARN/, 'ETS:WARN'), this.reset, '\n'); + } + } + if (this.mWarningCount > length) { + this.warningCount = this.warningCount + this.mWarningCount - length; + } + } + } + + private printError(): void { + if (this.mErrorCount > 0) { + const errors: Info[] = [...this.mStats.compilation.errors]; + for (let index = 0; index < errors.length; index++) { + if (errors[index].issue) { + const position: string = errors[index].issue.location + ? `:${errors[index].issue.location.start.line}:${errors[index].issue.location.start.column}` + : ''; + const location: string = errors[index].issue.file + position; + const detail: string = errors[index].issue.message; + logger.error(this.red, 'ETS:ERROR File: ' + location, this.reset); + logger.error(this.red, detail, this.reset, '\n'); + } else if (/BUILDERROR/.test(errors[index].message)) { + const errorMessage: string = errors[index].message.replace(/^Module Error\s*.*:\n/, '') + .replace(/\(Emitted value instead of an instance of Error\) BUILD/, '') + .replace(/^ERROR/, 'ETS:ERROR'); + this.printErrorMessage(errorMessage, true, errors[index]); + } else { + let errorMessage: string = `${errors[index].message.replace(/\[tsl\]\s*/, '') + .replace(/\u001b\[.*?m/g, '').replace(/\.ets\.ts/g, '.ets').trim()}\n`; + errorMessage = this.filterModuleError(errorMessage) + .replace(/^ERROR in /, 'ETS:ERROR File: ').replace(/\s{6}TS/g, ' TS') + .replace(/\(([0-9]+),([0-9]+)\)/, ':$1:$2'); + this.printErrorMessage(errorMessage, false, errors[index]); + } + } + } + } + private printErrorMessage(errorMessage: string, lineFeed: boolean, errorInfo: Info): void { + if (this.validateError(errorMessage)) { + if (lineFeed) { + logger.error(this.red, errorMessage + '\n', this.reset); + } else { + logger.error(this.red, errorMessage, this.reset); + } + } else { + const errorsIndex = this.mStats.compilation.errors.indexOf(errorInfo); + this.mStats.compilation.errors.splice(errorsIndex, 1); + this.mErrorCount = this.mErrorCount - 1; + } + } + private validateError(message: string): boolean { + const propInfoReg: RegExp = /Cannot find name\s*'(\$?[_a-zA-Z0-9]+)'/; + const componentNameReg: RegExp = /'typeof\s*(\$?[_a-zA-Z0-9]+)' is not callable/; + const stateInfoReg: RegExp = /Property\s*'(\$[_a-zA-Z0-9]+)' does not exist on type/; + const extendInfoReg: RegExp = /Property\s*'([_a-zA-Z0-9]+)' does not exist on type\s*'([_a-zA-Z0-9]+)'\./; + if (this.matchMessage(message, props, propInfoReg) || + this.matchMessage(message, [...componentCollection.customComponents], componentNameReg) || + this.matchMessage(message, props, stateInfoReg) || + this.matchMessage(message, EXTEND_ATTRIBUTE, extendInfoReg, true)) { + return false; + } + return true; + } + private matchMessage(message: string, nameArr: any, reg: RegExp, + validateComponent: boolean = false): boolean { + if (reg.test(message)) { + const match: string[] = message.match(reg); + if (validateComponent) { + if (match[1] && match[2] && nameArr.has(match[2])) { + const attributeArray: string[] = [...nameArr.get(match[2])].map(item => item.attribute); + if (attributeArray.includes(match[1])) { + return true; + } + } + } else { + if (match[1] && nameArr.includes(match[1])) { + return true; + } + } + } + return false; + } + private filterModuleError(message: string): string { + if (/You may need an additional loader/.test(message) && transformLog && transformLog.sourceFile) { + const fileName: string = transformLog.sourceFile.fileName.replace(/.ts$/, ''); + const errorInfos: string[] = message.split('You may need an additional loader to handle the result of these loaders.'); + if (errorInfos && errorInfos.length > 1 && errorInfos[1]) { + message = `ERROR in ${fileName}\n The following syntax is incorrect.${errorInfos[1]}`; + } + } + return message; + } +} diff --git a/compiler/compiler/src/component_map.ts b/compiler/compiler/src/component_map.ts new file mode 100644 index 000000000..5f3508b27 --- /dev/null +++ b/compiler/compiler/src/component_map.ts @@ -0,0 +1,455 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + +export const COMPONENT_MAP: any = { + Search: { + atomic: true, + attrs: [ + 'searchButton', 'placeholderColor', 'placeholderFont', 'onSubmit', 'onChange' + ] + }, + FormComponent: { + atomic: true, + attrs: [ + 'size', 'moduleName', 'dimension', 'allowUpdate', 'visibility', + 'onAcquired', 'onError', 'onRouter' + ] + }, + Image: { + atomic: true, + attrs: [ + 'alt', 'objectFit', 'matchTextDirection', 'fitOriginalSize', 'objectRepeat', 'renderMode', 'interpolation', + 'onComplete', 'onError', 'onFinish', 'sourceSize', 'fillColor', 'autoResize' + ] + }, + ImageAnimator: { + atomic: true, + attrs: [ + 'images', 'state', 'duration', 'reverse', 'fixedSize', 'preDecode', 'fillMode', 'iterations', 'onStart', + 'onPause', 'onRepeat', 'onCancel', 'onFinish' + ] + }, + Animator: { + atomic: true, + noDebugLine: true, + attrs: [ + 'state', 'duration', 'curve', 'delay', 'fillMode', 'iterations', 'playMode', 'motion', 'onStart', + 'onPause', 'onRepeat', 'onCancel', 'onFinish', 'onFrame' + ] + }, + Refresh: { + single: true, + attrs: [ + 'refreshing', 'offset', 'friction', + 'onStateChange', 'onRefreshing' + ] + }, + SpringProp: { + atomic: true + }, + SpringMotion: { + atomic: true + }, + FrictionMotion: { + atomic: true + }, + ScrollMotion: { + atomic: true + }, + Text: { + children: ['Span'], + attrs: [ + 'fontColor', 'fontSize', 'fontStyle', 'fontWeight', 'textAlign', 'lineHeight', 'textOverflow', 'maxLines', + 'decoration', 'letterSpacing', 'textCase', 'baselineOffset', 'minFontSize', 'maxFontSize' + ] + }, + TextPicker: { + atomic: true, + attrs: ['defaultPickerItemHeight', 'onAccept', 'onCancel', 'onChange'] + }, + DatePicker: { + atomic: true, + attrs: ['lunar', 'onChange', 'useMilitaryTime'] + }, + Span: { + atomic: true, + attrs: [ + 'fontColor', 'fontSize', 'fontStyle', 'fontFamily', 'fontWeight', 'decoration', 'letterSpacing', 'textCase' + ] + }, + Button: { + attrs: ['type', 'stateEffect', 'fontColor', 'fontSize', 'fontWeight'] + }, + Divider: { + atomic: true, + attrs: ['color', 'vertical', 'strokeWidth', 'lineCap'] + }, + Piece: { + atomic: true, + attrs: ['iconPosition'] + }, + Slider: { + atomic: true, + attrs: ['blockColor', 'trackColor', 'selectedColor', 'minLabel','maxLabel', 'showSteps', 'showTips', 'onChange'] + }, + Counter: { + attrs: [ + 'onStateChange', 'onInc', + 'onDec', 'height', 'width' + ] + }, + Row: { + attrs: ['alignItems'] + }, + Column: { + attrs: ['alignItems'] + }, + Stack: { + attrs: ['alignContent'] + }, + List: { + children: ['ListItem', 'Section'], + attrs: [ + 'listDirection', 'scrollBar', 'edgeEffect', 'divider', 'editMode', 'cachedCount', 'chainAnimation', + 'onScroll', 'onReachStart', 'onReachEnd', 'onScrollStop', 'onItemDelete', 'onItemMove' + ] + }, + ListItem: { + parents: ['List'], + single: true, + attrs: ['sticky', 'editable'] + }, + Grid: { + children: ['GridItem'], + attrs: ['columnsTemplate', 'rowsTemplate', 'columnsGap', 'rowsGap', 'scrollBar', 'scrollBarWidth', 'scrollBarColor'] + }, + GridItem: { + parents: ['Grid'], + single: true, + attrs: ['rowStart', 'rowEnd', 'columnStart', 'columnEnd', 'forceRebuild'] + }, + GridContainer: { + attrs: ['columns', 'sizeType', 'gutter', 'margin'] + }, + Hyperlink: { + attrs: ['color'] + }, + Swiper: { + attrs: [ + 'index', 'autoPlay', 'interval', 'indicator', + 'loop', 'duration', 'vertical', 'itemSpace', 'displayMode', 'onChange' + ] + }, + Stepper: { + children: ['StepperItem'], + attrs: [ + 'onFinish', 'onSkip', 'onChange', 'onNext', 'onPrevious' + ] + }, + StepperItem: { + parents: ['Stepper'], + single: true, + attrs: ['prevLabel', 'nextLabel', 'status'] + }, + Rating: { + attrs: ['stars', 'stepSize', 'starStyle', 'onChange'] + }, + Calendar: { + attrs: [ + 'date', 'showLunar', 'startOfWeek', 'offDays', 'onSelectChange', 'onRequestData', + 'currentData', 'preData', 'nextData', 'needSlide', 'showHoliday', 'direction', + 'currentDayStyle', 'nonCurrentDayStyle', 'todayStyle', 'weekStyle', 'workStateStyle' + ] + }, + Panel: { + attrs: [ + 'type', 'mode', 'dragBar', 'fullHeight', + 'halfHeight', 'miniHeight', 'show', 'onChange' + ] + }, + Navigator: { + single: true, + attrs: ['target', 'type', 'params', 'active'] + }, + Sheet: { + children: ['Section'], + attrs: [] + }, + Section: { + attrs: [] + }, + QRCode: { + attrs: ['color', 'backgroundColor'] + }, + Flex: { + attrs: [] + }, + LoadingProgress: { + atomic: true, + attrs: ['color'] + }, + NavigationView: { + attrs: [] + }, + Scroll: { + attrs: [ + 'scrollable', 'onScroll', 'onScrollEdge', 'onScrollEnd', 'scrollBar', 'scrollBarColor', + 'scrollBarWidth', 'edgeEffect' + ] + }, + Shape: { + children: ['Rect', 'Path', 'Circle', 'Ellipse', 'Shape', 'Polyline', 'Polygon', 'Image', 'Text'], + attrs: [ + 'stroke', 'fill', 'strokeDashOffset', 'strokeLineCap', + 'strokeLineJoin', 'strokeMiterLimit', 'strokeOpacity', + 'fillOpacity', 'strokeWidth', 'antiAlias', 'strokeDashArray', + 'viewPort' + ] + }, + Progress: { + atomic: true, + attrs: [ + 'value', 'color', 'cricularStyle', 'circularStyle' + ] + }, + Rect: { + atomic: true, + attrs: [ + 'radiusWidth', 'radiusHeight', 'radius' + ] + }, + Path: { + atomic: true, + attrs: [ + 'commands' + ] + }, + Circle: { + atomic: true + }, + Ellipse: { + atomic: true + }, + Camera: { + atomic: true, + attrs: ['devicePosition'] + }, + Tabs: { + children: ['TabContent'], + attrs: [ + 'vertical', 'scrollable', 'barMode', 'barWidth', 'barHeight', 'animationDuration', + 'onChange' + ] + }, + TabContent: { + parents: ['Tabs'], + attrs: ['tabBar'] + }, + PageTransitionEnter: { + atomic: true, + noDebugLine: true, + attrs: ['onEnter'] + }, + PageTransitionExit: { + atomic: true, + noDebugLine: true, + attrs: ['onExit'] + }, + Blank: { + parents: ['Row', 'Column'], + atomic: true, + attrs: ['color'] + }, + RowSplit: { + attrs: ['resizeable'] + }, + ColumnSplit: { + attrs: ['resizeable'] + }, + Toggle: { + attrs: ['onChange', 'selectedColor', 'swithPointStyle'] + }, + AlertDialog: { + attrs: ['show'] + }, + ActionSheet: { + attrs: ['show'] + }, + Video: { + atomic: true, + attrs: [ + 'muted', 'autoPlay', 'controls', 'loop', 'objectFit', 'onSeeking', 'onFullscreenChange', + 'onStart', 'onPause', 'onPrepared', 'onFinish', 'onSeeked', 'onUpdate', 'onError' + ] + }, + AbilityComponent: { + attrs: ['onReady', 'onDestroy', 'onAbilityCreated', 'onAbilityMoveToFront', 'onAbilityWillRemove'] + }, + AlphabetIndexer: { + attrs: [ + 'onSelected', 'selectedColor', 'popupColor', 'selectedBackgroundColor', 'popupBackground', 'usingPopup', + 'selectedFont', 'popupFont', 'itemSize', 'font', 'color', 'alignStyle' + ] + }, + Radio: { + atomic: true, + attrs: ['checked', 'onChange'] + }, + Web: { + atomic: true, + attrs: ['pagestart', 'pagefinish', 'error','message', 'reload'] + }, + GeometryView: { + atomic: true + }, + DataPanel: { + atomic: false, + attrs: ['closeEffect'] + }, + Badge: { + atomics: true, + attrs: [] + }, + Line: { + atomic: true, + attrs: [ + 'startPoint','endPoint' + ] + }, + Polygon: { + atomic: true, + attrs: ['points'] + }, + Polyline: { + atomic: true, + attrs: ['points'] + }, + Gauge: { + atomic: true, + attrs: ['value', 'startAngle', 'endAngle', 'colors', 'strokeWidth', 'labelTextConfig', 'labelColorConfig'] + }, + TextArea: { + atomic: true, + attrs: [ + 'placeholderColor', 'placeholderFont', 'textAlign', 'caretColor', 'onChange' + ] + }, + TextInput: { + atomic: true, + attrs: [ + 'type', 'placeholderColor', 'placeholderFont', 'enterKeyType', 'caretColor', 'maxLength', 'onEditChanged', + 'onSubmit', 'onChange' + ] + }, + Marquee: { + atomic: true, + attrs: ['fontColor', 'fontSize', 'allowScale', 'fontWeight', 'fontFamily', 'onStart', 'onBounce', 'onFinish'] + }, + Menu: { + children: ['Option'], + attrs: ['show', 'showPosition', 'fontColor', 'fontSize', 'fontWeight', 'fontFamily'], + }, + Option: { + parents: ['Menu'], + attrs: ['fontColor', 'fontSize', 'fontWeight', 'fontFamily'], + }, +}; + +const COMMON_ATTRS: Set = new Set([ + 'width', 'height', 'size', 'constraintSize', 'layoutPriority', 'layoutWeight', + 'padding', 'paddingLeft', 'paddingRight', 'paddingTop', 'paddingBottom', + 'margin', 'marginLeft', 'marginRight', 'marginTop', 'marginBottom', + 'border', 'borderStyle', 'borderWidth', 'borderColor', 'borderRadius', + 'backgroundColor', 'backgroundImage', 'backgroundImageSize', 'backgroundImagePosition', + 'opacity', 'animation', 'transition', + 'navigationTitle', 'navigationSubTitle', 'hideNavigationBar', 'hideNavigationBackButton', + 'toolBar', 'hideToolBar', 'onClick', 'onTouch', 'onKeyEvent', 'onHover', + 'blur', 'backdropBlur', 'windowBlur', 'translate', 'rotate', 'scale', 'transform', + 'onAppear', 'onDisAppear', 'visibility', 'flexBasis', 'flexShrink', 'flexGrow', 'alignSelf', + 'useAlign', 'zIndex', 'sharedTransition', 'direction', 'align', 'position', 'markAnchor', 'offset', + 'enabled', 'aspectRatio', 'displayPriority', + 'onDrag', 'onDragEnter', 'onDragMove', 'onDragLeave', 'onDrop', + 'overlay', 'linearGradient', 'sweepGradient', 'radialGradient', + 'gridOffset', 'gridSpan', 'useSizeType', + 'motionPath', 'clip', 'shadow', 'mask', + 'accessibilityGroup', 'accessibilityText', 'accessibilityDescription', + 'accessibilityImportance', 'onAccessibility', 'grayscale', 'brightness', 'contrast', + 'saturate', 'geometryTransition', + 'bindPopup', 'colorBlend', 'invert', 'sepia', 'hueRotate', 'bindMenu' +]); +const TRANSITION_COMMON_ATTRS: Set = new Set([ + 'slide', 'translate', 'scale', 'opacity' +]); +export const GESTURE_ATTRS: Set = new Set([ + 'gesture', 'parallelGesture', 'priorityGesture' +]); + +export const forbiddenUseStateType: Set = new Set(['Scroller', 'SwiperScroller', + 'VideoController', 'CustomDialogController', 'SwiperController', 'TabsController', + 'CalendarController', 'AbilityController' +]); + +export const INNER_COMPONENT_NAMES: Set = new Set(); +export const NO_DEBUG_LINE_COMPONENT: Set = new Set(); +export const BUILDIN_CONTAINER_COMPONENT: Set = new Set(); +export const BUILDIN_STYLE_NAMES: Set = new Set([ + ...COMMON_ATTRS, ...GESTURE_ATTRS, ...TRANSITION_COMMON_ATTRS +]); +export const AUTOMIC_COMPONENT: Set = new Set(); +export const SINGLE_CHILD_COMPONENT: Set = new Set(); +export const SPECIFIC_CHILD_COMPONENT: Map> = new Map(); +export const GESTURE_TYPE_NAMES: Set = new Set([ + 'TapGesture', 'LongPressGesture', 'PanGesture', 'PinchGesture', 'RotationGesture', 'GestureGroup' +]); +export const CUSTOM_BUILDER_METHOD: Set = new Set(); + +export interface ExtendParamterInterfance { + attribute: string, + parameterCount: number +} +export const EXTEND_ATTRIBUTE: Map> = new Map(); + +export const JS_BIND_COMPONENTS: Set = new Set([ + ...GESTURE_TYPE_NAMES, 'Gesture', + 'PanGestureOption', 'CustomDialogController', 'Storage', 'Scroller', 'SwiperController', + 'TabsController', 'CalendarController', 'AbilityController', 'VideoController' +]); + +(function initComponent() { + Object.keys(COMPONENT_MAP).forEach((componentName) => { + INNER_COMPONENT_NAMES.add(componentName); + JS_BIND_COMPONENTS.add(componentName); + if (!COMPONENT_MAP[componentName].atomic) { + BUILDIN_CONTAINER_COMPONENT.add(componentName); + } else { + AUTOMIC_COMPONENT.add(componentName); + } + if (COMPONENT_MAP[componentName].single) { + SINGLE_CHILD_COMPONENT.add(componentName); + } + if (COMPONENT_MAP[componentName].children) { + SPECIFIC_CHILD_COMPONENT.set(componentName, + new Set([...COMPONENT_MAP[componentName].children])); + } + if (COMPONENT_MAP[componentName].attrs && COMPONENT_MAP[componentName].attrs.length) { + COMPONENT_MAP[componentName].attrs.forEach((item) => { + BUILDIN_STYLE_NAMES.add(item); + }); + } + if (COMPONENT_MAP[componentName].noDebugLine) { + NO_DEBUG_LINE_COMPONENT.add(componentName); + } + }); +})(); diff --git a/compiler/compiler/src/create.ts b/compiler/compiler/src/create.ts new file mode 100644 index 000000000..c7e0c9cb9 --- /dev/null +++ b/compiler/compiler/src/create.ts @@ -0,0 +1,109 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + +const fs = require('fs'); +const program = require('commander'); + +program.parse(process.argv); +let name:string = 'HelloAce'; +let appID:string = 'ace.helloworld'; +let appName:string = 'HelloAce'; +if (program.args && program.args[0]) { + name = program.args[0]; + appID = program.args[0]; + appName = program.args[0]; +} + +const regPath: RegExp = /[`~!@#$%^&*()_+<>?:"{},./;'[\]]/im; + +/* + * Create sample project and files. + * @param dist {String} + */ +function createProject(dist: string) { + const dist_ = dist.trim().split('/'); + if (dist_.length > 1 || regPath.test(dist)) { + return console.error( + 'ERROR: The project name cannot be a path nor contain any special symbol.\n' + + "NOTE: To create the template project, run 'npm run create' in the root directory.\n" + + "NOTE: To customize the project name, run 'npm run create '."); + } + const appPath:string = dist + '/app.ets'; + const manifestPath:string = dist + '/manifest.json'; + const indexPath:string = dist + '/pages/index.ets'; + + const app:string = `export default { + onCreate() { + console.info('Application onCreate') + }, + onDestroy() { + console.info('Application onDestroy') + }, +}`; + + const manifest:string = `{ + "appID": "com.huawei.` + appID + `", + "appName": "` + appName + `", + "versionName": "1.0.0", + "versionCode": 1, + "minPlatformVersion": "1.0.1", + "pages": [ + "pages/index" + ], + "window": { + "designWidth": 750, + "autoDesignWidth": false + } +}`; + + const index:string = `@Entry +@Component +struct MyComponent { + private value1: string = "hello world 1"; + private value2: string = "hello world 2"; + private value3: string = "hello world 3"; + + build() { + Column() { + Text(this.value1); + Text(this.value2); + Text(this.value3); + } + } +}`; + + fs.mkdir(dist + '/pages', { recursive: true }, (err) => { + if (err) { + return console.error('ERROR: Failed to create project directory.'); + } + fs.writeFile(appPath, app, (err) => { + if (err) { + return console.error('ERROR: Failed to write app.ets.'); + } + }); + fs.writeFile(manifestPath, manifest, (err) => { + if (err) { + return console.error('ERROR: Failed to write manifest.json.'); + } + }); + fs.writeFile(indexPath, index, (err) => { + if (err) { + return console.error('ERROR: Failed to write index.ets.'); + } + }); + }); +} + +createProject(name); diff --git a/compiler/compiler/src/gen_abc_plugin.ts b/compiler/compiler/src/gen_abc_plugin.ts new file mode 100644 index 000000000..e645bdf4f --- /dev/null +++ b/compiler/compiler/src/gen_abc_plugin.ts @@ -0,0 +1,123 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + +import * as process from 'child_process'; +import * as fs from 'fs'; + +import * as path from 'path'; +import Compiler from 'webpack/lib/Compiler'; +import { logger } from './compile_info'; + +const arkDir: string = path.join(__dirname, '..', 'bin', 'ark'); + +const firstFileEXT: string = '_.js'; +let output: string; +let webpackPath: string; +let isWin: boolean = false; +let isMac: boolean = false; +let isDebug: boolean = false; + +const red: string = '\u001b[31m'; +const blue: string = '\u001b[34m'; +const reset: string = '\u001b[39m'; + +export class GenAbcPlugin { + constructor(output_, webpackPath_, isDebug_) { + output = output_; + webpackPath = webpackPath_; + isDebug = isDebug_; + } + apply(compiler: Compiler) { + if (fs.existsSync(path.resolve(webpackPath, 'ark/build-win'))) { + isWin = true; + } else { + if (fs.existsSync(path.resolve(webpackPath, 'ark/build-mac'))) { + isMac = true; + } else { + if (!fs.existsSync(path.resolve(webpackPath, 'ark/build'))) { + logger.error(red, 'ETS:ERROR find build fail', reset); + return; + } + } + } + + compiler.hooks.emit.tap('GenAbcPlugin', (compilation) => { + Object.keys(compilation.assets).forEach(key => { + // choice *.js + if (output && webpackPath && path.extname(key) === '.js') { + const newContent: string = compilation.assets[key].source(); + const keyPath: string = key.replace(/\.js$/, firstFileEXT); + writeFileSync(newContent, path.resolve(output, keyPath), key); + } + }); + }); + } +} + +function writeFileSync(inputString: string, output: string, jsBundleFile: string): void { + const parent: string = path.join(output, '..'); + if (!(fs.existsSync(parent) && fs.statSync(parent).isDirectory())) { + mkDir(parent); + } + fs.writeFileSync(output, inputString); + if (fs.existsSync(output)) { + js2abcFirst(output); + } else { + logger.error(red, `ETS:ERROR Failed to convert file ${jsBundleFile} to bin. ${output} is lost`, reset); + } +} + +function mkDir(path_: string): void { + const parent: string = path.join(path_, '..'); + if (!(fs.existsSync(parent) && !fs.statSync(parent).isFile())) { + mkDir(parent); + } + fs.mkdirSync(path_); +} + +function js2abcFirst(inputPath: string): void { + let param: string = '-r'; + if (isDebug) { + param += ' --debug'; + } + + let js2abc: string = path.join(arkDir, 'build', 'src', 'index.js'); + if (isWin) { + js2abc = path.join(arkDir, 'build-win', 'src', 'index.js'); + } else if (isMac) { + js2abc = path.join(arkDir, 'build-mac', 'src', 'index.js'); + } + + const cmd: string = `node --expose-gc "${js2abc}" "${inputPath}" ${param}`; + + try { + process.execSync(cmd); + } catch (e) { + logger.error(red, `ETS:ERROR Failed to convert file ${inputPath} to abc `, reset); + return; + } + + if (fs.existsSync(inputPath)) { + fs.unlinkSync(inputPath); + } + + const abcFile: string = inputPath.replace(/\.js$/, '.abc'); + if (fs.existsSync(abcFile)) { + const abcFileNew: string = abcFile.replace(/_.abc$/, '.abc'); + fs.renameSync(abcFile, abcFileNew); + } else { + logger.error(red, `ETS:ERROR ${abcFile} is lost`, reset); + } +} diff --git a/compiler/compiler/src/pre_define.ts b/compiler/compiler/src/pre_define.ts new file mode 100644 index 000000000..ce665c478 --- /dev/null +++ b/compiler/compiler/src/pre_define.ts @@ -0,0 +1,173 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + +export const NATIVE_MODULE: Set = new Set( + ['system.app', 'ohos.app', 'system.router', 'system.curves', 'ohos.curves', 'system.matrix4', 'ohos.matrix4']); +export const SYSTEM_PLUGIN: string = 'system'; +export const OHOS_PLUGIN: string = 'ohos'; + +export const COMPONENT_DECORATOR_ENTRY: string = '@Entry'; +export const COMPONENT_DECORATOR_PREVIEW: string = '@Preview'; +export const COMPONENT_DECORATOR_COMPONENT: string = '@Component'; +export const COMPONENT_DECORATOR_CUSTOM_DIALOG: string = '@CustomDialog'; + +export const COMPONENT_NON_DECORATOR: string = 'regular'; +export const COMPONENT_STATE_DECORATOR: string = '@State'; +export const COMPONENT_PROP_DECORATOR: string = '@Prop'; +export const COMPONENT_LINK_DECORATOR: string = '@Link'; +export const COMPONENT_STORAGE_PROP_DECORATOR: string = '@StorageProp'; +export const COMPONENT_STORAGE_LINK_DECORATOR: string = '@StorageLink'; +export const COMPONENT_PROVIDE_DECORATOR: string = '@Provide'; +export const COMPONENT_CONSUME_DECORATOR: string = '@Consume'; +export const COMPONENT_OBJECT_LINK_DECORATOR: string = '@ObjectLink'; +export const COMPONENT_WATCH_DECORATOR: string = '@Watch'; + +export const INNER_COMPONENT_DECORATORS: Set = new Set([COMPONENT_DECORATOR_ENTRY, + COMPONENT_DECORATOR_PREVIEW, COMPONENT_DECORATOR_COMPONENT, COMPONENT_DECORATOR_CUSTOM_DIALOG]); +export const INNER_COMPONENT_MEMBER_DECORATORS: Set = new Set([COMPONENT_STATE_DECORATOR, + COMPONENT_PROP_DECORATOR, COMPONENT_LINK_DECORATOR, COMPONENT_STORAGE_PROP_DECORATOR, + COMPONENT_STORAGE_LINK_DECORATOR, COMPONENT_PROVIDE_DECORATOR, COMPONENT_CONSUME_DECORATOR, + COMPONENT_OBJECT_LINK_DECORATOR, COMPONENT_WATCH_DECORATOR]); + +export const COMPONENT_OBSERVED_DECORATOR: string = '@Observed'; +export const COMPONENT_BUILDER_DECORATOR: string = '@Builder'; +export const COMPONENT_EXTEND_DECORATOR: string = '@Extend'; + +export const OBSERVED_PROPERTY_SIMPLE: string = 'ObservedPropertySimple'; +export const OBSERVED_PROPERTY_OBJECT: string = 'ObservedPropertyObject'; +export const SYNCHED_PROPERTY_SIMPLE_ONE_WAY: string = 'SynchedPropertySimpleOneWay'; +export const SYNCHED_PROPERTY_SIMPLE_TWO_WAY: string = 'SynchedPropertySimpleTwoWay'; +export const SYNCHED_PROPERTY_OBJECT_TWO_WAY: string = 'SynchedPropertyObjectTwoWay'; +export const SYNCHED_PROPERTY_NESED_OBJECT: string = 'SynchedPropertyNesedObject'; + +export const INITIALIZE_CONSUME_FUNCTION: string = 'initializeConsume'; +export const ADD_PROVIDED_VAR: string = 'addProvidedVar'; + +export const APP_STORAGE: string = 'AppStorage'; +export const APP_STORAGE_SET_AND_PROP: string = 'setAndProp'; +export const APP_STORAGE_SET_AND_LINK: string = 'setAndLink'; +export const APP_STORAGE_GET_OR_SET: string = 'GetOrCreate'; + +export const PAGE_ENTRY_FUNCTION_NAME: string = 'loadDocument'; + +export const COMPONENT_DECORATOR_NAME_COMPONENT: string = 'Component'; +export const COMPONENT_DECORATOR_NAME_CUSTOMDIALOG: string = 'CustomDialog'; +export const CUSTOM_DECORATOR_NAME: Set = new Set([ + COMPONENT_DECORATOR_NAME_COMPONENT, COMPONENT_DECORATOR_NAME_CUSTOMDIALOG +]); + +export const EXTNAME_ETS: string = '.ets'; +export const NODE_MODULES: string = 'node_modules'; +export const INDEX_ETS: string = 'index.ets'; +export const PACKAGE_JSON: string = 'package.json'; +export const CUSTOM_COMPONENT_DEFAULT: string = 'default'; + +export const BASE_COMPONENT_NAME: string = 'View'; +export const STRUCT: string = 'struct'; +export const CLASS: string = 'class'; +export const COMPONENT_BUILD_FUNCTION: string = 'build'; +export const COMPONENT_RENDER_FUNCTION: string = 'render'; +export const COMPONENT_TRANSITION_FUNCTION: string = 'pageTransition'; +export const COMPONENT_TRANSITION_NAME: string = 'PageTransition'; + +export const COMPONENT_BUTTON: string = 'Button'; +export const COMPONENT_FOREACH: string = 'ForEach'; +export const COMPONENT_LAZYFOREACH: string = 'LazyForEach'; +export const IS_RENDERING_IN_PROGRESS: string = 'isRenderingInProgress'; +export const COMPONENT_BLANK: string = 'Blank'; +export const FOREACH_OBSERVED_OBJECT: string = 'ObservedObject'; +export const FOREACH_GET_RAW_OBJECT: string = 'GetRawObject'; +export const COMPONENT_IF: string = 'If'; +export const COMPONENT_IF_BRANCH_ID_FUNCTION: string = 'branchId'; +export const COMPONENT_IF_UNDEFINED: string = 'undefined'; +export const GLOBAL_CONTEXT: string = 'Context'; +export const ATTRIBUTE_ANIMATION: string = 'animation'; +export const ATTRIBUTE_ANIMATETO: string = 'animateTo'; + +export const COMPONENT_CONSTRUCTOR_ID: string = 'compilerAssignedUniqueChildId'; +export const COMPONENT_CONSTRUCTOR_PARENT: string = 'parent'; +export const COMPONENT_CONSTRUCTOR_PARAMS: string = 'params'; +export const COMPONENT_CONSTRUCTOR_UNDEFINED: string = 'undefined'; + +export const BUILD_ON: string = 'on'; +export const BUILD_OFF: string = 'off'; + +export const COMPONENT_CREATE_FUNCTION: string = 'create'; +export const COMPONENT_CREATE_LABEL_FUNCTION: string = 'createWithLabel'; +export const COMPONENT_CREATE_CHILD_FUNCTION: string = 'createWithChild'; +export const COMPONENT_POP_FUNCTION: string = 'pop'; +export const COMPONENT_DEBUGLINE_FUNCTION: string = 'debugLine'; + +export const COMPONENT_CONSTRUCTOR_UPDATE_PARAMS: string = 'updateWithValueParams'; +export const COMPONENT_CONSTRUCTOR_DELETE_PARAMS: string = 'aboutToBeDeleted'; +export const CREATE_GET_METHOD: string = 'get'; +export const CREATE_SET_METHOD: string = 'set'; +export const CREATE_NEWVALUE_IDENTIFIER: string = 'newValue'; +export const CREATE_CONSTRUCTOR_PARAMS: string = 'params'; +export const CREATE_CONSTRUCTOR_SUBSCRIBER_MANAGER: string = 'SubscriberManager'; +export const CREATE_CONSTRUCTOR_GET_FUNCTION: string = 'Get'; +export const CREATE_CONSTRUCTOR_DELETE_FUNCTION: string = 'delete'; +export const ABOUT_TO_BE_DELETE_FUNCTION_ID: string = 'id'; +export const COMPONENT_WATCH_FUNCTION: string = 'declareWatch'; + +export const CREATE_STATE_METHOD: string = 'createState'; +export const CREATE_PROP_METHOD: string = 'createProp'; +export const CREATE_LINK_METHOD: string = 'createLink'; +export const CREATE_OBSERVABLE_OBJECT_METHOD: string = 'createObservableObject'; + +export const CUSTOM_COMPONENT_EARLIER_CREATE_CHILD: string = 'earlierCreatedChild_'; +export const CUSTOM_COMPONENT_FUNCTION_FIND_CHILD_BY_ID: string = 'findChildById'; +export const CUSTOM_COMPONENT_NEEDS_UPDATE_FUNCTION: string = 'needsUpdate'; +export const CUSTOM_COMPONENT_MARK_STATIC_FUNCTION: string = 'markStatic'; + +export const COMPONENT_GESTURE: string = 'Gesture'; +export const COMPONENT_GESTURE_GROUP: string = 'GestureGroup'; +export const GESTURE_ATTRIBUTE: string = 'gesture'; +export const PARALLEL_GESTURE_ATTRIBUTE: string = 'parallelGesture'; +export const PRIORITY_GESTURE_ATTRIBUTE: string = 'priorityGesture'; +export const GESTURE_ENUM_KEY: string = 'GesturePriority'; +export const GESTURE_ENUM_VALUE_HIGH: string = 'High'; +export const GESTURE_ENUM_VALUE_LOW: string = 'Low'; +export const GESTURE_ENUM_VALUE_PARALLEL: string = 'Parallel'; + +export const RESOURCE: string = '$r'; +export const RESOURCE_RAWFILE: string = '$rawfile'; +export const RESOURCE_NAME_ID: string = 'id'; +export const RESOURCE_NAME_TYPE: string = 'type'; +export const RESOURCE_NAME_PARAMS: string = 'params'; +export const RESOURCE_TYPE = { + color: 10001, + float: 10002, + string: 10003, + plural: 10004, + boolean: 10005, + intarray: 10006, + integer: 10007, + pattern: 10008, + strarray: 10009, + media: 20000, + rawfile: 30000 +}; + +export const WORKERS_DIR: string = 'workers'; +export const WORKER_OBJECT: string = 'Worker'; + +export const SET_CONTROLLER_METHOD: string = 'setController'; +export const SET_CONTROLLER_CTR: string = 'ctr'; +export const SET_CONTROLLER_CTR_TYPE: string = 'CustomDialogController'; +export const JS_DIALOG: string = 'jsDialog'; +export const CUSTOM_DIALOG_CONTROLLER_BUILDER: string = 'builder'; + +export const GEOMETRY_VIEW: string = 'GeometryView'; diff --git a/compiler/compiler/src/pre_process.ts b/compiler/compiler/src/pre_process.ts new file mode 100644 index 000000000..96eeee0e6 --- /dev/null +++ b/compiler/compiler/src/pre_process.ts @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + +import { + ReplaceResult, + sourceReplace, + validateUISyntax, + processSystemApi +} from './validate_ui_syntax'; +import { + LogInfo, + emitLogInfo +} from './utils'; +import { BUILD_ON } from './pre_define'; + +function preProcess(source: string): string { + process.env.compiler = BUILD_ON; + if (/\.ets$/.test(this.resourcePath)) { + const result: ReplaceResult = sourceReplace(source, this.resourcePath); + const newContent: string = result.content; + const log: LogInfo[] = result.log.concat(validateUISyntax(source, newContent, + this.resourcePath, this.resourceQuery)); + if (log.length) { + emitLogInfo(this, log); + } + return newContent; + } else { + return processSystemApi(source); + } +} + +module.exports = preProcess; diff --git a/compiler/compiler/src/process_component_build.ts b/compiler/compiler/src/process_component_build.ts new file mode 100644 index 000000000..e0b842967 --- /dev/null +++ b/compiler/compiler/src/process_component_build.ts @@ -0,0 +1,702 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + +import ts from 'typescript'; +import path from 'path'; + +import { + COMPONENT_RENDER_FUNCTION, + COMPONENT_CREATE_FUNCTION, + COMPONENT_POP_FUNCTION, + COMPONENT_BUTTON, + COMPONENT_BLANK, + COMPONENT_CREATE_LABEL_FUNCTION, + COMPONENT_CREATE_CHILD_FUNCTION, + COMPONENT_FOREACH, + COMPONENT_LAZYFOREACH, + IS_RENDERING_IN_PROGRESS, + FOREACH_OBSERVED_OBJECT, + FOREACH_GET_RAW_OBJECT, + COMPONENT_IF, + COMPONENT_IF_BRANCH_ID_FUNCTION, + COMPONENT_IF_UNDEFINED, + ATTRIBUTE_ANIMATION, + GLOBAL_CONTEXT, + COMPONENT_GESTURE, + COMPONENT_GESTURE_GROUP, + GESTURE_ATTRIBUTE, + PARALLEL_GESTURE_ATTRIBUTE, + PRIORITY_GESTURE_ATTRIBUTE, + GESTURE_ENUM_KEY, + GESTURE_ENUM_VALUE_HIGH, + GESTURE_ENUM_VALUE_LOW, + GESTURE_ENUM_VALUE_PARALLEL, + COMPONENT_TRANSITION_NAME, + COMPONENT_DEBUGLINE_FUNCTION +} from './pre_define'; +import { + INNER_COMPONENT_NAMES, + BUILDIN_CONTAINER_COMPONENT, + BUILDIN_STYLE_NAMES, + CUSTOM_BUILDER_METHOD, + GESTURE_ATTRS, + GESTURE_TYPE_NAMES, + EXTEND_ATTRIBUTE, + NO_DEBUG_LINE_COMPONENT +} from './component_map'; +import { componentCollection } from './validate_ui_syntax'; +import { processCustomComponent } from './process_custom_component'; +import { + LogType, + LogInfo, + componentInfo, + createFunction +} from './utils'; +import { projectConfig } from '../main'; +import { transformLog } from './process_ui_syntax'; + +export const appComponentCollection: Set = new Set(); + +export function processComponentBuild(node: ts.MethodDeclaration, + log: LogInfo[]): ts.MethodDeclaration { + let newNode: ts.MethodDeclaration; + const renderNode: ts.Identifier = ts.factory.createIdentifier(COMPONENT_RENDER_FUNCTION); + if (node.body && node.body.statements && node.body.statements.length && + validateRootNode(node, log)) { + newNode = ts.factory.updateMethodDeclaration(node, node.decorators, node.modifiers, + node.asteriskToken, renderNode, node.questionToken, node.typeParameters, node.parameters, + node.type, processComponentBlock(node.body, false, log)); + } else { + newNode = ts.factory.updateMethodDeclaration(node, node.decorators, node.modifiers, + node.asteriskToken, renderNode, node.questionToken, node.typeParameters, node.parameters, + node.type, node.body); + } + return newNode; +} + +export function processComponentBlock(node: ts.Block, isLazy: boolean, log: LogInfo[], + isTransition: boolean = false): ts.Block { + const newStatements: ts.Statement[] = []; + processComponentChild(node, newStatements, log); + if (isLazy) { + newStatements.unshift(createRenderingInProgress(true)); + } + if (isTransition) { + newStatements.unshift(ts.factory.createExpressionStatement( + createFunction(ts.factory.createIdentifier(COMPONENT_TRANSITION_NAME), + ts.factory.createIdentifier(COMPONENT_CREATE_FUNCTION), null))); + newStatements.push(ts.factory.createExpressionStatement( + createFunction(ts.factory.createIdentifier(COMPONENT_TRANSITION_NAME), + ts.factory.createIdentifier(COMPONENT_POP_FUNCTION), null))); + } + if (isLazy) { + newStatements.push(createRenderingInProgress(false)); + } + return ts.factory.updateBlock(node, newStatements); +} + +function validateRootNode(node: ts.MethodDeclaration, log: LogInfo[]): boolean { + let isValid: boolean = false; + if (node.body.statements.length < 4) { + switch (node.body.statements.length) { + case 1: + if (validateFirstNode(node.body.statements[0])) { + isValid = true; + } + break; + case 2: + if (validateFirstNode(node.body.statements[0]) && + validateBlockNode(node.body.statements[1])) { + isValid = true; + } + break; + case 3: + if (validateFirstNode(node.body.statements[0]) && + validateBlockNode(node.body.statements[1]) && + validateSecondNode(node.body.statements[2])) { + isValid = true; + } + break; + } + } + if (!isValid) { + log.push({ + type: LogType.ERROR, + message: `There should have a root container component.`, + pos: node.body.statements.pos + }); + } + return isValid; +} + +function processComponentChild(node: ts.Block, newStatements: ts.Statement[], + log: LogInfo[]): void { + if (node.statements.length) { + node.statements.forEach((item, index) => { + if (ts.isExpressionStatement(item)) { + const name: string = getName(item); + switch (getComponentType(item, log, name)) { + case ComponentType.innerComponent: + processInnerComponent(item, index, Array.from(node.statements), newStatements, log, name); + break; + case ComponentType.customComponent: + processCustomComponent(item, newStatements, log); + break; + case ComponentType.forEachComponent: + processForEachComponent(item, newStatements, log); + break; + case ComponentType.customBuilderMethod: + newStatements.push(item); + break; + } + } else if (ts.isIfStatement(item)) { + appComponentCollection.add(COMPONENT_IF); + processIfStatement(item, newStatements, log); + } else if (!ts.isBlock(item)) { + log.push({ + type: LogType.ERROR, + message: `Only UI component syntax can be written in build method.`, + pos: item.getStart() + }); + } + }); + } +} + +function processInnerComponent(node: ts.ExpressionStatement, index: number, arr: ts.Statement[], + newStatements: ts.Statement[], log: LogInfo[], name: string): void { + const res: CreateResult = createComponent(node, COMPONENT_CREATE_FUNCTION); + newStatements.push(res.newNode); + if (projectConfig.isPreview && !NO_DEBUG_LINE_COMPONENT.has(name)) { + const posOfNode: ts.LineAndCharacter = + transformLog.sourceFile.getLineAndCharacterOfPosition(getRealNodePos(node)); + const projectPath: string = projectConfig.projectPath; + const curFileName: string = transformLog.sourceFile.fileName.replace(/.ts$/, ''); + const debugInfo: string = + `${path.relative(projectPath, curFileName).replace(/\\+/g, '/')}` + + `(${posOfNode.line + 1}:${posOfNode.character + 1})`; + const debugNode: ts.ExpressionStatement = ts.factory.createExpressionStatement( + createFunction(ts.factory.createIdentifier(getName(node)), + ts.factory.createIdentifier(COMPONENT_DEBUGLINE_FUNCTION), + ts.factory.createNodeArray([ts.factory.createStringLiteral(debugInfo)]))); + newStatements.push(debugNode); + } + if (index + 1 < arr.length && ts.isBlock(arr[index + 1])) { + if (res.isButton) { + if (projectConfig.isPreview) { + newStatements.splice(-2, 1, createComponent(node, COMPONENT_CREATE_CHILD_FUNCTION).newNode); + } else { + newStatements.splice(-1, 1, createComponent(node, COMPONENT_CREATE_CHILD_FUNCTION).newNode); + } + } + if (index + 2 < arr.length && ts.isExpressionStatement(arr[index + 2]) && + isAttributeNode(arr[index + 2] as ts.ExpressionStatement)) { + bindComponentAttr(arr[index + 2] as ts.ExpressionStatement, res.identifierNode, newStatements, log); + } + processComponentChild(arr[index + 1] as ts.Block, newStatements, log); + } else { + bindComponentAttr(node, res.identifierNode, newStatements, log); + } + if (res.isContainerComponent || res.needPop) { + newStatements.push(createComponent(node, COMPONENT_POP_FUNCTION).newNode); + } +} + +function getRealNodePos(node: ts.Node): number { + // @ts-ignore + if (node.pos === -1 && node.expression) { + // @ts-ignore + return getRealNodePos(node.expression); + } else { + return node.getStart(); + } +} + +function processForEachComponent(node: ts.ExpressionStatement, newStatements: ts.Statement[], + log: LogInfo[]): void { + const popNode: ts.ExpressionStatement = ts.factory.createExpressionStatement(createFunction( + // @ts-ignore + node.expression.expression as ts.Identifier, + ts.factory.createIdentifier(COMPONENT_POP_FUNCTION), null)); + if (ts.isCallExpression(node.expression)) { + const propertyNode: ts.PropertyAccessExpression = ts.factory.createPropertyAccessExpression( + node.expression.expression as ts.Identifier, + ts.factory.createIdentifier(COMPONENT_CREATE_FUNCTION) + ); + const argumentsArray: ts.Expression[] = Array.from(node.expression.arguments); + let arrayObserveredObject: ts.CallExpression; + if (argumentsArray.length) { + arrayObserveredObject = ts.factory.createCallExpression( + ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier(FOREACH_OBSERVED_OBJECT), + ts.factory.createIdentifier(FOREACH_GET_RAW_OBJECT)), undefined, [argumentsArray[0]]); + } + argumentsArray.splice(0, 1, arrayObserveredObject); + const newArrowNode: ts.ArrowFunction = processForEachBlock(node.expression, log); + if (newArrowNode) { + argumentsArray.splice(1, 1, newArrowNode); + } + node = addForEachId(ts.factory.updateExpressionStatement(node, ts.factory.updateCallExpression( + node.expression, propertyNode, node.expression.typeArguments, argumentsArray))); + } + newStatements.push(node, popNode); +} + +function addForEachId(node: ts.ExpressionStatement): ts.ExpressionStatement { + const forEachComponent: ts.CallExpression = node.expression as ts.CallExpression; + return ts.factory.updateExpressionStatement(node, ts.factory.updateCallExpression( + forEachComponent, forEachComponent.expression, forEachComponent.typeArguments, + [ts.factory.createStringLiteral((++componentInfo.id).toString()), ts.factory.createThis(), + ...forEachComponent.arguments])); +} + +function processForEachBlock(node: ts.CallExpression, log: LogInfo[]): ts.ArrowFunction { + if (node.arguments.length > 1 && ts.isArrowFunction(node.arguments[1])) { + const isLazy: boolean = node.expression.getText() === COMPONENT_LAZYFOREACH; + const arrowNode: ts.ArrowFunction = node.arguments[1] as ts.ArrowFunction; + const body: ts.ConciseBody = arrowNode.body; + if (node.arguments.length > 2 && !ts.isArrowFunction(node.arguments[2])) { + log.push({ + type: LogType.ERROR, + message: 'There should be wrapped in curly braces in ForEach.', + pos: body.getStart() + }); + } else if (!ts.isBlock(body)) { + const statement: ts.Statement = ts.factory.createExpressionStatement(body); + const blockNode: ts.Block = ts.factory.createBlock([statement], true); + // @ts-ignore + statement.parent = blockNode; + return ts.factory.updateArrowFunction( + arrowNode, arrowNode.modifiers, arrowNode.typeParameters, arrowNode.parameters, + arrowNode.type, arrowNode.equalsGreaterThanToken, processComponentBlock(blockNode, isLazy, log)); + } else { + return ts.factory.updateArrowFunction( + arrowNode, arrowNode.modifiers, arrowNode.typeParameters, arrowNode.parameters, + arrowNode.type, arrowNode.equalsGreaterThanToken, processComponentBlock(body, isLazy, log)); + } + } + return null; +} + +function createRenderingInProgress(isTrue: boolean): ts.ExpressionStatement { + return ts.factory.createExpressionStatement(ts.factory.createBinaryExpression( + ts.factory.createPropertyAccessExpression( + ts.factory.createThis(), + ts.factory.createIdentifier(IS_RENDERING_IN_PROGRESS) + ), + ts.factory.createToken(ts.SyntaxKind.EqualsToken), + isTrue ? ts.factory.createTrue() : ts.factory.createFalse() + )); +} + +function processIfStatement(node: ts.IfStatement, newStatements: ts.Statement[], + log: LogInfo[]): void { + const ifCreate: ts.ExpressionStatement = createIfCreate(); + const newIfNode: ts.IfStatement = processInnerIfStatement(node, 0, log); + const ifPop: ts.ExpressionStatement = createIfPop(); + newStatements.push(ifCreate, newIfNode, ifPop); +} + +function processInnerIfStatement(node: ts.IfStatement, id: number, log: LogInfo[]): ts.IfStatement { + if (ts.isIdentifier(node.expression) && node.expression.originalKeywordKind === undefined && + !node.expression.escapedText) { + log.push({ + type: LogType.ERROR, + message: 'Condition expression cannot be null in if statement.', + pos: node.expression.getStart() + }); + node = ts.factory.updateIfStatement(node, ts.factory.createIdentifier(COMPONENT_IF_UNDEFINED), + node.thenStatement, node.elseStatement); + } + const newThenStatement: ts.Statement = processThenStatement(node.thenStatement, id, log); + const newElseStatement: ts.Statement = processElseStatement(node.elseStatement, id, log); + const newIfNode: ts.IfStatement = ts.factory.updateIfStatement( + node, node.expression, newThenStatement, newElseStatement); + return newIfNode; +} + +function processThenStatement(thenStatement: ts.Statement, id: number, + log: LogInfo[]): ts.Statement { + if (ts.isExpressionStatement(thenStatement) && ts.isIdentifier(thenStatement.expression) && + thenStatement.expression.originalKeywordKind === undefined && + !thenStatement.expression.escapedText) { + log.push({ + type: LogType.ERROR, + message: 'Then statement cannot be null in if statement.', + pos: thenStatement.expression.getStart() + }); + } + if (thenStatement) { + if (ts.isBlock(thenStatement)) { + thenStatement = processIfBlock(thenStatement, id, log); + } else if (ts.isIfStatement(thenStatement)) { + thenStatement = processInnerIfStatement(thenStatement, 0, log); + thenStatement = ts.factory.createBlock( + [createIfCreate(), createIfBranchId(id), thenStatement, createIfPop()], true); + } else { + thenStatement = ts.factory.createBlock([thenStatement], true); + thenStatement = processIfBlock(thenStatement as ts.Block, id, log); + } + } + return thenStatement; +} + +function processElseStatement(elseStatement: ts.Statement, id: number, + log: LogInfo[]): ts.Statement { + if (elseStatement) { + if (ts.isBlock(elseStatement)) { + elseStatement = processIfBlock(elseStatement, id + 1, log); + } else if (ts.isIfStatement(elseStatement)) { + elseStatement = processInnerIfStatement(elseStatement, id + 1, log); + } else { + elseStatement = ts.factory.createBlock([elseStatement], true); + elseStatement = processIfBlock(elseStatement as ts.Block, id + 1, log); + } + } + return elseStatement; +} + +function processIfBlock(block: ts.Block, id: number, log: LogInfo[]): ts.Block { + return addIfBranchId(id, processComponentBlock(block, false, log)); +} + +function addIfBranchId(id: number, container: ts.Block): ts.Block { + return ts.factory.updateBlock(container, [createIfBranchId(id), ...container.statements]); +} + +function createIf(): ts.Identifier { + return ts.factory.createIdentifier(COMPONENT_IF); +} + +function createIfCreate(): ts.ExpressionStatement { + return ts.factory.createExpressionStatement(createFunction(createIf(), + ts.factory.createIdentifier(COMPONENT_CREATE_FUNCTION), ts.factory.createNodeArray([]))); +} + +function createIfPop(): ts.ExpressionStatement { + return ts.factory.createExpressionStatement(createFunction(createIf(), + ts.factory.createIdentifier(COMPONENT_POP_FUNCTION), null)); +} + +function createIfBranchId(id: number): ts.ExpressionStatement { + return ts.factory.createExpressionStatement(createFunction(createIf(), + ts.factory.createIdentifier(COMPONENT_IF_BRANCH_ID_FUNCTION), + ts.factory.createNodeArray([ts.factory.createNumericLiteral(id)]))); +} + +interface CreateResult { + newNode: ts.ExpressionStatement; + identifierNode: ts.Identifier; + isContainerComponent: boolean; + isButton: boolean; + needPop: boolean; +} + +function createComponent(node: ts.ExpressionStatement, type: string): CreateResult { + const res: CreateResult = { + newNode: node, + identifierNode: null, + isContainerComponent: false, + isButton: false, + needPop: false + }; + let identifierNode: ts.Identifier = ts.factory.createIdentifier(type); + let temp: any = node.expression; + while (temp && !ts.isIdentifier(temp) && temp.expression) { + temp = temp.expression; + } + if (temp && temp.parent && ts.isCallExpression(temp.parent) && ts.isIdentifier(temp)) { + if (temp.getText() === COMPONENT_BUTTON && type !== COMPONENT_POP_FUNCTION) { + res.isButton = true; + identifierNode = type === COMPONENT_CREATE_CHILD_FUNCTION + ? ts.factory.createIdentifier(COMPONENT_CREATE_CHILD_FUNCTION) + : ts.factory.createIdentifier(COMPONENT_CREATE_LABEL_FUNCTION); + } + if (temp.getText() === COMPONENT_BLANK) { + res.needPop = true; + } + if (BUILDIN_CONTAINER_COMPONENT.has(temp.getText())) { + res.isContainerComponent = true; + } + res.newNode = type === COMPONENT_POP_FUNCTION + ? ts.factory.updateExpressionStatement(node, + createFunction(temp, identifierNode, null)) + : ts.factory.updateExpressionStatement(node, + createFunction(temp, identifierNode, temp.parent.arguments)); + res.identifierNode = temp; + } + return res; +} + +interface AnimationInfo { + statement: ts.Statement, + kind: boolean +} + +export function bindComponentAttr(node: ts.ExpressionStatement, identifierNode: ts.Identifier, + newStatements: ts.Statement[], log: LogInfo[], reverse: boolean = true): void { + let temp: any = node.expression; + const statements: ts.Statement[] = []; + const lastStatement: AnimationInfo = { statement: null, kind: false }; + while (temp && ts.isCallExpression(temp) && temp.expression) { + if (ts.isPropertyAccessExpression(temp.expression) && + temp.expression.name && ts.isIdentifier(temp.expression.name)) { + addComponentAttr(temp, temp.expression.name, lastStatement, statements, identifierNode, log); + temp = temp.expression.expression; + } else if (ts.isIdentifier(temp.expression)) { + if (!INNER_COMPONENT_NAMES.has(temp.expression.getText()) && + !GESTURE_TYPE_NAMES.has(temp.expression.getText())) { + addComponentAttr(temp, temp.expression, lastStatement, statements, identifierNode, log); + } + break; + } + } + if (lastStatement.statement && lastStatement.kind) { + statements.push(lastStatement.statement); + } + if (statements.length) { + reverse ? newStatements.push(...statements.reverse()) : newStatements.push(...statements); + } +} + +function addComponentAttr(temp: any, node: ts.Identifier, lastStatement: any, + statements: ts.Statement[], identifierNode: ts.Identifier, log: LogInfo[]): void { + const propName: string = node.getText(); + if (propName === ATTRIBUTE_ANIMATION) { + if (!lastStatement.statement) { + if (!(temp.arguments.length === 1 && + temp.arguments[0].kind === ts.SyntaxKind.NullKeyword)) { + statements.push(ts.factory.createExpressionStatement(createFunction( + ts.factory.createIdentifier(GLOBAL_CONTEXT), node, + // @ts-ignore + [ts.factory.createNull()]))); + } + } else { + statements.push(lastStatement.statement); + } + lastStatement.statement = ts.factory.createExpressionStatement(createFunction( + ts.factory.createIdentifier(GLOBAL_CONTEXT), node, temp.arguments)); + lastStatement.kind = false; + } else if (GESTURE_ATTRS.has(propName)) { + parseGesture(temp, propName, statements, log); + lastStatement.kind = true; + } else if (isExtendFunctionNode(identifierNode, propName)) { + validateExtendParameterCount(temp, identifierNode, propName, log); + statements.push(ts.factory.createExpressionStatement(ts.factory.createCallExpression( + ts.factory.createIdentifier(`__${identifierNode.escapedText.toString()}__${propName}`), + undefined, temp.arguments))); + lastStatement.kind = true; + } else { + statements.push(ts.factory.createExpressionStatement( + createFunction(identifierNode, node, temp.arguments))); + lastStatement.kind = true; + } +} + +function isExtendFunctionNode(identifierNode: ts.Identifier, propName: string): boolean { + if (identifierNode && EXTEND_ATTRIBUTE.has(identifierNode.escapedText.toString())) { + const attributeArray: string[] = + [...EXTEND_ATTRIBUTE.get(identifierNode.escapedText.toString())].map(item => item.attribute); + if (attributeArray.includes(propName)) { + return true; + } + } + return false; +} + +const gestureMap: Map = new Map([ + [PRIORITY_GESTURE_ATTRIBUTE, GESTURE_ENUM_VALUE_HIGH], + [PARALLEL_GESTURE_ATTRIBUTE, GESTURE_ENUM_VALUE_PARALLEL], + [GESTURE_ATTRIBUTE, GESTURE_ENUM_VALUE_LOW] +]); + +function parseGesture(node: ts.CallExpression, propName: string, statements: ts.Statement[], + log: LogInfo[]): void { + statements.push(ts.factory.createExpressionStatement( + createFunction(ts.factory.createIdentifier(COMPONENT_GESTURE), + ts.factory.createIdentifier(COMPONENT_POP_FUNCTION), null))); + parseGestureInterface(node, statements, log); + const argumentArr: ts.NodeArray = ts.factory.createNodeArray( + [ts.factory.createPropertyAccessExpression( + ts.factory.createIdentifier(GESTURE_ENUM_KEY), + ts.factory.createIdentifier(gestureMap.get(propName))) + ] + ); + if (node.arguments && node.arguments.length > 1 && + ts.isPropertyAccessExpression(node.arguments[1])) { + // @ts-ignore + argumentArr.push(node.arguments[1]); + } + statements.push(ts.factory.createExpressionStatement( + createFunction(ts.factory.createIdentifier(COMPONENT_GESTURE), + ts.factory.createIdentifier(COMPONENT_CREATE_FUNCTION), argumentArr))); +} + +function processGestureType(node: ts.CallExpression, statements: ts.Statement[], log: LogInfo[], + reverse: boolean = false): void { + const newStatements: ts.Statement[] = []; + const newNode: ts.ExpressionStatement = ts.factory.createExpressionStatement(node); + let temp: any = node.expression; + while (temp && !ts.isIdentifier(temp) && temp.expression) { + temp = temp.expression; + } + if (temp && temp.parent && ts.isCallExpression(temp.parent) && ts.isIdentifier(temp) && + GESTURE_TYPE_NAMES.has(temp.escapedText.toString())) { + newStatements.push(ts.factory.createExpressionStatement( + createFunction(temp, ts.factory.createIdentifier(COMPONENT_POP_FUNCTION), null))); + if (temp.escapedText.toString() === COMPONENT_GESTURE_GROUP) { + const gestureStatements: ts.Statement[] = []; + parseGestureInterface(temp.parent, gestureStatements, log, true); + newStatements.push(...gestureStatements.reverse()); + bindComponentAttr(newNode, temp, newStatements, log, false); + let argumentArr: ts.NodeArray = null; + if (temp.parent.arguments && temp.parent.arguments.length) { + // @ts-ignore + argumentArr = ts.factory.createNodeArray([temp.parent.arguments[0]]); + } + newStatements.push(ts.factory.createExpressionStatement( + createFunction(temp, ts.factory.createIdentifier(COMPONENT_CREATE_FUNCTION), argumentArr))); + } else { + bindComponentAttr(newNode, temp, newStatements, log, false); + newStatements.push(ts.factory.createExpressionStatement( + createFunction(temp, ts.factory.createIdentifier(COMPONENT_CREATE_FUNCTION), temp.parent.arguments))); + } + } + if (newStatements.length) { + reverse ? statements.push(...newStatements.reverse()) : statements.push(...newStatements); + } +} + +function parseGestureInterface(node: ts.CallExpression, statements: ts.Statement[], log: LogInfo[], + reverse: boolean = false): void { + if (node.arguments && node.arguments.length) { + node.arguments.forEach((item: ts.Node) => { + if (ts.isCallExpression(item)) { + processGestureType(item, statements, log, reverse); + } + }); + } +} + +export function getName(node: ts.ExpressionStatement): string { + let temp: any = node.expression; + let name: string; + while (temp) { + if (ts.isIdentifier(temp) && temp.parent && ts.isCallExpression(temp.parent)) { + name = temp.escapedText.toString(); + break; + } else if (ts.isPropertyAccessExpression(temp) && temp.name && ts.isIdentifier(temp.name) && + !BUILDIN_STYLE_NAMES.has(temp.name.escapedText.toString())) { + name = temp.name.escapedText.toString(); + break; + } + temp = temp.expression; + } + return name; +} + +export function isAttributeNode(node: ts.ExpressionStatement): boolean { + let temp: any = node.expression; + let name: string; + while (temp) { + if (ts.isCallExpression(temp) && temp.expression && ts.isIdentifier(temp.expression)) { + name = temp.expression.escapedText.toString(); + break; + } + temp = temp.expression; + } + return BUILDIN_STYLE_NAMES.has(name); +} + +function validateFirstNode(node: ts.Statement): boolean { + const isEntryComponent: boolean = + componentCollection.entryComponent === componentCollection.currentClassName; + if ((isEntryComponent && validateEntryComponent(node)) || + (!isEntryComponent && validateCustomComponent(node))) { + return true; + } + return false; +} + +function validateEntryComponent(node: ts.Statement): boolean { + if (ts.isExpressionStatement(node) && BUILDIN_CONTAINER_COMPONENT.has(getName(node))) { + return true; + } + return false; +} + +function validateCustomComponent(node: ts.Statement): boolean { + if (ts.isIfStatement(node) || + (ts.isExpressionStatement(node) && (INNER_COMPONENT_NAMES.has(getName(node)) || + componentCollection.customComponents.has(getName(node))))) { + return true; + } + return false; +} + +function validateBlockNode(node: ts.Statement): boolean { + if (ts.isBlock(node)) { + return true; + } + return false; +} + +function validateSecondNode(node: ts.Statement): boolean { + if (ts.isExpressionStatement(node) && isAttributeNode(node)) { + return true; + } + return false; +} + +enum ComponentType { + innerComponent, + customComponent, + forEachComponent, + customBuilderMethod +} + +function getComponentType(node: ts.ExpressionStatement, log: LogInfo[], + name: string): ComponentType { + if (INNER_COMPONENT_NAMES.has(name)) { + return ComponentType.innerComponent; + } else if (componentCollection.customComponents.has(name)) { + return ComponentType.customComponent; + } else if (name === COMPONENT_FOREACH || name === COMPONENT_LAZYFOREACH) { + appComponentCollection.add(name); + return ComponentType.forEachComponent; + } else if (CUSTOM_BUILDER_METHOD.has(name)) { + return ComponentType.customBuilderMethod; + } else if (!isAttributeNode(node)) { + log.push({ + type: LogType.ERROR, + message: `'${node.getText()}' does not meet UI component syntax.`, + pos: node.getStart() + }); + } + return null; +} + +function validateExtendParameterCount(temp: any, identifierNode: ts.Identifier, propName: string, + log: LogInfo[]): void { + const parameterCount: number = + [...EXTEND_ATTRIBUTE.get(identifierNode.escapedText.toString())].filter(item => + item.attribute === propName)[0].parameterCount; + if (temp.arguments && temp.arguments.length !== parameterCount) { + log.push({ + type: LogType.ERROR, + message: `The '${propName}' is expected ${parameterCount} arguments, but got ${temp.arguments.length}.`, + pos: temp.getStart() + }); + } +} diff --git a/compiler/compiler/src/process_component_class.ts b/compiler/compiler/src/process_component_class.ts new file mode 100644 index 000000000..735e09c8c --- /dev/null +++ b/compiler/compiler/src/process_component_class.ts @@ -0,0 +1,400 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + +import ts from 'typescript'; + +import { + COMPONENT_BUILD_FUNCTION, + BASE_COMPONENT_NAME, + ATTRIBUTE_ANIMATETO, + GLOBAL_CONTEXT, + CREATE_CONSTRUCTOR_PARAMS, + COMPONENT_CONSTRUCTOR_UPDATE_PARAMS, + COMPONENT_CONSTRUCTOR_DELETE_PARAMS, + CREATE_CONSTRUCTOR_SUBSCRIBER_MANAGER, + ABOUT_TO_BE_DELETE_FUNCTION_ID, + CREATE_CONSTRUCTOR_GET_FUNCTION, + CREATE_CONSTRUCTOR_DELETE_FUNCTION, + FOREACH_OBSERVED_OBJECT, + FOREACH_GET_RAW_OBJECT, + COMPONENT_BUILDER_DECORATOR, + COMPONENT_TRANSITION_FUNCTION, + COMPONENT_CREATE_FUNCTION, + GEOMETRY_VIEW +} from './pre_define'; +import { + BUILDIN_STYLE_NAMES, + CUSTOM_BUILDER_METHOD +} from './component_map'; +import { + componentCollection, + linkCollection +} from './validate_ui_syntax'; +import { + addConstructor, + getInitConstructor +} from './process_component_constructor'; +import { + ControllerType, + processMemberVariableDecorators, + UpdateResult, + stateObjectCollection, + curPropMap +} from './process_component_member'; +import { + processComponentBuild, + processComponentBlock +} from './process_component_build'; +import { + LogType, + LogInfo, + hasDecorator +} from './utils'; + +export function processComponentClass(node: ts.ClassDeclaration, context: ts.TransformationContext, + log: LogInfo[], program: ts.Program): ts.ClassDeclaration { + validateInheritClass(node, log); + const memberNode: ts.ClassElement[] = + processMembers(node.members, node.name, context, log, program); + return ts.factory.updateClassDeclaration(node, undefined, node.modifiers, node.name, + node.typeParameters, updateHeritageClauses(node), memberNode); +} + +type BuildCount = { + count: number; +} + +function processMembers(members: ts.NodeArray, parentComponentName: ts.Identifier, + context: ts.TransformationContext, log: LogInfo[], program: ts.Program): ts.ClassElement[] { + const buildCount: BuildCount = { count: 0 }; + let ctorNode: any = getInitConstructor(members); + const newMembers: ts.ClassElement[] = []; + const watchMap: Map = new Map(); + const updateParamsStatements: ts.Statement[] = []; + const deleteParamsStatements: ts.PropertyDeclaration[] = []; + const checkController: ControllerType = + { hasController: !componentCollection.customDialogs.has(parentComponentName.getText()) }; + members.forEach((item: ts.ClassElement) => { + let updateItem: ts.ClassElement; + if (ts.isPropertyDeclaration(item)) { + const result: UpdateResult = processMemberVariableDecorators(parentComponentName, item, + ctorNode, watchMap, checkController, log, program, context); + if (result.isItemUpdate()) { + updateItem = result.getProperity(); + } else { + updateItem = item; + } + if (result.getVariableGet()) { + newMembers.push(result.getVariableGet()); + } + if (result.getVariableSet()) { + newMembers.push(result.getVariableSet()); + } + if (result.isCtorUpdate()) { + ctorNode = result.getCtor(); + } + if (result.getUpdateParams()) { + updateParamsStatements.push(result.getUpdateParams()); + } + if (result.isDeleteParams()) { + deleteParamsStatements.push(item); + } + if (result.getControllerSet()) { + newMembers.push(result.getControllerSet()); + } + } + if (ts.isMethodDeclaration(item) && item.name) { + updateItem = + processComponentMethod(item, parentComponentName, context, log, buildCount); + } + if (updateItem) { + newMembers.push(updateItem); + } + }); + validateBuildMethodCount(buildCount, parentComponentName, log); + validateHasController(parentComponentName, checkController, log); + newMembers.unshift(addDeleteParamsFunc(deleteParamsStatements)); + newMembers.unshift(addUpdateParamsFunc(updateParamsStatements)); + newMembers.unshift(addConstructor(ctorNode, watchMap)); + return newMembers; +} + +function processComponentMethod(node: ts.MethodDeclaration, parentComponentName: ts.Identifier, + context: ts.TransformationContext, log: LogInfo[], buildCount: BuildCount): ts.MethodDeclaration { + let updateItem: ts.MethodDeclaration = node; + const name: string = node.name.getText(); + if (name === COMPONENT_BUILD_FUNCTION) { + buildCount.count = buildCount.count + 1; + updateItem = processBuildMember(node, context, log); + curPropMap.clear(); + } else if (node.body && ts.isBlock(node.body)) { + if (name === COMPONENT_TRANSITION_FUNCTION) { + updateItem = ts.factory.updateMethodDeclaration(node, node.decorators, node.modifiers, + node.asteriskToken, node.name, node.questionToken, node.typeParameters, node.parameters, + node.type, processComponentBlock(node.body, false, log, true)); + } else if (hasDecorator(node, COMPONENT_BUILDER_DECORATOR)) { + CUSTOM_BUILDER_METHOD.add(name); + updateItem = ts.factory.updateMethodDeclaration(node, undefined, node.modifiers, + node.asteriskToken, node.name, node.questionToken, node.typeParameters, node.parameters, + node.type, processComponentBlock(node.body, false, log)); + } + } + return ts.visitNode(updateItem, visitMethod); + function visitMethod(node: ts.Node): ts.Node { + if (ts.isCallExpression(node) && ts.isIdentifier(node.expression)) { + const name: string = node.expression.escapedText.toString(); + if (name === ATTRIBUTE_ANIMATETO) { + node = processAnimateTo(node); + } + } + return ts.visitEachChild(node, visitMethod, context); + } +} + +function processBuildMember(node: ts.MethodDeclaration, context: ts.TransformationContext, + log: LogInfo[]): ts.MethodDeclaration { + if (node.parameters.length) { + log.push({ + type: LogType.ERROR, + message: `The 'build' method can not have arguments.`, + pos: node.getStart() + }); + } + const buildNode: ts.MethodDeclaration = processComponentBuild(node, log); + return ts.visitNode(buildNode, visitBuild); + function visitBuild(node: ts.Node): ts.Node { + if (isGeometryView(node)) { + node = processGeometryView(node as ts.ExpressionStatement, log); + } + if (isProperty(node)) { + node = createReference(node as ts.PropertyAssignment); + } + if (ts.isPropertyAccessExpression(node) && ts.isIdentifier(node.name) && + stateObjectCollection.has(node.name.escapedText.toString()) && node.parent && + ts.isCallExpression(node.parent) && ts.isPropertyAccessExpression(node.parent.expression) && + node.parent.expression.name.escapedText.toString() !== FOREACH_GET_RAW_OBJECT) { + return ts.factory.createCallExpression(ts.factory.createPropertyAccessExpression( + ts.factory.createIdentifier(FOREACH_OBSERVED_OBJECT), + ts.factory.createIdentifier(FOREACH_GET_RAW_OBJECT)), undefined, [node]); + } + return ts.visitEachChild(node, visitBuild, context); + } +} + +function isGeometryView(node: ts.Node): boolean { + if (ts.isExpressionStatement(node) && ts.isCallExpression(node.expression)) { + const call: ts.CallExpression = node.expression; + const exp: ts.Expression = call.expression; + const args: ts.NodeArray = call.arguments; + if (ts.isPropertyAccessExpression(exp) && ts.isIdentifier(exp.expression) && + exp.expression.escapedText.toString() === GEOMETRY_VIEW && ts.isIdentifier(exp.name) && + exp.name.escapedText.toString() === COMPONENT_CREATE_FUNCTION && args && args.length === 1 && + (ts.isArrowFunction(args[0]) || ts.isFunctionExpression(args[0]))) { + return true; + } + } + return false; +} + +function processGeometryView(node: ts.ExpressionStatement, + log: LogInfo[]): ts.ExpressionStatement { + const exp: ts.CallExpression = node.expression as ts.CallExpression; + const arg: ts.ArrowFunction | ts.FunctionExpression = + exp.arguments[0] as ts.ArrowFunction | ts.FunctionExpression; + return ts.factory.updateExpressionStatement(node, ts.factory.updateCallExpression(exp, + exp.expression, undefined, [ts.factory.createArrowFunction(undefined, undefined, arg.parameters, + undefined, ts.factory.createToken(ts.SyntaxKind.EqualsGreaterThanToken), + getGeometryReaderFunctionBlock(arg, log))])); +} + +function getGeometryReaderFunctionBlock(node: ts.ArrowFunction | ts.FunctionExpression, + log: LogInfo[]): ts.Block { + let blockNode: ts.Block; + if (ts.isBlock(node.body)) { + blockNode = node.body; + } else if (ts.isArrowFunction(node) && ts.isCallExpression(node.body)) { + blockNode = ts.factory.createBlock([ts.factory.createExpressionStatement(node.body)]); + } + return processComponentBlock(blockNode, false, log); +} + +function updateHeritageClauses(node: ts.ClassDeclaration): ts.NodeArray { + const result:ts.HeritageClause[] = []; + const heritageClause:ts.HeritageClause = ts.factory.createHeritageClause( + ts.SyntaxKind.ExtendsKeyword, + [ts.factory.createExpressionWithTypeArguments( + ts.factory.createIdentifier(BASE_COMPONENT_NAME), [])]); + + if (node.heritageClauses) { + result.push(...node.heritageClauses); + } + result.push(heritageClause); + + return ts.factory.createNodeArray(result); +} + +export function isProperty(node: ts.Node): Boolean { + if (node.parent && ts.isObjectLiteralExpression(node.parent) && node.parent.parent && + ts.isCallExpression(node.parent.parent) && ts.isPropertyAssignment(node) && + ts.isIdentifier(node.name)) { + if (ts.isIdentifier(node.parent.parent.expression) && + !BUILDIN_STYLE_NAMES.has(node.parent.parent.expression.escapedText.toString()) && + componentCollection.customComponents.has( + node.parent.parent.expression.escapedText.toString())) { + return true; + } else if (ts.isPropertyAccessExpression(node.parent.parent.expression) && + ts.isIdentifier(node.parent.parent.expression.expression) && + componentCollection.customComponents.has( + node.parent.parent.expression.name.escapedText.toString())) { + return true; + } + } + return false; +} + +export function createReference(node: ts.PropertyAssignment): ts.PropertyAssignment { + const linkParentComponent: string[] = getParentNode(node, linkCollection).slice(1); + const propertyName: ts.Identifier = node.name as ts.Identifier; + let initText: string; + if (linkParentComponent && ts.isPropertyAssignment(node) && ts.isIdentifier(propertyName) && + linkParentComponent.includes(propertyName.escapedText.toString())) { + const LINK_REG: RegExp = /^\$/g; + const initExpression: ts.Expression = node.initializer; + if (ts.isIdentifier(initExpression) && + initExpression.escapedText.toString().match(LINK_REG)) { + if (linkParentComponent.includes(propertyName.escapedText.toString())) { + initText = initExpression.escapedText.toString().replace(LINK_REG, ''); + } + } else if (ts.isPropertyAccessExpression(initExpression) && initExpression.expression && + initExpression.expression.kind === ts.SyntaxKind.ThisKeyword && + ts.isIdentifier(initExpression.name) && + initExpression.name.escapedText.toString().match(LINK_REG)) { + if (linkParentComponent.includes(propertyName.escapedText.toString())) { + initText = initExpression.name.escapedText.toString().replace(LINK_REG, ''); + } + } + if (initText) { + node = addDoubleUnderline(node, propertyName, initText); + } + } + return node; +} + +function addDoubleUnderline(node: ts.PropertyAssignment, propertyName: ts.Identifier, + initText: string): ts.PropertyAssignment { + return ts.factory.updatePropertyAssignment(node, propertyName, + ts.factory.createPropertyAccessExpression(ts.factory.createThis(), + ts.factory.createIdentifier(`__${initText}`))); +} + +function getParentNode(node: ts.PropertyAssignment, collection: Map>): string[] { + const grandparentNode: ts.NewExpression = node.parent.parent as ts.NewExpression; + const grandparentExpression: ts.Identifier | ts.PropertyAccessExpression = + grandparentNode.expression as ts.Identifier | ts.PropertyAccessExpression; + let parentComponent: Set = new Set(); + let grandparentName: string; + if (ts.isIdentifier(grandparentExpression)) { + grandparentName = grandparentExpression.escapedText.toString(); + parentComponent = collection.get(grandparentName); + } else if (ts.isPropertyAccessExpression(grandparentExpression)) { + grandparentName = grandparentExpression.name.escapedText.toString(); + parentComponent = collection.get(grandparentName); + } else { + // ignore + } + if (!parentComponent) { + parentComponent = new Set(); + } + return [grandparentName, ...parentComponent]; +} + +function processAnimateTo(node: ts.CallExpression): ts.CallExpression { + return ts.factory.updateCallExpression(node, ts.factory.createPropertyAccessExpression( + ts.factory.createIdentifier(GLOBAL_CONTEXT), ts.factory.createIdentifier(ATTRIBUTE_ANIMATETO)), + node.typeArguments, node.arguments); +} + +function addUpdateParamsFunc(statements: ts.Statement[]): ts.MethodDeclaration { + return createParamsInitBlock(COMPONENT_CONSTRUCTOR_UPDATE_PARAMS, statements); +} + +function addDeleteParamsFunc(statements: ts.PropertyDeclaration[]): ts.MethodDeclaration { + const deleteStatements: ts.ExpressionStatement[] = []; + statements.forEach((statement: ts.PropertyDeclaration) => { + const name: ts.Identifier = statement.name as ts.Identifier; + const paramsStatement: ts.ExpressionStatement = ts.factory.createExpressionStatement( + ts.factory.createCallExpression(ts.factory.createPropertyAccessExpression( + ts.factory.createPropertyAccessExpression(ts.factory.createThis(), + ts.factory.createIdentifier(`__${name.escapedText.toString()}`)), + ts.factory.createIdentifier(COMPONENT_CONSTRUCTOR_DELETE_PARAMS)), undefined, [])); + deleteStatements.push(paramsStatement); + }); + const defaultStatement: ts.ExpressionStatement = + ts.factory.createExpressionStatement(ts.factory.createCallExpression( + ts.factory.createPropertyAccessExpression( + ts.factory.createCallExpression(ts.factory.createPropertyAccessExpression( + ts.factory.createIdentifier(CREATE_CONSTRUCTOR_SUBSCRIBER_MANAGER), + ts.factory.createIdentifier(CREATE_CONSTRUCTOR_GET_FUNCTION)), undefined, []), + ts.factory.createIdentifier(CREATE_CONSTRUCTOR_DELETE_FUNCTION)), + undefined, [ts.factory.createCallExpression(ts.factory.createPropertyAccessExpression( + ts.factory.createThis(), ts.factory.createIdentifier(ABOUT_TO_BE_DELETE_FUNCTION_ID)), + undefined, [])])); + deleteStatements.push(defaultStatement); + const deleteParamsMethod: ts.MethodDeclaration = + createParamsInitBlock(COMPONENT_CONSTRUCTOR_DELETE_PARAMS, deleteStatements); + return deleteParamsMethod; +} + +function createParamsInitBlock(express: string, statements: ts.Statement[]): ts.MethodDeclaration { + const methodDeclaration: ts.MethodDeclaration = ts.factory.createMethodDeclaration(undefined, + undefined, undefined, ts.factory.createIdentifier(express), undefined, undefined, + [ts.factory.createParameterDeclaration(undefined, undefined, undefined, + express === COMPONENT_CONSTRUCTOR_DELETE_PARAMS ? undefined : + ts.factory.createIdentifier(CREATE_CONSTRUCTOR_PARAMS), undefined, undefined, undefined)], + undefined, ts.factory.createBlock(statements, true)); + return methodDeclaration; +} + +function validateBuildMethodCount(buildCount: BuildCount, parentComponentName: ts.Identifier, + log: LogInfo[]): void { + if (buildCount.count !== 1) { + log.push({ + type: LogType.ERROR, + message: `struct '${parentComponentName.getText()}' must be at least or at most one 'build' method.`, + pos: parentComponentName.getStart() + }); + } +} + +function validateInheritClass(node: ts.ClassDeclaration, log: LogInfo[]): void { + if (node.heritageClauses) { + log.push({ + type: LogType.ERROR, + message: '@Component should not be inherit other Classes.', + pos: node.heritageClauses.pos + }); + } +} + +function validateHasController(componentName: ts.Identifier, checkController: ControllerType, + log: LogInfo[]): void { + if (!checkController.hasController) { + log.push({ + type: LogType.ERROR, + message: '@CustomDialog component should have a property of the CustomDialogController type.', + pos: componentName.pos + }); + } +} diff --git a/compiler/compiler/src/process_component_constructor.ts b/compiler/compiler/src/process_component_constructor.ts new file mode 100644 index 000000000..c963af058 --- /dev/null +++ b/compiler/compiler/src/process_component_constructor.ts @@ -0,0 +1,95 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + +import ts from 'typescript'; + +import { + COMPONENT_CONSTRUCTOR_ID, + COMPONENT_CONSTRUCTOR_PARENT, + COMPONENT_CONSTRUCTOR_PARAMS, + COMPONENT_CONSTRUCTOR_UPDATE_PARAMS, + COMPONENT_WATCH_FUNCTION +} from './pre_define'; + +export function getInitConstructor(members: ts.NodeArray): ts.ConstructorDeclaration { + let ctorNode: any = members.find(item => { + return ts.isConstructorDeclaration(item); + }); + if (ctorNode) { + ctorNode = updateConstructor(ctorNode, [], [], true); + } + return ctorNode; +} + +export function updateConstructor(ctorNode: ts.ConstructorDeclaration, + para: ts.ParameterDeclaration[], addStatements: ts.Statement[], + isSuper: boolean = false): ts.ConstructorDeclaration { + let modifyPara: ts.ParameterDeclaration[]; + if (para && para.length) { + modifyPara = Array.from(ctorNode.parameters); + if (modifyPara) { + modifyPara.push(...para); + } + } + let modifyBody: ts.Statement[]; + if (addStatements && addStatements.length && ctorNode) { + modifyBody = Array.from(ctorNode.body.statements); + if (modifyBody) { + if (isSuper) { + modifyBody.unshift(...addStatements); + } else { + modifyBody.push(...addStatements); + } + } + } + if (ctorNode) { + ctorNode = ts.factory.updateConstructorDeclaration(ctorNode, ctorNode.decorators, + ctorNode.modifiers, modifyPara || ctorNode.parameters, + ts.factory.createBlock(modifyBody || ctorNode.body.statements, true)); + } + return ctorNode; +} + +export function addConstructor(ctorNode: any, watchMap: Map) + : ts.ConstructorDeclaration { + const watchStatements: ts.ExpressionStatement[] = []; + watchMap.forEach((value, key) => { + const watchNode: ts.ExpressionStatement = ts.factory.createExpressionStatement( + ts.factory.createCallExpression( + ts.factory.createPropertyAccessExpression( + ts.factory.createThis(), + ts.factory.createIdentifier(COMPONENT_WATCH_FUNCTION) + ), + undefined, + [ + ts.factory.createStringLiteral(key), + ts.isStringLiteral(value) ? + ts.factory.createPropertyAccessExpression(ts.factory.createThis(), + ts.factory.createIdentifier(value.text)) : value as ts.PropertyAccessExpression + ] + )); + watchStatements.push(watchNode); + }); + const callSuperStatement: ts.Statement = ts.factory.createExpressionStatement( + ts.factory.createCallExpression(ts.factory.createSuper(), undefined, + [ts.factory.createIdentifier(COMPONENT_CONSTRUCTOR_ID), + ts.factory.createIdentifier(COMPONENT_CONSTRUCTOR_PARENT)])); + const updateWithValueParamsStatement: ts.Statement = ts.factory.createExpressionStatement( + ts.factory.createCallExpression(ts.factory.createPropertyAccessExpression( + ts.factory.createThis(), ts.factory.createIdentifier(COMPONENT_CONSTRUCTOR_UPDATE_PARAMS)), + undefined, [ts.factory.createIdentifier(COMPONENT_CONSTRUCTOR_PARAMS)])); + return updateConstructor(updateConstructor(ctorNode, [], [callSuperStatement], true), [], + [updateWithValueParamsStatement, ...watchStatements], false); +} diff --git a/compiler/compiler/src/process_component_member.ts b/compiler/compiler/src/process_component_member.ts new file mode 100644 index 000000000..5a348c2f4 --- /dev/null +++ b/compiler/compiler/src/process_component_member.ts @@ -0,0 +1,899 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + +import ts from 'typescript'; + +import { + INNER_COMPONENT_MEMBER_DECORATORS, + COMPONENT_NON_DECORATOR, + COMPONENT_STATE_DECORATOR, + COMPONENT_PROP_DECORATOR, + COMPONENT_LINK_DECORATOR, + COMPONENT_STORAGE_PROP_DECORATOR, + COMPONENT_STORAGE_LINK_DECORATOR, + COMPONENT_PROVIDE_DECORATOR, + COMPONENT_CONSUME_DECORATOR, + COMPONENT_OBJECT_LINK_DECORATOR, + COMPONENT_WATCH_DECORATOR, + COMPONENT_OBSERVED_DECORATOR, + OBSERVED_PROPERTY_SIMPLE, + OBSERVED_PROPERTY_OBJECT, + SYNCHED_PROPERTY_SIMPLE_ONE_WAY, + SYNCHED_PROPERTY_SIMPLE_TWO_WAY, + SYNCHED_PROPERTY_OBJECT_TWO_WAY, + SYNCHED_PROPERTY_NESED_OBJECT, + CREATE_GET_METHOD, + CREATE_SET_METHOD, + CREATE_NEWVALUE_IDENTIFIER, + CREATE_CONSTRUCTOR_PARAMS, + ADD_PROVIDED_VAR, + INITIALIZE_CONSUME_FUNCTION, + APP_STORAGE, + APP_STORAGE_SET_AND_PROP, + APP_STORAGE_SET_AND_LINK, + APP_STORAGE_GET_OR_SET, + COMPONENT_CONSTRUCTOR_UNDEFINED, + SET_CONTROLLER_METHOD, + SET_CONTROLLER_CTR, + SET_CONTROLLER_CTR_TYPE, + JS_DIALOG, + CUSTOM_DIALOG_CONTROLLER_BUILDER, + BASE_COMPONENT_NAME, + COMPONENT_CREATE_FUNCTION +} from './pre_define'; +import { + forbiddenUseStateType, + BUILDIN_STYLE_NAMES +} from './component_map'; +import { + observedClassCollection, + enumCollection, + componentCollection, + classMethodCollection +} from './validate_ui_syntax'; +import { updateConstructor } from './process_component_constructor'; +import { + LogType, + LogInfo, + componentInfo, + createFunction +} from './utils'; +import { + createReference, + isProperty +} from './process_component_class'; + +export type ControllerType = { + hasController: boolean +} + +export const observedPropertyDecorators: Set = + new Set([COMPONENT_STATE_DECORATOR, COMPONENT_PROVIDE_DECORATOR]); + +export const propAndLinkDecorators: Set = + new Set([COMPONENT_PROP_DECORATOR, COMPONENT_LINK_DECORATOR]); + +export const appStorageDecorators: Set = + new Set([COMPONENT_STORAGE_PROP_DECORATOR, COMPONENT_STORAGE_LINK_DECORATOR]); + +export const mandatorySpecifyDefaultValueDecorators: Set = + new Set([...observedPropertyDecorators, ...appStorageDecorators]); + +export const forbiddenSpecifyDefaultValueDecorators: Set = + new Set([...propAndLinkDecorators, COMPONENT_CONSUME_DECORATOR, COMPONENT_OBJECT_LINK_DECORATOR]); + +export const mandatoryToInitViaParamDecorators: Set = + new Set([...propAndLinkDecorators, COMPONENT_OBJECT_LINK_DECORATOR]); + +export const setUpdateParamsDecorators: Set = + new Set([...observedPropertyDecorators, COMPONENT_PROP_DECORATOR, COMPONENT_OBJECT_LINK_DECORATOR]); + +export const immutableDecorators: Set = + new Set([COMPONENT_STORAGE_PROP_DECORATOR, COMPONENT_OBJECT_LINK_DECORATOR]); + +export const simpleTypes: Set = new Set([ts.SyntaxKind.StringKeyword, + ts.SyntaxKind.NumberKeyword, ts.SyntaxKind.BooleanKeyword, ts.SyntaxKind.EnumDeclaration]); + +export const decoratorParamSet: Set = new Set(); + +export const stateObjectCollection: Set = new Set(); + +export class UpdateResult { + private itemUpdate: boolean = false; + private ctorUpdate: boolean = false; + private properity: ts.PropertyDeclaration; + private ctor: ts.ConstructorDeclaration; + private variableGet: ts.GetAccessorDeclaration; + private variableSet: ts.SetAccessorDeclaration; + private updateParams: ts.Statement; + private deleteParams: boolean = false; + private controllerSet: ts.MethodDeclaration; + + public setProperity(updateItem: ts.PropertyDeclaration) { + this.itemUpdate = true; + this.properity = updateItem; + } + + public setCtor(updateCtor: ts.ConstructorDeclaration) { + this.ctorUpdate = true; + this.ctor = updateCtor; + } + + public setControllerSet(updateControllerSet: ts.MethodDeclaration) { + this.controllerSet = updateControllerSet; + } + + public getControllerSet(): ts.MethodDeclaration { + return this.controllerSet; + } + + public setVariableGet(updateVariableGet: ts.GetAccessorDeclaration) { + this.variableGet = updateVariableGet; + } + + public setVariableSet(updateVariableSet: ts.SetAccessorDeclaration) { + this.variableSet = updateVariableSet; + } + + public setUpdateParams(updateParams: ts.Statement) { + this.updateParams = updateParams; + } + + public setDeleteParams(deleteParams: boolean) { + this.deleteParams = deleteParams; + } + + public isItemUpdate(): boolean { + return this.itemUpdate; + } + + public isCtorUpdate(): boolean { + return this.ctorUpdate; + } + + public getProperity(): ts.PropertyDeclaration { + return this.properity; + } + + public getCtor(): ts.ConstructorDeclaration { + return this.ctor; + } + + public getUpdateParams(): ts.Statement { + return this.updateParams; + } + + public getVariableGet(): ts.GetAccessorDeclaration { + return this.variableGet; + } + + public getVariableSet(): ts.SetAccessorDeclaration { + return this.variableSet; + } + + public isDeleteParams(): boolean { + return this.deleteParams; + } +} + +export const curPropMap: Map = new Map(); + +export function processMemberVariableDecorators(parentName: ts.Identifier, + item: ts.PropertyDeclaration, ctorNode: ts.ConstructorDeclaration, watchMap: Map, + checkController: ControllerType, log: LogInfo[], program: ts.Program, + context: ts.TransformationContext): UpdateResult { + const updateResult: UpdateResult = new UpdateResult(); + const name: ts.Identifier = item.name as ts.Identifier; + if (!item.decorators || !item.decorators.length) { + curPropMap.set(name.escapedText.toString(), COMPONENT_NON_DECORATOR); + updateResult.setProperity(undefined); + updateResult.setUpdateParams(createUpdateParams(name, COMPONENT_NON_DECORATOR)); + updateResult.setCtor(updateConstructor(ctorNode, [], [ + createVariableInitStatement(item, COMPONENT_NON_DECORATOR, log, program, context)])); + updateResult.setControllerSet(createControllerSet(item, parentName, name, checkController)); + } else if (!item.type) { + validatePropertyNonType(name, log); + return updateResult; + } else { + processPropertyNodeDecorator(parentName, item, updateResult, ctorNode, name, watchMap, + log, program, context); + } + return updateResult; +} + +function createControllerSet(node: ts.PropertyDeclaration, componentName: ts.Identifier, + name: ts.Identifier, checkController: ControllerType): ts.MethodDeclaration { + if (componentCollection.customDialogs.has(componentName.getText()) && node.type && + node.type.getText() === SET_CONTROLLER_CTR_TYPE) { + checkController.hasController = true; + return ts.factory.createMethodDeclaration(undefined, undefined, undefined, + ts.factory.createIdentifier(SET_CONTROLLER_METHOD), undefined, undefined, + [ts.factory.createParameterDeclaration(undefined, undefined, undefined, + ts.factory.createIdentifier(SET_CONTROLLER_CTR), undefined, + ts.factory.createTypeReferenceNode(ts.factory.createIdentifier(SET_CONTROLLER_CTR_TYPE), + undefined), undefined)], undefined, ts.factory.createBlock( + [ts.factory.createExpressionStatement(ts.factory.createBinaryExpression( + ts.factory.createPropertyAccessExpression(ts.factory.createThis(), name), + ts.factory.createToken(ts.SyntaxKind.EqualsToken), + ts.factory.createIdentifier(SET_CONTROLLER_CTR)))], true)); + } +} + +function processPropertyNodeDecorator(parentName: ts.Identifier, node: ts.PropertyDeclaration, + updateResult: UpdateResult, ctorNode: ts.ConstructorDeclaration, name: ts.Identifier, + watchMap: Map, log: LogInfo[], program: ts.Program, + context: ts.TransformationContext): void { + let stateManagementDecoratorCount: number = 0; + for (let i = 0; i < node.decorators.length; i++) { + const decoratorName: string = node.decorators[i].getText().replace(/\(.*\)$/, '').trim(); + if (decoratorName !== COMPONENT_WATCH_DECORATOR) { + curPropMap.set(name.escapedText.toString(), decoratorName); + } + if (BUILDIN_STYLE_NAMES.has(decoratorName.replace('@', ''))) { + validateDuplicateDecorator(node.decorators[i], log); + } + if (decoratorName !== COMPONENT_WATCH_DECORATOR && isForbiddenUseStateType(node.type)) { + // @ts-ignore + validateForbiddenUseStateType(name, decoratorName, node.type.typeName.getText(), log); + return; + } + if (parentName.getText() === componentCollection.entryComponent && + mandatoryToInitViaParamDecorators.has(decoratorName)) { + validateHasIllegalDecoratorInEntry(parentName, name, decoratorName, log); + } + if (node.initializer && forbiddenSpecifyDefaultValueDecorators.has(decoratorName)) { + validatePropertyDefaultValue(name, decoratorName, log); + return; + } else if (!node.initializer && mandatorySpecifyDefaultValueDecorators.has(decoratorName)) { + validatePropertyNonDefaultValue(name, decoratorName, log); + return; + } + if (node.questionToken && mandatoryToInitViaParamDecorators.has(decoratorName)) { + validateHasIllegalQuestionToken(name, decoratorName, log); + } + if (!isSimpleType(node.type, program)) { + stateObjectCollection.add(name.escapedText.toString()); + } + if (decoratorName === COMPONENT_WATCH_DECORATOR && + validateWatchDecorator(name, node.decorators.length, log)) { + processWatch(node, node.decorators[i], watchMap, log); + } else if (INNER_COMPONENT_MEMBER_DECORATORS.has(decoratorName)) { + stateManagementDecoratorCount += 1; + processStateDecorators(node, decoratorName, updateResult, ctorNode, log, program, context); + } + } + if (stateManagementDecoratorCount > 1) { + validateMultiDecorators(name, log); + return; + } +} + +function processStateDecorators(node: ts.PropertyDeclaration, decorator: string, + updateResult: UpdateResult, ctorNode: ts.ConstructorDeclaration, log: LogInfo[], + program: ts.Program, context: ts.TransformationContext): void { + const name: ts.Identifier = node.name as ts.Identifier; + updateResult.setProperity(undefined); + const updateState: ts.Statement[] = []; + const variableInitStatement: ts.Statement = + createVariableInitStatement(node, decorator, log, program, context); + if (variableInitStatement) { + updateState.push(variableInitStatement); + } + addAddProvidedVar(node, name, decorator, updateState); + updateResult.setCtor(updateConstructor(ctorNode, [], [...updateState], false)); + updateResult.setVariableGet(createGetAccessor(name, CREATE_GET_METHOD)); + if (!immutableDecorators.has(decorator)) { + updateResult.setVariableSet(createSetAccessor(name, CREATE_SET_METHOD)); + } + if (setUpdateParamsDecorators.has(decorator)) { + updateResult.setUpdateParams(createUpdateParams(name, decorator)); + } + updateResult.setDeleteParams(true); +} + +function processWatch(node: ts.PropertyDeclaration, decorator: ts.Decorator, + watchMap: Map, log: LogInfo[]): void { + if (node.name) { + const propertyName: string = node.name.getText(); + if (decorator.expression && ts.isCallExpression(decorator.expression) && + decorator.expression.arguments && decorator.expression.arguments.length === 1) { + const currentClassMethod: Set = classMethodCollection.get(node.parent.name.getText()); + const argument: ts.Node = decorator.expression.arguments[0]; + if (ts.isStringLiteral(argument)) { + if (currentClassMethod.has(argument.text)) { + watchMap.set(propertyName, argument); + } else { + log.push({ + type: LogType.ERROR, + message: `Cannot find name ${argument.getText()} in struct '${node.parent.name.getText()}'.`, + pos: argument.getStart() + }); + } + } else if (ts.isIdentifier(decorator.expression.arguments[0])) { + const content: string = decorator.expression.arguments[0].getText(); + const propertyNode: ts.PropertyAccessExpression = createPropertyAccessExpressionWithThis(content); + watchMap.set(propertyName, propertyNode); + decoratorParamSet.add(content); + validateWatchParam(LogType.WARN, argument.getStart(), log); + } else if (ts.isPropertyAccessExpression(decorator.expression.arguments[0])) { + watchMap.set(propertyName, decorator.expression.arguments[0]); + validateWatchParam(LogType.WARN, argument.getStart(), log); + } else { + validateWatchParam(LogType.ERROR, argument.getStart(), log); + } + } + } +} + +function createVariableInitStatement(node: ts.PropertyDeclaration, decorator: string, + log: LogInfo[], program: ts.Program, context: ts.TransformationContext): ts.Statement { + const name: ts.Identifier = node.name as ts.Identifier; + let type: ts.TypeNode; + let updateState: ts.ExpressionStatement; + if (node.type) { + type = node.type; + } + switch (decorator) { + case COMPONENT_NON_DECORATOR: + updateState = updateNormalProperty(node, name, log, context); + break; + case COMPONENT_STATE_DECORATOR: + case COMPONENT_PROVIDE_DECORATOR: + updateState = updateObservedProperty(node, name, type, program); + break; + case COMPONENT_LINK_DECORATOR: + updateState = updateSynchedPropertyTwoWay(name, type, program); + break; + case COMPONENT_PROP_DECORATOR: + updateState = updateSynchedPropertyOneWay(name, type, decorator, log, program); + break; + case COMPONENT_STORAGE_PROP_DECORATOR: + case COMPONENT_STORAGE_LINK_DECORATOR: + const setFuncName: string = decorator === COMPONENT_STORAGE_PROP_DECORATOR ? + APP_STORAGE_SET_AND_PROP : APP_STORAGE_SET_AND_LINK; + updateState = updateStoragePropAndLinkProperty(node, name, setFuncName, log); + break; + case COMPONENT_OBJECT_LINK_DECORATOR: + updateState = updateSynchedPropertyNesedObject(name, type, decorator, log); + break; + case COMPONENT_CONSUME_DECORATOR: + updateState = updateConsumeProperty(node, name); + break; + } + return updateState; +} + +function createUpdateParams(name: ts.Identifier, decorator: string): ts.Statement { + let updateParamsNode: ts.Statement; + switch (decorator) { + case COMPONENT_NON_DECORATOR: + case COMPONENT_STATE_DECORATOR: + case COMPONENT_PROVIDE_DECORATOR: + updateParamsNode = createUpdateParamsWithIf(name); + break; + case COMPONENT_PROP_DECORATOR: + updateParamsNode = createUpdateParamsWithoutIf(name); + break; + case COMPONENT_OBJECT_LINK_DECORATOR: + updateParamsNode = createUpdateParamsWithSet(name); + break; + } + return updateParamsNode; +} + +function createUpdateParamsWithIf(name: ts.Identifier): ts.IfStatement { + return ts.factory.createIfStatement(ts.factory.createBinaryExpression( + ts.factory.createPropertyAccessExpression( + ts.factory.createIdentifier(CREATE_CONSTRUCTOR_PARAMS), + ts.factory.createIdentifier(name.escapedText.toString())), + ts.factory.createToken(ts.SyntaxKind.ExclamationEqualsEqualsToken), + ts.factory.createIdentifier(COMPONENT_CONSTRUCTOR_UNDEFINED)), ts.factory.createBlock([ + createUpdateParamsWithoutIf(name)], true), undefined); +} + +function createUpdateParamsWithoutIf(name: ts.Identifier): ts.ExpressionStatement { + return ts.factory.createExpressionStatement(ts.factory.createBinaryExpression( + createPropertyAccessExpressionWithThis(name.getText()), + ts.factory.createToken(ts.SyntaxKind.EqualsToken), + createPropertyAccessExpressionWithParams(name.getText()))); +} + +function createUpdateParamsWithSet(name: ts.Identifier): ts.ExpressionStatement { + return ts.factory.createExpressionStatement(ts.factory.createCallExpression( + ts.factory.createPropertyAccessExpression(createPropertyAccessExpressionWithThis(`__${name.getText()}`), + ts.factory.createIdentifier(CREATE_SET_METHOD)), undefined, + [createPropertyAccessExpressionWithParams(name.getText())])); +} + +function updateNormalProperty(node: ts.PropertyDeclaration, name: ts.Identifier, + log: LogInfo[], context: ts.TransformationContext): ts.ExpressionStatement { + const init: ts.Expression = + ts.visitNode(processCustomDialogController(node, log), visitDialogController); + function visitDialogController(node: ts.Node): ts.Node { + if (isProperty(node)) { + node = createReference(node as ts.PropertyAssignment); + } + return ts.visitEachChild(node, visitDialogController, context); + } + return ts.factory.createExpressionStatement(ts.factory.createBinaryExpression( + createPropertyAccessExpressionWithThis(name.getText()), + ts.factory.createToken(ts.SyntaxKind.EqualsToken), init || + ts.factory.createIdentifier(COMPONENT_CONSTRUCTOR_UNDEFINED))); +} + +function processCustomDialogController(node: ts.PropertyDeclaration, + log: LogInfo[]): ts.Expression { + if (node.initializer && ts.isNewExpression(node.initializer) && + ts.isIdentifier(node.initializer.expression) && + node.initializer.expression.getText() === SET_CONTROLLER_CTR_TYPE) { + return createCustomDialogController(node, node.initializer, log); + } + return node.initializer; +} + +function createCustomDialogController(parent: ts.PropertyDeclaration, node: ts.NewExpression, + log: LogInfo[]): ts.NewExpression { + if (node.arguments && node.arguments.length === 1 && + ts.isObjectLiteralExpression(node.arguments[0]) && node.arguments[0].properties) { + const newproperties: ts.ObjectLiteralElementLike[] = node.arguments[0].properties.map((item) => { + if (isCustomDialogControllerPropertyAssignment(item, log)) { + item = processCustomDialogControllerPropertyAssignment(parent, item as ts.PropertyAssignment); + } + return item; + }); + return ts.factory.createNewExpression(node.expression, node.typeArguments, + [ts.factory.createObjectLiteralExpression(newproperties, true), ts.factory.createThis()]); + } +} + +function isCustomDialogControllerPropertyAssignment(node: ts.ObjectLiteralElementLike, + log: LogInfo[]): boolean { + if (ts.isPropertyAssignment(node) && ts.isIdentifier(node.name) && + node.name.getText() === CUSTOM_DIALOG_CONTROLLER_BUILDER) { + if (ts.isCallExpression(node.initializer) && ts.isIdentifier(node.initializer.expression) && + componentCollection.customDialogs.has(node.initializer.expression.getText())) { + return true; + } else { + validateCustomDialogControllerBuilderInit(node, log); + } + } +} + +function processCustomDialogControllerPropertyAssignment(parent: ts.PropertyDeclaration, + node: ts.PropertyAssignment): ts.PropertyAssignment { + if (ts.isCallExpression(node.initializer)) { + return ts.factory.updatePropertyAssignment(node, node.name, + processCustomDialogControllerBuilder(parent, node.initializer)); + } +} + +function processCustomDialogControllerBuilder(parent: ts.PropertyDeclaration, + node: ts.CallExpression): ts.ArrowFunction { + const newExp: ts.Expression = createCustomComponentNewExpression(node); + const jsDialog: ts.Identifier = ts.factory.createIdentifier(JS_DIALOG); + return createCustomComponentBuilderArrowFunction(parent, jsDialog, newExp); +} + +function updateObservedProperty(item: ts.PropertyDeclaration, name: ts.Identifier, + type: ts.TypeNode, program: ts.Program): ts.ExpressionStatement { + return ts.factory.createExpressionStatement(ts.factory.createBinaryExpression( + createPropertyAccessExpressionWithThis(`__${name.getText()}`), + ts.factory.createToken(ts.SyntaxKind.EqualsToken), ts.factory.createNewExpression( + ts.factory.createIdentifier(isSimpleType(type, program) ? OBSERVED_PROPERTY_SIMPLE : + OBSERVED_PROPERTY_OBJECT), undefined, [item.initializer, ts.factory.createThis(), + ts.factory.createStringLiteral(name.escapedText.toString())]))); +} + +function updateSynchedPropertyTwoWay(nameIdentifier: ts.Identifier, type: ts.TypeNode, + program: ts.Program): ts.ExpressionStatement { + const name: string = nameIdentifier.escapedText.toString(); + const functionName: string = isSimpleType(type, program) ? + SYNCHED_PROPERTY_SIMPLE_TWO_WAY : SYNCHED_PROPERTY_OBJECT_TWO_WAY; + return createInitExpressionStatementForDecorator(name, functionName, + createPropertyAccessExpressionWithParams(name)); +} + +function updateSynchedPropertyOneWay(nameIdentifier: ts.Identifier, type: ts.TypeNode, + decoractor: string, log: LogInfo[], program: ts.Program): ts.ExpressionStatement { + const name: string = nameIdentifier.escapedText.toString(); + if (isSimpleType(type, program)) { + return createInitExpressionStatementForDecorator(name, SYNCHED_PROPERTY_SIMPLE_ONE_WAY, + createPropertyAccessExpressionWithParams(name)); + } else { + validateNonSimpleType(nameIdentifier, decoractor, log); + } +} + +function updateStoragePropAndLinkProperty(node: ts.PropertyDeclaration, name: ts.Identifier, + setFuncName: string, log: LogInfo[]): ts.ExpressionStatement { + if (isSingleKey(node)) { + const key: string = getDecoratorKey(node); + return ts.factory.createExpressionStatement(ts.factory.createBinaryExpression( + createPropertyAccessExpressionWithThis(`__${name.getText()}`), + ts.factory.createToken(ts.SyntaxKind.EqualsToken), ts.factory.createCallExpression( + ts.factory.createPropertyAccessExpression(ts.factory.createCallExpression( + ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier(APP_STORAGE), + ts.factory.createIdentifier(APP_STORAGE_GET_OR_SET)), undefined, []), + ts.factory.createIdentifier(setFuncName)), undefined, [ts.factory.createStringLiteral(key), + node.initializer, ts.factory.createThis()]))); + } else { + validateAppStorageDecoractorsNonSingleKey(node, log); + } +} + +function getDecoratorKey(node: ts.PropertyDeclaration): string { + let key: string; + // @ts-ignore + const keyNameNode: ts.Node = node.decorators[0].expression.arguments[0]; + if (ts.isIdentifier(keyNameNode)) { + key = keyNameNode.getText(); + decoratorParamSet.add(key); + } else if (ts.isStringLiteral(keyNameNode)) { + key = keyNameNode.text; + } + return key; +} + +function updateSynchedPropertyNesedObject(nameIdentifier: ts.Identifier, + type: ts.TypeNode, decoractor: string, log: LogInfo[]): ts.ExpressionStatement { + if (isObservedClassType(type)) { + return createInitExpressionStatementForDecorator(nameIdentifier.getText(), SYNCHED_PROPERTY_NESED_OBJECT, + createPropertyAccessExpressionWithParams(nameIdentifier.getText())); + } else { + validateNonObservedClassType(nameIdentifier, decoractor, log); + } +} + +function updateConsumeProperty(node: ts.PropertyDeclaration, + nameIdentifier: ts.Identifier): ts.ExpressionStatement { + const name: string = nameIdentifier.getText(); + let propertyOrAliasName: string; + if (isSingleKey(node)) { + propertyOrAliasName = getDecoratorKey(node); + } else { + propertyOrAliasName = name; + } + return ts.factory.createExpressionStatement(ts.factory.createBinaryExpression( + createPropertyAccessExpressionWithThis(`__${name}`), + ts.factory.createToken(ts.SyntaxKind.EqualsToken), ts.factory.createCallExpression( + createPropertyAccessExpressionWithThis(INITIALIZE_CONSUME_FUNCTION), undefined, [ + ts.factory.createStringLiteral(propertyOrAliasName), ts.factory.createStringLiteral(name)]))); +} + +function createCustomComponentBuilderArrowFunction(parent: ts.PropertyDeclaration, + jsDialog: ts.Identifier, newExp: ts.Expression): ts.ArrowFunction { + return ts.factory.createArrowFunction(undefined, undefined, [], undefined, + ts.factory.createToken(ts.SyntaxKind.EqualsGreaterThanToken), ts.factory.createBlock([ + ts.factory.createVariableStatement(undefined, ts.factory.createVariableDeclarationList( + [ts.factory.createVariableDeclaration(jsDialog, undefined, undefined, newExp)], + ts.NodeFlags.Let)), ts.factory.createExpressionStatement(ts.factory.createCallExpression( + ts.factory.createPropertyAccessExpression(jsDialog, + ts.factory.createIdentifier(SET_CONTROLLER_METHOD)), undefined, + [ts.factory.createPropertyAccessExpression(ts.factory.createThis(), + parent.name as ts.Identifier)])), ts.factory.createExpressionStatement( + createViewCreate(jsDialog))], true)); +} + +export function createViewCreate(node: ts.NewExpression | ts.Identifier): ts.CallExpression { + return createFunction(ts.factory.createIdentifier(BASE_COMPONENT_NAME), + ts.factory.createIdentifier(COMPONENT_CREATE_FUNCTION), ts.factory.createNodeArray([node])); +} + +export function createCustomComponentNewExpression(node: ts.CallExpression): ts.NewExpression { + const newNode: ts.NewExpression = ts.factory.createNewExpression(node.expression, + node.typeArguments, node.arguments.length ? node.arguments : []); + return addCustomComponentId(newNode); +} + +function addCustomComponentId(node: ts.NewExpression): ts.NewExpression { + for (const item of componentCollection.customComponents) { + componentInfo.componentNames.add(item); + } + componentInfo.componentNames.forEach((name: string) => { + const nodeIdentifier: ts.Identifier | ts.PropertyAccessExpression = + node.expression as ts.Identifier | ts.PropertyAccessExpression; + let argumentsArray: ts.Expression[]; + if (node.arguments && node.arguments.length) { + argumentsArray = Array.from(node.arguments); + } + if (nodeIdentifier && (ts.isIdentifier(nodeIdentifier) && + nodeIdentifier.escapedText === name || ts.isPropertyAccessExpression(nodeIdentifier) && + ts.isIdentifier(nodeIdentifier.name) && nodeIdentifier.name.escapedText === name)) { + if (!argumentsArray) { + argumentsArray = [ts.factory.createObjectLiteralExpression([], true)]; + } + argumentsArray.unshift(ts.factory.createStringLiteral((++componentInfo.id).toString()), + ts.factory.createThis()); + node = + ts.factory.updateNewExpression(node, node.expression, node.typeArguments, argumentsArray); + } else if (argumentsArray) { + node = + ts.factory.updateNewExpression(node, node.expression, node.typeArguments, argumentsArray); + } + }); + return node; +} + +function createInitExpressionStatementForDecorator(propertyName: string, functionName: string, + parameterNode: ts.Expression): ts.ExpressionStatement { + return ts.factory.createExpressionStatement(ts.factory.createBinaryExpression( + createPropertyAccessExpressionWithThis(`__${propertyName}`), + ts.factory.createToken(ts.SyntaxKind.EqualsToken), ts.factory.createNewExpression( + ts.factory.createIdentifier(functionName), undefined, [parameterNode, ts.factory.createThis(), + ts.factory.createStringLiteral(propertyName)]))); +} + +function createPropertyAccessExpressionWithParams(propertyName: string): ts.PropertyAccessExpression { + return ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier(CREATE_CONSTRUCTOR_PARAMS), + ts.factory.createIdentifier(propertyName)); +} + +function createPropertyAccessExpressionWithThis(propertyName: string): ts.PropertyAccessExpression { + return ts.factory.createPropertyAccessExpression(ts.factory.createThis(), + ts.factory.createIdentifier(propertyName)); +} + +function addAddProvidedVar(node: ts.PropertyDeclaration, name: ts.Identifier, + decoratorName: string, updateState: ts.Statement[]): void { + if (decoratorName === COMPONENT_PROVIDE_DECORATOR) { + if (isSingleKey(node)) { + updateState.push(createAddProvidedVar(getDecoratorKey(node), name)); + } + updateState.push(createAddProvidedVar(name.getText(), name)); + } +} + +function createAddProvidedVar(propertyOrAliasName: string, + name: ts.Identifier): ts.ExpressionStatement { + return ts.factory.createExpressionStatement(ts.factory.createCallExpression( + createPropertyAccessExpressionWithThis(ADD_PROVIDED_VAR), undefined, [ + ts.factory.createStringLiteral(propertyOrAliasName), + createPropertyAccessExpressionWithThis(`__${name.getText()}`)])); +} + +function createGetAccessor(item: ts.Identifier, express: string): ts.GetAccessorDeclaration { + const getAccessorStatement: ts.GetAccessorDeclaration = + ts.factory.createGetAccessorDeclaration(undefined, undefined, item, [], undefined, + ts.factory.createBlock([ts.factory.createReturnStatement( + ts.factory.createCallExpression(ts.factory.createPropertyAccessExpression( + createPropertyAccessExpressionWithThis(`__${item.getText()}`), + ts.factory.createIdentifier(express)), undefined, []))], true)); + return getAccessorStatement; +} + +function createSetAccessor(item: ts.Identifier, express: string): ts.SetAccessorDeclaration { + const setAccessorStatement: ts.SetAccessorDeclaration = + ts.factory.createSetAccessorDeclaration(undefined, undefined, item, + [ts.factory.createParameterDeclaration(undefined, undefined, undefined, + ts.factory.createIdentifier(CREATE_NEWVALUE_IDENTIFIER), undefined, undefined, + undefined)], ts.factory.createBlock([ts.factory.createExpressionStatement( + ts.factory.createCallExpression(ts.factory.createPropertyAccessExpression( + createPropertyAccessExpressionWithThis(`__${item.getText()}`), + ts.factory.createIdentifier(express)), undefined, + [ts.factory.createIdentifier(CREATE_NEWVALUE_IDENTIFIER)]))], true)); + return setAccessorStatement; +} + +function isForbiddenUseStateType(typeNode: ts.TypeNode): boolean { + if (ts.isTypeReferenceNode(typeNode) && ts.isIdentifier(typeNode.typeName) && + forbiddenUseStateType.has(typeNode.typeName.getText())) { + return true; + } + return false; +} + +function isSimpleType(typeNode: ts.TypeNode, program: ts.Program): boolean { + let checker: ts.TypeChecker; + if (program) { + checker = program.getTypeChecker(); + } + const enumType: ts.SyntaxKind = getEnumType(typeNode, checker); + if (simpleTypes.has(enumType || typeNode.kind) || isEnumtype(typeNode)) { + return true; + } else if (ts.isUnionTypeNode(typeNode) && typeNode.types) { + const types: ts.NodeArray = typeNode.types; + for (let i = 0; i < types.length; i++) { + const enumType: ts.SyntaxKind = getEnumType(types[i], checker); + if (!simpleTypes.has(enumType || types[i].kind) && !isEnumtype(typeNode)) { + return false; + } + } + return true; + } + return false; +} + +function getEnumType(typeNode: ts.TypeNode, checker: ts.TypeChecker): ts.SyntaxKind { + if (!checker) { + return; + } + if (ts.isTypeReferenceNode(typeNode) && ts.isIdentifier(typeNode.typeName)) { + const type: ts.Type = + checker.getBaseTypeOfLiteralType(checker.getTypeAtLocation(typeNode.typeName)); + if (type.symbol && type.symbol.valueDeclaration) { + return type.symbol.valueDeclaration.kind; + } + } +} + +function isEnumtype(typeNode: ts.TypeNode): boolean { + if (ts.isTypeReferenceNode(typeNode) && ts.isIdentifier(typeNode.typeName)) { + return enumCollection.has(typeNode.typeName.getText()); + } +} + +function isObservedClassType(type: ts.TypeNode): boolean { + if (ts.isTypeReferenceNode(type) && observedClassCollection.has(type.getText())) { + return true; + } else if (ts.isUnionTypeNode(type) && type.types) { + const types: ts.NodeArray = type.types; + for (let i = 0; i < types.length; i++) { + if (!observedClassCollection.has(types[i].getText())) { + return false; + } + } + return true; + } + return false; +} + +function validateAppStorageDecoractorsNonSingleKey(node: ts.PropertyDeclaration, + log: LogInfo[]): void { + if (ts.isIdentifier(node.decorators[0].expression)) { + validateDecoratorNonSingleKey(node.decorators[0].expression, log); + } else if (ts.isCallExpression(node.decorators[0].expression) && + ts.isIdentifier(node.decorators[0].expression.expression)) { + validateDecoratorNonSingleKey(node.decorators[0].expression.expression, log); + } +} + +function isSingleKey(node: ts.PropertyDeclaration): boolean { + if (ts.isCallExpression(node.decorators[0].expression) && + node.decorators[0].expression.arguments && + node.decorators[0].expression.arguments.length === 1 && + (ts.isIdentifier(node.decorators[0].expression.arguments[0]) || + ts.isStringLiteral(node.decorators[0].expression.arguments[0]))) { + return true; + } +} + +function validateMultiDecorators(name: ts.Identifier, log: LogInfo[]): void { + log.push({ + type: LogType.ERROR, + message: `The property '${name.escapedText.toString()}' cannot have mutilate state management decorators.`, + pos: name.getStart() + }); +} + +function validateDecoratorNonSingleKey(decoratorsIdentifier: ts.Identifier, + log: LogInfo[]): void { + log.push({ + type: LogType.ERROR, + message: `The decorator ${decoratorsIdentifier.escapedText.toString()} should have a single key.`, + pos: decoratorsIdentifier.getStart() + }); +} + +function validatePropertyNonDefaultValue(propertyName: ts.Identifier, decorator: string, + log: LogInfo[]): void { + log.push({ + type: LogType.ERROR, + message: `The ${decorator} property '${propertyName.getText()}' must be specified a default value.`, + pos: propertyName.getStart() + }); +} + +function validatePropertyDefaultValue(propertyName: ts.Identifier, decorator: string, + log: LogInfo[]): void { + log.push({ + type: LogType.ERROR, + message: `The ${decorator} property '${propertyName.getText()}' cannot be specified a default value.`, + pos: propertyName.getStart() + }); +} + +function validatePropertyNonType(propertyName: ts.Identifier, log: LogInfo[]): void { + log.push({ + type: LogType.ERROR, + message: `The property '${propertyName.getText()}' must specify a type.`, + pos: propertyName.getStart() + }); +} + +function validateNonSimpleType(propertyName: ts.Identifier, decorator: string, + log: LogInfo[]): void { + log.push({ + type: LogType.ERROR, + message: `The type of the ${decorator} property '${propertyName.getText()}' ` + + `can only be string, number or boolean.`, + pos: propertyName.getStart() + }); +} + +function validateNonObservedClassType(propertyName: ts.Identifier, decorator: string, + log: LogInfo[]): void { + log.push({ + type: LogType.ERROR, + message: `The type of the ${decorator} property '${propertyName.getText()}' can only be ` + + `objects of classes decorated with ${COMPONENT_OBSERVED_DECORATOR} class decorator in ets (not ts).`, + pos: propertyName.getStart() + }); +} + +function validateHasIllegalQuestionToken(propertyName: ts.Identifier, decorator: string, + log: LogInfo[]): void { + log.push({ + type: LogType.WARN, + message: `The ${decorator} property '${propertyName.getText()}' cannot have a question token.`, + pos: propertyName.getStart() + }); +} + +function validateHasIllegalDecoratorInEntry(parentName: ts.Identifier, propertyName: ts.Identifier, + decorator: string, log: LogInfo[]): void { + log.push({ + type: LogType.WARN, + message: `The @Entry component '${parentName.getText()}' cannot have the ` + + `${decorator} property '${propertyName.getText()}'.`, + pos: propertyName.getStart() + }); +} + +function validateForbiddenUseStateType(propertyName: ts.Identifier, decorator: string, type: string, + log: LogInfo[]): void { + log.push({ + type: LogType.ERROR, + message: `The ${decorator} property '${propertyName.getText()}' cannot be a '${type}' object.`, + pos: propertyName.getStart() + }); +} + +function validateDuplicateDecorator(decorator: ts.Decorator, log: LogInfo[]): void { + log.push({ + type: LogType.ERROR, + message: `The decorator '${decorator.getText()}' cannot have the same name as the build-in ` + + `style attribute '${decorator.getText().replace('@', '')}'.`, + pos: decorator.getStart() + }); +} + +function validateWatchDecorator(propertyName: ts.Identifier, length: number, log: LogInfo[]): boolean { + if (length === 1) { + log.push({ + type: LogType.ERROR, + message: `Regular variable '${propertyName.escapedText.toString()}' can not be decorated with @Watch.`, + pos: propertyName.getStart() + }); + return false; + } + return true; +} + +function validateWatchParam(type: LogType, pos: number, log: LogInfo[]): void { + log.push({ + type: type, + message: 'The parameter should be a string.', + pos: pos + }); +} + +function validateCustomDialogControllerBuilderInit(node: ts.ObjectLiteralElementLike, + log: LogInfo[]): void { + log.push({ + type: LogType.ERROR, + message: 'The builder should be initialized with a @CustomDialog Component.', + pos: node.getStart() + }); +} diff --git a/compiler/compiler/src/process_custom_component.ts b/compiler/compiler/src/process_custom_component.ts new file mode 100644 index 000000000..163e8cbb3 --- /dev/null +++ b/compiler/compiler/src/process_custom_component.ts @@ -0,0 +1,393 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + +import ts from 'typescript'; + +import { + COMPONENT_NON_DECORATOR, + COMPONENT_STATE_DECORATOR, + COMPONENT_PROP_DECORATOR, + COMPONENT_LINK_DECORATOR, + COMPONENT_STORAGE_LINK_DECORATOR, + COMPONENT_PROVIDE_DECORATOR, + COMPONENT_OBJECT_LINK_DECORATOR, + COMPONENT_CREATE_FUNCTION, + BASE_COMPONENT_NAME, + CUSTOM_COMPONENT_EARLIER_CREATE_CHILD, + COMPONENT_CONSTRUCTOR_UPDATE_PARAMS, + CUSTOM_COMPONENT_FUNCTION_FIND_CHILD_BY_ID, + COMPONENT_CONSTRUCTOR_UNDEFINED, + CUSTOM_COMPONENT_NEEDS_UPDATE_FUNCTION, + CUSTOM_COMPONENT_MARK_STATIC_FUNCTION +} from './pre_define'; +import { + propertyCollection, + stateCollection, + linkCollection, + propCollection, + regularCollection, + storagePropCollection, + storageLinkCollection, + provideCollection, + consumeCollection, + objectLinkCollection, + isStaticViewCollection +} from './validate_ui_syntax'; +import { + propAndLinkDecorators, + curPropMap, + observedPropertyDecorators, + createViewCreate, + createCustomComponentNewExpression +} from './process_component_member'; +import { + LogType, + LogInfo, + componentInfo +} from './utils'; + +const localArray: string[] = [...observedPropertyDecorators, COMPONENT_NON_DECORATOR, + COMPONENT_PROP_DECORATOR, COMPONENT_OBJECT_LINK_DECORATOR]; + +const decoractorMap: Map>> = new Map( + [[COMPONENT_STATE_DECORATOR, stateCollection], + [COMPONENT_LINK_DECORATOR, linkCollection], + [COMPONENT_PROP_DECORATOR, propCollection], + [COMPONENT_NON_DECORATOR, regularCollection], + [COMPONENT_PROVIDE_DECORATOR, provideCollection], + [COMPONENT_OBJECT_LINK_DECORATOR, objectLinkCollection]]); + +export function processCustomComponent(node: ts.ExpressionStatement, newStatements: ts.Statement[], + log: LogInfo[]): void { + if (ts.isCallExpression(node.expression)) { + addCustomComponent(node, newStatements, createCustomComponentNewExpression(node.expression), log); + } +} + +function addCustomComponent(node: ts.ExpressionStatement, newStatements: ts.Statement[], + newNode: ts.NewExpression, log: LogInfo[]): void { + if (ts.isNewExpression(newNode)) { + const customComponentName: string = getCustomComponentName(newNode); + const propertyArray: ts.ObjectLiteralElementLike[] = []; + validateCustomComponentPrams(node, customComponentName, propertyArray, log); + addCustomComponentStatements(node, newStatements, newNode, customComponentName, propertyArray); + } +} + +function addCustomComponentStatements(node: ts.ExpressionStatement, newStatements: ts.Statement[], + newNode: ts.NewExpression, name: string, props: ts.ObjectLiteralElementLike[]): void { + const id: string = componentInfo.id.toString(); + newStatements.push(createFindChildById(id), createCustomComponentIfStatement(id, + ts.factory.updateExpressionStatement(node, createViewCreate(newNode)), + ts.factory.createObjectLiteralExpression(props, true), name)); +} + +function validateCustomComponentPrams(node: ts.ExpressionStatement, name: string, + props: ts.ObjectLiteralElementLike[], log: LogInfo[]): void { + const curChildProps: Set = new Set([]); + const nodeExpression: ts.CallExpression = node.expression as ts.CallExpression; + const nodeArguments: ts.NodeArray = nodeExpression.arguments; + const propertySet: Set = getCollectionSet(name, propertyCollection); + const linkSet: Set = getCollectionSet(name, linkCollection); + if (nodeArguments && nodeArguments.length === 1 && + ts.isObjectLiteralExpression(nodeArguments[0])) { + const nodeArgument: ts.ObjectLiteralExpression = nodeArguments[0] as ts.ObjectLiteralExpression; + nodeArgument.properties.forEach(item => { + curChildProps.add(item.name.getText()); + if (isThisProperty(item, propertySet)) { + validateStateManagement(item, name, log); + if (isNonThisProperty(item, linkSet)) { + props.push(item); + } + } else { + validateNonExistentProperty(item, name, log); + } + }); + } + validateMandatoryToInitViaParam(node, name, curChildProps, log); +} + +function getCustomComponentName(newNode: ts.NewExpression): string { + let customComponentName: string; + if (ts.isIdentifier(newNode.expression)) { + customComponentName = newNode.expression.escapedText.toString(); + } else if (ts.isPropertyAccessExpression(newNode.expression)) { + customComponentName = newNode.expression.name.escapedText.toString(); + } + return customComponentName; +} + +function getCollectionSet(name: string, collection: Map>): Set { + return collection.get(name) || new Set([]); +} + +function isThisProperty(node: ts.ObjectLiteralElementLike, propertySet: Set): boolean { + if (ts.isPropertyAssignment(node) && ts.isIdentifier(node.name) && + propertySet.has(node.name.escapedText.toString())) { + return true; + } + return false; +} + +function isNonThisProperty(node: ts.ObjectLiteralElementLike, propertySet: Set): boolean { + if (ts.isPropertyAssignment(node) && ts.isIdentifier(node.name) && + !propertySet.has(node.name.escapedText.toString())) { + return true; + } + return false; +} + +function validateStateManagement(node: ts.ObjectLiteralElementLike, customComponentName: string, + log: LogInfo[]): void { + validateForbiddenToInitViaParam(node, customComponentName, log); + checkFromParentToChild(node, customComponentName, log); +} + +function checkFromParentToChild(node: ts.ObjectLiteralElementLike, customComponentName: string, + log: LogInfo[]): void { + const propertyName: string = node.name.getText(); + const curPropertyKind: string = getPropertyDecoratorKind(propertyName, customComponentName); + if (curPropertyKind) { + if (isInitFromParent(node)) { + const parentPropertyName: string = + getParentPropertyName(node as ts.PropertyAssignment, curPropertyKind, log); + if (!parentPropertyName) { + return; + } + const parentPropertyKind: string = curPropMap.get(parentPropertyName); + if (parentPropertyKind && !isCorrectInitFormParent(parentPropertyKind, curPropertyKind)) { + validateIllegalInitFromParent( + node, propertyName, curPropertyKind, parentPropertyName, parentPropertyKind, log); + } + } else if (isInitFromLocal(node) && ts.isPropertyAssignment(node)) { + if (!localArray.includes(curPropertyKind)) { + validateIllegalInitFromParent(node, propertyName, curPropertyKind, + node.initializer.getText(), COMPONENT_NON_DECORATOR, log); + } + } + } +} + +function isInitFromParent(node: ts.ObjectLiteralElementLike): boolean { + if (ts.isPropertyAssignment(node) && node.initializer) { + if (ts.isPropertyAccessExpression(node.initializer) && node.initializer.expression && + node.initializer.expression.kind === ts.SyntaxKind.ThisKeyword && + ts.isIdentifier(node.initializer.name)) { + return true; + } else if (ts.isIdentifier(node.initializer) && + matchStartWithDollar(node.initializer.getText())) { + return true; + } + } +} + +function isInitFromLocal(node: ts.ObjectLiteralElementLike): boolean { + if (ts.isPropertyAssignment(node) && ts.isIdentifier(node.initializer) && + !matchStartWithDollar(node.initializer.getText())) { + return true; + } +} + +function getParentPropertyName(node: ts.PropertyAssignment, curPropertyKind: string, + log: LogInfo[]): string { + let parentPropertyName: string; + const initExpression: ts.Expression = node.initializer; + if (curPropertyKind === COMPONENT_LINK_DECORATOR) { + if (hasDollar(initExpression)) { + // @ts-ignore + const initName: ts.Identifier = initExpression.name || initExpression; + parentPropertyName = initName.getText().replace(/^\$/, ''); + } else { + validateLinkWithoutDollar(node, log); + } + } else { + if (hasDollar(initExpression)) { + validateNonLinkWithDollar(node, log); + } else { + // @ts-ignore + parentPropertyName = node.initializer.name.getText(); + } + } + return parentPropertyName; +} + +function isCorrectInitFormParent(parent: string, child: string): boolean { + switch (child) { + case COMPONENT_STATE_DECORATOR: + case COMPONENT_PROVIDE_DECORATOR: + if (parent === COMPONENT_NON_DECORATOR) { + return true; + } + break; + case COMPONENT_LINK_DECORATOR: + if ([COMPONENT_STATE_DECORATOR, COMPONENT_LINK_DECORATOR, + COMPONENT_STORAGE_LINK_DECORATOR].includes(parent)) { + return true; + } + break; + case COMPONENT_PROP_DECORATOR: + if ([COMPONENT_STATE_DECORATOR, ...propAndLinkDecorators].includes(parent)) { + return true; + } + break; + case COMPONENT_NON_DECORATOR: + if ([COMPONENT_STATE_DECORATOR, ...propAndLinkDecorators, COMPONENT_NON_DECORATOR, + COMPONENT_OBJECT_LINK_DECORATOR].includes(parent)) { + return true; + } + break; + case COMPONENT_OBJECT_LINK_DECORATOR: + if (parent === COMPONENT_STATE_DECORATOR) { + return true; + } + break; + } + return false; +} + +function getPropertyDecoratorKind(propertyName: string, customComponentName: string): string { + for (const item of decoractorMap.entries()) { + if (getCollectionSet(customComponentName, item[1]).has(propertyName)) { + return item[0]; + } + } +} + +function createFindChildById(id: string): ts.VariableStatement { + return ts.factory.createVariableStatement(undefined, ts.factory.createVariableDeclarationList( + [ts.factory.createVariableDeclaration(ts.factory.createIdentifier( + `${CUSTOM_COMPONENT_EARLIER_CREATE_CHILD}${id}`), undefined, undefined, + ts.factory.createCallExpression(ts.factory.createPropertyAccessExpression(ts.factory.createThis(), + ts.factory.createIdentifier(`${CUSTOM_COMPONENT_FUNCTION_FIND_CHILD_BY_ID}`)), undefined, + [ts.factory.createStringLiteral(id)]))], ts.NodeFlags.Let)); +} + +function createCustomComponentIfStatement(id: string, node: ts.ExpressionStatement, + newObjectLiteralExpression: ts.ObjectLiteralExpression, parentName: string): ts.IfStatement { + const viewName: string = `${CUSTOM_COMPONENT_EARLIER_CREATE_CHILD}${id}`; + return ts.factory.createIfStatement(ts.factory.createBinaryExpression( + ts.factory.createIdentifier(viewName), + ts.factory.createToken(ts.SyntaxKind.EqualsEqualsToken), + ts.factory.createIdentifier(`${COMPONENT_CONSTRUCTOR_UNDEFINED}`)), + ts.factory.createBlock([node], true), + ts.factory.createBlock([ts.factory.createExpressionStatement(ts.factory.createCallExpression( + ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier( + viewName), ts.factory.createIdentifier( + `${COMPONENT_CONSTRUCTOR_UPDATE_PARAMS}`)), undefined, [newObjectLiteralExpression])), + isStaticViewCollection.get(parentName) ? createStaticIf(viewName) : undefined, + ts.factory.createExpressionStatement(ts.factory.createCallExpression( + ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier(`${BASE_COMPONENT_NAME}`), + ts.factory.createIdentifier(`${COMPONENT_CREATE_FUNCTION}`)), undefined, + [ts.factory.createIdentifier(viewName)]))], true)); +} + +function createStaticIf(name: string): ts.IfStatement { + return ts.factory.createIfStatement(ts.factory.createPrefixUnaryExpression( + ts.SyntaxKind.ExclamationToken, ts.factory.createCallExpression( + ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier(name), + ts.factory.createIdentifier(CUSTOM_COMPONENT_NEEDS_UPDATE_FUNCTION)), undefined, [])), + ts.factory.createBlock([ts.factory.createExpressionStatement(ts.factory.createCallExpression( + ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier(name), + ts.factory.createIdentifier(CUSTOM_COMPONENT_MARK_STATIC_FUNCTION)), + undefined, []))], true), undefined); +} + +function hasDollar(initExpression: ts.Expression): boolean { + if (ts.isPropertyAccessExpression(initExpression) && + matchStartWithDollar(initExpression.name.getText())) { + return true; + } else if (ts.isIdentifier(initExpression) && matchStartWithDollar(initExpression.getText())) { + return true; + } else { + return false; + } +} + +function matchStartWithDollar(name: string): boolean { + return /^\$/.test(name); +} + +function validateForbiddenToInitViaParam(node: ts.ObjectLiteralElementLike, + customComponentName: string, log: LogInfo[]): void { + const forbiddenToInitViaParamSet: Set = new Set([ + ...getCollectionSet(customComponentName, storageLinkCollection), + ...getCollectionSet(customComponentName, storagePropCollection), + ...getCollectionSet(customComponentName, consumeCollection)]); + if (isThisProperty(node, forbiddenToInitViaParamSet)) { + log.push({ + type: LogType.ERROR, + message: `Property '${node.name.getText()}' in the custom component '${customComponentName}'` + + ` cannot initialize here (forbidden to specify).`, + pos: node.name.getStart() + }); + } +} + +function validateNonExistentProperty(node: ts.ObjectLiteralElementLike, + customComponentName: string, log: LogInfo[]): void { + log.push({ + type: LogType.ERROR, + message: `Property '${node.name.getText()}' does not exist on type '${customComponentName}'.`, + pos: node.name.getStart() + }); +} + +function validateMandatoryToInitViaParam(node: ts.ExpressionStatement, customComponentName: string, + curChildProps: Set, log: LogInfo[]): void { + const mandatoryToInitViaParamSet: Set = new Set([ + ...getCollectionSet(customComponentName, propCollection), + ...getCollectionSet(customComponentName, linkCollection), + ...getCollectionSet(customComponentName, objectLinkCollection)]); + mandatoryToInitViaParamSet.forEach(item => { + if (!curChildProps.has(item)) { + log.push({ + type: LogType.ERROR, + message: `Property '${item}' in the custom component '${customComponentName}'` + + ` is missing (mandatory to specify).`, + pos: node.getStart() + }); + } + }); +} + +function validateIllegalInitFromParent(node: ts.ObjectLiteralElementLike, propertyName: string, + curPropertyKind: string, parentPropertyName: string, parentPropertyKind: string, + log: LogInfo[]): void { + log.push({ + type: LogType.ERROR, + message: `The ${parentPropertyKind} property '${parentPropertyName}' cannot be assigned to ` + + `the ${curPropertyKind} property '${propertyName}'.`, + // @ts-ignore + pos: node.initializer.getStart() + }); +} + +function validateLinkWithoutDollar(node: ts.PropertyAssignment, log: LogInfo[]): void { + log.push({ + type: LogType.ERROR, + message: `The @Link property '${node.name.getText()}' should initialize` + + ` using '$' to create a reference to a @State or @Link variable.`, + pos: node.initializer.getStart() + }); +} + +function validateNonLinkWithDollar(node: ts.PropertyAssignment, log: LogInfo[]): void { + log.push({ + type: LogType.ERROR, + message: `Property '${node.name.getText()}' cannot initialize` + + ` using '$' to create a reference to a variable.`, + pos: node.initializer.getStart() + }); +} diff --git a/compiler/compiler/src/process_import.ts b/compiler/compiler/src/process_import.ts new file mode 100644 index 000000000..1e8e12a43 --- /dev/null +++ b/compiler/compiler/src/process_import.ts @@ -0,0 +1,278 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + +import ts from 'typescript'; +import fs from 'fs'; +import path from 'path'; + +import { + EXTNAME_ETS, + NODE_MODULES, + INDEX_ETS, + PACKAGE_JSON, + STRUCT, + CLASS, + CUSTOM_COMPONENT_DEFAULT, + CUSTOM_DECORATOR_NAME +} from './pre_define'; +import { + propertyCollection, + linkCollection, + componentCollection, + preprocessExtend, + processSystemApi, + propCollection, + isObservedClass, + isCustomDialogClass, + observedClassCollection, + enumCollection, + getComponentSet, + IComponentSet +} from './validate_ui_syntax'; +import { LogInfo } from './utils'; +import { projectConfig } from '../main'; + +export default function processImport(node: ts.ImportDeclaration | ts.ImportEqualsDeclaration | + ts.ExportDeclaration, pagesDir: string, log: LogInfo[]): void { + let filePath: string; + let defaultName: string; + const asName: Map = new Map(); + if (ts.isImportDeclaration(node) || ts.isExportDeclaration(node)) { + filePath = node.moduleSpecifier.getText().replace(/'|"/g, ''); + if (ts.isImportDeclaration(node) && node.importClause && node.importClause.name && + ts.isIdentifier(node.importClause.name)) { + defaultName = node.importClause.name.escapedText.toString(); + } + if (ts.isImportDeclaration(node) && node.importClause && node.importClause.namedBindings && + ts.isNamedImports(node.importClause.namedBindings) && + node.importClause.namedBindings.elements) { + node.importClause.namedBindings.elements.forEach(item => { + if (item.name && item.propertyName && ts.isIdentifier(item.name) && + ts.isIdentifier(item.propertyName)) { + asName.set(item.propertyName.escapedText.toString(), item.name.escapedText.toString()); + } + }); + } + } else { + if (node.moduleReference && ts.isExternalModuleReference(node.moduleReference) && + node.moduleReference.expression && ts.isStringLiteral(node.moduleReference.expression)) { + filePath = node.moduleReference.expression.text; + defaultName = node.name.escapedText.toString(); + } + } + if (filePath && path.extname(filePath) !== EXTNAME_ETS && !isModule(filePath)) { + filePath += EXTNAME_ETS; + } + try { + let fileResolvePath: string; + if (/^(\.|\.\.)\//.test(filePath)) { + fileResolvePath = path.join(pagesDir, filePath); + } else if (/^\//.test(filePath)) { + fileResolvePath = filePath; + } else { + fileResolvePath = getFileResolvePath(fileResolvePath, pagesDir, filePath, projectConfig.projectPath); + } + if (fs.existsSync(fileResolvePath) && fs.statSync(fileResolvePath).isFile()) { + const content: string = preprocessExtend(processSystemApi( + fs.readFileSync(fileResolvePath, { encoding: 'utf-8' }).replace( + new RegExp('\\b' + STRUCT + '\\b.+\\{', 'g'), item => { + return item.replace(new RegExp('\\b' + STRUCT + '\\b', 'g'), `${CLASS} `); + })), fileResolvePath, log); + const sourceFile: ts.SourceFile = ts.createSourceFile(filePath, content, + ts.ScriptTarget.Latest, true, ts.ScriptKind.TS); + visitAllNode(sourceFile, defaultName, asName, pagesDir, log); + } + } catch (e) { + // ignore + } +} + +function visitAllNode(node: ts.Node, defaultNameFromParent: string, asNameFromParent: Map, + pagesDir: string, log: LogInfo[]) { + if (isObservedClass(node)) { + // @ts-ignore + observedClassCollection.add(node.name.getText()); + } + if (isCustomDialogClass(node)) { + // @ts-ignore + componentCollection.customDialogs.add(node.name.getText()); + } + if (ts.isEnumDeclaration(node) && node.name) { + enumCollection.add(node.name.getText()); + } + if (ts.isClassDeclaration(node) && ts.isIdentifier(node.name) && isCustomComponent(node)) { + addDependencies(node, defaultNameFromParent, asNameFromParent); + if (!defaultNameFromParent && node.modifiers && node.modifiers.length >= 2 && + node.modifiers[0] && node.modifiers[0].kind === ts.SyntaxKind.ExportKeyword && + node.modifiers[1] && node.modifiers[1].kind === ts.SyntaxKind.DefaultKeyword && + hasCollection(node.name)) { + addDefaultExport(node); + } + } + if (ts.isExportAssignment(node) && node.expression && ts.isIdentifier(node.expression) && + hasCollection(node.expression)) { + if (defaultNameFromParent) { + setDependencies(defaultNameFromParent, + linkCollection.get(node.expression.escapedText.toString()), + propertyCollection.get(node.expression.escapedText.toString()), + propCollection.get(node.expression.escapedText.toString())); + } + addDefaultExport(node); + } + if (ts.isExportDeclaration(node) && node.exportClause && + ts.isNamedExports(node.exportClause) && node.exportClause.elements) { + node.exportClause.elements.forEach(item => { + if (item.name && item.propertyName && ts.isIdentifier(item.name) && + ts.isIdentifier(item.propertyName) && hasCollection(item.propertyName)) { + let asExportName: string = item.name.escapedText.toString(); + const asExportPropertyName: string = item.propertyName.escapedText.toString(); + if (asNameFromParent.has(asExportName)) { + asExportName = asNameFromParent.get(asExportName); + } + setDependencies(asExportName, linkCollection.get(asExportPropertyName), + propertyCollection.get(asExportPropertyName), + propCollection.get(asExportPropertyName)); + } + }); + } + if (ts.isExportDeclaration(node) && node.moduleSpecifier && + ts.isStringLiteral(node.moduleSpecifier)) { + processImport(node, pagesDir, log); + } + node.getChildren().forEach((item: ts.Node) => visitAllNode(item, defaultNameFromParent, + asNameFromParent, pagesDir, log)); +} + +function addDependencies(node: ts.ClassDeclaration, defaultNameFromParent: string, + asNameFromParent: Map): void { + const componentName: string = node.name.getText(); + const ComponentSet: IComponentSet = getComponentSet(node); + if (defaultNameFromParent && node.modifiers && node.modifiers.length >= 2 && node.modifiers[0] && + node.modifiers[1] && node.modifiers[0].kind === ts.SyntaxKind.ExportKeyword && + node.modifiers[1].kind === ts.SyntaxKind.DefaultKeyword) { + setDependencies(defaultNameFromParent, ComponentSet.links, ComponentSet.propertys, + ComponentSet.props); + } else if (asNameFromParent.has(componentName)) { + setDependencies(asNameFromParent.get(componentName), ComponentSet.links, ComponentSet.propertys, + ComponentSet.props); + } else { + setDependencies(componentName, ComponentSet.links, ComponentSet.propertys, ComponentSet.props); + } +} + +function addDefaultExport(node: ts.ClassDeclaration | ts.ExportAssignment): void { + let name: string; + if (ts.isClassDeclaration(node) && node.name && ts.isIdentifier(node.name)) { + name = node.name.escapedText.toString(); + } else if (ts.isExportAssignment(node) && node.expression && ts.isIdentifier(node.expression)) { + name = node.expression.escapedText.toString(); + } else { + return; + } + setDependencies(CUSTOM_COMPONENT_DEFAULT, + linkCollection.has(CUSTOM_COMPONENT_DEFAULT) ? + new Set([...linkCollection.get(CUSTOM_COMPONENT_DEFAULT), ...linkCollection.get(name)]) : + linkCollection.get(name), propertyCollection.has(CUSTOM_COMPONENT_DEFAULT) ? + new Set([...propertyCollection.get(CUSTOM_COMPONENT_DEFAULT), ...propertyCollection.get(name)]) : + propertyCollection.get(name), propCollection.has(CUSTOM_COMPONENT_DEFAULT) ? + new Set([...propCollection.get(CUSTOM_COMPONENT_DEFAULT), ...propCollection.get(name)]) : + propCollection.get(name)); +} + +function setDependencies(component: string, linkArray: Set, propertyArray: Set, + propArray: Set): void { + linkCollection.set(component, linkArray); + propertyCollection.set(component, propertyArray); + propCollection.set(component, propArray); + componentCollection.customComponents.add(component); +} + +function hasCollection(node: ts.Identifier): boolean { + return linkCollection.has(node.escapedText.toString()) || + propCollection.has(node.escapedText.toString()) || + propertyCollection.has(node.escapedText.toString()); +} + +function isModule(filePath: string): boolean { + return !/^(\.|\.\.)?\//.test(filePath); +} + +function isCustomComponent(node: ts.ClassDeclaration): boolean { + if (node.decorators && node.decorators.length) { + for (let i = 0; i < node.decorators.length; ++i) { + const decoratorName: ts.Identifier = node.decorators[i].expression as ts.Identifier; + if (ts.isIdentifier(decoratorName) && + CUSTOM_DECORATOR_NAME.has(decoratorName.escapedText.toString())) { + return true; + } + } + } + return false; +} + +function isPackageJsonEntry(filePath: string): boolean { + const packageJsonPath: string = path.join(filePath, PACKAGE_JSON); + if (fs.existsSync(packageJsonPath)) { + let entry: string; + try { + entry = JSON.parse(fs.readFileSync(packageJsonPath).toString()).main; + } catch (e) { + return false; + } + if (typeof entry === 'string' && fs.existsSync(path.join(filePath, entry))) { + return true; + } + } +} + +function getPackageJsonEntry(filePath: string): string { + return path.join(filePath, JSON.parse(fs.readFileSync(path.join(filePath, PACKAGE_JSON)).toString()).main); +} + +function getModuleFilePath(filePath: string): string { + if (filePath && path.extname(filePath) !== EXTNAME_ETS && isModule(filePath)) { + filePath += EXTNAME_ETS; + } + return filePath; +} + +function getFileResolvePath(fileResolvePath: string, pagesDir: string, filePath: string, + projectPath: string): string { + const moduleFilePath: string = getModuleFilePath(filePath); + const defaultModule: string = path.join(projectPath, moduleFilePath); + if (fs.existsSync(defaultModule)) { + return defaultModule; + } + const entryModule: string = path.join(projectPath, '../../../../../', moduleFilePath); + if (fs.existsSync(entryModule)) { + return entryModule; + } + let curPageDir: string = pagesDir; + while (!fs.existsSync(fileResolvePath)) { + fileResolvePath = path.join(curPageDir, NODE_MODULES, filePath); + if (fs.existsSync(fileResolvePath + EXTNAME_ETS)) { + fileResolvePath = fileResolvePath + EXTNAME_ETS; + } else if (isPackageJsonEntry(fileResolvePath)) { + fileResolvePath = getPackageJsonEntry(fileResolvePath); + } else if (fs.existsSync(path.join(fileResolvePath, INDEX_ETS))) { + fileResolvePath = path.join(fileResolvePath, INDEX_ETS); + } + if (curPageDir === path.parse(curPageDir).root) { + break; + } + curPageDir = path.dirname(curPageDir); + } + return fileResolvePath; +} diff --git a/compiler/compiler/src/process_system_module.ts b/compiler/compiler/src/process_system_module.ts new file mode 100644 index 000000000..9ef05d3cc --- /dev/null +++ b/compiler/compiler/src/process_system_module.ts @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + +import { processSystemApi } from './validate_ui_syntax'; + +module.exports = function processSystemModule(source: string): string { + return processSystemApi(source); +}; diff --git a/compiler/compiler/src/process_ui_syntax.ts b/compiler/compiler/src/process_ui_syntax.ts new file mode 100644 index 000000000..d2f0d106d --- /dev/null +++ b/compiler/compiler/src/process_ui_syntax.ts @@ -0,0 +1,410 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + +import ts from 'typescript'; +import path from 'path'; + +import { componentCollection } from './validate_ui_syntax'; +import { processComponentClass } from './process_component_class'; +import processImport from './process_import'; +import { + PAGE_ENTRY_FUNCTION_NAME, + COMPONENT_CONSTRUCTOR_UNDEFINED, + BUILD_ON, + COMPONENT_BUILD_FUNCTION, + COMPONENT_BUILDER_DECORATOR, + COMPONENT_EXTEND_DECORATOR, + RESOURCE, + RESOURCE_TYPE, + WORKER_OBJECT, + RESOURCE_NAME_ID, + RESOURCE_NAME_TYPE, + RESOURCE_NAME_PARAMS, + RESOURCE_RAWFILE +} from './pre_define'; +import { + componentInfo, + LogInfo, + LogType, + hasDecorator, + FileLog +} from './utils'; +import { + getName, + isAttributeNode, + processComponentBlock, + bindComponentAttr, + appComponentCollection +} from './process_component_build'; +import { + BUILDIN_CONTAINER_COMPONENT, + CUSTOM_BUILDER_METHOD, + EXTEND_ATTRIBUTE, + JS_BIND_COMPONENTS +} from './component_map'; +import { resources } from '../main'; + +export const transformLog: FileLog = new FileLog(); + +export function processUISyntax(program: ts.Program, ut = false): Function { + return (context: ts.TransformationContext) => { + let pagesDir: string; + return (node: ts.SourceFile) => { + pagesDir = path.resolve(path.dirname(node.fileName)); + if (process.env.compiler === BUILD_ON) { + if (!ut && (path.basename(node.fileName) === 'app.ets.ts' || !/\.ets\.ts$/.test(node.fileName))) { + node = ts.visitEachChild(node, processResourceNode, context); + return node; + } + collectComponents(node); + transformLog.sourceFile = node; + validateSourceFileNode(node); + node = createEntryNode(node, context); + node = ts.visitEachChild(node, processAllNodes, context); + return node; + } else { + return node; + } + }; + function processAllNodes(node: ts.Node): ts.Node { + if (ts.isImportDeclaration(node) || ts.isImportEqualsDeclaration(node)) { + processImport(node, pagesDir, transformLog.errors); + } else if (ts.isClassDeclaration(node) && node.name && + componentCollection.customComponents.has(node.name.getText())) { + componentCollection.currentClassName = node.name.getText(); + node = processComponentClass(node, context, transformLog.errors, program); + componentCollection.currentClassName = null; + } else if (ts.isFunctionDeclaration(node)) { + if (hasDecorator(node, COMPONENT_EXTEND_DECORATOR)) { + node = processExtend(node, transformLog.errors); + } else if (hasDecorator(node, COMPONENT_BUILDER_DECORATOR) && node.name && node.body && + ts.isBlock(node.body)) { + CUSTOM_BUILDER_METHOD.add(node.name.getText()); + node = ts.factory.updateFunctionDeclaration(node, undefined, node.modifiers, + node.asteriskToken, node.name, node.typeParameters, node.parameters, node.type, + processComponentBlock(node.body, false, transformLog.errors)); + } + } else if (isResource(node)) { + node = processResourceData(node as ts.CallExpression); + } else if (isWorker(node)) { + node = processWorker(node as ts.NewExpression); + } + return ts.visitEachChild(node, processAllNodes, context); + } + function processResourceNode(node: ts.Node): ts.Node { + if (isResource(node)) { + node = processResourceData(node as ts.CallExpression); + } + return ts.visitEachChild(node, processResourceNode, context); + } + function validateSourceFileNode(node: ts.SourceFile): void { + if (program) { + node = ts.visitEachChild(node, validateAllNodes, context); + } + } + function validateAllNodes(node: ts.Node): ts.Node { + if (ts.isMethodDeclaration(node) && node.name && + node.name.getText() === COMPONENT_BUILD_FUNCTION && node.body && ts.isBlock(node.body)) { + const typeChecker: ts.TypeChecker = program.getTypeChecker(); + validateBody(node.body, typeChecker); + return node; + } + return ts.visitEachChild(node, validateAllNodes, context); + } + }; +} + +function collectComponents(node: ts.SourceFile): void { + // @ts-ignore + if (node.identifiers && node.identifiers.size) { + // @ts-ignore + for (let key of node.identifiers.keys()) { + if (JS_BIND_COMPONENTS.has(key)) { + appComponentCollection.add(key); + } + } + } +} + +function isResource(node: ts.Node): boolean { + return ts.isCallExpression(node) && ts.isIdentifier(node.expression) && + (node.expression.escapedText.toString() === RESOURCE || + node.expression.escapedText.toString() === RESOURCE_RAWFILE) && node.arguments.length > 0; +} + +function processResourceData(node: ts.CallExpression): ts.Node { + if (ts.isStringLiteral(node.arguments[0])) { + if (node.expression.getText() === RESOURCE_RAWFILE) { + return createResourceParam(0, RESOURCE_TYPE.rawfile, [node.arguments[0]]); + } else { + // @ts-ignore + const resourceData: string[] = node.arguments[0].text.trim().split('.'); + if (validateResourceData(resourceData, resources, node.arguments[0].getStart())) { + const resourceType: number = RESOURCE_TYPE[resourceData[1]]; + const resourceValue: number = resources[resourceData[0]][resourceData[1]][resourceData[2]]; + return createResourceParam(resourceValue, resourceType, + Array.from(node.arguments).slice(1)); + } + } + } + return node; +} + +function createResourceParam(resourceValue: number, resourceType: number,argsArr: ts.Expression[]): + ts.ObjectLiteralExpression { + const resourceParams: ts.ObjectLiteralExpression = ts.factory.createObjectLiteralExpression( + [ + ts.factory.createPropertyAssignment( + ts.factory.createStringLiteral(RESOURCE_NAME_ID), + ts.factory.createNumericLiteral(resourceValue) + ), + ts.factory.createPropertyAssignment( + ts.factory.createStringLiteral(RESOURCE_NAME_TYPE), + ts.factory.createNumericLiteral(resourceType) + ), + ts.factory.createPropertyAssignment( + ts.factory.createIdentifier(RESOURCE_NAME_PARAMS), + ts.factory.createArrayLiteralExpression( + argsArr, + false + ) + ) + ], + false + ); + return resourceParams; +} + +function validateResourceData(resourceData: string[], resources: object, pos: number): boolean { + if (resourceData.length !== 3) { + transformLog.errors.push({ + type: LogType.ERROR, + message: 'The input parameter is not supported.', + pos: pos + }); + } else if (!resources[resourceData[0]]) { + transformLog.errors.push({ + type: LogType.ERROR, + message: `The value of '${resourceData[0]}' is invalid.`, + pos: pos + }); + } else if (!resources[resourceData[0]][resourceData[1]]) { + transformLog.errors.push({ + type: LogType.ERROR, + message: `Value '${resourceData[1]}' does not exist on type 'typeof ${resourceData[0]}'.`, + pos: pos + }); + } else if (!resources[resourceData[0]][resourceData[1]][resourceData[2]]) { + transformLog.errors.push({ + type: LogType.ERROR, + message: `Value '${resourceData[2]}' does not exist on type 'typeof ${resourceData[1]}'.`, + pos: pos + }); + } else { + return true; + } + return false; +} + +function isWorker(node: ts.Node): boolean { + return ts.isNewExpression(node) && ts.isPropertyAccessExpression(node.expression) && + ts.isIdentifier(node.expression.name) && + node.expression.name.escapedText.toString() === WORKER_OBJECT; +} + +function processWorker(node: ts.NewExpression): ts.Node { + if (node.arguments.length && ts.isStringLiteral(node.arguments[0])) { + const args: ts.Expression[] = Array.from(node.arguments); + // @ts-ignore + const workerPath: string = node.arguments[0].text; + const stringNode: ts.StringLiteral = ts.factory.createStringLiteral( + workerPath.replace(/\.ts$/, '.js')); + args.splice(0, 1, stringNode); + return ts.factory.updateNewExpression(node, node.expression, node.typeArguments, args); + } + return node; +} + +function processExtend(node: ts.FunctionDeclaration, log: LogInfo[]): ts.FunctionDeclaration { + const componentName: string = isExtendFunction(node); + if (componentName) { + const statementArray: ts.Statement[] = []; + bindComponentAttr(node.body.statements[0] as ts.ExpressionStatement, + ts.factory.createIdentifier(componentName), statementArray, log); + return ts.factory.updateFunctionDeclaration(node, undefined, node.modifiers, node.asteriskToken, + node.name, node.typeParameters, node.parameters, node.type, + ts.factory.updateBlock(node.body, statementArray)); + } +} + +function isExtendFunction(node: ts.FunctionDeclaration): string { + if (ts.isBlock(node.body) && node.body.statements && node.body.statements.length === 1 && + ts.isExpressionStatement(node.body.statements[0]) && + // @ts-ignore + ts.isCallExpression(node.body.statements[0].expression) && ts.isIdentifier(node.name)) { + const nameArray: string[] = node.name.getText().split('__'); + if (nameArray.length === 3 && !nameArray[0] && EXTEND_ATTRIBUTE.has(nameArray[1])) { + const attributeArray: string[] = + [...EXTEND_ATTRIBUTE.get(nameArray[1])].map(item => item.attribute); + if (attributeArray.includes(nameArray[2])) { + return nameArray[1]; + } + } + } +} + +function createEntryNode(node: ts.SourceFile, context: ts.TransformationContext): ts.SourceFile { + if (componentCollection.entryComponent && !componentCollection.previewComponent) { + const entryNode: ts.ExpressionStatement = + createEntryFunction(componentCollection.entryComponent, context); + return context.factory.updateSourceFile(node, [...node.statements, entryNode]); + } else if (componentCollection.entryComponent && componentCollection.previewComponent) { + const entryNode: ts.ExpressionStatement = + createEntryFunction(componentCollection.previewComponent, context); + return context.factory.updateSourceFile(node, [...node.statements, entryNode]); + } else { + return node; + } +} + +function validateBody(node: ts.Block, typeChecker: ts.TypeChecker): void { + if (node.statements.length) { + node.statements.forEach((item, index, arr) => { + if (ts.isBlock(item)) { + validateBody(item, typeChecker); + } + if (index + 2 < arr.length && ts.isExpressionStatement(item) && + isAttributeBlockNode(item, arr as ts.Statement[], index) && + ts.isCallExpression(item.expression) && ts.isIdentifier(item.expression.expression)) { + const componentName: string = item.expression.expression.getText(); + const type: ts.Type = typeChecker.getTypeAtLocation(item.expression); + let temp: any = arr[index + 2]; + let name: string; + while (temp) { + if (ts.isCallExpression(temp)) { + if (ts.isPropertyAccessExpression(temp.expression)) { + const pos: number = temp.expression.name.getStart(); + name = temp.expression.name.getText(); + validateSymbol(isPropertyExist(typeChecker, pos, type, name, componentName), + temp.arguments, pos, typeChecker); + } else if (ts.isIdentifier(temp.expression)) { + const pos: number = temp.expression.getStart(); + name = temp.expression.getText(); + validateSymbol(isPropertyExist(typeChecker, pos, type, name, componentName), + temp.arguments, pos, typeChecker); + break; + } + } + temp = temp.expression; + } + } + }); + } +} + +function validateSymbol(type: ts.Symbol, args: ts.NodeArray, + argPos: number, typeChecker: ts.TypeChecker): void { + // @ts-ignore + if (type && type.valueDeclaration.parameters) { + // @ts-ignore + const parameters: ts.ParameterDeclaration[] = type.valueDeclaration.parameters; + const maxLength: number = parameters.length; + const minLength: number = getMinLength(parameters); + if (args.length < minLength || args.length > maxLength) { + let message:string; + if (maxLength !== minLength) { + message = `TS2554: Expected ${minLength}-${maxLength} arguments, but got ${args.length}.`; + } else { + message = `TS2554: Expected ${maxLength} arguments, but got ${args.length}.`; + } + transformLog.errors.push({ + type: LogType.ERROR, + message: message, + pos: argPos + }); + } else { + for (let i = 0; i < parameters.length; i++) { + validatePropertyType(parameters[i], args[i], typeChecker); + } + } + } +} + +function getMinLength(parameters: ts.ParameterDeclaration[]): number { + let length: number = parameters.length; + parameters.forEach((item: ts.ParameterDeclaration) => { + if (item.questionToken !== undefined) { + length--; + } + }); + return length; +} + +function isPropertyExist(typeChecker: ts.TypeChecker, pos: number, type: ts.Type, + propertyName: string, componentName: string): ts.Symbol { + const symbol: ts.Symbol = typeChecker.getPropertyOfType(type, propertyName); + if (symbol) { + return symbol; + } else { + transformLog.errors.push({ + type: LogType.ERROR, + message: `TS2339: Property '${propertyName}' does not exist on type '${componentName}'.`, + pos: pos + }); + } + return null; +} + +function validatePropertyType(param: ts.ParameterDeclaration, arg: ts.Expression, + typeChecker: ts.TypeChecker): void { + const argLocalType: ts.Type = typeChecker.getTypeAtLocation(arg); + const paramLocalType: ts.Type = typeChecker.getTypeAtLocation(param.type); + const argType: ts.Type = typeChecker.getBaseTypeOfLiteralType(typeChecker.getTypeAtLocation(arg)); + // @ts-ignore + const intrinsicName: string = argType.intrinsicName; + const argTypeName: string = intrinsicName || typeChecker.typeToString(argLocalType); + // @ts-ignore + if (!typeChecker.isTypeAssignableTo(argLocalType, paramLocalType)) { + generateArgumentLog(arg, argTypeName, typeChecker.typeToString(paramLocalType)); + } +} + +function generateArgumentLog(arg: ts.Expression, argTypeName: string, paramTypeName: string): void { + transformLog.errors.push({ + type: LogType.ERROR, + message: `TS2345: Argument of type '${argTypeName}' is not assignable to parameter of type '${paramTypeName}'.`, + pos: arg.getStart() + }); +} + +function isAttributeBlockNode(node: ts.ExpressionStatement, arr: ts.Statement[], index: number): boolean { + const attributeNode: ts.Node = arr[index + 2]; + return BUILDIN_CONTAINER_COMPONENT.has(getName(node)) && ts.isBlock(arr[index + 1]) + && ts.isExpressionStatement(attributeNode) && isAttributeNode(attributeNode); +} + +function createEntryFunction(name: string, context: ts.TransformationContext) + : ts.ExpressionStatement { + return context.factory.createExpressionStatement(context.factory.createCallExpression( + context.factory.createIdentifier(PAGE_ENTRY_FUNCTION_NAME), undefined, + [context.factory.createNewExpression(context.factory.createIdentifier(name), undefined, + [context.factory.createStringLiteral((++componentInfo.id).toString()), + context.factory.createIdentifier(COMPONENT_CONSTRUCTOR_UNDEFINED), + context.factory.createObjectLiteralExpression([], false)])])); +} + +export function resetLog(): void { + transformLog.errors = []; +} diff --git a/compiler/compiler/src/result_process.ts b/compiler/compiler/src/result_process.ts new file mode 100644 index 000000000..1087b8879 --- /dev/null +++ b/compiler/compiler/src/result_process.ts @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + +import ts from 'typescript'; +import path from 'path'; + +import { BUILD_OFF } from './pre_define'; +import { + resetLog, + transformLog +} from './process_ui_syntax'; +import { + propertyCollection, + linkCollection +} from './validate_ui_syntax'; +import { + LogInfo, + emitLogInfo, + componentInfo +} from './utils'; +import { resetComponentCollection } from './validate_ui_syntax'; +import { abilityConfig } from '../main'; + +module.exports = function resultProcess(source: string, map: any): void { + process.env.compiler = BUILD_OFF; + if (/\.ets$/.test(this.resourcePath)) { + componentInfo.id = 0; + propertyCollection.clear(); + linkCollection.clear(); + resetComponentCollection(); + if (transformLog && transformLog.errors.length) { + const sourceFile: ts.SourceFile = transformLog.sourceFile; + const logInfos: LogInfo[] = transformLog.errors.map((item) => { + if (item.pos) { + const posOfNode: ts.LineAndCharacter = sourceFile.getLineAndCharacterOfPosition(item.pos); + item.line = posOfNode.line + 1; + item.column = posOfNode.character + 1; + } else { + item.line = undefined; + item.column = undefined; + } + item.fileName = sourceFile.fileName.replace(/.ts$/, ''); + return item; + }); + emitLogInfo(this, logInfos); + resetLog(); + } + } + const resourcePath: string = path.basename(this.resourcePath); + if (['app.ets', abilityConfig.abilityEntryFile].includes(resourcePath)) { + source = source.replace(/exports\.default/, 'globalThis.exports.default'); + } + + this.callback(null, source, map); +}; diff --git a/compiler/compiler/src/utils.ts b/compiler/compiler/src/utils.ts new file mode 100644 index 000000000..943c1aa7f --- /dev/null +++ b/compiler/compiler/src/utils.ts @@ -0,0 +1,158 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + +import ts from 'typescript'; +import path from 'path'; +import fs from 'fs'; + +export enum LogType { + ERROR = 'ERROR', + WARN = 'WARN', + NOTE = 'NOTE' +} + +export interface LogInfo { + type: LogType, + message: string, + pos?: number, + line?: number, + column?: number, + fileName?: string +} + +export class FileLog { + private _sourceFile: ts.SourceFile; + private _errors: LogInfo[] = []; + + public get sourceFile() { + return this._sourceFile; + } + + public set sourceFile(newValue: ts.SourceFile) { + this._sourceFile = newValue; + } + + public get errors() { + return this._errors; + } + + public set errors(newValue: LogInfo[]) { + this._errors = newValue; + } +} + +export function emitLogInfo(loader: any, infos: LogInfo[]) { + if (infos && infos.length) { + infos.forEach((item) => { + switch (item.type) { + case LogType.ERROR: + loader.emitError(getMessage(loader.resourcePath, item)); + break; + case LogType.WARN: + loader.emitWarning(getMessage(loader.resourcePath, item)); + break; + case LogType.NOTE: + loader.emitWarning(getMessage(loader.resourcePath, item)); + break; + } + }); + } +} + +export function addLog(type: LogType, message: string, pos: number, log: LogInfo[], + sourceFile: ts.SourceFile) { + const posOfNode: ts.LineAndCharacter = sourceFile.getLineAndCharacterOfPosition(pos); + log.push({ + type: type, + message: message, + line: posOfNode.line + 1, + column: posOfNode.character + 1, + fileName: sourceFile.fileName + }); +} + +export function getMessage(fileName: string, info: LogInfo): string { + let messsage: string; + if (info.line && info.column) { + messsage = `BUILD${info.type} File: ${fileName}:${info.line}:${info.column}\n ${info.message}`; + } else { + messsage = `BUILD${info.type} File: ${fileName}\n ${info.message}`; + } + return messsage; +} + +class ComponentInfo { + private _id: number = 0; + private _componentNames: Set = new Set(['ForEach']); + public set id(id: number) { + this._id = id; + } + public get id() { + return this._id; + } + public set componentNames(componentNames: Set) { + this._componentNames = componentNames; + } + public get componentNames() { + return this._componentNames; + } +} + +export const componentInfo: ComponentInfo = new ComponentInfo(); + +export function hasDecorator(node: ts.MethodDeclaration | ts.FunctionDeclaration | ts.ClassDeclaration, + decortorName: string): boolean { + if (node.decorators && node.decorators.length) { + for (let i = 0; i < node.decorators.length; i++) { + if (node.decorators[i].getText() === decortorName) { + return true; + } + } + } + return false; +} + +const STATEMENT_EXPECT: number = 1128; +const SEMICOLON_EXPECT: number = 1005; +export const IGNORE_ERROR_CODE: number[] = [STATEMENT_EXPECT, SEMICOLON_EXPECT]; + +export function readFile(dir: string, utFiles: string[]) { + try { + const files: string[] = fs.readdirSync(dir); + files.forEach((element) => { + const filePath: string = path.join(dir, element); + const status: fs.Stats = fs.statSync(filePath); + if (status.isDirectory()) { + readFile(filePath, utFiles); + } else { + utFiles.push(filePath); + } + }); + } catch (e) { + console.error('ETS ERROR: ' + e); + } +} + +export function createFunction(node: ts.Identifier, attrNode: ts.Identifier, + argumentsArr: ts.NodeArray): ts.CallExpression { + return ts.factory.createCallExpression( + ts.factory.createPropertyAccessExpression( + node, + attrNode + ), + undefined, + argumentsArr && argumentsArr.length ? argumentsArr : [] + ); +} diff --git a/compiler/compiler/src/validate_ui_syntax.ts b/compiler/compiler/src/validate_ui_syntax.ts new file mode 100644 index 000000000..bb78f691d --- /dev/null +++ b/compiler/compiler/src/validate_ui_syntax.ts @@ -0,0 +1,802 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + +import ts from 'typescript'; +import path from 'path'; + +import { + INNER_COMPONENT_DECORATORS, + COMPONENT_DECORATOR_ENTRY, + COMPONENT_DECORATOR_PREVIEW, + COMPONENT_DECORATOR_COMPONENT, + COMPONENT_DECORATOR_CUSTOM_DIALOG, + STRUCT, + CLASS, + NATIVE_MODULE, + SYSTEM_PLUGIN, + OHOS_PLUGIN, + INNER_COMPONENT_MEMBER_DECORATORS, + COMPONENT_FOREACH, + COMPONENT_LAZYFOREACH, + COMPONENT_STATE_DECORATOR, + COMPONENT_LINK_DECORATOR, + COMPONENT_PROP_DECORATOR, + COMPONENT_STORAGE_PROP_DECORATOR, + COMPONENT_STORAGE_LINK_DECORATOR, + COMPONENT_PROVIDE_DECORATOR, + COMPONENT_CONSUME_DECORATOR, + COMPONENT_OBJECT_LINK_DECORATOR, + COMPONENT_CONSTRUCTOR_ID, + COMPONENT_CONSTRUCTOR_PARENT, + COMPONENT_CONSTRUCTOR_PARAMS, + COMPONENT_EXTEND_DECORATOR, + COMPONENT_OBSERVED_DECORATOR +} from './pre_define'; +import { + INNER_COMPONENT_NAMES, + AUTOMIC_COMPONENT, + SINGLE_CHILD_COMPONENT, + SPECIFIC_CHILD_COMPONENT, + BUILDIN_STYLE_NAMES, + EXTEND_ATTRIBUTE +} from './component_map'; +import { + LogType, + LogInfo, + componentInfo, + addLog, + hasDecorator +} from './utils'; +const parser = require('../syntax_parser/dist/syntax_parser.js'); + +export interface ComponentCollection { + entryComponent: string; + previewComponent: string; + customDialogs: Set; + customComponents: Set; + currentClassName: string; +} + +export interface IComponentSet { + propertys: Set; + regulars: Set; + states: Set; + links: Set; + props: Set; + storageProps: Set; + storageLinks: Set; + provides: Set; + consumes: Set; + objectLinks: Set; +} + +export const componentCollection: ComponentCollection = { + entryComponent: null, + previewComponent: null, + customDialogs: new Set([]), + customComponents: new Set([]), + currentClassName: null +}; + +export const observedClassCollection: Set = new Set(); +export const enumCollection: Set = new Set(); +export const classMethodCollection: Map> = new Map(); +export const dollarCollection: Set = new Set(); + +export const propertyCollection: Map> = new Map(); +export const stateCollection: Map> = new Map(); +export const linkCollection: Map> = new Map(); +export const propCollection: Map> = new Map(); +export const regularCollection: Map> = new Map(); +export const storagePropCollection: Map> = new Map(); +export const storageLinkCollection: Map> = new Map(); +export const provideCollection: Map> = new Map(); +export const consumeCollection: Map> = new Map(); +export const objectLinkCollection: Map> = new Map(); + +export const isStaticViewCollection: Map = new Map(); + +export const moduleCollection: Set = new Set(); + +export function validateUISyntax(source: string, content: string, filePath: string, + fileQuery: string): LogInfo[] { + let log: LogInfo[] = []; + if (path.basename(filePath) !== 'app.ets') { + const res: LogInfo[] = checkComponentDecorator(source, filePath, fileQuery); + if (res) { + log = log.concat(res); + } + const allComponentNames: Set = + new Set([...INNER_COMPONENT_NAMES, ...componentCollection.customComponents]); + checkUISyntax(filePath, allComponentNames, content, log); + componentCollection.customComponents.forEach(item => componentInfo.componentNames.add(item)); + } + + return log; +} + +function checkComponentDecorator(source: string, filePath: string, + fileQuery: string): LogInfo[] | null { + const log: LogInfo[] = []; + const sourceFile: ts.SourceFile = ts.createSourceFile(filePath, source, + ts.ScriptTarget.Latest, true, ts.ScriptKind.TS); + if (sourceFile && sourceFile.statements && sourceFile.statements.length) { + const result: DecoratorResult = { + entryCount: 0, + previewCount: 0 + }; + sourceFile.statements.forEach((item, index, arr) => { + if (isObservedClass(item)) { + // @ts-ignore + observedClassCollection.add(item.name.getText()); + } + if (ts.isEnumDeclaration(item) && item.name) { + enumCollection.add(item.name.getText()); + } + if (isStruct(item)) { + if (index + 1 < arr.length && ts.isExpressionStatement(arr[index + 1]) && + // @ts-ignore + arr[index + 1].expression && ts.isIdentifier(arr[index + 1].expression)) { + if (ts.isExportAssignment(item) && hasComponentDecorator(item)) { + checkDecorators(item, result, arr[index + 1] as ts.ExpressionStatement, log, sourceFile); + } else if (index > 0 && hasComponentDecorator(arr[index - 1])) { + checkDecorators(arr[index - 1] as ts.MissingDeclaration, result, + arr[index + 1] as ts.ExpressionStatement, log, sourceFile); + } else { + // @ts-ignore + const pos: number = item.expression.getStart(); + const message: string = `A struct should use decorator '@Component'.`; + addLog(LogType.WARN, message, pos, log, sourceFile); + } + } else { + // @ts-ignore + const pos: number = item.expression.getStart(); + const message: string = `A struct must have a name.`; + addLog(LogType.ERROR, message, pos, log, sourceFile); + } + } + if (ts.isMissingDeclaration(item)) { + const decorators: ts.NodeArray = item.decorators; + for (let i = 0; i < decorators.length; i++) { + if (decorators[i] && /struct/.test(item.getText())) { + const message: string = `Please use a valid decorator.`; + addLog(LogType.ERROR, message, item.getStart(), log, sourceFile); + break; + } + } + } + }); + validateEntryCount(result, fileQuery, sourceFile.fileName, log); + } + + return log.length ? log : null; +} + +function validateEntryCount(result: DecoratorResult, fileQuery: string, + fileName: string, log: LogInfo[]): void { + if (result.entryCount !== 1 && fileQuery === '?entry') { + log.push({ + type: LogType.ERROR, + message: `A page configured in 'config.json' must have one and only one '@Entry' ` + + `decorator with a struct.`, + fileName: fileName + }); + } +} + +export function isObservedClass(node: ts.Node): boolean { + if (ts.isClassDeclaration(node) && hasDecorator(node, COMPONENT_OBSERVED_DECORATOR)) { + return true; + } + return false; +} + +export function isCustomDialogClass(node: ts.Node): boolean { + if (ts.isClassDeclaration(node) && hasDecorator(node, COMPONENT_DECORATOR_CUSTOM_DIALOG)) { + return true; + } + return false; +} + +function isStruct(node: ts.Node): boolean { + if ((ts.isExpressionStatement(node) || ts.isExportAssignment(node)) && + node.expression && ts.isIdentifier(node.expression) && node.expression.getText() === STRUCT) { + return true; + } + return false; +} + +function hasComponentDecorator(node: ts.Node): boolean { + if ((ts.isMissingDeclaration(node) || ts.isExportAssignment(node)) && + node.decorators && node.decorators.length) { + return true; + } + return false; +} + +interface DecoratorResult { + entryCount: number; + previewCount: number; +} + +function checkDecorators(node: ts.MissingDeclaration | ts.ExportAssignment, result: DecoratorResult, + component: ts.ExpressionStatement, log: LogInfo[], sourceFile: ts.SourceFile): void { + let hasComponentDecorator: boolean = false; + const componentName: string = component.getText(); + node.decorators.forEach((element) => { + const name: string = element.getText(); + if (INNER_COMPONENT_DECORATORS.has(name)) { + componentCollection.customComponents.add(componentName); + switch (name) { + case COMPONENT_DECORATOR_ENTRY: + result.entryCount++; + componentCollection.entryComponent = componentName; + break; + case COMPONENT_DECORATOR_PREVIEW: + result.previewCount++; + componentCollection.previewComponent = componentName; + break; + case COMPONENT_DECORATOR_COMPONENT: + hasComponentDecorator = true; + break; + case COMPONENT_DECORATOR_CUSTOM_DIALOG: + componentCollection.customDialogs.add(componentName); + hasComponentDecorator = true; + break; + } + } else { + const pos: number = element.expression ? element.expression.pos : element.pos; + const message: string = `The struct '${componentName}' use invalid decorator.`; + addLog(LogType.WARN, message, pos, log, sourceFile); + } + }); + if (!hasComponentDecorator) { + const message: string = `The struct '${componentName}' should use decorator '@Component'.`; + addLog(LogType.WARN, message, component.pos, log, sourceFile); + } + if (BUILDIN_STYLE_NAMES.has(componentName)) { + const message: string = `The struct '${componentName}' cannot have the same name ` + + `as the built-in attribute '${componentName}'.`; + addLog(LogType.ERROR, message, component.pos, log, sourceFile); + } + if (INNER_COMPONENT_NAMES.has(componentName)) { + const message: string = `The struct '${componentName}' cannot have the same name ` + + `as the built-in component '${componentName}'.`; + addLog(LogType.ERROR, message, component.pos, log, sourceFile); + } +} + +function checkUISyntax(filePath: string, allComponentNames: Set, content: string, + log: LogInfo[]): void { + const sourceFile: ts.SourceFile = ts.createSourceFile(filePath, content, + ts.ScriptTarget.Latest, true, ts.ScriptKind.TS); + visitAllNode(sourceFile, sourceFile, allComponentNames, log); +} + +function visitAllNode(node: ts.Node, sourceFileNode: ts.SourceFile, allComponentNames: Set, + log: LogInfo[]) { + checkAllNode(node, allComponentNames, sourceFileNode, log); + if (ts.isClassDeclaration(node) && node.name && ts.isIdentifier(node.name)) { + collectComponentProps(node); + } + node.getChildren().forEach((item: ts.Node) => visitAllNode(item, sourceFileNode, allComponentNames, log)); +} + +function checkAllNode(node: ts.Node, allComponentNames: Set, sourceFileNode: ts.SourceFile, + log: LogInfo[]): void { + if (ts.isExpressionStatement(node) && node.expression && ts.isIdentifier(node.expression) && + allComponentNames.has(node.expression.escapedText.toString())) { + const pos: number = node.expression.getStart(); + const message: string = + `The component name must be followed by parentheses, like '${node.expression.getText()}()'.`; + addLog(LogType.ERROR, message, pos, log, sourceFileNode); + } + checkNoChildComponent(node, sourceFileNode, log); + checkOneChildComponent(node, allComponentNames, sourceFileNode, log); + checkSpecificChildComponent(node, allComponentNames, sourceFileNode, log); +} + +function checkNoChildComponent(node: ts.Node, sourceFileNode: ts.SourceFile, log: LogInfo[]): void { + if (ts.isExpressionStatement(node) && ts.isCallExpression(node.expression) && + ts.isIdentifier(node.expression.expression) && hasChild(node)) { + const componentName: string = node.expression.expression.escapedText.toString(); + const pos: number = node.expression.expression.getStart(); + const message: string = `The component '${componentName}' can't have any child.`; + addLog(LogType.ERROR, message, pos, log, sourceFileNode); + } +} + +function hasChild(node: ts.ExpressionStatement): boolean { + const callExpression: ts.CallExpression = node.expression as ts.CallExpression; + const nodeName: ts.Identifier = callExpression.expression as ts.Identifier; + if (AUTOMIC_COMPONENT.has(nodeName.escapedText.toString()) && getNextNode(node)) { + return true; + } + return false; +} + +function getNextNode(node: ts.Node): ts.Block { + if (node.parent && ts.isBlock(node.parent) && node.parent.statements) { + const statementsArray: ts.Node[] = Array.from(node.parent.statements); + for (let i = 0; i < statementsArray.length - 1; i++) { + const curNode: ts.Node = statementsArray[i]; + const nextNode: ts.Node = statementsArray[i + 1]; + if (node === curNode && ts.isBlock(nextNode)) { + return nextNode; + } + } + } +} + +function checkOneChildComponent(node: ts.Node, allComponentNames: Set, + sourceFileNode: ts.SourceFile, log: LogInfo[]): void { + if (ts.isExpressionStatement(node) && ts.isCallExpression(node.expression) && + ts.isIdentifier(node.expression.expression) && hasNonSingleChild(node, allComponentNames)) { + const componentName: string = node.expression.expression.escapedText.toString(); + const pos: number = node.expression.expression.getStart(); + const message: string = + `The component '${componentName}' can only have a single child component.`; + addLog(LogType.ERROR, message, pos, log, sourceFileNode); + } +} + +function hasNonSingleChild(node: ts.ExpressionStatement, allComponentNames: Set): boolean { + const callExpression: ts.CallExpression = node.expression as ts.CallExpression; + const nodeName: ts.Identifier = callExpression.expression as ts.Identifier; + const nextBlockNode: ts.Block = getNextNode(node); + if (SINGLE_CHILD_COMPONENT.has(nodeName.escapedText.toString())) { + if (!nextBlockNode) { + return false; + } + if (nextBlockNode && nextBlockNode.statements) { + const length: number = nextBlockNode.statements.length; + if (!length) { + return false; + } + if (length > 3) { + return true; + } + const childCount: number = getBlockChildrenCount(nextBlockNode, allComponentNames); + if (childCount > 1) { + return true; + } + } + } + return false; +} + +function getBlockChildrenCount(blockNode: ts.Block, allComponentNames: Set): number { + let maxCount: number = 0; + const length: number = blockNode.statements.length; + for (let i = 0; i < length; ++i) { + const item: ts.Node = blockNode.statements[i]; + if (ts.isExpressionStatement(item) && ts.isCallExpression(item.expression) && + isForEachComponent(item.expression)) { + maxCount += 2; + } + if (ts.isIfStatement(item)) { + maxCount += getIfChildrenCount(item, allComponentNames); + } + if (ts.isBlock(item)) { + maxCount += getBlockChildrenCount(item, allComponentNames); + } + if (ts.isExpressionStatement(item) && ts.isCallExpression(item.expression)) { + let newNode: any = item.expression; + while (newNode.expression) { + if (ts.isCallExpression(newNode) && ts.isIdentifier(newNode.expression) && + !isForEachComponent(newNode) && isComponent(newNode, allComponentNames)) { + maxCount += 1; + if (i + 1 < length && ts.isBlock(blockNode.statements[i + 1])) { + ++i; + } + } + newNode = newNode.expression; + } + } + if (maxCount > 1) { + break; + } + } + return maxCount; +} + +function isComponent(node: ts.CallExpression, allComponentNames: Set): boolean { + if (ts.isIdentifier(node.expression) && + allComponentNames.has(node.expression.escapedText.toString())) { + return true; + } + return false; +} + +function isForEachComponent(node: ts.CallExpression): boolean { + if (ts.isIdentifier(node.expression)) { + const componentName: string = node.expression.escapedText.toString(); + return componentName === COMPONENT_FOREACH || componentName === COMPONENT_LAZYFOREACH; + } + return false; +} + +function getIfChildrenCount(ifNode: ts.IfStatement, allComponentNames: Set): number { + const maxCount: number = + Math.max(getStatementCount(ifNode.thenStatement, allComponentNames), + getStatementCount(ifNode.elseStatement, allComponentNames)); + return maxCount; +} + +function getStatementCount(node: ts.Node, allComponentNames: Set): number { + let maxCount: number = 0; + if (!node) { + return maxCount; + } else if (ts.isBlock(node)) { + maxCount = getBlockChildrenCount(node, allComponentNames); + } else if (ts.isIfStatement(node)) { + maxCount = getIfChildrenCount(node, allComponentNames); + } else if (ts.isExpressionStatement(node) && ts.isCallExpression(node.expression) && + isForEachComponent(node.expression)) { + maxCount = 2; + } else if (ts.isExpressionStatement(node) && ts.isCallExpression(node.expression) && + !isForEachComponent(node.expression) && isComponent(node.expression, allComponentNames)) { + maxCount = 1; + } + return maxCount; +} + +function checkSpecificChildComponent(node: ts.Node, allComponentNames: Set, + sourceFileNode: ts.SourceFile, log: LogInfo[]): void { + if (ts.isExpressionStatement(node) && ts.isCallExpression(node.expression) && + ts.isIdentifier(node.expression.expression) && hasNonspecificChild(node, allComponentNames)) { + const componentName: string = node.expression.expression.escapedText.toString(); + const pos: number = node.expression.expression.getStart(); + const specificChildArray: string = + Array.from(SPECIFIC_CHILD_COMPONENT.get(componentName)).join(' and '); + const message: string = + `The component '${componentName}' can only have the child component ${specificChildArray}.`; + addLog(LogType.ERROR, message, pos, log, sourceFileNode); + } +} + +function hasNonspecificChild(node: ts.ExpressionStatement, + allComponentNames: Set): boolean { + const callExpression: ts.CallExpression = node.expression as ts.CallExpression; + const nodeName: ts.Identifier = callExpression.expression as ts.Identifier; + const nodeNameString: string = nodeName.escapedText.toString(); + const blockNode: ts.Block = getNextNode(node); + let isNonspecific: boolean = false; + if (SPECIFIC_CHILD_COMPONENT.has(nodeNameString) && blockNode) { + const specificChildSet: Set = SPECIFIC_CHILD_COMPONENT.get(nodeNameString); + isNonspecific = isNonspecificChildBlock(blockNode, specificChildSet, allComponentNames); + if (isNonspecific) { + return isNonspecific; + } + } + return isNonspecific; +} + +function isNonspecificChildBlock(blockNode: ts.Block, specificChildSet: Set, + allComponentNames: Set): boolean { + if (blockNode.statements) { + const length: number = blockNode.statements.length; + for (let i = 0; i < length; ++i) { + const item: ts.Node = blockNode.statements[i]; + if (ts.isIfStatement(item) && isNonspecificChildIf(item, specificChildSet, allComponentNames)) { + return true; + } + if (ts.isExpressionStatement(item) && ts.isCallExpression(item.expression) && + isForEachComponent(item.expression) && + isNonspecificChildForEach(item.expression, specificChildSet, allComponentNames)) { + return true; + } + if (ts.isBlock(item) && isNonspecificChildBlock(item, specificChildSet, allComponentNames)) { + return true; + } + if (ts.isExpressionStatement(item) && ts.isCallExpression(item.expression)) { + let newNode: any = item.expression; + while (newNode.expression) { + if (ts.isCallExpression(newNode) && ts.isIdentifier(newNode.expression) && + !isForEachComponent(newNode) && isComponent(newNode, allComponentNames)) { + const isNonspecific: boolean = + isNonspecificChildNonForEach(item.expression, specificChildSet); + if (isNonspecific) { + return isNonspecific; + } + if (i + 1 < length && ts.isBlock(blockNode.statements[i + 1])) { + ++i; + } + } + newNode = newNode.expression; + } + } + } + } + return false; +} + +function isNonspecificChildIf(node: ts.IfStatement, specificChildSet: Set, + allComponentNames: Set): boolean { + return isNonspecificChildIfStatement(node.thenStatement, specificChildSet, allComponentNames) || + isNonspecificChildIfStatement(node.elseStatement, specificChildSet, allComponentNames); +} + +function isNonspecificChildForEach(node: ts.CallExpression, specificChildSet: Set, + allComponentNames: Set): boolean { + if (ts.isCallExpression(node) && node.arguments && + node.arguments.length > 1 && ts.isArrowFunction(node.arguments[1])) { + const arrowFunction: ts.ArrowFunction = node.arguments[1] as ts.ArrowFunction; + const body: ts.Block | ts.CallExpression | ts.IfStatement = + arrowFunction.body as ts.Block | ts.CallExpression | ts.IfStatement; + if (!body) { + return false; + } + if (ts.isBlock(body) && isNonspecificChildBlock(body, specificChildSet, allComponentNames)) { + return true; + } + if (ts.isIfStatement(body) && isNonspecificChildIf(body, specificChildSet, allComponentNames)) { + return true; + } + if (ts.isCallExpression(body) && isForEachComponent(body) && + isNonspecificChildForEach(body, specificChildSet, allComponentNames)) { + return true; + } + if (ts.isCallExpression(body) && !isForEachComponent(body) && + isComponent(body, allComponentNames) && + isNonspecificChildNonForEach(body, specificChildSet)) { + return true; + } + } + return false; +} + +function isNonspecificChildNonForEach(node: ts.CallExpression, + specificChildSet: Set): boolean { + if (ts.isIdentifier(node.expression) && + !specificChildSet.has(node.expression.escapedText.toString())) { + return true; + } + return false; +} + +function isNonspecificChildIfStatement(node: ts.Node, specificChildSet: Set, + allComponentNames: Set): boolean { + if (!node) { + return false; + } + if (ts.isBlock(node) && isNonspecificChildBlock(node, specificChildSet, allComponentNames)) { + return true; + } + if (ts.isIfStatement(node) && isNonspecificChildIf(node, specificChildSet, allComponentNames)) { + return true; + } + if (ts.isExpressionStatement(node) && ts.isCallExpression(node.expression) && + isForEachComponent(node.expression) && + isNonspecificChildForEach(node.expression, specificChildSet, allComponentNames)) { + return true; + } + if (ts.isExpressionStatement(node) && ts.isCallExpression(node.expression) && + !isForEachComponent(node.expression) && isComponent(node.expression, allComponentNames) && + isNonspecificChildNonForEach(node.expression, specificChildSet)) { + return true; + } + return false; +} + +function collectComponentProps(node: ts.ClassDeclaration): void { + const componentName: string = node.name.getText(); + const ComponentSet: IComponentSet = getComponentSet(node); + propertyCollection.set(componentName, ComponentSet.propertys); + stateCollection.set(componentName, ComponentSet.states); + linkCollection.set(componentName, ComponentSet.links); + propCollection.set(componentName, ComponentSet.props); + regularCollection.set(componentName, ComponentSet.regulars); + storagePropCollection.set(componentName, ComponentSet.storageProps); + storageLinkCollection.set(componentName, ComponentSet.storageLinks); + provideCollection.set(componentName, ComponentSet.provides); + consumeCollection.set(componentName, ComponentSet.consumes); + objectLinkCollection.set(componentName, ComponentSet.objectLinks); +} + +export function getComponentSet(node: ts.ClassDeclaration): IComponentSet { + const propertys: Set = new Set(); + const states: Set = new Set(); + const links: Set = new Set(); + const props: Set = new Set(); + const regulars: Set = new Set(); + const storageProps: Set = new Set(); + const storageLinks: Set = new Set(); + const provides: Set = new Set(); + const consumes: Set = new Set(); + const objectLinks: Set = new Set(); + traversalComponentProps(node, propertys, regulars, states, links, props, storageProps, + storageLinks, provides, consumes, objectLinks); + return { + propertys, regulars, states, links, props, storageProps, storageLinks, provides, + consumes, objectLinks + }; +} + +function traversalComponentProps(node: ts.ClassDeclaration, propertys: Set, + regulars: Set, states: Set, links: Set, props: Set, + storageProps: Set, storageLinks: Set, provides: Set, + consumes: Set, objectLinks: Set): void { + let isStatic: boolean = true; + if (node.members) { + const currentMethodCollection: Set = new Set(); + node.members.forEach(item => { + if (ts.isPropertyDeclaration(item) && ts.isIdentifier(item.name)) { + const propertyName: string = item.name.getText(); + propertys.add(propertyName); + if (!item.decorators || !item.decorators.length) { + regulars.add(propertyName); + } else { + isStatic = false; + for (let i = 0; i < item.decorators.length; i++) { + const decoratorName: string = item.decorators[i].getText().replace(/\(.*\)$/, '').trim(); + if (INNER_COMPONENT_MEMBER_DECORATORS.has(decoratorName)) { + dollarCollection.add('$' + propertyName); + collectionStates(decoratorName, propertyName, states, links, props, storageProps, + storageLinks, provides, consumes, objectLinks); + } + } + } + } + if (ts.isMethodDeclaration(item) && item.name && ts.isIdentifier(item.name)) { + currentMethodCollection.add(item.name.getText()); + } + }); + classMethodCollection.set(node.name.getText(), currentMethodCollection); + } + isStaticViewCollection.set(node.name.getText(), isStatic); +} + +function collectionStates(decorator: string, name: string, states: Set, links: Set, + props: Set, storageProps: Set, storageLinks: Set, provides: Set, + consumes: Set, objectLinks: Set): void { + switch (decorator) { + case COMPONENT_STATE_DECORATOR: + states.add(name); + break; + case COMPONENT_LINK_DECORATOR: + links.add(name); + break; + case COMPONENT_PROP_DECORATOR: + props.add(name); + break; + case COMPONENT_STORAGE_PROP_DECORATOR: + storageProps.add(name); + break; + case COMPONENT_STORAGE_LINK_DECORATOR: + storageLinks.add(name); + break; + case COMPONENT_PROVIDE_DECORATOR: + provides.add(name); + break; + case COMPONENT_CONSUME_DECORATOR: + consumes.add(name); + break; + case COMPONENT_OBJECT_LINK_DECORATOR: + objectLinks.add(name); + break; + } +} + +export interface ReplaceResult { + content: string, + log: LogInfo[] +} + +export function sourceReplace(source: string, sourcePath: string): ReplaceResult { + let content: string = source; + const log: LogInfo[] = []; + // replace struct->class + content = content.replace( + new RegExp('\\b' + STRUCT + '\\b.+\\{', 'g'), item => { + item = item.replace(new RegExp('\\b' + STRUCT + '\\b', 'g'), `${CLASS} `); + return `${item} constructor(${COMPONENT_CONSTRUCTOR_ID}?, ${COMPONENT_CONSTRUCTOR_PARENT}?, ${COMPONENT_CONSTRUCTOR_PARAMS}?) {}`; + }); + + content = preprocessExtend(content, sourcePath, log); + // process @system. + content = processSystemApi(content); + + return { + content: content, + log: log + } +} + +export function preprocessExtend(content: string, sourcePath: string, log: LogInfo[]): string { + let syntaxCheckContent: string; + let result: any; + try { + result = parser.parse(content); + syntaxCheckContent = result.content; + for (let i = 0; i < result.collect_extend.component.length; i++) { + collectExtend( + result.collect_extend.component[i], + result.collect_extend.functionName[i], + result.collect_extend.parameters[i] + ); + } + } catch (err) { + result = err; + log.push({ + type: LogType.ERROR, + message: parser.SyntaxError.buildMessage(err.expected, err.found), + line: err.location.start.line, + column: err.location.start.column, + fileName: sourcePath + }); + syntaxCheckContent = content; + } + if (result.error_otherParsers) { + for(let i = 0; i < result.error_otherParsers.length; i++) { + log.push({ + type: LogType.ERROR, + message: result.error_otherParsers[i].errMessage, + line: result.error_otherParsers[i].errPosition.line, + column: result.error_otherParsers[i].errPosition.column, + fileName: sourcePath + }); + } + } + return syntaxCheckContent; +} + +function collectExtend(component: string, attribute: string, parameter: string): void { + let parameterCount: number; + if (parameter) { + parameterCount = parameter.split(',').length; + } else { + parameterCount = 0; + } + BUILDIN_STYLE_NAMES.add(attribute); + if (EXTEND_ATTRIBUTE.has(component)) { + EXTEND_ATTRIBUTE.get(component).add({ attribute, parameterCount }); + } else { + EXTEND_ATTRIBUTE.set(component, new Set([{ attribute, parameterCount }])); + } +} + +export function processSystemApi(content: string): string { + const REG_SYSTEM: RegExp = + /import\s+(.+)\s+from\s+['"]@(system|ohos)\.(\S+)['"]|import\s+(.+)\s*=\s*require\(\s*['"]@(system|ohos)\.(\S+)['"]\s*\)/g; + const REG_LIB_SO: RegExp = + /import\s+(.+)\s+from\s+['"]lib(\S+)\.so['"]|import\s+(.+)\s*=\s*require\(\s*['"]lib(\S+)\.so['"]\s*\)/g; + return content.replace(REG_LIB_SO, (_, item1, item2, item3, item4) => { + const libSoValue: string = item1 || item3; + const libSoKey: string = item2 || item4; + return `var ${libSoValue} = globalThis.requireNapi("${libSoKey}", true);`; + }).replace(REG_SYSTEM, (item, item1, item2, item3, item4, item5, item6) => { + const moduleType: string = item2 || item5; + const systemKey: string = item3 || item6; + const systemValue: string = item1 || item4; + moduleCollection.add(`${moduleType}.${systemKey}`); + if (NATIVE_MODULE.has(`${moduleType}.${systemKey}`)) { + item = `var ${systemValue} = globalThis.requireNativeModule('${moduleType}.${systemKey}')`; + } else if (moduleType === SYSTEM_PLUGIN) { + item = `var ${systemValue} = isSystemplugin('${systemKey}', '${SYSTEM_PLUGIN}') ? ` + + `globalThis.systemplugin.${systemKey} : globalThis.requireNapi('${systemKey}')`; + } else if (moduleType === OHOS_PLUGIN) { + item = `var ${systemValue} = isSystemplugin('${systemKey}', '${OHOS_PLUGIN}') ? ` + + `globalThis.ohosplugin.${systemKey} : isSystemplugin('${systemKey}', '${SYSTEM_PLUGIN}') ? ` + + `globalThis.systemplugin.${systemKey} : globalThis.requireNapi('${systemKey}')`; + } + return item; + }); +} + +export function resetComponentCollection() { + componentCollection.entryComponent = null; + componentCollection.previewComponent = null; +} diff --git a/compiler/compiler/syntax_parser/src/parse_extend.peg b/compiler/compiler/syntax_parser/src/parse_extend.peg new file mode 100644 index 000000000..0dcec46be --- /dev/null +++ b/compiler/compiler/syntax_parser/src/parse_extend.peg @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + +start = extendAttributes:extendAttribute+ +{ + return {location: location()}; +} + +extendAttribute = whiteSpace '.' whiteSpace attribute item +attribute = attr_head attr_tail +attr_head = $ [a-zA-Z_$]+ +attr_tail = $ [a-zA-Z0-9_$]* +item = whiteSpace '(' [^()]* item* [^()]* ')' whiteSpace +whiteSpace = [ \t\r\n]* diff --git a/compiler/compiler/syntax_parser/src/syntax_parser.peg b/compiler/compiler/syntax_parser/src/syntax_parser.peg new file mode 100644 index 000000000..c77c99afc --- /dev/null +++ b/compiler/compiler/syntax_parser/src/syntax_parser.peg @@ -0,0 +1,116 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + +{ + const parse_extend = require('./parse_extend.js'); + + const error_otherParsers = []; + let singleError = function(errMessage, line, column) { + this.errMessage = errMessage; + this.errPosition = { + line: line, + column: column + }; + }; + const collect_extend = { + component: [], + functionName: [], + parameters: [] + }; +} + +start = blocks: block+ +{ + return { + content: blocks.join(''), + location: location(), + collect_extend: collect_extend, + error_otherParsers: error_otherParsers + }; +} + +block = extend/(prefix extend?) +prefix = $((!prefix_extend .)+) +extend = + whiteSpace1:whiteSpace prefix_extend:prefix_extend funcBody_extend:funcBody_extend + whiteSpace2: whiteSpace right:'}' whiteSpace3:whiteSpace +{ + return whiteSpace1 + prefix_extend + funcBody_extend + whiteSpace2 + right + whiteSpace3; +} + +prefix_extend = prefix_extend_one/prefix_extend_another + +//match a kind of extend component +prefix_extend_one = + '@Extend' whiteSpace1:whiteSpace '(' component:component ')' whiteSpace2:whiteSpace 'function' + whiteSpace3:whiteSpace function_name:function_name whiteSpace4:whiteSpace '(' parameters:parameters + ')' whiteSpace5:whiteSpace left:'{' +{ + collect_extend.component.push(component); + collect_extend.functionName.push(function_name); + collect_extend.parameters.push(parameters); + return '@Extend' + whiteSpace1 + whiteSpace2 + 'function' + whiteSpace3 + '__' + component + + '__' + function_name + whiteSpace4 + '(' + parameters + ')' + whiteSpace5 + left + component; +} + +//match another kind of extend component +prefix_extend_another = + '@Extend' whiteSpace1:whiteSpace component:component '.' function_name:function_name + whiteSpace2:whiteSpace '(' parameters:parameters ')' whiteSpace3:whiteSpace left:'{' +{ + collect_extend.component.push(component); + collect_extend.functionName.push(function_name); + collect_extend.parameters.push(parameters); + return '@Extend' + ' function' + whiteSpace1 + '__' + component + '__' + function_name + + whiteSpace2 + '(' + parameters + ')' + whiteSpace3 + left + component; +} + +component = $ [a-zA-Z_]+ +function_name = $ (function_name_head function_name_tail) +function_name_head = $ [a-zA-Z_$]+ +function_name_tail = $ [a-zA-Z0-9_$]* +parameters = $ ([^()]* item* [^()]*) + +//extract Extend internal attribute SyntaxError +funcBody_extend = body:($[^{}]* item* [^{}]*) +{ + try { + let functionBody = body.join(''); + parse_extend.parse(functionBody); + return functionBody; + } catch (err) { + let countLines = location().end.line - location().start.line; + if (err.location.start.line === 1) { + err.location.start.column += location().start.column; + } + let supportMessage = " Our rule is .attribute(value) , for example: .width(50) . And you'd better have at least one attribute in Extend Component"; + error_otherParsers.push( + new singleError( + parse_extend.SyntaxError.buildMessage(err.expected, err.found) + supportMessage, + err.location.start.line + location().start.line - 1, + err.location.start.column + ) + ); + let placeHolders = ''; + while (countLines>0) { + placeHolders += '\r\n'; + countLines -= 1; + } + return '()' + placeHolders; + } +} + +item = $ (whiteSpace '{' [^{}]* item* [^{}]* '}' whiteSpace) +whiteSpace = $ [ \t\r\n]* diff --git a/compiler/compiler/test/README.md b/compiler/compiler/test/README.md new file mode 100644 index 000000000..8cb5288c5 --- /dev/null +++ b/compiler/compiler/test/README.md @@ -0,0 +1,83 @@ +# compiler unit testing + +**The compiler unit testing for ace2.0.** + +## Usage +Here are simplified instructions of how to get started. The following commands work both on **Windows** and **Linux** platforms. + +### 1. Install +First, enter the root directory of the compiler: +``` +$ cd compiler/ +``` +And then install the npm dependencies(You must have node&npm installed): +``` +$ npm install +``` +**Note**: If some errors occur, delete the generated package `node_modules`, config npm proxy and run `npm install` again. +``` +npm config set proxy http://username:password@server:port +npm confit set https-proxy http://username:password@server:port +``` + +### 2. Quick Start +First, create a new test file or directory in `compiler/test`. +Write source code in variable 'source', and write expected code in variable 'expectResult': +``` +// source code +export const source: string = `...` +// expected code +export const expectResult: string = `...` +``` +In the root directory of `compiler/`: +``` +$ npm run test +``` +All files in the `compiler/test` will be tested. + +### 3. Example +1. Create a new test directory `foo` in `compiler`. +2. Create a new test file `bar.ts` in `compiler/foo`. +3. In the file `bar.ts`, write the following lines: +``` +export const source: string = ` +struct MyComponent { + build() { + } +}` + +export const expectResult: string = +`class MyComponent { + build() { + } +} +` +``` +4. In the root directory of `compiler/`: +``` +$ npm run test +``` +5. All files in the `compiler/test` will be tested. The output is like the following lines: +``` + ✓ bar + 1 passing (1ms) +``` +**Note**: If the actual building result is different from the expected result and the output is like the following lines, you should check the error: +``` + 1) bar + + 0 passing (1ms) + 1 failing + + 1) compiler + bar: + + AssertionError: expected 'class MyComponent {\n build() {\n }\n}\n' to deeply equal 'class MyComponent {\n build() {\n \n}\n' + + expected - actual + + class MyComponent { + build() { + - } + + + } +``` diff --git a/compiler/compiler/test/pages/AMDComponent.ets b/compiler/compiler/test/pages/AMDComponent.ets new file mode 100644 index 000000000..3135f0d85 --- /dev/null +++ b/compiler/compiler/test/pages/AMDComponent.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + +@Component +struct AMDComponent { + @Link AMDComponentLink1?: any + @Link AMDComponentLink2?: number + @Link AMDComponentLink3?: boolean + @Link AMDComponentLink4?: string + + private myVar: number = 0 + private myVar2: number + + build() { + + } +} + +export = AMDComponent diff --git a/compiler/compiler/test/pages/DefaultComponent.ets b/compiler/compiler/test/pages/DefaultComponent.ets new file mode 100644 index 000000000..e0add5224 --- /dev/null +++ b/compiler/compiler/test/pages/DefaultComponent.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + +@Component +struct DefaultComponent { + @Link DefaultComponentLink1?: any + @Link DefaultComponentLink2?: number + @Link DefaultComponentLink3?: boolean + @Link DefaultComponentLink4?: string + + private myVar: number = 0 + private myVar2: number + + build() { + + } +} + +export default DefaultComponent diff --git a/compiler/compiler/test/pages/ExportComponent.ets b/compiler/compiler/test/pages/ExportComponent.ets new file mode 100644 index 000000000..ba582d538 --- /dev/null +++ b/compiler/compiler/test/pages/ExportComponent.ets @@ -0,0 +1,119 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + + +import DefaultComponent from "./test/pages/DefaultComponent.ets" + +@Component +struct ExportComponent1 { + @Link ExportComponent1Link1?: any + @Link ExportComponent1Link2?: number + @Link ExportComponent1Link3?: boolean + @Link ExportComponent1Link4?: string + @State indexState1: any = { count: 0 } + @State indexState2: number = 0 + @State indexState3: boolean = false + @State indexState4: string = 'Home' + + build() { + Row() { + DefaultComponent({ + DefaultComponentLink1: $indexState1, + DefaultComponentLink2: $indexState2, + DefaultComponentLink3: $indexState3, + DefaultComponentLink4: $indexState4, + myVar: 100, + myVar2: 100 + }) + } + } +} + +@Component +struct ExportComponent2 { + @Link ExportComponent2Link1?: any + @Link ExportComponent2Link2?: number + @Link ExportComponent2Link3?: boolean + @Link ExportComponent2Link4?: string + @State indexState1: any = { count: 0 } + @State indexState2: number = 0 + @State indexState3: boolean = false + @State indexState4: string = 'Home' + + build() { + Row() { + DefaultComponent({ + DefaultComponentLink1: $indexState1, + DefaultComponentLink2: $indexState2, + DefaultComponentLink3: $indexState3, + DefaultComponentLink4: $indexState4, + myVar: 100, + myVar2: 100 + }) + } + } +} + +@Component +struct ExportComponent3 { + @Link ExportComponent3Link1?: any + @Link ExportComponent3Link2?: number + @Link ExportComponent3Link3?: boolean + @Link ExportComponent3Link4?: string + @State indexState1: any = { count: 0 } + @State indexState2: number = 0 + @State indexState3: boolean = false + @State indexState4: string = 'Home' + + build() { + Row() { + DefaultComponent({ + DefaultComponentLink1: $indexState1, + DefaultComponentLink2: $indexState2, + DefaultComponentLink3: $indexState3, + DefaultComponentLink4: $indexState4, + myVar: 100, + myVar2: 100 + }) + } + } +} + +@Component +export default struct ExportComponent4 { + @Link ExportComponent4Link1?: any + @Link ExportComponent4Link2?: number + @Link ExportComponent4Link3?: boolean + @Link ExportComponent4Link4?: string + @State indexState1: any = { count: 0 } + @State indexState2: number = 0 + @State indexState3: boolean = false + @State indexState4: string = 'Home' + + build() { + Row() { + DefaultComponent({ + DefaultComponentLink1: $indexState1, + DefaultComponentLink2: $indexState2, + DefaultComponentLink3: $indexState3, + DefaultComponentLink4: $indexState4, + myVar: 100, + myVar2: 100 + }) + } + } +} + +export { ExportComponent1 as ExportComponent, ExportComponent2, ExportComponent3 } diff --git a/compiler/compiler/test/pages/ExportStarComponent.ets b/compiler/compiler/test/pages/ExportStarComponent.ets new file mode 100644 index 000000000..d9d450293 --- /dev/null +++ b/compiler/compiler/test/pages/ExportStarComponent.ets @@ -0,0 +1,17 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + + +export * as AllStarComponent from './test/pages/ExportComponent'; diff --git a/compiler/compiler/test/pages/LinkComponent.ets b/compiler/compiler/test/pages/LinkComponent.ets new file mode 100644 index 000000000..ffcc61155 --- /dev/null +++ b/compiler/compiler/test/pages/LinkComponent.ets @@ -0,0 +1,120 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + +import DefaultComponent from "./DefaultComponent.ets" + +@Component +struct LinkComponent1 { + @Link LinkComponent1Link1?: any + @Link LinkComponent1Link2?: number + @Link LinkComponent1Link3?: boolean + @Link LinkComponent1Link4?: string + @State indexState1: any = { count: 0 } + @State indexState2: number = 0 + @State indexState3: boolean = false + @State indexState4: string = 'Home' + + build() { + Row() { + DefaultComponent({ + DefaultComponentLink1: $indexState1, + DefaultComponentLink2: $indexState2, + DefaultComponentLink3: $indexState3, + DefaultComponentLink4: $indexState4, + myVar: 100, + myVar2: 100 + }) + } + } +} + +@Component +struct LinkComponent2 { + @Link LinkComponent2Link1?: any + @Link LinkComponent2Link2?: number + @Link LinkComponent2Link3?: boolean + @Link LinkComponent2Link4?: string + @State indexState1: any = { count: 0 } + @State indexState2: number = 0 + @State indexState3: boolean = false + @State indexState4: string = 'Home' + + build() { + Row() { + DefaultComponent({ + DefaultComponentLink1: $indexState1, + DefaultComponentLink2: $indexState2, + DefaultComponentLink3: $indexState3, + DefaultComponentLink4: $indexState4, + myVar: 100, + myVar2: 100 + }) + } + } +} + +@Component +struct LinkComponent3 { + @Link LinkComponent3Link1?: any + @Link LinkComponent3Link2?: number + @Link LinkComponent3Link3?: boolean + @Link LinkComponent3Link4?: string + @State indexState1: any = { count: 0 } + @State indexState2: number = 0 + @State indexState3: boolean = false + @State indexState4: string = 'Home' + + build() { + Row() { + DefaultComponent({ + DefaultComponentLink1: $indexState1, + DefaultComponentLink2: $indexState2, + DefaultComponentLink3: $indexState3, + DefaultComponentLink4: $indexState4, + myVar: 100, + myVar2: 100 + }) + } + } +} + +@Component +struct LinkComponent4 { + @Link LinkComponent3Link1?: any + @Link LinkComponent3Link2?: number + @Link LinkComponent3Link3?: boolean + @Link LinkComponent3Link4?: string + @State indexState1: any = { count: 0 } + @State indexState2: number = 0 + @State indexState3: boolean = false + @State indexState4: string = 'Home' + + build() { + Row() { + DefaultComponent({ + DefaultComponentLink1: $indexState1, + DefaultComponentLink2: $indexState2, + DefaultComponentLink3: $indexState3, + DefaultComponentLink4: $indexState4, + myVar: 100, + myVar2: 100 + }) + } + } +} + +export { LinkComponent1 as LinkComponent, LinkComponent2, LinkComponent3 } + +export default LinkComponent4 diff --git a/compiler/compiler/test/pages/NamespaceComponent.ets b/compiler/compiler/test/pages/NamespaceComponent.ets new file mode 100644 index 000000000..5b33ec85f --- /dev/null +++ b/compiler/compiler/test/pages/NamespaceComponent.ets @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + +@Component +struct NamespaceComponent1 { + @Link NamespaceComponent1Link1?: any + @Link NamespaceComponent1Link2?: number + @Link NamespaceComponent1Link3?: boolean + @Link NamespaceComponent1Link4?: string + + private myVar: number = 0 + private myVar2: number + + build() { + + } +} + +@Component +struct NamespaceComponent2 { + @Link NamespaceComponent2Link1?: any + @Link NamespaceComponent2Link2?: number + @Link NamespaceComponent2Link3?: boolean + @Link NamespaceComponent2Link4?: string + + private myVar: number = 0 + private myVar2: number + + build() { + + } +} + +@Component +struct NamespaceComponent3 { + @Link NamespaceComponent3Link1?: any + @Link NamespaceComponent3Link2?: number + @Link NamespaceComponent3Link3?: boolean + @Link NamespaceComponent3Link4?: string + + private myVar: number = 0 + private myVar2: number + + build() { + + } +} + +export { NamespaceComponent1, NamespaceComponent2 } + +export default NamespaceComponent3 diff --git a/compiler/compiler/test/pages/TsModule.ts b/compiler/compiler/test/pages/TsModule.ts new file mode 100644 index 000000000..7faca616e --- /dev/null +++ b/compiler/compiler/test/pages/TsModule.ts @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2020 Huawei Device Co., Ltd. + * 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. + */ + +export default class TsModule { + private property: number = 1; + constructor(property: number) { + this.property = property; + } + + public method(): any { + return { count: this.property }; + } +} diff --git a/compiler/compiler/test/test.ts b/compiler/compiler/test/test.ts new file mode 100644 index 000000000..a4254e7d8 --- /dev/null +++ b/compiler/compiler/test/test.ts @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + +import ts from 'typescript'; +import path from 'path'; +import chai from 'chai'; +import { + describe, + it +} from 'mocha'; +const expect = chai.expect; + +import { + validateUISyntax, + resetComponentCollection, + sourceReplace, + componentCollection +} from '../lib/validate_ui_syntax'; +import { processUISyntax } from '../lib/process_ui_syntax'; +import { + componentInfo, + readFile +} from '../lib/utils'; +import { BUILD_ON } from '../lib/pre_define'; + +function expectActual(name: string, filePath: string) { + const content: any = require(filePath); + const source: string = content.source; + process.env.compiler = BUILD_ON; + const afterProcess = sourceReplace(source); + validateUISyntax(source, afterProcess, `${name}.ts`); + const result: ts.TranspileOutput = ts.transpileModule(afterProcess, { + compilerOptions: { + "target": ts.ScriptTarget.ES2017 + }, + fileName: `${name}.ts`, + transformers: { before: [processUISyntax(null, true)] } + }); + componentInfo.id = 0; + componentCollection.customComponents.clear(); + resetComponentCollection(); + expect(result.outputText).eql(content.expectResult); +} + +describe('compiler', () => { + const utPath: string = path.resolve(__dirname, './ut'); + const utFiles: string[] = []; + readFile(utPath, utFiles); + utFiles.forEach((item) => { + const fileName: string = path.basename(item, '.ts'); + it(fileName, () => { + expectActual(fileName, item); + }) + }) +}) diff --git a/compiler/compiler/test/ut/animation/animation.ts b/compiler/compiler/test/ut/animation/animation.ts new file mode 100644 index 000000000..a2cad53be --- /dev/null +++ b/compiler/compiler/test/ut/animation/animation.ts @@ -0,0 +1,119 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + +export const source: string = ` +@Entry +@Component +struct Animation { + private bgColor: string = "#8888ff" + private width: number + private height: number + + build() { + Column() { + Text("Text explicit animation").onClick(() => { + let dx = 50; + let dy = 100; + this.bgColor = (this.bgColor == "#8888ff") ? "#ff8888" : "#8888ff"; + animateTo( + {duration: 1000, delay: 0, curve: "ease"}, + () => { + this.width += dx; + } + ); + animateTo( + {duration: 2000, delay: 0, curve: "ease"}, + () => { + this.height += dy; + } + ); + }) + .width(this.width) + .fontSize(40) + .animation({duration: 1000, delay: 0, curve: "ease"}) + .opacity(10) + .fontColor('#8888ff') + .animation({duration: 100, delay: 10, curve: "ease"}) + .margin({}) + .height(this.height) + }.width(this.width) + .animation({duration: 2000, delay: 0, curve: "ease"}) + .opacity(10) + .animation({duration: 200, delay: 20, curve: "ease"}) + .margin({}) + .height(this.height) + .animation(null) + } +}` + +export const expectResult: string = +`class Animation extends View { + constructor(compilerAssignedUniqueChildId, parent, params) { + super(compilerAssignedUniqueChildId, parent); + this.bgColor = "#8888ff"; + this.width = undefined; + this.height = undefined; + this.updateWithValueParams(params); + } + updateWithValueParams(params) { + if (params.bgColor !== undefined) { + this.bgColor = params.bgColor; + } + if (params.width !== undefined) { + this.width = params.width; + } + if (params.height !== undefined) { + this.height = params.height; + } + } + aboutToBeDeleted() { + SubscriberManager.Get().delete(this.id()); + } + render() { + Column.create(); + Context.animation({ duration: 2000, delay: 0, curve: "ease" }); + Column.width(this.width); + Context.animation({ duration: 200, delay: 20, curve: "ease" }); + Column.opacity(10); + Context.animation(null); + Column.margin({}); + Column.height(this.height); + Text.create("Text explicit animation"); + Context.animation({ duration: 1000, delay: 0, curve: "ease" }); + Text.onClick(() => { + let dx = 50; + let dy = 100; + this.bgColor = (this.bgColor == "#8888ff") ? "#ff8888" : "#8888ff"; + Context.animateTo({ duration: 1000, delay: 0, curve: "ease" }, () => { + this.width += dx; + }); + Context.animateTo({ duration: 2000, delay: 0, curve: "ease" }, () => { + this.height += dy; + }); + }); + Text.width(this.width); + Text.fontSize(40); + Context.animation({ duration: 100, delay: 10, curve: "ease" }); + Text.opacity(10); + Text.fontColor('#8888ff'); + Context.animation(null); + Text.margin({}); + Text.height(this.height); + Text.pop(); + Column.pop(); + } +} +loadDocument(new Animation("1", undefined, {})); +` diff --git a/compiler/compiler/test/ut/build/build.ts b/compiler/compiler/test/ut/build/build.ts new file mode 100644 index 000000000..65bb964d4 --- /dev/null +++ b/compiler/compiler/test/ut/build/build.ts @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + +export const source: string = ` +@Entry +@Component +struct MyComponent { + private test: string = 'Hello' + build() { + Column() { + Text(this.test) + Button() + .width(20) + .height(20) + }.width(100) + } +}` + +export const expectResult: string = +`class MyComponent extends View { + constructor(compilerAssignedUniqueChildId, parent, params) { + super(compilerAssignedUniqueChildId, parent); + this.test = 'Hello'; + this.updateWithValueParams(params); + } + updateWithValueParams(params) { + if (params.test !== undefined) { + this.test = params.test; + } + } + aboutToBeDeleted() { + SubscriberManager.Get().delete(this.id()); + } + render() { + Column.create(); + Column.width(100); + Text.create(this.test); + Text.pop(); + Button.createWithLabel(); + Button.width(20); + Button.height(20); + Button.pop(); + Column.pop(); + } +} +loadDocument(new MyComponent("1", undefined, {})); +` \ No newline at end of file diff --git a/compiler/compiler/test/ut/component/component.ts b/compiler/compiler/test/ut/component/component.ts new file mode 100644 index 000000000..9b46eb749 --- /dev/null +++ b/compiler/compiler/test/ut/component/component.ts @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + +export const source: string = ` +@Component +@Entry +struct MyComponent { + private value1: string = "hello world 1" + private value2: string = "hello world 2" + private value3: string = "hello world 3" + + build() { + Column() { + Text(this.value1) + Text(this.value2) + Text(this.value3) + } + } +}` + +export const expectResult: string = +`class MyComponent extends View { + constructor(compilerAssignedUniqueChildId, parent, params) { + super(compilerAssignedUniqueChildId, parent); + this.value1 = "hello world 1"; + this.value2 = "hello world 2"; + this.value3 = "hello world 3"; + this.updateWithValueParams(params); + } + updateWithValueParams(params) { + if (params.value1 !== undefined) { + this.value1 = params.value1; + } + if (params.value2 !== undefined) { + this.value2 = params.value2; + } + if (params.value3 !== undefined) { + this.value3 = params.value3; + } + } + aboutToBeDeleted() { + SubscriberManager.Get().delete(this.id()); + } + render() { + Column.create(); + Text.create(this.value1); + Text.pop(); + Text.create(this.value2); + Text.pop(); + Text.create(this.value3); + Text.pop(); + Column.pop(); + } +} +loadDocument(new MyComponent("1", undefined, {})); +` diff --git a/compiler/compiler/test/ut/component/customComponent.ts b/compiler/compiler/test/ut/component/customComponent.ts new file mode 100644 index 000000000..6907d09b7 --- /dev/null +++ b/compiler/compiler/test/ut/component/customComponent.ts @@ -0,0 +1,157 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + +export const source: string = ` +@Entry +@Component +struct Parent { + public regularToState: string = 'regularToState' + @State stateToProp: string = 'stateToProp' + public regularToRegular: string = 'regularToRegular' + @State stateToLink: string = 'stateToLink' + build() { + Row() { + Child({ stateProperty: this.regularToState, + propProperty: this.stateToProp, + regularProperty: this.regularToRegular, + linkProperty: this.$stateToLink + }) + } + } +} + +@Component +struct Child { + @State stateProperty: string = 'state' + @Prop propProperty: string + public regularProperty: string = 'regular' + @Link linkProperty: string + build() { + Column() {} + } +} +` + +export const expectResult: string = +`class Parent extends View { + constructor(compilerAssignedUniqueChildId, parent, params) { + super(compilerAssignedUniqueChildId, parent); + this.regularToState = 'regularToState'; + this.__stateToProp = new ObservedPropertySimple('stateToProp', this, "stateToProp"); + this.regularToRegular = 'regularToRegular'; + this.__stateToLink = new ObservedPropertySimple('stateToLink', this, "stateToLink"); + this.updateWithValueParams(params); + } + updateWithValueParams(params) { + if (params.regularToState !== undefined) { + this.regularToState = params.regularToState; + } + if (params.stateToProp !== undefined) { + this.stateToProp = params.stateToProp; + } + if (params.regularToRegular !== undefined) { + this.regularToRegular = params.regularToRegular; + } + if (params.stateToLink !== undefined) { + this.stateToLink = params.stateToLink; + } + } + aboutToBeDeleted() { + this.__stateToProp.aboutToBeDeleted(); + this.__stateToLink.aboutToBeDeleted(); + SubscriberManager.Get().delete(this.id()); + } + get stateToProp() { + return this.__stateToProp.get(); + } + set stateToProp(newValue) { + this.__stateToProp.set(newValue); + } + get stateToLink() { + return this.__stateToLink.get(); + } + set stateToLink(newValue) { + this.__stateToLink.set(newValue); + } + render() { + Row.create(); + let earlierCreatedChild_2 = this.findChildById("2"); + if (earlierCreatedChild_2 == undefined) { + View.create(new Child("2", this, { stateProperty: this.regularToState, + propProperty: this.stateToProp, + regularProperty: this.regularToRegular, + linkProperty: this.__stateToLink + })); + } + else { + earlierCreatedChild_2.updateWithValueParams({ + stateProperty: this.regularToState, + propProperty: this.stateToProp, + regularProperty: this.regularToRegular + }); + View.create(earlierCreatedChild_2); + } + Row.pop(); + } +} +class Child extends View { + constructor(compilerAssignedUniqueChildId, parent, params) { + super(compilerAssignedUniqueChildId, parent); + this.__stateProperty = new ObservedPropertySimple('state', this, "stateProperty"); + this.__propProperty = new SynchedPropertySimpleOneWay(params.propProperty, this, "propProperty"); + this.regularProperty = 'regular'; + this.__linkProperty = new SynchedPropertySimpleTwoWay(params.linkProperty, this, "linkProperty"); + this.updateWithValueParams(params); + } + updateWithValueParams(params) { + if (params.stateProperty !== undefined) { + this.stateProperty = params.stateProperty; + } + this.propProperty = params.propProperty; + if (params.regularProperty !== undefined) { + this.regularProperty = params.regularProperty; + } + } + aboutToBeDeleted() { + this.__stateProperty.aboutToBeDeleted(); + this.__propProperty.aboutToBeDeleted(); + this.__linkProperty.aboutToBeDeleted(); + SubscriberManager.Get().delete(this.id()); + } + get stateProperty() { + return this.__stateProperty.get(); + } + set stateProperty(newValue) { + this.__stateProperty.set(newValue); + } + get propProperty() { + return this.__propProperty.get(); + } + set propProperty(newValue) { + this.__propProperty.set(newValue); + } + get linkProperty() { + return this.__linkProperty.get(); + } + set linkProperty(newValue) { + this.__linkProperty.set(newValue); + } + render() { + Column.create(); + Column.pop(); + } +} +loadDocument(new Parent("1", undefined, {})); +` diff --git a/compiler/compiler/test/ut/constructor/id.ts b/compiler/compiler/test/ut/constructor/id.ts new file mode 100644 index 000000000..3a7920333 --- /dev/null +++ b/compiler/compiler/test/ut/constructor/id.ts @@ -0,0 +1,249 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + +export const source: string = ` +@Entry +@Component +struct HomeComponent { + private value1: string = "1" + value2: string = "2" + @Prop value3: number + @State value4: Array = [1, 2, 3] + @Link value5: string + value6: string + private value7: string + @State value8: string = "value8" + + build() { + Column() { + ForEach([], + item => { + Column() { + Banner() + Text('1') + if (this.value1) { + Banner({value2: '2'}) + Text('2') + } + } + }, + item => item + ) + Banner({value1: '2', value2: '3', value3: '4'}) + Text('3') + if (true) { + Banner({value1: '3', value2: '2', value3: '1'}) + Text('4') + } + } + .height(500) + } + } + +@Component +struct Banner { + private value1: string = "hello world 4" + private value2: string = "hello world 5" + private value3: string = "hello world 6" + + build() { + Column() { + Text(this.value1) + Text(this.value2) + Text(this.value3) + } + } +}` + +export const expectResult: string = +`class HomeComponent extends View { + constructor(compilerAssignedUniqueChildId, parent, params) { + super(compilerAssignedUniqueChildId, parent); + this.value1 = "1"; + this.value2 = "2"; + this.__value3 = new SynchedPropertySimpleOneWay(params.value3, this, "value3"); + this.__value4 = new ObservedPropertyObject([1, 2, 3], this, "value4"); + this.__value5 = new SynchedPropertySimpleTwoWay(params.value5, this, "value5"); + this.value6 = undefined; + this.value7 = undefined; + this.__value8 = new ObservedPropertySimple("value8", this, "value8"); + this.updateWithValueParams(params); + } + updateWithValueParams(params) { + if (params.value1 !== undefined) { + this.value1 = params.value1; + } + if (params.value2 !== undefined) { + this.value2 = params.value2; + } + this.value3 = params.value3; + if (params.value4 !== undefined) { + this.value4 = params.value4; + } + if (params.value6 !== undefined) { + this.value6 = params.value6; + } + if (params.value7 !== undefined) { + this.value7 = params.value7; + } + if (params.value8 !== undefined) { + this.value8 = params.value8; + } + } + aboutToBeDeleted() { + this.__value3.aboutToBeDeleted(); + this.__value4.aboutToBeDeleted(); + this.__value5.aboutToBeDeleted(); + this.__value8.aboutToBeDeleted(); + SubscriberManager.Get().delete(this.id()); + } + get value3() { + return this.__value3.get(); + } + set value3(newValue) { + this.__value3.set(newValue); + } + get value4() { + return this.__value4.get(); + } + set value4(newValue) { + this.__value4.set(newValue); + } + get value5() { + return this.__value5.get(); + } + set value5(newValue) { + this.__value5.set(newValue); + } + get value8() { + return this.__value8.get(); + } + set value8(newValue) { + this.__value8.set(newValue); + } + render() { + Column.create(); + Column.height(500); + ForEach.create("4", this, ObservedObject.GetRawObject([]), item => { + Column.create(); + let earlierCreatedChild_2 = this.findChildById("2"); + if (earlierCreatedChild_2 == undefined) { + View.create(new Banner("2", this, {})); + } + else { + earlierCreatedChild_2.updateWithValueParams({}); + if (!earlierCreatedChild_2.needsUpdate()) { + earlierCreatedChild_2.markStatic(); + } + View.create(earlierCreatedChild_2); + } + Text.create('1'); + Text.pop(); + If.create(); + if (this.value1) { + If.branchId(0); + let earlierCreatedChild_3 = this.findChildById("3"); + if (earlierCreatedChild_3 == undefined) { + View.create(new Banner("3", this, { value2: '2' })); + } + else { + earlierCreatedChild_3.updateWithValueParams({ + value2: '2' + }); + if (!earlierCreatedChild_3.needsUpdate()) { + earlierCreatedChild_3.markStatic(); + } + View.create(earlierCreatedChild_3); + } + Text.create('2'); + Text.pop(); + } + If.pop(); + Column.pop(); + }, item => item); + ForEach.pop(); + let earlierCreatedChild_5 = this.findChildById("5"); + if (earlierCreatedChild_5 == undefined) { + View.create(new Banner("5", this, { value1: '2', value2: '3', value3: '4' })); + } + else { + earlierCreatedChild_5.updateWithValueParams({ + value1: '2', value2: '3', value3: '4' + }); + if (!earlierCreatedChild_5.needsUpdate()) { + earlierCreatedChild_5.markStatic(); + } + View.create(earlierCreatedChild_5); + } + Text.create('3'); + Text.pop(); + If.create(); + if (true) { + If.branchId(0); + let earlierCreatedChild_6 = this.findChildById("6"); + if (earlierCreatedChild_6 == undefined) { + View.create(new Banner("6", this, { value1: '3', value2: '2', value3: '1' })); + } + else { + earlierCreatedChild_6.updateWithValueParams({ + value1: '3', value2: '2', value3: '1' + }); + if (!earlierCreatedChild_6.needsUpdate()) { + earlierCreatedChild_6.markStatic(); + } + View.create(earlierCreatedChild_6); + } + Text.create('4'); + Text.pop(); + } + If.pop(); + Column.pop(); + } +} +class Banner extends View { + constructor(compilerAssignedUniqueChildId, parent, params) { + super(compilerAssignedUniqueChildId, parent); + this.value1 = "hello world 4"; + this.value2 = "hello world 5"; + this.value3 = "hello world 6"; + this.updateWithValueParams(params); + } + updateWithValueParams(params) { + if (params.value1 !== undefined) { + this.value1 = params.value1; + } + if (params.value2 !== undefined) { + this.value2 = params.value2; + } + if (params.value3 !== undefined) { + this.value3 = params.value3; + } + } + aboutToBeDeleted() { + SubscriberManager.Get().delete(this.id()); + } + render() { + Column.create(); + Text.create(this.value1); + Text.pop(); + Text.create(this.value2); + Text.pop(); + Text.create(this.value3); + Text.pop(); + Column.pop(); + } +} +loadDocument(new HomeComponent("1", undefined, {})); +` diff --git a/compiler/compiler/test/ut/constructor/link.ts b/compiler/compiler/test/ut/constructor/link.ts new file mode 100644 index 000000000..117c65802 --- /dev/null +++ b/compiler/compiler/test/ut/constructor/link.ts @@ -0,0 +1,88 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + +export const source: string = ` +@Entry +@Component +struct MyLinkComponent { + @Link myLink1?: any + @Link myLink2?: number + @Link myLink3?: boolean + @Link myLink4?: string + + private myVar: number = 0 + private myVar2: number + + build() { + + } +}` + +export const expectResult: string = +`class MyLinkComponent extends View { + constructor(compilerAssignedUniqueChildId, parent, params) { + super(compilerAssignedUniqueChildId, parent); + this.__myLink1 = new SynchedPropertyObjectTwoWay(params.myLink1, this, "myLink1"); + this.__myLink2 = new SynchedPropertySimpleTwoWay(params.myLink2, this, "myLink2"); + this.__myLink3 = new SynchedPropertySimpleTwoWay(params.myLink3, this, "myLink3"); + this.__myLink4 = new SynchedPropertySimpleTwoWay(params.myLink4, this, "myLink4"); + this.myVar = 0; + this.myVar2 = undefined; + this.updateWithValueParams(params); + } + updateWithValueParams(params) { + if (params.myVar !== undefined) { + this.myVar = params.myVar; + } + if (params.myVar2 !== undefined) { + this.myVar2 = params.myVar2; + } + } + aboutToBeDeleted() { + this.__myLink1.aboutToBeDeleted(); + this.__myLink2.aboutToBeDeleted(); + this.__myLink3.aboutToBeDeleted(); + this.__myLink4.aboutToBeDeleted(); + SubscriberManager.Get().delete(this.id()); + } + get myLink1() { + return this.__myLink1.get(); + } + set myLink1(newValue) { + this.__myLink1.set(newValue); + } + get myLink2() { + return this.__myLink2.get(); + } + set myLink2(newValue) { + this.__myLink2.set(newValue); + } + get myLink3() { + return this.__myLink3.get(); + } + set myLink3(newValue) { + this.__myLink3.set(newValue); + } + get myLink4() { + return this.__myLink4.get(); + } + set myLink4(newValue) { + this.__myLink4.set(newValue); + } + render() { + } +} +loadDocument(new MyLinkComponent("1", undefined, {})); +` \ No newline at end of file diff --git a/compiler/compiler/test/ut/constructor/observedObjectLink.ts b/compiler/compiler/test/ut/constructor/observedObjectLink.ts new file mode 100644 index 000000000..1614e1512 --- /dev/null +++ b/compiler/compiler/test/ut/constructor/observedObjectLink.ts @@ -0,0 +1,142 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + +export const source: string = ` +let NextID : number = 0; + +@Observed class ClassA { + public id : number; + public c: number; + constructor(c: number) { + this.id = NextID++; + this.c = c; + } +} + +@Observed class ClassB { + public a: ClassA; + constructor(a: ClassA) { + this.a = a; + } +} + +@Component +struct ViewA { + @ObjectLink varA : ClassA; + build() { + Row() {} + } +} + +@Entry +@Component +struct ViewB { + @State varB : ClassB = new ClassB(new ClassA(0)); + build() { + Column() { + Row() { + ViewA({ varA: this.varB.a }) + } + } + } +} +` + +export const expectResult: string = +`var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +let NextID = 0; +let ClassA = class ClassA { + constructor(c) { + this.id = NextID++; + this.c = c; + } +}; +ClassA = __decorate([ + Observed +], ClassA); +let ClassB = class ClassB { + constructor(a) { + this.a = a; + } +}; +ClassB = __decorate([ + Observed +], ClassB); +class ViewA extends View { + constructor(compilerAssignedUniqueChildId, parent, params) { + super(compilerAssignedUniqueChildId, parent); + this.__varA = new SynchedPropertyNesedObject(params.varA, this, "varA"); + this.updateWithValueParams(params); + } + updateWithValueParams(params) { + this.__varA.set(params.varA); + } + aboutToBeDeleted() { + this.__varA.aboutToBeDeleted(); + SubscriberManager.Get().delete(this.id()); + } + get varA() { + return this.__varA.get(); + } + render() { + Row.create(); + Row.pop(); + } +} +class ViewB extends View { + constructor(compilerAssignedUniqueChildId, parent, params) { + super(compilerAssignedUniqueChildId, parent); + this.__varB = new ObservedPropertyObject(new ClassB(new ClassA(0)), this, "varB"); + this.updateWithValueParams(params); + } + updateWithValueParams(params) { + if (params.varB !== undefined) { + this.varB = params.varB; + } + } + aboutToBeDeleted() { + this.__varB.aboutToBeDeleted(); + SubscriberManager.Get().delete(this.id()); + } + get varB() { + return this.__varB.get(); + } + set varB(newValue) { + this.__varB.set(newValue); + } + render() { + Column.create(); + Row.create(); + let earlierCreatedChild_2 = this.findChildById("2"); + if (earlierCreatedChild_2 == undefined) { + View.create(new ViewA("2", this, { varA: this.varB.a })); + } + else { + earlierCreatedChild_2.updateWithValueParams({ + varA: this.varB.a + }); + View.create(earlierCreatedChild_2); + } + Row.pop(); + Column.pop(); + } +} +loadDocument(new ViewB("1", undefined, {})); +` \ No newline at end of file diff --git a/compiler/compiler/test/ut/constructor/prop.ts b/compiler/compiler/test/ut/constructor/prop.ts new file mode 100644 index 000000000..8765e74e5 --- /dev/null +++ b/compiler/compiler/test/ut/constructor/prop.ts @@ -0,0 +1,91 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + +export const source: string = ` +@Entry +@Component +struct MyPropComponent { + @Prop myProp1?: any + @Prop myProp2?: number + @Prop myProp3?: boolean + @Prop myProp4?: string + + private myVar: number = 0 + private myVar2: number + + build() { + + } +}` + +export const expectResult: string = +`class MyPropComponent extends View { + constructor(compilerAssignedUniqueChildId, parent, params) { + super(compilerAssignedUniqueChildId, parent); + this.__myProp2 = new SynchedPropertySimpleOneWay(params.myProp2, this, "myProp2"); + this.__myProp3 = new SynchedPropertySimpleOneWay(params.myProp3, this, "myProp3"); + this.__myProp4 = new SynchedPropertySimpleOneWay(params.myProp4, this, "myProp4"); + this.myVar = 0; + this.myVar2 = undefined; + this.updateWithValueParams(params); + } + updateWithValueParams(params) { + this.myProp1 = params.myProp1; + this.myProp2 = params.myProp2; + this.myProp3 = params.myProp3; + this.myProp4 = params.myProp4; + if (params.myVar !== undefined) { + this.myVar = params.myVar; + } + if (params.myVar2 !== undefined) { + this.myVar2 = params.myVar2; + } + } + aboutToBeDeleted() { + this.__myProp1.aboutToBeDeleted(); + this.__myProp2.aboutToBeDeleted(); + this.__myProp3.aboutToBeDeleted(); + this.__myProp4.aboutToBeDeleted(); + SubscriberManager.Get().delete(this.id()); + } + get myProp1() { + return this.__myProp1.get(); + } + set myProp1(newValue) { + this.__myProp1.set(newValue); + } + get myProp2() { + return this.__myProp2.get(); + } + set myProp2(newValue) { + this.__myProp2.set(newValue); + } + get myProp3() { + return this.__myProp3.get(); + } + set myProp3(newValue) { + this.__myProp3.set(newValue); + } + get myProp4() { + return this.__myProp4.get(); + } + set myProp4(newValue) { + this.__myProp4.set(newValue); + } + render() { + } +} +loadDocument(new MyPropComponent("1", undefined, {})); +` diff --git a/compiler/compiler/test/ut/constructor/provideConsume.ts b/compiler/compiler/test/ut/constructor/provideConsume.ts new file mode 100644 index 000000000..a8f884a1e --- /dev/null +++ b/compiler/compiler/test/ut/constructor/provideConsume.ts @@ -0,0 +1,130 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + +export const source: string = ` +@Component +struct GrandChild { + @Consume arr: number[]; + build() { + } +} + +@Component +struct Child { + build() { + Column() { + GrandChild() + } + } +} + +@Entry +@Component +struct Parent { + @Provide(provideAlias) arr: number[] = [1, 2, 3]; + build() { + Column() { + Child() + } + } +} +` + +export const expectResult: string = +`class GrandChild extends View { + constructor(compilerAssignedUniqueChildId, parent, params) { + super(compilerAssignedUniqueChildId, parent); + this.__arr = this.initializeConsume("arr", "arr"); + this.updateWithValueParams(params); + } + updateWithValueParams(params) { + } + aboutToBeDeleted() { + this.__arr.aboutToBeDeleted(); + SubscriberManager.Get().delete(this.id()); + } + get arr() { + return this.__arr.get(); + } + set arr(newValue) { + this.__arr.set(newValue); + } + render() { + } +} +class Child extends View { + constructor(compilerAssignedUniqueChildId, parent, params) { + super(compilerAssignedUniqueChildId, parent); + this.updateWithValueParams(params); + } + updateWithValueParams(params) { + } + aboutToBeDeleted() { + SubscriberManager.Get().delete(this.id()); + } + render() { + Column.create(); + let earlierCreatedChild_2 = this.findChildById("2"); + if (earlierCreatedChild_2 == undefined) { + View.create(new GrandChild("2", this, {})); + } + else { + earlierCreatedChild_2.updateWithValueParams({}); + View.create(earlierCreatedChild_2); + } + Column.pop(); + } +} +class Parent extends View { + constructor(compilerAssignedUniqueChildId, parent, params) { + super(compilerAssignedUniqueChildId, parent); + this.__arr = new ObservedPropertyObject([1, 2, 3], this, "arr"); + this.addProvidedVar("provideAlias", this.__arr); + this.addProvidedVar("arr", this.__arr); + this.updateWithValueParams(params); + } + updateWithValueParams(params) { + if (params.arr !== undefined) { + this.arr = params.arr; + } + } + aboutToBeDeleted() { + this.__arr.aboutToBeDeleted(); + SubscriberManager.Get().delete(this.id()); + } + get arr() { + return this.__arr.get(); + } + set arr(newValue) { + this.__arr.set(newValue); + } + render() { + Column.create(); + let earlierCreatedChild_3 = this.findChildById("3"); + if (earlierCreatedChild_3 == undefined) { + View.create(new Child("3", this, {})); + } + else { + earlierCreatedChild_3.updateWithValueParams({}); + if (!earlierCreatedChild_3.needsUpdate()) { + earlierCreatedChild_3.markStatic(); + } + View.create(earlierCreatedChild_3); + } + Column.pop(); + } +} +loadDocument(new Parent("1", undefined, {})); +` \ No newline at end of file diff --git a/compiler/compiler/test/ut/constructor/state.ts b/compiler/compiler/test/ut/constructor/state.ts new file mode 100644 index 000000000..9f67c7c04 --- /dev/null +++ b/compiler/compiler/test/ut/constructor/state.ts @@ -0,0 +1,121 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + +export const source: string = ` +class DataModel{ + private myData1: number = 0 +} + +@Entry +@Component +struct MyStateComponent { + @State myState1: any = { count: 0 } + @State myState2: number = 0 + @State myState3: boolean = false + @State myState4: string = 'Home' + @State myState5: DataModel = new DataModel() + + private myVar : number = 0 + private myVar2 : number + + build() { + + } +}` + +export const expectResult: string = +`class DataModel { + constructor() { + this.myData1 = 0; + } +} +class MyStateComponent extends View { + constructor(compilerAssignedUniqueChildId, parent, params) { + super(compilerAssignedUniqueChildId, parent); + this.__myState1 = new ObservedPropertyObject({ count: 0 }, this, "myState1"); + this.__myState2 = new ObservedPropertySimple(0, this, "myState2"); + this.__myState3 = new ObservedPropertySimple(false, this, "myState3"); + this.__myState4 = new ObservedPropertySimple('Home', this, "myState4"); + this.__myState5 = new ObservedPropertyObject(new DataModel(), this, "myState5"); + this.myVar = 0; + this.myVar2 = undefined; + this.updateWithValueParams(params); + } + updateWithValueParams(params) { + if (params.myState1 !== undefined) { + this.myState1 = params.myState1; + } + if (params.myState2 !== undefined) { + this.myState2 = params.myState2; + } + if (params.myState3 !== undefined) { + this.myState3 = params.myState3; + } + if (params.myState4 !== undefined) { + this.myState4 = params.myState4; + } + if (params.myState5 !== undefined) { + this.myState5 = params.myState5; + } + if (params.myVar !== undefined) { + this.myVar = params.myVar; + } + if (params.myVar2 !== undefined) { + this.myVar2 = params.myVar2; + } + } + aboutToBeDeleted() { + this.__myState1.aboutToBeDeleted(); + this.__myState2.aboutToBeDeleted(); + this.__myState3.aboutToBeDeleted(); + this.__myState4.aboutToBeDeleted(); + this.__myState5.aboutToBeDeleted(); + SubscriberManager.Get().delete(this.id()); + } + get myState1() { + return this.__myState1.get(); + } + set myState1(newValue) { + this.__myState1.set(newValue); + } + get myState2() { + return this.__myState2.get(); + } + set myState2(newValue) { + this.__myState2.set(newValue); + } + get myState3() { + return this.__myState3.get(); + } + set myState3(newValue) { + this.__myState3.set(newValue); + } + get myState4() { + return this.__myState4.get(); + } + set myState4(newValue) { + this.__myState4.set(newValue); + } + get myState5() { + return this.__myState5.get(); + } + set myState5(newValue) { + this.__myState5.set(newValue); + } + render() { + } +} +loadDocument(new MyStateComponent("1", undefined, {})); +` \ No newline at end of file diff --git a/compiler/compiler/test/ut/customDialog/customDialog.ts b/compiler/compiler/test/ut/customDialog/customDialog.ts new file mode 100644 index 000000000..b57f51314 --- /dev/null +++ b/compiler/compiler/test/ut/customDialog/customDialog.ts @@ -0,0 +1,159 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + +export const source: string = ` +@CustomDialog +struct DialogExample { + controller: CustomDialogController; + termsToAccept: string = "" + action1: () => void; + action2: (x: number, s: string) => void; + +build() { + Row() { + Button ("Option A") + .onClick(() => { + this.controller.close(); + this.action1(); + }) + Button ("Option B") + .onClick(() => { + this.controller.close(); + this.action2(47, "Option B is great choice"); + }) + } + } +} + +@Entry +@Component +struct CustomDialogUser { + dialogController : CustomDialogController = new CustomDialogController({ + builder: DialogExample({termsToAccept: "Please accept the terms.", action1: this.onAccept, action2: this.existApp}), + cancel: this.existApp, + autoCancel: false + }); + + onAccept() { + console.log("onAccept"); + } + existApp() { + console.log("Cancel dialog!"); + } + + build() { + Column() { + Button("Click to open Dialog") + .onClick(() => { + this.dialogController.open() + }) + Button("Click to close Dialog") + onClick(() => { + this.dialogController.close() + }) + } + } +} +` + +export const expectResult: string = +`class DialogExample extends View { + constructor(compilerAssignedUniqueChildId, parent, params) { + super(compilerAssignedUniqueChildId, parent); + this.controller = undefined; + this.termsToAccept = ""; + this.action1 = undefined; + this.action2 = undefined; + this.updateWithValueParams(params); + } + updateWithValueParams(params) { + if (params.controller !== undefined) { + this.controller = params.controller; + } + if (params.termsToAccept !== undefined) { + this.termsToAccept = params.termsToAccept; + } + if (params.action1 !== undefined) { + this.action1 = params.action1; + } + if (params.action2 !== undefined) { + this.action2 = params.action2; + } + } + aboutToBeDeleted() { + SubscriberManager.Get().delete(this.id()); + } + setController(ctr) { + this.controller = ctr; + } + render() { + Row.create(); + Button.createWithLabel("Option A"); + Button.onClick(() => { + this.controller.close(); + this.action1(); + }); + Button.pop(); + Button.createWithLabel("Option B"); + Button.onClick(() => { + this.controller.close(); + this.action2(47, "Option B is great choice"); + }); + Button.pop(); + Row.pop(); + } +} +class CustomDialogUser extends View { + constructor(compilerAssignedUniqueChildId, parent, params) { + super(compilerAssignedUniqueChildId, parent); + this.dialogController = new CustomDialogController({ + builder: () => { + let jsDialog = new DialogExample("2", this, { termsToAccept: "Please accept the terms.", action1: this.onAccept, action2: this.existApp }); + jsDialog.setController(this.dialogController); + View.create(jsDialog); + }, + cancel: this.existApp, + autoCancel: false + }, this); + this.updateWithValueParams(params); + } + updateWithValueParams(params) { + if (params.dialogController !== undefined) { + this.dialogController = params.dialogController; + } + } + aboutToBeDeleted() { + SubscriberManager.Get().delete(this.id()); + } + onAccept() { + console.log("onAccept"); + } + existApp() { + console.log("Cancel dialog!"); + } + render() { + Column.create(); + Button.createWithLabel("Click to open Dialog"); + Button.onClick(() => { + this.dialogController.open(); + }); + Button.pop(); + Button.createWithLabel("Click to close Dialog"); + Button.pop(); + Column.pop(); + } +} +loadDocument(new CustomDialogUser("1", undefined, {})); +` diff --git a/compiler/compiler/test/ut/decorator/builder.ts b/compiler/compiler/test/ut/decorator/builder.ts new file mode 100644 index 000000000..0bf64721d --- /dev/null +++ b/compiler/compiler/test/ut/decorator/builder.ts @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + +export const source: string = ` +@Builder +function SquareText(label: string, size: number) { + Text(label) + .width(1 * size).height(1 * size) +} + +@Builder +function bb() { + Text("label") +} + +@Entry +@Component +struct HomeComponent { + size = 1 + + @Builder aa(label: string) { + Text(label) + } + + build() { + Column() { + bb() + SquareText("A", this.size) + this.aa("A") + } + .height(500) + } +}` + +export const expectResult: string = +`function SquareText(label, size) { + Text.create(label); + Text.width(1 * size); + Text.height(1 * size); + Text.pop(); +} +function bb() { + Text.create("label"); + Text.pop(); +} +class HomeComponent extends View { + constructor(compilerAssignedUniqueChildId, parent, params) { + super(compilerAssignedUniqueChildId, parent); + this.size = 1; + this.updateWithValueParams(params); + } + updateWithValueParams(params) { + if (params.size !== undefined) { + this.size = params.size; + } + } + aboutToBeDeleted() { + SubscriberManager.Get().delete(this.id()); + } + aa(label) { + Text.create(label); + Text.pop(); + } + render() { + Column.create(); + Column.height(500); + bb(); + SquareText("A", this.size); + this.aa("A"); + Column.pop(); + } +} +loadDocument(new HomeComponent("1", undefined, {})); +` diff --git a/compiler/compiler/test/ut/decorator/extend.ts b/compiler/compiler/test/ut/decorator/extend.ts new file mode 100644 index 000000000..a8494672c --- /dev/null +++ b/compiler/compiler/test/ut/decorator/extend.ts @@ -0,0 +1,85 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + +export const source: string = ` + @Extend Text.fancy(color:string){ + .backgroundColor(color) + } + +@Extend +Text.superFancy(size:number){ + .fontSize(size) + .fancy(Color.Red) +} + +@Extend(Button) +function fancy(color:string){ + .backgroundColor(color) + .width(200) + .height(100) +} + +@Entry +@Component +struct FancyText { + build() { + Row() { + Text("Just Fancy").fancy(Color.Yellow) + Text("Super Fancy Text").height(70).superFancy(24) + Button("Fancy Button").fancy(Color.Green) + } + } +}` + +export const expectResult: string = +`function __Text__fancy(color) { + Text.backgroundColor(color); +} +function __Text__superFancy(size) { + Text.fontSize(size); + __Text__fancy(Color.Red); +} +function __Button__fancy(color) { + Button.backgroundColor(color); + Button.width(200); + Button.height(100); +} +class FancyText extends View { + constructor(compilerAssignedUniqueChildId, parent, params) { + super(compilerAssignedUniqueChildId, parent); + this.updateWithValueParams(params); + } + updateWithValueParams(params) { + } + aboutToBeDeleted() { + SubscriberManager.Get().delete(this.id()); + } + render() { + Row.create(); + Text.create("Just Fancy"); + __Text__fancy(Color.Yellow); + Text.pop(); + Text.create("Super Fancy Text"); + Text.height(70); + __Text__superFancy(24); + Text.pop(); + Button.createWithLabel("Fancy Button"); + __Button__fancy(Color.Green); + Button.pop(); + Row.pop(); + } +} +loadDocument(new FancyText("1", undefined, {})); +` \ No newline at end of file diff --git a/compiler/compiler/test/ut/decorator/watch.ts b/compiler/compiler/test/ut/decorator/watch.ts new file mode 100644 index 000000000..90c246194 --- /dev/null +++ b/compiler/compiler/test/ut/decorator/watch.ts @@ -0,0 +1,168 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + +export const source: string = ` +class PurchaseItem { + static NextId : number = 0; + + public id: number; + public price: number; + + constructor(price : number) { + this.id = PurchaseItem.NextId++; + this.price = price; + } +} + +@Component +struct BasketViewer { + @Link @Watch("onBasketUpdated") shopBasket : PurchaseItem[]; + @State @Watch('updateTotal') totalPurchase : number = this.updateTotal(); + updateTotal() : number { + let sum = 0; + this.shopBasket.forEach((i) => { sum += i.price; }); + this.totalPurchase = (sum < 100) ? sum : 0.9 * sum; + return this.totalPurchase; + } + // @Watch cb + onBasketUpdated(propName: string) : void { + this.updateTotal(); + } + build() { + Column() { + ForEach(this.shopBasket, + (item) => { + Text(item.price) + }, + item => item.id.toString() + ) + Text('this.totalPurchase') + } + } +} + +@Entry +@Component +struct BasketModifier { + @State shopBasket : PurchaseItem[] = [ ]; + build() { + Column() { + Button("add to basket") + .onClick(() => { this.shopBasket.push(new PurchaseItem(Math.round(100 * Math.random()))) }) + BasketViewer({shopBasket: this.$shopBasket}) + } + } +}` + +export const expectResult: string = +`class PurchaseItem { + constructor(price) { + this.id = PurchaseItem.NextId++; + this.price = price; + } +} +PurchaseItem.NextId = 0; +class BasketViewer extends View { + constructor(compilerAssignedUniqueChildId, parent, params) { + super(compilerAssignedUniqueChildId, parent); + this.__shopBasket = new SynchedPropertyObjectTwoWay(params.shopBasket, this, "shopBasket"); + this.__totalPurchase = new ObservedPropertySimple(this.updateTotal(), this, "totalPurchase"); + this.updateWithValueParams(params); + this.declareWatch("shopBasket", this.onBasketUpdated); + this.declareWatch("totalPurchase", this.updateTotal); + } + updateWithValueParams(params) { + if (params.totalPurchase !== undefined) { + this.totalPurchase = params.totalPurchase; + } + } + aboutToBeDeleted() { + this.__shopBasket.aboutToBeDeleted(); + this.__totalPurchase.aboutToBeDeleted(); + SubscriberManager.Get().delete(this.id()); + } + get shopBasket() { + return this.__shopBasket.get(); + } + set shopBasket(newValue) { + this.__shopBasket.set(newValue); + } + get totalPurchase() { + return this.__totalPurchase.get(); + } + set totalPurchase(newValue) { + this.__totalPurchase.set(newValue); + } + updateTotal() { + let sum = 0; + this.shopBasket.forEach((i) => { sum += i.price; }); + this.totalPurchase = (sum < 100) ? sum : 0.9 * sum; + return this.totalPurchase; + } + // @Watch cb + onBasketUpdated(propName) { + this.updateTotal(); + } + render() { + Column.create(); + ForEach.create("2", this, ObservedObject.GetRawObject(this.shopBasket), (item) => { + Text.create(item.price); + Text.pop(); + }, item => item.id.toString()); + ForEach.pop(); + Text.create('this.totalPurchase'); + Text.pop(); + Column.pop(); + } +} +class BasketModifier extends View { + constructor(compilerAssignedUniqueChildId, parent, params) { + super(compilerAssignedUniqueChildId, parent); + this.__shopBasket = new ObservedPropertyObject([], this, "shopBasket"); + this.updateWithValueParams(params); + } + updateWithValueParams(params) { + if (params.shopBasket !== undefined) { + this.shopBasket = params.shopBasket; + } + } + aboutToBeDeleted() { + this.__shopBasket.aboutToBeDeleted(); + SubscriberManager.Get().delete(this.id()); + } + get shopBasket() { + return this.__shopBasket.get(); + } + set shopBasket(newValue) { + this.__shopBasket.set(newValue); + } + render() { + Column.create(); + Button.createWithLabel("add to basket"); + Button.onClick(() => { this.shopBasket.push(new PurchaseItem(Math.round(100 * Math.random()))); }); + Button.pop(); + let earlierCreatedChild_3 = this.findChildById("3"); + if (earlierCreatedChild_3 == undefined) { + View.create(new BasketViewer("3", this, { shopBasket: this.__shopBasket })); + } + else { + earlierCreatedChild_3.updateWithValueParams({}); + View.create(earlierCreatedChild_3); + } + Column.pop(); + } +} +loadDocument(new BasketModifier("1", undefined, {})); +` \ No newline at end of file diff --git a/compiler/compiler/test/ut/decorator/watchWithAnimateTo.ts b/compiler/compiler/test/ut/decorator/watchWithAnimateTo.ts new file mode 100644 index 000000000..dc728962d --- /dev/null +++ b/compiler/compiler/test/ut/decorator/watchWithAnimateTo.ts @@ -0,0 +1,148 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + +export const source: string = ` +@Entry +@Component +struct ListComponent { + @State dialogVis : boolean = false + build() { + Stack() { + MyAlertDialog({dialogVis: $dialogVis}) + } + } +} + +@Component +struct MyAlertDialog { + @Link @Watch("onDialogVisUpdated") dialogVis : boolean; + onDialogVisUpdated(propName: string) : void { + animateTo({}, () => {}) + } + build() { + Stack() { + DialogView({dialogShow: $dialogVis}).onClick(() => { + animateTo({}, () => {}) + }) + } + } +} + +@Component +struct DialogView { + @Link dialogShow: boolean + build() { + Column() {} + } +} +` + +export const expectResult: string = +`class ListComponent extends View { + constructor(compilerAssignedUniqueChildId, parent, params) { + super(compilerAssignedUniqueChildId, parent); + this.__dialogVis = new ObservedPropertySimple(false, this, "dialogVis"); + this.updateWithValueParams(params); + } + updateWithValueParams(params) { + if (params.dialogVis !== undefined) { + this.dialogVis = params.dialogVis; + } + } + aboutToBeDeleted() { + this.__dialogVis.aboutToBeDeleted(); + SubscriberManager.Get().delete(this.id()); + } + get dialogVis() { + return this.__dialogVis.get(); + } + set dialogVis(newValue) { + this.__dialogVis.set(newValue); + } + render() { + Stack.create(); + let earlierCreatedChild_2 = this.findChildById("2"); + if (earlierCreatedChild_2 == undefined) { + View.create(new MyAlertDialog("2", this, { dialogVis: this.__dialogVis })); + } + else { + earlierCreatedChild_2.updateWithValueParams({}); + View.create(earlierCreatedChild_2); + } + Stack.pop(); + } +} +class MyAlertDialog extends View { + constructor(compilerAssignedUniqueChildId, parent, params) { + super(compilerAssignedUniqueChildId, parent); + this.__dialogVis = new SynchedPropertySimpleTwoWay(params.dialogVis, this, "dialogVis"); + this.updateWithValueParams(params); + this.declareWatch("dialogVis", this.onDialogVisUpdated); + } + updateWithValueParams(params) { + } + aboutToBeDeleted() { + this.__dialogVis.aboutToBeDeleted(); + SubscriberManager.Get().delete(this.id()); + } + get dialogVis() { + return this.__dialogVis.get(); + } + set dialogVis(newValue) { + this.__dialogVis.set(newValue); + } + onDialogVisUpdated(propName) { + Context.animateTo({}, () => { }); + } + render() { + Stack.create(); + let earlierCreatedChild_2 = this.findChildById("2"); + if (earlierCreatedChild_2 == undefined) { + View.create(new (DialogView({ dialogShow: this.__dialogVis }).onClick)(() => { + Context.animateTo({}, () => { }); + })); + } + else { + earlierCreatedChild_2.updateWithValueParams({}); + View.create(earlierCreatedChild_2); + } + Stack.pop(); + } +} +class DialogView extends View { + constructor(compilerAssignedUniqueChildId, parent, params) { + super(compilerAssignedUniqueChildId, parent); + this.__dialogShow = new SynchedPropertySimpleTwoWay(params.dialogShow, this, "dialogShow"); + this.updateWithValueParams(params); + } + updateWithValueParams(params) { + } + aboutToBeDeleted() { + this.__dialogShow.aboutToBeDeleted(); + SubscriberManager.Get().delete(this.id()); + } + get dialogShow() { + return this.__dialogShow.get(); + } + set dialogShow(newValue) { + this.__dialogShow.set(newValue); + } + render() { + Column.create(); + Column.pop(); + } +} +loadDocument(new ListComponent("1", undefined, {})); +` \ No newline at end of file diff --git a/compiler/compiler/test/ut/geometryReader/geometryReader.ts b/compiler/compiler/test/ut/geometryReader/geometryReader.ts new file mode 100644 index 000000000..e8b5b6c4f --- /dev/null +++ b/compiler/compiler/test/ut/geometryReader/geometryReader.ts @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + +export const source: string = ` +@Entry +@Component +struct GeometryReaderTest { + build() { + Column() { + GeometryView((obj) => { + Column() { + Text("Text in GeometryView, Height:" + obj.height) + .fontSize(30) + } + }).backgroundColor(Color.Yellow) + } + } +} +` + +export const expectResult: string = +`class GeometryReaderTest extends View { + constructor(compilerAssignedUniqueChildId, parent, params) { + super(compilerAssignedUniqueChildId, parent); + this.updateWithValueParams(params); + } + updateWithValueParams(params) { + } + aboutToBeDeleted() { + SubscriberManager.Get().delete(this.id()); + } + render() { + Column.create(); + GeometryView.create((obj) => { + Column.create(); + Text.create("Text in GeometryView, Height:" + obj.height); + Text.fontSize(30); + Text.pop(); + Column.pop(); + }); + GeometryView.backgroundColor(Color.Yellow); + Column.pop(); + } +} +loadDocument(new GeometryReaderTest("1", undefined, {})); +` diff --git a/compiler/compiler/test/ut/gesture/panGestrue.ts b/compiler/compiler/test/ut/gesture/panGestrue.ts new file mode 100644 index 000000000..f558964a4 --- /dev/null +++ b/compiler/compiler/test/ut/gesture/panGestrue.ts @@ -0,0 +1,279 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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/LICENSE2.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. + */ + +export const source: string = ` +import router from '@system.router' +import app from '@system.app' + +@Entry +@Component +struct MyComponent { + @State offsetX1: double = 0 + @State offsetY1: double = 0 + @State offsetX2: double = 0 + @State offsetY2: double = 0 + @State offsetX3: double = 0 + @State offsetY3: double = 0 + + build() { + Column() { + Text('fingers:1,all,offsetX: ' + this.offsetX1 + ' offsetY: ' + this.offsetY1) + .fontSize(25) + .width(200) + .height(200) + .backgroundColor('red') + .gesture( + PanGesture({fingers: 1, direction: Direction.All, distance: 15}) + .onActionStart((event: GestureEvent) => { + this.offsetX1 = event.offsetX + this.offsetY1 = event.offsetY + console.error('pan gesture on clicked') + }) + .onActionUpdate((event: GestureEvent) => { + this.offsetX1 = event.offsetX + this.offsetY1 = event.offsetY + console.error('pan gesture on clicked') + }) + .onActionEnd((event: GestureEvent) => { + this.offsetX1 = event.offsetX + this.offsetY1 = event.offsetY + console.error('pan gesture on clicked') + }) + .onActionCancel(() => { + }) + ) + + Text('fingers:1,horizontal,offsetX: ' + this.offsetX2 + ' offsetY: ' + this.offsetY2) + .fontSize(25) + .width(400) + .height(200) + .backgroundColor('green') + .gesture( + PanGesture({fingers: 1, direction: Direction.Horizontal, distance: 15}) + .onActionStart((event: GestureEvent) => { + this.offsetX2 = event.offsetX + this.offsetY2 = event.offsetY + console.error('pan gesture on clicked') + }) + .onActionUpdate((event: GestureEvent) => { + this.offsetX2 = event.offsetX + this.offsetY2 = event.offsetY + console.error('pan gesture on clicked') + }) + .onActionEnd((event: GestureEvent) => { + this.offsetX2 = event.offsetX + this.offsetY2 = event.offsetY + console.error('pan gesture on clicked') + }) + .onActionCancel(() => { + }) + ) + + Text('fingers:1,vertical,offsetX: ' + this.offsetX3 + ' offsetY: ' + this.offsetY3) + .fontSize(25) + .width(200) + .height(400) + .backgroundColor('blue') + .gesture( + PanGesture({fingers: 1, direction: Direction.Vertical, distance: 15}) + .onActionStart((event: GestureEvent) => { + this.offsetX3 = event.offsetX + this.offsetY3 = event.offsetY + console.error('pan gesture on clicked') + }) + .onActionUpdate((event: GestureEvent) => { + this.offsetX3 = event.offsetX + this.offsetY3 = event.offsetY + console.error('pan gesture on clicked') + }) + .onActionEnd((event: GestureEvent) => { + this.offsetX3 = event.offsetX + this.offsetY3 = event.offsetY + console.error('pan gesture on clicked') + }) + .onActionCancel(() => { + }) + ) + } + } +}` + +export const expectResult: string = +`var router = globalThis.requireNativeModule('system.router'); +var app = globalThis.requireNativeModule('system.app'); +class MyComponent extends View { + constructor(compilerAssignedUniqueChildId, parent, params) { + super(compilerAssignedUniqueChildId, parent); + this.__offsetX1 = new ObservedPropertyObject(0, this, "offsetX1"); + this.__offsetY1 = new ObservedPropertyObject(0, this, "offsetY1"); + this.__offsetX2 = new ObservedPropertyObject(0, this, "offsetX2"); + this.__offsetY2 = new ObservedPropertyObject(0, this, "offsetY2"); + this.__offsetX3 = new ObservedPropertyObject(0, this, "offsetX3"); + this.__offsetY3 = new ObservedPropertyObject(0, this, "offsetY3"); + this.updateWithValueParams(params); + } + updateWithValueParams(params) { + if (params.offsetX1 !== undefined) { + this.offsetX1 = params.offsetX1; + } + if (params.offsetY1 !== undefined) { + this.offsetY1 = params.offsetY1; + } + if (params.offsetX2 !== undefined) { + this.offsetX2 = params.offsetX2; + } + if (params.offsetY2 !== undefined) { + this.offsetY2 = params.offsetY2; + } + if (params.offsetX3 !== undefined) { + this.offsetX3 = params.offsetX3; + } + if (params.offsetY3 !== undefined) { + this.offsetY3 = params.offsetY3; + } + } + aboutToBeDeleted() { + this.__offsetX1.aboutToBeDeleted(); + this.__offsetY1.aboutToBeDeleted(); + this.__offsetX2.aboutToBeDeleted(); + this.__offsetY2.aboutToBeDeleted(); + this.__offsetX3.aboutToBeDeleted(); + this.__offsetY3.aboutToBeDeleted(); + SubscriberManager.Get().delete(this.id()); + } + get offsetX1() { + return this.__offsetX1.get(); + } + set offsetX1(newValue) { + this.__offsetX1.set(newValue); + } + get offsetY1() { + return this.__offsetY1.get(); + } + set offsetY1(newValue) { + this.__offsetY1.set(newValue); + } + get offsetX2() { + return this.__offsetX2.get(); + } + set offsetX2(newValue) { + this.__offsetX2.set(newValue); + } + get offsetY2() { + return this.__offsetY2.get(); + } + set offsetY2(newValue) { + this.__offsetY2.set(newValue); + } + get offsetX3() { + return this.__offsetX3.get(); + } + set offsetX3(newValue) { + this.__offsetX3.set(newValue); + } + get offsetY3() { + return this.__offsetY3.get(); + } + set offsetY3(newValue) { + this.__offsetY3.set(newValue); + } + render() { + Column.create(); + Text.create('fingers:1,all,offsetX: ' + this.offsetX1 + ' offsetY: ' + this.offsetY1); + Text.fontSize(25); + Text.width(200); + Text.height(200); + Text.backgroundColor('red'); + Gesture.create(GesturePriority.Low); + PanGesture.create({ fingers: 1, direction: Direction.All, distance: 15 }); + PanGesture.onActionStart((event) => { + this.offsetX1 = event.offsetX; + this.offsetY1 = event.offsetY; + console.error('pan gesture on clicked'); + }); + PanGesture.onActionUpdate((event) => { + this.offsetX1 = event.offsetX; + this.offsetY1 = event.offsetY; + console.error('pan gesture on clicked'); + }); + PanGesture.onActionEnd((event) => { + this.offsetX1 = event.offsetX; + this.offsetY1 = event.offsetY; + console.error('pan gesture on clicked'); + }); + PanGesture.onActionCancel(() => { + }); + PanGesture.pop(); + Gesture.pop(); + Text.pop(); + Text.create('fingers:1,horizontal,offsetX: ' + this.offsetX2 + ' offsetY: ' + this.offsetY2); + Text.fontSize(25); + Text.width(400); + Text.height(200); + Text.backgroundColor('green'); + Gesture.create(GesturePriority.Low); + PanGesture.create({ fingers: 1, direction: Direction.Horizontal, distance: 15 }); + PanGesture.onActionStart((event) => { + this.offsetX2 = event.offsetX; + this.offsetY2 = event.offsetY; + console.error('pan gesture on clicked'); + }); + PanGesture.onActionUpdate((event) => { + this.offsetX2 = event.offsetX; + this.offsetY2 = event.offsetY; + console.error('pan gesture on clicked'); + }); + PanGesture.onActionEnd((event) => { + this.offsetX2 = event.offsetX; + this.offsetY2 = event.offsetY; + console.error('pan gesture on clicked'); + }); + PanGesture.onActionCancel(() => { + }); + PanGesture.pop(); + Gesture.pop(); + Text.pop(); + Text.create('fingers:1,vertical,offsetX: ' + this.offsetX3 + ' offsetY: ' + this.offsetY3); + Text.fontSize(25); + Text.width(200); + Text.height(400); + Text.backgroundColor('blue'); + Gesture.create(GesturePriority.Low); + PanGesture.create({ fingers: 1, direction: Direction.Vertical, distance: 15 }); + PanGesture.onActionStart((event) => { + this.offsetX3 = event.offsetX; + this.offsetY3 = event.offsetY; + console.error('pan gesture on clicked'); + }); + PanGesture.onActionUpdate((event) => { + this.offsetX3 = event.offsetX; + this.offsetY3 = event.offsetY; + console.error('pan gesture on clicked'); + }); + PanGesture.onActionEnd((event) => { + this.offsetX3 = event.offsetX; + this.offsetY3 = event.offsetY; + console.error('pan gesture on clicked'); + }); + PanGesture.onActionCancel(() => { + }); + PanGesture.pop(); + Gesture.pop(); + Text.pop(); + Column.pop(); + } +} +loadDocument(new MyComponent("1", undefined, {})); +` diff --git a/compiler/compiler/test/ut/gesture/pinchGesture.ts b/compiler/compiler/test/ut/gesture/pinchGesture.ts new file mode 100644 index 000000000..c85947f2b --- /dev/null +++ b/compiler/compiler/test/ut/gesture/pinchGesture.ts @@ -0,0 +1,107 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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/LICENSE2.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. + */ + +export const source: string = ` +import router from '@system.router' +import app from '@system.app' + +@Entry +@Component +struct MyComponent { + @State text_num: float = 0.0 + + build() { + Column() { + Text('fingers:2,scale: ' + this.text_num) + .fontSize(25) + .width(400) + .height(400) + .backgroundColor('red') + .gesture( + PinchGesture({fingers: 2, distance: 18}) + .onActionStart((event: GestureEvent) => { + this.text_num = event.scale + console.error('pinch gesture on clicked') + }) + .onActionUpdate((event: GestureEvent) => { + this.text_num = event.scale + console.error('pinch gesture on clicked') + }) + .onActionEnd((event: GestureEvent) => { + this.text_num = event.scale + console.error('pinch gesture on clicked') + }) + .onActionCancel(() => { + }) + ) + } + } +}` + +export const expectResult: string = +`var router = globalThis.requireNativeModule('system.router'); +var app = globalThis.requireNativeModule('system.app'); +class MyComponent extends View { + constructor(compilerAssignedUniqueChildId, parent, params) { + super(compilerAssignedUniqueChildId, parent); + this.__text_num = new ObservedPropertyObject(0.0, this, "text_num"); + this.updateWithValueParams(params); + } + updateWithValueParams(params) { + if (params.text_num !== undefined) { + this.text_num = params.text_num; + } + } + aboutToBeDeleted() { + this.__text_num.aboutToBeDeleted(); + SubscriberManager.Get().delete(this.id()); + } + get text_num() { + return this.__text_num.get(); + } + set text_num(newValue) { + this.__text_num.set(newValue); + } + render() { + Column.create(); + Text.create('fingers:2,scale: ' + this.text_num); + Text.fontSize(25); + Text.width(400); + Text.height(400); + Text.backgroundColor('red'); + Gesture.create(GesturePriority.Low); + PinchGesture.create({ fingers: 2, distance: 18 }); + PinchGesture.onActionStart((event) => { + this.text_num = event.scale; + console.error('pinch gesture on clicked'); + }); + PinchGesture.onActionUpdate((event) => { + this.text_num = event.scale; + console.error('pinch gesture on clicked'); + }); + PinchGesture.onActionEnd((event) => { + this.text_num = event.scale; + console.error('pinch gesture on clicked'); + }); + PinchGesture.onActionCancel(() => { + }); + PinchGesture.pop(); + Gesture.pop(); + Text.pop(); + Column.pop(); + } +} +loadDocument(new MyComponent("1", undefined, {})); +` diff --git a/compiler/compiler/test/ut/gesture/rotationGesture.ts b/compiler/compiler/test/ut/gesture/rotationGesture.ts new file mode 100644 index 000000000..87c0b76e9 --- /dev/null +++ b/compiler/compiler/test/ut/gesture/rotationGesture.ts @@ -0,0 +1,108 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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/LICENSE2.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. + */ + +export const source: string = ` +import router from '@system.router' +import app from '@system.app' + +@Entry +@Component +struct MyComponent { + @State text_num: number = 0.0 + + build() { + Column() { + Text('fingers:2,angle: ' + this.text_num) + .fontSize(25) + .width(400) + .height(400) + .backgroundColor('red') + .gesture( + RotationGesture({fingers: 2, angle: 5}) + .onActionStart((event: GestureEvent) => { + this.text_num = event.angle + console.error('rotation gesture on clicked') + }) + .onActionUpdate((event: GestureEvent) => { + this.text_num = event.angle + console.error('rotation gesture on clicked') + }) + .onActionEnd((event: GestureEvent) => { + this.text_num = event.angle + console.error('rotation gesture on clicked') + }) + .onActionCancel(() => { + }) + ) + + } + } +}` + +export const expectResult: string = +`var router = globalThis.requireNativeModule('system.router'); +var app = globalThis.requireNativeModule('system.app'); +class MyComponent extends View { + constructor(compilerAssignedUniqueChildId, parent, params) { + super(compilerAssignedUniqueChildId, parent); + this.__text_num = new ObservedPropertySimple(0.0, this, "text_num"); + this.updateWithValueParams(params); + } + updateWithValueParams(params) { + if (params.text_num !== undefined) { + this.text_num = params.text_num; + } + } + aboutToBeDeleted() { + this.__text_num.aboutToBeDeleted(); + SubscriberManager.Get().delete(this.id()); + } + get text_num() { + return this.__text_num.get(); + } + set text_num(newValue) { + this.__text_num.set(newValue); + } + render() { + Column.create(); + Text.create('fingers:2,angle: ' + this.text_num); + Text.fontSize(25); + Text.width(400); + Text.height(400); + Text.backgroundColor('red'); + Gesture.create(GesturePriority.Low); + RotationGesture.create({ fingers: 2, angle: 5 }); + RotationGesture.onActionStart((event) => { + this.text_num = event.angle; + console.error('rotation gesture on clicked'); + }); + RotationGesture.onActionUpdate((event) => { + this.text_num = event.angle; + console.error('rotation gesture on clicked'); + }); + RotationGesture.onActionEnd((event) => { + this.text_num = event.angle; + console.error('rotation gesture on clicked'); + }); + RotationGesture.onActionCancel(() => { + }); + RotationGesture.pop(); + Gesture.pop(); + Text.pop(); + Column.pop(); + } +} +loadDocument(new MyComponent("1", undefined, {})); +` diff --git a/compiler/compiler/test/ut/gesture/tapGesture.ts b/compiler/compiler/test/ut/gesture/tapGesture.ts new file mode 100644 index 000000000..436553286 --- /dev/null +++ b/compiler/compiler/test/ut/gesture/tapGesture.ts @@ -0,0 +1,177 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + +export const source: string = ` +@Entry +@Component +struct MyComponent { + build() { + Column() { + Text("222").width(12) + .gesture( + GestureGroup( + GestureMode.Sequence, + LongPressGesture() + .onAction(()=> { + console.error('long press gesture recognized') + }) + , + PanGesture() + .onActionStart(()=> { + console.error('pan gesture start') + }), + GestureGroup( + GestureMode.Sequence, + LongPressGesture() + .onAction(()=> { + console.error('long press gesture recognized') + }) + , + PanGesture() + .onActionStart(()=> { + console.error('pan gesture start') + }) + ) + ) + .onCancel(()=> { + console.error('sequence gesture canceled') + }) + ) + .height(21) + Text("333").width(33).parallelGesture( + TapGesture({count: 1, fingers:2}) + .onAction((event)=> { + console.error('parallel gesture tap gesture recognized') + }) + ) + Text("444").priorityGesture( + TapGesture({count: 1, fingers:2}) + .onAction((event)=> { + console.error('two fingers tap gesture recognized') + }), + GestureMask.IgnoreInternal + ) + } + .width(12) + .gesture( + GestureGroup( + GestureMode.Sequence, + LongPressGesture() + .onAction(()=> { + console.error('long press gesture recognized') + }) + , + PanGesture() + .onActionStart(()=> { + console.error('pan gesture start') + }) + ) + .onCancel(()=> { + console.error('sequence gesture canceled') + }) + ) + .height(21) + } +}` + +export const expectResult: string = +`class MyComponent extends View { + constructor(compilerAssignedUniqueChildId, parent, params) { + super(compilerAssignedUniqueChildId, parent); + this.updateWithValueParams(params); + } + updateWithValueParams(params) { + } + aboutToBeDeleted() { + SubscriberManager.Get().delete(this.id()); + } + render() { + Column.create(); + Column.width(12); + Gesture.create(GesturePriority.Low); + GestureGroup.create(GestureMode.Sequence); + GestureGroup.onCancel(() => { + console.error('sequence gesture canceled'); + }); + LongPressGesture.create(); + LongPressGesture.onAction(() => { + console.error('long press gesture recognized'); + }); + LongPressGesture.pop(); + PanGesture.create(); + PanGesture.onActionStart(() => { + console.error('pan gesture start'); + }); + PanGesture.pop(); + GestureGroup.pop(); + Gesture.pop(); + Column.height(21); + Text.create("222"); + Text.width(12); + Gesture.create(GesturePriority.Low); + GestureGroup.create(GestureMode.Sequence); + GestureGroup.onCancel(() => { + console.error('sequence gesture canceled'); + }); + LongPressGesture.create(); + LongPressGesture.onAction(() => { + console.error('long press gesture recognized'); + }); + LongPressGesture.pop(); + PanGesture.create(); + PanGesture.onActionStart(() => { + console.error('pan gesture start'); + }); + PanGesture.pop(); + GestureGroup.create(GestureMode.Sequence); + LongPressGesture.create(); + LongPressGesture.onAction(() => { + console.error('long press gesture recognized'); + }); + LongPressGesture.pop(); + PanGesture.create(); + PanGesture.onActionStart(() => { + console.error('pan gesture start'); + }); + PanGesture.pop(); + GestureGroup.pop(); + GestureGroup.pop(); + Gesture.pop(); + Text.height(21); + Text.pop(); + Text.create("333"); + Text.width(33); + Gesture.create(GesturePriority.Parallel); + TapGesture.create({ count: 1, fingers: 2 }); + TapGesture.onAction((event) => { + console.error('parallel gesture tap gesture recognized'); + }); + TapGesture.pop(); + Gesture.pop(); + Text.pop(); + Text.create("444"); + Gesture.create(GesturePriority.High, GestureMask.IgnoreInternal); + TapGesture.create({ count: 1, fingers: 2 }); + TapGesture.onAction((event) => { + console.error('two fingers tap gesture recognized'); + }); + TapGesture.pop(); + Gesture.pop(); + Text.pop(); + Column.pop(); + } +} +loadDocument(new MyComponent("1", undefined, {})); +` diff --git a/compiler/compiler/test/ut/import/importEts.ts b/compiler/compiler/test/ut/import/importEts.ts new file mode 100644 index 000000000..783eb14a0 --- /dev/null +++ b/compiler/compiler/test/ut/import/importEts.ts @@ -0,0 +1,408 @@ +/* + * Copyright (c) 2020 Huawei Device Co., Ltd. + * 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. + */ + +export const source: string = ` +import + LinkComponentDefault, { + LinkComponent as LinkComponent1Ref, + LinkComponent2 as LinkComponent2Ref, + LinkComponent3 +} from './test/pages/LinkComponent.ets' +import DefaultComponent from "./test/pages/DefaultComponent.ets" +import * as AllComponent from './test/pages/NamespaceComponent' +import AMDComponentDefault = require('./test/pages/AMDComponent') +import { AllStarComponent } from './test/pages/ExportStarComponent' +import TsModule = require('./test/pages/TsModule') + +@Entry +@Component +struct ImportTest { + @State myState1: any = new TsModule(1).method() + @State myState2: number = 0 + @State myState3: boolean = false + @State myState4: string = 'ImportTest' + + build() { + Row() { + LinkComponent2Ref({ + LinkComponent2Link1: $myState1, + LinkComponent2Link2: this.$myState2, + LinkComponent2Link3: $myState3, + LinkComponent2Link4: $myState4, + indexState1: { count: 1 }, + indexState2: 1, + indexState3: true, + indexState4: 'LinkComponent2' + }) + Text('space') + LinkComponent1Ref({ + LinkComponent1Link1: $myState1, + LinkComponent1Link2: this.$myState2, + LinkComponent1Link3: $myState3, + LinkComponent1Link4: $myState4, + indexState1: { count: 1 }, + indexState2: 1, + indexState3: true, + indexState4: 'LinkComponent1' + }) + DefaultComponent({ + DefaultComponentLink1: $myState1, + DefaultComponentLink2: this.$myState2, + DefaultComponentLink3: $myState3, + DefaultComponentLink4: $myState4, + myVar: 100, + myVar2: 100 + }) + AllComponent.NamespaceComponent1({ + NamespaceComponent1Link1: $myState1, + NamespaceComponent1Link2: this.$myState2, + NamespaceComponent1Link3: $myState3, + NamespaceComponent1Link4: $myState4, + myVar: 100, + myVar2: 80 + }) + LinkComponentDefault({ + LinkComponent3Link1: $myState1, + LinkComponent3Link2: this.$myState2, + LinkComponent3Link3: $myState3, + LinkComponent3Link4: $myState4, + indexState1: { count: 1 }, + indexState2: 1, + indexState3: true, + indexState4: 'LinkComponent3' + }) + AMDComponentDefault({ + AMDComponentLink1: $myState1, + AMDComponentLink2: this.$myState2, + AMDComponentLink3: $myState3, + AMDComponentLink4: $myState4, + myVar: 100, + myVar2: 100 + }) + LinkComponent3({ + LinkComponent3Link1: $myState1, + LinkComponent3Link2: this.$myState2, + LinkComponent3Link3: $myState3, + LinkComponent3Link4: $myState4, + indexState1: { count: 1 }, + indexState2: 1, + indexState3: true, + indexState4: 'LinkComponent1' + }) + AllStarComponent.ExportComponent({ + ExportComponent1Link1: $myState1, + ExportComponent1Link2: this.$myState2, + ExportComponent1Link3: $myState3, + ExportComponent1Link4: $myState4, + indexState1: { count: 1 }, + indexState2: 1, + indexState3: true, + indexState4: 'ExportComponent1' + }) + AllStarComponent.default({ + ExportComponent4Link1: $myState1, + ExportComponent4Link2: this.$myState2, + ExportComponent4Link3: $myState3, + ExportComponent4Link4: $myState4, + indexState1: { count: 1 }, + indexState2: 1, + indexState3: true, + indexState4: 'ExportComponent4' + }) + AllComponent.default({ + NamespaceComponent3Link1: $myState1, + NamespaceComponent3Link2: this.$myState2, + NamespaceComponent3Link3: $myState3, + NamespaceComponent3Link4: $myState4, + myVar: 100, + myVar2: 80 + }) + } + } +} +` + +export const expectResult: string = +`import LinkComponentDefault, { LinkComponent as LinkComponent1Ref, LinkComponent2 as LinkComponent2Ref, LinkComponent3 } from './test/pages/LinkComponent.ets'; +import DefaultComponent from "./test/pages/DefaultComponent.ets"; +import * as AllComponent from './test/pages/NamespaceComponent'; +import { AllStarComponent } from './test/pages/ExportStarComponent'; +class ImportTest extends View { + constructor(compilerAssignedUniqueChildId, parent, params) { + super(compilerAssignedUniqueChildId, parent); + this.__myState1 = new ObservedPropertyObject(new TsModule(1).method(), this, "myState1"); + this.__myState2 = new ObservedPropertySimple(0, this, "myState2"); + this.__myState3 = new ObservedPropertySimple(false, this, "myState3"); + this.__myState4 = new ObservedPropertySimple('ImportTest', this, "myState4"); + this.updateWithValueParams(params); + } + updateWithValueParams(params) { + if (params.myState1 !== undefined) { + this.myState1 = params.myState1; + } + if (params.myState2 !== undefined) { + this.myState2 = params.myState2; + } + if (params.myState3 !== undefined) { + this.myState3 = params.myState3; + } + if (params.myState4 !== undefined) { + this.myState4 = params.myState4; + } + } + aboutToBeDeleted() { + this.__myState1.aboutToBeDeleted(); + this.__myState2.aboutToBeDeleted(); + this.__myState3.aboutToBeDeleted(); + this.__myState4.aboutToBeDeleted(); + SubscriberManager.Get().delete(this.id()); + } + get myState1() { + return this.__myState1.get(); + } + set myState1(newValue) { + this.__myState1.set(newValue); + } + get myState2() { + return this.__myState2.get(); + } + set myState2(newValue) { + this.__myState2.set(newValue); + } + get myState3() { + return this.__myState3.get(); + } + set myState3(newValue) { + this.__myState3.set(newValue); + } + get myState4() { + return this.__myState4.get(); + } + set myState4(newValue) { + this.__myState4.set(newValue); + } + render() { + Row.create(); + let earlierCreatedChild_2 = this.findChildById("2"); + if (earlierCreatedChild_2 == undefined) { + View.create(new LinkComponent2Ref("2", this, { + LinkComponent2Link1: this.__myState1, + LinkComponent2Link2: this.__myState2, + LinkComponent2Link3: this.__myState3, + LinkComponent2Link4: this.__myState4, + indexState1: { count: 1 }, + indexState2: 1, + indexState3: true, + indexState4: 'LinkComponent2' + })); + } + else { + earlierCreatedChild_2.updateWithValueParams({ + indexState1: { count: 1 }, + indexState2: 1, + indexState3: true, + indexState4: 'LinkComponent2' + }); + View.create(earlierCreatedChild_2); + } + Text.create('space'); + Text.pop(); + let earlierCreatedChild_3 = this.findChildById("3"); + if (earlierCreatedChild_3 == undefined) { + View.create(new LinkComponent1Ref("3", this, { + LinkComponent1Link1: this.__myState1, + LinkComponent1Link2: this.__myState2, + LinkComponent1Link3: this.__myState3, + LinkComponent1Link4: this.__myState4, + indexState1: { count: 1 }, + indexState2: 1, + indexState3: true, + indexState4: 'LinkComponent1' + })); + } + else { + earlierCreatedChild_3.updateWithValueParams({ + indexState1: { count: 1 }, + indexState2: 1, + indexState3: true, + indexState4: 'LinkComponent1' + }); + View.create(earlierCreatedChild_3); + } + let earlierCreatedChild_4 = this.findChildById("4"); + if (earlierCreatedChild_4 == undefined) { + View.create(new DefaultComponent("4", this, { + DefaultComponentLink1: this.__myState1, + DefaultComponentLink2: this.__myState2, + DefaultComponentLink3: this.__myState3, + DefaultComponentLink4: this.__myState4, + myVar: 100, + myVar2: 100 + })); + } + else { + earlierCreatedChild_4.updateWithValueParams({ + myVar: 100, + myVar2: 100 + }); + View.create(earlierCreatedChild_4); + } + let earlierCreatedChild_5 = this.findChildById("5"); + if (earlierCreatedChild_5 == undefined) { + View.create(new AllComponent.NamespaceComponent1("5", this, { + NamespaceComponent1Link1: this.__myState1, + NamespaceComponent1Link2: this.__myState2, + NamespaceComponent1Link3: this.__myState3, + NamespaceComponent1Link4: this.__myState4, + myVar: 100, + myVar2: 80 + })); + } + else { + earlierCreatedChild_5.updateWithValueParams({ + myVar: 100, + myVar2: 80 + }); + View.create(earlierCreatedChild_5); + } + let earlierCreatedChild_6 = this.findChildById("6"); + if (earlierCreatedChild_6 == undefined) { + View.create(new LinkComponentDefault("6", this, { + LinkComponent3Link1: this.__myState1, + LinkComponent3Link2: this.__myState2, + LinkComponent3Link3: this.__myState3, + LinkComponent3Link4: this.__myState4, + indexState1: { count: 1 }, + indexState2: 1, + indexState3: true, + indexState4: 'LinkComponent3' + })); + } + else { + earlierCreatedChild_6.updateWithValueParams({ + indexState1: { count: 1 }, + indexState2: 1, + indexState3: true, + indexState4: 'LinkComponent3' + }); + View.create(earlierCreatedChild_6); + } + let earlierCreatedChild_7 = this.findChildById("7"); + if (earlierCreatedChild_7 == undefined) { + View.create(new AMDComponentDefault("7", this, { + AMDComponentLink1: this.__myState1, + AMDComponentLink2: this.__myState2, + AMDComponentLink3: this.__myState3, + AMDComponentLink4: this.__myState4, + myVar: 100, + myVar2: 100 + })); + } + else { + earlierCreatedChild_7.updateWithValueParams({ + myVar: 100, + myVar2: 100 + }); + View.create(earlierCreatedChild_7); + } + let earlierCreatedChild_8 = this.findChildById("8"); + if (earlierCreatedChild_8 == undefined) { + View.create(new LinkComponent3("8", this, { + LinkComponent3Link1: this.__myState1, + LinkComponent3Link2: this.__myState2, + LinkComponent3Link3: this.__myState3, + LinkComponent3Link4: this.__myState4, + indexState1: { count: 1 }, + indexState2: 1, + indexState3: true, + indexState4: 'LinkComponent1' + })); + } + else { + earlierCreatedChild_8.updateWithValueParams({ + indexState1: { count: 1 }, + indexState2: 1, + indexState3: true, + indexState4: 'LinkComponent1' + }); + View.create(earlierCreatedChild_8); + } + let earlierCreatedChild_9 = this.findChildById("9"); + if (earlierCreatedChild_9 == undefined) { + View.create(new AllStarComponent.ExportComponent("9", this, { + ExportComponent1Link1: this.__myState1, + ExportComponent1Link2: this.__myState2, + ExportComponent1Link3: this.__myState3, + ExportComponent1Link4: this.__myState4, + indexState1: { count: 1 }, + indexState2: 1, + indexState3: true, + indexState4: 'ExportComponent1' + })); + } + else { + earlierCreatedChild_9.updateWithValueParams({ + indexState1: { count: 1 }, + indexState2: 1, + indexState3: true, + indexState4: 'ExportComponent1' + }); + View.create(earlierCreatedChild_9); + } + let earlierCreatedChild_10 = this.findChildById("10"); + if (earlierCreatedChild_10 == undefined) { + View.create(new AllStarComponent.default("10", this, { + ExportComponent4Link1: this.__myState1, + ExportComponent4Link2: this.__myState2, + ExportComponent4Link3: this.__myState3, + ExportComponent4Link4: this.__myState4, + indexState1: { count: 1 }, + indexState2: 1, + indexState3: true, + indexState4: 'ExportComponent4' + })); + } + else { + earlierCreatedChild_10.updateWithValueParams({ + indexState1: { count: 1 }, + indexState2: 1, + indexState3: true, + indexState4: 'ExportComponent4' + }); + View.create(earlierCreatedChild_10); + } + let earlierCreatedChild_11 = this.findChildById("11"); + if (earlierCreatedChild_11 == undefined) { + View.create(new AllComponent.default("11", this, { + NamespaceComponent3Link1: this.__myState1, + NamespaceComponent3Link2: this.__myState2, + NamespaceComponent3Link3: this.__myState3, + NamespaceComponent3Link4: this.__myState4, + myVar: 100, + myVar2: 80 + })); + } + else { + earlierCreatedChild_11.updateWithValueParams({ + myVar: 100, + myVar2: 80 + }); + View.create(earlierCreatedChild_11); + } + Row.pop(); + } +} +loadDocument(new ImportTest("1", undefined, {})); +` diff --git a/compiler/compiler/test/ut/import/importSystemApi.ts b/compiler/compiler/test/ut/import/importSystemApi.ts new file mode 100644 index 000000000..33f1646b1 --- /dev/null +++ b/compiler/compiler/test/ut/import/importSystemApi.ts @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2020 Huawei Device Co., Ltd. + * 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. + */ + +export const source: string = ` +import { router1, router2 } from "@system.router"; +import { app } from "@system.router"; +import { fetch } from "@system.fetch"; + +import { router1, router2, router3 } = require('@system.router'); +import { app1, app2 } = require('@system.app'); +import { fetch } = require('@system.fetch'); + +import router from "@system.router" +import app from "@system.router" +import fetch from "@system.fetch" + +import router = require('@system.router') +import app = require('@system.app') +import fetch = require('@system.fetch') + +import fetch from '@ohos.net.http' + +import hello from 'libhello.so' +import world = require('libworld.so') +` + +export const expectResult: string = +`var { router1, router2 } = globalThis.requireNativeModule('system.router'); +var { app } = globalThis.requireNativeModule('system.router'); +var { fetch } = isSystemplugin('fetch', 'system') ? globalThis.systemplugin.fetch : globalThis.requireNapi('fetch'); +var { router1, router2, router3 } = globalThis.requireNativeModule('system.router'); +var { app1, app2 } = globalThis.requireNativeModule('system.app'); +var { fetch } = isSystemplugin('fetch', 'system') ? globalThis.systemplugin.fetch : globalThis.requireNapi('fetch'); +var router = globalThis.requireNativeModule('system.router'); +var app = globalThis.requireNativeModule('system.router'); +var fetch = isSystemplugin('fetch', 'system') ? globalThis.systemplugin.fetch : globalThis.requireNapi('fetch'); +var router = globalThis.requireNativeModule('system.router'); +var app = globalThis.requireNativeModule('system.app'); +var fetch = isSystemplugin('fetch', 'system') ? globalThis.systemplugin.fetch : globalThis.requireNapi('fetch'); +var fetch = isSystemplugin('net.http', 'ohos') ? globalThis.ohosplugin.net.http : isSystemplugin('net.http', 'system') ? globalThis.systemplugin.net.http : globalThis.requireNapi('net.http'); +var hello = globalThis.requireNapi("hello", true); +var world = globalThis.requireNapi("world", true); +` diff --git a/compiler/compiler/test/ut/import/importTs.ts b/compiler/compiler/test/ut/import/importTs.ts new file mode 100644 index 000000000..357302aec --- /dev/null +++ b/compiler/compiler/test/ut/import/importTs.ts @@ -0,0 +1,162 @@ +/* + * Copyright (c) 2020 Huawei Device Co., Ltd. + * 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. + */ + +export const source: string = ` +import { AllStarComponent } from './test/pages/ExportStarComponent' +import TsModule from './test/pages/TsModule' + +@Entry +@Component +struct ImportTest { + @State myState1: any = new TsModule(1).method(); + @State myState2: number = 0 + @State myState3: boolean = false + @State myState4: string = 'ImportTest' + + build() { + Row() { + AllStarComponent.ExportComponent({ + ExportComponent1Link1: $myState1, + ExportComponent1Link2: this.$myState2, + ExportComponent1Link3: $myState3, + ExportComponent1Link4: $myState4, + indexState1: { count: 1 }, + indexState2: 1, + indexState3: true, + indexState4: 'ExportComponent1' + }) + AllStarComponent.default({ + ExportComponent4Link1: $myState1, + ExportComponent4Link2: this.$myState2, + ExportComponent4Link3: $myState3, + ExportComponent4Link4: $myState4, + indexState1: { count: 1 }, + indexState2: 1, + indexState3: true, + indexState4: 'ExportComponent4' + }) + } + } +} +` + +export const expectResult: string = +`import { AllStarComponent } from './test/pages/ExportStarComponent'; +import TsModule from './test/pages/TsModule'; +class ImportTest extends View { + constructor(compilerAssignedUniqueChildId, parent, params) { + super(compilerAssignedUniqueChildId, parent); + this.__myState1 = new ObservedPropertyObject(new TsModule(1).method(), this, "myState1"); + this.__myState2 = new ObservedPropertySimple(0, this, "myState2"); + this.__myState3 = new ObservedPropertySimple(false, this, "myState3"); + this.__myState4 = new ObservedPropertySimple('ImportTest', this, "myState4"); + this.updateWithValueParams(params); + } + updateWithValueParams(params) { + if (params.myState1 !== undefined) { + this.myState1 = params.myState1; + } + if (params.myState2 !== undefined) { + this.myState2 = params.myState2; + } + if (params.myState3 !== undefined) { + this.myState3 = params.myState3; + } + if (params.myState4 !== undefined) { + this.myState4 = params.myState4; + } + } + aboutToBeDeleted() { + this.__myState1.aboutToBeDeleted(); + this.__myState2.aboutToBeDeleted(); + this.__myState3.aboutToBeDeleted(); + this.__myState4.aboutToBeDeleted(); + SubscriberManager.Get().delete(this.id()); + } + get myState1() { + return this.__myState1.get(); + } + set myState1(newValue) { + this.__myState1.set(newValue); + } + get myState2() { + return this.__myState2.get(); + } + set myState2(newValue) { + this.__myState2.set(newValue); + } + get myState3() { + return this.__myState3.get(); + } + set myState3(newValue) { + this.__myState3.set(newValue); + } + get myState4() { + return this.__myState4.get(); + } + set myState4(newValue) { + this.__myState4.set(newValue); + } + render() { + Row.create(); + let earlierCreatedChild_2 = this.findChildById("2"); + if (earlierCreatedChild_2 == undefined) { + View.create(new AllStarComponent.ExportComponent("2", this, { + ExportComponent1Link1: this.__myState1, + ExportComponent1Link2: this.__myState2, + ExportComponent1Link3: this.__myState3, + ExportComponent1Link4: this.__myState4, + indexState1: { count: 1 }, + indexState2: 1, + indexState3: true, + indexState4: 'ExportComponent1' + })); + } + else { + earlierCreatedChild_2.updateWithValueParams({ + indexState1: { count: 1 }, + indexState2: 1, + indexState3: true, + indexState4: 'ExportComponent1' + }); + View.create(earlierCreatedChild_2); + } + let earlierCreatedChild_3 = this.findChildById("3"); + if (earlierCreatedChild_3 == undefined) { + View.create(new AllStarComponent.default("3", this, { + ExportComponent4Link1: this.__myState1, + ExportComponent4Link2: this.__myState2, + ExportComponent4Link3: this.__myState3, + ExportComponent4Link4: this.__myState4, + indexState1: { count: 1 }, + indexState2: 1, + indexState3: true, + indexState4: 'ExportComponent4' + })); + } + else { + earlierCreatedChild_3.updateWithValueParams({ + indexState1: { count: 1 }, + indexState2: 1, + indexState3: true, + indexState4: 'ExportComponent4' + }); + View.create(earlierCreatedChild_3); + } + Row.pop(); + } +} +loadDocument(new ImportTest("1", undefined, {})); +` diff --git a/compiler/compiler/test/ut/link/createLinkReference.ts b/compiler/compiler/test/ut/link/createLinkReference.ts new file mode 100644 index 000000000..e9562301c --- /dev/null +++ b/compiler/compiler/test/ut/link/createLinkReference.ts @@ -0,0 +1,186 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + +export const source: string = ` +@Component +struct MyLinkTestComponent { + @Link myLink1?: any + @Link myLink2?: number + @Link myLink3?: boolean + @Link myLink4?: string + + private myVar: number = 0 + private myVar2: number + + build() { + + } +} + +@Entry +@Component +struct LinkTest { + @State myState1: any = { count: 0 } + @State myState2: number = 0 + @State myState3: boolean = false + @State myState4: string = 'Home' + + build() { + Row() { + MyLinkTestComponent({ + myLink1: $myState1, + myLink2: this.$myState2, + myLink3: $myState3, + myLink4: this.$myState4, + myVar: 100, + myVar2: 100 + }) + } + } +}` + +export const expectResult: string = +`class MyLinkTestComponent extends View { + constructor(compilerAssignedUniqueChildId, parent, params) { + super(compilerAssignedUniqueChildId, parent); + this.__myLink1 = new SynchedPropertyObjectTwoWay(params.myLink1, this, "myLink1"); + this.__myLink2 = new SynchedPropertySimpleTwoWay(params.myLink2, this, "myLink2"); + this.__myLink3 = new SynchedPropertySimpleTwoWay(params.myLink3, this, "myLink3"); + this.__myLink4 = new SynchedPropertySimpleTwoWay(params.myLink4, this, "myLink4"); + this.myVar = 0; + this.myVar2 = undefined; + this.updateWithValueParams(params); + } + updateWithValueParams(params) { + if (params.myVar !== undefined) { + this.myVar = params.myVar; + } + if (params.myVar2 !== undefined) { + this.myVar2 = params.myVar2; + } + } + aboutToBeDeleted() { + this.__myLink1.aboutToBeDeleted(); + this.__myLink2.aboutToBeDeleted(); + this.__myLink3.aboutToBeDeleted(); + this.__myLink4.aboutToBeDeleted(); + SubscriberManager.Get().delete(this.id()); + } + get myLink1() { + return this.__myLink1.get(); + } + set myLink1(newValue) { + this.__myLink1.set(newValue); + } + get myLink2() { + return this.__myLink2.get(); + } + set myLink2(newValue) { + this.__myLink2.set(newValue); + } + get myLink3() { + return this.__myLink3.get(); + } + set myLink3(newValue) { + this.__myLink3.set(newValue); + } + get myLink4() { + return this.__myLink4.get(); + } + set myLink4(newValue) { + this.__myLink4.set(newValue); + } + render() { + } +} +class LinkTest extends View { + constructor(compilerAssignedUniqueChildId, parent, params) { + super(compilerAssignedUniqueChildId, parent); + this.__myState1 = new ObservedPropertyObject({ count: 0 }, this, "myState1"); + this.__myState2 = new ObservedPropertySimple(0, this, "myState2"); + this.__myState3 = new ObservedPropertySimple(false, this, "myState3"); + this.__myState4 = new ObservedPropertySimple('Home', this, "myState4"); + this.updateWithValueParams(params); + } + updateWithValueParams(params) { + if (params.myState1 !== undefined) { + this.myState1 = params.myState1; + } + if (params.myState2 !== undefined) { + this.myState2 = params.myState2; + } + if (params.myState3 !== undefined) { + this.myState3 = params.myState3; + } + if (params.myState4 !== undefined) { + this.myState4 = params.myState4; + } + } + aboutToBeDeleted() { + this.__myState1.aboutToBeDeleted(); + this.__myState2.aboutToBeDeleted(); + this.__myState3.aboutToBeDeleted(); + this.__myState4.aboutToBeDeleted(); + SubscriberManager.Get().delete(this.id()); + } + get myState1() { + return this.__myState1.get(); + } + set myState1(newValue) { + this.__myState1.set(newValue); + } + get myState2() { + return this.__myState2.get(); + } + set myState2(newValue) { + this.__myState2.set(newValue); + } + get myState3() { + return this.__myState3.get(); + } + set myState3(newValue) { + this.__myState3.set(newValue); + } + get myState4() { + return this.__myState4.get(); + } + set myState4(newValue) { + this.__myState4.set(newValue); + } + render() { + Row.create(); + let earlierCreatedChild_2 = this.findChildById("2"); + if (earlierCreatedChild_2 == undefined) { + View.create(new MyLinkTestComponent("2", this, { + myLink1: this.__myState1, + myLink2: this.__myState2, + myLink3: this.__myState3, + myLink4: this.__myState4, + myVar: 100, + myVar2: 100 + })); + } + else { + earlierCreatedChild_2.updateWithValueParams({ + myVar: 100, + myVar2: 100 + }); + View.create(earlierCreatedChild_2); + } + Row.pop(); + } +} +loadDocument(new LinkTest("1", undefined, {})); +` diff --git a/compiler/compiler/test/ut/preview/previewDecorator.ts b/compiler/compiler/test/ut/preview/previewDecorator.ts new file mode 100644 index 000000000..b1adbbbd4 --- /dev/null +++ b/compiler/compiler/test/ut/preview/previewDecorator.ts @@ -0,0 +1,138 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + +export const source: string = ` +@Entry +@Component +struct HomePreviewComponent { + private value1: string = "hello world 1" + private value2: string = "hello world 2" + private value3: string = "hello world 3" + + build() { + Column() { + Row() { + Text(this.value1) + Text(this.value2) + Text(this.value3) + } + Row() { + Button() { + Text(this.value1) + .fontSize(20) + } + .width(100) + .height(20) + Text(this.value2) + .fontSize(100) + Text(this.value3) + } + .width(20) + } + .height(500) + } +} + +@Preview +@Component +struct HomePreviewComponent_Preview { + build() { + Column() { + HomePreviewComponent(); + } + } +} +` + +export const expectResult: string = +`class HomePreviewComponent extends View { + constructor(compilerAssignedUniqueChildId, parent, params) { + super(compilerAssignedUniqueChildId, parent); + this.value1 = "hello world 1"; + this.value2 = "hello world 2"; + this.value3 = "hello world 3"; + this.updateWithValueParams(params); + } + updateWithValueParams(params) { + if (params.value1 !== undefined) { + this.value1 = params.value1; + } + if (params.value2 !== undefined) { + this.value2 = params.value2; + } + if (params.value3 !== undefined) { + this.value3 = params.value3; + } + } + aboutToBeDeleted() { + SubscriberManager.Get().delete(this.id()); + } + render() { + Column.create(); + Column.height(500); + Row.create(); + Text.create(this.value1); + Text.pop(); + Text.create(this.value2); + Text.pop(); + Text.create(this.value3); + Text.pop(); + Row.pop(); + Row.create(); + Row.width(20); + Button.createWithChild(); + Button.width(100); + Button.height(20); + Text.create(this.value1); + Text.fontSize(20); + Text.pop(); + Button.pop(); + Text.create(this.value2); + Text.fontSize(100); + Text.pop(); + Text.create(this.value3); + Text.pop(); + Row.pop(); + Column.pop(); + } +} +class HomePreviewComponent_Preview extends View { + constructor(compilerAssignedUniqueChildId, parent, params) { + super(compilerAssignedUniqueChildId, parent); + this.updateWithValueParams(params); + } + updateWithValueParams(params) { + } + aboutToBeDeleted() { + SubscriberManager.Get().delete(this.id()); + } + render() { + Column.create(); + let earlierCreatedChild_2 = this.findChildById("2"); + if (earlierCreatedChild_2 == undefined) { + View.create(new HomePreviewComponent("2", this, {})); + } + else { + earlierCreatedChild_2.updateWithValueParams({}); + if (!earlierCreatedChild_2.needsUpdate()) { + earlierCreatedChild_2.markStatic(); + } + View.create(earlierCreatedChild_2); + } + Column.pop(); + } +} +loadDocument(new HomePreviewComponent_Preview("1", undefined, {})); +` diff --git a/compiler/compiler/test/ut/render/forEach/forEach01.ts b/compiler/compiler/test/ut/render/forEach/forEach01.ts new file mode 100644 index 000000000..1f87b8904 --- /dev/null +++ b/compiler/compiler/test/ut/render/forEach/forEach01.ts @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + +export const source: string = ` +@Entry +@Component +struct MyComponent { + private test: string = 'Hello' + build() { + Column() { + Text(this.test) + ForEach( + weekNames, + (item, index) => { + GridItem() { + Text(item) + .fontSize(10) + } + }, + (item, index) => item) + }.width(100) + } +}` + +export const expectResult: string = +`class MyComponent extends View { + constructor(compilerAssignedUniqueChildId, parent, params) { + super(compilerAssignedUniqueChildId, parent); + this.test = 'Hello'; + this.updateWithValueParams(params); + } + updateWithValueParams(params) { + if (params.test !== undefined) { + this.test = params.test; + } + } + aboutToBeDeleted() { + SubscriberManager.Get().delete(this.id()); + } + render() { + Column.create(); + Column.width(100); + Text.create(this.test); + Text.pop(); + ForEach.create("2", this, ObservedObject.GetRawObject(weekNames), (item, index) => { + GridItem.create(); + Text.create(item); + Text.fontSize(10); + Text.pop(); + GridItem.pop(); + }, (item, index) => item); + ForEach.pop(); + Column.pop(); + } +} +loadDocument(new MyComponent("1", undefined, {})); +` diff --git a/compiler/compiler/test/ut/render/forEach/forEach02.ts b/compiler/compiler/test/ut/render/forEach/forEach02.ts new file mode 100644 index 000000000..4007051c1 --- /dev/null +++ b/compiler/compiler/test/ut/render/forEach/forEach02.ts @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + +export const source: string = ` +@Entry +@Component +struct MyComponent { + private test: string = 'Hello' + build() { + Column() { + Text(this.test) + ForEach( + weekNames, + (item: string, index: number) => + Text(item).fontSize(10) + , + (item: any, index: number) => item) + }.width(100) + } +}` + +export const expectResult: string = +`class MyComponent extends View { + constructor(compilerAssignedUniqueChildId, parent, params) { + super(compilerAssignedUniqueChildId, parent); + this.test = 'Hello'; + this.updateWithValueParams(params); + } + updateWithValueParams(params) { + if (params.test !== undefined) { + this.test = params.test; + } + } + aboutToBeDeleted() { + SubscriberManager.Get().delete(this.id()); + } + render() { + Column.create(); + Column.width(100); + Text.create(this.test); + Text.pop(); + ForEach.create("2", this, ObservedObject.GetRawObject(weekNames), (item, index) => { + Text.create(item); + Text.fontSize(10); + Text.pop(); + }, (item, index) => item); + ForEach.pop(); + Column.pop(); + } +} +loadDocument(new MyComponent("1", undefined, {})); +` diff --git a/compiler/compiler/test/ut/render/forEach/forEach03.ts b/compiler/compiler/test/ut/render/forEach/forEach03.ts new file mode 100644 index 000000000..f3122986a --- /dev/null +++ b/compiler/compiler/test/ut/render/forEach/forEach03.ts @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + +export const source: string = ` +@Entry +@Component +struct MyComponent { + build() { + Column() { + ForEach( + weekNames, + (item: string, index: number) => { + Text(item).fontSize(10) + ForEach( + weekNames, + (item: string, index: number) => { + Text(item).fontSize(10) + Column() { + Text(item).fontSize(10) + } + }, + (item: any, index: number) => item + ) + }, + (item: any, index: number) => item + ) + } + } +}` + +export const expectResult: string = +`class MyComponent extends View { + constructor(compilerAssignedUniqueChildId, parent, params) { + super(compilerAssignedUniqueChildId, parent); + this.updateWithValueParams(params); + } + updateWithValueParams(params) { + } + aboutToBeDeleted() { + SubscriberManager.Get().delete(this.id()); + } + render() { + Column.create(); + ForEach.create("3", this, ObservedObject.GetRawObject(weekNames), (item, index) => { + Text.create(item); + Text.fontSize(10); + Text.pop(); + ForEach.create("2", this, ObservedObject.GetRawObject(weekNames), (item, index) => { + Text.create(item); + Text.fontSize(10); + Text.pop(); + Column.create(); + Text.create(item); + Text.fontSize(10); + Text.pop(); + Column.pop(); + }, (item, index) => item); + ForEach.pop(); + }, (item, index) => item); + ForEach.pop(); + Column.pop(); + } +} +loadDocument(new MyComponent("1", undefined, {})); +` diff --git a/compiler/compiler/test/ut/render/forEach/forEach04.ts b/compiler/compiler/test/ut/render/forEach/forEach04.ts new file mode 100644 index 000000000..586bd7204 --- /dev/null +++ b/compiler/compiler/test/ut/render/forEach/forEach04.ts @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + +export const source: string = ` +@Entry +@Component +struct MyComponent { + private test: string = 'Hello' + build() { + Column() { + Text(this.test) + ForEach( + weekNames, + (item, index) => { + Text(item) + .fontSize(10) + } + ) + }.width(100) + } +}` + +export const expectResult: string = +`class MyComponent extends View { + constructor(compilerAssignedUniqueChildId, parent, params) { + super(compilerAssignedUniqueChildId, parent); + this.test = 'Hello'; + this.updateWithValueParams(params); + } + updateWithValueParams(params) { + if (params.test !== undefined) { + this.test = params.test; + } + } + aboutToBeDeleted() { + SubscriberManager.Get().delete(this.id()); + } + render() { + Column.create(); + Column.width(100); + Text.create(this.test); + Text.pop(); + ForEach.create("2", this, ObservedObject.GetRawObject(weekNames), (item, index) => { + Text.create(item); + Text.fontSize(10); + Text.pop(); + }); + ForEach.pop(); + Column.pop(); + } +} +loadDocument(new MyComponent("1", undefined, {})); +` diff --git a/compiler/compiler/test/ut/render/forEach/forEachComplexModel.ts b/compiler/compiler/test/ut/render/forEach/forEachComplexModel.ts new file mode 100644 index 000000000..5f5eb56d8 --- /dev/null +++ b/compiler/compiler/test/ut/render/forEach/forEachComplexModel.ts @@ -0,0 +1,131 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + +export const source: string = ` +// class without @Component convert tool will not process. +class Month { + year: number = 2010; // why add assignment here, TS grammar required, if not it will omit by TSC. + month: number = 2; + days: number[] = [1, 2]; + + constructor(year:number, month:number, days:number[]){ + this.year = year; + this.month = month; + this.days = days; + } +} + +@Component +@Entry +struct Calendar { + +// simulate with 6 months +@State calendar : Month[] = [ + new Month(2020, 1, [...Array(31).keys()]), + new Month(2020, 2, [...Array(28).keys()]), + new Month(2020, 3, [...Array(31).keys()]), + new Month(2020, 4, [...Array(30).keys()]), + new Month(2020, 5, [...Array(31).keys()]), + new Month(2020, 6, [...Array(30).keys()]) +] + + build() { + Column() { + Button() { + Text('next month') + }.onClick(() => { + this.calendar.shift() + this.calendar.push(new Month(2020, 7, [...Array(31).keys()])) + }) + + ForEach(this.calendar, + (item: Month) => { + ForEach(item.days, + (day : number) => { + Text('day') + }, + (day : number) => day.toString() + ) // inner ForEach + }, + (item: Month) => (item.year * 12 + item.month).toString() // field is used together with year and month as the unique ID of the month. + ) // outer ForEach + } + } +}` + +export const expectResult: string = +`// class without @Component convert tool will not process. +class Month { + constructor(year, month, days) { + this.year = 2010; // why add assignment here, TS grammar required, if not it will omit by TSC. + this.month = 2; + this.days = [1, 2]; + this.year = year; + this.month = month; + this.days = days; + } +} +class Calendar extends View { + constructor(compilerAssignedUniqueChildId, parent, params) { + super(compilerAssignedUniqueChildId, parent); + this.__calendar = new ObservedPropertyObject([ + new Month(2020, 1, [...Array(31).keys()]), + new Month(2020, 2, [...Array(28).keys()]), + new Month(2020, 3, [...Array(31).keys()]), + new Month(2020, 4, [...Array(30).keys()]), + new Month(2020, 5, [...Array(31).keys()]), + new Month(2020, 6, [...Array(30).keys()]) + ], this, "calendar"); + this.updateWithValueParams(params); + } + updateWithValueParams(params) { + if (params.calendar !== undefined) { + this.calendar = params.calendar; + } + } + aboutToBeDeleted() { + this.__calendar.aboutToBeDeleted(); + SubscriberManager.Get().delete(this.id()); + } + get calendar() { + return this.__calendar.get(); + } + set calendar(newValue) { + this.__calendar.set(newValue); + } + render() { + Column.create(); + Button.createWithChild(); + Button.onClick(() => { + this.calendar.shift(); + this.calendar.push(new Month(2020, 7, [...Array(31).keys()])); + }); + Text.create('next month'); + Text.pop(); + Button.pop(); + ForEach.create("3", this, ObservedObject.GetRawObject(this.calendar), (item) => { + ForEach.create("2", this, ObservedObject.GetRawObject(item.days), (day) => { + Text.create('day'); + Text.pop(); + }, (day) => day.toString()); // inner ForEach + ForEach.pop(); + }, (item) => (item.year * 12 + item.month).toString() // field is used together with year and month as the unique ID of the month. + ); // outer ForEach + ForEach.pop(); + Column.pop(); + } +} +loadDocument(new Calendar("1", undefined, {})); +` diff --git a/compiler/compiler/test/ut/render/forEach/forEachSimpleModel.ts b/compiler/compiler/test/ut/render/forEach/forEachSimpleModel.ts new file mode 100644 index 000000000..92e66c9c1 --- /dev/null +++ b/compiler/compiler/test/ut/render/forEach/forEachSimpleModel.ts @@ -0,0 +1,85 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + +export const source: string = ` +@Entry +@Component +struct MyComponent2 { + @State arr: number[] = [10, 20, 30] + + build() { + Column() { + Button() { + Text('Reverse Array') + }.onClick(() => { + this.arr.reverse() + }) + + ForEach(this.arr, // Parameter 1: array to be iterated + (item: number) => { // Parameter 2: item generator + Column() { + Divider() + } + }, + (item: number) => item.toString() // Parameter 3: unique key generator, which is optional but recommended. + ) + } + } +}` + +export const expectResult: string = +`class MyComponent2 extends View { + constructor(compilerAssignedUniqueChildId, parent, params) { + super(compilerAssignedUniqueChildId, parent); + this.__arr = new ObservedPropertyObject([10, 20, 30], this, "arr"); + this.updateWithValueParams(params); + } + updateWithValueParams(params) { + if (params.arr !== undefined) { + this.arr = params.arr; + } + } + aboutToBeDeleted() { + this.__arr.aboutToBeDeleted(); + SubscriberManager.Get().delete(this.id()); + } + get arr() { + return this.__arr.get(); + } + set arr(newValue) { + this.__arr.set(newValue); + } + render() { + Column.create(); + Button.createWithChild(); + Button.onClick(() => { + this.arr.reverse(); + }); + Text.create('Reverse Array'); + Text.pop(); + Button.pop(); + ForEach.create("2", this, ObservedObject.GetRawObject(this.arr), // Parameter 1: array to be iterated + (item) => { + Column.create(); + Divider.create(); + Column.pop(); + }, (item) => item.toString() // Parameter 3: unique key generator, which is optional but recommended. + ); + ForEach.pop(); + Column.pop(); + } +} +loadDocument(new MyComponent2("1", undefined, {})); +` diff --git a/compiler/compiler/test/ut/render/if/if.ts b/compiler/compiler/test/ut/render/if/if.ts new file mode 100644 index 000000000..38e086356 --- /dev/null +++ b/compiler/compiler/test/ut/render/if/if.ts @@ -0,0 +1,207 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + +export const source: string = ` +@Entry +@Component +struct MyComponent { + private test: string = 'Hello' + build() { + Column() { + if (this.test === 'Hello') { + Text(this.test) + } + + if (this.test === 'Hello') { + Text(this.test) + Button() + .width(20) + .height(20) + } else if (this.test === 'World') { + Text('World') + } else if (this.test === 'Hello World') { + Text(this.test) + Text('World') + } + else { + + } + + if (this.test === 'Hello') Text(this.test) + else if (this.test === '') Button() + .width(20) + .height(20) + + if (this.test === 'Hello') { + Text(this.test) + } + + Text(this.test) + Button() + .width(20) + .height(20) + + if (true) { + if (this.test === 'Hello') { + if (1) { + Text(this.test) + } + } else { + if (0) { + Button() + .width(20) + .height(20) + } else if (1) { + + } + } + } + + if (this.test !== 'Hello') if (this.test !== 'World') Button() + .width(20) + .height(20) + }.width(100) + } +}` + +export const expectResult: string = +`class MyComponent extends View { + constructor(compilerAssignedUniqueChildId, parent, params) { + super(compilerAssignedUniqueChildId, parent); + this.test = 'Hello'; + this.updateWithValueParams(params); + } + updateWithValueParams(params) { + if (params.test !== undefined) { + this.test = params.test; + } + } + aboutToBeDeleted() { + SubscriberManager.Get().delete(this.id()); + } + render() { + Column.create(); + Column.width(100); + If.create(); + if (this.test === 'Hello') { + If.branchId(0); + Text.create(this.test); + Text.pop(); + } + If.pop(); + If.create(); + if (this.test === 'Hello') { + If.branchId(0); + Text.create(this.test); + Text.pop(); + Button.createWithLabel(); + Button.width(20); + Button.height(20); + Button.pop(); + } + else if (this.test === 'World') { + If.branchId(1); + Text.create('World'); + Text.pop(); + } + else if (this.test === 'Hello World') { + If.branchId(2); + Text.create(this.test); + Text.pop(); + Text.create('World'); + Text.pop(); + } + else { + If.branchId(3); + } + If.pop(); + If.create(); + if (this.test === 'Hello') { + If.branchId(0); + Text.create(this.test); + Text.pop(); + } + else if (this.test === '') { + If.branchId(1); + Button.createWithLabel(); + Button.width(20); + Button.height(20); + Button.pop(); + } + If.pop(); + If.create(); + if (this.test === 'Hello') { + If.branchId(0); + Text.create(this.test); + Text.pop(); + } + If.pop(); + Text.create(this.test); + Text.pop(); + Button.createWithLabel(); + Button.width(20); + Button.height(20); + Button.pop(); + If.create(); + if (true) { + If.branchId(0); + If.create(); + if (this.test === 'Hello') { + If.branchId(0); + If.create(); + if (1) { + If.branchId(0); + Text.create(this.test); + Text.pop(); + } + If.pop(); + } + else { + If.branchId(1); + If.create(); + if (0) { + If.branchId(0); + Button.createWithLabel(); + Button.width(20); + Button.height(20); + Button.pop(); + } + else if (1) { + If.branchId(1); + } + If.pop(); + } + If.pop(); + } + If.pop(); + If.create(); + if (this.test !== 'Hello') { + If.create(); + If.branchId(0); + if (this.test !== 'World') { + If.branchId(0); + Button.createWithLabel(); + Button.width(20); + Button.height(20); + Button.pop(); + } + If.pop(); + } + If.pop(); + Column.pop(); + } +} +loadDocument(new MyComponent("1", undefined, {})); +` diff --git a/compiler/compiler/test/ut/render/if/ifIncludeForEach.ts b/compiler/compiler/test/ut/render/if/ifIncludeForEach.ts new file mode 100644 index 000000000..becd794ee --- /dev/null +++ b/compiler/compiler/test/ut/render/if/ifIncludeForEach.ts @@ -0,0 +1,131 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + +export const source: string = ` +@Entry +@Component +struct HomeComponent { + private value1: string = "hello world 1" + private value2: string = "hello world 2" + private value3: string = "hello world 3" + private values: Array = [] + build() { + Column() { + ForEach(this.values, item => { + Column() { + if (this.value1) { + Text(this.value1) + } + if (this.value2) { + Text(this.value2) + } else { + Text(this.value3) + } + } + }, item => item) + ForEach(this.values, item => { + if (this.value1) { + Text(this.value1) + } + if (this.value2) { + Text(this.value2) + } else { + Text(this.value3) + } + }, item => item) + } + } +}` + +export const expectResult: string = +`class HomeComponent extends View { + constructor(compilerAssignedUniqueChildId, parent, params) { + super(compilerAssignedUniqueChildId, parent); + this.value1 = "hello world 1"; + this.value2 = "hello world 2"; + this.value3 = "hello world 3"; + this.values = []; + this.updateWithValueParams(params); + } + updateWithValueParams(params) { + if (params.value1 !== undefined) { + this.value1 = params.value1; + } + if (params.value2 !== undefined) { + this.value2 = params.value2; + } + if (params.value3 !== undefined) { + this.value3 = params.value3; + } + if (params.values !== undefined) { + this.values = params.values; + } + } + aboutToBeDeleted() { + SubscriberManager.Get().delete(this.id()); + } + render() { + Column.create(); + ForEach.create("2", this, ObservedObject.GetRawObject(this.values), item => { + Column.create(); + If.create(); + if (this.value1) { + If.branchId(0); + Text.create(this.value1); + Text.pop(); + } + If.pop(); + If.create(); + if (this.value2) { + If.branchId(0); + Text.create(this.value2); + Text.pop(); + } + else { + If.branchId(1); + Text.create(this.value3); + Text.pop(); + } + If.pop(); + Column.pop(); + }, item => item); + ForEach.pop(); + ForEach.create("3", this, ObservedObject.GetRawObject(this.values), item => { + If.create(); + if (this.value1) { + If.branchId(0); + Text.create(this.value1); + Text.pop(); + } + If.pop(); + If.create(); + if (this.value2) { + If.branchId(0); + Text.create(this.value2); + Text.pop(); + } + else { + If.branchId(1); + Text.create(this.value3); + Text.pop(); + } + If.pop(); + }, item => item); + ForEach.pop(); + Column.pop(); + } +} +loadDocument(new HomeComponent("1", undefined, {})); +` diff --git a/compiler/compiler/test/ut/struct/struct_01.ts b/compiler/compiler/test/ut/struct/struct_01.ts new file mode 100644 index 000000000..04d53f94b --- /dev/null +++ b/compiler/compiler/test/ut/struct/struct_01.ts @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + +export const source: string = ` +@Component +@Entry +struct MyComponent { + build() { + } +}` + +export const expectResult: string = +`class MyComponent extends View { + constructor(compilerAssignedUniqueChildId, parent, params) { + super(compilerAssignedUniqueChildId, parent); + this.updateWithValueParams(params); + } + updateWithValueParams(params) { + } + aboutToBeDeleted() { + SubscriberManager.Get().delete(this.id()); + } + render() { + } +} +loadDocument(new MyComponent("1", undefined, {})); +` diff --git a/compiler/compiler/test/ut/struct/struct_02.ts b/compiler/compiler/test/ut/struct/struct_02.ts new file mode 100644 index 000000000..644ce3bb3 --- /dev/null +++ b/compiler/compiler/test/ut/struct/struct_02.ts @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + +export const source: string = ` +struct MyComponent { + build() { + } +}` + +export const expectResult: string = +`class MyComponent { + constructor(compilerAssignedUniqueChildId, parent, params) { } + build() { + } +} +` diff --git a/compiler/compiler/test/ut/transition/transition.ts b/compiler/compiler/test/ut/transition/transition.ts new file mode 100644 index 000000000..bae55792b --- /dev/null +++ b/compiler/compiler/test/ut/transition/transition.ts @@ -0,0 +1,111 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + +export const source: string = ` +@Entry +@Component +struct HomeComponent { + @State scale: number = 1 + @State opacity: number = 1 + build() { + Column() { + Text('hello world') + .fontColor(Color.Red) + }.scale(this.scale) + .opacity(this.opacity) + } + pageTransition() { + PageTransitionEnter({type: RouteType.Push, duration: 1200}) + .slide(SlideEffect.Left) + PageTransitionEnter({type: RouteType.Pop, duration: 1200, curve: Curve.Linear}) + .onEnter((type: RouteType, progress: number) => { + this.scale = 1 + this.opacity = progress + }) + PageTransitionExit({type: RouteType.Push, curve: Curve.Linear}) + .translate({x: 100.0, y: 100.0}) + .opacity(0) + PageTransitionExit({type: RouteType.Pop, duration: 1500, curve: Curve.Ease}) + .onExit((type: RouteType, progress: number) => { + this.scale = 1 - progress + this.opacity = 1 + }) + } +}` + +export const expectResult: string = +`class HomeComponent extends View { + constructor(compilerAssignedUniqueChildId, parent, params) { + super(compilerAssignedUniqueChildId, parent); + this.__scale = new ObservedPropertySimple(1, this, "scale"); + this.__opacity = new ObservedPropertySimple(1, this, "opacity"); + this.updateWithValueParams(params); + } + updateWithValueParams(params) { + if (params.scale !== undefined) { + this.scale = params.scale; + } + if (params.opacity !== undefined) { + this.opacity = params.opacity; + } + } + aboutToBeDeleted() { + this.__scale.aboutToBeDeleted(); + this.__opacity.aboutToBeDeleted(); + SubscriberManager.Get().delete(this.id()); + } + get scale() { + return this.__scale.get(); + } + set scale(newValue) { + this.__scale.set(newValue); + } + get opacity() { + return this.__opacity.get(); + } + set opacity(newValue) { + this.__opacity.set(newValue); + } + render() { + Column.create(); + Column.scale(this.scale); + Column.opacity(this.opacity); + Text.create('hello world'); + Text.fontColor(Color.Red); + Text.pop(); + Column.pop(); + } + pageTransition() { + PageTransition.create(); + PageTransitionEnter.create({ type: RouteType.Push, duration: 1200 }); + PageTransitionEnter.slide(SlideEffect.Left); + PageTransitionEnter.create({ type: RouteType.Pop, duration: 1200, curve: Curve.Linear }); + PageTransitionEnter.onEnter((type, progress) => { + this.scale = 1; + this.opacity = progress; + }); + PageTransitionExit.create({ type: RouteType.Push, curve: Curve.Linear }); + PageTransitionExit.translate({ x: 100.0, y: 100.0 }); + PageTransitionExit.opacity(0); + PageTransitionExit.create({ type: RouteType.Pop, duration: 1500, curve: Curve.Ease }); + PageTransitionExit.onExit((type, progress) => { + this.scale = 1 - progress; + this.opacity = 1; + }); + PageTransition.pop(); + } +} +loadDocument(new HomeComponent("1", undefined, {})); +` \ No newline at end of file diff --git a/compiler/compiler/tsconfig.json b/compiler/compiler/tsconfig.json new file mode 100644 index 000000000..822f29fa5 --- /dev/null +++ b/compiler/compiler/tsconfig.json @@ -0,0 +1,26 @@ +{ + "compileOnSave": false, + "compilerOptions": { + "allowJs": true, + "allowSyntheticDefaultImports": true, + "esModuleInterop": true, + "importsNotUsedAsValues": "preserve", + "noImplicitAny": false, + "noUnusedLocals": false, + "noUnusedParameters": false, + "experimentalDecorators": true, + "moduleResolution": "node", + "resolveJsonModule": true, + "sourceMap": true, + "module": "commonjs", + "target": "es2017", + "types": [], + "typeRoots": [], + "lib": [ + "es2020" + ] + }, + "exclude": [ + "node_modules" + ] +} \ No newline at end of file diff --git a/compiler/compiler/uglify-source.js b/compiler/compiler/uglify-source.js new file mode 100644 index 000000000..0823ead66 --- /dev/null +++ b/compiler/compiler/uglify-source.js @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2020 Huawei Device Co., Ltd. + * 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. + */ + +const fs = require('fs') +const path = require('path') +const uglifyJS = require('uglify-es') + +readCode(process.argv[2]) + +function readCode(inputPath) { + if (fs.existsSync(inputPath)) { + const files = fs.readdirSync(inputPath) + files.forEach(function(file) { + const filePath = path.join(inputPath, file) + if (fs.existsSync(filePath)) { + const fileStat = fs.statSync(filePath) + if (fileStat.isFile()) { + const code = fs.readFileSync(filePath, 'utf-8') + uglifyCode(code,filePath) + } + if (fileStat.isDirectory()) { + readCode(filePath) + } + } + }) + } +} + +function uglifyCode(code, outPath) { + const uglifyCode = uglifyJS.minify(code).code + fs.writeFileSync(outPath, uglifyCode) +} diff --git a/compiler/compiler/webpack.config.js b/compiler/compiler/webpack.config.js new file mode 100644 index 000000000..8e0ab7b80 --- /dev/null +++ b/compiler/compiler/webpack.config.js @@ -0,0 +1,188 @@ +/* + * Copyright (c) 2020 Huawei Device Co., Ltd. + * 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. + */ + +const path = require('path'); +const { CleanWebpackPlugin } = require('clean-webpack-plugin'); +const CopyPlugin = require('copy-webpack-plugin'); +const Webpack = require('webpack'); +const { GenAbcPlugin } = require('./lib/gen_abc_plugin'); + +const { + projectConfig, + loadEntryObj, + readAppResource, + resources, + loadWorker, + abilityConfig +} = require('./main'); +const { ResultStates } = require('./lib/compile_info'); +const { processUISyntax } = require('./lib/process_ui_syntax'); +const { IGNORE_ERROR_CODE } = require('./lib/utils'); + +const watchMode = (process.env.watchMode && process.env.watchMode === 'true') || false; + +function initConfig(config) { + const projectPath = path.resolve(projectConfig.projectPath); + Object.assign(config, { + entry: projectConfig.entryObj, + watch: watchMode, + watchOptions: { + aggregateTimeout: 10, + poll: false, + ignored: /node_modules/ + }, + output: { + path: path.resolve(__dirname, projectConfig.buildPath), + filename: '[name].js', + devtoolModuleFilenameTemplate: 'webpack:///[absolute-resource-path]' + }, + devtool: 'nosources-source-map', + mode: 'development', + module: { + rules: [ + { + test: /\.(ets|ts)$/, + use: [ + { loader: path.resolve(__dirname, 'lib/result_process.js') }, + { + loader: 'ts-loader', + options: { + appendTsSuffixTo: [/\.ets$/], + onlyCompileBundledFiles: true, + configFile: path.resolve(__dirname, 'tsconfig.json'), + getCustomTransformers(program) { + return { + before: [processUISyntax(program)], + after: [] + }; + }, + ignoreDiagnostics: IGNORE_ERROR_CODE + } + }, + { loader: path.resolve(__dirname, 'lib/pre_process.js') } + ] + }, + { + test: /\.js$/, + use: [ + { loader: path.resolve(__dirname, 'lib/process_system_module.js') } + ] + } + ] + }, + node: { + global: false + }, + resolve: { + extensions:['.js', '.ets', '.ts'], + modules: [ + projectPath, + path.join(projectPath, '../../../../../'), + './node_modules', + path.join(__dirname, 'node_modules') + ] + }, + stats: { preset: 'none' }, + plugins: [ + new Webpack.WatchIgnorePlugin({ + paths: [ + /\.js$/, + /\.d\.ts$/ + ]}), + new CleanWebpackPlugin(), + new ResultStates() + ] + }) +} + +function setProjectConfig(envArgs) { + const args = Object.keys(envArgs); + if (args.indexOf('projectName') === args.length - 2) { + projectConfig.projectPath = path.join(process.cwd(), args[args.length - 1]); + } + if (envArgs.aceModuleRoot) { + projectConfig.projectPath = envArgs.aceModuleRoot; + } + if (envArgs.aceModuleBuild) { + projectConfig.buildPath = envArgs.aceModuleBuild; + } + if (envArgs.aceManifestPath) { + projectConfig.manifestFilePath = envArgs.aceManifestPath; + } +} + +function setReleaseConfig(config) { + const TerserPlugin = require('terser-webpack-plugin'); + config.mode = 'production'; + config.optimization = { + emitOnErrors: true, + usedExports: false, + minimize: true, + minimizer: [ new TerserPlugin() ] + }; + config.output.sourceMapFilename = '_releaseMap/[name].js.map'; +} + +function setCopyPluginConfig(config) { + const copyPluginPattrens = []; + copyPluginPattrens.push({ + from: '**/*', + context: path.resolve(__dirname, projectConfig.projectPath), + globOptions: { + ignore: [ + '**/*.ets', + '**/*.ts', + '**/*.js', + path.resolve(__dirname, projectConfig.buildPath, '**').replace(/\\/g, '/') + ] + }, + noErrorOnMissing: true + }); + if (abilityConfig.abilityType === 'page') { + copyPluginPattrens.push({ from: projectConfig.manifestFilePath }); + } + config.plugins.push(new CopyPlugin({ patterns: copyPluginPattrens })); +} + +module.exports = (env, argv) => { + const config = {}; + setProjectConfig(env); + loadEntryObj(projectConfig); + initConfig(config); + setCopyPluginConfig(config); + + if (env.isPreview !== "true") { + loadWorker(projectConfig); + if (env.compilerType && env.compilerType === 'ark') { + config.plugins.push(new GenAbcPlugin(projectConfig.buildPath, path.join(__dirname, 'bin'), env.buildMode === 'debug')); + } + } else { + projectConfig.isPreview = true; + } + + if (env.sourceMap === 'none') { + config.devtool = false; + } + + if (env.buildMode === 'release') { + setReleaseConfig(config); + } + + const appResourcePath = env.appResource || process.env.appResource; + if (appResourcePath) { + readAppResource(resources, appResourcePath); + } + return config; +} diff --git a/compiler/sample/app.ets b/compiler/sample/app.ets index 30a198381..8e35f7b00 100644 --- a/compiler/sample/app.ets +++ b/compiler/sample/app.ets @@ -1,3 +1,19 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + + export default { onCreate() { console.info('Application onCreate') diff --git a/compiler/sample/pages/home.ets b/compiler/sample/pages/home.ets index 0fce6542c..65b5d3974 100644 --- a/compiler/sample/pages/home.ets +++ b/compiler/sample/pages/home.ets @@ -1,3 +1,19 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + + @Entry @Component struct HomeComponent { diff --git a/compiler/sample/pages/home_preview.ets b/compiler/sample/pages/home_preview.ets index 9ae05aaf3..53fe3642d 100644 --- a/compiler/sample/pages/home_preview.ets +++ b/compiler/sample/pages/home_preview.ets @@ -1,3 +1,19 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + + @Entry @Component struct HomePreviewComponent { diff --git a/compiler/sample/pages/index.ets b/compiler/sample/pages/index.ets index 2f37ded2f..9708e4ba0 100644 --- a/compiler/sample/pages/index.ets +++ b/compiler/sample/pages/index.ets @@ -1,3 +1,19 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + + @Component struct Banner { private value1: string = "hello world 4" diff --git a/compiler/sample/pages/testcases/component-01.ets b/compiler/sample/pages/testcases/component-01.ets index 44c4c183f..27c1a6be7 100644 --- a/compiler/sample/pages/testcases/component-01.ets +++ b/compiler/sample/pages/testcases/component-01.ets @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + @Component @Entry struct MyComponent1 { diff --git a/compiler/sample/pages/testcases/componentGridTest.ets b/compiler/sample/pages/testcases/componentGridTest.ets index ef46eff71..54d1cd8e3 100644 --- a/compiler/sample/pages/testcases/componentGridTest.ets +++ b/compiler/sample/pages/testcases/componentGridTest.ets @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + @Entry @Component struct GridRootView { diff --git a/compiler/sample/pages/testcases/componentListTest.ets b/compiler/sample/pages/testcases/componentListTest.ets index 361a80233..1b60675ed 100644 --- a/compiler/sample/pages/testcases/componentListTest.ets +++ b/compiler/sample/pages/testcases/componentListTest.ets @@ -1,3 +1,19 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + + @Entry @Component struct ListRootView { diff --git a/compiler/sample/pages/testcases/constructor-01.ets b/compiler/sample/pages/testcases/constructor-01.ets index f2befe6cb..77aac86c2 100644 --- a/compiler/sample/pages/testcases/constructor-01.ets +++ b/compiler/sample/pages/testcases/constructor-01.ets @@ -1,3 +1,19 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + + class DataModel{ private myData1: number = 0 } diff --git a/compiler/sample/pages/testcases/constructor-02.ets b/compiler/sample/pages/testcases/constructor-02.ets index 03b017c9f..72eb63327 100644 --- a/compiler/sample/pages/testcases/constructor-02.ets +++ b/compiler/sample/pages/testcases/constructor-02.ets @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + @Entry @Component struct MyLinkComponent { diff --git a/compiler/sample/pages/testcases/constructor-03.ets b/compiler/sample/pages/testcases/constructor-03.ets index 1d790e2ac..4a482cb70 100644 --- a/compiler/sample/pages/testcases/constructor-03.ets +++ b/compiler/sample/pages/testcases/constructor-03.ets @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + @Entry @Component struct MyPropComponent { diff --git a/compiler/sample/pages/testcases/expected/component-01-expected.js b/compiler/sample/pages/testcases/expected/component-01-expected.js index 849492f2a..ae202268d 100644 --- a/compiler/sample/pages/testcases/expected/component-01-expected.js +++ b/compiler/sample/pages/testcases/expected/component-01-expected.js @@ -1,3 +1,19 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + + class MyComponent extends View { constructor() { super(); diff --git a/compiler/sample/pages/testcases/expected/constructor-01-expected.js b/compiler/sample/pages/testcases/expected/constructor-01-expected.js index 76555d8b3..53ca41c94 100644 --- a/compiler/sample/pages/testcases/expected/constructor-01-expected.js +++ b/compiler/sample/pages/testcases/expected/constructor-01-expected.js @@ -1,3 +1,19 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + + class MyStateComponent extends View { constructor(inputParams) { super(); diff --git a/compiler/sample/pages/testcases/expected/constructor-02-expected.js b/compiler/sample/pages/testcases/expected/constructor-02-expected.js index c257a6b16..6c5de4e0c 100644 --- a/compiler/sample/pages/testcases/expected/constructor-02-expected.js +++ b/compiler/sample/pages/testcases/expected/constructor-02-expected.js @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + class MyLinkComponent extends View { constructor(inputParams) { super(); diff --git a/compiler/sample/pages/testcases/expected/constructor-03-expected.js b/compiler/sample/pages/testcases/expected/constructor-03-expected.js index ae75c757d..67382c3d3 100644 --- a/compiler/sample/pages/testcases/expected/constructor-03-expected.js +++ b/compiler/sample/pages/testcases/expected/constructor-03-expected.js @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + class MyPropComponent extends View { constructor(inputParams) { super(); diff --git a/compiler/sample/pages/testcases/expected/link-01-expected.js b/compiler/sample/pages/testcases/expected/link-01-expected.js index 46c737697..d0ba0a588 100644 --- a/compiler/sample/pages/testcases/expected/link-01-expected.js +++ b/compiler/sample/pages/testcases/expected/link-01-expected.js @@ -1,3 +1,19 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + + class MyLinkTestComponent extends View { constructor(inputParams) { super(); diff --git a/compiler/sample/pages/testcases/expected/new-01-expected.js b/compiler/sample/pages/testcases/expected/new-01-expected.js index 68c475807..7e46d89c6 100644 --- a/compiler/sample/pages/testcases/expected/new-01-expected.js +++ b/compiler/sample/pages/testcases/expected/new-01-expected.js @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + class MyComponent extends View { constructor(value1 = "hello world 1", value2 = "hello world 2", value3 = "hello world 3") { super(); diff --git a/compiler/sample/pages/testcases/expected/new-02-expected.js b/compiler/sample/pages/testcases/expected/new-02-expected.js index 68c475807..7e46d89c6 100644 --- a/compiler/sample/pages/testcases/expected/new-02-expected.js +++ b/compiler/sample/pages/testcases/expected/new-02-expected.js @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + class MyComponent extends View { constructor(value1 = "hello world 1", value2 = "hello world 2", value3 = "hello world 3") { super(); diff --git a/compiler/sample/pages/testcases/expected/new-03-expected.js b/compiler/sample/pages/testcases/expected/new-03-expected.js index 4f153f34b..9bf4eae84 100644 --- a/compiler/sample/pages/testcases/expected/new-03-expected.js +++ b/compiler/sample/pages/testcases/expected/new-03-expected.js @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + class Banner extends View { constructor(value1 = "hello world 2") { super(); diff --git a/compiler/sample/pages/testcases/expected/new-04-expected.js b/compiler/sample/pages/testcases/expected/new-04-expected.js index 4f153f34b..9bf4eae84 100644 --- a/compiler/sample/pages/testcases/expected/new-04-expected.js +++ b/compiler/sample/pages/testcases/expected/new-04-expected.js @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + class Banner extends View { constructor(value1 = "hello world 2") { super(); diff --git a/compiler/sample/pages/testcases/expected/struct-01-expected.js b/compiler/sample/pages/testcases/expected/struct-01-expected.js index 8df48157b..fa4b84a95 100644 --- a/compiler/sample/pages/testcases/expected/struct-01-expected.js +++ b/compiler/sample/pages/testcases/expected/struct-01-expected.js @@ -1,3 +1,19 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + + class MyComponent extends View { render() { } diff --git a/compiler/sample/pages/testcases/expected/struct-02-expected.js b/compiler/sample/pages/testcases/expected/struct-02-expected.js index a9ba8932d..11297a9a4 100644 --- a/compiler/sample/pages/testcases/expected/struct-02-expected.js +++ b/compiler/sample/pages/testcases/expected/struct-02-expected.js @@ -1,3 +1,19 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + + class MyComponent { build() { } diff --git a/compiler/sample/pages/testcases/forEachComplexModel.ets b/compiler/sample/pages/testcases/forEachComplexModel.ets index 64ad0c504..5b0a58a80 100644 --- a/compiler/sample/pages/testcases/forEachComplexModel.ets +++ b/compiler/sample/pages/testcases/forEachComplexModel.ets @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + // class without @Component convert tool will not process. class Month { year: number = 2010; // why add assignment here, TS grammar required, if not it will omit by TSC. diff --git a/compiler/sample/pages/testcases/forEachSimpleModel.ets b/compiler/sample/pages/testcases/forEachSimpleModel.ets index f98c4e704..ad1a0a2de 100644 --- a/compiler/sample/pages/testcases/forEachSimpleModel.ets +++ b/compiler/sample/pages/testcases/forEachSimpleModel.ets @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + @Entry @Component struct MyComponent2 { diff --git a/compiler/sample/pages/testcases/image.ets b/compiler/sample/pages/testcases/image.ets index 1fc838065..26ba6d705 100644 --- a/compiler/sample/pages/testcases/image.ets +++ b/compiler/sample/pages/testcases/image.ets @@ -1,3 +1,19 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + + @Entry @Component struct UserView1 { diff --git a/compiler/sample/pages/testcases/import-api-01.ets b/compiler/sample/pages/testcases/import-api-01.ets index 2256c7e58..e2e3ceaa4 100644 --- a/compiler/sample/pages/testcases/import-api-01.ets +++ b/compiler/sample/pages/testcases/import-api-01.ets @@ -1,3 +1,19 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + + import fetch from '@system.fetch' import router from '@system.router' diff --git a/compiler/sample/pages/testcases/link-01.ets b/compiler/sample/pages/testcases/link-01.ets index 55ffc8ca5..aff09ab50 100644 --- a/compiler/sample/pages/testcases/link-01.ets +++ b/compiler/sample/pages/testcases/link-01.ets @@ -1,3 +1,19 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + + @Component struct MyLinkTestComponent { @Link myLink1?: any diff --git a/compiler/sample/pages/testcases/linkArrayModel.ets b/compiler/sample/pages/testcases/linkArrayModel.ets index 45a1d9ccf..f4901f8b6 100644 --- a/compiler/sample/pages/testcases/linkArrayModel.ets +++ b/compiler/sample/pages/testcases/linkArrayModel.ets @@ -1,3 +1,19 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + + @Component @Entry struct Parent { diff --git a/compiler/sample/pages/testcases/linkPropCombo.ets b/compiler/sample/pages/testcases/linkPropCombo.ets index 7c689737d..03d834813 100644 --- a/compiler/sample/pages/testcases/linkPropCombo.ets +++ b/compiler/sample/pages/testcases/linkPropCombo.ets @@ -1,3 +1,19 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + + @Component @Entry struct ParentView { diff --git a/compiler/sample/pages/testcases/linkSimpleModel.ets b/compiler/sample/pages/testcases/linkSimpleModel.ets index bf2ccc351..4f2947eb8 100644 --- a/compiler/sample/pages/testcases/linkSimpleModel.ets +++ b/compiler/sample/pages/testcases/linkSimpleModel.ets @@ -1,3 +1,19 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + + @Component @Entry struct Player { diff --git a/compiler/sample/pages/testcases/new-01.ets b/compiler/sample/pages/testcases/new-01.ets index 235c5dd3f..7f6c51a5c 100644 --- a/compiler/sample/pages/testcases/new-01.ets +++ b/compiler/sample/pages/testcases/new-01.ets @@ -1,3 +1,19 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + + @Component @Entry struct MyComponent3 { diff --git a/compiler/sample/pages/testcases/new-0101.ets b/compiler/sample/pages/testcases/new-0101.ets index 235c5dd3f..7f6c51a5c 100644 --- a/compiler/sample/pages/testcases/new-0101.ets +++ b/compiler/sample/pages/testcases/new-0101.ets @@ -1,3 +1,19 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + + @Component @Entry struct MyComponent3 { diff --git a/compiler/sample/pages/testcases/new-02.ets b/compiler/sample/pages/testcases/new-02.ets index ea285c94f..d60117669 100644 --- a/compiler/sample/pages/testcases/new-02.ets +++ b/compiler/sample/pages/testcases/new-02.ets @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + @Component @Entry struct MyComponent4 { diff --git a/compiler/sample/pages/testcases/new-03.ets b/compiler/sample/pages/testcases/new-03.ets index fa0bc708c..de28fd142 100644 --- a/compiler/sample/pages/testcases/new-03.ets +++ b/compiler/sample/pages/testcases/new-03.ets @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + @Component struct Banner { private value1: string = "hello world 2"; diff --git a/compiler/sample/pages/testcases/new-04.ets b/compiler/sample/pages/testcases/new-04.ets index 73e6fff35..b8f1c7ecb 100644 --- a/compiler/sample/pages/testcases/new-04.ets +++ b/compiler/sample/pages/testcases/new-04.ets @@ -1,3 +1,19 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + + @Component struct Banner { private value1: string = "hello world 2"; diff --git a/compiler/sample/pages/testcases/onclicktest.ets b/compiler/sample/pages/testcases/onclicktest.ets index 2a11f36ed..305ff1e58 100644 --- a/compiler/sample/pages/testcases/onclicktest.ets +++ b/compiler/sample/pages/testcases/onclicktest.ets @@ -1,3 +1,17 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ @Entry @Component diff --git a/compiler/sample/pages/testcases/propSimpleModel.ets b/compiler/sample/pages/testcases/propSimpleModel.ets index 5c1569bfc..6d7b371b0 100644 --- a/compiler/sample/pages/testcases/propSimpleModel.ets +++ b/compiler/sample/pages/testcases/propSimpleModel.ets @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + @Component @Entry struct ParentComponent { diff --git a/compiler/sample/pages/testcases/showcaseCovid19.ets b/compiler/sample/pages/testcases/showcaseCovid19.ets index b92d5a3cd..14a8a57a8 100644 --- a/compiler/sample/pages/testcases/showcaseCovid19.ets +++ b/compiler/sample/pages/testcases/showcaseCovid19.ets @@ -8,6 +8,22 @@ * * ACE @ Web Helsinki * + + */ + + /* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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/compiler/sample/pages/testcases/simpleText.ets b/compiler/sample/pages/testcases/simpleText.ets index 2d93d0318..9a982d6b0 100644 --- a/compiler/sample/pages/testcases/simpleText.ets +++ b/compiler/sample/pages/testcases/simpleText.ets @@ -1,3 +1,19 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + + @Entry @Component struct UserView { diff --git a/compiler/sample/pages/testcases/stacktestsuite.ets b/compiler/sample/pages/testcases/stacktestsuite.ets index dfc9fcfd5..56908b36b 100644 --- a/compiler/sample/pages/testcases/stacktestsuite.ets +++ b/compiler/sample/pages/testcases/stacktestsuite.ets @@ -1,3 +1,17 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ class Test { align:number = 0; diff --git a/compiler/sample/pages/testcases/stateArrayReverse.ets b/compiler/sample/pages/testcases/stateArrayReverse.ets index d6a8903e4..bc8e5eb5b 100644 --- a/compiler/sample/pages/testcases/stateArrayReverse.ets +++ b/compiler/sample/pages/testcases/stateArrayReverse.ets @@ -16,6 +16,22 @@ */ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + + class Item1 { id:number; label:string; diff --git a/compiler/sample/pages/testcases/stateArrayReverseCustomView.ets b/compiler/sample/pages/testcases/stateArrayReverseCustomView.ets index 5a1a8119c..f6e3bc1ba 100644 --- a/compiler/sample/pages/testcases/stateArrayReverseCustomView.ets +++ b/compiler/sample/pages/testcases/stateArrayReverseCustomView.ets @@ -1,3 +1,19 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + + class Item{ id:number = 0; label:string = ''; diff --git a/compiler/sample/pages/testcases/stateComplexType.ets b/compiler/sample/pages/testcases/stateComplexType.ets index abbe5c6b2..6071b5aec 100644 --- a/compiler/sample/pages/testcases/stateComplexType.ets +++ b/compiler/sample/pages/testcases/stateComplexType.ets @@ -1,3 +1,19 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + + // Customize the status data class. class Model { value: string = ''; diff --git a/compiler/sample/pages/testcases/stateStateBindingProp.ets b/compiler/sample/pages/testcases/stateStateBindingProp.ets index d2ab7f710..5e4ae423a 100644 --- a/compiler/sample/pages/testcases/stateStateBindingProp.ets +++ b/compiler/sample/pages/testcases/stateStateBindingProp.ets @@ -1,3 +1,19 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + + class GreenButtonState { width:number = 0; diff --git a/compiler/sample/pages/testcases/struct-01.ets b/compiler/sample/pages/testcases/struct-01.ets index 0c8c1b789..941dd29f7 100644 --- a/compiler/sample/pages/testcases/struct-01.ets +++ b/compiler/sample/pages/testcases/struct-01.ets @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + @Component @Entry struct MyComponent7 { diff --git a/compiler/sample/pages/testcases/struct-02.ets b/compiler/sample/pages/testcases/struct-02.ets index ee57c9cde..3ecc7a771 100644 --- a/compiler/sample/pages/testcases/struct-02.ets +++ b/compiler/sample/pages/testcases/struct-02.ets @@ -1,3 +1,19 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + + struct MyComponent8 { build() { } diff --git a/compiler/sample/pages/todo.ets b/compiler/sample/pages/todo.ets index f1b21f224..033ff0d97 100644 --- a/compiler/sample/pages/todo.ets +++ b/compiler/sample/pages/todo.ets @@ -11,6 +11,22 @@ * This is the ouput the eDSL transpiler should generate. */ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + + let tasks: Array = [ { label: "Wash the car" }, { label: "Buy some milk" }, diff --git a/compiler/test/pages/AMDComponent.ets b/compiler/test/pages/AMDComponent.ets index ab714803e..3135f0d85 100644 --- a/compiler/test/pages/AMDComponent.ets +++ b/compiler/test/pages/AMDComponent.ets @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + @Component struct AMDComponent { @Link AMDComponentLink1?: any diff --git a/compiler/test/pages/DefaultComponent.ets b/compiler/test/pages/DefaultComponent.ets index 94c842e7a..e0add5224 100644 --- a/compiler/test/pages/DefaultComponent.ets +++ b/compiler/test/pages/DefaultComponent.ets @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + @Component struct DefaultComponent { @Link DefaultComponentLink1?: any diff --git a/compiler/test/pages/ExportComponent.ets b/compiler/test/pages/ExportComponent.ets index c8332c7f6..ba582d538 100644 --- a/compiler/test/pages/ExportComponent.ets +++ b/compiler/test/pages/ExportComponent.ets @@ -1,3 +1,19 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + + import DefaultComponent from "./test/pages/DefaultComponent.ets" @Component diff --git a/compiler/test/pages/ExportStarComponent.ets b/compiler/test/pages/ExportStarComponent.ets index ada630313..d9d450293 100644 --- a/compiler/test/pages/ExportStarComponent.ets +++ b/compiler/test/pages/ExportStarComponent.ets @@ -1 +1,17 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + + export * as AllStarComponent from './test/pages/ExportComponent'; diff --git a/compiler/test/pages/LinkComponent.ets b/compiler/test/pages/LinkComponent.ets index 1357500ba..ffcc61155 100644 --- a/compiler/test/pages/LinkComponent.ets +++ b/compiler/test/pages/LinkComponent.ets @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + import DefaultComponent from "./DefaultComponent.ets" @Component diff --git a/compiler/test/pages/NamespaceComponent.ets b/compiler/test/pages/NamespaceComponent.ets index 5f3b3e87a..5b33ec85f 100644 --- a/compiler/test/pages/NamespaceComponent.ets +++ b/compiler/test/pages/NamespaceComponent.ets @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + @Component struct NamespaceComponent1 { @Link NamespaceComponent1Link1?: any -- Gitee From 18f30fc19d4a37cd3f901029141876760afba60a Mon Sep 17 00:00:00 2001 From: songbeibei Date: Mon, 22 Nov 2021 20:39:43 +0800 Subject: [PATCH 2/8] =?UTF-8?q?=E7=AC=AC=E4=B8=80=E6=AC=A1=E6=8F=90?= =?UTF-8?q?=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- compiler/compiler/.eslintrc | 104 - compiler/compiler/README.md | 81 - compiler/compiler/babel.config.js | 35 - compiler/compiler/build_declarations_file.js | 128 - compiler/compiler/build_parser.js | 48 - compiler/compiler/main.js | 154 - compiler/compiler/npm-install.js | 51 - compiler/compiler/package-lock.json | 5700 ----------------- compiler/compiler/package.json | 46 - compiler/compiler/sample/app.ets | 24 - compiler/compiler/sample/manifest.json | 35 - compiler/compiler/sample/pages/home.ets | 46 - .../compiler/sample/pages/home_preview.ets | 56 - compiler/compiler/sample/pages/index.ets | 48 - .../sample/pages/testcases/component-01.ets | 34 - .../pages/testcases/componentGridTest.ets | 70 - .../pages/testcases/componentListTest.ets | 64 - .../sample/pages/testcases/constructor-01.ets | 36 - .../sample/pages/testcases/constructor-02.ets | 30 - .../sample/pages/testcases/constructor-03.ets | 30 - .../expected/component-01-expected.js | 27 - .../expected/constructor-01-expected.js | 34 - .../expected/constructor-02-expected.js | 29 - .../expected/constructor-03-expected.js | 29 - .../testcases/expected/link-01-expected.js | 52 - .../testcases/expected/new-01-expected.js | 25 - .../testcases/expected/new-02-expected.js | 25 - .../testcases/expected/new-03-expected.js | 30 - .../testcases/expected/new-04-expected.js | 30 - .../testcases/expected/struct-01-expected.js | 22 - .../testcases/expected/struct-02-expected.js | 20 - .../pages/testcases/forEachComplexModel.ets | 62 - .../pages/testcases/forEachSimpleModel.ets | 58 - .../compiler/sample/pages/testcases/image.ets | 34 - .../sample/pages/testcases/import-api-01.ets | 37 - .../sample/pages/testcases/link-01.ets | 52 - .../sample/pages/testcases/linkArrayModel.ets | 48 - .../sample/pages/testcases/linkPropCombo.ets | 49 - .../pages/testcases/linkSimpleModel.ets | 41 - .../sample/pages/testcases/new-01.ets | 31 - .../sample/pages/testcases/new-0101.ets | 31 - .../sample/pages/testcases/new-02.ets | 30 - .../sample/pages/testcases/new-03.ets | 38 - .../sample/pages/testcases/new-04.ets | 39 - .../sample/pages/testcases/onclicktest.ets | 55 - .../pages/testcases/propSimpleModel.ets | 62 - .../pages/testcases/showcaseCovid19.ets | 3577 ----------- .../sample/pages/testcases/simpleText.ets | 84 - .../sample/pages/testcases/stacktestsuite.ets | 148 - .../pages/testcases/stateArrayReverse.ets | 72 - .../testcases/stateArrayReverseCustomView.ets | 94 - .../pages/testcases/stateComplexType.ets | 62 - .../pages/testcases/stateStateBindingProp.ets | 107 - .../sample/pages/testcases/struct-01.ets | 21 - .../sample/pages/testcases/struct-02.ets | 20 - compiler/compiler/sample/pages/todo.ets | 178 - compiler/compiler/src/compile_info.ts | 233 - compiler/compiler/src/component_map.ts | 455 -- compiler/compiler/src/create.ts | 109 - compiler/compiler/src/gen_abc_plugin.ts | 123 - compiler/compiler/src/pre_define.ts | 173 - compiler/compiler/src/pre_process.ts | 44 - .../compiler/src/process_component_build.ts | 702 -- .../compiler/src/process_component_class.ts | 400 -- .../src/process_component_constructor.ts | 95 - .../compiler/src/process_component_member.ts | 899 --- .../compiler/src/process_custom_component.ts | 393 -- compiler/compiler/src/process_import.ts | 278 - .../compiler/src/process_system_module.ts | 20 - compiler/compiler/src/process_ui_syntax.ts | 410 -- compiler/compiler/src/result_process.ts | 67 - compiler/compiler/src/utils.ts | 158 - compiler/compiler/src/validate_ui_syntax.ts | 802 --- .../syntax_parser/src/parse_extend.peg | 26 - .../syntax_parser/src/syntax_parser.peg | 116 - compiler/compiler/test/README.md | 83 - compiler/compiler/test/pages/AMDComponent.ets | 31 - .../compiler/test/pages/DefaultComponent.ets | 31 - .../compiler/test/pages/ExportComponent.ets | 119 - .../test/pages/ExportStarComponent.ets | 17 - .../compiler/test/pages/LinkComponent.ets | 120 - .../test/pages/NamespaceComponent.ets | 63 - compiler/compiler/test/pages/TsModule.ts | 25 - compiler/compiler/test/test.ts | 67 - .../compiler/test/ut/animation/animation.ts | 119 - compiler/compiler/test/ut/build/build.ts | 59 - .../compiler/test/ut/component/component.ts | 68 - .../test/ut/component/customComponent.ts | 157 - compiler/compiler/test/ut/constructor/id.ts | 249 - compiler/compiler/test/ut/constructor/link.ts | 88 - .../test/ut/constructor/observedObjectLink.ts | 142 - compiler/compiler/test/ut/constructor/prop.ts | 91 - .../test/ut/constructor/provideConsume.ts | 130 - .../compiler/test/ut/constructor/state.ts | 121 - .../test/ut/customDialog/customDialog.ts | 159 - .../compiler/test/ut/decorator/builder.ts | 86 - compiler/compiler/test/ut/decorator/extend.ts | 85 - compiler/compiler/test/ut/decorator/watch.ts | 168 - .../test/ut/decorator/watchWithAnimateTo.ts | 148 - .../test/ut/geometryReader/geometryReader.ts | 58 - .../compiler/test/ut/gesture/panGestrue.ts | 279 - .../compiler/test/ut/gesture/pinchGesture.ts | 107 - .../test/ut/gesture/rotationGesture.ts | 108 - .../compiler/test/ut/gesture/tapGesture.ts | 177 - compiler/compiler/test/ut/import/importEts.ts | 408 -- .../test/ut/import/importSystemApi.ts | 55 - compiler/compiler/test/ut/import/importTs.ts | 162 - .../test/ut/link/createLinkReference.ts | 186 - .../test/ut/preview/previewDecorator.ts | 138 - .../test/ut/render/forEach/forEach01.ts | 69 - .../test/ut/render/forEach/forEach02.ts | 64 - .../test/ut/render/forEach/forEach03.ts | 77 - .../test/ut/render/forEach/forEach04.ts | 65 - .../ut/render/forEach/forEachComplexModel.ts | 131 - .../ut/render/forEach/forEachSimpleModel.ts | 85 - compiler/compiler/test/ut/render/if/if.ts | 207 - .../test/ut/render/if/ifIncludeForEach.ts | 131 - compiler/compiler/test/ut/struct/struct_01.ts | 39 - compiler/compiler/test/ut/struct/struct_02.ts | 28 - .../compiler/test/ut/transition/transition.ts | 111 - compiler/compiler/tsconfig.json | 26 - compiler/compiler/uglify-source.js | 44 - compiler/compiler/webpack.config.js | 188 - 123 files changed, 23045 deletions(-) delete mode 100644 compiler/compiler/.eslintrc delete mode 100644 compiler/compiler/README.md delete mode 100644 compiler/compiler/babel.config.js delete mode 100644 compiler/compiler/build_declarations_file.js delete mode 100644 compiler/compiler/build_parser.js delete mode 100644 compiler/compiler/main.js delete mode 100644 compiler/compiler/npm-install.js delete mode 100644 compiler/compiler/package-lock.json delete mode 100644 compiler/compiler/package.json delete mode 100644 compiler/compiler/sample/app.ets delete mode 100644 compiler/compiler/sample/manifest.json delete mode 100644 compiler/compiler/sample/pages/home.ets delete mode 100644 compiler/compiler/sample/pages/home_preview.ets delete mode 100644 compiler/compiler/sample/pages/index.ets delete mode 100644 compiler/compiler/sample/pages/testcases/component-01.ets delete mode 100644 compiler/compiler/sample/pages/testcases/componentGridTest.ets delete mode 100644 compiler/compiler/sample/pages/testcases/componentListTest.ets delete mode 100644 compiler/compiler/sample/pages/testcases/constructor-01.ets delete mode 100644 compiler/compiler/sample/pages/testcases/constructor-02.ets delete mode 100644 compiler/compiler/sample/pages/testcases/constructor-03.ets delete mode 100644 compiler/compiler/sample/pages/testcases/expected/component-01-expected.js delete mode 100644 compiler/compiler/sample/pages/testcases/expected/constructor-01-expected.js delete mode 100644 compiler/compiler/sample/pages/testcases/expected/constructor-02-expected.js delete mode 100644 compiler/compiler/sample/pages/testcases/expected/constructor-03-expected.js delete mode 100644 compiler/compiler/sample/pages/testcases/expected/link-01-expected.js delete mode 100644 compiler/compiler/sample/pages/testcases/expected/new-01-expected.js delete mode 100644 compiler/compiler/sample/pages/testcases/expected/new-02-expected.js delete mode 100644 compiler/compiler/sample/pages/testcases/expected/new-03-expected.js delete mode 100644 compiler/compiler/sample/pages/testcases/expected/new-04-expected.js delete mode 100644 compiler/compiler/sample/pages/testcases/expected/struct-01-expected.js delete mode 100644 compiler/compiler/sample/pages/testcases/expected/struct-02-expected.js delete mode 100644 compiler/compiler/sample/pages/testcases/forEachComplexModel.ets delete mode 100644 compiler/compiler/sample/pages/testcases/forEachSimpleModel.ets delete mode 100644 compiler/compiler/sample/pages/testcases/image.ets delete mode 100644 compiler/compiler/sample/pages/testcases/import-api-01.ets delete mode 100644 compiler/compiler/sample/pages/testcases/link-01.ets delete mode 100644 compiler/compiler/sample/pages/testcases/linkArrayModel.ets delete mode 100644 compiler/compiler/sample/pages/testcases/linkPropCombo.ets delete mode 100644 compiler/compiler/sample/pages/testcases/linkSimpleModel.ets delete mode 100644 compiler/compiler/sample/pages/testcases/new-01.ets delete mode 100644 compiler/compiler/sample/pages/testcases/new-0101.ets delete mode 100644 compiler/compiler/sample/pages/testcases/new-02.ets delete mode 100644 compiler/compiler/sample/pages/testcases/new-03.ets delete mode 100644 compiler/compiler/sample/pages/testcases/new-04.ets delete mode 100644 compiler/compiler/sample/pages/testcases/onclicktest.ets delete mode 100644 compiler/compiler/sample/pages/testcases/propSimpleModel.ets delete mode 100644 compiler/compiler/sample/pages/testcases/showcaseCovid19.ets delete mode 100644 compiler/compiler/sample/pages/testcases/simpleText.ets delete mode 100644 compiler/compiler/sample/pages/testcases/stacktestsuite.ets delete mode 100644 compiler/compiler/sample/pages/testcases/stateArrayReverse.ets delete mode 100644 compiler/compiler/sample/pages/testcases/stateArrayReverseCustomView.ets delete mode 100644 compiler/compiler/sample/pages/testcases/stateComplexType.ets delete mode 100644 compiler/compiler/sample/pages/testcases/stateStateBindingProp.ets delete mode 100644 compiler/compiler/sample/pages/testcases/struct-01.ets delete mode 100644 compiler/compiler/sample/pages/testcases/struct-02.ets delete mode 100644 compiler/compiler/sample/pages/todo.ets delete mode 100644 compiler/compiler/src/compile_info.ts delete mode 100644 compiler/compiler/src/component_map.ts delete mode 100644 compiler/compiler/src/create.ts delete mode 100644 compiler/compiler/src/gen_abc_plugin.ts delete mode 100644 compiler/compiler/src/pre_define.ts delete mode 100644 compiler/compiler/src/pre_process.ts delete mode 100644 compiler/compiler/src/process_component_build.ts delete mode 100644 compiler/compiler/src/process_component_class.ts delete mode 100644 compiler/compiler/src/process_component_constructor.ts delete mode 100644 compiler/compiler/src/process_component_member.ts delete mode 100644 compiler/compiler/src/process_custom_component.ts delete mode 100644 compiler/compiler/src/process_import.ts delete mode 100644 compiler/compiler/src/process_system_module.ts delete mode 100644 compiler/compiler/src/process_ui_syntax.ts delete mode 100644 compiler/compiler/src/result_process.ts delete mode 100644 compiler/compiler/src/utils.ts delete mode 100644 compiler/compiler/src/validate_ui_syntax.ts delete mode 100644 compiler/compiler/syntax_parser/src/parse_extend.peg delete mode 100644 compiler/compiler/syntax_parser/src/syntax_parser.peg delete mode 100644 compiler/compiler/test/README.md delete mode 100644 compiler/compiler/test/pages/AMDComponent.ets delete mode 100644 compiler/compiler/test/pages/DefaultComponent.ets delete mode 100644 compiler/compiler/test/pages/ExportComponent.ets delete mode 100644 compiler/compiler/test/pages/ExportStarComponent.ets delete mode 100644 compiler/compiler/test/pages/LinkComponent.ets delete mode 100644 compiler/compiler/test/pages/NamespaceComponent.ets delete mode 100644 compiler/compiler/test/pages/TsModule.ts delete mode 100644 compiler/compiler/test/test.ts delete mode 100644 compiler/compiler/test/ut/animation/animation.ts delete mode 100644 compiler/compiler/test/ut/build/build.ts delete mode 100644 compiler/compiler/test/ut/component/component.ts delete mode 100644 compiler/compiler/test/ut/component/customComponent.ts delete mode 100644 compiler/compiler/test/ut/constructor/id.ts delete mode 100644 compiler/compiler/test/ut/constructor/link.ts delete mode 100644 compiler/compiler/test/ut/constructor/observedObjectLink.ts delete mode 100644 compiler/compiler/test/ut/constructor/prop.ts delete mode 100644 compiler/compiler/test/ut/constructor/provideConsume.ts delete mode 100644 compiler/compiler/test/ut/constructor/state.ts delete mode 100644 compiler/compiler/test/ut/customDialog/customDialog.ts delete mode 100644 compiler/compiler/test/ut/decorator/builder.ts delete mode 100644 compiler/compiler/test/ut/decorator/extend.ts delete mode 100644 compiler/compiler/test/ut/decorator/watch.ts delete mode 100644 compiler/compiler/test/ut/decorator/watchWithAnimateTo.ts delete mode 100644 compiler/compiler/test/ut/geometryReader/geometryReader.ts delete mode 100644 compiler/compiler/test/ut/gesture/panGestrue.ts delete mode 100644 compiler/compiler/test/ut/gesture/pinchGesture.ts delete mode 100644 compiler/compiler/test/ut/gesture/rotationGesture.ts delete mode 100644 compiler/compiler/test/ut/gesture/tapGesture.ts delete mode 100644 compiler/compiler/test/ut/import/importEts.ts delete mode 100644 compiler/compiler/test/ut/import/importSystemApi.ts delete mode 100644 compiler/compiler/test/ut/import/importTs.ts delete mode 100644 compiler/compiler/test/ut/link/createLinkReference.ts delete mode 100644 compiler/compiler/test/ut/preview/previewDecorator.ts delete mode 100644 compiler/compiler/test/ut/render/forEach/forEach01.ts delete mode 100644 compiler/compiler/test/ut/render/forEach/forEach02.ts delete mode 100644 compiler/compiler/test/ut/render/forEach/forEach03.ts delete mode 100644 compiler/compiler/test/ut/render/forEach/forEach04.ts delete mode 100644 compiler/compiler/test/ut/render/forEach/forEachComplexModel.ts delete mode 100644 compiler/compiler/test/ut/render/forEach/forEachSimpleModel.ts delete mode 100644 compiler/compiler/test/ut/render/if/if.ts delete mode 100644 compiler/compiler/test/ut/render/if/ifIncludeForEach.ts delete mode 100644 compiler/compiler/test/ut/struct/struct_01.ts delete mode 100644 compiler/compiler/test/ut/struct/struct_02.ts delete mode 100644 compiler/compiler/test/ut/transition/transition.ts delete mode 100644 compiler/compiler/tsconfig.json delete mode 100644 compiler/compiler/uglify-source.js delete mode 100644 compiler/compiler/webpack.config.js diff --git a/compiler/compiler/.eslintrc b/compiler/compiler/.eslintrc deleted file mode 100644 index 4d0ce2fbc..000000000 --- a/compiler/compiler/.eslintrc +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - -{ - "parserOptions": { - "ecmaVersion": 7, - "sourceType": "module" - }, - - "env": { - "es6": true, - "node": true, - "mocha": true - }, - - "extends": "eslint:recommended", - "parser": "@typescript-eslint/parser", - - "rules": { - "camelcase": [2, { "properties": "never" }], - "accessor-pairs": 2, - "arrow-spacing": 2, - "block-spacing": 2, - "brace-style": 2, - "comma-dangle": 2, - "comma-spacing": 2, - "comma-style": 2, - "curly": 2, - "dot-location": [2, "property"], - "eol-last": 2, - "eqeqeq": 2, - "indent": [2, 2, { "SwitchCase": 1 }], - "key-spacing": 2, - "keyword-spacing": 2, - "new-cap": 2, - "new-parens": 2, - "no-array-constructor": 2, - "no-caller": 2, - "no-eval": 2, - "no-extend-native": 2, - "no-extra-bind": 2, - "no-extra-parens": 2, - "no-floating-decimal": 2, - "no-implied-eval": 2, - "no-iterator": 2, - "no-label-var": 2, - "no-labels": 2, - "no-lone-blocks": 2, - "no-multi-spaces": 2, - "no-multi-str": 2, - "no-multiple-empty-lines": [2, { "max": 1 }], - "no-new-object": 2, - "no-new-wrappers": 2, - "no-octal-escape": 2, - "no-proto": 2, - "no-return-assign": 2, - "no-self-compare": 2, - "no-sequences": 2, - "func-call-spacing": 2, - "no-throw-literal": 2, - "no-trailing-spaces": 2, - "no-undef-init": 2, - "no-unmodified-loop-condition": 2, - "no-unneeded-ternary": [2, { "defaultAssignment": false }], - "no-unused-vars": [2, { "vars": "all", "args": "none" }], - "no-useless-computed-key": 2, - "no-useless-constructor": 2, - "no-whitespace-before-property": 2, - "one-var": [2, { "initialized": "never" }], - "padded-blocks": [2, "never"], - "quotes": [2, "single", {"avoidEscape": true, "allowTemplateLiterals": true}], - "semi": 2, - "semi-spacing": 2, - "space-before-blocks": 2, - "space-before-function-paren": [2, "never"], - "space-in-parens": 2, - "space-infix-ops": 2, - "space-unary-ops": [2, { "words": true, "nonwords": false }], - "spaced-comment": 2, - "template-curly-spacing": 2, - "wrap-iife": [2, "any"], - "no-var": 2, - "prefer-const": 2, - "array-bracket-spacing": 2 - }, - - "settings": { - "flowtype": { - "onlyFilesWithFlowAnnotation": true - } - } -} diff --git a/compiler/compiler/README.md b/compiler/compiler/README.md deleted file mode 100644 index f3d80c2f2..000000000 --- a/compiler/compiler/README.md +++ /dev/null @@ -1,81 +0,0 @@ -# compiler - -**The compiler tool chain for ace2.0.** - -## Usage -Here are simplified instructions of how to get started. The following commands work both on **Windows** and **Linux** platforms. - -### 1. Install - -First, enter the root directory of the compiler: -``` -$ cd compiler/ -``` -And then install the npm dependencies(You must have node&npm installed): -``` -$ npm install -``` -**Note**: If some errors occur, delete the generated package `node_modules`, please check the following items: - -First, check whether your node version is 12.x or later; -Secondly, config npm proxy and run `npm install` again. -``` -npm config set strict-ssl false -npm config set registry https://cmc.centralrepo.rnd.huawei.com/npm/ -``` - -### 2. Quick Start - -For a quick start - -In the root directory of `compiler/`: -``` -$ npm run build -$ npm run compile -``` -The `sample` project will be compiled. The output is in the `sample/build` directory. - -### 3. Create a new project - -The way to create a new project - -In the root directory of `compiler/`: -``` -$ npm run build -$ npm run create [projectName] -``` - -**Note**: If `projectName` is empty, create the `HelloAce` project by default. - -For example, use the following line to create a project named `foo`: -``` -$ npm run create foo -``` -The directory structure of project `foo`: -- foo - - pages - - index.ets - - app.ets - - manifest.json - -### 4. Create a new page - -For example, create a file `bar.ets` in the `page` directory. And then add the following lines to `"page"` field in `manifest.json`: -``` - "pages": [ - "pages/index", - "pages/bar" - ] -``` - -### 5. Compile a project - -The way to compile a project - -In the root directory of `compiler/`: -``` -$ npm run build -$ npm run compile [projectName] -``` - -**Note**: If `projectName` is empty, compile the `sample` project by default. In the project root directory, the compilation result is in the `build` directory. diff --git a/compiler/compiler/babel.config.js b/compiler/compiler/babel.config.js deleted file mode 100644 index 1c8aa7051..000000000 --- a/compiler/compiler/babel.config.js +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2020 Huawei Device Co., Ltd. - * 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. - */ - -module.exports = function(api) { - api.cache(true); - - const presets = ['@babel/preset-env', '@babel/typescript']; - const plugins = [ - '@babel/plugin-transform-modules-commonjs', - '@babel/plugin-proposal-class-properties', - [ - '@babel/plugin-transform-arrow-functions', - { - spec: true - } - ] - ]; - - return { - presets, - plugins - }; -}; diff --git a/compiler/compiler/build_declarations_file.js b/compiler/compiler/build_declarations_file.js deleted file mode 100644 index 3b016b636..000000000 --- a/compiler/compiler/build_declarations_file.js +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - -const ts = require('typescript') -const path = require('path') -const fs = require('fs') - -generateTargetFile(process.argv[2], process.argv[3]); -function generateTargetFile(filePath, output) { - const files = []; - const globalTsFile = path.resolve(filePath, '../../global.d.ts'); - if (fs.existsSync(globalTsFile)) { - files.push(globalTsFile); - } - readFile(filePath, files); - if (!fs.existsSync(output)) { - mkDir(output); - } - const license = `/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */`; - files.forEach((item) => { - const content = fs.readFileSync(item, 'utf8'); - const fileName = path.resolve(output, path.basename(item)); - const newContent = license + '\n\n' + processsFile(content, fileName); - fs.writeFile(fileName, newContent, err => { - if (err) { - console.error(err); - return; - } - }); - }); -} - -function readFile(dir, fileDir) { - const files = fs.readdirSync(dir); - files.forEach((element) => { - const filePath = path.join(dir, element); - const status = fs.statSync(filePath); - if (status.isDirectory()) { - readFile(filePath, fileDir); - } else { - fileDir.push(filePath); - } - }); -} - -function mkDir(filePath) { - const parent = path.join(filePath, '..'); - if (!(fs.existsSync(parent) && !fs.statSync(parent).isFile())) { - mkDir(parent); - } - fs.mkdirSync(filePath); -} - -function processsFile(content, fileName) { - let sourceFile = ts.createSourceFile(fileName, content, ts.ScriptTarget.Latest, true, ts.ScriptKind.TS); - const newStatements = []; - if (sourceFile.statements && sourceFile.statements.length) { - sourceFile.statements.forEach((node) => { - if (!ts.isImportDeclaration(node)) { - if (node.modifiers && node.modifiers.length && node.modifiers[0].kind === ts.SyntaxKind.ExportKeyword) { - node.modifiers.splice(0, 1); - } - if (isVariable(node)) { - const name = node.declarationList.declarations[0].name.getText(); - const type = node.declarationList.declarations[0].type.getText(); - if (name.indexOf(type) !== -1) { - const declarationNode = ts.factory.updateVariableDeclaration(node.declarationList.declarations[0], - ts.factory.createIdentifier(type), node.declarationList.declarations[0].exclamationToken, - node.declarationList.declarations[0].type, node.declarationList.declarations[0].initializer); - node.declarationList = ts.factory.updateVariableDeclarationList(node.declarationList, [declarationNode]); - } - } - newStatements.push(node); - } - }); - } - sourceFile = ts.factory.updateSourceFile(sourceFile, newStatements); - const printer = ts.createPrinter({ removeComments: true, newLine: ts.NewLineKind.LineFeed }); - const result = printer.printNode(ts.EmitHint.Unspecified, sourceFile, sourceFile); - return result; -} - -function isVariable(node) { - if (ts.isVariableStatement(node) && node.declarationList && node.declarationList.declarations && - node.declarationList.declarations.length && ts.isVariableDeclaration(node.declarationList.declarations[0]) && - node.declarationList.declarations[0].name && node.declarationList.declarations[0].type) { - return true; - } - return false; -} - -generateComponentConfig(process.argv[4]); -function generateComponentConfig(dir) { - const configFile = path.resolve(dir, 'component_map.js'); - if (fs.existsSync(configFile)) { - const { COMPONENT_MAP } = require(configFile); - try { - fs.writeFileSync(path.resolve(dir, '../component_config.json'), JSON.stringify(COMPONENT_MAP)); - } catch (error) { - console.error(error); - } - } -} diff --git a/compiler/compiler/build_parser.js b/compiler/compiler/build_parser.js deleted file mode 100644 index 03f79ad7d..000000000 --- a/compiler/compiler/build_parser.js +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - -const util = require('util'); -const childProcess = require('child_process'); -const exec = util.promisify(childProcess.exec); -const fs = require('fs'); -const path = require('path'); - -function generateSyntaxParser(inputFile, nodePath) { - const readDirPath = path.resolve(__dirname, './syntax_parser/src'); - const readDirSubFiles = fs.readdirSync(readDirPath); - const catalogPath = path.resolve(inputFile, '..'); - const catalogSubFiles = fs.readdirSync(catalogPath) - const parserPath = path.resolve(__dirname, './node_modules/pegjs/bin/pegjs'); - - if (catalogSubFiles.includes('dist')) { - exec('rm -rf ' + catalogPath + '/dist/*.js'); - } else { - exec('mkdir ' + catalogPath + '/dist'); - } - - ;(async function transJs () { - if (readDirSubFiles.length) { - for (let item of readDirSubFiles) { - let name = path.basename(item, '.peg'); - if (name){ - await exec(nodePath + ' ' + parserPath + ' -o ' + - catalogPath + '/dist/' + name + '.js ' + readDirPath + '/' + item); - } - } - } - })() -} - -generateSyntaxParser(process.argv[2], process.argv[0]); diff --git a/compiler/compiler/main.js b/compiler/compiler/main.js deleted file mode 100644 index b356e486b..000000000 --- a/compiler/compiler/main.js +++ /dev/null @@ -1,154 +0,0 @@ -/* - * Copyright (c) 2020 Huawei Device Co., Ltd. - * 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. - */ - -const fs = require('fs'); -const path = require('path'); - -const { readFile } = require('./lib/utils'); -const { WORKERS_DIR } = require('./lib/pre_define'); - -const { - configure, - getLogger -} = require('log4js'); - -configure({ - appenders: { 'ETS': {type: 'stderr', layout: {type: 'messagePassThrough'}}}, - categories: {'default': {appenders: ['ETS'], level: 'info'}} -}); -const logger = getLogger('ETS'); - -const staticPreviewPage = process.env.aceStaticPreview; -const abilityConfig = { - abilityType: process.env.abilityType || 'page', - abilityEntryFile: null -}; -const projectConfig = {}; -const resources = { - app: {}, - sys: {} -}; - -function initProjectConfig(projectConfig) { - projectConfig.entryObj = {}; - projectConfig.projectPath = projectConfig.projectPath || process.env.aceModuleRoot || - path.join(process.cwd(), 'sample'); - projectConfig.buildPath = projectConfig.buildPath || process.env.aceModuleBuild || - path.resolve(projectConfig.projectPath, 'build'); - projectConfig.manifestFilePath = projectConfig.manifestFilePath || process.env.aceManifestPath || - path.join(projectConfig.projectPath, 'manifest.json'); -} - -function loadEntryObj(projectConfig) { - initProjectConfig(projectConfig); - setEntryFile(projectConfig); - - if(staticPreviewPage) { - projectConfig.entryObj['./' + staticPreviewPage] = projectConfig.projectPath + path.sep + - staticPreviewPage + '.ets?entry'; - } else if (abilityConfig.abilityType === 'page') { - let manifest = {}; - try { - const jsonString = fs.readFileSync(projectConfig.manifestFilePath).toString(); - manifest = JSON.parse(jsonString); - } catch (error) { - throw Error(`\u001b[31m ERROR: the manifest file '${projectConfig.manifestFilePath}' is lost or format is invalid. \u001b[39m`).message; - } - if (manifest.pages) { - const pages = manifest.pages; - pages.forEach((element) => { - const fileName = projectConfig.projectPath + path.sep + element + '.ets'; - if (fs.existsSync(fileName)) { - projectConfig.entryObj['./' + element] = fileName + '?entry'; - } else { - throw Error(`\u001b[31m ERROR: page '${fileName}' does not exist. \u001b[39m`).message; - } - }); - } else { - throw Error(`\u001b[31m ERROR: missing pages attribute in '${projectConfig.manifestFilePath}'. \u001b[39m`).message; - } - } -} - -function setEntryFile(projectConfig) { - const entryFileName = abilityConfig.abilityType === 'page' ? 'app' : abilityConfig.abilityType; - const extendFile = entryFileName === 'app' ? '.ets' : '.ts'; - abilityConfig.abilityEntryFile = entryFileName + extendFile; - const entryFilePath = path.join(projectConfig.projectPath, abilityConfig.abilityEntryFile); - if (!fs.existsSync(entryFilePath)) { - throw Error(`\u001b[31m ERROR: missing ${entryFilePath}. \u001b[39m`).message; - } - projectConfig.entryObj[`./${entryFileName}`] = projectConfig.projectPath + `/${abilityConfig.abilityEntryFile}?entry`; -} - -function loadWorker(projectConfig) { - const workerPath = path.resolve(projectConfig.projectPath, WORKERS_DIR); - if (fs.existsSync(workerPath)) { - const workerFiles = []; - readFile(workerPath, workerFiles); - workerFiles.forEach((item) => { - if (/\.(ts|js)$/.test(item)) { - const relativePath = path.relative(workerPath, item).replace(/\.(ts|js)$/, ''); - projectConfig.entryObj[`./${WORKERS_DIR}/` + relativePath] = item; - } - }) - } -} - -;(function initSystemResource() { - const sysResourcePath = path.resolve('./sysResource.js'); - if (fs.existsSync(sysResourcePath)) { - resources.sys = require(sysResourcePath).sys; - } -})() - -function readAppResource(resources, filePath) { - if (fs.existsSync(filePath)) { - const appResource = fs.readFileSync(filePath, "utf-8"); - const resourceArr = appResource.split(/\n/); - let resourceMap = new Map(); - for (let i = 0; i < resourceArr.length; i++) { - if (!resourceArr[i].length) { - continue; - } - const resourceData = resourceArr[i].split(/\s/); - if (resourceData.length === 3 && Number(resourceData[2]) !== NaN ) { - if (resourceMap.get(resourceData[0])) { - const resourceKeys = resourceMap.get(resourceData[0]); - if (!resourceKeys[resourceData[1]] || resourceKeys[resourceData[1]] !== Number(resourceData[2])) { - resourceKeys[resourceData[1]] = Number(resourceData[2]); - } - } else { - let obj = {}; - obj[resourceData[1]] = Number(resourceData[2]); - resourceMap.set(resourceData[0], obj); - } - } else { - logger.warn(`\u001b[31m ETS:WARN The format of file '${filePath}' is incorrect. \u001b[39m`); - break; - } - } - for (let [key, value] of resourceMap) { - resources.app[key] = value; - } - } -} - -exports.projectConfig = projectConfig; -exports.loadEntryObj = loadEntryObj; -exports.readAppResource = readAppResource; -exports.resources = resources; -exports.loadWorker = loadWorker; -exports.abilityConfig = abilityConfig; diff --git a/compiler/compiler/npm-install.js b/compiler/compiler/npm-install.js deleted file mode 100644 index 32ae7ec45..000000000 --- a/compiler/compiler/npm-install.js +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - -'use strict'; -const path = require('path'); -const fs = require('fs'); -const exec = require('child_process').exec; - -const arkDir = path.resolve(__dirname, 'bin', "ark"); -if (!fs.existsSync(arkDir)) { - return; -} - -let isWin = !1; -let isMac = !1; - -if (fs.existsSync(path.join(arkDir, "build-win"))) { - isWin = !0; -} else if (fs.existsSync(path.join(arkDir, "build-mac"))) { - isMac = !0; -} else if (!fs.existsSync(path.join(arkDir, "build"))) { - throw Error("Error: find build fail").message; -} - -let cwd; -if (isWin) { - cwd = path.join(arkDir, "build-win"); -} else if (isMac) { - cwd = path.join(arkDir, "build-mac"); -} else { - cwd = path.join(arkDir, "build"); -} - -exec('npm install', { cwd: cwd }, function(err, stdout, stderr) { - console.log('[31m', stdout, '[39m'); - if (err !== null) { - console.error('[31m', `npm install filed: ${err}`, '[39m'); - } -}); diff --git a/compiler/compiler/package-lock.json b/compiler/compiler/package-lock.json deleted file mode 100644 index 7fa081a90..000000000 --- a/compiler/compiler/package-lock.json +++ /dev/null @@ -1,5700 +0,0 @@ -{ - "name": "compilier", - "version": "0.0.1", - "lockfileVersion": 1, - "requires": true, - "dependencies": { - "@babel/cli": { - "version": "7.15.4", - "resolved": "https://registry.nlark.com/@babel/cli/download/@babel/cli-7.15.4.tgz", - "integrity": "sha1-AOIeGStzjex5AMi7NicON3IXwKQ=", - "dev": true, - "requires": { - "@nicolo-ribaudo/chokidar-2": "2.1.8-no-fsevents.2", - "chokidar": "^3.4.0", - "commander": "^4.0.1", - "convert-source-map": "^1.1.0", - "fs-readdir-recursive": "^1.1.0", - "glob": "^7.0.0", - "make-dir": "^2.1.0", - "slash": "^2.0.0", - "source-map": "^0.5.0" - }, - "dependencies": { - "commander": { - "version": "4.1.1", - "resolved": "https://registry.nlark.com/commander/download/commander-4.1.1.tgz", - "integrity": "sha1-n9YCvZNilOnp70aj9NaWQESxgGg=", - "dev": true - }, - "slash": { - "version": "2.0.0", - "resolved": "https://registry.nlark.com/slash/download/slash-2.0.0.tgz", - "integrity": "sha1-3lUoUaF1nfOo8gZTVEL17E3eq0Q=", - "dev": true - }, - "source-map": { - "version": "0.5.7", - "resolved": "https://registry.nlark.com/source-map/download/source-map-0.5.7.tgz?cache=0&sync_timestamp=1624608014898&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fsource-map%2Fdownload%2Fsource-map-0.5.7.tgz", - "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", - "dev": true - } - } - }, - "@babel/code-frame": { - "version": "7.14.5", - "resolved": "https://registry.nlark.com/@babel/code-frame/download/@babel/code-frame-7.14.5.tgz", - "integrity": "sha1-I7CNdA6D9JxeWZRfvxtD6Au/Tts=", - "dev": true, - "requires": { - "@babel/highlight": "^7.14.5" - } - }, - "@babel/compat-data": { - "version": "7.15.0", - "resolved": "https://registry.nlark.com/@babel/compat-data/download/@babel/compat-data-7.15.0.tgz", - "integrity": "sha1-Lbr4uFM0eWyvuw9Xk6kKL8AQsXY=", - "dev": true - }, - "@babel/core": { - "version": "7.15.4", - "resolved": "https://registry.nlark.com/@babel/core/download/@babel/core-7.15.4.tgz?cache=0&sync_timestamp=1630618926729&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40babel%2Fcore%2Fdownload%2F%40babel%2Fcore-7.15.4.tgz", - "integrity": "sha1-pw0GxYrh/OOcI/jv15+dXriy85c=", - "dev": true, - "requires": { - "@babel/code-frame": "^7.14.5", - "@babel/generator": "^7.15.4", - "@babel/helper-compilation-targets": "^7.15.4", - "@babel/helper-module-transforms": "^7.15.4", - "@babel/helpers": "^7.15.4", - "@babel/parser": "^7.15.4", - "@babel/template": "^7.15.4", - "@babel/traverse": "^7.15.4", - "@babel/types": "^7.15.4", - "convert-source-map": "^1.7.0", - "debug": "^4.1.0", - "gensync": "^1.0.0-beta.2", - "json5": "^2.1.2", - "semver": "^6.3.0", - "source-map": "^0.5.0" - }, - "dependencies": { - "semver": { - "version": "6.3.0", - "resolved": "https://registry.nlark.com/semver/download/semver-6.3.0.tgz?cache=0&sync_timestamp=1624607961409&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fsemver%2Fdownload%2Fsemver-6.3.0.tgz", - "integrity": "sha1-7gpkyK9ejO6mdoexM3YeG+y9HT0=", - "dev": true - }, - "source-map": { - "version": "0.5.7", - "resolved": "https://registry.nlark.com/source-map/download/source-map-0.5.7.tgz?cache=0&sync_timestamp=1624608014898&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fsource-map%2Fdownload%2Fsource-map-0.5.7.tgz", - "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", - "dev": true - } - } - }, - "@babel/generator": { - "version": "7.15.4", - "resolved": "https://registry.nlark.com/@babel/generator/download/@babel/generator-7.15.4.tgz", - "integrity": "sha1-hayxWaJnymMk+Xk5hpke4gIqBbA=", - "dev": true, - "requires": { - "@babel/types": "^7.15.4", - "jsesc": "^2.5.1", - "source-map": "^0.5.0" - }, - "dependencies": { - "source-map": { - "version": "0.5.7", - "resolved": "https://registry.nlark.com/source-map/download/source-map-0.5.7.tgz?cache=0&sync_timestamp=1624608014898&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fsource-map%2Fdownload%2Fsource-map-0.5.7.tgz", - "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", - "dev": true - } - } - }, - "@babel/helper-annotate-as-pure": { - "version": "7.15.4", - "resolved": "https://registry.nlark.com/@babel/helper-annotate-as-pure/download/@babel/helper-annotate-as-pure-7.15.4.tgz", - "integrity": "sha1-PQ5DsAxeSf22xX5CFgGnpljV+DU=", - "dev": true, - "requires": { - "@babel/types": "^7.15.4" - } - }, - "@babel/helper-builder-binary-assignment-operator-visitor": { - "version": "7.15.4", - "resolved": "https://registry.nlark.com/@babel/helper-builder-binary-assignment-operator-visitor/download/@babel/helper-builder-binary-assignment-operator-visitor-7.15.4.tgz", - "integrity": "sha1-Ia2BX2CbhO4OMFhnbDPPbRZwUl8=", - "dev": true, - "requires": { - "@babel/helper-explode-assignable-expression": "^7.15.4", - "@babel/types": "^7.15.4" - } - }, - "@babel/helper-compilation-targets": { - "version": "7.15.4", - "resolved": "https://registry.nlark.com/@babel/helper-compilation-targets/download/@babel/helper-compilation-targets-7.15.4.tgz", - "integrity": "sha1-z22U8w++/BORI+J91rAvZa7tt7k=", - "dev": true, - "requires": { - "@babel/compat-data": "^7.15.0", - "@babel/helper-validator-option": "^7.14.5", - "browserslist": "^4.16.6", - "semver": "^6.3.0" - }, - "dependencies": { - "semver": { - "version": "6.3.0", - "resolved": "https://registry.nlark.com/semver/download/semver-6.3.0.tgz?cache=0&sync_timestamp=1624607961409&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fsemver%2Fdownload%2Fsemver-6.3.0.tgz", - "integrity": "sha1-7gpkyK9ejO6mdoexM3YeG+y9HT0=", - "dev": true - } - } - }, - "@babel/helper-create-class-features-plugin": { - "version": "7.15.4", - "resolved": "https://registry.nlark.com/@babel/helper-create-class-features-plugin/download/@babel/helper-create-class-features-plugin-7.15.4.tgz", - "integrity": "sha1-f5d8F70SpfujY8sZvqCQOUvzfS4=", - "dev": true, - "requires": { - "@babel/helper-annotate-as-pure": "^7.15.4", - "@babel/helper-function-name": "^7.15.4", - "@babel/helper-member-expression-to-functions": "^7.15.4", - "@babel/helper-optimise-call-expression": "^7.15.4", - "@babel/helper-replace-supers": "^7.15.4", - "@babel/helper-split-export-declaration": "^7.15.4" - } - }, - "@babel/helper-create-regexp-features-plugin": { - "version": "7.14.5", - "resolved": "https://registry.nlark.com/@babel/helper-create-regexp-features-plugin/download/@babel/helper-create-regexp-features-plugin-7.14.5.tgz", - "integrity": "sha1-x9WsXpz2IcJgV3Ivt6ikxYiTWMQ=", - "dev": true, - "requires": { - "@babel/helper-annotate-as-pure": "^7.14.5", - "regexpu-core": "^4.7.1" - } - }, - "@babel/helper-define-polyfill-provider": { - "version": "0.2.3", - "resolved": "https://registry.nlark.com/@babel/helper-define-polyfill-provider/download/@babel/helper-define-polyfill-provider-0.2.3.tgz", - "integrity": "sha1-BSXt7FCUZTooJojTTYRuTHXpwLY=", - "dev": true, - "requires": { - "@babel/helper-compilation-targets": "^7.13.0", - "@babel/helper-module-imports": "^7.12.13", - "@babel/helper-plugin-utils": "^7.13.0", - "@babel/traverse": "^7.13.0", - "debug": "^4.1.1", - "lodash.debounce": "^4.0.8", - "resolve": "^1.14.2", - "semver": "^6.1.2" - }, - "dependencies": { - "semver": { - "version": "6.3.0", - "resolved": "https://registry.nlark.com/semver/download/semver-6.3.0.tgz?cache=0&sync_timestamp=1624607961409&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fsemver%2Fdownload%2Fsemver-6.3.0.tgz", - "integrity": "sha1-7gpkyK9ejO6mdoexM3YeG+y9HT0=", - "dev": true - } - } - }, - "@babel/helper-explode-assignable-expression": { - "version": "7.15.4", - "resolved": "https://registry.nlark.com/@babel/helper-explode-assignable-expression/download/@babel/helper-explode-assignable-expression-7.15.4.tgz", - "integrity": "sha1-+a7J0hnycer5K59WFZjKayaCYAw=", - "dev": true, - "requires": { - "@babel/types": "^7.15.4" - } - }, - "@babel/helper-function-name": { - "version": "7.15.4", - "resolved": "https://registry.nlark.com/@babel/helper-function-name/download/@babel/helper-function-name-7.15.4.tgz", - "integrity": "sha1-hFdE2vxDgaSl+2r6bD02+Yp4frw=", - "dev": true, - "requires": { - "@babel/helper-get-function-arity": "^7.15.4", - "@babel/template": "^7.15.4", - "@babel/types": "^7.15.4" - } - }, - "@babel/helper-get-function-arity": { - "version": "7.15.4", - "resolved": "https://registry.nlark.com/@babel/helper-get-function-arity/download/@babel/helper-get-function-arity-7.15.4.tgz", - "integrity": "sha1-CYgYk0oTf854tTaj4BWGS+Hih5s=", - "dev": true, - "requires": { - "@babel/types": "^7.15.4" - } - }, - "@babel/helper-hoist-variables": { - "version": "7.15.4", - "resolved": "https://registry.nlark.com/@babel/helper-hoist-variables/download/@babel/helper-hoist-variables-7.15.4.tgz", - "integrity": "sha1-CZk6MlnA6Rj5nRBCYd/fwDPxeN8=", - "dev": true, - "requires": { - "@babel/types": "^7.15.4" - } - }, - "@babel/helper-member-expression-to-functions": { - "version": "7.15.4", - "resolved": "https://registry.nlark.com/@babel/helper-member-expression-to-functions/download/@babel/helper-member-expression-to-functions-7.15.4.tgz", - "integrity": "sha1-v9NNybupgkpGWLAxfsL9VxpR5u8=", - "dev": true, - "requires": { - "@babel/types": "^7.15.4" - } - }, - "@babel/helper-module-imports": { - "version": "7.15.4", - "resolved": "https://registry.nlark.com/@babel/helper-module-imports/download/@babel/helper-module-imports-7.15.4.tgz", - "integrity": "sha1-4YAH0jBjLeoZtHhTuYRHbntOED8=", - "dev": true, - "requires": { - "@babel/types": "^7.15.4" - } - }, - "@babel/helper-module-transforms": { - "version": "7.15.4", - "resolved": "https://registry.nlark.com/@babel/helper-module-transforms/download/@babel/helper-module-transforms-7.15.4.tgz", - "integrity": "sha1-lizGKaf3+aCC3WLQMH+nX+h4jXw=", - "dev": true, - "requires": { - "@babel/helper-module-imports": "^7.15.4", - "@babel/helper-replace-supers": "^7.15.4", - "@babel/helper-simple-access": "^7.15.4", - "@babel/helper-split-export-declaration": "^7.15.4", - "@babel/helper-validator-identifier": "^7.14.9", - "@babel/template": "^7.15.4", - "@babel/traverse": "^7.15.4", - "@babel/types": "^7.15.4" - } - }, - "@babel/helper-optimise-call-expression": { - "version": "7.15.4", - "resolved": "https://registry.nlark.com/@babel/helper-optimise-call-expression/download/@babel/helper-optimise-call-expression-7.15.4.tgz", - "integrity": "sha1-8xClEho7nMUtmrGRIr1ymCLe4XE=", - "dev": true, - "requires": { - "@babel/types": "^7.15.4" - } - }, - "@babel/helper-plugin-utils": { - "version": "7.14.5", - "resolved": "https://registry.nlark.com/@babel/helper-plugin-utils/download/@babel/helper-plugin-utils-7.14.5.tgz", - "integrity": "sha1-WsgizpfuxGdBq3ClF5ceRDpwxak=", - "dev": true - }, - "@babel/helper-remap-async-to-generator": { - "version": "7.15.4", - "resolved": "https://registry.nlark.com/@babel/helper-remap-async-to-generator/download/@babel/helper-remap-async-to-generator-7.15.4.tgz", - "integrity": "sha1-JjfAcx5MkPv1isWLULK1oZL8lw8=", - "dev": true, - "requires": { - "@babel/helper-annotate-as-pure": "^7.15.4", - "@babel/helper-wrap-function": "^7.15.4", - "@babel/types": "^7.15.4" - } - }, - "@babel/helper-replace-supers": { - "version": "7.15.4", - "resolved": "https://registry.nlark.com/@babel/helper-replace-supers/download/@babel/helper-replace-supers-7.15.4.tgz", - "integrity": "sha1-UqirJrqRjH9t7ihiiwcHGse3NHo=", - "dev": true, - "requires": { - "@babel/helper-member-expression-to-functions": "^7.15.4", - "@babel/helper-optimise-call-expression": "^7.15.4", - "@babel/traverse": "^7.15.4", - "@babel/types": "^7.15.4" - } - }, - "@babel/helper-simple-access": { - "version": "7.15.4", - "resolved": "https://registry.nlark.com/@babel/helper-simple-access/download/@babel/helper-simple-access-7.15.4.tgz", - "integrity": "sha1-rDaJBavx3o6XgUNLY12PhnS8wTs=", - "dev": true, - "requires": { - "@babel/types": "^7.15.4" - } - }, - "@babel/helper-skip-transparent-expression-wrappers": { - "version": "7.15.4", - "resolved": "https://registry.nlark.com/@babel/helper-skip-transparent-expression-wrappers/download/@babel/helper-skip-transparent-expression-wrappers-7.15.4.tgz", - "integrity": "sha1-cH29uh9K0Po0+RFPyBl67H1dous=", - "dev": true, - "requires": { - "@babel/types": "^7.15.4" - } - }, - "@babel/helper-split-export-declaration": { - "version": "7.15.4", - "resolved": "https://registry.nlark.com/@babel/helper-split-export-declaration/download/@babel/helper-split-export-declaration-7.15.4.tgz", - "integrity": "sha1-rsq5Lc2+9qEKo7YqsgSwhfd24lc=", - "dev": true, - "requires": { - "@babel/types": "^7.15.4" - } - }, - "@babel/helper-validator-identifier": { - "version": "7.14.9", - "resolved": "https://registry.nlark.com/@babel/helper-validator-identifier/download/@babel/helper-validator-identifier-7.14.9.tgz?cache=0&sync_timestamp=1627804408187&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40babel%2Fhelper-validator-identifier%2Fdownload%2F%40babel%2Fhelper-validator-identifier-7.14.9.tgz", - "integrity": "sha1-ZlTRcbICT22O4VG/JQlpmRkTHUg=", - "dev": true - }, - "@babel/helper-validator-option": { - "version": "7.14.5", - "resolved": "https://registry.nlark.com/@babel/helper-validator-option/download/@babel/helper-validator-option-7.14.5.tgz", - "integrity": "sha1-bnKh//GNXfy4eOHmLxoCHEty1aM=", - "dev": true - }, - "@babel/helper-wrap-function": { - "version": "7.15.4", - "resolved": "https://registry.nlark.com/@babel/helper-wrap-function/download/@babel/helper-wrap-function-7.15.4.tgz", - "integrity": "sha1-b3VLJEbPrz1hJSPmq415wnw6Pec=", - "dev": true, - "requires": { - "@babel/helper-function-name": "^7.15.4", - "@babel/template": "^7.15.4", - "@babel/traverse": "^7.15.4", - "@babel/types": "^7.15.4" - } - }, - "@babel/helpers": { - "version": "7.15.4", - "resolved": "https://registry.nlark.com/@babel/helpers/download/@babel/helpers-7.15.4.tgz", - "integrity": "sha1-X0DwIFCjAnEho89I1JfAXFVer0M=", - "dev": true, - "requires": { - "@babel/template": "^7.15.4", - "@babel/traverse": "^7.15.4", - "@babel/types": "^7.15.4" - } - }, - "@babel/highlight": { - "version": "7.14.5", - "resolved": "https://registry.nlark.com/@babel/highlight/download/@babel/highlight-7.14.5.tgz", - "integrity": "sha1-aGGlLwOWZAUAH2qlNKAaJNmejNk=", - "dev": true, - "requires": { - "@babel/helper-validator-identifier": "^7.14.5", - "chalk": "^2.0.0", - "js-tokens": "^4.0.0" - }, - "dependencies": { - "ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.nlark.com/ansi-styles/download/ansi-styles-3.2.1.tgz", - "integrity": "sha1-QfuyAkPlCxK+DwS43tvwdSDOhB0=", - "dev": true, - "requires": { - "color-convert": "^1.9.0" - } - }, - "chalk": { - "version": "2.4.2", - "resolved": "https://registry.nlark.com/chalk/download/chalk-2.4.2.tgz?cache=0&sync_timestamp=1627646614989&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fchalk%2Fdownload%2Fchalk-2.4.2.tgz", - "integrity": "sha1-zUJUFnelQzPPVBpJEIwUMrRMlCQ=", - "dev": true, - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - } - }, - "color-convert": { - "version": "1.9.3", - "resolved": "https://registry.nlark.com/color-convert/download/color-convert-1.9.3.tgz?cache=0&sync_timestamp=1624607968569&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fcolor-convert%2Fdownload%2Fcolor-convert-1.9.3.tgz", - "integrity": "sha1-u3GFBpDh8TZWfeYp0tVHHe2kweg=", - "dev": true, - "requires": { - "color-name": "1.1.3" - } - }, - "color-name": { - "version": "1.1.3", - "resolved": "https://registry.nlark.com/color-name/download/color-name-1.1.3.tgz", - "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", - "dev": true - }, - "has-flag": { - "version": "3.0.0", - "resolved": "https://registry.nlark.com/has-flag/download/has-flag-3.0.0.tgz?cache=0&sync_timestamp=1626716578584&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fhas-flag%2Fdownload%2Fhas-flag-3.0.0.tgz", - "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", - "dev": true - }, - "supports-color": { - "version": "5.5.0", - "resolved": "https://registry.nlark.com/supports-color/download/supports-color-5.5.0.tgz?cache=0&sync_timestamp=1626703455199&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fsupports-color%2Fdownload%2Fsupports-color-5.5.0.tgz", - "integrity": "sha1-4uaaRKyHcveKHsCzW2id9lMO/I8=", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } - } - } - }, - "@babel/parser": { - "version": "7.15.4", - "resolved": "https://registry.nlark.com/@babel/parser/download/@babel/parser-7.15.4.tgz", - "integrity": "sha1-AvKTG4IlEtOq0X1HWug9p0olWoQ=", - "dev": true - }, - "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": { - "version": "7.15.4", - "resolved": "https://registry.nlark.com/@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining/download/@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining-7.15.4.tgz", - "integrity": "sha1-296rsegPYi2fC1g++ymZYF4KVn4=", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.14.5", - "@babel/helper-skip-transparent-expression-wrappers": "^7.15.4", - "@babel/plugin-proposal-optional-chaining": "^7.14.5" - } - }, - "@babel/plugin-proposal-async-generator-functions": { - "version": "7.15.4", - "resolved": "https://registry.nlark.com/@babel/plugin-proposal-async-generator-functions/download/@babel/plugin-proposal-async-generator-functions-7.15.4.tgz", - "integrity": "sha1-+Cqr6WwTXSzqqRf+ufX8oxY1J34=", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.14.5", - "@babel/helper-remap-async-to-generator": "^7.15.4", - "@babel/plugin-syntax-async-generators": "^7.8.4" - } - }, - "@babel/plugin-proposal-class-properties": { - "version": "7.14.5", - "resolved": "https://registry.nlark.com/@babel/plugin-proposal-class-properties/download/@babel/plugin-proposal-class-properties-7.14.5.tgz?cache=0&sync_timestamp=1624608012853&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40babel%2Fplugin-proposal-class-properties%2Fdownload%2F%40babel%2Fplugin-proposal-class-properties-7.14.5.tgz", - "integrity": "sha1-QNHuFAxbHjGjUPT17tlFCWVZtC4=", - "dev": true, - "requires": { - "@babel/helper-create-class-features-plugin": "^7.14.5", - "@babel/helper-plugin-utils": "^7.14.5" - } - }, - "@babel/plugin-proposal-class-static-block": { - "version": "7.15.4", - "resolved": "https://registry.nlark.com/@babel/plugin-proposal-class-static-block/download/@babel/plugin-proposal-class-static-block-7.15.4.tgz", - "integrity": "sha1-PnymEoRTwInotHepn5cMY/wcuNc=", - "dev": true, - "requires": { - "@babel/helper-create-class-features-plugin": "^7.15.4", - "@babel/helper-plugin-utils": "^7.14.5", - "@babel/plugin-syntax-class-static-block": "^7.14.5" - } - }, - "@babel/plugin-proposal-dynamic-import": { - "version": "7.14.5", - "resolved": "https://registry.nlark.com/@babel/plugin-proposal-dynamic-import/download/@babel/plugin-proposal-dynamic-import-7.14.5.tgz", - "integrity": "sha1-DGYX30YcDB+P/ztHzVl3I2AQHSw=", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.14.5", - "@babel/plugin-syntax-dynamic-import": "^7.8.3" - } - }, - "@babel/plugin-proposal-export-namespace-from": { - "version": "7.14.5", - "resolved": "https://registry.nlark.com/@babel/plugin-proposal-export-namespace-from/download/@babel/plugin-proposal-export-namespace-from-7.14.5.tgz", - "integrity": "sha1-260kQxDObM0IMHIWfYzqg6Uvr3Y=", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.14.5", - "@babel/plugin-syntax-export-namespace-from": "^7.8.3" - } - }, - "@babel/plugin-proposal-json-strings": { - "version": "7.14.5", - "resolved": "https://registry.nlark.com/@babel/plugin-proposal-json-strings/download/@babel/plugin-proposal-json-strings-7.14.5.tgz", - "integrity": "sha1-ON5g2zYug6PYyUSshY3fnwwiOes=", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.14.5", - "@babel/plugin-syntax-json-strings": "^7.8.3" - } - }, - "@babel/plugin-proposal-logical-assignment-operators": { - "version": "7.14.5", - "resolved": "https://registry.nlark.com/@babel/plugin-proposal-logical-assignment-operators/download/@babel/plugin-proposal-logical-assignment-operators-7.14.5.tgz", - "integrity": "sha1-bmIpwqmbAqspFfglceDMZGpAxzg=", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.14.5", - "@babel/plugin-syntax-logical-assignment-operators": "^7.10.4" - } - }, - "@babel/plugin-proposal-nullish-coalescing-operator": { - "version": "7.14.5", - "resolved": "https://registry.nlark.com/@babel/plugin-proposal-nullish-coalescing-operator/download/@babel/plugin-proposal-nullish-coalescing-operator-7.14.5.tgz?cache=0&sync_timestamp=1624607953699&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40babel%2Fplugin-proposal-nullish-coalescing-operator%2Fdownload%2F%40babel%2Fplugin-proposal-nullish-coalescing-operator-7.14.5.tgz", - "integrity": "sha1-7jhYnOAOLMWbKZ7D6kBvzToP2vY=", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.14.5", - "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3" - } - }, - "@babel/plugin-proposal-numeric-separator": { - "version": "7.14.5", - "resolved": "https://registry.nlark.com/@babel/plugin-proposal-numeric-separator/download/@babel/plugin-proposal-numeric-separator-7.14.5.tgz", - "integrity": "sha1-g2Mb8z2aUd8YTCECoGmsDFjAXxg=", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.14.5", - "@babel/plugin-syntax-numeric-separator": "^7.10.4" - } - }, - "@babel/plugin-proposal-object-rest-spread": { - "version": "7.14.7", - "resolved": "https://registry.nlark.com/@babel/plugin-proposal-object-rest-spread/download/@babel/plugin-proposal-object-rest-spread-7.14.7.tgz?cache=0&sync_timestamp=1624608013147&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40babel%2Fplugin-proposal-object-rest-spread%2Fdownload%2F%40babel%2Fplugin-proposal-object-rest-spread-7.14.7.tgz", - "integrity": "sha1-WSCis99/eQHfAgWXTAZBsT/Z02M=", - "dev": true, - "requires": { - "@babel/compat-data": "^7.14.7", - "@babel/helper-compilation-targets": "^7.14.5", - "@babel/helper-plugin-utils": "^7.14.5", - "@babel/plugin-syntax-object-rest-spread": "^7.8.3", - "@babel/plugin-transform-parameters": "^7.14.5" - } - }, - "@babel/plugin-proposal-optional-catch-binding": { - "version": "7.14.5", - "resolved": "https://registry.nlark.com/@babel/plugin-proposal-optional-catch-binding/download/@babel/plugin-proposal-optional-catch-binding-7.14.5.tgz", - "integrity": "sha1-k53W7d7/Omf997PwRLU0cmJZjDw=", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.14.5", - "@babel/plugin-syntax-optional-catch-binding": "^7.8.3" - } - }, - "@babel/plugin-proposal-optional-chaining": { - "version": "7.14.5", - "resolved": "https://registry.nlark.com/@babel/plugin-proposal-optional-chaining/download/@babel/plugin-proposal-optional-chaining-7.14.5.tgz", - "integrity": "sha1-+oNlHmCjYOPxN5fu8AuNUZaVtgM=", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.14.5", - "@babel/helper-skip-transparent-expression-wrappers": "^7.14.5", - "@babel/plugin-syntax-optional-chaining": "^7.8.3" - } - }, - "@babel/plugin-proposal-private-methods": { - "version": "7.14.5", - "resolved": "https://registry.nlark.com/@babel/plugin-proposal-private-methods/download/@babel/plugin-proposal-private-methods-7.14.5.tgz?cache=0&sync_timestamp=1624607954131&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40babel%2Fplugin-proposal-private-methods%2Fdownload%2F%40babel%2Fplugin-proposal-private-methods-7.14.5.tgz", - "integrity": "sha1-N0RklZlrKUXzD1vltg1eKqT1eS0=", - "dev": true, - "requires": { - "@babel/helper-create-class-features-plugin": "^7.14.5", - "@babel/helper-plugin-utils": "^7.14.5" - } - }, - "@babel/plugin-proposal-private-property-in-object": { - "version": "7.15.4", - "resolved": "https://registry.nlark.com/@babel/plugin-proposal-private-property-in-object/download/@babel/plugin-proposal-private-property-in-object-7.15.4.tgz", - "integrity": "sha1-VcXjtNAmH9RP5jfj9iTPsPSE4+U=", - "dev": true, - "requires": { - "@babel/helper-annotate-as-pure": "^7.15.4", - "@babel/helper-create-class-features-plugin": "^7.15.4", - "@babel/helper-plugin-utils": "^7.14.5", - "@babel/plugin-syntax-private-property-in-object": "^7.14.5" - } - }, - "@babel/plugin-proposal-unicode-property-regex": { - "version": "7.14.5", - "resolved": "https://registry.nlark.com/@babel/plugin-proposal-unicode-property-regex/download/@babel/plugin-proposal-unicode-property-regex-7.14.5.tgz", - "integrity": "sha1-D5XuDnV6XWR/N42qDsp+k/qou+g=", - "dev": true, - "requires": { - "@babel/helper-create-regexp-features-plugin": "^7.14.5", - "@babel/helper-plugin-utils": "^7.14.5" - } - }, - "@babel/plugin-syntax-async-generators": { - "version": "7.8.4", - "resolved": "https://registry.nlark.com/@babel/plugin-syntax-async-generators/download/@babel/plugin-syntax-async-generators-7.8.4.tgz", - "integrity": "sha1-qYP7Gusuw/btBCohD2QOkOeG/g0=", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.8.0" - } - }, - "@babel/plugin-syntax-class-properties": { - "version": "7.12.13", - "resolved": "https://registry.nlark.com/@babel/plugin-syntax-class-properties/download/@babel/plugin-syntax-class-properties-7.12.13.tgz", - "integrity": "sha1-tcmHJ0xKOoK4lxR5aTGmtTVErhA=", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.12.13" - } - }, - "@babel/plugin-syntax-class-static-block": { - "version": "7.14.5", - "resolved": "https://registry.nlark.com/@babel/plugin-syntax-class-static-block/download/@babel/plugin-syntax-class-static-block-7.14.5.tgz", - "integrity": "sha1-GV34mxRrS3izv4l/16JXyEZZ1AY=", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.14.5" - } - }, - "@babel/plugin-syntax-dynamic-import": { - "version": "7.8.3", - "resolved": "https://registry.nlark.com/@babel/plugin-syntax-dynamic-import/download/@babel/plugin-syntax-dynamic-import-7.8.3.tgz?cache=0&sync_timestamp=1624608013305&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40babel%2Fplugin-syntax-dynamic-import%2Fdownload%2F%40babel%2Fplugin-syntax-dynamic-import-7.8.3.tgz", - "integrity": "sha1-Yr+Ysto80h1iYVT8lu5bPLaOrLM=", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.8.0" - } - }, - "@babel/plugin-syntax-export-namespace-from": { - "version": "7.8.3", - "resolved": "https://registry.nlark.com/@babel/plugin-syntax-export-namespace-from/download/@babel/plugin-syntax-export-namespace-from-7.8.3.tgz", - "integrity": "sha1-AolkqbqA28CUyRXEh618TnpmRlo=", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.8.3" - } - }, - "@babel/plugin-syntax-json-strings": { - "version": "7.8.3", - "resolved": "https://registry.nlark.com/@babel/plugin-syntax-json-strings/download/@babel/plugin-syntax-json-strings-7.8.3.tgz", - "integrity": "sha1-AcohtmjNghjJ5kDLbdiMVBKyyWo=", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.8.0" - } - }, - "@babel/plugin-syntax-logical-assignment-operators": { - "version": "7.10.4", - "resolved": "https://registry.nlark.com/@babel/plugin-syntax-logical-assignment-operators/download/@babel/plugin-syntax-logical-assignment-operators-7.10.4.tgz", - "integrity": "sha1-ypHvRjA1MESLkGZSusLp/plB9pk=", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.10.4" - } - }, - "@babel/plugin-syntax-nullish-coalescing-operator": { - "version": "7.8.3", - "resolved": "https://registry.nlark.com/@babel/plugin-syntax-nullish-coalescing-operator/download/@babel/plugin-syntax-nullish-coalescing-operator-7.8.3.tgz", - "integrity": "sha1-Fn7XA2iIYIH3S1w2xlqIwDtm0ak=", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.8.0" - } - }, - "@babel/plugin-syntax-numeric-separator": { - "version": "7.10.4", - "resolved": "https://registry.nlark.com/@babel/plugin-syntax-numeric-separator/download/@babel/plugin-syntax-numeric-separator-7.10.4.tgz", - "integrity": "sha1-ubBws+M1cM2f0Hun+pHA3Te5r5c=", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.10.4" - } - }, - "@babel/plugin-syntax-object-rest-spread": { - "version": "7.8.3", - "resolved": "https://registry.nlark.com/@babel/plugin-syntax-object-rest-spread/download/@babel/plugin-syntax-object-rest-spread-7.8.3.tgz", - "integrity": "sha1-YOIl7cvZimQDMqLnLdPmbxr1WHE=", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.8.0" - } - }, - "@babel/plugin-syntax-optional-catch-binding": { - "version": "7.8.3", - "resolved": "https://registry.nlark.com/@babel/plugin-syntax-optional-catch-binding/download/@babel/plugin-syntax-optional-catch-binding-7.8.3.tgz", - "integrity": "sha1-YRGiZbz7Ag6579D9/X0mQCue1sE=", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.8.0" - } - }, - "@babel/plugin-syntax-optional-chaining": { - "version": "7.8.3", - "resolved": "https://registry.nlark.com/@babel/plugin-syntax-optional-chaining/download/@babel/plugin-syntax-optional-chaining-7.8.3.tgz", - "integrity": "sha1-T2nCq5UWfgGAzVM2YT+MV4j31Io=", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.8.0" - } - }, - "@babel/plugin-syntax-private-property-in-object": { - "version": "7.14.5", - "resolved": "https://registry.nlark.com/@babel/plugin-syntax-private-property-in-object/download/@babel/plugin-syntax-private-property-in-object-7.14.5.tgz", - "integrity": "sha1-DcZnHsDqIrbpShEU+FeXDNOd4a0=", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.14.5" - } - }, - "@babel/plugin-syntax-top-level-await": { - "version": "7.14.5", - "resolved": "https://registry.nlark.com/@babel/plugin-syntax-top-level-await/download/@babel/plugin-syntax-top-level-await-7.14.5.tgz", - "integrity": "sha1-wc/a3DWmRiQAAfBhOCR7dBw02Uw=", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.14.5" - } - }, - "@babel/plugin-syntax-typescript": { - "version": "7.14.5", - "resolved": "https://registry.nlark.com/@babel/plugin-syntax-typescript/download/@babel/plugin-syntax-typescript-7.14.5.tgz", - "integrity": "sha1-uCxs5HGxZbXOQgz5KRTW+0YiVxY=", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.14.5" - } - }, - "@babel/plugin-transform-arrow-functions": { - "version": "7.14.5", - "resolved": "https://registry.nlark.com/@babel/plugin-transform-arrow-functions/download/@babel/plugin-transform-arrow-functions-7.14.5.tgz?cache=0&sync_timestamp=1624607954413&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40babel%2Fplugin-transform-arrow-functions%2Fdownload%2F%40babel%2Fplugin-transform-arrow-functions-7.14.5.tgz", - "integrity": "sha1-9xh9lYinaN0IC/TJ/+EX6mL3hio=", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.14.5" - } - }, - "@babel/plugin-transform-async-to-generator": { - "version": "7.14.5", - "resolved": "https://registry.nlark.com/@babel/plugin-transform-async-to-generator/download/@babel/plugin-transform-async-to-generator-7.14.5.tgz", - "integrity": "sha1-cseJCE2PIJSsuUVjOUPvhEPTnmc=", - "dev": true, - "requires": { - "@babel/helper-module-imports": "^7.14.5", - "@babel/helper-plugin-utils": "^7.14.5", - "@babel/helper-remap-async-to-generator": "^7.14.5" - } - }, - "@babel/plugin-transform-block-scoped-functions": { - "version": "7.14.5", - "resolved": "https://registry.nlark.com/@babel/plugin-transform-block-scoped-functions/download/@babel/plugin-transform-block-scoped-functions-7.14.5.tgz", - "integrity": "sha1-5IZB2ZnUvBV6Z+8zautUvET9OtQ=", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.14.5" - } - }, - "@babel/plugin-transform-block-scoping": { - "version": "7.15.3", - "resolved": "https://registry.nlark.com/@babel/plugin-transform-block-scoping/download/@babel/plugin-transform-block-scoping-7.15.3.tgz", - "integrity": "sha1-lMgabi/CMLzObvU3rJah5NKzr68=", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.14.5" - } - }, - "@babel/plugin-transform-classes": { - "version": "7.15.4", - "resolved": "https://registry.nlark.com/@babel/plugin-transform-classes/download/@babel/plugin-transform-classes-7.15.4.tgz", - "integrity": "sha1-UK7heq9/MyrkTjvOTC4QU01dO/E=", - "dev": true, - "requires": { - "@babel/helper-annotate-as-pure": "^7.15.4", - "@babel/helper-function-name": "^7.15.4", - "@babel/helper-optimise-call-expression": "^7.15.4", - "@babel/helper-plugin-utils": "^7.14.5", - "@babel/helper-replace-supers": "^7.15.4", - "@babel/helper-split-export-declaration": "^7.15.4", - "globals": "^11.1.0" - } - }, - "@babel/plugin-transform-computed-properties": { - "version": "7.14.5", - "resolved": "https://registry.nlark.com/@babel/plugin-transform-computed-properties/download/@babel/plugin-transform-computed-properties-7.14.5.tgz", - "integrity": "sha1-G514mHQg0RIj1BGVRhzEO5dLIE8=", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.14.5" - } - }, - "@babel/plugin-transform-destructuring": { - "version": "7.14.7", - "resolved": "https://registry.nlark.com/@babel/plugin-transform-destructuring/download/@babel/plugin-transform-destructuring-7.14.7.tgz?cache=0&sync_timestamp=1624607954836&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40babel%2Fplugin-transform-destructuring%2Fdownload%2F%40babel%2Fplugin-transform-destructuring-7.14.7.tgz", - "integrity": "sha1-CtWO034j4iCE0QnxhSYINeVVdXY=", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.14.5" - } - }, - "@babel/plugin-transform-dotall-regex": { - "version": "7.14.5", - "resolved": "https://registry.nlark.com/@babel/plugin-transform-dotall-regex/download/@babel/plugin-transform-dotall-regex-7.14.5.tgz", - "integrity": "sha1-L2v3bka9+AQ7Tn4WzyRTJim6DHo=", - "dev": true, - "requires": { - "@babel/helper-create-regexp-features-plugin": "^7.14.5", - "@babel/helper-plugin-utils": "^7.14.5" - } - }, - "@babel/plugin-transform-duplicate-keys": { - "version": "7.14.5", - "resolved": "https://registry.nlark.com/@babel/plugin-transform-duplicate-keys/download/@babel/plugin-transform-duplicate-keys-7.14.5.tgz", - "integrity": "sha1-NlpIRIgb3xUB46nwJw5/D5EXeVQ=", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.14.5" - } - }, - "@babel/plugin-transform-exponentiation-operator": { - "version": "7.14.5", - "resolved": "https://registry.nlark.com/@babel/plugin-transform-exponentiation-operator/download/@babel/plugin-transform-exponentiation-operator-7.14.5.tgz", - "integrity": "sha1-UVS43Wo9/m2Qkj1hckvT3uuQtJM=", - "dev": true, - "requires": { - "@babel/helper-builder-binary-assignment-operator-visitor": "^7.14.5", - "@babel/helper-plugin-utils": "^7.14.5" - } - }, - "@babel/plugin-transform-for-of": { - "version": "7.15.4", - "resolved": "https://registry.nlark.com/@babel/plugin-transform-for-of/download/@babel/plugin-transform-for-of-7.15.4.tgz", - "integrity": "sha1-JcYszicYz7KXFfQW511SY/s2qMI=", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.14.5" - } - }, - "@babel/plugin-transform-function-name": { - "version": "7.14.5", - "resolved": "https://registry.nlark.com/@babel/plugin-transform-function-name/download/@babel/plugin-transform-function-name-7.14.5.tgz", - "integrity": "sha1-6Bxl7LkAdG1/MYAva+0fUtkV1vI=", - "dev": true, - "requires": { - "@babel/helper-function-name": "^7.14.5", - "@babel/helper-plugin-utils": "^7.14.5" - } - }, - "@babel/plugin-transform-literals": { - "version": "7.14.5", - "resolved": "https://registry.nlark.com/@babel/plugin-transform-literals/download/@babel/plugin-transform-literals-7.14.5.tgz", - "integrity": "sha1-QdBsf/XU0J489Fh70+zzkwxzD3g=", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.14.5" - } - }, - "@babel/plugin-transform-member-expression-literals": { - "version": "7.14.5", - "resolved": "https://registry.nlark.com/@babel/plugin-transform-member-expression-literals/download/@babel/plugin-transform-member-expression-literals-7.14.5.tgz", - "integrity": "sha1-s5zVISor8jWmF9Mg7CtIvMCRuKc=", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.14.5" - } - }, - "@babel/plugin-transform-modules-amd": { - "version": "7.14.5", - "resolved": "https://registry.nlark.com/@babel/plugin-transform-modules-amd/download/@babel/plugin-transform-modules-amd-7.14.5.tgz", - "integrity": "sha1-T9nOfjQRy4uDhISAtwQdgwBIWPc=", - "dev": true, - "requires": { - "@babel/helper-module-transforms": "^7.14.5", - "@babel/helper-plugin-utils": "^7.14.5", - "babel-plugin-dynamic-import-node": "^2.3.3" - } - }, - "@babel/plugin-transform-modules-commonjs": { - "version": "7.15.4", - "resolved": "https://registry.nlark.com/@babel/plugin-transform-modules-commonjs/download/@babel/plugin-transform-modules-commonjs-7.15.4.tgz", - "integrity": "sha1-ggEQEkDqu1p2wI72GylU92e2tME=", - "dev": true, - "requires": { - "@babel/helper-module-transforms": "^7.15.4", - "@babel/helper-plugin-utils": "^7.14.5", - "@babel/helper-simple-access": "^7.15.4", - "babel-plugin-dynamic-import-node": "^2.3.3" - } - }, - "@babel/plugin-transform-modules-systemjs": { - "version": "7.15.4", - "resolved": "https://registry.nlark.com/@babel/plugin-transform-modules-systemjs/download/@babel/plugin-transform-modules-systemjs-7.15.4.tgz", - "integrity": "sha1-tCiQxzSaeMgncZ8dLQzTjH0mgTI=", - "dev": true, - "requires": { - "@babel/helper-hoist-variables": "^7.15.4", - "@babel/helper-module-transforms": "^7.15.4", - "@babel/helper-plugin-utils": "^7.14.5", - "@babel/helper-validator-identifier": "^7.14.9", - "babel-plugin-dynamic-import-node": "^2.3.3" - } - }, - "@babel/plugin-transform-modules-umd": { - "version": "7.14.5", - "resolved": "https://registry.nlark.com/@babel/plugin-transform-modules-umd/download/@babel/plugin-transform-modules-umd-7.14.5.tgz", - "integrity": "sha1-+2Yt/uaXzOJ0p82lJRkKeQlqpuA=", - "dev": true, - "requires": { - "@babel/helper-module-transforms": "^7.14.5", - "@babel/helper-plugin-utils": "^7.14.5" - } - }, - "@babel/plugin-transform-named-capturing-groups-regex": { - "version": "7.14.9", - "resolved": "https://registry.nlark.com/@babel/plugin-transform-named-capturing-groups-regex/download/@babel/plugin-transform-named-capturing-groups-regex-7.14.9.tgz?cache=0&sync_timestamp=1627804419952&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40babel%2Fplugin-transform-named-capturing-groups-regex%2Fdownload%2F%40babel%2Fplugin-transform-named-capturing-groups-regex-7.14.9.tgz", - "integrity": "sha1-xo9cXRLS66ujdi5XwsT2NHpG57I=", - "dev": true, - "requires": { - "@babel/helper-create-regexp-features-plugin": "^7.14.5" - } - }, - "@babel/plugin-transform-new-target": { - "version": "7.14.5", - "resolved": "https://registry.nlark.com/@babel/plugin-transform-new-target/download/@babel/plugin-transform-new-target-7.14.5.tgz", - "integrity": "sha1-Mb2ui5JdyEB26/zSqZQBQ67X2/g=", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.14.5" - } - }, - "@babel/plugin-transform-object-super": { - "version": "7.14.5", - "resolved": "https://registry.nlark.com/@babel/plugin-transform-object-super/download/@babel/plugin-transform-object-super-7.14.5.tgz", - "integrity": "sha1-0LX66snphZehYanPeMUn7ZNM3EU=", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.14.5", - "@babel/helper-replace-supers": "^7.14.5" - } - }, - "@babel/plugin-transform-parameters": { - "version": "7.15.4", - "resolved": "https://registry.nlark.com/@babel/plugin-transform-parameters/download/@babel/plugin-transform-parameters-7.15.4.tgz", - "integrity": "sha1-XyKFzDFgv0jIUCQycWtIUE0p7WI=", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.14.5" - } - }, - "@babel/plugin-transform-property-literals": { - "version": "7.14.5", - "resolved": "https://registry.nlark.com/@babel/plugin-transform-property-literals/download/@babel/plugin-transform-property-literals-7.14.5.tgz", - "integrity": "sha1-DduqH4PbNgbxzfSEb6HftHNFizQ=", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.14.5" - } - }, - "@babel/plugin-transform-regenerator": { - "version": "7.14.5", - "resolved": "https://registry.nlark.com/@babel/plugin-transform-regenerator/download/@babel/plugin-transform-regenerator-7.14.5.tgz", - "integrity": "sha1-lnb9VwftKPUicnxbPAqoVERAsE8=", - "dev": true, - "requires": { - "regenerator-transform": "^0.14.2" - } - }, - "@babel/plugin-transform-reserved-words": { - "version": "7.14.5", - "resolved": "https://registry.nlark.com/@babel/plugin-transform-reserved-words/download/@babel/plugin-transform-reserved-words-7.14.5.tgz", - "integrity": "sha1-xEWJtmHP2++NQwDcx0ad/6kvgwQ=", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.14.5" - } - }, - "@babel/plugin-transform-shorthand-properties": { - "version": "7.14.5", - "resolved": "https://registry.nlark.com/@babel/plugin-transform-shorthand-properties/download/@babel/plugin-transform-shorthand-properties-7.14.5.tgz?cache=0&sync_timestamp=1624607955296&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40babel%2Fplugin-transform-shorthand-properties%2Fdownload%2F%40babel%2Fplugin-transform-shorthand-properties-7.14.5.tgz", - "integrity": "sha1-l/E4VfFAkzjYyty6ymcK154JGlg=", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.14.5" - } - }, - "@babel/plugin-transform-spread": { - "version": "7.14.6", - "resolved": "https://registry.nlark.com/@babel/plugin-transform-spread/download/@babel/plugin-transform-spread-7.14.6.tgz?cache=0&sync_timestamp=1624607955440&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40babel%2Fplugin-transform-spread%2Fdownload%2F%40babel%2Fplugin-transform-spread-7.14.6.tgz", - "integrity": "sha1-a9QOV/596UqpBIUZY7VhZlL3MUQ=", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.14.5", - "@babel/helper-skip-transparent-expression-wrappers": "^7.14.5" - } - }, - "@babel/plugin-transform-sticky-regex": { - "version": "7.14.5", - "resolved": "https://registry.nlark.com/@babel/plugin-transform-sticky-regex/download/@babel/plugin-transform-sticky-regex-7.14.5.tgz", - "integrity": "sha1-W2F1Qmdei3dhKUOB88KMYz9Arrk=", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.14.5" - } - }, - "@babel/plugin-transform-template-literals": { - "version": "7.14.5", - "resolved": "https://registry.nlark.com/@babel/plugin-transform-template-literals/download/@babel/plugin-transform-template-literals-7.14.5.tgz?cache=0&sync_timestamp=1624607976904&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40babel%2Fplugin-transform-template-literals%2Fdownload%2F%40babel%2Fplugin-transform-template-literals-7.14.5.tgz", - "integrity": "sha1-pfK8Izk32EU4hdxza92Nn/q/PZM=", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.14.5" - } - }, - "@babel/plugin-transform-typeof-symbol": { - "version": "7.14.5", - "resolved": "https://registry.nlark.com/@babel/plugin-transform-typeof-symbol/download/@babel/plugin-transform-typeof-symbol-7.14.5.tgz", - "integrity": "sha1-Oa8nOemJor0pG/a1PxaYFCPUV9Q=", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.14.5" - } - }, - "@babel/plugin-transform-typescript": { - "version": "7.15.4", - "resolved": "https://registry.nlark.com/@babel/plugin-transform-typescript/download/@babel/plugin-transform-typescript-7.15.4.tgz?cache=0&sync_timestamp=1630620772635&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40babel%2Fplugin-transform-typescript%2Fdownload%2F%40babel%2Fplugin-transform-typescript-7.15.4.tgz", - "integrity": "sha1-23oGLc+L5fwJa8DutAoT+/ofolE=", - "dev": true, - "requires": { - "@babel/helper-create-class-features-plugin": "^7.15.4", - "@babel/helper-plugin-utils": "^7.14.5", - "@babel/plugin-syntax-typescript": "^7.14.5" - } - }, - "@babel/plugin-transform-unicode-escapes": { - "version": "7.14.5", - "resolved": "https://registry.nlark.com/@babel/plugin-transform-unicode-escapes/download/@babel/plugin-transform-unicode-escapes-7.14.5.tgz", - "integrity": "sha1-nUvSpoHjxdes9PV/qeURddkdDGs=", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.14.5" - } - }, - "@babel/plugin-transform-unicode-regex": { - "version": "7.14.5", - "resolved": "https://registry.nlark.com/@babel/plugin-transform-unicode-regex/download/@babel/plugin-transform-unicode-regex-7.14.5.tgz", - "integrity": "sha1-TNCbbIQl3YElXHzrP7GDbnQUOC4=", - "dev": true, - "requires": { - "@babel/helper-create-regexp-features-plugin": "^7.14.5", - "@babel/helper-plugin-utils": "^7.14.5" - } - }, - "@babel/preset-env": { - "version": "7.15.4", - "resolved": "https://registry.nlark.com/@babel/preset-env/download/@babel/preset-env-7.15.4.tgz?cache=0&sync_timestamp=1630619344894&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40babel%2Fpreset-env%2Fdownload%2F%40babel%2Fpreset-env-7.15.4.tgz", - "integrity": "sha1-GX5/madVxIjwr0Ea8XnL0Q3m6BU=", - "dev": true, - "requires": { - "@babel/compat-data": "^7.15.0", - "@babel/helper-compilation-targets": "^7.15.4", - "@babel/helper-plugin-utils": "^7.14.5", - "@babel/helper-validator-option": "^7.14.5", - "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": "^7.15.4", - "@babel/plugin-proposal-async-generator-functions": "^7.15.4", - "@babel/plugin-proposal-class-properties": "^7.14.5", - "@babel/plugin-proposal-class-static-block": "^7.15.4", - "@babel/plugin-proposal-dynamic-import": "^7.14.5", - "@babel/plugin-proposal-export-namespace-from": "^7.14.5", - "@babel/plugin-proposal-json-strings": "^7.14.5", - "@babel/plugin-proposal-logical-assignment-operators": "^7.14.5", - "@babel/plugin-proposal-nullish-coalescing-operator": "^7.14.5", - "@babel/plugin-proposal-numeric-separator": "^7.14.5", - "@babel/plugin-proposal-object-rest-spread": "^7.14.7", - "@babel/plugin-proposal-optional-catch-binding": "^7.14.5", - "@babel/plugin-proposal-optional-chaining": "^7.14.5", - "@babel/plugin-proposal-private-methods": "^7.14.5", - "@babel/plugin-proposal-private-property-in-object": "^7.15.4", - "@babel/plugin-proposal-unicode-property-regex": "^7.14.5", - "@babel/plugin-syntax-async-generators": "^7.8.4", - "@babel/plugin-syntax-class-properties": "^7.12.13", - "@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-json-strings": "^7.8.3", - "@babel/plugin-syntax-logical-assignment-operators": "^7.10.4", - "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3", - "@babel/plugin-syntax-numeric-separator": "^7.10.4", - "@babel/plugin-syntax-object-rest-spread": "^7.8.3", - "@babel/plugin-syntax-optional-catch-binding": "^7.8.3", - "@babel/plugin-syntax-optional-chaining": "^7.8.3", - "@babel/plugin-syntax-private-property-in-object": "^7.14.5", - "@babel/plugin-syntax-top-level-await": "^7.14.5", - "@babel/plugin-transform-arrow-functions": "^7.14.5", - "@babel/plugin-transform-async-to-generator": "^7.14.5", - "@babel/plugin-transform-block-scoped-functions": "^7.14.5", - "@babel/plugin-transform-block-scoping": "^7.15.3", - "@babel/plugin-transform-classes": "^7.15.4", - "@babel/plugin-transform-computed-properties": "^7.14.5", - "@babel/plugin-transform-destructuring": "^7.14.7", - "@babel/plugin-transform-dotall-regex": "^7.14.5", - "@babel/plugin-transform-duplicate-keys": "^7.14.5", - "@babel/plugin-transform-exponentiation-operator": "^7.14.5", - "@babel/plugin-transform-for-of": "^7.15.4", - "@babel/plugin-transform-function-name": "^7.14.5", - "@babel/plugin-transform-literals": "^7.14.5", - "@babel/plugin-transform-member-expression-literals": "^7.14.5", - "@babel/plugin-transform-modules-amd": "^7.14.5", - "@babel/plugin-transform-modules-commonjs": "^7.15.4", - "@babel/plugin-transform-modules-systemjs": "^7.15.4", - "@babel/plugin-transform-modules-umd": "^7.14.5", - "@babel/plugin-transform-named-capturing-groups-regex": "^7.14.9", - "@babel/plugin-transform-new-target": "^7.14.5", - "@babel/plugin-transform-object-super": "^7.14.5", - "@babel/plugin-transform-parameters": "^7.15.4", - "@babel/plugin-transform-property-literals": "^7.14.5", - "@babel/plugin-transform-regenerator": "^7.14.5", - "@babel/plugin-transform-reserved-words": "^7.14.5", - "@babel/plugin-transform-shorthand-properties": "^7.14.5", - "@babel/plugin-transform-spread": "^7.14.6", - "@babel/plugin-transform-sticky-regex": "^7.14.5", - "@babel/plugin-transform-template-literals": "^7.14.5", - "@babel/plugin-transform-typeof-symbol": "^7.14.5", - "@babel/plugin-transform-unicode-escapes": "^7.14.5", - "@babel/plugin-transform-unicode-regex": "^7.14.5", - "@babel/preset-modules": "^0.1.4", - "@babel/types": "^7.15.4", - "babel-plugin-polyfill-corejs2": "^0.2.2", - "babel-plugin-polyfill-corejs3": "^0.2.2", - "babel-plugin-polyfill-regenerator": "^0.2.2", - "core-js-compat": "^3.16.0", - "semver": "^6.3.0" - }, - "dependencies": { - "semver": { - "version": "6.3.0", - "resolved": "https://registry.nlark.com/semver/download/semver-6.3.0.tgz?cache=0&sync_timestamp=1624607961409&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fsemver%2Fdownload%2Fsemver-6.3.0.tgz", - "integrity": "sha1-7gpkyK9ejO6mdoexM3YeG+y9HT0=", - "dev": true - } - } - }, - "@babel/preset-modules": { - "version": "0.1.4", - "resolved": "https://registry.nlark.com/@babel/preset-modules/download/@babel/preset-modules-0.1.4.tgz", - "integrity": "sha1-Ni8raMZihClw/bXiVP/I/BwuQV4=", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/plugin-proposal-unicode-property-regex": "^7.4.4", - "@babel/plugin-transform-dotall-regex": "^7.4.4", - "@babel/types": "^7.4.4", - "esutils": "^2.0.2" - } - }, - "@babel/preset-typescript": { - "version": "7.15.0", - "resolved": "https://registry.nlark.com/@babel/preset-typescript/download/@babel/preset-typescript-7.15.0.tgz", - "integrity": "sha1-6PymOKGg9k8U4RGff+RQAneECUU=", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.14.5", - "@babel/helper-validator-option": "^7.14.5", - "@babel/plugin-transform-typescript": "^7.15.0" - } - }, - "@babel/runtime": { - "version": "7.15.4", - "resolved": "https://registry.nlark.com/@babel/runtime/download/@babel/runtime-7.15.4.tgz", - "integrity": "sha1-/RfRa/34eObdAtGXU6OfqKjZyEo=", - "dev": true, - "requires": { - "regenerator-runtime": "^0.13.4" - } - }, - "@babel/template": { - "version": "7.15.4", - "resolved": "https://registry.nlark.com/@babel/template/download/@babel/template-7.15.4.tgz", - "integrity": "sha1-UYmNNdzz+qZwxO5q/P1RfuE58ZQ=", - "dev": true, - "requires": { - "@babel/code-frame": "^7.14.5", - "@babel/parser": "^7.15.4", - "@babel/types": "^7.15.4" - } - }, - "@babel/traverse": { - "version": "7.15.4", - "resolved": "https://registry.nlark.com/@babel/traverse/download/@babel/traverse-7.15.4.tgz", - "integrity": "sha1-/4UQNnoUS/v/VS2eGOKPPiiJwi0=", - "dev": true, - "requires": { - "@babel/code-frame": "^7.14.5", - "@babel/generator": "^7.15.4", - "@babel/helper-function-name": "^7.15.4", - "@babel/helper-hoist-variables": "^7.15.4", - "@babel/helper-split-export-declaration": "^7.15.4", - "@babel/parser": "^7.15.4", - "@babel/types": "^7.15.4", - "debug": "^4.1.0", - "globals": "^11.1.0" - } - }, - "@babel/types": { - "version": "7.15.4", - "resolved": "https://registry.nlark.com/@babel/types/download/@babel/types-7.15.4.tgz", - "integrity": "sha1-dO64bb1nSNJ0E5ZVe5hg5X/OCg0=", - "dev": true, - "requires": { - "@babel/helper-validator-identifier": "^7.14.9", - "to-fast-properties": "^2.0.0" - } - }, - "@discoveryjs/json-ext": { - "version": "0.5.3", - "resolved": "https://registry.nlark.com/@discoveryjs/json-ext/download/@discoveryjs/json-ext-0.5.3.tgz", - "integrity": "sha1-kEIPn5xtOYfxdqGafY52QnGi9V0=" - }, - "@eslint/eslintrc": { - "version": "0.4.3", - "resolved": "https://registry.nlark.com/@eslint/eslintrc/download/@eslint/eslintrc-0.4.3.tgz?cache=0&sync_timestamp=1628296902668&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40eslint%2Feslintrc%2Fdownload%2F%40eslint%2Feslintrc-0.4.3.tgz", - "integrity": "sha1-nkKYHvA1vrPdSa3ResuW6P9vOUw=", - "dev": true, - "requires": { - "ajv": "^6.12.4", - "debug": "^4.1.1", - "espree": "^7.3.0", - "globals": "^13.9.0", - "ignore": "^4.0.6", - "import-fresh": "^3.2.1", - "js-yaml": "^3.13.1", - "minimatch": "^3.0.4", - "strip-json-comments": "^3.1.1" - }, - "dependencies": { - "globals": { - "version": "13.11.0", - "resolved": "https://registry.nlark.com/globals/download/globals-13.11.0.tgz", - "integrity": "sha1-QO9njaEX/nvS4o8fqySVG9AlW+c=", - "dev": true, - "requires": { - "type-fest": "^0.20.2" - } - }, - "ignore": { - "version": "4.0.6", - "resolved": "https://registry.nlark.com/ignore/download/ignore-4.0.6.tgz", - "integrity": "sha1-dQ49tYYgh7RzfrrIIH/9HvJ7Jfw=", - "dev": true - } - } - }, - "@humanwhocodes/config-array": { - "version": "0.5.0", - "resolved": "https://registry.nlark.com/@humanwhocodes/config-array/download/@humanwhocodes/config-array-0.5.0.tgz?cache=0&sync_timestamp=1625263855104&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40humanwhocodes%2Fconfig-array%2Fdownload%2F%40humanwhocodes%2Fconfig-array-0.5.0.tgz", - "integrity": "sha1-FAeWfUxu7Nc4j4Os8er00Mbljvk=", - "dev": true, - "requires": { - "@humanwhocodes/object-schema": "^1.2.0", - "debug": "^4.1.1", - "minimatch": "^3.0.4" - } - }, - "@humanwhocodes/object-schema": { - "version": "1.2.0", - "resolved": "https://registry.nlark.com/@humanwhocodes/object-schema/download/@humanwhocodes/object-schema-1.2.0.tgz?cache=0&sync_timestamp=1625263889550&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40humanwhocodes%2Fobject-schema%2Fdownload%2F%40humanwhocodes%2Fobject-schema-1.2.0.tgz", - "integrity": "sha1-h956+cIxgm/daKxyWPd8Qp4OX88=", - "dev": true - }, - "@nicolo-ribaudo/chokidar-2": { - "version": "2.1.8-no-fsevents.2", - "resolved": "https://registry.nlark.com/@nicolo-ribaudo/chokidar-2/download/@nicolo-ribaudo/chokidar-2-2.1.8-no-fsevents.2.tgz", - "integrity": "sha1-4yTAokelVnGS3XGAZHcJ1+L6+Us=", - "dev": true, - "optional": true, - "requires": { - "anymatch": "^2.0.0", - "async-each": "^1.0.1", - "braces": "^2.3.2", - "glob-parent": "^5.1.2", - "inherits": "^2.0.3", - "is-binary-path": "^1.0.0", - "is-glob": "^4.0.0", - "normalize-path": "^3.0.0", - "path-is-absolute": "^1.0.0", - "readdirp": "^2.2.1", - "upath": "^1.1.1" - }, - "dependencies": { - "anymatch": { - "version": "2.0.0", - "resolved": "https://registry.nlark.com/anymatch/download/anymatch-2.0.0.tgz", - "integrity": "sha1-vLJLTzeTTZqnrBe0ra+J58du8us=", - "dev": true, - "optional": true, - "requires": { - "micromatch": "^3.1.4", - "normalize-path": "^2.1.1" - }, - "dependencies": { - "normalize-path": { - "version": "2.1.1", - "resolved": "https://registry.nlark.com/normalize-path/download/normalize-path-2.1.1.tgz", - "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=", - "dev": true, - "optional": true, - "requires": { - "remove-trailing-separator": "^1.0.1" - } - } - } - }, - "braces": { - "version": "2.3.2", - "resolved": "https://registry.nlark.com/braces/download/braces-2.3.2.tgz", - "integrity": "sha1-WXn9PxTNUxVl5fot8av/8d+u5yk=", - "dev": true, - "optional": true, - "requires": { - "arr-flatten": "^1.1.0", - "array-unique": "^0.3.2", - "extend-shallow": "^2.0.1", - "fill-range": "^4.0.0", - "isobject": "^3.0.1", - "repeat-element": "^1.1.2", - "snapdragon": "^0.8.1", - "snapdragon-node": "^2.0.1", - "split-string": "^3.0.2", - "to-regex": "^3.0.1" - }, - "dependencies": { - "extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.nlark.com/extend-shallow/download/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", - "dev": true, - "optional": true, - "requires": { - "is-extendable": "^0.1.0" - } - } - } - }, - "fill-range": { - "version": "4.0.0", - "resolved": "https://registry.nlark.com/fill-range/download/fill-range-4.0.0.tgz", - "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=", - "dev": true, - "optional": true, - "requires": { - "extend-shallow": "^2.0.1", - "is-number": "^3.0.0", - "repeat-string": "^1.6.1", - "to-regex-range": "^2.1.0" - }, - "dependencies": { - "extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.nlark.com/extend-shallow/download/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", - "dev": true, - "optional": true, - "requires": { - "is-extendable": "^0.1.0" - } - } - } - }, - "is-number": { - "version": "3.0.0", - "resolved": "https://registry.nlark.com/is-number/download/is-number-3.0.0.tgz", - "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", - "dev": true, - "optional": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.nlark.com/kind-of/download/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "optional": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "micromatch": { - "version": "3.1.10", - "resolved": "https://registry.nlark.com/micromatch/download/micromatch-3.1.10.tgz", - "integrity": "sha1-cIWbyVyYQJUvNZoGij/En57PrCM=", - "dev": true, - "optional": true, - "requires": { - "arr-diff": "^4.0.0", - "array-unique": "^0.3.2", - "braces": "^2.3.1", - "define-property": "^2.0.2", - "extend-shallow": "^3.0.2", - "extglob": "^2.0.4", - "fragment-cache": "^0.2.1", - "kind-of": "^6.0.2", - "nanomatch": "^1.2.9", - "object.pick": "^1.3.0", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.2" - } - }, - "to-regex-range": { - "version": "2.1.1", - "resolved": "https://registry.nlark.com/to-regex-range/download/to-regex-range-2.1.1.tgz", - "integrity": "sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg=", - "dev": true, - "optional": true, - "requires": { - "is-number": "^3.0.0", - "repeat-string": "^1.6.1" - } - } - } - }, - "@nodelib/fs.scandir": { - "version": "2.1.5", - "resolved": "https://registry.nlark.com/@nodelib/fs.scandir/download/@nodelib/fs.scandir-2.1.5.tgz", - "integrity": "sha1-dhnC6yGyVIP20WdUi0z9WnSIw9U=", - "requires": { - "@nodelib/fs.stat": "2.0.5", - "run-parallel": "^1.1.9" - } - }, - "@nodelib/fs.stat": { - "version": "2.0.5", - "resolved": "https://registry.nlark.com/@nodelib/fs.stat/download/@nodelib/fs.stat-2.0.5.tgz", - "integrity": "sha1-W9Jir5Tp0lvR5xsF3u1Eh2oiLos=" - }, - "@nodelib/fs.walk": { - "version": "1.2.8", - "resolved": "https://registry.nlark.com/@nodelib/fs.walk/download/@nodelib/fs.walk-1.2.8.tgz", - "integrity": "sha1-6Vc36LtnRt3t9pxVaVNJTxlv5po=", - "requires": { - "@nodelib/fs.scandir": "2.1.5", - "fastq": "^1.6.0" - } - }, - "@types/eslint": { - "version": "7.28.0", - "resolved": "https://registry.nlark.com/@types/eslint/download/@types/eslint-7.28.0.tgz?cache=0&sync_timestamp=1629707594595&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40types%2Feslint%2Fdownload%2F%40types%2Feslint-7.28.0.tgz", - "integrity": "sha1-fkHySB0wHGjhT0g/4QsBd1POjVo=", - "requires": { - "@types/estree": "*", - "@types/json-schema": "*" - } - }, - "@types/eslint-scope": { - "version": "3.7.1", - "resolved": "https://registry.nlark.com/@types/eslint-scope/download/@types/eslint-scope-3.7.1.tgz", - "integrity": "sha1-jcOQp7T53Z8ShGKe/OmC5BYSEW4=", - "requires": { - "@types/eslint": "*", - "@types/estree": "*" - } - }, - "@types/estree": { - "version": "0.0.50", - "resolved": "https://registry.nlark.com/@types/estree/download/@types/estree-0.0.50.tgz", - "integrity": "sha1-Hgyqk2TT/M0pMcPtlv2+ql1MyoM=" - }, - "@types/glob": { - "version": "7.1.4", - "resolved": "https://registry.nlark.com/@types/glob/download/@types/glob-7.1.4.tgz", - "integrity": "sha1-6lniHS7lxReRTLS8jkFTuZ5WZnI=", - "requires": { - "@types/minimatch": "*", - "@types/node": "*" - } - }, - "@types/json-schema": { - "version": "7.0.9", - "resolved": "https://registry.nlark.com/@types/json-schema/download/@types/json-schema-7.0.9.tgz", - "integrity": "sha1-l+3JA36gw4WFMgsolk3eOznkZg0=" - }, - "@types/minimatch": { - "version": "3.0.5", - "resolved": "https://registry.nlark.com/@types/minimatch/download/@types/minimatch-3.0.5.tgz?cache=0&sync_timestamp=1629708337307&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40types%2Fminimatch%2Fdownload%2F%40types%2Fminimatch-3.0.5.tgz", - "integrity": "sha1-EAHMXmo3BLg8I2An538vWOoBD0A=" - }, - "@types/node": { - "version": "16.7.10", - "resolved": "https://registry.nlark.com/@types/node/download/@types/node-16.7.10.tgz", - "integrity": "sha1-eqcyzEc0HBKha31WL1GcI4O21Pw=" - }, - "@types/source-list-map": { - "version": "0.1.2", - "resolved": "https://registry.nlark.com/@types/source-list-map/download/@types/source-list-map-0.1.2.tgz", - "integrity": "sha1-AHiDYGP/rxdBI0m7o2QIfgrALsk=" - }, - "@types/tapable": { - "version": "1.0.8", - "resolved": "https://registry.nlark.com/@types/tapable/download/@types/tapable-1.0.8.tgz?cache=0&sync_timestamp=1629709441343&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40types%2Ftapable%2Fdownload%2F%40types%2Ftapable-1.0.8.tgz", - "integrity": "sha1-uUpDkchWZse3Mpn9OtedT6pDUxA=" - }, - "@types/uglify-js": { - "version": "3.13.1", - "resolved": "https://registry.nlark.com/@types/uglify-js/download/@types/uglify-js-3.13.1.tgz?cache=0&sync_timestamp=1629709602784&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40types%2Fuglify-js%2Fdownload%2F%40types%2Fuglify-js-3.13.1.tgz", - "integrity": "sha1-XoienoHpQkXHW2RQYA4cXqKHiuo=", - "requires": { - "source-map": "^0.6.1" - } - }, - "@types/webpack": { - "version": "4.41.30", - "resolved": "https://registry.nlark.com/@types/webpack/download/@types/webpack-4.41.30.tgz", - "integrity": "sha1-/T220NQeFFqO7q/NPEp8zekGjdw=", - "requires": { - "@types/node": "*", - "@types/tapable": "^1", - "@types/uglify-js": "*", - "@types/webpack-sources": "*", - "anymatch": "^3.0.0", - "source-map": "^0.6.0" - } - }, - "@types/webpack-sources": { - "version": "3.2.0", - "resolved": "https://registry.nlark.com/@types/webpack-sources/download/@types/webpack-sources-3.2.0.tgz?cache=0&sync_timestamp=1629709756861&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40types%2Fwebpack-sources%2Fdownload%2F%40types%2Fwebpack-sources-3.2.0.tgz", - "integrity": "sha1-FtdZuglsKJA0smVT0t8b9FJI04s=", - "requires": { - "@types/node": "*", - "@types/source-list-map": "*", - "source-map": "^0.7.3" - }, - "dependencies": { - "source-map": { - "version": "0.7.3", - "resolved": "https://registry.nlark.com/source-map/download/source-map-0.7.3.tgz?cache=0&sync_timestamp=1624608014898&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fsource-map%2Fdownload%2Fsource-map-0.7.3.tgz", - "integrity": "sha1-UwL4FpAxc1ImVECS5kmB91F1A4M=" - } - } - }, - "@typescript-eslint/parser": { - "version": "4.30.0", - "resolved": "https://registry.nlark.com/@typescript-eslint/parser/download/@typescript-eslint/parser-4.30.0.tgz", - "integrity": "sha1-ar1yD2a9eQ8+DoDDvncYDI/LGS0=", - "dev": true, - "requires": { - "@typescript-eslint/scope-manager": "4.30.0", - "@typescript-eslint/types": "4.30.0", - "@typescript-eslint/typescript-estree": "4.30.0", - "debug": "^4.3.1" - } - }, - "@typescript-eslint/scope-manager": { - "version": "4.30.0", - "resolved": "https://registry.nlark.com/@typescript-eslint/scope-manager/download/@typescript-eslint/scope-manager-4.30.0.tgz?cache=0&sync_timestamp=1630474454313&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40typescript-eslint%2Fscope-manager%2Fdownload%2F%40typescript-eslint%2Fscope-manager-4.30.0.tgz", - "integrity": "sha1-Gj/7s4WxoGvoXNUWWiIyTwaahe4=", - "dev": true, - "requires": { - "@typescript-eslint/types": "4.30.0", - "@typescript-eslint/visitor-keys": "4.30.0" - } - }, - "@typescript-eslint/types": { - "version": "4.30.0", - "resolved": "https://registry.nlark.com/@typescript-eslint/types/download/@typescript-eslint/types-4.30.0.tgz?cache=0&sync_timestamp=1630474457027&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40typescript-eslint%2Ftypes%2Fdownload%2F%40typescript-eslint%2Ftypes-4.30.0.tgz", - "integrity": "sha1-+52bA1hCbxhof7qC6wsPhpeAIE8=", - "dev": true - }, - "@typescript-eslint/typescript-estree": { - "version": "4.30.0", - "resolved": "https://registry.nlark.com/@typescript-eslint/typescript-estree/download/@typescript-eslint/typescript-estree-4.30.0.tgz?cache=0&sync_timestamp=1630474515380&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40typescript-eslint%2Ftypescript-estree%2Fdownload%2F%40typescript-eslint%2Ftypescript-estree-4.30.0.tgz", - "integrity": "sha1-rleDPacqdT9IRs0wU3WMdxZwwqw=", - "dev": true, - "requires": { - "@typescript-eslint/types": "4.30.0", - "@typescript-eslint/visitor-keys": "4.30.0", - "debug": "^4.3.1", - "globby": "^11.0.3", - "is-glob": "^4.0.1", - "semver": "^7.3.5", - "tsutils": "^3.21.0" - }, - "dependencies": { - "array-union": { - "version": "2.1.0", - "resolved": "https://registry.nlark.com/array-union/download/array-union-2.1.0.tgz", - "integrity": "sha1-t5hCCtvrHego2ErNii4j0+/oXo0=", - "dev": true - }, - "globby": { - "version": "11.0.4", - "resolved": "https://registry.nlark.com/globby/download/globby-11.0.4.tgz", - "integrity": "sha1-LLr/d8Lypi5x6bKBOme5ejowAaU=", - "dev": true, - "requires": { - "array-union": "^2.1.0", - "dir-glob": "^3.0.1", - "fast-glob": "^3.1.1", - "ignore": "^5.1.4", - "merge2": "^1.3.0", - "slash": "^3.0.0" - } - } - } - }, - "@typescript-eslint/visitor-keys": { - "version": "4.30.0", - "resolved": "https://registry.nlark.com/@typescript-eslint/visitor-keys/download/@typescript-eslint/visitor-keys-4.30.0.tgz", - "integrity": "sha1-pHxicvxxsMYn0WkfaOrs9K1xRF4=", - "dev": true, - "requires": { - "@typescript-eslint/types": "4.30.0", - "eslint-visitor-keys": "^2.0.0" - } - }, - "@ungap/promise-all-settled": { - "version": "1.1.2", - "resolved": "https://registry.nlark.com/@ungap/promise-all-settled/download/@ungap/promise-all-settled-1.1.2.tgz", - "integrity": "sha1-qlgEJxHW4ydd033Fl+XTHowpCkQ=", - "dev": true - }, - "@webassemblyjs/ast": { - "version": "1.11.1", - "resolved": "https://registry.nlark.com/@webassemblyjs/ast/download/@webassemblyjs/ast-1.11.1.tgz?cache=0&sync_timestamp=1625473420080&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40webassemblyjs%2Fast%2Fdownload%2F%40webassemblyjs%2Fast-1.11.1.tgz", - "integrity": "sha1-K/12fq4aaZb0Mv9+jX/HVnnAtqc=", - "requires": { - "@webassemblyjs/helper-numbers": "1.11.1", - "@webassemblyjs/helper-wasm-bytecode": "1.11.1" - } - }, - "@webassemblyjs/floating-point-hex-parser": { - "version": "1.11.1", - "resolved": "https://registry.nlark.com/@webassemblyjs/floating-point-hex-parser/download/@webassemblyjs/floating-point-hex-parser-1.11.1.tgz", - "integrity": "sha1-9sYacF8P16auyqToGY8j2dwXnk8=" - }, - "@webassemblyjs/helper-api-error": { - "version": "1.11.1", - "resolved": "https://registry.nlark.com/@webassemblyjs/helper-api-error/download/@webassemblyjs/helper-api-error-1.11.1.tgz?cache=0&sync_timestamp=1625473346773&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40webassemblyjs%2Fhelper-api-error%2Fdownload%2F%40webassemblyjs%2Fhelper-api-error-1.11.1.tgz", - "integrity": "sha1-GmMZLYeI5cASgAump6RscFKI/RY=" - }, - "@webassemblyjs/helper-buffer": { - "version": "1.11.1", - "resolved": "https://registry.nlark.com/@webassemblyjs/helper-buffer/download/@webassemblyjs/helper-buffer-1.11.1.tgz", - "integrity": "sha1-gyqQDrREiEzemnytRn+BUA9eWrU=" - }, - "@webassemblyjs/helper-numbers": { - "version": "1.11.1", - "resolved": "https://registry.nlark.com/@webassemblyjs/helper-numbers/download/@webassemblyjs/helper-numbers-1.11.1.tgz", - "integrity": "sha1-ZNgdohn7u6HjvRv8dPboxOEKYq4=", - "requires": { - "@webassemblyjs/floating-point-hex-parser": "1.11.1", - "@webassemblyjs/helper-api-error": "1.11.1", - "@xtuc/long": "4.2.2" - } - }, - "@webassemblyjs/helper-wasm-bytecode": { - "version": "1.11.1", - "resolved": "https://registry.nlark.com/@webassemblyjs/helper-wasm-bytecode/download/@webassemblyjs/helper-wasm-bytecode-1.11.1.tgz", - "integrity": "sha1-8ygkHkHnsZnQsgwY6IQpxEMyleE=" - }, - "@webassemblyjs/helper-wasm-section": { - "version": "1.11.1", - "resolved": "https://registry.nlark.com/@webassemblyjs/helper-wasm-section/download/@webassemblyjs/helper-wasm-section-1.11.1.tgz?cache=0&sync_timestamp=1625473466570&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40webassemblyjs%2Fhelper-wasm-section%2Fdownload%2F%40webassemblyjs%2Fhelper-wasm-section-1.11.1.tgz", - "integrity": "sha1-Ie4GWntjXzGec48N1zv72igcCXo=", - "requires": { - "@webassemblyjs/ast": "1.11.1", - "@webassemblyjs/helper-buffer": "1.11.1", - "@webassemblyjs/helper-wasm-bytecode": "1.11.1", - "@webassemblyjs/wasm-gen": "1.11.1" - } - }, - "@webassemblyjs/ieee754": { - "version": "1.11.1", - "resolved": "https://registry.nlark.com/@webassemblyjs/ieee754/download/@webassemblyjs/ieee754-1.11.1.tgz", - "integrity": "sha1-ljkp6bvQVwnn4SJDoJkYCBKZJhQ=", - "requires": { - "@xtuc/ieee754": "^1.2.0" - } - }, - "@webassemblyjs/leb128": { - "version": "1.11.1", - "resolved": "https://registry.nlark.com/@webassemblyjs/leb128/download/@webassemblyjs/leb128-1.11.1.tgz", - "integrity": "sha1-zoFLRVdOk9drrh+yZEq5zdlSeqU=", - "requires": { - "@xtuc/long": "4.2.2" - } - }, - "@webassemblyjs/utf8": { - "version": "1.11.1", - "resolved": "https://registry.nlark.com/@webassemblyjs/utf8/download/@webassemblyjs/utf8-1.11.1.tgz", - "integrity": "sha1-0fi3ZDaefG5rrjUOhU3smlnwo/8=" - }, - "@webassemblyjs/wasm-edit": { - "version": "1.11.1", - "resolved": "https://registry.nlark.com/@webassemblyjs/wasm-edit/download/@webassemblyjs/wasm-edit-1.11.1.tgz?cache=0&sync_timestamp=1625473422937&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40webassemblyjs%2Fwasm-edit%2Fdownload%2F%40webassemblyjs%2Fwasm-edit-1.11.1.tgz", - "integrity": "sha1-rSBuv0v5WgWM6YgKjAksXeyBk9Y=", - "requires": { - "@webassemblyjs/ast": "1.11.1", - "@webassemblyjs/helper-buffer": "1.11.1", - "@webassemblyjs/helper-wasm-bytecode": "1.11.1", - "@webassemblyjs/helper-wasm-section": "1.11.1", - "@webassemblyjs/wasm-gen": "1.11.1", - "@webassemblyjs/wasm-opt": "1.11.1", - "@webassemblyjs/wasm-parser": "1.11.1", - "@webassemblyjs/wast-printer": "1.11.1" - } - }, - "@webassemblyjs/wasm-gen": { - "version": "1.11.1", - "resolved": "https://registry.nlark.com/@webassemblyjs/wasm-gen/download/@webassemblyjs/wasm-gen-1.11.1.tgz?cache=0&sync_timestamp=1625473464969&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40webassemblyjs%2Fwasm-gen%2Fdownload%2F%40webassemblyjs%2Fwasm-gen-1.11.1.tgz", - "integrity": "sha1-hsXqMEhJdZt9iMR6MvTwOa48j3Y=", - "requires": { - "@webassemblyjs/ast": "1.11.1", - "@webassemblyjs/helper-wasm-bytecode": "1.11.1", - "@webassemblyjs/ieee754": "1.11.1", - "@webassemblyjs/leb128": "1.11.1", - "@webassemblyjs/utf8": "1.11.1" - } - }, - "@webassemblyjs/wasm-opt": { - "version": "1.11.1", - "resolved": "https://registry.nlark.com/@webassemblyjs/wasm-opt/download/@webassemblyjs/wasm-opt-1.11.1.tgz?cache=0&sync_timestamp=1625473467198&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40webassemblyjs%2Fwasm-opt%2Fdownload%2F%40webassemblyjs%2Fwasm-opt-1.11.1.tgz", - "integrity": "sha1-ZXtMIgL0zzs0X4pMZGHIwkGJhfI=", - "requires": { - "@webassemblyjs/ast": "1.11.1", - "@webassemblyjs/helper-buffer": "1.11.1", - "@webassemblyjs/wasm-gen": "1.11.1", - "@webassemblyjs/wasm-parser": "1.11.1" - } - }, - "@webassemblyjs/wasm-parser": { - "version": "1.11.1", - "resolved": "https://registry.nlark.com/@webassemblyjs/wasm-parser/download/@webassemblyjs/wasm-parser-1.11.1.tgz?cache=0&sync_timestamp=1625473417746&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40webassemblyjs%2Fwasm-parser%2Fdownload%2F%40webassemblyjs%2Fwasm-parser-1.11.1.tgz", - "integrity": "sha1-hspzRTT0F+m9PGfHocddi+QfsZk=", - "requires": { - "@webassemblyjs/ast": "1.11.1", - "@webassemblyjs/helper-api-error": "1.11.1", - "@webassemblyjs/helper-wasm-bytecode": "1.11.1", - "@webassemblyjs/ieee754": "1.11.1", - "@webassemblyjs/leb128": "1.11.1", - "@webassemblyjs/utf8": "1.11.1" - } - }, - "@webassemblyjs/wast-printer": { - "version": "1.11.1", - "resolved": "https://registry.nlark.com/@webassemblyjs/wast-printer/download/@webassemblyjs/wast-printer-1.11.1.tgz?cache=0&sync_timestamp=1625473465901&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40webassemblyjs%2Fwast-printer%2Fdownload%2F%40webassemblyjs%2Fwast-printer-1.11.1.tgz", - "integrity": "sha1-0Mc77ajuxUJvEK6O9VzuXnCEwvA=", - "requires": { - "@webassemblyjs/ast": "1.11.1", - "@xtuc/long": "4.2.2" - } - }, - "@webpack-cli/configtest": { - "version": "1.0.4", - "resolved": "https://registry.nlark.com/@webpack-cli/configtest/download/@webpack-cli/configtest-1.0.4.tgz", - "integrity": "sha1-8DzmMRwIg6g9BFaeLAPGI4MW0qo=" - }, - "@webpack-cli/info": { - "version": "1.3.0", - "resolved": "https://registry.nlark.com/@webpack-cli/info/download/@webpack-cli/info-1.3.0.tgz", - "integrity": "sha1-nXijEQGpYJl6Ss1B/9m5MAYn/is=", - "requires": { - "envinfo": "^7.7.3" - } - }, - "@webpack-cli/serve": { - "version": "1.5.2", - "resolved": "https://registry.nlark.com/@webpack-cli/serve/download/@webpack-cli/serve-1.5.2.tgz", - "integrity": "sha1-6lhLY3/2PFpHf28hYEtaIFtyyew=" - }, - "@xtuc/ieee754": { - "version": "1.2.0", - "resolved": "https://registry.nlark.com/@xtuc/ieee754/download/@xtuc/ieee754-1.2.0.tgz", - "integrity": "sha1-7vAUoxRa5Hehy8AM0eVSM23Ot5A=" - }, - "@xtuc/long": { - "version": "4.2.2", - "resolved": "https://registry.nlark.com/@xtuc/long/download/@xtuc/long-4.2.2.tgz", - "integrity": "sha1-0pHGpOl5ibXGHZrPOWrk/hM6cY0=" - }, - "acorn": { - "version": "8.4.1", - "resolved": "https://registry.nlark.com/acorn/download/acorn-8.4.1.tgz", - "integrity": "sha1-VsNiUfx8q8cJatwY8Fr+gUMhoow=" - }, - "acorn-import-assertions": { - "version": "1.7.6", - "resolved": "https://registry.nlark.com/acorn-import-assertions/download/acorn-import-assertions-1.7.6.tgz", - "integrity": "sha1-WA4//K5ncO6+7HbDuXIyAenQH3g=" - }, - "acorn-jsx": { - "version": "5.3.2", - "resolved": "https://registry.nlark.com/acorn-jsx/download/acorn-jsx-5.3.2.tgz?cache=0&sync_timestamp=1625793705701&other_urls=https%3A%2F%2Fregistry.nlark.com%2Facorn-jsx%2Fdownload%2Facorn-jsx-5.3.2.tgz", - "integrity": "sha1-ftW7VZCLOy8bxVxq8WU7rafweTc=", - "dev": true - }, - "ajv": { - "version": "6.12.6", - "resolved": "https://registry.nlark.com/ajv/download/ajv-6.12.6.tgz", - "integrity": "sha1-uvWmLoArB9l3A0WG+MO69a3ybfQ=", - "requires": { - "fast-deep-equal": "^3.1.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", - "uri-js": "^4.2.2" - } - }, - "ajv-keywords": { - "version": "3.5.2", - "resolved": "https://registry.nlark.com/ajv-keywords/download/ajv-keywords-3.5.2.tgz", - "integrity": "sha1-MfKdpatuANHC0yms97WSlhTVAU0=" - }, - "ansi-colors": { - "version": "4.1.1", - "resolved": "https://registry.nlark.com/ansi-colors/download/ansi-colors-4.1.1.tgz", - "integrity": "sha1-y7muJWv3UK8eqzRPIpqif+lLo0g=", - "dev": true - }, - "ansi-regex": { - "version": "5.0.0", - "resolved": "https://registry.nlark.com/ansi-regex/download/ansi-regex-5.0.0.tgz", - "integrity": "sha1-OIU59VF5vzkznIGvMKZU1p+Hy3U=", - "dev": true - }, - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.nlark.com/ansi-styles/download/ansi-styles-4.3.0.tgz", - "integrity": "sha1-7dgDYornHATIWuegkG7a00tkiTc=", - "requires": { - "color-convert": "^2.0.1" - } - }, - "anymatch": { - "version": "3.1.2", - "resolved": "https://registry.nlark.com/anymatch/download/anymatch-3.1.2.tgz", - "integrity": "sha1-wFV8CWrzLxBhmPT04qODU343hxY=", - "requires": { - "normalize-path": "^3.0.0", - "picomatch": "^2.0.4" - } - }, - "arg": { - "version": "4.1.3", - "resolved": "https://registry.nlark.com/arg/download/arg-4.1.3.tgz?cache=0&sync_timestamp=1629166495886&other_urls=https%3A%2F%2Fregistry.nlark.com%2Farg%2Fdownload%2Farg-4.1.3.tgz", - "integrity": "sha1-Jp/HrVuOQstjyJbVZmAXJhwUQIk=", - "dev": true - }, - "argparse": { - "version": "1.0.10", - "resolved": "https://registry.nlark.com/argparse/download/argparse-1.0.10.tgz", - "integrity": "sha1-vNZ5HqWuCXJeF+WtmIE0zUCz2RE=", - "dev": true, - "requires": { - "sprintf-js": "~1.0.2" - } - }, - "arr-diff": { - "version": "4.0.0", - "resolved": "https://registry.nlark.com/arr-diff/download/arr-diff-4.0.0.tgz", - "integrity": "sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA=", - "dev": true, - "optional": true - }, - "arr-flatten": { - "version": "1.1.0", - "resolved": "https://registry.nlark.com/arr-flatten/download/arr-flatten-1.1.0.tgz", - "integrity": "sha1-NgSLv/TntH4TZkQxbJlmnqWukfE=", - "dev": true, - "optional": true - }, - "arr-union": { - "version": "3.1.0", - "resolved": "https://registry.nlark.com/arr-union/download/arr-union-3.1.0.tgz", - "integrity": "sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ=", - "dev": true, - "optional": true - }, - "array-union": { - "version": "1.0.2", - "resolved": "https://registry.nlark.com/array-union/download/array-union-1.0.2.tgz", - "integrity": "sha1-mjRBDk9OPaI96jdb5b5w8kd47Dk=", - "requires": { - "array-uniq": "^1.0.1" - } - }, - "array-uniq": { - "version": "1.0.3", - "resolved": "https://registry.nlark.com/array-uniq/download/array-uniq-1.0.3.tgz", - "integrity": "sha1-r2rId6Jcx/dOBYiUdThY39sk/bY=" - }, - "array-unique": { - "version": "0.3.2", - "resolved": "https://registry.nlark.com/array-unique/download/array-unique-0.3.2.tgz", - "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=", - "dev": true, - "optional": true - }, - "assertion-error": { - "version": "1.1.0", - "resolved": "https://registry.nlark.com/assertion-error/download/assertion-error-1.1.0.tgz", - "integrity": "sha1-5gtrDo8wG9l+U3UhW9pAbIURjAs=", - "dev": true - }, - "assign-symbols": { - "version": "1.0.0", - "resolved": "https://registry.nlark.com/assign-symbols/download/assign-symbols-1.0.0.tgz", - "integrity": "sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c=", - "dev": true, - "optional": true - }, - "astral-regex": { - "version": "2.0.0", - "resolved": "https://registry.nlark.com/astral-regex/download/astral-regex-2.0.0.tgz", - "integrity": "sha1-SDFDxWeu7UeFdZwIZXhtx319LjE=", - "dev": true - }, - "async-each": { - "version": "1.0.3", - "resolved": "https://registry.nlark.com/async-each/download/async-each-1.0.3.tgz", - "integrity": "sha1-tyfb+H12UWAvBvTUrDh/R9kbDL8=", - "dev": true, - "optional": true - }, - "atob": { - "version": "2.1.2", - "resolved": "https://registry.nlark.com/atob/download/atob-2.1.2.tgz", - "integrity": "sha1-bZUX654DDSQ2ZmZR6GvZ9vE1M8k=", - "dev": true, - "optional": true - }, - "babel-plugin-dynamic-import-node": { - "version": "2.3.3", - "resolved": "https://registry.nlark.com/babel-plugin-dynamic-import-node/download/babel-plugin-dynamic-import-node-2.3.3.tgz?cache=0&sync_timestamp=1624608029217&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fbabel-plugin-dynamic-import-node%2Fdownload%2Fbabel-plugin-dynamic-import-node-2.3.3.tgz", - "integrity": "sha1-hP2hnJduxcbe/vV/lCez3vZuF6M=", - "dev": true, - "requires": { - "object.assign": "^4.1.0" - } - }, - "babel-plugin-polyfill-corejs2": { - "version": "0.2.2", - "resolved": "https://registry.nlark.com/babel-plugin-polyfill-corejs2/download/babel-plugin-polyfill-corejs2-0.2.2.tgz", - "integrity": "sha1-6RJHheb9lPlLYYp5VOVpMFO/Uyc=", - "dev": true, - "requires": { - "@babel/compat-data": "^7.13.11", - "@babel/helper-define-polyfill-provider": "^0.2.2", - "semver": "^6.1.1" - }, - "dependencies": { - "semver": { - "version": "6.3.0", - "resolved": "https://registry.nlark.com/semver/download/semver-6.3.0.tgz?cache=0&sync_timestamp=1624607961409&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fsemver%2Fdownload%2Fsemver-6.3.0.tgz", - "integrity": "sha1-7gpkyK9ejO6mdoexM3YeG+y9HT0=", - "dev": true - } - } - }, - "babel-plugin-polyfill-corejs3": { - "version": "0.2.4", - "resolved": "https://registry.nlark.com/babel-plugin-polyfill-corejs3/download/babel-plugin-polyfill-corejs3-0.2.4.tgz", - "integrity": "sha1-aMuBMWsOjZ1yGpLgAJ7G7NTNLKk=", - "dev": true, - "requires": { - "@babel/helper-define-polyfill-provider": "^0.2.2", - "core-js-compat": "^3.14.0" - } - }, - "babel-plugin-polyfill-regenerator": { - "version": "0.2.2", - "resolved": "https://registry.nlark.com/babel-plugin-polyfill-regenerator/download/babel-plugin-polyfill-regenerator-0.2.2.tgz", - "integrity": "sha1-sxDI1kKsraNIwfo7Pmzg6FG+4Hc=", - "dev": true, - "requires": { - "@babel/helper-define-polyfill-provider": "^0.2.2" - } - }, - "balanced-match": { - "version": "1.0.2", - "resolved": "https://registry.nlark.com/balanced-match/download/balanced-match-1.0.2.tgz", - "integrity": "sha1-6D46fj8wCzTLnYf2FfoMvzV2kO4=" - }, - "base": { - "version": "0.11.2", - "resolved": "https://registry.nlark.com/base/download/base-0.11.2.tgz", - "integrity": "sha1-e95c7RRbbVUakNuH+DxVi060io8=", - "dev": true, - "optional": true, - "requires": { - "cache-base": "^1.0.1", - "class-utils": "^0.3.5", - "component-emitter": "^1.2.1", - "define-property": "^1.0.0", - "isobject": "^3.0.1", - "mixin-deep": "^1.2.0", - "pascalcase": "^0.1.1" - }, - "dependencies": { - "define-property": { - "version": "1.0.0", - "resolved": "https://registry.nlark.com/define-property/download/define-property-1.0.0.tgz", - "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", - "dev": true, - "optional": true, - "requires": { - "is-descriptor": "^1.0.0" - } - }, - "is-accessor-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.nlark.com/is-accessor-descriptor/download/is-accessor-descriptor-1.0.0.tgz", - "integrity": "sha1-FpwvbT3x+ZJhgHI2XJsOofaHhlY=", - "dev": true, - "optional": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-data-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.nlark.com/is-data-descriptor/download/is-data-descriptor-1.0.0.tgz", - "integrity": "sha1-2Eh2Mh0Oet0DmQQGq7u9NrqSaMc=", - "dev": true, - "optional": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-descriptor": { - "version": "1.0.2", - "resolved": "https://registry.nlark.com/is-descriptor/download/is-descriptor-1.0.2.tgz", - "integrity": "sha1-OxWXRqZmBLBPjIFSS6NlxfFNhuw=", - "dev": true, - "optional": true, - "requires": { - "is-accessor-descriptor": "^1.0.0", - "is-data-descriptor": "^1.0.0", - "kind-of": "^6.0.2" - } - } - } - }, - "big.js": { - "version": "5.2.2", - "resolved": "https://registry.nlark.com/big.js/download/big.js-5.2.2.tgz", - "integrity": "sha1-ZfCvOC9Xi83HQr2cKB6cstd2gyg=" - }, - "binary-extensions": { - "version": "1.13.1", - "resolved": "https://registry.nlark.com/binary-extensions/download/binary-extensions-1.13.1.tgz", - "integrity": "sha1-WYr+VHVbKGilMw0q/51Ou1Mgm2U=", - "dev": true, - "optional": true - }, - "brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.nlark.com/brace-expansion/download/brace-expansion-1.1.11.tgz", - "integrity": "sha1-PH/L9SnYcibz0vUrlm/1Jx60Qd0=", - "requires": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "braces": { - "version": "3.0.2", - "resolved": "https://registry.nlark.com/braces/download/braces-3.0.2.tgz", - "integrity": "sha1-NFThpGLujVmeI23zNs2epPiv4Qc=", - "requires": { - "fill-range": "^7.0.1" - } - }, - "browser-stdout": { - "version": "1.3.1", - "resolved": "https://registry.nlark.com/browser-stdout/download/browser-stdout-1.3.1.tgz", - "integrity": "sha1-uqVZ7hTO1zRSIputcyZGfGH6vWA=", - "dev": true - }, - "browserslist": { - "version": "4.16.8", - "resolved": "https://registry.nlark.com/browserslist/download/browserslist-4.16.8.tgz?cache=0&sync_timestamp=1629302575089&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fbrowserslist%2Fdownload%2Fbrowserslist-4.16.8.tgz", - "integrity": "sha1-y4aLC1VPE3um4z3g7P8u2kA8T7A=", - "requires": { - "caniuse-lite": "^1.0.30001251", - "colorette": "^1.3.0", - "electron-to-chromium": "^1.3.811", - "escalade": "^3.1.1", - "node-releases": "^1.1.75" - } - }, - "buffer-from": { - "version": "1.1.2", - "resolved": "https://registry.nlark.com/buffer-from/download/buffer-from-1.1.2.tgz?cache=0&sync_timestamp=1627578361955&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fbuffer-from%2Fdownload%2Fbuffer-from-1.1.2.tgz", - "integrity": "sha1-KxRqb9cugLT1XSVfNe1Zo6mkG9U=" - }, - "cache-base": { - "version": "1.0.1", - "resolved": "https://registry.nlark.com/cache-base/download/cache-base-1.0.1.tgz", - "integrity": "sha1-Cn9GQWgxyLZi7jb+TnxZ129marI=", - "dev": true, - "optional": true, - "requires": { - "collection-visit": "^1.0.0", - "component-emitter": "^1.2.1", - "get-value": "^2.0.6", - "has-value": "^1.0.0", - "isobject": "^3.0.1", - "set-value": "^2.0.0", - "to-object-path": "^0.3.0", - "union-value": "^1.0.0", - "unset-value": "^1.0.0" - } - }, - "call-bind": { - "version": "1.0.2", - "resolved": "https://registry.nlark.com/call-bind/download/call-bind-1.0.2.tgz", - "integrity": "sha1-sdTonmiBGcPJqQOtMKuy9qkZvjw=", - "dev": true, - "requires": { - "function-bind": "^1.1.1", - "get-intrinsic": "^1.0.2" - } - }, - "callsites": { - "version": "3.1.0", - "resolved": "https://registry.nlark.com/callsites/download/callsites-3.1.0.tgz?cache=0&sync_timestamp=1628464907898&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fcallsites%2Fdownload%2Fcallsites-3.1.0.tgz", - "integrity": "sha1-s2MKvYlDQy9Us/BRkjjjPNffL3M=", - "dev": true - }, - "camelcase": { - "version": "6.2.0", - "resolved": "https://registry.nlark.com/camelcase/download/camelcase-6.2.0.tgz", - "integrity": "sha1-kkr4gcnVJaydh/QNlk5c6pgqGAk=", - "dev": true - }, - "caniuse-lite": { - "version": "1.0.30001252", - "resolved": "https://registry.nlark.com/caniuse-lite/download/caniuse-lite-1.0.30001252.tgz", - "integrity": "sha1-yxbk49r+lI/EqbszB66gVLkSAZo=" - }, - "chai": { - "version": "4.3.4", - "resolved": "https://registry.nlark.com/chai/download/chai-4.3.4.tgz?cache=0&sync_timestamp=1624607982671&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fchai%2Fdownload%2Fchai-4.3.4.tgz", - "integrity": "sha1-tV5lWzHh6scJm+TAjCGWT84ubEk=", - "dev": true, - "requires": { - "assertion-error": "^1.1.0", - "check-error": "^1.0.2", - "deep-eql": "^3.0.1", - "get-func-name": "^2.0.0", - "pathval": "^1.1.1", - "type-detect": "^4.0.5" - } - }, - "chalk": { - "version": "4.1.2", - "resolved": "https://registry.nlark.com/chalk/download/chalk-4.1.2.tgz?cache=0&sync_timestamp=1627646614989&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fchalk%2Fdownload%2Fchalk-4.1.2.tgz", - "integrity": "sha1-qsTit3NKdAhnrrFr8CqtVWoeegE=", - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "check-error": { - "version": "1.0.2", - "resolved": "https://registry.nlark.com/check-error/download/check-error-1.0.2.tgz", - "integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=", - "dev": true - }, - "chokidar": { - "version": "3.5.2", - "resolved": "https://registry.nlark.com/chokidar/download/chokidar-3.5.2.tgz", - "integrity": "sha1-26OXb8rbAW9m/TZQIdkWANAcHnU=", - "dev": true, - "optional": true, - "requires": { - "anymatch": "~3.1.2", - "braces": "~3.0.2", - "fsevents": "~2.3.2", - "glob-parent": "~5.1.2", - "is-binary-path": "~2.1.0", - "is-glob": "~4.0.1", - "normalize-path": "~3.0.0", - "readdirp": "~3.6.0" - }, - "dependencies": { - "binary-extensions": { - "version": "2.2.0", - "resolved": "https://registry.nlark.com/binary-extensions/download/binary-extensions-2.2.0.tgz", - "integrity": "sha1-dfUC7q+f/eQvyYgpZFvk6na9ni0=", - "dev": true, - "optional": true - }, - "is-binary-path": { - "version": "2.1.0", - "resolved": "https://registry.nlark.com/is-binary-path/download/is-binary-path-2.1.0.tgz", - "integrity": "sha1-6h9/O4DwZCNug0cPhsCcJU+0Wwk=", - "dev": true, - "optional": true, - "requires": { - "binary-extensions": "^2.0.0" - } - }, - "readdirp": { - "version": "3.6.0", - "resolved": "https://registry.nlark.com/readdirp/download/readdirp-3.6.0.tgz", - "integrity": "sha1-dKNwvYVxFuJFspzJc0DNQxoCpsc=", - "dev": true, - "optional": true, - "requires": { - "picomatch": "^2.2.1" - } - } - } - }, - "chrome-trace-event": { - "version": "1.0.3", - "resolved": "https://registry.nlark.com/chrome-trace-event/download/chrome-trace-event-1.0.3.tgz", - "integrity": "sha1-EBXs7UdB4V0GZkqVfbv1DQQeJqw=" - }, - "class-utils": { - "version": "0.3.6", - "resolved": "https://registry.nlark.com/class-utils/download/class-utils-0.3.6.tgz", - "integrity": "sha1-+TNprouafOAv1B+q0MqDAzGQxGM=", - "dev": true, - "optional": true, - "requires": { - "arr-union": "^3.1.0", - "define-property": "^0.2.5", - "isobject": "^3.0.0", - "static-extend": "^0.1.1" - }, - "dependencies": { - "define-property": { - "version": "0.2.5", - "resolved": "https://registry.nlark.com/define-property/download/define-property-0.2.5.tgz", - "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", - "dev": true, - "optional": true, - "requires": { - "is-descriptor": "^0.1.0" - } - } - } - }, - "clean-webpack-plugin": { - "version": "3.0.0", - "resolved": "https://registry.nlark.com/clean-webpack-plugin/download/clean-webpack-plugin-3.0.0.tgz?cache=0&sync_timestamp=1630504808165&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fclean-webpack-plugin%2Fdownload%2Fclean-webpack-plugin-3.0.0.tgz", - "integrity": "sha1-qZ2Ow0wcYopFQVZ6p7RXRGRgxis=", - "requires": { - "@types/webpack": "^4.4.31", - "del": "^4.1.1" - } - }, - "cliui": { - "version": "7.0.4", - "resolved": "https://registry.nlark.com/cliui/download/cliui-7.0.4.tgz", - "integrity": "sha1-oCZe5lVHb8gHrqnfPfjfd4OAi08=", - "dev": true, - "requires": { - "string-width": "^4.2.0", - "strip-ansi": "^6.0.0", - "wrap-ansi": "^7.0.0" - } - }, - "clone-deep": { - "version": "4.0.1", - "resolved": "https://registry.nlark.com/clone-deep/download/clone-deep-4.0.1.tgz", - "integrity": "sha1-wZ/Zvbv4WUK0/ZechNz31fB8I4c=", - "requires": { - "is-plain-object": "^2.0.4", - "kind-of": "^6.0.2", - "shallow-clone": "^3.0.0" - } - }, - "collection-visit": { - "version": "1.0.0", - "resolved": "https://registry.nlark.com/collection-visit/download/collection-visit-1.0.0.tgz", - "integrity": "sha1-S8A3PBZLwykbTTaMgpzxqApZ3KA=", - "dev": true, - "optional": true, - "requires": { - "map-visit": "^1.0.0", - "object-visit": "^1.0.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.nlark.com/color-convert/download/color-convert-2.0.1.tgz?cache=0&sync_timestamp=1624607968569&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fcolor-convert%2Fdownload%2Fcolor-convert-2.0.1.tgz", - "integrity": "sha1-ctOmjVmMm9s68q0ehPIdiWq9TeM=", - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.nlark.com/color-name/download/color-name-1.1.4.tgz", - "integrity": "sha1-wqCah6y95pVD3m9j+jmVyCbFNqI=" - }, - "colorette": { - "version": "1.3.0", - "resolved": "https://registry.nlark.com/colorette/download/colorette-1.3.0.tgz", - "integrity": "sha1-/0XS8O2yRAadO3cq3rBP7TjQoK8=" - }, - "commander": { - "version": "2.20.3", - "resolved": "https://registry.nlark.com/commander/download/commander-2.20.3.tgz", - "integrity": "sha1-/UhehMA+tIgcIHIrpIA16FMa6zM=" - }, - "component-emitter": { - "version": "1.3.0", - "resolved": "https://registry.nlark.com/component-emitter/download/component-emitter-1.3.0.tgz", - "integrity": "sha1-FuQHD7qK4ptnnyIVhT7hgasuq8A=", - "dev": true, - "optional": true - }, - "concat-map": { - "version": "0.0.1", - "resolved": "https://registry.nlark.com/concat-map/download/concat-map-0.0.1.tgz", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" - }, - "convert-source-map": { - "version": "1.8.0", - "resolved": "https://registry.nlark.com/convert-source-map/download/convert-source-map-1.8.0.tgz?cache=0&sync_timestamp=1624608042394&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fconvert-source-map%2Fdownload%2Fconvert-source-map-1.8.0.tgz", - "integrity": "sha1-8zc8MtIbTXgN2ABFFGhPt5HKQ2k=", - "dev": true, - "requires": { - "safe-buffer": "~5.1.1" - }, - "dependencies": { - "safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.nlark.com/safe-buffer/download/safe-buffer-5.1.2.tgz", - "integrity": "sha1-mR7GnSluAxN0fVm9/St0XDX4go0=", - "dev": true - } - } - }, - "copy-descriptor": { - "version": "0.1.1", - "resolved": "https://registry.nlark.com/copy-descriptor/download/copy-descriptor-0.1.1.tgz", - "integrity": "sha1-Z29us8OZl8LuGsOpJP1hJHSPV40=", - "dev": true, - "optional": true - }, - "copy-webpack-plugin": { - "version": "8.1.1", - "resolved": "https://registry.nlark.com/copy-webpack-plugin/download/copy-webpack-plugin-8.1.1.tgz", - "integrity": "sha1-P2l+FidkklwvDSNfOAZ2ElUI/SY=", - "requires": { - "fast-glob": "^3.2.5", - "glob-parent": "^5.1.1", - "globby": "^11.0.3", - "normalize-path": "^3.0.0", - "p-limit": "^3.1.0", - "schema-utils": "^3.0.0", - "serialize-javascript": "^5.0.1" - }, - "dependencies": { - "array-union": { - "version": "2.1.0", - "resolved": "https://registry.nlark.com/array-union/download/array-union-2.1.0.tgz", - "integrity": "sha1-t5hCCtvrHego2ErNii4j0+/oXo0=" - }, - "globby": { - "version": "11.0.4", - "resolved": "https://registry.nlark.com/globby/download/globby-11.0.4.tgz", - "integrity": "sha1-LLr/d8Lypi5x6bKBOme5ejowAaU=", - "requires": { - "array-union": "^2.1.0", - "dir-glob": "^3.0.1", - "fast-glob": "^3.1.1", - "ignore": "^5.1.4", - "merge2": "^1.3.0", - "slash": "^3.0.0" - } - } - } - }, - "core-js-compat": { - "version": "3.17.2", - "resolved": "https://registry.nlark.com/core-js-compat/download/core-js-compat-3.17.2.tgz?cache=0&sync_timestamp=1630603307523&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fcore-js-compat%2Fdownload%2Fcore-js-compat-3.17.2.tgz", - "integrity": "sha1-9GGrlQwKD/7fwyfevyi35RiVCTY=", - "dev": true, - "requires": { - "browserslist": "^4.16.8", - "semver": "7.0.0" - }, - "dependencies": { - "semver": { - "version": "7.0.0", - "resolved": "https://registry.nlark.com/semver/download/semver-7.0.0.tgz?cache=0&sync_timestamp=1624607961409&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fsemver%2Fdownload%2Fsemver-7.0.0.tgz", - "integrity": "sha1-XzyjV2HkfgWyBsba/yz4FPAxa44=", - "dev": true - } - } - }, - "core-util-is": { - "version": "1.0.3", - "resolved": "https://registry.nlark.com/core-util-is/download/core-util-is-1.0.3.tgz", - "integrity": "sha1-pgQtNjTCsn6TKPg3uWX6yDgI24U=" - }, - "create-require": { - "version": "1.1.1", - "resolved": "https://registry.nlark.com/create-require/download/create-require-1.1.1.tgz", - "integrity": "sha1-wdfo8eX2z8n/ZfnNNS03NIdWwzM=", - "dev": true - }, - "cross-spawn": { - "version": "7.0.3", - "resolved": "https://registry.nlark.com/cross-spawn/download/cross-spawn-7.0.3.tgz?cache=0&sync_timestamp=1624608055915&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fcross-spawn%2Fdownload%2Fcross-spawn-7.0.3.tgz", - "integrity": "sha1-9zqFudXUHQRVUcF34ogtSshXKKY=", - "requires": { - "path-key": "^3.1.0", - "shebang-command": "^2.0.0", - "which": "^2.0.1" - } - }, - "date-format": { - "version": "3.0.0", - "resolved": "https://registry.nlark.com/date-format/download/date-format-3.0.0.tgz", - "integrity": "sha1-64eANlx9KxURB4+0keZHl4DzrZU=" - }, - "debug": { - "version": "4.3.2", - "resolved": "https://registry.nlark.com/debug/download/debug-4.3.2.tgz?cache=0&sync_timestamp=1625374653719&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fdebug%2Fdownload%2Fdebug-4.3.2.tgz", - "integrity": "sha1-8KScGKyHeeMdSgxgKd+3aHPHQos=", - "requires": { - "ms": "2.1.2" - } - }, - "decamelize": { - "version": "4.0.0", - "resolved": "https://registry.nlark.com/decamelize/download/decamelize-4.0.0.tgz", - "integrity": "sha1-qkcte/Zg6xXzSU79UxyrfypwmDc=", - "dev": true - }, - "deccjsunit": { - "version": "1.0.3", - "resolved": "https://registry.nlark.com/deccjsunit/download/deccjsunit-1.0.3.tgz", - "integrity": "sha1-AcMxIKje4SsaoQiZGE14pszfiKI=" - }, - "decode-uri-component": { - "version": "0.2.0", - "resolved": "https://registry.nlark.com/decode-uri-component/download/decode-uri-component-0.2.0.tgz", - "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=", - "dev": true, - "optional": true - }, - "deep-eql": { - "version": "3.0.1", - "resolved": "https://registry.nlark.com/deep-eql/download/deep-eql-3.0.1.tgz", - "integrity": "sha1-38lARACtHI/gI+faHfHBR8S0RN8=", - "dev": true, - "requires": { - "type-detect": "^4.0.0" - } - }, - "deep-is": { - "version": "0.1.3", - "resolved": "https://registry.nlark.com/deep-is/download/deep-is-0.1.3.tgz", - "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=", - "dev": true - }, - "define-properties": { - "version": "1.1.3", - "resolved": "https://registry.nlark.com/define-properties/download/define-properties-1.1.3.tgz", - "integrity": "sha1-z4jabL7ib+bbcJT2HYcMvYTO6fE=", - "dev": true, - "requires": { - "object-keys": "^1.0.12" - } - }, - "define-property": { - "version": "2.0.2", - "resolved": "https://registry.nlark.com/define-property/download/define-property-2.0.2.tgz", - "integrity": "sha1-1Flono1lS6d+AqgX+HENcCyxbp0=", - "dev": true, - "optional": true, - "requires": { - "is-descriptor": "^1.0.2", - "isobject": "^3.0.1" - }, - "dependencies": { - "is-accessor-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.nlark.com/is-accessor-descriptor/download/is-accessor-descriptor-1.0.0.tgz", - "integrity": "sha1-FpwvbT3x+ZJhgHI2XJsOofaHhlY=", - "dev": true, - "optional": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-data-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.nlark.com/is-data-descriptor/download/is-data-descriptor-1.0.0.tgz", - "integrity": "sha1-2Eh2Mh0Oet0DmQQGq7u9NrqSaMc=", - "dev": true, - "optional": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-descriptor": { - "version": "1.0.2", - "resolved": "https://registry.nlark.com/is-descriptor/download/is-descriptor-1.0.2.tgz", - "integrity": "sha1-OxWXRqZmBLBPjIFSS6NlxfFNhuw=", - "dev": true, - "optional": true, - "requires": { - "is-accessor-descriptor": "^1.0.0", - "is-data-descriptor": "^1.0.0", - "kind-of": "^6.0.2" - } - } - } - }, - "del": { - "version": "4.1.1", - "resolved": "https://registry.nlark.com/del/download/del-4.1.1.tgz", - "integrity": "sha1-no8RciLqRKMf86FWwEm5kFKp8LQ=", - "requires": { - "@types/glob": "^7.1.1", - "globby": "^6.1.0", - "is-path-cwd": "^2.0.0", - "is-path-in-cwd": "^2.0.0", - "p-map": "^2.0.0", - "pify": "^4.0.1", - "rimraf": "^2.6.3" - } - }, - "diff": { - "version": "5.0.0", - "resolved": "https://registry.nlark.com/diff/download/diff-5.0.0.tgz?cache=0&sync_timestamp=1624608104914&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fdiff%2Fdownload%2Fdiff-5.0.0.tgz", - "integrity": "sha1-ftatdthZ0DB4fsNYVfWx2vMdhSs=", - "dev": true - }, - "dir-glob": { - "version": "3.0.1", - "resolved": "https://registry.nlark.com/dir-glob/download/dir-glob-3.0.1.tgz", - "integrity": "sha1-Vtv3PZkqSpO6FYT0U0Bj/S5BcX8=", - "requires": { - "path-type": "^4.0.0" - } - }, - "doctrine": { - "version": "3.0.0", - "resolved": "https://registry.nlark.com/doctrine/download/doctrine-3.0.0.tgz", - "integrity": "sha1-rd6+rXKmV023g2OdyHoSF3OXOWE=", - "dev": true, - "requires": { - "esutils": "^2.0.2" - } - }, - "electron-to-chromium": { - "version": "1.3.828", - "resolved": "https://registry.nlark.com/electron-to-chromium/download/electron-to-chromium-1.3.828.tgz", - "integrity": "sha1-De6XW1v0XWNXryZvNQ/NtnNqXkA=" - }, - "emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.nlark.com/emoji-regex/download/emoji-regex-8.0.0.tgz", - "integrity": "sha1-6Bj9ac5cz8tARZT4QpY79TFkzDc=", - "dev": true - }, - "emojis-list": { - "version": "3.0.0", - "resolved": "https://registry.nlark.com/emojis-list/download/emojis-list-3.0.0.tgz", - "integrity": "sha1-VXBmIEatKeLpFucariYKvf9Pang=" - }, - "enhanced-resolve": { - "version": "4.5.0", - "resolved": "https://registry.nlark.com/enhanced-resolve/download/enhanced-resolve-4.5.0.tgz", - "integrity": "sha1-Lzz9hNvjtIfxjy2y7x4GSlccpew=", - "requires": { - "graceful-fs": "^4.1.2", - "memory-fs": "^0.5.0", - "tapable": "^1.0.0" - } - }, - "enquirer": { - "version": "2.3.6", - "resolved": "https://registry.nlark.com/enquirer/download/enquirer-2.3.6.tgz", - "integrity": "sha1-Kn/l3WNKHkElqXXsmU/1RW3Dc00=", - "dev": true, - "requires": { - "ansi-colors": "^4.1.1" - } - }, - "envinfo": { - "version": "7.8.1", - "resolved": "https://registry.nlark.com/envinfo/download/envinfo-7.8.1.tgz", - "integrity": "sha1-Bjd+Pl9NN5/qesWS1a2JJ+DE1HU=" - }, - "errno": { - "version": "0.1.8", - "resolved": "https://registry.nlark.com/errno/download/errno-0.1.8.tgz", - "integrity": "sha1-i7Ppx9Rjvkl2/4iPdrSAnrwugR8=", - "requires": { - "prr": "~1.0.1" - } - }, - "es-module-lexer": { - "version": "0.7.1", - "resolved": "https://registry.nlark.com/es-module-lexer/download/es-module-lexer-0.7.1.tgz", - "integrity": "sha1-wsjg9G8t8GJ0za8N0/OzPgoLJn0=" - }, - "escalade": { - "version": "3.1.1", - "resolved": "https://registry.nlark.com/escalade/download/escalade-3.1.1.tgz", - "integrity": "sha1-2M/ccACWXFoBdLSoLqpcBVJ0LkA=" - }, - "escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.nlark.com/escape-string-regexp/download/escape-string-regexp-1.0.5.tgz", - "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", - "dev": true - }, - "eslint": { - "version": "7.32.0", - "resolved": "https://registry.nlark.com/eslint/download/eslint-7.32.0.tgz", - "integrity": "sha1-xtMooUvj+wjI0dIeEsAv23oqgS0=", - "dev": true, - "requires": { - "@babel/code-frame": "7.12.11", - "@eslint/eslintrc": "^0.4.3", - "@humanwhocodes/config-array": "^0.5.0", - "ajv": "^6.10.0", - "chalk": "^4.0.0", - "cross-spawn": "^7.0.2", - "debug": "^4.0.1", - "doctrine": "^3.0.0", - "enquirer": "^2.3.5", - "escape-string-regexp": "^4.0.0", - "eslint-scope": "^5.1.1", - "eslint-utils": "^2.1.0", - "eslint-visitor-keys": "^2.0.0", - "espree": "^7.3.1", - "esquery": "^1.4.0", - "esutils": "^2.0.2", - "fast-deep-equal": "^3.1.3", - "file-entry-cache": "^6.0.1", - "functional-red-black-tree": "^1.0.1", - "glob-parent": "^5.1.2", - "globals": "^13.6.0", - "ignore": "^4.0.6", - "import-fresh": "^3.0.0", - "imurmurhash": "^0.1.4", - "is-glob": "^4.0.0", - "js-yaml": "^3.13.1", - "json-stable-stringify-without-jsonify": "^1.0.1", - "levn": "^0.4.1", - "lodash.merge": "^4.6.2", - "minimatch": "^3.0.4", - "natural-compare": "^1.4.0", - "optionator": "^0.9.1", - "progress": "^2.0.0", - "regexpp": "^3.1.0", - "semver": "^7.2.1", - "strip-ansi": "^6.0.0", - "strip-json-comments": "^3.1.0", - "table": "^6.0.9", - "text-table": "^0.2.0", - "v8-compile-cache": "^2.0.3" - }, - "dependencies": { - "@babel/code-frame": { - "version": "7.12.11", - "resolved": "https://registry.nlark.com/@babel/code-frame/download/@babel/code-frame-7.12.11.tgz", - "integrity": "sha1-9K1DWqJj25NbjxDyxVLSP7cWpj8=", - "dev": true, - "requires": { - "@babel/highlight": "^7.10.4" - } - }, - "escape-string-regexp": { - "version": "4.0.0", - "resolved": "https://registry.nlark.com/escape-string-regexp/download/escape-string-regexp-4.0.0.tgz", - "integrity": "sha1-FLqDpdNz49MR5a/KKc9b+tllvzQ=", - "dev": true - }, - "globals": { - "version": "13.11.0", - "resolved": "https://registry.nlark.com/globals/download/globals-13.11.0.tgz", - "integrity": "sha1-QO9njaEX/nvS4o8fqySVG9AlW+c=", - "dev": true, - "requires": { - "type-fest": "^0.20.2" - } - }, - "ignore": { - "version": "4.0.6", - "resolved": "https://registry.nlark.com/ignore/download/ignore-4.0.6.tgz", - "integrity": "sha1-dQ49tYYgh7RzfrrIIH/9HvJ7Jfw=", - "dev": true - } - } - }, - "eslint-scope": { - "version": "5.1.1", - "resolved": "https://registry.nlark.com/eslint-scope/download/eslint-scope-5.1.1.tgz?cache=0&sync_timestamp=1627061754690&other_urls=https%3A%2F%2Fregistry.nlark.com%2Feslint-scope%2Fdownload%2Feslint-scope-5.1.1.tgz", - "integrity": "sha1-54blmmbLkrP2wfsNUIqrF0hI9Iw=", - "requires": { - "esrecurse": "^4.3.0", - "estraverse": "^4.1.1" - } - }, - "eslint-utils": { - "version": "2.1.0", - "resolved": "https://registry.nlark.com/eslint-utils/download/eslint-utils-2.1.0.tgz?cache=0&sync_timestamp=1624608042629&other_urls=https%3A%2F%2Fregistry.nlark.com%2Feslint-utils%2Fdownload%2Feslint-utils-2.1.0.tgz", - "integrity": "sha1-0t5eA0JOcH3BDHQGjd7a5wh0Gyc=", - "dev": true, - "requires": { - "eslint-visitor-keys": "^1.1.0" - }, - "dependencies": { - "eslint-visitor-keys": { - "version": "1.3.0", - "resolved": "https://registry.nlark.com/eslint-visitor-keys/download/eslint-visitor-keys-1.3.0.tgz", - "integrity": "sha1-MOvR73wv3/AcOk8VEESvJfqwUj4=", - "dev": true - } - } - }, - "eslint-visitor-keys": { - "version": "2.1.0", - "resolved": "https://registry.nlark.com/eslint-visitor-keys/download/eslint-visitor-keys-2.1.0.tgz", - "integrity": "sha1-9lMoJZMFknOSyTjtROsKXJsr0wM=", - "dev": true - }, - "espree": { - "version": "7.3.1", - "resolved": "https://registry.nlark.com/espree/download/espree-7.3.1.tgz?cache=0&sync_timestamp=1625021052689&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fespree%2Fdownload%2Fespree-7.3.1.tgz", - "integrity": "sha1-8t8zC3Usb1UBn4vYm3ZgA5wbu7Y=", - "dev": true, - "requires": { - "acorn": "^7.4.0", - "acorn-jsx": "^5.3.1", - "eslint-visitor-keys": "^1.3.0" - }, - "dependencies": { - "acorn": { - "version": "7.4.1", - "resolved": "https://registry.nlark.com/acorn/download/acorn-7.4.1.tgz", - "integrity": "sha1-/q7SVZc9LndVW4PbwIhRpsY1IPo=", - "dev": true - }, - "eslint-visitor-keys": { - "version": "1.3.0", - "resolved": "https://registry.nlark.com/eslint-visitor-keys/download/eslint-visitor-keys-1.3.0.tgz", - "integrity": "sha1-MOvR73wv3/AcOk8VEESvJfqwUj4=", - "dev": true - } - } - }, - "esprima": { - "version": "4.0.1", - "resolved": "https://registry.nlark.com/esprima/download/esprima-4.0.1.tgz", - "integrity": "sha1-E7BM2z5sXRnfkatph6hpVhmwqnE=", - "dev": true - }, - "esquery": { - "version": "1.4.0", - "resolved": "https://registry.nlark.com/esquery/download/esquery-1.4.0.tgz", - "integrity": "sha1-IUj/w4uC6McFff7UhCWz5h8PJKU=", - "dev": true, - "requires": { - "estraverse": "^5.1.0" - }, - "dependencies": { - "estraverse": { - "version": "5.2.0", - "resolved": "https://registry.nlark.com/estraverse/download/estraverse-5.2.0.tgz?cache=0&sync_timestamp=1624607974054&other_urls=https%3A%2F%2Fregistry.nlark.com%2Festraverse%2Fdownload%2Festraverse-5.2.0.tgz", - "integrity": "sha1-MH30JUfmzHMk088DwVXVzbjFOIA=", - "dev": true - } - } - }, - "esrecurse": { - "version": "4.3.0", - "resolved": "https://registry.nlark.com/esrecurse/download/esrecurse-4.3.0.tgz", - "integrity": "sha1-eteWTWeauyi+5yzsY3WLHF0smSE=", - "requires": { - "estraverse": "^5.2.0" - }, - "dependencies": { - "estraverse": { - "version": "5.2.0", - "resolved": "https://registry.nlark.com/estraverse/download/estraverse-5.2.0.tgz?cache=0&sync_timestamp=1624607974054&other_urls=https%3A%2F%2Fregistry.nlark.com%2Festraverse%2Fdownload%2Festraverse-5.2.0.tgz", - "integrity": "sha1-MH30JUfmzHMk088DwVXVzbjFOIA=" - } - } - }, - "estraverse": { - "version": "4.3.0", - "resolved": "https://registry.nlark.com/estraverse/download/estraverse-4.3.0.tgz?cache=0&sync_timestamp=1624607974054&other_urls=https%3A%2F%2Fregistry.nlark.com%2Festraverse%2Fdownload%2Festraverse-4.3.0.tgz", - "integrity": "sha1-OYrT88WiSUi+dyXoPRGn3ijNvR0=" - }, - "esutils": { - "version": "2.0.3", - "resolved": "https://registry.nlark.com/esutils/download/esutils-2.0.3.tgz", - "integrity": "sha1-dNLrTeC42hKTcRkQ1Qd1ubcQ72Q=", - "dev": true - }, - "events": { - "version": "3.3.0", - "resolved": "https://registry.nlark.com/events/download/events-3.3.0.tgz", - "integrity": "sha1-Mala0Kkk4tLEGagTrrLE6HjqdAA=" - }, - "execa": { - "version": "5.1.1", - "resolved": "https://registry.nlark.com/execa/download/execa-5.1.1.tgz", - "integrity": "sha1-+ArZy/Qpj3vR1MlVXCHpN0HEEd0=", - "requires": { - "cross-spawn": "^7.0.3", - "get-stream": "^6.0.0", - "human-signals": "^2.1.0", - "is-stream": "^2.0.0", - "merge-stream": "^2.0.0", - "npm-run-path": "^4.0.1", - "onetime": "^5.1.2", - "signal-exit": "^3.0.3", - "strip-final-newline": "^2.0.0" - } - }, - "expand-brackets": { - "version": "2.1.4", - "resolved": "https://registry.nlark.com/expand-brackets/download/expand-brackets-2.1.4.tgz", - "integrity": "sha1-t3c14xXOMPa27/D4OwQVGiJEliI=", - "dev": true, - "optional": true, - "requires": { - "debug": "^2.3.3", - "define-property": "^0.2.5", - "extend-shallow": "^2.0.1", - "posix-character-classes": "^0.1.0", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.1" - }, - "dependencies": { - "debug": { - "version": "2.6.9", - "resolved": "https://registry.nlark.com/debug/download/debug-2.6.9.tgz?cache=0&sync_timestamp=1625374653719&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fdebug%2Fdownload%2Fdebug-2.6.9.tgz", - "integrity": "sha1-XRKFFd8TT/Mn6QpMk/Tgd6U2NB8=", - "dev": true, - "optional": true, - "requires": { - "ms": "2.0.0" - } - }, - "define-property": { - "version": "0.2.5", - "resolved": "https://registry.nlark.com/define-property/download/define-property-0.2.5.tgz", - "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", - "dev": true, - "optional": true, - "requires": { - "is-descriptor": "^0.1.0" - } - }, - "extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.nlark.com/extend-shallow/download/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", - "dev": true, - "optional": true, - "requires": { - "is-extendable": "^0.1.0" - } - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.nlark.com/ms/download/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true, - "optional": true - } - } - }, - "extend-shallow": { - "version": "3.0.2", - "resolved": "https://registry.nlark.com/extend-shallow/download/extend-shallow-3.0.2.tgz", - "integrity": "sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg=", - "dev": true, - "optional": true, - "requires": { - "assign-symbols": "^1.0.0", - "is-extendable": "^1.0.1" - }, - "dependencies": { - "is-extendable": { - "version": "1.0.1", - "resolved": "https://registry.nlark.com/is-extendable/download/is-extendable-1.0.1.tgz", - "integrity": "sha1-p0cPnkJnM9gb2B4RVSZOOjUHyrQ=", - "dev": true, - "optional": true, - "requires": { - "is-plain-object": "^2.0.4" - } - } - } - }, - "extglob": { - "version": "2.0.4", - "resolved": "https://registry.nlark.com/extglob/download/extglob-2.0.4.tgz", - "integrity": "sha1-rQD+TcYSqSMuhxhxHcXLWrAoVUM=", - "dev": true, - "optional": true, - "requires": { - "array-unique": "^0.3.2", - "define-property": "^1.0.0", - "expand-brackets": "^2.1.4", - "extend-shallow": "^2.0.1", - "fragment-cache": "^0.2.1", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.1" - }, - "dependencies": { - "define-property": { - "version": "1.0.0", - "resolved": "https://registry.nlark.com/define-property/download/define-property-1.0.0.tgz", - "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", - "dev": true, - "optional": true, - "requires": { - "is-descriptor": "^1.0.0" - } - }, - "extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.nlark.com/extend-shallow/download/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", - "dev": true, - "optional": true, - "requires": { - "is-extendable": "^0.1.0" - } - }, - "is-accessor-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.nlark.com/is-accessor-descriptor/download/is-accessor-descriptor-1.0.0.tgz", - "integrity": "sha1-FpwvbT3x+ZJhgHI2XJsOofaHhlY=", - "dev": true, - "optional": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-data-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.nlark.com/is-data-descriptor/download/is-data-descriptor-1.0.0.tgz", - "integrity": "sha1-2Eh2Mh0Oet0DmQQGq7u9NrqSaMc=", - "dev": true, - "optional": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-descriptor": { - "version": "1.0.2", - "resolved": "https://registry.nlark.com/is-descriptor/download/is-descriptor-1.0.2.tgz", - "integrity": "sha1-OxWXRqZmBLBPjIFSS6NlxfFNhuw=", - "dev": true, - "optional": true, - "requires": { - "is-accessor-descriptor": "^1.0.0", - "is-data-descriptor": "^1.0.0", - "kind-of": "^6.0.2" - } - } - } - }, - "fast-deep-equal": { - "version": "3.1.3", - "resolved": "https://registry.nlark.com/fast-deep-equal/download/fast-deep-equal-3.1.3.tgz?cache=0&sync_timestamp=1624607945641&other_urls=https%3A%2F%2Fregistry.nlark.com%2Ffast-deep-equal%2Fdownload%2Ffast-deep-equal-3.1.3.tgz", - "integrity": "sha1-On1WtVnWy8PrUSMlJE5hmmXGxSU=" - }, - "fast-glob": { - "version": "3.2.7", - "resolved": "https://registry.nlark.com/fast-glob/download/fast-glob-3.2.7.tgz?cache=0&sync_timestamp=1625772623128&other_urls=https%3A%2F%2Fregistry.nlark.com%2Ffast-glob%2Fdownload%2Ffast-glob-3.2.7.tgz", - "integrity": "sha1-/Wy3otfpqnp4RhEehaGW1rL3ZqE=", - "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.nlark.com/fast-json-stable-stringify/download/fast-json-stable-stringify-2.1.0.tgz", - "integrity": "sha1-h0v2nG9ATCtdmcSBNBOZ/VWJJjM=" - }, - "fast-levenshtein": { - "version": "2.0.6", - "resolved": "https://registry.nlark.com/fast-levenshtein/download/fast-levenshtein-2.0.6.tgz", - "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=", - "dev": true - }, - "fastest-levenshtein": { - "version": "1.0.12", - "resolved": "https://registry.nlark.com/fastest-levenshtein/download/fastest-levenshtein-1.0.12.tgz", - "integrity": "sha1-mZD306iMxan/0fF0V0UlFwDUl+I=" - }, - "fastq": { - "version": "1.12.0", - "resolved": "https://registry.nlark.com/fastq/download/fastq-1.12.0.tgz?cache=0&sync_timestamp=1629360956808&other_urls=https%3A%2F%2Fregistry.nlark.com%2Ffastq%2Fdownload%2Ffastq-1.12.0.tgz", - "integrity": "sha1-7XtqtdYjk/ssxZHIU2UqXDGL95Q=", - "requires": { - "reusify": "^1.0.4" - } - }, - "file-entry-cache": { - "version": "6.0.1", - "resolved": "https://registry.nlark.com/file-entry-cache/download/file-entry-cache-6.0.1.tgz", - "integrity": "sha1-IRst2WWcsDlLBz5zI6w8kz1SICc=", - "dev": true, - "requires": { - "flat-cache": "^3.0.4" - } - }, - "fill-range": { - "version": "7.0.1", - "resolved": "https://registry.nlark.com/fill-range/download/fill-range-7.0.1.tgz", - "integrity": "sha1-GRmmp8df44ssfHflGYU12prN2kA=", - "requires": { - "to-regex-range": "^5.0.1" - } - }, - "find-up": { - "version": "4.1.0", - "resolved": "https://registry.nlark.com/find-up/download/find-up-4.1.0.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.nlark.com%2Ffind-up%2Fdownload%2Ffind-up-4.1.0.tgz", - "integrity": "sha1-l6/n1s3AvFkoWEt8jXsW6KmqXRk=", - "requires": { - "locate-path": "^5.0.0", - "path-exists": "^4.0.0" - } - }, - "flat": { - "version": "5.0.2", - "resolved": "https://registry.nlark.com/flat/download/flat-5.0.2.tgz", - "integrity": "sha1-jKb+MyBp/6nTJMMnGYxZglnOskE=", - "dev": true - }, - "flat-cache": { - "version": "3.0.4", - "resolved": "https://registry.nlark.com/flat-cache/download/flat-cache-3.0.4.tgz", - "integrity": "sha1-YbAzgwKy/p+Vfcwy/CqH8cMEixE=", - "dev": true, - "requires": { - "flatted": "^3.1.0", - "rimraf": "^3.0.2" - }, - "dependencies": { - "flatted": { - "version": "3.2.2", - "resolved": "https://registry.nlark.com/flatted/download/flatted-3.2.2.tgz?cache=0&sync_timestamp=1627541251258&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fflatted%2Fdownload%2Fflatted-3.2.2.tgz", - "integrity": "sha1-ZL/tXLaP48p4s+shStl7Y77c5WE=", - "dev": true - }, - "rimraf": { - "version": "3.0.2", - "resolved": "https://registry.nlark.com/rimraf/download/rimraf-3.0.2.tgz", - "integrity": "sha1-8aVAK6YiCtUswSgrrBrjqkn9Bho=", - "dev": true, - "requires": { - "glob": "^7.1.3" - } - } - } - }, - "flatted": { - "version": "2.0.2", - "resolved": "https://registry.nlark.com/flatted/download/flatted-2.0.2.tgz?cache=0&sync_timestamp=1627541251258&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fflatted%2Fdownload%2Fflatted-2.0.2.tgz", - "integrity": "sha1-RXWyHivO50NKqb5mL0t7X5wrUTg=" - }, - "for-in": { - "version": "1.0.2", - "resolved": "https://registry.nlark.com/for-in/download/for-in-1.0.2.tgz", - "integrity": "sha1-gQaNKVqBQuwKxybG4iAMMPttXoA=", - "dev": true, - "optional": true - }, - "fragment-cache": { - "version": "0.2.1", - "resolved": "https://registry.nlark.com/fragment-cache/download/fragment-cache-0.2.1.tgz", - "integrity": "sha1-QpD60n8T6Jvn8zeZxrxaCr//DRk=", - "dev": true, - "optional": true, - "requires": { - "map-cache": "^0.2.2" - } - }, - "fs-extra": { - "version": "8.1.0", - "resolved": "https://registry.nlark.com/fs-extra/download/fs-extra-8.1.0.tgz", - "integrity": "sha1-SdQ8RaiM2Wd2aMt74bRu/bjS4cA=", - "requires": { - "graceful-fs": "^4.2.0", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" - } - }, - "fs-readdir-recursive": { - "version": "1.1.0", - "resolved": "https://registry.nlark.com/fs-readdir-recursive/download/fs-readdir-recursive-1.1.0.tgz", - "integrity": "sha1-4y/AMKLM7kSmtTcTCNpUvgs5fSc=", - "dev": true - }, - "fs.realpath": { - "version": "1.0.0", - "resolved": "https://registry.nlark.com/fs.realpath/download/fs.realpath-1.0.0.tgz", - "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" - }, - "fsevents": { - "version": "2.3.2", - "resolved": "https://registry.nlark.com/fsevents/download/fsevents-2.3.2.tgz", - "integrity": "sha1-ilJveLj99GI7cJ4Ll1xSwkwC/Ro=", - "dev": true, - "optional": true - }, - "function-bind": { - "version": "1.1.1", - "resolved": "https://registry.nlark.com/function-bind/download/function-bind-1.1.1.tgz", - "integrity": "sha1-pWiZ0+o8m6uHS7l3O3xe3pL0iV0=" - }, - "functional-red-black-tree": { - "version": "1.0.1", - "resolved": "https://registry.nlark.com/functional-red-black-tree/download/functional-red-black-tree-1.0.1.tgz", - "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=", - "dev": true - }, - "gensync": { - "version": "1.0.0-beta.2", - "resolved": "https://registry.nlark.com/gensync/download/gensync-1.0.0-beta.2.tgz", - "integrity": "sha1-MqbudsPX9S1GsrGuXZP+qFgKJeA=", - "dev": true - }, - "get-caller-file": { - "version": "2.0.5", - "resolved": "https://registry.nlark.com/get-caller-file/download/get-caller-file-2.0.5.tgz", - "integrity": "sha1-T5RBKoLbMvNuOwuXQfipf+sDH34=", - "dev": true - }, - "get-func-name": { - "version": "2.0.0", - "resolved": "https://registry.nlark.com/get-func-name/download/get-func-name-2.0.0.tgz?cache=0&sync_timestamp=1624607980603&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fget-func-name%2Fdownload%2Fget-func-name-2.0.0.tgz", - "integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=", - "dev": true - }, - "get-intrinsic": { - "version": "1.1.1", - "resolved": "https://registry.nlark.com/get-intrinsic/download/get-intrinsic-1.1.1.tgz", - "integrity": "sha1-FfWfN2+FXERpY5SPDSTNNje0q8Y=", - "dev": true, - "requires": { - "function-bind": "^1.1.1", - "has": "^1.0.3", - "has-symbols": "^1.0.1" - } - }, - "get-stream": { - "version": "6.0.1", - "resolved": "https://registry.nlark.com/get-stream/download/get-stream-6.0.1.tgz", - "integrity": "sha1-omLY7vZ6ztV8KFKtYWdSakPL97c=" - }, - "get-value": { - "version": "2.0.6", - "resolved": "https://registry.nlark.com/get-value/download/get-value-2.0.6.tgz", - "integrity": "sha1-3BXKHGcjh8p2vTesCjlbogQqLCg=", - "dev": true, - "optional": true - }, - "glob": { - "version": "7.1.7", - "resolved": "https://registry.nlark.com/glob/download/glob-7.1.7.tgz", - "integrity": "sha1-Oxk+kjPwHULQs/eClLvutBj5SpA=", - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - }, - "glob-parent": { - "version": "5.1.2", - "resolved": "https://registry.nlark.com/glob-parent/download/glob-parent-5.1.2.tgz?cache=0&sync_timestamp=1626761012320&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fglob-parent%2Fdownload%2Fglob-parent-5.1.2.tgz", - "integrity": "sha1-hpgyxYA0/mikCTwX3BXoNA2EAcQ=", - "requires": { - "is-glob": "^4.0.1" - } - }, - "glob-to-regexp": { - "version": "0.4.1", - "resolved": "https://registry.nlark.com/glob-to-regexp/download/glob-to-regexp-0.4.1.tgz", - "integrity": "sha1-x1KXCHyFG5pXi9IX3VmpL1n+VG4=" - }, - "globals": { - "version": "11.12.0", - "resolved": "https://registry.nlark.com/globals/download/globals-11.12.0.tgz", - "integrity": "sha1-q4eVM4hooLq9hSV1gBjCp+uVxC4=", - "dev": true - }, - "globby": { - "version": "6.1.0", - "resolved": "https://registry.nlark.com/globby/download/globby-6.1.0.tgz", - "integrity": "sha1-9abXDoOV4hyFj7BInWTfAkJNUGw=", - "requires": { - "array-union": "^1.0.1", - "glob": "^7.0.3", - "object-assign": "^4.0.1", - "pify": "^2.0.0", - "pinkie-promise": "^2.0.0" - }, - "dependencies": { - "pify": { - "version": "2.3.0", - "resolved": "https://registry.nlark.com/pify/download/pify-2.3.0.tgz", - "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=" - } - } - }, - "graceful-fs": { - "version": "4.2.8", - "resolved": "https://registry.nlark.com/graceful-fs/download/graceful-fs-4.2.8.tgz?cache=0&sync_timestamp=1628194007768&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fgraceful-fs%2Fdownload%2Fgraceful-fs-4.2.8.tgz", - "integrity": "sha1-5BK40z9eAGWTy9PO5t+fLOu+gCo=" - }, - "growl": { - "version": "1.10.5", - "resolved": "https://registry.nlark.com/growl/download/growl-1.10.5.tgz", - "integrity": "sha1-8nNdwig2dPpnR4sQGBBZNVw2nl4=", - "dev": true - }, - "has": { - "version": "1.0.3", - "resolved": "https://registry.nlark.com/has/download/has-1.0.3.tgz", - "integrity": "sha1-ci18v8H2qoJB8W3YFOAR4fQeh5Y=", - "requires": { - "function-bind": "^1.1.1" - } - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.nlark.com/has-flag/download/has-flag-4.0.0.tgz?cache=0&sync_timestamp=1626716578584&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fhas-flag%2Fdownload%2Fhas-flag-4.0.0.tgz", - "integrity": "sha1-lEdx/ZyByBJlxNaUGGDaBrtZR5s=" - }, - "has-symbols": { - "version": "1.0.2", - "resolved": "https://registry.nlark.com/has-symbols/download/has-symbols-1.0.2.tgz", - "integrity": "sha1-Fl0wcMADCXUqEjakeTMeOsVvFCM=", - "dev": true - }, - "has-value": { - "version": "1.0.0", - "resolved": "https://registry.nlark.com/has-value/download/has-value-1.0.0.tgz", - "integrity": "sha1-GLKB2lhbHFxR3vJMkw7SmgvmsXc=", - "dev": true, - "optional": true, - "requires": { - "get-value": "^2.0.6", - "has-values": "^1.0.0", - "isobject": "^3.0.0" - } - }, - "has-values": { - "version": "1.0.0", - "resolved": "https://registry.nlark.com/has-values/download/has-values-1.0.0.tgz", - "integrity": "sha1-lbC2P+whRmGab+V/51Yo1aOe/k8=", - "dev": true, - "optional": true, - "requires": { - "is-number": "^3.0.0", - "kind-of": "^4.0.0" - }, - "dependencies": { - "is-number": { - "version": "3.0.0", - "resolved": "https://registry.nlark.com/is-number/download/is-number-3.0.0.tgz", - "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", - "dev": true, - "optional": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.nlark.com/kind-of/download/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "optional": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "kind-of": { - "version": "4.0.0", - "resolved": "https://registry.nlark.com/kind-of/download/kind-of-4.0.0.tgz", - "integrity": "sha1-IIE989cSkosgc3hpGkUGb65y3Vc=", - "dev": true, - "optional": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "he": { - "version": "1.2.0", - "resolved": "https://registry.nlark.com/he/download/he-1.2.0.tgz", - "integrity": "sha1-hK5l+n6vsWX922FWauFLrwVmTw8=", - "dev": true - }, - "human-signals": { - "version": "2.1.0", - "resolved": "https://registry.nlark.com/human-signals/download/human-signals-2.1.0.tgz", - "integrity": "sha1-3JH8ukLk0G5Kuu0zs+ejwC9RTqA=" - }, - "ignore": { - "version": "5.1.8", - "resolved": "https://registry.nlark.com/ignore/download/ignore-5.1.8.tgz", - "integrity": "sha1-8VCotQo0KJsz4i9YiavU2AFvDlc=" - }, - "import-fresh": { - "version": "3.3.0", - "resolved": "https://registry.nlark.com/import-fresh/download/import-fresh-3.3.0.tgz", - "integrity": "sha1-NxYsJfy566oublPVtNiM4X2eDCs=", - "dev": true, - "requires": { - "parent-module": "^1.0.0", - "resolve-from": "^4.0.0" - }, - "dependencies": { - "resolve-from": { - "version": "4.0.0", - "resolved": "https://registry.nlark.com/resolve-from/download/resolve-from-4.0.0.tgz?cache=0&sync_timestamp=1624607952279&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fresolve-from%2Fdownload%2Fresolve-from-4.0.0.tgz", - "integrity": "sha1-SrzYUq0y3Xuqv+m0DgCjbbXzkuY=", - "dev": true - } - } - }, - "import-local": { - "version": "3.0.2", - "resolved": "https://registry.nlark.com/import-local/download/import-local-3.0.2.tgz", - "integrity": "sha1-qM/QQx0d5KIZlwPQA+PmI2T6bbY=", - "requires": { - "pkg-dir": "^4.2.0", - "resolve-cwd": "^3.0.0" - } - }, - "imurmurhash": { - "version": "0.1.4", - "resolved": "https://registry.nlark.com/imurmurhash/download/imurmurhash-0.1.4.tgz", - "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", - "dev": true - }, - "inflight": { - "version": "1.0.6", - "resolved": "https://registry.nlark.com/inflight/download/inflight-1.0.6.tgz", - "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", - "requires": { - "once": "^1.3.0", - "wrappy": "1" - } - }, - "inherits": { - "version": "2.0.4", - "resolved": "https://registry.nlark.com/inherits/download/inherits-2.0.4.tgz", - "integrity": "sha1-D6LGT5MpF8NDOg3tVTY6rjdBa3w=" - }, - "interpret": { - "version": "2.2.0", - "resolved": "https://registry.nlark.com/interpret/download/interpret-2.2.0.tgz?cache=0&sync_timestamp=1624607963441&other_urls=https%3A%2F%2Fregistry.nlark.com%2Finterpret%2Fdownload%2Finterpret-2.2.0.tgz", - "integrity": "sha1-GnigtZZcQKVBbQB61vUK0nxBffk=" - }, - "is-accessor-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.nlark.com/is-accessor-descriptor/download/is-accessor-descriptor-0.1.6.tgz", - "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", - "dev": true, - "optional": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.nlark.com/kind-of/download/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "optional": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "is-binary-path": { - "version": "1.0.1", - "resolved": "https://registry.nlark.com/is-binary-path/download/is-binary-path-1.0.1.tgz", - "integrity": "sha1-dfFmQrSA8YenEcgUFh/TpKdlWJg=", - "dev": true, - "optional": true, - "requires": { - "binary-extensions": "^1.0.0" - } - }, - "is-buffer": { - "version": "1.1.6", - "resolved": "https://registry.nlark.com/is-buffer/download/is-buffer-1.1.6.tgz", - "integrity": "sha1-76ouqdqg16suoTqXsritUf776L4=", - "dev": true, - "optional": true - }, - "is-core-module": { - "version": "2.6.0", - "resolved": "https://registry.nlark.com/is-core-module/download/is-core-module-2.6.0.tgz?cache=0&sync_timestamp=1629225103688&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fis-core-module%2Fdownload%2Fis-core-module-2.6.0.tgz", - "integrity": "sha1-11U7JSb+Wbkro+QMjfdX7Ipwnhk=", - "requires": { - "has": "^1.0.3" - } - }, - "is-data-descriptor": { - "version": "0.1.4", - "resolved": "https://registry.nlark.com/is-data-descriptor/download/is-data-descriptor-0.1.4.tgz", - "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", - "dev": true, - "optional": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.nlark.com/kind-of/download/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "optional": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "is-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.nlark.com/is-descriptor/download/is-descriptor-0.1.6.tgz", - "integrity": "sha1-Nm2CQN3kh8pRgjsaufB6EKeCUco=", - "dev": true, - "optional": true, - "requires": { - "is-accessor-descriptor": "^0.1.6", - "is-data-descriptor": "^0.1.4", - "kind-of": "^5.0.0" - }, - "dependencies": { - "kind-of": { - "version": "5.1.0", - "resolved": "https://registry.nlark.com/kind-of/download/kind-of-5.1.0.tgz", - "integrity": "sha1-cpyR4thXt6QZofmqZWhcTDP1hF0=", - "dev": true, - "optional": true - } - } - }, - "is-extendable": { - "version": "0.1.1", - "resolved": "https://registry.nlark.com/is-extendable/download/is-extendable-0.1.1.tgz", - "integrity": "sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik=", - "dev": true, - "optional": true - }, - "is-extglob": { - "version": "2.1.1", - "resolved": "https://registry.nlark.com/is-extglob/download/is-extglob-2.1.1.tgz", - "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=" - }, - "is-fullwidth-code-point": { - "version": "3.0.0", - "resolved": "https://registry.nlark.com/is-fullwidth-code-point/download/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha1-8Rb4Bk/pCz94RKOJl8C3UFEmnx0=", - "dev": true - }, - "is-glob": { - "version": "4.0.1", - "resolved": "https://registry.nlark.com/is-glob/download/is-glob-4.0.1.tgz", - "integrity": "sha1-dWfb6fL14kZ7x3q4PEopSCQHpdw=", - "requires": { - "is-extglob": "^2.1.1" - } - }, - "is-number": { - "version": "7.0.0", - "resolved": "https://registry.nlark.com/is-number/download/is-number-7.0.0.tgz", - "integrity": "sha1-dTU0W4lnNNX4DE0GxQlVUnoU8Ss=" - }, - "is-path-cwd": { - "version": "2.2.0", - "resolved": "https://registry.nlark.com/is-path-cwd/download/is-path-cwd-2.2.0.tgz", - "integrity": "sha1-Z9Q7gmZKe1GR/ZEZEn6zAASKn9s=" - }, - "is-path-in-cwd": { - "version": "2.1.0", - "resolved": "https://registry.nlark.com/is-path-in-cwd/download/is-path-in-cwd-2.1.0.tgz", - "integrity": "sha1-v+Lcomxp85cmWkAJljYCk1oFOss=", - "requires": { - "is-path-inside": "^2.1.0" - } - }, - "is-path-inside": { - "version": "2.1.0", - "resolved": "https://registry.nlark.com/is-path-inside/download/is-path-inside-2.1.0.tgz", - "integrity": "sha1-fJgQWH1lmkDSe8201WFuqwWUlLI=", - "requires": { - "path-is-inside": "^1.0.2" - } - }, - "is-plain-obj": { - "version": "2.1.0", - "resolved": "https://registry.nlark.com/is-plain-obj/download/is-plain-obj-2.1.0.tgz", - "integrity": "sha1-ReQuN/zPH0Dajl927iFRWEDAkoc=", - "dev": true - }, - "is-plain-object": { - "version": "2.0.4", - "resolved": "https://registry.nlark.com/is-plain-object/download/is-plain-object-2.0.4.tgz?cache=0&sync_timestamp=1624608043754&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fis-plain-object%2Fdownload%2Fis-plain-object-2.0.4.tgz", - "integrity": "sha1-LBY7P6+xtgbZ0Xko8FwqHDjgdnc=", - "requires": { - "isobject": "^3.0.1" - } - }, - "is-stream": { - "version": "2.0.1", - "resolved": "https://registry.nlark.com/is-stream/download/is-stream-2.0.1.tgz?cache=0&sync_timestamp=1628592752355&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fis-stream%2Fdownload%2Fis-stream-2.0.1.tgz", - "integrity": "sha1-+sHj1TuXrVqdCunO8jifWBClwHc=" - }, - "is-windows": { - "version": "1.0.2", - "resolved": "https://registry.nlark.com/is-windows/download/is-windows-1.0.2.tgz", - "integrity": "sha1-0YUOuXkezRjmGCzhKjDzlmNLsZ0=", - "dev": true, - "optional": true - }, - "isarray": { - "version": "1.0.0", - "resolved": "https://registry.nlark.com/isarray/download/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" - }, - "isexe": { - "version": "2.0.0", - "resolved": "https://registry.nlark.com/isexe/download/isexe-2.0.0.tgz", - "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=" - }, - "isobject": { - "version": "3.0.1", - "resolved": "https://registry.nlark.com/isobject/download/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=" - }, - "jest-worker": { - "version": "27.1.0", - "resolved": "https://registry.nlark.com/jest-worker/download/jest-worker-27.1.0.tgz", - "integrity": "sha1-ZfSojjcUjtmEuoyoSS1rN2k4wKo=", - "requires": { - "@types/node": "*", - "merge-stream": "^2.0.0", - "supports-color": "^8.0.0" - }, - "dependencies": { - "supports-color": { - "version": "8.1.1", - "resolved": "https://registry.nlark.com/supports-color/download/supports-color-8.1.1.tgz?cache=0&sync_timestamp=1626703455199&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fsupports-color%2Fdownload%2Fsupports-color-8.1.1.tgz", - "integrity": "sha1-zW/BfihQDP9WwbhsCn/UpUpzAFw=", - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "js-tokens": { - "version": "4.0.0", - "resolved": "https://registry.nlark.com/js-tokens/download/js-tokens-4.0.0.tgz", - "integrity": "sha1-GSA/tZmR35jjoocFDUZHzerzJJk=", - "dev": true - }, - "js-yaml": { - "version": "3.14.1", - "resolved": "https://registry.nlark.com/js-yaml/download/js-yaml-3.14.1.tgz?cache=0&sync_timestamp=1624607946901&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fjs-yaml%2Fdownload%2Fjs-yaml-3.14.1.tgz", - "integrity": "sha1-2ugS/bOCX6MGYJqHFzg8UMNqBTc=", - "dev": true, - "requires": { - "argparse": "^1.0.7", - "esprima": "^4.0.0" - } - }, - "jsesc": { - "version": "2.5.2", - "resolved": "https://registry.nlark.com/jsesc/download/jsesc-2.5.2.tgz", - "integrity": "sha1-gFZNLkg9rPbo7yCWUKZ98/DCg6Q=", - "dev": true - }, - "json-parse-better-errors": { - "version": "1.0.2", - "resolved": "https://registry.nlark.com/json-parse-better-errors/download/json-parse-better-errors-1.0.2.tgz", - "integrity": "sha1-u4Z8+zRQ5pEHwTHRxRS6s9yLyqk=" - }, - "json-schema-traverse": { - "version": "0.4.1", - "resolved": "https://registry.nlark.com/json-schema-traverse/download/json-schema-traverse-0.4.1.tgz", - "integrity": "sha1-afaofZUTq4u4/mO9sJecRI5oRmA=" - }, - "json-stable-stringify-without-jsonify": { - "version": "1.0.1", - "resolved": "https://registry.nlark.com/json-stable-stringify-without-jsonify/download/json-stable-stringify-without-jsonify-1.0.1.tgz", - "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=", - "dev": true - }, - "json5": { - "version": "2.2.0", - "resolved": "https://registry.nlark.com/json5/download/json5-2.2.0.tgz?cache=0&sync_timestamp=1624607963605&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fjson5%2Fdownload%2Fjson5-2.2.0.tgz", - "integrity": "sha1-Lf7+cgxrpSXZ69kJlQ8FFTFsiaM=", - "requires": { - "minimist": "^1.2.5" - } - }, - "jsonfile": { - "version": "4.0.0", - "resolved": "https://registry.nlark.com/jsonfile/download/jsonfile-4.0.0.tgz", - "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=", - "requires": { - "graceful-fs": "^4.1.6" - } - }, - "kind-of": { - "version": "6.0.3", - "resolved": "https://registry.nlark.com/kind-of/download/kind-of-6.0.3.tgz", - "integrity": "sha1-B8BQNKbDSfoG4k+jWqdttFgM5N0=" - }, - "levn": { - "version": "0.4.1", - "resolved": "https://registry.nlark.com/levn/download/levn-0.4.1.tgz", - "integrity": "sha1-rkViwAdHO5MqYgDUAyaN0v/8at4=", - "dev": true, - "requires": { - "prelude-ls": "^1.2.1", - "type-check": "~0.4.0" - } - }, - "loader-runner": { - "version": "4.2.0", - "resolved": "https://registry.nlark.com/loader-runner/download/loader-runner-4.2.0.tgz", - "integrity": "sha1-1wIjgNZtFMX7HUlriYZOvP1Hg4Q=" - }, - "loader-utils": { - "version": "2.0.0", - "resolved": "https://registry.nlark.com/loader-utils/download/loader-utils-2.0.0.tgz?cache=0&sync_timestamp=1624607974187&other_urls=https%3A%2F%2Fregistry.nlark.com%2Floader-utils%2Fdownload%2Floader-utils-2.0.0.tgz", - "integrity": "sha1-5MrOW4FtQloWa18JfhDNErNgZLA=", - "requires": { - "big.js": "^5.2.2", - "emojis-list": "^3.0.0", - "json5": "^2.1.2" - } - }, - "locate-path": { - "version": "5.0.0", - "resolved": "https://registry.nlark.com/locate-path/download/locate-path-5.0.0.tgz", - "integrity": "sha1-Gvujlq/WdqbUJQTQpno6frn2KqA=", - "requires": { - "p-locate": "^4.1.0" - } - }, - "lodash.clonedeep": { - "version": "4.5.0", - "resolved": "https://registry.nlark.com/lodash.clonedeep/download/lodash.clonedeep-4.5.0.tgz", - "integrity": "sha1-4j8/nE+Pvd6HJSnBBxhXoIblzO8=", - "dev": true - }, - "lodash.debounce": { - "version": "4.0.8", - "resolved": "https://registry.nlark.com/lodash.debounce/download/lodash.debounce-4.0.8.tgz", - "integrity": "sha1-gteb/zCmfEAF/9XiUVMArZyk168=", - "dev": true - }, - "lodash.merge": { - "version": "4.6.2", - "resolved": "https://registry.nlark.com/lodash.merge/download/lodash.merge-4.6.2.tgz", - "integrity": "sha1-VYqlO0O2YeGSWgr9+japoQhf5Xo=", - "dev": true - }, - "lodash.truncate": { - "version": "4.4.2", - "resolved": "https://registry.nlark.com/lodash.truncate/download/lodash.truncate-4.4.2.tgz", - "integrity": "sha1-WjUNoLERO4N+z//VgSy+WNbq4ZM=", - "dev": true - }, - "log-symbols": { - "version": "4.0.0", - "resolved": "https://registry.nlark.com/log-symbols/download/log-symbols-4.0.0.tgz", - "integrity": "sha1-abPMRtIPRI7M23XqH6cz2eghySA=", - "dev": true, - "requires": { - "chalk": "^4.0.0" - } - }, - "log4js": { - "version": "6.3.0", - "resolved": "https://registry.nlark.com/log4js/download/log4js-6.3.0.tgz", - "integrity": "sha1-EN+vu0NDUaPjAnegC5h5RG9xW8s=", - "requires": { - "date-format": "^3.0.0", - "debug": "^4.1.1", - "flatted": "^2.0.1", - "rfdc": "^1.1.4", - "streamroller": "^2.2.4" - } - }, - "lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.nlark.com/lru-cache/download/lru-cache-6.0.0.tgz", - "integrity": "sha1-bW/mVw69lqr5D8rR2vo7JWbbOpQ=", - "requires": { - "yallist": "^4.0.0" - } - }, - "make-dir": { - "version": "2.1.0", - "resolved": "https://registry.nlark.com/make-dir/download/make-dir-2.1.0.tgz", - "integrity": "sha1-XwMQ4YuL6JjMBwCSlaMK5B6R5vU=", - "dev": true, - "requires": { - "pify": "^4.0.1", - "semver": "^5.6.0" - }, - "dependencies": { - "semver": { - "version": "5.7.1", - "resolved": "https://registry.nlark.com/semver/download/semver-5.7.1.tgz?cache=0&sync_timestamp=1624607961409&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fsemver%2Fdownload%2Fsemver-5.7.1.tgz", - "integrity": "sha1-qVT5Ma66UI0we78Gnv8MAclhFvc=", - "dev": true - } - } - }, - "make-error": { - "version": "1.3.6", - "resolved": "https://registry.nlark.com/make-error/download/make-error-1.3.6.tgz", - "integrity": "sha1-LrLjfqm2fEiR9oShOUeZr0hM96I=", - "dev": true - }, - "map-cache": { - "version": "0.2.2", - "resolved": "https://registry.nlark.com/map-cache/download/map-cache-0.2.2.tgz", - "integrity": "sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8=", - "dev": true, - "optional": true - }, - "map-visit": { - "version": "1.0.0", - "resolved": "https://registry.nlark.com/map-visit/download/map-visit-1.0.0.tgz", - "integrity": "sha1-7Nyo8TFE5mDxtb1B8S80edmN+48=", - "dev": true, - "optional": true, - "requires": { - "object-visit": "^1.0.0" - } - }, - "memory-fs": { - "version": "0.5.0", - "resolved": "https://registry.nlark.com/memory-fs/download/memory-fs-0.5.0.tgz", - "integrity": "sha1-MkwBKIuIZSlm0WHbd4OHIIRajjw=", - "requires": { - "errno": "^0.1.3", - "readable-stream": "^2.0.1" - } - }, - "merge-stream": { - "version": "2.0.0", - "resolved": "https://registry.nlark.com/merge-stream/download/merge-stream-2.0.0.tgz", - "integrity": "sha1-UoI2KaFN0AyXcPtq1H3GMQ8sH2A=" - }, - "merge2": { - "version": "1.4.1", - "resolved": "https://registry.nlark.com/merge2/download/merge2-1.4.1.tgz", - "integrity": "sha1-Q2iJL4hekHRVpv19xVwMnUBJkK4=" - }, - "micromatch": { - "version": "4.0.4", - "resolved": "https://registry.nlark.com/micromatch/download/micromatch-4.0.4.tgz", - "integrity": "sha1-iW1Rnf6dsl/OlM63pQCRm/iB6/k=", - "requires": { - "braces": "^3.0.1", - "picomatch": "^2.2.3" - } - }, - "mime-db": { - "version": "1.49.0", - "resolved": "https://registry.nlark.com/mime-db/download/mime-db-1.49.0.tgz", - "integrity": "sha1-89/eYMmenPO8lwHWh3ePU3ABy+0=" - }, - "mime-types": { - "version": "2.1.32", - "resolved": "https://registry.nlark.com/mime-types/download/mime-types-2.1.32.tgz?cache=0&sync_timestamp=1627407652875&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fmime-types%2Fdownload%2Fmime-types-2.1.32.tgz", - "integrity": "sha1-HQDonn3n/gIAjbYQAdngKFJnD9U=", - "requires": { - "mime-db": "1.49.0" - } - }, - "mimic-fn": { - "version": "2.1.0", - "resolved": "https://registry.nlark.com/mimic-fn/download/mimic-fn-2.1.0.tgz", - "integrity": "sha1-ftLCzMyvhNP/y3pptXcR/CCDQBs=" - }, - "minimatch": { - "version": "3.0.4", - "resolved": "https://registry.nlark.com/minimatch/download/minimatch-3.0.4.tgz?cache=0&sync_timestamp=1624607996146&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fminimatch%2Fdownload%2Fminimatch-3.0.4.tgz", - "integrity": "sha1-UWbihkV/AzBgZL5Ul+jbsMPTIIM=", - "requires": { - "brace-expansion": "^1.1.7" - } - }, - "minimist": { - "version": "1.2.5", - "resolved": "https://registry.nlark.com/minimist/download/minimist-1.2.5.tgz?cache=0&sync_timestamp=1624607886507&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fminimist%2Fdownload%2Fminimist-1.2.5.tgz", - "integrity": "sha1-Z9ZgFLZqaoqqDAg8X9WN9OTpdgI=" - }, - "mixin-deep": { - "version": "1.3.2", - "resolved": "https://registry.nlark.com/mixin-deep/download/mixin-deep-1.3.2.tgz", - "integrity": "sha1-ESC0PcNZp4Xc5ltVuC4lfM9HlWY=", - "dev": true, - "optional": true, - "requires": { - "for-in": "^1.0.2", - "is-extendable": "^1.0.1" - }, - "dependencies": { - "is-extendable": { - "version": "1.0.1", - "resolved": "https://registry.nlark.com/is-extendable/download/is-extendable-1.0.1.tgz", - "integrity": "sha1-p0cPnkJnM9gb2B4RVSZOOjUHyrQ=", - "dev": true, - "optional": true, - "requires": { - "is-plain-object": "^2.0.4" - } - } - } - }, - "mocha": { - "version": "8.4.0", - "resolved": "https://registry.nlark.com/mocha/download/mocha-8.4.0.tgz", - "integrity": "sha1-Z3voi/FZgKPK4Dpz4QoPw5l/DP8=", - "dev": true, - "requires": { - "@ungap/promise-all-settled": "1.1.2", - "ansi-colors": "4.1.1", - "browser-stdout": "1.3.1", - "chokidar": "3.5.1", - "debug": "4.3.1", - "diff": "5.0.0", - "escape-string-regexp": "4.0.0", - "find-up": "5.0.0", - "glob": "7.1.6", - "growl": "1.10.5", - "he": "1.2.0", - "js-yaml": "4.0.0", - "log-symbols": "4.0.0", - "minimatch": "3.0.4", - "ms": "2.1.3", - "nanoid": "3.1.20", - "serialize-javascript": "5.0.1", - "strip-json-comments": "3.1.1", - "supports-color": "8.1.1", - "which": "2.0.2", - "wide-align": "1.1.3", - "workerpool": "6.1.0", - "yargs": "16.2.0", - "yargs-parser": "20.2.4", - "yargs-unparser": "2.0.0" - }, - "dependencies": { - "argparse": { - "version": "2.0.1", - "resolved": "https://registry.nlark.com/argparse/download/argparse-2.0.1.tgz", - "integrity": "sha1-JG9Q88p4oyQPbJl+ipvR6sSeSzg=", - "dev": true - }, - "binary-extensions": { - "version": "2.2.0", - "resolved": "https://registry.nlark.com/binary-extensions/download/binary-extensions-2.2.0.tgz", - "integrity": "sha1-dfUC7q+f/eQvyYgpZFvk6na9ni0=", - "dev": true - }, - "chokidar": { - "version": "3.5.1", - "resolved": "https://registry.nlark.com/chokidar/download/chokidar-3.5.1.tgz", - "integrity": "sha1-7pznu+vSt59J8wR5nVRo4x4U5oo=", - "dev": true, - "requires": { - "anymatch": "~3.1.1", - "braces": "~3.0.2", - "fsevents": "~2.3.1", - "glob-parent": "~5.1.0", - "is-binary-path": "~2.1.0", - "is-glob": "~4.0.1", - "normalize-path": "~3.0.0", - "readdirp": "~3.5.0" - } - }, - "debug": { - "version": "4.3.1", - "resolved": "https://registry.nlark.com/debug/download/debug-4.3.1.tgz?cache=0&sync_timestamp=1625374653719&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fdebug%2Fdownload%2Fdebug-4.3.1.tgz", - "integrity": "sha1-8NIpxQXgxtjEmsVT0bE9wYP2su4=", - "dev": true, - "requires": { - "ms": "2.1.2" - }, - "dependencies": { - "ms": { - "version": "2.1.2", - "resolved": "https://registry.nlark.com/ms/download/ms-2.1.2.tgz", - "integrity": "sha1-0J0fNXtEP0kzgqjrPM0YOHKuYAk=", - "dev": true - } - } - }, - "escape-string-regexp": { - "version": "4.0.0", - "resolved": "https://registry.nlark.com/escape-string-regexp/download/escape-string-regexp-4.0.0.tgz", - "integrity": "sha1-FLqDpdNz49MR5a/KKc9b+tllvzQ=", - "dev": true - }, - "find-up": { - "version": "5.0.0", - "resolved": "https://registry.nlark.com/find-up/download/find-up-5.0.0.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.nlark.com%2Ffind-up%2Fdownload%2Ffind-up-5.0.0.tgz", - "integrity": "sha1-TJKBnstwg1YeT0okCoa+UZj1Nvw=", - "dev": true, - "requires": { - "locate-path": "^6.0.0", - "path-exists": "^4.0.0" - } - }, - "glob": { - "version": "7.1.6", - "resolved": "https://registry.nlark.com/glob/download/glob-7.1.6.tgz", - "integrity": "sha1-FB8zuBp8JJLhJVlDB0gMRmeSeKY=", - "dev": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - }, - "is-binary-path": { - "version": "2.1.0", - "resolved": "https://registry.nlark.com/is-binary-path/download/is-binary-path-2.1.0.tgz", - "integrity": "sha1-6h9/O4DwZCNug0cPhsCcJU+0Wwk=", - "dev": true, - "requires": { - "binary-extensions": "^2.0.0" - } - }, - "js-yaml": { - "version": "4.0.0", - "resolved": "https://registry.nlark.com/js-yaml/download/js-yaml-4.0.0.tgz?cache=0&sync_timestamp=1624607946901&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fjs-yaml%2Fdownload%2Fjs-yaml-4.0.0.tgz", - "integrity": "sha1-9Ca8D/S0BRkmzViMcRExg0CaEh8=", - "dev": true, - "requires": { - "argparse": "^2.0.1" - } - }, - "locate-path": { - "version": "6.0.0", - "resolved": "https://registry.nlark.com/locate-path/download/locate-path-6.0.0.tgz", - "integrity": "sha1-VTIeswn+u8WcSAHZMackUqaB0oY=", - "dev": true, - "requires": { - "p-locate": "^5.0.0" - } - }, - "ms": { - "version": "2.1.3", - "resolved": "https://registry.nlark.com/ms/download/ms-2.1.3.tgz", - "integrity": "sha1-V0yBOM4dK1hh8LRFedut1gxmFbI=", - "dev": true - }, - "p-locate": { - "version": "5.0.0", - "resolved": "https://registry.nlark.com/p-locate/download/p-locate-5.0.0.tgz?cache=0&sync_timestamp=1629892708584&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fp-locate%2Fdownload%2Fp-locate-5.0.0.tgz", - "integrity": "sha1-g8gxXGeFAF470CGDlBHJ4RDm2DQ=", - "dev": true, - "requires": { - "p-limit": "^3.0.2" - } - }, - "readdirp": { - "version": "3.5.0", - "resolved": "https://registry.nlark.com/readdirp/download/readdirp-3.5.0.tgz", - "integrity": "sha1-m6dMAZsV02UnjS6Ru4xI17TULJ4=", - "dev": true, - "requires": { - "picomatch": "^2.2.1" - } - }, - "supports-color": { - "version": "8.1.1", - "resolved": "https://registry.nlark.com/supports-color/download/supports-color-8.1.1.tgz?cache=0&sync_timestamp=1626703455199&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fsupports-color%2Fdownload%2Fsupports-color-8.1.1.tgz", - "integrity": "sha1-zW/BfihQDP9WwbhsCn/UpUpzAFw=", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "ms": { - "version": "2.1.2", - "resolved": "https://registry.nlark.com/ms/download/ms-2.1.2.tgz", - "integrity": "sha1-0J0fNXtEP0kzgqjrPM0YOHKuYAk=" - }, - "nanoid": { - "version": "3.1.20", - "resolved": "https://registry.nlark.com/nanoid/download/nanoid-3.1.20.tgz", - "integrity": "sha1-utwmPGsdzxS3HvqoX2q0wdbPx4g=", - "dev": true - }, - "nanomatch": { - "version": "1.2.13", - "resolved": "https://registry.nlark.com/nanomatch/download/nanomatch-1.2.13.tgz", - "integrity": "sha1-uHqKpPwN6P5r6IiVs4mD/yZb0Rk=", - "dev": true, - "optional": true, - "requires": { - "arr-diff": "^4.0.0", - "array-unique": "^0.3.2", - "define-property": "^2.0.2", - "extend-shallow": "^3.0.2", - "fragment-cache": "^0.2.1", - "is-windows": "^1.0.2", - "kind-of": "^6.0.2", - "object.pick": "^1.3.0", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.1" - } - }, - "natural-compare": { - "version": "1.4.0", - "resolved": "https://registry.nlark.com/natural-compare/download/natural-compare-1.4.0.tgz?cache=0&sync_timestamp=1624608011507&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fnatural-compare%2Fdownload%2Fnatural-compare-1.4.0.tgz", - "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", - "dev": true - }, - "neo-async": { - "version": "2.6.2", - "resolved": "https://registry.nlark.com/neo-async/download/neo-async-2.6.2.tgz", - "integrity": "sha1-tKr7k+OustgXTKU88WOrfXMIMF8=" - }, - "node-releases": { - "version": "1.1.75", - "resolved": "https://registry.nlark.com/node-releases/download/node-releases-1.1.75.tgz?cache=0&sync_timestamp=1629280320667&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fnode-releases%2Fdownload%2Fnode-releases-1.1.75.tgz", - "integrity": "sha1-bdjIdrmJehuOWgLeJq+nm7VOu/4=" - }, - "normalize-path": { - "version": "3.0.0", - "resolved": "https://registry.nlark.com/normalize-path/download/normalize-path-3.0.0.tgz", - "integrity": "sha1-Dc1p/yOhybEf0JeDFmRKA4ghamU=" - }, - "npm-run-path": { - "version": "4.0.1", - "resolved": "https://registry.nlark.com/npm-run-path/download/npm-run-path-4.0.1.tgz", - "integrity": "sha1-t+zR5e1T2o43pV4cImnguX7XSOo=", - "requires": { - "path-key": "^3.0.0" - } - }, - "object-assign": { - "version": "4.1.1", - "resolved": "https://registry.nlark.com/object-assign/download/object-assign-4.1.1.tgz", - "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" - }, - "object-copy": { - "version": "0.1.0", - "resolved": "https://registry.nlark.com/object-copy/download/object-copy-0.1.0.tgz", - "integrity": "sha1-fn2Fi3gb18mRpBupde04EnVOmYw=", - "dev": true, - "optional": true, - "requires": { - "copy-descriptor": "^0.1.0", - "define-property": "^0.2.5", - "kind-of": "^3.0.3" - }, - "dependencies": { - "define-property": { - "version": "0.2.5", - "resolved": "https://registry.nlark.com/define-property/download/define-property-0.2.5.tgz", - "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", - "dev": true, - "optional": true, - "requires": { - "is-descriptor": "^0.1.0" - } - }, - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.nlark.com/kind-of/download/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "optional": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "object-keys": { - "version": "1.1.1", - "resolved": "https://registry.nlark.com/object-keys/download/object-keys-1.1.1.tgz", - "integrity": "sha1-HEfyct8nfzsdrwYWd9nILiMixg4=", - "dev": true - }, - "object-visit": { - "version": "1.0.1", - "resolved": "https://registry.nlark.com/object-visit/download/object-visit-1.0.1.tgz", - "integrity": "sha1-95xEk68MU3e1n+OdOV5BBC3QRbs=", - "dev": true, - "optional": true, - "requires": { - "isobject": "^3.0.0" - } - }, - "object.assign": { - "version": "4.1.2", - "resolved": "https://registry.nlark.com/object.assign/download/object.assign-4.1.2.tgz", - "integrity": "sha1-DtVKNC7Os3s4/3brgxoOeIy2OUA=", - "dev": true, - "requires": { - "call-bind": "^1.0.0", - "define-properties": "^1.1.3", - "has-symbols": "^1.0.1", - "object-keys": "^1.1.1" - } - }, - "object.pick": { - "version": "1.3.0", - "resolved": "https://registry.nlark.com/object.pick/download/object.pick-1.3.0.tgz", - "integrity": "sha1-h6EKxMFpS9Lhy/U1kaZhQftd10c=", - "dev": true, - "optional": true, - "requires": { - "isobject": "^3.0.1" - } - }, - "once": { - "version": "1.4.0", - "resolved": "https://registry.nlark.com/once/download/once-1.4.0.tgz", - "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", - "requires": { - "wrappy": "1" - } - }, - "onetime": { - "version": "5.1.2", - "resolved": "https://registry.nlark.com/onetime/download/onetime-5.1.2.tgz", - "integrity": "sha1-0Oluu1awdHbfHdnEgG5SN5hcpF4=", - "requires": { - "mimic-fn": "^2.1.0" - } - }, - "optionator": { - "version": "0.9.1", - "resolved": "https://registry.nlark.com/optionator/download/optionator-0.9.1.tgz", - "integrity": "sha1-TyNqY3Pa4FZqbUPhMmZ09QwpFJk=", - "dev": true, - "requires": { - "deep-is": "^0.1.3", - "fast-levenshtein": "^2.0.6", - "levn": "^0.4.1", - "prelude-ls": "^1.2.1", - "type-check": "^0.4.0", - "word-wrap": "^1.2.3" - } - }, - "p-limit": { - "version": "3.1.0", - "resolved": "https://registry.nlark.com/p-limit/download/p-limit-3.1.0.tgz?cache=0&sync_timestamp=1628813055527&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fp-limit%2Fdownload%2Fp-limit-3.1.0.tgz", - "integrity": "sha1-4drMvnjQ0TiMoYxk/qOOPlfjcGs=", - "requires": { - "yocto-queue": "^0.1.0" - } - }, - "p-locate": { - "version": "4.1.0", - "resolved": "https://registry.nlark.com/p-locate/download/p-locate-4.1.0.tgz?cache=0&sync_timestamp=1629892708584&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fp-locate%2Fdownload%2Fp-locate-4.1.0.tgz", - "integrity": "sha1-o0KLtwiLOmApL2aRkni3wpetTwc=", - "requires": { - "p-limit": "^2.2.0" - }, - "dependencies": { - "p-limit": { - "version": "2.3.0", - "resolved": "https://registry.nlark.com/p-limit/download/p-limit-2.3.0.tgz?cache=0&sync_timestamp=1628813055527&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fp-limit%2Fdownload%2Fp-limit-2.3.0.tgz", - "integrity": "sha1-PdM8ZHohT9//2DWTPrCG2g3CHbE=", - "requires": { - "p-try": "^2.0.0" - } - } - } - }, - "p-map": { - "version": "2.1.0", - "resolved": "https://registry.nlark.com/p-map/download/p-map-2.1.0.tgz?cache=0&sync_timestamp=1627082442645&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fp-map%2Fdownload%2Fp-map-2.1.0.tgz", - "integrity": "sha1-MQko/u+cnsxltosXaTAYpmXOoXU=" - }, - "p-try": { - "version": "2.2.0", - "resolved": "https://registry.nlark.com/p-try/download/p-try-2.2.0.tgz", - "integrity": "sha1-yyhoVA4xPWHeWPr741zpAE1VQOY=" - }, - "parent-module": { - "version": "1.0.1", - "resolved": "https://registry.nlark.com/parent-module/download/parent-module-1.0.1.tgz", - "integrity": "sha1-aR0nCeeMefrjoVZiJFLQB2LKqqI=", - "dev": true, - "requires": { - "callsites": "^3.0.0" - } - }, - "pascalcase": { - "version": "0.1.1", - "resolved": "https://registry.nlark.com/pascalcase/download/pascalcase-0.1.1.tgz", - "integrity": "sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ=", - "dev": true, - "optional": true - }, - "path-exists": { - "version": "4.0.0", - "resolved": "https://registry.nlark.com/path-exists/download/path-exists-4.0.0.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fpath-exists%2Fdownload%2Fpath-exists-4.0.0.tgz", - "integrity": "sha1-UTvb4tO5XXdi6METfvoZXGxhtbM=" - }, - "path-is-absolute": { - "version": "1.0.1", - "resolved": "https://registry.nlark.com/path-is-absolute/download/path-is-absolute-1.0.1.tgz", - "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" - }, - "path-is-inside": { - "version": "1.0.2", - "resolved": "https://registry.nlark.com/path-is-inside/download/path-is-inside-1.0.2.tgz", - "integrity": "sha1-NlQX3t5EQw0cEa9hAn+s8HS9/FM=" - }, - "path-key": { - "version": "3.1.1", - "resolved": "https://registry.nlark.com/path-key/download/path-key-3.1.1.tgz", - "integrity": "sha1-WB9q3mWMu6ZaDTOA3ndTKVBU83U=" - }, - "path-parse": { - "version": "1.0.7", - "resolved": "https://registry.nlark.com/path-parse/download/path-parse-1.0.7.tgz", - "integrity": "sha1-+8EUtgykKzDZ2vWFjkvWi77bZzU=" - }, - "path-type": { - "version": "4.0.0", - "resolved": "https://registry.nlark.com/path-type/download/path-type-4.0.0.tgz", - "integrity": "sha1-hO0BwKe6OAr+CdkKjBgNzZ0DBDs=" - }, - "pathval": { - "version": "1.1.1", - "resolved": "https://registry.nlark.com/pathval/download/pathval-1.1.1.tgz", - "integrity": "sha1-hTTnenfOesWiUS6iHg/bj89sPY0=", - "dev": true - }, - "pegjs": { - "version": "0.10.0", - "resolved": "https://registry.npm.taobao.org/pegjs/download/pegjs-0.10.0.tgz", - "integrity": "sha1-z4uvrm7d/0tafvsYUmnqr0YQ3b0=" - }, - "picomatch": { - "version": "2.3.0", - "resolved": "https://registry.nlark.com/picomatch/download/picomatch-2.3.0.tgz", - "integrity": "sha1-8fBh3o9qS/AiiS4tEoI0+5gwKXI=" - }, - "pify": { - "version": "4.0.1", - "resolved": "https://registry.nlark.com/pify/download/pify-4.0.1.tgz", - "integrity": "sha1-SyzSXFDVmHNcUCkiJP2MbfQeMjE=" - }, - "pinkie": { - "version": "2.0.4", - "resolved": "https://registry.nlark.com/pinkie/download/pinkie-2.0.4.tgz", - "integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=" - }, - "pinkie-promise": { - "version": "2.0.1", - "resolved": "https://registry.nlark.com/pinkie-promise/download/pinkie-promise-2.0.1.tgz", - "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=", - "requires": { - "pinkie": "^2.0.0" - } - }, - "pkg-dir": { - "version": "4.2.0", - "resolved": "https://registry.nlark.com/pkg-dir/download/pkg-dir-4.2.0.tgz?cache=0&sync_timestamp=1624607963968&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fpkg-dir%2Fdownload%2Fpkg-dir-4.2.0.tgz", - "integrity": "sha1-8JkTPfft5CLoHR2ESCcO6z5CYfM=", - "requires": { - "find-up": "^4.0.0" - } - }, - "posix-character-classes": { - "version": "0.1.1", - "resolved": "https://registry.nlark.com/posix-character-classes/download/posix-character-classes-0.1.1.tgz", - "integrity": "sha1-AerA/jta9xoqbAL+q7jB/vfgDqs=", - "dev": true, - "optional": true - }, - "prelude-ls": { - "version": "1.2.1", - "resolved": "https://registry.nlark.com/prelude-ls/download/prelude-ls-1.2.1.tgz", - "integrity": "sha1-3rxkidem5rDnYRiIzsiAM30xY5Y=", - "dev": true - }, - "process-nextick-args": { - "version": "2.0.1", - "resolved": "https://registry.nlark.com/process-nextick-args/download/process-nextick-args-2.0.1.tgz", - "integrity": "sha1-eCDZsWEgzFXKmud5JoCufbptf+I=" - }, - "progress": { - "version": "2.0.3", - "resolved": "https://registry.nlark.com/progress/download/progress-2.0.3.tgz?cache=0&sync_timestamp=1624607996383&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fprogress%2Fdownload%2Fprogress-2.0.3.tgz", - "integrity": "sha1-foz42PW48jnBvGi+tOt4Vn1XLvg=", - "dev": true - }, - "prr": { - "version": "1.0.1", - "resolved": "https://registry.nlark.com/prr/download/prr-1.0.1.tgz", - "integrity": "sha1-0/wRS6BplaRexok/SEzrHXj19HY=" - }, - "punycode": { - "version": "2.1.1", - "resolved": "https://registry.nlark.com/punycode/download/punycode-2.1.1.tgz", - "integrity": "sha1-tYsBCsQMIsVldhbI0sLALHv0eew=" - }, - "queue-microtask": { - "version": "1.2.3", - "resolved": "https://registry.nlark.com/queue-microtask/download/queue-microtask-1.2.3.tgz", - "integrity": "sha1-SSkii7xyTfrEPg77BYyve2z7YkM=" - }, - "randombytes": { - "version": "2.1.0", - "resolved": "https://registry.nlark.com/randombytes/download/randombytes-2.1.0.tgz", - "integrity": "sha1-32+ENy8CcNxlzfYpE0mrekc9Tyo=", - "requires": { - "safe-buffer": "^5.1.0" - } - }, - "readable-stream": { - "version": "2.3.7", - "resolved": "https://registry.nlark.com/readable-stream/download/readable-stream-2.3.7.tgz", - "integrity": "sha1-Hsoc9xGu+BTAT2IlKjamL2yyO1c=", - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - }, - "dependencies": { - "safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.nlark.com/safe-buffer/download/safe-buffer-5.1.2.tgz", - "integrity": "sha1-mR7GnSluAxN0fVm9/St0XDX4go0=" - } - } - }, - "readdirp": { - "version": "2.2.1", - "resolved": "https://registry.nlark.com/readdirp/download/readdirp-2.2.1.tgz", - "integrity": "sha1-DodiKjMlqjPokihcr4tOhGUppSU=", - "dev": true, - "optional": true, - "requires": { - "graceful-fs": "^4.1.11", - "micromatch": "^3.1.10", - "readable-stream": "^2.0.2" - }, - "dependencies": { - "braces": { - "version": "2.3.2", - "resolved": "https://registry.nlark.com/braces/download/braces-2.3.2.tgz", - "integrity": "sha1-WXn9PxTNUxVl5fot8av/8d+u5yk=", - "dev": true, - "optional": true, - "requires": { - "arr-flatten": "^1.1.0", - "array-unique": "^0.3.2", - "extend-shallow": "^2.0.1", - "fill-range": "^4.0.0", - "isobject": "^3.0.1", - "repeat-element": "^1.1.2", - "snapdragon": "^0.8.1", - "snapdragon-node": "^2.0.1", - "split-string": "^3.0.2", - "to-regex": "^3.0.1" - }, - "dependencies": { - "extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.nlark.com/extend-shallow/download/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", - "dev": true, - "optional": true, - "requires": { - "is-extendable": "^0.1.0" - } - } - } - }, - "fill-range": { - "version": "4.0.0", - "resolved": "https://registry.nlark.com/fill-range/download/fill-range-4.0.0.tgz", - "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=", - "dev": true, - "optional": true, - "requires": { - "extend-shallow": "^2.0.1", - "is-number": "^3.0.0", - "repeat-string": "^1.6.1", - "to-regex-range": "^2.1.0" - }, - "dependencies": { - "extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.nlark.com/extend-shallow/download/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", - "dev": true, - "optional": true, - "requires": { - "is-extendable": "^0.1.0" - } - } - } - }, - "is-number": { - "version": "3.0.0", - "resolved": "https://registry.nlark.com/is-number/download/is-number-3.0.0.tgz", - "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", - "dev": true, - "optional": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.nlark.com/kind-of/download/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "optional": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "micromatch": { - "version": "3.1.10", - "resolved": "https://registry.nlark.com/micromatch/download/micromatch-3.1.10.tgz", - "integrity": "sha1-cIWbyVyYQJUvNZoGij/En57PrCM=", - "dev": true, - "optional": true, - "requires": { - "arr-diff": "^4.0.0", - "array-unique": "^0.3.2", - "braces": "^2.3.1", - "define-property": "^2.0.2", - "extend-shallow": "^3.0.2", - "extglob": "^2.0.4", - "fragment-cache": "^0.2.1", - "kind-of": "^6.0.2", - "nanomatch": "^1.2.9", - "object.pick": "^1.3.0", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.2" - } - }, - "to-regex-range": { - "version": "2.1.1", - "resolved": "https://registry.nlark.com/to-regex-range/download/to-regex-range-2.1.1.tgz", - "integrity": "sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg=", - "dev": true, - "optional": true, - "requires": { - "is-number": "^3.0.0", - "repeat-string": "^1.6.1" - } - } - } - }, - "rechoir": { - "version": "0.7.1", - "resolved": "https://registry.nlark.com/rechoir/download/rechoir-0.7.1.tgz", - "integrity": "sha1-lHipahyhNbXoj8An8D7pLWxkVoY=", - "requires": { - "resolve": "^1.9.0" - } - }, - "regenerate": { - "version": "1.4.2", - "resolved": "https://registry.nlark.com/regenerate/download/regenerate-1.4.2.tgz", - "integrity": "sha1-uTRtiCfo9aMve6KWN9OYtpAUhIo=", - "dev": true - }, - "regenerate-unicode-properties": { - "version": "8.2.0", - "resolved": "https://registry.nlark.com/regenerate-unicode-properties/download/regenerate-unicode-properties-8.2.0.tgz", - "integrity": "sha1-5d5xEdZV57pgwFfb6f83yH5lzew=", - "dev": true, - "requires": { - "regenerate": "^1.4.0" - } - }, - "regenerator-runtime": { - "version": "0.13.9", - "resolved": "https://registry.nlark.com/regenerator-runtime/download/regenerator-runtime-0.13.9.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fregenerator-runtime%2Fdownload%2Fregenerator-runtime-0.13.9.tgz", - "integrity": "sha1-iSV0Kpj/2QgUmI11Zq0wyjsmO1I=", - "dev": true - }, - "regenerator-transform": { - "version": "0.14.5", - "resolved": "https://registry.nlark.com/regenerator-transform/download/regenerator-transform-0.14.5.tgz?cache=0&sync_timestamp=1627057533376&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fregenerator-transform%2Fdownload%2Fregenerator-transform-0.14.5.tgz", - "integrity": "sha1-yY2hVGg2ccnE3LFuznNlF+G3/rQ=", - "dev": true, - "requires": { - "@babel/runtime": "^7.8.4" - } - }, - "regex-not": { - "version": "1.0.2", - "resolved": "https://registry.nlark.com/regex-not/download/regex-not-1.0.2.tgz", - "integrity": "sha1-H07OJ+ALC2XgJHpoEOaoXYOldSw=", - "dev": true, - "optional": true, - "requires": { - "extend-shallow": "^3.0.2", - "safe-regex": "^1.1.0" - } - }, - "regexpp": { - "version": "3.2.0", - "resolved": "https://registry.nlark.com/regexpp/download/regexpp-3.2.0.tgz", - "integrity": "sha1-BCWido2PI7rXDKS5BGH6LxIT4bI=", - "dev": true - }, - "regexpu-core": { - "version": "4.7.1", - "resolved": "https://registry.nlark.com/regexpu-core/download/regexpu-core-4.7.1.tgz", - "integrity": "sha1-LepamgcjMpj78NuR+pq8TG4PitY=", - "dev": true, - "requires": { - "regenerate": "^1.4.0", - "regenerate-unicode-properties": "^8.2.0", - "regjsgen": "^0.5.1", - "regjsparser": "^0.6.4", - "unicode-match-property-ecmascript": "^1.0.4", - "unicode-match-property-value-ecmascript": "^1.2.0" - } - }, - "regjsgen": { - "version": "0.5.2", - "resolved": "https://registry.nlark.com/regjsgen/download/regjsgen-0.5.2.tgz", - "integrity": "sha1-kv8pX7He7L9uzaslQ9IH6RqjNzM=", - "dev": true - }, - "regjsparser": { - "version": "0.6.9", - "resolved": "https://registry.nlark.com/regjsparser/download/regjsparser-0.6.9.tgz", - "integrity": "sha1-tInu98mizkNydicBFCnPgzpxg+Y=", - "dev": true, - "requires": { - "jsesc": "~0.5.0" - }, - "dependencies": { - "jsesc": { - "version": "0.5.0", - "resolved": "https://registry.nlark.com/jsesc/download/jsesc-0.5.0.tgz", - "integrity": "sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0=", - "dev": true - } - } - }, - "remove-trailing-separator": { - "version": "1.1.0", - "resolved": "https://registry.nlark.com/remove-trailing-separator/download/remove-trailing-separator-1.1.0.tgz", - "integrity": "sha1-wkvOKig62tW8P1jg1IJJuSN52O8=", - "dev": true, - "optional": true - }, - "repeat-element": { - "version": "1.1.4", - "resolved": "https://registry.nlark.com/repeat-element/download/repeat-element-1.1.4.tgz", - "integrity": "sha1-vmgVIIR6tYx1aKx1+/rSjtQtOek=", - "dev": true, - "optional": true - }, - "repeat-string": { - "version": "1.6.1", - "resolved": "https://registry.nlark.com/repeat-string/download/repeat-string-1.6.1.tgz", - "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=", - "dev": true, - "optional": true - }, - "require-directory": { - "version": "2.1.1", - "resolved": "https://registry.nlark.com/require-directory/download/require-directory-2.1.1.tgz", - "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", - "dev": true - }, - "require-from-string": { - "version": "2.0.2", - "resolved": "https://registry.nlark.com/require-from-string/download/require-from-string-2.0.2.tgz", - "integrity": "sha1-iaf92TgmEmcxjq/hT5wy5ZjDaQk=", - "dev": true - }, - "resolve": { - "version": "1.20.0", - "resolved": "https://registry.nlark.com/resolve/download/resolve-1.20.0.tgz", - "integrity": "sha1-YpoBP7P3B1XW8LeTXMHCxTeLGXU=", - "requires": { - "is-core-module": "^2.2.0", - "path-parse": "^1.0.6" - } - }, - "resolve-cwd": { - "version": "3.0.0", - "resolved": "https://registry.nlark.com/resolve-cwd/download/resolve-cwd-3.0.0.tgz", - "integrity": "sha1-DwB18bslRHZs9zumpuKt/ryxPy0=", - "requires": { - "resolve-from": "^5.0.0" - } - }, - "resolve-from": { - "version": "5.0.0", - "resolved": "https://registry.nlark.com/resolve-from/download/resolve-from-5.0.0.tgz?cache=0&sync_timestamp=1624607952279&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fresolve-from%2Fdownload%2Fresolve-from-5.0.0.tgz", - "integrity": "sha1-w1IlhD3493bfIcV1V7wIfp39/Gk=" - }, - "resolve-url": { - "version": "0.2.1", - "resolved": "https://registry.nlark.com/resolve-url/download/resolve-url-0.2.1.tgz", - "integrity": "sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo=", - "dev": true, - "optional": true - }, - "ret": { - "version": "0.1.15", - "resolved": "https://registry.nlark.com/ret/download/ret-0.1.15.tgz", - "integrity": "sha1-uKSCXVvbH8P29Twrwz+BOIaBx7w=", - "dev": true, - "optional": true - }, - "reusify": { - "version": "1.0.4", - "resolved": "https://registry.nlark.com/reusify/download/reusify-1.0.4.tgz", - "integrity": "sha1-kNo4Kx4SbvwCFG6QhFqI2xKSXXY=" - }, - "rfdc": { - "version": "1.3.0", - "resolved": "https://registry.nlark.com/rfdc/download/rfdc-1.3.0.tgz", - "integrity": "sha1-0LfEQasnINBdxM8m4ByJYx2doIs=" - }, - "rimraf": { - "version": "2.7.1", - "resolved": "https://registry.nlark.com/rimraf/download/rimraf-2.7.1.tgz", - "integrity": "sha1-NXl/E6f9rcVmFCwp1PB8ytSD4+w=", - "requires": { - "glob": "^7.1.3" - } - }, - "run-parallel": { - "version": "1.2.0", - "resolved": "https://registry.nlark.com/run-parallel/download/run-parallel-1.2.0.tgz", - "integrity": "sha1-ZtE2jae9+SHrnZW9GpIp5/IaQ+4=", - "requires": { - "queue-microtask": "^1.2.2" - } - }, - "safe-buffer": { - "version": "5.2.1", - "resolved": "https://registry.nlark.com/safe-buffer/download/safe-buffer-5.2.1.tgz", - "integrity": "sha1-Hq+fqb2x/dTsdfWPnNtOa3gn7sY=" - }, - "safe-regex": { - "version": "1.1.0", - "resolved": "https://registry.nlark.com/safe-regex/download/safe-regex-1.1.0.tgz", - "integrity": "sha1-QKNmnzsHfR6UPURinhV91IAjvy4=", - "dev": true, - "optional": true, - "requires": { - "ret": "~0.1.10" - } - }, - "schema-utils": { - "version": "3.1.1", - "resolved": "https://registry.nlark.com/schema-utils/download/schema-utils-3.1.1.tgz?cache=0&sync_timestamp=1626694902084&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fschema-utils%2Fdownload%2Fschema-utils-3.1.1.tgz", - "integrity": "sha1-vHTEtraZXB2I92qLd76nIZ4MgoE=", - "requires": { - "@types/json-schema": "^7.0.8", - "ajv": "^6.12.5", - "ajv-keywords": "^3.5.2" - } - }, - "semver": { - "version": "7.3.5", - "resolved": "https://registry.nlark.com/semver/download/semver-7.3.5.tgz?cache=0&sync_timestamp=1624607961409&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fsemver%2Fdownload%2Fsemver-7.3.5.tgz", - "integrity": "sha1-C2Ich5NI2JmOSw5L6Us/EuYBjvc=", - "requires": { - "lru-cache": "^6.0.0" - } - }, - "serialize-javascript": { - "version": "5.0.1", - "resolved": "https://registry.nlark.com/serialize-javascript/download/serialize-javascript-5.0.1.tgz?cache=0&sync_timestamp=1624608021459&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fserialize-javascript%2Fdownload%2Fserialize-javascript-5.0.1.tgz", - "integrity": "sha1-eIbshIBJpGJGepfT2Rjrsqr5NPQ=", - "requires": { - "randombytes": "^2.1.0" - } - }, - "set-value": { - "version": "2.0.1", - "resolved": "https://registry.nlark.com/set-value/download/set-value-2.0.1.tgz", - "integrity": "sha1-oY1AUw5vB95CKMfe/kInr4ytAFs=", - "dev": true, - "optional": true, - "requires": { - "extend-shallow": "^2.0.1", - "is-extendable": "^0.1.1", - "is-plain-object": "^2.0.3", - "split-string": "^3.0.1" - }, - "dependencies": { - "extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.nlark.com/extend-shallow/download/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", - "dev": true, - "optional": true, - "requires": { - "is-extendable": "^0.1.0" - } - } - } - }, - "shallow-clone": { - "version": "3.0.1", - "resolved": "https://registry.nlark.com/shallow-clone/download/shallow-clone-3.0.1.tgz", - "integrity": "sha1-jymBrZJTH1UDWwH7IwdppA4C76M=", - "requires": { - "kind-of": "^6.0.2" - } - }, - "shebang-command": { - "version": "2.0.0", - "resolved": "https://registry.nlark.com/shebang-command/download/shebang-command-2.0.0.tgz", - "integrity": "sha1-zNCvT4g1+9wmW4JGGq8MNmY/NOo=", - "requires": { - "shebang-regex": "^3.0.0" - } - }, - "shebang-regex": { - "version": "3.0.0", - "resolved": "https://registry.nlark.com/shebang-regex/download/shebang-regex-3.0.0.tgz?cache=0&sync_timestamp=1628896660639&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fshebang-regex%2Fdownload%2Fshebang-regex-3.0.0.tgz", - "integrity": "sha1-rhbxZE2HPsrYQ7AwexQzYtTEIXI=" - }, - "signal-exit": { - "version": "3.0.3", - "resolved": "https://registry.nlark.com/signal-exit/download/signal-exit-3.0.3.tgz", - "integrity": "sha1-oUEMLt2PB3sItOJTyOrPyvBXRhw=" - }, - "slash": { - "version": "3.0.0", - "resolved": "https://registry.nlark.com/slash/download/slash-3.0.0.tgz", - "integrity": "sha1-ZTm+hwwWWtvVJAIg2+Nh8bxNRjQ=" - }, - "slice-ansi": { - "version": "4.0.0", - "resolved": "https://registry.nlark.com/slice-ansi/download/slice-ansi-4.0.0.tgz", - "integrity": "sha1-UA6N0P1VsFgVCGJVsxla3ypF/ms=", - "dev": true, - "requires": { - "ansi-styles": "^4.0.0", - "astral-regex": "^2.0.0", - "is-fullwidth-code-point": "^3.0.0" - } - }, - "snapdragon": { - "version": "0.8.2", - "resolved": "https://registry.nlark.com/snapdragon/download/snapdragon-0.8.2.tgz", - "integrity": "sha1-ZJIufFZbDhQgS6GqfWlkJ40lGC0=", - "dev": true, - "optional": true, - "requires": { - "base": "^0.11.1", - "debug": "^2.2.0", - "define-property": "^0.2.5", - "extend-shallow": "^2.0.1", - "map-cache": "^0.2.2", - "source-map": "^0.5.6", - "source-map-resolve": "^0.5.0", - "use": "^3.1.0" - }, - "dependencies": { - "debug": { - "version": "2.6.9", - "resolved": "https://registry.nlark.com/debug/download/debug-2.6.9.tgz?cache=0&sync_timestamp=1625374653719&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fdebug%2Fdownload%2Fdebug-2.6.9.tgz", - "integrity": "sha1-XRKFFd8TT/Mn6QpMk/Tgd6U2NB8=", - "dev": true, - "optional": true, - "requires": { - "ms": "2.0.0" - } - }, - "define-property": { - "version": "0.2.5", - "resolved": "https://registry.nlark.com/define-property/download/define-property-0.2.5.tgz", - "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", - "dev": true, - "optional": true, - "requires": { - "is-descriptor": "^0.1.0" - } - }, - "extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.nlark.com/extend-shallow/download/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", - "dev": true, - "optional": true, - "requires": { - "is-extendable": "^0.1.0" - } - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.nlark.com/ms/download/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true, - "optional": true - }, - "source-map": { - "version": "0.5.7", - "resolved": "https://registry.nlark.com/source-map/download/source-map-0.5.7.tgz?cache=0&sync_timestamp=1624608014898&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fsource-map%2Fdownload%2Fsource-map-0.5.7.tgz", - "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", - "dev": true, - "optional": true - } - } - }, - "snapdragon-node": { - "version": "2.1.1", - "resolved": "https://registry.nlark.com/snapdragon-node/download/snapdragon-node-2.1.1.tgz", - "integrity": "sha1-bBdfhv8UvbByRWPo88GwIaKGhTs=", - "dev": true, - "optional": true, - "requires": { - "define-property": "^1.0.0", - "isobject": "^3.0.0", - "snapdragon-util": "^3.0.1" - }, - "dependencies": { - "define-property": { - "version": "1.0.0", - "resolved": "https://registry.nlark.com/define-property/download/define-property-1.0.0.tgz", - "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", - "dev": true, - "optional": true, - "requires": { - "is-descriptor": "^1.0.0" - } - }, - "is-accessor-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.nlark.com/is-accessor-descriptor/download/is-accessor-descriptor-1.0.0.tgz", - "integrity": "sha1-FpwvbT3x+ZJhgHI2XJsOofaHhlY=", - "dev": true, - "optional": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-data-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.nlark.com/is-data-descriptor/download/is-data-descriptor-1.0.0.tgz", - "integrity": "sha1-2Eh2Mh0Oet0DmQQGq7u9NrqSaMc=", - "dev": true, - "optional": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-descriptor": { - "version": "1.0.2", - "resolved": "https://registry.nlark.com/is-descriptor/download/is-descriptor-1.0.2.tgz", - "integrity": "sha1-OxWXRqZmBLBPjIFSS6NlxfFNhuw=", - "dev": true, - "optional": true, - "requires": { - "is-accessor-descriptor": "^1.0.0", - "is-data-descriptor": "^1.0.0", - "kind-of": "^6.0.2" - } - } - } - }, - "snapdragon-util": { - "version": "3.0.1", - "resolved": "https://registry.nlark.com/snapdragon-util/download/snapdragon-util-3.0.1.tgz", - "integrity": "sha1-+VZHlIbyrNeXAGk/b3uAXkWrVuI=", - "dev": true, - "optional": true, - "requires": { - "kind-of": "^3.2.0" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.nlark.com/kind-of/download/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "optional": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "source-map": { - "version": "0.6.1", - "resolved": "https://registry.nlark.com/source-map/download/source-map-0.6.1.tgz?cache=0&sync_timestamp=1624608014898&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fsource-map%2Fdownload%2Fsource-map-0.6.1.tgz", - "integrity": "sha1-dHIq8y6WFOnCh6jQu95IteLxomM=" - }, - "source-map-resolve": { - "version": "0.5.3", - "resolved": "https://registry.nlark.com/source-map-resolve/download/source-map-resolve-0.5.3.tgz", - "integrity": "sha1-GQhmvs51U+H48mei7oLGBrVQmho=", - "dev": true, - "optional": true, - "requires": { - "atob": "^2.1.2", - "decode-uri-component": "^0.2.0", - "resolve-url": "^0.2.1", - "source-map-url": "^0.4.0", - "urix": "^0.1.0" - } - }, - "source-map-support": { - "version": "0.5.19", - "resolved": "https://registry.nlark.com/source-map-support/download/source-map-support-0.5.19.tgz?cache=0&sync_timestamp=1624608061410&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fsource-map-support%2Fdownload%2Fsource-map-support-0.5.19.tgz", - "integrity": "sha1-qYti+G3K9PZzmWSMCFKRq56P7WE=", - "requires": { - "buffer-from": "^1.0.0", - "source-map": "^0.6.0" - } - }, - "source-map-url": { - "version": "0.4.1", - "resolved": "https://registry.nlark.com/source-map-url/download/source-map-url-0.4.1.tgz", - "integrity": "sha1-CvZmBadFpaL5HPG7+KevvCg97FY=", - "dev": true, - "optional": true - }, - "split-string": { - "version": "3.1.0", - "resolved": "https://registry.nlark.com/split-string/download/split-string-3.1.0.tgz", - "integrity": "sha1-fLCd2jqGWFcFxks5pkZgOGguj+I=", - "dev": true, - "optional": true, - "requires": { - "extend-shallow": "^3.0.0" - } - }, - "sprintf-js": { - "version": "1.0.3", - "resolved": "https://registry.nlark.com/sprintf-js/download/sprintf-js-1.0.3.tgz", - "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", - "dev": true - }, - "static-extend": { - "version": "0.1.2", - "resolved": "https://registry.nlark.com/static-extend/download/static-extend-0.1.2.tgz", - "integrity": "sha1-YICcOcv/VTNyJv1eC1IPNB8ftcY=", - "dev": true, - "optional": true, - "requires": { - "define-property": "^0.2.5", - "object-copy": "^0.1.0" - }, - "dependencies": { - "define-property": { - "version": "0.2.5", - "resolved": "https://registry.nlark.com/define-property/download/define-property-0.2.5.tgz", - "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", - "dev": true, - "optional": true, - "requires": { - "is-descriptor": "^0.1.0" - } - } - } - }, - "streamroller": { - "version": "2.2.4", - "resolved": "https://registry.nlark.com/streamroller/download/streamroller-2.2.4.tgz", - "integrity": "sha1-wZjO1C25QIamGTYIGHzoCl8rDlM=", - "requires": { - "date-format": "^2.1.0", - "debug": "^4.1.1", - "fs-extra": "^8.1.0" - }, - "dependencies": { - "date-format": { - "version": "2.1.0", - "resolved": "https://registry.nlark.com/date-format/download/date-format-2.1.0.tgz", - "integrity": "sha1-MdW16iEc9f12TNOLr50DPffhJc8=" - } - } - }, - "string-width": { - "version": "4.2.2", - "resolved": "https://registry.nlark.com/string-width/download/string-width-4.2.2.tgz", - "integrity": "sha1-2v1PlVmnWFz7pSnGoKT3NIjr1MU=", - "dev": true, - "requires": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.0" - } - }, - "string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.nlark.com/string_decoder/download/string_decoder-1.1.1.tgz", - "integrity": "sha1-nPFhG6YmhdcDCunkujQUnDrwP8g=", - "requires": { - "safe-buffer": "~5.1.0" - }, - "dependencies": { - "safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.nlark.com/safe-buffer/download/safe-buffer-5.1.2.tgz", - "integrity": "sha1-mR7GnSluAxN0fVm9/St0XDX4go0=" - } - } - }, - "strip-ansi": { - "version": "6.0.0", - "resolved": "https://registry.nlark.com/strip-ansi/download/strip-ansi-6.0.0.tgz", - "integrity": "sha1-CxVx3XZpzNTz4G4U7x7tJiJa5TI=", - "dev": true, - "requires": { - "ansi-regex": "^5.0.0" - } - }, - "strip-final-newline": { - "version": "2.0.0", - "resolved": "https://registry.nlark.com/strip-final-newline/download/strip-final-newline-2.0.0.tgz", - "integrity": "sha1-ibhS+y/L6Tb29LMYevsKEsGrWK0=" - }, - "strip-json-comments": { - "version": "3.1.1", - "resolved": "https://registry.nlark.com/strip-json-comments/download/strip-json-comments-3.1.1.tgz", - "integrity": "sha1-MfEoGzgyYwQ0gxwxDAHMzajL4AY=", - "dev": true - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.nlark.com/supports-color/download/supports-color-7.2.0.tgz?cache=0&sync_timestamp=1626703455199&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fsupports-color%2Fdownload%2Fsupports-color-7.2.0.tgz", - "integrity": "sha1-G33NyzK4E4gBs+R4umpRyqiWSNo=", - "requires": { - "has-flag": "^4.0.0" - } - }, - "table": { - "version": "6.7.1", - "resolved": "https://registry.nlark.com/table/download/table-6.7.1.tgz", - "integrity": "sha1-7gVZK3FDgxqMlPPO5qrkwczvM+I=", - "dev": true, - "requires": { - "ajv": "^8.0.1", - "lodash.clonedeep": "^4.5.0", - "lodash.truncate": "^4.4.2", - "slice-ansi": "^4.0.0", - "string-width": "^4.2.0", - "strip-ansi": "^6.0.0" - }, - "dependencies": { - "ajv": { - "version": "8.6.2", - "resolved": "https://registry.nlark.com/ajv/download/ajv-8.6.2.tgz", - "integrity": "sha1-L7ReDl/LwIEzJsHD2lNdGIG7BXE=", - "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.nlark.com/json-schema-traverse/download/json-schema-traverse-1.0.0.tgz", - "integrity": "sha1-rnvLNlard6c7pcSb9lTzjmtoYOI=", - "dev": true - } - } - }, - "tapable": { - "version": "1.1.3", - "resolved": "https://registry.nlark.com/tapable/download/tapable-1.1.3.tgz", - "integrity": "sha1-ofzMBrWNth/XpF2i2kT186Pme6I=" - }, - "terser": { - "version": "5.7.2", - "resolved": "https://registry.nlark.com/terser/download/terser-5.7.2.tgz", - "integrity": "sha1-1Nle1Pi/c1y5M+gC8qGCmr9UXj8=", - "requires": { - "commander": "^2.20.0", - "source-map": "~0.7.2", - "source-map-support": "~0.5.19" - }, - "dependencies": { - "source-map": { - "version": "0.7.3", - "resolved": "https://registry.nlark.com/source-map/download/source-map-0.7.3.tgz?cache=0&sync_timestamp=1624608014898&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fsource-map%2Fdownload%2Fsource-map-0.7.3.tgz", - "integrity": "sha1-UwL4FpAxc1ImVECS5kmB91F1A4M=" - } - } - }, - "terser-webpack-plugin": { - "version": "5.2.2", - "resolved": "https://registry.nlark.com/terser-webpack-plugin/download/terser-webpack-plugin-5.2.2.tgz?cache=0&sync_timestamp=1630630911890&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fterser-webpack-plugin%2Fdownload%2Fterser-webpack-plugin-5.2.2.tgz", - "integrity": "sha1-1/0IEJ1HuNTsfb/u5rGP4akULYw=", - "requires": { - "jest-worker": "^27.0.6", - "p-limit": "^3.1.0", - "schema-utils": "^3.1.1", - "serialize-javascript": "^6.0.0", - "source-map": "^0.6.1", - "terser": "^5.7.2" - }, - "dependencies": { - "serialize-javascript": { - "version": "6.0.0", - "resolved": "https://registry.nlark.com/serialize-javascript/download/serialize-javascript-6.0.0.tgz?cache=0&sync_timestamp=1624608021459&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fserialize-javascript%2Fdownload%2Fserialize-javascript-6.0.0.tgz", - "integrity": "sha1-765diPRdeSQUHai1w6en5mP+/rg=", - "requires": { - "randombytes": "^2.1.0" - } - } - } - }, - "text-table": { - "version": "0.2.0", - "resolved": "https://registry.nlark.com/text-table/download/text-table-0.2.0.tgz", - "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=", - "dev": true - }, - "to-fast-properties": { - "version": "2.0.0", - "resolved": "https://registry.nlark.com/to-fast-properties/download/to-fast-properties-2.0.0.tgz?cache=0&sync_timestamp=1628418893613&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fto-fast-properties%2Fdownload%2Fto-fast-properties-2.0.0.tgz", - "integrity": "sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4=", - "dev": true - }, - "to-object-path": { - "version": "0.3.0", - "resolved": "https://registry.nlark.com/to-object-path/download/to-object-path-0.3.0.tgz", - "integrity": "sha1-KXWIt7Dn4KwI4E5nL4XB9JmeF68=", - "dev": true, - "optional": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.nlark.com/kind-of/download/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "optional": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "to-regex": { - "version": "3.0.2", - "resolved": "https://registry.nlark.com/to-regex/download/to-regex-3.0.2.tgz", - "integrity": "sha1-E8/dmzNlUvMLUfM6iuG0Knp1mc4=", - "dev": true, - "optional": true, - "requires": { - "define-property": "^2.0.2", - "extend-shallow": "^3.0.2", - "regex-not": "^1.0.2", - "safe-regex": "^1.1.0" - } - }, - "to-regex-range": { - "version": "5.0.1", - "resolved": "https://registry.nlark.com/to-regex-range/download/to-regex-range-5.0.1.tgz", - "integrity": "sha1-FkjESq58jZiKMmAY7XL1tN0DkuQ=", - "requires": { - "is-number": "^7.0.0" - } - }, - "ts-loader": { - "version": "8.3.0", - "resolved": "https://registry.nlark.com/ts-loader/download/ts-loader-8.3.0.tgz", - "integrity": "sha1-gzYEltb4AE+rNYJSeRMsk0Eu3zM=", - "requires": { - "chalk": "^4.1.0", - "enhanced-resolve": "^4.0.0", - "loader-utils": "^2.0.0", - "micromatch": "^4.0.0", - "semver": "^7.3.4" - } - }, - "ts-node": { - "version": "9.1.1", - "resolved": "https://registry.nlark.com/ts-node/download/ts-node-9.1.1.tgz?cache=0&sync_timestamp=1629311301535&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fts-node%2Fdownload%2Fts-node-9.1.1.tgz", - "integrity": "sha1-UamkUKPpWUAb2l8ASnLVS5NtN20=", - "dev": true, - "requires": { - "arg": "^4.1.0", - "create-require": "^1.1.0", - "diff": "^4.0.1", - "make-error": "^1.1.1", - "source-map-support": "^0.5.17", - "yn": "3.1.1" - }, - "dependencies": { - "diff": { - "version": "4.0.2", - "resolved": "https://registry.nlark.com/diff/download/diff-4.0.2.tgz?cache=0&sync_timestamp=1624608104914&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fdiff%2Fdownload%2Fdiff-4.0.2.tgz", - "integrity": "sha1-YPOuy4nV+uUgwRqhnvwruYKq3n0=", - "dev": true - } - } - }, - "tslib": { - "version": "1.14.1", - "resolved": "https://registry.nlark.com/tslib/download/tslib-1.14.1.tgz", - "integrity": "sha1-zy04vcNKE0vK8QkcQfZhni9nLQA=", - "dev": true - }, - "tsutils": { - "version": "3.21.0", - "resolved": "https://registry.nlark.com/tsutils/download/tsutils-3.21.0.tgz", - "integrity": "sha1-tIcX05TOpsHglpg+7Vjp1hcVtiM=", - "dev": true, - "requires": { - "tslib": "^1.8.1" - } - }, - "type-check": { - "version": "0.4.0", - "resolved": "https://registry.nlark.com/type-check/download/type-check-0.4.0.tgz", - "integrity": "sha1-B7ggO/pwVsBlcFDjzNLDdzC6uPE=", - "dev": true, - "requires": { - "prelude-ls": "^1.2.1" - } - }, - "type-detect": { - "version": "4.0.8", - "resolved": "https://registry.nlark.com/type-detect/download/type-detect-4.0.8.tgz?cache=0&sync_timestamp=1624607980886&other_urls=https%3A%2F%2Fregistry.nlark.com%2Ftype-detect%2Fdownload%2Ftype-detect-4.0.8.tgz", - "integrity": "sha1-dkb7XxiHHPu3dJ5pvTmmOI63RQw=", - "dev": true - }, - "type-fest": { - "version": "0.20.2", - "resolved": "https://registry.nlark.com/type-fest/download/type-fest-0.20.2.tgz", - "integrity": "sha1-G/IH9LKPkVg2ZstfvTJ4hzAc1fQ=", - "dev": true - }, - "typescript": { - "version": "4.4.2", - "resolved": "https://registry.nlark.com/typescript/download/typescript-4.4.2.tgz?cache=0&sync_timestamp=1630566990929&other_urls=https%3A%2F%2Fregistry.nlark.com%2Ftypescript%2Fdownload%2Ftypescript-4.4.2.tgz", - "integrity": "sha1-bWGGQNQw41aaHftE99fmAM7T7oY=" - }, - "uglify-es": { - "version": "3.3.10", - "resolved": "https://registry.nlark.com/uglify-es/download/uglify-es-3.3.10.tgz", - "integrity": "sha1-iwt5ks6+IO3CbeG/MlzveXuPP6U=", - "dev": true, - "requires": { - "commander": "~2.14.1", - "source-map": "~0.6.1" - }, - "dependencies": { - "commander": { - "version": "2.14.1", - "resolved": "https://registry.nlark.com/commander/download/commander-2.14.1.tgz", - "integrity": "sha1-IjUSPjevjKPGXfRbAm29NXsBuao=", - "dev": true - } - } - }, - "unicode-canonical-property-names-ecmascript": { - "version": "1.0.4", - "resolved": "https://registry.nlark.com/unicode-canonical-property-names-ecmascript/download/unicode-canonical-property-names-ecmascript-1.0.4.tgz", - "integrity": "sha1-JhmADEyCWADv3YNDr33Zkzy+KBg=", - "dev": true - }, - "unicode-match-property-ecmascript": { - "version": "1.0.4", - "resolved": "https://registry.nlark.com/unicode-match-property-ecmascript/download/unicode-match-property-ecmascript-1.0.4.tgz", - "integrity": "sha1-jtKjJWmWG86SJ9Cc0/+7j+1fAgw=", - "dev": true, - "requires": { - "unicode-canonical-property-names-ecmascript": "^1.0.4", - "unicode-property-aliases-ecmascript": "^1.0.4" - } - }, - "unicode-match-property-value-ecmascript": { - "version": "1.2.0", - "resolved": "https://registry.nlark.com/unicode-match-property-value-ecmascript/download/unicode-match-property-value-ecmascript-1.2.0.tgz", - "integrity": "sha1-DZH2AO7rMJaqlisdb8iIduZOpTE=", - "dev": true - }, - "unicode-property-aliases-ecmascript": { - "version": "1.1.0", - "resolved": "https://registry.nlark.com/unicode-property-aliases-ecmascript/download/unicode-property-aliases-ecmascript-1.1.0.tgz", - "integrity": "sha1-3Vepn2IHvt/0Yoq++5TFDblByPQ=", - "dev": true - }, - "union-value": { - "version": "1.0.1", - "resolved": "https://registry.nlark.com/union-value/download/union-value-1.0.1.tgz", - "integrity": "sha1-C2/nuDWuzaYcbqTU8CwUIh4QmEc=", - "dev": true, - "optional": true, - "requires": { - "arr-union": "^3.1.0", - "get-value": "^2.0.6", - "is-extendable": "^0.1.1", - "set-value": "^2.0.1" - } - }, - "universalify": { - "version": "0.1.2", - "resolved": "https://registry.nlark.com/universalify/download/universalify-0.1.2.tgz", - "integrity": "sha1-tkb2m+OULavOzJ1mOcgNwQXvqmY=" - }, - "unset-value": { - "version": "1.0.0", - "resolved": "https://registry.nlark.com/unset-value/download/unset-value-1.0.0.tgz", - "integrity": "sha1-g3aHP30jNRef+x5vw6jtDfyKtVk=", - "dev": true, - "optional": true, - "requires": { - "has-value": "^0.3.1", - "isobject": "^3.0.0" - }, - "dependencies": { - "has-value": { - "version": "0.3.1", - "resolved": "https://registry.nlark.com/has-value/download/has-value-0.3.1.tgz", - "integrity": "sha1-ex9YutpiyoJ+wKIHgCVlSEWZXh8=", - "dev": true, - "optional": true, - "requires": { - "get-value": "^2.0.3", - "has-values": "^0.1.4", - "isobject": "^2.0.0" - }, - "dependencies": { - "isobject": { - "version": "2.1.0", - "resolved": "https://registry.nlark.com/isobject/download/isobject-2.1.0.tgz", - "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=", - "dev": true, - "optional": true, - "requires": { - "isarray": "1.0.0" - } - } - } - }, - "has-values": { - "version": "0.1.4", - "resolved": "https://registry.nlark.com/has-values/download/has-values-0.1.4.tgz", - "integrity": "sha1-bWHeldkd/Km5oCCJrThL/49it3E=", - "dev": true, - "optional": true - } - } - }, - "upath": { - "version": "1.2.0", - "resolved": "https://registry.nlark.com/upath/download/upath-1.2.0.tgz", - "integrity": "sha1-j2bbzVWog6za5ECK+LA1pQRMGJQ=", - "dev": true, - "optional": true - }, - "uri-js": { - "version": "4.4.1", - "resolved": "https://registry.nlark.com/uri-js/download/uri-js-4.4.1.tgz", - "integrity": "sha1-mxpSWVIlhZ5V9mnZKPiMbFfyp34=", - "requires": { - "punycode": "^2.1.0" - } - }, - "urix": { - "version": "0.1.0", - "resolved": "https://registry.nlark.com/urix/download/urix-0.1.0.tgz", - "integrity": "sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI=", - "dev": true, - "optional": true - }, - "use": { - "version": "3.1.1", - "resolved": "https://registry.nlark.com/use/download/use-3.1.1.tgz", - "integrity": "sha1-1QyMrHmhn7wg8pEfVuuXP04QBw8=", - "dev": true, - "optional": true - }, - "util-deprecate": { - "version": "1.0.2", - "resolved": "https://registry.nlark.com/util-deprecate/download/util-deprecate-1.0.2.tgz?cache=0&sync_timestamp=1624607944834&other_urls=https%3A%2F%2Fregistry.nlark.com%2Futil-deprecate%2Fdownload%2Futil-deprecate-1.0.2.tgz", - "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" - }, - "v8-compile-cache": { - "version": "2.3.0", - "resolved": "https://registry.nlark.com/v8-compile-cache/download/v8-compile-cache-2.3.0.tgz", - "integrity": "sha1-LeGWGMZtwkfc+2+ZM4A12CRaLO4=" - }, - "watchpack": { - "version": "2.2.0", - "resolved": "https://registry.nlark.com/watchpack/download/watchpack-2.2.0.tgz", - "integrity": "sha1-R9ePVBX+VQ7NdA+Z/iiCMjpYsc4=", - "requires": { - "glob-to-regexp": "^0.4.1", - "graceful-fs": "^4.1.2" - } - }, - "webpack": { - "version": "5.51.2", - "resolved": "https://registry.nlark.com/webpack/download/webpack-5.51.2.tgz?cache=0&sync_timestamp=1630589182625&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fwebpack%2Fdownload%2Fwebpack-5.51.2.tgz", - "integrity": "sha1-92XSWLC/ar2jxfIb+FWiVyDpeW8=", - "requires": { - "@types/eslint-scope": "^3.7.0", - "@types/estree": "^0.0.50", - "@webassemblyjs/ast": "1.11.1", - "@webassemblyjs/wasm-edit": "1.11.1", - "@webassemblyjs/wasm-parser": "1.11.1", - "acorn": "^8.4.1", - "acorn-import-assertions": "^1.7.6", - "browserslist": "^4.14.5", - "chrome-trace-event": "^1.0.2", - "enhanced-resolve": "^5.8.0", - "es-module-lexer": "^0.7.1", - "eslint-scope": "5.1.1", - "events": "^3.2.0", - "glob-to-regexp": "^0.4.1", - "graceful-fs": "^4.2.4", - "json-parse-better-errors": "^1.0.2", - "loader-runner": "^4.2.0", - "mime-types": "^2.1.27", - "neo-async": "^2.6.2", - "schema-utils": "^3.1.0", - "tapable": "^2.1.1", - "terser-webpack-plugin": "^5.1.3", - "watchpack": "^2.2.0", - "webpack-sources": "^3.2.0" - }, - "dependencies": { - "enhanced-resolve": { - "version": "5.8.2", - "resolved": "https://registry.nlark.com/enhanced-resolve/download/enhanced-resolve-5.8.2.tgz", - "integrity": "sha1-Fd3HeTRcu3PpfGEc0AwBwee/TYs=", - "requires": { - "graceful-fs": "^4.2.4", - "tapable": "^2.2.0" - } - }, - "tapable": { - "version": "2.2.0", - "resolved": "https://registry.nlark.com/tapable/download/tapable-2.2.0.tgz", - "integrity": "sha1-XDc9KB2cZyhIIT0OA30cQWWrQms=" - } - } - }, - "webpack-cli": { - "version": "4.8.0", - "resolved": "https://registry.nlark.com/webpack-cli/download/webpack-cli-4.8.0.tgz", - "integrity": "sha1-X8PIuUAdPIpD4q/OrPqCYZYjONE=", - "requires": { - "@discoveryjs/json-ext": "^0.5.0", - "@webpack-cli/configtest": "^1.0.4", - "@webpack-cli/info": "^1.3.0", - "@webpack-cli/serve": "^1.5.2", - "colorette": "^1.2.1", - "commander": "^7.0.0", - "execa": "^5.0.0", - "fastest-levenshtein": "^1.0.12", - "import-local": "^3.0.2", - "interpret": "^2.2.0", - "rechoir": "^0.7.0", - "v8-compile-cache": "^2.2.0", - "webpack-merge": "^5.7.3" - }, - "dependencies": { - "commander": { - "version": "7.2.0", - "resolved": "https://registry.nlark.com/commander/download/commander-7.2.0.tgz", - "integrity": "sha1-o2y1fQtQHOEI5NIFWaFQo5HZerc=" - } - } - }, - "webpack-merge": { - "version": "5.8.0", - "resolved": "https://registry.nlark.com/webpack-merge/download/webpack-merge-5.8.0.tgz?cache=0&sync_timestamp=1624607912484&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fwebpack-merge%2Fdownload%2Fwebpack-merge-5.8.0.tgz", - "integrity": "sha1-Kznb8ir4d3atdEw5AiNzHTCmj2E=", - "requires": { - "clone-deep": "^4.0.1", - "wildcard": "^2.0.0" - } - }, - "webpack-sources": { - "version": "3.2.0", - "resolved": "https://registry.nlark.com/webpack-sources/download/webpack-sources-3.2.0.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fwebpack-sources%2Fdownload%2Fwebpack-sources-3.2.0.tgz", - "integrity": "sha1-sWlzvPhE682zr94y7aHATQuQ+J0=" - }, - "which": { - "version": "2.0.2", - "resolved": "https://registry.nlark.com/which/download/which-2.0.2.tgz", - "integrity": "sha1-fGqN0KY2oDJ+ELWckobu6T8/UbE=", - "requires": { - "isexe": "^2.0.0" - } - }, - "wide-align": { - "version": "1.1.3", - "resolved": "https://registry.nlark.com/wide-align/download/wide-align-1.1.3.tgz", - "integrity": "sha1-rgdOa9wMFKQx6ATmJFScYzsABFc=", - "dev": true, - "requires": { - "string-width": "^1.0.2 || 2" - }, - "dependencies": { - "ansi-regex": { - "version": "3.0.0", - "resolved": "https://registry.nlark.com/ansi-regex/download/ansi-regex-3.0.0.tgz", - "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.nlark.com/is-fullwidth-code-point/download/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", - "dev": true - }, - "string-width": { - "version": "2.1.1", - "resolved": "https://registry.nlark.com/string-width/download/string-width-2.1.1.tgz", - "integrity": "sha1-q5Pyeo3BPSjKyBXEYhQ6bZASrp4=", - "dev": true, - "requires": { - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^4.0.0" - } - }, - "strip-ansi": { - "version": "4.0.0", - "resolved": "https://registry.nlark.com/strip-ansi/download/strip-ansi-4.0.0.tgz", - "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", - "dev": true, - "requires": { - "ansi-regex": "^3.0.0" - } - } - } - }, - "wildcard": { - "version": "2.0.0", - "resolved": "https://registry.nlark.com/wildcard/download/wildcard-2.0.0.tgz", - "integrity": "sha1-p30g5SAMb6qsl55LOq3Hs91/j+w=" - }, - "word-wrap": { - "version": "1.2.3", - "resolved": "https://registry.nlark.com/word-wrap/download/word-wrap-1.2.3.tgz", - "integrity": "sha1-YQY29rH3A4kb00dxzLF/uTtHB5w=", - "dev": true - }, - "workerpool": { - "version": "6.1.0", - "resolved": "https://registry.nlark.com/workerpool/download/workerpool-6.1.0.tgz", - "integrity": "sha1-qOA4tMlFaVloUt56jqQiju/es3s=", - "dev": true - }, - "wrap-ansi": { - "version": "7.0.0", - "resolved": "https://registry.nlark.com/wrap-ansi/download/wrap-ansi-7.0.0.tgz", - "integrity": "sha1-Z+FFz/UQpqaYS98RUpEdadLrnkM=", - "dev": true, - "requires": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" - } - }, - "wrappy": { - "version": "1.0.2", - "resolved": "https://registry.nlark.com/wrappy/download/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" - }, - "y18n": { - "version": "5.0.8", - "resolved": "https://registry.nlark.com/y18n/download/y18n-5.0.8.tgz", - "integrity": "sha1-f0k00PfKjFb5UxSTndzS3ZHOHVU=", - "dev": true - }, - "yallist": { - "version": "4.0.0", - "resolved": "https://registry.nlark.com/yallist/download/yallist-4.0.0.tgz?cache=0&sync_timestamp=1624607893982&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fyallist%2Fdownload%2Fyallist-4.0.0.tgz", - "integrity": "sha1-m7knkNnA7/7GO+c1GeEaNQGaOnI=" - }, - "yargs": { - "version": "16.2.0", - "resolved": "https://registry.nlark.com/yargs/download/yargs-16.2.0.tgz", - "integrity": "sha1-HIK/D2tqZur85+8w43b0mhJHf2Y=", - "dev": true, - "requires": { - "cliui": "^7.0.2", - "escalade": "^3.1.1", - "get-caller-file": "^2.0.5", - "require-directory": "^2.1.1", - "string-width": "^4.2.0", - "y18n": "^5.0.5", - "yargs-parser": "^20.2.2" - } - }, - "yargs-parser": { - "version": "20.2.4", - "resolved": "https://registry.nlark.com/yargs-parser/download/yargs-parser-20.2.4.tgz?cache=0&sync_timestamp=1624608003030&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fyargs-parser%2Fdownload%2Fyargs-parser-20.2.4.tgz", - "integrity": "sha1-tCiQ8UVmeW+Fro46JSkNIF8VSlQ=", - "dev": true - }, - "yargs-unparser": { - "version": "2.0.0", - "resolved": "https://registry.nlark.com/yargs-unparser/download/yargs-unparser-2.0.0.tgz", - "integrity": "sha1-8TH5ImkRrl2a04xDL+gJNmwjJes=", - "dev": true, - "requires": { - "camelcase": "^6.0.0", - "decamelize": "^4.0.0", - "flat": "^5.0.2", - "is-plain-obj": "^2.1.0" - } - }, - "yn": { - "version": "3.1.1", - "resolved": "https://registry.nlark.com/yn/download/yn-3.1.1.tgz", - "integrity": "sha1-HodAGgnXZ8HV6rJqbkwYUYLS61A=", - "dev": true - }, - "yocto-queue": { - "version": "0.1.0", - "resolved": "https://registry.nlark.com/yocto-queue/download/yocto-queue-0.1.0.tgz?cache=0&sync_timestamp=1628812679256&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fyocto-queue%2Fdownload%2Fyocto-queue-0.1.0.tgz", - "integrity": "sha1-ApTrPe4FAo0x7hpfosVWpqrxChs=" - } - } -} diff --git a/compiler/compiler/package.json b/compiler/compiler/package.json deleted file mode 100644 index fe0cde331..000000000 --- a/compiler/compiler/package.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "name": "compilier", - "version": "0.0.1", - "description": "Transpile ace2.0 ui-syntax to support UI control render, Component and State management.", - "private": true, - "keywords": [ - "ace", - "loader", - "webpack" - ], - "scripts": { - "lint": "eslint --fix ./src --ext .ts", - "build": "npm run generateSyntaxParser && npm run generateDeclarations && ./node_modules/.bin/babel ./src --out-dir lib --extensions .ts", - "create": "node ./lib/create.js --env projectName", - "compile": "webpack --config webpack.config.js --env buildMode=debug projectName", - "test": "npm run build && mocha -r ts-node/register test/test.ts", - "generateDeclarations": "node ./build_declarations_file.js ../../../interface/sdk-js/api/@internal/component/ets ./declarations ./lib", - "generateSyntaxParser": "node build_parser.js ./syntax_parser/dist", - "postinstall": "node npm-install.js" - }, - "devDependencies": { - "@babel/cli": "^7.8.4", - "@babel/core": "^7.9.0", - "@babel/plugin-proposal-class-properties": "^7.8.3", - "@babel/preset-env": "^7.9.0", - "@babel/preset-typescript": "^7.12.7", - "@babel/runtime": "^7.0.0", - "@typescript-eslint/parser": "^4.11.0", - "chai": "^4.2.0", - "eslint": "^7.16.0", - "mocha": "^8.2.1", - "ts-node": "^9.1.1", - "uglify-es": "^3.3.10" - }, - "dependencies": { - "clean-webpack-plugin": "^3.0.0", - "copy-webpack-plugin": "^8.1.0", - "deccjsunit": "1.0.3", - "log4js": "^6.3.0", - "pegjs": "^0.10.0", - "ts-loader": "^8.0.12", - "typescript": "^4.1.3", - "webpack": "^5.48.0", - "webpack-cli": "^4.2.0" - } -} diff --git a/compiler/compiler/sample/app.ets b/compiler/compiler/sample/app.ets deleted file mode 100644 index 8e35f7b00..000000000 --- a/compiler/compiler/sample/app.ets +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - - -export default { - onCreate() { - console.info('Application onCreate') - }, - onDestroy() { - console.info('Application onDestroy') - }, -} diff --git a/compiler/compiler/sample/manifest.json b/compiler/compiler/sample/manifest.json deleted file mode 100644 index 97155b8f1..000000000 --- a/compiler/compiler/sample/manifest.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "appID": "com.huawei.ace.helloworld", - "appName": "HelloAce", - "versionName": "1.0.0", - "versionCode": 1, - "minPlatformVersion": "1.0.1", - "pages": [ - "pages/todo", - "pages/index", - "pages/home", - "pages/home_preview", - - "pages/testcases/componentGridTest", - "pages/testcases/componentListTest", - "pages/testcases/image", - "pages/testcases/onclicktest", - "pages/testcases/simpleText", - "pages/testcases/stacktestsuite", - - "pages/testcases/forEachComplexModel", - "pages/testcases/forEachSimpleModel", - "pages/testcases/linkArrayModel", - "pages/testcases/linkPropCombo", - "pages/testcases/linkSimpleModel", - "pages/testcases/propSimpleModel", - "pages/testcases/stateArrayReverse", - "pages/testcases/stateArrayReverseCustomView", - "pages/testcases/stateComplexType", - "pages/testcases/stateStateBindingProp" - ], - "window": { - "designWidth": 750, - "autoDesignWidth": false - } -} \ No newline at end of file diff --git a/compiler/compiler/sample/pages/home.ets b/compiler/compiler/sample/pages/home.ets deleted file mode 100644 index 65b5d3974..000000000 --- a/compiler/compiler/sample/pages/home.ets +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - - -@Entry -@Component -struct HomeComponent { - private value1: string = "hello world 1" - private value2: string = "hello world 2" - private value3: string = "hello world 3" - - build() { - Column() { - Row() { - Text(this.value1) - Text(this.value2) - Text(this.value3) - } - Row() { - Button() { - Text(this.value1) - .fontSize(20) - } - .width(100) - .height(20) - Text(this.value2) - .fontSize(100) - Text(this.value3) - } - .width(20) - } - .height(500) - } -} \ No newline at end of file diff --git a/compiler/compiler/sample/pages/home_preview.ets b/compiler/compiler/sample/pages/home_preview.ets deleted file mode 100644 index 53fe3642d..000000000 --- a/compiler/compiler/sample/pages/home_preview.ets +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - - -@Entry -@Component -struct HomePreviewComponent { - private value1: string = "hello world 1" - private value2: string = "hello world 2" - private value3: string = "hello world 3" - - build() { - Column() { - Row() { - Text(this.value1) - Text(this.value2) - Text(this.value3) - } - Row() { - Button() { - Text(this.value1) - .fontSize(20) - } - .width(100) - .height(20) - Text(this.value2) - .fontSize(100) - Text(this.value3) - } - .width(20) - } - .height(500) - } -} - -@Preview -@Component -struct HomePreviewComponent_Preview { - build() { - Column() { - HomePreviewComponent() - } - } -} diff --git a/compiler/compiler/sample/pages/index.ets b/compiler/compiler/sample/pages/index.ets deleted file mode 100644 index 9708e4ba0..000000000 --- a/compiler/compiler/sample/pages/index.ets +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - - -@Component -struct Banner { - private value1: string = "hello world 4" - private value2: string = "hello world 5" - private value3: string = "hello world 6" - - build() { - Column() { - Text(this.value1) - Text(this.value2) - Text(this.value3) - } - } -} - -@Component -@Entry -struct MyComponent { - private value1: string = "hello world 1" - private value2: string = "hello world 2" - private value3: string = "hello world 3" - @State private idx:number = 0 - - build() { - Column() { - Text(this.value1) - Text(this.value2) - Text(this.value3) - Banner() - } - } -} diff --git a/compiler/compiler/sample/pages/testcases/component-01.ets b/compiler/compiler/sample/pages/testcases/component-01.ets deleted file mode 100644 index 27c1a6be7..000000000 --- a/compiler/compiler/sample/pages/testcases/component-01.ets +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - -@Component -@Entry -struct MyComponent1 { - private value1: string = "hello world 1" - private value2: string = "hello world 2" - private value3: string = "hello world 3" - - constructor() { - console.info('into constructor'); - } - - build() { - new Column() { - new Text(this.value1) - Text(this.value2) - Text(this.value3) - } - } -} \ No newline at end of file diff --git a/compiler/compiler/sample/pages/testcases/componentGridTest.ets b/compiler/compiler/sample/pages/testcases/componentGridTest.ets deleted file mode 100644 index 54d1cd8e3..000000000 --- a/compiler/compiler/sample/pages/testcases/componentGridTest.ets +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - -@Entry -@Component -struct GridRootView { - changeColor:boolean = true; - dataArrayA:string[] = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]; - @State itemColor:number = 0xffff00; - - build(){ - Column(){ - Text('--------------- Grid : foreach test --------------->') - Grid(){ - ForEach( - this.dataArrayA, //Data array - (item) => { - GridItem(){ - Text(item) - }.width(100).height(50).backgroundColor(0x00ff00) - }, - item => item - ) - } - .height(100).width(650) - .columnsTemplate("1fr 1fr 1fr 1fr 1fr 1fr 1fr").columnsGap(50) //Grid - Text('--------------- Grid : item start-end test --------------->') - Grid(){ - GridItem(){ - Text('1').fontSize(11) - } - .height(100).width(150).backgroundColor(0x00ff00).borderWidth(2.0) - GridItem(){ - Text('2').fontSize(22) - } - .height(100).width(150).backgroundColor(0x00ffff).borderWidth(2.0).borderStyle(2) - GridItem(){ - Text('3').fontSize(33) - } - .height(100).width(150).backgroundColor(0x0000ff).borderWidth(2.0).borderColor(0xff46f7).borderStyle(1) - GridItem(){ - Text('click me').fontSize(24) - } - .height(100).width(150).backgroundColor(this.itemColor).borderWidth(2.0).borderColor(0xff46f7).borderStyle(3) - .onClick(() => { - if (this.changeColor == true) { - this.itemColor = 0x0000ff; - } else { - this.itemColor = 0xffff00; - } - this.changeColor = !this.changeColor; - }) - } - .width(350).height(250) - .columnsTemplate("1fr 1fr 1fr").rowsTemplate("1fr 1fr").columnsGap(50).rowsGap(50) - } - } -} diff --git a/compiler/compiler/sample/pages/testcases/componentListTest.ets b/compiler/compiler/sample/pages/testcases/componentListTest.ets deleted file mode 100644 index 1b60675ed..000000000 --- a/compiler/compiler/sample/pages/testcases/componentListTest.ets +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - - -@Entry -@Component -struct ListRootView { - - dataArrayList:string[] = [ - "item0", "item1", "item2", "item3", "item4", "item5", "item6", "item7", "item8", "item9", - "item10", "item11", "item12", "item13", "item14", "item15", "item16", "item17", "item18", "item19", - "item20", "item21", "item22", "item23", "item24", "item25", "item26", "item27", "item28", "item29", - ]; - - @State listidx:number = 50; - - build(){ - Column(){ - Text('--------------- List :foreach test --------------->') - Text("index:" + this.listidx) - List(){ - ForEach( - this.dataArrayList, - (item) => { - ListItem(){ - Text(item) - } - .backgroundColor(0x6495ED).height(50) - .onClick(() => { - this.listidx ++; - }) - }, - (item) => item - ) - } - .height(600).width(500) - .divider({ strokeWidth: 2, color:"#FF00ff"}).scrollBar(BarState.Off) - .onReachStart(() => { - console.info("list-demo reachStart "); - }) - .onReachEnd(() => { - console.info("list-demo reachEnd "); - }) - .onScrollStop(() => { - console.info("list-demo scrollStop "); - }) - .onScroll((offset: number, state: ScrollState) => { - console.info('list-demo scroll:offset:' + offset + ",State:" + state) - }) - } - } -} \ No newline at end of file diff --git a/compiler/compiler/sample/pages/testcases/constructor-01.ets b/compiler/compiler/sample/pages/testcases/constructor-01.ets deleted file mode 100644 index 77aac86c2..000000000 --- a/compiler/compiler/sample/pages/testcases/constructor-01.ets +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - - -class DataModel{ - private myData1: number = 0 -} - -@Entry -@Component -struct MyStateComponent { - @State myState1: any = { count: 0 } - @State myState2: number = 0 - @State myState3: boolean = false - @State myState4: string = 'Home' - @State myState5: DataModel = new DataModel() - - private myVar : number = 0 - private myVar2 : number - - build() { - - } -} \ No newline at end of file diff --git a/compiler/compiler/sample/pages/testcases/constructor-02.ets b/compiler/compiler/sample/pages/testcases/constructor-02.ets deleted file mode 100644 index 72eb63327..000000000 --- a/compiler/compiler/sample/pages/testcases/constructor-02.ets +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - -@Entry -@Component -struct MyLinkComponent { - @Link myLink1?: any - @Link myLink2?: number - @Link myLink3?: boolean - @Link myLink4?: string - - private myVar: number = 0 - private myVar2: number - - build() { - - } -} \ No newline at end of file diff --git a/compiler/compiler/sample/pages/testcases/constructor-03.ets b/compiler/compiler/sample/pages/testcases/constructor-03.ets deleted file mode 100644 index 4a482cb70..000000000 --- a/compiler/compiler/sample/pages/testcases/constructor-03.ets +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - -@Entry -@Component -struct MyPropComponent { - @Prop myProp1?: any - @Prop myProp2?: number - @Prop myProp3?: boolean - @Prop myProp4?: string - - private myVar: number = 0 - private myVar2: number - - build() { - - } -} \ No newline at end of file diff --git a/compiler/compiler/sample/pages/testcases/expected/component-01-expected.js b/compiler/compiler/sample/pages/testcases/expected/component-01-expected.js deleted file mode 100644 index ae202268d..000000000 --- a/compiler/compiler/sample/pages/testcases/expected/component-01-expected.js +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - - -class MyComponent extends View { - constructor() { - super(); - this.value1 = value1; - this.value2 = value2; - this.value3 = value3; - console.info('into constructor'); - } - render() { return new Column(new Text(this.value1), new Text(this.value2), new Text(this.value3)); } -} -loadDocument(new MyComponent()); diff --git a/compiler/compiler/sample/pages/testcases/expected/constructor-01-expected.js b/compiler/compiler/sample/pages/testcases/expected/constructor-01-expected.js deleted file mode 100644 index 53ca41c94..000000000 --- a/compiler/compiler/sample/pages/testcases/expected/constructor-01-expected.js +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - - -class MyStateComponent extends View { - constructor(inputParams) { - super(); - this.myState1 = { count: 0 }; - this.myState2 = 0; - this.myState3 = false; - this.myState4 = 'Home'; - this.myVar = 0; - Object.assign(this, inputParams); - this.createState("myState1"); - this.createState("myState2"); - this.createState("myState3"); - this.createState("myState4"); - } - render() { - } -} -loadDocument(new MyStateComponent()); diff --git a/compiler/compiler/sample/pages/testcases/expected/constructor-02-expected.js b/compiler/compiler/sample/pages/testcases/expected/constructor-02-expected.js deleted file mode 100644 index 6c5de4e0c..000000000 --- a/compiler/compiler/sample/pages/testcases/expected/constructor-02-expected.js +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - -class MyLinkComponent extends View { - constructor(inputParams) { - super(); - this.myVar = 0; - Object.assign(this, inputParams); - this.createLink("myState1"); - this.createLink("myState2"); - this.createLink("myState3"); - this.createLink("myState4"); - } - render() { - } -} -loadDocument(new MyLinkComponent()); diff --git a/compiler/compiler/sample/pages/testcases/expected/constructor-03-expected.js b/compiler/compiler/sample/pages/testcases/expected/constructor-03-expected.js deleted file mode 100644 index 67382c3d3..000000000 --- a/compiler/compiler/sample/pages/testcases/expected/constructor-03-expected.js +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - -class MyPropComponent extends View { - constructor(inputParams) { - super(); - this.myVar = 0; - Object.assign(this, inputParams); - this.createProp("myProp1"); - this.createProp("myProp2"); - this.createProp("myProp3"); - this.createProp("myProp4"); - } - render() { - } -} -loadDocument(new MyPropComponent()); diff --git a/compiler/compiler/sample/pages/testcases/expected/link-01-expected.js b/compiler/compiler/sample/pages/testcases/expected/link-01-expected.js deleted file mode 100644 index d0ba0a588..000000000 --- a/compiler/compiler/sample/pages/testcases/expected/link-01-expected.js +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - - -class MyLinkTestComponent extends View { - constructor(inputParams) { - super(); - this.myVar = 0; - Object.assign(this, inputParams); - this.createLink("myLink1"); - this.createLink("myLink2"); - this.createLink("myLink3"); - this.createLink("myLink4"); - } - render() { - } -} -class LinkTest extends View { - constructor(inputParams) { - super(); - this.myState1 = { count: 0 }; - this.myState2 = 0; - this.myState3 = false; - this.myState4 = 'Home'; - Object.assign(this, inputParams); - this.createState("myState1"); - this.createState("myState2"); - this.createState("myState3"); - this.createState("myState4"); - } - render() { return new Row(new MyLinkTestComponent({ - myLink1: createLinkReference(this, "myState1"), - myLink2: createLinkReference(this, "myState2"), - myLink3: createLinkReference(this, "myState3"), - myLink4: createLinkReference(this, "myState4"), - myVar: 100, - myVar2: 100, - })); } -} -loadDocument(new LinkTest()); diff --git a/compiler/compiler/sample/pages/testcases/expected/new-01-expected.js b/compiler/compiler/sample/pages/testcases/expected/new-01-expected.js deleted file mode 100644 index 7e46d89c6..000000000 --- a/compiler/compiler/sample/pages/testcases/expected/new-01-expected.js +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - -class MyComponent extends View { - constructor(value1 = "hello world 1", value2 = "hello world 2", value3 = "hello world 3") { - super(); - this.value1 = value1; - this.value2 = value2; - this.value3 = value3; - } - render() { return new Column(new Text(this.value1), new Text(this.value2), new Text(this.value3)); } -} -loadDocument(new MyComponent()); diff --git a/compiler/compiler/sample/pages/testcases/expected/new-02-expected.js b/compiler/compiler/sample/pages/testcases/expected/new-02-expected.js deleted file mode 100644 index 7e46d89c6..000000000 --- a/compiler/compiler/sample/pages/testcases/expected/new-02-expected.js +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - -class MyComponent extends View { - constructor(value1 = "hello world 1", value2 = "hello world 2", value3 = "hello world 3") { - super(); - this.value1 = value1; - this.value2 = value2; - this.value3 = value3; - } - render() { return new Column(new Text(this.value1), new Text(this.value2), new Text(this.value3)); } -} -loadDocument(new MyComponent()); diff --git a/compiler/compiler/sample/pages/testcases/expected/new-03-expected.js b/compiler/compiler/sample/pages/testcases/expected/new-03-expected.js deleted file mode 100644 index 9bf4eae84..000000000 --- a/compiler/compiler/sample/pages/testcases/expected/new-03-expected.js +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - -class Banner extends View { - constructor(value1 = "hello world 2") { - super(); - this.value1 = value1; - } - render() { return new Column(new Text(this.value1)); } -} -class MyComponent extends View { - constructor(value1 = "hello world 1") { - super(); - this.value1 = value1; - } - render() { return new Column(new Text(this.value1), new Banner()); } -} -loadDocument(new MyComponent()); diff --git a/compiler/compiler/sample/pages/testcases/expected/new-04-expected.js b/compiler/compiler/sample/pages/testcases/expected/new-04-expected.js deleted file mode 100644 index 9bf4eae84..000000000 --- a/compiler/compiler/sample/pages/testcases/expected/new-04-expected.js +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - -class Banner extends View { - constructor(value1 = "hello world 2") { - super(); - this.value1 = value1; - } - render() { return new Column(new Text(this.value1)); } -} -class MyComponent extends View { - constructor(value1 = "hello world 1") { - super(); - this.value1 = value1; - } - render() { return new Column(new Text(this.value1), new Banner()); } -} -loadDocument(new MyComponent()); diff --git a/compiler/compiler/sample/pages/testcases/expected/struct-01-expected.js b/compiler/compiler/sample/pages/testcases/expected/struct-01-expected.js deleted file mode 100644 index fa4b84a95..000000000 --- a/compiler/compiler/sample/pages/testcases/expected/struct-01-expected.js +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - - -class MyComponent extends View { - render() { - } - constructor() { super(); } -} -loadDocument(new MyComponent()); diff --git a/compiler/compiler/sample/pages/testcases/expected/struct-02-expected.js b/compiler/compiler/sample/pages/testcases/expected/struct-02-expected.js deleted file mode 100644 index 11297a9a4..000000000 --- a/compiler/compiler/sample/pages/testcases/expected/struct-02-expected.js +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - - -class MyComponent { - build() { - } -} diff --git a/compiler/compiler/sample/pages/testcases/forEachComplexModel.ets b/compiler/compiler/sample/pages/testcases/forEachComplexModel.ets deleted file mode 100644 index 5b0a58a80..000000000 --- a/compiler/compiler/sample/pages/testcases/forEachComplexModel.ets +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - -// class without @Component convert tool will not process. -class Month { - year: number = 2010; // why add assignment here, TS grammar required, if not it will omit by TSC. - month: number = 2; - days: number[] = [1, 2]; - - constructor(year:number, month:number, days:number[]){ - this.year = year; - this.month = month; - this.days = days; - } -} - -@Component -@Entry -struct CalendarDemo { - -// simulate with 6 months -@State calendar : Month[] = [ - new Month(2020, 1, [...Array(31).keys()]), - new Month(2020, 2, [...Array(28).keys()]), - new Month(2020, 3, [...Array(31).keys()]) -] - - build() { - Column() { - Button() { - Text('next month') - }.onClick(() => { - this.calendar.shift() - this.calendar.push(new Month(2020, 4, [...Array(30).keys()])) - }) - - ForEach(this.calendar, - (item: Month) => { - Row() { - ForEach(item.days, - (day : number) => { - Text(`${day}`) - }, - (day : number) => day.toString()) // inner ForEach - } - }, - (item: Month) => (item.year * 12 + item.month).toString()) // outer ForEach - } - } -} \ No newline at end of file diff --git a/compiler/compiler/sample/pages/testcases/forEachSimpleModel.ets b/compiler/compiler/sample/pages/testcases/forEachSimpleModel.ets deleted file mode 100644 index ad1a0a2de..000000000 --- a/compiler/compiler/sample/pages/testcases/forEachSimpleModel.ets +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - -@Entry -@Component -struct MyComponent2 { - @State arr: number[] = [10, 20, 30] - - build() { - Column() { - Button() { - Text('Reverse Array') - .fontSize(30) - }.onClick(() => { - this.arr.reverse() - }).width(80).height(40) - Button() { - Text('clear Array') - .fontSize(30) - }.onClick(() => { - this.arr.splice(0, 1) - }).width(80).height(40) - Button() { - Text('replace Array item') - .fontSize(30) - }.onClick(() => { - this.arr.splice(0, 1, 40) - }).width(80).height(40) - Button() { - Text('replace Array') - .fontSize(30) - }.onClick(() => { - let newArr = [30, 40, 50] - this.arr = newArr - }).width(80).height(40) - - ForEach(this.arr, // Parameter 1: array to be iterated - (item: number) => { // Parameter 2: item generator - Text(`item value: ${item}`) - .fontSize(20) - }, - (item: number) => item.toString() // Parameter 3: unique key generator, which is optional but recommended. - ) - }.height(800) - } -} diff --git a/compiler/compiler/sample/pages/testcases/image.ets b/compiler/compiler/sample/pages/testcases/image.ets deleted file mode 100644 index 26ba6d705..000000000 --- a/compiler/compiler/sample/pages/testcases/image.ets +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - - -@Entry -@Component -struct UserView1 { - - build(){ - Column() { - Image('/common/seaman2.png') - .alt("/common/seaman2.png") - .onComplete((e) => { - console.log('load image, width2: ' + e.width) - console.log('load image, height3: ' + e.height) - }) - .onError(() => { - console.log('load image error1') - }) - } - } -} \ No newline at end of file diff --git a/compiler/compiler/sample/pages/testcases/import-api-01.ets b/compiler/compiler/sample/pages/testcases/import-api-01.ets deleted file mode 100644 index e2e3ceaa4..000000000 --- a/compiler/compiler/sample/pages/testcases/import-api-01.ets +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - - -import fetch from '@system.fetch' -import router from '@system.router' - -@Entry -@Component -struct HomeComponent { - private value1: string = "hello world 1" - private value2: string = "hello world 2" - private value3: string = "hello world 3" - - build() { - Column() { - if (this.value1 === 'Hello') { - Text(this.value1) - } else if (this.value1 === '') { - Button() - } - } - .height(500) - } -} \ No newline at end of file diff --git a/compiler/compiler/sample/pages/testcases/link-01.ets b/compiler/compiler/sample/pages/testcases/link-01.ets deleted file mode 100644 index aff09ab50..000000000 --- a/compiler/compiler/sample/pages/testcases/link-01.ets +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - - -@Component -struct MyLinkTestComponent { - @Link myLink1?: any - @Link myLink2?: number - @Link myLink3?: boolean - @Link myLink4?: string - - private myVar: number = 0 - private myVar2: number - - build() { - - } -} - -@Entry -@Component -struct LinkTest { - @State myState1: any = { count: 0 } - @State myState2: number = 0 - @State myState3: boolean = false - @State myState4: string = 'Home' - - build() { - Row() { - MyLinkTestComponent({ - myLink1: $myState1, - myLink2: $myState2, - myLink3: $myState3, - myLink4: $myState4, - myVar: 100, - myVar2: 100, - }) - } - } -} \ No newline at end of file diff --git a/compiler/compiler/sample/pages/testcases/linkArrayModel.ets b/compiler/compiler/sample/pages/testcases/linkArrayModel.ets deleted file mode 100644 index f4901f8b6..000000000 --- a/compiler/compiler/sample/pages/testcases/linkArrayModel.ets +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - - -@Component -@Entry -struct Parent { - @State arr: number[] = [1, 2, 3] - build() { - Column() { - Child({items: $arr}) - ForEach(this.arr, - item => {Text(`${item}`)}, - item => item) - } - } -} - -@Component -struct Child { - @Link items: number[] - build() { - Column() { - Button() { - Text("Button1: push") - }.onClick(() => { - this.items.push(100) - }) - Button() { - Text("Button2: replace whole item") - }.onClick(() => { - this.items = [100, 200, 300] - }) - } - } -} diff --git a/compiler/compiler/sample/pages/testcases/linkPropCombo.ets b/compiler/compiler/sample/pages/testcases/linkPropCombo.ets deleted file mode 100644 index 03d834813..000000000 --- a/compiler/compiler/sample/pages/testcases/linkPropCombo.ets +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - - -@Component -@Entry -struct ParentView { - @State counter:number = 0; - build() { - Column() { - ChildA({counterVal: this.counter}) - ChildB({counterRef: $counter}) - } - } -} - -@Component -struct ChildA { - @Prop counterVal: number; - build() { - Button() { - Text(`ChildA: (${this.counterVal}) +1`) - } - .onClick(() => this.counterVal += 1) - } -} - -@Component -struct ChildB { - @Link counterRef: number; - build() { - Button() { - Text(`ChildB: (${this.counterRef}) +1`) - } - .onClick(() => this.counterRef += 1) - } -} \ No newline at end of file diff --git a/compiler/compiler/sample/pages/testcases/linkSimpleModel.ets b/compiler/compiler/sample/pages/testcases/linkSimpleModel.ets deleted file mode 100644 index 4f2947eb8..000000000 --- a/compiler/compiler/sample/pages/testcases/linkSimpleModel.ets +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - - -@Component -@Entry -struct Player { - @State isPlaying: boolean = false - build() { - Column() { - PlayButton({ buttonPlaying: $isPlaying }) - Text(`Player is ${this.isPlaying? '':'not'} playing`) - } - } -} - -@Component -struct PlayButton { - @Link buttonPlaying: boolean - build() { - Column() { - Button() { - Image(this.buttonPlaying? "play.png": "pause.png") - }.onClick(() => { - this.buttonPlaying = !this.buttonPlaying - }) - } - } -} diff --git a/compiler/compiler/sample/pages/testcases/new-01.ets b/compiler/compiler/sample/pages/testcases/new-01.ets deleted file mode 100644 index 7f6c51a5c..000000000 --- a/compiler/compiler/sample/pages/testcases/new-01.ets +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - - -@Component -@Entry -struct MyComponent3 { - private value1: string = "hello world 1" - private value2: string = "hello world 2" - private value3: string = "hello world 3" - - build() { - Column() { - Text(this.value1) - Text(this.value2) - Text(this.value3) - } - } -} \ No newline at end of file diff --git a/compiler/compiler/sample/pages/testcases/new-0101.ets b/compiler/compiler/sample/pages/testcases/new-0101.ets deleted file mode 100644 index 7f6c51a5c..000000000 --- a/compiler/compiler/sample/pages/testcases/new-0101.ets +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - - -@Component -@Entry -struct MyComponent3 { - private value1: string = "hello world 1" - private value2: string = "hello world 2" - private value3: string = "hello world 3" - - build() { - Column() { - Text(this.value1) - Text(this.value2) - Text(this.value3) - } - } -} \ No newline at end of file diff --git a/compiler/compiler/sample/pages/testcases/new-02.ets b/compiler/compiler/sample/pages/testcases/new-02.ets deleted file mode 100644 index d60117669..000000000 --- a/compiler/compiler/sample/pages/testcases/new-02.ets +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - -@Component -@Entry -struct MyComponent4 { - private value1: string = "hello world 1" - private value2: string = "hello world 2" - private value3: string = "hello world 3" - - build() { - new Column() { - new Text(this.value1) - Text(this.value2) - Text(this.value3) - } - } -} \ No newline at end of file diff --git a/compiler/compiler/sample/pages/testcases/new-03.ets b/compiler/compiler/sample/pages/testcases/new-03.ets deleted file mode 100644 index de28fd142..000000000 --- a/compiler/compiler/sample/pages/testcases/new-03.ets +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - -@Component -struct Banner { - private value1: string = "hello world 2"; - - build() { - Column() { - Text(this.value1); - } - } -} - -@Component -@Entry -struct MyComponent5 { - private value1: string = "hello world 1" - - build() { - Column() { - Text(this.value1) - Banner() - } - } -} \ No newline at end of file diff --git a/compiler/compiler/sample/pages/testcases/new-04.ets b/compiler/compiler/sample/pages/testcases/new-04.ets deleted file mode 100644 index b8f1c7ecb..000000000 --- a/compiler/compiler/sample/pages/testcases/new-04.ets +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - - -@Component -struct Banner { - private value1: string = "hello world 2"; - - build() { - Column() { - Text(this.value1); - } - } -} - -@Component -@Entry -struct MyComponent6 { - private value1: string = "hello world 1" - - build() { - Column() { - Text(this.value1) - new Banner() - } - } -} \ No newline at end of file diff --git a/compiler/compiler/sample/pages/testcases/onclicktest.ets b/compiler/compiler/sample/pages/testcases/onclicktest.ets deleted file mode 100644 index 305ff1e58..000000000 --- a/compiler/compiler/sample/pages/testcases/onclicktest.ets +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - -@Entry -@Component -struct TestView1 { - - @State - clicked:number = 0; - - onClicked() { - this.clicked = this.clicked + 1; - } - - build() { - Column(){ - Text("Clicked: " + this.onClicked) - Image("pages/pictures/0.jpeg") - .width(800).height(400).margin(50) - .onClick(this.onClicked.bind(this)) - Text("Test text\ntest text") - .onClick(this.onClicked.bind(this)) - Row(){ - Text("test") - Text("test") - Text("test") - } - .onClick(this.onClicked.bind(this)) - Stack(){ - Image("pages/pictures/0.jpeg") - Text("Test text") - } - .onClick(this.onClicked.bind(this)) - Column(){ - Text("test") - Text("test") - Text("test") - } - .onClick(this.onClicked.bind(this)) - } - .alignItems(HorizontalAlign.Center) - } // render -} diff --git a/compiler/compiler/sample/pages/testcases/propSimpleModel.ets b/compiler/compiler/sample/pages/testcases/propSimpleModel.ets deleted file mode 100644 index 6d7b371b0..000000000 --- a/compiler/compiler/sample/pages/testcases/propSimpleModel.ets +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - -@Component -@Entry -struct ParentComponent { - @State countDownStartValue: number = 10; // 10 Nuggets default start value in a Game - build() { - Column() { - Text(`Grant ${this.countDownStartValue} nuggets to play.`) - Button() { - Text("+1 - Nuggets in New Game") - }.onClick(() => { - this.countDownStartValue += 1 - }) - Button() { - Text("-1 - Nuggets in New Game") - }.onClick(() => { - this.countDownStartValue -= 1 - }) - - // when creatng ChildComponent, the initial value of its @Prop variable must be supplied in a named constructor parameter - // also regular costOfOneAttempt (non-Prop) variable is initialied - CountDownComponent({ count: this.countDownStartValue, costOfOneAttempt: 2 }) - } - } -} - -@Component -struct CountDownComponent { - - @Prop count: number - costOfOneAttempt?: number - - build() { - Column() { - if (this.count> 0) { - Text(`You have ${this.count} Nuggets left`) - } else { - Text("Game over!"); - } - - Button() { - Text("Try again") - }.onClick(() => { - this.count -= this.costOfOneAttempt; - }) - } - } -} diff --git a/compiler/compiler/sample/pages/testcases/showcaseCovid19.ets b/compiler/compiler/sample/pages/testcases/showcaseCovid19.ets deleted file mode 100644 index 14a8a57a8..000000000 --- a/compiler/compiler/sample/pages/testcases/showcaseCovid19.ets +++ /dev/null @@ -1,3577 +0,0 @@ - - -/** - * COVID Showcase App - * - * Made for the purpose of comparing ACE-Diff with ACE-JSF. - * Read the README.md file in the same directory for build instructions - * - * ACE @ Web Helsinki - * - - */ - - /* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - - - -const enum FlexAlign { - AUTO, - - // align to the start of the axis, can be both used in MainAxisAlign and CrossAxisAlign. - FLEX_START, - - // align to the center of the axis, can be both used in MainAxisAlign and CrossAxisAlign. - CENTER, - - // align to the end of the axis, can be both used in MainAxisAlign and CrossAxisAlign. - FLEX_END, - - // stretch the cross size, only used in CrossAxisAlign. - STRETCH, - - // adjust the cross position according to the textBaseline, only used in CrossAxisAlign. - BASELINE, - - // align the children on both ends, only used in MainAxisAlign. - SPACE_BETWEEN, - - // align the child with equivalent space, only used in MainAxisAlign. - SPACE_AROUND -} - -const enum TextOverflow { - CLIP, - ELLIPSIS, - NONE, -} - -class MonthData { - month: number = 0; - new_cases: number = 0; - incidence: number = 0; - new_dead: number = 0; - incidence_dead: number = 0; - - constructor(month: number, new_cases: number, incidence: number, new_dead: number, incidence_dead: number) { - this.month = month; - this.new_cases = new_cases; - this.incidence = incidence; - this.new_dead = new_dead; - this.incidence_dead = incidence_dead; - } -} - -class MonthVM { - data: MonthData = undefined; - dirLabel: string = ''; - dirColor: string = ''; - constructor(data: MonthData, dirLabel: string, dirColor: string) { - this.data = data; - this.dirLabel = dirLabel; - this.dirColor = dirColor; - } -} - -class CountryTrendVM { - id: number = 0; - height: number = 0; - color: string = ''; - isVisible: boolean = false; - constructor(id: number, height: number, color: string, isVisible: boolean) { - this.id = id; - this.height = height; - this.color = color; - this.isVisible = isVisible; - } -} - - -// non-mutaitng Model holding basic data about a country -// no need to observe instances -class CountryData { - name: string = ''; - continent: string = ''; - alpha2: string = ''; - population: number = 0; - months: Array = undefined; - maxCases: number = 0; - - constructor(name: string, - continent: string, - alpha2: string, - population: number, - maxCases: number, - months: Array) { - this.name = name; - this.continent = continent; - this.alpha2 = alpha2; - this.population = population; - this.maxCases = maxCases; - this.months = months; - } - - compareName(c2: CountryData): number { - return (this.name == c2.name) ? 0 : (this.name < c2.name) ? -1 : 1; - // FXXME V8 ICU issue workaround, do not use: return this.name.localeCompare(c2.name); - } -} - -// mutating part of Country model -// needs to be wrapped by an Observable -class CountryVM { - show: boolean = false; - data: CountryData = undefined; - - constructor(show: boolean, data: CountryData) { - this.show = show; - this.data = data; - } -} - -// singleton, mutating object about how to vide countries -class CountriesPresentation { - // first country to show in View - firstCountry_: number = 0; - - // sorting by country name: +1: A..Z; -1: Z..A - countriesSortDirection: number = 0; - - // total number of countries in VM, i.e. after filtering - countriesN: number = 0; - - static readonly TOTAL_COUNTRIES = 183;// change when data set updated - static readonly SHOW_COUNTRIES = 25; - static readonly SHIFT_BY = 18; - - static readonly N_REGULAR_FONT_SIZE = 18; - static readonly REGULAR_FONT_SIZE = CountriesPresentation.N_REGULAR_FONT_SIZE + 'px'; - - constructor() { - this.firstCountry_ = 0; - this.countriesSortDirection = 1; // A..Z order - this.countriesN = CountriesPresentation.TOTAL_COUNTRIES; - } - - firstCountry(): number { - return this.firstCountry_; - } - - lastCountry(): number { - return this.firstCountry_ + CountriesPresentation.SHOW_COUNTRIES; - } - // shift visible countries by - shiftBy(byCount: number): void { - this.firstCountry_ = Math.max(0, - Math.min(this.firstCountry_ + byCount, - this.countriesN - CountriesPresentation.SHOW_COUNTRIES) - ); - console.log(`shiftCountries this.firstCountry=${this.firstCountry}`); - } - - // after applying filters reset firstCountry and sorting direction, - // and recalc number of to be shown countries - resetByFilters(countriesData: any): void { - this.countriesN = countriesData.filter((c) => c.show).length; - this.firstCountry_ = 0; - this.countriesSortDirection = 1 - console.log(`CountriesPresentation: setCountriesN(${this.countriesN}) `); - } - - // reverse sorting direction of visible countries - reverseDirection(): void { - this.countriesSortDirection *= -1; - } -} - - -// similar to CountryPresentation, singleton mutating object about how to present -// months' data of each country -class MonthsPresentation { - firstMonth_: number = 8; - - constructor() { - this.firstMonth_ = 8; - } - - firstMonth(): number { - return this.firstMonth_; - } - lastMonth(): number { - return this.firstMonth_ + 2; - } - - shiftBy(byCount) { - this.firstMonth_ = Math.max(0, Math.min(this.firstMonth_ + byCount, 8)); - console.log(`shiftMonths this.firstMonth=${this.firstMonth_}`); - } -} - -var initCountriesData = function (): Array { - var result = new Array(); - APP_DATA.forEach((country: any) => { - let countryVM = new CountryVM( - /*show */ true, - new CountryData(country.name, country.continent, country.alpha2, country.population, country.maxCases, country.months) - ); - result.push(countryVM); - }); - console.log(`initCountriesData: result.length ${result.length}`); - return result; -} - - -// -------------------- PageView ------------------------------------------------------------ - -@Entry -@Component -struct PageView { - - @State showFilters: boolean = false; - @State countriesPresentation: CountriesPresentation = new CountriesPresentation(); - @State monthsPresentation: MonthsPresentation = new MonthsPresentation(); - - countriesData: Array = initCountriesData(); - - /* - constructor(id: string, parent: View, params: { countriesData: Array }) { - super(id, parent); - console.log(`Create PageView`); - - // Properties 'firstCountry', 'countriesSortDirection', 'firstMonth' only - // change in this View when also 'showFilters' changes. - // same applies to countriesData - // Hence, we do not need to make countriesPresentation and monthsPresentation - // a @State variable - this.setInitialObjectState({ - showFilters: false, - countriesPresentation: new CountriesPresentation(), - monthsPresentation: new MonthsPresentation(), - countriesData: [] - }); - - this.updateObjectState(params); - - this.createState("showFilters"); - this.createState("countriesPresentation"); - this.createState("monthsPresentation"); - - this.____is_initialized___ = true; - } - -render(): ViewAbstract { - console.log(`Render PageView`); - // if ... {} else {} - return this.showFilters ? new Column( - new FiltersView("FiltersView", this, { countriesVM: this.countriesData }), - new Row( - new Button("Apply Filters").onClick(() => this.onApplyFiltersPressed()) - .height('50px') - .width('300px'), - new Button("Dump MemInfo").onClick(() => { - dumpMemoryStats("FiltersView visile"); - }).width('300px') - ) - ).setUniqueKey("Filters") - : new Column( - new Row( - new Button("Show Filters") - .onClick(() => this.showFilters = true).width('300px'), - new Button("Dump MemInfo") - .onClick(() => { - dumpMemoryStats("StatsView visible"); - }).width('300px'), - ), - new StatsView("StatsView", this, { - countriesData: this.countriesData, - countriesPresentation: createLinkReference(this, "countriesPresentation"), - monthsPresentation: createLinkReference(this, "monthsPresentation") - }).setUniqueKey("StatsView") - ).setUniqueKey("Stats") - } - */ - - onApplyFiltersPressed(): void { - this.showFilters = false; - this.countriesPresentation.resetByFilters(this.countriesData); - this.monthsPresentation.firstMonth_ = 8; - } - - build() { - Column() { - if (this.showFilters) { - Column() { - FiltersView({ countriesVM: this.countriesData }) - Row() { - Button("Apply Filters").onClick(() => { this.onApplyFiltersPressed() } ).height('50px').width('300px') - Button("Dump MemInfo").onClick(() => { dumpMemoryStats("FiltersView visile") }).width('300px') - }.wrapContent() - }.wrapContent() - } else { - Column() { - Row() { - Button("Show Filters") - .width('300px') - .onClick(() => { this.showFilters = true } ) - Button("Dump MemInfo") - .width('300px') - .onClick(() => { dumpMemoryStats("StatsView visible") }) - }.wrapContent() - StatsView({countriesData: this.countriesData, countriesPresentation: $countriesPresentation, monthsPresentation: $monthsPresentation}) - .setUniqueKey("StatsView") - }.wrapContent() - } - }.wrapContent().setUniqueKey("Page") - } -} - - -// -------------------- StatsView ------------------------------------------------------------ - -@Component -struct StatsView { - - // just a regular class variable - countriesData: Array; - - @Link countriesPresentation: CountriesPresentation; - - @Link monthsPresentation: MonthsPresentation; - - /* - constructor(id: string, parent: PageView, - params: { - countriesData: Array, - countriesPresentation: LinkReference, - monthsPresentation: LinkReference - }) { - super(id, parent); - console.log(`Create StatsView`); - - this.setInitialObjectState({ countriesData: [] }) - this.updateObjectState(params); - - this.createLink("countriesPresentation"); - this.createLink("monthsPresentation"); - - this.____is_initialized___ = true; - } - - render(): Flex { - console.log(`Render StatsView`); - return new Column( - new StatsViewHeading("160", this, - { monthsPresentation: createLinkReference(this, "monthsPresentation") }) - .setUniqueKey("Heading"), // all children of Column have unique keys - - new ForEach("161", this, - this.countriesVM(), - (country: CountryVM) => new CountryStatsView("140", this, - { countryData: country, monthsPresentation: createLinkReference(this, "monthsPresentation") }), - (country: CountryVM) => country.data.alpha2 - ).setUniqueKey("Countries"), - new Row( - new Button("Prev").onClick(() => this.countriesPresentation.shiftBy(-CountriesPresentation.SHIFT_BY)).setUniqueKey("Prev"), - new Button("Next").onClick(() => this.countriesPresentation.shiftBy(CountriesPresentation.SHIFT_BY)).setUniqueKey("Next"), - new Button(this.countriesPresentation.countriesSortDirection > 0 ? "Z..A" : "A..Z").onClick(() => this.countriesPresentation.reverseDirection()).setUniqueKey("Sort"), - new Button("Earier").onClick(() => this.monthsPresentation.shiftBy(-1)).setUniqueKey("Earlier"), - new Button("Later").onClick(() => this.monthsPresentation.shiftBy(1)).setUniqueKey("Later"), - ).height('100px').setUniqueKey("Buttons_Row") // all children of Column have unique keys - ).wrapContent() - } - - */ - - build() { - Column() { - StatsViewHeading({ monthsPresentation: $monthsPresentation }).setUniqueKey("Heading") - CountriesStatsView({ countriesPresentation: $countriesPresentation, monthsPresentation: $monthsPresentation, countriesData: this.countriesData}).setUniqueKey("CSV") - Row() { - Button("Prev").onClick(() => { this.countriesPresentation.shiftBy(-CountriesPresentation.SHIFT_BY) } ).setUniqueKey("Prev") - Button("Next").onClick(() => { this.countriesPresentation.shiftBy(CountriesPresentation.SHIFT_BY) } ).setUniqueKey("Next") - Button(this.countriesPresentation.countriesSortDirection > 0 ? "Z..A" : "A..Z").onClick(() => { this.countriesPresentation.reverseDirection() } ).setUniqueKey("Sort") - Button("Earier").onClick(() => { this.monthsPresentation.shiftBy(-1) } ).setUniqueKey("Earlier") - Button("Later").onClick(() => { this.monthsPresentation.shiftBy(1) } ).setUniqueKey("Later") - }.height('100px').setUniqueKey("Buttons_Row") - }.wrapContent() - } -} - - - -@Component -struct StatsViewHeading { - - static monthsLabel: string[] = ["February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]; - - @Link monthsPresentation: MonthsPresentation; - - /* - constructor(id: string, parent: StatsView, params: { monthsPresentation: LinkReference }) { - super(id, parent); - console.log(`Create StatsViewHeading`); - - this.setInitialObjectState({}) - this.updateObjectState(params); - - this.createLink("monthsPresentation"); - - this.____is_initialized___ = true; - } - - render(): ViewAbstract { - return new Row( - new Text("Territory").fontSize(CountriesPresentation.REGULAR_FONT_SIZE).fontWeight("bold").width('222px').setUniqueKey("Territory"), // all children of Row need unique Key - new ForEach("171", this, - StatsViewHeading.monthsLabel.slice(this.monthsPresentation.firstMonth(), this.monthsPresentation.lastMonth()), - (month) => new Text(month).fontSize(CountriesPresentation.REGULAR_FONT_SIZE).fontWeight("bold").width('182px'), - (month) => month - ), - new Text("Trend").fontSize(CountriesPresentation.REGULAR_FONT_SIZE).fontWeight("bold").width('110px').setUniqueKey("Trend"), // all children of Row need unique Key - ).height('50px'); - } - */ - - build() { - Row() { - Text("Territory").fontSize(CountriesPresentation.REGULAR_FONT_SIZE).fontWeight("bold").width('222px').setUniqueKey("Territory") // all children of Row need unique Key - ForEach( - StatsViewHeading.monthsLabel.slice(this.monthsPresentation.firstMonth(), this.monthsPresentation.lastMonth()), - (month) => { Text(month).fontSize(CountriesPresentation.REGULAR_FONT_SIZE).fontWeight("bold").width('182px') }, - (month) => month - ) - Text("Trend").fontSize(CountriesPresentation.REGULAR_FONT_SIZE).fontWeight("bold").width('110px').setUniqueKey("Trend") // all children of Row need unique Key - }.height('50px') - } -} - - - -@Component -struct CountriesStatsView { - - @Link countriesPresentation: CountriesPresentation; - @Link monthsPresentation: MonthsPresentation; - countriesData: Array; - - filteredCountries(): Array { - var result = this.countriesData.filter((c) => c.show); - console.log("update filteredCountries, length: " + result.length); - return result; - } - - countriesVM(): Array { - console.log("update countriesVM, ..."); - var result = this.filteredCountries() - .slice(this.countriesPresentation.firstCountry(), this.countriesPresentation.lastCountry()) - .sort(function (c1: CountryVM, c2: CountryVM) { - return this.countriesPresentation.countriesSortDirection * c1.data.compareName(c2.data) - }.bind(this) - ); - - console.log("update countriesVM, length: " + result.length); - return result; - } - -// do not put curley brackets around the item gen function below, compiler will not generate needed return - build() { - Column() { - ForEach(this.countriesVM(), - (country) => CountryStatsView({ monthsPresentation: $monthsPresentation, countryData: country}), - (country) => country.data.alpha2 - ).setUniqueKey("ForEach") - }.wrapContent().setUniqueKey("ForEach_Col") - } -} - - -@Component -struct CountryStatsView { - - @State countryData: CountryVM = new CountryVM(false, undefined); // dummy init - @Link monthsPresentation: MonthsPresentation; - - /* - constructor(id: string, parent: StatsView, - params: { countryData: CountryVM, monthsPresentation: LinkReference }) { - super(id, parent); - console.log(`Create CountryStatsView`); - - // we need to init the @State countryData variable with a dummy - this.setInitialObjectState({ countryData: new CountryVM(false, undefined) }) - this.updateObjectState(params); - - // countryData is wrapped with an ObservableObject already - // createState will pick up the Obs.Object and have the View subscribe to it. - this.createState("countryData"); - this.createLink("monthsPresentation"); - - this.____is_initialized___ = true; - console.log(`Create CountryStatsView of ${this.countryData.data.name}`); - } -*/ - - build() { - Row() { - Image(`pictures/diff/flags/${this.countryData.data.alpha2}.png`).width('32px').height('32px').marginRight('5px').setUniqueKey("Country_Flag") - Row() { - Text(this.countryData.data.name).fontSize(CountriesPresentation.REGULAR_FONT_SIZE).textOverflow(TextOverflow.Ellipsis).maxLines(1) - }.justifyContent(FlexAlign.start).width('190px').height('50px').setUniqueKey("Country_Name") - CountryMonthsStatView({ countryData: $countryData, monthsPresentation: $monthsPresentation }).setUniqueKey("CountryMonthsStatView") - CountryTrendView({ countryData: $countryData, monthsPresentation: $monthsPresentation }).setUniqueKey("CountryTrendView") - }.alignItems(FlexAlign.start).justifyContent(FlexAlign.Center).wrapContent().height('50px') - } -} - -@Component -struct CountryMonthsStatView { - - @Link countryData: CountryVM; - @Link monthsPresentation: MonthsPresentation; - - areCasesRising(monthIndex: number): boolean { - const caseData: MonthData[] = this.countryData.data.months; - return ((monthIndex == 0) && (caseData[monthIndex] != undefined) && (caseData[monthIndex].new_cases > 0) || - ((caseData[monthIndex - 1] != undefined) && (caseData[monthIndex] != undefined) && (caseData[monthIndex].new_cases > caseData[monthIndex - 1].new_cases))); - } - - areCasesDeclining(monthIndex: number): boolean { - const caseData: MonthData[] = this.countryData.data.months; - return ((monthIndex > 0) && (caseData[monthIndex] != undefined) && (caseData[monthIndex - 1] != undefined) && (caseData[monthIndex].new_cases < caseData[monthIndex - 1].new_cases)); - } - - /* - constructor(id: string, parent: CountryStatsView, params: { countryData: LinkReference, monthsPresentation: LinkReference }) { - super(id, parent); - console.log(`Create CountryMonthsStatView`); - - this.setInitialObjectState({}) - this.updateObjectState(params); - - this.createLink("countryData"); - this.createLink("monthsPresentation"); - - this.____is_initialized___ = true; - console.log(`Create CountryMonthsStatView of ${this.countryData.data.name}`); - } -*/ - - calcVM(): Array { - console.log(`Render CountryMonthsStatView of ${this.countryData.data.name}`); - var vm: MonthVM[] = []; - for (var monthsIndex = this.monthsPresentation.firstMonth(); monthsIndex < this.monthsPresentation.lastMonth(); monthsIndex++) { - vm.push(new MonthVM( - this.countryData.data.months[monthsIndex], - this.areCasesDeclining(monthsIndex) ? "▼" : this.areCasesRising(monthsIndex) ? "▲" : "►", - this.areCasesDeclining(monthsIndex) ? "#228B22" : this.areCasesRising(monthsIndex) ? "#ff4500" : "#000000", - )); - } - return vm; - } - - build() { - Row() { - ForEach(this.calcVM(), - (month) => { - Row() { - Row() { - Text(month.data.new_cases.toString()) - } - .justifyContent(FlexAlign.end).width('110px').height('50px') - Text(month.dirLabel) - .color(month.dirColor) - .fontSize(CountriesPresentation.REGULAR_FONT_SIZE) - .height('50px').width('18px') - Row() { - Text(month.data.incidence.toString()) - .fontSize(CountriesPresentation.REGULAR_FONT_SIZE) - .color(CountryTrendView.calcBarColor(month.data.incidence)) - } - .justifyContent(FlexAlign.end).width('70px').height('50px') - } - .width((110 + 70) + 'px').height('50px') - }, - (month) => month.data.month.toString() - ) - } - .wrapContent().width((2 * (110 + 90)) + 'px').height('50px') - } -} - - -@Component -struct CountryTrendView { - - @Link countryData: CountryVM; - @Link monthsPresentation: MonthsPresentation; - - /* - constructor(id: string, parent: CountryStatsView, params: { countryData: LinkReference, monthsPresentation: LinkReference }) { - super(id, parent); - - console.log(`Create CountryTrendView`); - - this.setInitialObjectState({}) - this.updateObjectState(params); - - this.createLink("countryData"); - this.createLink("monthsPresentation"); - - this.____is_initialized___ = true; - console.log(`Create CountryTrendView of ${this.countryData.data.name}`); - } -*/ - - calcBarHeight(monthCases: number): number { - let result = (this.countryData.data.maxCases == 0) ? 1 : 1 + (39 * monthCases / this.countryData.data.maxCases); - console.log(`bar height ${result} maxCases ${this.countryData.data.maxCases}`); - return result; - } - - static calcBarColor(incidence: number): string { - return (incidence >= 500) ? "#a52729" : (incidence >= 250) ? "#7e2e1f" : (incidence >= 100) ? "#98503C" : (incidence >= 50) ? "#a5714E" : (incidence >= 35) ? "#b99c6b" : "#d5c4a1"; - } - - calcVM(): Array { - console.log(`Render CountryTrendView of ${this.countryData.data.name} for ${this.countryData.data.months.length} months`); - const vm: CountryTrendVM[] = []; - for (var i = 0; i < this.countryData.data.months.length; i++) { - const isVisible: boolean = (this.monthsPresentation.firstMonth() <= i) && (i < this.monthsPresentation.lastMonth()); - vm.push(new CountryTrendVM( - this.countryData.data.months[i].month, - this.calcBarHeight(this.countryData.data.months[i].new_cases), - CountryTrendView.calcBarColor(this.countryData.data.months[i].incidence), - isVisible - )); - } - return vm; - } - - build() { - Row() { - ForEach(this.calcVM(), - (m) => { - Column() { - if (m.isVisible) { - Column() { - Column() { - /* emtry */ } - .height(Math.max(0, m.height - 2) + 'px') - .width('5px') - .backgroundColor(m.color) - Column() { - /* emtry */ } - .height('2px').width('5px').backgroundColor("#000000") - } // Column - .height(m.height).width('5px').marginRight('1px') - } else { - Column() { - /* emtry */ } - .height(m.height + 'px') - .width('5px') - .backgroundColor(m.color) - .marginRight('1px') - } // else - }.wrapContent().height(m.height + 'px') - }, // ForEach item gen func - (m) => m.id // ForEach id gen func - ) // ForEach - } // Row - .wrapContent().alignItems(FlexAlign.end).height('50px').width('60px').marginLeft('10px') - } -} - - - - -// -------------------- FiltersView ------------------------------------------------------------ - -@Component -struct FiltersView { - - // @State hack against mising @Observed / observableObject for all ContryVM instances - @State countryHasChanged: boolean = false; - - // regular parameter - countriesVM: Array = []; - - static CONTINENTS = ["Asia", "Europe", "Africa", "North America", "South America", "Oceania"]; - - /* constructor(id: string, parent: PageView, params: { countriesVM: Array }) { - super(id, parent); - console.log(`Create FiltersView`); - - this.setInitialObjectState({ countriesVM: [] }) - this.updateObjectState(params); - this.createState("countryHasChanged") - this.____is_initialized___ = true; - } - */ - - getCovidDataByContinent(ct: string): Array < CountryVM > { - let result = this.countriesVM.filter((c: CountryVM) => c.data.continent == ct); - console.log(`getCovidDataByContinent(${ct}) returns length ${result.length}`); - return result; - } - - toggleContinent(conti: string): void { - console.log(`toggleContinent ...${conti}`); - let data: Array < CountryVM > = this.getCovidDataByContinent(conti); - let newValue: boolean = (data.length > 0) ? !data[0].show : false; - data.forEach((c: CountryVM) => c.show = newValue); - - // FIXME: hack to make this vew render and take chnaged 'show' CountryVM instances into account - // this need @Observed CountryVM / createdObservableObject to work efficiently. - this.countryHasChanged = !this.countryHasChanged - } - - build() { - Column() { - ForEach( - FiltersView.CONTINENTS, - (conti) => { - Column() { - Button(conti) - .onClick(() => { this.toggleContinent(conti) } ) - .height('50px') - .width('400px') - .setUniqueKey("Button_" + conti) - ContinentFiltersView({ countriesVM: this.getCovidDataByContinent(conti) }).setUniqueKey("ContinentFiltersView_" + conti) // all children of Row need unique Key - }.wrapContent().setUniqueKey("ContinentFiltersView_row_" + conti) - }, - (conti) => conti - ) - }.wrapContent().width('740px'); - } -} - - -@Component -struct ContinentFiltersView { - // regular variable - countriesVM: Array = []; - - /* - constructor(id: string, parent: FiltersView, params: { countriesVM: Array }) { - super(id, parent); - this.setInitialObjectState({ countriesVM: [] }) - this.updateObjectState(params); - - console.log(`Create ContinentFiltersView for ${this.countriesVM.length} countries`); - this.____is_initialized___ = true; - } -*/ - - build() { - Row() { - ForEach( - this.countriesVM, - (country) => { - CountryFiltersView({ countryVM: country }) - }, - (country) => country.data.alpha2 - ) // ForEach - }.wrap(true).wrapContent() - } -} - - -@Component -struct CountryFiltersView { - @State countryVM: CountryVM = new CountryVM(true, undefined); - - /* - constructor(id: string, parent: ContinentFiltersView, params: { countryVM: CountryVM }) { - super(id, parent); - console.log(`Create CountryFiltersView ...`); - - this.setInitialObjectState({ countriesVM: [] }) - this.updateObjectState(params); - - // individdual countryVM is wrapped inside a ObservableObject alredy. - // createState will take it and register this View to the Obs.Object. - this.createState("countryVM"); - this.____is_initialized___ = true; - - console.log(`Create CountryFiltersView for ${this.countryVM.data.name}`); - } -*/ - - build() { - Row() { - // country flag - Image(`pictures/diff/flags/${this.countryVM.data.alpha2}.png`) - .width('32px').height('32px') - .marginTop('4px').marginBottom('4px').marginRight('10px') - - // country 2-letter code - Text(this.countryVM.data.alpha2) - .fontSize(CountriesPresentation.REGULAR_FONT_SIZE) - .fontWeight(this.countryVM.show ? 'bold' : 'normal').width('50px').height('40px') - }.wrapContent() - .width('90px').height('40px') - .backgroundColor(this.countryVM.show ? '#ffffff' : '#c0c0c0') - } -} - - -const APP_DATA = [ - { - "name": "Afghanistan", "continent": "Asia", "alpha2": "af", "population": 38928341, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 174, "incidence": 0, "new_dead": 3, "incidence_dead": 0 }, - { "month": 4, "new_cases": 1952, "incidence": 1, "new_dead": 60, "incidence_dead": 0 }, - { "month": 5, "new_cases": 13081, "incidence": 8, "new_dead": 194, "incidence_dead": 0.1 }, - { "month": 6, "new_cases": 16299, "incidence": 10, "new_dead": 494, "incidence_dead": 0.3 }, - { "month": 7, "new_cases": 5158, "incidence": 3, "new_dead": 532, "incidence_dead": 0.3 }, - { "month": 8, "new_cases": 1494, "incidence": 1, "new_dead": 119, "incidence_dead": 0.1 }, - { "month": 9, "new_cases": 1109, "incidence": 1, "new_dead": 57, "incidence_dead": 0 }, - { "month": 10, "new_cases": 2157, "incidence": 1, "new_dead": 78, "incidence_dead": 0.1 }, - { "month": 11, "new_cases": 4849, "incidence": 3, "new_dead": 257, "incidence_dead": 0.2 }, - ], - maxCases: 16299 - }, - { - "name": "Albania", "continent": "Europe", "alpha2": "al", "population": 2877800, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 241, "incidence": 2, "new_dead": 14, "incidence_dead": 0.1 }, - { "month": 4, "new_cases": 530, "incidence": 5, "new_dead": 16, "incidence_dead": 0.1 }, - { "month": 5, "new_cases": 364, "incidence": 3, "new_dead": 2, "incidence_dead": 0 }, - { "month": 6, "new_cases": 1398, "incidence": 12, "new_dead": 29, "incidence_dead": 0.3 }, - { "month": 7, "new_cases": 2741, "incidence": 24, "new_dead": 95, "incidence_dead": 0.8 }, - { "month": 8, "new_cases": 4237, "incidence": 37, "new_dead": 127, "incidence_dead": 1.1 }, - { "month": 9, "new_cases": 4136, "incidence": 36, "new_dead": 103, "incidence_dead": 0.9 }, - { "month": 10, "new_cases": 7226, "incidence": 63, "new_dead": 122, "incidence_dead": 1.1 }, - { "month": 11, "new_cases": 17307, "incidence": 150, "new_dead": 301, "incidence_dead": 2.6 }, - ], - maxCases: 17307 - }, - { - "name": "Algeria", "continent": "Africa", "alpha2": "dz", "population": 43851043, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 715, "incidence": 0, "new_dead": 43, "incidence_dead": 0 }, - { "month": 4, "new_cases": 3290, "incidence": 2, "new_dead": 406, "incidence_dead": 0.2 }, - { "month": 5, "new_cases": 5388, "incidence": 3, "new_dead": 203, "incidence_dead": 0.1 }, - { "month": 6, "new_cases": 4513, "incidence": 3, "new_dead": 259, "incidence_dead": 0.1 }, - { "month": 7, "new_cases": 16487, "incidence": 9, "new_dead": 298, "incidence_dead": 0.2 }, - { "month": 8, "new_cases": 14100, "incidence": 8, "new_dead": 300, "incidence_dead": 0.2 }, - { "month": 9, "new_cases": 7036, "incidence": 4, "new_dead": 226, "incidence_dead": 0.1 }, - { "month": 10, "new_cases": 6412, "incidence": 4, "new_dead": 228, "incidence_dead": 0.1 }, - { "month": 11, "new_cases": 25257, "incidence": 14, "new_dead": 467, "incidence_dead": 0.3 }, - ], - maxCases: 25257 - }, - { - "name": "Andorra", "continent": "Europe", "alpha2": "ad", "population": 77265, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 375, "incidence": 121, "new_dead": 11, "incidence_dead": 3.6 }, - { "month": 4, "new_cases": 369, "incidence": 119, "new_dead": 30, "incidence_dead": 9.7 }, - { "month": 5, "new_cases": 19, "incidence": 6, "new_dead": 9, "incidence_dead": 2.9 }, - { "month": 6, "new_cases": 91, "incidence": 29, "new_dead": 1, "incidence_dead": 0.3 }, - { "month": 7, "new_cases": 70, "incidence": 23, "new_dead": 0, "incidence_dead": 0 }, - { "month": 8, "new_cases": 251, "incidence": 81, "new_dead": 1, "incidence_dead": 0.3 }, - { "month": 9, "new_cases": 874, "incidence": 283, "new_dead": 0, "incidence_dead": 0 }, - { "month": 10, "new_cases": 2706, "incidence": 876, "new_dead": 22, "incidence_dead": 7.1 }, - { "month": 11, "new_cases": 1989, "incidence": 644, "new_dead": 1, "incidence_dead": 0.3 }, - ], - maxCases: 2706 - }, - { - "name": "Angola", "continent": "Africa", "alpha2": "ao", "population": 32866268, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 6, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 4, "new_cases": 20, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 5, "new_cases": 59, "incidence": 0, "new_dead": 2, "incidence_dead": 0 }, - { "month": 6, "new_cases": 198, "incidence": 0, "new_dead": 9, "incidence_dead": 0 }, - { "month": 7, "new_cases": 864, "incidence": 1, "new_dead": 39, "incidence_dead": 0 }, - { "month": 8, "new_cases": 1506, "incidence": 1, "new_dead": 56, "incidence_dead": 0 }, - { "month": 9, "new_cases": 2318, "incidence": 2, "new_dead": 75, "incidence_dead": 0.1 }, - { "month": 10, "new_cases": 5833, "incidence": 4, "new_dead": 101, "incidence_dead": 0.1 }, - { "month": 11, "new_cases": 4334, "incidence": 3, "new_dead": 64, "incidence_dead": 0 }, - ], - maxCases: 5833 - }, - { - "name": "Antigua and Barbuda", "continent": "North America", "alpha2": "ag", "population": 97928, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 6, "incidence": 2, "new_dead": 0, "incidence_dead": 0 }, - { "month": 4, "new_cases": 17, "incidence": 4, "new_dead": 2, "incidence_dead": 0.5 }, - { "month": 5, "new_cases": 2, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, - { "month": 6, "new_cases": 43, "incidence": 11, "new_dead": 0, "incidence_dead": 0 }, - { "month": 7, "new_cases": 22, "incidence": 6, "new_dead": 0, "incidence_dead": 0 }, - { "month": 8, "new_cases": 3, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, - { "month": 9, "new_cases": 7, "incidence": 2, "new_dead": 0, "incidence_dead": 0 }, - { "month": 10, "new_cases": 27, "incidence": 7, "new_dead": 0, "incidence_dead": 0 }, - { "month": 11, "new_cases": 13, "incidence": 3, "new_dead": 1, "incidence_dead": 0.3 }, - ], - maxCases: 43 - }, - { - "name": "Argentina", "continent": "South America", "alpha2": "ar", "population": 45195777, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 1053, "incidence": 1, "new_dead": 26, "incidence_dead": 0 }, - { "month": 4, "new_cases": 3374, "incidence": 2, "new_dead": 191, "incidence_dead": 0.1 }, - { "month": 5, "new_cases": 12423, "incidence": 7, "new_dead": 321, "incidence_dead": 0.2 }, - { "month": 6, "new_cases": 47679, "incidence": 26, "new_dead": 768, "incidence_dead": 0.4 }, - { "month": 7, "new_cases": 126772, "incidence": 70, "new_dead": 2236, "incidence_dead": 1.2 }, - { "month": 8, "new_cases": 226433, "incidence": 125, "new_dead": 5117, "incidence_dead": 2.8 }, - { "month": 9, "new_cases": 333266, "incidence": 184, "new_dead": 8277, "incidence_dead": 4.6 }, - { "month": 10, "new_cases": 415923, "incidence": 230, "new_dead": 14065, "incidence_dead": 7.8 }, - { "month": 11, "new_cases": 257609, "incidence": 142, "new_dead": 7728, "incidence_dead": 4.3 }, - ], - maxCases: 415923 - }, - { - "name": "Armenia", "continent": "Asia", "alpha2": "am", "population": 2963234, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 531, "incidence": 4, "new_dead": 2, "incidence_dead": 0 }, - { "month": 4, "new_cases": 1534, "incidence": 13, "new_dead": 29, "incidence_dead": 0.2 }, - { "month": 5, "new_cases": 7216, "incidence": 61, "new_dead": 99, "incidence_dead": 0.8 }, - { "month": 6, "new_cases": 16260, "incidence": 137, "new_dead": 312, "incidence_dead": 2.6 }, - { "month": 7, "new_cases": 13008, "incidence": 110, "new_dead": 295, "incidence_dead": 2.5 }, - { "month": 8, "new_cases": 5231, "incidence": 44, "new_dead": 141, "incidence_dead": 1.2 }, - { "month": 9, "new_cases": 6578, "incidence": 55, "new_dead": 80, "incidence_dead": 0.7 }, - { "month": 10, "new_cases": 39454, "incidence": 333, "new_dead": 382, "incidence_dead": 3.2 }, - { "month": 11, "new_cases": 45311, "incidence": 382, "new_dead": 823, "incidence_dead": 6.9 }, - ], - maxCases: 45311 - }, - { - "name": "Australia", "continent": "Oceania", "alpha2": "au", "population": 25499881, "months": [ - { "month": 2, "new_cases": 16, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 4534, "incidence": 4, "new_dead": 17, "incidence_dead": 0 }, - { "month": 4, "new_cases": 2207, "incidence": 2, "new_dead": 75, "incidence_dead": 0.1 }, - { "month": 5, "new_cases": 436, "incidence": 0, "new_dead": 10, "incidence_dead": 0 }, - { "month": 6, "new_cases": 718, "incidence": 1, "new_dead": 1, "incidence_dead": 0 }, - { "month": 7, "new_cases": 9360, "incidence": 9, "new_dead": 97, "incidence_dead": 0.1 }, - { "month": 8, "new_cases": 8539, "incidence": 8, "new_dead": 456, "incidence_dead": 0.4 }, - { "month": 9, "new_cases": 1277, "incidence": 1, "new_dead": 231, "incidence_dead": 0.2 }, - { "month": 10, "new_cases": 499, "incidence": 0, "new_dead": 19, "incidence_dead": 0 }, - { "month": 11, "new_cases": 317, "incidence": 0, "new_dead": 1, "incidence_dead": 0 }, - ], - maxCases: 9360 - }, - { - "name": "Austria", "continent": "Europe", "alpha2": "at", "population": 9006400, "months": [ - { "month": 2, "new_cases": 7, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 10171, "incidence": 28, "new_dead": 127, "incidence_dead": 0.4 }, - { "month": 4, "new_cases": 5272, "incidence": 15, "new_dead": 456, "incidence_dead": 1.3 }, - { "month": 5, "new_cases": 1279, "incidence": 4, "new_dead": 84, "incidence_dead": 0.2 }, - { "month": 6, "new_cases": 1035, "incidence": 3, "new_dead": 37, "incidence_dead": 0.1 }, - { "month": 7, "new_cases": 3364, "incidence": 9, "new_dead": 13, "incidence_dead": 0 }, - { "month": 8, "new_cases": 6308, "incidence": 18, "new_dead": 15, "incidence_dead": 0 }, - { "month": 9, "new_cases": 17375, "incidence": 48, "new_dead": 66, "incidence_dead": 0.2 }, - { "month": 10, "new_cases": 60112, "incidence": 167, "new_dead": 310, "incidence_dead": 0.9 }, - { "month": 11, "new_cases": 177531, "incidence": 493, "new_dead": 2075, "incidence_dead": 5.8 }, - ], - maxCases: 177531 - }, - { - "name": "Azerbaijan", "continent": "Asia", "alpha2": "az", "population": 10139175, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 295, "incidence": 1, "new_dead": 4, "incidence_dead": 0 }, - { "month": 4, "new_cases": 1506, "incidence": 4, "new_dead": 19, "incidence_dead": 0 }, - { "month": 5, "new_cases": 3690, "incidence": 9, "new_dead": 39, "incidence_dead": 0.1 }, - { "month": 6, "new_cases": 12030, "incidence": 30, "new_dead": 150, "incidence_dead": 0.4 }, - { "month": 7, "new_cases": 14354, "incidence": 35, "new_dead": 235, "incidence_dead": 0.6 }, - { "month": 8, "new_cases": 4557, "incidence": 11, "new_dead": 86, "incidence_dead": 0.2 }, - { "month": 9, "new_cases": 3794, "incidence": 9, "new_dead": 57, "incidence_dead": 0.1 }, - { "month": 10, "new_cases": 15040, "incidence": 37, "new_dead": 139, "incidence_dead": 0.3 }, - { "month": 11, "new_cases": 65907, "incidence": 163, "new_dead": 662, "incidence_dead": 1.6 }, - ], - maxCases: 65907 - }, - { - "name": "Bahamas", "continent": "North America", "alpha2": "bs", "population": 393248, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 13, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, - { "month": 4, "new_cases": 67, "incidence": 4, "new_dead": 10, "incidence_dead": 0.6 }, - { "month": 5, "new_cases": 21, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, - { "month": 6, "new_cases": 2, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 7, "new_cases": 470, "incidence": 30, "new_dead": 3, "incidence_dead": 0.2 }, - { "month": 8, "new_cases": 1643, "incidence": 104, "new_dead": 36, "incidence_dead": 2.3 }, - { "month": 9, "new_cases": 1906, "incidence": 121, "new_dead": 46, "incidence_dead": 2.9 }, - { "month": 10, "new_cases": 2591, "incidence": 165, "new_dead": 48, "incidence_dead": 3.1 }, - { "month": 11, "new_cases": 827, "incidence": 53, "new_dead": 19, "incidence_dead": 1.2 }, - ], - maxCases: 2591 - }, - { - "name": "Bahrain", "continent": "Asia", "alpha2": "bh", "population": 1701583, "months": [ - { "month": 2, "new_cases": 40, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 526, "incidence": 8, "new_dead": 3, "incidence_dead": 0 }, - { "month": 4, "new_cases": 2473, "incidence": 36, "new_dead": 4, "incidence_dead": 0.1 }, - { "month": 5, "new_cases": 8358, "incidence": 123, "new_dead": 11, "incidence_dead": 0.2 }, - { "month": 6, "new_cases": 15360, "incidence": 226, "new_dead": 68, "incidence_dead": 1 }, - { "month": 7, "new_cases": 14224, "incidence": 209, "new_dead": 60, "incidence_dead": 0.9 }, - { "month": 8, "new_cases": 10990, "incidence": 161, "new_dead": 43, "incidence_dead": 0.6 }, - { "month": 9, "new_cases": 18892, "incidence": 278, "new_dead": 61, "incidence_dead": 0.9 }, - { "month": 10, "new_cases": 10781, "incidence": 158, "new_dead": 70, "incidence_dead": 1 }, - { "month": 11, "new_cases": 5311, "incidence": 78, "new_dead": 20, "incidence_dead": 0.3 }, - ], - maxCases: 18892 - }, - { - "name": "Bangladesh", "continent": "Asia", "alpha2": "bd", "population": 164689383, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 48, "incidence": 0, "new_dead": 4, "incidence_dead": 0 }, - { "month": 4, "new_cases": 7616, "incidence": 1, "new_dead": 163, "incidence_dead": 0 }, - { "month": 5, "new_cases": 39486, "incidence": 6, "new_dead": 482, "incidence_dead": 0.1 }, - { "month": 6, "new_cases": 98330, "incidence": 15, "new_dead": 1197, "incidence_dead": 0.2 }, - { "month": 7, "new_cases": 92178, "incidence": 14, "new_dead": 1264, "incidence_dead": 0.2 }, - { "month": 8, "new_cases": 75335, "incidence": 11, "new_dead": 1170, "incidence_dead": 0.2 }, - { "month": 9, "new_cases": 50483, "incidence": 8, "new_dead": 970, "incidence_dead": 0.1 }, - { "month": 10, "new_cases": 44205, "incidence": 7, "new_dead": 672, "incidence_dead": 0.1 }, - { "month": 11, "new_cases": 57248, "incidence": 9, "new_dead": 721, "incidence_dead": 0.1 }, - ], - maxCases: 98330 - }, - { - "name": "Barbados", "continent": "North America", "alpha2": "bb", "population": 287371, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 32, "incidence": 3, "new_dead": 0, "incidence_dead": 0 }, - { "month": 4, "new_cases": 47, "incidence": 4, "new_dead": 6, "incidence_dead": 0.5 }, - { "month": 5, "new_cases": 11, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, - { "month": 6, "new_cases": 5, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 7, "new_cases": 13, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, - { "month": 8, "new_cases": 64, "incidence": 6, "new_dead": 0, "incidence_dead": 0 }, - { "month": 9, "new_cases": 16, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, - { "month": 10, "new_cases": 47, "incidence": 4, "new_dead": 0, "incidence_dead": 0 }, - { "month": 11, "new_cases": 39, "incidence": 3, "new_dead": 0, "incidence_dead": 0 }, - ], - maxCases: 64 - }, - { - "name": "Belarus", "continent": "Europe", "alpha2": "by", "population": 9449321, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 151, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 4, "new_cases": 13875, "incidence": 37, "new_dead": 88, "incidence_dead": 0.2 }, - { "month": 5, "new_cases": 28529, "incidence": 75, "new_dead": 146, "incidence_dead": 0.4 }, - { "month": 6, "new_cases": 19562, "incidence": 52, "new_dead": 157, "incidence_dead": 0.4 }, - { "month": 7, "new_cases": 5690, "incidence": 15, "new_dead": 167, "incidence_dead": 0.4 }, - { "month": 8, "new_cases": 4035, "incidence": 11, "new_dead": 122, "incidence_dead": 0.3 }, - { "month": 9, "new_cases": 6788, "incidence": 18, "new_dead": 152, "incidence_dead": 0.4 }, - { "month": 10, "new_cases": 19851, "incidence": 53, "new_dead": 147, "incidence_dead": 0.4 }, - { "month": 11, "new_cases": 38165, "incidence": 101, "new_dead": 178, "incidence_dead": 0.5 }, - ], - maxCases: 38165 - }, - { - "name": "Belgium", "continent": "Europe", "alpha2": "be", "population": 11589616, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 12774, "incidence": 28, "new_dead": 702, "incidence_dead": 1.5 }, - { "month": 4, "new_cases": 35744, "incidence": 77, "new_dead": 6889, "incidence_dead": 14.9 }, - { "month": 5, "new_cases": 9862, "incidence": 21, "new_dead": 1873, "incidence_dead": 4 }, - { "month": 6, "new_cases": 3046, "incidence": 7, "new_dead": 280, "incidence_dead": 0.6 }, - { "month": 7, "new_cases": 7324, "incidence": 16, "new_dead": 94, "incidence_dead": 0.2 }, - { "month": 8, "new_cases": 16485, "incidence": 36, "new_dead": 54, "incidence_dead": 0.1 }, - { "month": 9, "new_cases": 33216, "incidence": 72, "new_dead": 121, "incidence_dead": 0.3 }, - { "month": 10, "new_cases": 310777, "incidence": 670, "new_dead": 1609, "incidence_dead": 3.5 }, - { "month": 11, "new_cases": 148116, "incidence": 320, "new_dead": 5020, "incidence_dead": 10.8 }, - ], - maxCases: 310777 - }, - { - "name": "Belize", "continent": "North America", "alpha2": "bz", "population": 397621, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 2, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 4, "new_cases": 15, "incidence": 1, "new_dead": 1, "incidence_dead": 0.1 }, - { "month": 5, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 6, "new_cases": 6, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 7, "new_cases": 24, "incidence": 2, "new_dead": 0, "incidence_dead": 0 }, - { "month": 8, "new_cases": 959, "incidence": 60, "new_dead": 11, "incidence_dead": 0.7 }, - { "month": 9, "new_cases": 985, "incidence": 62, "new_dead": 14, "incidence_dead": 0.9 }, - { "month": 10, "new_cases": 1495, "incidence": 94, "new_dead": 32, "incidence_dead": 2 }, - { "month": 11, "new_cases": 2367, "incidence": 149, "new_dead": 89, "incidence_dead": 5.6 }, - ], - maxCases: 2367 - }, - { - "name": "Benin", "continent": "Africa", "alpha2": "bj", "population": 12123198, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 8, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 4, "new_cases": 55, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 5, "new_cases": 168, "incidence": 0, "new_dead": 2, "incidence_dead": 0 }, - { "month": 6, "new_cases": 967, "incidence": 2, "new_dead": 18, "incidence_dead": 0 }, - { "month": 7, "new_cases": 606, "incidence": 1, "new_dead": 15, "incidence_dead": 0 }, - { "month": 8, "new_cases": 340, "incidence": 1, "new_dead": 4, "incidence_dead": 0 }, - { "month": 9, "new_cases": 212, "incidence": 0, "new_dead": 1, "incidence_dead": 0 }, - { "month": 10, "new_cases": 286, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, - { "month": 11, "new_cases": 372, "incidence": 1, "new_dead": 2, "incidence_dead": 0 }, - ], - maxCases: 967 - }, - { - "name": "Bhutan", "continent": "Asia", "alpha2": "bt", "population": 771612, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 3, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 4, "new_cases": 3, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 5, "new_cases": 36, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, - { "month": 6, "new_cases": 34, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, - { "month": 7, "new_cases": 24, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, - { "month": 8, "new_cases": 124, "incidence": 4, "new_dead": 0, "incidence_dead": 0 }, - { "month": 9, "new_cases": 57, "incidence": 2, "new_dead": 0, "incidence_dead": 0 }, - { "month": 10, "new_cases": 67, "incidence": 2, "new_dead": 0, "incidence_dead": 0 }, - { "month": 11, "new_cases": 61, "incidence": 2, "new_dead": 0, "incidence_dead": 0 }, - ], - maxCases: 124 - }, - { - "name": "Bolivia", "continent": "South America", "alpha2": "bo", "population": 11673029, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 105, "incidence": 0, "new_dead": 5, "incidence_dead": 0 }, - { "month": 4, "new_cases": 1060, "incidence": 2, "new_dead": 56, "incidence_dead": 0.1 }, - { "month": 5, "new_cases": 8815, "incidence": 19, "new_dead": 251, "incidence_dead": 0.5 }, - { "month": 6, "new_cases": 23237, "incidence": 50, "new_dead": 810, "incidence_dead": 1.7 }, - { "month": 7, "new_cases": 43570, "incidence": 93, "new_dead": 1854, "incidence_dead": 4 }, - { "month": 8, "new_cases": 39809, "incidence": 85, "new_dead": 2050, "incidence_dead": 4.4 }, - { "month": 9, "new_cases": 18713, "incidence": 40, "new_dead": 2938, "incidence_dead": 6.3 }, - { "month": 10, "new_cases": 6446, "incidence": 14, "new_dead": 760, "incidence_dead": 1.6 }, - { "month": 11, "new_cases": 2951, "incidence": 6, "new_dead": 232, "incidence_dead": 0.5 }, - ], - maxCases: 43570 - }, - { - "name": "Bosnia and Herzegovina", "continent": "Europe", "alpha2": "ba", "population": 3280815, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 418, "incidence": 3, "new_dead": 12, "incidence_dead": 0.1 }, - { "month": 4, "new_cases": 1337, "incidence": 10, "new_dead": 56, "incidence_dead": 0.4 }, - { "month": 5, "new_cases": 753, "incidence": 6, "new_dead": 84, "incidence_dead": 0.6 }, - { "month": 6, "new_cases": 1943, "incidence": 15, "new_dead": 33, "incidence_dead": 0.3 }, - { "month": 7, "new_cases": 7423, "incidence": 57, "new_dead": 153, "incidence_dead": 1.2 }, - { "month": 8, "new_cases": 8088, "incidence": 62, "new_dead": 270, "incidence_dead": 2.1 }, - { "month": 9, "new_cases": 7505, "incidence": 57, "new_dead": 247, "incidence_dead": 1.9 }, - { "month": 10, "new_cases": 22621, "incidence": 172, "new_dead": 378, "incidence_dead": 2.9 }, - { "month": 11, "new_cases": 37811, "incidence": 288, "new_dead": 1447, "incidence_dead": 11 }, - ], - maxCases: 37811 - }, - { - "name": "Botswana", "continent": "Africa", "alpha2": "bw", "population": 2351625, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 1, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 4, "new_cases": 19, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 5, "new_cases": 12, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 6, "new_cases": 192, "incidence": 2, "new_dead": 0, "incidence_dead": 0 }, - { "month": 7, "new_cases": 577, "incidence": 6, "new_dead": 1, "incidence_dead": 0 }, - { "month": 8, "new_cases": 829, "incidence": 9, "new_dead": 4, "incidence_dead": 0 }, - { "month": 9, "new_cases": 1539, "incidence": 16, "new_dead": 10, "incidence_dead": 0.1 }, - { "month": 10, "new_cases": 3470, "incidence": 37, "new_dead": 8, "incidence_dead": 0.1 }, - { "month": 11, "new_cases": 4100, "incidence": 44, "new_dead": 10, "incidence_dead": 0.1 }, - ], - maxCases: 4100 - }, - { - "name": "Brazil", "continent": "South America", "alpha2": "br", "population": 212559409, "months": [ - { "month": 2, "new_cases": 1, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 5715, "incidence": 1, "new_dead": 200, "incidence_dead": 0 }, - { "month": 4, "new_cases": 81470, "incidence": 10, "new_dead": 5805, "incidence_dead": 0.7 }, - { "month": 5, "new_cases": 427662, "incidence": 50, "new_dead": 23308, "incidence_dead": 2.7 }, - { "month": 6, "new_cases": 887192, "incidence": 104, "new_dead": 30280, "incidence_dead": 3.6 }, - { "month": 7, "new_cases": 1260444, "incidence": 148, "new_dead": 32881, "incidence_dead": 3.9 }, - { "month": 8, "new_cases": 1245787, "incidence": 147, "new_dead": 28906, "incidence_dead": 3.4 }, - { "month": 9, "new_cases": 902663, "incidence": 106, "new_dead": 22571, "incidence_dead": 2.7 }, - { "month": 10, "new_cases": 724670, "incidence": 85, "new_dead": 15932, "incidence_dead": 1.9 }, - { "month": 11, "new_cases": 800273, "incidence": 94, "new_dead": 13236, "incidence_dead": 1.6 }, - ], - maxCases: 1260444 - }, - { - "name": "Brunei", "continent": "Asia", "alpha2": "bn", "population": 437483, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 128, "incidence": 7, "new_dead": 0, "incidence_dead": 0 }, - { "month": 4, "new_cases": 9, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, - { "month": 5, "new_cases": 3, "incidence": 0, "new_dead": 1, "incidence_dead": 0.1 }, - { "month": 6, "new_cases": 0, "incidence": 0, "new_dead": 1, "incidence_dead": 0.1 }, - { "month": 7, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 8, "new_cases": 3, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 9, "new_cases": 2, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 10, "new_cases": 2, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 11, "new_cases": 2, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - ], - maxCases: 128 - }, - { - "name": "Bulgaria", "continent": "Europe", "alpha2": "bg", "population": 6948445, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 395, "incidence": 1, "new_dead": 7, "incidence_dead": 0 }, - { "month": 4, "new_cases": 1107, "incidence": 4, "new_dead": 58, "incidence_dead": 0.2 }, - { "month": 5, "new_cases": 1007, "incidence": 4, "new_dead": 74, "incidence_dead": 0.3 }, - { "month": 6, "new_cases": 2476, "incidence": 9, "new_dead": 90, "incidence_dead": 0.3 }, - { "month": 7, "new_cases": 6701, "incidence": 24, "new_dead": 153, "incidence_dead": 0.6 }, - { "month": 8, "new_cases": 4576, "incidence": 16, "new_dead": 246, "incidence_dead": 0.9 }, - { "month": 9, "new_cases": 4567, "incidence": 16, "new_dead": 196, "incidence_dead": 0.7 }, - { "month": 10, "new_cases": 32011, "incidence": 115, "new_dead": 454, "incidence_dead": 1.6 }, - { "month": 11, "new_cases": 92456, "incidence": 333, "new_dead": 2756, "incidence_dead": 9.9 }, - ], - maxCases: 92456 - }, - { - "name": "Burkina Faso", "continent": "Africa", "alpha2": "bf", "population": 20903278, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 260, "incidence": 0, "new_dead": 13, "incidence_dead": 0 }, - { "month": 4, "new_cases": 384, "incidence": 0, "new_dead": 29, "incidence_dead": 0 }, - { "month": 5, "new_cases": 202, "incidence": 0, "new_dead": 10, "incidence_dead": 0 }, - { "month": 6, "new_cases": 115, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 7, "new_cases": 144, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 8, "new_cases": 262, "incidence": 0, "new_dead": 2, "incidence_dead": 0 }, - { "month": 9, "new_cases": 688, "incidence": 1, "new_dead": 3, "incidence_dead": 0 }, - { "month": 10, "new_cases": 444, "incidence": 1, "new_dead": 9, "incidence_dead": 0 }, - { "month": 11, "new_cases": 386, "incidence": 0, "new_dead": 1, "incidence_dead": 0 }, - ], - maxCases: 688 - }, - { - "name": "Burundi", "continent": "Africa", "alpha2": "bi", "population": 11890781, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 4, "new_cases": 9, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 5, "new_cases": 52, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 6, "new_cases": 107, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 7, "new_cases": 217, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 8, "new_cases": 58, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 9, "new_cases": 63, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 10, "new_cases": 77, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 11, "new_cases": 103, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - ], - maxCases: 217 - }, - { - "name": "Cambodia", "continent": "Asia", "alpha2": "kh", "population": 16718971, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 108, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 4, "new_cases": 13, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 5, "new_cases": 3, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 6, "new_cases": 16, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 7, "new_cases": 98, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 8, "new_cases": 35, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 9, "new_cases": 3, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 10, "new_cases": 14, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 11, "new_cases": 35, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - ], - maxCases: 108 - }, - { - "name": "Cameroon", "continent": "Africa", "alpha2": "cm", "population": 26545864, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 192, "incidence": 0, "new_dead": 5, "incidence_dead": 0 }, - { "month": 4, "new_cases": 1639, "incidence": 2, "new_dead": 55, "incidence_dead": 0.1 }, - { "month": 5, "new_cases": 4072, "incidence": 4, "new_dead": 130, "incidence_dead": 0.1 }, - { "month": 6, "new_cases": 6688, "incidence": 6, "new_dead": 122, "incidence_dead": 0.1 }, - { "month": 7, "new_cases": 4663, "incidence": 4, "new_dead": 78, "incidence_dead": 0.1 }, - { "month": 8, "new_cases": 1887, "incidence": 2, "new_dead": 20, "incidence_dead": 0 }, - { "month": 9, "new_cases": 1696, "incidence": 2, "new_dead": 7, "incidence_dead": 0 }, - { "month": 10, "new_cases": 955, "incidence": 1, "new_dead": 8, "incidence_dead": 0 }, - { "month": 11, "new_cases": 2652, "incidence": 2, "new_dead": 11, "incidence_dead": 0 }, - ], - maxCases: 6688 - }, - { - "name": "Canada", "continent": "North America", "alpha2": "ca", "population": 37742157, "months": [ - { "month": 2, "new_cases": 16, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 8507, "incidence": 6, "new_dead": 100, "incidence_dead": 0.1 }, - { "month": 4, "new_cases": 45930, "incidence": 30, "new_dead": 3209, "incidence_dead": 2.1 }, - { "month": 5, "new_cases": 38022, "incidence": 25, "new_dead": 4064, "incidence_dead": 2.7 }, - { "month": 6, "new_cases": 13618, "incidence": 9, "new_dead": 1276, "incidence_dead": 0.8 }, - { "month": 7, "new_cases": 12184, "incidence": 8, "new_dead": 330, "incidence_dead": 0.2 }, - { "month": 8, "new_cases": 12637, "incidence": 8, "new_dead": 193, "incidence_dead": 0.1 }, - { "month": 9, "new_cases": 30189, "incidence": 20, "new_dead": 173, "incidence_dead": 0.1 }, - { "month": 10, "new_cases": 76206, "incidence": 50, "new_dead": 841, "incidence_dead": 0.6 }, - { "month": 11, "new_cases": 144244, "incidence": 96, "new_dead": 1960, "incidence_dead": 1.3 }, - ], - maxCases: 144244 - }, - { - "name": "Cape Verde", "continent": "Africa", "alpha2": "cv", "population": 555988, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 5, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 4, "new_cases": 115, "incidence": 5, "new_dead": 0, "incidence_dead": 0 }, - { "month": 5, "new_cases": 314, "incidence": 14, "new_dead": 3, "incidence_dead": 0.1 }, - { "month": 6, "new_cases": 792, "incidence": 36, "new_dead": 11, "incidence_dead": 0.5 }, - { "month": 7, "new_cases": 1224, "incidence": 55, "new_dead": 8, "incidence_dead": 0.4 }, - { "month": 8, "new_cases": 1433, "incidence": 64, "new_dead": 17, "incidence_dead": 0.8 }, - { "month": 9, "new_cases": 2140, "incidence": 96, "new_dead": 20, "incidence_dead": 0.9 }, - { "month": 10, "new_cases": 2769, "incidence": 125, "new_dead": 35, "incidence_dead": 1.6 }, - { "month": 11, "new_cases": 1968, "incidence": 88, "new_dead": 10, "incidence_dead": 0.4 }, - ], - maxCases: 2769 - }, - { - "name": "Central African Republic", "continent": "Africa", "alpha2": "cf", "population": 4829764, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 2, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 4, "new_cases": 47, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 5, "new_cases": 961, "incidence": 5, "new_dead": 1, "incidence_dead": 0 }, - { "month": 6, "new_cases": 2734, "incidence": 14, "new_dead": 45, "incidence_dead": 0.2 }, - { "month": 7, "new_cases": 863, "incidence": 4, "new_dead": 12, "incidence_dead": 0.1 }, - { "month": 8, "new_cases": 103, "incidence": 1, "new_dead": 3, "incidence_dead": 0 }, - { "month": 9, "new_cases": 118, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, - { "month": 10, "new_cases": 37, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 11, "new_cases": 47, "incidence": 0, "new_dead": 1, "incidence_dead": 0 }, - ], - maxCases: 2734 - }, - { - "name": "Chad", "continent": "Africa", "alpha2": "td", "population": 16425859, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 6, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 4, "new_cases": 66, "incidence": 0, "new_dead": 3, "incidence_dead": 0 }, - { "month": 5, "new_cases": 705, "incidence": 1, "new_dead": 60, "incidence_dead": 0.1 }, - { "month": 6, "new_cases": 88, "incidence": 0, "new_dead": 9, "incidence_dead": 0 }, - { "month": 7, "new_cases": 70, "incidence": 0, "new_dead": 1, "incidence_dead": 0 }, - { "month": 8, "new_cases": 77, "incidence": 0, "new_dead": 2, "incidence_dead": 0 }, - { "month": 9, "new_cases": 187, "incidence": 0, "new_dead": 8, "incidence_dead": 0 }, - { "month": 10, "new_cases": 283, "incidence": 0, "new_dead": 13, "incidence_dead": 0 }, - { "month": 11, "new_cases": 205, "incidence": 0, "new_dead": 3, "incidence_dead": 0 }, - ], - maxCases: 705 - }, - { - "name": "Chile", "continent": "South America", "alpha2": "cl", "population": 19116209, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 2842, "incidence": 4, "new_dead": 11, "incidence_dead": 0 }, - { "month": 4, "new_cases": 14858, "incidence": 19, "new_dead": 215, "incidence_dead": 0.3 }, - { "month": 5, "new_cases": 105848, "incidence": 138, "new_dead": 827, "incidence_dead": 1.1 }, - { "month": 6, "new_cases": 155843, "incidence": 204, "new_dead": 4634, "incidence_dead": 6.1 }, - { "month": 7, "new_cases": 76274, "incidence": 100, "new_dead": 3769, "incidence_dead": 4.9 }, - { "month": 8, "new_cases": 56059, "incidence": 73, "new_dead": 1832, "incidence_dead": 2.4 }, - { "month": 9, "new_cases": 51265, "incidence": 67, "new_dead": 1452, "incidence_dead": 1.9 }, - { "month": 10, "new_cases": 47265, "incidence": 62, "new_dead": 1466, "incidence_dead": 1.9 }, - { "month": 11, "new_cases": 41487, "incidence": 54, "new_dead": 1203, "incidence_dead": 1.6 }, - ], - maxCases: 155843 - }, - { - "name": "China", "continent": "Asia", "alpha2": "cn", "population": 1439323774, "months": [ - { "month": 2, "new_cases": 69554, "incidence": 1, "new_dead": 2624, "incidence_dead": 0 }, - { "month": 3, "new_cases": 2923, "incidence": 0, "new_dead": 472, "incidence_dead": 0 }, - { "month": 4, "new_cases": 1677, "incidence": 0, "new_dead": 1328, "incidence_dead": 0 }, - { "month": 5, "new_cases": 190, "incidence": 0, "new_dead": 1, "incidence_dead": 0 }, - { "month": 6, "new_cases": 639, "incidence": 0, "new_dead": 3, "incidence_dead": 0 }, - { "month": 7, "new_cases": 2870, "incidence": 0, "new_dead": 20, "incidence_dead": 0 }, - { "month": 8, "new_cases": 2259, "incidence": 0, "new_dead": 62, "incidence_dead": 0 }, - { "month": 9, "new_cases": 631, "incidence": 0, "new_dead": 16, "incidence_dead": 0 }, - { "month": 10, "new_cases": 821, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 11, "new_cases": 1536, "incidence": 0, "new_dead": 4, "incidence_dead": 0 }, - ], - maxCases: 69554 - }, - { - "name": "Colombia", "continent": "South America", "alpha2": "co", "population": 50882884, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 905, "incidence": 0, "new_dead": 14, "incidence_dead": 0 }, - { "month": 4, "new_cases": 5601, "incidence": 3, "new_dead": 277, "incidence_dead": 0.1 }, - { "month": 5, "new_cases": 22876, "incidence": 11, "new_dead": 646, "incidence_dead": 0.3 }, - { "month": 6, "new_cases": 68463, "incidence": 34, "new_dead": 2395, "incidence_dead": 1.2 }, - { "month": 7, "new_cases": 197662, "incidence": 97, "new_dead": 6771, "incidence_dead": 3.3 }, - { "month": 8, "new_cases": 319586, "incidence": 157, "new_dead": 9557, "incidence_dead": 4.7 }, - { "month": 9, "new_cases": 214585, "incidence": 105, "new_dead": 6336, "incidence_dead": 3.1 }, - { "month": 10, "new_cases": 244505, "incidence": 120, "new_dead": 5316, "incidence_dead": 2.6 }, - { "month": 11, "new_cases": 242622, "incidence": 119, "new_dead": 5452, "incidence_dead": 2.7 }, - ], - maxCases: 319586 - }, - { - "name": "Comoros", "continent": "Africa", "alpha2": "km", "population": 869595, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 4, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 5, "new_cases": 105, "incidence": 3, "new_dead": 1, "incidence_dead": 0 }, - { "month": 6, "new_cases": 197, "incidence": 6, "new_dead": 5, "incidence_dead": 0.1 }, - { "month": 7, "new_cases": 75, "incidence": 2, "new_dead": 0, "incidence_dead": 0 }, - { "month": 8, "new_cases": 45, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, - { "month": 9, "new_cases": 56, "incidence": 2, "new_dead": 0, "incidence_dead": 0 }, - { "month": 10, "new_cases": 66, "incidence": 2, "new_dead": 0, "incidence_dead": 0 }, - { "month": 11, "new_cases": 66, "incidence": 2, "new_dead": 0, "incidence_dead": 0 }, - ], - maxCases: 197 - }, - { - "name": "Congo", "continent": "Africa", "alpha2": "cg", "population": 5518092, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 18, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 4, "new_cases": 201, "incidence": 1, "new_dead": 7, "incidence_dead": 0 }, - { "month": 5, "new_cases": 391, "incidence": 2, "new_dead": 11, "incidence_dead": 0 }, - { "month": 6, "new_cases": 476, "incidence": 2, "new_dead": 17, "incidence_dead": 0.1 }, - { "month": 7, "new_cases": 2113, "incidence": 10, "new_dead": 17, "incidence_dead": 0.1 }, - { "month": 8, "new_cases": 779, "incidence": 4, "new_dead": 24, "incidence_dead": 0.1 }, - { "month": 9, "new_cases": 1110, "incidence": 5, "new_dead": 11, "incidence_dead": 0 }, - { "month": 10, "new_cases": 201, "incidence": 1, "new_dead": 3, "incidence_dead": 0 }, - { "month": 11, "new_cases": 484, "incidence": 2, "new_dead": 2, "incidence_dead": 0 }, - ], - maxCases: 2113 - }, - { - "name": "Costa Rica", "continent": "North America", "alpha2": "cr", "population": 5094114, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 346, "incidence": 2, "new_dead": 1, "incidence_dead": 0 }, - { "month": 4, "new_cases": 372, "incidence": 2, "new_dead": 4, "incidence_dead": 0 }, - { "month": 5, "new_cases": 337, "incidence": 2, "new_dead": 4, "incidence_dead": 0 }, - { "month": 6, "new_cases": 2403, "incidence": 12, "new_dead": 6, "incidence_dead": 0 }, - { "month": 7, "new_cases": 14361, "incidence": 70, "new_dead": 134, "incidence_dead": 0.7 }, - { "month": 8, "new_cases": 23467, "incidence": 115, "new_dead": 286, "incidence_dead": 1.4 }, - { "month": 9, "new_cases": 34473, "incidence": 169, "new_dead": 468, "incidence_dead": 2.3 }, - { "month": 10, "new_cases": 34211, "incidence": 168, "new_dead": 481, "incidence_dead": 2.4 }, - { "month": 11, "new_cases": 29667, "incidence": 146, "new_dead": 341, "incidence_dead": 1.7 }, - ], - maxCases: 34473 - }, - { - "name": "Cote d'Ivoire", "continent": "Africa", "alpha2": "ci", "population": 26378275, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 178, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 4, "new_cases": 1096, "incidence": 1, "new_dead": 13, "incidence_dead": 0 }, - { "month": 5, "new_cases": 1558, "incidence": 1, "new_dead": 19, "incidence_dead": 0 }, - { "month": 6, "new_cases": 6666, "incidence": 6, "new_dead": 35, "incidence_dead": 0 }, - { "month": 7, "new_cases": 6548, "incidence": 6, "new_dead": 34, "incidence_dead": 0 }, - { "month": 8, "new_cases": 2020, "incidence": 2, "new_dead": 15, "incidence_dead": 0 }, - { "month": 9, "new_cases": 1657, "incidence": 2, "new_dead": 3, "incidence_dead": 0 }, - { "month": 10, "new_cases": 992, "incidence": 1, "new_dead": 6, "incidence_dead": 0 }, - { "month": 11, "new_cases": 615, "incidence": 1, "new_dead": 6, "incidence_dead": 0 }, - ], - maxCases: 6666 - }, - { - "name": "Croatia", "continent": "Europe", "alpha2": "hr", "population": 4105268, "months": [ - { "month": 2, "new_cases": 5, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 861, "incidence": 5, "new_dead": 5, "incidence_dead": 0 }, - { "month": 4, "new_cases": 1209, "incidence": 7, "new_dead": 63, "incidence_dead": 0.4 }, - { "month": 5, "new_cases": 170, "incidence": 1, "new_dead": 34, "incidence_dead": 0.2 }, - { "month": 6, "new_cases": 531, "incidence": 3, "new_dead": 4, "incidence_dead": 0 }, - { "month": 7, "new_cases": 2362, "incidence": 14, "new_dead": 38, "incidence_dead": 0.2 }, - { "month": 8, "new_cases": 5130, "incidence": 31, "new_dead": 41, "incidence_dead": 0.2 }, - { "month": 9, "new_cases": 6324, "incidence": 39, "new_dead": 94, "incidence_dead": 0.6 }, - { "month": 10, "new_cases": 32723, "incidence": 199, "new_dead": 266, "incidence_dead": 1.6 }, - { "month": 11, "new_cases": 79126, "incidence": 482, "new_dead": 1240, "incidence_dead": 7.6 }, - ], - maxCases: 79126 - }, - { - "name": "Cuba", "continent": "North America", "alpha2": "cu", "population": 11326616, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 183, "incidence": 0, "new_dead": 5, "incidence_dead": 0 }, - { "month": 4, "new_cases": 1315, "incidence": 3, "new_dead": 55, "incidence_dead": 0.1 }, - { "month": 5, "new_cases": 544, "incidence": 1, "new_dead": 22, "incidence_dead": 0 }, - { "month": 6, "new_cases": 296, "incidence": 1, "new_dead": 3, "incidence_dead": 0 }, - { "month": 7, "new_cases": 267, "incidence": 1, "new_dead": 1, "incidence_dead": 0 }, - { "month": 8, "new_cases": 1424, "incidence": 3, "new_dead": 7, "incidence_dead": 0 }, - { "month": 9, "new_cases": 1565, "incidence": 3, "new_dead": 28, "incidence_dead": 0.1 }, - { "month": 10, "new_cases": 1290, "incidence": 3, "new_dead": 6, "incidence_dead": 0 }, - { "month": 11, "new_cases": 1397, "incidence": 3, "new_dead": 7, "incidence_dead": 0 }, - ], - maxCases: 1565 - }, - { - "name": "Cyprus", "continent": "Europe", "alpha2": "cy", "population": 875899, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 260, "incidence": 7, "new_dead": 7, "incidence_dead": 0.2 }, - { "month": 4, "new_cases": 588, "incidence": 17, "new_dead": 7, "incidence_dead": 0.2 }, - { "month": 5, "new_cases": 94, "incidence": 3, "new_dead": 2, "incidence_dead": 0.1 }, - { "month": 6, "new_cases": 54, "incidence": 2, "new_dead": 2, "incidence_dead": 0.1 }, - { "month": 7, "new_cases": 116, "incidence": 3, "new_dead": 0, "incidence_dead": 0 }, - { "month": 8, "new_cases": 374, "incidence": 11, "new_dead": 1, "incidence_dead": 0 }, - { "month": 9, "new_cases": 267, "incidence": 8, "new_dead": 2, "incidence_dead": 0.1 }, - { "month": 10, "new_cases": 2611, "incidence": 75, "new_dead": 4, "incidence_dead": 0.1 }, - { "month": 11, "new_cases": 6199, "incidence": 177, "new_dead": 23, "incidence_dead": 0.7 }, - ], - maxCases: 6199 - }, - { - "name": "Czechia", "continent": "Europe", "alpha2": "cz", "population": 10708982, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 3305, "incidence": 8, "new_dead": 30, "incidence_dead": 0.1 }, - { "month": 4, "new_cases": 4374, "incidence": 10, "new_dead": 205, "incidence_dead": 0.5 }, - { "month": 5, "new_cases": 1586, "incidence": 4, "new_dead": 84, "incidence_dead": 0.2 }, - { "month": 6, "new_cases": 2686, "incidence": 6, "new_dead": 29, "incidence_dead": 0.1 }, - { "month": 7, "new_cases": 4620, "incidence": 11, "new_dead": 33, "incidence_dead": 0.1 }, - { "month": 8, "new_cases": 8044, "incidence": 19, "new_dead": 42, "incidence_dead": 0.1 }, - { "month": 9, "new_cases": 46145, "incidence": 108, "new_dead": 231, "incidence_dead": 0.5 }, - { "month": 10, "new_cases": 264339, "incidence": 617, "new_dead": 2596, "incidence_dead": 6.1 }, - { "month": 11, "new_cases": 188196, "incidence": 439, "new_dead": 5044, "incidence_dead": 11.8 }, - ], - maxCases: 264339 - }, - { - "name": "Democratic Republic of Congo", "continent": "Africa", "alpha2": "cd", "population": 89561404, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 97, "incidence": 0, "new_dead": 7, "incidence_dead": 0 }, - { "month": 4, "new_cases": 474, "incidence": 0, "new_dead": 23, "incidence_dead": 0 }, - { "month": 5, "new_cases": 2498, "incidence": 1, "new_dead": 41, "incidence_dead": 0 }, - { "month": 6, "new_cases": 3969, "incidence": 1, "new_dead": 98, "incidence_dead": 0 }, - { "month": 7, "new_cases": 2031, "incidence": 1, "new_dead": 45, "incidence_dead": 0 }, - { "month": 8, "new_cases": 1027, "incidence": 0, "new_dead": 43, "incidence_dead": 0 }, - { "month": 9, "new_cases": 562, "incidence": 0, "new_dead": 14, "incidence_dead": 0 }, - { "month": 10, "new_cases": 647, "incidence": 0, "new_dead": 35, "incidence_dead": 0 }, - { "month": 11, "new_cases": 1466, "incidence": 0, "new_dead": 26, "incidence_dead": 0 }, - ], - maxCases: 3969 - }, - { - "name": "Denmark", "continent": "Europe", "alpha2": "dk", "population": 5792203, "months": [ - { "month": 2, "new_cases": 2, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 3036, "incidence": 13, "new_dead": 89, "incidence_dead": 0.4 }, - { "month": 4, "new_cases": 6317, "incidence": 27, "new_dead": 362, "incidence_dead": 1.6 }, - { "month": 5, "new_cases": 2513, "incidence": 11, "new_dead": 122, "incidence_dead": 0.5 }, - { "month": 6, "new_cases": 1099, "incidence": 5, "new_dead": 31, "incidence_dead": 0.1 }, - { "month": 7, "new_cases": 1060, "incidence": 5, "new_dead": 10, "incidence_dead": 0 }, - { "month": 8, "new_cases": 3382, "incidence": 15, "new_dead": 9, "incidence_dead": 0 }, - { "month": 9, "new_cases": 11069, "incidence": 48, "new_dead": 26, "incidence_dead": 0.1 }, - { "month": 10, "new_cases": 18384, "incidence": 79, "new_dead": 71, "incidence_dead": 0.3 }, - { "month": 11, "new_cases": 34139, "incidence": 147, "new_dead": 116, "incidence_dead": 0.5 }, - ], - maxCases: 34139 - }, - { - "name": "Djibouti", "continent": "Africa", "alpha2": "dj", "population": 988002, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 29, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, - { "month": 4, "new_cases": 1059, "incidence": 27, "new_dead": 1, "incidence_dead": 0 }, - { "month": 5, "new_cases": 2265, "incidence": 57, "new_dead": 22, "incidence_dead": 0.6 }, - { "month": 6, "new_cases": 1328, "incidence": 34, "new_dead": 30, "incidence_dead": 0.8 }, - { "month": 7, "new_cases": 402, "incidence": 10, "new_dead": 4, "incidence_dead": 0.1 }, - { "month": 8, "new_cases": 303, "incidence": 8, "new_dead": 2, "incidence_dead": 0.1 }, - { "month": 9, "new_cases": 29, "incidence": 1, "new_dead": 1, "incidence_dead": 0 }, - { "month": 10, "new_cases": 145, "incidence": 4, "new_dead": 0, "incidence_dead": 0 }, - { "month": 11, "new_cases": 118, "incidence": 3, "new_dead": 0, "incidence_dead": 0 }, - ], - maxCases: 2265 - }, - { - "name": "Dominica", "continent": "North America", "alpha2": "dm", "population": 71991, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 11, "incidence": 4, "new_dead": 0, "incidence_dead": 0 }, - { "month": 4, "new_cases": 4, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, - { "month": 5, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 6, "new_cases": 2, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, - { "month": 7, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 8, "new_cases": 2, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, - { "month": 9, "new_cases": 10, "incidence": 3, "new_dead": 0, "incidence_dead": 0 }, - { "month": 10, "new_cases": 20, "incidence": 7, "new_dead": 0, "incidence_dead": 0 }, - { "month": 11, "new_cases": 35, "incidence": 12, "new_dead": 0, "incidence_dead": 0 }, - ], - maxCases: 35 - }, - { - "name": "Dominican Republic", "continent": "North America", "alpha2": "do", "population": 10847904, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 1108, "incidence": 3, "new_dead": 50, "incidence_dead": 0.1 }, - { "month": 4, "new_cases": 5863, "incidence": 14, "new_dead": 250, "incidence_dead": 0.6 }, - { "month": 5, "new_cases": 10313, "incidence": 24, "new_dead": 201, "incidence_dead": 0.5 }, - { "month": 6, "new_cases": 15283, "incidence": 35, "new_dead": 245, "incidence_dead": 0.6 }, - { "month": 7, "new_cases": 37081, "incidence": 85, "new_dead": 413, "incidence_dead": 1 }, - { "month": 8, "new_cases": 25066, "incidence": 58, "new_dead": 550, "incidence_dead": 1.3 }, - { "month": 9, "new_cases": 17494, "incidence": 40, "new_dead": 395, "incidence_dead": 0.9 }, - { "month": 10, "new_cases": 14809, "incidence": 34, "new_dead": 140, "incidence_dead": 0.3 }, - { "month": 11, "new_cases": 16970, "incidence": 39, "new_dead": 86, "incidence_dead": 0.2 }, - ], - maxCases: 37081 - }, - { - "name": "Ecuador", "continent": "South America", "alpha2": "ec", "population": 17643060, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 2234, "incidence": 3, "new_dead": 73, "incidence_dead": 0.1 }, - { "month": 4, "new_cases": 22694, "incidence": 32, "new_dead": 825, "incidence_dead": 1.2 }, - { "month": 5, "new_cases": 14164, "incidence": 20, "new_dead": 2458, "incidence_dead": 3.5 }, - { "month": 6, "new_cases": 17334, "incidence": 25, "new_dead": 1169, "incidence_dead": 1.7 }, - { "month": 7, "new_cases": 28923, "incidence": 41, "new_dead": 1175, "incidence_dead": 1.7 }, - { "month": 8, "new_cases": 28412, "incidence": 40, "new_dead": 854, "incidence_dead": 1.2 }, - { "month": 9, "new_cases": 23280, "incidence": 33, "new_dead": 4799, "incidence_dead": 6.8 }, - { "month": 10, "new_cases": 31145, "incidence": 44, "new_dead": 1315, "incidence_dead": 1.9 }, - { "month": 11, "new_cases": 24493, "incidence": 35, "new_dead": 791, "incidence_dead": 1.1 }, - ], - maxCases: 31145 - }, - { - "name": "Egypt", "continent": "Africa", "alpha2": "eg", "population": 102334403, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 709, "incidence": 0, "new_dead": 45, "incidence_dead": 0 }, - { "month": 4, "new_cases": 4827, "incidence": 1, "new_dead": 346, "incidence_dead": 0.1 }, - { "month": 5, "new_cases": 19448, "incidence": 5, "new_dead": 567, "incidence_dead": 0.1 }, - { "month": 6, "new_cases": 43326, "incidence": 11, "new_dead": 1994, "incidence_dead": 0.5 }, - { "month": 7, "new_cases": 25767, "incidence": 6, "new_dead": 1852, "incidence_dead": 0.5 }, - { "month": 8, "new_cases": 4861, "incidence": 1, "new_dead": 616, "incidence_dead": 0.2 }, - { "month": 9, "new_cases": 4259, "incidence": 1, "new_dead": 509, "incidence_dead": 0.1 }, - { "month": 10, "new_cases": 4357, "incidence": 1, "new_dead": 336, "incidence_dead": 0.1 }, - { "month": 11, "new_cases": 8356, "incidence": 2, "new_dead": 384, "incidence_dead": 0.1 }, - ], - maxCases: 43326 - }, - { - "name": "El Salvador", "continent": "North America", "alpha2": "sv", "population": 6486201, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 31, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 4, "new_cases": 363, "incidence": 1, "new_dead": 9, "incidence_dead": 0 }, - { "month": 5, "new_cases": 2122, "incidence": 8, "new_dead": 36, "incidence_dead": 0.1 }, - { "month": 6, "new_cases": 3921, "incidence": 15, "new_dead": 128, "incidence_dead": 0.5 }, - { "month": 7, "new_cases": 10194, "incidence": 39, "new_dead": 274, "incidence_dead": 1.1 }, - { "month": 8, "new_cases": 9097, "incidence": 35, "new_dead": 269, "incidence_dead": 1 }, - { "month": 9, "new_cases": 3348, "incidence": 13, "new_dead": 126, "incidence_dead": 0.5 }, - { "month": 10, "new_cases": 4368, "incidence": 17, "new_dead": 132, "incidence_dead": 0.5 }, - { "month": 11, "new_cases": 4960, "incidence": 19, "new_dead": 139, "incidence_dead": 0.5 }, - ], - maxCases: 10194 - }, - { - "name": "Equatorial Guinea", "continent": "Africa", "alpha2": "gq", "population": 1402985, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 11, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 4, "new_cases": 303, "incidence": 5, "new_dead": 0, "incidence_dead": 0 }, - { "month": 5, "new_cases": 991, "incidence": 18, "new_dead": 11, "incidence_dead": 0.2 }, - { "month": 6, "new_cases": 695, "incidence": 12, "new_dead": 20, "incidence_dead": 0.4 }, - { "month": 7, "new_cases": 2820, "incidence": 50, "new_dead": 51, "incidence_dead": 0.9 }, - { "month": 8, "new_cases": 120, "incidence": 2, "new_dead": 0, "incidence_dead": 0 }, - { "month": 9, "new_cases": 89, "incidence": 2, "new_dead": 0, "incidence_dead": 0 }, - { "month": 10, "new_cases": 58, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, - { "month": 11, "new_cases": 65, "incidence": 1, "new_dead": 2, "incidence_dead": 0 }, - ], - maxCases: 2820 - }, - { - "name": "Eritrea", "continent": "Africa", "alpha2": "er", "population": 3546427, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 14, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 4, "new_cases": 24, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 5, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 6, "new_cases": 164, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, - { "month": 7, "new_cases": 76, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, - { "month": 8, "new_cases": 40, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 9, "new_cases": 56, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 10, "new_cases": 88, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, - { "month": 11, "new_cases": 114, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, - ], - maxCases: 164 - }, - { - "name": "Estonia", "continent": "Europe", "alpha2": "ee", "population": 1326539, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 744, "incidence": 14, "new_dead": 3, "incidence_dead": 0.1 }, - { "month": 4, "new_cases": 944, "incidence": 18, "new_dead": 48, "incidence_dead": 0.9 }, - { "month": 5, "new_cases": 180, "incidence": 3, "new_dead": 16, "incidence_dead": 0.3 }, - { "month": 6, "new_cases": 120, "incidence": 2, "new_dead": 1, "incidence_dead": 0 }, - { "month": 7, "new_cases": 75, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, - { "month": 8, "new_cases": 311, "incidence": 6, "new_dead": -5, "incidence_dead": -0.1 }, - { "month": 9, "new_cases": 996, "incidence": 19, "new_dead": 0, "incidence_dead": 0 }, - { "month": 10, "new_cases": 1534, "incidence": 29, "new_dead": 9, "incidence_dead": 0.2 }, - { "month": 11, "new_cases": 7403, "incidence": 140, "new_dead": 45, "incidence_dead": 0.8 }, - ], - maxCases: 7403 - }, - { - "name": "Eswatini", "continent": "Africa", "alpha2": "sz", "population": 1160164, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 8, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 4, "new_cases": 91, "incidence": 2, "new_dead": 0, "incidence_dead": 0 }, - { "month": 5, "new_cases": 185, "incidence": 4, "new_dead": 1, "incidence_dead": 0 }, - { "month": 6, "new_cases": 527, "incidence": 11, "new_dead": 9, "incidence_dead": 0.2 }, - { "month": 7, "new_cases": 1836, "incidence": 40, "new_dead": 30, "incidence_dead": 0.6 }, - { "month": 8, "new_cases": 1929, "incidence": 42, "new_dead": 50, "incidence_dead": 1.1 }, - { "month": 9, "new_cases": 905, "incidence": 20, "new_dead": 18, "incidence_dead": 0.4 }, - { "month": 10, "new_cases": 435, "incidence": 9, "new_dead": 8, "incidence_dead": 0.2 }, - { "month": 11, "new_cases": 502, "incidence": 11, "new_dead": 5, "incidence_dead": 0.1 }, - ], - maxCases: 1929 - }, - { - "name": "Ethiopia", "continent": "Africa", "alpha2": "et", "population": 114963583, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 25, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 4, "new_cases": 105, "incidence": 0, "new_dead": 1, "incidence_dead": 0 }, - { "month": 5, "new_cases": 1041, "incidence": 0, "new_dead": 8, "incidence_dead": 0 }, - { "month": 6, "new_cases": 4674, "incidence": 1, "new_dead": 92, "incidence_dead": 0 }, - { "month": 7, "new_cases": 11684, "incidence": 3, "new_dead": 171, "incidence_dead": 0 }, - { "month": 8, "new_cases": 34601, "incidence": 8, "new_dead": 535, "incidence_dead": 0.1 }, - { "month": 9, "new_cases": 23237, "incidence": 5, "new_dead": 389, "incidence_dead": 0.1 }, - { "month": 10, "new_cases": 20801, "incidence": 5, "new_dead": 271, "incidence_dead": 0.1 }, - { "month": 11, "new_cases": 13905, "incidence": 3, "new_dead": 237, "incidence_dead": 0.1 }, - ], - maxCases: 34601 - }, - { - "name": "Fiji", "continent": "Oceania", "alpha2": "fj", "population": 896444, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 4, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 4, "new_cases": 13, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 5, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 6, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 7, "new_cases": 9, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 8, "new_cases": 1, "incidence": 0, "new_dead": 1, "incidence_dead": 0 }, - { "month": 9, "new_cases": 4, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 10, "new_cases": 2, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 11, "new_cases": 8, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - ], - maxCases: 13 - }, - { - "name": "Finland", "continent": "Europe", "alpha2": "fi", "population": 5540718, "months": [ - { "month": 2, "new_cases": 2, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 1415, "incidence": 6, "new_dead": 16, "incidence_dead": 0.1 }, - { "month": 4, "new_cases": 3577, "incidence": 16, "new_dead": 194, "incidence_dead": 0.9 }, - { "month": 5, "new_cases": 1864, "incidence": 8, "new_dead": 109, "incidence_dead": 0.5 }, - { "month": 6, "new_cases": 355, "incidence": 2, "new_dead": 8, "incidence_dead": 0 }, - { "month": 7, "new_cases": 218, "incidence": 1, "new_dead": 1, "incidence_dead": 0 }, - { "month": 8, "new_cases": 654, "incidence": 3, "new_dead": 7, "incidence_dead": 0 }, - { "month": 9, "new_cases": 1906, "incidence": 9, "new_dead": 8, "incidence_dead": 0 }, - { "month": 10, "new_cases": 6121, "incidence": 28, "new_dead": 14, "incidence_dead": 0.1 }, - { "month": 11, "new_cases": 8799, "incidence": 40, "new_dead": 41, "incidence_dead": 0.2 }, - ], - maxCases: 8799 - }, - { - "name": "France", "continent": "Europe", "alpha2": "fr", "population": 65273512, "months": [ - { "month": 2, "new_cases": 95, "incidence": 0, "new_dead": 1, "incidence_dead": 0 }, - { "month": 3, "new_cases": 52178, "incidence": 20, "new_dead": 3524, "incidence_dead": 1.3 }, - { "month": 4, "new_cases": 116583, "incidence": 45, "new_dead": 20823, "incidence_dead": 8 }, - { "month": 5, "new_cases": 22114, "incidence": 8, "new_dead": 4456, "incidence_dead": 1.7 }, - { "month": 6, "new_cases": 13269, "incidence": 5, "new_dead": 1041, "incidence_dead": 0.4 }, - { "month": 7, "new_cases": 22995, "incidence": 9, "new_dead": 422, "incidence_dead": 0.2 }, - { "month": 8, "new_cases": 93921, "incidence": 36, "new_dead": 378, "incidence_dead": 0.1 }, - { "month": 9, "new_cases": 284733, "incidence": 109, "new_dead": 1332, "incidence_dead": 0.5 }, - { "month": 10, "new_cases": 808471, "incidence": 310, "new_dead": 4849, "incidence_dead": 1.9 }, - { "month": 11, "new_cases": 862510, "incidence": 330, "new_dead": 15992, "incidence_dead": 6.1 }, - ], - maxCases: 862510 - }, - { - "name": "Gabon", "continent": "Africa", "alpha2": "ga", "population": 2225728, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 15, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 4, "new_cases": 260, "incidence": 3, "new_dead": 2, "incidence_dead": 0 }, - { "month": 5, "new_cases": 2379, "incidence": 27, "new_dead": 14, "incidence_dead": 0.2 }, - { "month": 6, "new_cases": 2739, "incidence": 31, "new_dead": 25, "incidence_dead": 0.3 }, - { "month": 7, "new_cases": 1958, "incidence": 22, "new_dead": 7, "incidence_dead": 0.1 }, - { "month": 8, "new_cases": 1181, "incidence": 13, "new_dead": 4, "incidence_dead": 0 }, - { "month": 9, "new_cases": 233, "incidence": 3, "new_dead": 1, "incidence_dead": 0 }, - { "month": 10, "new_cases": 202, "incidence": 2, "new_dead": 1, "incidence_dead": 0 }, - { "month": 11, "new_cases": 246, "incidence": 3, "new_dead": 5, "incidence_dead": 0.1 }, - ], - maxCases: 2739 - }, - { - "name": "Gambia", "continent": "Africa", "alpha2": "gm", "population": 2416664, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 3, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 4, "new_cases": 7, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 5, "new_cases": 14, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 6, "new_cases": 24, "incidence": 0, "new_dead": 1, "incidence_dead": 0 }, - { "month": 7, "new_cases": 449, "incidence": 5, "new_dead": 7, "incidence_dead": 0.1 }, - { "month": 8, "new_cases": 2465, "incidence": 26, "new_dead": 87, "incidence_dead": 0.9 }, - { "month": 9, "new_cases": 616, "incidence": 6, "new_dead": 16, "incidence_dead": 0.2 }, - { "month": 10, "new_cases": 93, "incidence": 1, "new_dead": 7, "incidence_dead": 0.1 }, - { "month": 11, "new_cases": 70, "incidence": 1, "new_dead": 4, "incidence_dead": 0 }, - ], - maxCases: 2465 - }, - { - "name": "Georgia", "continent": "Asia", "alpha2": "ge", "population": 3989175, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 109, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, - { "month": 4, "new_cases": 429, "incidence": 3, "new_dead": 5, "incidence_dead": 0 }, - { "month": 5, "new_cases": 244, "incidence": 2, "new_dead": 6, "incidence_dead": 0 }, - { "month": 6, "new_cases": 145, "incidence": 1, "new_dead": 3, "incidence_dead": 0 }, - { "month": 7, "new_cases": 240, "incidence": 2, "new_dead": 2, "incidence_dead": 0 }, - { "month": 8, "new_cases": 319, "incidence": 2, "new_dead": 2, "incidence_dead": 0 }, - { "month": 9, "new_cases": 4705, "incidence": 29, "new_dead": 20, "incidence_dead": 0.1 }, - { "month": 10, "new_cases": 32744, "incidence": 205, "new_dead": 268, "incidence_dead": 1.7 }, - { "month": 11, "new_cases": 96648, "incidence": 606, "new_dead": 960, "incidence_dead": 6 }, - ], - maxCases: 96648 - }, - { - "name": "Germany", "continent": "Europe", "alpha2": "de", "population": 83783945, "months": [ - { "month": 2, "new_cases": 74, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 71729, "incidence": 21, "new_dead": 773, "incidence_dead": 0.2 }, - { "month": 4, "new_cases": 91201, "incidence": 27, "new_dead": 5848, "incidence_dead": 1.7 }, - { "month": 5, "new_cases": 20401, "incidence": 6, "new_dead": 1917, "incidence_dead": 0.6 }, - { "month": 6, "new_cases": 12008, "incidence": 4, "new_dead": 450, "incidence_dead": 0.1 }, - { "month": 7, "new_cases": 14981, "incidence": 4, "new_dead": 157, "incidence_dead": 0 }, - { "month": 8, "new_cases": 34403, "incidence": 10, "new_dead": 156, "incidence_dead": 0 }, - { "month": 9, "new_cases": 48111, "incidence": 14, "new_dead": 192, "incidence_dead": 0.1 }, - { "month": 10, "new_cases": 238877, "incidence": 71, "new_dead": 988, "incidence_dead": 0.3 }, - { "month": 11, "new_cases": 538122, "incidence": 161, "new_dead": 6211, "incidence_dead": 1.9 }, - ], - maxCases: 538122 - }, - { - "name": "Ghana", "continent": "Africa", "alpha2": "gh", "population": 31072945, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 158, "incidence": 0, "new_dead": 4, "incidence_dead": 0 }, - { "month": 4, "new_cases": 1913, "incidence": 2, "new_dead": 12, "incidence_dead": 0 }, - { "month": 5, "new_cases": 5996, "incidence": 5, "new_dead": 19, "incidence_dead": 0 }, - { "month": 6, "new_cases": 9671, "incidence": 8, "new_dead": 76, "incidence_dead": 0.1 }, - { "month": 7, "new_cases": 17760, "incidence": 14, "new_dead": 70, "incidence_dead": 0.1 }, - { "month": 8, "new_cases": 8797, "incidence": 7, "new_dead": 94, "incidence_dead": 0.1 }, - { "month": 9, "new_cases": 2328, "incidence": 2, "new_dead": 25, "incidence_dead": 0 }, - { "month": 10, "new_cases": 1429, "incidence": 1, "new_dead": 19, "incidence_dead": 0 }, - { "month": 11, "new_cases": 3612, "incidence": 3, "new_dead": 3, "incidence_dead": 0 }, - ], - maxCases: 17760 - }, - { - "name": "Greece", "continent": "Europe", "alpha2": "gr", "population": 10423056, "months": [ - { "month": 2, "new_cases": 3, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 1310, "incidence": 3, "new_dead": 48, "incidence_dead": 0.1 }, - { "month": 4, "new_cases": 1277, "incidence": 3, "new_dead": 91, "incidence_dead": 0.2 }, - { "month": 5, "new_cases": 326, "incidence": 1, "new_dead": 35, "incidence_dead": 0.1 }, - { "month": 6, "new_cases": 492, "incidence": 1, "new_dead": 17, "incidence_dead": 0 }, - { "month": 7, "new_cases": 1068, "incidence": 3, "new_dead": 14, "incidence_dead": 0 }, - { "month": 8, "new_cases": 5840, "incidence": 14, "new_dead": 60, "incidence_dead": 0.1 }, - { "month": 9, "new_cases": 8158, "incidence": 20, "new_dead": 125, "incidence_dead": 0.3 }, - { "month": 10, "new_cases": 20776, "incidence": 50, "new_dead": 235, "incidence_dead": 0.6 }, - { "month": 11, "new_cases": 66020, "incidence": 158, "new_dead": 1780, "incidence_dead": 4.3 }, - ], - maxCases: 66020 - }, - { - "name": "Grenada", "continent": "North America", "alpha2": "gd", "population": 112519, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 8, "incidence": 2, "new_dead": 0, "incidence_dead": 0 }, - { "month": 4, "new_cases": 11, "incidence": 2, "new_dead": 0, "incidence_dead": 0 }, - { "month": 5, "new_cases": 3, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, - { "month": 6, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 7, "new_cases": 1, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 8, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 9, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 10, "new_cases": 4, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, - { "month": 11, "new_cases": 13, "incidence": 3, "new_dead": 0, "incidence_dead": 0 }, - ], - maxCases: 13 - }, - { - "name": "Guatemala", "continent": "North America", "alpha2": "gt", "population": 17915567, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 37, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 4, "new_cases": 561, "incidence": 1, "new_dead": 15, "incidence_dead": 0 }, - { "month": 5, "new_cases": 4488, "incidence": 6, "new_dead": 92, "incidence_dead": 0.1 }, - { "month": 6, "new_cases": 13009, "incidence": 18, "new_dead": 665, "incidence_dead": 0.9 }, - { "month": 7, "new_cases": 31693, "incidence": 44, "new_dead": 1151, "incidence_dead": 1.6 }, - { "month": 8, "new_cases": 24285, "incidence": 34, "new_dead": 836, "incidence_dead": 1.2 }, - { "month": 9, "new_cases": 17672, "incidence": 25, "new_dead": 486, "incidence_dead": 0.7 }, - { "month": 10, "new_cases": 16193, "incidence": 23, "new_dead": 483, "incidence_dead": 0.7 }, - { "month": 11, "new_cases": 14123, "incidence": 20, "new_dead": 442, "incidence_dead": 0.6 }, - ], - maxCases: 31693 - }, - { - "name": "Guinea", "continent": "Africa", "alpha2": "gn", "population": 13132792, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 21, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 4, "new_cases": 1473, "incidence": 3, "new_dead": 6, "incidence_dead": 0 }, - { "month": 5, "new_cases": 2211, "incidence": 4, "new_dead": 16, "incidence_dead": 0 }, - { "month": 6, "new_cases": 1685, "incidence": 3, "new_dead": 10, "incidence_dead": 0 }, - { "month": 7, "new_cases": 1917, "incidence": 4, "new_dead": 13, "incidence_dead": 0 }, - { "month": 8, "new_cases": 2101, "incidence": 4, "new_dead": 13, "incidence_dead": 0 }, - { "month": 9, "new_cases": 1243, "incidence": 2, "new_dead": 7, "incidence_dead": 0 }, - { "month": 10, "new_cases": 1420, "incidence": 3, "new_dead": 6, "incidence_dead": 0 }, - { "month": 11, "new_cases": 1047, "incidence": 2, "new_dead": 4, "incidence_dead": 0 }, - ], - maxCases: 2211 - }, - { - "name": "Guinea-Bissau", "continent": "Africa", "alpha2": "gw", "population": 1967998, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 6, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 4, "new_cases": 197, "incidence": 3, "new_dead": 0, "incidence_dead": 0 }, - { "month": 5, "new_cases": 1051, "incidence": 13, "new_dead": 7, "incidence_dead": 0.1 }, - { "month": 6, "new_cases": 398, "incidence": 5, "new_dead": 16, "incidence_dead": 0.2 }, - { "month": 7, "new_cases": 327, "incidence": 4, "new_dead": 2, "incidence_dead": 0 }, - { "month": 8, "new_cases": 224, "incidence": 3, "new_dead": 8, "incidence_dead": 0.1 }, - { "month": 9, "new_cases": 119, "incidence": 2, "new_dead": 5, "incidence_dead": 0.1 }, - { "month": 10, "new_cases": 89, "incidence": 1, "new_dead": 2, "incidence_dead": 0 }, - { "month": 11, "new_cases": 28, "incidence": 0, "new_dead": 3, "incidence_dead": 0 }, - ], - maxCases: 1051 - }, - { - "name": "Guyana", "continent": "South America", "alpha2": "gy", "population": 786559, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 11, "incidence": 0, "new_dead": 1, "incidence_dead": 0 }, - { "month": 4, "new_cases": 70, "incidence": 2, "new_dead": 7, "incidence_dead": 0.2 }, - { "month": 5, "new_cases": 71, "incidence": 2, "new_dead": 3, "incidence_dead": 0.1 }, - { "month": 6, "new_cases": 92, "incidence": 3, "new_dead": 0, "incidence_dead": 0 }, - { "month": 7, "new_cases": 168, "incidence": 5, "new_dead": 8, "incidence_dead": 0.3 }, - { "month": 8, "new_cases": 893, "incidence": 28, "new_dead": 19, "incidence_dead": 0.6 }, - { "month": 9, "new_cases": 1588, "incidence": 50, "new_dead": 41, "incidence_dead": 1.3 }, - { "month": 10, "new_cases": 1268, "incidence": 40, "new_dead": 44, "incidence_dead": 1.4 }, - { "month": 11, "new_cases": 1244, "incidence": 40, "new_dead": 27, "incidence_dead": 0.9 }, - ], - maxCases: 1588 - }, - { - "name": "Haiti", "continent": "North America", "alpha2": "ht", "population": 11402533, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 13, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 4, "new_cases": 66, "incidence": 0, "new_dead": 7, "incidence_dead": 0 }, - { "month": 5, "new_cases": 2043, "incidence": 4, "new_dead": 36, "incidence_dead": 0.1 }, - { "month": 6, "new_cases": 3851, "incidence": 8, "new_dead": 61, "incidence_dead": 0.1 }, - { "month": 7, "new_cases": 1449, "incidence": 3, "new_dead": 56, "incidence_dead": 0.1 }, - { "month": 8, "new_cases": 800, "incidence": 2, "new_dead": 40, "incidence_dead": 0.1 }, - { "month": 9, "new_cases": 542, "incidence": 1, "new_dead": 28, "incidence_dead": 0.1 }, - { "month": 10, "new_cases": 291, "incidence": 1, "new_dead": 3, "incidence_dead": 0 }, - { "month": 11, "new_cases": 237, "incidence": 1, "new_dead": 1, "incidence_dead": 0 }, - ], - maxCases: 3851 - }, - { - "name": "Honduras", "continent": "North America", "alpha2": "hn", "population": 9904608, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 139, "incidence": 0, "new_dead": 6, "incidence_dead": 0 }, - { "month": 4, "new_cases": 630, "incidence": 2, "new_dead": 64, "incidence_dead": 0.2 }, - { "month": 5, "new_cases": 4431, "incidence": 11, "new_dead": 141, "incidence_dead": 0.4 }, - { "month": 6, "new_cases": 14356, "incidence": 36, "new_dead": 285, "incidence_dead": 0.7 }, - { "month": 7, "new_cases": 22456, "incidence": 57, "new_dead": 840, "incidence_dead": 2.1 }, - { "month": 8, "new_cases": 19000, "incidence": 48, "new_dead": 536, "incidence_dead": 1.4 }, - { "month": 9, "new_cases": 15886, "incidence": 40, "new_dead": 480, "incidence_dead": 1.2 }, - { "month": 10, "new_cases": 19988, "incidence": 50, "new_dead": 316, "incidence_dead": 0.8 }, - { "month": 11, "new_cases": 11365, "incidence": 29, "new_dead": 249, "incidence_dead": 0.6 }, - ], - maxCases: 22456 - }, - { - "name": "Hungary", "continent": "Europe", "alpha2": "hu", "population": 9660350, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 490, "incidence": 1, "new_dead": 15, "incidence_dead": 0 }, - { "month": 4, "new_cases": 2283, "incidence": 6, "new_dead": 296, "incidence_dead": 0.8 }, - { "month": 5, "new_cases": 1101, "incidence": 3, "new_dead": 214, "incidence_dead": 0.6 }, - { "month": 6, "new_cases": 279, "incidence": 1, "new_dead": 59, "incidence_dead": 0.2 }, - { "month": 7, "new_cases": 350, "incidence": 1, "new_dead": 11, "incidence_dead": 0 }, - { "month": 8, "new_cases": 1634, "incidence": 4, "new_dead": 19, "incidence_dead": 0 }, - { "month": 9, "new_cases": 20322, "incidence": 53, "new_dead": 150, "incidence_dead": 0.4 }, - { "month": 10, "new_cases": 48860, "incidence": 126, "new_dead": 985, "incidence_dead": 2.5 }, - { "month": 11, "new_cases": 141801, "incidence": 367, "new_dead": 3073, "incidence_dead": 8 }, - ], - maxCases: 141801 - }, - { - "name": "Iceland", "continent": "Europe", "alpha2": "is", "population": 341250, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 1134, "incidence": 83, "new_dead": 1, "incidence_dead": 0.1 }, - { "month": 4, "new_cases": 662, "incidence": 48, "new_dead": 8, "incidence_dead": 0.6 }, - { "month": 5, "new_cases": 9, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, - { "month": 6, "new_cases": 18, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, - { "month": 7, "new_cases": 61, "incidence": 4, "new_dead": 0, "incidence_dead": 0 }, - { "month": 8, "new_cases": 222, "incidence": 16, "new_dead": 0, "incidence_dead": 0 }, - { "month": 9, "new_cases": 621, "incidence": 45, "new_dead": 0, "incidence_dead": 0 }, - { "month": 10, "new_cases": 2137, "incidence": 157, "new_dead": 2, "incidence_dead": 0.1 }, - { "month": 11, "new_cases": 527, "incidence": 39, "new_dead": 14, "incidence_dead": 1 }, - ], - maxCases: 2137 - }, - { - "name": "India", "continent": "Asia", "alpha2": "in", "population": 1380004385, "months": [ - { "month": 2, "new_cases": 2, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 1394, "incidence": 0, "new_dead": 34, "incidence_dead": 0 }, - { "month": 4, "new_cases": 33466, "incidence": 1, "new_dead": 1119, "incidence_dead": 0 }, - { "month": 5, "new_cases": 155746, "incidence": 3, "new_dead": 4254, "incidence_dead": 0.1 }, - { "month": 6, "new_cases": 394872, "incidence": 7, "new_dead": 11992, "incidence_dead": 0.2 }, - { "month": 7, "new_cases": 1110507, "incidence": 20, "new_dead": 19111, "incidence_dead": 0.3 }, - { "month": 8, "new_cases": 1995178, "incidence": 36, "new_dead": 28777, "incidence_dead": 0.5 }, - { "month": 9, "new_cases": 2621418, "incidence": 47, "new_dead": 33390, "incidence_dead": 0.6 }, - { "month": 10, "new_cases": 1871498, "incidence": 34, "new_dead": 23433, "incidence_dead": 0.4 }, - { "month": 11, "new_cases": 1278727, "incidence": 23, "new_dead": 15510, "incidence_dead": 0.3 }, - ], - maxCases: 2621418 - }, - { - "name": "Indonesia", "continent": "Asia", "alpha2": "id", "population": 273523621, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 1526, "incidence": 0, "new_dead": 135, "incidence_dead": 0 }, - { "month": 4, "new_cases": 8590, "incidence": 1, "new_dead": 656, "incidence_dead": 0.1 }, - { "month": 5, "new_cases": 16355, "incidence": 1, "new_dead": 821, "incidence_dead": 0.1 }, - { "month": 6, "new_cases": 29912, "incidence": 3, "new_dead": 1263, "incidence_dead": 0.1 }, - { "month": 7, "new_cases": 51991, "incidence": 5, "new_dead": 2255, "incidence_dead": 0.2 }, - { "month": 8, "new_cases": 66420, "incidence": 6, "new_dead": 2286, "incidence_dead": 0.2 }, - { "month": 9, "new_cases": 112212, "incidence": 10, "new_dead": 3323, "incidence_dead": 0.3 }, - { "month": 10, "new_cases": 123080, "incidence": 11, "new_dead": 3129, "incidence_dead": 0.3 }, - { "month": 11, "new_cases": 128795, "incidence": 12, "new_dead": 3076, "incidence_dead": 0.3 }, - ], - maxCases: 128795 - }, - { - "name": "Iraq", "continent": "Asia", "alpha2": "iq", "population": 40222503, "months": [ - { "month": 2, "new_cases": 12, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 681, "incidence": 0, "new_dead": 48, "incidence_dead": 0 }, - { "month": 4, "new_cases": 1391, "incidence": 1, "new_dead": 43, "incidence_dead": 0 }, - { "month": 5, "new_cases": 4354, "incidence": 3, "new_dead": 112, "incidence_dead": 0.1 }, - { "month": 6, "new_cases": 42670, "incidence": 27, "new_dead": 1738, "incidence_dead": 1.1 }, - { "month": 7, "new_cases": 75500, "incidence": 47, "new_dead": 2798, "incidence_dead": 1.7 }, - { "month": 8, "new_cases": 110325, "incidence": 69, "new_dead": 2301, "incidence_dead": 1.4 }, - { "month": 9, "new_cases": 128047, "incidence": 80, "new_dead": 2139, "incidence_dead": 1.3 }, - { "month": 10, "new_cases": 109649, "incidence": 68, "new_dead": 1729, "incidence_dead": 1.1 }, - { "month": 11, "new_cases": 79919, "incidence": 50, "new_dead": 1348, "incidence_dead": 0.8 }, - ], - maxCases: 128047 - }, - { - "name": "Ireland", "continent": "Europe", "alpha2": "ie", "population": 4937796, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 3234, "incidence": 16, "new_dead": 70, "incidence_dead": 0.4 }, - { "month": 4, "new_cases": 17377, "incidence": 88, "new_dead": 1161, "incidence_dead": 5.9 }, - { "month": 5, "new_cases": 4378, "incidence": 22, "new_dead": 420, "incidence_dead": 2.1 }, - { "month": 6, "new_cases": 483, "incidence": 2, "new_dead": 84, "incidence_dead": 0.4 }, - { "month": 7, "new_cases": 592, "incidence": 3, "new_dead": 27, "incidence_dead": 0.1 }, - { "month": 8, "new_cases": 2746, "incidence": 14, "new_dead": 14, "incidence_dead": 0.1 }, - { "month": 9, "new_cases": 7344, "incidence": 37, "new_dead": 27, "incidence_dead": 0.1 }, - { "month": 10, "new_cases": 25301, "incidence": 128, "new_dead": 109, "incidence_dead": 0.6 }, - { "month": 11, "new_cases": 11088, "incidence": 56, "new_dead": 140, "incidence_dead": 0.7 }, - ], - maxCases: 25301 - }, - { - "name": "Israel", "continent": "Asia", "alpha2": "il", "population": 8655541, "months": [ - { "month": 2, "new_cases": 5, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 5711, "incidence": 16, "new_dead": 20, "incidence_dead": 0.1 }, - { "month": 4, "new_cases": 10179, "incidence": 29, "new_dead": 204, "incidence_dead": 0.6 }, - { "month": 5, "new_cases": 1183, "incidence": 3, "new_dead": 62, "incidence_dead": 0.2 }, - { "month": 6, "new_cases": 8359, "incidence": 24, "new_dead": 40, "incidence_dead": 0.1 }, - { "month": 7, "new_cases": 46296, "incidence": 134, "new_dead": 237, "incidence_dead": 0.7 }, - { "month": 8, "new_cases": 45172, "incidence": 130, "new_dead": 389, "incidence_dead": 1.1 }, - { "month": 9, "new_cases": 130505, "incidence": 377, "new_dead": 651, "incidence_dead": 1.9 }, - { "month": 10, "new_cases": 66938, "incidence": 193, "new_dead": 957, "incidence_dead": 2.8 }, - { "month": 11, "new_cases": 22842, "incidence": 66, "new_dead": 311, "incidence_dead": 0.9 }, - ], - maxCases: 130505 - }, - { - "name": "Italy", "continent": "Europe", "alpha2": "it", "population": 60461828, "months": [ - { "month": 2, "new_cases": 1126, "incidence": 0, "new_dead": 28, "incidence_dead": 0 }, - { "month": 3, "new_cases": 104664, "incidence": 43, "new_dead": 12399, "incidence_dead": 5.1 }, - { "month": 4, "new_cases": 99671, "incidence": 41, "new_dead": 15539, "incidence_dead": 6.4 }, - { "month": 5, "new_cases": 27534, "incidence": 11, "new_dead": 5448, "incidence_dead": 2.3 }, - { "month": 6, "new_cases": 7581, "incidence": 3, "new_dead": 1352, "incidence_dead": 0.6 }, - { "month": 7, "new_cases": 6959, "incidence": 3, "new_dead": 374, "incidence_dead": 0.2 }, - { "month": 8, "new_cases": 21677, "incidence": 9, "new_dead": 342, "incidence_dead": 0.1 }, - { "month": 9, "new_cases": 45647, "incidence": 19, "new_dead": 411, "incidence_dead": 0.2 }, - { "month": 10, "new_cases": 364569, "incidence": 151, "new_dead": 2724, "incidence_dead": 1.1 }, - { "month": 11, "new_cases": 922124, "incidence": 381, "new_dead": 16958, "incidence_dead": 7 }, - ], - maxCases: 922124 - }, - { - "name": "Jamaica", "continent": "North America", "alpha2": "jm", "population": 2961161, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 35, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 4, "new_cases": 386, "incidence": 3, "new_dead": 7, "incidence_dead": 0.1 }, - { "month": 5, "new_cases": 164, "incidence": 1, "new_dead": 1, "incidence_dead": 0 }, - { "month": 6, "new_cases": 116, "incidence": 1, "new_dead": 1, "incidence_dead": 0 }, - { "month": 7, "new_cases": 176, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, - { "month": 8, "new_cases": 1581, "incidence": 13, "new_dead": 11, "incidence_dead": 0.1 }, - { "month": 9, "new_cases": 4023, "incidence": 34, "new_dead": 86, "incidence_dead": 0.7 }, - { "month": 10, "new_cases": 2612, "incidence": 22, "new_dead": 99, "incidence_dead": 0.8 }, - { "month": 11, "new_cases": 1669, "incidence": 14, "new_dead": 51, "incidence_dead": 0.4 }, - ], - maxCases: 4023 - }, - { - "name": "Japan", "continent": "Asia", "alpha2": "jp", "population": 126476458, "months": [ - { "month": 2, "new_cases": 230, "incidence": 0, "new_dead": 5, "incidence_dead": 0 }, - { "month": 3, "new_cases": 2010, "incidence": 0, "new_dead": 61, "incidence_dead": 0 }, - { "month": 4, "new_cases": 12029, "incidence": 2, "new_dead": 414, "incidence_dead": 0.1 }, - { "month": 5, "new_cases": 2467, "incidence": 0, "new_dead": 417, "incidence_dead": 0.1 }, - { "month": 6, "new_cases": 1864, "incidence": 0, "new_dead": 74, "incidence_dead": 0 }, - { "month": 7, "new_cases": 17619, "incidence": 3, "new_dead": 36, "incidence_dead": 0 }, - { "month": 8, "new_cases": 32162, "incidence": 6, "new_dead": 290, "incidence_dead": 0.1 }, - { "month": 9, "new_cases": 15195, "incidence": 3, "new_dead": 277, "incidence_dead": 0.1 }, - { "month": 10, "new_cases": 17736, "incidence": 4, "new_dead": 194, "incidence_dead": 0 }, - { "month": 11, "new_cases": 47635, "incidence": 9, "new_dead": 307, "incidence_dead": 0.1 }, - ], - maxCases: 47635 - }, - { - "name": "Jordan", "continent": "Asia", "alpha2": "jo", "population": 10203140, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 273, "incidence": 1, "new_dead": 4, "incidence_dead": 0 }, - { "month": 4, "new_cases": 179, "incidence": 0, "new_dead": 3, "incidence_dead": 0 }, - { "month": 5, "new_cases": 286, "incidence": 1, "new_dead": 1, "incidence_dead": 0 }, - { "month": 6, "new_cases": 393, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, - { "month": 7, "new_cases": 61, "incidence": 0, "new_dead": 2, "incidence_dead": 0 }, - { "month": 8, "new_cases": 841, "incidence": 2, "new_dead": 4, "incidence_dead": 0 }, - { "month": 9, "new_cases": 9791, "incidence": 24, "new_dead": 46, "incidence_dead": 0.1 }, - { "month": 10, "new_cases": 60782, "incidence": 149, "new_dead": 768, "incidence_dead": 1.9 }, - { "month": 11, "new_cases": 146823, "incidence": 360, "new_dead": 1922, "incidence_dead": 4.7 }, - ], - maxCases: 146823 - }, - { - "name": "Kazakhstan", "continent": "Asia", "alpha2": "kz", "population": 18776707, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 339, "incidence": 0, "new_dead": 1, "incidence_dead": 0 }, - { "month": 4, "new_cases": 3059, "incidence": 4, "new_dead": 23, "incidence_dead": 0 }, - { "month": 5, "new_cases": 7456, "incidence": 10, "new_dead": 15, "incidence_dead": 0 }, - { "month": 6, "new_cases": 11450, "incidence": 15, "new_dead": 148, "incidence_dead": 0.2 }, - { "month": 7, "new_cases": 68059, "incidence": 91, "new_dead": 605, "incidence_dead": 0.8 }, - { "month": 8, "new_cases": 40306, "incidence": 54, "new_dead": 988, "incidence_dead": 1.3 }, - { "month": 9, "new_cases": 10034, "incidence": 13, "new_dead": 297, "incidence_dead": 0.4 }, - { "month": 10, "new_cases": 8992, "incidence": 12, "new_dead": 148, "incidence_dead": 0.2 }, - { "month": 11, "new_cases": 24864, "incidence": 33, "new_dead": 207, "incidence_dead": 0.3 }, - ], - maxCases: 68059 - }, - { - "name": "Kenya", "continent": "Africa", "alpha2": "ke", "population": 53771300, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 58, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 4, "new_cases": 337, "incidence": 0, "new_dead": 16, "incidence_dead": 0 }, - { "month": 5, "new_cases": 1566, "incidence": 1, "new_dead": 47, "incidence_dead": 0 }, - { "month": 6, "new_cases": 4404, "incidence": 2, "new_dead": 84, "incidence_dead": 0 }, - { "month": 7, "new_cases": 14270, "incidence": 7, "new_dead": 193, "incidence_dead": 0.1 }, - { "month": 8, "new_cases": 13565, "incidence": 6, "new_dead": 236, "incidence_dead": 0.1 }, - { "month": 9, "new_cases": 4328, "incidence": 2, "new_dead": 134, "incidence_dead": 0.1 }, - { "month": 10, "new_cases": 16663, "incidence": 8, "new_dead": 270, "incidence_dead": 0.1 }, - { "month": 11, "new_cases": 28426, "incidence": 13, "new_dead": 488, "incidence_dead": 0.2 }, - ], - maxCases: 28426 - }, - { - "name": "Kuwait", "continent": "Asia", "alpha2": "kw", "population": 4270563, "months": [ - { "month": 2, "new_cases": 44, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 244, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, - { "month": 4, "new_cases": 3735, "incidence": 22, "new_dead": 25, "incidence_dead": 0.1 }, - { "month": 5, "new_cases": 23019, "incidence": 135, "new_dead": 186, "incidence_dead": 1.1 }, - { "month": 6, "new_cases": 19152, "incidence": 112, "new_dead": 142, "incidence_dead": 0.8 }, - { "month": 7, "new_cases": 20762, "incidence": 122, "new_dead": 93, "incidence_dead": 0.5 }, - { "month": 8, "new_cases": 18152, "incidence": 106, "new_dead": 84, "incidence_dead": 0.5 }, - { "month": 9, "new_cases": 20073, "incidence": 118, "new_dead": 79, "incidence_dead": 0.5 }, - { "month": 10, "new_cases": 20744, "incidence": 121, "new_dead": 169, "incidence_dead": 1 }, - { "month": 11, "new_cases": 16709, "incidence": 98, "new_dead": 101, "incidence_dead": 0.6 }, - ], - maxCases: 23019 - }, - { - "name": "Kyrgyzstan", "continent": "Asia", "alpha2": "kg", "population": 6524191, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 104, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 4, "new_cases": 639, "incidence": 2, "new_dead": 7, "incidence_dead": 0 }, - { "month": 5, "new_cases": 1002, "incidence": 4, "new_dead": 8, "incidence_dead": 0 }, - { "month": 6, "new_cases": 3758, "incidence": 14, "new_dead": 45, "incidence_dead": 0.2 }, - { "month": 7, "new_cases": 30299, "incidence": 116, "new_dead": 1317, "incidence_dead": 5 }, - { "month": 8, "new_cases": 8093, "incidence": 31, "new_dead": -320, "incidence_dead": -1.2 }, - { "month": 9, "new_cases": 2771, "incidence": 11, "new_dead": 6, "incidence_dead": 0 }, - { "month": 10, "new_cases": 12209, "incidence": 47, "new_dead": 80, "incidence_dead": 0.3 }, - { "month": 11, "new_cases": 14300, "incidence": 55, "new_dead": 131, "incidence_dead": 0.5 }, - ], - maxCases: 30299 - }, - { - "name": "Laos", "continent": "Asia", "alpha2": "la", "population": 7275556, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 7, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 4, "new_cases": 10, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 5, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 6, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 7, "new_cases": 1, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 8, "new_cases": 2, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 9, "new_cases": 1, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 10, "new_cases": 1, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 11, "new_cases": 15, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - ], - maxCases: 15 - }, - { - "name": "Latvia", "continent": "Europe", "alpha2": "lv", "population": 1886202, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 397, "incidence": 5, "new_dead": 0, "incidence_dead": 0 }, - { "month": 4, "new_cases": 460, "incidence": 6, "new_dead": 14, "incidence_dead": 0.2 }, - { "month": 5, "new_cases": 208, "incidence": 3, "new_dead": 9, "incidence_dead": 0.1 }, - { "month": 6, "new_cases": 52, "incidence": 1, "new_dead": 6, "incidence_dead": 0.1 }, - { "month": 7, "new_cases": 113, "incidence": 1, "new_dead": 2, "incidence_dead": 0 }, - { "month": 8, "new_cases": 165, "incidence": 2, "new_dead": 2, "incidence_dead": 0 }, - { "month": 9, "new_cases": 428, "incidence": 6, "new_dead": 3, "incidence_dead": 0 }, - { "month": 10, "new_cases": 4070, "incidence": 54, "new_dead": 34, "incidence_dead": 0.5 }, - { "month": 11, "new_cases": 11181, "incidence": 148, "new_dead": 135, "incidence_dead": 1.8 }, - ], - maxCases: 11181 - }, - { - "name": "Lebanon", "continent": "Asia", "alpha2": "lb", "population": 6825442, "months": [ - { "month": 2, "new_cases": 3, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 466, "incidence": 2, "new_dead": 11, "incidence_dead": 0 }, - { "month": 4, "new_cases": 255, "incidence": 1, "new_dead": 12, "incidence_dead": 0 }, - { "month": 5, "new_cases": 495, "incidence": 2, "new_dead": 3, "incidence_dead": 0 }, - { "month": 6, "new_cases": 558, "incidence": 2, "new_dead": 7, "incidence_dead": 0 }, - { "month": 7, "new_cases": 2777, "incidence": 10, "new_dead": 27, "incidence_dead": 0.1 }, - { "month": 8, "new_cases": 12753, "incidence": 47, "new_dead": 106, "incidence_dead": 0.4 }, - { "month": 9, "new_cases": 22326, "incidence": 82, "new_dead": 200, "incidence_dead": 0.7 }, - { "month": 10, "new_cases": 41594, "incidence": 152, "new_dead": 270, "incidence_dead": 1 }, - { "month": 11, "new_cases": 46716, "incidence": 171, "new_dead": 381, "incidence_dead": 1.4 }, - ], - maxCases: 46716 - }, - { - "name": "Lesotho", "continent": "Africa", "alpha2": "ls", "population": 2142252, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 4, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 5, "new_cases": 1, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 6, "new_cases": 25, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 7, "new_cases": 577, "incidence": 7, "new_dead": 12, "incidence_dead": 0.1 }, - { "month": 8, "new_cases": 481, "incidence": 6, "new_dead": 18, "incidence_dead": 0.2 }, - { "month": 9, "new_cases": 510, "incidence": 6, "new_dead": 5, "incidence_dead": 0.1 }, - { "month": 10, "new_cases": 358, "incidence": 4, "new_dead": 8, "incidence_dead": 0.1 }, - { "month": 11, "new_cases": 156, "incidence": 2, "new_dead": 0, "incidence_dead": 0 }, - ], - maxCases: 577 - }, - { - "name": "Liberia", "continent": "Africa", "alpha2": "lr", "population": 5057677, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 2, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 4, "new_cases": 138, "incidence": 1, "new_dead": 15, "incidence_dead": 0.1 }, - { "month": 5, "new_cases": 147, "incidence": 1, "new_dead": 11, "incidence_dead": 0.1 }, - { "month": 6, "new_cases": 492, "incidence": 2, "new_dead": 9, "incidence_dead": 0 }, - { "month": 7, "new_cases": 406, "incidence": 2, "new_dead": 39, "incidence_dead": 0.2 }, - { "month": 8, "new_cases": 118, "incidence": 1, "new_dead": 7, "incidence_dead": 0 }, - { "month": 9, "new_cases": 39, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 10, "new_cases": 83, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 11, "new_cases": 169, "incidence": 1, "new_dead": 1, "incidence_dead": 0 }, - ], - maxCases: 492 - }, - { - "name": "Libya", "continent": "Africa", "alpha2": "ly", "population": 6871287, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 9, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 4, "new_cases": 51, "incidence": 0, "new_dead": 2, "incidence_dead": 0 }, - { "month": 5, "new_cases": 95, "incidence": 0, "new_dead": 2, "incidence_dead": 0 }, - { "month": 6, "new_cases": 668, "incidence": 2, "new_dead": 19, "incidence_dead": 0.1 }, - { "month": 7, "new_cases": 2797, "incidence": 10, "new_dead": 50, "incidence_dead": 0.2 }, - { "month": 8, "new_cases": 10345, "incidence": 38, "new_dead": 163, "incidence_dead": 0.6 }, - { "month": 9, "new_cases": 20559, "incidence": 75, "new_dead": 314, "incidence_dead": 1.1 }, - { "month": 10, "new_cases": 26570, "incidence": 97, "new_dead": 306, "incidence_dead": 1.1 }, - { "month": 11, "new_cases": 21714, "incidence": 79, "new_dead": 326, "incidence_dead": 1.2 }, - ], - maxCases: 26570 - }, - { - "name": "Liechtenstein", "continent": "Europe", "alpha2": "li", "population": 38137, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 67, "incidence": 44, "new_dead": 0, "incidence_dead": 0 }, - { "month": 4, "new_cases": 14, "incidence": 9, "new_dead": 0, "incidence_dead": 0 }, - { "month": 5, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 6, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 7, "new_cases": 6, "incidence": 4, "new_dead": 0, "incidence_dead": 0 }, - { "month": 8, "new_cases": 19, "incidence": 12, "new_dead": 0, "incidence_dead": 0 }, - { "month": 9, "new_cases": 11, "incidence": 7, "new_dead": 0, "incidence_dead": 0 }, - { "month": 10, "new_cases": 415, "incidence": 272, "new_dead": 2, "incidence_dead": 1.3 }, - { "month": 11, "new_cases": 737, "incidence": 483, "new_dead": 13, "incidence_dead": 8.5 }, - ], - maxCases: 737 - }, - { - "name": "Lithuania", "continent": "Europe", "alpha2": "lt", "population": 2722291, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 536, "incidence": 5, "new_dead": 7, "incidence_dead": 0.1 }, - { "month": 4, "new_cases": 848, "incidence": 8, "new_dead": 37, "incidence_dead": 0.3 }, - { "month": 5, "new_cases": 290, "incidence": 3, "new_dead": 25, "incidence_dead": 0.2 }, - { "month": 6, "new_cases": 142, "incidence": 1, "new_dead": 8, "incidence_dead": 0.1 }, - { "month": 7, "new_cases": 258, "incidence": 2, "new_dead": 2, "incidence_dead": 0 }, - { "month": 8, "new_cases": 831, "incidence": 8, "new_dead": 6, "incidence_dead": 0.1 }, - { "month": 9, "new_cases": 1787, "incidence": 16, "new_dead": 6, "incidence_dead": 0.1 }, - { "month": 10, "new_cases": 10131, "incidence": 93, "new_dead": 73, "incidence_dead": 0.7 }, - { "month": 11, "new_cases": 46501, "incidence": 427, "new_dead": 341, "incidence_dead": 3.1 }, - ], - maxCases: 46501 - }, - { - "name": "Luxembourg", "continent": "Europe", "alpha2": "lu", "population": 625976, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 2177, "incidence": 87, "new_dead": 22, "incidence_dead": 0.9 }, - { "month": 4, "new_cases": 1606, "incidence": 64, "new_dead": 67, "incidence_dead": 2.7 }, - { "month": 5, "new_cases": 234, "incidence": 9, "new_dead": 20, "incidence_dead": 0.8 }, - { "month": 6, "new_cases": 281, "incidence": 11, "new_dead": 0, "incidence_dead": 0 }, - { "month": 7, "new_cases": 2396, "incidence": 96, "new_dead": 4, "incidence_dead": 0.2 }, - { "month": 8, "new_cases": -70, "incidence": -3, "new_dead": 10, "incidence_dead": 0.4 }, - { "month": 9, "new_cases": 1884, "incidence": 75, "new_dead": 0, "incidence_dead": 0 }, - { "month": 10, "new_cases": 8625, "incidence": 344, "new_dead": 28, "incidence_dead": 1.1 }, - { "month": 11, "new_cases": 17544, "incidence": 701, "new_dead": 169, "incidence_dead": 6.7 }, - ], - maxCases: 17544 - }, - { - "name": "Madagascar", "continent": "Africa", "alpha2": "mg", "population": 27691019, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 54, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 4, "new_cases": 71, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 5, "new_cases": 643, "incidence": 1, "new_dead": 5, "incidence_dead": 0 }, - { "month": 6, "new_cases": 1443, "incidence": 1, "new_dead": 14, "incidence_dead": 0 }, - { "month": 7, "new_cases": 8654, "incidence": 8, "new_dead": 86, "incidence_dead": 0.1 }, - { "month": 8, "new_cases": 3995, "incidence": 4, "new_dead": 86, "incidence_dead": 0.1 }, - { "month": 9, "new_cases": 1545, "incidence": 1, "new_dead": 38, "incidence_dead": 0 }, - { "month": 10, "new_cases": 703, "incidence": 1, "new_dead": 14, "incidence_dead": 0 }, - { "month": 11, "new_cases": 230, "incidence": 0, "new_dead": 7, "incidence_dead": 0 }, - ], - maxCases: 8654 - }, - { - "name": "Malawi", "continent": "Africa", "alpha2": "mw", "population": 19129955, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 4, "new_cases": 34, "incidence": 0, "new_dead": 2, "incidence_dead": 0 }, - { "month": 5, "new_cases": 247, "incidence": 0, "new_dead": 1, "incidence_dead": 0 }, - { "month": 6, "new_cases": 940, "incidence": 1, "new_dead": 10, "incidence_dead": 0 }, - { "month": 7, "new_cases": 2854, "incidence": 4, "new_dead": 100, "incidence_dead": 0.1 }, - { "month": 8, "new_cases": 1488, "incidence": 2, "new_dead": 61, "incidence_dead": 0.1 }, - { "month": 9, "new_cases": 207, "incidence": 0, "new_dead": 4, "incidence_dead": 0 }, - { "month": 10, "new_cases": 157, "incidence": 0, "new_dead": 5, "incidence_dead": 0 }, - { "month": 11, "new_cases": 98, "incidence": 0, "new_dead": 1, "incidence_dead": 0 }, - ], - maxCases: 2854 - }, - { - "name": "Malaysia", "continent": "Asia", "alpha2": "my", "population": 32365998, "months": [ - { "month": 2, "new_cases": 17, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 2741, "incidence": 2, "new_dead": 41, "incidence_dead": 0 }, - { "month": 4, "new_cases": 3236, "incidence": 2, "new_dead": 59, "incidence_dead": 0 }, - { "month": 5, "new_cases": 1817, "incidence": 1, "new_dead": 13, "incidence_dead": 0 }, - { "month": 6, "new_cases": 820, "incidence": 1, "new_dead": 6, "incidence_dead": 0 }, - { "month": 7, "new_cases": 337, "incidence": 0, "new_dead": 4, "incidence_dead": 0 }, - { "month": 8, "new_cases": 364, "incidence": 0, "new_dead": 2, "incidence_dead": 0 }, - { "month": 9, "new_cases": 1884, "incidence": 1, "new_dead": 9, "incidence_dead": 0 }, - { "month": 10, "new_cases": 20324, "incidence": 16, "new_dead": 113, "incidence_dead": 0.1 }, - { "month": 11, "new_cases": 34149, "incidence": 26, "new_dead": 111, "incidence_dead": 0.1 }, - ], - maxCases: 34149 - }, - { - "name": "Maldives", "continent": "Asia", "alpha2": "mv", "population": 540542, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 14, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, - { "month": 4, "new_cases": 450, "incidence": 21, "new_dead": 0, "incidence_dead": 0 }, - { "month": 5, "new_cases": 1305, "incidence": 60, "new_dead": 4, "incidence_dead": 0.2 }, - { "month": 6, "new_cases": 588, "incidence": 27, "new_dead": 4, "incidence_dead": 0.2 }, - { "month": 7, "new_cases": 1432, "incidence": 66, "new_dead": 7, "incidence_dead": 0.3 }, - { "month": 8, "new_cases": 4011, "incidence": 186, "new_dead": 12, "incidence_dead": 0.6 }, - { "month": 9, "new_cases": 2487, "incidence": 115, "new_dead": 6, "incidence_dead": 0.3 }, - { "month": 10, "new_cases": 1368, "incidence": 63, "new_dead": 4, "incidence_dead": 0.2 }, - { "month": 11, "new_cases": 1352, "incidence": 63, "new_dead": 8, "incidence_dead": 0.4 }, - ], - maxCases: 4011 - }, - { - "name": "Mali", "continent": "Africa", "alpha2": "ml", "population": 20250834, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 26, "incidence": 0, "new_dead": 1, "incidence_dead": 0 }, - { "month": 4, "new_cases": 462, "incidence": 1, "new_dead": 24, "incidence_dead": 0 }, - { "month": 5, "new_cases": 775, "incidence": 1, "new_dead": 51, "incidence_dead": 0.1 }, - { "month": 6, "new_cases": 916, "incidence": 1, "new_dead": 39, "incidence_dead": 0 }, - { "month": 7, "new_cases": 354, "incidence": 0, "new_dead": 8, "incidence_dead": 0 }, - { "month": 8, "new_cases": 241, "incidence": 0, "new_dead": 2, "incidence_dead": 0 }, - { "month": 9, "new_cases": 342, "incidence": 0, "new_dead": 5, "incidence_dead": 0 }, - { "month": 10, "new_cases": 436, "incidence": 1, "new_dead": 5, "incidence_dead": 0 }, - { "month": 11, "new_cases": 1156, "incidence": 1, "new_dead": 20, "incidence_dead": 0 }, - ], - maxCases: 1156 - }, - { - "name": "Malta", "continent": "Europe", "alpha2": "mt", "population": 441539, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 166, "incidence": 9, "new_dead": 0, "incidence_dead": 0 }, - { "month": 4, "new_cases": 296, "incidence": 17, "new_dead": 3, "incidence_dead": 0.2 }, - { "month": 5, "new_cases": 153, "incidence": 9, "new_dead": 5, "incidence_dead": 0.3 }, - { "month": 6, "new_cases": 52, "incidence": 3, "new_dead": 0, "incidence_dead": 0 }, - { "month": 7, "new_cases": 154, "incidence": 9, "new_dead": 0, "incidence_dead": 0 }, - { "month": 8, "new_cases": 1059, "incidence": 60, "new_dead": 3, "incidence_dead": 0.2 }, - { "month": 9, "new_cases": 1175, "incidence": 67, "new_dead": 23, "incidence_dead": 1.3 }, - { "month": 10, "new_cases": 2984, "incidence": 169, "new_dead": 27, "incidence_dead": 1.5 }, - { "month": 11, "new_cases": 3831, "incidence": 217, "new_dead": 75, "incidence_dead": 4.2 }, - ], - maxCases: 3831 - }, - { - "name": "Marshall Islands", "continent": "Oceania", "alpha2": "mh", "population": 59194, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 4, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 5, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 6, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 7, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 8, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 9, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 10, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 11, "new_cases": 2, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, - ], - maxCases: 2 - }, - { - "name": "Mauritania", "continent": "Africa", "alpha2": "mr", "population": 4649660, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 5, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 4, "new_cases": 2, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 5, "new_cases": 522, "incidence": 3, "new_dead": 22, "incidence_dead": 0.1 }, - { "month": 6, "new_cases": 3833, "incidence": 21, "new_dead": 106, "incidence_dead": 0.6 }, - { "month": 7, "new_cases": 1947, "incidence": 10, "new_dead": 28, "incidence_dead": 0.2 }, - { "month": 8, "new_cases": 738, "incidence": 4, "new_dead": 2, "incidence_dead": 0 }, - { "month": 9, "new_cases": 454, "incidence": 2, "new_dead": 2, "incidence_dead": 0 }, - { "month": 10, "new_cases": 201, "incidence": 1, "new_dead": 2, "incidence_dead": 0 }, - { "month": 11, "new_cases": 898, "incidence": 5, "new_dead": 14, "incidence_dead": 0.1 }, - ], - maxCases: 3833 - }, - { - "name": "Mauritius", "continent": "Africa", "alpha2": "mu", "population": 1271767, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 140, "incidence": 3, "new_dead": 4, "incidence_dead": 0.1 }, - { "month": 4, "new_cases": 189, "incidence": 4, "new_dead": 5, "incidence_dead": 0.1 }, - { "month": 5, "new_cases": 3, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 6, "new_cases": 6, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 7, "new_cases": 3, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 8, "new_cases": 12, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 9, "new_cases": 25, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 10, "new_cases": 60, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, - { "month": 11, "new_cases": 63, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, - ], - maxCases: 189 - }, - { - "name": "Mexico", "continent": "North America", "alpha2": "mx", "population": 128932753, "months": [ - { "month": 2, "new_cases": 3, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 1211, "incidence": 0, "new_dead": 28, "incidence_dead": 0 }, - { "month": 4, "new_cases": 18009, "incidence": 3, "new_dead": 1830, "incidence_dead": 0.4 }, - { "month": 5, "new_cases": 71440, "incidence": 14, "new_dead": 8071, "incidence_dead": 1.6 }, - { "month": 6, "new_cases": 135425, "incidence": 26, "new_dead": 17839, "incidence_dead": 3.5 }, - { "month": 7, "new_cases": 198548, "incidence": 38, "new_dead": 18919, "incidence_dead": 3.7 }, - { "month": 8, "new_cases": 174923, "incidence": 34, "new_dead": 17726, "incidence_dead": 3.4 }, - { "month": 9, "new_cases": 143656, "incidence": 28, "new_dead": 13232, "incidence_dead": 2.6 }, - { "month": 10, "new_cases": 181746, "incidence": 35, "new_dead": 14107, "incidence_dead": 2.7 }, - { "month": 11, "new_cases": 188581, "incidence": 37, "new_dead": 14187, "incidence_dead": 2.8 }, - ], - maxCases: 198548 - }, - { - "name": "Moldova", "continent": "Europe", "alpha2": "md", "population": 4033963, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 352, "incidence": 2, "new_dead": 3, "incidence_dead": 0 }, - { "month": 4, "new_cases": 3544, "incidence": 22, "new_dead": 112, "incidence_dead": 0.7 }, - { "month": 5, "new_cases": 4354, "incidence": 27, "new_dead": 179, "incidence_dead": 1.1 }, - { "month": 6, "new_cases": 8362, "incidence": 52, "new_dead": 250, "incidence_dead": 1.5 }, - { "month": 7, "new_cases": 8120, "incidence": 50, "new_dead": 233, "incidence_dead": 1.4 }, - { "month": 8, "new_cases": 12187, "incidence": 76, "new_dead": 217, "incidence_dead": 1.3 }, - { "month": 9, "new_cases": 16122, "incidence": 100, "new_dead": 325, "incidence_dead": 2 }, - { "month": 10, "new_cases": 22998, "incidence": 143, "new_dead": 465, "incidence_dead": 2.9 }, - { "month": 11, "new_cases": 31324, "incidence": 194, "new_dead": 519, "incidence_dead": 3.2 }, - ], - maxCases: 31324 - }, - { - "name": "Monaco", "continent": "Europe", "alpha2": "mc", "population": 39244, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 51, "incidence": 32, "new_dead": 0, "incidence_dead": 0 }, - { "month": 4, "new_cases": 43, "incidence": 27, "new_dead": 3, "incidence_dead": 1.9 }, - { "month": 5, "new_cases": 4, "incidence": 3, "new_dead": 0, "incidence_dead": 0 }, - { "month": 6, "new_cases": 4, "incidence": 3, "new_dead": 0, "incidence_dead": 0 }, - { "month": 7, "new_cases": 17, "incidence": 11, "new_dead": 0, "incidence_dead": 0 }, - { "month": 8, "new_cases": 34, "incidence": 22, "new_dead": 0, "incidence_dead": 0 }, - { "month": 9, "new_cases": 64, "incidence": 41, "new_dead": -2, "incidence_dead": -1.3 }, - { "month": 10, "new_cases": 141, "incidence": 90, "new_dead": 0, "incidence_dead": 0 }, - { "month": 11, "new_cases": 250, "incidence": 159, "new_dead": 1, "incidence_dead": 0.6 }, - ], - maxCases: 250 - }, - { - "name": "Mongolia", "continent": "Asia", "alpha2": "mn", "population": 3278292, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 11, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 4, "new_cases": 26, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 5, "new_cases": 141, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, - { "month": 6, "new_cases": 41, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 7, "new_cases": 71, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, - { "month": 8, "new_cases": 13, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 9, "new_cases": 9, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 10, "new_cases": 33, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 11, "new_cases": 455, "incidence": 3, "new_dead": 0, "incidence_dead": 0 }, - ], - maxCases: 455 - }, - { - "name": "Montenegro", "continent": "Europe", "alpha2": "me", "population": 628062, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 107, "incidence": 4, "new_dead": 1, "incidence_dead": 0 }, - { "month": 4, "new_cases": 213, "incidence": 8, "new_dead": 5, "incidence_dead": 0.2 }, - { "month": 5, "new_cases": 2, "incidence": 0, "new_dead": 2, "incidence_dead": 0.1 }, - { "month": 6, "new_cases": 224, "incidence": 9, "new_dead": 3, "incidence_dead": 0.1 }, - { "month": 7, "new_cases": 2525, "incidence": 101, "new_dead": 36, "incidence_dead": 1.4 }, - { "month": 8, "new_cases": 1762, "incidence": 70, "new_dead": 52, "incidence_dead": 2.1 }, - { "month": 9, "new_cases": 5937, "incidence": 236, "new_dead": 69, "incidence_dead": 2.7 }, - { "month": 10, "new_cases": 7569, "incidence": 301, "new_dead": 132, "incidence_dead": 5.3 }, - { "month": 11, "new_cases": 16924, "incidence": 674, "new_dead": 198, "incidence_dead": 7.9 }, - ], - maxCases: 16924 - }, - { - "name": "Morocco", "continent": "Africa", "alpha2": "ma", "population": 36910558, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 616, "incidence": 0, "new_dead": 35, "incidence_dead": 0 }, - { "month": 4, "new_cases": 3806, "incidence": 3, "new_dead": 134, "incidence_dead": 0.1 }, - { "month": 5, "new_cases": 3384, "incidence": 2, "new_dead": 35, "incidence_dead": 0 }, - { "month": 6, "new_cases": 4726, "incidence": 3, "new_dead": 23, "incidence_dead": 0 }, - { "month": 7, "new_cases": 11789, "incidence": 8, "new_dead": 125, "incidence_dead": 0.1 }, - { "month": 8, "new_cases": 38268, "incidence": 26, "new_dead": 788, "incidence_dead": 0.5 }, - { "month": 9, "new_cases": 61063, "incidence": 41, "new_dead": 1053, "incidence_dead": 0.7 }, - { "month": 10, "new_cases": 95431, "incidence": 65, "new_dead": 1501, "incidence_dead": 1 }, - { "month": 11, "new_cases": 137252, "incidence": 93, "new_dead": 2151, "incidence_dead": 1.5 }, - ], - maxCases: 137252 - }, - { - "name": "Mozambique", "continent": "Africa", "alpha2": "mz", "population": 31255435, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 7, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 4, "new_cases": 68, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 5, "new_cases": 178, "incidence": 0, "new_dead": 1, "incidence_dead": 0 }, - { "month": 6, "new_cases": 635, "incidence": 1, "new_dead": 4, "incidence_dead": 0 }, - { "month": 7, "new_cases": 975, "incidence": 1, "new_dead": 5, "incidence_dead": 0 }, - { "month": 8, "new_cases": 2052, "incidence": 2, "new_dead": 12, "incidence_dead": 0 }, - { "month": 9, "new_cases": 4812, "incidence": 4, "new_dead": 38, "incidence_dead": 0 }, - { "month": 10, "new_cases": 4141, "incidence": 3, "new_dead": 31, "incidence_dead": 0 }, - { "month": 11, "new_cases": 2832, "incidence": 2, "new_dead": 39, "incidence_dead": 0 }, - ], - maxCases: 4812 - }, - { - "name": "Myanmar", "continent": "Asia", "alpha2": "mm", "population": 54409794, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 7, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 4, "new_cases": 136, "incidence": 0, "new_dead": 5, "incidence_dead": 0 }, - { "month": 5, "new_cases": 73, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 6, "new_cases": 75, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 7, "new_cases": 54, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 8, "new_cases": 529, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 9, "new_cases": 12491, "incidence": 6, "new_dead": 304, "incidence_dead": 0.1 }, - { "month": 10, "new_cases": 39333, "incidence": 18, "new_dead": 927, "incidence_dead": 0.4 }, - { "month": 11, "new_cases": 38007, "incidence": 17, "new_dead": 704, "incidence_dead": 0.3 }, - ], - maxCases: 39333 - }, - { - "name": "Namibia", "continent": "Africa", "alpha2": "na", "population": 2540916, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 9, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 4, "new_cases": 5, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 5, "new_cases": 8, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 6, "new_cases": 181, "incidence": 2, "new_dead": 0, "incidence_dead": 0 }, - { "month": 7, "new_cases": 1924, "incidence": 19, "new_dead": 9, "incidence_dead": 0.1 }, - { "month": 8, "new_cases": 5421, "incidence": 53, "new_dead": 65, "incidence_dead": 0.6 }, - { "month": 9, "new_cases": 3715, "incidence": 37, "new_dead": 46, "incidence_dead": 0.5 }, - { "month": 10, "new_cases": 1670, "incidence": 16, "new_dead": 12, "incidence_dead": 0.1 }, - { "month": 11, "new_cases": 1445, "incidence": 14, "new_dead": 18, "incidence_dead": 0.2 }, - ], - maxCases: 5421 - }, - { - "name": "Nepal", "continent": "Asia", "alpha2": "np", "population": 29136808, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 4, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 4, "new_cases": 52, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 5, "new_cases": 1515, "incidence": 1, "new_dead": 7, "incidence_dead": 0 }, - { "month": 6, "new_cases": 11992, "incidence": 10, "new_dead": 21, "incidence_dead": 0 }, - { "month": 7, "new_cases": 6207, "incidence": 5, "new_dead": 27, "incidence_dead": 0 }, - { "month": 8, "new_cases": 19689, "incidence": 17, "new_dead": 172, "incidence_dead": 0.1 }, - { "month": 9, "new_cases": 38357, "incidence": 33, "new_dead": 270, "incidence_dead": 0.2 }, - { "month": 10, "new_cases": 92926, "incidence": 80, "new_dead": 439, "incidence_dead": 0.4 }, - { "month": 11, "new_cases": 62709, "incidence": 54, "new_dead": 571, "incidence_dead": 0.5 }, - ], - maxCases: 92926 - }, - { - "name": "Netherlands", "continent": "Europe", "alpha2": "nl", "population": 17134873, "months": [ - { "month": 2, "new_cases": 5, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 12661, "incidence": 18, "new_dead": 1039, "incidence_dead": 1.5 }, - { "month": 4, "new_cases": 26845, "incidence": 39, "new_dead": 3771, "incidence_dead": 5.5 }, - { "month": 5, "new_cases": 7133, "incidence": 10, "new_dead": 1164, "incidence_dead": 1.7 }, - { "month": 6, "new_cases": 3838, "incidence": 6, "new_dead": 157, "incidence_dead": 0.2 }, - { "month": 7, "new_cases": 4107, "incidence": 6, "new_dead": 34, "incidence_dead": 0 }, - { "month": 8, "new_cases": 18642, "incidence": 27, "new_dead": 86, "incidence_dead": 0.1 }, - { "month": 9, "new_cases": 52756, "incidence": 77, "new_dead": 205, "incidence_dead": 0.3 }, - { "month": 10, "new_cases": 231652, "incidence": 338, "new_dead": 1002, "incidence_dead": 1.5 }, - { "month": 11, "new_cases": 174290, "incidence": 254, "new_dead": 1994, "incidence_dead": 2.9 }, - ], - maxCases: 231652 - }, - { - "name": "New Zealand", "continent": "Oceania", "alpha2": "nz", "population": 4822233, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 646, "incidence": 3, "new_dead": 0, "incidence_dead": 0 }, - { "month": 4, "new_cases": 832, "incidence": 4, "new_dead": 18, "incidence_dead": 0.1 }, - { "month": 5, "new_cases": 25, "incidence": 0, "new_dead": 3, "incidence_dead": 0 }, - { "month": 6, "new_cases": 24, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 7, "new_cases": 34, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 8, "new_cases": 190, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, - { "month": 9, "new_cases": 96, "incidence": 0, "new_dead": 3, "incidence_dead": 0 }, - { "month": 10, "new_cases": 111, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, - { "month": 11, "new_cases": 100, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, - ], - maxCases: 832 - }, - { - "name": "Nicaragua", "continent": "North America", "alpha2": "ni", "population": 6624554, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 4, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 4, "new_cases": 9, "incidence": 0, "new_dead": 2, "incidence_dead": 0 }, - { "month": 5, "new_cases": 745, "incidence": 3, "new_dead": 32, "incidence_dead": 0.1 }, - { "month": 6, "new_cases": 1760, "incidence": 7, "new_dead": 48, "incidence_dead": 0.2 }, - { "month": 7, "new_cases": 1153, "incidence": 4, "new_dead": 33, "incidence_dead": 0.1 }, - { "month": 8, "new_cases": 822, "incidence": 3, "new_dead": 21, "incidence_dead": 0.1 }, - { "month": 9, "new_cases": 676, "incidence": 3, "new_dead": 14, "incidence_dead": 0.1 }, - { "month": 10, "new_cases": 344, "incidence": 1, "new_dead": 5, "incidence_dead": 0 }, - { "month": 11, "new_cases": 270, "incidence": 1, "new_dead": 4, "incidence_dead": 0 }, - ], - maxCases: 1760 - }, - { - "name": "Niger", "continent": "Africa", "alpha2": "ne", "population": 24206636, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 26, "incidence": 0, "new_dead": 2, "incidence_dead": 0 }, - { "month": 4, "new_cases": 692, "incidence": 1, "new_dead": 29, "incidence_dead": 0 }, - { "month": 5, "new_cases": 239, "incidence": 0, "new_dead": 32, "incidence_dead": 0 }, - { "month": 6, "new_cases": 117, "incidence": 0, "new_dead": 3, "incidence_dead": 0 }, - { "month": 7, "new_cases": 59, "incidence": 0, "new_dead": 2, "incidence_dead": 0 }, - { "month": 8, "new_cases": 42, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 9, "new_cases": 21, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 10, "new_cases": 23, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 11, "new_cases": 328, "incidence": 0, "new_dead": 3, "incidence_dead": 0 }, - ], - maxCases: 692 - }, - { - "name": "Nigeria", "continent": "Africa", "alpha2": "ng", "population": 206139587, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 134, "incidence": 0, "new_dead": 1, "incidence_dead": 0 }, - { "month": 4, "new_cases": 1797, "incidence": 0, "new_dead": 56, "incidence_dead": 0 }, - { "month": 5, "new_cases": 8230, "incidence": 1, "new_dead": 229, "incidence_dead": 0 }, - { "month": 6, "new_cases": 15532, "incidence": 2, "new_dead": 303, "incidence_dead": 0 }, - { "month": 7, "new_cases": 17457, "incidence": 2, "new_dead": 289, "incidence_dead": 0 }, - { "month": 8, "new_cases": 10857, "incidence": 1, "new_dead": 134, "incidence_dead": 0 }, - { "month": 9, "new_cases": 4840, "incidence": 1, "new_dead": 99, "incidence_dead": 0 }, - { "month": 10, "new_cases": 4005, "incidence": 0, "new_dead": 32, "incidence_dead": 0 }, - { "month": 11, "new_cases": 4704, "incidence": 1, "new_dead": 29, "incidence_dead": 0 }, - ], - maxCases: 17457 - }, - { - "name": "North Macedonia", "continent": "Europe", "alpha2": "mk", "population": 2083380, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 328, "incidence": 4, "new_dead": 8, "incidence_dead": 0.1 }, - { "month": 4, "new_cases": 1136, "incidence": 14, "new_dead": 68, "incidence_dead": 0.8 }, - { "month": 5, "new_cases": 761, "incidence": 9, "new_dead": 56, "incidence_dead": 0.7 }, - { "month": 6, "new_cases": 4108, "incidence": 49, "new_dead": 169, "incidence_dead": 2 }, - { "month": 7, "new_cases": 4420, "incidence": 53, "new_dead": 184, "incidence_dead": 2.2 }, - { "month": 8, "new_cases": 3587, "incidence": 43, "new_dead": 117, "incidence_dead": 1.4 }, - { "month": 9, "new_cases": 3636, "incidence": 44, "new_dead": 136, "incidence_dead": 1.6 }, - { "month": 10, "new_cases": 13595, "incidence": 163, "new_dead": 255, "incidence_dead": 3.1 }, - { "month": 11, "new_cases": 30306, "incidence": 364, "new_dead": 769, "incidence_dead": 9.2 }, - ], - maxCases: 30306 - }, - { - "name": "Norway", "continent": "Europe", "alpha2": "no", "population": 5421242, "months": [ - { "month": 2, "new_cases": 14, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 4626, "incidence": 21, "new_dead": 36, "incidence_dead": 0.2 }, - { "month": 4, "new_cases": 3097, "incidence": 14, "new_dead": 171, "incidence_dead": 0.8 }, - { "month": 5, "new_cases": 702, "incidence": 3, "new_dead": 26, "incidence_dead": 0.1 }, - { "month": 6, "new_cases": 439, "incidence": 2, "new_dead": 14, "incidence_dead": 0.1 }, - { "month": 7, "new_cases": 361, "incidence": 2, "new_dead": 5, "incidence_dead": 0 }, - { "month": 8, "new_cases": 1542, "incidence": 7, "new_dead": 9, "incidence_dead": 0 }, - { "month": 9, "new_cases": 3245, "incidence": 15, "new_dead": 10, "incidence_dead": 0 }, - { "month": 10, "new_cases": 6304, "incidence": 29, "new_dead": 8, "incidence_dead": 0 }, - { "month": 11, "new_cases": 15819, "incidence": 73, "new_dead": 50, "incidence_dead": 0.2 }, - ], - maxCases: 15819 - }, - { - "name": "Oman", "continent": "Asia", "alpha2": "om", "population": 5106622, "months": [ - { "month": 2, "new_cases": 4, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 186, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, - { "month": 4, "new_cases": 2156, "incidence": 11, "new_dead": 10, "incidence_dead": 0 }, - { "month": 5, "new_cases": 9089, "incidence": 44, "new_dead": 38, "incidence_dead": 0.2 }, - { "month": 6, "new_cases": 28633, "incidence": 140, "new_dead": 127, "incidence_dead": 0.6 }, - { "month": 7, "new_cases": 39089, "incidence": 191, "new_dead": 245, "incidence_dead": 1.2 }, - { "month": 8, "new_cases": 6563, "incidence": 32, "new_dead": 264, "incidence_dead": 1.3 }, - { "month": 9, "new_cases": 12863, "incidence": 63, "new_dead": 250, "incidence_dead": 1.2 }, - { "month": 10, "new_cases": 15849, "incidence": 78, "new_dead": 273, "incidence_dead": 1.3 }, - { "month": 11, "new_cases": 9265, "incidence": 45, "new_dead": 215, "incidence_dead": 1.1 }, - ], - maxCases: 39089 - }, - { - "name": "Pakistan", "continent": "Asia", "alpha2": "pk", "population": 220892331, "months": [ - { "month": 2, "new_cases": 2, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 2114, "incidence": 0, "new_dead": 25, "incidence_dead": 0 }, - { "month": 4, "new_cases": 15996, "incidence": 2, "new_dead": 390, "incidence_dead": 0 }, - { "month": 5, "new_cases": 54346, "incidence": 6, "new_dead": 1126, "incidence_dead": 0.1 }, - { "month": 6, "new_cases": 141010, "incidence": 16, "new_dead": 2852, "incidence_dead": 0.3 }, - { "month": 7, "new_cases": 64835, "incidence": 7, "new_dead": 1556, "incidence_dead": 0.2 }, - { "month": 8, "new_cases": 17544, "incidence": 2, "new_dead": 343, "incidence_dead": 0 }, - { "month": 9, "new_cases": 16957, "incidence": 2, "new_dead": 190, "incidence_dead": 0 }, - { "month": 10, "new_cases": 21164, "incidence": 2, "new_dead": 339, "incidence_dead": 0 }, - { "month": 11, "new_cases": 66512, "incidence": 8, "new_dead": 1268, "incidence_dead": 0.1 }, - ], - maxCases: 141010 - }, - { - "name": "Panama", "continent": "North America", "alpha2": "pa", "population": 4314768, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 1180, "incidence": 7, "new_dead": 29, "incidence_dead": 0.2 }, - { "month": 4, "new_cases": 5351, "incidence": 31, "new_dead": 158, "incidence_dead": 0.9 }, - { "month": 5, "new_cases": 6931, "incidence": 40, "new_dead": 148, "incidence_dead": 0.9 }, - { "month": 6, "new_cases": 20087, "incidence": 116, "new_dead": 295, "incidence_dead": 1.7 }, - { "month": 7, "new_cases": 31706, "incidence": 184, "new_dead": 790, "incidence_dead": 4.6 }, - { "month": 8, "new_cases": 27726, "incidence": 161, "new_dead": 581, "incidence_dead": 3.4 }, - { "month": 9, "new_cases": 19613, "incidence": 114, "new_dead": 370, "incidence_dead": 2.1 }, - { "month": 10, "new_cases": 21003, "incidence": 122, "new_dead": 328, "incidence_dead": 1.9 }, - { "month": 11, "new_cases": 32208, "incidence": 187, "new_dead": 379, "incidence_dead": 2.2 }, - ], - maxCases: 32208 - }, - { - "name": "Papua New Guinea", "continent": "Oceania", "alpha2": "pg", "population": 8947027, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 4, "new_cases": 7, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 5, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 6, "new_cases": 3, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 7, "new_cases": 61, "incidence": 0, "new_dead": 1, "incidence_dead": 0 }, - { "month": 8, "new_cases": 387, "incidence": 1, "new_dead": 3, "incidence_dead": 0 }, - { "month": 9, "new_cases": 75, "incidence": 0, "new_dead": 2, "incidence_dead": 0 }, - { "month": 10, "new_cases": 55, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 11, "new_cases": 67, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - ], - maxCases: 387 - }, - { - "name": "Paraguay", "continent": "South America", "alpha2": "py", "population": 7132530, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 64, "incidence": 0, "new_dead": 2, "incidence_dead": 0 }, - { "month": 4, "new_cases": 201, "incidence": 1, "new_dead": 7, "incidence_dead": 0 }, - { "month": 5, "new_cases": 720, "incidence": 3, "new_dead": 1, "incidence_dead": 0 }, - { "month": 6, "new_cases": 1235, "incidence": 4, "new_dead": 6, "incidence_dead": 0 }, - { "month": 7, "new_cases": 3117, "incidence": 11, "new_dead": 32, "incidence_dead": 0.1 }, - { "month": 8, "new_cases": 12324, "incidence": 43, "new_dead": 277, "incidence_dead": 1 }, - { "month": 9, "new_cases": 23096, "incidence": 81, "new_dead": 531, "incidence_dead": 1.9 }, - { "month": 10, "new_cases": 22427, "incidence": 79, "new_dead": 547, "incidence_dead": 1.9 }, - { "month": 11, "new_cases": 19239, "incidence": 67, "new_dead": 352, "incidence_dead": 1.2 }, - ], - maxCases: 23096 - }, - { - "name": "Peru", "continent": "South America", "alpha2": "pe", "population": 32971846, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 1064, "incidence": 1, "new_dead": 27, "incidence_dead": 0 }, - { "month": 4, "new_cases": 35911, "incidence": 27, "new_dead": 1021, "incidence_dead": 0.8 }, - { "month": 5, "new_cases": 127500, "incidence": 97, "new_dead": 3455, "incidence_dead": 2.6 }, - { "month": 6, "new_cases": 120737, "incidence": 92, "new_dead": 5171, "incidence_dead": 3.9 }, - { "month": 7, "new_cases": 122279, "incidence": 93, "new_dead": 9344, "incidence_dead": 7.1 }, - { "month": 8, "new_cases": 239674, "incidence": 182, "new_dead": 9767, "incidence_dead": 7.4 }, - { "month": 9, "new_cases": 164602, "incidence": 125, "new_dead": 3608, "incidence_dead": 2.7 }, - { "month": 10, "new_cases": 88412, "incidence": 67, "new_dead": 2015, "incidence_dead": 1.5 }, - { "month": 11, "new_cases": 62350, "incidence": 47, "new_dead": 1512, "incidence_dead": 1.1 }, - ], - maxCases: 239674 - }, - { - "name": "Philippines", "continent": "Asia", "alpha2": "ph", "population": 109581085, "months": [ - { "month": 2, "new_cases": 2, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 2081, "incidence": 0, "new_dead": 87, "incidence_dead": 0 }, - { "month": 4, "new_cases": 6404, "incidence": 1, "new_dead": 480, "incidence_dead": 0.1 }, - { "month": 5, "new_cases": 9598, "incidence": 2, "new_dead": 389, "incidence_dead": 0.1 }, - { "month": 6, "new_cases": 19428, "incidence": 4, "new_dead": 309, "incidence_dead": 0.1 }, - { "month": 7, "new_cases": 55840, "incidence": 13, "new_dead": 757, "incidence_dead": 0.2 }, - { "month": 8, "new_cases": 127465, "incidence": 29, "new_dead": 1535, "incidence_dead": 0.4 }, - { "month": 9, "new_cases": 90875, "incidence": 21, "new_dead": 1946, "incidence_dead": 0.4 }, - { "month": 10, "new_cases": 69035, "incidence": 16, "new_dead": 1717, "incidence_dead": 0.4 }, - { "month": 11, "new_cases": 50901, "incidence": 12, "new_dead": 1171, "incidence_dead": 0.3 }, - ], - maxCases: 127465 - }, - { - "name": "Poland", "continent": "Europe", "alpha2": "pl", "population": 37846605, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 2310, "incidence": 2, "new_dead": 32, "incidence_dead": 0 }, - { "month": 4, "new_cases": 10566, "incidence": 7, "new_dead": 611, "incidence_dead": 0.4 }, - { "month": 5, "new_cases": 10909, "incidence": 7, "new_dead": 420, "incidence_dead": 0.3 }, - { "month": 6, "new_cases": 10607, "incidence": 7, "new_dead": 399, "incidence_dead": 0.3 }, - { "month": 7, "new_cases": 11295, "incidence": 7, "new_dead": 253, "incidence_dead": 0.2 }, - { "month": 8, "new_cases": 21684, "incidence": 14, "new_dead": 323, "incidence_dead": 0.2 }, - { "month": 9, "new_cases": 24142, "incidence": 16, "new_dead": 474, "incidence_dead": 0.3 }, - { "month": 10, "new_cases": 271217, "incidence": 179, "new_dead": 3118, "incidence_dead": 2.1 }, - { "month": 11, "new_cases": 628080, "incidence": 415, "new_dead": 11519, "incidence_dead": 7.6 }, - ], - maxCases: 628080 - }, - { - "name": "Portugal", "continent": "Europe", "alpha2": "pt", "population": 10196707, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 7441, "incidence": 18, "new_dead": 159, "incidence_dead": 0.4 }, - { "month": 4, "new_cases": 17602, "incidence": 43, "new_dead": 829, "incidence_dead": 2 }, - { "month": 5, "new_cases": 7455, "incidence": 18, "new_dead": 421, "incidence_dead": 1 }, - { "month": 6, "new_cases": 9641, "incidence": 24, "new_dead": 166, "incidence_dead": 0.4 }, - { "month": 7, "new_cases": 8931, "incidence": 22, "new_dead": 159, "incidence_dead": 0.4 }, - { "month": 8, "new_cases": 6940, "incidence": 17, "new_dead": 87, "incidence_dead": 0.2 }, - { "month": 9, "new_cases": 17530, "incidence": 43, "new_dead": 149, "incidence_dead": 0.4 }, - { "month": 10, "new_cases": 65737, "incidence": 161, "new_dead": 536, "incidence_dead": 1.3 }, - { "month": 11, "new_cases": 156782, "incidence": 384, "new_dead": 1998, "incidence_dead": 4.9 }, - ], - maxCases: 156782 - }, - { - "name": "Qatar", "continent": "Asia", "alpha2": "qa", "population": 2881060, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 780, "incidence": 7, "new_dead": 1, "incidence_dead": 0 }, - { "month": 4, "new_cases": 12628, "incidence": 110, "new_dead": 8, "incidence_dead": 0.1 }, - { "month": 5, "new_cases": 43501, "incidence": 377, "new_dead": 28, "incidence_dead": 0.2 }, - { "month": 6, "new_cases": 39178, "incidence": 340, "new_dead": 75, "incidence_dead": 0.7 }, - { "month": 7, "new_cases": 14607, "incidence": 127, "new_dead": 61, "incidence_dead": 0.5 }, - { "month": 8, "new_cases": 8083, "incidence": 70, "new_dead": 23, "incidence_dead": 0.2 }, - { "month": 9, "new_cases": 6982, "incidence": 61, "new_dead": 17, "incidence_dead": 0.1 }, - { "month": 10, "new_cases": 6796, "incidence": 59, "new_dead": 18, "incidence_dead": 0.2 }, - { "month": 11, "new_cases": 6277, "incidence": 54, "new_dead": 5, "incidence_dead": 0 }, - ], - maxCases: 43501 - }, - { - "name": "Romania", "continent": "Europe", "alpha2": "ro", "population": 19237682, "months": [ - { "month": 2, "new_cases": 2, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 2242, "incidence": 3, "new_dead": 79, "incidence_dead": 0.1 }, - { "month": 4, "new_cases": 9995, "incidence": 13, "new_dead": 635, "incidence_dead": 0.8 }, - { "month": 5, "new_cases": 7017, "incidence": 9, "new_dead": 549, "incidence_dead": 0.7 }, - { "month": 6, "new_cases": 7713, "incidence": 10, "new_dead": 385, "incidence_dead": 0.5 }, - { "month": 7, "new_cases": 23916, "incidence": 31, "new_dead": 692, "incidence_dead": 0.9 }, - { "month": 8, "new_cases": 36654, "incidence": 48, "new_dead": 1278, "incidence_dead": 1.7 }, - { "month": 9, "new_cases": 40032, "incidence": 52, "new_dead": 1204, "incidence_dead": 1.6 }, - { "month": 10, "new_cases": 113767, "incidence": 148, "new_dead": 2143, "incidence_dead": 2.8 }, - { "month": 11, "new_cases": 234023, "incidence": 304, "new_dead": 4363, "incidence_dead": 5.7 }, - ], - maxCases: 234023 - }, - { - "name": "Russia", "continent": "Europe", "alpha2": "ru", "population": 145934460, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 2335, "incidence": 0, "new_dead": 16, "incidence_dead": 0 }, - { "month": 4, "new_cases": 104161, "incidence": 18, "new_dead": 1056, "incidence_dead": 0.2 }, - { "month": 5, "new_cases": 299345, "incidence": 51, "new_dead": 3620, "incidence_dead": 0.6 }, - { "month": 6, "new_cases": 241086, "incidence": 41, "new_dead": 4613, "incidence_dead": 0.8 }, - { "month": 7, "new_cases": 191532, "incidence": 33, "new_dead": 4633, "incidence_dead": 0.8 }, - { "month": 8, "new_cases": 153941, "incidence": 26, "new_dead": 3189, "incidence_dead": 0.5 }, - { "month": 9, "new_cases": 178397, "incidence": 31, "new_dead": 3502, "incidence_dead": 0.6 }, - { "month": 10, "new_cases": 435468, "incidence": 75, "new_dead": 7157, "incidence_dead": 1.2 }, - { "month": 11, "new_cases": 669669, "incidence": 115, "new_dead": 11704, "incidence_dead": 2 }, - ], - maxCases: 669669 - }, - { - "name": "Rwanda", "continent": "Africa", "alpha2": "rw", "population": 12952209, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 74, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 4, "new_cases": 168, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 5, "new_cases": 127, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 6, "new_cases": 655, "incidence": 1, "new_dead": 1, "incidence_dead": 0 }, - { "month": 7, "new_cases": 997, "incidence": 2, "new_dead": 3, "incidence_dead": 0 }, - { "month": 8, "new_cases": 2041, "incidence": 4, "new_dead": 11, "incidence_dead": 0 }, - { "month": 9, "new_cases": 777, "incidence": 1, "new_dead": 13, "incidence_dead": 0 }, - { "month": 10, "new_cases": 297, "incidence": 1, "new_dead": 6, "incidence_dead": 0 }, - { "month": 11, "new_cases": 797, "incidence": 2, "new_dead": 14, "incidence_dead": 0 }, - ], - maxCases: 2041 - }, - { - "name": "Saint Kitts and Nevis", "continent": "North America", "alpha2": "kn", "population": 53192, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 6, "incidence": 3, "new_dead": 0, "incidence_dead": 0 }, - { "month": 4, "new_cases": 7, "incidence": 3, "new_dead": 0, "incidence_dead": 0 }, - { "month": 5, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 6, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 7, "new_cases": 2, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, - { "month": 8, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 9, "new_cases": 2, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, - { "month": 10, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 11, "new_cases": 3, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, - ], - maxCases: 7 - }, - { - "name": "Saint Lucia", "continent": "North America", "alpha2": "lc", "population": 183629, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 12, "incidence": 2, "new_dead": 0, "incidence_dead": 0 }, - { "month": 4, "new_cases": 4, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, - { "month": 5, "new_cases": 1, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 6, "new_cases": 1, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 7, "new_cases": 6, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, - { "month": 8, "new_cases": 1, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 9, "new_cases": 1, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 10, "new_cases": 51, "incidence": 7, "new_dead": 0, "incidence_dead": 0 }, - { "month": 11, "new_cases": 181, "incidence": 25, "new_dead": 1, "incidence_dead": 0.1 }, - ], - maxCases: 181 - }, - { - "name": "Saint Vincent and the Grenadines", "continent": "North America", "alpha2": "vc", "population": 110947, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 4, "new_cases": 15, "incidence": 3, "new_dead": 0, "incidence_dead": 0 }, - { "month": 5, "new_cases": 10, "incidence": 2, "new_dead": 0, "incidence_dead": 0 }, - { "month": 6, "new_cases": 3, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, - { "month": 7, "new_cases": 25, "incidence": 6, "new_dead": 0, "incidence_dead": 0 }, - { "month": 8, "new_cases": 6, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, - { "month": 9, "new_cases": 4, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, - { "month": 10, "new_cases": 10, "incidence": 2, "new_dead": 0, "incidence_dead": 0 }, - { "month": 11, "new_cases": 11, "incidence": 2, "new_dead": 0, "incidence_dead": 0 }, - ], - maxCases: 25 - }, - { - "name": "Samoa", "continent": "Oceania", "alpha2": "ws", "population": 198410, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 4, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 5, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 6, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 7, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 8, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 9, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 10, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 11, "new_cases": 1, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - ], - maxCases: 1 - }, - { - "name": "San Marino", "continent": "Europe", "alpha2": "sm", "population": 33938, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 235, "incidence": 173, "new_dead": 25, "incidence_dead": 18.4 }, - { "month": 4, "new_cases": 333, "incidence": 245, "new_dead": 15, "incidence_dead": 11 }, - { "month": 5, "new_cases": 102, "incidence": 75, "new_dead": 1, "incidence_dead": 0.7 }, - { "month": 6, "new_cases": 27, "incidence": 20, "new_dead": 0, "incidence_dead": 0 }, - { "month": 7, "new_cases": 1, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, - { "month": 8, "new_cases": 16, "incidence": 12, "new_dead": 0, "incidence_dead": 0 }, - { "month": 9, "new_cases": 17, "incidence": 13, "new_dead": 0, "incidence_dead": 0 }, - { "month": 10, "new_cases": 196, "incidence": 144, "new_dead": 0, "incidence_dead": 0 }, - { "month": 11, "new_cases": 684, "incidence": 504, "new_dead": 4, "incidence_dead": 2.9 }, - ], - maxCases: 684 - }, - { - "name": "Sao Tome and Principe", "continent": "Africa", "alpha2": "st", "population": 219161, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 4, "new_cases": 10, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, - { "month": 5, "new_cases": 469, "incidence": 53, "new_dead": 11, "incidence_dead": 1.3 }, - { "month": 6, "new_cases": 231, "incidence": 26, "new_dead": 1, "incidence_dead": 0.1 }, - { "month": 7, "new_cases": 157, "incidence": 18, "new_dead": 2, "incidence_dead": 0.2 }, - { "month": 8, "new_cases": 25, "incidence": 3, "new_dead": 0, "incidence_dead": 0 }, - { "month": 9, "new_cases": 15, "incidence": 2, "new_dead": 0, "incidence_dead": 0 }, - { "month": 10, "new_cases": 34, "incidence": 4, "new_dead": 1, "incidence_dead": 0.1 }, - { "month": 11, "new_cases": 46, "incidence": 5, "new_dead": 1, "incidence_dead": 0.1 }, - ], - maxCases: 469 - }, - { - "name": "Saudi Arabia", "continent": "Asia", "alpha2": "sa", "population": 34813867, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 1562, "incidence": 1, "new_dead": 9, "incidence_dead": 0 }, - { "month": 4, "new_cases": 21190, "incidence": 15, "new_dead": 152, "incidence_dead": 0.1 }, - { "month": 5, "new_cases": 62508, "incidence": 45, "new_dead": 341, "incidence_dead": 0.2 }, - { "month": 6, "new_cases": 105562, "incidence": 76, "new_dead": 1146, "incidence_dead": 0.8 }, - { "month": 7, "new_cases": 85082, "incidence": 61, "new_dead": 1217, "incidence_dead": 0.9 }, - { "month": 8, "new_cases": 39867, "incidence": 29, "new_dead": 1031, "incidence_dead": 0.7 }, - { "month": 9, "new_cases": 18833, "incidence": 14, "new_dead": 871, "incidence_dead": 0.6 }, - { "month": 10, "new_cases": 12677, "incidence": 9, "new_dead": 634, "incidence_dead": 0.5 }, - { "month": 11, "new_cases": 10078, "incidence": 7, "new_dead": 494, "incidence_dead": 0.4 }, - ], - maxCases: 105562 - }, - { - "name": "Senegal", "continent": "Africa", "alpha2": "sn", "population": 16743930, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 174, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 4, "new_cases": 758, "incidence": 1, "new_dead": 8, "incidence_dead": 0 }, - { "month": 5, "new_cases": 2712, "incidence": 4, "new_dead": 33, "incidence_dead": 0 }, - { "month": 6, "new_cases": 3148, "incidence": 5, "new_dead": 70, "incidence_dead": 0.1 }, - { "month": 7, "new_cases": 3439, "incidence": 5, "new_dead": 93, "incidence_dead": 0.1 }, - { "month": 8, "new_cases": 3379, "incidence": 5, "new_dead": 79, "incidence_dead": 0.1 }, - { "month": 9, "new_cases": 1371, "incidence": 2, "new_dead": 27, "incidence_dead": 0 }, - { "month": 10, "new_cases": 634, "incidence": 1, "new_dead": 13, "incidence_dead": 0 }, - { "month": 11, "new_cases": 473, "incidence": 1, "new_dead": 9, "incidence_dead": 0 }, - ], - maxCases: 3439 - }, - { - "name": "Serbia", "continent": "Europe", "alpha2": "rs", "population": 6804596, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 899, "incidence": 3, "new_dead": 15, "incidence_dead": 0.1 }, - { "month": 4, "new_cases": 8109, "incidence": 30, "new_dead": 163, "incidence_dead": 0.6 }, - { "month": 5, "new_cases": 2403, "incidence": 9, "new_dead": 64, "incidence_dead": 0.2 }, - { "month": 6, "new_cases": 3152, "incidence": 12, "new_dead": 34, "incidence_dead": 0.1 }, - { "month": 7, "new_cases": 10988, "incidence": 40, "new_dead": 296, "incidence_dead": 1.1 }, - { "month": 8, "new_cases": 5854, "incidence": 22, "new_dead": 140, "incidence_dead": 0.5 }, - { "month": 9, "new_cases": 2145, "incidence": 8, "new_dead": 36, "incidence_dead": 0.1 }, - { "month": 10, "new_cases": 13403, "incidence": 49, "new_dead": 71, "incidence_dead": 0.3 }, - { "month": 11, "new_cases": 128484, "incidence": 472, "new_dead": 784, "incidence_dead": 2.9 }, - ], - maxCases: 128484 - }, - { - "name": "Seychelles", "continent": "Africa", "alpha2": "sc", "population": 98340, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 8, "incidence": 2, "new_dead": 0, "incidence_dead": 0 }, - { "month": 4, "new_cases": 1, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 5, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 6, "new_cases": 70, "incidence": 18, "new_dead": 0, "incidence_dead": 0 }, - { "month": 7, "new_cases": 33, "incidence": 8, "new_dead": 0, "incidence_dead": 0 }, - { "month": 8, "new_cases": 22, "incidence": 6, "new_dead": 0, "incidence_dead": 0 }, - { "month": 9, "new_cases": 8, "incidence": 2, "new_dead": 0, "incidence_dead": 0 }, - { "month": 10, "new_cases": 9, "incidence": 2, "new_dead": 0, "incidence_dead": 0 }, - { "month": 11, "new_cases": 30, "incidence": 8, "new_dead": 0, "incidence_dead": 0 }, - ], - maxCases: 70 - }, - { - "name": "Sierra Leone", "continent": "Africa", "alpha2": "sl", "population": 7976985, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 4, "new_cases": 123, "incidence": 0, "new_dead": 6, "incidence_dead": 0 }, - { "month": 5, "new_cases": 737, "incidence": 2, "new_dead": 39, "incidence_dead": 0.1 }, - { "month": 6, "new_cases": 601, "incidence": 2, "new_dead": 14, "incidence_dead": 0 }, - { "month": 7, "new_cases": 361, "incidence": 1, "new_dead": 7, "incidence_dead": 0 }, - { "month": 8, "new_cases": 199, "incidence": 1, "new_dead": 3, "incidence_dead": 0 }, - { "month": 9, "new_cases": 209, "incidence": 1, "new_dead": 2, "incidence_dead": 0 }, - { "month": 10, "new_cases": 135, "incidence": 0, "new_dead": 2, "incidence_dead": 0 }, - { "month": 11, "new_cases": 46, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - ], - maxCases: 737 - }, - { - "name": "Singapore", "continent": "Asia", "alpha2": "sg", "population": 5850343, "months": [ - { "month": 2, "new_cases": 89, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 824, "incidence": 4, "new_dead": 1, "incidence_dead": 0 }, - { "month": 4, "new_cases": 15243, "incidence": 65, "new_dead": 12, "incidence_dead": 0.1 }, - { "month": 5, "new_cases": 18715, "incidence": 80, "new_dead": 8, "incidence_dead": 0 }, - { "month": 6, "new_cases": 9023, "incidence": 39, "new_dead": 3, "incidence_dead": 0 }, - { "month": 7, "new_cases": 8298, "incidence": 35, "new_dead": 1, "incidence_dead": 0 }, - { "month": 8, "new_cases": 4607, "incidence": 20, "new_dead": 0, "incidence_dead": 0 }, - { "month": 9, "new_cases": 953, "incidence": 4, "new_dead": 0, "incidence_dead": 0 }, - { "month": 10, "new_cases": 250, "incidence": 1, "new_dead": 1, "incidence_dead": 0 }, - { "month": 11, "new_cases": 203, "incidence": 1, "new_dead": 1, "incidence_dead": 0 }, - ], - maxCases: 18715 - }, - { - "name": "Slovakia", "continent": "Europe", "alpha2": "sk", "population": 5459643, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 362, "incidence": 2, "new_dead": 0, "incidence_dead": 0 }, - { "month": 4, "new_cases": 1033, "incidence": 5, "new_dead": 22, "incidence_dead": 0.1 }, - { "month": 5, "new_cases": 125, "incidence": 1, "new_dead": 5, "incidence_dead": 0 }, - { "month": 6, "new_cases": 146, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, - { "month": 7, "new_cases": 625, "incidence": 3, "new_dead": 1, "incidence_dead": 0 }, - { "month": 8, "new_cases": 1625, "incidence": 7, "new_dead": 4, "incidence_dead": 0 }, - { "month": 9, "new_cases": 6224, "incidence": 29, "new_dead": 15, "incidence_dead": 0.1 }, - { "month": 10, "new_cases": 47523, "incidence": 218, "new_dead": 171, "incidence_dead": 0.8 }, - { "month": 11, "new_cases": 48265, "incidence": 221, "new_dead": 620, "incidence_dead": 2.8 }, - ], - maxCases: 48265 - }, - { - "name": "Slovenia", "continent": "Europe", "alpha2": "si", "population": 2078932, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 800, "incidence": 10, "new_dead": 14, "incidence_dead": 0.2 }, - { "month": 4, "new_cases": 627, "incidence": 8, "new_dead": 76, "incidence_dead": 0.9 }, - { "month": 5, "new_cases": 44, "incidence": 1, "new_dead": 17, "incidence_dead": 0.2 }, - { "month": 6, "new_cases": 127, "incidence": 2, "new_dead": 3, "incidence_dead": 0 }, - { "month": 7, "new_cases": 556, "incidence": 7, "new_dead": 8, "incidence_dead": 0.1 }, - { "month": 8, "new_cases": 727, "incidence": 9, "new_dead": 14, "incidence_dead": 0.2 }, - { "month": 9, "new_cases": 2807, "incidence": 34, "new_dead": 17, "incidence_dead": 0.2 }, - { "month": 10, "new_cases": 28617, "incidence": 344, "new_dead": 188, "incidence_dead": 2.3 }, - { "month": 11, "new_cases": 41507, "incidence": 499, "new_dead": 1097, "incidence_dead": 13.2 }, - ], - maxCases: 41507 - }, - { - "name": "Solomon Islands", "continent": "Oceania", "alpha2": "sb", "population": 686878, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 4, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 5, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 6, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 7, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 8, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 9, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 10, "new_cases": 6, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 11, "new_cases": 9, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - ], - maxCases: 9 - }, - { - "name": "Somalia", "continent": "Africa", "alpha2": "so", "population": 15893219, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 4, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 4, "new_cases": 596, "incidence": 1, "new_dead": 27, "incidence_dead": 0 }, - { "month": 5, "new_cases": 1375, "incidence": 2, "new_dead": 50, "incidence_dead": 0.1 }, - { "month": 6, "new_cases": 948, "incidence": 1, "new_dead": 12, "incidence_dead": 0 }, - { "month": 7, "new_cases": 288, "incidence": 0, "new_dead": 3, "incidence_dead": 0 }, - { "month": 8, "new_cases": 98, "incidence": 0, "new_dead": 5, "incidence_dead": 0 }, - { "month": 9, "new_cases": 278, "incidence": 0, "new_dead": 1, "incidence_dead": 0 }, - { "month": 10, "new_cases": 353, "incidence": 1, "new_dead": 5, "incidence_dead": 0 }, - { "month": 11, "new_cases": 510, "incidence": 1, "new_dead": 9, "incidence_dead": 0 }, - ], - maxCases: 1375 - }, - { - "name": "South Africa", "continent": "Africa", "alpha2": "za", "population": 59308690, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 1352, "incidence": 1, "new_dead": 4, "incidence_dead": 0 }, - { "month": 4, "new_cases": 4294, "incidence": 2, "new_dead": 98, "incidence_dead": 0 }, - { "month": 5, "new_cases": 27036, "incidence": 11, "new_dead": 580, "incidence_dead": 0.2 }, - { "month": 6, "new_cases": 118526, "incidence": 50, "new_dead": 1974, "incidence_dead": 0.8 }, - { "month": 7, "new_cases": 341974, "incidence": 144, "new_dead": 5348, "incidence_dead": 2.3 }, - { "month": 8, "new_cases": 133858, "incidence": 56, "new_dead": 6144, "incidence_dead": 2.6 }, - { "month": 9, "new_cases": 47298, "incidence": 20, "new_dead": 2585, "incidence_dead": 1.1 }, - { "month": 10, "new_cases": 51113, "incidence": 22, "new_dead": 2542, "incidence_dead": 1.1 }, - { "month": 11, "new_cases": 64552, "incidence": 27, "new_dead": 2259, "incidence_dead": 1 }, - ], - maxCases: 341974 - }, - { - "name": "South Korea", "continent": "Asia", "alpha2": "kr", "population": 51269183, "months": [ - { "month": 2, "new_cases": 3139, "incidence": 2, "new_dead": 15, "incidence_dead": 0 }, - { "month": 3, "new_cases": 6636, "incidence": 3, "new_dead": 146, "incidence_dead": 0.1 }, - { "month": 4, "new_cases": 988, "incidence": 0, "new_dead": 86, "incidence_dead": 0 }, - { "month": 5, "new_cases": 729, "incidence": 0, "new_dead": 23, "incidence_dead": 0 }, - { "month": 6, "new_cases": 1347, "incidence": 1, "new_dead": 11, "incidence_dead": 0 }, - { "month": 7, "new_cases": 1486, "incidence": 1, "new_dead": 19, "incidence_dead": 0 }, - { "month": 8, "new_cases": 5846, "incidence": 3, "new_dead": 23, "incidence_dead": 0 }, - { "month": 9, "new_cases": 3707, "incidence": 2, "new_dead": 91, "incidence_dead": 0 }, - { "month": 10, "new_cases": 2746, "incidence": 1, "new_dead": 51, "incidence_dead": 0 }, - { "month": 11, "new_cases": 8017, "incidence": 4, "new_dead": 60, "incidence_dead": 0 }, - ], - maxCases: 8017 - }, - { - "name": "South Sudan", "continent": "Africa", "alpha2": "ss", "population": 11193729, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 4, "new_cases": 34, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 5, "new_cases": 959, "incidence": 2, "new_dead": 6, "incidence_dead": 0 }, - { "month": 6, "new_cases": 1013, "incidence": 2, "new_dead": 28, "incidence_dead": 0.1 }, - { "month": 7, "new_cases": 315, "incidence": 1, "new_dead": 8, "incidence_dead": 0 }, - { "month": 8, "new_cases": 205, "incidence": 0, "new_dead": 1, "incidence_dead": 0 }, - { "month": 9, "new_cases": 177, "incidence": 0, "new_dead": 2, "incidence_dead": 0 }, - { "month": 10, "new_cases": 201, "incidence": 0, "new_dead": 9, "incidence_dead": 0 }, - { "month": 11, "new_cases": 204, "incidence": 0, "new_dead": 3, "incidence_dead": 0 }, - ], - maxCases: 1013 - }, - { - "name": "Spain", "continent": "Europe", "alpha2": "es", "population": 46754783, "months": [ - { "month": 2, "new_cases": 44, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 95878, "incidence": 51, "new_dead": 8463, "incidence_dead": 4.5 }, - { "month": 4, "new_cases": 117512, "incidence": 63, "new_dead": 16079, "incidence_dead": 8.6 }, - { "month": 5, "new_cases": 26044, "incidence": 14, "new_dead": 2584, "incidence_dead": 1.4 }, - { "month": 6, "new_cases": 9792, "incidence": 5, "new_dead": 1228, "incidence_dead": 0.7 }, - { "month": 7, "new_cases": 39251, "incidence": 21, "new_dead": 90, "incidence_dead": 0 }, - { "month": 8, "new_cases": 174336, "incidence": 93, "new_dead": 649, "incidence_dead": 0.3 }, - { "month": 9, "new_cases": 306330, "incidence": 164, "new_dead": 2697, "incidence_dead": 1.4 }, - { "month": 10, "new_cases": 416490, "incidence": 223, "new_dead": 4087, "incidence_dead": 2.2 }, - { "month": 11, "new_cases": 462509, "incidence": 247, "new_dead": 9191, "incidence_dead": 4.9 }, - ], - maxCases: 462509 - }, - { - "name": "Sri Lanka", "continent": "Asia", "alpha2": "lk", "population": 21413250, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 142, "incidence": 0, "new_dead": 1, "incidence_dead": 0 }, - { "month": 4, "new_cases": 520, "incidence": 1, "new_dead": 5, "incidence_dead": 0 }, - { "month": 5, "new_cases": 970, "incidence": 1, "new_dead": 3, "incidence_dead": 0 }, - { "month": 6, "new_cases": 414, "incidence": 0, "new_dead": 1, "incidence_dead": 0 }, - { "month": 7, "new_cases": 768, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, - { "month": 8, "new_cases": 234, "incidence": 0, "new_dead": 1, "incidence_dead": 0 }, - { "month": 9, "new_cases": 331, "incidence": 0, "new_dead": 1, "incidence_dead": 0 }, - { "month": 10, "new_cases": 7283, "incidence": 9, "new_dead": 7, "incidence_dead": 0 }, - { "month": 11, "new_cases": 13324, "incidence": 16, "new_dead": 98, "incidence_dead": 0.1 }, - ], - maxCases: 13324 - }, - { - "name": "Sudan", "continent": "Africa", "alpha2": "sd", "population": 43849269, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 6, "incidence": 0, "new_dead": 1, "incidence_dead": 0 }, - { "month": 4, "new_cases": 435, "incidence": 0, "new_dead": 29, "incidence_dead": 0 }, - { "month": 5, "new_cases": 4584, "incidence": 3, "new_dead": 255, "incidence_dead": 0.1 }, - { "month": 6, "new_cases": 4231, "incidence": 2, "new_dead": 286, "incidence_dead": 0.2 }, - { "month": 7, "new_cases": 2387, "incidence": 1, "new_dead": 174, "incidence_dead": 0.1 }, - { "month": 8, "new_cases": 1545, "incidence": 1, "new_dead": 77, "incidence_dead": 0 }, - { "month": 9, "new_cases": 451, "incidence": 0, "new_dead": 13, "incidence_dead": 0 }, - { "month": 10, "new_cases": 164, "incidence": 0, "new_dead": 1, "incidence_dead": 0 }, - { "month": 11, "new_cases": 4006, "incidence": 2, "new_dead": 412, "incidence_dead": 0.2 }, - ], - maxCases: 4584 - }, - { - "name": "Suriname", "continent": "South America", "alpha2": "sr", "population": 586634, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 8, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 4, "new_cases": 1, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 5, "new_cases": 13, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, - { "month": 6, "new_cases": 492, "incidence": 21, "new_dead": 12, "incidence_dead": 0.5 }, - { "month": 7, "new_cases": 1135, "incidence": 48, "new_dead": 13, "incidence_dead": 0.6 }, - { "month": 8, "new_cases": 2384, "incidence": 102, "new_dead": 45, "incidence_dead": 1.9 }, - { "month": 9, "new_cases": 843, "incidence": 36, "new_dead": 33, "incidence_dead": 1.4 }, - { "month": 10, "new_cases": 326, "incidence": 14, "new_dead": 7, "incidence_dead": 0.3 }, - { "month": 11, "new_cases": 109, "incidence": 5, "new_dead": 6, "incidence_dead": 0.3 }, - ], - maxCases: 2384 - }, - { - "name": "Sweden", "continent": "Europe", "alpha2": "se", "population": 10099270, "months": [ - { "month": 2, "new_cases": 13, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 4820, "incidence": 12, "new_dead": 384, "incidence_dead": 1 }, - { "month": 4, "new_cases": 16767, "incidence": 42, "new_dead": 2569, "incidence_dead": 6.4 }, - { "month": 5, "new_cases": 17060, "incidence": 42, "new_dead": 1719, "incidence_dead": 4.3 }, - { "month": 6, "new_cases": 29263, "incidence": 72, "new_dead": 842, "incidence_dead": 2.1 }, - { "month": 7, "new_cases": 9152, "incidence": 23, "new_dead": 251, "incidence_dead": 0.6 }, - { "month": 8, "new_cases": 7303, "incidence": 18, "new_dead": 42, "incidence_dead": 0.1 }, - { "month": 9, "new_cases": 8484, "incidence": 21, "new_dead": 85, "incidence_dead": 0.2 }, - { "month": 10, "new_cases": 31492, "incidence": 78, "new_dead": 84, "incidence_dead": 0.2 }, - { "month": 11, "new_cases": 118774, "incidence": 294, "new_dead": 704, "incidence_dead": 1.7 }, - ], - maxCases: 118774 - }, - { - "name": "Switzerland", "continent": "Europe", "alpha2": "ch", "population": 8654618, "months": [ - { "month": 2, "new_cases": 17, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 16587, "incidence": 48, "new_dead": 432, "incidence_dead": 1.2 }, - { "month": 4, "new_cases": 12981, "incidence": 37, "new_dead": 1304, "incidence_dead": 3.8 }, - { "month": 5, "new_cases": 1276, "incidence": 4, "new_dead": 183, "incidence_dead": 0.5 }, - { "month": 6, "new_cases": 852, "incidence": 2, "new_dead": 43, "incidence_dead": 0.1 }, - { "month": 7, "new_cases": 3518, "incidence": 10, "new_dead": 18, "incidence_dead": 0.1 }, - { "month": 8, "new_cases": 6945, "incidence": 20, "new_dead": 25, "incidence_dead": 0.1 }, - { "month": 9, "new_cases": 11105, "incidence": 32, "new_dead": 68, "incidence_dead": 0.2 }, - { "month": 10, "new_cases": 100969, "incidence": 292, "new_dead": 223, "incidence_dead": 0.6 }, - { "month": 11, "new_cases": 172821, "incidence": 499, "new_dead": 2518, "incidence_dead": 7.3 }, - ], - maxCases: 172821 - }, - { - "name": "Tajikistan", "continent": "Asia", "alpha2": "tj", "population": 9537642, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 4, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 5, "new_cases": 3915, "incidence": 10, "new_dead": 45, "incidence_dead": 0.1 }, - { "month": 6, "new_cases": 1970, "incidence": 5, "new_dead": 5, "incidence_dead": 0 }, - { "month": 7, "new_cases": 1509, "incidence": 4, "new_dead": 8, "incidence_dead": 0 }, - { "month": 8, "new_cases": 1174, "incidence": 3, "new_dead": 8, "incidence_dead": 0 }, - { "month": 9, "new_cases": 1186, "incidence": 3, "new_dead": 8, "incidence_dead": 0 }, - { "month": 10, "new_cases": 1248, "incidence": 3, "new_dead": 6, "incidence_dead": 0 }, - { "month": 11, "new_cases": 1177, "incidence": 3, "new_dead": 4, "incidence_dead": 0 }, - ], - maxCases: 3915 - }, - { - "name": "Tanzania", "continent": "Africa", "alpha2": "tz", "population": 59734213, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 18, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 4, "new_cases": 461, "incidence": 0, "new_dead": 15, "incidence_dead": 0 }, - { "month": 5, "new_cases": 29, "incidence": 0, "new_dead": 5, "incidence_dead": 0 }, - { "month": 6, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 7, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 8, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 9, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 10, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 11, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - ], - maxCases: 461 - }, - { - "name": "Thailand", "continent": "Asia", "alpha2": "th", "population": 69799978, "months": [ - { "month": 2, "new_cases": 23, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 1609, "incidence": 1, "new_dead": 9, "incidence_dead": 0 }, - { "month": 4, "new_cases": 1303, "incidence": 0, "new_dead": 44, "incidence_dead": 0 }, - { "month": 5, "new_cases": 127, "incidence": 0, "new_dead": 3, "incidence_dead": 0 }, - { "month": 6, "new_cases": 90, "incidence": 0, "new_dead": 1, "incidence_dead": 0 }, - { "month": 7, "new_cases": 139, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 8, "new_cases": 107, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 9, "new_cases": 152, "incidence": 0, "new_dead": 1, "incidence_dead": 0 }, - { "month": 10, "new_cases": 215, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 11, "new_cases": 224, "incidence": 0, "new_dead": 1, "incidence_dead": 0 }, - ], - maxCases: 1609 - }, - { - "name": "Timor", "continent": "Asia", "alpha2": "tl", "population": 1318442, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 4, "new_cases": 23, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 5, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 6, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 7, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 8, "new_cases": 3, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 9, "new_cases": 1, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 10, "new_cases": 2, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 11, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - ], - maxCases: 23 - }, - { - "name": "Togo", "continent": "Africa", "alpha2": "tg", "population": 8278737, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 33, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 4, "new_cases": 82, "incidence": 0, "new_dead": 8, "incidence_dead": 0 }, - { "month": 5, "new_cases": 326, "incidence": 1, "new_dead": 4, "incidence_dead": 0 }, - { "month": 6, "new_cases": 208, "incidence": 1, "new_dead": 1, "incidence_dead": 0 }, - { "month": 7, "new_cases": 291, "incidence": 1, "new_dead": 5, "incidence_dead": 0 }, - { "month": 8, "new_cases": 459, "incidence": 1, "new_dead": 9, "incidence_dead": 0 }, - { "month": 9, "new_cases": 384, "incidence": 1, "new_dead": 20, "incidence_dead": 0.1 }, - { "month": 10, "new_cases": 547, "incidence": 2, "new_dead": 9, "incidence_dead": 0 }, - { "month": 11, "new_cases": 643, "incidence": 2, "new_dead": 7, "incidence_dead": 0 }, - ], - maxCases: 643 - }, - { - "name": "Trinidad and Tobago", "continent": "North America", "alpha2": "tt", "population": 1399491, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 85, "incidence": 2, "new_dead": 2, "incidence_dead": 0 }, - { "month": 4, "new_cases": 29, "incidence": 1, "new_dead": 5, "incidence_dead": 0.1 }, - { "month": 5, "new_cases": 1, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 6, "new_cases": 13, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 7, "new_cases": 39, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, - { "month": 8, "new_cases": 1590, "incidence": 28, "new_dead": 14, "incidence_dead": 0.3 }, - { "month": 9, "new_cases": 2772, "incidence": 50, "new_dead": 54, "incidence_dead": 1 }, - { "month": 10, "new_cases": 1161, "incidence": 21, "new_dead": 32, "incidence_dead": 0.6 }, - { "month": 11, "new_cases": 977, "incidence": 17, "new_dead": 12, "incidence_dead": 0.2 }, - ], - maxCases: 2772 - }, - { - "name": "Tunisia", "continent": "Africa", "alpha2": "tn", "population": 11818618, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 393, "incidence": 1, "new_dead": 9, "incidence_dead": 0 }, - { "month": 4, "new_cases": 600, "incidence": 1, "new_dead": 31, "incidence_dead": 0.1 }, - { "month": 5, "new_cases": 83, "incidence": 0, "new_dead": 7, "incidence_dead": 0 }, - { "month": 6, "new_cases": 97, "incidence": 0, "new_dead": 2, "incidence_dead": 0 }, - { "month": 7, "new_cases": 361, "incidence": 1, "new_dead": 0, "incidence_dead": 0 }, - { "month": 8, "new_cases": 2268, "incidence": 5, "new_dead": 27, "incidence_dead": 0.1 }, - { "month": 9, "new_cases": 14610, "incidence": 31, "new_dead": 188, "incidence_dead": 0.4 }, - { "month": 10, "new_cases": 41400, "incidence": 88, "new_dead": 1052, "incidence_dead": 2.2 }, - { "month": 11, "new_cases": 36956, "incidence": 78, "new_dead": 1943, "incidence_dead": 4.1 }, - ], - maxCases: 41400 - }, - { - "name": "Turkey", "continent": "Asia", "alpha2": "tr", "population": 84339067, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 13530, "incidence": 4, "new_dead": 213, "incidence_dead": 0.1 }, - { "month": 4, "new_cases": 106673, "incidence": 32, "new_dead": 2960, "incidence_dead": 0.9 }, - { "month": 5, "new_cases": 43738, "incidence": 13, "new_dead": 1366, "incidence_dead": 0.4 }, - { "month": 6, "new_cases": 35964, "incidence": 11, "new_dead": 591, "incidence_dead": 0.2 }, - { "month": 7, "new_cases": 30967, "incidence": 9, "new_dead": 560, "incidence_dead": 0.2 }, - { "month": 8, "new_cases": 39260, "incidence": 12, "new_dead": 679, "incidence_dead": 0.2 }, - { "month": 9, "new_cases": 48530, "incidence": 14, "new_dead": 1825, "incidence_dead": 0.5 }, - { "month": 10, "new_cases": 56704, "incidence": 17, "new_dead": 2057, "incidence_dead": 0.6 }, - { "month": 11, "new_cases": 263480, "incidence": 78, "new_dead": 3494, "incidence_dead": 1 }, - ], - maxCases: 263480 - }, - { - "name": "Uganda", "continent": "Africa", "alpha2": "ug", "population": 45741000, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 43, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 4, "new_cases": 39, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 5, "new_cases": 334, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 6, "new_cases": 472, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 7, "new_cases": 265, "incidence": 0, "new_dead": 2, "incidence_dead": 0 }, - { "month": 8, "new_cases": 1818, "incidence": 1, "new_dead": 29, "incidence_dead": 0 }, - { "month": 9, "new_cases": 5157, "incidence": 3, "new_dead": 43, "incidence_dead": 0 }, - { "month": 10, "new_cases": 4366, "incidence": 2, "new_dead": 36, "incidence_dead": 0 }, - { "month": 11, "new_cases": 7964, "incidence": 4, "new_dead": 94, "incidence_dead": 0.1 }, - ], - maxCases: 7964 - }, - { - "name": "Ukraine", "continent": "Europe", "alpha2": "ua", "population": 43733759, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 644, "incidence": 0, "new_dead": 16, "incidence_dead": 0 }, - { "month": 4, "new_cases": 9761, "incidence": 6, "new_dead": 244, "incidence_dead": 0.1 }, - { "month": 5, "new_cases": 13266, "incidence": 8, "new_dead": 447, "incidence_dead": 0.3 }, - { "month": 6, "new_cases": 21582, "incidence": 12, "new_dead": 465, "incidence_dead": 0.3 }, - { "month": 7, "new_cases": 26150, "incidence": 15, "new_dead": 544, "incidence_dead": 0.3 }, - { "month": 8, "new_cases": 52728, "incidence": 30, "new_dead": 888, "incidence_dead": 0.5 }, - { "month": 9, "new_cases": 90314, "incidence": 52, "new_dead": 1616, "incidence_dead": 0.9 }, - { "month": 10, "new_cases": 184884, "incidence": 106, "new_dead": 3178, "incidence_dead": 1.8 }, - { "month": 11, "new_cases": 353013, "incidence": 202, "new_dead": 5332, "incidence_dead": 3 }, - ], - maxCases: 353013 - }, - { - "name": "United Arab Emirates", "continent": "Asia", "alpha2": "ae", "population": 9890400, "months": [ - { "month": 2, "new_cases": 17, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 643, "incidence": 2, "new_dead": 4, "incidence_dead": 0 }, - { "month": 4, "new_cases": 11817, "incidence": 30, "new_dead": 99, "incidence_dead": 0.3 }, - { "month": 5, "new_cases": 22076, "incidence": 56, "new_dead": 159, "incidence_dead": 0.4 }, - { "month": 6, "new_cases": 14110, "incidence": 36, "new_dead": 51, "incidence_dead": 0.1 }, - { "month": 7, "new_cases": 11839, "incidence": 30, "new_dead": 36, "incidence_dead": 0.1 }, - { "month": 8, "new_cases": 9725, "incidence": 25, "new_dead": 33, "incidence_dead": 0.1 }, - { "month": 9, "new_cases": 23959, "incidence": 61, "new_dead": 35, "incidence_dead": 0.1 }, - { "month": 10, "new_cases": 38439, "incidence": 97, "new_dead": 76, "incidence_dead": 0.2 }, - { "month": 11, "new_cases": 36231, "incidence": 92, "new_dead": 77, "incidence_dead": 0.2 }, - ], - maxCases: 38439 - }, - { - "name": "United Kingdom", "continent": "Europe", "alpha2": "gb", "population": 67886004, "months": [ - { "month": 2, "new_cases": 59, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 38754, "incidence": 14, "new_dead": 2456, "incidence_dead": 0.9 }, - { "month": 4, "new_cases": 139956, "incidence": 52, "new_dead": 24297, "incidence_dead": 8.9 }, - { "month": 5, "new_cases": 78768, "incidence": 29, "new_dead": 10773, "incidence_dead": 4 }, - { "month": 6, "new_cases": 27677, "incidence": 10, "new_dead": 2952, "incidence_dead": 1.1 }, - { "month": 7, "new_cases": 19577, "incidence": 7, "new_dead": 795, "incidence_dead": 0.3 }, - { "month": 8, "new_cases": 33290, "incidence": 12, "new_dead": 315, "incidence_dead": 0.1 }, - { "month": 9, "new_cases": 117763, "incidence": 43, "new_dead": 644, "incidence_dead": 0.2 }, - { "month": 10, "new_cases": 558947, "incidence": 206, "new_dead": 4412, "incidence_dead": 1.6 }, - { "month": 11, "new_cases": 618940, "incidence": 228, "new_dead": 11900, "incidence_dead": 4.4 }, - ], - maxCases: 618940 - }, - { - "name": "United States", "continent": "North America", "alpha2": "us", "population": 331002647, "months": [ - { "month": 2, "new_cases": 17, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 192152, "incidence": 15, "new_dead": 5277, "incidence_dead": 0.4 }, - { "month": 4, "new_cases": 884047, "incidence": 67, "new_dead": 60738, "incidence_dead": 4.6 }, - { "month": 5, "new_cases": 718241, "incidence": 54, "new_dead": 41703, "incidence_dead": 3.1 }, - { "month": 6, "new_cases": 842906, "incidence": 64, "new_dead": 20112, "incidence_dead": 1.5 }, - { "month": 7, "new_cases": 1915966, "incidence": 145, "new_dead": 26446, "incidence_dead": 2 }, - { "month": 8, "new_cases": 1463760, "incidence": 111, "new_dead": 29532, "incidence_dead": 2.2 }, - { "month": 9, "new_cases": 1202896, "incidence": 91, "new_dead": 23418, "incidence_dead": 1.8 }, - { "month": 10, "new_cases": 1917201, "incidence": 145, "new_dead": 23974, "incidence_dead": 1.8 }, - { "month": 11, "new_cases": 4462302, "incidence": 337, "new_dead": 36964, "incidence_dead": 2.8 }, - ], - maxCases: 4462302 - }, - { - "name": "Uruguay", "continent": "South America", "alpha2": "uy", "population": 3473727, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 334, "incidence": 2, "new_dead": 0, "incidence_dead": 0 }, - { "month": 4, "new_cases": 305, "incidence": 2, "new_dead": 16, "incidence_dead": 0.1 }, - { "month": 5, "new_cases": 180, "incidence": 1, "new_dead": 5, "incidence_dead": 0 }, - { "month": 6, "new_cases": 113, "incidence": 1, "new_dead": 5, "incidence_dead": 0 }, - { "month": 7, "new_cases": 328, "incidence": 2, "new_dead": 8, "incidence_dead": 0.1 }, - { "month": 8, "new_cases": 331, "incidence": 2, "new_dead": 9, "incidence_dead": 0.1 }, - { "month": 9, "new_cases": 451, "incidence": 3, "new_dead": 4, "incidence_dead": 0 }, - { "month": 10, "new_cases": 1078, "incidence": 8, "new_dead": 10, "incidence_dead": 0.1 }, - { "month": 11, "new_cases": 2733, "incidence": 20, "new_dead": 19, "incidence_dead": 0.1 }, - ], - maxCases: 2733 - }, - { - "name": "Uzbekistan", "continent": "Asia", "alpha2": "uz", "population": 33469199, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 171, "incidence": 0, "new_dead": 1, "incidence_dead": 0 }, - { "month": 4, "new_cases": 1867, "incidence": 1, "new_dead": 7, "incidence_dead": 0 }, - { "month": 5, "new_cases": 1584, "incidence": 1, "new_dead": 6, "incidence_dead": 0 }, - { "month": 6, "new_cases": 4880, "incidence": 4, "new_dead": 11, "incidence_dead": 0 }, - { "month": 7, "new_cases": 15506, "incidence": 12, "new_dead": 115, "incidence_dead": 0.1 }, - { "month": 8, "new_cases": 17884, "incidence": 13, "new_dead": 179, "incidence_dead": 0.1 }, - { "month": 9, "new_cases": 14824, "incidence": 11, "new_dead": 150, "incidence_dead": 0.1 }, - { "month": 10, "new_cases": 10215, "incidence": 8, "new_dead": 96, "incidence_dead": 0.1 }, - { "month": 11, "new_cases": 6162, "incidence": 5, "new_dead": 44, "incidence_dead": 0 }, - ], - maxCases: 17884 - }, - { - "name": "Vanuatu", "continent": "Oceania", "alpha2": "vu", "population": 307150, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 4, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 5, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 6, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 7, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 8, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 9, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 10, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 11, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - ], - maxCases: 0 - }, - { - "name": "Venezuela", "continent": "South America", "alpha2": "ve", "population": 28435943, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 133, "incidence": 0, "new_dead": 2, "incidence_dead": 0 }, - { "month": 4, "new_cases": 198, "incidence": 0, "new_dead": 13, "incidence_dead": 0 }, - { "month": 5, "new_cases": 1177, "incidence": 1, "new_dead": -2, "incidence_dead": 0 }, - { "month": 6, "new_cases": 4322, "incidence": 4, "new_dead": 37, "incidence_dead": 0 }, - { "month": 7, "new_cases": 12742, "incidence": 11, "new_dead": 113, "incidence_dead": 0.1 }, - { "month": 8, "new_cases": 28154, "incidence": 25, "new_dead": 222, "incidence_dead": 0.2 }, - { "month": 9, "new_cases": 28394, "incidence": 25, "new_dead": 242, "incidence_dead": 0.2 }, - { "month": 10, "new_cases": 16891, "incidence": 15, "new_dead": 170, "incidence_dead": 0.1 }, - { "month": 11, "new_cases": 10381, "incidence": 9, "new_dead": 99, "incidence_dead": 0.1 }, - ], - maxCases: 28394 - }, - { - "name": "Vietnam", "continent": "Asia", "alpha2": "vn", "population": 97338583, "months": [ - { "month": 2, "new_cases": 14, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 196, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 4, "new_cases": 58, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 5, "new_cases": 58, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 6, "new_cases": 27, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 7, "new_cases": 203, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 8, "new_cases": 486, "incidence": 0, "new_dead": 31, "incidence_dead": 0 }, - { "month": 9, "new_cases": 50, "incidence": 0, "new_dead": 1, "incidence_dead": 0 }, - { "month": 10, "new_cases": 86, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 11, "new_cases": 167, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - ], - maxCases: 486 - }, - { - "name": "Yemen", "continent": "Asia", "alpha2": "ye", "population": 29825968, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 4, "new_cases": 5, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 5, "new_cases": 317, "incidence": 0, "new_dead": 78, "incidence_dead": 0.1 }, - { "month": 6, "new_cases": 835, "incidence": 1, "new_dead": 232, "incidence_dead": 0.2 }, - { "month": 7, "new_cases": 570, "incidence": 0, "new_dead": 181, "incidence_dead": 0.2 }, - { "month": 8, "new_cases": 230, "incidence": 0, "new_dead": 73, "incidence_dead": 0.1 }, - { "month": 9, "new_cases": 76, "incidence": 0, "new_dead": 21, "incidence_dead": 0 }, - { "month": 10, "new_cases": 29, "incidence": 0, "new_dead": 12, "incidence_dead": 0 }, - { "month": 11, "new_cases": 128, "incidence": 0, "new_dead": 20, "incidence_dead": 0 }, - ], - maxCases: 835 - }, - { - "name": "Zambia", "continent": "Africa", "alpha2": "zm", "population": 18383956, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 33, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 4, "new_cases": 71, "incidence": 0, "new_dead": 2, "incidence_dead": 0 }, - { "month": 5, "new_cases": 951, "incidence": 1, "new_dead": 4, "incidence_dead": 0 }, - { "month": 6, "new_cases": 537, "incidence": 1, "new_dead": 17, "incidence_dead": 0 }, - { "month": 7, "new_cases": 4369, "incidence": 6, "new_dead": 127, "incidence_dead": 0.2 }, - { "month": 8, "new_cases": 6134, "incidence": 8, "new_dead": 137, "incidence_dead": 0.2 }, - { "month": 9, "new_cases": 2662, "incidence": 4, "new_dead": 44, "incidence_dead": 0.1 }, - { "month": 10, "new_cases": 1673, "incidence": 2, "new_dead": 17, "incidence_dead": 0 }, - { "month": 11, "new_cases": 1215, "incidence": 2, "new_dead": 8, "incidence_dead": 0 }, - ], - maxCases: 6134 - }, - { - "name": "Zimbabwe", "continent": "Africa", "alpha2": "zw", "population": 14862927, "months": [ - { "month": 2, "new_cases": 0, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 3, "new_cases": 7, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 4, "new_cases": 32, "incidence": 0, "new_dead": 3, "incidence_dead": 0 }, - { "month": 5, "new_cases": 138, "incidence": 0, "new_dead": 0, "incidence_dead": 0 }, - { "month": 6, "new_cases": 413, "incidence": 1, "new_dead": 3, "incidence_dead": 0 }, - { "month": 7, "new_cases": 2578, "incidence": 4, "new_dead": 60, "incidence_dead": 0.1 }, - { "month": 8, "new_cases": 3328, "incidence": 6, "new_dead": 135, "incidence_dead": 0.2 }, - { "month": 9, "new_cases": 1341, "incidence": 2, "new_dead": 26, "incidence_dead": 0 }, - { "month": 10, "new_cases": 529, "incidence": 1, "new_dead": 15, "incidence_dead": 0 }, - { "month": 11, "new_cases": 1583, "incidence": 3, "new_dead": 33, "incidence_dead": 0.1 }, - ], - maxCases: 3328 - }, - ]; diff --git a/compiler/compiler/sample/pages/testcases/simpleText.ets b/compiler/compiler/sample/pages/testcases/simpleText.ets deleted file mode 100644 index 9a982d6b0..000000000 --- a/compiler/compiler/sample/pages/testcases/simpleText.ets +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - - -@Entry -@Component -struct UserView { - - @State - button_name:string = "Before Click"; - - @State - currentView:string = "opacity"; - - build(){ - Column() { - if(this.currentView === "opacity") { - Column(){ - Row(){ - Text("Row Text1") - } - .width(100).height(100).opacity(0.5).backgroundColor("#c4b0dd") - Row(){ - Text("Row Text2") - } - .width(100).height(100).opacity(1).backgroundColor("#c4b0dd") - Text("Column Text1").height(100).backgroundColor("#c4b0de") - Text("Column Text2").height(100).backgroundColor("#c4deb0").opacity(0.5) - Image("pages/pictures/0.jpeg").width(600).height(300) - Image("pages/pictures/0.jpeg").width(600).height(300).opacity(0.5) - Button("Button1").height(100).backgroundColor("#c4deb0") - Button("Button2").height(100).backgroundColor("#c4deb0").opacity(0.5) - Divider().height(10).color("red") - Divider().height(10).color("red").opacity(0.5) - } - .width(700).backgroundColor("#b0c4de").margin(20) - } else if(this.currentView === "button") { - Button("V8 Button test:" + this.button_name) - .width(600).height(100).backgroundColor("#b0c4de").margin(50) - .onClick(() => { - console.log("V8 Button test click start"); - this.button_name = "After click"; - console.log("V8 Button test click end"); - }) - } else if(this.currentView === "text") { - Text("V8 Text test") - .width(600).height(100).backgroundColor("#b0c4de") - .margin(50).fontColor("#ff33aa").fontSize(50).fontWeight("bold") - } else if(this.currentView === "image") { - Image("pages/pictures/0.jpeg").width(800).height(400).margin(50) - } else if(this.currentView === "column") { - Column(){ - Text("Column Text1").height(100).backgroundColor("#c4b0de") - Text("Column Text2").height(100).backgroundColor("#c4deb0") - Image("pages/pictures/0.jpeg").width(600).height(300) - Text("Column Text3").height(100).backgroundColor("#c4b0de") - Text("Column Text4").height(100).backgroundColor("#c4deb0") - } - .width(700).height(1000).backgroundColor("#b0c4de").margin(20) - } else if(this.currentView === "row") { - Row(){ - Text("Text1").height(100).backgroundColor("#c4b0de") - Text("Text2").height(100).backgroundColor("#c4deb0") - Image("pages/pictures/0.jpeg").width(300).height(150) - Text("Text3").height(100).backgroundColor("#c4b0de") - Text("Text4").height(100).backgroundColor("#c4deb0") - } - .width(700).height(200).backgroundColor("#b0c4de").margin(20) - } - } - } -} \ No newline at end of file diff --git a/compiler/compiler/sample/pages/testcases/stacktestsuite.ets b/compiler/compiler/sample/pages/testcases/stacktestsuite.ets deleted file mode 100644 index 56908b36b..000000000 --- a/compiler/compiler/sample/pages/testcases/stacktestsuite.ets +++ /dev/null @@ -1,148 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - -class Test { - align:number = 0; - fit:number = 0; - overflow:number = 0; - text:number = 0; - width:number = 0; - constructor(align:number, fit:number, overflow:number, text:number, width:number) { - this.align = align; - this.fit = fit; - this.overflow = overflow; - this.text = text; - this.width = width; - } -} - -@Entry -@Component -struct TestView { - - @State - currentTest:Test = new Test(0, 0, 0, 0, 0); - - aligns:string[] = [ - "TopLeft", - "TopCenter", - "TopRight", - "CenterLeft", - "Center", - "CenterRight", - "BottomLeft", - "BottomCenter", - "BottomRight" - ]; - - stackFits:string[] = [ - "Keep", - "Stretch", - "Inherit", - "FirstChild" - ]; - - overflows:string[] = [ - "Clip", - "Observable" - ]; - - texts:string[] = [ - "Test text", - "This is a very long text for demonstration purposes." - ]; - - widths:number[] = [ - 200, - 500, - 800 - ]; - - alignToText(align) { - if (align >= this.aligns.length) - return "Unknown (" + align + ")"; - - return "Align." + this.aligns[align] + "(" + /*Align[this.aligns[align]]*/ + ")"; - } // alignToText - - fitToText(fit) { - if (fit >= this.stackFits.length) - return "Unknown (" + fit + ")"; - - return "StackFit." + this.stackFits[fit] + "(" + /*StackFit[this.stackFits[fit]]*/ + ")"; - } - - overflowToText(overflow) { - if (overflow >= this.overflows.length) - return "Unknown (" + overflow + ")"; - - return "Overflow." + this.overflows[overflow] + "(" + /*Overflow[this.overflows[overflow]]*/ + ")"; - } - - build() { - Column(){ - Row(){ - Button("Alignment") - .onClick(() => { - this.currentTest.align = (this.currentTest.align + 1) % this.aligns.length; - }) - Text(this.alignToText(this.currentTest.align)) - } - Row(){ - Button("Fit") - .onClick(() => { - this.currentTest.fit = (this.currentTest.fit + 1) % this.stackFits.length; - }) - Text(this.fitToText(this.currentTest.fit)) - } - Row(){ - Button("Overflow") - .onClick(() => { - this.currentTest.overflow = (this.currentTest.overflow + 1) % this.overflows.length; - }) - Text(this.overflowToText(this.currentTest.overflow)) - } - Row(){ - Button("Text") - .onClick(() => { - this.currentTest.text = (this.currentTest.text + 1) % this.texts.length; - }) - Text(this.texts[this.currentTest.text]) - } - Row(){ - Button("Width") - .onClick(() => { - this.currentTest.width = (this.currentTest.width + 1) % this.widths.length; - }) - Text("" + this.widths[this.currentTest.width]) - } - Stack(){ - Column(){ - - } - .width(350).height(400).backgroundColor(0xaaaaaa) - Text(this.texts[this.currentTest.text]).backgroundColor(0x00aaff).fontColor("#ffffff") - .width(this.widths[this.currentTest.width]) - } - //.alignment(Align[this.aligns[this.currentTest.align]]).stackFit(StackFit[this.stackFits[this.currentTest.fit]]) - //.Overflow(Overflow[this.overflows[this.currentTest.overflow]]).backgroundColor(0x0000cd).width(500.0).height(400.0) - Stack(){ - Text("test1") - Text("Test2") - } - } - .alignItems(HorizontalAlign.Center) - } -} \ No newline at end of file diff --git a/compiler/compiler/sample/pages/testcases/stateArrayReverse.ets b/compiler/compiler/sample/pages/testcases/stateArrayReverse.ets deleted file mode 100644 index bc8e5eb5b..000000000 --- a/compiler/compiler/sample/pages/testcases/stateArrayReverse.ets +++ /dev/null @@ -1,72 +0,0 @@ - -/* - StateArrayReverse test case - - The purpose of this test case is verify what happens when re-ordering the Widgets / Components - of same type. Here, the test is done with built-in text (not with a own subclass of JSView) - - The expectation is that TextElement objects are created only once, then put to new order. - For this to work, each time a TextComponent is created it needs to be assigned the same unique key. - - This is why anArray is not a simple array of strings. strings are not uniquely identifyable - (in SwiftUI). Therefore, the app needs to provide a unique id for each array item. - We do so by making each array item an object with a unique id. - - TODO this id should be used as the 'key' argument when creating a Text. - -*/ - -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - - -class Item1 { - id:number; - label:string; - - constructor(id:number, label:string){ - this.id = id; - this.label = label; - } -} - -@Entry -@Component -struct ShufflingArrayContainer1 { - - @State anArray:Item1[] = [ - new Item1(1, "Text 1"), - new Item1(2, "Text 2"), - new Item1(3, "Text 3"), - new Item1(4, "Text 4"), - new Item1(5, "Text 5") - ]; - - build() { - Column(){ - ForEach(this.anArray, - (item:Item1) => {Text(item.label)}, - (item:Item1) => item.id.toString() - ) //ForEach - Button("Reverse array") - .width(500.0) - .height(150.0) - .onClick(() => { - this.anArray.reverse(); - console.log("onClick handler on ShufflingArrayContainer1, this.anArray: " + JSON.stringify(this.anArray)); - }) //Button - } // Column - } // build -} // class diff --git a/compiler/compiler/sample/pages/testcases/stateArrayReverseCustomView.ets b/compiler/compiler/sample/pages/testcases/stateArrayReverseCustomView.ets deleted file mode 100644 index f6e3bc1ba..000000000 --- a/compiler/compiler/sample/pages/testcases/stateArrayReverseCustomView.ets +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - - -class Item{ - id:number = 0; - label:string = ''; - - constructor(id:number, label:string){ - this.id = id; - this.label = label; - } -} - -@Component -struct CustomRow { - item:Item; - - build(){ - Row(){ - Text("label: ") - Text(this.item.label) - Text(", cap: ") - Text(this.item.label.toUpperCase()) - Text(", rev: ") - Text(this.item.label.split("").reverse().join("")) - } - } -} - -@Component -struct CustomText { - item:Item; - - build() { - Column() { - Text(this.item.label) - } - } -} - -@Entry -@Component -struct ShufflingArrayContainer { - @State anArray:Item[] = [ - new Item(1, "Text 1"), - new Item(2, "Text 2"), - new Item(3, "Text 3"), - new Item(4, "Text 4"), - new Item(5, "Text 5") - ]; - - build() { - Column(){ - ForEach(this.anArray, - (item:Item) => {CustomRow({ item:item })}, - (item:Item) => item.id.toString() - ) //ForEach - Button("Reverse anArray") - .width(500.0) - .height(150.0) - .onClick(() => { - // replace entire array - this.anArray = (this.anArray[0].id == 1) ? - [ - new Item(10, "Text A"), - new Item(20, "Text B"), - new Item(30, "Text C"), - new Item(40, "Text D"), - new Item(50, "Text E") - ] : [ - new Item(1, "Text 1"), - new Item(2, "Text 2"), - new Item(3, "Text 3"), - new Item(4, "Text 4"), - new Item(5, "Text 5") - ]; - console.log("click handler on ShufflingArrayContainer, this.anArray: " + JSON.stringify(this.anArray)); - }) // click - } //Column - } //build -} //struct diff --git a/compiler/compiler/sample/pages/testcases/stateComplexType.ets b/compiler/compiler/sample/pages/testcases/stateComplexType.ets deleted file mode 100644 index 6071b5aec..000000000 --- a/compiler/compiler/sample/pages/testcases/stateComplexType.ets +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - - -// Customize the status data class. -class Model { - value: string = ''; - constructor(value: string) { - this.value = value; - } -} - -@Entry -@Component -struct EntryComponent { - build() { - Column(){ - MyComponentState() //MyComponent1 in this document - MyComponentState() //MyComponent2 in this document - } - } -} - -@Component -struct MyComponentState { - - @State title: Model = new Model('Hello World') - @State count: number = 0 - private toggle: boolean = true - - build() { - - Column(){ - Text(`${this.title.value}`) - Button() - .onClick(() => { - this.toggle != this.toggle; - this.title.value = this.toggle ? 'Hello World' : 'Hello Ace'; - }) // Modify the internal status data of MyComponent using the anonymous method. - - Button() { - Text(`click times: ${this.count}`) - .fontSize(10) - }.onClick(() => { - this.count += 1 - }) - } - - } -} diff --git a/compiler/compiler/sample/pages/testcases/stateStateBindingProp.ets b/compiler/compiler/sample/pages/testcases/stateStateBindingProp.ets deleted file mode 100644 index 5e4ae423a..000000000 --- a/compiler/compiler/sample/pages/testcases/stateStateBindingProp.ets +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - - -class GreenButtonState { - width:number = 0; - - constructor(width:number) { - this.width = width; - } -} - -@Component -struct GreenButton { - @Link greenButtonState:GreenButtonState; - - build() { - Button("Green Button") - .width(this.greenButtonState.width) - .height(150.0) - .backgroundColor("#00ff00") - .onClick(() => { - this.greenButtonState.width = (this.greenButtonState.width < 700) ? this.greenButtonState.width + 125 : 100; - console.log("onClick handler on GreenButton, updated value this.greenButtonState.width: " + this.greenButtonState.width); - }) - } -} - -@Component -struct RedButton { - @State redButtonState:number = 100; - - build() { - Button("Red Button") - .width(this.redButtonState) - .height(150.0) - .backgroundColor("#ff0000") - .onClick(() => { - this.redButtonState = (this.redButtonState < 700) ? this.redButtonState + 80 : 100; - console.log("onClick handler on RedButton, updated value this.redButtonState: " + this.redButtonState); - }) - } -} - -@Component -struct YellowButton { - @Prop yellowButtonState:number; - - build(){ - Button("Yellow Button") - .width(this.yellowButtonState) - .height(150.0) - .backgroundColor("#ffff00") - .onClick(() => { - this.yellowButtonState += 50.0; - console.log("onClick handler on YellowButton, updated value this.yellowButtonState: " + this.yellowButtonState); - }) - } -} - -@Entry -@Component -struct ShufflingContainer { - @State shuffle:boolean = false; - @State greenButtonState:GreenButtonState = new GreenButtonState(300); - @State yellowButtonProp:number = 100; - - build() { - Column(){ - Button(`Parent View: ${this.shuffle ? 'Shuffle to Red before Green' : 'Shuffle to Green before Red'}`) - .width(700.0) - .height(150.0) - .onClick(() => { - this.shuffle = !this.shuffle - console.log("onClick handler on ShufflingContainer, updated value this.shuffle: " + this.shuffle); - }) //Button "B1" - Button("Parent View: Set yellowButtonProp") - .width(700.0) - .height(150.0) - .onClick(() => { - this.yellowButtonProp = (this.yellowButtonProp < 700) ? this.yellowButtonProp + 100 : 100; - console.log("onClick handler on ShufflingContainer, updated value of yellowButtonProp: " + this.yellowButtonProp); - }) //Button "B2" - if(this.shuffle) { - GreenButton({ greenButtonState: $greenButtonState }) - RedButton() - YellowButton({ yellowButtonState: this.yellowButtonProp }) - } else { - RedButton() - YellowButton({ yellowButtonState: this.yellowButtonProp }) - GreenButton({ greenButtonState: $greenButtonState }) - } - } - } -} \ No newline at end of file diff --git a/compiler/compiler/sample/pages/testcases/struct-01.ets b/compiler/compiler/sample/pages/testcases/struct-01.ets deleted file mode 100644 index 941dd29f7..000000000 --- a/compiler/compiler/sample/pages/testcases/struct-01.ets +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - -@Component -@Entry -struct MyComponent7 { - build() { - } -} \ No newline at end of file diff --git a/compiler/compiler/sample/pages/testcases/struct-02.ets b/compiler/compiler/sample/pages/testcases/struct-02.ets deleted file mode 100644 index 3ecc7a771..000000000 --- a/compiler/compiler/sample/pages/testcases/struct-02.ets +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - - -struct MyComponent8 { - build() { - } -} \ No newline at end of file diff --git a/compiler/compiler/sample/pages/todo.ets b/compiler/compiler/sample/pages/todo.ets deleted file mode 100644 index 033ff0d97..000000000 --- a/compiler/compiler/sample/pages/todo.ets +++ /dev/null @@ -1,178 +0,0 @@ - -/** - * ACE @ Web Helsinki - * - * eDSL version of TODO application - * - * ( unverified due to lack of working eDSL transpiler ) - * - * For comparison, the plain JS version of this app that works with ACE-Diff can be found here - * https://rnd-gitlab-eu-c.huawei.com/zidanehbs/ace/ace/-/blob/fin-hmf-dev-ace-diff-clean/samples/common/res/hi_topapp/assets/js/default/acediff/todoListForEach.js - * This is the ouput the eDSL transpiler should generate. - */ - -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - - -let tasks: Array = [ - { label: "Wash the car" }, - { label: "Buy some milk" }, - { label: "Make the report" }, - { label: "Buy flight tickets" }, - { label: "Update profile" }, - { label: "Change tyres" }, - { label: "Walk the dog" }, - { label: "Feed the dog" }, - { label: "Paint the walls" }, - { label: "Wash dishes" }, - { label: "Water flowers" }, - { label: "Call parents" }, - { label: "Refactor: align_component.cpp" }, - { label: "Refactor: align_component.h" }, - { label: "Refactor: arc_component.cpp" }, - { label: "Refactor: arc_component.h" }, - { label: "Refactor: block_component.cpp" }, - { label: "Refactor: block_component.h" }, - { label: "Refactor: box_base_component.cpp" }, - { label: "Refactor: box_base_component.h" }, - { label: "Refactor: box_component.cpp" }, - { label: "Refactor: box_component.h" }, - { label: "Refactor: bubble_component.cpp" }, - { label: "Refactor: bubble_component.h" }, - { label: "Refactor: button_component.cpp" }, - { label: "Refactor: button_component.h" }, - { label: "Refactor: calendar_component.cpp" }, - { label: "Refactor: calendar_component.h" }, - { label: "Refactor: calendar_data_adapter.cpp" }, - { label: "Refactor: calendar_data_adapter.h" }, - { label: "Refactor: chart_component.cpp" }, - { label: "Refactor: chart_component.h" }, - { label: "Refactor: checkable_component.cpp" }, - { label: "Refactor: checkable_component.h" }, - { label: "Refactor: clip_component.cpp" }, - { label: "Refactor: clip_component.h" }, - { label: "Refactor: component.cpp" }, - { label: "Refactor: component_group.h" }, - { label: "Refactor: component.h" }, - { label: "Refactor: composed_component.cpp" }, - { label: "Refactor: composed_component.h" }, - { label: "Refactor: constants.cpp" }, - { label: "Refactor: constants.h" }, - { label: "Refactor: sole_child_component.h" }, - { label: "Refactor: stack_component.h" }, - { label: "Refactor: stage_component.h" }, - { label: "Refactor: swiper_component.h" }, - { label: "Refactor: tab_bar_component.cpp" }, - { label: "Refactor: tab_bar_component.h" }, - { label: "Refactor: tab_bar_indicator_component.cpp" }, - { label: "Refactor: tab_bar_indicator_component.h" }, - { label: "Refactor: tab_bar_item_component.cpp" }, - { label: "Refactor: tab_bar_item_component.h" }, - { label: "Refactor: tab_content_component.cpp" }, - { label: "Refactor: tab_content_component.h" }, - { label: "Refactor: tab_controller.cpp" }, - { label: "Refactor: tab_controller.h" }, - { label: "Refactor: test" }, - { label: "Refactor: text_component.cpp" }, - { label: "Refactor: text_component.h" }, - { label: "Refactor: text_field_component.cpp" }, - { label: "Refactor: text_field_component.h" }, - { label: "Refactor: text_field_controller.cpp" }, - { label: "Refactor: text_field_controller.h" }, - { label: "Refactor: text_overlay_component.cpp" }, - { label: "Refactor: text_overlay_component.h" }, - { label: "Refactor: text_span_component.cpp" }, - { label: "Refactor: text_span_component.h" }, - { label: "Refactor: texture_component.cpp" }, - { label: "Refactor: texture_component.h" }, - { label: "Refactor: toast_component.cpp" }, - { label: "Refactor: toast_component.h" }, - { label: "Refactor: toggle_component.cpp" }, - { label: "Refactor: toggle_component.h" }, - { label: "Refactor: touch_listener_component.h" }, - { label: "Refactor: track_component.cpp" }, - { label: "Refactor: track_component.h" }, - { label: "Refactor: transform_component.cpp" }, - { label: "Refactor: transform_component.h" }, - { label: "Refactor: transition_component.cpp" }, - { label: "Refactor: transition_component.h" }, - { label: "Refactor: triangle_component.cpp" }, - { label: "Refactor: triangle_component.h" }, - { label: "Refactor: tween_component.cpp" }, - { label: "Refactor: tween_component.h" }, - { label: "Refactor: video_component.cpp" }, - { label: "Refactor: video_component.h" }, - { label: "Refactor: watch_slider_component.cpp" }, - { label: "Refactor: watch_slider_component.h" }, - { label: "Refactor: wrap_component.h" }, - { /* not used */ } -] - -// Add ID for each task -tasks.forEach(function (item, index) { - item.id = index - tasks[index] = item -}) - -let tasksCount: number = tasks.length - 1 -let screenCount: number = 20 - -@Entry -@Component -struct RootView { - @State idx: number = 0 - - build() { - Column () { - Column() { - Row() { - Button("Next task") - .onClick(() => { - if (this.idx < tasksCount - screenCount) - this.idx++ - }) - Button("Prev task") - .onClick(() => { - if (this.idx > 0) - this.idx-- - }) - } - } - ForEach( - /* first parameter is an expression of type array. - the point of not just using an array here is to clarify ForEach can not just perate on the - source array (as repeat implementation in ACE-Light did) */ - tasks.slice(this.idx, this.idx + screenCount), - - /* the third, builder function take an item as input and creates a single View from it */ - item => { - Text((item.id + 1) + " : " + item.label) - }, - - /* second parameter is a arrow function that takes an item as input - and returns a persistent nique id (or key ) */ - item => item.id - ) // ForEach - Text("--- Page navigation ---") - Row() { - Button("First") - .onClick(() => this.idx = 0) - Button("End") - .onClick(() => this.idx = tasksCount - screenCount) - } - } - } // build -} // struct diff --git a/compiler/compiler/src/compile_info.ts b/compiler/compiler/src/compile_info.ts deleted file mode 100644 index 41693a175..000000000 --- a/compiler/compiler/src/compile_info.ts +++ /dev/null @@ -1,233 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - -import Stats from 'webpack/lib/Stats'; -import Compiler from 'webpack/lib/Compiler'; -import { - configure, - getLogger -} from 'log4js'; -import RawSource from 'webpack-sources/lib/RawSource'; - -import { - BUILDIN_STYLE_NAMES, - EXTEND_ATTRIBUTE -} from './component_map'; -import { transformLog } from './process_ui_syntax'; -import { - dollarCollection, - componentCollection, - moduleCollection -} from './validate_ui_syntax'; -import { decoratorParamSet } from './process_component_member'; -import { appComponentCollection } from './process_component_build'; -import { projectConfig } from '../main'; - -configure({ - appenders: { 'ETS': {type: 'stderr', layout: {type: 'messagePassThrough'}}}, - categories: {'default': {appenders: ['ETS'], level: 'info'}} -}); -export const logger = getLogger('ETS'); - -const props: string[] = []; - -interface Info { - message?: string; - issue?: { - message: string, - file: string, - location: { start?: { line: number, column: number } } - }; -} - -export class ResultStates { - private mStats: Stats; - private mErrorCount: number = 0; - private mWarningCount: number = 0; - private warningCount: number = 0; - private noteCount: number = 0; - private red: string = '\u001b[31m'; - private yellow: string = '\u001b[33m'; - private blue: string = '\u001b[34m'; - private reset: string = '\u001b[39m'; - - public apply(compiler: Compiler): void { - compiler.hooks.compilation.tap('SourcemapFixer', compilation => { - compilation.hooks.afterProcessAssets.tap('SourcemapFixer', assets => { - Reflect.ownKeys(assets).forEach(key => { - if (/\.map$/.test(key.toString())) { - assets[key]._value = assets[key]._value.toString().replace('.ets?entry', '.ets'); - } - }); - } - ); - }); - - compiler.hooks.done.tap('Result States', (stats: Stats) => { - this.mStats = stats; - this.warningCount = 0; - this.noteCount = 0; - if (this.mStats.compilation.errors) { - this.mErrorCount = this.mStats.compilation.errors.length; - } - if (this.mStats.compilation.warnings) { - this.mWarningCount = this.mStats.compilation.warnings.length; - } - props.push(...dollarCollection, ...decoratorParamSet, ...BUILDIN_STYLE_NAMES); - this.printResult(); - }); - - if (!projectConfig.isPreview) { - compiler.hooks.compilation.tap('Collect Components And Modules', compilation => { - compilation.hooks.additionalAssets.tapAsync('Collect Components And Modules', callback => { - compilation.assets['./component_collection.txt'] = - new RawSource(Array.from(appComponentCollection).join(",")); - compilation.assets['./module_collection.txt'] = - new RawSource(moduleCollection.size === 0 ? 'NULL' : Array.from(moduleCollection).join(",")); - callback(); - }); - }) - } - } - - private printResult(): void { - this.printWarning(); - this.printError(); - if (this.mErrorCount + this.warningCount + this.noteCount > 0) { - let result: string; - let resultInfo: string = ''; - if (this.mErrorCount > 0) { - resultInfo += `ERROR:${this.mErrorCount}`; - result = 'FAIL '; - } else { - result = 'SUCCESS '; - } - if (this.warningCount > 0) { - resultInfo += ` WARN:${this.warningCount}`; - } - if (this.noteCount > 0) { - resultInfo += ` NOTE:${this.noteCount}`; - } - logger.info(this.blue, 'COMPILE RESULT:' + result + `{${resultInfo}}`, this.reset); - } else { - console.info(this.blue, 'COMPILE RESULT:SUCCESS ', this.reset); - } - } - - private printWarning(): void { - if (this.mWarningCount > 0) { - const warnings: Info[] = this.mStats.compilation.warnings; - const length: number = warnings.length; - for (let index = 0; index < length; index++) { - const message: string = warnings[index].message.replace(/^Module Warning\s*.*:\n/, '') - .replace(/\(Emitted value instead of an instance of Error\) BUILD/, ''); - if (/^NOTE/.test(message)) { - this.noteCount++; - logger.info(this.blue, message, this.reset, '\n'); - } else { - this.warningCount++; - logger.warn(this.yellow, message.replace(/^WARN/, 'ETS:WARN'), this.reset, '\n'); - } - } - if (this.mWarningCount > length) { - this.warningCount = this.warningCount + this.mWarningCount - length; - } - } - } - - private printError(): void { - if (this.mErrorCount > 0) { - const errors: Info[] = [...this.mStats.compilation.errors]; - for (let index = 0; index < errors.length; index++) { - if (errors[index].issue) { - const position: string = errors[index].issue.location - ? `:${errors[index].issue.location.start.line}:${errors[index].issue.location.start.column}` - : ''; - const location: string = errors[index].issue.file + position; - const detail: string = errors[index].issue.message; - logger.error(this.red, 'ETS:ERROR File: ' + location, this.reset); - logger.error(this.red, detail, this.reset, '\n'); - } else if (/BUILDERROR/.test(errors[index].message)) { - const errorMessage: string = errors[index].message.replace(/^Module Error\s*.*:\n/, '') - .replace(/\(Emitted value instead of an instance of Error\) BUILD/, '') - .replace(/^ERROR/, 'ETS:ERROR'); - this.printErrorMessage(errorMessage, true, errors[index]); - } else { - let errorMessage: string = `${errors[index].message.replace(/\[tsl\]\s*/, '') - .replace(/\u001b\[.*?m/g, '').replace(/\.ets\.ts/g, '.ets').trim()}\n`; - errorMessage = this.filterModuleError(errorMessage) - .replace(/^ERROR in /, 'ETS:ERROR File: ').replace(/\s{6}TS/g, ' TS') - .replace(/\(([0-9]+),([0-9]+)\)/, ':$1:$2'); - this.printErrorMessage(errorMessage, false, errors[index]); - } - } - } - } - private printErrorMessage(errorMessage: string, lineFeed: boolean, errorInfo: Info): void { - if (this.validateError(errorMessage)) { - if (lineFeed) { - logger.error(this.red, errorMessage + '\n', this.reset); - } else { - logger.error(this.red, errorMessage, this.reset); - } - } else { - const errorsIndex = this.mStats.compilation.errors.indexOf(errorInfo); - this.mStats.compilation.errors.splice(errorsIndex, 1); - this.mErrorCount = this.mErrorCount - 1; - } - } - private validateError(message: string): boolean { - const propInfoReg: RegExp = /Cannot find name\s*'(\$?[_a-zA-Z0-9]+)'/; - const componentNameReg: RegExp = /'typeof\s*(\$?[_a-zA-Z0-9]+)' is not callable/; - const stateInfoReg: RegExp = /Property\s*'(\$[_a-zA-Z0-9]+)' does not exist on type/; - const extendInfoReg: RegExp = /Property\s*'([_a-zA-Z0-9]+)' does not exist on type\s*'([_a-zA-Z0-9]+)'\./; - if (this.matchMessage(message, props, propInfoReg) || - this.matchMessage(message, [...componentCollection.customComponents], componentNameReg) || - this.matchMessage(message, props, stateInfoReg) || - this.matchMessage(message, EXTEND_ATTRIBUTE, extendInfoReg, true)) { - return false; - } - return true; - } - private matchMessage(message: string, nameArr: any, reg: RegExp, - validateComponent: boolean = false): boolean { - if (reg.test(message)) { - const match: string[] = message.match(reg); - if (validateComponent) { - if (match[1] && match[2] && nameArr.has(match[2])) { - const attributeArray: string[] = [...nameArr.get(match[2])].map(item => item.attribute); - if (attributeArray.includes(match[1])) { - return true; - } - } - } else { - if (match[1] && nameArr.includes(match[1])) { - return true; - } - } - } - return false; - } - private filterModuleError(message: string): string { - if (/You may need an additional loader/.test(message) && transformLog && transformLog.sourceFile) { - const fileName: string = transformLog.sourceFile.fileName.replace(/.ts$/, ''); - const errorInfos: string[] = message.split('You may need an additional loader to handle the result of these loaders.'); - if (errorInfos && errorInfos.length > 1 && errorInfos[1]) { - message = `ERROR in ${fileName}\n The following syntax is incorrect.${errorInfos[1]}`; - } - } - return message; - } -} diff --git a/compiler/compiler/src/component_map.ts b/compiler/compiler/src/component_map.ts deleted file mode 100644 index 5f3508b27..000000000 --- a/compiler/compiler/src/component_map.ts +++ /dev/null @@ -1,455 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - -export const COMPONENT_MAP: any = { - Search: { - atomic: true, - attrs: [ - 'searchButton', 'placeholderColor', 'placeholderFont', 'onSubmit', 'onChange' - ] - }, - FormComponent: { - atomic: true, - attrs: [ - 'size', 'moduleName', 'dimension', 'allowUpdate', 'visibility', - 'onAcquired', 'onError', 'onRouter' - ] - }, - Image: { - atomic: true, - attrs: [ - 'alt', 'objectFit', 'matchTextDirection', 'fitOriginalSize', 'objectRepeat', 'renderMode', 'interpolation', - 'onComplete', 'onError', 'onFinish', 'sourceSize', 'fillColor', 'autoResize' - ] - }, - ImageAnimator: { - atomic: true, - attrs: [ - 'images', 'state', 'duration', 'reverse', 'fixedSize', 'preDecode', 'fillMode', 'iterations', 'onStart', - 'onPause', 'onRepeat', 'onCancel', 'onFinish' - ] - }, - Animator: { - atomic: true, - noDebugLine: true, - attrs: [ - 'state', 'duration', 'curve', 'delay', 'fillMode', 'iterations', 'playMode', 'motion', 'onStart', - 'onPause', 'onRepeat', 'onCancel', 'onFinish', 'onFrame' - ] - }, - Refresh: { - single: true, - attrs: [ - 'refreshing', 'offset', 'friction', - 'onStateChange', 'onRefreshing' - ] - }, - SpringProp: { - atomic: true - }, - SpringMotion: { - atomic: true - }, - FrictionMotion: { - atomic: true - }, - ScrollMotion: { - atomic: true - }, - Text: { - children: ['Span'], - attrs: [ - 'fontColor', 'fontSize', 'fontStyle', 'fontWeight', 'textAlign', 'lineHeight', 'textOverflow', 'maxLines', - 'decoration', 'letterSpacing', 'textCase', 'baselineOffset', 'minFontSize', 'maxFontSize' - ] - }, - TextPicker: { - atomic: true, - attrs: ['defaultPickerItemHeight', 'onAccept', 'onCancel', 'onChange'] - }, - DatePicker: { - atomic: true, - attrs: ['lunar', 'onChange', 'useMilitaryTime'] - }, - Span: { - atomic: true, - attrs: [ - 'fontColor', 'fontSize', 'fontStyle', 'fontFamily', 'fontWeight', 'decoration', 'letterSpacing', 'textCase' - ] - }, - Button: { - attrs: ['type', 'stateEffect', 'fontColor', 'fontSize', 'fontWeight'] - }, - Divider: { - atomic: true, - attrs: ['color', 'vertical', 'strokeWidth', 'lineCap'] - }, - Piece: { - atomic: true, - attrs: ['iconPosition'] - }, - Slider: { - atomic: true, - attrs: ['blockColor', 'trackColor', 'selectedColor', 'minLabel','maxLabel', 'showSteps', 'showTips', 'onChange'] - }, - Counter: { - attrs: [ - 'onStateChange', 'onInc', - 'onDec', 'height', 'width' - ] - }, - Row: { - attrs: ['alignItems'] - }, - Column: { - attrs: ['alignItems'] - }, - Stack: { - attrs: ['alignContent'] - }, - List: { - children: ['ListItem', 'Section'], - attrs: [ - 'listDirection', 'scrollBar', 'edgeEffect', 'divider', 'editMode', 'cachedCount', 'chainAnimation', - 'onScroll', 'onReachStart', 'onReachEnd', 'onScrollStop', 'onItemDelete', 'onItemMove' - ] - }, - ListItem: { - parents: ['List'], - single: true, - attrs: ['sticky', 'editable'] - }, - Grid: { - children: ['GridItem'], - attrs: ['columnsTemplate', 'rowsTemplate', 'columnsGap', 'rowsGap', 'scrollBar', 'scrollBarWidth', 'scrollBarColor'] - }, - GridItem: { - parents: ['Grid'], - single: true, - attrs: ['rowStart', 'rowEnd', 'columnStart', 'columnEnd', 'forceRebuild'] - }, - GridContainer: { - attrs: ['columns', 'sizeType', 'gutter', 'margin'] - }, - Hyperlink: { - attrs: ['color'] - }, - Swiper: { - attrs: [ - 'index', 'autoPlay', 'interval', 'indicator', - 'loop', 'duration', 'vertical', 'itemSpace', 'displayMode', 'onChange' - ] - }, - Stepper: { - children: ['StepperItem'], - attrs: [ - 'onFinish', 'onSkip', 'onChange', 'onNext', 'onPrevious' - ] - }, - StepperItem: { - parents: ['Stepper'], - single: true, - attrs: ['prevLabel', 'nextLabel', 'status'] - }, - Rating: { - attrs: ['stars', 'stepSize', 'starStyle', 'onChange'] - }, - Calendar: { - attrs: [ - 'date', 'showLunar', 'startOfWeek', 'offDays', 'onSelectChange', 'onRequestData', - 'currentData', 'preData', 'nextData', 'needSlide', 'showHoliday', 'direction', - 'currentDayStyle', 'nonCurrentDayStyle', 'todayStyle', 'weekStyle', 'workStateStyle' - ] - }, - Panel: { - attrs: [ - 'type', 'mode', 'dragBar', 'fullHeight', - 'halfHeight', 'miniHeight', 'show', 'onChange' - ] - }, - Navigator: { - single: true, - attrs: ['target', 'type', 'params', 'active'] - }, - Sheet: { - children: ['Section'], - attrs: [] - }, - Section: { - attrs: [] - }, - QRCode: { - attrs: ['color', 'backgroundColor'] - }, - Flex: { - attrs: [] - }, - LoadingProgress: { - atomic: true, - attrs: ['color'] - }, - NavigationView: { - attrs: [] - }, - Scroll: { - attrs: [ - 'scrollable', 'onScroll', 'onScrollEdge', 'onScrollEnd', 'scrollBar', 'scrollBarColor', - 'scrollBarWidth', 'edgeEffect' - ] - }, - Shape: { - children: ['Rect', 'Path', 'Circle', 'Ellipse', 'Shape', 'Polyline', 'Polygon', 'Image', 'Text'], - attrs: [ - 'stroke', 'fill', 'strokeDashOffset', 'strokeLineCap', - 'strokeLineJoin', 'strokeMiterLimit', 'strokeOpacity', - 'fillOpacity', 'strokeWidth', 'antiAlias', 'strokeDashArray', - 'viewPort' - ] - }, - Progress: { - atomic: true, - attrs: [ - 'value', 'color', 'cricularStyle', 'circularStyle' - ] - }, - Rect: { - atomic: true, - attrs: [ - 'radiusWidth', 'radiusHeight', 'radius' - ] - }, - Path: { - atomic: true, - attrs: [ - 'commands' - ] - }, - Circle: { - atomic: true - }, - Ellipse: { - atomic: true - }, - Camera: { - atomic: true, - attrs: ['devicePosition'] - }, - Tabs: { - children: ['TabContent'], - attrs: [ - 'vertical', 'scrollable', 'barMode', 'barWidth', 'barHeight', 'animationDuration', - 'onChange' - ] - }, - TabContent: { - parents: ['Tabs'], - attrs: ['tabBar'] - }, - PageTransitionEnter: { - atomic: true, - noDebugLine: true, - attrs: ['onEnter'] - }, - PageTransitionExit: { - atomic: true, - noDebugLine: true, - attrs: ['onExit'] - }, - Blank: { - parents: ['Row', 'Column'], - atomic: true, - attrs: ['color'] - }, - RowSplit: { - attrs: ['resizeable'] - }, - ColumnSplit: { - attrs: ['resizeable'] - }, - Toggle: { - attrs: ['onChange', 'selectedColor', 'swithPointStyle'] - }, - AlertDialog: { - attrs: ['show'] - }, - ActionSheet: { - attrs: ['show'] - }, - Video: { - atomic: true, - attrs: [ - 'muted', 'autoPlay', 'controls', 'loop', 'objectFit', 'onSeeking', 'onFullscreenChange', - 'onStart', 'onPause', 'onPrepared', 'onFinish', 'onSeeked', 'onUpdate', 'onError' - ] - }, - AbilityComponent: { - attrs: ['onReady', 'onDestroy', 'onAbilityCreated', 'onAbilityMoveToFront', 'onAbilityWillRemove'] - }, - AlphabetIndexer: { - attrs: [ - 'onSelected', 'selectedColor', 'popupColor', 'selectedBackgroundColor', 'popupBackground', 'usingPopup', - 'selectedFont', 'popupFont', 'itemSize', 'font', 'color', 'alignStyle' - ] - }, - Radio: { - atomic: true, - attrs: ['checked', 'onChange'] - }, - Web: { - atomic: true, - attrs: ['pagestart', 'pagefinish', 'error','message', 'reload'] - }, - GeometryView: { - atomic: true - }, - DataPanel: { - atomic: false, - attrs: ['closeEffect'] - }, - Badge: { - atomics: true, - attrs: [] - }, - Line: { - atomic: true, - attrs: [ - 'startPoint','endPoint' - ] - }, - Polygon: { - atomic: true, - attrs: ['points'] - }, - Polyline: { - atomic: true, - attrs: ['points'] - }, - Gauge: { - atomic: true, - attrs: ['value', 'startAngle', 'endAngle', 'colors', 'strokeWidth', 'labelTextConfig', 'labelColorConfig'] - }, - TextArea: { - atomic: true, - attrs: [ - 'placeholderColor', 'placeholderFont', 'textAlign', 'caretColor', 'onChange' - ] - }, - TextInput: { - atomic: true, - attrs: [ - 'type', 'placeholderColor', 'placeholderFont', 'enterKeyType', 'caretColor', 'maxLength', 'onEditChanged', - 'onSubmit', 'onChange' - ] - }, - Marquee: { - atomic: true, - attrs: ['fontColor', 'fontSize', 'allowScale', 'fontWeight', 'fontFamily', 'onStart', 'onBounce', 'onFinish'] - }, - Menu: { - children: ['Option'], - attrs: ['show', 'showPosition', 'fontColor', 'fontSize', 'fontWeight', 'fontFamily'], - }, - Option: { - parents: ['Menu'], - attrs: ['fontColor', 'fontSize', 'fontWeight', 'fontFamily'], - }, -}; - -const COMMON_ATTRS: Set = new Set([ - 'width', 'height', 'size', 'constraintSize', 'layoutPriority', 'layoutWeight', - 'padding', 'paddingLeft', 'paddingRight', 'paddingTop', 'paddingBottom', - 'margin', 'marginLeft', 'marginRight', 'marginTop', 'marginBottom', - 'border', 'borderStyle', 'borderWidth', 'borderColor', 'borderRadius', - 'backgroundColor', 'backgroundImage', 'backgroundImageSize', 'backgroundImagePosition', - 'opacity', 'animation', 'transition', - 'navigationTitle', 'navigationSubTitle', 'hideNavigationBar', 'hideNavigationBackButton', - 'toolBar', 'hideToolBar', 'onClick', 'onTouch', 'onKeyEvent', 'onHover', - 'blur', 'backdropBlur', 'windowBlur', 'translate', 'rotate', 'scale', 'transform', - 'onAppear', 'onDisAppear', 'visibility', 'flexBasis', 'flexShrink', 'flexGrow', 'alignSelf', - 'useAlign', 'zIndex', 'sharedTransition', 'direction', 'align', 'position', 'markAnchor', 'offset', - 'enabled', 'aspectRatio', 'displayPriority', - 'onDrag', 'onDragEnter', 'onDragMove', 'onDragLeave', 'onDrop', - 'overlay', 'linearGradient', 'sweepGradient', 'radialGradient', - 'gridOffset', 'gridSpan', 'useSizeType', - 'motionPath', 'clip', 'shadow', 'mask', - 'accessibilityGroup', 'accessibilityText', 'accessibilityDescription', - 'accessibilityImportance', 'onAccessibility', 'grayscale', 'brightness', 'contrast', - 'saturate', 'geometryTransition', - 'bindPopup', 'colorBlend', 'invert', 'sepia', 'hueRotate', 'bindMenu' -]); -const TRANSITION_COMMON_ATTRS: Set = new Set([ - 'slide', 'translate', 'scale', 'opacity' -]); -export const GESTURE_ATTRS: Set = new Set([ - 'gesture', 'parallelGesture', 'priorityGesture' -]); - -export const forbiddenUseStateType: Set = new Set(['Scroller', 'SwiperScroller', - 'VideoController', 'CustomDialogController', 'SwiperController', 'TabsController', - 'CalendarController', 'AbilityController' -]); - -export const INNER_COMPONENT_NAMES: Set = new Set(); -export const NO_DEBUG_LINE_COMPONENT: Set = new Set(); -export const BUILDIN_CONTAINER_COMPONENT: Set = new Set(); -export const BUILDIN_STYLE_NAMES: Set = new Set([ - ...COMMON_ATTRS, ...GESTURE_ATTRS, ...TRANSITION_COMMON_ATTRS -]); -export const AUTOMIC_COMPONENT: Set = new Set(); -export const SINGLE_CHILD_COMPONENT: Set = new Set(); -export const SPECIFIC_CHILD_COMPONENT: Map> = new Map(); -export const GESTURE_TYPE_NAMES: Set = new Set([ - 'TapGesture', 'LongPressGesture', 'PanGesture', 'PinchGesture', 'RotationGesture', 'GestureGroup' -]); -export const CUSTOM_BUILDER_METHOD: Set = new Set(); - -export interface ExtendParamterInterfance { - attribute: string, - parameterCount: number -} -export const EXTEND_ATTRIBUTE: Map> = new Map(); - -export const JS_BIND_COMPONENTS: Set = new Set([ - ...GESTURE_TYPE_NAMES, 'Gesture', - 'PanGestureOption', 'CustomDialogController', 'Storage', 'Scroller', 'SwiperController', - 'TabsController', 'CalendarController', 'AbilityController', 'VideoController' -]); - -(function initComponent() { - Object.keys(COMPONENT_MAP).forEach((componentName) => { - INNER_COMPONENT_NAMES.add(componentName); - JS_BIND_COMPONENTS.add(componentName); - if (!COMPONENT_MAP[componentName].atomic) { - BUILDIN_CONTAINER_COMPONENT.add(componentName); - } else { - AUTOMIC_COMPONENT.add(componentName); - } - if (COMPONENT_MAP[componentName].single) { - SINGLE_CHILD_COMPONENT.add(componentName); - } - if (COMPONENT_MAP[componentName].children) { - SPECIFIC_CHILD_COMPONENT.set(componentName, - new Set([...COMPONENT_MAP[componentName].children])); - } - if (COMPONENT_MAP[componentName].attrs && COMPONENT_MAP[componentName].attrs.length) { - COMPONENT_MAP[componentName].attrs.forEach((item) => { - BUILDIN_STYLE_NAMES.add(item); - }); - } - if (COMPONENT_MAP[componentName].noDebugLine) { - NO_DEBUG_LINE_COMPONENT.add(componentName); - } - }); -})(); diff --git a/compiler/compiler/src/create.ts b/compiler/compiler/src/create.ts deleted file mode 100644 index c7e0c9cb9..000000000 --- a/compiler/compiler/src/create.ts +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - -const fs = require('fs'); -const program = require('commander'); - -program.parse(process.argv); -let name:string = 'HelloAce'; -let appID:string = 'ace.helloworld'; -let appName:string = 'HelloAce'; -if (program.args && program.args[0]) { - name = program.args[0]; - appID = program.args[0]; - appName = program.args[0]; -} - -const regPath: RegExp = /[`~!@#$%^&*()_+<>?:"{},./;'[\]]/im; - -/* - * Create sample project and files. - * @param dist {String} - */ -function createProject(dist: string) { - const dist_ = dist.trim().split('/'); - if (dist_.length > 1 || regPath.test(dist)) { - return console.error( - 'ERROR: The project name cannot be a path nor contain any special symbol.\n' + - "NOTE: To create the template project, run 'npm run create' in the root directory.\n" + - "NOTE: To customize the project name, run 'npm run create '."); - } - const appPath:string = dist + '/app.ets'; - const manifestPath:string = dist + '/manifest.json'; - const indexPath:string = dist + '/pages/index.ets'; - - const app:string = `export default { - onCreate() { - console.info('Application onCreate') - }, - onDestroy() { - console.info('Application onDestroy') - }, -}`; - - const manifest:string = `{ - "appID": "com.huawei.` + appID + `", - "appName": "` + appName + `", - "versionName": "1.0.0", - "versionCode": 1, - "minPlatformVersion": "1.0.1", - "pages": [ - "pages/index" - ], - "window": { - "designWidth": 750, - "autoDesignWidth": false - } -}`; - - const index:string = `@Entry -@Component -struct MyComponent { - private value1: string = "hello world 1"; - private value2: string = "hello world 2"; - private value3: string = "hello world 3"; - - build() { - Column() { - Text(this.value1); - Text(this.value2); - Text(this.value3); - } - } -}`; - - fs.mkdir(dist + '/pages', { recursive: true }, (err) => { - if (err) { - return console.error('ERROR: Failed to create project directory.'); - } - fs.writeFile(appPath, app, (err) => { - if (err) { - return console.error('ERROR: Failed to write app.ets.'); - } - }); - fs.writeFile(manifestPath, manifest, (err) => { - if (err) { - return console.error('ERROR: Failed to write manifest.json.'); - } - }); - fs.writeFile(indexPath, index, (err) => { - if (err) { - return console.error('ERROR: Failed to write index.ets.'); - } - }); - }); -} - -createProject(name); diff --git a/compiler/compiler/src/gen_abc_plugin.ts b/compiler/compiler/src/gen_abc_plugin.ts deleted file mode 100644 index e645bdf4f..000000000 --- a/compiler/compiler/src/gen_abc_plugin.ts +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - -import * as process from 'child_process'; -import * as fs from 'fs'; - -import * as path from 'path'; -import Compiler from 'webpack/lib/Compiler'; -import { logger } from './compile_info'; - -const arkDir: string = path.join(__dirname, '..', 'bin', 'ark'); - -const firstFileEXT: string = '_.js'; -let output: string; -let webpackPath: string; -let isWin: boolean = false; -let isMac: boolean = false; -let isDebug: boolean = false; - -const red: string = '\u001b[31m'; -const blue: string = '\u001b[34m'; -const reset: string = '\u001b[39m'; - -export class GenAbcPlugin { - constructor(output_, webpackPath_, isDebug_) { - output = output_; - webpackPath = webpackPath_; - isDebug = isDebug_; - } - apply(compiler: Compiler) { - if (fs.existsSync(path.resolve(webpackPath, 'ark/build-win'))) { - isWin = true; - } else { - if (fs.existsSync(path.resolve(webpackPath, 'ark/build-mac'))) { - isMac = true; - } else { - if (!fs.existsSync(path.resolve(webpackPath, 'ark/build'))) { - logger.error(red, 'ETS:ERROR find build fail', reset); - return; - } - } - } - - compiler.hooks.emit.tap('GenAbcPlugin', (compilation) => { - Object.keys(compilation.assets).forEach(key => { - // choice *.js - if (output && webpackPath && path.extname(key) === '.js') { - const newContent: string = compilation.assets[key].source(); - const keyPath: string = key.replace(/\.js$/, firstFileEXT); - writeFileSync(newContent, path.resolve(output, keyPath), key); - } - }); - }); - } -} - -function writeFileSync(inputString: string, output: string, jsBundleFile: string): void { - const parent: string = path.join(output, '..'); - if (!(fs.existsSync(parent) && fs.statSync(parent).isDirectory())) { - mkDir(parent); - } - fs.writeFileSync(output, inputString); - if (fs.existsSync(output)) { - js2abcFirst(output); - } else { - logger.error(red, `ETS:ERROR Failed to convert file ${jsBundleFile} to bin. ${output} is lost`, reset); - } -} - -function mkDir(path_: string): void { - const parent: string = path.join(path_, '..'); - if (!(fs.existsSync(parent) && !fs.statSync(parent).isFile())) { - mkDir(parent); - } - fs.mkdirSync(path_); -} - -function js2abcFirst(inputPath: string): void { - let param: string = '-r'; - if (isDebug) { - param += ' --debug'; - } - - let js2abc: string = path.join(arkDir, 'build', 'src', 'index.js'); - if (isWin) { - js2abc = path.join(arkDir, 'build-win', 'src', 'index.js'); - } else if (isMac) { - js2abc = path.join(arkDir, 'build-mac', 'src', 'index.js'); - } - - const cmd: string = `node --expose-gc "${js2abc}" "${inputPath}" ${param}`; - - try { - process.execSync(cmd); - } catch (e) { - logger.error(red, `ETS:ERROR Failed to convert file ${inputPath} to abc `, reset); - return; - } - - if (fs.existsSync(inputPath)) { - fs.unlinkSync(inputPath); - } - - const abcFile: string = inputPath.replace(/\.js$/, '.abc'); - if (fs.existsSync(abcFile)) { - const abcFileNew: string = abcFile.replace(/_.abc$/, '.abc'); - fs.renameSync(abcFile, abcFileNew); - } else { - logger.error(red, `ETS:ERROR ${abcFile} is lost`, reset); - } -} diff --git a/compiler/compiler/src/pre_define.ts b/compiler/compiler/src/pre_define.ts deleted file mode 100644 index ce665c478..000000000 --- a/compiler/compiler/src/pre_define.ts +++ /dev/null @@ -1,173 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - -export const NATIVE_MODULE: Set = new Set( - ['system.app', 'ohos.app', 'system.router', 'system.curves', 'ohos.curves', 'system.matrix4', 'ohos.matrix4']); -export const SYSTEM_PLUGIN: string = 'system'; -export const OHOS_PLUGIN: string = 'ohos'; - -export const COMPONENT_DECORATOR_ENTRY: string = '@Entry'; -export const COMPONENT_DECORATOR_PREVIEW: string = '@Preview'; -export const COMPONENT_DECORATOR_COMPONENT: string = '@Component'; -export const COMPONENT_DECORATOR_CUSTOM_DIALOG: string = '@CustomDialog'; - -export const COMPONENT_NON_DECORATOR: string = 'regular'; -export const COMPONENT_STATE_DECORATOR: string = '@State'; -export const COMPONENT_PROP_DECORATOR: string = '@Prop'; -export const COMPONENT_LINK_DECORATOR: string = '@Link'; -export const COMPONENT_STORAGE_PROP_DECORATOR: string = '@StorageProp'; -export const COMPONENT_STORAGE_LINK_DECORATOR: string = '@StorageLink'; -export const COMPONENT_PROVIDE_DECORATOR: string = '@Provide'; -export const COMPONENT_CONSUME_DECORATOR: string = '@Consume'; -export const COMPONENT_OBJECT_LINK_DECORATOR: string = '@ObjectLink'; -export const COMPONENT_WATCH_DECORATOR: string = '@Watch'; - -export const INNER_COMPONENT_DECORATORS: Set = new Set([COMPONENT_DECORATOR_ENTRY, - COMPONENT_DECORATOR_PREVIEW, COMPONENT_DECORATOR_COMPONENT, COMPONENT_DECORATOR_CUSTOM_DIALOG]); -export const INNER_COMPONENT_MEMBER_DECORATORS: Set = new Set([COMPONENT_STATE_DECORATOR, - COMPONENT_PROP_DECORATOR, COMPONENT_LINK_DECORATOR, COMPONENT_STORAGE_PROP_DECORATOR, - COMPONENT_STORAGE_LINK_DECORATOR, COMPONENT_PROVIDE_DECORATOR, COMPONENT_CONSUME_DECORATOR, - COMPONENT_OBJECT_LINK_DECORATOR, COMPONENT_WATCH_DECORATOR]); - -export const COMPONENT_OBSERVED_DECORATOR: string = '@Observed'; -export const COMPONENT_BUILDER_DECORATOR: string = '@Builder'; -export const COMPONENT_EXTEND_DECORATOR: string = '@Extend'; - -export const OBSERVED_PROPERTY_SIMPLE: string = 'ObservedPropertySimple'; -export const OBSERVED_PROPERTY_OBJECT: string = 'ObservedPropertyObject'; -export const SYNCHED_PROPERTY_SIMPLE_ONE_WAY: string = 'SynchedPropertySimpleOneWay'; -export const SYNCHED_PROPERTY_SIMPLE_TWO_WAY: string = 'SynchedPropertySimpleTwoWay'; -export const SYNCHED_PROPERTY_OBJECT_TWO_WAY: string = 'SynchedPropertyObjectTwoWay'; -export const SYNCHED_PROPERTY_NESED_OBJECT: string = 'SynchedPropertyNesedObject'; - -export const INITIALIZE_CONSUME_FUNCTION: string = 'initializeConsume'; -export const ADD_PROVIDED_VAR: string = 'addProvidedVar'; - -export const APP_STORAGE: string = 'AppStorage'; -export const APP_STORAGE_SET_AND_PROP: string = 'setAndProp'; -export const APP_STORAGE_SET_AND_LINK: string = 'setAndLink'; -export const APP_STORAGE_GET_OR_SET: string = 'GetOrCreate'; - -export const PAGE_ENTRY_FUNCTION_NAME: string = 'loadDocument'; - -export const COMPONENT_DECORATOR_NAME_COMPONENT: string = 'Component'; -export const COMPONENT_DECORATOR_NAME_CUSTOMDIALOG: string = 'CustomDialog'; -export const CUSTOM_DECORATOR_NAME: Set = new Set([ - COMPONENT_DECORATOR_NAME_COMPONENT, COMPONENT_DECORATOR_NAME_CUSTOMDIALOG -]); - -export const EXTNAME_ETS: string = '.ets'; -export const NODE_MODULES: string = 'node_modules'; -export const INDEX_ETS: string = 'index.ets'; -export const PACKAGE_JSON: string = 'package.json'; -export const CUSTOM_COMPONENT_DEFAULT: string = 'default'; - -export const BASE_COMPONENT_NAME: string = 'View'; -export const STRUCT: string = 'struct'; -export const CLASS: string = 'class'; -export const COMPONENT_BUILD_FUNCTION: string = 'build'; -export const COMPONENT_RENDER_FUNCTION: string = 'render'; -export const COMPONENT_TRANSITION_FUNCTION: string = 'pageTransition'; -export const COMPONENT_TRANSITION_NAME: string = 'PageTransition'; - -export const COMPONENT_BUTTON: string = 'Button'; -export const COMPONENT_FOREACH: string = 'ForEach'; -export const COMPONENT_LAZYFOREACH: string = 'LazyForEach'; -export const IS_RENDERING_IN_PROGRESS: string = 'isRenderingInProgress'; -export const COMPONENT_BLANK: string = 'Blank'; -export const FOREACH_OBSERVED_OBJECT: string = 'ObservedObject'; -export const FOREACH_GET_RAW_OBJECT: string = 'GetRawObject'; -export const COMPONENT_IF: string = 'If'; -export const COMPONENT_IF_BRANCH_ID_FUNCTION: string = 'branchId'; -export const COMPONENT_IF_UNDEFINED: string = 'undefined'; -export const GLOBAL_CONTEXT: string = 'Context'; -export const ATTRIBUTE_ANIMATION: string = 'animation'; -export const ATTRIBUTE_ANIMATETO: string = 'animateTo'; - -export const COMPONENT_CONSTRUCTOR_ID: string = 'compilerAssignedUniqueChildId'; -export const COMPONENT_CONSTRUCTOR_PARENT: string = 'parent'; -export const COMPONENT_CONSTRUCTOR_PARAMS: string = 'params'; -export const COMPONENT_CONSTRUCTOR_UNDEFINED: string = 'undefined'; - -export const BUILD_ON: string = 'on'; -export const BUILD_OFF: string = 'off'; - -export const COMPONENT_CREATE_FUNCTION: string = 'create'; -export const COMPONENT_CREATE_LABEL_FUNCTION: string = 'createWithLabel'; -export const COMPONENT_CREATE_CHILD_FUNCTION: string = 'createWithChild'; -export const COMPONENT_POP_FUNCTION: string = 'pop'; -export const COMPONENT_DEBUGLINE_FUNCTION: string = 'debugLine'; - -export const COMPONENT_CONSTRUCTOR_UPDATE_PARAMS: string = 'updateWithValueParams'; -export const COMPONENT_CONSTRUCTOR_DELETE_PARAMS: string = 'aboutToBeDeleted'; -export const CREATE_GET_METHOD: string = 'get'; -export const CREATE_SET_METHOD: string = 'set'; -export const CREATE_NEWVALUE_IDENTIFIER: string = 'newValue'; -export const CREATE_CONSTRUCTOR_PARAMS: string = 'params'; -export const CREATE_CONSTRUCTOR_SUBSCRIBER_MANAGER: string = 'SubscriberManager'; -export const CREATE_CONSTRUCTOR_GET_FUNCTION: string = 'Get'; -export const CREATE_CONSTRUCTOR_DELETE_FUNCTION: string = 'delete'; -export const ABOUT_TO_BE_DELETE_FUNCTION_ID: string = 'id'; -export const COMPONENT_WATCH_FUNCTION: string = 'declareWatch'; - -export const CREATE_STATE_METHOD: string = 'createState'; -export const CREATE_PROP_METHOD: string = 'createProp'; -export const CREATE_LINK_METHOD: string = 'createLink'; -export const CREATE_OBSERVABLE_OBJECT_METHOD: string = 'createObservableObject'; - -export const CUSTOM_COMPONENT_EARLIER_CREATE_CHILD: string = 'earlierCreatedChild_'; -export const CUSTOM_COMPONENT_FUNCTION_FIND_CHILD_BY_ID: string = 'findChildById'; -export const CUSTOM_COMPONENT_NEEDS_UPDATE_FUNCTION: string = 'needsUpdate'; -export const CUSTOM_COMPONENT_MARK_STATIC_FUNCTION: string = 'markStatic'; - -export const COMPONENT_GESTURE: string = 'Gesture'; -export const COMPONENT_GESTURE_GROUP: string = 'GestureGroup'; -export const GESTURE_ATTRIBUTE: string = 'gesture'; -export const PARALLEL_GESTURE_ATTRIBUTE: string = 'parallelGesture'; -export const PRIORITY_GESTURE_ATTRIBUTE: string = 'priorityGesture'; -export const GESTURE_ENUM_KEY: string = 'GesturePriority'; -export const GESTURE_ENUM_VALUE_HIGH: string = 'High'; -export const GESTURE_ENUM_VALUE_LOW: string = 'Low'; -export const GESTURE_ENUM_VALUE_PARALLEL: string = 'Parallel'; - -export const RESOURCE: string = '$r'; -export const RESOURCE_RAWFILE: string = '$rawfile'; -export const RESOURCE_NAME_ID: string = 'id'; -export const RESOURCE_NAME_TYPE: string = 'type'; -export const RESOURCE_NAME_PARAMS: string = 'params'; -export const RESOURCE_TYPE = { - color: 10001, - float: 10002, - string: 10003, - plural: 10004, - boolean: 10005, - intarray: 10006, - integer: 10007, - pattern: 10008, - strarray: 10009, - media: 20000, - rawfile: 30000 -}; - -export const WORKERS_DIR: string = 'workers'; -export const WORKER_OBJECT: string = 'Worker'; - -export const SET_CONTROLLER_METHOD: string = 'setController'; -export const SET_CONTROLLER_CTR: string = 'ctr'; -export const SET_CONTROLLER_CTR_TYPE: string = 'CustomDialogController'; -export const JS_DIALOG: string = 'jsDialog'; -export const CUSTOM_DIALOG_CONTROLLER_BUILDER: string = 'builder'; - -export const GEOMETRY_VIEW: string = 'GeometryView'; diff --git a/compiler/compiler/src/pre_process.ts b/compiler/compiler/src/pre_process.ts deleted file mode 100644 index 96eeee0e6..000000000 --- a/compiler/compiler/src/pre_process.ts +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - -import { - ReplaceResult, - sourceReplace, - validateUISyntax, - processSystemApi -} from './validate_ui_syntax'; -import { - LogInfo, - emitLogInfo -} from './utils'; -import { BUILD_ON } from './pre_define'; - -function preProcess(source: string): string { - process.env.compiler = BUILD_ON; - if (/\.ets$/.test(this.resourcePath)) { - const result: ReplaceResult = sourceReplace(source, this.resourcePath); - const newContent: string = result.content; - const log: LogInfo[] = result.log.concat(validateUISyntax(source, newContent, - this.resourcePath, this.resourceQuery)); - if (log.length) { - emitLogInfo(this, log); - } - return newContent; - } else { - return processSystemApi(source); - } -} - -module.exports = preProcess; diff --git a/compiler/compiler/src/process_component_build.ts b/compiler/compiler/src/process_component_build.ts deleted file mode 100644 index e0b842967..000000000 --- a/compiler/compiler/src/process_component_build.ts +++ /dev/null @@ -1,702 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - -import ts from 'typescript'; -import path from 'path'; - -import { - COMPONENT_RENDER_FUNCTION, - COMPONENT_CREATE_FUNCTION, - COMPONENT_POP_FUNCTION, - COMPONENT_BUTTON, - COMPONENT_BLANK, - COMPONENT_CREATE_LABEL_FUNCTION, - COMPONENT_CREATE_CHILD_FUNCTION, - COMPONENT_FOREACH, - COMPONENT_LAZYFOREACH, - IS_RENDERING_IN_PROGRESS, - FOREACH_OBSERVED_OBJECT, - FOREACH_GET_RAW_OBJECT, - COMPONENT_IF, - COMPONENT_IF_BRANCH_ID_FUNCTION, - COMPONENT_IF_UNDEFINED, - ATTRIBUTE_ANIMATION, - GLOBAL_CONTEXT, - COMPONENT_GESTURE, - COMPONENT_GESTURE_GROUP, - GESTURE_ATTRIBUTE, - PARALLEL_GESTURE_ATTRIBUTE, - PRIORITY_GESTURE_ATTRIBUTE, - GESTURE_ENUM_KEY, - GESTURE_ENUM_VALUE_HIGH, - GESTURE_ENUM_VALUE_LOW, - GESTURE_ENUM_VALUE_PARALLEL, - COMPONENT_TRANSITION_NAME, - COMPONENT_DEBUGLINE_FUNCTION -} from './pre_define'; -import { - INNER_COMPONENT_NAMES, - BUILDIN_CONTAINER_COMPONENT, - BUILDIN_STYLE_NAMES, - CUSTOM_BUILDER_METHOD, - GESTURE_ATTRS, - GESTURE_TYPE_NAMES, - EXTEND_ATTRIBUTE, - NO_DEBUG_LINE_COMPONENT -} from './component_map'; -import { componentCollection } from './validate_ui_syntax'; -import { processCustomComponent } from './process_custom_component'; -import { - LogType, - LogInfo, - componentInfo, - createFunction -} from './utils'; -import { projectConfig } from '../main'; -import { transformLog } from './process_ui_syntax'; - -export const appComponentCollection: Set = new Set(); - -export function processComponentBuild(node: ts.MethodDeclaration, - log: LogInfo[]): ts.MethodDeclaration { - let newNode: ts.MethodDeclaration; - const renderNode: ts.Identifier = ts.factory.createIdentifier(COMPONENT_RENDER_FUNCTION); - if (node.body && node.body.statements && node.body.statements.length && - validateRootNode(node, log)) { - newNode = ts.factory.updateMethodDeclaration(node, node.decorators, node.modifiers, - node.asteriskToken, renderNode, node.questionToken, node.typeParameters, node.parameters, - node.type, processComponentBlock(node.body, false, log)); - } else { - newNode = ts.factory.updateMethodDeclaration(node, node.decorators, node.modifiers, - node.asteriskToken, renderNode, node.questionToken, node.typeParameters, node.parameters, - node.type, node.body); - } - return newNode; -} - -export function processComponentBlock(node: ts.Block, isLazy: boolean, log: LogInfo[], - isTransition: boolean = false): ts.Block { - const newStatements: ts.Statement[] = []; - processComponentChild(node, newStatements, log); - if (isLazy) { - newStatements.unshift(createRenderingInProgress(true)); - } - if (isTransition) { - newStatements.unshift(ts.factory.createExpressionStatement( - createFunction(ts.factory.createIdentifier(COMPONENT_TRANSITION_NAME), - ts.factory.createIdentifier(COMPONENT_CREATE_FUNCTION), null))); - newStatements.push(ts.factory.createExpressionStatement( - createFunction(ts.factory.createIdentifier(COMPONENT_TRANSITION_NAME), - ts.factory.createIdentifier(COMPONENT_POP_FUNCTION), null))); - } - if (isLazy) { - newStatements.push(createRenderingInProgress(false)); - } - return ts.factory.updateBlock(node, newStatements); -} - -function validateRootNode(node: ts.MethodDeclaration, log: LogInfo[]): boolean { - let isValid: boolean = false; - if (node.body.statements.length < 4) { - switch (node.body.statements.length) { - case 1: - if (validateFirstNode(node.body.statements[0])) { - isValid = true; - } - break; - case 2: - if (validateFirstNode(node.body.statements[0]) && - validateBlockNode(node.body.statements[1])) { - isValid = true; - } - break; - case 3: - if (validateFirstNode(node.body.statements[0]) && - validateBlockNode(node.body.statements[1]) && - validateSecondNode(node.body.statements[2])) { - isValid = true; - } - break; - } - } - if (!isValid) { - log.push({ - type: LogType.ERROR, - message: `There should have a root container component.`, - pos: node.body.statements.pos - }); - } - return isValid; -} - -function processComponentChild(node: ts.Block, newStatements: ts.Statement[], - log: LogInfo[]): void { - if (node.statements.length) { - node.statements.forEach((item, index) => { - if (ts.isExpressionStatement(item)) { - const name: string = getName(item); - switch (getComponentType(item, log, name)) { - case ComponentType.innerComponent: - processInnerComponent(item, index, Array.from(node.statements), newStatements, log, name); - break; - case ComponentType.customComponent: - processCustomComponent(item, newStatements, log); - break; - case ComponentType.forEachComponent: - processForEachComponent(item, newStatements, log); - break; - case ComponentType.customBuilderMethod: - newStatements.push(item); - break; - } - } else if (ts.isIfStatement(item)) { - appComponentCollection.add(COMPONENT_IF); - processIfStatement(item, newStatements, log); - } else if (!ts.isBlock(item)) { - log.push({ - type: LogType.ERROR, - message: `Only UI component syntax can be written in build method.`, - pos: item.getStart() - }); - } - }); - } -} - -function processInnerComponent(node: ts.ExpressionStatement, index: number, arr: ts.Statement[], - newStatements: ts.Statement[], log: LogInfo[], name: string): void { - const res: CreateResult = createComponent(node, COMPONENT_CREATE_FUNCTION); - newStatements.push(res.newNode); - if (projectConfig.isPreview && !NO_DEBUG_LINE_COMPONENT.has(name)) { - const posOfNode: ts.LineAndCharacter = - transformLog.sourceFile.getLineAndCharacterOfPosition(getRealNodePos(node)); - const projectPath: string = projectConfig.projectPath; - const curFileName: string = transformLog.sourceFile.fileName.replace(/.ts$/, ''); - const debugInfo: string = - `${path.relative(projectPath, curFileName).replace(/\\+/g, '/')}` + - `(${posOfNode.line + 1}:${posOfNode.character + 1})`; - const debugNode: ts.ExpressionStatement = ts.factory.createExpressionStatement( - createFunction(ts.factory.createIdentifier(getName(node)), - ts.factory.createIdentifier(COMPONENT_DEBUGLINE_FUNCTION), - ts.factory.createNodeArray([ts.factory.createStringLiteral(debugInfo)]))); - newStatements.push(debugNode); - } - if (index + 1 < arr.length && ts.isBlock(arr[index + 1])) { - if (res.isButton) { - if (projectConfig.isPreview) { - newStatements.splice(-2, 1, createComponent(node, COMPONENT_CREATE_CHILD_FUNCTION).newNode); - } else { - newStatements.splice(-1, 1, createComponent(node, COMPONENT_CREATE_CHILD_FUNCTION).newNode); - } - } - if (index + 2 < arr.length && ts.isExpressionStatement(arr[index + 2]) && - isAttributeNode(arr[index + 2] as ts.ExpressionStatement)) { - bindComponentAttr(arr[index + 2] as ts.ExpressionStatement, res.identifierNode, newStatements, log); - } - processComponentChild(arr[index + 1] as ts.Block, newStatements, log); - } else { - bindComponentAttr(node, res.identifierNode, newStatements, log); - } - if (res.isContainerComponent || res.needPop) { - newStatements.push(createComponent(node, COMPONENT_POP_FUNCTION).newNode); - } -} - -function getRealNodePos(node: ts.Node): number { - // @ts-ignore - if (node.pos === -1 && node.expression) { - // @ts-ignore - return getRealNodePos(node.expression); - } else { - return node.getStart(); - } -} - -function processForEachComponent(node: ts.ExpressionStatement, newStatements: ts.Statement[], - log: LogInfo[]): void { - const popNode: ts.ExpressionStatement = ts.factory.createExpressionStatement(createFunction( - // @ts-ignore - node.expression.expression as ts.Identifier, - ts.factory.createIdentifier(COMPONENT_POP_FUNCTION), null)); - if (ts.isCallExpression(node.expression)) { - const propertyNode: ts.PropertyAccessExpression = ts.factory.createPropertyAccessExpression( - node.expression.expression as ts.Identifier, - ts.factory.createIdentifier(COMPONENT_CREATE_FUNCTION) - ); - const argumentsArray: ts.Expression[] = Array.from(node.expression.arguments); - let arrayObserveredObject: ts.CallExpression; - if (argumentsArray.length) { - arrayObserveredObject = ts.factory.createCallExpression( - ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier(FOREACH_OBSERVED_OBJECT), - ts.factory.createIdentifier(FOREACH_GET_RAW_OBJECT)), undefined, [argumentsArray[0]]); - } - argumentsArray.splice(0, 1, arrayObserveredObject); - const newArrowNode: ts.ArrowFunction = processForEachBlock(node.expression, log); - if (newArrowNode) { - argumentsArray.splice(1, 1, newArrowNode); - } - node = addForEachId(ts.factory.updateExpressionStatement(node, ts.factory.updateCallExpression( - node.expression, propertyNode, node.expression.typeArguments, argumentsArray))); - } - newStatements.push(node, popNode); -} - -function addForEachId(node: ts.ExpressionStatement): ts.ExpressionStatement { - const forEachComponent: ts.CallExpression = node.expression as ts.CallExpression; - return ts.factory.updateExpressionStatement(node, ts.factory.updateCallExpression( - forEachComponent, forEachComponent.expression, forEachComponent.typeArguments, - [ts.factory.createStringLiteral((++componentInfo.id).toString()), ts.factory.createThis(), - ...forEachComponent.arguments])); -} - -function processForEachBlock(node: ts.CallExpression, log: LogInfo[]): ts.ArrowFunction { - if (node.arguments.length > 1 && ts.isArrowFunction(node.arguments[1])) { - const isLazy: boolean = node.expression.getText() === COMPONENT_LAZYFOREACH; - const arrowNode: ts.ArrowFunction = node.arguments[1] as ts.ArrowFunction; - const body: ts.ConciseBody = arrowNode.body; - if (node.arguments.length > 2 && !ts.isArrowFunction(node.arguments[2])) { - log.push({ - type: LogType.ERROR, - message: 'There should be wrapped in curly braces in ForEach.', - pos: body.getStart() - }); - } else if (!ts.isBlock(body)) { - const statement: ts.Statement = ts.factory.createExpressionStatement(body); - const blockNode: ts.Block = ts.factory.createBlock([statement], true); - // @ts-ignore - statement.parent = blockNode; - return ts.factory.updateArrowFunction( - arrowNode, arrowNode.modifiers, arrowNode.typeParameters, arrowNode.parameters, - arrowNode.type, arrowNode.equalsGreaterThanToken, processComponentBlock(blockNode, isLazy, log)); - } else { - return ts.factory.updateArrowFunction( - arrowNode, arrowNode.modifiers, arrowNode.typeParameters, arrowNode.parameters, - arrowNode.type, arrowNode.equalsGreaterThanToken, processComponentBlock(body, isLazy, log)); - } - } - return null; -} - -function createRenderingInProgress(isTrue: boolean): ts.ExpressionStatement { - return ts.factory.createExpressionStatement(ts.factory.createBinaryExpression( - ts.factory.createPropertyAccessExpression( - ts.factory.createThis(), - ts.factory.createIdentifier(IS_RENDERING_IN_PROGRESS) - ), - ts.factory.createToken(ts.SyntaxKind.EqualsToken), - isTrue ? ts.factory.createTrue() : ts.factory.createFalse() - )); -} - -function processIfStatement(node: ts.IfStatement, newStatements: ts.Statement[], - log: LogInfo[]): void { - const ifCreate: ts.ExpressionStatement = createIfCreate(); - const newIfNode: ts.IfStatement = processInnerIfStatement(node, 0, log); - const ifPop: ts.ExpressionStatement = createIfPop(); - newStatements.push(ifCreate, newIfNode, ifPop); -} - -function processInnerIfStatement(node: ts.IfStatement, id: number, log: LogInfo[]): ts.IfStatement { - if (ts.isIdentifier(node.expression) && node.expression.originalKeywordKind === undefined && - !node.expression.escapedText) { - log.push({ - type: LogType.ERROR, - message: 'Condition expression cannot be null in if statement.', - pos: node.expression.getStart() - }); - node = ts.factory.updateIfStatement(node, ts.factory.createIdentifier(COMPONENT_IF_UNDEFINED), - node.thenStatement, node.elseStatement); - } - const newThenStatement: ts.Statement = processThenStatement(node.thenStatement, id, log); - const newElseStatement: ts.Statement = processElseStatement(node.elseStatement, id, log); - const newIfNode: ts.IfStatement = ts.factory.updateIfStatement( - node, node.expression, newThenStatement, newElseStatement); - return newIfNode; -} - -function processThenStatement(thenStatement: ts.Statement, id: number, - log: LogInfo[]): ts.Statement { - if (ts.isExpressionStatement(thenStatement) && ts.isIdentifier(thenStatement.expression) && - thenStatement.expression.originalKeywordKind === undefined && - !thenStatement.expression.escapedText) { - log.push({ - type: LogType.ERROR, - message: 'Then statement cannot be null in if statement.', - pos: thenStatement.expression.getStart() - }); - } - if (thenStatement) { - if (ts.isBlock(thenStatement)) { - thenStatement = processIfBlock(thenStatement, id, log); - } else if (ts.isIfStatement(thenStatement)) { - thenStatement = processInnerIfStatement(thenStatement, 0, log); - thenStatement = ts.factory.createBlock( - [createIfCreate(), createIfBranchId(id), thenStatement, createIfPop()], true); - } else { - thenStatement = ts.factory.createBlock([thenStatement], true); - thenStatement = processIfBlock(thenStatement as ts.Block, id, log); - } - } - return thenStatement; -} - -function processElseStatement(elseStatement: ts.Statement, id: number, - log: LogInfo[]): ts.Statement { - if (elseStatement) { - if (ts.isBlock(elseStatement)) { - elseStatement = processIfBlock(elseStatement, id + 1, log); - } else if (ts.isIfStatement(elseStatement)) { - elseStatement = processInnerIfStatement(elseStatement, id + 1, log); - } else { - elseStatement = ts.factory.createBlock([elseStatement], true); - elseStatement = processIfBlock(elseStatement as ts.Block, id + 1, log); - } - } - return elseStatement; -} - -function processIfBlock(block: ts.Block, id: number, log: LogInfo[]): ts.Block { - return addIfBranchId(id, processComponentBlock(block, false, log)); -} - -function addIfBranchId(id: number, container: ts.Block): ts.Block { - return ts.factory.updateBlock(container, [createIfBranchId(id), ...container.statements]); -} - -function createIf(): ts.Identifier { - return ts.factory.createIdentifier(COMPONENT_IF); -} - -function createIfCreate(): ts.ExpressionStatement { - return ts.factory.createExpressionStatement(createFunction(createIf(), - ts.factory.createIdentifier(COMPONENT_CREATE_FUNCTION), ts.factory.createNodeArray([]))); -} - -function createIfPop(): ts.ExpressionStatement { - return ts.factory.createExpressionStatement(createFunction(createIf(), - ts.factory.createIdentifier(COMPONENT_POP_FUNCTION), null)); -} - -function createIfBranchId(id: number): ts.ExpressionStatement { - return ts.factory.createExpressionStatement(createFunction(createIf(), - ts.factory.createIdentifier(COMPONENT_IF_BRANCH_ID_FUNCTION), - ts.factory.createNodeArray([ts.factory.createNumericLiteral(id)]))); -} - -interface CreateResult { - newNode: ts.ExpressionStatement; - identifierNode: ts.Identifier; - isContainerComponent: boolean; - isButton: boolean; - needPop: boolean; -} - -function createComponent(node: ts.ExpressionStatement, type: string): CreateResult { - const res: CreateResult = { - newNode: node, - identifierNode: null, - isContainerComponent: false, - isButton: false, - needPop: false - }; - let identifierNode: ts.Identifier = ts.factory.createIdentifier(type); - let temp: any = node.expression; - while (temp && !ts.isIdentifier(temp) && temp.expression) { - temp = temp.expression; - } - if (temp && temp.parent && ts.isCallExpression(temp.parent) && ts.isIdentifier(temp)) { - if (temp.getText() === COMPONENT_BUTTON && type !== COMPONENT_POP_FUNCTION) { - res.isButton = true; - identifierNode = type === COMPONENT_CREATE_CHILD_FUNCTION - ? ts.factory.createIdentifier(COMPONENT_CREATE_CHILD_FUNCTION) - : ts.factory.createIdentifier(COMPONENT_CREATE_LABEL_FUNCTION); - } - if (temp.getText() === COMPONENT_BLANK) { - res.needPop = true; - } - if (BUILDIN_CONTAINER_COMPONENT.has(temp.getText())) { - res.isContainerComponent = true; - } - res.newNode = type === COMPONENT_POP_FUNCTION - ? ts.factory.updateExpressionStatement(node, - createFunction(temp, identifierNode, null)) - : ts.factory.updateExpressionStatement(node, - createFunction(temp, identifierNode, temp.parent.arguments)); - res.identifierNode = temp; - } - return res; -} - -interface AnimationInfo { - statement: ts.Statement, - kind: boolean -} - -export function bindComponentAttr(node: ts.ExpressionStatement, identifierNode: ts.Identifier, - newStatements: ts.Statement[], log: LogInfo[], reverse: boolean = true): void { - let temp: any = node.expression; - const statements: ts.Statement[] = []; - const lastStatement: AnimationInfo = { statement: null, kind: false }; - while (temp && ts.isCallExpression(temp) && temp.expression) { - if (ts.isPropertyAccessExpression(temp.expression) && - temp.expression.name && ts.isIdentifier(temp.expression.name)) { - addComponentAttr(temp, temp.expression.name, lastStatement, statements, identifierNode, log); - temp = temp.expression.expression; - } else if (ts.isIdentifier(temp.expression)) { - if (!INNER_COMPONENT_NAMES.has(temp.expression.getText()) && - !GESTURE_TYPE_NAMES.has(temp.expression.getText())) { - addComponentAttr(temp, temp.expression, lastStatement, statements, identifierNode, log); - } - break; - } - } - if (lastStatement.statement && lastStatement.kind) { - statements.push(lastStatement.statement); - } - if (statements.length) { - reverse ? newStatements.push(...statements.reverse()) : newStatements.push(...statements); - } -} - -function addComponentAttr(temp: any, node: ts.Identifier, lastStatement: any, - statements: ts.Statement[], identifierNode: ts.Identifier, log: LogInfo[]): void { - const propName: string = node.getText(); - if (propName === ATTRIBUTE_ANIMATION) { - if (!lastStatement.statement) { - if (!(temp.arguments.length === 1 && - temp.arguments[0].kind === ts.SyntaxKind.NullKeyword)) { - statements.push(ts.factory.createExpressionStatement(createFunction( - ts.factory.createIdentifier(GLOBAL_CONTEXT), node, - // @ts-ignore - [ts.factory.createNull()]))); - } - } else { - statements.push(lastStatement.statement); - } - lastStatement.statement = ts.factory.createExpressionStatement(createFunction( - ts.factory.createIdentifier(GLOBAL_CONTEXT), node, temp.arguments)); - lastStatement.kind = false; - } else if (GESTURE_ATTRS.has(propName)) { - parseGesture(temp, propName, statements, log); - lastStatement.kind = true; - } else if (isExtendFunctionNode(identifierNode, propName)) { - validateExtendParameterCount(temp, identifierNode, propName, log); - statements.push(ts.factory.createExpressionStatement(ts.factory.createCallExpression( - ts.factory.createIdentifier(`__${identifierNode.escapedText.toString()}__${propName}`), - undefined, temp.arguments))); - lastStatement.kind = true; - } else { - statements.push(ts.factory.createExpressionStatement( - createFunction(identifierNode, node, temp.arguments))); - lastStatement.kind = true; - } -} - -function isExtendFunctionNode(identifierNode: ts.Identifier, propName: string): boolean { - if (identifierNode && EXTEND_ATTRIBUTE.has(identifierNode.escapedText.toString())) { - const attributeArray: string[] = - [...EXTEND_ATTRIBUTE.get(identifierNode.escapedText.toString())].map(item => item.attribute); - if (attributeArray.includes(propName)) { - return true; - } - } - return false; -} - -const gestureMap: Map = new Map([ - [PRIORITY_GESTURE_ATTRIBUTE, GESTURE_ENUM_VALUE_HIGH], - [PARALLEL_GESTURE_ATTRIBUTE, GESTURE_ENUM_VALUE_PARALLEL], - [GESTURE_ATTRIBUTE, GESTURE_ENUM_VALUE_LOW] -]); - -function parseGesture(node: ts.CallExpression, propName: string, statements: ts.Statement[], - log: LogInfo[]): void { - statements.push(ts.factory.createExpressionStatement( - createFunction(ts.factory.createIdentifier(COMPONENT_GESTURE), - ts.factory.createIdentifier(COMPONENT_POP_FUNCTION), null))); - parseGestureInterface(node, statements, log); - const argumentArr: ts.NodeArray = ts.factory.createNodeArray( - [ts.factory.createPropertyAccessExpression( - ts.factory.createIdentifier(GESTURE_ENUM_KEY), - ts.factory.createIdentifier(gestureMap.get(propName))) - ] - ); - if (node.arguments && node.arguments.length > 1 && - ts.isPropertyAccessExpression(node.arguments[1])) { - // @ts-ignore - argumentArr.push(node.arguments[1]); - } - statements.push(ts.factory.createExpressionStatement( - createFunction(ts.factory.createIdentifier(COMPONENT_GESTURE), - ts.factory.createIdentifier(COMPONENT_CREATE_FUNCTION), argumentArr))); -} - -function processGestureType(node: ts.CallExpression, statements: ts.Statement[], log: LogInfo[], - reverse: boolean = false): void { - const newStatements: ts.Statement[] = []; - const newNode: ts.ExpressionStatement = ts.factory.createExpressionStatement(node); - let temp: any = node.expression; - while (temp && !ts.isIdentifier(temp) && temp.expression) { - temp = temp.expression; - } - if (temp && temp.parent && ts.isCallExpression(temp.parent) && ts.isIdentifier(temp) && - GESTURE_TYPE_NAMES.has(temp.escapedText.toString())) { - newStatements.push(ts.factory.createExpressionStatement( - createFunction(temp, ts.factory.createIdentifier(COMPONENT_POP_FUNCTION), null))); - if (temp.escapedText.toString() === COMPONENT_GESTURE_GROUP) { - const gestureStatements: ts.Statement[] = []; - parseGestureInterface(temp.parent, gestureStatements, log, true); - newStatements.push(...gestureStatements.reverse()); - bindComponentAttr(newNode, temp, newStatements, log, false); - let argumentArr: ts.NodeArray = null; - if (temp.parent.arguments && temp.parent.arguments.length) { - // @ts-ignore - argumentArr = ts.factory.createNodeArray([temp.parent.arguments[0]]); - } - newStatements.push(ts.factory.createExpressionStatement( - createFunction(temp, ts.factory.createIdentifier(COMPONENT_CREATE_FUNCTION), argumentArr))); - } else { - bindComponentAttr(newNode, temp, newStatements, log, false); - newStatements.push(ts.factory.createExpressionStatement( - createFunction(temp, ts.factory.createIdentifier(COMPONENT_CREATE_FUNCTION), temp.parent.arguments))); - } - } - if (newStatements.length) { - reverse ? statements.push(...newStatements.reverse()) : statements.push(...newStatements); - } -} - -function parseGestureInterface(node: ts.CallExpression, statements: ts.Statement[], log: LogInfo[], - reverse: boolean = false): void { - if (node.arguments && node.arguments.length) { - node.arguments.forEach((item: ts.Node) => { - if (ts.isCallExpression(item)) { - processGestureType(item, statements, log, reverse); - } - }); - } -} - -export function getName(node: ts.ExpressionStatement): string { - let temp: any = node.expression; - let name: string; - while (temp) { - if (ts.isIdentifier(temp) && temp.parent && ts.isCallExpression(temp.parent)) { - name = temp.escapedText.toString(); - break; - } else if (ts.isPropertyAccessExpression(temp) && temp.name && ts.isIdentifier(temp.name) && - !BUILDIN_STYLE_NAMES.has(temp.name.escapedText.toString())) { - name = temp.name.escapedText.toString(); - break; - } - temp = temp.expression; - } - return name; -} - -export function isAttributeNode(node: ts.ExpressionStatement): boolean { - let temp: any = node.expression; - let name: string; - while (temp) { - if (ts.isCallExpression(temp) && temp.expression && ts.isIdentifier(temp.expression)) { - name = temp.expression.escapedText.toString(); - break; - } - temp = temp.expression; - } - return BUILDIN_STYLE_NAMES.has(name); -} - -function validateFirstNode(node: ts.Statement): boolean { - const isEntryComponent: boolean = - componentCollection.entryComponent === componentCollection.currentClassName; - if ((isEntryComponent && validateEntryComponent(node)) || - (!isEntryComponent && validateCustomComponent(node))) { - return true; - } - return false; -} - -function validateEntryComponent(node: ts.Statement): boolean { - if (ts.isExpressionStatement(node) && BUILDIN_CONTAINER_COMPONENT.has(getName(node))) { - return true; - } - return false; -} - -function validateCustomComponent(node: ts.Statement): boolean { - if (ts.isIfStatement(node) || - (ts.isExpressionStatement(node) && (INNER_COMPONENT_NAMES.has(getName(node)) || - componentCollection.customComponents.has(getName(node))))) { - return true; - } - return false; -} - -function validateBlockNode(node: ts.Statement): boolean { - if (ts.isBlock(node)) { - return true; - } - return false; -} - -function validateSecondNode(node: ts.Statement): boolean { - if (ts.isExpressionStatement(node) && isAttributeNode(node)) { - return true; - } - return false; -} - -enum ComponentType { - innerComponent, - customComponent, - forEachComponent, - customBuilderMethod -} - -function getComponentType(node: ts.ExpressionStatement, log: LogInfo[], - name: string): ComponentType { - if (INNER_COMPONENT_NAMES.has(name)) { - return ComponentType.innerComponent; - } else if (componentCollection.customComponents.has(name)) { - return ComponentType.customComponent; - } else if (name === COMPONENT_FOREACH || name === COMPONENT_LAZYFOREACH) { - appComponentCollection.add(name); - return ComponentType.forEachComponent; - } else if (CUSTOM_BUILDER_METHOD.has(name)) { - return ComponentType.customBuilderMethod; - } else if (!isAttributeNode(node)) { - log.push({ - type: LogType.ERROR, - message: `'${node.getText()}' does not meet UI component syntax.`, - pos: node.getStart() - }); - } - return null; -} - -function validateExtendParameterCount(temp: any, identifierNode: ts.Identifier, propName: string, - log: LogInfo[]): void { - const parameterCount: number = - [...EXTEND_ATTRIBUTE.get(identifierNode.escapedText.toString())].filter(item => - item.attribute === propName)[0].parameterCount; - if (temp.arguments && temp.arguments.length !== parameterCount) { - log.push({ - type: LogType.ERROR, - message: `The '${propName}' is expected ${parameterCount} arguments, but got ${temp.arguments.length}.`, - pos: temp.getStart() - }); - } -} diff --git a/compiler/compiler/src/process_component_class.ts b/compiler/compiler/src/process_component_class.ts deleted file mode 100644 index 735e09c8c..000000000 --- a/compiler/compiler/src/process_component_class.ts +++ /dev/null @@ -1,400 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - -import ts from 'typescript'; - -import { - COMPONENT_BUILD_FUNCTION, - BASE_COMPONENT_NAME, - ATTRIBUTE_ANIMATETO, - GLOBAL_CONTEXT, - CREATE_CONSTRUCTOR_PARAMS, - COMPONENT_CONSTRUCTOR_UPDATE_PARAMS, - COMPONENT_CONSTRUCTOR_DELETE_PARAMS, - CREATE_CONSTRUCTOR_SUBSCRIBER_MANAGER, - ABOUT_TO_BE_DELETE_FUNCTION_ID, - CREATE_CONSTRUCTOR_GET_FUNCTION, - CREATE_CONSTRUCTOR_DELETE_FUNCTION, - FOREACH_OBSERVED_OBJECT, - FOREACH_GET_RAW_OBJECT, - COMPONENT_BUILDER_DECORATOR, - COMPONENT_TRANSITION_FUNCTION, - COMPONENT_CREATE_FUNCTION, - GEOMETRY_VIEW -} from './pre_define'; -import { - BUILDIN_STYLE_NAMES, - CUSTOM_BUILDER_METHOD -} from './component_map'; -import { - componentCollection, - linkCollection -} from './validate_ui_syntax'; -import { - addConstructor, - getInitConstructor -} from './process_component_constructor'; -import { - ControllerType, - processMemberVariableDecorators, - UpdateResult, - stateObjectCollection, - curPropMap -} from './process_component_member'; -import { - processComponentBuild, - processComponentBlock -} from './process_component_build'; -import { - LogType, - LogInfo, - hasDecorator -} from './utils'; - -export function processComponentClass(node: ts.ClassDeclaration, context: ts.TransformationContext, - log: LogInfo[], program: ts.Program): ts.ClassDeclaration { - validateInheritClass(node, log); - const memberNode: ts.ClassElement[] = - processMembers(node.members, node.name, context, log, program); - return ts.factory.updateClassDeclaration(node, undefined, node.modifiers, node.name, - node.typeParameters, updateHeritageClauses(node), memberNode); -} - -type BuildCount = { - count: number; -} - -function processMembers(members: ts.NodeArray, parentComponentName: ts.Identifier, - context: ts.TransformationContext, log: LogInfo[], program: ts.Program): ts.ClassElement[] { - const buildCount: BuildCount = { count: 0 }; - let ctorNode: any = getInitConstructor(members); - const newMembers: ts.ClassElement[] = []; - const watchMap: Map = new Map(); - const updateParamsStatements: ts.Statement[] = []; - const deleteParamsStatements: ts.PropertyDeclaration[] = []; - const checkController: ControllerType = - { hasController: !componentCollection.customDialogs.has(parentComponentName.getText()) }; - members.forEach((item: ts.ClassElement) => { - let updateItem: ts.ClassElement; - if (ts.isPropertyDeclaration(item)) { - const result: UpdateResult = processMemberVariableDecorators(parentComponentName, item, - ctorNode, watchMap, checkController, log, program, context); - if (result.isItemUpdate()) { - updateItem = result.getProperity(); - } else { - updateItem = item; - } - if (result.getVariableGet()) { - newMembers.push(result.getVariableGet()); - } - if (result.getVariableSet()) { - newMembers.push(result.getVariableSet()); - } - if (result.isCtorUpdate()) { - ctorNode = result.getCtor(); - } - if (result.getUpdateParams()) { - updateParamsStatements.push(result.getUpdateParams()); - } - if (result.isDeleteParams()) { - deleteParamsStatements.push(item); - } - if (result.getControllerSet()) { - newMembers.push(result.getControllerSet()); - } - } - if (ts.isMethodDeclaration(item) && item.name) { - updateItem = - processComponentMethod(item, parentComponentName, context, log, buildCount); - } - if (updateItem) { - newMembers.push(updateItem); - } - }); - validateBuildMethodCount(buildCount, parentComponentName, log); - validateHasController(parentComponentName, checkController, log); - newMembers.unshift(addDeleteParamsFunc(deleteParamsStatements)); - newMembers.unshift(addUpdateParamsFunc(updateParamsStatements)); - newMembers.unshift(addConstructor(ctorNode, watchMap)); - return newMembers; -} - -function processComponentMethod(node: ts.MethodDeclaration, parentComponentName: ts.Identifier, - context: ts.TransformationContext, log: LogInfo[], buildCount: BuildCount): ts.MethodDeclaration { - let updateItem: ts.MethodDeclaration = node; - const name: string = node.name.getText(); - if (name === COMPONENT_BUILD_FUNCTION) { - buildCount.count = buildCount.count + 1; - updateItem = processBuildMember(node, context, log); - curPropMap.clear(); - } else if (node.body && ts.isBlock(node.body)) { - if (name === COMPONENT_TRANSITION_FUNCTION) { - updateItem = ts.factory.updateMethodDeclaration(node, node.decorators, node.modifiers, - node.asteriskToken, node.name, node.questionToken, node.typeParameters, node.parameters, - node.type, processComponentBlock(node.body, false, log, true)); - } else if (hasDecorator(node, COMPONENT_BUILDER_DECORATOR)) { - CUSTOM_BUILDER_METHOD.add(name); - updateItem = ts.factory.updateMethodDeclaration(node, undefined, node.modifiers, - node.asteriskToken, node.name, node.questionToken, node.typeParameters, node.parameters, - node.type, processComponentBlock(node.body, false, log)); - } - } - return ts.visitNode(updateItem, visitMethod); - function visitMethod(node: ts.Node): ts.Node { - if (ts.isCallExpression(node) && ts.isIdentifier(node.expression)) { - const name: string = node.expression.escapedText.toString(); - if (name === ATTRIBUTE_ANIMATETO) { - node = processAnimateTo(node); - } - } - return ts.visitEachChild(node, visitMethod, context); - } -} - -function processBuildMember(node: ts.MethodDeclaration, context: ts.TransformationContext, - log: LogInfo[]): ts.MethodDeclaration { - if (node.parameters.length) { - log.push({ - type: LogType.ERROR, - message: `The 'build' method can not have arguments.`, - pos: node.getStart() - }); - } - const buildNode: ts.MethodDeclaration = processComponentBuild(node, log); - return ts.visitNode(buildNode, visitBuild); - function visitBuild(node: ts.Node): ts.Node { - if (isGeometryView(node)) { - node = processGeometryView(node as ts.ExpressionStatement, log); - } - if (isProperty(node)) { - node = createReference(node as ts.PropertyAssignment); - } - if (ts.isPropertyAccessExpression(node) && ts.isIdentifier(node.name) && - stateObjectCollection.has(node.name.escapedText.toString()) && node.parent && - ts.isCallExpression(node.parent) && ts.isPropertyAccessExpression(node.parent.expression) && - node.parent.expression.name.escapedText.toString() !== FOREACH_GET_RAW_OBJECT) { - return ts.factory.createCallExpression(ts.factory.createPropertyAccessExpression( - ts.factory.createIdentifier(FOREACH_OBSERVED_OBJECT), - ts.factory.createIdentifier(FOREACH_GET_RAW_OBJECT)), undefined, [node]); - } - return ts.visitEachChild(node, visitBuild, context); - } -} - -function isGeometryView(node: ts.Node): boolean { - if (ts.isExpressionStatement(node) && ts.isCallExpression(node.expression)) { - const call: ts.CallExpression = node.expression; - const exp: ts.Expression = call.expression; - const args: ts.NodeArray = call.arguments; - if (ts.isPropertyAccessExpression(exp) && ts.isIdentifier(exp.expression) && - exp.expression.escapedText.toString() === GEOMETRY_VIEW && ts.isIdentifier(exp.name) && - exp.name.escapedText.toString() === COMPONENT_CREATE_FUNCTION && args && args.length === 1 && - (ts.isArrowFunction(args[0]) || ts.isFunctionExpression(args[0]))) { - return true; - } - } - return false; -} - -function processGeometryView(node: ts.ExpressionStatement, - log: LogInfo[]): ts.ExpressionStatement { - const exp: ts.CallExpression = node.expression as ts.CallExpression; - const arg: ts.ArrowFunction | ts.FunctionExpression = - exp.arguments[0] as ts.ArrowFunction | ts.FunctionExpression; - return ts.factory.updateExpressionStatement(node, ts.factory.updateCallExpression(exp, - exp.expression, undefined, [ts.factory.createArrowFunction(undefined, undefined, arg.parameters, - undefined, ts.factory.createToken(ts.SyntaxKind.EqualsGreaterThanToken), - getGeometryReaderFunctionBlock(arg, log))])); -} - -function getGeometryReaderFunctionBlock(node: ts.ArrowFunction | ts.FunctionExpression, - log: LogInfo[]): ts.Block { - let blockNode: ts.Block; - if (ts.isBlock(node.body)) { - blockNode = node.body; - } else if (ts.isArrowFunction(node) && ts.isCallExpression(node.body)) { - blockNode = ts.factory.createBlock([ts.factory.createExpressionStatement(node.body)]); - } - return processComponentBlock(blockNode, false, log); -} - -function updateHeritageClauses(node: ts.ClassDeclaration): ts.NodeArray { - const result:ts.HeritageClause[] = []; - const heritageClause:ts.HeritageClause = ts.factory.createHeritageClause( - ts.SyntaxKind.ExtendsKeyword, - [ts.factory.createExpressionWithTypeArguments( - ts.factory.createIdentifier(BASE_COMPONENT_NAME), [])]); - - if (node.heritageClauses) { - result.push(...node.heritageClauses); - } - result.push(heritageClause); - - return ts.factory.createNodeArray(result); -} - -export function isProperty(node: ts.Node): Boolean { - if (node.parent && ts.isObjectLiteralExpression(node.parent) && node.parent.parent && - ts.isCallExpression(node.parent.parent) && ts.isPropertyAssignment(node) && - ts.isIdentifier(node.name)) { - if (ts.isIdentifier(node.parent.parent.expression) && - !BUILDIN_STYLE_NAMES.has(node.parent.parent.expression.escapedText.toString()) && - componentCollection.customComponents.has( - node.parent.parent.expression.escapedText.toString())) { - return true; - } else if (ts.isPropertyAccessExpression(node.parent.parent.expression) && - ts.isIdentifier(node.parent.parent.expression.expression) && - componentCollection.customComponents.has( - node.parent.parent.expression.name.escapedText.toString())) { - return true; - } - } - return false; -} - -export function createReference(node: ts.PropertyAssignment): ts.PropertyAssignment { - const linkParentComponent: string[] = getParentNode(node, linkCollection).slice(1); - const propertyName: ts.Identifier = node.name as ts.Identifier; - let initText: string; - if (linkParentComponent && ts.isPropertyAssignment(node) && ts.isIdentifier(propertyName) && - linkParentComponent.includes(propertyName.escapedText.toString())) { - const LINK_REG: RegExp = /^\$/g; - const initExpression: ts.Expression = node.initializer; - if (ts.isIdentifier(initExpression) && - initExpression.escapedText.toString().match(LINK_REG)) { - if (linkParentComponent.includes(propertyName.escapedText.toString())) { - initText = initExpression.escapedText.toString().replace(LINK_REG, ''); - } - } else if (ts.isPropertyAccessExpression(initExpression) && initExpression.expression && - initExpression.expression.kind === ts.SyntaxKind.ThisKeyword && - ts.isIdentifier(initExpression.name) && - initExpression.name.escapedText.toString().match(LINK_REG)) { - if (linkParentComponent.includes(propertyName.escapedText.toString())) { - initText = initExpression.name.escapedText.toString().replace(LINK_REG, ''); - } - } - if (initText) { - node = addDoubleUnderline(node, propertyName, initText); - } - } - return node; -} - -function addDoubleUnderline(node: ts.PropertyAssignment, propertyName: ts.Identifier, - initText: string): ts.PropertyAssignment { - return ts.factory.updatePropertyAssignment(node, propertyName, - ts.factory.createPropertyAccessExpression(ts.factory.createThis(), - ts.factory.createIdentifier(`__${initText}`))); -} - -function getParentNode(node: ts.PropertyAssignment, collection: Map>): string[] { - const grandparentNode: ts.NewExpression = node.parent.parent as ts.NewExpression; - const grandparentExpression: ts.Identifier | ts.PropertyAccessExpression = - grandparentNode.expression as ts.Identifier | ts.PropertyAccessExpression; - let parentComponent: Set = new Set(); - let grandparentName: string; - if (ts.isIdentifier(grandparentExpression)) { - grandparentName = grandparentExpression.escapedText.toString(); - parentComponent = collection.get(grandparentName); - } else if (ts.isPropertyAccessExpression(grandparentExpression)) { - grandparentName = grandparentExpression.name.escapedText.toString(); - parentComponent = collection.get(grandparentName); - } else { - // ignore - } - if (!parentComponent) { - parentComponent = new Set(); - } - return [grandparentName, ...parentComponent]; -} - -function processAnimateTo(node: ts.CallExpression): ts.CallExpression { - return ts.factory.updateCallExpression(node, ts.factory.createPropertyAccessExpression( - ts.factory.createIdentifier(GLOBAL_CONTEXT), ts.factory.createIdentifier(ATTRIBUTE_ANIMATETO)), - node.typeArguments, node.arguments); -} - -function addUpdateParamsFunc(statements: ts.Statement[]): ts.MethodDeclaration { - return createParamsInitBlock(COMPONENT_CONSTRUCTOR_UPDATE_PARAMS, statements); -} - -function addDeleteParamsFunc(statements: ts.PropertyDeclaration[]): ts.MethodDeclaration { - const deleteStatements: ts.ExpressionStatement[] = []; - statements.forEach((statement: ts.PropertyDeclaration) => { - const name: ts.Identifier = statement.name as ts.Identifier; - const paramsStatement: ts.ExpressionStatement = ts.factory.createExpressionStatement( - ts.factory.createCallExpression(ts.factory.createPropertyAccessExpression( - ts.factory.createPropertyAccessExpression(ts.factory.createThis(), - ts.factory.createIdentifier(`__${name.escapedText.toString()}`)), - ts.factory.createIdentifier(COMPONENT_CONSTRUCTOR_DELETE_PARAMS)), undefined, [])); - deleteStatements.push(paramsStatement); - }); - const defaultStatement: ts.ExpressionStatement = - ts.factory.createExpressionStatement(ts.factory.createCallExpression( - ts.factory.createPropertyAccessExpression( - ts.factory.createCallExpression(ts.factory.createPropertyAccessExpression( - ts.factory.createIdentifier(CREATE_CONSTRUCTOR_SUBSCRIBER_MANAGER), - ts.factory.createIdentifier(CREATE_CONSTRUCTOR_GET_FUNCTION)), undefined, []), - ts.factory.createIdentifier(CREATE_CONSTRUCTOR_DELETE_FUNCTION)), - undefined, [ts.factory.createCallExpression(ts.factory.createPropertyAccessExpression( - ts.factory.createThis(), ts.factory.createIdentifier(ABOUT_TO_BE_DELETE_FUNCTION_ID)), - undefined, [])])); - deleteStatements.push(defaultStatement); - const deleteParamsMethod: ts.MethodDeclaration = - createParamsInitBlock(COMPONENT_CONSTRUCTOR_DELETE_PARAMS, deleteStatements); - return deleteParamsMethod; -} - -function createParamsInitBlock(express: string, statements: ts.Statement[]): ts.MethodDeclaration { - const methodDeclaration: ts.MethodDeclaration = ts.factory.createMethodDeclaration(undefined, - undefined, undefined, ts.factory.createIdentifier(express), undefined, undefined, - [ts.factory.createParameterDeclaration(undefined, undefined, undefined, - express === COMPONENT_CONSTRUCTOR_DELETE_PARAMS ? undefined : - ts.factory.createIdentifier(CREATE_CONSTRUCTOR_PARAMS), undefined, undefined, undefined)], - undefined, ts.factory.createBlock(statements, true)); - return methodDeclaration; -} - -function validateBuildMethodCount(buildCount: BuildCount, parentComponentName: ts.Identifier, - log: LogInfo[]): void { - if (buildCount.count !== 1) { - log.push({ - type: LogType.ERROR, - message: `struct '${parentComponentName.getText()}' must be at least or at most one 'build' method.`, - pos: parentComponentName.getStart() - }); - } -} - -function validateInheritClass(node: ts.ClassDeclaration, log: LogInfo[]): void { - if (node.heritageClauses) { - log.push({ - type: LogType.ERROR, - message: '@Component should not be inherit other Classes.', - pos: node.heritageClauses.pos - }); - } -} - -function validateHasController(componentName: ts.Identifier, checkController: ControllerType, - log: LogInfo[]): void { - if (!checkController.hasController) { - log.push({ - type: LogType.ERROR, - message: '@CustomDialog component should have a property of the CustomDialogController type.', - pos: componentName.pos - }); - } -} diff --git a/compiler/compiler/src/process_component_constructor.ts b/compiler/compiler/src/process_component_constructor.ts deleted file mode 100644 index c963af058..000000000 --- a/compiler/compiler/src/process_component_constructor.ts +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - -import ts from 'typescript'; - -import { - COMPONENT_CONSTRUCTOR_ID, - COMPONENT_CONSTRUCTOR_PARENT, - COMPONENT_CONSTRUCTOR_PARAMS, - COMPONENT_CONSTRUCTOR_UPDATE_PARAMS, - COMPONENT_WATCH_FUNCTION -} from './pre_define'; - -export function getInitConstructor(members: ts.NodeArray): ts.ConstructorDeclaration { - let ctorNode: any = members.find(item => { - return ts.isConstructorDeclaration(item); - }); - if (ctorNode) { - ctorNode = updateConstructor(ctorNode, [], [], true); - } - return ctorNode; -} - -export function updateConstructor(ctorNode: ts.ConstructorDeclaration, - para: ts.ParameterDeclaration[], addStatements: ts.Statement[], - isSuper: boolean = false): ts.ConstructorDeclaration { - let modifyPara: ts.ParameterDeclaration[]; - if (para && para.length) { - modifyPara = Array.from(ctorNode.parameters); - if (modifyPara) { - modifyPara.push(...para); - } - } - let modifyBody: ts.Statement[]; - if (addStatements && addStatements.length && ctorNode) { - modifyBody = Array.from(ctorNode.body.statements); - if (modifyBody) { - if (isSuper) { - modifyBody.unshift(...addStatements); - } else { - modifyBody.push(...addStatements); - } - } - } - if (ctorNode) { - ctorNode = ts.factory.updateConstructorDeclaration(ctorNode, ctorNode.decorators, - ctorNode.modifiers, modifyPara || ctorNode.parameters, - ts.factory.createBlock(modifyBody || ctorNode.body.statements, true)); - } - return ctorNode; -} - -export function addConstructor(ctorNode: any, watchMap: Map) - : ts.ConstructorDeclaration { - const watchStatements: ts.ExpressionStatement[] = []; - watchMap.forEach((value, key) => { - const watchNode: ts.ExpressionStatement = ts.factory.createExpressionStatement( - ts.factory.createCallExpression( - ts.factory.createPropertyAccessExpression( - ts.factory.createThis(), - ts.factory.createIdentifier(COMPONENT_WATCH_FUNCTION) - ), - undefined, - [ - ts.factory.createStringLiteral(key), - ts.isStringLiteral(value) ? - ts.factory.createPropertyAccessExpression(ts.factory.createThis(), - ts.factory.createIdentifier(value.text)) : value as ts.PropertyAccessExpression - ] - )); - watchStatements.push(watchNode); - }); - const callSuperStatement: ts.Statement = ts.factory.createExpressionStatement( - ts.factory.createCallExpression(ts.factory.createSuper(), undefined, - [ts.factory.createIdentifier(COMPONENT_CONSTRUCTOR_ID), - ts.factory.createIdentifier(COMPONENT_CONSTRUCTOR_PARENT)])); - const updateWithValueParamsStatement: ts.Statement = ts.factory.createExpressionStatement( - ts.factory.createCallExpression(ts.factory.createPropertyAccessExpression( - ts.factory.createThis(), ts.factory.createIdentifier(COMPONENT_CONSTRUCTOR_UPDATE_PARAMS)), - undefined, [ts.factory.createIdentifier(COMPONENT_CONSTRUCTOR_PARAMS)])); - return updateConstructor(updateConstructor(ctorNode, [], [callSuperStatement], true), [], - [updateWithValueParamsStatement, ...watchStatements], false); -} diff --git a/compiler/compiler/src/process_component_member.ts b/compiler/compiler/src/process_component_member.ts deleted file mode 100644 index 5a348c2f4..000000000 --- a/compiler/compiler/src/process_component_member.ts +++ /dev/null @@ -1,899 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - -import ts from 'typescript'; - -import { - INNER_COMPONENT_MEMBER_DECORATORS, - COMPONENT_NON_DECORATOR, - COMPONENT_STATE_DECORATOR, - COMPONENT_PROP_DECORATOR, - COMPONENT_LINK_DECORATOR, - COMPONENT_STORAGE_PROP_DECORATOR, - COMPONENT_STORAGE_LINK_DECORATOR, - COMPONENT_PROVIDE_DECORATOR, - COMPONENT_CONSUME_DECORATOR, - COMPONENT_OBJECT_LINK_DECORATOR, - COMPONENT_WATCH_DECORATOR, - COMPONENT_OBSERVED_DECORATOR, - OBSERVED_PROPERTY_SIMPLE, - OBSERVED_PROPERTY_OBJECT, - SYNCHED_PROPERTY_SIMPLE_ONE_WAY, - SYNCHED_PROPERTY_SIMPLE_TWO_WAY, - SYNCHED_PROPERTY_OBJECT_TWO_WAY, - SYNCHED_PROPERTY_NESED_OBJECT, - CREATE_GET_METHOD, - CREATE_SET_METHOD, - CREATE_NEWVALUE_IDENTIFIER, - CREATE_CONSTRUCTOR_PARAMS, - ADD_PROVIDED_VAR, - INITIALIZE_CONSUME_FUNCTION, - APP_STORAGE, - APP_STORAGE_SET_AND_PROP, - APP_STORAGE_SET_AND_LINK, - APP_STORAGE_GET_OR_SET, - COMPONENT_CONSTRUCTOR_UNDEFINED, - SET_CONTROLLER_METHOD, - SET_CONTROLLER_CTR, - SET_CONTROLLER_CTR_TYPE, - JS_DIALOG, - CUSTOM_DIALOG_CONTROLLER_BUILDER, - BASE_COMPONENT_NAME, - COMPONENT_CREATE_FUNCTION -} from './pre_define'; -import { - forbiddenUseStateType, - BUILDIN_STYLE_NAMES -} from './component_map'; -import { - observedClassCollection, - enumCollection, - componentCollection, - classMethodCollection -} from './validate_ui_syntax'; -import { updateConstructor } from './process_component_constructor'; -import { - LogType, - LogInfo, - componentInfo, - createFunction -} from './utils'; -import { - createReference, - isProperty -} from './process_component_class'; - -export type ControllerType = { - hasController: boolean -} - -export const observedPropertyDecorators: Set = - new Set([COMPONENT_STATE_DECORATOR, COMPONENT_PROVIDE_DECORATOR]); - -export const propAndLinkDecorators: Set = - new Set([COMPONENT_PROP_DECORATOR, COMPONENT_LINK_DECORATOR]); - -export const appStorageDecorators: Set = - new Set([COMPONENT_STORAGE_PROP_DECORATOR, COMPONENT_STORAGE_LINK_DECORATOR]); - -export const mandatorySpecifyDefaultValueDecorators: Set = - new Set([...observedPropertyDecorators, ...appStorageDecorators]); - -export const forbiddenSpecifyDefaultValueDecorators: Set = - new Set([...propAndLinkDecorators, COMPONENT_CONSUME_DECORATOR, COMPONENT_OBJECT_LINK_DECORATOR]); - -export const mandatoryToInitViaParamDecorators: Set = - new Set([...propAndLinkDecorators, COMPONENT_OBJECT_LINK_DECORATOR]); - -export const setUpdateParamsDecorators: Set = - new Set([...observedPropertyDecorators, COMPONENT_PROP_DECORATOR, COMPONENT_OBJECT_LINK_DECORATOR]); - -export const immutableDecorators: Set = - new Set([COMPONENT_STORAGE_PROP_DECORATOR, COMPONENT_OBJECT_LINK_DECORATOR]); - -export const simpleTypes: Set = new Set([ts.SyntaxKind.StringKeyword, - ts.SyntaxKind.NumberKeyword, ts.SyntaxKind.BooleanKeyword, ts.SyntaxKind.EnumDeclaration]); - -export const decoratorParamSet: Set = new Set(); - -export const stateObjectCollection: Set = new Set(); - -export class UpdateResult { - private itemUpdate: boolean = false; - private ctorUpdate: boolean = false; - private properity: ts.PropertyDeclaration; - private ctor: ts.ConstructorDeclaration; - private variableGet: ts.GetAccessorDeclaration; - private variableSet: ts.SetAccessorDeclaration; - private updateParams: ts.Statement; - private deleteParams: boolean = false; - private controllerSet: ts.MethodDeclaration; - - public setProperity(updateItem: ts.PropertyDeclaration) { - this.itemUpdate = true; - this.properity = updateItem; - } - - public setCtor(updateCtor: ts.ConstructorDeclaration) { - this.ctorUpdate = true; - this.ctor = updateCtor; - } - - public setControllerSet(updateControllerSet: ts.MethodDeclaration) { - this.controllerSet = updateControllerSet; - } - - public getControllerSet(): ts.MethodDeclaration { - return this.controllerSet; - } - - public setVariableGet(updateVariableGet: ts.GetAccessorDeclaration) { - this.variableGet = updateVariableGet; - } - - public setVariableSet(updateVariableSet: ts.SetAccessorDeclaration) { - this.variableSet = updateVariableSet; - } - - public setUpdateParams(updateParams: ts.Statement) { - this.updateParams = updateParams; - } - - public setDeleteParams(deleteParams: boolean) { - this.deleteParams = deleteParams; - } - - public isItemUpdate(): boolean { - return this.itemUpdate; - } - - public isCtorUpdate(): boolean { - return this.ctorUpdate; - } - - public getProperity(): ts.PropertyDeclaration { - return this.properity; - } - - public getCtor(): ts.ConstructorDeclaration { - return this.ctor; - } - - public getUpdateParams(): ts.Statement { - return this.updateParams; - } - - public getVariableGet(): ts.GetAccessorDeclaration { - return this.variableGet; - } - - public getVariableSet(): ts.SetAccessorDeclaration { - return this.variableSet; - } - - public isDeleteParams(): boolean { - return this.deleteParams; - } -} - -export const curPropMap: Map = new Map(); - -export function processMemberVariableDecorators(parentName: ts.Identifier, - item: ts.PropertyDeclaration, ctorNode: ts.ConstructorDeclaration, watchMap: Map, - checkController: ControllerType, log: LogInfo[], program: ts.Program, - context: ts.TransformationContext): UpdateResult { - const updateResult: UpdateResult = new UpdateResult(); - const name: ts.Identifier = item.name as ts.Identifier; - if (!item.decorators || !item.decorators.length) { - curPropMap.set(name.escapedText.toString(), COMPONENT_NON_DECORATOR); - updateResult.setProperity(undefined); - updateResult.setUpdateParams(createUpdateParams(name, COMPONENT_NON_DECORATOR)); - updateResult.setCtor(updateConstructor(ctorNode, [], [ - createVariableInitStatement(item, COMPONENT_NON_DECORATOR, log, program, context)])); - updateResult.setControllerSet(createControllerSet(item, parentName, name, checkController)); - } else if (!item.type) { - validatePropertyNonType(name, log); - return updateResult; - } else { - processPropertyNodeDecorator(parentName, item, updateResult, ctorNode, name, watchMap, - log, program, context); - } - return updateResult; -} - -function createControllerSet(node: ts.PropertyDeclaration, componentName: ts.Identifier, - name: ts.Identifier, checkController: ControllerType): ts.MethodDeclaration { - if (componentCollection.customDialogs.has(componentName.getText()) && node.type && - node.type.getText() === SET_CONTROLLER_CTR_TYPE) { - checkController.hasController = true; - return ts.factory.createMethodDeclaration(undefined, undefined, undefined, - ts.factory.createIdentifier(SET_CONTROLLER_METHOD), undefined, undefined, - [ts.factory.createParameterDeclaration(undefined, undefined, undefined, - ts.factory.createIdentifier(SET_CONTROLLER_CTR), undefined, - ts.factory.createTypeReferenceNode(ts.factory.createIdentifier(SET_CONTROLLER_CTR_TYPE), - undefined), undefined)], undefined, ts.factory.createBlock( - [ts.factory.createExpressionStatement(ts.factory.createBinaryExpression( - ts.factory.createPropertyAccessExpression(ts.factory.createThis(), name), - ts.factory.createToken(ts.SyntaxKind.EqualsToken), - ts.factory.createIdentifier(SET_CONTROLLER_CTR)))], true)); - } -} - -function processPropertyNodeDecorator(parentName: ts.Identifier, node: ts.PropertyDeclaration, - updateResult: UpdateResult, ctorNode: ts.ConstructorDeclaration, name: ts.Identifier, - watchMap: Map, log: LogInfo[], program: ts.Program, - context: ts.TransformationContext): void { - let stateManagementDecoratorCount: number = 0; - for (let i = 0; i < node.decorators.length; i++) { - const decoratorName: string = node.decorators[i].getText().replace(/\(.*\)$/, '').trim(); - if (decoratorName !== COMPONENT_WATCH_DECORATOR) { - curPropMap.set(name.escapedText.toString(), decoratorName); - } - if (BUILDIN_STYLE_NAMES.has(decoratorName.replace('@', ''))) { - validateDuplicateDecorator(node.decorators[i], log); - } - if (decoratorName !== COMPONENT_WATCH_DECORATOR && isForbiddenUseStateType(node.type)) { - // @ts-ignore - validateForbiddenUseStateType(name, decoratorName, node.type.typeName.getText(), log); - return; - } - if (parentName.getText() === componentCollection.entryComponent && - mandatoryToInitViaParamDecorators.has(decoratorName)) { - validateHasIllegalDecoratorInEntry(parentName, name, decoratorName, log); - } - if (node.initializer && forbiddenSpecifyDefaultValueDecorators.has(decoratorName)) { - validatePropertyDefaultValue(name, decoratorName, log); - return; - } else if (!node.initializer && mandatorySpecifyDefaultValueDecorators.has(decoratorName)) { - validatePropertyNonDefaultValue(name, decoratorName, log); - return; - } - if (node.questionToken && mandatoryToInitViaParamDecorators.has(decoratorName)) { - validateHasIllegalQuestionToken(name, decoratorName, log); - } - if (!isSimpleType(node.type, program)) { - stateObjectCollection.add(name.escapedText.toString()); - } - if (decoratorName === COMPONENT_WATCH_DECORATOR && - validateWatchDecorator(name, node.decorators.length, log)) { - processWatch(node, node.decorators[i], watchMap, log); - } else if (INNER_COMPONENT_MEMBER_DECORATORS.has(decoratorName)) { - stateManagementDecoratorCount += 1; - processStateDecorators(node, decoratorName, updateResult, ctorNode, log, program, context); - } - } - if (stateManagementDecoratorCount > 1) { - validateMultiDecorators(name, log); - return; - } -} - -function processStateDecorators(node: ts.PropertyDeclaration, decorator: string, - updateResult: UpdateResult, ctorNode: ts.ConstructorDeclaration, log: LogInfo[], - program: ts.Program, context: ts.TransformationContext): void { - const name: ts.Identifier = node.name as ts.Identifier; - updateResult.setProperity(undefined); - const updateState: ts.Statement[] = []; - const variableInitStatement: ts.Statement = - createVariableInitStatement(node, decorator, log, program, context); - if (variableInitStatement) { - updateState.push(variableInitStatement); - } - addAddProvidedVar(node, name, decorator, updateState); - updateResult.setCtor(updateConstructor(ctorNode, [], [...updateState], false)); - updateResult.setVariableGet(createGetAccessor(name, CREATE_GET_METHOD)); - if (!immutableDecorators.has(decorator)) { - updateResult.setVariableSet(createSetAccessor(name, CREATE_SET_METHOD)); - } - if (setUpdateParamsDecorators.has(decorator)) { - updateResult.setUpdateParams(createUpdateParams(name, decorator)); - } - updateResult.setDeleteParams(true); -} - -function processWatch(node: ts.PropertyDeclaration, decorator: ts.Decorator, - watchMap: Map, log: LogInfo[]): void { - if (node.name) { - const propertyName: string = node.name.getText(); - if (decorator.expression && ts.isCallExpression(decorator.expression) && - decorator.expression.arguments && decorator.expression.arguments.length === 1) { - const currentClassMethod: Set = classMethodCollection.get(node.parent.name.getText()); - const argument: ts.Node = decorator.expression.arguments[0]; - if (ts.isStringLiteral(argument)) { - if (currentClassMethod.has(argument.text)) { - watchMap.set(propertyName, argument); - } else { - log.push({ - type: LogType.ERROR, - message: `Cannot find name ${argument.getText()} in struct '${node.parent.name.getText()}'.`, - pos: argument.getStart() - }); - } - } else if (ts.isIdentifier(decorator.expression.arguments[0])) { - const content: string = decorator.expression.arguments[0].getText(); - const propertyNode: ts.PropertyAccessExpression = createPropertyAccessExpressionWithThis(content); - watchMap.set(propertyName, propertyNode); - decoratorParamSet.add(content); - validateWatchParam(LogType.WARN, argument.getStart(), log); - } else if (ts.isPropertyAccessExpression(decorator.expression.arguments[0])) { - watchMap.set(propertyName, decorator.expression.arguments[0]); - validateWatchParam(LogType.WARN, argument.getStart(), log); - } else { - validateWatchParam(LogType.ERROR, argument.getStart(), log); - } - } - } -} - -function createVariableInitStatement(node: ts.PropertyDeclaration, decorator: string, - log: LogInfo[], program: ts.Program, context: ts.TransformationContext): ts.Statement { - const name: ts.Identifier = node.name as ts.Identifier; - let type: ts.TypeNode; - let updateState: ts.ExpressionStatement; - if (node.type) { - type = node.type; - } - switch (decorator) { - case COMPONENT_NON_DECORATOR: - updateState = updateNormalProperty(node, name, log, context); - break; - case COMPONENT_STATE_DECORATOR: - case COMPONENT_PROVIDE_DECORATOR: - updateState = updateObservedProperty(node, name, type, program); - break; - case COMPONENT_LINK_DECORATOR: - updateState = updateSynchedPropertyTwoWay(name, type, program); - break; - case COMPONENT_PROP_DECORATOR: - updateState = updateSynchedPropertyOneWay(name, type, decorator, log, program); - break; - case COMPONENT_STORAGE_PROP_DECORATOR: - case COMPONENT_STORAGE_LINK_DECORATOR: - const setFuncName: string = decorator === COMPONENT_STORAGE_PROP_DECORATOR ? - APP_STORAGE_SET_AND_PROP : APP_STORAGE_SET_AND_LINK; - updateState = updateStoragePropAndLinkProperty(node, name, setFuncName, log); - break; - case COMPONENT_OBJECT_LINK_DECORATOR: - updateState = updateSynchedPropertyNesedObject(name, type, decorator, log); - break; - case COMPONENT_CONSUME_DECORATOR: - updateState = updateConsumeProperty(node, name); - break; - } - return updateState; -} - -function createUpdateParams(name: ts.Identifier, decorator: string): ts.Statement { - let updateParamsNode: ts.Statement; - switch (decorator) { - case COMPONENT_NON_DECORATOR: - case COMPONENT_STATE_DECORATOR: - case COMPONENT_PROVIDE_DECORATOR: - updateParamsNode = createUpdateParamsWithIf(name); - break; - case COMPONENT_PROP_DECORATOR: - updateParamsNode = createUpdateParamsWithoutIf(name); - break; - case COMPONENT_OBJECT_LINK_DECORATOR: - updateParamsNode = createUpdateParamsWithSet(name); - break; - } - return updateParamsNode; -} - -function createUpdateParamsWithIf(name: ts.Identifier): ts.IfStatement { - return ts.factory.createIfStatement(ts.factory.createBinaryExpression( - ts.factory.createPropertyAccessExpression( - ts.factory.createIdentifier(CREATE_CONSTRUCTOR_PARAMS), - ts.factory.createIdentifier(name.escapedText.toString())), - ts.factory.createToken(ts.SyntaxKind.ExclamationEqualsEqualsToken), - ts.factory.createIdentifier(COMPONENT_CONSTRUCTOR_UNDEFINED)), ts.factory.createBlock([ - createUpdateParamsWithoutIf(name)], true), undefined); -} - -function createUpdateParamsWithoutIf(name: ts.Identifier): ts.ExpressionStatement { - return ts.factory.createExpressionStatement(ts.factory.createBinaryExpression( - createPropertyAccessExpressionWithThis(name.getText()), - ts.factory.createToken(ts.SyntaxKind.EqualsToken), - createPropertyAccessExpressionWithParams(name.getText()))); -} - -function createUpdateParamsWithSet(name: ts.Identifier): ts.ExpressionStatement { - return ts.factory.createExpressionStatement(ts.factory.createCallExpression( - ts.factory.createPropertyAccessExpression(createPropertyAccessExpressionWithThis(`__${name.getText()}`), - ts.factory.createIdentifier(CREATE_SET_METHOD)), undefined, - [createPropertyAccessExpressionWithParams(name.getText())])); -} - -function updateNormalProperty(node: ts.PropertyDeclaration, name: ts.Identifier, - log: LogInfo[], context: ts.TransformationContext): ts.ExpressionStatement { - const init: ts.Expression = - ts.visitNode(processCustomDialogController(node, log), visitDialogController); - function visitDialogController(node: ts.Node): ts.Node { - if (isProperty(node)) { - node = createReference(node as ts.PropertyAssignment); - } - return ts.visitEachChild(node, visitDialogController, context); - } - return ts.factory.createExpressionStatement(ts.factory.createBinaryExpression( - createPropertyAccessExpressionWithThis(name.getText()), - ts.factory.createToken(ts.SyntaxKind.EqualsToken), init || - ts.factory.createIdentifier(COMPONENT_CONSTRUCTOR_UNDEFINED))); -} - -function processCustomDialogController(node: ts.PropertyDeclaration, - log: LogInfo[]): ts.Expression { - if (node.initializer && ts.isNewExpression(node.initializer) && - ts.isIdentifier(node.initializer.expression) && - node.initializer.expression.getText() === SET_CONTROLLER_CTR_TYPE) { - return createCustomDialogController(node, node.initializer, log); - } - return node.initializer; -} - -function createCustomDialogController(parent: ts.PropertyDeclaration, node: ts.NewExpression, - log: LogInfo[]): ts.NewExpression { - if (node.arguments && node.arguments.length === 1 && - ts.isObjectLiteralExpression(node.arguments[0]) && node.arguments[0].properties) { - const newproperties: ts.ObjectLiteralElementLike[] = node.arguments[0].properties.map((item) => { - if (isCustomDialogControllerPropertyAssignment(item, log)) { - item = processCustomDialogControllerPropertyAssignment(parent, item as ts.PropertyAssignment); - } - return item; - }); - return ts.factory.createNewExpression(node.expression, node.typeArguments, - [ts.factory.createObjectLiteralExpression(newproperties, true), ts.factory.createThis()]); - } -} - -function isCustomDialogControllerPropertyAssignment(node: ts.ObjectLiteralElementLike, - log: LogInfo[]): boolean { - if (ts.isPropertyAssignment(node) && ts.isIdentifier(node.name) && - node.name.getText() === CUSTOM_DIALOG_CONTROLLER_BUILDER) { - if (ts.isCallExpression(node.initializer) && ts.isIdentifier(node.initializer.expression) && - componentCollection.customDialogs.has(node.initializer.expression.getText())) { - return true; - } else { - validateCustomDialogControllerBuilderInit(node, log); - } - } -} - -function processCustomDialogControllerPropertyAssignment(parent: ts.PropertyDeclaration, - node: ts.PropertyAssignment): ts.PropertyAssignment { - if (ts.isCallExpression(node.initializer)) { - return ts.factory.updatePropertyAssignment(node, node.name, - processCustomDialogControllerBuilder(parent, node.initializer)); - } -} - -function processCustomDialogControllerBuilder(parent: ts.PropertyDeclaration, - node: ts.CallExpression): ts.ArrowFunction { - const newExp: ts.Expression = createCustomComponentNewExpression(node); - const jsDialog: ts.Identifier = ts.factory.createIdentifier(JS_DIALOG); - return createCustomComponentBuilderArrowFunction(parent, jsDialog, newExp); -} - -function updateObservedProperty(item: ts.PropertyDeclaration, name: ts.Identifier, - type: ts.TypeNode, program: ts.Program): ts.ExpressionStatement { - return ts.factory.createExpressionStatement(ts.factory.createBinaryExpression( - createPropertyAccessExpressionWithThis(`__${name.getText()}`), - ts.factory.createToken(ts.SyntaxKind.EqualsToken), ts.factory.createNewExpression( - ts.factory.createIdentifier(isSimpleType(type, program) ? OBSERVED_PROPERTY_SIMPLE : - OBSERVED_PROPERTY_OBJECT), undefined, [item.initializer, ts.factory.createThis(), - ts.factory.createStringLiteral(name.escapedText.toString())]))); -} - -function updateSynchedPropertyTwoWay(nameIdentifier: ts.Identifier, type: ts.TypeNode, - program: ts.Program): ts.ExpressionStatement { - const name: string = nameIdentifier.escapedText.toString(); - const functionName: string = isSimpleType(type, program) ? - SYNCHED_PROPERTY_SIMPLE_TWO_WAY : SYNCHED_PROPERTY_OBJECT_TWO_WAY; - return createInitExpressionStatementForDecorator(name, functionName, - createPropertyAccessExpressionWithParams(name)); -} - -function updateSynchedPropertyOneWay(nameIdentifier: ts.Identifier, type: ts.TypeNode, - decoractor: string, log: LogInfo[], program: ts.Program): ts.ExpressionStatement { - const name: string = nameIdentifier.escapedText.toString(); - if (isSimpleType(type, program)) { - return createInitExpressionStatementForDecorator(name, SYNCHED_PROPERTY_SIMPLE_ONE_WAY, - createPropertyAccessExpressionWithParams(name)); - } else { - validateNonSimpleType(nameIdentifier, decoractor, log); - } -} - -function updateStoragePropAndLinkProperty(node: ts.PropertyDeclaration, name: ts.Identifier, - setFuncName: string, log: LogInfo[]): ts.ExpressionStatement { - if (isSingleKey(node)) { - const key: string = getDecoratorKey(node); - return ts.factory.createExpressionStatement(ts.factory.createBinaryExpression( - createPropertyAccessExpressionWithThis(`__${name.getText()}`), - ts.factory.createToken(ts.SyntaxKind.EqualsToken), ts.factory.createCallExpression( - ts.factory.createPropertyAccessExpression(ts.factory.createCallExpression( - ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier(APP_STORAGE), - ts.factory.createIdentifier(APP_STORAGE_GET_OR_SET)), undefined, []), - ts.factory.createIdentifier(setFuncName)), undefined, [ts.factory.createStringLiteral(key), - node.initializer, ts.factory.createThis()]))); - } else { - validateAppStorageDecoractorsNonSingleKey(node, log); - } -} - -function getDecoratorKey(node: ts.PropertyDeclaration): string { - let key: string; - // @ts-ignore - const keyNameNode: ts.Node = node.decorators[0].expression.arguments[0]; - if (ts.isIdentifier(keyNameNode)) { - key = keyNameNode.getText(); - decoratorParamSet.add(key); - } else if (ts.isStringLiteral(keyNameNode)) { - key = keyNameNode.text; - } - return key; -} - -function updateSynchedPropertyNesedObject(nameIdentifier: ts.Identifier, - type: ts.TypeNode, decoractor: string, log: LogInfo[]): ts.ExpressionStatement { - if (isObservedClassType(type)) { - return createInitExpressionStatementForDecorator(nameIdentifier.getText(), SYNCHED_PROPERTY_NESED_OBJECT, - createPropertyAccessExpressionWithParams(nameIdentifier.getText())); - } else { - validateNonObservedClassType(nameIdentifier, decoractor, log); - } -} - -function updateConsumeProperty(node: ts.PropertyDeclaration, - nameIdentifier: ts.Identifier): ts.ExpressionStatement { - const name: string = nameIdentifier.getText(); - let propertyOrAliasName: string; - if (isSingleKey(node)) { - propertyOrAliasName = getDecoratorKey(node); - } else { - propertyOrAliasName = name; - } - return ts.factory.createExpressionStatement(ts.factory.createBinaryExpression( - createPropertyAccessExpressionWithThis(`__${name}`), - ts.factory.createToken(ts.SyntaxKind.EqualsToken), ts.factory.createCallExpression( - createPropertyAccessExpressionWithThis(INITIALIZE_CONSUME_FUNCTION), undefined, [ - ts.factory.createStringLiteral(propertyOrAliasName), ts.factory.createStringLiteral(name)]))); -} - -function createCustomComponentBuilderArrowFunction(parent: ts.PropertyDeclaration, - jsDialog: ts.Identifier, newExp: ts.Expression): ts.ArrowFunction { - return ts.factory.createArrowFunction(undefined, undefined, [], undefined, - ts.factory.createToken(ts.SyntaxKind.EqualsGreaterThanToken), ts.factory.createBlock([ - ts.factory.createVariableStatement(undefined, ts.factory.createVariableDeclarationList( - [ts.factory.createVariableDeclaration(jsDialog, undefined, undefined, newExp)], - ts.NodeFlags.Let)), ts.factory.createExpressionStatement(ts.factory.createCallExpression( - ts.factory.createPropertyAccessExpression(jsDialog, - ts.factory.createIdentifier(SET_CONTROLLER_METHOD)), undefined, - [ts.factory.createPropertyAccessExpression(ts.factory.createThis(), - parent.name as ts.Identifier)])), ts.factory.createExpressionStatement( - createViewCreate(jsDialog))], true)); -} - -export function createViewCreate(node: ts.NewExpression | ts.Identifier): ts.CallExpression { - return createFunction(ts.factory.createIdentifier(BASE_COMPONENT_NAME), - ts.factory.createIdentifier(COMPONENT_CREATE_FUNCTION), ts.factory.createNodeArray([node])); -} - -export function createCustomComponentNewExpression(node: ts.CallExpression): ts.NewExpression { - const newNode: ts.NewExpression = ts.factory.createNewExpression(node.expression, - node.typeArguments, node.arguments.length ? node.arguments : []); - return addCustomComponentId(newNode); -} - -function addCustomComponentId(node: ts.NewExpression): ts.NewExpression { - for (const item of componentCollection.customComponents) { - componentInfo.componentNames.add(item); - } - componentInfo.componentNames.forEach((name: string) => { - const nodeIdentifier: ts.Identifier | ts.PropertyAccessExpression = - node.expression as ts.Identifier | ts.PropertyAccessExpression; - let argumentsArray: ts.Expression[]; - if (node.arguments && node.arguments.length) { - argumentsArray = Array.from(node.arguments); - } - if (nodeIdentifier && (ts.isIdentifier(nodeIdentifier) && - nodeIdentifier.escapedText === name || ts.isPropertyAccessExpression(nodeIdentifier) && - ts.isIdentifier(nodeIdentifier.name) && nodeIdentifier.name.escapedText === name)) { - if (!argumentsArray) { - argumentsArray = [ts.factory.createObjectLiteralExpression([], true)]; - } - argumentsArray.unshift(ts.factory.createStringLiteral((++componentInfo.id).toString()), - ts.factory.createThis()); - node = - ts.factory.updateNewExpression(node, node.expression, node.typeArguments, argumentsArray); - } else if (argumentsArray) { - node = - ts.factory.updateNewExpression(node, node.expression, node.typeArguments, argumentsArray); - } - }); - return node; -} - -function createInitExpressionStatementForDecorator(propertyName: string, functionName: string, - parameterNode: ts.Expression): ts.ExpressionStatement { - return ts.factory.createExpressionStatement(ts.factory.createBinaryExpression( - createPropertyAccessExpressionWithThis(`__${propertyName}`), - ts.factory.createToken(ts.SyntaxKind.EqualsToken), ts.factory.createNewExpression( - ts.factory.createIdentifier(functionName), undefined, [parameterNode, ts.factory.createThis(), - ts.factory.createStringLiteral(propertyName)]))); -} - -function createPropertyAccessExpressionWithParams(propertyName: string): ts.PropertyAccessExpression { - return ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier(CREATE_CONSTRUCTOR_PARAMS), - ts.factory.createIdentifier(propertyName)); -} - -function createPropertyAccessExpressionWithThis(propertyName: string): ts.PropertyAccessExpression { - return ts.factory.createPropertyAccessExpression(ts.factory.createThis(), - ts.factory.createIdentifier(propertyName)); -} - -function addAddProvidedVar(node: ts.PropertyDeclaration, name: ts.Identifier, - decoratorName: string, updateState: ts.Statement[]): void { - if (decoratorName === COMPONENT_PROVIDE_DECORATOR) { - if (isSingleKey(node)) { - updateState.push(createAddProvidedVar(getDecoratorKey(node), name)); - } - updateState.push(createAddProvidedVar(name.getText(), name)); - } -} - -function createAddProvidedVar(propertyOrAliasName: string, - name: ts.Identifier): ts.ExpressionStatement { - return ts.factory.createExpressionStatement(ts.factory.createCallExpression( - createPropertyAccessExpressionWithThis(ADD_PROVIDED_VAR), undefined, [ - ts.factory.createStringLiteral(propertyOrAliasName), - createPropertyAccessExpressionWithThis(`__${name.getText()}`)])); -} - -function createGetAccessor(item: ts.Identifier, express: string): ts.GetAccessorDeclaration { - const getAccessorStatement: ts.GetAccessorDeclaration = - ts.factory.createGetAccessorDeclaration(undefined, undefined, item, [], undefined, - ts.factory.createBlock([ts.factory.createReturnStatement( - ts.factory.createCallExpression(ts.factory.createPropertyAccessExpression( - createPropertyAccessExpressionWithThis(`__${item.getText()}`), - ts.factory.createIdentifier(express)), undefined, []))], true)); - return getAccessorStatement; -} - -function createSetAccessor(item: ts.Identifier, express: string): ts.SetAccessorDeclaration { - const setAccessorStatement: ts.SetAccessorDeclaration = - ts.factory.createSetAccessorDeclaration(undefined, undefined, item, - [ts.factory.createParameterDeclaration(undefined, undefined, undefined, - ts.factory.createIdentifier(CREATE_NEWVALUE_IDENTIFIER), undefined, undefined, - undefined)], ts.factory.createBlock([ts.factory.createExpressionStatement( - ts.factory.createCallExpression(ts.factory.createPropertyAccessExpression( - createPropertyAccessExpressionWithThis(`__${item.getText()}`), - ts.factory.createIdentifier(express)), undefined, - [ts.factory.createIdentifier(CREATE_NEWVALUE_IDENTIFIER)]))], true)); - return setAccessorStatement; -} - -function isForbiddenUseStateType(typeNode: ts.TypeNode): boolean { - if (ts.isTypeReferenceNode(typeNode) && ts.isIdentifier(typeNode.typeName) && - forbiddenUseStateType.has(typeNode.typeName.getText())) { - return true; - } - return false; -} - -function isSimpleType(typeNode: ts.TypeNode, program: ts.Program): boolean { - let checker: ts.TypeChecker; - if (program) { - checker = program.getTypeChecker(); - } - const enumType: ts.SyntaxKind = getEnumType(typeNode, checker); - if (simpleTypes.has(enumType || typeNode.kind) || isEnumtype(typeNode)) { - return true; - } else if (ts.isUnionTypeNode(typeNode) && typeNode.types) { - const types: ts.NodeArray = typeNode.types; - for (let i = 0; i < types.length; i++) { - const enumType: ts.SyntaxKind = getEnumType(types[i], checker); - if (!simpleTypes.has(enumType || types[i].kind) && !isEnumtype(typeNode)) { - return false; - } - } - return true; - } - return false; -} - -function getEnumType(typeNode: ts.TypeNode, checker: ts.TypeChecker): ts.SyntaxKind { - if (!checker) { - return; - } - if (ts.isTypeReferenceNode(typeNode) && ts.isIdentifier(typeNode.typeName)) { - const type: ts.Type = - checker.getBaseTypeOfLiteralType(checker.getTypeAtLocation(typeNode.typeName)); - if (type.symbol && type.symbol.valueDeclaration) { - return type.symbol.valueDeclaration.kind; - } - } -} - -function isEnumtype(typeNode: ts.TypeNode): boolean { - if (ts.isTypeReferenceNode(typeNode) && ts.isIdentifier(typeNode.typeName)) { - return enumCollection.has(typeNode.typeName.getText()); - } -} - -function isObservedClassType(type: ts.TypeNode): boolean { - if (ts.isTypeReferenceNode(type) && observedClassCollection.has(type.getText())) { - return true; - } else if (ts.isUnionTypeNode(type) && type.types) { - const types: ts.NodeArray = type.types; - for (let i = 0; i < types.length; i++) { - if (!observedClassCollection.has(types[i].getText())) { - return false; - } - } - return true; - } - return false; -} - -function validateAppStorageDecoractorsNonSingleKey(node: ts.PropertyDeclaration, - log: LogInfo[]): void { - if (ts.isIdentifier(node.decorators[0].expression)) { - validateDecoratorNonSingleKey(node.decorators[0].expression, log); - } else if (ts.isCallExpression(node.decorators[0].expression) && - ts.isIdentifier(node.decorators[0].expression.expression)) { - validateDecoratorNonSingleKey(node.decorators[0].expression.expression, log); - } -} - -function isSingleKey(node: ts.PropertyDeclaration): boolean { - if (ts.isCallExpression(node.decorators[0].expression) && - node.decorators[0].expression.arguments && - node.decorators[0].expression.arguments.length === 1 && - (ts.isIdentifier(node.decorators[0].expression.arguments[0]) || - ts.isStringLiteral(node.decorators[0].expression.arguments[0]))) { - return true; - } -} - -function validateMultiDecorators(name: ts.Identifier, log: LogInfo[]): void { - log.push({ - type: LogType.ERROR, - message: `The property '${name.escapedText.toString()}' cannot have mutilate state management decorators.`, - pos: name.getStart() - }); -} - -function validateDecoratorNonSingleKey(decoratorsIdentifier: ts.Identifier, - log: LogInfo[]): void { - log.push({ - type: LogType.ERROR, - message: `The decorator ${decoratorsIdentifier.escapedText.toString()} should have a single key.`, - pos: decoratorsIdentifier.getStart() - }); -} - -function validatePropertyNonDefaultValue(propertyName: ts.Identifier, decorator: string, - log: LogInfo[]): void { - log.push({ - type: LogType.ERROR, - message: `The ${decorator} property '${propertyName.getText()}' must be specified a default value.`, - pos: propertyName.getStart() - }); -} - -function validatePropertyDefaultValue(propertyName: ts.Identifier, decorator: string, - log: LogInfo[]): void { - log.push({ - type: LogType.ERROR, - message: `The ${decorator} property '${propertyName.getText()}' cannot be specified a default value.`, - pos: propertyName.getStart() - }); -} - -function validatePropertyNonType(propertyName: ts.Identifier, log: LogInfo[]): void { - log.push({ - type: LogType.ERROR, - message: `The property '${propertyName.getText()}' must specify a type.`, - pos: propertyName.getStart() - }); -} - -function validateNonSimpleType(propertyName: ts.Identifier, decorator: string, - log: LogInfo[]): void { - log.push({ - type: LogType.ERROR, - message: `The type of the ${decorator} property '${propertyName.getText()}' ` + - `can only be string, number or boolean.`, - pos: propertyName.getStart() - }); -} - -function validateNonObservedClassType(propertyName: ts.Identifier, decorator: string, - log: LogInfo[]): void { - log.push({ - type: LogType.ERROR, - message: `The type of the ${decorator} property '${propertyName.getText()}' can only be ` + - `objects of classes decorated with ${COMPONENT_OBSERVED_DECORATOR} class decorator in ets (not ts).`, - pos: propertyName.getStart() - }); -} - -function validateHasIllegalQuestionToken(propertyName: ts.Identifier, decorator: string, - log: LogInfo[]): void { - log.push({ - type: LogType.WARN, - message: `The ${decorator} property '${propertyName.getText()}' cannot have a question token.`, - pos: propertyName.getStart() - }); -} - -function validateHasIllegalDecoratorInEntry(parentName: ts.Identifier, propertyName: ts.Identifier, - decorator: string, log: LogInfo[]): void { - log.push({ - type: LogType.WARN, - message: `The @Entry component '${parentName.getText()}' cannot have the ` + - `${decorator} property '${propertyName.getText()}'.`, - pos: propertyName.getStart() - }); -} - -function validateForbiddenUseStateType(propertyName: ts.Identifier, decorator: string, type: string, - log: LogInfo[]): void { - log.push({ - type: LogType.ERROR, - message: `The ${decorator} property '${propertyName.getText()}' cannot be a '${type}' object.`, - pos: propertyName.getStart() - }); -} - -function validateDuplicateDecorator(decorator: ts.Decorator, log: LogInfo[]): void { - log.push({ - type: LogType.ERROR, - message: `The decorator '${decorator.getText()}' cannot have the same name as the build-in ` + - `style attribute '${decorator.getText().replace('@', '')}'.`, - pos: decorator.getStart() - }); -} - -function validateWatchDecorator(propertyName: ts.Identifier, length: number, log: LogInfo[]): boolean { - if (length === 1) { - log.push({ - type: LogType.ERROR, - message: `Regular variable '${propertyName.escapedText.toString()}' can not be decorated with @Watch.`, - pos: propertyName.getStart() - }); - return false; - } - return true; -} - -function validateWatchParam(type: LogType, pos: number, log: LogInfo[]): void { - log.push({ - type: type, - message: 'The parameter should be a string.', - pos: pos - }); -} - -function validateCustomDialogControllerBuilderInit(node: ts.ObjectLiteralElementLike, - log: LogInfo[]): void { - log.push({ - type: LogType.ERROR, - message: 'The builder should be initialized with a @CustomDialog Component.', - pos: node.getStart() - }); -} diff --git a/compiler/compiler/src/process_custom_component.ts b/compiler/compiler/src/process_custom_component.ts deleted file mode 100644 index 163e8cbb3..000000000 --- a/compiler/compiler/src/process_custom_component.ts +++ /dev/null @@ -1,393 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - -import ts from 'typescript'; - -import { - COMPONENT_NON_DECORATOR, - COMPONENT_STATE_DECORATOR, - COMPONENT_PROP_DECORATOR, - COMPONENT_LINK_DECORATOR, - COMPONENT_STORAGE_LINK_DECORATOR, - COMPONENT_PROVIDE_DECORATOR, - COMPONENT_OBJECT_LINK_DECORATOR, - COMPONENT_CREATE_FUNCTION, - BASE_COMPONENT_NAME, - CUSTOM_COMPONENT_EARLIER_CREATE_CHILD, - COMPONENT_CONSTRUCTOR_UPDATE_PARAMS, - CUSTOM_COMPONENT_FUNCTION_FIND_CHILD_BY_ID, - COMPONENT_CONSTRUCTOR_UNDEFINED, - CUSTOM_COMPONENT_NEEDS_UPDATE_FUNCTION, - CUSTOM_COMPONENT_MARK_STATIC_FUNCTION -} from './pre_define'; -import { - propertyCollection, - stateCollection, - linkCollection, - propCollection, - regularCollection, - storagePropCollection, - storageLinkCollection, - provideCollection, - consumeCollection, - objectLinkCollection, - isStaticViewCollection -} from './validate_ui_syntax'; -import { - propAndLinkDecorators, - curPropMap, - observedPropertyDecorators, - createViewCreate, - createCustomComponentNewExpression -} from './process_component_member'; -import { - LogType, - LogInfo, - componentInfo -} from './utils'; - -const localArray: string[] = [...observedPropertyDecorators, COMPONENT_NON_DECORATOR, - COMPONENT_PROP_DECORATOR, COMPONENT_OBJECT_LINK_DECORATOR]; - -const decoractorMap: Map>> = new Map( - [[COMPONENT_STATE_DECORATOR, stateCollection], - [COMPONENT_LINK_DECORATOR, linkCollection], - [COMPONENT_PROP_DECORATOR, propCollection], - [COMPONENT_NON_DECORATOR, regularCollection], - [COMPONENT_PROVIDE_DECORATOR, provideCollection], - [COMPONENT_OBJECT_LINK_DECORATOR, objectLinkCollection]]); - -export function processCustomComponent(node: ts.ExpressionStatement, newStatements: ts.Statement[], - log: LogInfo[]): void { - if (ts.isCallExpression(node.expression)) { - addCustomComponent(node, newStatements, createCustomComponentNewExpression(node.expression), log); - } -} - -function addCustomComponent(node: ts.ExpressionStatement, newStatements: ts.Statement[], - newNode: ts.NewExpression, log: LogInfo[]): void { - if (ts.isNewExpression(newNode)) { - const customComponentName: string = getCustomComponentName(newNode); - const propertyArray: ts.ObjectLiteralElementLike[] = []; - validateCustomComponentPrams(node, customComponentName, propertyArray, log); - addCustomComponentStatements(node, newStatements, newNode, customComponentName, propertyArray); - } -} - -function addCustomComponentStatements(node: ts.ExpressionStatement, newStatements: ts.Statement[], - newNode: ts.NewExpression, name: string, props: ts.ObjectLiteralElementLike[]): void { - const id: string = componentInfo.id.toString(); - newStatements.push(createFindChildById(id), createCustomComponentIfStatement(id, - ts.factory.updateExpressionStatement(node, createViewCreate(newNode)), - ts.factory.createObjectLiteralExpression(props, true), name)); -} - -function validateCustomComponentPrams(node: ts.ExpressionStatement, name: string, - props: ts.ObjectLiteralElementLike[], log: LogInfo[]): void { - const curChildProps: Set = new Set([]); - const nodeExpression: ts.CallExpression = node.expression as ts.CallExpression; - const nodeArguments: ts.NodeArray = nodeExpression.arguments; - const propertySet: Set = getCollectionSet(name, propertyCollection); - const linkSet: Set = getCollectionSet(name, linkCollection); - if (nodeArguments && nodeArguments.length === 1 && - ts.isObjectLiteralExpression(nodeArguments[0])) { - const nodeArgument: ts.ObjectLiteralExpression = nodeArguments[0] as ts.ObjectLiteralExpression; - nodeArgument.properties.forEach(item => { - curChildProps.add(item.name.getText()); - if (isThisProperty(item, propertySet)) { - validateStateManagement(item, name, log); - if (isNonThisProperty(item, linkSet)) { - props.push(item); - } - } else { - validateNonExistentProperty(item, name, log); - } - }); - } - validateMandatoryToInitViaParam(node, name, curChildProps, log); -} - -function getCustomComponentName(newNode: ts.NewExpression): string { - let customComponentName: string; - if (ts.isIdentifier(newNode.expression)) { - customComponentName = newNode.expression.escapedText.toString(); - } else if (ts.isPropertyAccessExpression(newNode.expression)) { - customComponentName = newNode.expression.name.escapedText.toString(); - } - return customComponentName; -} - -function getCollectionSet(name: string, collection: Map>): Set { - return collection.get(name) || new Set([]); -} - -function isThisProperty(node: ts.ObjectLiteralElementLike, propertySet: Set): boolean { - if (ts.isPropertyAssignment(node) && ts.isIdentifier(node.name) && - propertySet.has(node.name.escapedText.toString())) { - return true; - } - return false; -} - -function isNonThisProperty(node: ts.ObjectLiteralElementLike, propertySet: Set): boolean { - if (ts.isPropertyAssignment(node) && ts.isIdentifier(node.name) && - !propertySet.has(node.name.escapedText.toString())) { - return true; - } - return false; -} - -function validateStateManagement(node: ts.ObjectLiteralElementLike, customComponentName: string, - log: LogInfo[]): void { - validateForbiddenToInitViaParam(node, customComponentName, log); - checkFromParentToChild(node, customComponentName, log); -} - -function checkFromParentToChild(node: ts.ObjectLiteralElementLike, customComponentName: string, - log: LogInfo[]): void { - const propertyName: string = node.name.getText(); - const curPropertyKind: string = getPropertyDecoratorKind(propertyName, customComponentName); - if (curPropertyKind) { - if (isInitFromParent(node)) { - const parentPropertyName: string = - getParentPropertyName(node as ts.PropertyAssignment, curPropertyKind, log); - if (!parentPropertyName) { - return; - } - const parentPropertyKind: string = curPropMap.get(parentPropertyName); - if (parentPropertyKind && !isCorrectInitFormParent(parentPropertyKind, curPropertyKind)) { - validateIllegalInitFromParent( - node, propertyName, curPropertyKind, parentPropertyName, parentPropertyKind, log); - } - } else if (isInitFromLocal(node) && ts.isPropertyAssignment(node)) { - if (!localArray.includes(curPropertyKind)) { - validateIllegalInitFromParent(node, propertyName, curPropertyKind, - node.initializer.getText(), COMPONENT_NON_DECORATOR, log); - } - } - } -} - -function isInitFromParent(node: ts.ObjectLiteralElementLike): boolean { - if (ts.isPropertyAssignment(node) && node.initializer) { - if (ts.isPropertyAccessExpression(node.initializer) && node.initializer.expression && - node.initializer.expression.kind === ts.SyntaxKind.ThisKeyword && - ts.isIdentifier(node.initializer.name)) { - return true; - } else if (ts.isIdentifier(node.initializer) && - matchStartWithDollar(node.initializer.getText())) { - return true; - } - } -} - -function isInitFromLocal(node: ts.ObjectLiteralElementLike): boolean { - if (ts.isPropertyAssignment(node) && ts.isIdentifier(node.initializer) && - !matchStartWithDollar(node.initializer.getText())) { - return true; - } -} - -function getParentPropertyName(node: ts.PropertyAssignment, curPropertyKind: string, - log: LogInfo[]): string { - let parentPropertyName: string; - const initExpression: ts.Expression = node.initializer; - if (curPropertyKind === COMPONENT_LINK_DECORATOR) { - if (hasDollar(initExpression)) { - // @ts-ignore - const initName: ts.Identifier = initExpression.name || initExpression; - parentPropertyName = initName.getText().replace(/^\$/, ''); - } else { - validateLinkWithoutDollar(node, log); - } - } else { - if (hasDollar(initExpression)) { - validateNonLinkWithDollar(node, log); - } else { - // @ts-ignore - parentPropertyName = node.initializer.name.getText(); - } - } - return parentPropertyName; -} - -function isCorrectInitFormParent(parent: string, child: string): boolean { - switch (child) { - case COMPONENT_STATE_DECORATOR: - case COMPONENT_PROVIDE_DECORATOR: - if (parent === COMPONENT_NON_DECORATOR) { - return true; - } - break; - case COMPONENT_LINK_DECORATOR: - if ([COMPONENT_STATE_DECORATOR, COMPONENT_LINK_DECORATOR, - COMPONENT_STORAGE_LINK_DECORATOR].includes(parent)) { - return true; - } - break; - case COMPONENT_PROP_DECORATOR: - if ([COMPONENT_STATE_DECORATOR, ...propAndLinkDecorators].includes(parent)) { - return true; - } - break; - case COMPONENT_NON_DECORATOR: - if ([COMPONENT_STATE_DECORATOR, ...propAndLinkDecorators, COMPONENT_NON_DECORATOR, - COMPONENT_OBJECT_LINK_DECORATOR].includes(parent)) { - return true; - } - break; - case COMPONENT_OBJECT_LINK_DECORATOR: - if (parent === COMPONENT_STATE_DECORATOR) { - return true; - } - break; - } - return false; -} - -function getPropertyDecoratorKind(propertyName: string, customComponentName: string): string { - for (const item of decoractorMap.entries()) { - if (getCollectionSet(customComponentName, item[1]).has(propertyName)) { - return item[0]; - } - } -} - -function createFindChildById(id: string): ts.VariableStatement { - return ts.factory.createVariableStatement(undefined, ts.factory.createVariableDeclarationList( - [ts.factory.createVariableDeclaration(ts.factory.createIdentifier( - `${CUSTOM_COMPONENT_EARLIER_CREATE_CHILD}${id}`), undefined, undefined, - ts.factory.createCallExpression(ts.factory.createPropertyAccessExpression(ts.factory.createThis(), - ts.factory.createIdentifier(`${CUSTOM_COMPONENT_FUNCTION_FIND_CHILD_BY_ID}`)), undefined, - [ts.factory.createStringLiteral(id)]))], ts.NodeFlags.Let)); -} - -function createCustomComponentIfStatement(id: string, node: ts.ExpressionStatement, - newObjectLiteralExpression: ts.ObjectLiteralExpression, parentName: string): ts.IfStatement { - const viewName: string = `${CUSTOM_COMPONENT_EARLIER_CREATE_CHILD}${id}`; - return ts.factory.createIfStatement(ts.factory.createBinaryExpression( - ts.factory.createIdentifier(viewName), - ts.factory.createToken(ts.SyntaxKind.EqualsEqualsToken), - ts.factory.createIdentifier(`${COMPONENT_CONSTRUCTOR_UNDEFINED}`)), - ts.factory.createBlock([node], true), - ts.factory.createBlock([ts.factory.createExpressionStatement(ts.factory.createCallExpression( - ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier( - viewName), ts.factory.createIdentifier( - `${COMPONENT_CONSTRUCTOR_UPDATE_PARAMS}`)), undefined, [newObjectLiteralExpression])), - isStaticViewCollection.get(parentName) ? createStaticIf(viewName) : undefined, - ts.factory.createExpressionStatement(ts.factory.createCallExpression( - ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier(`${BASE_COMPONENT_NAME}`), - ts.factory.createIdentifier(`${COMPONENT_CREATE_FUNCTION}`)), undefined, - [ts.factory.createIdentifier(viewName)]))], true)); -} - -function createStaticIf(name: string): ts.IfStatement { - return ts.factory.createIfStatement(ts.factory.createPrefixUnaryExpression( - ts.SyntaxKind.ExclamationToken, ts.factory.createCallExpression( - ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier(name), - ts.factory.createIdentifier(CUSTOM_COMPONENT_NEEDS_UPDATE_FUNCTION)), undefined, [])), - ts.factory.createBlock([ts.factory.createExpressionStatement(ts.factory.createCallExpression( - ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier(name), - ts.factory.createIdentifier(CUSTOM_COMPONENT_MARK_STATIC_FUNCTION)), - undefined, []))], true), undefined); -} - -function hasDollar(initExpression: ts.Expression): boolean { - if (ts.isPropertyAccessExpression(initExpression) && - matchStartWithDollar(initExpression.name.getText())) { - return true; - } else if (ts.isIdentifier(initExpression) && matchStartWithDollar(initExpression.getText())) { - return true; - } else { - return false; - } -} - -function matchStartWithDollar(name: string): boolean { - return /^\$/.test(name); -} - -function validateForbiddenToInitViaParam(node: ts.ObjectLiteralElementLike, - customComponentName: string, log: LogInfo[]): void { - const forbiddenToInitViaParamSet: Set = new Set([ - ...getCollectionSet(customComponentName, storageLinkCollection), - ...getCollectionSet(customComponentName, storagePropCollection), - ...getCollectionSet(customComponentName, consumeCollection)]); - if (isThisProperty(node, forbiddenToInitViaParamSet)) { - log.push({ - type: LogType.ERROR, - message: `Property '${node.name.getText()}' in the custom component '${customComponentName}'` + - ` cannot initialize here (forbidden to specify).`, - pos: node.name.getStart() - }); - } -} - -function validateNonExistentProperty(node: ts.ObjectLiteralElementLike, - customComponentName: string, log: LogInfo[]): void { - log.push({ - type: LogType.ERROR, - message: `Property '${node.name.getText()}' does not exist on type '${customComponentName}'.`, - pos: node.name.getStart() - }); -} - -function validateMandatoryToInitViaParam(node: ts.ExpressionStatement, customComponentName: string, - curChildProps: Set, log: LogInfo[]): void { - const mandatoryToInitViaParamSet: Set = new Set([ - ...getCollectionSet(customComponentName, propCollection), - ...getCollectionSet(customComponentName, linkCollection), - ...getCollectionSet(customComponentName, objectLinkCollection)]); - mandatoryToInitViaParamSet.forEach(item => { - if (!curChildProps.has(item)) { - log.push({ - type: LogType.ERROR, - message: `Property '${item}' in the custom component '${customComponentName}'` + - ` is missing (mandatory to specify).`, - pos: node.getStart() - }); - } - }); -} - -function validateIllegalInitFromParent(node: ts.ObjectLiteralElementLike, propertyName: string, - curPropertyKind: string, parentPropertyName: string, parentPropertyKind: string, - log: LogInfo[]): void { - log.push({ - type: LogType.ERROR, - message: `The ${parentPropertyKind} property '${parentPropertyName}' cannot be assigned to ` + - `the ${curPropertyKind} property '${propertyName}'.`, - // @ts-ignore - pos: node.initializer.getStart() - }); -} - -function validateLinkWithoutDollar(node: ts.PropertyAssignment, log: LogInfo[]): void { - log.push({ - type: LogType.ERROR, - message: `The @Link property '${node.name.getText()}' should initialize` + - ` using '$' to create a reference to a @State or @Link variable.`, - pos: node.initializer.getStart() - }); -} - -function validateNonLinkWithDollar(node: ts.PropertyAssignment, log: LogInfo[]): void { - log.push({ - type: LogType.ERROR, - message: `Property '${node.name.getText()}' cannot initialize` + - ` using '$' to create a reference to a variable.`, - pos: node.initializer.getStart() - }); -} diff --git a/compiler/compiler/src/process_import.ts b/compiler/compiler/src/process_import.ts deleted file mode 100644 index 1e8e12a43..000000000 --- a/compiler/compiler/src/process_import.ts +++ /dev/null @@ -1,278 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - -import ts from 'typescript'; -import fs from 'fs'; -import path from 'path'; - -import { - EXTNAME_ETS, - NODE_MODULES, - INDEX_ETS, - PACKAGE_JSON, - STRUCT, - CLASS, - CUSTOM_COMPONENT_DEFAULT, - CUSTOM_DECORATOR_NAME -} from './pre_define'; -import { - propertyCollection, - linkCollection, - componentCollection, - preprocessExtend, - processSystemApi, - propCollection, - isObservedClass, - isCustomDialogClass, - observedClassCollection, - enumCollection, - getComponentSet, - IComponentSet -} from './validate_ui_syntax'; -import { LogInfo } from './utils'; -import { projectConfig } from '../main'; - -export default function processImport(node: ts.ImportDeclaration | ts.ImportEqualsDeclaration | - ts.ExportDeclaration, pagesDir: string, log: LogInfo[]): void { - let filePath: string; - let defaultName: string; - const asName: Map = new Map(); - if (ts.isImportDeclaration(node) || ts.isExportDeclaration(node)) { - filePath = node.moduleSpecifier.getText().replace(/'|"/g, ''); - if (ts.isImportDeclaration(node) && node.importClause && node.importClause.name && - ts.isIdentifier(node.importClause.name)) { - defaultName = node.importClause.name.escapedText.toString(); - } - if (ts.isImportDeclaration(node) && node.importClause && node.importClause.namedBindings && - ts.isNamedImports(node.importClause.namedBindings) && - node.importClause.namedBindings.elements) { - node.importClause.namedBindings.elements.forEach(item => { - if (item.name && item.propertyName && ts.isIdentifier(item.name) && - ts.isIdentifier(item.propertyName)) { - asName.set(item.propertyName.escapedText.toString(), item.name.escapedText.toString()); - } - }); - } - } else { - if (node.moduleReference && ts.isExternalModuleReference(node.moduleReference) && - node.moduleReference.expression && ts.isStringLiteral(node.moduleReference.expression)) { - filePath = node.moduleReference.expression.text; - defaultName = node.name.escapedText.toString(); - } - } - if (filePath && path.extname(filePath) !== EXTNAME_ETS && !isModule(filePath)) { - filePath += EXTNAME_ETS; - } - try { - let fileResolvePath: string; - if (/^(\.|\.\.)\//.test(filePath)) { - fileResolvePath = path.join(pagesDir, filePath); - } else if (/^\//.test(filePath)) { - fileResolvePath = filePath; - } else { - fileResolvePath = getFileResolvePath(fileResolvePath, pagesDir, filePath, projectConfig.projectPath); - } - if (fs.existsSync(fileResolvePath) && fs.statSync(fileResolvePath).isFile()) { - const content: string = preprocessExtend(processSystemApi( - fs.readFileSync(fileResolvePath, { encoding: 'utf-8' }).replace( - new RegExp('\\b' + STRUCT + '\\b.+\\{', 'g'), item => { - return item.replace(new RegExp('\\b' + STRUCT + '\\b', 'g'), `${CLASS} `); - })), fileResolvePath, log); - const sourceFile: ts.SourceFile = ts.createSourceFile(filePath, content, - ts.ScriptTarget.Latest, true, ts.ScriptKind.TS); - visitAllNode(sourceFile, defaultName, asName, pagesDir, log); - } - } catch (e) { - // ignore - } -} - -function visitAllNode(node: ts.Node, defaultNameFromParent: string, asNameFromParent: Map, - pagesDir: string, log: LogInfo[]) { - if (isObservedClass(node)) { - // @ts-ignore - observedClassCollection.add(node.name.getText()); - } - if (isCustomDialogClass(node)) { - // @ts-ignore - componentCollection.customDialogs.add(node.name.getText()); - } - if (ts.isEnumDeclaration(node) && node.name) { - enumCollection.add(node.name.getText()); - } - if (ts.isClassDeclaration(node) && ts.isIdentifier(node.name) && isCustomComponent(node)) { - addDependencies(node, defaultNameFromParent, asNameFromParent); - if (!defaultNameFromParent && node.modifiers && node.modifiers.length >= 2 && - node.modifiers[0] && node.modifiers[0].kind === ts.SyntaxKind.ExportKeyword && - node.modifiers[1] && node.modifiers[1].kind === ts.SyntaxKind.DefaultKeyword && - hasCollection(node.name)) { - addDefaultExport(node); - } - } - if (ts.isExportAssignment(node) && node.expression && ts.isIdentifier(node.expression) && - hasCollection(node.expression)) { - if (defaultNameFromParent) { - setDependencies(defaultNameFromParent, - linkCollection.get(node.expression.escapedText.toString()), - propertyCollection.get(node.expression.escapedText.toString()), - propCollection.get(node.expression.escapedText.toString())); - } - addDefaultExport(node); - } - if (ts.isExportDeclaration(node) && node.exportClause && - ts.isNamedExports(node.exportClause) && node.exportClause.elements) { - node.exportClause.elements.forEach(item => { - if (item.name && item.propertyName && ts.isIdentifier(item.name) && - ts.isIdentifier(item.propertyName) && hasCollection(item.propertyName)) { - let asExportName: string = item.name.escapedText.toString(); - const asExportPropertyName: string = item.propertyName.escapedText.toString(); - if (asNameFromParent.has(asExportName)) { - asExportName = asNameFromParent.get(asExportName); - } - setDependencies(asExportName, linkCollection.get(asExportPropertyName), - propertyCollection.get(asExportPropertyName), - propCollection.get(asExportPropertyName)); - } - }); - } - if (ts.isExportDeclaration(node) && node.moduleSpecifier && - ts.isStringLiteral(node.moduleSpecifier)) { - processImport(node, pagesDir, log); - } - node.getChildren().forEach((item: ts.Node) => visitAllNode(item, defaultNameFromParent, - asNameFromParent, pagesDir, log)); -} - -function addDependencies(node: ts.ClassDeclaration, defaultNameFromParent: string, - asNameFromParent: Map): void { - const componentName: string = node.name.getText(); - const ComponentSet: IComponentSet = getComponentSet(node); - if (defaultNameFromParent && node.modifiers && node.modifiers.length >= 2 && node.modifiers[0] && - node.modifiers[1] && node.modifiers[0].kind === ts.SyntaxKind.ExportKeyword && - node.modifiers[1].kind === ts.SyntaxKind.DefaultKeyword) { - setDependencies(defaultNameFromParent, ComponentSet.links, ComponentSet.propertys, - ComponentSet.props); - } else if (asNameFromParent.has(componentName)) { - setDependencies(asNameFromParent.get(componentName), ComponentSet.links, ComponentSet.propertys, - ComponentSet.props); - } else { - setDependencies(componentName, ComponentSet.links, ComponentSet.propertys, ComponentSet.props); - } -} - -function addDefaultExport(node: ts.ClassDeclaration | ts.ExportAssignment): void { - let name: string; - if (ts.isClassDeclaration(node) && node.name && ts.isIdentifier(node.name)) { - name = node.name.escapedText.toString(); - } else if (ts.isExportAssignment(node) && node.expression && ts.isIdentifier(node.expression)) { - name = node.expression.escapedText.toString(); - } else { - return; - } - setDependencies(CUSTOM_COMPONENT_DEFAULT, - linkCollection.has(CUSTOM_COMPONENT_DEFAULT) ? - new Set([...linkCollection.get(CUSTOM_COMPONENT_DEFAULT), ...linkCollection.get(name)]) : - linkCollection.get(name), propertyCollection.has(CUSTOM_COMPONENT_DEFAULT) ? - new Set([...propertyCollection.get(CUSTOM_COMPONENT_DEFAULT), ...propertyCollection.get(name)]) : - propertyCollection.get(name), propCollection.has(CUSTOM_COMPONENT_DEFAULT) ? - new Set([...propCollection.get(CUSTOM_COMPONENT_DEFAULT), ...propCollection.get(name)]) : - propCollection.get(name)); -} - -function setDependencies(component: string, linkArray: Set, propertyArray: Set, - propArray: Set): void { - linkCollection.set(component, linkArray); - propertyCollection.set(component, propertyArray); - propCollection.set(component, propArray); - componentCollection.customComponents.add(component); -} - -function hasCollection(node: ts.Identifier): boolean { - return linkCollection.has(node.escapedText.toString()) || - propCollection.has(node.escapedText.toString()) || - propertyCollection.has(node.escapedText.toString()); -} - -function isModule(filePath: string): boolean { - return !/^(\.|\.\.)?\//.test(filePath); -} - -function isCustomComponent(node: ts.ClassDeclaration): boolean { - if (node.decorators && node.decorators.length) { - for (let i = 0; i < node.decorators.length; ++i) { - const decoratorName: ts.Identifier = node.decorators[i].expression as ts.Identifier; - if (ts.isIdentifier(decoratorName) && - CUSTOM_DECORATOR_NAME.has(decoratorName.escapedText.toString())) { - return true; - } - } - } - return false; -} - -function isPackageJsonEntry(filePath: string): boolean { - const packageJsonPath: string = path.join(filePath, PACKAGE_JSON); - if (fs.existsSync(packageJsonPath)) { - let entry: string; - try { - entry = JSON.parse(fs.readFileSync(packageJsonPath).toString()).main; - } catch (e) { - return false; - } - if (typeof entry === 'string' && fs.existsSync(path.join(filePath, entry))) { - return true; - } - } -} - -function getPackageJsonEntry(filePath: string): string { - return path.join(filePath, JSON.parse(fs.readFileSync(path.join(filePath, PACKAGE_JSON)).toString()).main); -} - -function getModuleFilePath(filePath: string): string { - if (filePath && path.extname(filePath) !== EXTNAME_ETS && isModule(filePath)) { - filePath += EXTNAME_ETS; - } - return filePath; -} - -function getFileResolvePath(fileResolvePath: string, pagesDir: string, filePath: string, - projectPath: string): string { - const moduleFilePath: string = getModuleFilePath(filePath); - const defaultModule: string = path.join(projectPath, moduleFilePath); - if (fs.existsSync(defaultModule)) { - return defaultModule; - } - const entryModule: string = path.join(projectPath, '../../../../../', moduleFilePath); - if (fs.existsSync(entryModule)) { - return entryModule; - } - let curPageDir: string = pagesDir; - while (!fs.existsSync(fileResolvePath)) { - fileResolvePath = path.join(curPageDir, NODE_MODULES, filePath); - if (fs.existsSync(fileResolvePath + EXTNAME_ETS)) { - fileResolvePath = fileResolvePath + EXTNAME_ETS; - } else if (isPackageJsonEntry(fileResolvePath)) { - fileResolvePath = getPackageJsonEntry(fileResolvePath); - } else if (fs.existsSync(path.join(fileResolvePath, INDEX_ETS))) { - fileResolvePath = path.join(fileResolvePath, INDEX_ETS); - } - if (curPageDir === path.parse(curPageDir).root) { - break; - } - curPageDir = path.dirname(curPageDir); - } - return fileResolvePath; -} diff --git a/compiler/compiler/src/process_system_module.ts b/compiler/compiler/src/process_system_module.ts deleted file mode 100644 index 9ef05d3cc..000000000 --- a/compiler/compiler/src/process_system_module.ts +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - -import { processSystemApi } from './validate_ui_syntax'; - -module.exports = function processSystemModule(source: string): string { - return processSystemApi(source); -}; diff --git a/compiler/compiler/src/process_ui_syntax.ts b/compiler/compiler/src/process_ui_syntax.ts deleted file mode 100644 index d2f0d106d..000000000 --- a/compiler/compiler/src/process_ui_syntax.ts +++ /dev/null @@ -1,410 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - -import ts from 'typescript'; -import path from 'path'; - -import { componentCollection } from './validate_ui_syntax'; -import { processComponentClass } from './process_component_class'; -import processImport from './process_import'; -import { - PAGE_ENTRY_FUNCTION_NAME, - COMPONENT_CONSTRUCTOR_UNDEFINED, - BUILD_ON, - COMPONENT_BUILD_FUNCTION, - COMPONENT_BUILDER_DECORATOR, - COMPONENT_EXTEND_DECORATOR, - RESOURCE, - RESOURCE_TYPE, - WORKER_OBJECT, - RESOURCE_NAME_ID, - RESOURCE_NAME_TYPE, - RESOURCE_NAME_PARAMS, - RESOURCE_RAWFILE -} from './pre_define'; -import { - componentInfo, - LogInfo, - LogType, - hasDecorator, - FileLog -} from './utils'; -import { - getName, - isAttributeNode, - processComponentBlock, - bindComponentAttr, - appComponentCollection -} from './process_component_build'; -import { - BUILDIN_CONTAINER_COMPONENT, - CUSTOM_BUILDER_METHOD, - EXTEND_ATTRIBUTE, - JS_BIND_COMPONENTS -} from './component_map'; -import { resources } from '../main'; - -export const transformLog: FileLog = new FileLog(); - -export function processUISyntax(program: ts.Program, ut = false): Function { - return (context: ts.TransformationContext) => { - let pagesDir: string; - return (node: ts.SourceFile) => { - pagesDir = path.resolve(path.dirname(node.fileName)); - if (process.env.compiler === BUILD_ON) { - if (!ut && (path.basename(node.fileName) === 'app.ets.ts' || !/\.ets\.ts$/.test(node.fileName))) { - node = ts.visitEachChild(node, processResourceNode, context); - return node; - } - collectComponents(node); - transformLog.sourceFile = node; - validateSourceFileNode(node); - node = createEntryNode(node, context); - node = ts.visitEachChild(node, processAllNodes, context); - return node; - } else { - return node; - } - }; - function processAllNodes(node: ts.Node): ts.Node { - if (ts.isImportDeclaration(node) || ts.isImportEqualsDeclaration(node)) { - processImport(node, pagesDir, transformLog.errors); - } else if (ts.isClassDeclaration(node) && node.name && - componentCollection.customComponents.has(node.name.getText())) { - componentCollection.currentClassName = node.name.getText(); - node = processComponentClass(node, context, transformLog.errors, program); - componentCollection.currentClassName = null; - } else if (ts.isFunctionDeclaration(node)) { - if (hasDecorator(node, COMPONENT_EXTEND_DECORATOR)) { - node = processExtend(node, transformLog.errors); - } else if (hasDecorator(node, COMPONENT_BUILDER_DECORATOR) && node.name && node.body && - ts.isBlock(node.body)) { - CUSTOM_BUILDER_METHOD.add(node.name.getText()); - node = ts.factory.updateFunctionDeclaration(node, undefined, node.modifiers, - node.asteriskToken, node.name, node.typeParameters, node.parameters, node.type, - processComponentBlock(node.body, false, transformLog.errors)); - } - } else if (isResource(node)) { - node = processResourceData(node as ts.CallExpression); - } else if (isWorker(node)) { - node = processWorker(node as ts.NewExpression); - } - return ts.visitEachChild(node, processAllNodes, context); - } - function processResourceNode(node: ts.Node): ts.Node { - if (isResource(node)) { - node = processResourceData(node as ts.CallExpression); - } - return ts.visitEachChild(node, processResourceNode, context); - } - function validateSourceFileNode(node: ts.SourceFile): void { - if (program) { - node = ts.visitEachChild(node, validateAllNodes, context); - } - } - function validateAllNodes(node: ts.Node): ts.Node { - if (ts.isMethodDeclaration(node) && node.name && - node.name.getText() === COMPONENT_BUILD_FUNCTION && node.body && ts.isBlock(node.body)) { - const typeChecker: ts.TypeChecker = program.getTypeChecker(); - validateBody(node.body, typeChecker); - return node; - } - return ts.visitEachChild(node, validateAllNodes, context); - } - }; -} - -function collectComponents(node: ts.SourceFile): void { - // @ts-ignore - if (node.identifiers && node.identifiers.size) { - // @ts-ignore - for (let key of node.identifiers.keys()) { - if (JS_BIND_COMPONENTS.has(key)) { - appComponentCollection.add(key); - } - } - } -} - -function isResource(node: ts.Node): boolean { - return ts.isCallExpression(node) && ts.isIdentifier(node.expression) && - (node.expression.escapedText.toString() === RESOURCE || - node.expression.escapedText.toString() === RESOURCE_RAWFILE) && node.arguments.length > 0; -} - -function processResourceData(node: ts.CallExpression): ts.Node { - if (ts.isStringLiteral(node.arguments[0])) { - if (node.expression.getText() === RESOURCE_RAWFILE) { - return createResourceParam(0, RESOURCE_TYPE.rawfile, [node.arguments[0]]); - } else { - // @ts-ignore - const resourceData: string[] = node.arguments[0].text.trim().split('.'); - if (validateResourceData(resourceData, resources, node.arguments[0].getStart())) { - const resourceType: number = RESOURCE_TYPE[resourceData[1]]; - const resourceValue: number = resources[resourceData[0]][resourceData[1]][resourceData[2]]; - return createResourceParam(resourceValue, resourceType, - Array.from(node.arguments).slice(1)); - } - } - } - return node; -} - -function createResourceParam(resourceValue: number, resourceType: number,argsArr: ts.Expression[]): - ts.ObjectLiteralExpression { - const resourceParams: ts.ObjectLiteralExpression = ts.factory.createObjectLiteralExpression( - [ - ts.factory.createPropertyAssignment( - ts.factory.createStringLiteral(RESOURCE_NAME_ID), - ts.factory.createNumericLiteral(resourceValue) - ), - ts.factory.createPropertyAssignment( - ts.factory.createStringLiteral(RESOURCE_NAME_TYPE), - ts.factory.createNumericLiteral(resourceType) - ), - ts.factory.createPropertyAssignment( - ts.factory.createIdentifier(RESOURCE_NAME_PARAMS), - ts.factory.createArrayLiteralExpression( - argsArr, - false - ) - ) - ], - false - ); - return resourceParams; -} - -function validateResourceData(resourceData: string[], resources: object, pos: number): boolean { - if (resourceData.length !== 3) { - transformLog.errors.push({ - type: LogType.ERROR, - message: 'The input parameter is not supported.', - pos: pos - }); - } else if (!resources[resourceData[0]]) { - transformLog.errors.push({ - type: LogType.ERROR, - message: `The value of '${resourceData[0]}' is invalid.`, - pos: pos - }); - } else if (!resources[resourceData[0]][resourceData[1]]) { - transformLog.errors.push({ - type: LogType.ERROR, - message: `Value '${resourceData[1]}' does not exist on type 'typeof ${resourceData[0]}'.`, - pos: pos - }); - } else if (!resources[resourceData[0]][resourceData[1]][resourceData[2]]) { - transformLog.errors.push({ - type: LogType.ERROR, - message: `Value '${resourceData[2]}' does not exist on type 'typeof ${resourceData[1]}'.`, - pos: pos - }); - } else { - return true; - } - return false; -} - -function isWorker(node: ts.Node): boolean { - return ts.isNewExpression(node) && ts.isPropertyAccessExpression(node.expression) && - ts.isIdentifier(node.expression.name) && - node.expression.name.escapedText.toString() === WORKER_OBJECT; -} - -function processWorker(node: ts.NewExpression): ts.Node { - if (node.arguments.length && ts.isStringLiteral(node.arguments[0])) { - const args: ts.Expression[] = Array.from(node.arguments); - // @ts-ignore - const workerPath: string = node.arguments[0].text; - const stringNode: ts.StringLiteral = ts.factory.createStringLiteral( - workerPath.replace(/\.ts$/, '.js')); - args.splice(0, 1, stringNode); - return ts.factory.updateNewExpression(node, node.expression, node.typeArguments, args); - } - return node; -} - -function processExtend(node: ts.FunctionDeclaration, log: LogInfo[]): ts.FunctionDeclaration { - const componentName: string = isExtendFunction(node); - if (componentName) { - const statementArray: ts.Statement[] = []; - bindComponentAttr(node.body.statements[0] as ts.ExpressionStatement, - ts.factory.createIdentifier(componentName), statementArray, log); - return ts.factory.updateFunctionDeclaration(node, undefined, node.modifiers, node.asteriskToken, - node.name, node.typeParameters, node.parameters, node.type, - ts.factory.updateBlock(node.body, statementArray)); - } -} - -function isExtendFunction(node: ts.FunctionDeclaration): string { - if (ts.isBlock(node.body) && node.body.statements && node.body.statements.length === 1 && - ts.isExpressionStatement(node.body.statements[0]) && - // @ts-ignore - ts.isCallExpression(node.body.statements[0].expression) && ts.isIdentifier(node.name)) { - const nameArray: string[] = node.name.getText().split('__'); - if (nameArray.length === 3 && !nameArray[0] && EXTEND_ATTRIBUTE.has(nameArray[1])) { - const attributeArray: string[] = - [...EXTEND_ATTRIBUTE.get(nameArray[1])].map(item => item.attribute); - if (attributeArray.includes(nameArray[2])) { - return nameArray[1]; - } - } - } -} - -function createEntryNode(node: ts.SourceFile, context: ts.TransformationContext): ts.SourceFile { - if (componentCollection.entryComponent && !componentCollection.previewComponent) { - const entryNode: ts.ExpressionStatement = - createEntryFunction(componentCollection.entryComponent, context); - return context.factory.updateSourceFile(node, [...node.statements, entryNode]); - } else if (componentCollection.entryComponent && componentCollection.previewComponent) { - const entryNode: ts.ExpressionStatement = - createEntryFunction(componentCollection.previewComponent, context); - return context.factory.updateSourceFile(node, [...node.statements, entryNode]); - } else { - return node; - } -} - -function validateBody(node: ts.Block, typeChecker: ts.TypeChecker): void { - if (node.statements.length) { - node.statements.forEach((item, index, arr) => { - if (ts.isBlock(item)) { - validateBody(item, typeChecker); - } - if (index + 2 < arr.length && ts.isExpressionStatement(item) && - isAttributeBlockNode(item, arr as ts.Statement[], index) && - ts.isCallExpression(item.expression) && ts.isIdentifier(item.expression.expression)) { - const componentName: string = item.expression.expression.getText(); - const type: ts.Type = typeChecker.getTypeAtLocation(item.expression); - let temp: any = arr[index + 2]; - let name: string; - while (temp) { - if (ts.isCallExpression(temp)) { - if (ts.isPropertyAccessExpression(temp.expression)) { - const pos: number = temp.expression.name.getStart(); - name = temp.expression.name.getText(); - validateSymbol(isPropertyExist(typeChecker, pos, type, name, componentName), - temp.arguments, pos, typeChecker); - } else if (ts.isIdentifier(temp.expression)) { - const pos: number = temp.expression.getStart(); - name = temp.expression.getText(); - validateSymbol(isPropertyExist(typeChecker, pos, type, name, componentName), - temp.arguments, pos, typeChecker); - break; - } - } - temp = temp.expression; - } - } - }); - } -} - -function validateSymbol(type: ts.Symbol, args: ts.NodeArray, - argPos: number, typeChecker: ts.TypeChecker): void { - // @ts-ignore - if (type && type.valueDeclaration.parameters) { - // @ts-ignore - const parameters: ts.ParameterDeclaration[] = type.valueDeclaration.parameters; - const maxLength: number = parameters.length; - const minLength: number = getMinLength(parameters); - if (args.length < minLength || args.length > maxLength) { - let message:string; - if (maxLength !== minLength) { - message = `TS2554: Expected ${minLength}-${maxLength} arguments, but got ${args.length}.`; - } else { - message = `TS2554: Expected ${maxLength} arguments, but got ${args.length}.`; - } - transformLog.errors.push({ - type: LogType.ERROR, - message: message, - pos: argPos - }); - } else { - for (let i = 0; i < parameters.length; i++) { - validatePropertyType(parameters[i], args[i], typeChecker); - } - } - } -} - -function getMinLength(parameters: ts.ParameterDeclaration[]): number { - let length: number = parameters.length; - parameters.forEach((item: ts.ParameterDeclaration) => { - if (item.questionToken !== undefined) { - length--; - } - }); - return length; -} - -function isPropertyExist(typeChecker: ts.TypeChecker, pos: number, type: ts.Type, - propertyName: string, componentName: string): ts.Symbol { - const symbol: ts.Symbol = typeChecker.getPropertyOfType(type, propertyName); - if (symbol) { - return symbol; - } else { - transformLog.errors.push({ - type: LogType.ERROR, - message: `TS2339: Property '${propertyName}' does not exist on type '${componentName}'.`, - pos: pos - }); - } - return null; -} - -function validatePropertyType(param: ts.ParameterDeclaration, arg: ts.Expression, - typeChecker: ts.TypeChecker): void { - const argLocalType: ts.Type = typeChecker.getTypeAtLocation(arg); - const paramLocalType: ts.Type = typeChecker.getTypeAtLocation(param.type); - const argType: ts.Type = typeChecker.getBaseTypeOfLiteralType(typeChecker.getTypeAtLocation(arg)); - // @ts-ignore - const intrinsicName: string = argType.intrinsicName; - const argTypeName: string = intrinsicName || typeChecker.typeToString(argLocalType); - // @ts-ignore - if (!typeChecker.isTypeAssignableTo(argLocalType, paramLocalType)) { - generateArgumentLog(arg, argTypeName, typeChecker.typeToString(paramLocalType)); - } -} - -function generateArgumentLog(arg: ts.Expression, argTypeName: string, paramTypeName: string): void { - transformLog.errors.push({ - type: LogType.ERROR, - message: `TS2345: Argument of type '${argTypeName}' is not assignable to parameter of type '${paramTypeName}'.`, - pos: arg.getStart() - }); -} - -function isAttributeBlockNode(node: ts.ExpressionStatement, arr: ts.Statement[], index: number): boolean { - const attributeNode: ts.Node = arr[index + 2]; - return BUILDIN_CONTAINER_COMPONENT.has(getName(node)) && ts.isBlock(arr[index + 1]) - && ts.isExpressionStatement(attributeNode) && isAttributeNode(attributeNode); -} - -function createEntryFunction(name: string, context: ts.TransformationContext) - : ts.ExpressionStatement { - return context.factory.createExpressionStatement(context.factory.createCallExpression( - context.factory.createIdentifier(PAGE_ENTRY_FUNCTION_NAME), undefined, - [context.factory.createNewExpression(context.factory.createIdentifier(name), undefined, - [context.factory.createStringLiteral((++componentInfo.id).toString()), - context.factory.createIdentifier(COMPONENT_CONSTRUCTOR_UNDEFINED), - context.factory.createObjectLiteralExpression([], false)])])); -} - -export function resetLog(): void { - transformLog.errors = []; -} diff --git a/compiler/compiler/src/result_process.ts b/compiler/compiler/src/result_process.ts deleted file mode 100644 index 1087b8879..000000000 --- a/compiler/compiler/src/result_process.ts +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - -import ts from 'typescript'; -import path from 'path'; - -import { BUILD_OFF } from './pre_define'; -import { - resetLog, - transformLog -} from './process_ui_syntax'; -import { - propertyCollection, - linkCollection -} from './validate_ui_syntax'; -import { - LogInfo, - emitLogInfo, - componentInfo -} from './utils'; -import { resetComponentCollection } from './validate_ui_syntax'; -import { abilityConfig } from '../main'; - -module.exports = function resultProcess(source: string, map: any): void { - process.env.compiler = BUILD_OFF; - if (/\.ets$/.test(this.resourcePath)) { - componentInfo.id = 0; - propertyCollection.clear(); - linkCollection.clear(); - resetComponentCollection(); - if (transformLog && transformLog.errors.length) { - const sourceFile: ts.SourceFile = transformLog.sourceFile; - const logInfos: LogInfo[] = transformLog.errors.map((item) => { - if (item.pos) { - const posOfNode: ts.LineAndCharacter = sourceFile.getLineAndCharacterOfPosition(item.pos); - item.line = posOfNode.line + 1; - item.column = posOfNode.character + 1; - } else { - item.line = undefined; - item.column = undefined; - } - item.fileName = sourceFile.fileName.replace(/.ts$/, ''); - return item; - }); - emitLogInfo(this, logInfos); - resetLog(); - } - } - const resourcePath: string = path.basename(this.resourcePath); - if (['app.ets', abilityConfig.abilityEntryFile].includes(resourcePath)) { - source = source.replace(/exports\.default/, 'globalThis.exports.default'); - } - - this.callback(null, source, map); -}; diff --git a/compiler/compiler/src/utils.ts b/compiler/compiler/src/utils.ts deleted file mode 100644 index 943c1aa7f..000000000 --- a/compiler/compiler/src/utils.ts +++ /dev/null @@ -1,158 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - -import ts from 'typescript'; -import path from 'path'; -import fs from 'fs'; - -export enum LogType { - ERROR = 'ERROR', - WARN = 'WARN', - NOTE = 'NOTE' -} - -export interface LogInfo { - type: LogType, - message: string, - pos?: number, - line?: number, - column?: number, - fileName?: string -} - -export class FileLog { - private _sourceFile: ts.SourceFile; - private _errors: LogInfo[] = []; - - public get sourceFile() { - return this._sourceFile; - } - - public set sourceFile(newValue: ts.SourceFile) { - this._sourceFile = newValue; - } - - public get errors() { - return this._errors; - } - - public set errors(newValue: LogInfo[]) { - this._errors = newValue; - } -} - -export function emitLogInfo(loader: any, infos: LogInfo[]) { - if (infos && infos.length) { - infos.forEach((item) => { - switch (item.type) { - case LogType.ERROR: - loader.emitError(getMessage(loader.resourcePath, item)); - break; - case LogType.WARN: - loader.emitWarning(getMessage(loader.resourcePath, item)); - break; - case LogType.NOTE: - loader.emitWarning(getMessage(loader.resourcePath, item)); - break; - } - }); - } -} - -export function addLog(type: LogType, message: string, pos: number, log: LogInfo[], - sourceFile: ts.SourceFile) { - const posOfNode: ts.LineAndCharacter = sourceFile.getLineAndCharacterOfPosition(pos); - log.push({ - type: type, - message: message, - line: posOfNode.line + 1, - column: posOfNode.character + 1, - fileName: sourceFile.fileName - }); -} - -export function getMessage(fileName: string, info: LogInfo): string { - let messsage: string; - if (info.line && info.column) { - messsage = `BUILD${info.type} File: ${fileName}:${info.line}:${info.column}\n ${info.message}`; - } else { - messsage = `BUILD${info.type} File: ${fileName}\n ${info.message}`; - } - return messsage; -} - -class ComponentInfo { - private _id: number = 0; - private _componentNames: Set = new Set(['ForEach']); - public set id(id: number) { - this._id = id; - } - public get id() { - return this._id; - } - public set componentNames(componentNames: Set) { - this._componentNames = componentNames; - } - public get componentNames() { - return this._componentNames; - } -} - -export const componentInfo: ComponentInfo = new ComponentInfo(); - -export function hasDecorator(node: ts.MethodDeclaration | ts.FunctionDeclaration | ts.ClassDeclaration, - decortorName: string): boolean { - if (node.decorators && node.decorators.length) { - for (let i = 0; i < node.decorators.length; i++) { - if (node.decorators[i].getText() === decortorName) { - return true; - } - } - } - return false; -} - -const STATEMENT_EXPECT: number = 1128; -const SEMICOLON_EXPECT: number = 1005; -export const IGNORE_ERROR_CODE: number[] = [STATEMENT_EXPECT, SEMICOLON_EXPECT]; - -export function readFile(dir: string, utFiles: string[]) { - try { - const files: string[] = fs.readdirSync(dir); - files.forEach((element) => { - const filePath: string = path.join(dir, element); - const status: fs.Stats = fs.statSync(filePath); - if (status.isDirectory()) { - readFile(filePath, utFiles); - } else { - utFiles.push(filePath); - } - }); - } catch (e) { - console.error('ETS ERROR: ' + e); - } -} - -export function createFunction(node: ts.Identifier, attrNode: ts.Identifier, - argumentsArr: ts.NodeArray): ts.CallExpression { - return ts.factory.createCallExpression( - ts.factory.createPropertyAccessExpression( - node, - attrNode - ), - undefined, - argumentsArr && argumentsArr.length ? argumentsArr : [] - ); -} diff --git a/compiler/compiler/src/validate_ui_syntax.ts b/compiler/compiler/src/validate_ui_syntax.ts deleted file mode 100644 index bb78f691d..000000000 --- a/compiler/compiler/src/validate_ui_syntax.ts +++ /dev/null @@ -1,802 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - -import ts from 'typescript'; -import path from 'path'; - -import { - INNER_COMPONENT_DECORATORS, - COMPONENT_DECORATOR_ENTRY, - COMPONENT_DECORATOR_PREVIEW, - COMPONENT_DECORATOR_COMPONENT, - COMPONENT_DECORATOR_CUSTOM_DIALOG, - STRUCT, - CLASS, - NATIVE_MODULE, - SYSTEM_PLUGIN, - OHOS_PLUGIN, - INNER_COMPONENT_MEMBER_DECORATORS, - COMPONENT_FOREACH, - COMPONENT_LAZYFOREACH, - COMPONENT_STATE_DECORATOR, - COMPONENT_LINK_DECORATOR, - COMPONENT_PROP_DECORATOR, - COMPONENT_STORAGE_PROP_DECORATOR, - COMPONENT_STORAGE_LINK_DECORATOR, - COMPONENT_PROVIDE_DECORATOR, - COMPONENT_CONSUME_DECORATOR, - COMPONENT_OBJECT_LINK_DECORATOR, - COMPONENT_CONSTRUCTOR_ID, - COMPONENT_CONSTRUCTOR_PARENT, - COMPONENT_CONSTRUCTOR_PARAMS, - COMPONENT_EXTEND_DECORATOR, - COMPONENT_OBSERVED_DECORATOR -} from './pre_define'; -import { - INNER_COMPONENT_NAMES, - AUTOMIC_COMPONENT, - SINGLE_CHILD_COMPONENT, - SPECIFIC_CHILD_COMPONENT, - BUILDIN_STYLE_NAMES, - EXTEND_ATTRIBUTE -} from './component_map'; -import { - LogType, - LogInfo, - componentInfo, - addLog, - hasDecorator -} from './utils'; -const parser = require('../syntax_parser/dist/syntax_parser.js'); - -export interface ComponentCollection { - entryComponent: string; - previewComponent: string; - customDialogs: Set; - customComponents: Set; - currentClassName: string; -} - -export interface IComponentSet { - propertys: Set; - regulars: Set; - states: Set; - links: Set; - props: Set; - storageProps: Set; - storageLinks: Set; - provides: Set; - consumes: Set; - objectLinks: Set; -} - -export const componentCollection: ComponentCollection = { - entryComponent: null, - previewComponent: null, - customDialogs: new Set([]), - customComponents: new Set([]), - currentClassName: null -}; - -export const observedClassCollection: Set = new Set(); -export const enumCollection: Set = new Set(); -export const classMethodCollection: Map> = new Map(); -export const dollarCollection: Set = new Set(); - -export const propertyCollection: Map> = new Map(); -export const stateCollection: Map> = new Map(); -export const linkCollection: Map> = new Map(); -export const propCollection: Map> = new Map(); -export const regularCollection: Map> = new Map(); -export const storagePropCollection: Map> = new Map(); -export const storageLinkCollection: Map> = new Map(); -export const provideCollection: Map> = new Map(); -export const consumeCollection: Map> = new Map(); -export const objectLinkCollection: Map> = new Map(); - -export const isStaticViewCollection: Map = new Map(); - -export const moduleCollection: Set = new Set(); - -export function validateUISyntax(source: string, content: string, filePath: string, - fileQuery: string): LogInfo[] { - let log: LogInfo[] = []; - if (path.basename(filePath) !== 'app.ets') { - const res: LogInfo[] = checkComponentDecorator(source, filePath, fileQuery); - if (res) { - log = log.concat(res); - } - const allComponentNames: Set = - new Set([...INNER_COMPONENT_NAMES, ...componentCollection.customComponents]); - checkUISyntax(filePath, allComponentNames, content, log); - componentCollection.customComponents.forEach(item => componentInfo.componentNames.add(item)); - } - - return log; -} - -function checkComponentDecorator(source: string, filePath: string, - fileQuery: string): LogInfo[] | null { - const log: LogInfo[] = []; - const sourceFile: ts.SourceFile = ts.createSourceFile(filePath, source, - ts.ScriptTarget.Latest, true, ts.ScriptKind.TS); - if (sourceFile && sourceFile.statements && sourceFile.statements.length) { - const result: DecoratorResult = { - entryCount: 0, - previewCount: 0 - }; - sourceFile.statements.forEach((item, index, arr) => { - if (isObservedClass(item)) { - // @ts-ignore - observedClassCollection.add(item.name.getText()); - } - if (ts.isEnumDeclaration(item) && item.name) { - enumCollection.add(item.name.getText()); - } - if (isStruct(item)) { - if (index + 1 < arr.length && ts.isExpressionStatement(arr[index + 1]) && - // @ts-ignore - arr[index + 1].expression && ts.isIdentifier(arr[index + 1].expression)) { - if (ts.isExportAssignment(item) && hasComponentDecorator(item)) { - checkDecorators(item, result, arr[index + 1] as ts.ExpressionStatement, log, sourceFile); - } else if (index > 0 && hasComponentDecorator(arr[index - 1])) { - checkDecorators(arr[index - 1] as ts.MissingDeclaration, result, - arr[index + 1] as ts.ExpressionStatement, log, sourceFile); - } else { - // @ts-ignore - const pos: number = item.expression.getStart(); - const message: string = `A struct should use decorator '@Component'.`; - addLog(LogType.WARN, message, pos, log, sourceFile); - } - } else { - // @ts-ignore - const pos: number = item.expression.getStart(); - const message: string = `A struct must have a name.`; - addLog(LogType.ERROR, message, pos, log, sourceFile); - } - } - if (ts.isMissingDeclaration(item)) { - const decorators: ts.NodeArray = item.decorators; - for (let i = 0; i < decorators.length; i++) { - if (decorators[i] && /struct/.test(item.getText())) { - const message: string = `Please use a valid decorator.`; - addLog(LogType.ERROR, message, item.getStart(), log, sourceFile); - break; - } - } - } - }); - validateEntryCount(result, fileQuery, sourceFile.fileName, log); - } - - return log.length ? log : null; -} - -function validateEntryCount(result: DecoratorResult, fileQuery: string, - fileName: string, log: LogInfo[]): void { - if (result.entryCount !== 1 && fileQuery === '?entry') { - log.push({ - type: LogType.ERROR, - message: `A page configured in 'config.json' must have one and only one '@Entry' ` - + `decorator with a struct.`, - fileName: fileName - }); - } -} - -export function isObservedClass(node: ts.Node): boolean { - if (ts.isClassDeclaration(node) && hasDecorator(node, COMPONENT_OBSERVED_DECORATOR)) { - return true; - } - return false; -} - -export function isCustomDialogClass(node: ts.Node): boolean { - if (ts.isClassDeclaration(node) && hasDecorator(node, COMPONENT_DECORATOR_CUSTOM_DIALOG)) { - return true; - } - return false; -} - -function isStruct(node: ts.Node): boolean { - if ((ts.isExpressionStatement(node) || ts.isExportAssignment(node)) && - node.expression && ts.isIdentifier(node.expression) && node.expression.getText() === STRUCT) { - return true; - } - return false; -} - -function hasComponentDecorator(node: ts.Node): boolean { - if ((ts.isMissingDeclaration(node) || ts.isExportAssignment(node)) && - node.decorators && node.decorators.length) { - return true; - } - return false; -} - -interface DecoratorResult { - entryCount: number; - previewCount: number; -} - -function checkDecorators(node: ts.MissingDeclaration | ts.ExportAssignment, result: DecoratorResult, - component: ts.ExpressionStatement, log: LogInfo[], sourceFile: ts.SourceFile): void { - let hasComponentDecorator: boolean = false; - const componentName: string = component.getText(); - node.decorators.forEach((element) => { - const name: string = element.getText(); - if (INNER_COMPONENT_DECORATORS.has(name)) { - componentCollection.customComponents.add(componentName); - switch (name) { - case COMPONENT_DECORATOR_ENTRY: - result.entryCount++; - componentCollection.entryComponent = componentName; - break; - case COMPONENT_DECORATOR_PREVIEW: - result.previewCount++; - componentCollection.previewComponent = componentName; - break; - case COMPONENT_DECORATOR_COMPONENT: - hasComponentDecorator = true; - break; - case COMPONENT_DECORATOR_CUSTOM_DIALOG: - componentCollection.customDialogs.add(componentName); - hasComponentDecorator = true; - break; - } - } else { - const pos: number = element.expression ? element.expression.pos : element.pos; - const message: string = `The struct '${componentName}' use invalid decorator.`; - addLog(LogType.WARN, message, pos, log, sourceFile); - } - }); - if (!hasComponentDecorator) { - const message: string = `The struct '${componentName}' should use decorator '@Component'.`; - addLog(LogType.WARN, message, component.pos, log, sourceFile); - } - if (BUILDIN_STYLE_NAMES.has(componentName)) { - const message: string = `The struct '${componentName}' cannot have the same name ` + - `as the built-in attribute '${componentName}'.`; - addLog(LogType.ERROR, message, component.pos, log, sourceFile); - } - if (INNER_COMPONENT_NAMES.has(componentName)) { - const message: string = `The struct '${componentName}' cannot have the same name ` + - `as the built-in component '${componentName}'.`; - addLog(LogType.ERROR, message, component.pos, log, sourceFile); - } -} - -function checkUISyntax(filePath: string, allComponentNames: Set, content: string, - log: LogInfo[]): void { - const sourceFile: ts.SourceFile = ts.createSourceFile(filePath, content, - ts.ScriptTarget.Latest, true, ts.ScriptKind.TS); - visitAllNode(sourceFile, sourceFile, allComponentNames, log); -} - -function visitAllNode(node: ts.Node, sourceFileNode: ts.SourceFile, allComponentNames: Set, - log: LogInfo[]) { - checkAllNode(node, allComponentNames, sourceFileNode, log); - if (ts.isClassDeclaration(node) && node.name && ts.isIdentifier(node.name)) { - collectComponentProps(node); - } - node.getChildren().forEach((item: ts.Node) => visitAllNode(item, sourceFileNode, allComponentNames, log)); -} - -function checkAllNode(node: ts.Node, allComponentNames: Set, sourceFileNode: ts.SourceFile, - log: LogInfo[]): void { - if (ts.isExpressionStatement(node) && node.expression && ts.isIdentifier(node.expression) && - allComponentNames.has(node.expression.escapedText.toString())) { - const pos: number = node.expression.getStart(); - const message: string = - `The component name must be followed by parentheses, like '${node.expression.getText()}()'.`; - addLog(LogType.ERROR, message, pos, log, sourceFileNode); - } - checkNoChildComponent(node, sourceFileNode, log); - checkOneChildComponent(node, allComponentNames, sourceFileNode, log); - checkSpecificChildComponent(node, allComponentNames, sourceFileNode, log); -} - -function checkNoChildComponent(node: ts.Node, sourceFileNode: ts.SourceFile, log: LogInfo[]): void { - if (ts.isExpressionStatement(node) && ts.isCallExpression(node.expression) && - ts.isIdentifier(node.expression.expression) && hasChild(node)) { - const componentName: string = node.expression.expression.escapedText.toString(); - const pos: number = node.expression.expression.getStart(); - const message: string = `The component '${componentName}' can't have any child.`; - addLog(LogType.ERROR, message, pos, log, sourceFileNode); - } -} - -function hasChild(node: ts.ExpressionStatement): boolean { - const callExpression: ts.CallExpression = node.expression as ts.CallExpression; - const nodeName: ts.Identifier = callExpression.expression as ts.Identifier; - if (AUTOMIC_COMPONENT.has(nodeName.escapedText.toString()) && getNextNode(node)) { - return true; - } - return false; -} - -function getNextNode(node: ts.Node): ts.Block { - if (node.parent && ts.isBlock(node.parent) && node.parent.statements) { - const statementsArray: ts.Node[] = Array.from(node.parent.statements); - for (let i = 0; i < statementsArray.length - 1; i++) { - const curNode: ts.Node = statementsArray[i]; - const nextNode: ts.Node = statementsArray[i + 1]; - if (node === curNode && ts.isBlock(nextNode)) { - return nextNode; - } - } - } -} - -function checkOneChildComponent(node: ts.Node, allComponentNames: Set, - sourceFileNode: ts.SourceFile, log: LogInfo[]): void { - if (ts.isExpressionStatement(node) && ts.isCallExpression(node.expression) && - ts.isIdentifier(node.expression.expression) && hasNonSingleChild(node, allComponentNames)) { - const componentName: string = node.expression.expression.escapedText.toString(); - const pos: number = node.expression.expression.getStart(); - const message: string = - `The component '${componentName}' can only have a single child component.`; - addLog(LogType.ERROR, message, pos, log, sourceFileNode); - } -} - -function hasNonSingleChild(node: ts.ExpressionStatement, allComponentNames: Set): boolean { - const callExpression: ts.CallExpression = node.expression as ts.CallExpression; - const nodeName: ts.Identifier = callExpression.expression as ts.Identifier; - const nextBlockNode: ts.Block = getNextNode(node); - if (SINGLE_CHILD_COMPONENT.has(nodeName.escapedText.toString())) { - if (!nextBlockNode) { - return false; - } - if (nextBlockNode && nextBlockNode.statements) { - const length: number = nextBlockNode.statements.length; - if (!length) { - return false; - } - if (length > 3) { - return true; - } - const childCount: number = getBlockChildrenCount(nextBlockNode, allComponentNames); - if (childCount > 1) { - return true; - } - } - } - return false; -} - -function getBlockChildrenCount(blockNode: ts.Block, allComponentNames: Set): number { - let maxCount: number = 0; - const length: number = blockNode.statements.length; - for (let i = 0; i < length; ++i) { - const item: ts.Node = blockNode.statements[i]; - if (ts.isExpressionStatement(item) && ts.isCallExpression(item.expression) && - isForEachComponent(item.expression)) { - maxCount += 2; - } - if (ts.isIfStatement(item)) { - maxCount += getIfChildrenCount(item, allComponentNames); - } - if (ts.isBlock(item)) { - maxCount += getBlockChildrenCount(item, allComponentNames); - } - if (ts.isExpressionStatement(item) && ts.isCallExpression(item.expression)) { - let newNode: any = item.expression; - while (newNode.expression) { - if (ts.isCallExpression(newNode) && ts.isIdentifier(newNode.expression) && - !isForEachComponent(newNode) && isComponent(newNode, allComponentNames)) { - maxCount += 1; - if (i + 1 < length && ts.isBlock(blockNode.statements[i + 1])) { - ++i; - } - } - newNode = newNode.expression; - } - } - if (maxCount > 1) { - break; - } - } - return maxCount; -} - -function isComponent(node: ts.CallExpression, allComponentNames: Set): boolean { - if (ts.isIdentifier(node.expression) && - allComponentNames.has(node.expression.escapedText.toString())) { - return true; - } - return false; -} - -function isForEachComponent(node: ts.CallExpression): boolean { - if (ts.isIdentifier(node.expression)) { - const componentName: string = node.expression.escapedText.toString(); - return componentName === COMPONENT_FOREACH || componentName === COMPONENT_LAZYFOREACH; - } - return false; -} - -function getIfChildrenCount(ifNode: ts.IfStatement, allComponentNames: Set): number { - const maxCount: number = - Math.max(getStatementCount(ifNode.thenStatement, allComponentNames), - getStatementCount(ifNode.elseStatement, allComponentNames)); - return maxCount; -} - -function getStatementCount(node: ts.Node, allComponentNames: Set): number { - let maxCount: number = 0; - if (!node) { - return maxCount; - } else if (ts.isBlock(node)) { - maxCount = getBlockChildrenCount(node, allComponentNames); - } else if (ts.isIfStatement(node)) { - maxCount = getIfChildrenCount(node, allComponentNames); - } else if (ts.isExpressionStatement(node) && ts.isCallExpression(node.expression) && - isForEachComponent(node.expression)) { - maxCount = 2; - } else if (ts.isExpressionStatement(node) && ts.isCallExpression(node.expression) && - !isForEachComponent(node.expression) && isComponent(node.expression, allComponentNames)) { - maxCount = 1; - } - return maxCount; -} - -function checkSpecificChildComponent(node: ts.Node, allComponentNames: Set, - sourceFileNode: ts.SourceFile, log: LogInfo[]): void { - if (ts.isExpressionStatement(node) && ts.isCallExpression(node.expression) && - ts.isIdentifier(node.expression.expression) && hasNonspecificChild(node, allComponentNames)) { - const componentName: string = node.expression.expression.escapedText.toString(); - const pos: number = node.expression.expression.getStart(); - const specificChildArray: string = - Array.from(SPECIFIC_CHILD_COMPONENT.get(componentName)).join(' and '); - const message: string = - `The component '${componentName}' can only have the child component ${specificChildArray}.`; - addLog(LogType.ERROR, message, pos, log, sourceFileNode); - } -} - -function hasNonspecificChild(node: ts.ExpressionStatement, - allComponentNames: Set): boolean { - const callExpression: ts.CallExpression = node.expression as ts.CallExpression; - const nodeName: ts.Identifier = callExpression.expression as ts.Identifier; - const nodeNameString: string = nodeName.escapedText.toString(); - const blockNode: ts.Block = getNextNode(node); - let isNonspecific: boolean = false; - if (SPECIFIC_CHILD_COMPONENT.has(nodeNameString) && blockNode) { - const specificChildSet: Set = SPECIFIC_CHILD_COMPONENT.get(nodeNameString); - isNonspecific = isNonspecificChildBlock(blockNode, specificChildSet, allComponentNames); - if (isNonspecific) { - return isNonspecific; - } - } - return isNonspecific; -} - -function isNonspecificChildBlock(blockNode: ts.Block, specificChildSet: Set, - allComponentNames: Set): boolean { - if (blockNode.statements) { - const length: number = blockNode.statements.length; - for (let i = 0; i < length; ++i) { - const item: ts.Node = blockNode.statements[i]; - if (ts.isIfStatement(item) && isNonspecificChildIf(item, specificChildSet, allComponentNames)) { - return true; - } - if (ts.isExpressionStatement(item) && ts.isCallExpression(item.expression) && - isForEachComponent(item.expression) && - isNonspecificChildForEach(item.expression, specificChildSet, allComponentNames)) { - return true; - } - if (ts.isBlock(item) && isNonspecificChildBlock(item, specificChildSet, allComponentNames)) { - return true; - } - if (ts.isExpressionStatement(item) && ts.isCallExpression(item.expression)) { - let newNode: any = item.expression; - while (newNode.expression) { - if (ts.isCallExpression(newNode) && ts.isIdentifier(newNode.expression) && - !isForEachComponent(newNode) && isComponent(newNode, allComponentNames)) { - const isNonspecific: boolean = - isNonspecificChildNonForEach(item.expression, specificChildSet); - if (isNonspecific) { - return isNonspecific; - } - if (i + 1 < length && ts.isBlock(blockNode.statements[i + 1])) { - ++i; - } - } - newNode = newNode.expression; - } - } - } - } - return false; -} - -function isNonspecificChildIf(node: ts.IfStatement, specificChildSet: Set, - allComponentNames: Set): boolean { - return isNonspecificChildIfStatement(node.thenStatement, specificChildSet, allComponentNames) || - isNonspecificChildIfStatement(node.elseStatement, specificChildSet, allComponentNames); -} - -function isNonspecificChildForEach(node: ts.CallExpression, specificChildSet: Set, - allComponentNames: Set): boolean { - if (ts.isCallExpression(node) && node.arguments && - node.arguments.length > 1 && ts.isArrowFunction(node.arguments[1])) { - const arrowFunction: ts.ArrowFunction = node.arguments[1] as ts.ArrowFunction; - const body: ts.Block | ts.CallExpression | ts.IfStatement = - arrowFunction.body as ts.Block | ts.CallExpression | ts.IfStatement; - if (!body) { - return false; - } - if (ts.isBlock(body) && isNonspecificChildBlock(body, specificChildSet, allComponentNames)) { - return true; - } - if (ts.isIfStatement(body) && isNonspecificChildIf(body, specificChildSet, allComponentNames)) { - return true; - } - if (ts.isCallExpression(body) && isForEachComponent(body) && - isNonspecificChildForEach(body, specificChildSet, allComponentNames)) { - return true; - } - if (ts.isCallExpression(body) && !isForEachComponent(body) && - isComponent(body, allComponentNames) && - isNonspecificChildNonForEach(body, specificChildSet)) { - return true; - } - } - return false; -} - -function isNonspecificChildNonForEach(node: ts.CallExpression, - specificChildSet: Set): boolean { - if (ts.isIdentifier(node.expression) && - !specificChildSet.has(node.expression.escapedText.toString())) { - return true; - } - return false; -} - -function isNonspecificChildIfStatement(node: ts.Node, specificChildSet: Set, - allComponentNames: Set): boolean { - if (!node) { - return false; - } - if (ts.isBlock(node) && isNonspecificChildBlock(node, specificChildSet, allComponentNames)) { - return true; - } - if (ts.isIfStatement(node) && isNonspecificChildIf(node, specificChildSet, allComponentNames)) { - return true; - } - if (ts.isExpressionStatement(node) && ts.isCallExpression(node.expression) && - isForEachComponent(node.expression) && - isNonspecificChildForEach(node.expression, specificChildSet, allComponentNames)) { - return true; - } - if (ts.isExpressionStatement(node) && ts.isCallExpression(node.expression) && - !isForEachComponent(node.expression) && isComponent(node.expression, allComponentNames) && - isNonspecificChildNonForEach(node.expression, specificChildSet)) { - return true; - } - return false; -} - -function collectComponentProps(node: ts.ClassDeclaration): void { - const componentName: string = node.name.getText(); - const ComponentSet: IComponentSet = getComponentSet(node); - propertyCollection.set(componentName, ComponentSet.propertys); - stateCollection.set(componentName, ComponentSet.states); - linkCollection.set(componentName, ComponentSet.links); - propCollection.set(componentName, ComponentSet.props); - regularCollection.set(componentName, ComponentSet.regulars); - storagePropCollection.set(componentName, ComponentSet.storageProps); - storageLinkCollection.set(componentName, ComponentSet.storageLinks); - provideCollection.set(componentName, ComponentSet.provides); - consumeCollection.set(componentName, ComponentSet.consumes); - objectLinkCollection.set(componentName, ComponentSet.objectLinks); -} - -export function getComponentSet(node: ts.ClassDeclaration): IComponentSet { - const propertys: Set = new Set(); - const states: Set = new Set(); - const links: Set = new Set(); - const props: Set = new Set(); - const regulars: Set = new Set(); - const storageProps: Set = new Set(); - const storageLinks: Set = new Set(); - const provides: Set = new Set(); - const consumes: Set = new Set(); - const objectLinks: Set = new Set(); - traversalComponentProps(node, propertys, regulars, states, links, props, storageProps, - storageLinks, provides, consumes, objectLinks); - return { - propertys, regulars, states, links, props, storageProps, storageLinks, provides, - consumes, objectLinks - }; -} - -function traversalComponentProps(node: ts.ClassDeclaration, propertys: Set, - regulars: Set, states: Set, links: Set, props: Set, - storageProps: Set, storageLinks: Set, provides: Set, - consumes: Set, objectLinks: Set): void { - let isStatic: boolean = true; - if (node.members) { - const currentMethodCollection: Set = new Set(); - node.members.forEach(item => { - if (ts.isPropertyDeclaration(item) && ts.isIdentifier(item.name)) { - const propertyName: string = item.name.getText(); - propertys.add(propertyName); - if (!item.decorators || !item.decorators.length) { - regulars.add(propertyName); - } else { - isStatic = false; - for (let i = 0; i < item.decorators.length; i++) { - const decoratorName: string = item.decorators[i].getText().replace(/\(.*\)$/, '').trim(); - if (INNER_COMPONENT_MEMBER_DECORATORS.has(decoratorName)) { - dollarCollection.add('$' + propertyName); - collectionStates(decoratorName, propertyName, states, links, props, storageProps, - storageLinks, provides, consumes, objectLinks); - } - } - } - } - if (ts.isMethodDeclaration(item) && item.name && ts.isIdentifier(item.name)) { - currentMethodCollection.add(item.name.getText()); - } - }); - classMethodCollection.set(node.name.getText(), currentMethodCollection); - } - isStaticViewCollection.set(node.name.getText(), isStatic); -} - -function collectionStates(decorator: string, name: string, states: Set, links: Set, - props: Set, storageProps: Set, storageLinks: Set, provides: Set, - consumes: Set, objectLinks: Set): void { - switch (decorator) { - case COMPONENT_STATE_DECORATOR: - states.add(name); - break; - case COMPONENT_LINK_DECORATOR: - links.add(name); - break; - case COMPONENT_PROP_DECORATOR: - props.add(name); - break; - case COMPONENT_STORAGE_PROP_DECORATOR: - storageProps.add(name); - break; - case COMPONENT_STORAGE_LINK_DECORATOR: - storageLinks.add(name); - break; - case COMPONENT_PROVIDE_DECORATOR: - provides.add(name); - break; - case COMPONENT_CONSUME_DECORATOR: - consumes.add(name); - break; - case COMPONENT_OBJECT_LINK_DECORATOR: - objectLinks.add(name); - break; - } -} - -export interface ReplaceResult { - content: string, - log: LogInfo[] -} - -export function sourceReplace(source: string, sourcePath: string): ReplaceResult { - let content: string = source; - const log: LogInfo[] = []; - // replace struct->class - content = content.replace( - new RegExp('\\b' + STRUCT + '\\b.+\\{', 'g'), item => { - item = item.replace(new RegExp('\\b' + STRUCT + '\\b', 'g'), `${CLASS} `); - return `${item} constructor(${COMPONENT_CONSTRUCTOR_ID}?, ${COMPONENT_CONSTRUCTOR_PARENT}?, ${COMPONENT_CONSTRUCTOR_PARAMS}?) {}`; - }); - - content = preprocessExtend(content, sourcePath, log); - // process @system. - content = processSystemApi(content); - - return { - content: content, - log: log - } -} - -export function preprocessExtend(content: string, sourcePath: string, log: LogInfo[]): string { - let syntaxCheckContent: string; - let result: any; - try { - result = parser.parse(content); - syntaxCheckContent = result.content; - for (let i = 0; i < result.collect_extend.component.length; i++) { - collectExtend( - result.collect_extend.component[i], - result.collect_extend.functionName[i], - result.collect_extend.parameters[i] - ); - } - } catch (err) { - result = err; - log.push({ - type: LogType.ERROR, - message: parser.SyntaxError.buildMessage(err.expected, err.found), - line: err.location.start.line, - column: err.location.start.column, - fileName: sourcePath - }); - syntaxCheckContent = content; - } - if (result.error_otherParsers) { - for(let i = 0; i < result.error_otherParsers.length; i++) { - log.push({ - type: LogType.ERROR, - message: result.error_otherParsers[i].errMessage, - line: result.error_otherParsers[i].errPosition.line, - column: result.error_otherParsers[i].errPosition.column, - fileName: sourcePath - }); - } - } - return syntaxCheckContent; -} - -function collectExtend(component: string, attribute: string, parameter: string): void { - let parameterCount: number; - if (parameter) { - parameterCount = parameter.split(',').length; - } else { - parameterCount = 0; - } - BUILDIN_STYLE_NAMES.add(attribute); - if (EXTEND_ATTRIBUTE.has(component)) { - EXTEND_ATTRIBUTE.get(component).add({ attribute, parameterCount }); - } else { - EXTEND_ATTRIBUTE.set(component, new Set([{ attribute, parameterCount }])); - } -} - -export function processSystemApi(content: string): string { - const REG_SYSTEM: RegExp = - /import\s+(.+)\s+from\s+['"]@(system|ohos)\.(\S+)['"]|import\s+(.+)\s*=\s*require\(\s*['"]@(system|ohos)\.(\S+)['"]\s*\)/g; - const REG_LIB_SO: RegExp = - /import\s+(.+)\s+from\s+['"]lib(\S+)\.so['"]|import\s+(.+)\s*=\s*require\(\s*['"]lib(\S+)\.so['"]\s*\)/g; - return content.replace(REG_LIB_SO, (_, item1, item2, item3, item4) => { - const libSoValue: string = item1 || item3; - const libSoKey: string = item2 || item4; - return `var ${libSoValue} = globalThis.requireNapi("${libSoKey}", true);`; - }).replace(REG_SYSTEM, (item, item1, item2, item3, item4, item5, item6) => { - const moduleType: string = item2 || item5; - const systemKey: string = item3 || item6; - const systemValue: string = item1 || item4; - moduleCollection.add(`${moduleType}.${systemKey}`); - if (NATIVE_MODULE.has(`${moduleType}.${systemKey}`)) { - item = `var ${systemValue} = globalThis.requireNativeModule('${moduleType}.${systemKey}')`; - } else if (moduleType === SYSTEM_PLUGIN) { - item = `var ${systemValue} = isSystemplugin('${systemKey}', '${SYSTEM_PLUGIN}') ? ` + - `globalThis.systemplugin.${systemKey} : globalThis.requireNapi('${systemKey}')`; - } else if (moduleType === OHOS_PLUGIN) { - item = `var ${systemValue} = isSystemplugin('${systemKey}', '${OHOS_PLUGIN}') ? ` + - `globalThis.ohosplugin.${systemKey} : isSystemplugin('${systemKey}', '${SYSTEM_PLUGIN}') ? ` + - `globalThis.systemplugin.${systemKey} : globalThis.requireNapi('${systemKey}')`; - } - return item; - }); -} - -export function resetComponentCollection() { - componentCollection.entryComponent = null; - componentCollection.previewComponent = null; -} diff --git a/compiler/compiler/syntax_parser/src/parse_extend.peg b/compiler/compiler/syntax_parser/src/parse_extend.peg deleted file mode 100644 index 0dcec46be..000000000 --- a/compiler/compiler/syntax_parser/src/parse_extend.peg +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - -start = extendAttributes:extendAttribute+ -{ - return {location: location()}; -} - -extendAttribute = whiteSpace '.' whiteSpace attribute item -attribute = attr_head attr_tail -attr_head = $ [a-zA-Z_$]+ -attr_tail = $ [a-zA-Z0-9_$]* -item = whiteSpace '(' [^()]* item* [^()]* ')' whiteSpace -whiteSpace = [ \t\r\n]* diff --git a/compiler/compiler/syntax_parser/src/syntax_parser.peg b/compiler/compiler/syntax_parser/src/syntax_parser.peg deleted file mode 100644 index c77c99afc..000000000 --- a/compiler/compiler/syntax_parser/src/syntax_parser.peg +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - -{ - const parse_extend = require('./parse_extend.js'); - - const error_otherParsers = []; - let singleError = function(errMessage, line, column) { - this.errMessage = errMessage; - this.errPosition = { - line: line, - column: column - }; - }; - const collect_extend = { - component: [], - functionName: [], - parameters: [] - }; -} - -start = blocks: block+ -{ - return { - content: blocks.join(''), - location: location(), - collect_extend: collect_extend, - error_otherParsers: error_otherParsers - }; -} - -block = extend/(prefix extend?) -prefix = $((!prefix_extend .)+) -extend = - whiteSpace1:whiteSpace prefix_extend:prefix_extend funcBody_extend:funcBody_extend - whiteSpace2: whiteSpace right:'}' whiteSpace3:whiteSpace -{ - return whiteSpace1 + prefix_extend + funcBody_extend + whiteSpace2 + right + whiteSpace3; -} - -prefix_extend = prefix_extend_one/prefix_extend_another - -//match a kind of extend component -prefix_extend_one = - '@Extend' whiteSpace1:whiteSpace '(' component:component ')' whiteSpace2:whiteSpace 'function' - whiteSpace3:whiteSpace function_name:function_name whiteSpace4:whiteSpace '(' parameters:parameters - ')' whiteSpace5:whiteSpace left:'{' -{ - collect_extend.component.push(component); - collect_extend.functionName.push(function_name); - collect_extend.parameters.push(parameters); - return '@Extend' + whiteSpace1 + whiteSpace2 + 'function' + whiteSpace3 + '__' + component + - '__' + function_name + whiteSpace4 + '(' + parameters + ')' + whiteSpace5 + left + component; -} - -//match another kind of extend component -prefix_extend_another = - '@Extend' whiteSpace1:whiteSpace component:component '.' function_name:function_name - whiteSpace2:whiteSpace '(' parameters:parameters ')' whiteSpace3:whiteSpace left:'{' -{ - collect_extend.component.push(component); - collect_extend.functionName.push(function_name); - collect_extend.parameters.push(parameters); - return '@Extend' + ' function' + whiteSpace1 + '__' + component + '__' + function_name + - whiteSpace2 + '(' + parameters + ')' + whiteSpace3 + left + component; -} - -component = $ [a-zA-Z_]+ -function_name = $ (function_name_head function_name_tail) -function_name_head = $ [a-zA-Z_$]+ -function_name_tail = $ [a-zA-Z0-9_$]* -parameters = $ ([^()]* item* [^()]*) - -//extract Extend internal attribute SyntaxError -funcBody_extend = body:($[^{}]* item* [^{}]*) -{ - try { - let functionBody = body.join(''); - parse_extend.parse(functionBody); - return functionBody; - } catch (err) { - let countLines = location().end.line - location().start.line; - if (err.location.start.line === 1) { - err.location.start.column += location().start.column; - } - let supportMessage = " Our rule is .attribute(value) , for example: .width(50) . And you'd better have at least one attribute in Extend Component"; - error_otherParsers.push( - new singleError( - parse_extend.SyntaxError.buildMessage(err.expected, err.found) + supportMessage, - err.location.start.line + location().start.line - 1, - err.location.start.column - ) - ); - let placeHolders = ''; - while (countLines>0) { - placeHolders += '\r\n'; - countLines -= 1; - } - return '()' + placeHolders; - } -} - -item = $ (whiteSpace '{' [^{}]* item* [^{}]* '}' whiteSpace) -whiteSpace = $ [ \t\r\n]* diff --git a/compiler/compiler/test/README.md b/compiler/compiler/test/README.md deleted file mode 100644 index 8cb5288c5..000000000 --- a/compiler/compiler/test/README.md +++ /dev/null @@ -1,83 +0,0 @@ -# compiler unit testing - -**The compiler unit testing for ace2.0.** - -## Usage -Here are simplified instructions of how to get started. The following commands work both on **Windows** and **Linux** platforms. - -### 1. Install -First, enter the root directory of the compiler: -``` -$ cd compiler/ -``` -And then install the npm dependencies(You must have node&npm installed): -``` -$ npm install -``` -**Note**: If some errors occur, delete the generated package `node_modules`, config npm proxy and run `npm install` again. -``` -npm config set proxy http://username:password@server:port -npm confit set https-proxy http://username:password@server:port -``` - -### 2. Quick Start -First, create a new test file or directory in `compiler/test`. -Write source code in variable 'source', and write expected code in variable 'expectResult': -``` -// source code -export const source: string = `...` -// expected code -export const expectResult: string = `...` -``` -In the root directory of `compiler/`: -``` -$ npm run test -``` -All files in the `compiler/test` will be tested. - -### 3. Example -1. Create a new test directory `foo` in `compiler`. -2. Create a new test file `bar.ts` in `compiler/foo`. -3. In the file `bar.ts`, write the following lines: -``` -export const source: string = ` -struct MyComponent { - build() { - } -}` - -export const expectResult: string = -`class MyComponent { - build() { - } -} -` -``` -4. In the root directory of `compiler/`: -``` -$ npm run test -``` -5. All files in the `compiler/test` will be tested. The output is like the following lines: -``` - ✓ bar - 1 passing (1ms) -``` -**Note**: If the actual building result is different from the expected result and the output is like the following lines, you should check the error: -``` - 1) bar - - 0 passing (1ms) - 1 failing - - 1) compiler - bar: - - AssertionError: expected 'class MyComponent {\n build() {\n }\n}\n' to deeply equal 'class MyComponent {\n build() {\n \n}\n' - + expected - actual - - class MyComponent { - build() { - - } - + - } -``` diff --git a/compiler/compiler/test/pages/AMDComponent.ets b/compiler/compiler/test/pages/AMDComponent.ets deleted file mode 100644 index 3135f0d85..000000000 --- a/compiler/compiler/test/pages/AMDComponent.ets +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - -@Component -struct AMDComponent { - @Link AMDComponentLink1?: any - @Link AMDComponentLink2?: number - @Link AMDComponentLink3?: boolean - @Link AMDComponentLink4?: string - - private myVar: number = 0 - private myVar2: number - - build() { - - } -} - -export = AMDComponent diff --git a/compiler/compiler/test/pages/DefaultComponent.ets b/compiler/compiler/test/pages/DefaultComponent.ets deleted file mode 100644 index e0add5224..000000000 --- a/compiler/compiler/test/pages/DefaultComponent.ets +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - -@Component -struct DefaultComponent { - @Link DefaultComponentLink1?: any - @Link DefaultComponentLink2?: number - @Link DefaultComponentLink3?: boolean - @Link DefaultComponentLink4?: string - - private myVar: number = 0 - private myVar2: number - - build() { - - } -} - -export default DefaultComponent diff --git a/compiler/compiler/test/pages/ExportComponent.ets b/compiler/compiler/test/pages/ExportComponent.ets deleted file mode 100644 index ba582d538..000000000 --- a/compiler/compiler/test/pages/ExportComponent.ets +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - - -import DefaultComponent from "./test/pages/DefaultComponent.ets" - -@Component -struct ExportComponent1 { - @Link ExportComponent1Link1?: any - @Link ExportComponent1Link2?: number - @Link ExportComponent1Link3?: boolean - @Link ExportComponent1Link4?: string - @State indexState1: any = { count: 0 } - @State indexState2: number = 0 - @State indexState3: boolean = false - @State indexState4: string = 'Home' - - build() { - Row() { - DefaultComponent({ - DefaultComponentLink1: $indexState1, - DefaultComponentLink2: $indexState2, - DefaultComponentLink3: $indexState3, - DefaultComponentLink4: $indexState4, - myVar: 100, - myVar2: 100 - }) - } - } -} - -@Component -struct ExportComponent2 { - @Link ExportComponent2Link1?: any - @Link ExportComponent2Link2?: number - @Link ExportComponent2Link3?: boolean - @Link ExportComponent2Link4?: string - @State indexState1: any = { count: 0 } - @State indexState2: number = 0 - @State indexState3: boolean = false - @State indexState4: string = 'Home' - - build() { - Row() { - DefaultComponent({ - DefaultComponentLink1: $indexState1, - DefaultComponentLink2: $indexState2, - DefaultComponentLink3: $indexState3, - DefaultComponentLink4: $indexState4, - myVar: 100, - myVar2: 100 - }) - } - } -} - -@Component -struct ExportComponent3 { - @Link ExportComponent3Link1?: any - @Link ExportComponent3Link2?: number - @Link ExportComponent3Link3?: boolean - @Link ExportComponent3Link4?: string - @State indexState1: any = { count: 0 } - @State indexState2: number = 0 - @State indexState3: boolean = false - @State indexState4: string = 'Home' - - build() { - Row() { - DefaultComponent({ - DefaultComponentLink1: $indexState1, - DefaultComponentLink2: $indexState2, - DefaultComponentLink3: $indexState3, - DefaultComponentLink4: $indexState4, - myVar: 100, - myVar2: 100 - }) - } - } -} - -@Component -export default struct ExportComponent4 { - @Link ExportComponent4Link1?: any - @Link ExportComponent4Link2?: number - @Link ExportComponent4Link3?: boolean - @Link ExportComponent4Link4?: string - @State indexState1: any = { count: 0 } - @State indexState2: number = 0 - @State indexState3: boolean = false - @State indexState4: string = 'Home' - - build() { - Row() { - DefaultComponent({ - DefaultComponentLink1: $indexState1, - DefaultComponentLink2: $indexState2, - DefaultComponentLink3: $indexState3, - DefaultComponentLink4: $indexState4, - myVar: 100, - myVar2: 100 - }) - } - } -} - -export { ExportComponent1 as ExportComponent, ExportComponent2, ExportComponent3 } diff --git a/compiler/compiler/test/pages/ExportStarComponent.ets b/compiler/compiler/test/pages/ExportStarComponent.ets deleted file mode 100644 index d9d450293..000000000 --- a/compiler/compiler/test/pages/ExportStarComponent.ets +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - - -export * as AllStarComponent from './test/pages/ExportComponent'; diff --git a/compiler/compiler/test/pages/LinkComponent.ets b/compiler/compiler/test/pages/LinkComponent.ets deleted file mode 100644 index ffcc61155..000000000 --- a/compiler/compiler/test/pages/LinkComponent.ets +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - -import DefaultComponent from "./DefaultComponent.ets" - -@Component -struct LinkComponent1 { - @Link LinkComponent1Link1?: any - @Link LinkComponent1Link2?: number - @Link LinkComponent1Link3?: boolean - @Link LinkComponent1Link4?: string - @State indexState1: any = { count: 0 } - @State indexState2: number = 0 - @State indexState3: boolean = false - @State indexState4: string = 'Home' - - build() { - Row() { - DefaultComponent({ - DefaultComponentLink1: $indexState1, - DefaultComponentLink2: $indexState2, - DefaultComponentLink3: $indexState3, - DefaultComponentLink4: $indexState4, - myVar: 100, - myVar2: 100 - }) - } - } -} - -@Component -struct LinkComponent2 { - @Link LinkComponent2Link1?: any - @Link LinkComponent2Link2?: number - @Link LinkComponent2Link3?: boolean - @Link LinkComponent2Link4?: string - @State indexState1: any = { count: 0 } - @State indexState2: number = 0 - @State indexState3: boolean = false - @State indexState4: string = 'Home' - - build() { - Row() { - DefaultComponent({ - DefaultComponentLink1: $indexState1, - DefaultComponentLink2: $indexState2, - DefaultComponentLink3: $indexState3, - DefaultComponentLink4: $indexState4, - myVar: 100, - myVar2: 100 - }) - } - } -} - -@Component -struct LinkComponent3 { - @Link LinkComponent3Link1?: any - @Link LinkComponent3Link2?: number - @Link LinkComponent3Link3?: boolean - @Link LinkComponent3Link4?: string - @State indexState1: any = { count: 0 } - @State indexState2: number = 0 - @State indexState3: boolean = false - @State indexState4: string = 'Home' - - build() { - Row() { - DefaultComponent({ - DefaultComponentLink1: $indexState1, - DefaultComponentLink2: $indexState2, - DefaultComponentLink3: $indexState3, - DefaultComponentLink4: $indexState4, - myVar: 100, - myVar2: 100 - }) - } - } -} - -@Component -struct LinkComponent4 { - @Link LinkComponent3Link1?: any - @Link LinkComponent3Link2?: number - @Link LinkComponent3Link3?: boolean - @Link LinkComponent3Link4?: string - @State indexState1: any = { count: 0 } - @State indexState2: number = 0 - @State indexState3: boolean = false - @State indexState4: string = 'Home' - - build() { - Row() { - DefaultComponent({ - DefaultComponentLink1: $indexState1, - DefaultComponentLink2: $indexState2, - DefaultComponentLink3: $indexState3, - DefaultComponentLink4: $indexState4, - myVar: 100, - myVar2: 100 - }) - } - } -} - -export { LinkComponent1 as LinkComponent, LinkComponent2, LinkComponent3 } - -export default LinkComponent4 diff --git a/compiler/compiler/test/pages/NamespaceComponent.ets b/compiler/compiler/test/pages/NamespaceComponent.ets deleted file mode 100644 index 5b33ec85f..000000000 --- a/compiler/compiler/test/pages/NamespaceComponent.ets +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - -@Component -struct NamespaceComponent1 { - @Link NamespaceComponent1Link1?: any - @Link NamespaceComponent1Link2?: number - @Link NamespaceComponent1Link3?: boolean - @Link NamespaceComponent1Link4?: string - - private myVar: number = 0 - private myVar2: number - - build() { - - } -} - -@Component -struct NamespaceComponent2 { - @Link NamespaceComponent2Link1?: any - @Link NamespaceComponent2Link2?: number - @Link NamespaceComponent2Link3?: boolean - @Link NamespaceComponent2Link4?: string - - private myVar: number = 0 - private myVar2: number - - build() { - - } -} - -@Component -struct NamespaceComponent3 { - @Link NamespaceComponent3Link1?: any - @Link NamespaceComponent3Link2?: number - @Link NamespaceComponent3Link3?: boolean - @Link NamespaceComponent3Link4?: string - - private myVar: number = 0 - private myVar2: number - - build() { - - } -} - -export { NamespaceComponent1, NamespaceComponent2 } - -export default NamespaceComponent3 diff --git a/compiler/compiler/test/pages/TsModule.ts b/compiler/compiler/test/pages/TsModule.ts deleted file mode 100644 index 7faca616e..000000000 --- a/compiler/compiler/test/pages/TsModule.ts +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (c) 2020 Huawei Device Co., Ltd. - * 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. - */ - -export default class TsModule { - private property: number = 1; - constructor(property: number) { - this.property = property; - } - - public method(): any { - return { count: this.property }; - } -} diff --git a/compiler/compiler/test/test.ts b/compiler/compiler/test/test.ts deleted file mode 100644 index a4254e7d8..000000000 --- a/compiler/compiler/test/test.ts +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - -import ts from 'typescript'; -import path from 'path'; -import chai from 'chai'; -import { - describe, - it -} from 'mocha'; -const expect = chai.expect; - -import { - validateUISyntax, - resetComponentCollection, - sourceReplace, - componentCollection -} from '../lib/validate_ui_syntax'; -import { processUISyntax } from '../lib/process_ui_syntax'; -import { - componentInfo, - readFile -} from '../lib/utils'; -import { BUILD_ON } from '../lib/pre_define'; - -function expectActual(name: string, filePath: string) { - const content: any = require(filePath); - const source: string = content.source; - process.env.compiler = BUILD_ON; - const afterProcess = sourceReplace(source); - validateUISyntax(source, afterProcess, `${name}.ts`); - const result: ts.TranspileOutput = ts.transpileModule(afterProcess, { - compilerOptions: { - "target": ts.ScriptTarget.ES2017 - }, - fileName: `${name}.ts`, - transformers: { before: [processUISyntax(null, true)] } - }); - componentInfo.id = 0; - componentCollection.customComponents.clear(); - resetComponentCollection(); - expect(result.outputText).eql(content.expectResult); -} - -describe('compiler', () => { - const utPath: string = path.resolve(__dirname, './ut'); - const utFiles: string[] = []; - readFile(utPath, utFiles); - utFiles.forEach((item) => { - const fileName: string = path.basename(item, '.ts'); - it(fileName, () => { - expectActual(fileName, item); - }) - }) -}) diff --git a/compiler/compiler/test/ut/animation/animation.ts b/compiler/compiler/test/ut/animation/animation.ts deleted file mode 100644 index a2cad53be..000000000 --- a/compiler/compiler/test/ut/animation/animation.ts +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - -export const source: string = ` -@Entry -@Component -struct Animation { - private bgColor: string = "#8888ff" - private width: number - private height: number - - build() { - Column() { - Text("Text explicit animation").onClick(() => { - let dx = 50; - let dy = 100; - this.bgColor = (this.bgColor == "#8888ff") ? "#ff8888" : "#8888ff"; - animateTo( - {duration: 1000, delay: 0, curve: "ease"}, - () => { - this.width += dx; - } - ); - animateTo( - {duration: 2000, delay: 0, curve: "ease"}, - () => { - this.height += dy; - } - ); - }) - .width(this.width) - .fontSize(40) - .animation({duration: 1000, delay: 0, curve: "ease"}) - .opacity(10) - .fontColor('#8888ff') - .animation({duration: 100, delay: 10, curve: "ease"}) - .margin({}) - .height(this.height) - }.width(this.width) - .animation({duration: 2000, delay: 0, curve: "ease"}) - .opacity(10) - .animation({duration: 200, delay: 20, curve: "ease"}) - .margin({}) - .height(this.height) - .animation(null) - } -}` - -export const expectResult: string = -`class Animation extends View { - constructor(compilerAssignedUniqueChildId, parent, params) { - super(compilerAssignedUniqueChildId, parent); - this.bgColor = "#8888ff"; - this.width = undefined; - this.height = undefined; - this.updateWithValueParams(params); - } - updateWithValueParams(params) { - if (params.bgColor !== undefined) { - this.bgColor = params.bgColor; - } - if (params.width !== undefined) { - this.width = params.width; - } - if (params.height !== undefined) { - this.height = params.height; - } - } - aboutToBeDeleted() { - SubscriberManager.Get().delete(this.id()); - } - render() { - Column.create(); - Context.animation({ duration: 2000, delay: 0, curve: "ease" }); - Column.width(this.width); - Context.animation({ duration: 200, delay: 20, curve: "ease" }); - Column.opacity(10); - Context.animation(null); - Column.margin({}); - Column.height(this.height); - Text.create("Text explicit animation"); - Context.animation({ duration: 1000, delay: 0, curve: "ease" }); - Text.onClick(() => { - let dx = 50; - let dy = 100; - this.bgColor = (this.bgColor == "#8888ff") ? "#ff8888" : "#8888ff"; - Context.animateTo({ duration: 1000, delay: 0, curve: "ease" }, () => { - this.width += dx; - }); - Context.animateTo({ duration: 2000, delay: 0, curve: "ease" }, () => { - this.height += dy; - }); - }); - Text.width(this.width); - Text.fontSize(40); - Context.animation({ duration: 100, delay: 10, curve: "ease" }); - Text.opacity(10); - Text.fontColor('#8888ff'); - Context.animation(null); - Text.margin({}); - Text.height(this.height); - Text.pop(); - Column.pop(); - } -} -loadDocument(new Animation("1", undefined, {})); -` diff --git a/compiler/compiler/test/ut/build/build.ts b/compiler/compiler/test/ut/build/build.ts deleted file mode 100644 index 65bb964d4..000000000 --- a/compiler/compiler/test/ut/build/build.ts +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - -export const source: string = ` -@Entry -@Component -struct MyComponent { - private test: string = 'Hello' - build() { - Column() { - Text(this.test) - Button() - .width(20) - .height(20) - }.width(100) - } -}` - -export const expectResult: string = -`class MyComponent extends View { - constructor(compilerAssignedUniqueChildId, parent, params) { - super(compilerAssignedUniqueChildId, parent); - this.test = 'Hello'; - this.updateWithValueParams(params); - } - updateWithValueParams(params) { - if (params.test !== undefined) { - this.test = params.test; - } - } - aboutToBeDeleted() { - SubscriberManager.Get().delete(this.id()); - } - render() { - Column.create(); - Column.width(100); - Text.create(this.test); - Text.pop(); - Button.createWithLabel(); - Button.width(20); - Button.height(20); - Button.pop(); - Column.pop(); - } -} -loadDocument(new MyComponent("1", undefined, {})); -` \ No newline at end of file diff --git a/compiler/compiler/test/ut/component/component.ts b/compiler/compiler/test/ut/component/component.ts deleted file mode 100644 index 9b46eb749..000000000 --- a/compiler/compiler/test/ut/component/component.ts +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - -export const source: string = ` -@Component -@Entry -struct MyComponent { - private value1: string = "hello world 1" - private value2: string = "hello world 2" - private value3: string = "hello world 3" - - build() { - Column() { - Text(this.value1) - Text(this.value2) - Text(this.value3) - } - } -}` - -export const expectResult: string = -`class MyComponent extends View { - constructor(compilerAssignedUniqueChildId, parent, params) { - super(compilerAssignedUniqueChildId, parent); - this.value1 = "hello world 1"; - this.value2 = "hello world 2"; - this.value3 = "hello world 3"; - this.updateWithValueParams(params); - } - updateWithValueParams(params) { - if (params.value1 !== undefined) { - this.value1 = params.value1; - } - if (params.value2 !== undefined) { - this.value2 = params.value2; - } - if (params.value3 !== undefined) { - this.value3 = params.value3; - } - } - aboutToBeDeleted() { - SubscriberManager.Get().delete(this.id()); - } - render() { - Column.create(); - Text.create(this.value1); - Text.pop(); - Text.create(this.value2); - Text.pop(); - Text.create(this.value3); - Text.pop(); - Column.pop(); - } -} -loadDocument(new MyComponent("1", undefined, {})); -` diff --git a/compiler/compiler/test/ut/component/customComponent.ts b/compiler/compiler/test/ut/component/customComponent.ts deleted file mode 100644 index 6907d09b7..000000000 --- a/compiler/compiler/test/ut/component/customComponent.ts +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - -export const source: string = ` -@Entry -@Component -struct Parent { - public regularToState: string = 'regularToState' - @State stateToProp: string = 'stateToProp' - public regularToRegular: string = 'regularToRegular' - @State stateToLink: string = 'stateToLink' - build() { - Row() { - Child({ stateProperty: this.regularToState, - propProperty: this.stateToProp, - regularProperty: this.regularToRegular, - linkProperty: this.$stateToLink - }) - } - } -} - -@Component -struct Child { - @State stateProperty: string = 'state' - @Prop propProperty: string - public regularProperty: string = 'regular' - @Link linkProperty: string - build() { - Column() {} - } -} -` - -export const expectResult: string = -`class Parent extends View { - constructor(compilerAssignedUniqueChildId, parent, params) { - super(compilerAssignedUniqueChildId, parent); - this.regularToState = 'regularToState'; - this.__stateToProp = new ObservedPropertySimple('stateToProp', this, "stateToProp"); - this.regularToRegular = 'regularToRegular'; - this.__stateToLink = new ObservedPropertySimple('stateToLink', this, "stateToLink"); - this.updateWithValueParams(params); - } - updateWithValueParams(params) { - if (params.regularToState !== undefined) { - this.regularToState = params.regularToState; - } - if (params.stateToProp !== undefined) { - this.stateToProp = params.stateToProp; - } - if (params.regularToRegular !== undefined) { - this.regularToRegular = params.regularToRegular; - } - if (params.stateToLink !== undefined) { - this.stateToLink = params.stateToLink; - } - } - aboutToBeDeleted() { - this.__stateToProp.aboutToBeDeleted(); - this.__stateToLink.aboutToBeDeleted(); - SubscriberManager.Get().delete(this.id()); - } - get stateToProp() { - return this.__stateToProp.get(); - } - set stateToProp(newValue) { - this.__stateToProp.set(newValue); - } - get stateToLink() { - return this.__stateToLink.get(); - } - set stateToLink(newValue) { - this.__stateToLink.set(newValue); - } - render() { - Row.create(); - let earlierCreatedChild_2 = this.findChildById("2"); - if (earlierCreatedChild_2 == undefined) { - View.create(new Child("2", this, { stateProperty: this.regularToState, - propProperty: this.stateToProp, - regularProperty: this.regularToRegular, - linkProperty: this.__stateToLink - })); - } - else { - earlierCreatedChild_2.updateWithValueParams({ - stateProperty: this.regularToState, - propProperty: this.stateToProp, - regularProperty: this.regularToRegular - }); - View.create(earlierCreatedChild_2); - } - Row.pop(); - } -} -class Child extends View { - constructor(compilerAssignedUniqueChildId, parent, params) { - super(compilerAssignedUniqueChildId, parent); - this.__stateProperty = new ObservedPropertySimple('state', this, "stateProperty"); - this.__propProperty = new SynchedPropertySimpleOneWay(params.propProperty, this, "propProperty"); - this.regularProperty = 'regular'; - this.__linkProperty = new SynchedPropertySimpleTwoWay(params.linkProperty, this, "linkProperty"); - this.updateWithValueParams(params); - } - updateWithValueParams(params) { - if (params.stateProperty !== undefined) { - this.stateProperty = params.stateProperty; - } - this.propProperty = params.propProperty; - if (params.regularProperty !== undefined) { - this.regularProperty = params.regularProperty; - } - } - aboutToBeDeleted() { - this.__stateProperty.aboutToBeDeleted(); - this.__propProperty.aboutToBeDeleted(); - this.__linkProperty.aboutToBeDeleted(); - SubscriberManager.Get().delete(this.id()); - } - get stateProperty() { - return this.__stateProperty.get(); - } - set stateProperty(newValue) { - this.__stateProperty.set(newValue); - } - get propProperty() { - return this.__propProperty.get(); - } - set propProperty(newValue) { - this.__propProperty.set(newValue); - } - get linkProperty() { - return this.__linkProperty.get(); - } - set linkProperty(newValue) { - this.__linkProperty.set(newValue); - } - render() { - Column.create(); - Column.pop(); - } -} -loadDocument(new Parent("1", undefined, {})); -` diff --git a/compiler/compiler/test/ut/constructor/id.ts b/compiler/compiler/test/ut/constructor/id.ts deleted file mode 100644 index 3a7920333..000000000 --- a/compiler/compiler/test/ut/constructor/id.ts +++ /dev/null @@ -1,249 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - -export const source: string = ` -@Entry -@Component -struct HomeComponent { - private value1: string = "1" - value2: string = "2" - @Prop value3: number - @State value4: Array = [1, 2, 3] - @Link value5: string - value6: string - private value7: string - @State value8: string = "value8" - - build() { - Column() { - ForEach([], - item => { - Column() { - Banner() - Text('1') - if (this.value1) { - Banner({value2: '2'}) - Text('2') - } - } - }, - item => item - ) - Banner({value1: '2', value2: '3', value3: '4'}) - Text('3') - if (true) { - Banner({value1: '3', value2: '2', value3: '1'}) - Text('4') - } - } - .height(500) - } - } - -@Component -struct Banner { - private value1: string = "hello world 4" - private value2: string = "hello world 5" - private value3: string = "hello world 6" - - build() { - Column() { - Text(this.value1) - Text(this.value2) - Text(this.value3) - } - } -}` - -export const expectResult: string = -`class HomeComponent extends View { - constructor(compilerAssignedUniqueChildId, parent, params) { - super(compilerAssignedUniqueChildId, parent); - this.value1 = "1"; - this.value2 = "2"; - this.__value3 = new SynchedPropertySimpleOneWay(params.value3, this, "value3"); - this.__value4 = new ObservedPropertyObject([1, 2, 3], this, "value4"); - this.__value5 = new SynchedPropertySimpleTwoWay(params.value5, this, "value5"); - this.value6 = undefined; - this.value7 = undefined; - this.__value8 = new ObservedPropertySimple("value8", this, "value8"); - this.updateWithValueParams(params); - } - updateWithValueParams(params) { - if (params.value1 !== undefined) { - this.value1 = params.value1; - } - if (params.value2 !== undefined) { - this.value2 = params.value2; - } - this.value3 = params.value3; - if (params.value4 !== undefined) { - this.value4 = params.value4; - } - if (params.value6 !== undefined) { - this.value6 = params.value6; - } - if (params.value7 !== undefined) { - this.value7 = params.value7; - } - if (params.value8 !== undefined) { - this.value8 = params.value8; - } - } - aboutToBeDeleted() { - this.__value3.aboutToBeDeleted(); - this.__value4.aboutToBeDeleted(); - this.__value5.aboutToBeDeleted(); - this.__value8.aboutToBeDeleted(); - SubscriberManager.Get().delete(this.id()); - } - get value3() { - return this.__value3.get(); - } - set value3(newValue) { - this.__value3.set(newValue); - } - get value4() { - return this.__value4.get(); - } - set value4(newValue) { - this.__value4.set(newValue); - } - get value5() { - return this.__value5.get(); - } - set value5(newValue) { - this.__value5.set(newValue); - } - get value8() { - return this.__value8.get(); - } - set value8(newValue) { - this.__value8.set(newValue); - } - render() { - Column.create(); - Column.height(500); - ForEach.create("4", this, ObservedObject.GetRawObject([]), item => { - Column.create(); - let earlierCreatedChild_2 = this.findChildById("2"); - if (earlierCreatedChild_2 == undefined) { - View.create(new Banner("2", this, {})); - } - else { - earlierCreatedChild_2.updateWithValueParams({}); - if (!earlierCreatedChild_2.needsUpdate()) { - earlierCreatedChild_2.markStatic(); - } - View.create(earlierCreatedChild_2); - } - Text.create('1'); - Text.pop(); - If.create(); - if (this.value1) { - If.branchId(0); - let earlierCreatedChild_3 = this.findChildById("3"); - if (earlierCreatedChild_3 == undefined) { - View.create(new Banner("3", this, { value2: '2' })); - } - else { - earlierCreatedChild_3.updateWithValueParams({ - value2: '2' - }); - if (!earlierCreatedChild_3.needsUpdate()) { - earlierCreatedChild_3.markStatic(); - } - View.create(earlierCreatedChild_3); - } - Text.create('2'); - Text.pop(); - } - If.pop(); - Column.pop(); - }, item => item); - ForEach.pop(); - let earlierCreatedChild_5 = this.findChildById("5"); - if (earlierCreatedChild_5 == undefined) { - View.create(new Banner("5", this, { value1: '2', value2: '3', value3: '4' })); - } - else { - earlierCreatedChild_5.updateWithValueParams({ - value1: '2', value2: '3', value3: '4' - }); - if (!earlierCreatedChild_5.needsUpdate()) { - earlierCreatedChild_5.markStatic(); - } - View.create(earlierCreatedChild_5); - } - Text.create('3'); - Text.pop(); - If.create(); - if (true) { - If.branchId(0); - let earlierCreatedChild_6 = this.findChildById("6"); - if (earlierCreatedChild_6 == undefined) { - View.create(new Banner("6", this, { value1: '3', value2: '2', value3: '1' })); - } - else { - earlierCreatedChild_6.updateWithValueParams({ - value1: '3', value2: '2', value3: '1' - }); - if (!earlierCreatedChild_6.needsUpdate()) { - earlierCreatedChild_6.markStatic(); - } - View.create(earlierCreatedChild_6); - } - Text.create('4'); - Text.pop(); - } - If.pop(); - Column.pop(); - } -} -class Banner extends View { - constructor(compilerAssignedUniqueChildId, parent, params) { - super(compilerAssignedUniqueChildId, parent); - this.value1 = "hello world 4"; - this.value2 = "hello world 5"; - this.value3 = "hello world 6"; - this.updateWithValueParams(params); - } - updateWithValueParams(params) { - if (params.value1 !== undefined) { - this.value1 = params.value1; - } - if (params.value2 !== undefined) { - this.value2 = params.value2; - } - if (params.value3 !== undefined) { - this.value3 = params.value3; - } - } - aboutToBeDeleted() { - SubscriberManager.Get().delete(this.id()); - } - render() { - Column.create(); - Text.create(this.value1); - Text.pop(); - Text.create(this.value2); - Text.pop(); - Text.create(this.value3); - Text.pop(); - Column.pop(); - } -} -loadDocument(new HomeComponent("1", undefined, {})); -` diff --git a/compiler/compiler/test/ut/constructor/link.ts b/compiler/compiler/test/ut/constructor/link.ts deleted file mode 100644 index 117c65802..000000000 --- a/compiler/compiler/test/ut/constructor/link.ts +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - -export const source: string = ` -@Entry -@Component -struct MyLinkComponent { - @Link myLink1?: any - @Link myLink2?: number - @Link myLink3?: boolean - @Link myLink4?: string - - private myVar: number = 0 - private myVar2: number - - build() { - - } -}` - -export const expectResult: string = -`class MyLinkComponent extends View { - constructor(compilerAssignedUniqueChildId, parent, params) { - super(compilerAssignedUniqueChildId, parent); - this.__myLink1 = new SynchedPropertyObjectTwoWay(params.myLink1, this, "myLink1"); - this.__myLink2 = new SynchedPropertySimpleTwoWay(params.myLink2, this, "myLink2"); - this.__myLink3 = new SynchedPropertySimpleTwoWay(params.myLink3, this, "myLink3"); - this.__myLink4 = new SynchedPropertySimpleTwoWay(params.myLink4, this, "myLink4"); - this.myVar = 0; - this.myVar2 = undefined; - this.updateWithValueParams(params); - } - updateWithValueParams(params) { - if (params.myVar !== undefined) { - this.myVar = params.myVar; - } - if (params.myVar2 !== undefined) { - this.myVar2 = params.myVar2; - } - } - aboutToBeDeleted() { - this.__myLink1.aboutToBeDeleted(); - this.__myLink2.aboutToBeDeleted(); - this.__myLink3.aboutToBeDeleted(); - this.__myLink4.aboutToBeDeleted(); - SubscriberManager.Get().delete(this.id()); - } - get myLink1() { - return this.__myLink1.get(); - } - set myLink1(newValue) { - this.__myLink1.set(newValue); - } - get myLink2() { - return this.__myLink2.get(); - } - set myLink2(newValue) { - this.__myLink2.set(newValue); - } - get myLink3() { - return this.__myLink3.get(); - } - set myLink3(newValue) { - this.__myLink3.set(newValue); - } - get myLink4() { - return this.__myLink4.get(); - } - set myLink4(newValue) { - this.__myLink4.set(newValue); - } - render() { - } -} -loadDocument(new MyLinkComponent("1", undefined, {})); -` \ No newline at end of file diff --git a/compiler/compiler/test/ut/constructor/observedObjectLink.ts b/compiler/compiler/test/ut/constructor/observedObjectLink.ts deleted file mode 100644 index 1614e1512..000000000 --- a/compiler/compiler/test/ut/constructor/observedObjectLink.ts +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - -export const source: string = ` -let NextID : number = 0; - -@Observed class ClassA { - public id : number; - public c: number; - constructor(c: number) { - this.id = NextID++; - this.c = c; - } -} - -@Observed class ClassB { - public a: ClassA; - constructor(a: ClassA) { - this.a = a; - } -} - -@Component -struct ViewA { - @ObjectLink varA : ClassA; - build() { - Row() {} - } -} - -@Entry -@Component -struct ViewB { - @State varB : ClassB = new ClassB(new ClassA(0)); - build() { - Column() { - Row() { - ViewA({ varA: this.varB.a }) - } - } - } -} -` - -export const expectResult: string = -`var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; -}; -let NextID = 0; -let ClassA = class ClassA { - constructor(c) { - this.id = NextID++; - this.c = c; - } -}; -ClassA = __decorate([ - Observed -], ClassA); -let ClassB = class ClassB { - constructor(a) { - this.a = a; - } -}; -ClassB = __decorate([ - Observed -], ClassB); -class ViewA extends View { - constructor(compilerAssignedUniqueChildId, parent, params) { - super(compilerAssignedUniqueChildId, parent); - this.__varA = new SynchedPropertyNesedObject(params.varA, this, "varA"); - this.updateWithValueParams(params); - } - updateWithValueParams(params) { - this.__varA.set(params.varA); - } - aboutToBeDeleted() { - this.__varA.aboutToBeDeleted(); - SubscriberManager.Get().delete(this.id()); - } - get varA() { - return this.__varA.get(); - } - render() { - Row.create(); - Row.pop(); - } -} -class ViewB extends View { - constructor(compilerAssignedUniqueChildId, parent, params) { - super(compilerAssignedUniqueChildId, parent); - this.__varB = new ObservedPropertyObject(new ClassB(new ClassA(0)), this, "varB"); - this.updateWithValueParams(params); - } - updateWithValueParams(params) { - if (params.varB !== undefined) { - this.varB = params.varB; - } - } - aboutToBeDeleted() { - this.__varB.aboutToBeDeleted(); - SubscriberManager.Get().delete(this.id()); - } - get varB() { - return this.__varB.get(); - } - set varB(newValue) { - this.__varB.set(newValue); - } - render() { - Column.create(); - Row.create(); - let earlierCreatedChild_2 = this.findChildById("2"); - if (earlierCreatedChild_2 == undefined) { - View.create(new ViewA("2", this, { varA: this.varB.a })); - } - else { - earlierCreatedChild_2.updateWithValueParams({ - varA: this.varB.a - }); - View.create(earlierCreatedChild_2); - } - Row.pop(); - Column.pop(); - } -} -loadDocument(new ViewB("1", undefined, {})); -` \ No newline at end of file diff --git a/compiler/compiler/test/ut/constructor/prop.ts b/compiler/compiler/test/ut/constructor/prop.ts deleted file mode 100644 index 8765e74e5..000000000 --- a/compiler/compiler/test/ut/constructor/prop.ts +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - -export const source: string = ` -@Entry -@Component -struct MyPropComponent { - @Prop myProp1?: any - @Prop myProp2?: number - @Prop myProp3?: boolean - @Prop myProp4?: string - - private myVar: number = 0 - private myVar2: number - - build() { - - } -}` - -export const expectResult: string = -`class MyPropComponent extends View { - constructor(compilerAssignedUniqueChildId, parent, params) { - super(compilerAssignedUniqueChildId, parent); - this.__myProp2 = new SynchedPropertySimpleOneWay(params.myProp2, this, "myProp2"); - this.__myProp3 = new SynchedPropertySimpleOneWay(params.myProp3, this, "myProp3"); - this.__myProp4 = new SynchedPropertySimpleOneWay(params.myProp4, this, "myProp4"); - this.myVar = 0; - this.myVar2 = undefined; - this.updateWithValueParams(params); - } - updateWithValueParams(params) { - this.myProp1 = params.myProp1; - this.myProp2 = params.myProp2; - this.myProp3 = params.myProp3; - this.myProp4 = params.myProp4; - if (params.myVar !== undefined) { - this.myVar = params.myVar; - } - if (params.myVar2 !== undefined) { - this.myVar2 = params.myVar2; - } - } - aboutToBeDeleted() { - this.__myProp1.aboutToBeDeleted(); - this.__myProp2.aboutToBeDeleted(); - this.__myProp3.aboutToBeDeleted(); - this.__myProp4.aboutToBeDeleted(); - SubscriberManager.Get().delete(this.id()); - } - get myProp1() { - return this.__myProp1.get(); - } - set myProp1(newValue) { - this.__myProp1.set(newValue); - } - get myProp2() { - return this.__myProp2.get(); - } - set myProp2(newValue) { - this.__myProp2.set(newValue); - } - get myProp3() { - return this.__myProp3.get(); - } - set myProp3(newValue) { - this.__myProp3.set(newValue); - } - get myProp4() { - return this.__myProp4.get(); - } - set myProp4(newValue) { - this.__myProp4.set(newValue); - } - render() { - } -} -loadDocument(new MyPropComponent("1", undefined, {})); -` diff --git a/compiler/compiler/test/ut/constructor/provideConsume.ts b/compiler/compiler/test/ut/constructor/provideConsume.ts deleted file mode 100644 index a8f884a1e..000000000 --- a/compiler/compiler/test/ut/constructor/provideConsume.ts +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - -export const source: string = ` -@Component -struct GrandChild { - @Consume arr: number[]; - build() { - } -} - -@Component -struct Child { - build() { - Column() { - GrandChild() - } - } -} - -@Entry -@Component -struct Parent { - @Provide(provideAlias) arr: number[] = [1, 2, 3]; - build() { - Column() { - Child() - } - } -} -` - -export const expectResult: string = -`class GrandChild extends View { - constructor(compilerAssignedUniqueChildId, parent, params) { - super(compilerAssignedUniqueChildId, parent); - this.__arr = this.initializeConsume("arr", "arr"); - this.updateWithValueParams(params); - } - updateWithValueParams(params) { - } - aboutToBeDeleted() { - this.__arr.aboutToBeDeleted(); - SubscriberManager.Get().delete(this.id()); - } - get arr() { - return this.__arr.get(); - } - set arr(newValue) { - this.__arr.set(newValue); - } - render() { - } -} -class Child extends View { - constructor(compilerAssignedUniqueChildId, parent, params) { - super(compilerAssignedUniqueChildId, parent); - this.updateWithValueParams(params); - } - updateWithValueParams(params) { - } - aboutToBeDeleted() { - SubscriberManager.Get().delete(this.id()); - } - render() { - Column.create(); - let earlierCreatedChild_2 = this.findChildById("2"); - if (earlierCreatedChild_2 == undefined) { - View.create(new GrandChild("2", this, {})); - } - else { - earlierCreatedChild_2.updateWithValueParams({}); - View.create(earlierCreatedChild_2); - } - Column.pop(); - } -} -class Parent extends View { - constructor(compilerAssignedUniqueChildId, parent, params) { - super(compilerAssignedUniqueChildId, parent); - this.__arr = new ObservedPropertyObject([1, 2, 3], this, "arr"); - this.addProvidedVar("provideAlias", this.__arr); - this.addProvidedVar("arr", this.__arr); - this.updateWithValueParams(params); - } - updateWithValueParams(params) { - if (params.arr !== undefined) { - this.arr = params.arr; - } - } - aboutToBeDeleted() { - this.__arr.aboutToBeDeleted(); - SubscriberManager.Get().delete(this.id()); - } - get arr() { - return this.__arr.get(); - } - set arr(newValue) { - this.__arr.set(newValue); - } - render() { - Column.create(); - let earlierCreatedChild_3 = this.findChildById("3"); - if (earlierCreatedChild_3 == undefined) { - View.create(new Child("3", this, {})); - } - else { - earlierCreatedChild_3.updateWithValueParams({}); - if (!earlierCreatedChild_3.needsUpdate()) { - earlierCreatedChild_3.markStatic(); - } - View.create(earlierCreatedChild_3); - } - Column.pop(); - } -} -loadDocument(new Parent("1", undefined, {})); -` \ No newline at end of file diff --git a/compiler/compiler/test/ut/constructor/state.ts b/compiler/compiler/test/ut/constructor/state.ts deleted file mode 100644 index 9f67c7c04..000000000 --- a/compiler/compiler/test/ut/constructor/state.ts +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - -export const source: string = ` -class DataModel{ - private myData1: number = 0 -} - -@Entry -@Component -struct MyStateComponent { - @State myState1: any = { count: 0 } - @State myState2: number = 0 - @State myState3: boolean = false - @State myState4: string = 'Home' - @State myState5: DataModel = new DataModel() - - private myVar : number = 0 - private myVar2 : number - - build() { - - } -}` - -export const expectResult: string = -`class DataModel { - constructor() { - this.myData1 = 0; - } -} -class MyStateComponent extends View { - constructor(compilerAssignedUniqueChildId, parent, params) { - super(compilerAssignedUniqueChildId, parent); - this.__myState1 = new ObservedPropertyObject({ count: 0 }, this, "myState1"); - this.__myState2 = new ObservedPropertySimple(0, this, "myState2"); - this.__myState3 = new ObservedPropertySimple(false, this, "myState3"); - this.__myState4 = new ObservedPropertySimple('Home', this, "myState4"); - this.__myState5 = new ObservedPropertyObject(new DataModel(), this, "myState5"); - this.myVar = 0; - this.myVar2 = undefined; - this.updateWithValueParams(params); - } - updateWithValueParams(params) { - if (params.myState1 !== undefined) { - this.myState1 = params.myState1; - } - if (params.myState2 !== undefined) { - this.myState2 = params.myState2; - } - if (params.myState3 !== undefined) { - this.myState3 = params.myState3; - } - if (params.myState4 !== undefined) { - this.myState4 = params.myState4; - } - if (params.myState5 !== undefined) { - this.myState5 = params.myState5; - } - if (params.myVar !== undefined) { - this.myVar = params.myVar; - } - if (params.myVar2 !== undefined) { - this.myVar2 = params.myVar2; - } - } - aboutToBeDeleted() { - this.__myState1.aboutToBeDeleted(); - this.__myState2.aboutToBeDeleted(); - this.__myState3.aboutToBeDeleted(); - this.__myState4.aboutToBeDeleted(); - this.__myState5.aboutToBeDeleted(); - SubscriberManager.Get().delete(this.id()); - } - get myState1() { - return this.__myState1.get(); - } - set myState1(newValue) { - this.__myState1.set(newValue); - } - get myState2() { - return this.__myState2.get(); - } - set myState2(newValue) { - this.__myState2.set(newValue); - } - get myState3() { - return this.__myState3.get(); - } - set myState3(newValue) { - this.__myState3.set(newValue); - } - get myState4() { - return this.__myState4.get(); - } - set myState4(newValue) { - this.__myState4.set(newValue); - } - get myState5() { - return this.__myState5.get(); - } - set myState5(newValue) { - this.__myState5.set(newValue); - } - render() { - } -} -loadDocument(new MyStateComponent("1", undefined, {})); -` \ No newline at end of file diff --git a/compiler/compiler/test/ut/customDialog/customDialog.ts b/compiler/compiler/test/ut/customDialog/customDialog.ts deleted file mode 100644 index b57f51314..000000000 --- a/compiler/compiler/test/ut/customDialog/customDialog.ts +++ /dev/null @@ -1,159 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - -export const source: string = ` -@CustomDialog -struct DialogExample { - controller: CustomDialogController; - termsToAccept: string = "" - action1: () => void; - action2: (x: number, s: string) => void; - -build() { - Row() { - Button ("Option A") - .onClick(() => { - this.controller.close(); - this.action1(); - }) - Button ("Option B") - .onClick(() => { - this.controller.close(); - this.action2(47, "Option B is great choice"); - }) - } - } -} - -@Entry -@Component -struct CustomDialogUser { - dialogController : CustomDialogController = new CustomDialogController({ - builder: DialogExample({termsToAccept: "Please accept the terms.", action1: this.onAccept, action2: this.existApp}), - cancel: this.existApp, - autoCancel: false - }); - - onAccept() { - console.log("onAccept"); - } - existApp() { - console.log("Cancel dialog!"); - } - - build() { - Column() { - Button("Click to open Dialog") - .onClick(() => { - this.dialogController.open() - }) - Button("Click to close Dialog") - onClick(() => { - this.dialogController.close() - }) - } - } -} -` - -export const expectResult: string = -`class DialogExample extends View { - constructor(compilerAssignedUniqueChildId, parent, params) { - super(compilerAssignedUniqueChildId, parent); - this.controller = undefined; - this.termsToAccept = ""; - this.action1 = undefined; - this.action2 = undefined; - this.updateWithValueParams(params); - } - updateWithValueParams(params) { - if (params.controller !== undefined) { - this.controller = params.controller; - } - if (params.termsToAccept !== undefined) { - this.termsToAccept = params.termsToAccept; - } - if (params.action1 !== undefined) { - this.action1 = params.action1; - } - if (params.action2 !== undefined) { - this.action2 = params.action2; - } - } - aboutToBeDeleted() { - SubscriberManager.Get().delete(this.id()); - } - setController(ctr) { - this.controller = ctr; - } - render() { - Row.create(); - Button.createWithLabel("Option A"); - Button.onClick(() => { - this.controller.close(); - this.action1(); - }); - Button.pop(); - Button.createWithLabel("Option B"); - Button.onClick(() => { - this.controller.close(); - this.action2(47, "Option B is great choice"); - }); - Button.pop(); - Row.pop(); - } -} -class CustomDialogUser extends View { - constructor(compilerAssignedUniqueChildId, parent, params) { - super(compilerAssignedUniqueChildId, parent); - this.dialogController = new CustomDialogController({ - builder: () => { - let jsDialog = new DialogExample("2", this, { termsToAccept: "Please accept the terms.", action1: this.onAccept, action2: this.existApp }); - jsDialog.setController(this.dialogController); - View.create(jsDialog); - }, - cancel: this.existApp, - autoCancel: false - }, this); - this.updateWithValueParams(params); - } - updateWithValueParams(params) { - if (params.dialogController !== undefined) { - this.dialogController = params.dialogController; - } - } - aboutToBeDeleted() { - SubscriberManager.Get().delete(this.id()); - } - onAccept() { - console.log("onAccept"); - } - existApp() { - console.log("Cancel dialog!"); - } - render() { - Column.create(); - Button.createWithLabel("Click to open Dialog"); - Button.onClick(() => { - this.dialogController.open(); - }); - Button.pop(); - Button.createWithLabel("Click to close Dialog"); - Button.pop(); - Column.pop(); - } -} -loadDocument(new CustomDialogUser("1", undefined, {})); -` diff --git a/compiler/compiler/test/ut/decorator/builder.ts b/compiler/compiler/test/ut/decorator/builder.ts deleted file mode 100644 index 0bf64721d..000000000 --- a/compiler/compiler/test/ut/decorator/builder.ts +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - -export const source: string = ` -@Builder -function SquareText(label: string, size: number) { - Text(label) - .width(1 * size).height(1 * size) -} - -@Builder -function bb() { - Text("label") -} - -@Entry -@Component -struct HomeComponent { - size = 1 - - @Builder aa(label: string) { - Text(label) - } - - build() { - Column() { - bb() - SquareText("A", this.size) - this.aa("A") - } - .height(500) - } -}` - -export const expectResult: string = -`function SquareText(label, size) { - Text.create(label); - Text.width(1 * size); - Text.height(1 * size); - Text.pop(); -} -function bb() { - Text.create("label"); - Text.pop(); -} -class HomeComponent extends View { - constructor(compilerAssignedUniqueChildId, parent, params) { - super(compilerAssignedUniqueChildId, parent); - this.size = 1; - this.updateWithValueParams(params); - } - updateWithValueParams(params) { - if (params.size !== undefined) { - this.size = params.size; - } - } - aboutToBeDeleted() { - SubscriberManager.Get().delete(this.id()); - } - aa(label) { - Text.create(label); - Text.pop(); - } - render() { - Column.create(); - Column.height(500); - bb(); - SquareText("A", this.size); - this.aa("A"); - Column.pop(); - } -} -loadDocument(new HomeComponent("1", undefined, {})); -` diff --git a/compiler/compiler/test/ut/decorator/extend.ts b/compiler/compiler/test/ut/decorator/extend.ts deleted file mode 100644 index a8494672c..000000000 --- a/compiler/compiler/test/ut/decorator/extend.ts +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - -export const source: string = ` - @Extend Text.fancy(color:string){ - .backgroundColor(color) - } - -@Extend -Text.superFancy(size:number){ - .fontSize(size) - .fancy(Color.Red) -} - -@Extend(Button) -function fancy(color:string){ - .backgroundColor(color) - .width(200) - .height(100) -} - -@Entry -@Component -struct FancyText { - build() { - Row() { - Text("Just Fancy").fancy(Color.Yellow) - Text("Super Fancy Text").height(70).superFancy(24) - Button("Fancy Button").fancy(Color.Green) - } - } -}` - -export const expectResult: string = -`function __Text__fancy(color) { - Text.backgroundColor(color); -} -function __Text__superFancy(size) { - Text.fontSize(size); - __Text__fancy(Color.Red); -} -function __Button__fancy(color) { - Button.backgroundColor(color); - Button.width(200); - Button.height(100); -} -class FancyText extends View { - constructor(compilerAssignedUniqueChildId, parent, params) { - super(compilerAssignedUniqueChildId, parent); - this.updateWithValueParams(params); - } - updateWithValueParams(params) { - } - aboutToBeDeleted() { - SubscriberManager.Get().delete(this.id()); - } - render() { - Row.create(); - Text.create("Just Fancy"); - __Text__fancy(Color.Yellow); - Text.pop(); - Text.create("Super Fancy Text"); - Text.height(70); - __Text__superFancy(24); - Text.pop(); - Button.createWithLabel("Fancy Button"); - __Button__fancy(Color.Green); - Button.pop(); - Row.pop(); - } -} -loadDocument(new FancyText("1", undefined, {})); -` \ No newline at end of file diff --git a/compiler/compiler/test/ut/decorator/watch.ts b/compiler/compiler/test/ut/decorator/watch.ts deleted file mode 100644 index 90c246194..000000000 --- a/compiler/compiler/test/ut/decorator/watch.ts +++ /dev/null @@ -1,168 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - -export const source: string = ` -class PurchaseItem { - static NextId : number = 0; - - public id: number; - public price: number; - - constructor(price : number) { - this.id = PurchaseItem.NextId++; - this.price = price; - } -} - -@Component -struct BasketViewer { - @Link @Watch("onBasketUpdated") shopBasket : PurchaseItem[]; - @State @Watch('updateTotal') totalPurchase : number = this.updateTotal(); - updateTotal() : number { - let sum = 0; - this.shopBasket.forEach((i) => { sum += i.price; }); - this.totalPurchase = (sum < 100) ? sum : 0.9 * sum; - return this.totalPurchase; - } - // @Watch cb - onBasketUpdated(propName: string) : void { - this.updateTotal(); - } - build() { - Column() { - ForEach(this.shopBasket, - (item) => { - Text(item.price) - }, - item => item.id.toString() - ) - Text('this.totalPurchase') - } - } -} - -@Entry -@Component -struct BasketModifier { - @State shopBasket : PurchaseItem[] = [ ]; - build() { - Column() { - Button("add to basket") - .onClick(() => { this.shopBasket.push(new PurchaseItem(Math.round(100 * Math.random()))) }) - BasketViewer({shopBasket: this.$shopBasket}) - } - } -}` - -export const expectResult: string = -`class PurchaseItem { - constructor(price) { - this.id = PurchaseItem.NextId++; - this.price = price; - } -} -PurchaseItem.NextId = 0; -class BasketViewer extends View { - constructor(compilerAssignedUniqueChildId, parent, params) { - super(compilerAssignedUniqueChildId, parent); - this.__shopBasket = new SynchedPropertyObjectTwoWay(params.shopBasket, this, "shopBasket"); - this.__totalPurchase = new ObservedPropertySimple(this.updateTotal(), this, "totalPurchase"); - this.updateWithValueParams(params); - this.declareWatch("shopBasket", this.onBasketUpdated); - this.declareWatch("totalPurchase", this.updateTotal); - } - updateWithValueParams(params) { - if (params.totalPurchase !== undefined) { - this.totalPurchase = params.totalPurchase; - } - } - aboutToBeDeleted() { - this.__shopBasket.aboutToBeDeleted(); - this.__totalPurchase.aboutToBeDeleted(); - SubscriberManager.Get().delete(this.id()); - } - get shopBasket() { - return this.__shopBasket.get(); - } - set shopBasket(newValue) { - this.__shopBasket.set(newValue); - } - get totalPurchase() { - return this.__totalPurchase.get(); - } - set totalPurchase(newValue) { - this.__totalPurchase.set(newValue); - } - updateTotal() { - let sum = 0; - this.shopBasket.forEach((i) => { sum += i.price; }); - this.totalPurchase = (sum < 100) ? sum : 0.9 * sum; - return this.totalPurchase; - } - // @Watch cb - onBasketUpdated(propName) { - this.updateTotal(); - } - render() { - Column.create(); - ForEach.create("2", this, ObservedObject.GetRawObject(this.shopBasket), (item) => { - Text.create(item.price); - Text.pop(); - }, item => item.id.toString()); - ForEach.pop(); - Text.create('this.totalPurchase'); - Text.pop(); - Column.pop(); - } -} -class BasketModifier extends View { - constructor(compilerAssignedUniqueChildId, parent, params) { - super(compilerAssignedUniqueChildId, parent); - this.__shopBasket = new ObservedPropertyObject([], this, "shopBasket"); - this.updateWithValueParams(params); - } - updateWithValueParams(params) { - if (params.shopBasket !== undefined) { - this.shopBasket = params.shopBasket; - } - } - aboutToBeDeleted() { - this.__shopBasket.aboutToBeDeleted(); - SubscriberManager.Get().delete(this.id()); - } - get shopBasket() { - return this.__shopBasket.get(); - } - set shopBasket(newValue) { - this.__shopBasket.set(newValue); - } - render() { - Column.create(); - Button.createWithLabel("add to basket"); - Button.onClick(() => { this.shopBasket.push(new PurchaseItem(Math.round(100 * Math.random()))); }); - Button.pop(); - let earlierCreatedChild_3 = this.findChildById("3"); - if (earlierCreatedChild_3 == undefined) { - View.create(new BasketViewer("3", this, { shopBasket: this.__shopBasket })); - } - else { - earlierCreatedChild_3.updateWithValueParams({}); - View.create(earlierCreatedChild_3); - } - Column.pop(); - } -} -loadDocument(new BasketModifier("1", undefined, {})); -` \ No newline at end of file diff --git a/compiler/compiler/test/ut/decorator/watchWithAnimateTo.ts b/compiler/compiler/test/ut/decorator/watchWithAnimateTo.ts deleted file mode 100644 index dc728962d..000000000 --- a/compiler/compiler/test/ut/decorator/watchWithAnimateTo.ts +++ /dev/null @@ -1,148 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - -export const source: string = ` -@Entry -@Component -struct ListComponent { - @State dialogVis : boolean = false - build() { - Stack() { - MyAlertDialog({dialogVis: $dialogVis}) - } - } -} - -@Component -struct MyAlertDialog { - @Link @Watch("onDialogVisUpdated") dialogVis : boolean; - onDialogVisUpdated(propName: string) : void { - animateTo({}, () => {}) - } - build() { - Stack() { - DialogView({dialogShow: $dialogVis}).onClick(() => { - animateTo({}, () => {}) - }) - } - } -} - -@Component -struct DialogView { - @Link dialogShow: boolean - build() { - Column() {} - } -} -` - -export const expectResult: string = -`class ListComponent extends View { - constructor(compilerAssignedUniqueChildId, parent, params) { - super(compilerAssignedUniqueChildId, parent); - this.__dialogVis = new ObservedPropertySimple(false, this, "dialogVis"); - this.updateWithValueParams(params); - } - updateWithValueParams(params) { - if (params.dialogVis !== undefined) { - this.dialogVis = params.dialogVis; - } - } - aboutToBeDeleted() { - this.__dialogVis.aboutToBeDeleted(); - SubscriberManager.Get().delete(this.id()); - } - get dialogVis() { - return this.__dialogVis.get(); - } - set dialogVis(newValue) { - this.__dialogVis.set(newValue); - } - render() { - Stack.create(); - let earlierCreatedChild_2 = this.findChildById("2"); - if (earlierCreatedChild_2 == undefined) { - View.create(new MyAlertDialog("2", this, { dialogVis: this.__dialogVis })); - } - else { - earlierCreatedChild_2.updateWithValueParams({}); - View.create(earlierCreatedChild_2); - } - Stack.pop(); - } -} -class MyAlertDialog extends View { - constructor(compilerAssignedUniqueChildId, parent, params) { - super(compilerAssignedUniqueChildId, parent); - this.__dialogVis = new SynchedPropertySimpleTwoWay(params.dialogVis, this, "dialogVis"); - this.updateWithValueParams(params); - this.declareWatch("dialogVis", this.onDialogVisUpdated); - } - updateWithValueParams(params) { - } - aboutToBeDeleted() { - this.__dialogVis.aboutToBeDeleted(); - SubscriberManager.Get().delete(this.id()); - } - get dialogVis() { - return this.__dialogVis.get(); - } - set dialogVis(newValue) { - this.__dialogVis.set(newValue); - } - onDialogVisUpdated(propName) { - Context.animateTo({}, () => { }); - } - render() { - Stack.create(); - let earlierCreatedChild_2 = this.findChildById("2"); - if (earlierCreatedChild_2 == undefined) { - View.create(new (DialogView({ dialogShow: this.__dialogVis }).onClick)(() => { - Context.animateTo({}, () => { }); - })); - } - else { - earlierCreatedChild_2.updateWithValueParams({}); - View.create(earlierCreatedChild_2); - } - Stack.pop(); - } -} -class DialogView extends View { - constructor(compilerAssignedUniqueChildId, parent, params) { - super(compilerAssignedUniqueChildId, parent); - this.__dialogShow = new SynchedPropertySimpleTwoWay(params.dialogShow, this, "dialogShow"); - this.updateWithValueParams(params); - } - updateWithValueParams(params) { - } - aboutToBeDeleted() { - this.__dialogShow.aboutToBeDeleted(); - SubscriberManager.Get().delete(this.id()); - } - get dialogShow() { - return this.__dialogShow.get(); - } - set dialogShow(newValue) { - this.__dialogShow.set(newValue); - } - render() { - Column.create(); - Column.pop(); - } -} -loadDocument(new ListComponent("1", undefined, {})); -` \ No newline at end of file diff --git a/compiler/compiler/test/ut/geometryReader/geometryReader.ts b/compiler/compiler/test/ut/geometryReader/geometryReader.ts deleted file mode 100644 index e8b5b6c4f..000000000 --- a/compiler/compiler/test/ut/geometryReader/geometryReader.ts +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - -export const source: string = ` -@Entry -@Component -struct GeometryReaderTest { - build() { - Column() { - GeometryView((obj) => { - Column() { - Text("Text in GeometryView, Height:" + obj.height) - .fontSize(30) - } - }).backgroundColor(Color.Yellow) - } - } -} -` - -export const expectResult: string = -`class GeometryReaderTest extends View { - constructor(compilerAssignedUniqueChildId, parent, params) { - super(compilerAssignedUniqueChildId, parent); - this.updateWithValueParams(params); - } - updateWithValueParams(params) { - } - aboutToBeDeleted() { - SubscriberManager.Get().delete(this.id()); - } - render() { - Column.create(); - GeometryView.create((obj) => { - Column.create(); - Text.create("Text in GeometryView, Height:" + obj.height); - Text.fontSize(30); - Text.pop(); - Column.pop(); - }); - GeometryView.backgroundColor(Color.Yellow); - Column.pop(); - } -} -loadDocument(new GeometryReaderTest("1", undefined, {})); -` diff --git a/compiler/compiler/test/ut/gesture/panGestrue.ts b/compiler/compiler/test/ut/gesture/panGestrue.ts deleted file mode 100644 index f558964a4..000000000 --- a/compiler/compiler/test/ut/gesture/panGestrue.ts +++ /dev/null @@ -1,279 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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/LICENSE2.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. - */ - -export const source: string = ` -import router from '@system.router' -import app from '@system.app' - -@Entry -@Component -struct MyComponent { - @State offsetX1: double = 0 - @State offsetY1: double = 0 - @State offsetX2: double = 0 - @State offsetY2: double = 0 - @State offsetX3: double = 0 - @State offsetY3: double = 0 - - build() { - Column() { - Text('fingers:1,all,offsetX: ' + this.offsetX1 + ' offsetY: ' + this.offsetY1) - .fontSize(25) - .width(200) - .height(200) - .backgroundColor('red') - .gesture( - PanGesture({fingers: 1, direction: Direction.All, distance: 15}) - .onActionStart((event: GestureEvent) => { - this.offsetX1 = event.offsetX - this.offsetY1 = event.offsetY - console.error('pan gesture on clicked') - }) - .onActionUpdate((event: GestureEvent) => { - this.offsetX1 = event.offsetX - this.offsetY1 = event.offsetY - console.error('pan gesture on clicked') - }) - .onActionEnd((event: GestureEvent) => { - this.offsetX1 = event.offsetX - this.offsetY1 = event.offsetY - console.error('pan gesture on clicked') - }) - .onActionCancel(() => { - }) - ) - - Text('fingers:1,horizontal,offsetX: ' + this.offsetX2 + ' offsetY: ' + this.offsetY2) - .fontSize(25) - .width(400) - .height(200) - .backgroundColor('green') - .gesture( - PanGesture({fingers: 1, direction: Direction.Horizontal, distance: 15}) - .onActionStart((event: GestureEvent) => { - this.offsetX2 = event.offsetX - this.offsetY2 = event.offsetY - console.error('pan gesture on clicked') - }) - .onActionUpdate((event: GestureEvent) => { - this.offsetX2 = event.offsetX - this.offsetY2 = event.offsetY - console.error('pan gesture on clicked') - }) - .onActionEnd((event: GestureEvent) => { - this.offsetX2 = event.offsetX - this.offsetY2 = event.offsetY - console.error('pan gesture on clicked') - }) - .onActionCancel(() => { - }) - ) - - Text('fingers:1,vertical,offsetX: ' + this.offsetX3 + ' offsetY: ' + this.offsetY3) - .fontSize(25) - .width(200) - .height(400) - .backgroundColor('blue') - .gesture( - PanGesture({fingers: 1, direction: Direction.Vertical, distance: 15}) - .onActionStart((event: GestureEvent) => { - this.offsetX3 = event.offsetX - this.offsetY3 = event.offsetY - console.error('pan gesture on clicked') - }) - .onActionUpdate((event: GestureEvent) => { - this.offsetX3 = event.offsetX - this.offsetY3 = event.offsetY - console.error('pan gesture on clicked') - }) - .onActionEnd((event: GestureEvent) => { - this.offsetX3 = event.offsetX - this.offsetY3 = event.offsetY - console.error('pan gesture on clicked') - }) - .onActionCancel(() => { - }) - ) - } - } -}` - -export const expectResult: string = -`var router = globalThis.requireNativeModule('system.router'); -var app = globalThis.requireNativeModule('system.app'); -class MyComponent extends View { - constructor(compilerAssignedUniqueChildId, parent, params) { - super(compilerAssignedUniqueChildId, parent); - this.__offsetX1 = new ObservedPropertyObject(0, this, "offsetX1"); - this.__offsetY1 = new ObservedPropertyObject(0, this, "offsetY1"); - this.__offsetX2 = new ObservedPropertyObject(0, this, "offsetX2"); - this.__offsetY2 = new ObservedPropertyObject(0, this, "offsetY2"); - this.__offsetX3 = new ObservedPropertyObject(0, this, "offsetX3"); - this.__offsetY3 = new ObservedPropertyObject(0, this, "offsetY3"); - this.updateWithValueParams(params); - } - updateWithValueParams(params) { - if (params.offsetX1 !== undefined) { - this.offsetX1 = params.offsetX1; - } - if (params.offsetY1 !== undefined) { - this.offsetY1 = params.offsetY1; - } - if (params.offsetX2 !== undefined) { - this.offsetX2 = params.offsetX2; - } - if (params.offsetY2 !== undefined) { - this.offsetY2 = params.offsetY2; - } - if (params.offsetX3 !== undefined) { - this.offsetX3 = params.offsetX3; - } - if (params.offsetY3 !== undefined) { - this.offsetY3 = params.offsetY3; - } - } - aboutToBeDeleted() { - this.__offsetX1.aboutToBeDeleted(); - this.__offsetY1.aboutToBeDeleted(); - this.__offsetX2.aboutToBeDeleted(); - this.__offsetY2.aboutToBeDeleted(); - this.__offsetX3.aboutToBeDeleted(); - this.__offsetY3.aboutToBeDeleted(); - SubscriberManager.Get().delete(this.id()); - } - get offsetX1() { - return this.__offsetX1.get(); - } - set offsetX1(newValue) { - this.__offsetX1.set(newValue); - } - get offsetY1() { - return this.__offsetY1.get(); - } - set offsetY1(newValue) { - this.__offsetY1.set(newValue); - } - get offsetX2() { - return this.__offsetX2.get(); - } - set offsetX2(newValue) { - this.__offsetX2.set(newValue); - } - get offsetY2() { - return this.__offsetY2.get(); - } - set offsetY2(newValue) { - this.__offsetY2.set(newValue); - } - get offsetX3() { - return this.__offsetX3.get(); - } - set offsetX3(newValue) { - this.__offsetX3.set(newValue); - } - get offsetY3() { - return this.__offsetY3.get(); - } - set offsetY3(newValue) { - this.__offsetY3.set(newValue); - } - render() { - Column.create(); - Text.create('fingers:1,all,offsetX: ' + this.offsetX1 + ' offsetY: ' + this.offsetY1); - Text.fontSize(25); - Text.width(200); - Text.height(200); - Text.backgroundColor('red'); - Gesture.create(GesturePriority.Low); - PanGesture.create({ fingers: 1, direction: Direction.All, distance: 15 }); - PanGesture.onActionStart((event) => { - this.offsetX1 = event.offsetX; - this.offsetY1 = event.offsetY; - console.error('pan gesture on clicked'); - }); - PanGesture.onActionUpdate((event) => { - this.offsetX1 = event.offsetX; - this.offsetY1 = event.offsetY; - console.error('pan gesture on clicked'); - }); - PanGesture.onActionEnd((event) => { - this.offsetX1 = event.offsetX; - this.offsetY1 = event.offsetY; - console.error('pan gesture on clicked'); - }); - PanGesture.onActionCancel(() => { - }); - PanGesture.pop(); - Gesture.pop(); - Text.pop(); - Text.create('fingers:1,horizontal,offsetX: ' + this.offsetX2 + ' offsetY: ' + this.offsetY2); - Text.fontSize(25); - Text.width(400); - Text.height(200); - Text.backgroundColor('green'); - Gesture.create(GesturePriority.Low); - PanGesture.create({ fingers: 1, direction: Direction.Horizontal, distance: 15 }); - PanGesture.onActionStart((event) => { - this.offsetX2 = event.offsetX; - this.offsetY2 = event.offsetY; - console.error('pan gesture on clicked'); - }); - PanGesture.onActionUpdate((event) => { - this.offsetX2 = event.offsetX; - this.offsetY2 = event.offsetY; - console.error('pan gesture on clicked'); - }); - PanGesture.onActionEnd((event) => { - this.offsetX2 = event.offsetX; - this.offsetY2 = event.offsetY; - console.error('pan gesture on clicked'); - }); - PanGesture.onActionCancel(() => { - }); - PanGesture.pop(); - Gesture.pop(); - Text.pop(); - Text.create('fingers:1,vertical,offsetX: ' + this.offsetX3 + ' offsetY: ' + this.offsetY3); - Text.fontSize(25); - Text.width(200); - Text.height(400); - Text.backgroundColor('blue'); - Gesture.create(GesturePriority.Low); - PanGesture.create({ fingers: 1, direction: Direction.Vertical, distance: 15 }); - PanGesture.onActionStart((event) => { - this.offsetX3 = event.offsetX; - this.offsetY3 = event.offsetY; - console.error('pan gesture on clicked'); - }); - PanGesture.onActionUpdate((event) => { - this.offsetX3 = event.offsetX; - this.offsetY3 = event.offsetY; - console.error('pan gesture on clicked'); - }); - PanGesture.onActionEnd((event) => { - this.offsetX3 = event.offsetX; - this.offsetY3 = event.offsetY; - console.error('pan gesture on clicked'); - }); - PanGesture.onActionCancel(() => { - }); - PanGesture.pop(); - Gesture.pop(); - Text.pop(); - Column.pop(); - } -} -loadDocument(new MyComponent("1", undefined, {})); -` diff --git a/compiler/compiler/test/ut/gesture/pinchGesture.ts b/compiler/compiler/test/ut/gesture/pinchGesture.ts deleted file mode 100644 index c85947f2b..000000000 --- a/compiler/compiler/test/ut/gesture/pinchGesture.ts +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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/LICENSE2.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. - */ - -export const source: string = ` -import router from '@system.router' -import app from '@system.app' - -@Entry -@Component -struct MyComponent { - @State text_num: float = 0.0 - - build() { - Column() { - Text('fingers:2,scale: ' + this.text_num) - .fontSize(25) - .width(400) - .height(400) - .backgroundColor('red') - .gesture( - PinchGesture({fingers: 2, distance: 18}) - .onActionStart((event: GestureEvent) => { - this.text_num = event.scale - console.error('pinch gesture on clicked') - }) - .onActionUpdate((event: GestureEvent) => { - this.text_num = event.scale - console.error('pinch gesture on clicked') - }) - .onActionEnd((event: GestureEvent) => { - this.text_num = event.scale - console.error('pinch gesture on clicked') - }) - .onActionCancel(() => { - }) - ) - } - } -}` - -export const expectResult: string = -`var router = globalThis.requireNativeModule('system.router'); -var app = globalThis.requireNativeModule('system.app'); -class MyComponent extends View { - constructor(compilerAssignedUniqueChildId, parent, params) { - super(compilerAssignedUniqueChildId, parent); - this.__text_num = new ObservedPropertyObject(0.0, this, "text_num"); - this.updateWithValueParams(params); - } - updateWithValueParams(params) { - if (params.text_num !== undefined) { - this.text_num = params.text_num; - } - } - aboutToBeDeleted() { - this.__text_num.aboutToBeDeleted(); - SubscriberManager.Get().delete(this.id()); - } - get text_num() { - return this.__text_num.get(); - } - set text_num(newValue) { - this.__text_num.set(newValue); - } - render() { - Column.create(); - Text.create('fingers:2,scale: ' + this.text_num); - Text.fontSize(25); - Text.width(400); - Text.height(400); - Text.backgroundColor('red'); - Gesture.create(GesturePriority.Low); - PinchGesture.create({ fingers: 2, distance: 18 }); - PinchGesture.onActionStart((event) => { - this.text_num = event.scale; - console.error('pinch gesture on clicked'); - }); - PinchGesture.onActionUpdate((event) => { - this.text_num = event.scale; - console.error('pinch gesture on clicked'); - }); - PinchGesture.onActionEnd((event) => { - this.text_num = event.scale; - console.error('pinch gesture on clicked'); - }); - PinchGesture.onActionCancel(() => { - }); - PinchGesture.pop(); - Gesture.pop(); - Text.pop(); - Column.pop(); - } -} -loadDocument(new MyComponent("1", undefined, {})); -` diff --git a/compiler/compiler/test/ut/gesture/rotationGesture.ts b/compiler/compiler/test/ut/gesture/rotationGesture.ts deleted file mode 100644 index 87c0b76e9..000000000 --- a/compiler/compiler/test/ut/gesture/rotationGesture.ts +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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/LICENSE2.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. - */ - -export const source: string = ` -import router from '@system.router' -import app from '@system.app' - -@Entry -@Component -struct MyComponent { - @State text_num: number = 0.0 - - build() { - Column() { - Text('fingers:2,angle: ' + this.text_num) - .fontSize(25) - .width(400) - .height(400) - .backgroundColor('red') - .gesture( - RotationGesture({fingers: 2, angle: 5}) - .onActionStart((event: GestureEvent) => { - this.text_num = event.angle - console.error('rotation gesture on clicked') - }) - .onActionUpdate((event: GestureEvent) => { - this.text_num = event.angle - console.error('rotation gesture on clicked') - }) - .onActionEnd((event: GestureEvent) => { - this.text_num = event.angle - console.error('rotation gesture on clicked') - }) - .onActionCancel(() => { - }) - ) - - } - } -}` - -export const expectResult: string = -`var router = globalThis.requireNativeModule('system.router'); -var app = globalThis.requireNativeModule('system.app'); -class MyComponent extends View { - constructor(compilerAssignedUniqueChildId, parent, params) { - super(compilerAssignedUniqueChildId, parent); - this.__text_num = new ObservedPropertySimple(0.0, this, "text_num"); - this.updateWithValueParams(params); - } - updateWithValueParams(params) { - if (params.text_num !== undefined) { - this.text_num = params.text_num; - } - } - aboutToBeDeleted() { - this.__text_num.aboutToBeDeleted(); - SubscriberManager.Get().delete(this.id()); - } - get text_num() { - return this.__text_num.get(); - } - set text_num(newValue) { - this.__text_num.set(newValue); - } - render() { - Column.create(); - Text.create('fingers:2,angle: ' + this.text_num); - Text.fontSize(25); - Text.width(400); - Text.height(400); - Text.backgroundColor('red'); - Gesture.create(GesturePriority.Low); - RotationGesture.create({ fingers: 2, angle: 5 }); - RotationGesture.onActionStart((event) => { - this.text_num = event.angle; - console.error('rotation gesture on clicked'); - }); - RotationGesture.onActionUpdate((event) => { - this.text_num = event.angle; - console.error('rotation gesture on clicked'); - }); - RotationGesture.onActionEnd((event) => { - this.text_num = event.angle; - console.error('rotation gesture on clicked'); - }); - RotationGesture.onActionCancel(() => { - }); - RotationGesture.pop(); - Gesture.pop(); - Text.pop(); - Column.pop(); - } -} -loadDocument(new MyComponent("1", undefined, {})); -` diff --git a/compiler/compiler/test/ut/gesture/tapGesture.ts b/compiler/compiler/test/ut/gesture/tapGesture.ts deleted file mode 100644 index 436553286..000000000 --- a/compiler/compiler/test/ut/gesture/tapGesture.ts +++ /dev/null @@ -1,177 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - -export const source: string = ` -@Entry -@Component -struct MyComponent { - build() { - Column() { - Text("222").width(12) - .gesture( - GestureGroup( - GestureMode.Sequence, - LongPressGesture() - .onAction(()=> { - console.error('long press gesture recognized') - }) - , - PanGesture() - .onActionStart(()=> { - console.error('pan gesture start') - }), - GestureGroup( - GestureMode.Sequence, - LongPressGesture() - .onAction(()=> { - console.error('long press gesture recognized') - }) - , - PanGesture() - .onActionStart(()=> { - console.error('pan gesture start') - }) - ) - ) - .onCancel(()=> { - console.error('sequence gesture canceled') - }) - ) - .height(21) - Text("333").width(33).parallelGesture( - TapGesture({count: 1, fingers:2}) - .onAction((event)=> { - console.error('parallel gesture tap gesture recognized') - }) - ) - Text("444").priorityGesture( - TapGesture({count: 1, fingers:2}) - .onAction((event)=> { - console.error('two fingers tap gesture recognized') - }), - GestureMask.IgnoreInternal - ) - } - .width(12) - .gesture( - GestureGroup( - GestureMode.Sequence, - LongPressGesture() - .onAction(()=> { - console.error('long press gesture recognized') - }) - , - PanGesture() - .onActionStart(()=> { - console.error('pan gesture start') - }) - ) - .onCancel(()=> { - console.error('sequence gesture canceled') - }) - ) - .height(21) - } -}` - -export const expectResult: string = -`class MyComponent extends View { - constructor(compilerAssignedUniqueChildId, parent, params) { - super(compilerAssignedUniqueChildId, parent); - this.updateWithValueParams(params); - } - updateWithValueParams(params) { - } - aboutToBeDeleted() { - SubscriberManager.Get().delete(this.id()); - } - render() { - Column.create(); - Column.width(12); - Gesture.create(GesturePriority.Low); - GestureGroup.create(GestureMode.Sequence); - GestureGroup.onCancel(() => { - console.error('sequence gesture canceled'); - }); - LongPressGesture.create(); - LongPressGesture.onAction(() => { - console.error('long press gesture recognized'); - }); - LongPressGesture.pop(); - PanGesture.create(); - PanGesture.onActionStart(() => { - console.error('pan gesture start'); - }); - PanGesture.pop(); - GestureGroup.pop(); - Gesture.pop(); - Column.height(21); - Text.create("222"); - Text.width(12); - Gesture.create(GesturePriority.Low); - GestureGroup.create(GestureMode.Sequence); - GestureGroup.onCancel(() => { - console.error('sequence gesture canceled'); - }); - LongPressGesture.create(); - LongPressGesture.onAction(() => { - console.error('long press gesture recognized'); - }); - LongPressGesture.pop(); - PanGesture.create(); - PanGesture.onActionStart(() => { - console.error('pan gesture start'); - }); - PanGesture.pop(); - GestureGroup.create(GestureMode.Sequence); - LongPressGesture.create(); - LongPressGesture.onAction(() => { - console.error('long press gesture recognized'); - }); - LongPressGesture.pop(); - PanGesture.create(); - PanGesture.onActionStart(() => { - console.error('pan gesture start'); - }); - PanGesture.pop(); - GestureGroup.pop(); - GestureGroup.pop(); - Gesture.pop(); - Text.height(21); - Text.pop(); - Text.create("333"); - Text.width(33); - Gesture.create(GesturePriority.Parallel); - TapGesture.create({ count: 1, fingers: 2 }); - TapGesture.onAction((event) => { - console.error('parallel gesture tap gesture recognized'); - }); - TapGesture.pop(); - Gesture.pop(); - Text.pop(); - Text.create("444"); - Gesture.create(GesturePriority.High, GestureMask.IgnoreInternal); - TapGesture.create({ count: 1, fingers: 2 }); - TapGesture.onAction((event) => { - console.error('two fingers tap gesture recognized'); - }); - TapGesture.pop(); - Gesture.pop(); - Text.pop(); - Column.pop(); - } -} -loadDocument(new MyComponent("1", undefined, {})); -` diff --git a/compiler/compiler/test/ut/import/importEts.ts b/compiler/compiler/test/ut/import/importEts.ts deleted file mode 100644 index 783eb14a0..000000000 --- a/compiler/compiler/test/ut/import/importEts.ts +++ /dev/null @@ -1,408 +0,0 @@ -/* - * Copyright (c) 2020 Huawei Device Co., Ltd. - * 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. - */ - -export const source: string = ` -import - LinkComponentDefault, { - LinkComponent as LinkComponent1Ref, - LinkComponent2 as LinkComponent2Ref, - LinkComponent3 -} from './test/pages/LinkComponent.ets' -import DefaultComponent from "./test/pages/DefaultComponent.ets" -import * as AllComponent from './test/pages/NamespaceComponent' -import AMDComponentDefault = require('./test/pages/AMDComponent') -import { AllStarComponent } from './test/pages/ExportStarComponent' -import TsModule = require('./test/pages/TsModule') - -@Entry -@Component -struct ImportTest { - @State myState1: any = new TsModule(1).method() - @State myState2: number = 0 - @State myState3: boolean = false - @State myState4: string = 'ImportTest' - - build() { - Row() { - LinkComponent2Ref({ - LinkComponent2Link1: $myState1, - LinkComponent2Link2: this.$myState2, - LinkComponent2Link3: $myState3, - LinkComponent2Link4: $myState4, - indexState1: { count: 1 }, - indexState2: 1, - indexState3: true, - indexState4: 'LinkComponent2' - }) - Text('space') - LinkComponent1Ref({ - LinkComponent1Link1: $myState1, - LinkComponent1Link2: this.$myState2, - LinkComponent1Link3: $myState3, - LinkComponent1Link4: $myState4, - indexState1: { count: 1 }, - indexState2: 1, - indexState3: true, - indexState4: 'LinkComponent1' - }) - DefaultComponent({ - DefaultComponentLink1: $myState1, - DefaultComponentLink2: this.$myState2, - DefaultComponentLink3: $myState3, - DefaultComponentLink4: $myState4, - myVar: 100, - myVar2: 100 - }) - AllComponent.NamespaceComponent1({ - NamespaceComponent1Link1: $myState1, - NamespaceComponent1Link2: this.$myState2, - NamespaceComponent1Link3: $myState3, - NamespaceComponent1Link4: $myState4, - myVar: 100, - myVar2: 80 - }) - LinkComponentDefault({ - LinkComponent3Link1: $myState1, - LinkComponent3Link2: this.$myState2, - LinkComponent3Link3: $myState3, - LinkComponent3Link4: $myState4, - indexState1: { count: 1 }, - indexState2: 1, - indexState3: true, - indexState4: 'LinkComponent3' - }) - AMDComponentDefault({ - AMDComponentLink1: $myState1, - AMDComponentLink2: this.$myState2, - AMDComponentLink3: $myState3, - AMDComponentLink4: $myState4, - myVar: 100, - myVar2: 100 - }) - LinkComponent3({ - LinkComponent3Link1: $myState1, - LinkComponent3Link2: this.$myState2, - LinkComponent3Link3: $myState3, - LinkComponent3Link4: $myState4, - indexState1: { count: 1 }, - indexState2: 1, - indexState3: true, - indexState4: 'LinkComponent1' - }) - AllStarComponent.ExportComponent({ - ExportComponent1Link1: $myState1, - ExportComponent1Link2: this.$myState2, - ExportComponent1Link3: $myState3, - ExportComponent1Link4: $myState4, - indexState1: { count: 1 }, - indexState2: 1, - indexState3: true, - indexState4: 'ExportComponent1' - }) - AllStarComponent.default({ - ExportComponent4Link1: $myState1, - ExportComponent4Link2: this.$myState2, - ExportComponent4Link3: $myState3, - ExportComponent4Link4: $myState4, - indexState1: { count: 1 }, - indexState2: 1, - indexState3: true, - indexState4: 'ExportComponent4' - }) - AllComponent.default({ - NamespaceComponent3Link1: $myState1, - NamespaceComponent3Link2: this.$myState2, - NamespaceComponent3Link3: $myState3, - NamespaceComponent3Link4: $myState4, - myVar: 100, - myVar2: 80 - }) - } - } -} -` - -export const expectResult: string = -`import LinkComponentDefault, { LinkComponent as LinkComponent1Ref, LinkComponent2 as LinkComponent2Ref, LinkComponent3 } from './test/pages/LinkComponent.ets'; -import DefaultComponent from "./test/pages/DefaultComponent.ets"; -import * as AllComponent from './test/pages/NamespaceComponent'; -import { AllStarComponent } from './test/pages/ExportStarComponent'; -class ImportTest extends View { - constructor(compilerAssignedUniqueChildId, parent, params) { - super(compilerAssignedUniqueChildId, parent); - this.__myState1 = new ObservedPropertyObject(new TsModule(1).method(), this, "myState1"); - this.__myState2 = new ObservedPropertySimple(0, this, "myState2"); - this.__myState3 = new ObservedPropertySimple(false, this, "myState3"); - this.__myState4 = new ObservedPropertySimple('ImportTest', this, "myState4"); - this.updateWithValueParams(params); - } - updateWithValueParams(params) { - if (params.myState1 !== undefined) { - this.myState1 = params.myState1; - } - if (params.myState2 !== undefined) { - this.myState2 = params.myState2; - } - if (params.myState3 !== undefined) { - this.myState3 = params.myState3; - } - if (params.myState4 !== undefined) { - this.myState4 = params.myState4; - } - } - aboutToBeDeleted() { - this.__myState1.aboutToBeDeleted(); - this.__myState2.aboutToBeDeleted(); - this.__myState3.aboutToBeDeleted(); - this.__myState4.aboutToBeDeleted(); - SubscriberManager.Get().delete(this.id()); - } - get myState1() { - return this.__myState1.get(); - } - set myState1(newValue) { - this.__myState1.set(newValue); - } - get myState2() { - return this.__myState2.get(); - } - set myState2(newValue) { - this.__myState2.set(newValue); - } - get myState3() { - return this.__myState3.get(); - } - set myState3(newValue) { - this.__myState3.set(newValue); - } - get myState4() { - return this.__myState4.get(); - } - set myState4(newValue) { - this.__myState4.set(newValue); - } - render() { - Row.create(); - let earlierCreatedChild_2 = this.findChildById("2"); - if (earlierCreatedChild_2 == undefined) { - View.create(new LinkComponent2Ref("2", this, { - LinkComponent2Link1: this.__myState1, - LinkComponent2Link2: this.__myState2, - LinkComponent2Link3: this.__myState3, - LinkComponent2Link4: this.__myState4, - indexState1: { count: 1 }, - indexState2: 1, - indexState3: true, - indexState4: 'LinkComponent2' - })); - } - else { - earlierCreatedChild_2.updateWithValueParams({ - indexState1: { count: 1 }, - indexState2: 1, - indexState3: true, - indexState4: 'LinkComponent2' - }); - View.create(earlierCreatedChild_2); - } - Text.create('space'); - Text.pop(); - let earlierCreatedChild_3 = this.findChildById("3"); - if (earlierCreatedChild_3 == undefined) { - View.create(new LinkComponent1Ref("3", this, { - LinkComponent1Link1: this.__myState1, - LinkComponent1Link2: this.__myState2, - LinkComponent1Link3: this.__myState3, - LinkComponent1Link4: this.__myState4, - indexState1: { count: 1 }, - indexState2: 1, - indexState3: true, - indexState4: 'LinkComponent1' - })); - } - else { - earlierCreatedChild_3.updateWithValueParams({ - indexState1: { count: 1 }, - indexState2: 1, - indexState3: true, - indexState4: 'LinkComponent1' - }); - View.create(earlierCreatedChild_3); - } - let earlierCreatedChild_4 = this.findChildById("4"); - if (earlierCreatedChild_4 == undefined) { - View.create(new DefaultComponent("4", this, { - DefaultComponentLink1: this.__myState1, - DefaultComponentLink2: this.__myState2, - DefaultComponentLink3: this.__myState3, - DefaultComponentLink4: this.__myState4, - myVar: 100, - myVar2: 100 - })); - } - else { - earlierCreatedChild_4.updateWithValueParams({ - myVar: 100, - myVar2: 100 - }); - View.create(earlierCreatedChild_4); - } - let earlierCreatedChild_5 = this.findChildById("5"); - if (earlierCreatedChild_5 == undefined) { - View.create(new AllComponent.NamespaceComponent1("5", this, { - NamespaceComponent1Link1: this.__myState1, - NamespaceComponent1Link2: this.__myState2, - NamespaceComponent1Link3: this.__myState3, - NamespaceComponent1Link4: this.__myState4, - myVar: 100, - myVar2: 80 - })); - } - else { - earlierCreatedChild_5.updateWithValueParams({ - myVar: 100, - myVar2: 80 - }); - View.create(earlierCreatedChild_5); - } - let earlierCreatedChild_6 = this.findChildById("6"); - if (earlierCreatedChild_6 == undefined) { - View.create(new LinkComponentDefault("6", this, { - LinkComponent3Link1: this.__myState1, - LinkComponent3Link2: this.__myState2, - LinkComponent3Link3: this.__myState3, - LinkComponent3Link4: this.__myState4, - indexState1: { count: 1 }, - indexState2: 1, - indexState3: true, - indexState4: 'LinkComponent3' - })); - } - else { - earlierCreatedChild_6.updateWithValueParams({ - indexState1: { count: 1 }, - indexState2: 1, - indexState3: true, - indexState4: 'LinkComponent3' - }); - View.create(earlierCreatedChild_6); - } - let earlierCreatedChild_7 = this.findChildById("7"); - if (earlierCreatedChild_7 == undefined) { - View.create(new AMDComponentDefault("7", this, { - AMDComponentLink1: this.__myState1, - AMDComponentLink2: this.__myState2, - AMDComponentLink3: this.__myState3, - AMDComponentLink4: this.__myState4, - myVar: 100, - myVar2: 100 - })); - } - else { - earlierCreatedChild_7.updateWithValueParams({ - myVar: 100, - myVar2: 100 - }); - View.create(earlierCreatedChild_7); - } - let earlierCreatedChild_8 = this.findChildById("8"); - if (earlierCreatedChild_8 == undefined) { - View.create(new LinkComponent3("8", this, { - LinkComponent3Link1: this.__myState1, - LinkComponent3Link2: this.__myState2, - LinkComponent3Link3: this.__myState3, - LinkComponent3Link4: this.__myState4, - indexState1: { count: 1 }, - indexState2: 1, - indexState3: true, - indexState4: 'LinkComponent1' - })); - } - else { - earlierCreatedChild_8.updateWithValueParams({ - indexState1: { count: 1 }, - indexState2: 1, - indexState3: true, - indexState4: 'LinkComponent1' - }); - View.create(earlierCreatedChild_8); - } - let earlierCreatedChild_9 = this.findChildById("9"); - if (earlierCreatedChild_9 == undefined) { - View.create(new AllStarComponent.ExportComponent("9", this, { - ExportComponent1Link1: this.__myState1, - ExportComponent1Link2: this.__myState2, - ExportComponent1Link3: this.__myState3, - ExportComponent1Link4: this.__myState4, - indexState1: { count: 1 }, - indexState2: 1, - indexState3: true, - indexState4: 'ExportComponent1' - })); - } - else { - earlierCreatedChild_9.updateWithValueParams({ - indexState1: { count: 1 }, - indexState2: 1, - indexState3: true, - indexState4: 'ExportComponent1' - }); - View.create(earlierCreatedChild_9); - } - let earlierCreatedChild_10 = this.findChildById("10"); - if (earlierCreatedChild_10 == undefined) { - View.create(new AllStarComponent.default("10", this, { - ExportComponent4Link1: this.__myState1, - ExportComponent4Link2: this.__myState2, - ExportComponent4Link3: this.__myState3, - ExportComponent4Link4: this.__myState4, - indexState1: { count: 1 }, - indexState2: 1, - indexState3: true, - indexState4: 'ExportComponent4' - })); - } - else { - earlierCreatedChild_10.updateWithValueParams({ - indexState1: { count: 1 }, - indexState2: 1, - indexState3: true, - indexState4: 'ExportComponent4' - }); - View.create(earlierCreatedChild_10); - } - let earlierCreatedChild_11 = this.findChildById("11"); - if (earlierCreatedChild_11 == undefined) { - View.create(new AllComponent.default("11", this, { - NamespaceComponent3Link1: this.__myState1, - NamespaceComponent3Link2: this.__myState2, - NamespaceComponent3Link3: this.__myState3, - NamespaceComponent3Link4: this.__myState4, - myVar: 100, - myVar2: 80 - })); - } - else { - earlierCreatedChild_11.updateWithValueParams({ - myVar: 100, - myVar2: 80 - }); - View.create(earlierCreatedChild_11); - } - Row.pop(); - } -} -loadDocument(new ImportTest("1", undefined, {})); -` diff --git a/compiler/compiler/test/ut/import/importSystemApi.ts b/compiler/compiler/test/ut/import/importSystemApi.ts deleted file mode 100644 index 33f1646b1..000000000 --- a/compiler/compiler/test/ut/import/importSystemApi.ts +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2020 Huawei Device Co., Ltd. - * 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. - */ - -export const source: string = ` -import { router1, router2 } from "@system.router"; -import { app } from "@system.router"; -import { fetch } from "@system.fetch"; - -import { router1, router2, router3 } = require('@system.router'); -import { app1, app2 } = require('@system.app'); -import { fetch } = require('@system.fetch'); - -import router from "@system.router" -import app from "@system.router" -import fetch from "@system.fetch" - -import router = require('@system.router') -import app = require('@system.app') -import fetch = require('@system.fetch') - -import fetch from '@ohos.net.http' - -import hello from 'libhello.so' -import world = require('libworld.so') -` - -export const expectResult: string = -`var { router1, router2 } = globalThis.requireNativeModule('system.router'); -var { app } = globalThis.requireNativeModule('system.router'); -var { fetch } = isSystemplugin('fetch', 'system') ? globalThis.systemplugin.fetch : globalThis.requireNapi('fetch'); -var { router1, router2, router3 } = globalThis.requireNativeModule('system.router'); -var { app1, app2 } = globalThis.requireNativeModule('system.app'); -var { fetch } = isSystemplugin('fetch', 'system') ? globalThis.systemplugin.fetch : globalThis.requireNapi('fetch'); -var router = globalThis.requireNativeModule('system.router'); -var app = globalThis.requireNativeModule('system.router'); -var fetch = isSystemplugin('fetch', 'system') ? globalThis.systemplugin.fetch : globalThis.requireNapi('fetch'); -var router = globalThis.requireNativeModule('system.router'); -var app = globalThis.requireNativeModule('system.app'); -var fetch = isSystemplugin('fetch', 'system') ? globalThis.systemplugin.fetch : globalThis.requireNapi('fetch'); -var fetch = isSystemplugin('net.http', 'ohos') ? globalThis.ohosplugin.net.http : isSystemplugin('net.http', 'system') ? globalThis.systemplugin.net.http : globalThis.requireNapi('net.http'); -var hello = globalThis.requireNapi("hello", true); -var world = globalThis.requireNapi("world", true); -` diff --git a/compiler/compiler/test/ut/import/importTs.ts b/compiler/compiler/test/ut/import/importTs.ts deleted file mode 100644 index 357302aec..000000000 --- a/compiler/compiler/test/ut/import/importTs.ts +++ /dev/null @@ -1,162 +0,0 @@ -/* - * Copyright (c) 2020 Huawei Device Co., Ltd. - * 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. - */ - -export const source: string = ` -import { AllStarComponent } from './test/pages/ExportStarComponent' -import TsModule from './test/pages/TsModule' - -@Entry -@Component -struct ImportTest { - @State myState1: any = new TsModule(1).method(); - @State myState2: number = 0 - @State myState3: boolean = false - @State myState4: string = 'ImportTest' - - build() { - Row() { - AllStarComponent.ExportComponent({ - ExportComponent1Link1: $myState1, - ExportComponent1Link2: this.$myState2, - ExportComponent1Link3: $myState3, - ExportComponent1Link4: $myState4, - indexState1: { count: 1 }, - indexState2: 1, - indexState3: true, - indexState4: 'ExportComponent1' - }) - AllStarComponent.default({ - ExportComponent4Link1: $myState1, - ExportComponent4Link2: this.$myState2, - ExportComponent4Link3: $myState3, - ExportComponent4Link4: $myState4, - indexState1: { count: 1 }, - indexState2: 1, - indexState3: true, - indexState4: 'ExportComponent4' - }) - } - } -} -` - -export const expectResult: string = -`import { AllStarComponent } from './test/pages/ExportStarComponent'; -import TsModule from './test/pages/TsModule'; -class ImportTest extends View { - constructor(compilerAssignedUniqueChildId, parent, params) { - super(compilerAssignedUniqueChildId, parent); - this.__myState1 = new ObservedPropertyObject(new TsModule(1).method(), this, "myState1"); - this.__myState2 = new ObservedPropertySimple(0, this, "myState2"); - this.__myState3 = new ObservedPropertySimple(false, this, "myState3"); - this.__myState4 = new ObservedPropertySimple('ImportTest', this, "myState4"); - this.updateWithValueParams(params); - } - updateWithValueParams(params) { - if (params.myState1 !== undefined) { - this.myState1 = params.myState1; - } - if (params.myState2 !== undefined) { - this.myState2 = params.myState2; - } - if (params.myState3 !== undefined) { - this.myState3 = params.myState3; - } - if (params.myState4 !== undefined) { - this.myState4 = params.myState4; - } - } - aboutToBeDeleted() { - this.__myState1.aboutToBeDeleted(); - this.__myState2.aboutToBeDeleted(); - this.__myState3.aboutToBeDeleted(); - this.__myState4.aboutToBeDeleted(); - SubscriberManager.Get().delete(this.id()); - } - get myState1() { - return this.__myState1.get(); - } - set myState1(newValue) { - this.__myState1.set(newValue); - } - get myState2() { - return this.__myState2.get(); - } - set myState2(newValue) { - this.__myState2.set(newValue); - } - get myState3() { - return this.__myState3.get(); - } - set myState3(newValue) { - this.__myState3.set(newValue); - } - get myState4() { - return this.__myState4.get(); - } - set myState4(newValue) { - this.__myState4.set(newValue); - } - render() { - Row.create(); - let earlierCreatedChild_2 = this.findChildById("2"); - if (earlierCreatedChild_2 == undefined) { - View.create(new AllStarComponent.ExportComponent("2", this, { - ExportComponent1Link1: this.__myState1, - ExportComponent1Link2: this.__myState2, - ExportComponent1Link3: this.__myState3, - ExportComponent1Link4: this.__myState4, - indexState1: { count: 1 }, - indexState2: 1, - indexState3: true, - indexState4: 'ExportComponent1' - })); - } - else { - earlierCreatedChild_2.updateWithValueParams({ - indexState1: { count: 1 }, - indexState2: 1, - indexState3: true, - indexState4: 'ExportComponent1' - }); - View.create(earlierCreatedChild_2); - } - let earlierCreatedChild_3 = this.findChildById("3"); - if (earlierCreatedChild_3 == undefined) { - View.create(new AllStarComponent.default("3", this, { - ExportComponent4Link1: this.__myState1, - ExportComponent4Link2: this.__myState2, - ExportComponent4Link3: this.__myState3, - ExportComponent4Link4: this.__myState4, - indexState1: { count: 1 }, - indexState2: 1, - indexState3: true, - indexState4: 'ExportComponent4' - })); - } - else { - earlierCreatedChild_3.updateWithValueParams({ - indexState1: { count: 1 }, - indexState2: 1, - indexState3: true, - indexState4: 'ExportComponent4' - }); - View.create(earlierCreatedChild_3); - } - Row.pop(); - } -} -loadDocument(new ImportTest("1", undefined, {})); -` diff --git a/compiler/compiler/test/ut/link/createLinkReference.ts b/compiler/compiler/test/ut/link/createLinkReference.ts deleted file mode 100644 index e9562301c..000000000 --- a/compiler/compiler/test/ut/link/createLinkReference.ts +++ /dev/null @@ -1,186 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - -export const source: string = ` -@Component -struct MyLinkTestComponent { - @Link myLink1?: any - @Link myLink2?: number - @Link myLink3?: boolean - @Link myLink4?: string - - private myVar: number = 0 - private myVar2: number - - build() { - - } -} - -@Entry -@Component -struct LinkTest { - @State myState1: any = { count: 0 } - @State myState2: number = 0 - @State myState3: boolean = false - @State myState4: string = 'Home' - - build() { - Row() { - MyLinkTestComponent({ - myLink1: $myState1, - myLink2: this.$myState2, - myLink3: $myState3, - myLink4: this.$myState4, - myVar: 100, - myVar2: 100 - }) - } - } -}` - -export const expectResult: string = -`class MyLinkTestComponent extends View { - constructor(compilerAssignedUniqueChildId, parent, params) { - super(compilerAssignedUniqueChildId, parent); - this.__myLink1 = new SynchedPropertyObjectTwoWay(params.myLink1, this, "myLink1"); - this.__myLink2 = new SynchedPropertySimpleTwoWay(params.myLink2, this, "myLink2"); - this.__myLink3 = new SynchedPropertySimpleTwoWay(params.myLink3, this, "myLink3"); - this.__myLink4 = new SynchedPropertySimpleTwoWay(params.myLink4, this, "myLink4"); - this.myVar = 0; - this.myVar2 = undefined; - this.updateWithValueParams(params); - } - updateWithValueParams(params) { - if (params.myVar !== undefined) { - this.myVar = params.myVar; - } - if (params.myVar2 !== undefined) { - this.myVar2 = params.myVar2; - } - } - aboutToBeDeleted() { - this.__myLink1.aboutToBeDeleted(); - this.__myLink2.aboutToBeDeleted(); - this.__myLink3.aboutToBeDeleted(); - this.__myLink4.aboutToBeDeleted(); - SubscriberManager.Get().delete(this.id()); - } - get myLink1() { - return this.__myLink1.get(); - } - set myLink1(newValue) { - this.__myLink1.set(newValue); - } - get myLink2() { - return this.__myLink2.get(); - } - set myLink2(newValue) { - this.__myLink2.set(newValue); - } - get myLink3() { - return this.__myLink3.get(); - } - set myLink3(newValue) { - this.__myLink3.set(newValue); - } - get myLink4() { - return this.__myLink4.get(); - } - set myLink4(newValue) { - this.__myLink4.set(newValue); - } - render() { - } -} -class LinkTest extends View { - constructor(compilerAssignedUniqueChildId, parent, params) { - super(compilerAssignedUniqueChildId, parent); - this.__myState1 = new ObservedPropertyObject({ count: 0 }, this, "myState1"); - this.__myState2 = new ObservedPropertySimple(0, this, "myState2"); - this.__myState3 = new ObservedPropertySimple(false, this, "myState3"); - this.__myState4 = new ObservedPropertySimple('Home', this, "myState4"); - this.updateWithValueParams(params); - } - updateWithValueParams(params) { - if (params.myState1 !== undefined) { - this.myState1 = params.myState1; - } - if (params.myState2 !== undefined) { - this.myState2 = params.myState2; - } - if (params.myState3 !== undefined) { - this.myState3 = params.myState3; - } - if (params.myState4 !== undefined) { - this.myState4 = params.myState4; - } - } - aboutToBeDeleted() { - this.__myState1.aboutToBeDeleted(); - this.__myState2.aboutToBeDeleted(); - this.__myState3.aboutToBeDeleted(); - this.__myState4.aboutToBeDeleted(); - SubscriberManager.Get().delete(this.id()); - } - get myState1() { - return this.__myState1.get(); - } - set myState1(newValue) { - this.__myState1.set(newValue); - } - get myState2() { - return this.__myState2.get(); - } - set myState2(newValue) { - this.__myState2.set(newValue); - } - get myState3() { - return this.__myState3.get(); - } - set myState3(newValue) { - this.__myState3.set(newValue); - } - get myState4() { - return this.__myState4.get(); - } - set myState4(newValue) { - this.__myState4.set(newValue); - } - render() { - Row.create(); - let earlierCreatedChild_2 = this.findChildById("2"); - if (earlierCreatedChild_2 == undefined) { - View.create(new MyLinkTestComponent("2", this, { - myLink1: this.__myState1, - myLink2: this.__myState2, - myLink3: this.__myState3, - myLink4: this.__myState4, - myVar: 100, - myVar2: 100 - })); - } - else { - earlierCreatedChild_2.updateWithValueParams({ - myVar: 100, - myVar2: 100 - }); - View.create(earlierCreatedChild_2); - } - Row.pop(); - } -} -loadDocument(new LinkTest("1", undefined, {})); -` diff --git a/compiler/compiler/test/ut/preview/previewDecorator.ts b/compiler/compiler/test/ut/preview/previewDecorator.ts deleted file mode 100644 index b1adbbbd4..000000000 --- a/compiler/compiler/test/ut/preview/previewDecorator.ts +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - -export const source: string = ` -@Entry -@Component -struct HomePreviewComponent { - private value1: string = "hello world 1" - private value2: string = "hello world 2" - private value3: string = "hello world 3" - - build() { - Column() { - Row() { - Text(this.value1) - Text(this.value2) - Text(this.value3) - } - Row() { - Button() { - Text(this.value1) - .fontSize(20) - } - .width(100) - .height(20) - Text(this.value2) - .fontSize(100) - Text(this.value3) - } - .width(20) - } - .height(500) - } -} - -@Preview -@Component -struct HomePreviewComponent_Preview { - build() { - Column() { - HomePreviewComponent(); - } - } -} -` - -export const expectResult: string = -`class HomePreviewComponent extends View { - constructor(compilerAssignedUniqueChildId, parent, params) { - super(compilerAssignedUniqueChildId, parent); - this.value1 = "hello world 1"; - this.value2 = "hello world 2"; - this.value3 = "hello world 3"; - this.updateWithValueParams(params); - } - updateWithValueParams(params) { - if (params.value1 !== undefined) { - this.value1 = params.value1; - } - if (params.value2 !== undefined) { - this.value2 = params.value2; - } - if (params.value3 !== undefined) { - this.value3 = params.value3; - } - } - aboutToBeDeleted() { - SubscriberManager.Get().delete(this.id()); - } - render() { - Column.create(); - Column.height(500); - Row.create(); - Text.create(this.value1); - Text.pop(); - Text.create(this.value2); - Text.pop(); - Text.create(this.value3); - Text.pop(); - Row.pop(); - Row.create(); - Row.width(20); - Button.createWithChild(); - Button.width(100); - Button.height(20); - Text.create(this.value1); - Text.fontSize(20); - Text.pop(); - Button.pop(); - Text.create(this.value2); - Text.fontSize(100); - Text.pop(); - Text.create(this.value3); - Text.pop(); - Row.pop(); - Column.pop(); - } -} -class HomePreviewComponent_Preview extends View { - constructor(compilerAssignedUniqueChildId, parent, params) { - super(compilerAssignedUniqueChildId, parent); - this.updateWithValueParams(params); - } - updateWithValueParams(params) { - } - aboutToBeDeleted() { - SubscriberManager.Get().delete(this.id()); - } - render() { - Column.create(); - let earlierCreatedChild_2 = this.findChildById("2"); - if (earlierCreatedChild_2 == undefined) { - View.create(new HomePreviewComponent("2", this, {})); - } - else { - earlierCreatedChild_2.updateWithValueParams({}); - if (!earlierCreatedChild_2.needsUpdate()) { - earlierCreatedChild_2.markStatic(); - } - View.create(earlierCreatedChild_2); - } - Column.pop(); - } -} -loadDocument(new HomePreviewComponent_Preview("1", undefined, {})); -` diff --git a/compiler/compiler/test/ut/render/forEach/forEach01.ts b/compiler/compiler/test/ut/render/forEach/forEach01.ts deleted file mode 100644 index 1f87b8904..000000000 --- a/compiler/compiler/test/ut/render/forEach/forEach01.ts +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - -export const source: string = ` -@Entry -@Component -struct MyComponent { - private test: string = 'Hello' - build() { - Column() { - Text(this.test) - ForEach( - weekNames, - (item, index) => { - GridItem() { - Text(item) - .fontSize(10) - } - }, - (item, index) => item) - }.width(100) - } -}` - -export const expectResult: string = -`class MyComponent extends View { - constructor(compilerAssignedUniqueChildId, parent, params) { - super(compilerAssignedUniqueChildId, parent); - this.test = 'Hello'; - this.updateWithValueParams(params); - } - updateWithValueParams(params) { - if (params.test !== undefined) { - this.test = params.test; - } - } - aboutToBeDeleted() { - SubscriberManager.Get().delete(this.id()); - } - render() { - Column.create(); - Column.width(100); - Text.create(this.test); - Text.pop(); - ForEach.create("2", this, ObservedObject.GetRawObject(weekNames), (item, index) => { - GridItem.create(); - Text.create(item); - Text.fontSize(10); - Text.pop(); - GridItem.pop(); - }, (item, index) => item); - ForEach.pop(); - Column.pop(); - } -} -loadDocument(new MyComponent("1", undefined, {})); -` diff --git a/compiler/compiler/test/ut/render/forEach/forEach02.ts b/compiler/compiler/test/ut/render/forEach/forEach02.ts deleted file mode 100644 index 4007051c1..000000000 --- a/compiler/compiler/test/ut/render/forEach/forEach02.ts +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - -export const source: string = ` -@Entry -@Component -struct MyComponent { - private test: string = 'Hello' - build() { - Column() { - Text(this.test) - ForEach( - weekNames, - (item: string, index: number) => - Text(item).fontSize(10) - , - (item: any, index: number) => item) - }.width(100) - } -}` - -export const expectResult: string = -`class MyComponent extends View { - constructor(compilerAssignedUniqueChildId, parent, params) { - super(compilerAssignedUniqueChildId, parent); - this.test = 'Hello'; - this.updateWithValueParams(params); - } - updateWithValueParams(params) { - if (params.test !== undefined) { - this.test = params.test; - } - } - aboutToBeDeleted() { - SubscriberManager.Get().delete(this.id()); - } - render() { - Column.create(); - Column.width(100); - Text.create(this.test); - Text.pop(); - ForEach.create("2", this, ObservedObject.GetRawObject(weekNames), (item, index) => { - Text.create(item); - Text.fontSize(10); - Text.pop(); - }, (item, index) => item); - ForEach.pop(); - Column.pop(); - } -} -loadDocument(new MyComponent("1", undefined, {})); -` diff --git a/compiler/compiler/test/ut/render/forEach/forEach03.ts b/compiler/compiler/test/ut/render/forEach/forEach03.ts deleted file mode 100644 index f3122986a..000000000 --- a/compiler/compiler/test/ut/render/forEach/forEach03.ts +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - -export const source: string = ` -@Entry -@Component -struct MyComponent { - build() { - Column() { - ForEach( - weekNames, - (item: string, index: number) => { - Text(item).fontSize(10) - ForEach( - weekNames, - (item: string, index: number) => { - Text(item).fontSize(10) - Column() { - Text(item).fontSize(10) - } - }, - (item: any, index: number) => item - ) - }, - (item: any, index: number) => item - ) - } - } -}` - -export const expectResult: string = -`class MyComponent extends View { - constructor(compilerAssignedUniqueChildId, parent, params) { - super(compilerAssignedUniqueChildId, parent); - this.updateWithValueParams(params); - } - updateWithValueParams(params) { - } - aboutToBeDeleted() { - SubscriberManager.Get().delete(this.id()); - } - render() { - Column.create(); - ForEach.create("3", this, ObservedObject.GetRawObject(weekNames), (item, index) => { - Text.create(item); - Text.fontSize(10); - Text.pop(); - ForEach.create("2", this, ObservedObject.GetRawObject(weekNames), (item, index) => { - Text.create(item); - Text.fontSize(10); - Text.pop(); - Column.create(); - Text.create(item); - Text.fontSize(10); - Text.pop(); - Column.pop(); - }, (item, index) => item); - ForEach.pop(); - }, (item, index) => item); - ForEach.pop(); - Column.pop(); - } -} -loadDocument(new MyComponent("1", undefined, {})); -` diff --git a/compiler/compiler/test/ut/render/forEach/forEach04.ts b/compiler/compiler/test/ut/render/forEach/forEach04.ts deleted file mode 100644 index 586bd7204..000000000 --- a/compiler/compiler/test/ut/render/forEach/forEach04.ts +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - -export const source: string = ` -@Entry -@Component -struct MyComponent { - private test: string = 'Hello' - build() { - Column() { - Text(this.test) - ForEach( - weekNames, - (item, index) => { - Text(item) - .fontSize(10) - } - ) - }.width(100) - } -}` - -export const expectResult: string = -`class MyComponent extends View { - constructor(compilerAssignedUniqueChildId, parent, params) { - super(compilerAssignedUniqueChildId, parent); - this.test = 'Hello'; - this.updateWithValueParams(params); - } - updateWithValueParams(params) { - if (params.test !== undefined) { - this.test = params.test; - } - } - aboutToBeDeleted() { - SubscriberManager.Get().delete(this.id()); - } - render() { - Column.create(); - Column.width(100); - Text.create(this.test); - Text.pop(); - ForEach.create("2", this, ObservedObject.GetRawObject(weekNames), (item, index) => { - Text.create(item); - Text.fontSize(10); - Text.pop(); - }); - ForEach.pop(); - Column.pop(); - } -} -loadDocument(new MyComponent("1", undefined, {})); -` diff --git a/compiler/compiler/test/ut/render/forEach/forEachComplexModel.ts b/compiler/compiler/test/ut/render/forEach/forEachComplexModel.ts deleted file mode 100644 index 5f5eb56d8..000000000 --- a/compiler/compiler/test/ut/render/forEach/forEachComplexModel.ts +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - -export const source: string = ` -// class without @Component convert tool will not process. -class Month { - year: number = 2010; // why add assignment here, TS grammar required, if not it will omit by TSC. - month: number = 2; - days: number[] = [1, 2]; - - constructor(year:number, month:number, days:number[]){ - this.year = year; - this.month = month; - this.days = days; - } -} - -@Component -@Entry -struct Calendar { - -// simulate with 6 months -@State calendar : Month[] = [ - new Month(2020, 1, [...Array(31).keys()]), - new Month(2020, 2, [...Array(28).keys()]), - new Month(2020, 3, [...Array(31).keys()]), - new Month(2020, 4, [...Array(30).keys()]), - new Month(2020, 5, [...Array(31).keys()]), - new Month(2020, 6, [...Array(30).keys()]) -] - - build() { - Column() { - Button() { - Text('next month') - }.onClick(() => { - this.calendar.shift() - this.calendar.push(new Month(2020, 7, [...Array(31).keys()])) - }) - - ForEach(this.calendar, - (item: Month) => { - ForEach(item.days, - (day : number) => { - Text('day') - }, - (day : number) => day.toString() - ) // inner ForEach - }, - (item: Month) => (item.year * 12 + item.month).toString() // field is used together with year and month as the unique ID of the month. - ) // outer ForEach - } - } -}` - -export const expectResult: string = -`// class without @Component convert tool will not process. -class Month { - constructor(year, month, days) { - this.year = 2010; // why add assignment here, TS grammar required, if not it will omit by TSC. - this.month = 2; - this.days = [1, 2]; - this.year = year; - this.month = month; - this.days = days; - } -} -class Calendar extends View { - constructor(compilerAssignedUniqueChildId, parent, params) { - super(compilerAssignedUniqueChildId, parent); - this.__calendar = new ObservedPropertyObject([ - new Month(2020, 1, [...Array(31).keys()]), - new Month(2020, 2, [...Array(28).keys()]), - new Month(2020, 3, [...Array(31).keys()]), - new Month(2020, 4, [...Array(30).keys()]), - new Month(2020, 5, [...Array(31).keys()]), - new Month(2020, 6, [...Array(30).keys()]) - ], this, "calendar"); - this.updateWithValueParams(params); - } - updateWithValueParams(params) { - if (params.calendar !== undefined) { - this.calendar = params.calendar; - } - } - aboutToBeDeleted() { - this.__calendar.aboutToBeDeleted(); - SubscriberManager.Get().delete(this.id()); - } - get calendar() { - return this.__calendar.get(); - } - set calendar(newValue) { - this.__calendar.set(newValue); - } - render() { - Column.create(); - Button.createWithChild(); - Button.onClick(() => { - this.calendar.shift(); - this.calendar.push(new Month(2020, 7, [...Array(31).keys()])); - }); - Text.create('next month'); - Text.pop(); - Button.pop(); - ForEach.create("3", this, ObservedObject.GetRawObject(this.calendar), (item) => { - ForEach.create("2", this, ObservedObject.GetRawObject(item.days), (day) => { - Text.create('day'); - Text.pop(); - }, (day) => day.toString()); // inner ForEach - ForEach.pop(); - }, (item) => (item.year * 12 + item.month).toString() // field is used together with year and month as the unique ID of the month. - ); // outer ForEach - ForEach.pop(); - Column.pop(); - } -} -loadDocument(new Calendar("1", undefined, {})); -` diff --git a/compiler/compiler/test/ut/render/forEach/forEachSimpleModel.ts b/compiler/compiler/test/ut/render/forEach/forEachSimpleModel.ts deleted file mode 100644 index 92e66c9c1..000000000 --- a/compiler/compiler/test/ut/render/forEach/forEachSimpleModel.ts +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - -export const source: string = ` -@Entry -@Component -struct MyComponent2 { - @State arr: number[] = [10, 20, 30] - - build() { - Column() { - Button() { - Text('Reverse Array') - }.onClick(() => { - this.arr.reverse() - }) - - ForEach(this.arr, // Parameter 1: array to be iterated - (item: number) => { // Parameter 2: item generator - Column() { - Divider() - } - }, - (item: number) => item.toString() // Parameter 3: unique key generator, which is optional but recommended. - ) - } - } -}` - -export const expectResult: string = -`class MyComponent2 extends View { - constructor(compilerAssignedUniqueChildId, parent, params) { - super(compilerAssignedUniqueChildId, parent); - this.__arr = new ObservedPropertyObject([10, 20, 30], this, "arr"); - this.updateWithValueParams(params); - } - updateWithValueParams(params) { - if (params.arr !== undefined) { - this.arr = params.arr; - } - } - aboutToBeDeleted() { - this.__arr.aboutToBeDeleted(); - SubscriberManager.Get().delete(this.id()); - } - get arr() { - return this.__arr.get(); - } - set arr(newValue) { - this.__arr.set(newValue); - } - render() { - Column.create(); - Button.createWithChild(); - Button.onClick(() => { - this.arr.reverse(); - }); - Text.create('Reverse Array'); - Text.pop(); - Button.pop(); - ForEach.create("2", this, ObservedObject.GetRawObject(this.arr), // Parameter 1: array to be iterated - (item) => { - Column.create(); - Divider.create(); - Column.pop(); - }, (item) => item.toString() // Parameter 3: unique key generator, which is optional but recommended. - ); - ForEach.pop(); - Column.pop(); - } -} -loadDocument(new MyComponent2("1", undefined, {})); -` diff --git a/compiler/compiler/test/ut/render/if/if.ts b/compiler/compiler/test/ut/render/if/if.ts deleted file mode 100644 index 38e086356..000000000 --- a/compiler/compiler/test/ut/render/if/if.ts +++ /dev/null @@ -1,207 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - -export const source: string = ` -@Entry -@Component -struct MyComponent { - private test: string = 'Hello' - build() { - Column() { - if (this.test === 'Hello') { - Text(this.test) - } - - if (this.test === 'Hello') { - Text(this.test) - Button() - .width(20) - .height(20) - } else if (this.test === 'World') { - Text('World') - } else if (this.test === 'Hello World') { - Text(this.test) - Text('World') - } - else { - - } - - if (this.test === 'Hello') Text(this.test) - else if (this.test === '') Button() - .width(20) - .height(20) - - if (this.test === 'Hello') { - Text(this.test) - } - - Text(this.test) - Button() - .width(20) - .height(20) - - if (true) { - if (this.test === 'Hello') { - if (1) { - Text(this.test) - } - } else { - if (0) { - Button() - .width(20) - .height(20) - } else if (1) { - - } - } - } - - if (this.test !== 'Hello') if (this.test !== 'World') Button() - .width(20) - .height(20) - }.width(100) - } -}` - -export const expectResult: string = -`class MyComponent extends View { - constructor(compilerAssignedUniqueChildId, parent, params) { - super(compilerAssignedUniqueChildId, parent); - this.test = 'Hello'; - this.updateWithValueParams(params); - } - updateWithValueParams(params) { - if (params.test !== undefined) { - this.test = params.test; - } - } - aboutToBeDeleted() { - SubscriberManager.Get().delete(this.id()); - } - render() { - Column.create(); - Column.width(100); - If.create(); - if (this.test === 'Hello') { - If.branchId(0); - Text.create(this.test); - Text.pop(); - } - If.pop(); - If.create(); - if (this.test === 'Hello') { - If.branchId(0); - Text.create(this.test); - Text.pop(); - Button.createWithLabel(); - Button.width(20); - Button.height(20); - Button.pop(); - } - else if (this.test === 'World') { - If.branchId(1); - Text.create('World'); - Text.pop(); - } - else if (this.test === 'Hello World') { - If.branchId(2); - Text.create(this.test); - Text.pop(); - Text.create('World'); - Text.pop(); - } - else { - If.branchId(3); - } - If.pop(); - If.create(); - if (this.test === 'Hello') { - If.branchId(0); - Text.create(this.test); - Text.pop(); - } - else if (this.test === '') { - If.branchId(1); - Button.createWithLabel(); - Button.width(20); - Button.height(20); - Button.pop(); - } - If.pop(); - If.create(); - if (this.test === 'Hello') { - If.branchId(0); - Text.create(this.test); - Text.pop(); - } - If.pop(); - Text.create(this.test); - Text.pop(); - Button.createWithLabel(); - Button.width(20); - Button.height(20); - Button.pop(); - If.create(); - if (true) { - If.branchId(0); - If.create(); - if (this.test === 'Hello') { - If.branchId(0); - If.create(); - if (1) { - If.branchId(0); - Text.create(this.test); - Text.pop(); - } - If.pop(); - } - else { - If.branchId(1); - If.create(); - if (0) { - If.branchId(0); - Button.createWithLabel(); - Button.width(20); - Button.height(20); - Button.pop(); - } - else if (1) { - If.branchId(1); - } - If.pop(); - } - If.pop(); - } - If.pop(); - If.create(); - if (this.test !== 'Hello') { - If.create(); - If.branchId(0); - if (this.test !== 'World') { - If.branchId(0); - Button.createWithLabel(); - Button.width(20); - Button.height(20); - Button.pop(); - } - If.pop(); - } - If.pop(); - Column.pop(); - } -} -loadDocument(new MyComponent("1", undefined, {})); -` diff --git a/compiler/compiler/test/ut/render/if/ifIncludeForEach.ts b/compiler/compiler/test/ut/render/if/ifIncludeForEach.ts deleted file mode 100644 index becd794ee..000000000 --- a/compiler/compiler/test/ut/render/if/ifIncludeForEach.ts +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - -export const source: string = ` -@Entry -@Component -struct HomeComponent { - private value1: string = "hello world 1" - private value2: string = "hello world 2" - private value3: string = "hello world 3" - private values: Array = [] - build() { - Column() { - ForEach(this.values, item => { - Column() { - if (this.value1) { - Text(this.value1) - } - if (this.value2) { - Text(this.value2) - } else { - Text(this.value3) - } - } - }, item => item) - ForEach(this.values, item => { - if (this.value1) { - Text(this.value1) - } - if (this.value2) { - Text(this.value2) - } else { - Text(this.value3) - } - }, item => item) - } - } -}` - -export const expectResult: string = -`class HomeComponent extends View { - constructor(compilerAssignedUniqueChildId, parent, params) { - super(compilerAssignedUniqueChildId, parent); - this.value1 = "hello world 1"; - this.value2 = "hello world 2"; - this.value3 = "hello world 3"; - this.values = []; - this.updateWithValueParams(params); - } - updateWithValueParams(params) { - if (params.value1 !== undefined) { - this.value1 = params.value1; - } - if (params.value2 !== undefined) { - this.value2 = params.value2; - } - if (params.value3 !== undefined) { - this.value3 = params.value3; - } - if (params.values !== undefined) { - this.values = params.values; - } - } - aboutToBeDeleted() { - SubscriberManager.Get().delete(this.id()); - } - render() { - Column.create(); - ForEach.create("2", this, ObservedObject.GetRawObject(this.values), item => { - Column.create(); - If.create(); - if (this.value1) { - If.branchId(0); - Text.create(this.value1); - Text.pop(); - } - If.pop(); - If.create(); - if (this.value2) { - If.branchId(0); - Text.create(this.value2); - Text.pop(); - } - else { - If.branchId(1); - Text.create(this.value3); - Text.pop(); - } - If.pop(); - Column.pop(); - }, item => item); - ForEach.pop(); - ForEach.create("3", this, ObservedObject.GetRawObject(this.values), item => { - If.create(); - if (this.value1) { - If.branchId(0); - Text.create(this.value1); - Text.pop(); - } - If.pop(); - If.create(); - if (this.value2) { - If.branchId(0); - Text.create(this.value2); - Text.pop(); - } - else { - If.branchId(1); - Text.create(this.value3); - Text.pop(); - } - If.pop(); - }, item => item); - ForEach.pop(); - Column.pop(); - } -} -loadDocument(new HomeComponent("1", undefined, {})); -` diff --git a/compiler/compiler/test/ut/struct/struct_01.ts b/compiler/compiler/test/ut/struct/struct_01.ts deleted file mode 100644 index 04d53f94b..000000000 --- a/compiler/compiler/test/ut/struct/struct_01.ts +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - -export const source: string = ` -@Component -@Entry -struct MyComponent { - build() { - } -}` - -export const expectResult: string = -`class MyComponent extends View { - constructor(compilerAssignedUniqueChildId, parent, params) { - super(compilerAssignedUniqueChildId, parent); - this.updateWithValueParams(params); - } - updateWithValueParams(params) { - } - aboutToBeDeleted() { - SubscriberManager.Get().delete(this.id()); - } - render() { - } -} -loadDocument(new MyComponent("1", undefined, {})); -` diff --git a/compiler/compiler/test/ut/struct/struct_02.ts b/compiler/compiler/test/ut/struct/struct_02.ts deleted file mode 100644 index 644ce3bb3..000000000 --- a/compiler/compiler/test/ut/struct/struct_02.ts +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - -export const source: string = ` -struct MyComponent { - build() { - } -}` - -export const expectResult: string = -`class MyComponent { - constructor(compilerAssignedUniqueChildId, parent, params) { } - build() { - } -} -` diff --git a/compiler/compiler/test/ut/transition/transition.ts b/compiler/compiler/test/ut/transition/transition.ts deleted file mode 100644 index bae55792b..000000000 --- a/compiler/compiler/test/ut/transition/transition.ts +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - -export const source: string = ` -@Entry -@Component -struct HomeComponent { - @State scale: number = 1 - @State opacity: number = 1 - build() { - Column() { - Text('hello world') - .fontColor(Color.Red) - }.scale(this.scale) - .opacity(this.opacity) - } - pageTransition() { - PageTransitionEnter({type: RouteType.Push, duration: 1200}) - .slide(SlideEffect.Left) - PageTransitionEnter({type: RouteType.Pop, duration: 1200, curve: Curve.Linear}) - .onEnter((type: RouteType, progress: number) => { - this.scale = 1 - this.opacity = progress - }) - PageTransitionExit({type: RouteType.Push, curve: Curve.Linear}) - .translate({x: 100.0, y: 100.0}) - .opacity(0) - PageTransitionExit({type: RouteType.Pop, duration: 1500, curve: Curve.Ease}) - .onExit((type: RouteType, progress: number) => { - this.scale = 1 - progress - this.opacity = 1 - }) - } -}` - -export const expectResult: string = -`class HomeComponent extends View { - constructor(compilerAssignedUniqueChildId, parent, params) { - super(compilerAssignedUniqueChildId, parent); - this.__scale = new ObservedPropertySimple(1, this, "scale"); - this.__opacity = new ObservedPropertySimple(1, this, "opacity"); - this.updateWithValueParams(params); - } - updateWithValueParams(params) { - if (params.scale !== undefined) { - this.scale = params.scale; - } - if (params.opacity !== undefined) { - this.opacity = params.opacity; - } - } - aboutToBeDeleted() { - this.__scale.aboutToBeDeleted(); - this.__opacity.aboutToBeDeleted(); - SubscriberManager.Get().delete(this.id()); - } - get scale() { - return this.__scale.get(); - } - set scale(newValue) { - this.__scale.set(newValue); - } - get opacity() { - return this.__opacity.get(); - } - set opacity(newValue) { - this.__opacity.set(newValue); - } - render() { - Column.create(); - Column.scale(this.scale); - Column.opacity(this.opacity); - Text.create('hello world'); - Text.fontColor(Color.Red); - Text.pop(); - Column.pop(); - } - pageTransition() { - PageTransition.create(); - PageTransitionEnter.create({ type: RouteType.Push, duration: 1200 }); - PageTransitionEnter.slide(SlideEffect.Left); - PageTransitionEnter.create({ type: RouteType.Pop, duration: 1200, curve: Curve.Linear }); - PageTransitionEnter.onEnter((type, progress) => { - this.scale = 1; - this.opacity = progress; - }); - PageTransitionExit.create({ type: RouteType.Push, curve: Curve.Linear }); - PageTransitionExit.translate({ x: 100.0, y: 100.0 }); - PageTransitionExit.opacity(0); - PageTransitionExit.create({ type: RouteType.Pop, duration: 1500, curve: Curve.Ease }); - PageTransitionExit.onExit((type, progress) => { - this.scale = 1 - progress; - this.opacity = 1; - }); - PageTransition.pop(); - } -} -loadDocument(new HomeComponent("1", undefined, {})); -` \ No newline at end of file diff --git a/compiler/compiler/tsconfig.json b/compiler/compiler/tsconfig.json deleted file mode 100644 index 822f29fa5..000000000 --- a/compiler/compiler/tsconfig.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "compileOnSave": false, - "compilerOptions": { - "allowJs": true, - "allowSyntheticDefaultImports": true, - "esModuleInterop": true, - "importsNotUsedAsValues": "preserve", - "noImplicitAny": false, - "noUnusedLocals": false, - "noUnusedParameters": false, - "experimentalDecorators": true, - "moduleResolution": "node", - "resolveJsonModule": true, - "sourceMap": true, - "module": "commonjs", - "target": "es2017", - "types": [], - "typeRoots": [], - "lib": [ - "es2020" - ] - }, - "exclude": [ - "node_modules" - ] -} \ No newline at end of file diff --git a/compiler/compiler/uglify-source.js b/compiler/compiler/uglify-source.js deleted file mode 100644 index 0823ead66..000000000 --- a/compiler/compiler/uglify-source.js +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2020 Huawei Device Co., Ltd. - * 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. - */ - -const fs = require('fs') -const path = require('path') -const uglifyJS = require('uglify-es') - -readCode(process.argv[2]) - -function readCode(inputPath) { - if (fs.existsSync(inputPath)) { - const files = fs.readdirSync(inputPath) - files.forEach(function(file) { - const filePath = path.join(inputPath, file) - if (fs.existsSync(filePath)) { - const fileStat = fs.statSync(filePath) - if (fileStat.isFile()) { - const code = fs.readFileSync(filePath, 'utf-8') - uglifyCode(code,filePath) - } - if (fileStat.isDirectory()) { - readCode(filePath) - } - } - }) - } -} - -function uglifyCode(code, outPath) { - const uglifyCode = uglifyJS.minify(code).code - fs.writeFileSync(outPath, uglifyCode) -} diff --git a/compiler/compiler/webpack.config.js b/compiler/compiler/webpack.config.js deleted file mode 100644 index 8e0ab7b80..000000000 --- a/compiler/compiler/webpack.config.js +++ /dev/null @@ -1,188 +0,0 @@ -/* - * Copyright (c) 2020 Huawei Device Co., Ltd. - * 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. - */ - -const path = require('path'); -const { CleanWebpackPlugin } = require('clean-webpack-plugin'); -const CopyPlugin = require('copy-webpack-plugin'); -const Webpack = require('webpack'); -const { GenAbcPlugin } = require('./lib/gen_abc_plugin'); - -const { - projectConfig, - loadEntryObj, - readAppResource, - resources, - loadWorker, - abilityConfig -} = require('./main'); -const { ResultStates } = require('./lib/compile_info'); -const { processUISyntax } = require('./lib/process_ui_syntax'); -const { IGNORE_ERROR_CODE } = require('./lib/utils'); - -const watchMode = (process.env.watchMode && process.env.watchMode === 'true') || false; - -function initConfig(config) { - const projectPath = path.resolve(projectConfig.projectPath); - Object.assign(config, { - entry: projectConfig.entryObj, - watch: watchMode, - watchOptions: { - aggregateTimeout: 10, - poll: false, - ignored: /node_modules/ - }, - output: { - path: path.resolve(__dirname, projectConfig.buildPath), - filename: '[name].js', - devtoolModuleFilenameTemplate: 'webpack:///[absolute-resource-path]' - }, - devtool: 'nosources-source-map', - mode: 'development', - module: { - rules: [ - { - test: /\.(ets|ts)$/, - use: [ - { loader: path.resolve(__dirname, 'lib/result_process.js') }, - { - loader: 'ts-loader', - options: { - appendTsSuffixTo: [/\.ets$/], - onlyCompileBundledFiles: true, - configFile: path.resolve(__dirname, 'tsconfig.json'), - getCustomTransformers(program) { - return { - before: [processUISyntax(program)], - after: [] - }; - }, - ignoreDiagnostics: IGNORE_ERROR_CODE - } - }, - { loader: path.resolve(__dirname, 'lib/pre_process.js') } - ] - }, - { - test: /\.js$/, - use: [ - { loader: path.resolve(__dirname, 'lib/process_system_module.js') } - ] - } - ] - }, - node: { - global: false - }, - resolve: { - extensions:['.js', '.ets', '.ts'], - modules: [ - projectPath, - path.join(projectPath, '../../../../../'), - './node_modules', - path.join(__dirname, 'node_modules') - ] - }, - stats: { preset: 'none' }, - plugins: [ - new Webpack.WatchIgnorePlugin({ - paths: [ - /\.js$/, - /\.d\.ts$/ - ]}), - new CleanWebpackPlugin(), - new ResultStates() - ] - }) -} - -function setProjectConfig(envArgs) { - const args = Object.keys(envArgs); - if (args.indexOf('projectName') === args.length - 2) { - projectConfig.projectPath = path.join(process.cwd(), args[args.length - 1]); - } - if (envArgs.aceModuleRoot) { - projectConfig.projectPath = envArgs.aceModuleRoot; - } - if (envArgs.aceModuleBuild) { - projectConfig.buildPath = envArgs.aceModuleBuild; - } - if (envArgs.aceManifestPath) { - projectConfig.manifestFilePath = envArgs.aceManifestPath; - } -} - -function setReleaseConfig(config) { - const TerserPlugin = require('terser-webpack-plugin'); - config.mode = 'production'; - config.optimization = { - emitOnErrors: true, - usedExports: false, - minimize: true, - minimizer: [ new TerserPlugin() ] - }; - config.output.sourceMapFilename = '_releaseMap/[name].js.map'; -} - -function setCopyPluginConfig(config) { - const copyPluginPattrens = []; - copyPluginPattrens.push({ - from: '**/*', - context: path.resolve(__dirname, projectConfig.projectPath), - globOptions: { - ignore: [ - '**/*.ets', - '**/*.ts', - '**/*.js', - path.resolve(__dirname, projectConfig.buildPath, '**').replace(/\\/g, '/') - ] - }, - noErrorOnMissing: true - }); - if (abilityConfig.abilityType === 'page') { - copyPluginPattrens.push({ from: projectConfig.manifestFilePath }); - } - config.plugins.push(new CopyPlugin({ patterns: copyPluginPattrens })); -} - -module.exports = (env, argv) => { - const config = {}; - setProjectConfig(env); - loadEntryObj(projectConfig); - initConfig(config); - setCopyPluginConfig(config); - - if (env.isPreview !== "true") { - loadWorker(projectConfig); - if (env.compilerType && env.compilerType === 'ark') { - config.plugins.push(new GenAbcPlugin(projectConfig.buildPath, path.join(__dirname, 'bin'), env.buildMode === 'debug')); - } - } else { - projectConfig.isPreview = true; - } - - if (env.sourceMap === 'none') { - config.devtool = false; - } - - if (env.buildMode === 'release') { - setReleaseConfig(config); - } - - const appResourcePath = env.appResource || process.env.appResource; - if (appResourcePath) { - readAppResource(resources, appResourcePath); - } - return config; -} -- Gitee From 916bdca8a7e90dc93c6ac7249137b3fa910f8af4 Mon Sep 17 00:00:00 2001 From: songbeibei Date: Mon, 22 Nov 2021 20:53:49 +0800 Subject: [PATCH 3/8] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E7=BB=93=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LICENSE.md | 177 ++++++++++++++++++ compiler/README.md | 2 +- .../expected/component-01-expected.js | 2 +- generateSysResource.py | 16 ++ 4 files changed, 195 insertions(+), 2 deletions(-) create mode 100644 LICENSE.md diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 000000000..4947287f7 --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,177 @@ + + 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 \ No newline at end of file diff --git a/compiler/README.md b/compiler/README.md index f3d80c2f2..ed7654a89 100644 --- a/compiler/README.md +++ b/compiler/README.md @@ -21,7 +21,7 @@ First, check whether your node version is 12.x or later; Secondly, config npm proxy and run `npm install` again. ``` npm config set strict-ssl false -npm config set registry https://cmc.centralrepo.rnd.huawei.com/npm/ +npm config set registry http://registry.npm.taobao.org ``` ### 2. Quick Start diff --git a/compiler/sample/pages/testcases/expected/component-01-expected.js b/compiler/sample/pages/testcases/expected/component-01-expected.js index ae202268d..ab53813c4 100644 --- a/compiler/sample/pages/testcases/expected/component-01-expected.js +++ b/compiler/sample/pages/testcases/expected/component-01-expected.js @@ -20,7 +20,7 @@ class MyComponent extends View { this.value1 = value1; this.value2 = value2; this.value3 = value3; - console.info('into constructor'); + } render() { return new Column(new Text(this.value1), new Text(this.value2), new Text(this.value3)); } } diff --git a/generateSysResource.py b/generateSysResource.py index 95f0c0bf7..592c33334 100644 --- a/generateSysResource.py +++ b/generateSysResource.py @@ -1,5 +1,21 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- + +# /* +# Copyright (c) 2021 Huawei Device Co., Ltd. +# 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. + + import json import os import argparse -- Gitee From 076f817e8e07cfa2db5663ca65e10c1dcede87c3 Mon Sep 17 00:00:00 2001 From: songbeibei Date: Tue, 23 Nov 2021 11:09:14 +0800 Subject: [PATCH 4/8] =?UTF-8?q?=E5=90=8E=E7=BC=80gn=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LICENSE.md => LICENS.gn | 0 compiler/sample/app.ets | 1 - compiler/sample/pages/home.ets | 1 - compiler/sample/pages/home_preview.ets | 1 - compiler/sample/pages/index.ets | 1 - .../pages/testcases/componentListTest.ets | 1 - .../sample/pages/testcases/constructor-01.ets | 1 - .../expected/component-01-expected.js | 1 - .../expected/constructor-01-expected.js | 1 - .../testcases/expected/link-01-expected.js | 1 - .../testcases/expected/struct-01-expected.js | 1 - .../testcases/expected/struct-02-expected.js | 1 - compiler/sample/pages/testcases/image.ets | 1 - .../sample/pages/testcases/import-api-01.ets | 1 - compiler/sample/pages/testcases/link-01.ets | 1 - .../sample/pages/testcases/linkArrayModel.ets | 1 - .../sample/pages/testcases/linkPropCombo.ets | 1 - .../pages/testcases/linkSimpleModel.ets | 1 - compiler/sample/pages/testcases/new-01.ets | 1 - compiler/sample/pages/testcases/new-0101.ets | 1 - compiler/sample/pages/testcases/new-04.ets | 1 - .../pages/testcases/showcaseCovid19.ets | 26 +++++++--------- .../sample/pages/testcases/simpleText.ets | 1 - .../pages/testcases/stateArrayReverse.ets | 30 +++++++++---------- .../testcases/stateArrayReverseCustomView.ets | 1 - .../pages/testcases/stateComplexType.ets | 1 - .../pages/testcases/stateStateBindingProp.ets | 1 - compiler/sample/pages/testcases/struct-02.ets | 1 - compiler/sample/pages/todo.ets | 26 ++++++++-------- compiler/test/pages/ExportComponent.ets | 1 - compiler/test/pages/ExportStarComponent.ets | 1 - generateSysResource.py | 5 ++-- 32 files changed, 39 insertions(+), 75 deletions(-) rename LICENSE.md => LICENS.gn (100%) diff --git a/LICENSE.md b/LICENS.gn similarity index 100% rename from LICENSE.md rename to LICENS.gn diff --git a/compiler/sample/app.ets b/compiler/sample/app.ets index 8e35f7b00..0759beef2 100644 --- a/compiler/sample/app.ets +++ b/compiler/sample/app.ets @@ -13,7 +13,6 @@ * limitations under the License. */ - export default { onCreate() { console.info('Application onCreate') diff --git a/compiler/sample/pages/home.ets b/compiler/sample/pages/home.ets index 65b5d3974..3079671f1 100644 --- a/compiler/sample/pages/home.ets +++ b/compiler/sample/pages/home.ets @@ -13,7 +13,6 @@ * limitations under the License. */ - @Entry @Component struct HomeComponent { diff --git a/compiler/sample/pages/home_preview.ets b/compiler/sample/pages/home_preview.ets index 53fe3642d..c4352e719 100644 --- a/compiler/sample/pages/home_preview.ets +++ b/compiler/sample/pages/home_preview.ets @@ -13,7 +13,6 @@ * limitations under the License. */ - @Entry @Component struct HomePreviewComponent { diff --git a/compiler/sample/pages/index.ets b/compiler/sample/pages/index.ets index 9708e4ba0..2dd5eb53d 100644 --- a/compiler/sample/pages/index.ets +++ b/compiler/sample/pages/index.ets @@ -13,7 +13,6 @@ * limitations under the License. */ - @Component struct Banner { private value1: string = "hello world 4" diff --git a/compiler/sample/pages/testcases/componentListTest.ets b/compiler/sample/pages/testcases/componentListTest.ets index 1b60675ed..37d42cfcb 100644 --- a/compiler/sample/pages/testcases/componentListTest.ets +++ b/compiler/sample/pages/testcases/componentListTest.ets @@ -13,7 +13,6 @@ * limitations under the License. */ - @Entry @Component struct ListRootView { diff --git a/compiler/sample/pages/testcases/constructor-01.ets b/compiler/sample/pages/testcases/constructor-01.ets index 77aac86c2..139b5c496 100644 --- a/compiler/sample/pages/testcases/constructor-01.ets +++ b/compiler/sample/pages/testcases/constructor-01.ets @@ -13,7 +13,6 @@ * limitations under the License. */ - class DataModel{ private myData1: number = 0 } diff --git a/compiler/sample/pages/testcases/expected/component-01-expected.js b/compiler/sample/pages/testcases/expected/component-01-expected.js index ab53813c4..4b061aff0 100644 --- a/compiler/sample/pages/testcases/expected/component-01-expected.js +++ b/compiler/sample/pages/testcases/expected/component-01-expected.js @@ -13,7 +13,6 @@ * limitations under the License. */ - class MyComponent extends View { constructor() { super(); diff --git a/compiler/sample/pages/testcases/expected/constructor-01-expected.js b/compiler/sample/pages/testcases/expected/constructor-01-expected.js index 53ca41c94..0dd998288 100644 --- a/compiler/sample/pages/testcases/expected/constructor-01-expected.js +++ b/compiler/sample/pages/testcases/expected/constructor-01-expected.js @@ -13,7 +13,6 @@ * limitations under the License. */ - class MyStateComponent extends View { constructor(inputParams) { super(); diff --git a/compiler/sample/pages/testcases/expected/link-01-expected.js b/compiler/sample/pages/testcases/expected/link-01-expected.js index d0ba0a588..2d3a148a5 100644 --- a/compiler/sample/pages/testcases/expected/link-01-expected.js +++ b/compiler/sample/pages/testcases/expected/link-01-expected.js @@ -13,7 +13,6 @@ * limitations under the License. */ - class MyLinkTestComponent extends View { constructor(inputParams) { super(); diff --git a/compiler/sample/pages/testcases/expected/struct-01-expected.js b/compiler/sample/pages/testcases/expected/struct-01-expected.js index fa4b84a95..3808218ea 100644 --- a/compiler/sample/pages/testcases/expected/struct-01-expected.js +++ b/compiler/sample/pages/testcases/expected/struct-01-expected.js @@ -13,7 +13,6 @@ * limitations under the License. */ - class MyComponent extends View { render() { } diff --git a/compiler/sample/pages/testcases/expected/struct-02-expected.js b/compiler/sample/pages/testcases/expected/struct-02-expected.js index 11297a9a4..c68c35b33 100644 --- a/compiler/sample/pages/testcases/expected/struct-02-expected.js +++ b/compiler/sample/pages/testcases/expected/struct-02-expected.js @@ -13,7 +13,6 @@ * limitations under the License. */ - class MyComponent { build() { } diff --git a/compiler/sample/pages/testcases/image.ets b/compiler/sample/pages/testcases/image.ets index 26ba6d705..632256b50 100644 --- a/compiler/sample/pages/testcases/image.ets +++ b/compiler/sample/pages/testcases/image.ets @@ -13,7 +13,6 @@ * limitations under the License. */ - @Entry @Component struct UserView1 { diff --git a/compiler/sample/pages/testcases/import-api-01.ets b/compiler/sample/pages/testcases/import-api-01.ets index e2e3ceaa4..7c1d6a6bc 100644 --- a/compiler/sample/pages/testcases/import-api-01.ets +++ b/compiler/sample/pages/testcases/import-api-01.ets @@ -13,7 +13,6 @@ * limitations under the License. */ - import fetch from '@system.fetch' import router from '@system.router' diff --git a/compiler/sample/pages/testcases/link-01.ets b/compiler/sample/pages/testcases/link-01.ets index aff09ab50..1af77002e 100644 --- a/compiler/sample/pages/testcases/link-01.ets +++ b/compiler/sample/pages/testcases/link-01.ets @@ -13,7 +13,6 @@ * limitations under the License. */ - @Component struct MyLinkTestComponent { @Link myLink1?: any diff --git a/compiler/sample/pages/testcases/linkArrayModel.ets b/compiler/sample/pages/testcases/linkArrayModel.ets index f4901f8b6..882e79169 100644 --- a/compiler/sample/pages/testcases/linkArrayModel.ets +++ b/compiler/sample/pages/testcases/linkArrayModel.ets @@ -13,7 +13,6 @@ * limitations under the License. */ - @Component @Entry struct Parent { diff --git a/compiler/sample/pages/testcases/linkPropCombo.ets b/compiler/sample/pages/testcases/linkPropCombo.ets index 03d834813..8ba060e71 100644 --- a/compiler/sample/pages/testcases/linkPropCombo.ets +++ b/compiler/sample/pages/testcases/linkPropCombo.ets @@ -13,7 +13,6 @@ * limitations under the License. */ - @Component @Entry struct ParentView { diff --git a/compiler/sample/pages/testcases/linkSimpleModel.ets b/compiler/sample/pages/testcases/linkSimpleModel.ets index 4f2947eb8..c68c24863 100644 --- a/compiler/sample/pages/testcases/linkSimpleModel.ets +++ b/compiler/sample/pages/testcases/linkSimpleModel.ets @@ -13,7 +13,6 @@ * limitations under the License. */ - @Component @Entry struct Player { diff --git a/compiler/sample/pages/testcases/new-01.ets b/compiler/sample/pages/testcases/new-01.ets index 7f6c51a5c..cbe88d23a 100644 --- a/compiler/sample/pages/testcases/new-01.ets +++ b/compiler/sample/pages/testcases/new-01.ets @@ -13,7 +13,6 @@ * limitations under the License. */ - @Component @Entry struct MyComponent3 { diff --git a/compiler/sample/pages/testcases/new-0101.ets b/compiler/sample/pages/testcases/new-0101.ets index 7f6c51a5c..cbe88d23a 100644 --- a/compiler/sample/pages/testcases/new-0101.ets +++ b/compiler/sample/pages/testcases/new-0101.ets @@ -13,7 +13,6 @@ * limitations under the License. */ - @Component @Entry struct MyComponent3 { diff --git a/compiler/sample/pages/testcases/new-04.ets b/compiler/sample/pages/testcases/new-04.ets index b8f1c7ecb..b3e93de2c 100644 --- a/compiler/sample/pages/testcases/new-04.ets +++ b/compiler/sample/pages/testcases/new-04.ets @@ -13,7 +13,6 @@ * limitations under the License. */ - @Component struct Banner { private value1: string = "hello world 2"; diff --git a/compiler/sample/pages/testcases/showcaseCovid19.ets b/compiler/sample/pages/testcases/showcaseCovid19.ets index 14a8a57a8..01a058645 100644 --- a/compiler/sample/pages/testcases/showcaseCovid19.ets +++ b/compiler/sample/pages/testcases/showcaseCovid19.ets @@ -1,17 +1,4 @@ - - -/** - * COVID Showcase App - * - * Made for the purpose of comparing ACE-Diff with ACE-JSF. - * Read the README.md file in the same directory for build instructions - * - * ACE @ Web Helsinki - * - - */ - - /* +/* * Copyright (c) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,7 +13,16 @@ * limitations under the License. */ - +/** + * COVID Showcase App + * + * Made for the purpose of comparing ACE-Diff with ACE-JSF. + * Read the README.md file in the same directory for build instructions + * + * ACE @ Web Helsinki + * + + */ const enum FlexAlign { AUTO, diff --git a/compiler/sample/pages/testcases/simpleText.ets b/compiler/sample/pages/testcases/simpleText.ets index 9a982d6b0..e05d17131 100644 --- a/compiler/sample/pages/testcases/simpleText.ets +++ b/compiler/sample/pages/testcases/simpleText.ets @@ -13,7 +13,6 @@ * limitations under the License. */ - @Entry @Component struct UserView { diff --git a/compiler/sample/pages/testcases/stateArrayReverse.ets b/compiler/sample/pages/testcases/stateArrayReverse.ets index bc8e5eb5b..e63d8937f 100644 --- a/compiler/sample/pages/testcases/stateArrayReverse.ets +++ b/compiler/sample/pages/testcases/stateArrayReverse.ets @@ -1,3 +1,17 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ /* StateArrayReverse test case @@ -16,22 +30,6 @@ */ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * 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. - */ - - class Item1 { id:number; label:string; diff --git a/compiler/sample/pages/testcases/stateArrayReverseCustomView.ets b/compiler/sample/pages/testcases/stateArrayReverseCustomView.ets index f6e3bc1ba..b127cb00e 100644 --- a/compiler/sample/pages/testcases/stateArrayReverseCustomView.ets +++ b/compiler/sample/pages/testcases/stateArrayReverseCustomView.ets @@ -13,7 +13,6 @@ * limitations under the License. */ - class Item{ id:number = 0; label:string = ''; diff --git a/compiler/sample/pages/testcases/stateComplexType.ets b/compiler/sample/pages/testcases/stateComplexType.ets index 6071b5aec..0d58d8b94 100644 --- a/compiler/sample/pages/testcases/stateComplexType.ets +++ b/compiler/sample/pages/testcases/stateComplexType.ets @@ -13,7 +13,6 @@ * limitations under the License. */ - // Customize the status data class. class Model { value: string = ''; diff --git a/compiler/sample/pages/testcases/stateStateBindingProp.ets b/compiler/sample/pages/testcases/stateStateBindingProp.ets index 5e4ae423a..6fdad55c4 100644 --- a/compiler/sample/pages/testcases/stateStateBindingProp.ets +++ b/compiler/sample/pages/testcases/stateStateBindingProp.ets @@ -13,7 +13,6 @@ * limitations under the License. */ - class GreenButtonState { width:number = 0; diff --git a/compiler/sample/pages/testcases/struct-02.ets b/compiler/sample/pages/testcases/struct-02.ets index 3ecc7a771..e98ed82f8 100644 --- a/compiler/sample/pages/testcases/struct-02.ets +++ b/compiler/sample/pages/testcases/struct-02.ets @@ -13,7 +13,6 @@ * limitations under the License. */ - struct MyComponent8 { build() { } diff --git a/compiler/sample/pages/todo.ets b/compiler/sample/pages/todo.ets index 033ff0d97..e3cbe4b4c 100644 --- a/compiler/sample/pages/todo.ets +++ b/compiler/sample/pages/todo.ets @@ -1,16 +1,3 @@ - -/** - * ACE @ Web Helsinki - * - * eDSL version of TODO application - * - * ( unverified due to lack of working eDSL transpiler ) - * - * For comparison, the plain JS version of this app that works with ACE-Diff can be found here - * https://rnd-gitlab-eu-c.huawei.com/zidanehbs/ace/ace/-/blob/fin-hmf-dev-ace-diff-clean/samples/common/res/hi_topapp/assets/js/default/acediff/todoListForEach.js - * This is the ouput the eDSL transpiler should generate. - */ - /* * Copyright (c) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -26,7 +13,18 @@ * limitations under the License. */ - +/** + * ACE @ Web Helsinki + * + * eDSL version of TODO application + * + * ( unverified due to lack of working eDSL transpiler ) + * + * For comparison, the plain JS version of this app that works with ACE-Diff can be found here + * https://rnd-gitlab-eu-c.huawei.com/zidanehbs/ace/ace/-/blob/fin-hmf-dev-ace-diff-clean/samples/common/res/hi_topapp/assets/js/default/acediff/todoListForEach.js + * This is the ouput the eDSL transpiler should generate. + */ + let tasks: Array = [ { label: "Wash the car" }, { label: "Buy some milk" }, diff --git a/compiler/test/pages/ExportComponent.ets b/compiler/test/pages/ExportComponent.ets index ba582d538..d3d65b425 100644 --- a/compiler/test/pages/ExportComponent.ets +++ b/compiler/test/pages/ExportComponent.ets @@ -13,7 +13,6 @@ * limitations under the License. */ - import DefaultComponent from "./test/pages/DefaultComponent.ets" @Component diff --git a/compiler/test/pages/ExportStarComponent.ets b/compiler/test/pages/ExportStarComponent.ets index d9d450293..164a1cc91 100644 --- a/compiler/test/pages/ExportStarComponent.ets +++ b/compiler/test/pages/ExportStarComponent.ets @@ -13,5 +13,4 @@ * limitations under the License. */ - export * as AllStarComponent from './test/pages/ExportComponent'; diff --git a/generateSysResource.py b/generateSysResource.py index 592c33334..2a80ebe7b 100644 --- a/generateSysResource.py +++ b/generateSysResource.py @@ -1,6 +1,3 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - # /* # Copyright (c) 2021 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); @@ -15,6 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. +#!/usr/bin/env python +# -*- coding: utf-8 -*- import json import os -- Gitee From bcf26cd089fb41d66464c024f2fed361148cfb96 Mon Sep 17 00:00:00 2001 From: songbeibei Date: Tue, 23 Nov 2021 11:28:45 +0800 Subject: [PATCH 5/8] songbeibei3@huawei.com Signed-off-by: songbeibei --- .../sample/pages/testcases/expected/component-01-expected.js | 1 - 1 file changed, 1 deletion(-) diff --git a/compiler/sample/pages/testcases/expected/component-01-expected.js b/compiler/sample/pages/testcases/expected/component-01-expected.js index 4b061aff0..17617442a 100644 --- a/compiler/sample/pages/testcases/expected/component-01-expected.js +++ b/compiler/sample/pages/testcases/expected/component-01-expected.js @@ -19,7 +19,6 @@ class MyComponent extends View { this.value1 = value1; this.value2 = value2; this.value3 = value3; - } render() { return new Column(new Text(this.value1), new Text(this.value2), new Text(this.value3)); } } -- Gitee From a449e8f256b64b45160a7fcb719e51825f7ee939 Mon Sep 17 00:00:00 2001 From: songbeibei Date: Tue, 23 Nov 2021 11:50:51 +0800 Subject: [PATCH 6/8] 3409533354@qq.com Signed-off-by: songbeibei --- .../sample/pages/testcases/expected/component-01-expected.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/sample/pages/testcases/expected/component-01-expected.js b/compiler/sample/pages/testcases/expected/component-01-expected.js index 17617442a..8c3387bc0 100644 --- a/compiler/sample/pages/testcases/expected/component-01-expected.js +++ b/compiler/sample/pages/testcases/expected/component-01-expected.js @@ -15,7 +15,7 @@ class MyComponent extends View { constructor() { - super(); + super(); this.value1 = value1; this.value2 = value2; this.value3 = value3; -- Gitee From f4a34e364030de4697a9bdfaf2939349a67e0f9f Mon Sep 17 00:00:00 2001 From: songbeibei Date: Tue, 23 Nov 2021 12:13:28 +0800 Subject: [PATCH 7/8] 3409533354@qq.com Signed-off-by: songbeibei --- LICENS.gn => LICENS | 0 compiler/sample/pages/home_preview.ets | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename LICENS.gn => LICENS (100%) diff --git a/LICENS.gn b/LICENS similarity index 100% rename from LICENS.gn rename to LICENS diff --git a/compiler/sample/pages/home_preview.ets b/compiler/sample/pages/home_preview.ets index c4352e719..c11cf6319 100644 --- a/compiler/sample/pages/home_preview.ets +++ b/compiler/sample/pages/home_preview.ets @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - + @Entry @Component struct HomePreviewComponent { -- Gitee From 533131f0ec246303751fe0821fa3540b012c8624 Mon Sep 17 00:00:00 2001 From: songbeibei Date: Tue, 23 Nov 2021 12:23:25 +0800 Subject: [PATCH 8/8] 3409533354@qq.com Signed-off-by: songbeibei --- LICENS | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/LICENS b/LICENS index 4947287f7..41fe3ba05 100644 --- a/LICENS +++ b/LICENS @@ -1,4 +1,18 @@ - +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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. + */ + Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ -- Gitee