diff --git a/BUILD.gn b/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..20068f1ab6d6d5e619a616a392b31f1d462289fa --- /dev/null +++ b/BUILD.gn @@ -0,0 +1,130 @@ +# Copyright (c) Huawei Technologies Co., Ltd. 2021-2021. All rights reserved. + +import("//build/ohos.gni") +import("//build/ohos/ace/ace.gni") +import("//foundation/ace/ace_engine/ace_config.gni") + +ets_loader_lib_dir = + get_label_info(":build_ets_loader_library", "target_out_dir") + "/lib" +ets_loader_declarations_dir = get_label_info(":build_ets_loader_library", + "target_out_dir") + "/declarations" +ets_loader_component_config_file = + get_label_info(":build_ets_loader_library", "target_out_dir") + + "/component_config.json" +ets_sysResource = get_label_info(":build_ets_sysResource", "target_out_dir") + + "/sysResource.js" + +action("build_ets_loader_library") { + script = "//foundation/ace/huawei_proprietary/tools/ets-loader/build_ets_loader_library.py" + depfile = "$target_gen_dir/$target_name.d" + outputs = [ + ets_loader_lib_dir, + ets_loader_declarations_dir, + ets_loader_component_config_file, + ] + + _ets_loader_dir = + "//foundation/ace/huawei_proprietary/tools/ets-loader/compiler" + _ace_toolkit_dir = "//prebuilts/ace-toolkit/ets-loader/compiler" + _declarations_file_dir = "//interface/sdk-js/api/@internal/component/ets" + + _babel_js = _ace_toolkit_dir + "/node_modules/@babel/cli/bin/babel.js" + _babel_config_js = _ace_toolkit_dir + "/babel.config.js" + _uglify_source_js = _ace_toolkit_dir + "/uglify-source.js" + _build_declarations_file_js = _ace_toolkit_dir + "/build_declarations_file.js" + + inputs = [ + _babel_config_js, + _babel_js, + _uglify_source_js, + _build_declarations_file_js, + ] + + # different host platform nodejs tool directory + if (host_os == "linux") { + nodejs_path = + "//prebuilts/ace-toolkit/nodejs/node-v12.18.4-linux-x64/bin/node" + } else if (host_os == "mac") { + nodejs_path = + "//prebuilts/ace-toolkit/nodejs/node-v12.18.4-darwin-x64/bin/node" + } else { + assert(false, "Unsupported host_os: $host_os") + } + + args = [ + "--depfile", + rebase_path(depfile, root_build_dir), + "--node", + rebase_path(nodejs_path, root_build_dir), + "--babel-js", + rebase_path(_babel_js, root_build_dir), + "--ets-loader-src-dir", + rebase_path(_ets_loader_dir + "/src", root_build_dir), + "--babel-config-js", + rebase_path(_babel_config_js, root_build_dir), + "--uglify-source-js", + rebase_path(_uglify_source_js, root_build_dir), + "--output-dir", + rebase_path(ets_loader_lib_dir, root_build_dir), + "--declarations-file-dir", + rebase_path(_declarations_file_dir, root_build_dir), + "--build-declarations-file-js", + rebase_path(_build_declarations_file_js, root_build_dir), + "--output-declarations-dir", + rebase_path(ets_loader_declarations_dir, root_build_dir), + "--output-component-config-file", + rebase_path(ets_loader_component_config_file, root_build_dir), + ] +} + +action("build_ets_sysResource") { + script = "//foundation/ace/huawei_proprietary/tools/ets-loader/generateSysResource.py" + outputs = [ ets_sysResource ] + + _id_defined_json = + "//utils/resources/systemres/main/resources/base/element/id_defined.json" + inputs = [ _id_defined_json ] + + args = [ + "--input-json", + rebase_path(_id_defined_json, root_build_dir), + "--output-js", + rebase_path(ets_sysResource, root_build_dir), + ] +} + +ohos_copy("ets_loader") { + deps = [ + ":build_ets_loader_library", + ":build_ets_sysResource", + ] + sources = [ + "compiler/main.js", + "compiler/npm-install.js", + "compiler/package-lock.json", + "compiler/package.json", + "compiler/tsconfig.json", + "compiler/webpack.config.js", + ets_loader_component_config_file, + ets_sysResource, + ] + outputs = [ target_out_dir + "/$target_name/{{source_file_part}}" ] + module_source_dir = target_out_dir + "/$target_name" + module_install_name = "" +} + +ohos_copy("ets_loader_library") { + deps = [ ":build_ets_loader_library" ] + sources = [ ets_loader_lib_dir ] + outputs = [ target_out_dir + "/$target_name" ] + module_source_dir = target_out_dir + "/$target_name" + module_install_name = "" +} + +ohos_copy("ets_loader_declaration") { + deps = [ ":build_ets_loader_library" ] + sources = [ ets_loader_declarations_dir ] + outputs = [ target_out_dir + "/$target_name" ] + module_source_dir = target_out_dir + "/$target_name" + module_install_name = "" +} diff --git a/build_ets_loader_library.py b/build_ets_loader_library.py new file mode 100644 index 0000000000000000000000000000000000000000..9d79e430be24c230d03b742e166a07ad5f2c3b1d --- /dev/null +++ b/build_ets_loader_library.py @@ -0,0 +1,88 @@ +#!/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 os +import sys +import subprocess +import argparse + +sys.path.append( + os.path.join(os.path.dirname(__file__), os.pardir, os.pardir, os.pardir, + os.pardir, os.pardir, 'build')) +from maple.java.util import build_utils # noqa: E402 + + +def parse_args(): + + parser = argparse.ArgumentParser() + build_utils.add_depfile_option(parser) + + parser.add_argument('--node', help='path to nodejs exetuable') + parser.add_argument('--babel-js', help='path to babel.js') + parser.add_argument('--ets-loader-src-dir', help='path to compiler/src') + parser.add_argument('--babel-config-js', help='path babel.config.js') + parser.add_argument('--uglify-source-js', help='path uglify-source.js') + parser.add_argument('--output-dir', help='path to output') + parser.add_argument('--declarations-file-dir', + help='path declarations file') + parser.add_argument('--build-declarations-file-js', + help='path build_declarations_file.js') + parser.add_argument('--output-declarations-dir', + help='path declarations file to output') + parser.add_argument('--output-component-config-file', + help='path component config file to output') + + options = parser.parse_args() + return options + + +def do_build(build_cmd, uglify_cmd, build_declarations_file_cmd): + for cmd in [build_cmd, uglify_cmd, build_declarations_file_cmd]: + build_utils.check_output(cmd) + + +def main(): + options = parse_args() + build_cmd = [ + options.node, options.babel_js, options.ets_loader_src_dir + ] + build_cmd.extend(['--out-dir', options.output_dir]) + build_cmd.extend(['--extensions', '.ts']) + build_cmd.extend(['--config-file', options.babel_config_js]) + depfile_deps = [options.node, options.babel_js, options.babel_config_js] + depfile_deps.extend(build_utils.get_all_files(options.ets_loader_src_dir)) + + uglify_cmd = [options.node, options.uglify_source_js, options.output_dir] + depfile_deps.append(options.uglify_source_js) + + build_declarations_file_cmd = [options.node, + options.build_declarations_file_js, + options.declarations_file_dir, + options.output_declarations_dir, + options.output_dir] + depfile_deps.append(options.build_declarations_file_js) + + build_utils.call_and_write_depfile_if_stale( + lambda: do_build(build_cmd, uglify_cmd, build_declarations_file_cmd), + options, + depfile_deps=depfile_deps, + input_paths=depfile_deps, + output_paths=([ + options.output_dir, + options.output_declarations_dir, + options.output_component_config_file])) + +if __name__ == '__main__': + sys.exit(main()) diff --git a/compiler/.eslintrc b/compiler/.eslintrc new file mode 100644 index 0000000000000000000000000000000000000000..4d857e85cafde8e72b9ce215bd7bf2b5cac85f48 --- /dev/null +++ b/compiler/.eslintrc @@ -0,0 +1,89 @@ +{ + "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/README.md b/compiler/README.md new file mode 100644 index 0000000000000000000000000000000000000000..f3d80c2f2906eea6b48227f4cfb7c16b35f3678e --- /dev/null +++ b/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/babel.config.js b/compiler/babel.config.js new file mode 100644 index 0000000000000000000000000000000000000000..1c8aa70516ca7db5bda81d75107c87ef219eea50 --- /dev/null +++ b/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/build_declarations_file.js b/compiler/build_declarations_file.js new file mode 100644 index 0000000000000000000000000000000000000000..22a1f6275632e8dc01e9b1863d4362650e7818b9 --- /dev/null +++ b/compiler/build_declarations_file.js @@ -0,0 +1,117 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT 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(); +function generateTargetFile() { + const filePath = path.resolve(__dirname, '../../../../../../interface/sdk-js/api/@internal/component/ets'); + const output = path.resolve(__dirname, './declarations'); + 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; +} diff --git a/compiler/examples/calendar/app.ets b/compiler/examples/calendar/app.ets new file mode 100644 index 0000000000000000000000000000000000000000..0be61a623b0216ebbfacf77d8871f2fcaf1de68e --- /dev/null +++ b/compiler/examples/calendar/app.ets @@ -0,0 +1,8 @@ +export default { + onCreate() { + console.info('Application onCreate') + }, + onDestroy() { + console.info('Application onDestroy') + }, +} diff --git a/compiler/examples/calendar/manifest.json b/compiler/examples/calendar/manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..6a6087dcd4207b11c40b9d05d469a26960650d79 --- /dev/null +++ b/compiler/examples/calendar/manifest.json @@ -0,0 +1,10 @@ +{ + "appID": "com.huawei.calendar", + "appName": "calendar", + "versionName": "1.0.0", + "versionCode": 1, + "minPlatformVersion": "2.0.0", + "pages": [ + "pages/calendar" + ] +} diff --git a/compiler/examples/calendar/pages/calendar.ets b/compiler/examples/calendar/pages/calendar.ets new file mode 100644 index 0000000000000000000000000000000000000000..fa9d39a550cd04b6e2091364f89d1363856e3c85 --- /dev/null +++ b/compiler/examples/calendar/pages/calendar.ets @@ -0,0 +1,147 @@ +@Component +struct Title { + @Prop currentMonth: number + @Prop currentYear: number + private weekNames: string[] = ['日', '一', '二', '三', '四', '五', '六'] + build() { + Column() { + Column() { + Text(`${this.currentYear} 年 ${this.currentMonth+1} 月`) + .fontSize(17) + .fontWeight(FontWeight.Bold) + }.height(39) + Grid() { + ForEach( + this.weekNames, + item => { + GridItem() { + Text(item) + .fontSize(10) + } + }, + item => item + ) + }.rowsTemplate('1fr').columnsTemplate('1fr 1fr 1fr 1fr 1fr 1fr 1fr').height(34) + } + } +} + +@Component +struct Day { + @Prop day: number + @Prop month: number + @Prop lunarDay: string + @Prop lunarMonth: number + @Link private selectedDay?: number + @Link private selectedLunarMonth?: number + @Link private selectedLunarDay?: string + build() { + Column() { + Text(`${this.day}`) + .fontSize(17) + .fontWeight(FontWeight.Bold) + .color(this.selectedDay === this.day ? Color.Red : Color.Black) + Text(`${this.lunarDay}`) + .fontSize(10) + .color(this.selectedDay === this.day ? Color.Red : Color.Black) + }.height(72) + .alignItems(HorizontalAlign.Center) + .onClick(() => { + this.selectedLunarDay = this.lunarDay + this.selectedLunarMonth = this.lunarMonth + this.selectedDay = this.day + }) + } +} + +@Component +struct MonthView { + @Prop month: number + private lunarMonthDays: string[] = [ + '初一', '初二', '初三', '初四', '初五', '初六', '初七', '初八', '初九', '初十', + '十一', '十二', '十三', '十四', '十五', '十六', '十七', '十八', '十九', '二十', + '廿一', '廿二', '廿三', '廿四', '廿五', '廿六', '廿七', '廿八', '廿九', '三十'] + private lunarMonthNames: string[] = [ + '正月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '冬月', '腊月'] + @State selectedLunarDay: string = '初十' + @State selectedLunarMonth: number = new Date().getMonth() + 1 + @State selectedDay: number = new Date().getDate() + + build() { + Column() { + Row() { + Grid() { + ForEach( + Array.from({length: 35}, (a, i) => i + 1), + item => { + GridItem() { + Day({day: item, + month: this.month, + lunarDay: this.lunarMonthDays[item % 30], + lunarMonth: this.month, + selectedLunarDay: this.$selectedLunarDay, + selectedLunarMonth: this.$selectedLunarMonth, + selectedDay: this.$selectedDay}) + } + }, + item => item + ) + }.rowsTemplate('1fr 1fr 1fr 1fr 1fr').columnsTemplate('1fr 1fr 1fr 1fr 1fr 1fr 1fr').height(288) + }.alignItems(VerticalAlign.Center) + + Row() { + Column() { + Row() { + Text(`农历 ${this.lunarMonthNames[this.selectedLunarMonth]}${this.selectedLunarDay}`) + .fontSize(15) + .margin(10) + } + Row() { + Text('今日无日程') + .fontSize(15) + }.alignItems(VerticalAlign.Center) + } + }.alignItems(VerticalAlign.Center) + } + } +} + +@Component +struct SwiperView { + private monthList: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11] + @Link private month?: number + @Link private year?: number + build() { + Swiper() { + ForEach( + this.monthList, + item => { + Column() { + MonthView({month: item}) + }.margin({left: 20, right: 20, bottom: 20, top: 3}) + }, + item => item) + }.indicator(false) + .index(this.month) + .onChange(e => { + this.month = e.index + }) + } + } +} + +@Entry +@Component +struct MyCalendar { + @State monthIdx: number = new Date().getMonth() + @State yearIdx: number = new Date().getFullYear() + build() { + Column() { + Row() { + Title({currentMonth:this.monthIdx, currentYear:this.yearIdx}) + }.height(72) + .margin({left: 20, right: 20, top: 20}) + SwiperView({month: this.$monthIdx, year: this.$yearIdx}) + } + } +} diff --git a/compiler/examples/taobao/app.ets b/compiler/examples/taobao/app.ets new file mode 100644 index 0000000000000000000000000000000000000000..0be61a623b0216ebbfacf77d8871f2fcaf1de68e --- /dev/null +++ b/compiler/examples/taobao/app.ets @@ -0,0 +1,8 @@ +export default { + onCreate() { + console.info('Application onCreate') + }, + onDestroy() { + console.info('Application onDestroy') + }, +} diff --git a/compiler/examples/taobao/manifest.json b/compiler/examples/taobao/manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..28384141b02407514271ddbb21d3f6daeaa5f030 --- /dev/null +++ b/compiler/examples/taobao/manifest.json @@ -0,0 +1,11 @@ +{ + "appID": "com.huawei.taobao", + "appName": "taobao", + "versionName": "1.0.0", + "versionCode": 1, + "minPlatformVersion": "2.0.0", + "pages": [ + "pages/index", + "pages/detail" + ] +} diff --git a/compiler/examples/taobao/pages/detail.ets b/compiler/examples/taobao/pages/detail.ets new file mode 100644 index 0000000000000000000000000000000000000000..c35c2cd8c5e0adab40c82482d928c89bd22ee0a5 --- /dev/null +++ b/compiler/examples/taobao/pages/detail.ets @@ -0,0 +1,72 @@ +const detailList = [ + { + uri: 'resources/rawfile/table/list_one.jpg', + title: '创意日式环保原木纸巾架 榉木无漆卷纸收纳架 卫生纸柱厨房纸巾架' + }, + { + uri: 'resources/rawfile/table/list_two.jpg', + title: '展示篮海草编新中式收纳筐矮收纳盒藤编制把手托盘杂物家居整理篮' + }, + { + uri: 'resources/rawfile/table/list_three.jpg', + title: '门后挂钩金属门背后衣物挂架免钉无痕衣帽钩创意门上挂衣架挂衣钩' + }, + { + uri: 'resources/rawfile/table/list_four.jpg', + title: '可折叠桌面置物架分层小型架子厨房杂物整理落地收纳架衣柜隔层架' + }, + { + uri: 'resources/rawfile/table/list_five.jpg', + title: 'Castle Garden亲肤水貂绒3D立体树叶双层多功能绒毯 白' + }, + { + uri: 'resources/rawfile/table/list_six.jpg', + title: 'DORA HOUSE欧式法式复古木质烛台 仿古做旧酒吧别墅装饰配烛杯' + }, + { + uri: 'resources/rawfile/table/list_seven.jpg', + title: '美式装饰品北欧创意家居客厅书房电视柜发光地球仪样板房摆件礼品' + }, + { + uri: 'resources/rawfile/table/list_eight.jpg', + title: '树可珐琅 日式收纳筒加厚搪瓷筷子筒笔筒工具筒厨房收纳复古笔筒' + }, + { + uri: 'resources/rawfile/table/list_nine.jpg', + title: '包邮家用陶瓷盘子圆形菜盘 创意碗盘骨瓷西餐具牛扒盘 清新水果盘' + }, + { + uri: 'resources/rawfile/table/list_ten.jpg', + title: '朵颐创意北欧不锈钢西餐餐具黑柄手柄刀叉勺套装甜品叉勺主餐刀叉' + } +] + +@Entry +@Component +struct Detail { + build() { + Column() { + List() { + ForEach( + detailList, + (item) => { + ListItem() { + Column() { + Image(item.uri) + .width(275).height(300) + .borderRadius(15) + Text(item.title) + .fontSize(16) + .width(220).height(50) + }.width(300).height(400) + .borderRadius(15) + .alignItems(HorizontalAlign.Center) + }.height(410) + }, + item => item.title) + }.width(300) + }.width(360) + .backgroundColor(Color.White) + .alignItems(HorizontalAlign.Center) + } +} \ No newline at end of file diff --git a/compiler/examples/taobao/pages/index.ets b/compiler/examples/taobao/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..1d909aaa21ed218d3795a3d5eb3e971eaaa6f8a2 --- /dev/null +++ b/compiler/examples/taobao/pages/index.ets @@ -0,0 +1,293 @@ +const SelectItems = [ + { + uri1: 'class/type_new.png', title1: '天猫新品', uri2: 'class/type_recharge.png', title2: '充值中心' + }, + { + uri1: 'class/type_international.png', title1: '天猫国际', uri2: 'class/type_garden.png', title2: '金币庄园' + }, + { + uri1: 'class/type_order.png', title1: '饿了么', uri2: 'class/type_auction.png', title2: '阿里拍卖' + }, + { + uri1: 'class/type_market.png', title1: '天猫超市', uri2: 'class/type_eat.png', title2: '淘宝吃货' + }, + { + uri1: 'class/type_all.png', title1: '分类', uri2: 'class/type_used.png', title2: '咸鱼' + }, + { + uri1: 'class/type_food.png', title1: '天猫美食', uri2: 'class/type_vip.png', title2: '会员中心' + }, + { + uri1: 'class/type_health.png', title1: '阿里健康', uri2: 'class/type_movie.png', title2: '淘票票' + }, + { + uri1: 'class/type_life.png', title1: '口碑生活', uri2: 'class/type_membership.png', title2: '会员店' + }, +] + +const ProductItems = [ + { + uri1: 'table/list_one.jpg', description1: '创意日式环保原木纸巾架 榉木无漆卷纸收纳架 卫生纸柱厨房纸巾架', price1:'¥29.9', soldNumber1: '79人已购买', + uri2: 'table/list_two.jpg', description2: '展示篮海草编新中式收纳筐矮收纳盒藤编制把手托盘杂物家居整理篮', price2: '¥35.1', soldNumber2: '24人已购买' + }, + { + uri1: 'table/list_three.jpg', description1: '门后挂钩金属门背后衣物挂架免钉无痕衣帽钩创意门上挂衣架挂衣钩', price1: '¥27.9', soldNumber1: '214人已购买', + uri2: 'table/list_four.jpg', description2: '可折叠桌面置物架分层小型架子厨房杂物整理落地收纳架衣柜隔层架', price2: '¥8', soldNumber2: '1234人已购买' + }, + { + uri1: 'table/list_five.jpg', description1: 'Castle Garden亲肤水貂绒3D立体树叶双层多功能绒毯白', price1: '¥198.8', soldNumber1: '38人已购买', + uri2: 'table/list_six.jpg', description2: 'DORA HOUSE欧式法式复古木质烛台 仿古做旧酒吧别墅装饰配烛杯', price2: '¥168', soldNumber2: '82人已购买' + }, + { + uri1: 'table/list_seven.jpg', description1: '美式装饰品北欧创意家居客厅书房电视柜发光地球仪样板房摆件礼品', price1: '¥148', soldNumber1: '19人已购买', + uri2: 'table/list_eight.jpg', description2: '树可珐琅 日式收纳筒加厚搪瓷筷子筒笔筒工具筒厨房收纳复古笔筒', price2: '¥39', soldNumber2: '113人已购买' + }, + { + uri1: 'table/list_nine.jpg', description1: '包邮家用陶瓷盘子圆形菜盘 创意碗盘骨瓷西餐具牛扒盘 清新水果盘', price1: '¥24.9', soldNumber1: '21人已购买', + uri2: 'table/list_ten.jpg', description2: '朵颐创意北欧不锈钢西餐餐具黑柄手柄刀叉勺套装甜品叉勺主餐刀叉', price2: '¥19', soldNumber2: '25人已购买' + }, + { + uri1: 'table/list_eleven.jpg', description1: '「番茄设计出品 / 千鸟格纹路」设计师高靠背布艺软床', price1: '¥3,625', soldNumber1: '11人已购买', + uri2: 'table/list_twelve.jpg', description2: '复古做旧实木多肉花架 田园乡村置物架托盘 储物架 花园园艺杂货', price2: '¥275', soldNumber2: '8人已购买' + }, + { + uri1: 'table/list_thirteen.jpg', description1: '北欧简约胡桃木色门厅柜玄关柜鞋柜组合定做隔断柜镂空屏风鞋柜', price1: '¥2,290', soldNumber1: '78人已购买', + uri2: 'table/list_fourteen.jpg', description2: '厨房创意竹木陶瓷调味罐三件套胡椒盐罐味精瓶调料盒套装调味瓶罐', price2: '¥35', soldNumber2: '25人已购买' + }, + { + uri1: 'table/list_fifteen.jpg', description1: 'Moreover原创设计耐高温水杯玻璃杯饮料杯酒杯早餐杯牛奶杯简约', price1: '¥22', soldNumber1: '66人已购买', + uri2: 'table/list_sixteen.jpg', description2: '乐尚多功能碎菜器 家用手动蔬菜绞碎器 蒜肉搅碎机绞肉机饺子馅机', price2: '¥45', soldNumber2: '23人已购买' + }, + { + uri1: 'table/list_seventeen.jpg', description1: '满天星云南干花束雏菊小向日葵太阳花家居装饰插花送朋友满包邮', price1: '¥21.5', soldNumber1: '30人已购买', + uri2: 'table/list_eighteen.jpg', description2: '厨房创意竹木陶瓷调味罐三件套胡椒盐罐味精瓶调料盒套装调味瓶罐', price2: '¥16', soldNumber2: '23人已购买' + }, + { + uri1: 'table/list_ninteen.jpg', description1: '梵辰组装现代简约复古做旧靠背实木扶手酒店餐厅餐椅休闲网红椅子', price1: '¥229', soldNumber1: '382人已购买', + uri2: 'table/list_twenty.png', description2: '烘焙工具 软瓷裱花枪 家用奶油挤花器 蛋糕裱花笔diy套装', price2: '¥24.8', soldNumber2: '23人已购买' + }, + { + uri1: 'table/list_twentyone.jpg', description1: '汇安 实木床双人1.5m1.8米北欧日式经济型木床现代简约主卧家具', price1: '¥1,288', soldNumber1: '0人已购买', + uri2: 'table/list_twentytwo.jpg', description2: '旅侣 天然植物干花永生花黄金球金槌花花束搭配家居装饰摆拍道具', price2: '¥30.9', soldNumber2: '100人已购买' + }, + { + uri1: 'table/list_twentythree.jpg', description1: '北欧风格ins文艺范工作室店铺墙面铁丝网格照片装饰墙挂件收纳', price1: '¥88', soldNumber1: '15人已购买', + uri2: 'table/list_twentyfour.jpg', description2: '北欧餐椅现代简约家用实木靠背曲木椅奶茶店设计创意餐厅椅子ins', price2: '¥315', soldNumber2: '23人已购买' + }, + { + uri1: 'table/list_twentyfive.jpg', description1: '大号裱花嘴套装 不锈钢9头裱花咀超大八齿圆孔大玫瑰大寿桃大10齿', price1: '¥25', soldNumber1: '116人已购买', + uri2: 'table/list_twentysix.jpg', description2: '【Home deco】【现货】日本进口冰箱保鲜盒食品密封盒带盖收纳盒', price2: '¥18.5', soldNumber2: '67人已购买' + }, +] + +const resourcePath = 'resources/rawfile/' + +class ProductItem { + public uri1: string + public description1: string + public price1: string + public soldNumber1: string + public uri2: string + public description2: string + public price2: string + public soldNumber2: string +} + +@Entry +@Component +struct MainPage { + build() { + Column() { + List() { + ListItem() { + TopList() + } + ListItem() { + Banner() + } + ListItem() { + SelectItemList() + } + ListItem() { + SpecialItemList() + } + ListItem() { + Row() { + Image(resourcePath + 'double_twelve.gif') + .width(327).height(87) + .objectFit(ImageFit.Fill) + }.alignItems(VerticalAlign.Center).justifyContent(FlexAlign.Center) + } + ForEach( + ProductItems, + (item) => { + ListItem() { + ProductListItem({item: item}) + } + }, + item => item.uri1) + ForEach( + ProductItems, + (item) => { + ListItem() { + ProductListItem({item: item}) + } + }, + item => item.uri1) + ForEach( + ProductItems, + (item) => { + ListItem() { + ProductListItem({item: item}) + } + }, + item => item.uri1) + } + }.alignItems(HorizontalAlign.Center) + } +} + +@Component +struct TopList { + private topList: string[] = ['首页','生鲜','食品','女装','鞋靴','饰品','百货','母婴','箱包','男装','内衣','手机','美妆', + '家装','运动','电器','洗护','数码','车品','企业','保健'] + build() { + List() { + ForEach( + this.topList, + (item) => { + ListItem() { + Text(item) + .fontSize(14) + .width(39) + .textAlign(TextAlign.Center) + } + }, + item => item) + }.height(34) + .listDirection(ListDirection.Horizontal) + } +} + +@Component +struct Banner { + private bannerList: string[] = ['swiper/swiper_one.jpg','swiper/swiper_two.jpg', 'swiper/swiper_three.jpg', + 'swiper/swiper_four.jpg','swiper/swiper_five.jpg'] + build() { + Row() { + Swiper() { + ForEach( + this.bannerList, + (item) => { Image(resourcePath + item) }, + item => item) + }.width(288).height(96) + .autoPlay(true) + }.alignItems(VerticalAlign.Center) + } +} + +@Component +struct SelectItemList { + build() { + List() { + ForEach( + SelectItems, + (item) => { + ListItem() { + Column() { + Image(resourcePath + item.uri1) + .width(48).height(44) + Text(item.title1) + .fontSize(12) + Image(resourcePath + item.uri2) + .width(48).height(44) + Text(item.title2) + .fontSize(12) + }.width(68).height(130) + .alignItems(HorizontalAlign.Center) + } + }, + item => item.title1) + }.height(144).padding(8) + .listDirection(ListDirection.Horizontal) + } +} + +@Component +struct SpecialItemList { + private SpecialItems: Object[] = [ + {uri1: 'special/attention_doubletwelve.png', uri2:'special/attention_double_one.png', uri3: 'special/attention_double_two.jpg'}, + {uri1: 'special/attention_best.png', uri2:'special/attention_best_one.png', uri3: 'special/attention_best_two.jpg'}, + {uri1: 'special/attention_live.png', uri2:'special/attention_live_one.png', uri3: 'special/attention_live_two.jpg'}, + {uri1: 'special/attention_video.png', uri2:'special/attention_video_one.png', uri3: 'special/attention_video_two.png'}, + ] + + build() { + Column() { + Grid() { + ForEach( + this.SpecialItems, + (item) => { + GridItem() { + Column() { + Image(resourcePath + item.uri1) + .width(154).height(22) + .objectFit(ImageFit.Fill) + Row() { + Image(resourcePath + item.uri2) + .width(72).height(87) + .objectFit(ImageFit.Fill) + Image(resourcePath + item.uri3) + .width(72).height(87) + .objectFit(ImageFit.Fill) + }.justifyContent(FlexAlign.SpaceAround) + }.alignItems(HorizontalAlign.Center) + } + }, + item => item.uri1) + }.width(360).height(240) + .columnsTemplate('1fr, 1fr').rowsTemplate('1fr, 1fr') + }.width(360) + .alignItems(HorizontalAlign.Center) + } +} + +@Component +struct ProductListItem { + private item: ProductItem + + build() { + Row() { + Product({uri: this.item.uri1, description: this.item.description1, price: this.item.price1, soldNumber: this.item.soldNumber1}) + Product({uri: this.item.uri2, description: this.item.description2, price: this.item.price2, soldNumber: this.item.soldNumber2}) + } + } +} + +@Component +struct Product { + private uri: string + private description: string + private price: string + private soldNumber: string + build() { + Column() { + Image(resourcePath + this.uri) + .width(144).height(144) + .borderRadius(15) + Text(this.description) + .fontSize(15).height(63) + Row() { + Text(this.price) + .color(0xffff4500) + .fontSize(14).width(58) + .textAlign(TextAlign.Start) + Text(this.soldNumber) + .color(0xff808080) + .fontSize(11) + }.width(144).height(20) + .alignItems(VerticalAlign.Center) + }.width(168).height(245) + .alignItems(HorizontalAlign.Center) + } +} \ No newline at end of file diff --git a/compiler/examples/taobao/resources/rawfile/class/type_all.png b/compiler/examples/taobao/resources/rawfile/class/type_all.png new file mode 100644 index 0000000000000000000000000000000000000000..36d319b954757d0691112de7704f8128e15bb96d Binary files /dev/null and b/compiler/examples/taobao/resources/rawfile/class/type_all.png differ diff --git a/compiler/examples/taobao/resources/rawfile/class/type_auction.png b/compiler/examples/taobao/resources/rawfile/class/type_auction.png new file mode 100644 index 0000000000000000000000000000000000000000..428190a38f87942ffe04de5380d606faa04defa3 Binary files /dev/null and b/compiler/examples/taobao/resources/rawfile/class/type_auction.png differ diff --git a/compiler/examples/taobao/resources/rawfile/class/type_eat.png b/compiler/examples/taobao/resources/rawfile/class/type_eat.png new file mode 100644 index 0000000000000000000000000000000000000000..3dcf981133fd568a9d5b25f7b6a3dcd1fa04f673 Binary files /dev/null and b/compiler/examples/taobao/resources/rawfile/class/type_eat.png differ diff --git a/compiler/examples/taobao/resources/rawfile/class/type_food.png b/compiler/examples/taobao/resources/rawfile/class/type_food.png new file mode 100644 index 0000000000000000000000000000000000000000..73961a116873a7e49166a593cfbbe220c0fdd3d5 Binary files /dev/null and b/compiler/examples/taobao/resources/rawfile/class/type_food.png differ diff --git a/compiler/examples/taobao/resources/rawfile/class/type_garden.png b/compiler/examples/taobao/resources/rawfile/class/type_garden.png new file mode 100644 index 0000000000000000000000000000000000000000..6ffcfddbddc9a432df9a13fbb767d60df3d9f7cd Binary files /dev/null and b/compiler/examples/taobao/resources/rawfile/class/type_garden.png differ diff --git a/compiler/examples/taobao/resources/rawfile/class/type_health.png b/compiler/examples/taobao/resources/rawfile/class/type_health.png new file mode 100644 index 0000000000000000000000000000000000000000..7d7d7727f027512f14729cb95ebf2a340ff4f4bc Binary files /dev/null and b/compiler/examples/taobao/resources/rawfile/class/type_health.png differ diff --git a/compiler/examples/taobao/resources/rawfile/class/type_international.png b/compiler/examples/taobao/resources/rawfile/class/type_international.png new file mode 100644 index 0000000000000000000000000000000000000000..c44a72445ce79d999a8cac4de1ab67c5ebf37d81 Binary files /dev/null and b/compiler/examples/taobao/resources/rawfile/class/type_international.png differ diff --git a/compiler/examples/taobao/resources/rawfile/class/type_life.png b/compiler/examples/taobao/resources/rawfile/class/type_life.png new file mode 100644 index 0000000000000000000000000000000000000000..7abd9ef7461dce010e63dc94a5325bbb45646497 Binary files /dev/null and b/compiler/examples/taobao/resources/rawfile/class/type_life.png differ diff --git a/compiler/examples/taobao/resources/rawfile/class/type_market.png b/compiler/examples/taobao/resources/rawfile/class/type_market.png new file mode 100644 index 0000000000000000000000000000000000000000..aca69825175d93098032308b53cfae47649d1f9e Binary files /dev/null and b/compiler/examples/taobao/resources/rawfile/class/type_market.png differ diff --git a/compiler/examples/taobao/resources/rawfile/class/type_membership.png b/compiler/examples/taobao/resources/rawfile/class/type_membership.png new file mode 100644 index 0000000000000000000000000000000000000000..e1b1253c46382293bc914e9e62449f85b7e3bfb8 Binary files /dev/null and b/compiler/examples/taobao/resources/rawfile/class/type_membership.png differ diff --git a/compiler/examples/taobao/resources/rawfile/class/type_movie.png b/compiler/examples/taobao/resources/rawfile/class/type_movie.png new file mode 100644 index 0000000000000000000000000000000000000000..2feb7c7a6d1f348a31552c83499615577e4a75d1 Binary files /dev/null and b/compiler/examples/taobao/resources/rawfile/class/type_movie.png differ diff --git a/compiler/examples/taobao/resources/rawfile/class/type_new.png b/compiler/examples/taobao/resources/rawfile/class/type_new.png new file mode 100644 index 0000000000000000000000000000000000000000..dc42939bfbe54e10f2e65e3dce89250ad1a66827 Binary files /dev/null and b/compiler/examples/taobao/resources/rawfile/class/type_new.png differ diff --git a/compiler/examples/taobao/resources/rawfile/class/type_order.png b/compiler/examples/taobao/resources/rawfile/class/type_order.png new file mode 100644 index 0000000000000000000000000000000000000000..1e17dcdf39b560b9b7aa287611d6d94c6d689c7f Binary files /dev/null and b/compiler/examples/taobao/resources/rawfile/class/type_order.png differ diff --git a/compiler/examples/taobao/resources/rawfile/class/type_recharge.png b/compiler/examples/taobao/resources/rawfile/class/type_recharge.png new file mode 100644 index 0000000000000000000000000000000000000000..ecfdf72fff61d462c65a958fb0758ff23fe3099f Binary files /dev/null and b/compiler/examples/taobao/resources/rawfile/class/type_recharge.png differ diff --git a/compiler/examples/taobao/resources/rawfile/class/type_today.png b/compiler/examples/taobao/resources/rawfile/class/type_today.png new file mode 100644 index 0000000000000000000000000000000000000000..e4cc8892d5d97f74856d85c32d14a937db93abae Binary files /dev/null and b/compiler/examples/taobao/resources/rawfile/class/type_today.png differ diff --git a/compiler/examples/taobao/resources/rawfile/class/type_travel.png b/compiler/examples/taobao/resources/rawfile/class/type_travel.png new file mode 100644 index 0000000000000000000000000000000000000000..8367ea2ec96eb9c455c57851a8d5ffff0bf8460a Binary files /dev/null and b/compiler/examples/taobao/resources/rawfile/class/type_travel.png differ diff --git a/compiler/examples/taobao/resources/rawfile/class/type_used.png b/compiler/examples/taobao/resources/rawfile/class/type_used.png new file mode 100644 index 0000000000000000000000000000000000000000..bcf3d3b876f3ae22eb5b800a795d905b75d700c7 Binary files /dev/null and b/compiler/examples/taobao/resources/rawfile/class/type_used.png differ diff --git a/compiler/examples/taobao/resources/rawfile/class/type_vip.png b/compiler/examples/taobao/resources/rawfile/class/type_vip.png new file mode 100644 index 0000000000000000000000000000000000000000..7e531236bda3e018ca48c9a0f79731c28c3da6f7 Binary files /dev/null and b/compiler/examples/taobao/resources/rawfile/class/type_vip.png differ diff --git a/compiler/examples/taobao/resources/rawfile/double_twelve.gif b/compiler/examples/taobao/resources/rawfile/double_twelve.gif new file mode 100644 index 0000000000000000000000000000000000000000..5bafb2a89d7f3dcbacb566f8833864c4c6011c28 Binary files /dev/null and b/compiler/examples/taobao/resources/rawfile/double_twelve.gif differ diff --git a/compiler/examples/taobao/resources/rawfile/special/attention_best.png b/compiler/examples/taobao/resources/rawfile/special/attention_best.png new file mode 100644 index 0000000000000000000000000000000000000000..8ebedcbb8af7dc2dcc3fd3eb38e4fe4abfa61754 Binary files /dev/null and b/compiler/examples/taobao/resources/rawfile/special/attention_best.png differ diff --git a/compiler/examples/taobao/resources/rawfile/special/attention_best_one.png b/compiler/examples/taobao/resources/rawfile/special/attention_best_one.png new file mode 100644 index 0000000000000000000000000000000000000000..536e7a3666b4b0d20548e17698b2682ef497efa6 Binary files /dev/null and b/compiler/examples/taobao/resources/rawfile/special/attention_best_one.png differ diff --git a/compiler/examples/taobao/resources/rawfile/special/attention_best_two.jpg b/compiler/examples/taobao/resources/rawfile/special/attention_best_two.jpg new file mode 100644 index 0000000000000000000000000000000000000000..3e3af0ec3dac8987de466ccf57c0bbe0f01c8662 Binary files /dev/null and b/compiler/examples/taobao/resources/rawfile/special/attention_best_two.jpg differ diff --git a/compiler/examples/taobao/resources/rawfile/special/attention_discount.jpg b/compiler/examples/taobao/resources/rawfile/special/attention_discount.jpg new file mode 100644 index 0000000000000000000000000000000000000000..946dc169b0f05f97aca402c6d3401d2c77f3cbdb Binary files /dev/null and b/compiler/examples/taobao/resources/rawfile/special/attention_discount.jpg differ diff --git a/compiler/examples/taobao/resources/rawfile/special/attention_double_one.png b/compiler/examples/taobao/resources/rawfile/special/attention_double_one.png new file mode 100644 index 0000000000000000000000000000000000000000..c905b723822ac1fe67a769222c08f1ecdc80d9db Binary files /dev/null and b/compiler/examples/taobao/resources/rawfile/special/attention_double_one.png differ diff --git a/compiler/examples/taobao/resources/rawfile/special/attention_double_two.jpg b/compiler/examples/taobao/resources/rawfile/special/attention_double_two.jpg new file mode 100644 index 0000000000000000000000000000000000000000..496227d2e6616a53bf726a55f3596c3a29573dfb Binary files /dev/null and b/compiler/examples/taobao/resources/rawfile/special/attention_double_two.jpg differ diff --git a/compiler/examples/taobao/resources/rawfile/special/attention_doubletwelve.png b/compiler/examples/taobao/resources/rawfile/special/attention_doubletwelve.png new file mode 100644 index 0000000000000000000000000000000000000000..539c8f489a107a4bcd62df09d5c10affc845bc86 Binary files /dev/null and b/compiler/examples/taobao/resources/rawfile/special/attention_doubletwelve.png differ diff --git a/compiler/examples/taobao/resources/rawfile/special/attention_live.png b/compiler/examples/taobao/resources/rawfile/special/attention_live.png new file mode 100644 index 0000000000000000000000000000000000000000..82f71df91ce8956fe637c63e748e73f80974d17c Binary files /dev/null and b/compiler/examples/taobao/resources/rawfile/special/attention_live.png differ diff --git a/compiler/examples/taobao/resources/rawfile/special/attention_live_one.png b/compiler/examples/taobao/resources/rawfile/special/attention_live_one.png new file mode 100644 index 0000000000000000000000000000000000000000..273fad7cae257aa12d5aa000fcc86049e7bc98aa Binary files /dev/null and b/compiler/examples/taobao/resources/rawfile/special/attention_live_one.png differ diff --git a/compiler/examples/taobao/resources/rawfile/special/attention_live_two.jpg b/compiler/examples/taobao/resources/rawfile/special/attention_live_two.jpg new file mode 100644 index 0000000000000000000000000000000000000000..2f933b787df6862c4fddcba346ebd754e2a7f300 Binary files /dev/null and b/compiler/examples/taobao/resources/rawfile/special/attention_live_two.jpg differ diff --git a/compiler/examples/taobao/resources/rawfile/special/attention_packet.png b/compiler/examples/taobao/resources/rawfile/special/attention_packet.png new file mode 100644 index 0000000000000000000000000000000000000000..cc41e5afe57cc88e31b662b6eb8aed3b60bd8614 Binary files /dev/null and b/compiler/examples/taobao/resources/rawfile/special/attention_packet.png differ diff --git a/compiler/examples/taobao/resources/rawfile/special/attention_packet_detail.png b/compiler/examples/taobao/resources/rawfile/special/attention_packet_detail.png new file mode 100644 index 0000000000000000000000000000000000000000..6ba26adfa26dd7b1586a395de7fa209402bab255 Binary files /dev/null and b/compiler/examples/taobao/resources/rawfile/special/attention_packet_detail.png differ diff --git a/compiler/examples/taobao/resources/rawfile/special/attention_rush.png b/compiler/examples/taobao/resources/rawfile/special/attention_rush.png new file mode 100644 index 0000000000000000000000000000000000000000..031fa1f6fa6128bc9297c9e7b1953061fd076739 Binary files /dev/null and b/compiler/examples/taobao/resources/rawfile/special/attention_rush.png differ diff --git a/compiler/examples/taobao/resources/rawfile/special/attention_rush_detail.png b/compiler/examples/taobao/resources/rawfile/special/attention_rush_detail.png new file mode 100644 index 0000000000000000000000000000000000000000..a4b354031a1f17731466f7336de20e6cfd767976 Binary files /dev/null and b/compiler/examples/taobao/resources/rawfile/special/attention_rush_detail.png differ diff --git a/compiler/examples/taobao/resources/rawfile/special/attention_sale.png b/compiler/examples/taobao/resources/rawfile/special/attention_sale.png new file mode 100644 index 0000000000000000000000000000000000000000..1865fb41b95a521cf7131a265250955896e8c33c Binary files /dev/null and b/compiler/examples/taobao/resources/rawfile/special/attention_sale.png differ diff --git a/compiler/examples/taobao/resources/rawfile/special/attention_sale_detail.jpg b/compiler/examples/taobao/resources/rawfile/special/attention_sale_detail.jpg new file mode 100644 index 0000000000000000000000000000000000000000..d1529b2d3536fe5537604644bbb5c0822a13e495 Binary files /dev/null and b/compiler/examples/taobao/resources/rawfile/special/attention_sale_detail.jpg differ diff --git a/compiler/examples/taobao/resources/rawfile/special/attention_video.png b/compiler/examples/taobao/resources/rawfile/special/attention_video.png new file mode 100644 index 0000000000000000000000000000000000000000..9c249b95a2269be2c68e8eb465cf3824237ebb77 Binary files /dev/null and b/compiler/examples/taobao/resources/rawfile/special/attention_video.png differ diff --git a/compiler/examples/taobao/resources/rawfile/special/attention_video_one.png b/compiler/examples/taobao/resources/rawfile/special/attention_video_one.png new file mode 100644 index 0000000000000000000000000000000000000000..c16d66f49e87450c922425e9c346a0536afd7505 Binary files /dev/null and b/compiler/examples/taobao/resources/rawfile/special/attention_video_one.png differ diff --git a/compiler/examples/taobao/resources/rawfile/special/attention_video_two.png b/compiler/examples/taobao/resources/rawfile/special/attention_video_two.png new file mode 100644 index 0000000000000000000000000000000000000000..f0b72c14fd94cf79086304cf70aa2144eaa3ef8c Binary files /dev/null and b/compiler/examples/taobao/resources/rawfile/special/attention_video_two.png differ diff --git a/compiler/examples/taobao/resources/rawfile/swiper/swiper_five.jpg b/compiler/examples/taobao/resources/rawfile/swiper/swiper_five.jpg new file mode 100644 index 0000000000000000000000000000000000000000..bcd3d989f5a226e48c0eadf22844c21d3bfbfe9a Binary files /dev/null and b/compiler/examples/taobao/resources/rawfile/swiper/swiper_five.jpg differ diff --git a/compiler/examples/taobao/resources/rawfile/swiper/swiper_four.jpg b/compiler/examples/taobao/resources/rawfile/swiper/swiper_four.jpg new file mode 100644 index 0000000000000000000000000000000000000000..2dfc55f8e56bc0c7946004d855ffb27be5d5056d Binary files /dev/null and b/compiler/examples/taobao/resources/rawfile/swiper/swiper_four.jpg differ diff --git a/compiler/examples/taobao/resources/rawfile/swiper/swiper_one.jpg b/compiler/examples/taobao/resources/rawfile/swiper/swiper_one.jpg new file mode 100644 index 0000000000000000000000000000000000000000..967e2254d8d3700b77fb79aaee85765ca0d87991 Binary files /dev/null and b/compiler/examples/taobao/resources/rawfile/swiper/swiper_one.jpg differ diff --git a/compiler/examples/taobao/resources/rawfile/swiper/swiper_three.jpg b/compiler/examples/taobao/resources/rawfile/swiper/swiper_three.jpg new file mode 100644 index 0000000000000000000000000000000000000000..777ae5cbd8b885b85170919858fdb618dbcd71ef Binary files /dev/null and b/compiler/examples/taobao/resources/rawfile/swiper/swiper_three.jpg differ diff --git a/compiler/examples/taobao/resources/rawfile/swiper/swiper_two.jpg b/compiler/examples/taobao/resources/rawfile/swiper/swiper_two.jpg new file mode 100644 index 0000000000000000000000000000000000000000..34d52e5ed7eeb48bbacfe61f6e16449e14502ef8 Binary files /dev/null and b/compiler/examples/taobao/resources/rawfile/swiper/swiper_two.jpg differ diff --git a/compiler/examples/taobao/resources/rawfile/table/list_eight.jpg b/compiler/examples/taobao/resources/rawfile/table/list_eight.jpg new file mode 100644 index 0000000000000000000000000000000000000000..98fd8b901fb116019f8f913f13fa2a742c74ebad Binary files /dev/null and b/compiler/examples/taobao/resources/rawfile/table/list_eight.jpg differ diff --git a/compiler/examples/taobao/resources/rawfile/table/list_eighteen.jpg b/compiler/examples/taobao/resources/rawfile/table/list_eighteen.jpg new file mode 100644 index 0000000000000000000000000000000000000000..7bc5f03f727ca9819ff7eae173d8f88c37ce6440 Binary files /dev/null and b/compiler/examples/taobao/resources/rawfile/table/list_eighteen.jpg differ diff --git a/compiler/examples/taobao/resources/rawfile/table/list_eleven.jpg b/compiler/examples/taobao/resources/rawfile/table/list_eleven.jpg new file mode 100644 index 0000000000000000000000000000000000000000..da49f0c5906f907e662299ad17ea099e2cf05a43 Binary files /dev/null and b/compiler/examples/taobao/resources/rawfile/table/list_eleven.jpg differ diff --git a/compiler/examples/taobao/resources/rawfile/table/list_fifteen.jpg b/compiler/examples/taobao/resources/rawfile/table/list_fifteen.jpg new file mode 100644 index 0000000000000000000000000000000000000000..57329f5ae8a2eff5136c043cbf27497a13d57657 Binary files /dev/null and b/compiler/examples/taobao/resources/rawfile/table/list_fifteen.jpg differ diff --git a/compiler/examples/taobao/resources/rawfile/table/list_five.jpg b/compiler/examples/taobao/resources/rawfile/table/list_five.jpg new file mode 100644 index 0000000000000000000000000000000000000000..e10428ea3709e4ceec9a006143b923062c58d75d Binary files /dev/null and b/compiler/examples/taobao/resources/rawfile/table/list_five.jpg differ diff --git a/compiler/examples/taobao/resources/rawfile/table/list_four.jpg b/compiler/examples/taobao/resources/rawfile/table/list_four.jpg new file mode 100644 index 0000000000000000000000000000000000000000..85e2a9d9582816e0a425733da05b61a8bff0eb4b Binary files /dev/null and b/compiler/examples/taobao/resources/rawfile/table/list_four.jpg differ diff --git a/compiler/examples/taobao/resources/rawfile/table/list_fourteen.jpg b/compiler/examples/taobao/resources/rawfile/table/list_fourteen.jpg new file mode 100644 index 0000000000000000000000000000000000000000..db08594b82db2506d210710dd06363efc9e1793a Binary files /dev/null and b/compiler/examples/taobao/resources/rawfile/table/list_fourteen.jpg differ diff --git a/compiler/examples/taobao/resources/rawfile/table/list_nine.jpg b/compiler/examples/taobao/resources/rawfile/table/list_nine.jpg new file mode 100644 index 0000000000000000000000000000000000000000..b314127111552455a646c1def7678e093879ee6c Binary files /dev/null and b/compiler/examples/taobao/resources/rawfile/table/list_nine.jpg differ diff --git a/compiler/examples/taobao/resources/rawfile/table/list_ninteen.jpg b/compiler/examples/taobao/resources/rawfile/table/list_ninteen.jpg new file mode 100644 index 0000000000000000000000000000000000000000..4cbda8c2746815ca8cee38b3332011ebbc6c4060 Binary files /dev/null and b/compiler/examples/taobao/resources/rawfile/table/list_ninteen.jpg differ diff --git a/compiler/examples/taobao/resources/rawfile/table/list_one.jpg b/compiler/examples/taobao/resources/rawfile/table/list_one.jpg new file mode 100644 index 0000000000000000000000000000000000000000..aa3d17664f238841466eca497f6c254b9d44cbf5 Binary files /dev/null and b/compiler/examples/taobao/resources/rawfile/table/list_one.jpg differ diff --git a/compiler/examples/taobao/resources/rawfile/table/list_seven.jpg b/compiler/examples/taobao/resources/rawfile/table/list_seven.jpg new file mode 100644 index 0000000000000000000000000000000000000000..3a50148ddc4d939bfef3faf0eb4159c68edbbce2 Binary files /dev/null and b/compiler/examples/taobao/resources/rawfile/table/list_seven.jpg differ diff --git a/compiler/examples/taobao/resources/rawfile/table/list_seventeen.jpg b/compiler/examples/taobao/resources/rawfile/table/list_seventeen.jpg new file mode 100644 index 0000000000000000000000000000000000000000..7f0e9763a5715737e861a7e9f94b19104ef30aca Binary files /dev/null and b/compiler/examples/taobao/resources/rawfile/table/list_seventeen.jpg differ diff --git a/compiler/examples/taobao/resources/rawfile/table/list_six.jpg b/compiler/examples/taobao/resources/rawfile/table/list_six.jpg new file mode 100644 index 0000000000000000000000000000000000000000..67f8ba40135bca43c927b4d54470575d8e48e909 Binary files /dev/null and b/compiler/examples/taobao/resources/rawfile/table/list_six.jpg differ diff --git a/compiler/examples/taobao/resources/rawfile/table/list_sixteen.jpg b/compiler/examples/taobao/resources/rawfile/table/list_sixteen.jpg new file mode 100644 index 0000000000000000000000000000000000000000..9d548e4c56995c24582ab168be3400755c85acec Binary files /dev/null and b/compiler/examples/taobao/resources/rawfile/table/list_sixteen.jpg differ diff --git a/compiler/examples/taobao/resources/rawfile/table/list_ten.jpg b/compiler/examples/taobao/resources/rawfile/table/list_ten.jpg new file mode 100644 index 0000000000000000000000000000000000000000..3e3af189aebc69a9c721149b1d37669b3150e430 Binary files /dev/null and b/compiler/examples/taobao/resources/rawfile/table/list_ten.jpg differ diff --git a/compiler/examples/taobao/resources/rawfile/table/list_thirteen.jpg b/compiler/examples/taobao/resources/rawfile/table/list_thirteen.jpg new file mode 100644 index 0000000000000000000000000000000000000000..43eb3dfe4c64484f1726122aec0a2a7935bff184 Binary files /dev/null and b/compiler/examples/taobao/resources/rawfile/table/list_thirteen.jpg differ diff --git a/compiler/examples/taobao/resources/rawfile/table/list_three.jpg b/compiler/examples/taobao/resources/rawfile/table/list_three.jpg new file mode 100644 index 0000000000000000000000000000000000000000..a4153e0ea2f388169fe3558200b49b4c72be6e09 Binary files /dev/null and b/compiler/examples/taobao/resources/rawfile/table/list_three.jpg differ diff --git a/compiler/examples/taobao/resources/rawfile/table/list_twelve.jpg b/compiler/examples/taobao/resources/rawfile/table/list_twelve.jpg new file mode 100644 index 0000000000000000000000000000000000000000..fd13ef322470dfe014d8bbb1db23fa97c7cf98cd Binary files /dev/null and b/compiler/examples/taobao/resources/rawfile/table/list_twelve.jpg differ diff --git a/compiler/examples/taobao/resources/rawfile/table/list_twenty.png b/compiler/examples/taobao/resources/rawfile/table/list_twenty.png new file mode 100644 index 0000000000000000000000000000000000000000..3b582efc5bb2a321843ca622c8709e7003a338c4 Binary files /dev/null and b/compiler/examples/taobao/resources/rawfile/table/list_twenty.png differ diff --git a/compiler/examples/taobao/resources/rawfile/table/list_twentyfive.jpg b/compiler/examples/taobao/resources/rawfile/table/list_twentyfive.jpg new file mode 100644 index 0000000000000000000000000000000000000000..f9fe864defa4e8a5e02fcf7a318ebaf47c2d3001 Binary files /dev/null and b/compiler/examples/taobao/resources/rawfile/table/list_twentyfive.jpg differ diff --git a/compiler/examples/taobao/resources/rawfile/table/list_twentyfour.jpg b/compiler/examples/taobao/resources/rawfile/table/list_twentyfour.jpg new file mode 100644 index 0000000000000000000000000000000000000000..aba732396bc314ec5990fe8f4304f70a0f0587d8 Binary files /dev/null and b/compiler/examples/taobao/resources/rawfile/table/list_twentyfour.jpg differ diff --git a/compiler/examples/taobao/resources/rawfile/table/list_twentyone.jpg b/compiler/examples/taobao/resources/rawfile/table/list_twentyone.jpg new file mode 100644 index 0000000000000000000000000000000000000000..f0b3bbe48d4ee575996777b603d7ad51f382d487 Binary files /dev/null and b/compiler/examples/taobao/resources/rawfile/table/list_twentyone.jpg differ diff --git a/compiler/examples/taobao/resources/rawfile/table/list_twentyseven.jpg b/compiler/examples/taobao/resources/rawfile/table/list_twentyseven.jpg new file mode 100644 index 0000000000000000000000000000000000000000..966782332886121e21ac67d6f76df0e61e859cd1 Binary files /dev/null and b/compiler/examples/taobao/resources/rawfile/table/list_twentyseven.jpg differ diff --git a/compiler/examples/taobao/resources/rawfile/table/list_twentysix.jpg b/compiler/examples/taobao/resources/rawfile/table/list_twentysix.jpg new file mode 100644 index 0000000000000000000000000000000000000000..2b53eb39d32c09ba0e205621630f9d00617df076 Binary files /dev/null and b/compiler/examples/taobao/resources/rawfile/table/list_twentysix.jpg differ diff --git a/compiler/examples/taobao/resources/rawfile/table/list_twentythree.jpg b/compiler/examples/taobao/resources/rawfile/table/list_twentythree.jpg new file mode 100644 index 0000000000000000000000000000000000000000..0d10dfd19a4aa29fa47628ca373d0fd9d8407d94 Binary files /dev/null and b/compiler/examples/taobao/resources/rawfile/table/list_twentythree.jpg differ diff --git a/compiler/examples/taobao/resources/rawfile/table/list_twentytwo.jpg b/compiler/examples/taobao/resources/rawfile/table/list_twentytwo.jpg new file mode 100644 index 0000000000000000000000000000000000000000..3c5c14bdc0e38a1ed761f3ca956961f98dea9532 Binary files /dev/null and b/compiler/examples/taobao/resources/rawfile/table/list_twentytwo.jpg differ diff --git a/compiler/examples/taobao/resources/rawfile/table/list_two.jpg b/compiler/examples/taobao/resources/rawfile/table/list_two.jpg new file mode 100644 index 0000000000000000000000000000000000000000..890525db31e87d5034d30ce351bd64947c824ca4 Binary files /dev/null and b/compiler/examples/taobao/resources/rawfile/table/list_two.jpg differ diff --git a/compiler/main.js b/compiler/main.js new file mode 100644 index 0000000000000000000000000000000000000000..b63f46599cfce43107c7625f8f063b24ef185f1d --- /dev/null +++ b/compiler/main.js @@ -0,0 +1,143 @@ +/* + * 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 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); + const appEtsPath = path.join(projectConfig.projectPath, 'app.ets'); + let manifest = {}; + try { + const jsonString = fs.readFileSync(projectConfig.manifestFilePath).toString(); + manifest = JSON.parse(jsonString); + } catch (error) { + throw Error('\u001b[31m ERROR: the manifest file is lost or format is invalid. \u001b[39m').message; + } + + if (!fs.existsSync(appEtsPath)) { + throw Error('\u001b[31m ERROR: missing app.ets. \u001b[39m').message; + } + projectConfig.entryObj['./app'] = projectConfig.projectPath + '/app.ets?entry'; + + if(staticPreviewPage) { + projectConfig.entryObj['./' + staticPreviewPage] = projectConfig.projectPath + path.sep + + staticPreviewPage + '.ets?entry'; + } else { + 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 manifest.json. \u001b[39m').message; + } + } +} + +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; diff --git a/compiler/npm-install.js b/compiler/npm-install.js new file mode 100644 index 0000000000000000000000000000000000000000..e8cc4a93706e1682dbf5eff71a1d89386867326a --- /dev/null +++ b/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; + +if (!fs.existsSync(path.resolve(__dirname, 'bin', 'ark'))) { + return; +} + +let isWin = !1; +let isMac = !1; + +if (fs.existsSync(path.resolve(__dirname, 'bin', 'ark/build-win'))) { + isWin = !0; +} else if (fs.existsSync(path.resolve(__dirname, 'bin', 'ark/build-mac'))) { + isMac = !0; +} else if (!fs.existsSync(path.resolve(__dirname, 'bin', 'ark/build'))) { + console.error('[31m', 'find build fail', '[39m'); + return; +} + +let cwd; +if (isWin) { + cwd = path.join(__dirname, 'bin', 'ark', 'build-win'); +} else if (isMac) { + cwd = path.join(__dirname, 'bin', 'ark', 'build-mac'); +} else { + cwd = path.join(__dirname, 'bin', 'ark', '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/package-lock.json b/compiler/package-lock.json new file mode 100644 index 0000000000000000000000000000000000000000..22b091f231bb2a91aa1bd3c1ff562bdda1c15d3e --- /dev/null +++ b/compiler/package-lock.json @@ -0,0 +1,5954 @@ +{ + "name": "compilier", + "version": "0.0.1", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "@babel/cli": { + "version": "7.13.14", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@babel/cli/-/cli-7.13.14.tgz", + "integrity": "sha512-zmEFV8WBRsW+mPQumO1/4b34QNALBVReaiHJOkxhUsdo/AvYM62c+SKSuLi2aZ42t3ocK6OI0uwUXRvrIbREZw==", + "dev": true, + "requires": { + "@nicolo-ribaudo/chokidar-2": "2.1.8-no-fsevents", + "chokidar": "^3.4.0", + "commander": "^4.0.1", + "convert-source-map": "^1.1.0", + "fs-readdir-recursive": "^1.1.0", + "glob": "^7.0.0", + "lodash": "^4.17.19", + "make-dir": "^2.1.0", + "slash": "^2.0.0", + "source-map": "^0.5.0" + }, + "dependencies": { + "commander": { + "version": "4.1.1", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/commander/-/commander-4.1.1.tgz", + "integrity": "sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==", + "dev": true + }, + "slash": { + "version": "2.0.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/slash/2.0.0/slash-2.0.0.tgz", + "integrity": "sha1-3lUoUaF1nfOo8gZTVEL17E3eq0Q=", + "dev": true + }, + "source-map": { + "version": "0.5.7", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/source-map/0.5.7/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", + "dev": true + } + } + }, + "@babel/code-frame": { + "version": "7.12.13", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@babel/code-frame/-/code-frame-7.12.13.tgz", + "integrity": "sha512-HV1Cm0Q3ZrpCR93tkWOYiuYIgLxZXZFVG2VgK+MBWjUqZTundupbfx2aXarXuw5Ko5aMcjtJgbSs4vUGBS5v6g==", + "dev": true, + "requires": { + "@babel/highlight": "^7.12.13" + } + }, + "@babel/compat-data": { + "version": "7.13.15", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@babel/compat-data/-/compat-data-7.13.15.tgz", + "integrity": "sha512-ltnibHKR1VnrU4ymHyQ/CXtNXI6yZC0oJThyW78Hft8XndANwi+9H+UIklBDraIjFEJzw8wmcM427oDd9KS5wA==", + "dev": true + }, + "@babel/core": { + "version": "7.13.15", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@babel/core/-/core-7.13.15.tgz", + "integrity": "sha512-6GXmNYeNjS2Uz+uls5jalOemgIhnTMeaXo+yBUA72kC2uX/8VW6XyhVIo2L8/q0goKQA3EVKx0KOQpVKSeWadQ==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.12.13", + "@babel/generator": "^7.13.9", + "@babel/helper-compilation-targets": "^7.13.13", + "@babel/helper-module-transforms": "^7.13.14", + "@babel/helpers": "^7.13.10", + "@babel/parser": "^7.13.15", + "@babel/template": "^7.12.13", + "@babel/traverse": "^7.13.15", + "@babel/types": "^7.13.14", + "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": { + "debug": { + "version": "4.3.2", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/debug/4.3.2/debug-4.3.2.tgz", + "integrity": "sha1-8KScGKyHeeMdSgxgKd+3aHPHQos=", + "dev": true, + "requires": { + "ms": "2.1.2" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/ms/2.1.2/ms-2.1.2.tgz", + "integrity": "sha1-0J0fNXtEP0kzgqjrPM0YOHKuYAk=", + "dev": true + }, + "semver": { + "version": "6.3.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/semver/6.3.0/semver-6.3.0.tgz", + "integrity": "sha1-7gpkyK9ejO6mdoexM3YeG+y9HT0=", + "dev": true + }, + "source-map": { + "version": "0.5.7", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/source-map/0.5.7/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", + "dev": true + } + } + }, + "@babel/generator": { + "version": "7.13.9", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@babel/generator/-/generator-7.13.9.tgz", + "integrity": "sha512-mHOOmY0Axl/JCTkxTU6Lf5sWOg/v8nUa+Xkt4zMTftX0wqmb6Sh7J8gvcehBw7q0AhrhAR+FDacKjCZ2X8K+Sw==", + "dev": true, + "requires": { + "@babel/types": "^7.13.0", + "jsesc": "^2.5.1", + "source-map": "^0.5.0" + }, + "dependencies": { + "source-map": { + "version": "0.5.7", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/source-map/0.5.7/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", + "dev": true + } + } + }, + "@babel/helper-annotate-as-pure": { + "version": "7.12.13", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.12.13.tgz", + "integrity": "sha512-7YXfX5wQ5aYM/BOlbSccHDbuXXFPxeoUmfWtz8le2yTkTZc+BxsiEnENFoi2SlmA8ewDkG2LgIMIVzzn2h8kfw==", + "dev": true, + "requires": { + "@babel/types": "^7.12.13" + } + }, + "@babel/helper-builder-binary-assignment-operator-visitor": { + "version": "7.12.13", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@babel/helper-builder-binary-assignment-operator-visitor/-/helper-builder-binary-assignment-operator-visitor-7.12.13.tgz", + "integrity": "sha512-CZOv9tGphhDRlVjVkAgm8Nhklm9RzSmWpX2my+t7Ua/KT616pEzXsQCjinzvkRvHWJ9itO4f296efroX23XCMA==", + "dev": true, + "requires": { + "@babel/helper-explode-assignable-expression": "^7.12.13", + "@babel/types": "^7.12.13" + } + }, + "@babel/helper-compilation-targets": { + "version": "7.13.13", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@babel/helper-compilation-targets/-/helper-compilation-targets-7.13.13.tgz", + "integrity": "sha512-q1kcdHNZehBwD9jYPh3WyXcsFERi39X4I59I3NadciWtNDyZ6x+GboOxncFK0kXlKIv6BJm5acncehXWUjWQMQ==", + "dev": true, + "requires": { + "@babel/compat-data": "^7.13.12", + "@babel/helper-validator-option": "^7.12.17", + "browserslist": "^4.14.5", + "semver": "^6.3.0" + }, + "dependencies": { + "semver": { + "version": "6.3.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/semver/6.3.0/semver-6.3.0.tgz", + "integrity": "sha1-7gpkyK9ejO6mdoexM3YeG+y9HT0=", + "dev": true + } + } + }, + "@babel/helper-create-class-features-plugin": { + "version": "7.13.11", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.13.11.tgz", + "integrity": "sha512-ays0I7XYq9xbjCSvT+EvysLgfc3tOkwCULHjrnscGT3A9qD4sk3wXnJ3of0MAWsWGjdinFvajHU2smYuqXKMrw==", + "dev": true, + "requires": { + "@babel/helper-function-name": "^7.12.13", + "@babel/helper-member-expression-to-functions": "^7.13.0", + "@babel/helper-optimise-call-expression": "^7.12.13", + "@babel/helper-replace-supers": "^7.13.0", + "@babel/helper-split-export-declaration": "^7.12.13" + } + }, + "@babel/helper-create-regexp-features-plugin": { + "version": "7.12.17", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@babel/helper-create-regexp-features-plugin/-/helper-create-regexp-features-plugin-7.12.17.tgz", + "integrity": "sha512-p2VGmBu9oefLZ2nQpgnEnG0ZlRPvL8gAGvPUMQwUdaE8k49rOMuZpOwdQoy5qJf6K8jL3bcAMhVUlHAjIgJHUg==", + "dev": true, + "requires": { + "@babel/helper-annotate-as-pure": "^7.12.13", + "regexpu-core": "^4.7.1" + } + }, + "@babel/helper-define-polyfill-provider": { + "version": "0.2.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@babel/helper-define-polyfill-provider/-/helper-define-polyfill-provider-0.2.0.tgz", + "integrity": "sha512-JT8tHuFjKBo8NnaUbblz7mIu1nnvUDiHVjXXkulZULyidvo/7P6TY7+YqpV37IfF+KUFxmlK04elKtGKXaiVgw==", + "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": { + "debug": { + "version": "4.3.2", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/debug/4.3.2/debug-4.3.2.tgz", + "integrity": "sha1-8KScGKyHeeMdSgxgKd+3aHPHQos=", + "dev": true, + "requires": { + "ms": "2.1.2" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/ms/2.1.2/ms-2.1.2.tgz", + "integrity": "sha1-0J0fNXtEP0kzgqjrPM0YOHKuYAk=", + "dev": true + }, + "semver": { + "version": "6.3.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/semver/6.3.0/semver-6.3.0.tgz", + "integrity": "sha1-7gpkyK9ejO6mdoexM3YeG+y9HT0=", + "dev": true + } + } + }, + "@babel/helper-explode-assignable-expression": { + "version": "7.13.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@babel/helper-explode-assignable-expression/-/helper-explode-assignable-expression-7.13.0.tgz", + "integrity": "sha512-qS0peLTDP8kOisG1blKbaoBg/o9OSa1qoumMjTK5pM+KDTtpxpsiubnCGP34vK8BXGcb2M9eigwgvoJryrzwWA==", + "dev": true, + "requires": { + "@babel/types": "^7.13.0" + } + }, + "@babel/helper-function-name": { + "version": "7.12.13", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@babel/helper-function-name/-/helper-function-name-7.12.13.tgz", + "integrity": "sha512-TZvmPn0UOqmvi5G4vvw0qZTpVptGkB1GL61R6lKvrSdIxGm5Pky7Q3fpKiIkQCAtRCBUwB0PaThlx9vebCDSwA==", + "dev": true, + "requires": { + "@babel/helper-get-function-arity": "^7.12.13", + "@babel/template": "^7.12.13", + "@babel/types": "^7.12.13" + } + }, + "@babel/helper-get-function-arity": { + "version": "7.12.13", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@babel/helper-get-function-arity/-/helper-get-function-arity-7.12.13.tgz", + "integrity": "sha512-DjEVzQNz5LICkzN0REdpD5prGoidvbdYk1BVgRUOINaWJP2t6avB27X1guXK1kXNrX0WMfsrm1A/ZBthYuIMQg==", + "dev": true, + "requires": { + "@babel/types": "^7.12.13" + } + }, + "@babel/helper-hoist-variables": { + "version": "7.13.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@babel/helper-hoist-variables/-/helper-hoist-variables-7.13.0.tgz", + "integrity": "sha512-0kBzvXiIKfsCA0y6cFEIJf4OdzfpRuNk4+YTeHZpGGc666SATFKTz6sRncwFnQk7/ugJ4dSrCj6iJuvW4Qwr2g==", + "dev": true, + "requires": { + "@babel/traverse": "^7.13.0", + "@babel/types": "^7.13.0" + } + }, + "@babel/helper-member-expression-to-functions": { + "version": "7.13.12", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.13.12.tgz", + "integrity": "sha512-48ql1CLL59aKbU94Y88Xgb2VFy7a95ykGRbJJaaVv+LX5U8wFpLfiGXJJGUozsmA1oEh/o5Bp60Voq7ACyA/Sw==", + "dev": true, + "requires": { + "@babel/types": "^7.13.12" + } + }, + "@babel/helper-module-imports": { + "version": "7.13.12", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@babel/helper-module-imports/-/helper-module-imports-7.13.12.tgz", + "integrity": "sha512-4cVvR2/1B693IuOvSI20xqqa/+bl7lqAMR59R4iu39R9aOX8/JoYY1sFaNvUMyMBGnHdwvJgUrzNLoUZxXypxA==", + "dev": true, + "requires": { + "@babel/types": "^7.13.12" + } + }, + "@babel/helper-module-transforms": { + "version": "7.13.14", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@babel/helper-module-transforms/-/helper-module-transforms-7.13.14.tgz", + "integrity": "sha512-QuU/OJ0iAOSIatyVZmfqB0lbkVP0kDRiKj34xy+QNsnVZi/PA6BoSoreeqnxxa9EHFAIL0R9XOaAR/G9WlIy5g==", + "dev": true, + "requires": { + "@babel/helper-module-imports": "^7.13.12", + "@babel/helper-replace-supers": "^7.13.12", + "@babel/helper-simple-access": "^7.13.12", + "@babel/helper-split-export-declaration": "^7.12.13", + "@babel/helper-validator-identifier": "^7.12.11", + "@babel/template": "^7.12.13", + "@babel/traverse": "^7.13.13", + "@babel/types": "^7.13.14" + } + }, + "@babel/helper-optimise-call-expression": { + "version": "7.12.13", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.12.13.tgz", + "integrity": "sha512-BdWQhoVJkp6nVjB7nkFWcn43dkprYauqtk++Py2eaf/GRDFm5BxRqEIZCiHlZUGAVmtwKcsVL1dC68WmzeFmiA==", + "dev": true, + "requires": { + "@babel/types": "^7.12.13" + } + }, + "@babel/helper-plugin-utils": { + "version": "7.13.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@babel/helper-plugin-utils/-/helper-plugin-utils-7.13.0.tgz", + "integrity": "sha512-ZPafIPSwzUlAoWT8DKs1W2VyF2gOWthGd5NGFMsBcMMol+ZhK+EQY/e6V96poa6PA/Bh+C9plWN0hXO1uB8AfQ==", + "dev": true + }, + "@babel/helper-remap-async-to-generator": { + "version": "7.13.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@babel/helper-remap-async-to-generator/-/helper-remap-async-to-generator-7.13.0.tgz", + "integrity": "sha512-pUQpFBE9JvC9lrQbpX0TmeNIy5s7GnZjna2lhhcHC7DzgBs6fWn722Y5cfwgrtrqc7NAJwMvOa0mKhq6XaE4jg==", + "dev": true, + "requires": { + "@babel/helper-annotate-as-pure": "^7.12.13", + "@babel/helper-wrap-function": "^7.13.0", + "@babel/types": "^7.13.0" + } + }, + "@babel/helper-replace-supers": { + "version": "7.13.12", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@babel/helper-replace-supers/-/helper-replace-supers-7.13.12.tgz", + "integrity": "sha512-Gz1eiX+4yDO8mT+heB94aLVNCL+rbuT2xy4YfyNqu8F+OI6vMvJK891qGBTqL9Uc8wxEvRW92Id6G7sDen3fFw==", + "dev": true, + "requires": { + "@babel/helper-member-expression-to-functions": "^7.13.12", + "@babel/helper-optimise-call-expression": "^7.12.13", + "@babel/traverse": "^7.13.0", + "@babel/types": "^7.13.12" + } + }, + "@babel/helper-simple-access": { + "version": "7.13.12", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@babel/helper-simple-access/-/helper-simple-access-7.13.12.tgz", + "integrity": "sha512-7FEjbrx5SL9cWvXioDbnlYTppcZGuCY6ow3/D5vMggb2Ywgu4dMrpTJX0JdQAIcRRUElOIxF3yEooa9gUb9ZbA==", + "dev": true, + "requires": { + "@babel/types": "^7.13.12" + } + }, + "@babel/helper-skip-transparent-expression-wrappers": { + "version": "7.12.1", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@babel/helper-skip-transparent-expression-wrappers/-/helper-skip-transparent-expression-wrappers-7.12.1.tgz", + "integrity": "sha512-Mf5AUuhG1/OCChOJ/HcADmvcHM42WJockombn8ATJG3OnyiSxBK/Mm5x78BQWvmtXZKHgbjdGL2kin/HOLlZGA==", + "dev": true, + "requires": { + "@babel/types": "^7.12.1" + } + }, + "@babel/helper-split-export-declaration": { + "version": "7.12.13", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.12.13.tgz", + "integrity": "sha512-tCJDltF83htUtXx5NLcaDqRmknv652ZWCHyoTETf1CXYJdPC7nohZohjUgieXhv0hTJdRf2FjDueFehdNucpzg==", + "dev": true, + "requires": { + "@babel/types": "^7.12.13" + } + }, + "@babel/helper-validator-identifier": { + "version": "7.12.11", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@babel/helper-validator-identifier/-/helper-validator-identifier-7.12.11.tgz", + "integrity": "sha512-np/lG3uARFybkoHokJUmf1QfEvRVCPbmQeUQpKow5cQ3xWrV9i3rUHodKDJPQfTVX61qKi+UdYk8kik84n7XOw==", + "dev": true + }, + "@babel/helper-validator-option": { + "version": "7.12.17", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@babel/helper-validator-option/-/helper-validator-option-7.12.17.tgz", + "integrity": "sha512-TopkMDmLzq8ngChwRlyjR6raKD6gMSae4JdYDB8bByKreQgG0RBTuKe9LRxW3wFtUnjxOPRKBDwEH6Mg5KeDfw==", + "dev": true + }, + "@babel/helper-wrap-function": { + "version": "7.13.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@babel/helper-wrap-function/-/helper-wrap-function-7.13.0.tgz", + "integrity": "sha512-1UX9F7K3BS42fI6qd2A4BjKzgGjToscyZTdp1DjknHLCIvpgne6918io+aL5LXFcER/8QWiwpoY902pVEqgTXA==", + "dev": true, + "requires": { + "@babel/helper-function-name": "^7.12.13", + "@babel/template": "^7.12.13", + "@babel/traverse": "^7.13.0", + "@babel/types": "^7.13.0" + } + }, + "@babel/helpers": { + "version": "7.13.10", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@babel/helpers/-/helpers-7.13.10.tgz", + "integrity": "sha512-4VO883+MWPDUVRF3PhiLBUFHoX/bsLTGFpFK/HqvvfBZz2D57u9XzPVNFVBTc0PW/CWR9BXTOKt8NF4DInUHcQ==", + "dev": true, + "requires": { + "@babel/template": "^7.12.13", + "@babel/traverse": "^7.13.0", + "@babel/types": "^7.13.0" + } + }, + "@babel/highlight": { + "version": "7.13.10", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@babel/highlight/-/highlight-7.13.10.tgz", + "integrity": "sha512-5aPpe5XQPzflQrFwL1/QoeHkP2MsA4JCntcXHRhEsdsfPVkvPi2w7Qix4iV7t5S/oC9OodGrggd8aco1g3SZFg==", + "dev": true, + "requires": { + "@babel/helper-validator-identifier": "^7.12.11", + "chalk": "^2.0.0", + "js-tokens": "^4.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/ansi-styles/3.2.1/ansi-styles-3.2.1.tgz", + "integrity": "sha1-QfuyAkPlCxK+DwS43tvwdSDOhB0=", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.2", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/chalk/2.4.2/chalk-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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/color-convert/1.9.3/color-convert-1.9.3.tgz", + "integrity": "sha1-u3GFBpDh8TZWfeYp0tVHHe2kweg=", + "dev": true, + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/color-name/1.1.3/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", + "dev": true + }, + "has-flag": { + "version": "3.0.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/has-flag/3.0.0/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "supports-color": { + "version": "5.5.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/supports-color/5.5.0/supports-color-5.5.0.tgz", + "integrity": "sha1-4uaaRKyHcveKHsCzW2id9lMO/I8=", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "@babel/parser": { + "version": "7.13.15", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@babel/parser/-/parser-7.13.15.tgz", + "integrity": "sha512-b9COtcAlVEQljy/9fbcMHpG+UIW9ReF+gpaxDHTlZd0c6/UU9ng8zdySAW9sRTzpvcdCHn6bUcbuYUgGzLAWVQ==", + "dev": true + }, + "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": { + "version": "7.13.12", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining/-/plugin-bugfix-v8-spread-parameters-in-optional-chaining-7.13.12.tgz", + "integrity": "sha512-d0u3zWKcoZf379fOeJdr1a5WPDny4aOFZ6hlfKivgK0LY7ZxNfoaHL2fWwdGtHyVvra38FC+HVYkO+byfSA8AQ==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.13.0", + "@babel/helper-skip-transparent-expression-wrappers": "^7.12.1", + "@babel/plugin-proposal-optional-chaining": "^7.13.12" + } + }, + "@babel/plugin-proposal-async-generator-functions": { + "version": "7.13.15", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.13.15.tgz", + "integrity": "sha512-VapibkWzFeoa6ubXy/NgV5U2U4MVnUlvnx6wo1XhlsaTrLYWE0UFpDQsVrmn22q5CzeloqJ8gEMHSKxuee6ZdA==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.13.0", + "@babel/helper-remap-async-to-generator": "^7.13.0", + "@babel/plugin-syntax-async-generators": "^7.8.4" + } + }, + "@babel/plugin-proposal-class-properties": { + "version": "7.13.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.13.0.tgz", + "integrity": "sha512-KnTDjFNC1g+45ka0myZNvSBFLhNCLN+GeGYLDEA8Oq7MZ6yMgfLoIRh86GRT0FjtJhZw8JyUskP9uvj5pHM9Zg==", + "dev": true, + "requires": { + "@babel/helper-create-class-features-plugin": "^7.13.0", + "@babel/helper-plugin-utils": "^7.13.0" + } + }, + "@babel/plugin-proposal-dynamic-import": { + "version": "7.13.8", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@babel/plugin-proposal-dynamic-import/-/plugin-proposal-dynamic-import-7.13.8.tgz", + "integrity": "sha512-ONWKj0H6+wIRCkZi9zSbZtE/r73uOhMVHh256ys0UzfM7I3d4n+spZNWjOnJv2gzopumP2Wxi186vI8N0Y2JyQ==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.13.0", + "@babel/plugin-syntax-dynamic-import": "^7.8.3" + } + }, + "@babel/plugin-proposal-export-namespace-from": { + "version": "7.12.13", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@babel/plugin-proposal-export-namespace-from/-/plugin-proposal-export-namespace-from-7.12.13.tgz", + "integrity": "sha512-INAgtFo4OnLN3Y/j0VwAgw3HDXcDtX+C/erMvWzuV9v71r7urb6iyMXu7eM9IgLr1ElLlOkaHjJ0SbCmdOQ3Iw==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.12.13", + "@babel/plugin-syntax-export-namespace-from": "^7.8.3" + } + }, + "@babel/plugin-proposal-json-strings": { + "version": "7.13.8", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@babel/plugin-proposal-json-strings/-/plugin-proposal-json-strings-7.13.8.tgz", + "integrity": "sha512-w4zOPKUFPX1mgvTmL/fcEqy34hrQ1CRcGxdphBc6snDnnqJ47EZDIyop6IwXzAC8G916hsIuXB2ZMBCExC5k7Q==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.13.0", + "@babel/plugin-syntax-json-strings": "^7.8.3" + } + }, + "@babel/plugin-proposal-logical-assignment-operators": { + "version": "7.13.8", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@babel/plugin-proposal-logical-assignment-operators/-/plugin-proposal-logical-assignment-operators-7.13.8.tgz", + "integrity": "sha512-aul6znYB4N4HGweImqKn59Su9RS8lbUIqxtXTOcAGtNIDczoEFv+l1EhmX8rUBp3G1jMjKJm8m0jXVp63ZpS4A==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.13.0", + "@babel/plugin-syntax-logical-assignment-operators": "^7.10.4" + } + }, + "@babel/plugin-proposal-nullish-coalescing-operator": { + "version": "7.13.8", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@babel/plugin-proposal-nullish-coalescing-operator/-/plugin-proposal-nullish-coalescing-operator-7.13.8.tgz", + "integrity": "sha512-iePlDPBn//UhxExyS9KyeYU7RM9WScAG+D3Hhno0PLJebAEpDZMocbDe64eqynhNAnwz/vZoL/q/QB2T1OH39A==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.13.0", + "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3" + } + }, + "@babel/plugin-proposal-numeric-separator": { + "version": "7.12.13", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@babel/plugin-proposal-numeric-separator/-/plugin-proposal-numeric-separator-7.12.13.tgz", + "integrity": "sha512-O1jFia9R8BUCl3ZGB7eitaAPu62TXJRHn7rh+ojNERCFyqRwJMTmhz+tJ+k0CwI6CLjX/ee4qW74FSqlq9I35w==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.12.13", + "@babel/plugin-syntax-numeric-separator": "^7.10.4" + } + }, + "@babel/plugin-proposal-object-rest-spread": { + "version": "7.13.8", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.13.8.tgz", + "integrity": "sha512-DhB2EuB1Ih7S3/IRX5AFVgZ16k3EzfRbq97CxAVI1KSYcW+lexV8VZb7G7L8zuPVSdQMRn0kiBpf/Yzu9ZKH0g==", + "dev": true, + "requires": { + "@babel/compat-data": "^7.13.8", + "@babel/helper-compilation-targets": "^7.13.8", + "@babel/helper-plugin-utils": "^7.13.0", + "@babel/plugin-syntax-object-rest-spread": "^7.8.3", + "@babel/plugin-transform-parameters": "^7.13.0" + } + }, + "@babel/plugin-proposal-optional-catch-binding": { + "version": "7.13.8", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@babel/plugin-proposal-optional-catch-binding/-/plugin-proposal-optional-catch-binding-7.13.8.tgz", + "integrity": "sha512-0wS/4DUF1CuTmGo+NiaHfHcVSeSLj5S3e6RivPTg/2k3wOv3jO35tZ6/ZWsQhQMvdgI7CwphjQa/ccarLymHVA==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.13.0", + "@babel/plugin-syntax-optional-catch-binding": "^7.8.3" + } + }, + "@babel/plugin-proposal-optional-chaining": { + "version": "7.13.12", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@babel/plugin-proposal-optional-chaining/-/plugin-proposal-optional-chaining-7.13.12.tgz", + "integrity": "sha512-fcEdKOkIB7Tf4IxrgEVeFC4zeJSTr78no9wTdBuZZbqF64kzllU0ybo2zrzm7gUQfxGhBgq4E39oRs8Zx/RMYQ==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.13.0", + "@babel/helper-skip-transparent-expression-wrappers": "^7.12.1", + "@babel/plugin-syntax-optional-chaining": "^7.8.3" + } + }, + "@babel/plugin-proposal-private-methods": { + "version": "7.13.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@babel/plugin-proposal-private-methods/-/plugin-proposal-private-methods-7.13.0.tgz", + "integrity": "sha512-MXyyKQd9inhx1kDYPkFRVOBXQ20ES8Pto3T7UZ92xj2mY0EVD8oAVzeyYuVfy/mxAdTSIayOvg+aVzcHV2bn6Q==", + "dev": true, + "requires": { + "@babel/helper-create-class-features-plugin": "^7.13.0", + "@babel/helper-plugin-utils": "^7.13.0" + } + }, + "@babel/plugin-proposal-unicode-property-regex": { + "version": "7.12.13", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@babel/plugin-proposal-unicode-property-regex/-/plugin-proposal-unicode-property-regex-7.12.13.tgz", + "integrity": "sha512-XyJmZidNfofEkqFV5VC/bLabGmO5QzenPO/YOfGuEbgU+2sSwMmio3YLb4WtBgcmmdwZHyVyv8on77IUjQ5Gvg==", + "dev": true, + "requires": { + "@babel/helper-create-regexp-features-plugin": "^7.12.13", + "@babel/helper-plugin-utils": "^7.12.13" + } + }, + "@babel/plugin-syntax-async-generators": { + "version": "7.8.4", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/babel/plugin-syntax-async-generators/7.8.4/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@babel/plugin-syntax-class-properties/-/plugin-syntax-class-properties-7.12.13.tgz", + "integrity": "sha512-fm4idjKla0YahUNgFNLCB0qySdsoPiZP3iQE3rky0mBUtMZ23yDJ9SJdg6dXTSDnulOVqiF3Hgr9nbXvXTQZYA==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.12.13" + } + }, + "@babel/plugin-syntax-dynamic-import": { + "version": "7.8.3", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/babel/plugin-syntax-dynamic-import/7.8.3/plugin-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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/babel/plugin-syntax-export-namespace-from/7.8.3/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/babel/plugin-syntax-json-strings/7.8.3/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@babel/plugin-syntax-logical-assignment-operators/-/plugin-syntax-logical-assignment-operators-7.10.4.tgz", + "integrity": "sha512-d8waShlpFDinQ5MtvGU9xDAOzKH47+FFoney2baFIoMr952hKOLp1HR7VszoZvOsV/4+RRszNY7D17ba0te0ig==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.10.4" + } + }, + "@babel/plugin-syntax-nullish-coalescing-operator": { + "version": "7.8.3", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/babel/plugin-syntax-nullish-coalescing-operator/7.8.3/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/babel/plugin-syntax-numeric-separator/7.10.4/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/babel/plugin-syntax-object-rest-spread/7.8.3/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/babel/plugin-syntax-optional-catch-binding/7.8.3/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/babel/plugin-syntax-optional-chaining/7.8.3/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-top-level-await": { + "version": "7.12.13", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@babel/plugin-syntax-top-level-await/-/plugin-syntax-top-level-await-7.12.13.tgz", + "integrity": "sha512-A81F9pDwyS7yM//KwbCSDqy3Uj4NMIurtplxphWxoYtNPov7cJsDkAFNNyVlIZ3jwGycVsurZ+LtOA8gZ376iQ==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.12.13" + } + }, + "@babel/plugin-syntax-typescript": { + "version": "7.12.13", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.12.13.tgz", + "integrity": "sha512-cHP3u1JiUiG2LFDKbXnwVad81GvfyIOmCD6HIEId6ojrY0Drfy2q1jw7BwN7dE84+kTnBjLkXoL3IEy/3JPu2w==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.12.13" + } + }, + "@babel/plugin-transform-arrow-functions": { + "version": "7.13.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.13.0.tgz", + "integrity": "sha512-96lgJagobeVmazXFaDrbmCLQxBysKu7U6Do3mLsx27gf5Dk85ezysrs2BZUpXD703U/Su1xTBDxxar2oa4jAGg==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.13.0" + } + }, + "@babel/plugin-transform-async-to-generator": { + "version": "7.13.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.13.0.tgz", + "integrity": "sha512-3j6E004Dx0K3eGmhxVJxwwI89CTJrce7lg3UrtFuDAVQ/2+SJ/h/aSFOeE6/n0WB1GsOffsJp6MnPQNQ8nmwhg==", + "dev": true, + "requires": { + "@babel/helper-module-imports": "^7.12.13", + "@babel/helper-plugin-utils": "^7.13.0", + "@babel/helper-remap-async-to-generator": "^7.13.0" + } + }, + "@babel/plugin-transform-block-scoped-functions": { + "version": "7.12.13", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@babel/plugin-transform-block-scoped-functions/-/plugin-transform-block-scoped-functions-7.12.13.tgz", + "integrity": "sha512-zNyFqbc3kI/fVpqwfqkg6RvBgFpC4J18aKKMmv7KdQ/1GgREapSJAykLMVNwfRGO3BtHj3YQZl8kxCXPcVMVeg==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.12.13" + } + }, + "@babel/plugin-transform-block-scoping": { + "version": "7.12.13", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.12.13.tgz", + "integrity": "sha512-Pxwe0iqWJX4fOOM2kEZeUuAxHMWb9nK+9oh5d11bsLoB0xMg+mkDpt0eYuDZB7ETrY9bbcVlKUGTOGWy7BHsMQ==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.12.13" + } + }, + "@babel/plugin-transform-classes": { + "version": "7.13.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@babel/plugin-transform-classes/-/plugin-transform-classes-7.13.0.tgz", + "integrity": "sha512-9BtHCPUARyVH1oXGcSJD3YpsqRLROJx5ZNP6tN5vnk17N0SVf9WCtf8Nuh1CFmgByKKAIMstitKduoCmsaDK5g==", + "dev": true, + "requires": { + "@babel/helper-annotate-as-pure": "^7.12.13", + "@babel/helper-function-name": "^7.12.13", + "@babel/helper-optimise-call-expression": "^7.12.13", + "@babel/helper-plugin-utils": "^7.13.0", + "@babel/helper-replace-supers": "^7.13.0", + "@babel/helper-split-export-declaration": "^7.12.13", + "globals": "^11.1.0" + } + }, + "@babel/plugin-transform-computed-properties": { + "version": "7.13.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@babel/plugin-transform-computed-properties/-/plugin-transform-computed-properties-7.13.0.tgz", + "integrity": "sha512-RRqTYTeZkZAz8WbieLTvKUEUxZlUTdmL5KGMyZj7FnMfLNKV4+r5549aORG/mgojRmFlQMJDUupwAMiF2Q7OUg==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.13.0" + } + }, + "@babel/plugin-transform-destructuring": { + "version": "7.13.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.13.0.tgz", + "integrity": "sha512-zym5em7tePoNT9s964c0/KU3JPPnuq7VhIxPRefJ4/s82cD+q1mgKfuGRDMCPL0HTyKz4dISuQlCusfgCJ86HA==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.13.0" + } + }, + "@babel/plugin-transform-dotall-regex": { + "version": "7.12.13", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.12.13.tgz", + "integrity": "sha512-foDrozE65ZFdUC2OfgeOCrEPTxdB3yjqxpXh8CH+ipd9CHd4s/iq81kcUpyH8ACGNEPdFqbtzfgzbT/ZGlbDeQ==", + "dev": true, + "requires": { + "@babel/helper-create-regexp-features-plugin": "^7.12.13", + "@babel/helper-plugin-utils": "^7.12.13" + } + }, + "@babel/plugin-transform-duplicate-keys": { + "version": "7.12.13", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@babel/plugin-transform-duplicate-keys/-/plugin-transform-duplicate-keys-7.12.13.tgz", + "integrity": "sha512-NfADJiiHdhLBW3pulJlJI2NB0t4cci4WTZ8FtdIuNc2+8pslXdPtRRAEWqUY+m9kNOk2eRYbTAOipAxlrOcwwQ==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.12.13" + } + }, + "@babel/plugin-transform-exponentiation-operator": { + "version": "7.12.13", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@babel/plugin-transform-exponentiation-operator/-/plugin-transform-exponentiation-operator-7.12.13.tgz", + "integrity": "sha512-fbUelkM1apvqez/yYx1/oICVnGo2KM5s63mhGylrmXUxK/IAXSIf87QIxVfZldWf4QsOafY6vV3bX8aMHSvNrA==", + "dev": true, + "requires": { + "@babel/helper-builder-binary-assignment-operator-visitor": "^7.12.13", + "@babel/helper-plugin-utils": "^7.12.13" + } + }, + "@babel/plugin-transform-for-of": { + "version": "7.13.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.13.0.tgz", + "integrity": "sha512-IHKT00mwUVYE0zzbkDgNRP6SRzvfGCYsOxIRz8KsiaaHCcT9BWIkO+H9QRJseHBLOGBZkHUdHiqj6r0POsdytg==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.13.0" + } + }, + "@babel/plugin-transform-function-name": { + "version": "7.12.13", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@babel/plugin-transform-function-name/-/plugin-transform-function-name-7.12.13.tgz", + "integrity": "sha512-6K7gZycG0cmIwwF7uMK/ZqeCikCGVBdyP2J5SKNCXO5EOHcqi+z7Jwf8AmyDNcBgxET8DrEtCt/mPKPyAzXyqQ==", + "dev": true, + "requires": { + "@babel/helper-function-name": "^7.12.13", + "@babel/helper-plugin-utils": "^7.12.13" + } + }, + "@babel/plugin-transform-literals": { + "version": "7.12.13", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@babel/plugin-transform-literals/-/plugin-transform-literals-7.12.13.tgz", + "integrity": "sha512-FW+WPjSR7hiUxMcKqyNjP05tQ2kmBCdpEpZHY1ARm96tGQCCBvXKnpjILtDplUnJ/eHZ0lALLM+d2lMFSpYJrQ==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.12.13" + } + }, + "@babel/plugin-transform-member-expression-literals": { + "version": "7.12.13", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@babel/plugin-transform-member-expression-literals/-/plugin-transform-member-expression-literals-7.12.13.tgz", + "integrity": "sha512-kxLkOsg8yir4YeEPHLuO2tXP9R/gTjpuTOjshqSpELUN3ZAg2jfDnKUvzzJxObun38sw3wm4Uu69sX/zA7iRvg==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.12.13" + } + }, + "@babel/plugin-transform-modules-amd": { + "version": "7.13.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.13.0.tgz", + "integrity": "sha512-EKy/E2NHhY/6Vw5d1k3rgoobftcNUmp9fGjb9XZwQLtTctsRBOTRO7RHHxfIky1ogMN5BxN7p9uMA3SzPfotMQ==", + "dev": true, + "requires": { + "@babel/helper-module-transforms": "^7.13.0", + "@babel/helper-plugin-utils": "^7.13.0", + "babel-plugin-dynamic-import-node": "^2.3.3" + } + }, + "@babel/plugin-transform-modules-commonjs": { + "version": "7.13.8", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.13.8.tgz", + "integrity": "sha512-9QiOx4MEGglfYZ4XOnU79OHr6vIWUakIj9b4mioN8eQIoEh+pf5p/zEB36JpDFWA12nNMiRf7bfoRvl9Rn79Bw==", + "dev": true, + "requires": { + "@babel/helper-module-transforms": "^7.13.0", + "@babel/helper-plugin-utils": "^7.13.0", + "@babel/helper-simple-access": "^7.12.13", + "babel-plugin-dynamic-import-node": "^2.3.3" + } + }, + "@babel/plugin-transform-modules-systemjs": { + "version": "7.13.8", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.13.8.tgz", + "integrity": "sha512-hwqctPYjhM6cWvVIlOIe27jCIBgHCsdH2xCJVAYQm7V5yTMoilbVMi9f6wKg0rpQAOn6ZG4AOyvCqFF/hUh6+A==", + "dev": true, + "requires": { + "@babel/helper-hoist-variables": "^7.13.0", + "@babel/helper-module-transforms": "^7.13.0", + "@babel/helper-plugin-utils": "^7.13.0", + "@babel/helper-validator-identifier": "^7.12.11", + "babel-plugin-dynamic-import-node": "^2.3.3" + } + }, + "@babel/plugin-transform-modules-umd": { + "version": "7.13.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@babel/plugin-transform-modules-umd/-/plugin-transform-modules-umd-7.13.0.tgz", + "integrity": "sha512-D/ILzAh6uyvkWjKKyFE/W0FzWwasv6vPTSqPcjxFqn6QpX3u8DjRVliq4F2BamO2Wee/om06Vyy+vPkNrd4wxw==", + "dev": true, + "requires": { + "@babel/helper-module-transforms": "^7.13.0", + "@babel/helper-plugin-utils": "^7.13.0" + } + }, + "@babel/plugin-transform-named-capturing-groups-regex": { + "version": "7.12.13", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.12.13.tgz", + "integrity": "sha512-Xsm8P2hr5hAxyYblrfACXpQKdQbx4m2df9/ZZSQ8MAhsadw06+jW7s9zsSw6he+mJZXRlVMyEnVktJo4zjk1WA==", + "dev": true, + "requires": { + "@babel/helper-create-regexp-features-plugin": "^7.12.13" + } + }, + "@babel/plugin-transform-new-target": { + "version": "7.12.13", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@babel/plugin-transform-new-target/-/plugin-transform-new-target-7.12.13.tgz", + "integrity": "sha512-/KY2hbLxrG5GTQ9zzZSc3xWiOy379pIETEhbtzwZcw9rvuaVV4Fqy7BYGYOWZnaoXIQYbbJ0ziXLa/sKcGCYEQ==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.12.13" + } + }, + "@babel/plugin-transform-object-super": { + "version": "7.12.13", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@babel/plugin-transform-object-super/-/plugin-transform-object-super-7.12.13.tgz", + "integrity": "sha512-JzYIcj3XtYspZDV8j9ulnoMPZZnF/Cj0LUxPOjR89BdBVx+zYJI9MdMIlUZjbXDX+6YVeS6I3e8op+qQ3BYBoQ==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.12.13", + "@babel/helper-replace-supers": "^7.12.13" + } + }, + "@babel/plugin-transform-parameters": { + "version": "7.13.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.13.0.tgz", + "integrity": "sha512-Jt8k/h/mIwE2JFEOb3lURoY5C85ETcYPnbuAJ96zRBzh1XHtQZfs62ChZ6EP22QlC8c7Xqr9q+e1SU5qttwwjw==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.13.0" + } + }, + "@babel/plugin-transform-property-literals": { + "version": "7.12.13", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@babel/plugin-transform-property-literals/-/plugin-transform-property-literals-7.12.13.tgz", + "integrity": "sha512-nqVigwVan+lR+g8Fj8Exl0UQX2kymtjcWfMOYM1vTYEKujeyv2SkMgazf2qNcK7l4SDiKyTA/nHCPqL4e2zo1A==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.12.13" + } + }, + "@babel/plugin-transform-regenerator": { + "version": "7.13.15", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.13.15.tgz", + "integrity": "sha512-Bk9cOLSz8DiurcMETZ8E2YtIVJbFCPGW28DJWUakmyVWtQSm6Wsf0p4B4BfEr/eL2Nkhe/CICiUiMOCi1TPhuQ==", + "dev": true, + "requires": { + "regenerator-transform": "^0.14.2" + } + }, + "@babel/plugin-transform-reserved-words": { + "version": "7.12.13", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@babel/plugin-transform-reserved-words/-/plugin-transform-reserved-words-7.12.13.tgz", + "integrity": "sha512-xhUPzDXxZN1QfiOy/I5tyye+TRz6lA7z6xaT4CLOjPRMVg1ldRf0LHw0TDBpYL4vG78556WuHdyO9oi5UmzZBg==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.12.13" + } + }, + "@babel/plugin-transform-shorthand-properties": { + "version": "7.12.13", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.12.13.tgz", + "integrity": "sha512-xpL49pqPnLtf0tVluuqvzWIgLEhuPpZzvs2yabUHSKRNlN7ScYU7aMlmavOeyXJZKgZKQRBlh8rHbKiJDraTSw==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.12.13" + } + }, + "@babel/plugin-transform-spread": { + "version": "7.13.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@babel/plugin-transform-spread/-/plugin-transform-spread-7.13.0.tgz", + "integrity": "sha512-V6vkiXijjzYeFmQTr3dBxPtZYLPcUfY34DebOU27jIl2M/Y8Egm52Hw82CSjjPqd54GTlJs5x+CR7HeNr24ckg==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.13.0", + "@babel/helper-skip-transparent-expression-wrappers": "^7.12.1" + } + }, + "@babel/plugin-transform-sticky-regex": { + "version": "7.12.13", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@babel/plugin-transform-sticky-regex/-/plugin-transform-sticky-regex-7.12.13.tgz", + "integrity": "sha512-Jc3JSaaWT8+fr7GRvQP02fKDsYk4K/lYwWq38r/UGfaxo89ajud321NH28KRQ7xy1Ybc0VUE5Pz8psjNNDUglg==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.12.13" + } + }, + "@babel/plugin-transform-template-literals": { + "version": "7.13.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.13.0.tgz", + "integrity": "sha512-d67umW6nlfmr1iehCcBv69eSUSySk1EsIS8aTDX4Xo9qajAh6mYtcl4kJrBkGXuxZPEgVr7RVfAvNW6YQkd4Mw==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.13.0" + } + }, + "@babel/plugin-transform-typeof-symbol": { + "version": "7.12.13", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@babel/plugin-transform-typeof-symbol/-/plugin-transform-typeof-symbol-7.12.13.tgz", + "integrity": "sha512-eKv/LmUJpMnu4npgfvs3LiHhJua5fo/CysENxa45YCQXZwKnGCQKAg87bvoqSW1fFT+HA32l03Qxsm8ouTY3ZQ==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.12.13" + } + }, + "@babel/plugin-transform-typescript": { + "version": "7.13.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.13.0.tgz", + "integrity": "sha512-elQEwluzaU8R8dbVuW2Q2Y8Nznf7hnjM7+DSCd14Lo5fF63C9qNLbwZYbmZrtV9/ySpSUpkRpQXvJb6xyu4hCQ==", + "dev": true, + "requires": { + "@babel/helper-create-class-features-plugin": "^7.13.0", + "@babel/helper-plugin-utils": "^7.13.0", + "@babel/plugin-syntax-typescript": "^7.12.13" + } + }, + "@babel/plugin-transform-unicode-escapes": { + "version": "7.12.13", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@babel/plugin-transform-unicode-escapes/-/plugin-transform-unicode-escapes-7.12.13.tgz", + "integrity": "sha512-0bHEkdwJ/sN/ikBHfSmOXPypN/beiGqjo+o4/5K+vxEFNPRPdImhviPakMKG4x96l85emoa0Z6cDflsdBusZbw==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.12.13" + } + }, + "@babel/plugin-transform-unicode-regex": { + "version": "7.12.13", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@babel/plugin-transform-unicode-regex/-/plugin-transform-unicode-regex-7.12.13.tgz", + "integrity": "sha512-mDRzSNY7/zopwisPZ5kM9XKCfhchqIYwAKRERtEnhYscZB79VRekuRSoYbN0+KVe3y8+q1h6A4svXtP7N+UoCA==", + "dev": true, + "requires": { + "@babel/helper-create-regexp-features-plugin": "^7.12.13", + "@babel/helper-plugin-utils": "^7.12.13" + } + }, + "@babel/preset-env": { + "version": "7.13.15", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@babel/preset-env/-/preset-env-7.13.15.tgz", + "integrity": "sha512-D4JAPMXcxk69PKe81jRJ21/fP/uYdcTZ3hJDF5QX2HSI9bBxxYw/dumdR6dGumhjxlprHPE4XWoPaqzZUVy2MA==", + "dev": true, + "requires": { + "@babel/compat-data": "^7.13.15", + "@babel/helper-compilation-targets": "^7.13.13", + "@babel/helper-plugin-utils": "^7.13.0", + "@babel/helper-validator-option": "^7.12.17", + "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": "^7.13.12", + "@babel/plugin-proposal-async-generator-functions": "^7.13.15", + "@babel/plugin-proposal-class-properties": "^7.13.0", + "@babel/plugin-proposal-dynamic-import": "^7.13.8", + "@babel/plugin-proposal-export-namespace-from": "^7.12.13", + "@babel/plugin-proposal-json-strings": "^7.13.8", + "@babel/plugin-proposal-logical-assignment-operators": "^7.13.8", + "@babel/plugin-proposal-nullish-coalescing-operator": "^7.13.8", + "@babel/plugin-proposal-numeric-separator": "^7.12.13", + "@babel/plugin-proposal-object-rest-spread": "^7.13.8", + "@babel/plugin-proposal-optional-catch-binding": "^7.13.8", + "@babel/plugin-proposal-optional-chaining": "^7.13.12", + "@babel/plugin-proposal-private-methods": "^7.13.0", + "@babel/plugin-proposal-unicode-property-regex": "^7.12.13", + "@babel/plugin-syntax-async-generators": "^7.8.4", + "@babel/plugin-syntax-class-properties": "^7.12.13", + "@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-top-level-await": "^7.12.13", + "@babel/plugin-transform-arrow-functions": "^7.13.0", + "@babel/plugin-transform-async-to-generator": "^7.13.0", + "@babel/plugin-transform-block-scoped-functions": "^7.12.13", + "@babel/plugin-transform-block-scoping": "^7.12.13", + "@babel/plugin-transform-classes": "^7.13.0", + "@babel/plugin-transform-computed-properties": "^7.13.0", + "@babel/plugin-transform-destructuring": "^7.13.0", + "@babel/plugin-transform-dotall-regex": "^7.12.13", + "@babel/plugin-transform-duplicate-keys": "^7.12.13", + "@babel/plugin-transform-exponentiation-operator": "^7.12.13", + "@babel/plugin-transform-for-of": "^7.13.0", + "@babel/plugin-transform-function-name": "^7.12.13", + "@babel/plugin-transform-literals": "^7.12.13", + "@babel/plugin-transform-member-expression-literals": "^7.12.13", + "@babel/plugin-transform-modules-amd": "^7.13.0", + "@babel/plugin-transform-modules-commonjs": "^7.13.8", + "@babel/plugin-transform-modules-systemjs": "^7.13.8", + "@babel/plugin-transform-modules-umd": "^7.13.0", + "@babel/plugin-transform-named-capturing-groups-regex": "^7.12.13", + "@babel/plugin-transform-new-target": "^7.12.13", + "@babel/plugin-transform-object-super": "^7.12.13", + "@babel/plugin-transform-parameters": "^7.13.0", + "@babel/plugin-transform-property-literals": "^7.12.13", + "@babel/plugin-transform-regenerator": "^7.13.15", + "@babel/plugin-transform-reserved-words": "^7.12.13", + "@babel/plugin-transform-shorthand-properties": "^7.12.13", + "@babel/plugin-transform-spread": "^7.13.0", + "@babel/plugin-transform-sticky-regex": "^7.12.13", + "@babel/plugin-transform-template-literals": "^7.13.0", + "@babel/plugin-transform-typeof-symbol": "^7.12.13", + "@babel/plugin-transform-unicode-escapes": "^7.12.13", + "@babel/plugin-transform-unicode-regex": "^7.12.13", + "@babel/preset-modules": "^0.1.4", + "@babel/types": "^7.13.14", + "babel-plugin-polyfill-corejs2": "^0.2.0", + "babel-plugin-polyfill-corejs3": "^0.2.0", + "babel-plugin-polyfill-regenerator": "^0.2.0", + "core-js-compat": "^3.9.0", + "semver": "^6.3.0" + }, + "dependencies": { + "semver": { + "version": "6.3.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/semver/6.3.0/semver-6.3.0.tgz", + "integrity": "sha1-7gpkyK9ejO6mdoexM3YeG+y9HT0=", + "dev": true + } + } + }, + "@babel/preset-modules": { + "version": "0.1.4", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@babel/preset-modules/-/preset-modules-0.1.4.tgz", + "integrity": "sha512-J36NhwnfdzpmH41M1DrnkkgAqhZaqr/NBdPfQ677mLzlaXo+oDiv1deyCDtgAhz8p328otdob0Du7+xgHGZbKg==", + "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.13.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@babel/preset-typescript/-/preset-typescript-7.13.0.tgz", + "integrity": "sha512-LXJwxrHy0N3f6gIJlYbLta1D9BDtHpQeqwzM0LIfjDlr6UE/D5Mc7W4iDiQzaE+ks0sTjT26ArcHWnJVt0QiHw==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.13.0", + "@babel/helper-validator-option": "^7.12.17", + "@babel/plugin-transform-typescript": "^7.13.0" + } + }, + "@babel/runtime": { + "version": "7.13.10", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@babel/runtime/-/runtime-7.13.10.tgz", + "integrity": "sha512-4QPkjJq6Ns3V/RgpEahRk+AGfL0eO6RHHtTWoNNr5mO49G6B5+X6d6THgWEAvTrznU5xYpbAlVKRYcsCgh/Akw==", + "dev": true, + "requires": { + "regenerator-runtime": "^0.13.4" + } + }, + "@babel/template": { + "version": "7.12.13", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@babel/template/-/template-7.12.13.tgz", + "integrity": "sha512-/7xxiGA57xMo/P2GVvdEumr8ONhFOhfgq2ihK3h1e6THqzTAkHbkXgB0xI9yeTfIUoH3+oAeHhqm/I43OTbbjA==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.12.13", + "@babel/parser": "^7.12.13", + "@babel/types": "^7.12.13" + } + }, + "@babel/traverse": { + "version": "7.13.15", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@babel/traverse/-/traverse-7.13.15.tgz", + "integrity": "sha512-/mpZMNvj6bce59Qzl09fHEs8Bt8NnpEDQYleHUPZQ3wXUMvXi+HJPLars68oAbmp839fGoOkv2pSL2z9ajCIaQ==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.12.13", + "@babel/generator": "^7.13.9", + "@babel/helper-function-name": "^7.12.13", + "@babel/helper-split-export-declaration": "^7.12.13", + "@babel/parser": "^7.13.15", + "@babel/types": "^7.13.14", + "debug": "^4.1.0", + "globals": "^11.1.0" + }, + "dependencies": { + "debug": { + "version": "4.3.2", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/debug/4.3.2/debug-4.3.2.tgz", + "integrity": "sha1-8KScGKyHeeMdSgxgKd+3aHPHQos=", + "dev": true, + "requires": { + "ms": "2.1.2" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/ms/2.1.2/ms-2.1.2.tgz", + "integrity": "sha1-0J0fNXtEP0kzgqjrPM0YOHKuYAk=", + "dev": true + } + } + }, + "@babel/types": { + "version": "7.13.14", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@babel/types/-/types-7.13.14.tgz", + "integrity": "sha512-A2aa3QTkWoyqsZZFl56MLUsfmh7O0gN41IPvXAE/++8ojpbz12SszD7JEGYVdn4f9Kt4amIei07swF1h4AqmmQ==", + "dev": true, + "requires": { + "@babel/helper-validator-identifier": "^7.12.11", + "lodash": "^4.17.19", + "to-fast-properties": "^2.0.0" + } + }, + "@discoveryjs/json-ext": { + "version": "0.5.3", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@discoveryjs/json-ext/-/json-ext-0.5.3.tgz", + "integrity": "sha512-Fxt+AfXgjMoin2maPIYzFZnQjAXjAL0PHscM5pRTtatFqB+vZxAM9tLp2Optnuw3QOQC40jTNeGYFOMvyf7v9g==" + }, + "@eslint/eslintrc": { + "version": "0.4.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@eslint/eslintrc/-/eslintrc-0.4.0.tgz", + "integrity": "sha512-2ZPCc+uNbjV5ERJr+aKSPRwZgKd2z11x0EgLvb1PURmUrn9QNRXFqje0Ldq454PfAVyaJYyrDvvIKSFP4NnBog==", + "dev": true, + "requires": { + "ajv": "^6.12.4", + "debug": "^4.1.1", + "espree": "^7.3.0", + "globals": "^12.1.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": { + "debug": { + "version": "4.3.2", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/debug/4.3.2/debug-4.3.2.tgz", + "integrity": "sha1-8KScGKyHeeMdSgxgKd+3aHPHQos=", + "dev": true, + "requires": { + "ms": "2.1.2" + } + }, + "globals": { + "version": "12.4.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/globals/12.4.0/globals-12.4.0.tgz", + "integrity": "sha1-oYgTV2pBsAokqX5/gVkYwuGZJfg=", + "dev": true, + "requires": { + "type-fest": "^0.8.1" + } + }, + "ignore": { + "version": "4.0.6", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/ignore/4.0.6/ignore-4.0.6.tgz", + "integrity": "sha1-dQ49tYYgh7RzfrrIIH/9HvJ7Jfw=", + "dev": true + }, + "ms": { + "version": "2.1.2", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/ms/2.1.2/ms-2.1.2.tgz", + "integrity": "sha1-0J0fNXtEP0kzgqjrPM0YOHKuYAk=", + "dev": true + } + } + }, + "@nicolo-ribaudo/chokidar-2": { + "version": "2.1.8-no-fsevents", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@nicolo-ribaudo/chokidar-2/-/chokidar-2-2.1.8-no-fsevents.tgz", + "integrity": "sha512-+nb9vWloHNNMFHjGofEam3wopE3m1yuambrrd/fnPc+lFOMB9ROTqQlche9ByFWNkdNqfSgR/kkQtQ8DzEWt2w==", + "dev": true, + "optional": true, + "requires": { + "anymatch": "^2.0.0", + "async-each": "^1.0.1", + "braces": "^2.3.2", + "glob-parent": "^3.1.0", + "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": { + "braces": { + "version": "2.3.2", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/braces/2.3.2/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" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/extend-shallow/2.0.1/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/fill-range/4.0.0/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" + } + }, + "glob-parent": { + "version": "3.1.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/glob-parent/3.1.0/glob-parent-3.1.0.tgz", + "integrity": "sha1-nmr2KZ2NO9K9QEMIMr0RPfkGxa4=", + "dev": true, + "optional": true, + "requires": { + "is-glob": "^3.1.0", + "path-dirname": "^1.0.0" + }, + "dependencies": { + "is-glob": { + "version": "3.1.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/is-glob/3.1.0/is-glob-3.1.0.tgz", + "integrity": "sha1-e6WuJCF4BKxwcHuWkiVnSGzD6Eo=", + "dev": true, + "optional": true, + "requires": { + "is-extglob": "^2.1.0" + } + } + } + }, + "is-number": { + "version": "3.0.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/is-number/3.0.0/is-number-3.0.0.tgz", + "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "dev": true, + "optional": true, + "requires": { + "kind-of": "^3.0.2" + } + }, + "kind-of": { + "version": "3.2.2", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/kind-of/3.2.2/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "optional": true, + "requires": { + "is-buffer": "^1.1.5" + } + }, + "to-regex-range": { + "version": "2.1.1", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/to-regex-range/2.1.1/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.4", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@nodelib/fs.scandir/-/fs.scandir-2.1.4.tgz", + "integrity": "sha512-33g3pMJk3bg5nXbL/+CY6I2eJDzZAni49PfJnL5fghPTggPvBd/pFNSgJsdAgWptuFu7qq/ERvOYFlhvsLTCKA==", + "requires": { + "@nodelib/fs.stat": "2.0.4", + "run-parallel": "^1.1.9" + } + }, + "@nodelib/fs.stat": { + "version": "2.0.4", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@nodelib/fs.stat/-/fs.stat-2.0.4.tgz", + "integrity": "sha512-IYlHJA0clt2+Vg7bccq+TzRdJvv19c2INqBSsoOLp1je7xjtr7J26+WXR72MCdvU9q1qTzIWDfhMf+DRvQJK4Q==" + }, + "@nodelib/fs.walk": { + "version": "1.2.6", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@nodelib/fs.walk/-/fs.walk-1.2.6.tgz", + "integrity": "sha512-8Broas6vTtW4GIXTAHDoE32hnN2M5ykgCpWGbuXHQ15vEMqr23pB76e/GZcYsZCHALv50ktd24qhEyKr6wBtow==", + "requires": { + "@nodelib/fs.scandir": "2.1.4", + "fastq": "^1.6.0" + } + }, + "@types/anymatch": { + "version": "1.3.1", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/types/anymatch/1.3.1/anymatch-1.3.1.tgz", + "integrity": "sha1-M2utwb7sudrMOL6izzKt9ieoQho=" + }, + "@types/eslint": { + "version": "7.28.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@types/eslint/-/eslint-7.28.0.tgz", + "integrity": "sha512-07XlgzX0YJUn4iG1ocY4IX9DzKSmMGUs6ESKlxWhZRaa0fatIWaHWUVapcuGa8r5HFnTqzj+4OCjd5f7EZ/i/A==", + "requires": { + "@types/estree": "*", + "@types/json-schema": "*" + } + }, + "@types/eslint-scope": { + "version": "3.7.1", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@types/eslint-scope/-/eslint-scope-3.7.1.tgz", + "integrity": "sha512-SCFeogqiptms4Fg29WpOTk5nHIzfpKCemSN63ksBQYKTcXoJEmJagV+DhVmbapZzY4/5YaOV1nZwrsU79fFm1g==", + "requires": { + "@types/eslint": "*", + "@types/estree": "*" + } + }, + "@types/estree": { + "version": "0.0.50", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@types/estree/-/estree-0.0.50.tgz", + "integrity": "sha512-C6N5s2ZFtuZRj54k2/zyRhNDjJwwcViAM3Nbm8zjBpbqAdZ00mr0CFxvSKeO8Y/e03WVFLpQMdHYVfUd6SB+Hw==" + }, + "@types/glob": { + "version": "7.1.3", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@types/glob/-/glob-7.1.3.tgz", + "integrity": "sha512-SEYeGAIQIQX8NN6LDKprLjbrd5dARM5EXsd8GI/A5l0apYI1fGMWgPHSe4ZKL4eozlAyI+doUE9XbYS4xCkQ1w==", + "requires": { + "@types/minimatch": "*", + "@types/node": "*" + } + }, + "@types/json-schema": { + "version": "7.0.7", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@types/json-schema/-/json-schema-7.0.7.tgz", + "integrity": "sha512-cxWFQVseBm6O9Gbw1IWb8r6OS4OhSt3hPZLkFApLjM8TEXROBuQGLAH2i2gZpcXdLBIrpXuTDhH7Vbm1iXmNGA==" + }, + "@types/minimatch": { + "version": "3.0.4", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@types/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-1z8k4wzFnNjVK/tlxvrWuK5WMt6mydWWP7+zvH5eFep4oj+UkrfiJTRtjCeBXNpwaA/FYqqtb4/QS4ianFpIRA==" + }, + "@types/node": { + "version": "14.14.39", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@types/node/-/node-14.14.39.tgz", + "integrity": "sha512-Qipn7rfTxGEDqZiezH+wxqWYR8vcXq5LRpZrETD19Gs4o8LbklbmqotSUsMU+s5G3PJwMRDfNEYoxrcBwIxOuw==" + }, + "@types/source-list-map": { + "version": "0.1.2", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/types/source-list-map/0.1.2/source-list-map-0.1.2.tgz", + "integrity": "sha1-AHiDYGP/rxdBI0m7o2QIfgrALsk=" + }, + "@types/tapable": { + "version": "1.0.7", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@types/tapable/-/tapable-1.0.7.tgz", + "integrity": "sha512-0VBprVqfgFD7Ehb2vd8Lh9TG3jP98gvr8rgehQqzztZNI7o8zS8Ad4jyZneKELphpuE212D8J70LnSNQSyO6bQ==" + }, + "@types/uglify-js": { + "version": "3.13.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@types/uglify-js/-/uglify-js-3.13.0.tgz", + "integrity": "sha512-EGkrJD5Uy+Pg0NUR8uA4bJ5WMfljyad0G+784vLCNUkD+QwOJXUbBYExXfVGf7YtyzdQp3L/XMYcliB987kL5Q==", + "requires": { + "source-map": "^0.6.1" + } + }, + "@types/webpack": { + "version": "4.41.27", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@types/webpack/-/webpack-4.41.27.tgz", + "integrity": "sha512-wK/oi5gcHi72VMTbOaQ70VcDxSQ1uX8S2tukBK9ARuGXrYM/+u4ou73roc7trXDNmCxCoerE8zruQqX/wuHszA==", + "requires": { + "@types/anymatch": "*", + "@types/node": "*", + "@types/tapable": "^1", + "@types/uglify-js": "*", + "@types/webpack-sources": "*", + "source-map": "^0.6.0" + } + }, + "@types/webpack-sources": { + "version": "2.1.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@types/webpack-sources/-/webpack-sources-2.1.0.tgz", + "integrity": "sha512-LXn/oYIpBeucgP1EIJbKQ2/4ZmpvRl+dlrFdX7+94SKRUV3Evy3FsfMZY318vGhkWUS5MPhtOM3w1/hCOAOXcg==", + "requires": { + "@types/node": "*", + "@types/source-list-map": "*", + "source-map": "^0.7.3" + }, + "dependencies": { + "source-map": { + "version": "0.7.3", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/source-map/0.7.3/source-map-0.7.3.tgz", + "integrity": "sha1-UwL4FpAxc1ImVECS5kmB91F1A4M=" + } + } + }, + "@typescript-eslint/parser": { + "version": "4.22.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@typescript-eslint/parser/-/parser-4.22.0.tgz", + "integrity": "sha512-z/bGdBJJZJN76nvAY9DkJANYgK3nlRstRRi74WHm3jjgf2I8AglrSY+6l7ogxOmn55YJ6oKZCLLy+6PW70z15Q==", + "dev": true, + "requires": { + "@typescript-eslint/scope-manager": "4.22.0", + "@typescript-eslint/types": "4.22.0", + "@typescript-eslint/typescript-estree": "4.22.0", + "debug": "^4.1.1" + }, + "dependencies": { + "debug": { + "version": "4.3.2", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/debug/4.3.2/debug-4.3.2.tgz", + "integrity": "sha1-8KScGKyHeeMdSgxgKd+3aHPHQos=", + "dev": true, + "requires": { + "ms": "2.1.2" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/ms/2.1.2/ms-2.1.2.tgz", + "integrity": "sha1-0J0fNXtEP0kzgqjrPM0YOHKuYAk=", + "dev": true + } + } + }, + "@typescript-eslint/scope-manager": { + "version": "4.22.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@typescript-eslint/scope-manager/-/scope-manager-4.22.0.tgz", + "integrity": "sha512-OcCO7LTdk6ukawUM40wo61WdeoA7NM/zaoq1/2cs13M7GyiF+T4rxuA4xM+6LeHWjWbss7hkGXjFDRcKD4O04Q==", + "dev": true, + "requires": { + "@typescript-eslint/types": "4.22.0", + "@typescript-eslint/visitor-keys": "4.22.0" + } + }, + "@typescript-eslint/types": { + "version": "4.22.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@typescript-eslint/types/-/types-4.22.0.tgz", + "integrity": "sha512-sW/BiXmmyMqDPO2kpOhSy2Py5w6KvRRsKZnV0c4+0nr4GIcedJwXAq+RHNK4lLVEZAJYFltnnk1tJSlbeS9lYA==", + "dev": true + }, + "@typescript-eslint/typescript-estree": { + "version": "4.22.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@typescript-eslint/typescript-estree/-/typescript-estree-4.22.0.tgz", + "integrity": "sha512-TkIFeu5JEeSs5ze/4NID+PIcVjgoU3cUQUIZnH3Sb1cEn1lBo7StSV5bwPuJQuoxKXlzAObjYTilOEKRuhR5yg==", + "dev": true, + "requires": { + "@typescript-eslint/types": "4.22.0", + "@typescript-eslint/visitor-keys": "4.22.0", + "debug": "^4.1.1", + "globby": "^11.0.1", + "is-glob": "^4.0.1", + "semver": "^7.3.2", + "tsutils": "^3.17.1" + }, + "dependencies": { + "array-union": { + "version": "2.1.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/array-union/2.1.0/array-union-2.1.0.tgz", + "integrity": "sha1-t5hCCtvrHego2ErNii4j0+/oXo0=", + "dev": true + }, + "debug": { + "version": "4.3.2", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/debug/4.3.2/debug-4.3.2.tgz", + "integrity": "sha1-8KScGKyHeeMdSgxgKd+3aHPHQos=", + "dev": true, + "requires": { + "ms": "2.1.2" + } + }, + "globby": { + "version": "11.0.3", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/globby/-/globby-11.0.3.tgz", + "integrity": "sha512-ffdmosjA807y7+lA1NM0jELARVmYul/715xiILEjo3hBLPTcirgQNnXECn5g3mtR8TOLCVbkfua1Hpen25/Xcg==", + "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" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/ms/2.1.2/ms-2.1.2.tgz", + "integrity": "sha1-0J0fNXtEP0kzgqjrPM0YOHKuYAk=", + "dev": true + } + } + }, + "@typescript-eslint/visitor-keys": { + "version": "4.22.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@typescript-eslint/visitor-keys/-/visitor-keys-4.22.0.tgz", + "integrity": "sha512-nnMu4F+s4o0sll6cBSsTeVsT4cwxB7zECK3dFxzEjPBii9xLpq4yqqsy/FU5zMfan6G60DKZSCXAa3sHJZrcYw==", + "dev": true, + "requires": { + "@typescript-eslint/types": "4.22.0", + "eslint-visitor-keys": "^2.0.0" + } + }, + "@ungap/promise-all-settled": { + "version": "1.1.2", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@ungap/promise-all-settled/-/promise-all-settled-1.1.2.tgz", + "integrity": "sha512-sL/cEvJWAnClXw0wHk85/2L0G6Sj8UB0Ctc1TEMbKSsmpRosqhwj9gWgFRZSrBr2f9tiXISwNhCPmlfqUqyb9Q==", + "dev": true + }, + "@webassemblyjs/ast": { + "version": "1.11.1", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@webassemblyjs/ast/-/ast-1.11.1.tgz", + "integrity": "sha512-ukBh14qFLjxTQNTXocdyksN5QdM28S1CxHt2rdskFyL+xFV7VremuBLVbmCePj+URalXBENx/9Lm7lnhihtCSw==", + "requires": { + "@webassemblyjs/helper-numbers": "1.11.1", + "@webassemblyjs/helper-wasm-bytecode": "1.11.1" + } + }, + "@webassemblyjs/floating-point-hex-parser": { + "version": "1.11.1", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.11.1.tgz", + "integrity": "sha512-iGRfyc5Bq+NnNuX8b5hwBrRjzf0ocrJPI6GWFodBFzmFnyvrQ83SHKhmilCU/8Jv67i4GJZBMhEzltxzcNagtQ==" + }, + "@webassemblyjs/helper-api-error": { + "version": "1.11.1", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@webassemblyjs/helper-api-error/-/helper-api-error-1.11.1.tgz", + "integrity": "sha512-RlhS8CBCXfRUR/cwo2ho9bkheSXG0+NwooXcc3PAILALf2QLdFyj7KGsKRbVc95hZnhnERon4kW/D3SZpp6Tcg==" + }, + "@webassemblyjs/helper-buffer": { + "version": "1.11.1", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@webassemblyjs/helper-buffer/-/helper-buffer-1.11.1.tgz", + "integrity": "sha512-gwikF65aDNeeXa8JxXa2BAk+REjSyhrNC9ZwdT0f8jc4dQQeDQ7G4m0f2QCLPJiMTTO6wfDmRmj/pW0PsUvIcA==" + }, + "@webassemblyjs/helper-numbers": { + "version": "1.11.1", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@webassemblyjs/helper-numbers/-/helper-numbers-1.11.1.tgz", + "integrity": "sha512-vDkbxiB8zfnPdNK9Rajcey5C0w+QJugEglN0of+kmO8l7lDb77AnlKYQF7aarZuCrv+l0UvqL+68gSDr3k9LPQ==", + "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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.11.1.tgz", + "integrity": "sha512-PvpoOGiJwXeTrSf/qfudJhwlvDQxFgelbMqtq52WWiXC6Xgg1IREdngmPN3bs4RoO83PnL/nFrxucXj1+BX62Q==" + }, + "@webassemblyjs/helper-wasm-section": { + "version": "1.11.1", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.11.1.tgz", + "integrity": "sha512-10P9No29rYX1j7F3EVPX3JvGPQPae+AomuSTPiF9eBQeChHI6iqjMIwR9JmOJXwpnn/oVGDk7I5IlskuMwU/pg==", + "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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@webassemblyjs/ieee754/-/ieee754-1.11.1.tgz", + "integrity": "sha512-hJ87QIPtAMKbFq6CGTkZYJivEwZDbQUgYd3qKSadTNOhVY7p+gfP6Sr0lLRVTaG1JjFj+r3YchoqRYxNH3M0GQ==", + "requires": { + "@xtuc/ieee754": "^1.2.0" + } + }, + "@webassemblyjs/leb128": { + "version": "1.11.1", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@webassemblyjs/leb128/-/leb128-1.11.1.tgz", + "integrity": "sha512-BJ2P0hNZ0u+Th1YZXJpzW6miwqQUGcIHT1G/sf72gLVD9DZ5AdYTqPNbHZh6K1M5VmKvFXwGSWZADz+qBWxeRw==", + "requires": { + "@xtuc/long": "4.2.2" + } + }, + "@webassemblyjs/utf8": { + "version": "1.11.1", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@webassemblyjs/utf8/-/utf8-1.11.1.tgz", + "integrity": "sha512-9kqcxAEdMhiwQkHpkNiorZzqpGrodQQ2IGrHHxCy+Ozng0ofyMA0lTqiLkVs1uzTRejX+/O0EOT7KxqVPuXosQ==" + }, + "@webassemblyjs/wasm-edit": { + "version": "1.11.1", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@webassemblyjs/wasm-edit/-/wasm-edit-1.11.1.tgz", + "integrity": "sha512-g+RsupUC1aTHfR8CDgnsVRVZFJqdkFHpsHMfJuWQzWU3tvnLC07UqHICfP+4XyL2tnr1amvl1Sdp06TnYCmVkA==", + "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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@webassemblyjs/wasm-gen/-/wasm-gen-1.11.1.tgz", + "integrity": "sha512-F7QqKXwwNlMmsulj6+O7r4mmtAlCWfO/0HdgOxSklZfQcDu0TpLiD1mRt/zF25Bk59FIjEuGAIyn5ei4yMfLhA==", + "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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@webassemblyjs/wasm-opt/-/wasm-opt-1.11.1.tgz", + "integrity": "sha512-VqnkNqnZlU5EB64pp1l7hdm3hmQw7Vgqa0KF/KCNO9sIpI6Fk6brDEiX+iCOYrvMuBWDws0NkTOxYEb85XQHHw==", + "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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@webassemblyjs/wasm-parser/-/wasm-parser-1.11.1.tgz", + "integrity": "sha512-rrBujw+dJu32gYB7/Lup6UhdkPx9S9SnobZzRVL7VcBH9Bt9bCBLEuX/YXOOtBsOZ4NQrRykKhffRWHvigQvOA==", + "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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@webassemblyjs/wast-printer/-/wast-printer-1.11.1.tgz", + "integrity": "sha512-IQboUWM4eKzWW+N/jij2sRatKMh99QEelo3Eb2q0qXkvPRISAj8Qxtmw5itwqK+TTkBuUIE45AxYPToqPtL5gg==", + "requires": { + "@webassemblyjs/ast": "1.11.1", + "@xtuc/long": "4.2.2" + } + }, + "@webpack-cli/configtest": { + "version": "1.0.4", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@webpack-cli/configtest/-/configtest-1.0.4.tgz", + "integrity": "sha512-cs3XLy+UcxiP6bj0A6u7MLLuwdXJ1c3Dtc0RkKg+wiI1g/Ti1om8+/2hc2A2B60NbBNAbMgyBMHvyymWm/j4wQ==" + }, + "@webpack-cli/info": { + "version": "1.3.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@webpack-cli/info/-/info-1.3.0.tgz", + "integrity": "sha512-ASiVB3t9LOKHs5DyVUcxpraBXDOKubYu/ihHhU+t1UPpxsivg6Od2E2qU4gJCekfEddzRBzHhzA/Acyw/mlK/w==", + "requires": { + "envinfo": "^7.7.3" + } + }, + "@webpack-cli/serve": { + "version": "1.5.1", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@webpack-cli/serve/-/serve-1.5.1.tgz", + "integrity": "sha512-4vSVUiOPJLmr45S8rMGy7WDvpWxfFxfP/Qx/cxZFCfvoypTYpPPL1X8VIZMe0WTA+Jr7blUxwUSEZNkjoMTgSw==" + }, + "@xtuc/ieee754": { + "version": "1.2.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/xtuc/ieee754/1.2.0/ieee754-1.2.0.tgz", + "integrity": "sha1-7vAUoxRa5Hehy8AM0eVSM23Ot5A=" + }, + "@xtuc/long": { + "version": "4.2.2", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/xtuc/long/4.2.2/long-4.2.2.tgz", + "integrity": "sha1-0pHGpOl5ibXGHZrPOWrk/hM6cY0=" + }, + "acorn": { + "version": "8.4.1", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/acorn/-/acorn-8.4.1.tgz", + "integrity": "sha1-VsNiUfx8q8cJatwY8Fr+gUMhoow=" + }, + "acorn-import-assertions": { + "version": "1.7.6", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/acorn-import-assertions/-/acorn-import-assertions-1.7.6.tgz", + "integrity": "sha512-FlVvVFA1TX6l3lp8VjDnYYq7R1nyW6x3svAt4nDgrWQ9SBaSh9CnbwgSUTasgfNfOG5HlM1ehugCvM+hjo56LA==" + }, + "acorn-jsx": { + "version": "5.3.1", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/acorn-jsx/-/acorn-jsx-5.3.1.tgz", + "integrity": "sha512-K0Ptm/47OKfQRpNQ2J/oIN/3QYiK6FwW+eJbILhsdxh2WTLdl+30o8aGdTbm5JbffpFFAg/g+zi1E+jvJha5ng==", + "dev": true + }, + "ajv": { + "version": "6.12.6", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/ajv/6.12.6/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/ajv-keywords/3.5.2/ajv-keywords-3.5.2.tgz", + "integrity": "sha1-MfKdpatuANHC0yms97WSlhTVAU0=" + }, + "ansi-colors": { + "version": "4.1.1", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/ansi-colors/-/ansi-colors-4.1.1.tgz", + "integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==", + "dev": true + }, + "ansi-styles": { + "version": "4.3.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/ansi-styles/4.3.0/ansi-styles-4.3.0.tgz", + "integrity": "sha1-7dgDYornHATIWuegkG7a00tkiTc=", + "requires": { + "color-convert": "^2.0.1" + } + }, + "anymatch": { + "version": "2.0.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/anymatch/2.0.0/anymatch-2.0.0.tgz", + "integrity": "sha1-vLJLTzeTTZqnrBe0ra+J58du8us=", + "dev": true, + "optional": true, + "requires": { + "micromatch": "^3.1.4", + "normalize-path": "^2.1.1" + }, + "dependencies": { + "braces": { + "version": "2.3.2", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/braces/2.3.2/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/extend-shallow/2.0.1/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/fill-range/4.0.0/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/extend-shallow/2.0.1/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/is-number/3.0.0/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/kind-of/3.2.2/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/micromatch/3.1.10/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" + } + }, + "normalize-path": { + "version": "2.1.1", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/normalize-path/2.1.1/normalize-path-2.1.1.tgz", + "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=", + "dev": true, + "optional": true, + "requires": { + "remove-trailing-separator": "^1.0.1" + } + }, + "to-regex-range": { + "version": "2.1.1", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/to-regex-range/2.1.1/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" + } + } + } + }, + "arg": { + "version": "4.1.3", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/arg/4.1.3/arg-4.1.3.tgz", + "integrity": "sha1-Jp/HrVuOQstjyJbVZmAXJhwUQIk=", + "dev": true + }, + "argparse": { + "version": "1.0.10", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/argparse/1.0.10/argparse-1.0.10.tgz", + "integrity": "sha1-vNZ5HqWuCXJeF+WtmIE0zUCz2RE=", + "dev": true, + "requires": { + "sprintf-js": "~1.0.2" + } + }, + "arr-diff": { + "version": "4.0.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/arr-diff/4.0.0/arr-diff-4.0.0.tgz", + "integrity": "sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA=", + "dev": true, + "optional": true + }, + "arr-flatten": { + "version": "1.1.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/arr-flatten/1.1.0/arr-flatten-1.1.0.tgz", + "integrity": "sha1-NgSLv/TntH4TZkQxbJlmnqWukfE=", + "dev": true, + "optional": true + }, + "arr-union": { + "version": "3.1.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/arr-union/3.1.0/arr-union-3.1.0.tgz", + "integrity": "sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ=", + "dev": true, + "optional": true + }, + "array-union": { + "version": "1.0.2", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/array-union/1.0.2/array-union-1.0.2.tgz", + "integrity": "sha1-mjRBDk9OPaI96jdb5b5w8kd47Dk=", + "requires": { + "array-uniq": "^1.0.1" + } + }, + "array-uniq": { + "version": "1.0.3", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/array-uniq/1.0.3/array-uniq-1.0.3.tgz", + "integrity": "sha1-r2rId6Jcx/dOBYiUdThY39sk/bY=" + }, + "array-unique": { + "version": "0.3.2", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/array-unique/0.3.2/array-unique-0.3.2.tgz", + "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=", + "dev": true, + "optional": true + }, + "assertion-error": { + "version": "1.1.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/assertion-error/1.1.0/assertion-error-1.1.0.tgz", + "integrity": "sha1-5gtrDo8wG9l+U3UhW9pAbIURjAs=", + "dev": true + }, + "assign-symbols": { + "version": "1.0.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/assign-symbols/1.0.0/assign-symbols-1.0.0.tgz", + "integrity": "sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c=", + "dev": true, + "optional": true + }, + "astral-regex": { + "version": "2.0.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/astral-regex/-/astral-regex-2.0.0.tgz", + "integrity": "sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==", + "dev": true + }, + "async-each": { + "version": "1.0.3", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/async-each/1.0.3/async-each-1.0.3.tgz", + "integrity": "sha1-tyfb+H12UWAvBvTUrDh/R9kbDL8=", + "dev": true, + "optional": true + }, + "atob": { + "version": "2.1.2", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/atob/2.1.2/atob-2.1.2.tgz", + "integrity": "sha1-bZUX654DDSQ2ZmZR6GvZ9vE1M8k=", + "dev": true, + "optional": true + }, + "babel-plugin-dynamic-import-node": { + "version": "2.3.3", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/babel-plugin-dynamic-import-node/2.3.3/babel-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.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/babel-plugin-polyfill-corejs2/-/babel-plugin-polyfill-corejs2-0.2.0.tgz", + "integrity": "sha512-9bNwiR0dS881c5SHnzCmmGlMkJLl0OUZvxrxHo9w/iNoRuqaPjqlvBf4HrovXtQs/au5yKkpcdgfT1cC5PAZwg==", + "dev": true, + "requires": { + "@babel/compat-data": "^7.13.11", + "@babel/helper-define-polyfill-provider": "^0.2.0", + "semver": "^6.1.1" + }, + "dependencies": { + "semver": { + "version": "6.3.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/semver/6.3.0/semver-6.3.0.tgz", + "integrity": "sha1-7gpkyK9ejO6mdoexM3YeG+y9HT0=", + "dev": true + } + } + }, + "babel-plugin-polyfill-corejs3": { + "version": "0.2.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/babel-plugin-polyfill-corejs3/-/babel-plugin-polyfill-corejs3-0.2.0.tgz", + "integrity": "sha512-zZyi7p3BCUyzNxLx8KV61zTINkkV65zVkDAFNZmrTCRVhjo1jAS+YLvDJ9Jgd/w2tsAviCwFHReYfxO3Iql8Yg==", + "dev": true, + "requires": { + "@babel/helper-define-polyfill-provider": "^0.2.0", + "core-js-compat": "^3.9.1" + } + }, + "babel-plugin-polyfill-regenerator": { + "version": "0.2.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/babel-plugin-polyfill-regenerator/-/babel-plugin-polyfill-regenerator-0.2.0.tgz", + "integrity": "sha512-J7vKbCuD2Xi/eEHxquHN14bXAW9CXtecwuLrOIDJtcZzTaPzV1VdEfoUf9AzcRBMolKUQKM9/GVojeh0hFiqMg==", + "dev": true, + "requires": { + "@babel/helper-define-polyfill-provider": "^0.2.0" + } + }, + "balanced-match": { + "version": "1.0.2", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" + }, + "base": { + "version": "0.11.2", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/base/0.11.2/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/define-property/1.0.0/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/is-accessor-descriptor/1.0.0/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/is-data-descriptor/1.0.0/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/is-descriptor/1.0.2/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/big.js/5.2.2/big.js-5.2.2.tgz", + "integrity": "sha1-ZfCvOC9Xi83HQr2cKB6cstd2gyg=" + }, + "binary-extensions": { + "version": "1.13.1", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/binary-extensions/1.13.1/binary-extensions-1.13.1.tgz", + "integrity": "sha1-WYr+VHVbKGilMw0q/51Ou1Mgm2U=", + "dev": true, + "optional": true + }, + "brace-expansion": { + "version": "1.1.11", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/brace-expansion/1.1.11/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/braces/3.0.2/braces-3.0.2.tgz", + "integrity": "sha1-NFThpGLujVmeI23zNs2epPiv4Qc=", + "requires": { + "fill-range": "^7.0.1" + } + }, + "browser-stdout": { + "version": "1.3.1", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/browser-stdout/1.3.1/browser-stdout-1.3.1.tgz", + "integrity": "sha1-uqVZ7hTO1zRSIputcyZGfGH6vWA=", + "dev": true + }, + "browserslist": { + "version": "4.16.4", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/browserslist/-/browserslist-4.16.4.tgz", + "integrity": "sha512-d7rCxYV8I9kj41RH8UKYnvDYCRENUlHRgyXy/Rhr/1BaeLGfiCptEdFE8MIrvGfWbBFNjVYx76SQWvNX1j+/cQ==", + "requires": { + "caniuse-lite": "^1.0.30001208", + "colorette": "^1.2.2", + "electron-to-chromium": "^1.3.712", + "escalade": "^3.1.1", + "node-releases": "^1.1.71" + } + }, + "buffer-from": { + "version": "1.1.1", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/buffer-from/1.1.1/buffer-from-1.1.1.tgz", + "integrity": "sha1-MnE7wCj3XAL9txDXx7zsHyxgcO8=" + }, + "cache-base": { + "version": "1.0.1", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/cache-base/1.0.1/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/call-bind/1.0.2/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/callsites/3.1.0/callsites-3.1.0.tgz", + "integrity": "sha1-s2MKvYlDQy9Us/BRkjjjPNffL3M=", + "dev": true + }, + "caniuse-lite": { + "version": "1.0.30001208", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/caniuse-lite/-/caniuse-lite-1.0.30001208.tgz", + "integrity": "sha512-OE5UE4+nBOro8Dyvv0lfx+SRtfVIOM9uhKqFmJeUbGriqhhStgp1A0OyBpgy3OUF8AhYCT+PVwPC1gMl2ZcQMA==" + }, + "chai": { + "version": "4.3.4", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/chai/-/chai-4.3.4.tgz", + "integrity": "sha512-yS5H68VYOCtN1cjfwumDSuzn/9c+yza4f3reKXlE5rUg7SFcCEy90gJvydNgOYtblyf4Zi6jIWRnXOgErta0KA==", + "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.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/chalk/4.1.0/chalk-4.1.0.tgz", + "integrity": "sha1-ThSHCmGNni7dl92DRf2dncMVZGo=", + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "check-error": { + "version": "1.0.2", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/check-error/1.0.2/check-error-1.0.2.tgz", + "integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=", + "dev": true + }, + "chokidar": { + "version": "3.5.1", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/chokidar/3.5.1/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" + }, + "dependencies": { + "anymatch": { + "version": "3.1.2", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/anymatch/-/anymatch-3.1.2.tgz", + "integrity": "sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg==", + "dev": true, + "requires": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + } + }, + "binary-extensions": { + "version": "2.2.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/binary-extensions/2.2.0/binary-extensions-2.2.0.tgz", + "integrity": "sha1-dfUC7q+f/eQvyYgpZFvk6na9ni0=", + "dev": true + }, + "is-binary-path": { + "version": "2.1.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/is-binary-path/2.1.0/is-binary-path-2.1.0.tgz", + "integrity": "sha1-6h9/O4DwZCNug0cPhsCcJU+0Wwk=", + "dev": true, + "requires": { + "binary-extensions": "^2.0.0" + } + }, + "readdirp": { + "version": "3.5.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/readdirp/3.5.0/readdirp-3.5.0.tgz", + "integrity": "sha1-m6dMAZsV02UnjS6Ru4xI17TULJ4=", + "dev": true, + "requires": { + "picomatch": "^2.2.1" + } + } + } + }, + "chrome-trace-event": { + "version": "1.0.3", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/chrome-trace-event/-/chrome-trace-event-1.0.3.tgz", + "integrity": "sha1-EBXs7UdB4V0GZkqVfbv1DQQeJqw=" + }, + "class-utils": { + "version": "0.3.6", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/class-utils/0.3.6/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/define-property/0.2.5/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/clean-webpack-plugin/3.0.0/clean-webpack-plugin-3.0.0.tgz", + "integrity": "sha1-qZ2Ow0wcYopFQVZ6p7RXRGRgxis=", + "requires": { + "@types/webpack": "^4.4.31", + "del": "^4.1.1" + } + }, + "clone-deep": { + "version": "4.0.1", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/clone-deep/4.0.1/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/collection-visit/1.0.0/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/color-convert/2.0.1/color-convert-2.0.1.tgz", + "integrity": "sha1-ctOmjVmMm9s68q0ehPIdiWq9TeM=", + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/color-name/1.1.4/color-name-1.1.4.tgz", + "integrity": "sha1-wqCah6y95pVD3m9j+jmVyCbFNqI=" + }, + "colorette": { + "version": "1.2.2", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/colorette/-/colorette-1.2.2.tgz", + "integrity": "sha512-MKGMzyfeuutC/ZJ1cba9NqcNpfeqMUcYmyF1ZFY6/Cn7CNSAKx6a+s48sqLqyAiZuaP2TcqMhoo+dlwFnVxT9w==" + }, + "commander": { + "version": "2.20.3", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==" + }, + "component-emitter": { + "version": "1.3.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/component-emitter/1.3.0/component-emitter-1.3.0.tgz", + "integrity": "sha1-FuQHD7qK4ptnnyIVhT7hgasuq8A=", + "dev": true, + "optional": true + }, + "concat-map": { + "version": "0.0.1", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/concat-map/0.0.1/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" + }, + "convert-source-map": { + "version": "1.7.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/convert-source-map/1.7.0/convert-source-map-1.7.0.tgz", + "integrity": "sha1-F6LLiC1/d9NJBYXizmxSRCSjpEI=", + "dev": true, + "requires": { + "safe-buffer": "~5.1.1" + }, + "dependencies": { + "safe-buffer": { + "version": "5.1.2", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/safe-buffer/5.1.2/safe-buffer-5.1.2.tgz", + "integrity": "sha1-mR7GnSluAxN0fVm9/St0XDX4go0=", + "dev": true + } + } + }, + "copy-descriptor": { + "version": "0.1.1", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/copy-descriptor/0.1.1/copy-descriptor-0.1.1.tgz", + "integrity": "sha1-Z29us8OZl8LuGsOpJP1hJHSPV40=", + "dev": true, + "optional": true + }, + "copy-webpack-plugin": { + "version": "8.1.1", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/copy-webpack-plugin/-/copy-webpack-plugin-8.1.1.tgz", + "integrity": "sha512-rYM2uzRxrLRpcyPqGceRBDpxxUV8vcDqIKxAUKfcnFpcrPxT5+XvhTxv7XLjo5AvEJFPdAE3zCogG2JVahqgSQ==", + "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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/array-union/2.1.0/array-union-2.1.0.tgz", + "integrity": "sha1-t5hCCtvrHego2ErNii4j0+/oXo0=" + }, + "globby": { + "version": "11.0.3", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/globby/-/globby-11.0.3.tgz", + "integrity": "sha512-ffdmosjA807y7+lA1NM0jELARVmYul/715xiILEjo3hBLPTcirgQNnXECn5g3mtR8TOLCVbkfua1Hpen25/Xcg==", + "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.10.1", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/core-js-compat/-/core-js-compat-3.10.1.tgz", + "integrity": "sha512-ZHQTdTPkqvw2CeHiZC970NNJcnwzT6YIueDMASKt+p3WbZsLXOcoD392SkcWhkC0wBBHhlfhqGKKsNCQUozYtg==", + "dev": true, + "requires": { + "browserslist": "^4.16.3", + "semver": "7.0.0" + }, + "dependencies": { + "semver": { + "version": "7.0.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/semver/7.0.0/semver-7.0.0.tgz", + "integrity": "sha1-XzyjV2HkfgWyBsba/yz4FPAxa44=", + "dev": true + } + } + }, + "core-util-is": { + "version": "1.0.2", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/core-util-is/1.0.2/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" + }, + "create-require": { + "version": "1.1.1", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/create-require/1.1.1/create-require-1.1.1.tgz", + "integrity": "sha1-wdfo8eX2z8n/ZfnNNS03NIdWwzM=", + "dev": true + }, + "cross-spawn": { + "version": "7.0.3", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/cross-spawn/7.0.3/cross-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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/date-format/3.0.0/date-format-3.0.0.tgz", + "integrity": "sha1-64eANlx9KxURB4+0keZHl4DzrZU=" + }, + "debug": { + "version": "2.6.9", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/debug/2.6.9/debug-2.6.9.tgz", + "integrity": "sha1-XRKFFd8TT/Mn6QpMk/Tgd6U2NB8=", + "dev": true, + "optional": true, + "requires": { + "ms": "2.0.0" + } + }, + "deccjsunit": { + "version": "1.0.3", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/deccjsunit/-/deccjsunit-1.0.3.tgz", + "integrity": "sha512-GER7j7yKoZHFzr9CzWEdTOhR5LuxXV7PkUqL4lcU9+UmutIiDvvBW3rce4nTcbrvCd6DDqOrgqJ/0+GqA2W+Xw==" + }, + "decode-uri-component": { + "version": "0.2.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/decode-uri-component/0.2.0/decode-uri-component-0.2.0.tgz", + "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=", + "dev": true, + "optional": true + }, + "deep-eql": { + "version": "3.0.1", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/deep-eql/3.0.1/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/deep-is/0.1.3/deep-is-0.1.3.tgz", + "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=", + "dev": true + }, + "define-properties": { + "version": "1.1.3", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/define-properties/1.1.3/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/define-property/2.0.2/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/is-accessor-descriptor/1.0.0/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/is-data-descriptor/1.0.0/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/is-descriptor/1.0.2/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/del/4.1.1/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/diff/-/diff-5.0.0.tgz", + "integrity": "sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w==", + "dev": true + }, + "dir-glob": { + "version": "3.0.1", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/dir-glob/3.0.1/dir-glob-3.0.1.tgz", + "integrity": "sha1-Vtv3PZkqSpO6FYT0U0Bj/S5BcX8=", + "requires": { + "path-type": "^4.0.0" + } + }, + "doctrine": { + "version": "3.0.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/doctrine/3.0.0/doctrine-3.0.0.tgz", + "integrity": "sha1-rd6+rXKmV023g2OdyHoSF3OXOWE=", + "dev": true, + "requires": { + "esutils": "^2.0.2" + } + }, + "electron-to-chromium": { + "version": "1.3.717", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/electron-to-chromium/-/electron-to-chromium-1.3.717.tgz", + "integrity": "sha512-OfzVPIqD1MkJ7fX+yTl2nKyOE4FReeVfMCzzxQS+Kp43hZYwHwThlGP+EGIZRXJsxCM7dqo8Y65NOX/HP12iXQ==" + }, + "emojis-list": { + "version": "3.0.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/emojis-list/3.0.0/emojis-list-3.0.0.tgz", + "integrity": "sha1-VXBmIEatKeLpFucariYKvf9Pang=" + }, + "enhanced-resolve": { + "version": "4.5.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/enhanced-resolve/4.5.0/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/enquirer/-/enquirer-2.3.6.tgz", + "integrity": "sha512-yjNnPr315/FjS4zIsUxYguYUPP2e1NK4d7E7ZOLiyYCcbFBiTMyID+2wvm2w6+pZ/odMA7cRkjhsPbltwBOrLg==", + "dev": true, + "requires": { + "ansi-colors": "^4.1.1" + } + }, + "envinfo": { + "version": "7.8.1", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/envinfo/-/envinfo-7.8.1.tgz", + "integrity": "sha512-/o+BXHmB7ocbHEAs6F2EnG0ogybVVUdkRunTT2glZU9XAaGmhqskrvKwqXuDfNjEO0LZKWdejEEpnq8aM0tOaw==" + }, + "errno": { + "version": "0.1.8", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/errno/0.1.8/errno-0.1.8.tgz", + "integrity": "sha1-i7Ppx9Rjvkl2/4iPdrSAnrwugR8=", + "requires": { + "prr": "~1.0.1" + } + }, + "es-module-lexer": { + "version": "0.7.1", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/es-module-lexer/-/es-module-lexer-0.7.1.tgz", + "integrity": "sha1-wsjg9G8t8GJ0za8N0/OzPgoLJn0=" + }, + "escalade": { + "version": "3.1.1", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/escalade/3.1.1/escalade-3.1.1.tgz", + "integrity": "sha1-2M/ccACWXFoBdLSoLqpcBVJ0LkA=" + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/escape-string-regexp/1.0.5/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "dev": true + }, + "eslint": { + "version": "7.24.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/eslint/-/eslint-7.24.0.tgz", + "integrity": "sha512-k9gaHeHiFmGCDQ2rEfvULlSLruz6tgfA8DEn+rY9/oYPFFTlz55mM/Q/Rij1b2Y42jwZiK3lXvNTw6w6TXzcKQ==", + "dev": true, + "requires": { + "@babel/code-frame": "7.12.11", + "@eslint/eslintrc": "^0.4.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", + "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", + "file-entry-cache": "^6.0.1", + "functional-red-black-tree": "^1.0.1", + "glob-parent": "^5.0.0", + "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": "^4.17.21", + "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.4", + "text-table": "^0.2.0", + "v8-compile-cache": "^2.0.3" + }, + "dependencies": { + "@babel/code-frame": { + "version": "7.12.11", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@babel/code-frame/-/code-frame-7.12.11.tgz", + "integrity": "sha512-Zt1yodBx1UcyiePMSkWnU4hPqhwq7hGi2nFL1LeA3EUl+q2LQx16MISgJ0+z7dnmgvP9QtIleuETGOiOH1RcIw==", + "dev": true, + "requires": { + "@babel/highlight": "^7.10.4" + } + }, + "ansi-regex": { + "version": "5.0.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/ansi-regex/5.0.0/ansi-regex-5.0.0.tgz", + "integrity": "sha1-OIU59VF5vzkznIGvMKZU1p+Hy3U=", + "dev": true + }, + "cross-spawn": { + "version": "7.0.3", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/cross-spawn/7.0.3/cross-spawn-7.0.3.tgz", + "integrity": "sha1-9zqFudXUHQRVUcF34ogtSshXKKY=", + "dev": true, + "requires": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + } + }, + "debug": { + "version": "4.3.2", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/debug/4.3.2/debug-4.3.2.tgz", + "integrity": "sha1-8KScGKyHeeMdSgxgKd+3aHPHQos=", + "dev": true, + "requires": { + "ms": "2.1.2" + } + }, + "globals": { + "version": "13.8.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/globals/-/globals-13.8.0.tgz", + "integrity": "sha512-rHtdA6+PDBIjeEvA91rpqzEvk/k3/i7EeNQiryiWuJH0Hw9cpyJMAt2jtbAwUaRdhD+573X4vWw6IcjKPasi9Q==", + "dev": true, + "requires": { + "type-fest": "^0.20.2" + } + }, + "ignore": { + "version": "4.0.6", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/ignore/4.0.6/ignore-4.0.6.tgz", + "integrity": "sha1-dQ49tYYgh7RzfrrIIH/9HvJ7Jfw=", + "dev": true + }, + "ms": { + "version": "2.1.2", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/ms/2.1.2/ms-2.1.2.tgz", + "integrity": "sha1-0J0fNXtEP0kzgqjrPM0YOHKuYAk=", + "dev": true + }, + "path-key": { + "version": "3.1.1", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/path-key/3.1.1/path-key-3.1.1.tgz", + "integrity": "sha1-WB9q3mWMu6ZaDTOA3ndTKVBU83U=", + "dev": true + }, + "shebang-command": { + "version": "2.0.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/shebang-command/2.0.0/shebang-command-2.0.0.tgz", + "integrity": "sha1-zNCvT4g1+9wmW4JGGq8MNmY/NOo=", + "dev": true, + "requires": { + "shebang-regex": "^3.0.0" + } + }, + "shebang-regex": { + "version": "3.0.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/shebang-regex/3.0.0/shebang-regex-3.0.0.tgz", + "integrity": "sha1-rhbxZE2HPsrYQ7AwexQzYtTEIXI=", + "dev": true + }, + "strip-ansi": { + "version": "6.0.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/strip-ansi/6.0.0/strip-ansi-6.0.0.tgz", + "integrity": "sha1-CxVx3XZpzNTz4G4U7x7tJiJa5TI=", + "dev": true, + "requires": { + "ansi-regex": "^5.0.0" + } + }, + "type-fest": { + "version": "0.20.2", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", + "dev": true + }, + "which": { + "version": "2.0.2", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/which/2.0.2/which-2.0.2.tgz", + "integrity": "sha1-fGqN0KY2oDJ+ELWckobu6T8/UbE=", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + } + } + }, + "eslint-scope": { + "version": "5.1.1", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/eslint-scope/-/eslint-scope-5.1.1.tgz", + "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", + "requires": { + "esrecurse": "^4.3.0", + "estraverse": "^4.1.1" + } + }, + "eslint-utils": { + "version": "2.1.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/eslint-utils/-/eslint-utils-2.1.0.tgz", + "integrity": "sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg==", + "dev": true, + "requires": { + "eslint-visitor-keys": "^1.1.0" + }, + "dependencies": { + "eslint-visitor-keys": { + "version": "1.3.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/eslint-visitor-keys/1.3.0/eslint-visitor-keys-1.3.0.tgz", + "integrity": "sha1-MOvR73wv3/AcOk8VEESvJfqwUj4=", + "dev": true + } + } + }, + "eslint-visitor-keys": { + "version": "2.0.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/eslint-visitor-keys/-/eslint-visitor-keys-2.0.0.tgz", + "integrity": "sha512-QudtT6av5WXels9WjIM7qz1XD1cWGvX4gGXvp/zBn9nXG02D0utdU3Em2m/QjTnrsk6bBjmCygl3rmj118msQQ==", + "dev": true + }, + "espree": { + "version": "7.3.1", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/espree/-/espree-7.3.1.tgz", + "integrity": "sha512-v3JCNCE64umkFpmkFGqzVKsOT0tN1Zr+ueqLZfpV1Ob8e+CEgPWa+OxCoGH3tnhimMKIaBm4m/vaRpJ/krRz2g==", + "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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/acorn/7.4.1/acorn-7.4.1.tgz", + "integrity": "sha1-/q7SVZc9LndVW4PbwIhRpsY1IPo=", + "dev": true + }, + "eslint-visitor-keys": { + "version": "1.3.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/eslint-visitor-keys/1.3.0/eslint-visitor-keys-1.3.0.tgz", + "integrity": "sha1-MOvR73wv3/AcOk8VEESvJfqwUj4=", + "dev": true + } + } + }, + "esprima": { + "version": "4.0.1", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/esprima/4.0.1/esprima-4.0.1.tgz", + "integrity": "sha1-E7BM2z5sXRnfkatph6hpVhmwqnE=", + "dev": true + }, + "esquery": { + "version": "1.4.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/esquery/-/esquery-1.4.0.tgz", + "integrity": "sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w==", + "dev": true, + "requires": { + "estraverse": "^5.1.0" + }, + "dependencies": { + "estraverse": { + "version": "5.2.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/estraverse/5.2.0/estraverse-5.2.0.tgz", + "integrity": "sha1-MH30JUfmzHMk088DwVXVzbjFOIA=", + "dev": true + } + } + }, + "esrecurse": { + "version": "4.3.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/esrecurse/4.3.0/esrecurse-4.3.0.tgz", + "integrity": "sha1-eteWTWeauyi+5yzsY3WLHF0smSE=", + "requires": { + "estraverse": "^5.2.0" + }, + "dependencies": { + "estraverse": { + "version": "5.2.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/estraverse/5.2.0/estraverse-5.2.0.tgz", + "integrity": "sha1-MH30JUfmzHMk088DwVXVzbjFOIA=" + } + } + }, + "estraverse": { + "version": "4.3.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/estraverse/4.3.0/estraverse-4.3.0.tgz", + "integrity": "sha1-OYrT88WiSUi+dyXoPRGn3ijNvR0=" + }, + "esutils": { + "version": "2.0.3", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/esutils/2.0.3/esutils-2.0.3.tgz", + "integrity": "sha1-dNLrTeC42hKTcRkQ1Qd1ubcQ72Q=", + "dev": true + }, + "events": { + "version": "3.3.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/events/-/events-3.3.0.tgz", + "integrity": "sha1-Mala0Kkk4tLEGagTrrLE6HjqdAA=" + }, + "execa": { + "version": "5.1.1", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/execa/-/execa-5.1.1.tgz", + "integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==", + "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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/expand-brackets/2.1.4/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": { + "define-property": { + "version": "0.2.5", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/define-property/0.2.5/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/extend-shallow/2.0.1/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "optional": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "extend-shallow": { + "version": "3.0.2", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/extend-shallow/3.0.2/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/is-extendable/1.0.1/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/extglob/2.0.4/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/define-property/1.0.0/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/extend-shallow/2.0.1/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/is-accessor-descriptor/1.0.0/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/is-data-descriptor/1.0.0/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/is-descriptor/1.0.2/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/fast-deep-equal/3.1.3/fast-deep-equal-3.1.3.tgz", + "integrity": "sha1-On1WtVnWy8PrUSMlJE5hmmXGxSU=" + }, + "fast-glob": { + "version": "3.2.5", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/fast-glob/3.2.5/fast-glob-3.2.5.tgz", + "integrity": "sha1-eTmvKmVt55pPGQGQPuityqfLlmE=", + "requires": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.0", + "merge2": "^1.3.0", + "micromatch": "^4.0.2", + "picomatch": "^2.2.1" + } + }, + "fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/fast-json-stable-stringify/2.1.0/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha1-h0v2nG9ATCtdmcSBNBOZ/VWJJjM=" + }, + "fast-levenshtein": { + "version": "2.0.6", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/fast-levenshtein/2.0.6/fast-levenshtein-2.0.6.tgz", + "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=", + "dev": true + }, + "fastest-levenshtein": { + "version": "1.0.12", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/fastest-levenshtein/-/fastest-levenshtein-1.0.12.tgz", + "integrity": "sha512-On2N+BpYJ15xIC974QNVuYGMOlEVt4s0EOI3wwMqOmK1fdDY+FN/zltPV8vosq4ad4c/gJ1KHScUn/6AWIgiow==" + }, + "fastq": { + "version": "1.11.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/fastq/-/fastq-1.11.0.tgz", + "integrity": "sha1-u5+5VaBxMKkY62PB9RYcwypdCFg=", + "requires": { + "reusify": "^1.0.4" + } + }, + "file-entry-cache": { + "version": "6.0.1", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/file-entry-cache/-/file-entry-cache-6.0.1.tgz", + "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==", + "dev": true, + "requires": { + "flat-cache": "^3.0.4" + } + }, + "fill-range": { + "version": "7.0.1", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/fill-range/7.0.1/fill-range-7.0.1.tgz", + "integrity": "sha1-GRmmp8df44ssfHflGYU12prN2kA=", + "requires": { + "to-regex-range": "^5.0.1" + } + }, + "find-up": { + "version": "4.1.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/find-up/4.1.0/find-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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/flat/5.0.2/flat-5.0.2.tgz", + "integrity": "sha1-jKb+MyBp/6nTJMMnGYxZglnOskE=", + "dev": true + }, + "flat-cache": { + "version": "3.0.4", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/flat-cache/-/flat-cache-3.0.4.tgz", + "integrity": "sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg==", + "dev": true, + "requires": { + "flatted": "^3.1.0", + "rimraf": "^3.0.2" + }, + "dependencies": { + "rimraf": { + "version": "3.0.2", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/rimraf/3.0.2/rimraf-3.0.2.tgz", + "integrity": "sha1-8aVAK6YiCtUswSgrrBrjqkn9Bho=", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + } + } + }, + "flatted": { + "version": "3.1.1", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/flatted/-/flatted-3.1.1.tgz", + "integrity": "sha512-zAoAQiudy+r5SvnSw3KJy5os/oRJYHzrzja/tBDqrZtNhUw8bt6y8OBzMWcjWr+8liV8Eb6yOhw8WZ7VFZ5ZzA==", + "dev": true + }, + "for-in": { + "version": "1.0.2", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/for-in/1.0.2/for-in-1.0.2.tgz", + "integrity": "sha1-gQaNKVqBQuwKxybG4iAMMPttXoA=", + "dev": true, + "optional": true + }, + "fragment-cache": { + "version": "0.2.1", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/fragment-cache/0.2.1/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/fs-extra/8.1.0/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/fs-readdir-recursive/1.1.0/fs-readdir-recursive-1.1.0.tgz", + "integrity": "sha1-4y/AMKLM7kSmtTcTCNpUvgs5fSc=", + "dev": true + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/fs.realpath/1.0.0/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" + }, + "fsevents": { + "version": "2.3.2", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "dev": true, + "optional": true + }, + "function-bind": { + "version": "1.1.1", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/function-bind/1.1.1/function-bind-1.1.1.tgz", + "integrity": "sha1-pWiZ0+o8m6uHS7l3O3xe3pL0iV0=" + }, + "functional-red-black-tree": { + "version": "1.0.1", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/functional-red-black-tree/1.0.1/functional-red-black-tree-1.0.1.tgz", + "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=", + "dev": true + }, + "gensync": { + "version": "1.0.0-beta.2", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/gensync/1.0.0-beta.2/gensync-1.0.0-beta.2.tgz", + "integrity": "sha1-MqbudsPX9S1GsrGuXZP+qFgKJeA=", + "dev": true + }, + "get-caller-file": { + "version": "2.0.5", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/get-caller-file/2.0.5/get-caller-file-2.0.5.tgz", + "integrity": "sha1-T5RBKoLbMvNuOwuXQfipf+sDH34=", + "dev": true + }, + "get-func-name": { + "version": "2.0.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/get-func-name/2.0.0/get-func-name-2.0.0.tgz", + "integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=", + "dev": true + }, + "get-intrinsic": { + "version": "1.1.1", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/get-intrinsic/-/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/get-stream/-/get-stream-6.0.1.tgz", + "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==" + }, + "get-value": { + "version": "2.0.6", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/get-value/2.0.6/get-value-2.0.6.tgz", + "integrity": "sha1-3BXKHGcjh8p2vTesCjlbogQqLCg=", + "dev": true, + "optional": true + }, + "glob": { + "version": "7.1.6", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/glob/7.1.6/glob-7.1.6.tgz", + "integrity": "sha1-FB8zuBp8JJLhJVlDB0gMRmeSeKY=", + "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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "requires": { + "is-glob": "^4.0.1" + } + }, + "glob-to-regexp": { + "version": "0.4.1", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz", + "integrity": "sha1-x1KXCHyFG5pXi9IX3VmpL1n+VG4=" + }, + "globals": { + "version": "11.12.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/globals/11.12.0/globals-11.12.0.tgz", + "integrity": "sha1-q4eVM4hooLq9hSV1gBjCp+uVxC4=", + "dev": true + }, + "globby": { + "version": "6.1.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/globby/6.1.0/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/pify/2.3.0/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=" + } + } + }, + "graceful-fs": { + "version": "4.2.6", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/graceful-fs/-/graceful-fs-4.2.6.tgz", + "integrity": "sha512-nTnJ528pbqxYanhpDYsi4Rd8MAeaBA67+RZ10CM1m3bTAVFEDcd5AuA4a6W5YkGZ1iNXHzZz8T6TBKLeBuNriQ==" + }, + "growl": { + "version": "1.10.5", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/growl/1.10.5/growl-1.10.5.tgz", + "integrity": "sha1-8nNdwig2dPpnR4sQGBBZNVw2nl4=", + "dev": true + }, + "has": { + "version": "1.0.3", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/has/1.0.3/has-1.0.3.tgz", + "integrity": "sha1-ci18v8H2qoJB8W3YFOAR4fQeh5Y=", + "requires": { + "function-bind": "^1.1.1" + } + }, + "has-flag": { + "version": "4.0.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/has-flag/4.0.0/has-flag-4.0.0.tgz", + "integrity": "sha1-lEdx/ZyByBJlxNaUGGDaBrtZR5s=" + }, + "has-symbols": { + "version": "1.0.2", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/has-symbols/-/has-symbols-1.0.2.tgz", + "integrity": "sha1-Fl0wcMADCXUqEjakeTMeOsVvFCM=", + "dev": true + }, + "has-value": { + "version": "1.0.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/has-value/1.0.0/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/has-values/1.0.0/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/is-number/3.0.0/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/kind-of/3.2.2/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/kind-of/4.0.0/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/he/1.2.0/he-1.2.0.tgz", + "integrity": "sha1-hK5l+n6vsWX922FWauFLrwVmTw8=", + "dev": true + }, + "human-signals": { + "version": "2.1.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/human-signals/-/human-signals-2.1.0.tgz", + "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==" + }, + "ignore": { + "version": "5.1.8", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/ignore/5.1.8/ignore-5.1.8.tgz", + "integrity": "sha1-8VCotQo0KJsz4i9YiavU2AFvDlc=" + }, + "import-fresh": { + "version": "3.3.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/import-fresh/-/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/resolve-from/4.0.0/resolve-from-4.0.0.tgz", + "integrity": "sha1-SrzYUq0y3Xuqv+m0DgCjbbXzkuY=", + "dev": true + } + } + }, + "import-local": { + "version": "3.0.2", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/import-local/-/import-local-3.0.2.tgz", + "integrity": "sha512-vjL3+w0oulAVZ0hBHnxa/Nm5TAurf9YLQJDhqRZyqb+VKGOB6LU8t9H1Nr5CIo16vh9XfJTOoHwU0B71S557gA==", + "requires": { + "pkg-dir": "^4.2.0", + "resolve-cwd": "^3.0.0" + } + }, + "imurmurhash": { + "version": "0.1.4", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/imurmurhash/0.1.4/imurmurhash-0.1.4.tgz", + "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", + "dev": true + }, + "inflight": { + "version": "1.0.6", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/inflight/1.0.6/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.4", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/inherits/2.0.4/inherits-2.0.4.tgz", + "integrity": "sha1-D6LGT5MpF8NDOg3tVTY6rjdBa3w=" + }, + "interpret": { + "version": "2.2.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/interpret/-/interpret-2.2.0.tgz", + "integrity": "sha512-Ju0Bz/cEia55xDwUWEa8+olFpCiQoypjnQySseKtmjNrnps3P+xfpUmGr90T7yjlVJmOtybRvPXhKMbHr+fWnw==" + }, + "is-accessor-descriptor": { + "version": "0.1.6", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/is-accessor-descriptor/0.1.6/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/kind-of/3.2.2/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/is-binary-path/1.0.1/is-binary-path-1.0.1.tgz", + "integrity": "sha1-dfFmQrSA8YenEcgUFh/TpKdlWJg=", + "dev": true, + "optional": true, + "requires": { + "binary-extensions": "^1.0.0" + } + }, + "is-boolean-object": { + "version": "1.1.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/is-boolean-object/-/is-boolean-object-1.1.0.tgz", + "integrity": "sha512-a7Uprx8UtD+HWdyYwnD1+ExtTgqQtD2k/1yJgtXP6wnMm8byhkoTZRl+95LLThpzNZJ5aEvi46cdH+ayMFRwmA==", + "dev": true, + "requires": { + "call-bind": "^1.0.0" + } + }, + "is-buffer": { + "version": "1.1.6", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/is-buffer/1.1.6/is-buffer-1.1.6.tgz", + "integrity": "sha1-76ouqdqg16suoTqXsritUf776L4=", + "dev": true, + "optional": true + }, + "is-core-module": { + "version": "2.2.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/is-core-module/2.2.0/is-core-module-2.2.0.tgz", + "integrity": "sha1-lwN+89UiJNhRY/VZeytj2a/tmBo=", + "requires": { + "has": "^1.0.3" + } + }, + "is-data-descriptor": { + "version": "0.1.4", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/is-data-descriptor/0.1.4/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/kind-of/3.2.2/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/is-descriptor/0.1.6/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/kind-of/5.1.0/kind-of-5.1.0.tgz", + "integrity": "sha1-cpyR4thXt6QZofmqZWhcTDP1hF0=", + "dev": true, + "optional": true + } + } + }, + "is-extendable": { + "version": "0.1.1", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/is-extendable/0.1.1/is-extendable-0.1.1.tgz", + "integrity": "sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik=", + "dev": true, + "optional": true + }, + "is-extglob": { + "version": "2.1.1", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/is-extglob/2.1.1/is-extglob-2.1.1.tgz", + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=" + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/is-fullwidth-code-point/2.0.0/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true + }, + "is-glob": { + "version": "4.0.1", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/is-glob/4.0.1/is-glob-4.0.1.tgz", + "integrity": "sha1-dWfb6fL14kZ7x3q4PEopSCQHpdw=", + "requires": { + "is-extglob": "^2.1.1" + } + }, + "is-number": { + "version": "7.0.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/is-number/7.0.0/is-number-7.0.0.tgz", + "integrity": "sha1-dTU0W4lnNNX4DE0GxQlVUnoU8Ss=" + }, + "is-number-object": { + "version": "1.0.4", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/is-number-object/1.0.4/is-number-object-1.0.4.tgz", + "integrity": "sha1-NqyV50HPGLKD/B3fXoPaeY4+wZc=", + "dev": true + }, + "is-path-cwd": { + "version": "2.2.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/is-path-cwd/2.2.0/is-path-cwd-2.2.0.tgz", + "integrity": "sha1-Z9Q7gmZKe1GR/ZEZEn6zAASKn9s=" + }, + "is-path-in-cwd": { + "version": "2.1.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/is-path-in-cwd/2.1.0/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/is-path-inside/2.1.0/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/is-plain-obj/-/is-plain-obj-2.1.0.tgz", + "integrity": "sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==", + "dev": true + }, + "is-plain-object": { + "version": "2.0.4", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/is-plain-object/2.0.4/is-plain-object-2.0.4.tgz", + "integrity": "sha1-LBY7P6+xtgbZ0Xko8FwqHDjgdnc=", + "requires": { + "isobject": "^3.0.1" + } + }, + "is-stream": { + "version": "2.0.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/is-stream/2.0.0/is-stream-2.0.0.tgz", + "integrity": "sha1-venDJoDW+uBBKdasnZIc54FfeOM=" + }, + "is-string": { + "version": "1.0.5", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/is-string/1.0.5/is-string-1.0.5.tgz", + "integrity": "sha1-QEk+0ZjvP/R3uMf5L2ROyCpc06Y=", + "dev": true + }, + "is-windows": { + "version": "1.0.2", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/is-windows/1.0.2/is-windows-1.0.2.tgz", + "integrity": "sha1-0YUOuXkezRjmGCzhKjDzlmNLsZ0=", + "dev": true, + "optional": true + }, + "isarray": { + "version": "1.0.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/isarray/1.0.0/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" + }, + "isexe": { + "version": "2.0.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/isexe/2.0.0/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=" + }, + "isobject": { + "version": "3.0.1", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/isobject/3.0.1/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=" + }, + "jest-worker": { + "version": "27.0.6", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/jest-worker/-/jest-worker-27.0.6.tgz", + "integrity": "sha1-pf2x4UrTTrIoz+Fi2fcpzb+iiu0=", + "requires": { + "@types/node": "*", + "merge-stream": "^2.0.0", + "supports-color": "^8.0.0" + }, + "dependencies": { + "supports-color": { + "version": "8.1.1", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha1-zW/BfihQDP9WwbhsCn/UpUpzAFw=", + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, + "js-tokens": { + "version": "4.0.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/js-tokens/4.0.0/js-tokens-4.0.0.tgz", + "integrity": "sha1-GSA/tZmR35jjoocFDUZHzerzJJk=", + "dev": true + }, + "js-yaml": { + "version": "3.14.1", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/js-yaml/3.14.1/js-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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/jsesc/2.5.2/jsesc-2.5.2.tgz", + "integrity": "sha1-gFZNLkg9rPbo7yCWUKZ98/DCg6Q=", + "dev": true + }, + "json-parse-better-errors": { + "version": "1.0.2", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/json-parse-better-errors/1.0.2/json-parse-better-errors-1.0.2.tgz", + "integrity": "sha1-u4Z8+zRQ5pEHwTHRxRS6s9yLyqk=" + }, + "json-schema-traverse": { + "version": "0.4.1", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/json-schema-traverse/0.4.1/json-schema-traverse-0.4.1.tgz", + "integrity": "sha1-afaofZUTq4u4/mO9sJecRI5oRmA=" + }, + "json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/json-stable-stringify-without-jsonify/1.0.1/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=", + "dev": true + }, + "json5": { + "version": "2.2.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/json5/2.2.0/json5-2.2.0.tgz", + "integrity": "sha1-Lf7+cgxrpSXZ69kJlQ8FFTFsiaM=", + "requires": { + "minimist": "^1.2.5" + } + }, + "jsonfile": { + "version": "4.0.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/jsonfile/4.0.0/jsonfile-4.0.0.tgz", + "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=", + "requires": { + "graceful-fs": "^4.1.6" + } + }, + "kind-of": { + "version": "6.0.3", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/kind-of/6.0.3/kind-of-6.0.3.tgz", + "integrity": "sha1-B8BQNKbDSfoG4k+jWqdttFgM5N0=" + }, + "levn": { + "version": "0.4.1", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "dev": true, + "requires": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + } + }, + "loader-runner": { + "version": "4.2.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/loader-runner/-/loader-runner-4.2.0.tgz", + "integrity": "sha1-1wIjgNZtFMX7HUlriYZOvP1Hg4Q=" + }, + "loader-utils": { + "version": "2.0.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/loader-utils/2.0.0/loader-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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/locate-path/5.0.0/locate-path-5.0.0.tgz", + "integrity": "sha1-Gvujlq/WdqbUJQTQpno6frn2KqA=", + "requires": { + "p-locate": "^4.1.0" + } + }, + "lodash": { + "version": "4.17.21", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/lodash/4.17.21/lodash-4.17.21.tgz", + "integrity": "sha1-Z5WRxWTDv/quhFTPCz3zcMPWkRw=", + "dev": true + }, + "lodash.clonedeep": { + "version": "4.5.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/lodash.clonedeep/4.5.0/lodash.clonedeep-4.5.0.tgz", + "integrity": "sha1-4j8/nE+Pvd6HJSnBBxhXoIblzO8=", + "dev": true + }, + "lodash.debounce": { + "version": "4.0.8", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/lodash.debounce/4.0.8/lodash.debounce-4.0.8.tgz", + "integrity": "sha1-gteb/zCmfEAF/9XiUVMArZyk168=", + "dev": true + }, + "lodash.flatten": { + "version": "4.4.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/lodash.flatten/4.4.0/lodash.flatten-4.4.0.tgz", + "integrity": "sha1-8xwiIlqWMtK7+OSt2+8kCqdlph8=", + "dev": true + }, + "lodash.truncate": { + "version": "4.4.2", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/lodash.truncate/-/lodash.truncate-4.4.2.tgz", + "integrity": "sha1-WjUNoLERO4N+z//VgSy+WNbq4ZM=", + "dev": true + }, + "log-symbols": { + "version": "4.0.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/log-symbols/-/log-symbols-4.0.0.tgz", + "integrity": "sha512-FN8JBzLx6CzeMrB0tg6pqlGU1wCrXW+ZXGH481kfsBqer0hToTIiHdjH4Mq8xJUbvATujKCvaREGWpGUionraA==", + "dev": true, + "requires": { + "chalk": "^4.0.0" + } + }, + "log4js": { + "version": "6.3.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/log4js/6.3.0/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" + }, + "dependencies": { + "debug": { + "version": "4.3.1", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/debug/4.3.1/debug-4.3.1.tgz", + "integrity": "sha1-8NIpxQXgxtjEmsVT0bE9wYP2su4=", + "requires": { + "ms": "2.1.2" + } + }, + "flatted": { + "version": "2.0.2", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/flatted/2.0.2/flatted-2.0.2.tgz", + "integrity": "sha1-RXWyHivO50NKqb5mL0t7X5wrUTg=" + }, + "ms": { + "version": "2.1.2", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/ms/2.1.2/ms-2.1.2.tgz", + "integrity": "sha1-0J0fNXtEP0kzgqjrPM0YOHKuYAk=" + } + } + }, + "lru-cache": { + "version": "6.0.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/lru-cache/6.0.0/lru-cache-6.0.0.tgz", + "integrity": "sha1-bW/mVw69lqr5D8rR2vo7JWbbOpQ=", + "requires": { + "yallist": "^4.0.0" + } + }, + "make-dir": { + "version": "2.1.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/make-dir/2.1.0/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/semver/5.7.1/semver-5.7.1.tgz", + "integrity": "sha1-qVT5Ma66UI0we78Gnv8MAclhFvc=", + "dev": true + } + } + }, + "make-error": { + "version": "1.3.6", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/make-error/1.3.6/make-error-1.3.6.tgz", + "integrity": "sha1-LrLjfqm2fEiR9oShOUeZr0hM96I=", + "dev": true + }, + "map-cache": { + "version": "0.2.2", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/map-cache/0.2.2/map-cache-0.2.2.tgz", + "integrity": "sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8=", + "dev": true, + "optional": true + }, + "map-visit": { + "version": "1.0.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/map-visit/1.0.0/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/memory-fs/0.5.0/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/merge-stream/2.0.0/merge-stream-2.0.0.tgz", + "integrity": "sha1-UoI2KaFN0AyXcPtq1H3GMQ8sH2A=" + }, + "merge2": { + "version": "1.4.1", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/merge2/1.4.1/merge2-1.4.1.tgz", + "integrity": "sha1-Q2iJL4hekHRVpv19xVwMnUBJkK4=" + }, + "micromatch": { + "version": "4.0.4", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/micromatch/-/micromatch-4.0.4.tgz", + "integrity": "sha512-pRmzw/XUcwXGpD9aI9q/0XOwLNygjETJ8y0ao0wdqprrzDa4YnxLcz7fQRZr8voh8V10kGhABbNcHVk5wHgWwg==", + "requires": { + "braces": "^3.0.1", + "picomatch": "^2.2.3" + } + }, + "mime-db": { + "version": "1.49.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/mime-db/-/mime-db-1.49.0.tgz", + "integrity": "sha1-89/eYMmenPO8lwHWh3ePU3ABy+0=" + }, + "mime-types": { + "version": "2.1.32", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/mime-types/-/mime-types-2.1.32.tgz", + "integrity": "sha1-HQDonn3n/gIAjbYQAdngKFJnD9U=", + "requires": { + "mime-db": "1.49.0" + } + }, + "mimic-fn": { + "version": "2.1.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/mimic-fn/2.1.0/mimic-fn-2.1.0.tgz", + "integrity": "sha1-ftLCzMyvhNP/y3pptXcR/CCDQBs=" + }, + "minimatch": { + "version": "3.0.4", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/minimatch/3.0.4/minimatch-3.0.4.tgz", + "integrity": "sha1-UWbihkV/AzBgZL5Ul+jbsMPTIIM=", + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "minimist": { + "version": "1.2.5", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/minimist/1.2.5/minimist-1.2.5.tgz", + "integrity": "sha1-Z9ZgFLZqaoqqDAg8X9WN9OTpdgI=" + }, + "mixin-deep": { + "version": "1.3.2", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/mixin-deep/1.3.2/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/is-extendable/1.0.1/is-extendable-1.0.1.tgz", + "integrity": "sha1-p0cPnkJnM9gb2B4RVSZOOjUHyrQ=", + "dev": true, + "optional": true, + "requires": { + "is-plain-object": "^2.0.4" + } + } + } + }, + "mocha": { + "version": "8.3.2", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/mocha/-/mocha-8.3.2.tgz", + "integrity": "sha512-UdmISwr/5w+uXLPKspgoV7/RXZwKRTiTjJ2/AC5ZiEztIoOYdfKb19+9jNmEInzx5pBsCyJQzarAxqIGBNYJhg==", + "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": { + "ansi-regex": { + "version": "5.0.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/ansi-regex/5.0.0/ansi-regex-5.0.0.tgz", + "integrity": "sha1-OIU59VF5vzkznIGvMKZU1p+Hy3U=", + "dev": true + }, + "argparse": { + "version": "2.0.1", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true + }, + "cliui": { + "version": "7.0.4", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/cliui/7.0.4/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" + } + }, + "debug": { + "version": "4.3.1", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/debug/4.3.1/debug-4.3.1.tgz", + "integrity": "sha1-8NIpxQXgxtjEmsVT0bE9wYP2su4=", + "dev": true, + "requires": { + "ms": "2.1.2" + }, + "dependencies": { + "ms": { + "version": "2.1.2", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/ms/2.1.2/ms-2.1.2.tgz", + "integrity": "sha1-0J0fNXtEP0kzgqjrPM0YOHKuYAk=", + "dev": true + } + } + }, + "emoji-regex": { + "version": "8.0.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/emoji-regex/8.0.0/emoji-regex-8.0.0.tgz", + "integrity": "sha1-6Bj9ac5cz8tARZT4QpY79TFkzDc=", + "dev": true + }, + "escape-string-regexp": { + "version": "4.0.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/escape-string-regexp/4.0.0/escape-string-regexp-4.0.0.tgz", + "integrity": "sha1-FLqDpdNz49MR5a/KKc9b+tllvzQ=", + "dev": true + }, + "find-up": { + "version": "5.0.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dev": true, + "requires": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + } + }, + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/is-fullwidth-code-point/3.0.0/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha1-8Rb4Bk/pCz94RKOJl8C3UFEmnx0=", + "dev": true + }, + "js-yaml": { + "version": "4.0.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/js-yaml/-/js-yaml-4.0.0.tgz", + "integrity": "sha512-pqon0s+4ScYUvX30wxQi3PogGFAlUyH0awepWvwkj4jD4v+ova3RiYw8bmA6x2rDrEaj8i/oWKoRxpVNW+Re8Q==", + "dev": true, + "requires": { + "argparse": "^2.0.1" + } + }, + "locate-path": { + "version": "6.0.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dev": true, + "requires": { + "p-locate": "^5.0.0" + } + }, + "ms": { + "version": "2.1.3", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/ms/2.1.3/ms-2.1.3.tgz", + "integrity": "sha1-V0yBOM4dK1hh8LRFedut1gxmFbI=", + "dev": true + }, + "p-locate": { + "version": "5.0.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha1-g8gxXGeFAF470CGDlBHJ4RDm2DQ=", + "dev": true, + "requires": { + "p-limit": "^3.0.2" + } + }, + "path-exists": { + "version": "4.0.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/path-exists/4.0.0/path-exists-4.0.0.tgz", + "integrity": "sha1-UTvb4tO5XXdi6METfvoZXGxhtbM=", + "dev": true + }, + "string-width": { + "version": "4.2.2", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/string-width/-/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" + } + }, + "strip-ansi": { + "version": "6.0.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/strip-ansi/6.0.0/strip-ansi-6.0.0.tgz", + "integrity": "sha1-CxVx3XZpzNTz4G4U7x7tJiJa5TI=", + "dev": true, + "requires": { + "ansi-regex": "^5.0.0" + } + }, + "supports-color": { + "version": "8.1.1", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + }, + "which": { + "version": "2.0.2", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/which/2.0.2/which-2.0.2.tgz", + "integrity": "sha1-fGqN0KY2oDJ+ELWckobu6T8/UbE=", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + }, + "wrap-ansi": { + "version": "7.0.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/wrap-ansi/7.0.0/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" + } + }, + "y18n": { + "version": "5.0.8", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "dev": true + }, + "yargs": { + "version": "16.2.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/yargs/-/yargs-16.2.0.tgz", + "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", + "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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/yargs-parser/20.2.4/yargs-parser-20.2.4.tgz", + "integrity": "sha1-tCiQ8UVmeW+Fro46JSkNIF8VSlQ=", + "dev": true + } + } + }, + "ms": { + "version": "2.0.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/ms/2.0.0/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true, + "optional": true + }, + "nanoid": { + "version": "3.1.20", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/nanoid/-/nanoid-3.1.20.tgz", + "integrity": "sha512-a1cQNyczgKbLX9jwbS/+d7W8fX/RfgYR7lVWwWOGIPNgK2m0MWvrGF6/m4kk6U3QcFMnZf3RIhL0v2Jgh/0Uxw==", + "dev": true + }, + "nanomatch": { + "version": "1.2.13", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/nanomatch/1.2.13/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/natural-compare/1.4.0/natural-compare-1.4.0.tgz", + "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", + "dev": true + }, + "neo-async": { + "version": "2.6.2", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/neo-async/2.6.2/neo-async-2.6.2.tgz", + "integrity": "sha1-tKr7k+OustgXTKU88WOrfXMIMF8=" + }, + "node-releases": { + "version": "1.1.71", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/node-releases/-/node-releases-1.1.71.tgz", + "integrity": "sha512-zR6HoT6LrLCRBwukmrVbHv0EpEQjksO6GmFcZQQuCAy139BEsoVKPYnf3jongYW83fAa1torLGYwxxky/p28sg==" + }, + "normalize-path": { + "version": "3.0.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/normalize-path/3.0.0/normalize-path-3.0.0.tgz", + "integrity": "sha1-Dc1p/yOhybEf0JeDFmRKA4ghamU=" + }, + "npm-run-path": { + "version": "4.0.1", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/npm-run-path/4.0.1/npm-run-path-4.0.1.tgz", + "integrity": "sha1-t+zR5e1T2o43pV4cImnguX7XSOo=", + "requires": { + "path-key": "^3.0.0" + } + }, + "object-assign": { + "version": "4.1.1", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/object-assign/4.1.1/object-assign-4.1.1.tgz", + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" + }, + "object-copy": { + "version": "0.1.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/object-copy/0.1.0/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/define-property/0.2.5/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/kind-of/3.2.2/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/object-keys/1.1.1/object-keys-1.1.1.tgz", + "integrity": "sha1-HEfyct8nfzsdrwYWd9nILiMixg4=", + "dev": true + }, + "object-visit": { + "version": "1.0.1", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/object-visit/1.0.1/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/object.assign/4.1.2/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/object.pick/1.3.0/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/once/1.4.0/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "requires": { + "wrappy": "1" + } + }, + "onetime": { + "version": "5.1.2", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/onetime/5.1.2/onetime-5.1.2.tgz", + "integrity": "sha1-0Oluu1awdHbfHdnEgG5SN5hcpF4=", + "requires": { + "mimic-fn": "^2.1.0" + } + }, + "optionator": { + "version": "0.9.1", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/optionator/-/optionator-0.9.1.tgz", + "integrity": "sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw==", + "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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha1-4drMvnjQ0TiMoYxk/qOOPlfjcGs=", + "requires": { + "yocto-queue": "^0.1.0" + } + }, + "p-locate": { + "version": "4.1.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/p-locate/4.1.0/p-locate-4.1.0.tgz", + "integrity": "sha1-o0KLtwiLOmApL2aRkni3wpetTwc=", + "requires": { + "p-limit": "^2.2.0" + }, + "dependencies": { + "p-limit": { + "version": "2.3.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/p-limit/2.3.0/p-limit-2.3.0.tgz", + "integrity": "sha1-PdM8ZHohT9//2DWTPrCG2g3CHbE=", + "requires": { + "p-try": "^2.0.0" + } + } + } + }, + "p-map": { + "version": "2.1.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/p-map/2.1.0/p-map-2.1.0.tgz", + "integrity": "sha1-MQko/u+cnsxltosXaTAYpmXOoXU=" + }, + "p-try": { + "version": "2.2.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/p-try/2.2.0/p-try-2.2.0.tgz", + "integrity": "sha1-yyhoVA4xPWHeWPr741zpAE1VQOY=" + }, + "parent-module": { + "version": "1.0.1", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/parent-module/1.0.1/parent-module-1.0.1.tgz", + "integrity": "sha1-aR0nCeeMefrjoVZiJFLQB2LKqqI=", + "dev": true, + "requires": { + "callsites": "^3.0.0" + } + }, + "pascalcase": { + "version": "0.1.1", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/pascalcase/0.1.1/pascalcase-0.1.1.tgz", + "integrity": "sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ=", + "dev": true, + "optional": true + }, + "path-dirname": { + "version": "1.0.2", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/path-dirname/1.0.2/path-dirname-1.0.2.tgz", + "integrity": "sha1-zDPSTVJeCZpTiMAzbG4yuRYGCeA=", + "dev": true, + "optional": true + }, + "path-exists": { + "version": "4.0.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/path-exists/4.0.0/path-exists-4.0.0.tgz", + "integrity": "sha1-UTvb4tO5XXdi6METfvoZXGxhtbM=" + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/path-is-absolute/1.0.1/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" + }, + "path-is-inside": { + "version": "1.0.2", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/path-is-inside/1.0.2/path-is-inside-1.0.2.tgz", + "integrity": "sha1-NlQX3t5EQw0cEa9hAn+s8HS9/FM=" + }, + "path-key": { + "version": "3.1.1", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/path-key/3.1.1/path-key-3.1.1.tgz", + "integrity": "sha1-WB9q3mWMu6ZaDTOA3ndTKVBU83U=" + }, + "path-parse": { + "version": "1.0.6", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/path-parse/1.0.6/path-parse-1.0.6.tgz", + "integrity": "sha1-1i27VnlAXXLEc37FhgDp3c8G0kw=" + }, + "path-type": { + "version": "4.0.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/path-type/4.0.0/path-type-4.0.0.tgz", + "integrity": "sha1-hO0BwKe6OAr+CdkKjBgNzZ0DBDs=" + }, + "pathval": { + "version": "1.1.1", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/pathval/-/pathval-1.1.1.tgz", + "integrity": "sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==", + "dev": true + }, + "picomatch": { + "version": "2.2.3", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/picomatch/-/picomatch-2.2.3.tgz", + "integrity": "sha512-KpELjfwcCDUb9PeigTs2mBJzXUPzAuP2oPcA989He8Rte0+YUAjw1JVedDhuTKPkHjSYzMN3npC9luThGYEKdg==" + }, + "pify": { + "version": "4.0.1", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/pify/4.0.1/pify-4.0.1.tgz", + "integrity": "sha1-SyzSXFDVmHNcUCkiJP2MbfQeMjE=" + }, + "pinkie": { + "version": "2.0.4", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/pinkie/2.0.4/pinkie-2.0.4.tgz", + "integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=" + }, + "pinkie-promise": { + "version": "2.0.1", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/pinkie-promise/2.0.1/pinkie-promise-2.0.1.tgz", + "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=", + "requires": { + "pinkie": "^2.0.0" + } + }, + "pkg-dir": { + "version": "4.2.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/pkg-dir/4.2.0/pkg-dir-4.2.0.tgz", + "integrity": "sha1-8JkTPfft5CLoHR2ESCcO6z5CYfM=", + "requires": { + "find-up": "^4.0.0" + } + }, + "posix-character-classes": { + "version": "0.1.1", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/posix-character-classes/0.1.1/posix-character-classes-0.1.1.tgz", + "integrity": "sha1-AerA/jta9xoqbAL+q7jB/vfgDqs=", + "dev": true, + "optional": true + }, + "prelude-ls": { + "version": "1.2.1", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "dev": true + }, + "process-nextick-args": { + "version": "2.0.1", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/process-nextick-args/2.0.1/process-nextick-args-2.0.1.tgz", + "integrity": "sha1-eCDZsWEgzFXKmud5JoCufbptf+I=" + }, + "progress": { + "version": "2.0.3", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/progress/2.0.3/progress-2.0.3.tgz", + "integrity": "sha1-foz42PW48jnBvGi+tOt4Vn1XLvg=", + "dev": true + }, + "prr": { + "version": "1.0.1", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/prr/1.0.1/prr-1.0.1.tgz", + "integrity": "sha1-0/wRS6BplaRexok/SEzrHXj19HY=" + }, + "punycode": { + "version": "2.1.1", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/punycode/2.1.1/punycode-2.1.1.tgz", + "integrity": "sha1-tYsBCsQMIsVldhbI0sLALHv0eew=" + }, + "queue-microtask": { + "version": "1.2.3", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==" + }, + "randombytes": { + "version": "2.1.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/randombytes/2.1.0/randombytes-2.1.0.tgz", + "integrity": "sha1-32+ENy8CcNxlzfYpE0mrekc9Tyo=", + "requires": { + "safe-buffer": "^5.1.0" + } + }, + "readable-stream": { + "version": "2.3.7", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/readable-stream/2.3.7/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/safe-buffer/5.1.2/safe-buffer-5.1.2.tgz", + "integrity": "sha1-mR7GnSluAxN0fVm9/St0XDX4go0=" + } + } + }, + "readdirp": { + "version": "2.2.1", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/readdirp/2.2.1/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/braces/2.3.2/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/extend-shallow/2.0.1/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/fill-range/4.0.0/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/extend-shallow/2.0.1/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/is-number/3.0.0/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/kind-of/3.2.2/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/micromatch/3.1.10/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/to-regex-range/2.1.1/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.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/rechoir/-/rechoir-0.7.0.tgz", + "integrity": "sha512-ADsDEH2bvbjltXEP+hTIAmeFekTFK0V2BTxMkok6qILyAJEXV0AFfoWcAq4yfll5VdIMd/RVXq0lR+wQi5ZU3Q==", + "requires": { + "resolve": "^1.9.0" + } + }, + "regenerate": { + "version": "1.4.2", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/regenerate/1.4.2/regenerate-1.4.2.tgz", + "integrity": "sha1-uTRtiCfo9aMve6KWN9OYtpAUhIo=", + "dev": true + }, + "regenerate-unicode-properties": { + "version": "8.2.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/regenerate-unicode-properties/8.2.0/regenerate-unicode-properties-8.2.0.tgz", + "integrity": "sha1-5d5xEdZV57pgwFfb6f83yH5lzew=", + "dev": true, + "requires": { + "regenerate": "^1.4.0" + } + }, + "regenerator-runtime": { + "version": "0.13.8", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/regenerator-runtime/-/regenerator-runtime-0.13.8.tgz", + "integrity": "sha1-ctzshGo2omctaVAcNdt1qRvOSHU=", + "dev": true + }, + "regenerator-transform": { + "version": "0.14.5", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/regenerator-transform/0.14.5/regenerator-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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/regex-not/1.0.2/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.1.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/regexpp/3.1.0/regexpp-3.1.0.tgz", + "integrity": "sha1-IG0K0KVkjP+9uK5GQ489xRyfeOI=", + "dev": true + }, + "regexpu-core": { + "version": "4.7.1", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/regexpu-core/4.7.1/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/regjsgen/0.5.2/regjsgen-0.5.2.tgz", + "integrity": "sha1-kv8pX7He7L9uzaslQ9IH6RqjNzM=", + "dev": true + }, + "regjsparser": { + "version": "0.6.9", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/regjsparser/-/regjsparser-0.6.9.tgz", + "integrity": "sha512-ZqbNRz1SNjLAiYuwY0zoXW8Ne675IX5q+YHioAGbCw4X96Mjl2+dcX9B2ciaeyYjViDAfvIjFpQjJgLttTEERQ==", + "dev": true, + "requires": { + "jsesc": "~0.5.0" + }, + "dependencies": { + "jsesc": { + "version": "0.5.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/jsesc/0.5.0/jsesc-0.5.0.tgz", + "integrity": "sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0=", + "dev": true + } + } + }, + "remove-trailing-separator": { + "version": "1.1.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/remove-trailing-separator/1.1.0/remove-trailing-separator-1.1.0.tgz", + "integrity": "sha1-wkvOKig62tW8P1jg1IJJuSN52O8=", + "dev": true, + "optional": true + }, + "repeat-element": { + "version": "1.1.4", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/repeat-element/-/repeat-element-1.1.4.tgz", + "integrity": "sha512-LFiNfRcSu7KK3evMyYOuCzv3L10TW7yC1G2/+StMjK8Y6Vqd2MG7r/Qjw4ghtuCOjFvlnms/iMmLqpvW/ES/WQ==", + "dev": true, + "optional": true + }, + "repeat-string": { + "version": "1.6.1", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/repeat-string/1.6.1/repeat-string-1.6.1.tgz", + "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=", + "dev": true, + "optional": true + }, + "require-directory": { + "version": "2.1.1", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/require-directory/2.1.1/require-directory-2.1.1.tgz", + "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", + "dev": true + }, + "require-from-string": { + "version": "2.0.2", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/require-from-string/-/require-from-string-2.0.2.tgz", + "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", + "dev": true + }, + "resolve": { + "version": "1.20.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/resolve/-/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/resolve-cwd/3.0.0/resolve-cwd-3.0.0.tgz", + "integrity": "sha1-DwB18bslRHZs9zumpuKt/ryxPy0=", + "requires": { + "resolve-from": "^5.0.0" + } + }, + "resolve-from": { + "version": "5.0.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/resolve-from/5.0.0/resolve-from-5.0.0.tgz", + "integrity": "sha1-w1IlhD3493bfIcV1V7wIfp39/Gk=" + }, + "resolve-url": { + "version": "0.2.1", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/resolve-url/0.2.1/resolve-url-0.2.1.tgz", + "integrity": "sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo=", + "dev": true, + "optional": true + }, + "ret": { + "version": "0.1.15", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/ret/0.1.15/ret-0.1.15.tgz", + "integrity": "sha1-uKSCXVvbH8P29Twrwz+BOIaBx7w=", + "dev": true, + "optional": true + }, + "reusify": { + "version": "1.0.4", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/reusify/1.0.4/reusify-1.0.4.tgz", + "integrity": "sha1-kNo4Kx4SbvwCFG6QhFqI2xKSXXY=" + }, + "rfdc": { + "version": "1.3.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/rfdc/-/rfdc-1.3.0.tgz", + "integrity": "sha512-V2hovdzFbOi77/WajaSMXk2OLm+xNIeQdMMuB7icj7bk6zi2F8GGAxigcnDFpJHbNyNcgyJDiP+8nOrY5cZGrA==" + }, + "rimraf": { + "version": "2.7.1", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/rimraf/2.7.1/rimraf-2.7.1.tgz", + "integrity": "sha1-NXl/E6f9rcVmFCwp1PB8ytSD4+w=", + "requires": { + "glob": "^7.1.3" + } + }, + "run-parallel": { + "version": "1.2.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/run-parallel/-/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/safe-buffer/5.2.1/safe-buffer-5.2.1.tgz", + "integrity": "sha1-Hq+fqb2x/dTsdfWPnNtOa3gn7sY=" + }, + "safe-regex": { + "version": "1.1.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/safe-regex/1.1.0/safe-regex-1.1.0.tgz", + "integrity": "sha1-QKNmnzsHfR6UPURinhV91IAjvy4=", + "dev": true, + "optional": true, + "requires": { + "ret": "~0.1.10" + } + }, + "schema-utils": { + "version": "3.0.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/schema-utils/3.0.0/schema-utils-3.0.0.tgz", + "integrity": "sha1-Z1AvaqK2ai1AMrQnmilEl4oJE+8=", + "requires": { + "@types/json-schema": "^7.0.6", + "ajv": "^6.12.5", + "ajv-keywords": "^3.5.2" + } + }, + "semver": { + "version": "7.3.5", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/semver/-/semver-7.3.5.tgz", + "integrity": "sha1-C2Ich5NI2JmOSw5L6Us/EuYBjvc=", + "requires": { + "lru-cache": "^6.0.0" + } + }, + "serialize-javascript": { + "version": "5.0.1", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/serialize-javascript/5.0.1/serialize-javascript-5.0.1.tgz", + "integrity": "sha1-eIbshIBJpGJGepfT2Rjrsqr5NPQ=", + "requires": { + "randombytes": "^2.1.0" + } + }, + "set-value": { + "version": "2.0.1", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/set-value/2.0.1/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/extend-shallow/2.0.1/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/shallow-clone/3.0.1/shallow-clone-3.0.1.tgz", + "integrity": "sha1-jymBrZJTH1UDWwH7IwdppA4C76M=", + "requires": { + "kind-of": "^6.0.2" + } + }, + "shebang-command": { + "version": "2.0.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/shebang-command/2.0.0/shebang-command-2.0.0.tgz", + "integrity": "sha1-zNCvT4g1+9wmW4JGGq8MNmY/NOo=", + "requires": { + "shebang-regex": "^3.0.0" + } + }, + "shebang-regex": { + "version": "3.0.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/shebang-regex/3.0.0/shebang-regex-3.0.0.tgz", + "integrity": "sha1-rhbxZE2HPsrYQ7AwexQzYtTEIXI=" + }, + "signal-exit": { + "version": "3.0.3", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/signal-exit/3.0.3/signal-exit-3.0.3.tgz", + "integrity": "sha1-oUEMLt2PB3sItOJTyOrPyvBXRhw=" + }, + "slash": { + "version": "3.0.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/slash/3.0.0/slash-3.0.0.tgz", + "integrity": "sha1-ZTm+hwwWWtvVJAIg2+Nh8bxNRjQ=" + }, + "slice-ansi": { + "version": "4.0.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/slice-ansi/-/slice-ansi-4.0.0.tgz", + "integrity": "sha512-qMCMfhY040cVHT43K9BFygqYbUPFZKHOg7K73mtTWJRb8pyP3fzf4Ixd5SzdEJQ6MRUg/WBnOLxghZtKKurENQ==", + "dev": true, + "requires": { + "ansi-styles": "^4.0.0", + "astral-regex": "^2.0.0", + "is-fullwidth-code-point": "^3.0.0" + }, + "dependencies": { + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/is-fullwidth-code-point/3.0.0/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha1-8Rb4Bk/pCz94RKOJl8C3UFEmnx0=", + "dev": true + } + } + }, + "snapdragon": { + "version": "0.8.2", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/snapdragon/0.8.2/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": { + "define-property": { + "version": "0.2.5", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/define-property/0.2.5/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/extend-shallow/2.0.1/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "optional": true, + "requires": { + "is-extendable": "^0.1.0" + } + }, + "source-map": { + "version": "0.5.7", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/source-map/0.5.7/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", + "dev": true, + "optional": true + } + } + }, + "snapdragon-node": { + "version": "2.1.1", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/snapdragon-node/2.1.1/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/define-property/1.0.0/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/is-accessor-descriptor/1.0.0/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/is-data-descriptor/1.0.0/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/is-descriptor/1.0.2/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/snapdragon-util/3.0.1/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/kind-of/3.2.2/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/source-map/0.6.1/source-map-0.6.1.tgz", + "integrity": "sha1-dHIq8y6WFOnCh6jQu95IteLxomM=" + }, + "source-map-resolve": { + "version": "0.5.3", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/source-map-resolve/0.5.3/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/source-map-support/0.5.19/source-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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/source-map-url/0.4.1/source-map-url-0.4.1.tgz", + "integrity": "sha1-CvZmBadFpaL5HPG7+KevvCg97FY=", + "dev": true, + "optional": true + }, + "split-string": { + "version": "3.1.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/split-string/3.1.0/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/sprintf-js/1.0.3/sprintf-js-1.0.3.tgz", + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", + "dev": true + }, + "static-extend": { + "version": "0.1.2", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/static-extend/0.1.2/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/define-property/0.2.5/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/streamroller/2.2.4/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/date-format/2.1.0/date-format-2.1.0.tgz", + "integrity": "sha1-MdW16iEc9f12TNOLr50DPffhJc8=" + }, + "debug": { + "version": "4.3.1", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/debug/4.3.1/debug-4.3.1.tgz", + "integrity": "sha1-8NIpxQXgxtjEmsVT0bE9wYP2su4=", + "requires": { + "ms": "2.1.2" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/ms/2.1.2/ms-2.1.2.tgz", + "integrity": "sha1-0J0fNXtEP0kzgqjrPM0YOHKuYAk=" + } + } + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/string_decoder/1.1.1/string_decoder-1.1.1.tgz", + "integrity": "sha1-nPFhG6YmhdcDCunkujQUnDrwP8g=", + "requires": { + "safe-buffer": "~5.1.0" + }, + "dependencies": { + "safe-buffer": { + "version": "5.1.2", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/safe-buffer/5.1.2/safe-buffer-5.1.2.tgz", + "integrity": "sha1-mR7GnSluAxN0fVm9/St0XDX4go0=" + } + } + }, + "strip-final-newline": { + "version": "2.0.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/strip-final-newline/2.0.0/strip-final-newline-2.0.0.tgz", + "integrity": "sha1-ibhS+y/L6Tb29LMYevsKEsGrWK0=" + }, + "strip-json-comments": { + "version": "3.1.1", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/strip-json-comments/3.1.1/strip-json-comments-3.1.1.tgz", + "integrity": "sha1-MfEoGzgyYwQ0gxwxDAHMzajL4AY=", + "dev": true + }, + "supports-color": { + "version": "7.2.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/supports-color/7.2.0/supports-color-7.2.0.tgz", + "integrity": "sha1-G33NyzK4E4gBs+R4umpRyqiWSNo=", + "requires": { + "has-flag": "^4.0.0" + } + }, + "table": { + "version": "6.1.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/table/-/table-6.1.0.tgz", + "integrity": "sha512-T4G5KMmqIk6X87gLKWyU5exPpTjLjY5KyrFWaIjv3SvgaIUGXV7UEzGEnZJdTA38/yUS6f9PlKezQ0bYXG3iIQ==", + "dev": true, + "requires": { + "ajv": "^8.0.1", + "is-boolean-object": "^1.1.0", + "is-number-object": "^1.0.4", + "is-string": "^1.0.5", + "lodash.clonedeep": "^4.5.0", + "lodash.flatten": "^4.4.0", + "lodash.truncate": "^4.4.2", + "slice-ansi": "^4.0.0", + "string-width": "^4.2.0" + }, + "dependencies": { + "ajv": { + "version": "8.1.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/ajv/-/ajv-8.1.0.tgz", + "integrity": "sha512-B/Sk2Ix7A36fs/ZkuGLIR86EdjbgR6fsAcbx9lOP/QBSXujDNbVmIS/U4Itz5k8fPFDeVZl/zQ/gJW4Jrq6XjQ==", + "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" + } + }, + "ansi-regex": { + "version": "5.0.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/ansi-regex/5.0.0/ansi-regex-5.0.0.tgz", + "integrity": "sha1-OIU59VF5vzkznIGvMKZU1p+Hy3U=", + "dev": true + }, + "emoji-regex": { + "version": "8.0.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/emoji-regex/8.0.0/emoji-regex-8.0.0.tgz", + "integrity": "sha1-6Bj9ac5cz8tARZT4QpY79TFkzDc=", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/is-fullwidth-code-point/3.0.0/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha1-8Rb4Bk/pCz94RKOJl8C3UFEmnx0=", + "dev": true + }, + "json-schema-traverse": { + "version": "1.0.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "dev": true + }, + "string-width": { + "version": "4.2.2", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/string-width/-/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" + } + }, + "strip-ansi": { + "version": "6.0.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/strip-ansi/6.0.0/strip-ansi-6.0.0.tgz", + "integrity": "sha1-CxVx3XZpzNTz4G4U7x7tJiJa5TI=", + "dev": true, + "requires": { + "ansi-regex": "^5.0.0" + } + } + } + }, + "tapable": { + "version": "1.1.3", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/tapable/1.1.3/tapable-1.1.3.tgz", + "integrity": "sha1-ofzMBrWNth/XpF2i2kT186Pme6I=" + }, + "terser": { + "version": "5.7.1", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/terser/-/terser-5.7.1.tgz", + "integrity": "sha1-LcemEAm2a7Y4MFyyqCR2OxFr94Q=", + "requires": { + "commander": "^2.20.0", + "source-map": "~0.7.2", + "source-map-support": "~0.5.19" + }, + "dependencies": { + "source-map": { + "version": "0.7.3", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/source-map/0.7.3/source-map-0.7.3.tgz", + "integrity": "sha1-UwL4FpAxc1ImVECS5kmB91F1A4M=" + } + } + }, + "terser-webpack-plugin": { + "version": "5.1.4", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/terser-webpack-plugin/-/terser-webpack-plugin-5.1.4.tgz", + "integrity": "sha1-w2nPikeqmSK9DYqU/j09oRp2eKE=", + "requires": { + "jest-worker": "^27.0.2", + "p-limit": "^3.1.0", + "schema-utils": "^3.0.0", + "serialize-javascript": "^6.0.0", + "source-map": "^0.6.1", + "terser": "^5.7.0" + }, + "dependencies": { + "serialize-javascript": { + "version": "6.0.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/serialize-javascript/-/serialize-javascript-6.0.0.tgz", + "integrity": "sha1-765diPRdeSQUHai1w6en5mP+/rg=", + "requires": { + "randombytes": "^2.1.0" + } + } + } + }, + "text-table": { + "version": "0.2.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/text-table/0.2.0/text-table-0.2.0.tgz", + "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=", + "dev": true + }, + "to-fast-properties": { + "version": "2.0.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/to-fast-properties/2.0.0/to-fast-properties-2.0.0.tgz", + "integrity": "sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4=", + "dev": true + }, + "to-object-path": { + "version": "0.3.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/to-object-path/0.3.0/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/kind-of/3.2.2/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/to-regex/3.0.2/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/to-regex-range/5.0.1/to-regex-range-5.0.1.tgz", + "integrity": "sha1-FkjESq58jZiKMmAY7XL1tN0DkuQ=", + "requires": { + "is-number": "^7.0.0" + } + }, + "ts-loader": { + "version": "8.1.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/ts-loader/-/ts-loader-8.1.0.tgz", + "integrity": "sha512-YiQipGGAFj2zBfqLhp28yUvPP9jUGqHxRzrGYuc82Z2wM27YIHbElXiaZDc93c3x0mz4zvBmS6q/DgExpdj37A==", + "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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/ts-node/9.1.1/ts-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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/diff/4.0.2/diff-4.0.2.tgz", + "integrity": "sha1-YPOuy4nV+uUgwRqhnvwruYKq3n0=", + "dev": true + } + } + }, + "tslib": { + "version": "1.14.1", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha1-zy04vcNKE0vK8QkcQfZhni9nLQA=", + "dev": true + }, + "tsutils": { + "version": "3.21.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/tsutils/-/tsutils-3.21.0.tgz", + "integrity": "sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==", + "dev": true, + "requires": { + "tslib": "^1.8.1" + } + }, + "type-check": { + "version": "0.4.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "dev": true, + "requires": { + "prelude-ls": "^1.2.1" + } + }, + "type-detect": { + "version": "4.0.8", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/type-detect/4.0.8/type-detect-4.0.8.tgz", + "integrity": "sha1-dkb7XxiHHPu3dJ5pvTmmOI63RQw=", + "dev": true + }, + "type-fest": { + "version": "0.8.1", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/type-fest/0.8.1/type-fest-0.8.1.tgz", + "integrity": "sha1-CeJJ696FHTseSNJ8EFREZn8XuD0=", + "dev": true + }, + "typescript": { + "version": "4.2.4", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/typescript/-/typescript-4.2.4.tgz", + "integrity": "sha512-V+evlYHZnQkaz8TRBuxTA92yZBPotr5H+WhQ7bD3hZUndx5tGOa1fuCgeSjxAzM1RiN5IzvadIXTVefuuwZCRg==" + }, + "uglify-es": { + "version": "3.3.10", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/uglify-es/3.3.10/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/commander/-/commander-2.14.1.tgz", + "integrity": "sha512-+YR16o3rK53SmWHU3rEM3tPAh2rwb1yPcQX5irVn7mb0gXbwuCCrnkbV5+PBfETdfg1vui07nM6PCG1zndcjQw==", + "dev": true + } + } + }, + "unicode-canonical-property-names-ecmascript": { + "version": "1.0.4", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/unicode-canonical-property-names-ecmascript/1.0.4/unicode-canonical-property-names-ecmascript-1.0.4.tgz", + "integrity": "sha1-JhmADEyCWADv3YNDr33Zkzy+KBg=", + "dev": true + }, + "unicode-match-property-ecmascript": { + "version": "1.0.4", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/unicode-match-property-ecmascript/1.0.4/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/unicode-match-property-value-ecmascript/1.2.0/unicode-match-property-value-ecmascript-1.2.0.tgz", + "integrity": "sha1-DZH2AO7rMJaqlisdb8iIduZOpTE=", + "dev": true + }, + "unicode-property-aliases-ecmascript": { + "version": "1.1.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/unicode-property-aliases-ecmascript/1.1.0/unicode-property-aliases-ecmascript-1.1.0.tgz", + "integrity": "sha1-3Vepn2IHvt/0Yoq++5TFDblByPQ=", + "dev": true + }, + "union-value": { + "version": "1.0.1", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/union-value/1.0.1/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/universalify/0.1.2/universalify-0.1.2.tgz", + "integrity": "sha1-tkb2m+OULavOzJ1mOcgNwQXvqmY=" + }, + "unset-value": { + "version": "1.0.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/unset-value/1.0.0/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/has-value/0.3.1/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/isobject/2.1.0/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/has-values/0.1.4/has-values-0.1.4.tgz", + "integrity": "sha1-bWHeldkd/Km5oCCJrThL/49it3E=", + "dev": true, + "optional": true + } + } + }, + "upath": { + "version": "1.2.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/upath/1.2.0/upath-1.2.0.tgz", + "integrity": "sha1-j2bbzVWog6za5ECK+LA1pQRMGJQ=", + "dev": true, + "optional": true + }, + "uri-js": { + "version": "4.4.1", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/uri-js/4.4.1/uri-js-4.4.1.tgz", + "integrity": "sha1-mxpSWVIlhZ5V9mnZKPiMbFfyp34=", + "requires": { + "punycode": "^2.1.0" + } + }, + "urix": { + "version": "0.1.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/urix/0.1.0/urix-0.1.0.tgz", + "integrity": "sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI=", + "dev": true, + "optional": true + }, + "use": { + "version": "3.1.1", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/use/3.1.1/use-3.1.1.tgz", + "integrity": "sha1-1QyMrHmhn7wg8pEfVuuXP04QBw8=", + "dev": true, + "optional": true + }, + "util-deprecate": { + "version": "1.0.2", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/util-deprecate/1.0.2/util-deprecate-1.0.2.tgz", + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" + }, + "v8-compile-cache": { + "version": "2.3.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz", + "integrity": "sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA==" + }, + "watchpack": { + "version": "2.2.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/watchpack/-/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.49.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/webpack/-/webpack-5.49.0.tgz", + "integrity": "sha512-XarsANVf28A7Q3KPxSnX80EkCcuOer5hTOEJWJNvbskOZ+EK3pobHarGHceyUZMxpsTHBHhlV7hiQyLZzGosYw==", + "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": { + "@types/json-schema": { + "version": "7.0.9", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/@types/json-schema/-/json-schema-7.0.9.tgz", + "integrity": "sha512-qcUXuemtEu+E5wZSJHNxUXeCZhAfXKQ41D+duX+VYPde7xyEVZci+/oXKJL13tnRs9lR2pr4fod59GT6/X1/yQ==" + }, + "enhanced-resolve": { + "version": "5.8.2", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/enhanced-resolve/-/enhanced-resolve-5.8.2.tgz", + "integrity": "sha1-Fd3HeTRcu3PpfGEc0AwBwee/TYs=", + "requires": { + "graceful-fs": "^4.2.4", + "tapable": "^2.2.0" + } + }, + "schema-utils": { + "version": "3.1.1", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/schema-utils/-/schema-utils-3.1.1.tgz", + "integrity": "sha1-vHTEtraZXB2I92qLd76nIZ4MgoE=", + "requires": { + "@types/json-schema": "^7.0.8", + "ajv": "^6.12.5", + "ajv-keywords": "^3.5.2" + } + }, + "tapable": { + "version": "2.2.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/tapable/-/tapable-2.2.0.tgz", + "integrity": "sha1-XDc9KB2cZyhIIT0OA30cQWWrQms=" + } + } + }, + "webpack-cli": { + "version": "4.7.2", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/webpack-cli/-/webpack-cli-4.7.2.tgz", + "integrity": "sha512-mEoLmnmOIZQNiRl0ebnjzQ74Hk0iKS5SiEEnpq3dRezoyR3yPaeQZCMCe+db4524pj1Pd5ghZXjT41KLzIhSLw==", + "requires": { + "@discoveryjs/json-ext": "^0.5.0", + "@webpack-cli/configtest": "^1.0.4", + "@webpack-cli/info": "^1.3.0", + "@webpack-cli/serve": "^1.5.1", + "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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/commander/-/commander-7.2.0.tgz", + "integrity": "sha1-o2y1fQtQHOEI5NIFWaFQo5HZerc=" + } + } + }, + "webpack-merge": { + "version": "5.8.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/webpack-merge/-/webpack-merge-5.8.0.tgz", + "integrity": "sha512-/SaI7xY0831XwP6kzuwhKWVKDP9t1QY1h65lAFLbZqMPIuYcD9QAW4u9STIbU9kaJbPBB/geU/gLr1wDjOhQ+Q==", + "requires": { + "clone-deep": "^4.0.1", + "wildcard": "^2.0.0" + } + }, + "webpack-sources": { + "version": "3.2.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/webpack-sources/-/webpack-sources-3.2.0.tgz", + "integrity": "sha512-fahN08Et7P9trej8xz/Z7eRu8ltyiygEo/hnRi9KqBUs80KeDcnf96ZJo++ewWd84fEf3xSX9bp4ZS9hbw0OBw==" + }, + "which": { + "version": "2.0.2", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/which/2.0.2/which-2.0.2.tgz", + "integrity": "sha1-fGqN0KY2oDJ+ELWckobu6T8/UbE=", + "requires": { + "isexe": "^2.0.0" + } + }, + "wide-align": { + "version": "1.1.3", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/wide-align/1.1.3/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/ansi-regex/3.0.0/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, + "string-width": { + "version": "2.1.1", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/string-width/2.1.1/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": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/strip-ansi/4.0.0/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "^3.0.0" + } + } + } + }, + "wildcard": { + "version": "2.0.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/wildcard/-/wildcard-2.0.0.tgz", + "integrity": "sha512-JcKqAHLPxcdb9KM49dufGXn2x3ssnfjbcaQdLlfZsL9rH9wgDQjUtDxbo8NE0F6SFvydeu1VhZe7hZuHsB2/pw==" + }, + "word-wrap": { + "version": "1.2.3", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/word-wrap/1.2.3/word-wrap-1.2.3.tgz", + "integrity": "sha1-YQY29rH3A4kb00dxzLF/uTtHB5w=", + "dev": true + }, + "workerpool": { + "version": "6.1.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/workerpool/-/workerpool-6.1.0.tgz", + "integrity": "sha512-toV7q9rWNYha963Pl/qyeZ6wG+3nnsyvolaNUS8+R5Wtw6qJPTxIlOP1ZSvcGhEJw+l3HMMmtiNo9Gl61G4GVg==", + "dev": true + }, + "wrappy": { + "version": "1.0.2", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/wrappy/1.0.2/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" + }, + "yallist": { + "version": "4.0.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/yallist/4.0.0/yallist-4.0.0.tgz", + "integrity": "sha1-m7knkNnA7/7GO+c1GeEaNQGaOnI=" + }, + "yargs-unparser": { + "version": "2.0.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/yargs-unparser/-/yargs-unparser-2.0.0.tgz", + "integrity": "sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA==", + "dev": true, + "requires": { + "camelcase": "^6.0.0", + "decamelize": "^4.0.0", + "flat": "^5.0.2", + "is-plain-obj": "^2.1.0" + }, + "dependencies": { + "camelcase": { + "version": "6.2.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/camelcase/-/camelcase-6.2.0.tgz", + "integrity": "sha512-c7wVvbw3f37nuobQNtgsgG9POC9qMbNuMQmTCqZv23b6MIz0fcYpBiOlv9gEN/hdLdnZTDQhg6e9Dq5M1vKvfg==", + "dev": true + }, + "decamelize": { + "version": "4.0.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/decamelize/-/decamelize-4.0.0.tgz", + "integrity": "sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==", + "dev": true + } + } + }, + "yn": { + "version": "3.1.1", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/yn/3.1.1/yn-3.1.1.tgz", + "integrity": "sha1-HodAGgnXZ8HV6rJqbkwYUYLS61A=", + "dev": true + }, + "yocto-queue": { + "version": "0.1.0", + "resolved": "http://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-public/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha1-ApTrPe4FAo0x7hpfosVWpqrxChs=" + } + } +} diff --git a/compiler/package.json b/compiler/package.json new file mode 100644 index 0000000000000000000000000000000000000000..fab82d88310d9ee161b5392d423a61e5afdd0799 --- /dev/null +++ b/compiler/package.json @@ -0,0 +1,44 @@ +{ + "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 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", + "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": "latest", + "log4js": "^6.3.0", + "ts-loader": "^8.0.12", + "typescript": "^4.1.3", + "webpack": "^5.48.0", + "webpack-cli": "^4.2.0" + } +} diff --git a/compiler/sample/app.ets b/compiler/sample/app.ets new file mode 100644 index 0000000000000000000000000000000000000000..30a1983810a7bd729f821e64efc93e0ffa2b6424 --- /dev/null +++ b/compiler/sample/app.ets @@ -0,0 +1,8 @@ +export default { + onCreate() { + console.info('Application onCreate') + }, + onDestroy() { + console.info('Application onDestroy') + }, +} diff --git a/compiler/sample/manifest.json b/compiler/sample/manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..97155b8f143765351882027299247ca8d540f117 --- /dev/null +++ b/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/sample/pages/home.ets b/compiler/sample/pages/home.ets new file mode 100644 index 0000000000000000000000000000000000000000..0fce6542cd8bdb2ce744974a95ef3be677e037b4 --- /dev/null +++ b/compiler/sample/pages/home.ets @@ -0,0 +1,30 @@ +@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/sample/pages/home_preview.ets b/compiler/sample/pages/home_preview.ets new file mode 100644 index 0000000000000000000000000000000000000000..9ae05aaf335a3db82cc286f11b625408b6d2e8ed --- /dev/null +++ b/compiler/sample/pages/home_preview.ets @@ -0,0 +1,40 @@ +@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/sample/pages/index.ets b/compiler/sample/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..2f37ded2f7717821942bc0a93560585b3fe31eb5 --- /dev/null +++ b/compiler/sample/pages/index.ets @@ -0,0 +1,32 @@ +@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/sample/pages/testcases/component-01.ets b/compiler/sample/pages/testcases/component-01.ets new file mode 100644 index 0000000000000000000000000000000000000000..44c4c183f02c5c61b92d0a3532be00504b25672a --- /dev/null +++ b/compiler/sample/pages/testcases/component-01.ets @@ -0,0 +1,19 @@ +@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/sample/pages/testcases/componentGridTest.ets b/compiler/sample/pages/testcases/componentGridTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..ef46eff71b79377a3d58f28e8d522047a0f2b072 --- /dev/null +++ b/compiler/sample/pages/testcases/componentGridTest.ets @@ -0,0 +1,55 @@ +@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/sample/pages/testcases/componentListTest.ets b/compiler/sample/pages/testcases/componentListTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..361a80233f86e0d1be983be6ec4490b2ae11f692 --- /dev/null +++ b/compiler/sample/pages/testcases/componentListTest.ets @@ -0,0 +1,48 @@ +@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/sample/pages/testcases/constructor-01.ets b/compiler/sample/pages/testcases/constructor-01.ets new file mode 100644 index 0000000000000000000000000000000000000000..f2befe6cb1c789ab8676d800f43dc9c3b82f27e9 --- /dev/null +++ b/compiler/sample/pages/testcases/constructor-01.ets @@ -0,0 +1,20 @@ +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/sample/pages/testcases/constructor-02.ets b/compiler/sample/pages/testcases/constructor-02.ets new file mode 100644 index 0000000000000000000000000000000000000000..03b017c9f154889f751e9b296322be81ab21d0e5 --- /dev/null +++ b/compiler/sample/pages/testcases/constructor-02.ets @@ -0,0 +1,15 @@ +@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/sample/pages/testcases/constructor-03.ets b/compiler/sample/pages/testcases/constructor-03.ets new file mode 100644 index 0000000000000000000000000000000000000000..1d790e2acdf70c6119f5ba5019ab44db6c376c3b --- /dev/null +++ b/compiler/sample/pages/testcases/constructor-03.ets @@ -0,0 +1,15 @@ +@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/sample/pages/testcases/expected/component-01-expected.js b/compiler/sample/pages/testcases/expected/component-01-expected.js new file mode 100644 index 0000000000000000000000000000000000000000..849492f2a944440c64727ad13c4dc2bd3d736b30 --- /dev/null +++ b/compiler/sample/pages/testcases/expected/component-01-expected.js @@ -0,0 +1,11 @@ +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/sample/pages/testcases/expected/constructor-01-expected.js b/compiler/sample/pages/testcases/expected/constructor-01-expected.js new file mode 100644 index 0000000000000000000000000000000000000000..76555d8b3c700e84cdc1686b80cad24dc22a0a3a --- /dev/null +++ b/compiler/sample/pages/testcases/expected/constructor-01-expected.js @@ -0,0 +1,18 @@ +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/sample/pages/testcases/expected/constructor-02-expected.js b/compiler/sample/pages/testcases/expected/constructor-02-expected.js new file mode 100644 index 0000000000000000000000000000000000000000..c257a6b1653a81279550fa655b94dadeeb6f374b --- /dev/null +++ b/compiler/sample/pages/testcases/expected/constructor-02-expected.js @@ -0,0 +1,14 @@ +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/sample/pages/testcases/expected/constructor-03-expected.js b/compiler/sample/pages/testcases/expected/constructor-03-expected.js new file mode 100644 index 0000000000000000000000000000000000000000..ae75c757dd8d5be9f372047e3549e0417c12b277 --- /dev/null +++ b/compiler/sample/pages/testcases/expected/constructor-03-expected.js @@ -0,0 +1,14 @@ +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/sample/pages/testcases/expected/link-01-expected.js b/compiler/sample/pages/testcases/expected/link-01-expected.js new file mode 100644 index 0000000000000000000000000000000000000000..46c737697f8d459a3a230e390411faeb19ec4367 --- /dev/null +++ b/compiler/sample/pages/testcases/expected/link-01-expected.js @@ -0,0 +1,36 @@ +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/sample/pages/testcases/expected/new-01-expected.js b/compiler/sample/pages/testcases/expected/new-01-expected.js new file mode 100644 index 0000000000000000000000000000000000000000..68c475807c92a9d8c5f2c1e60b11b0b52d5cf394 --- /dev/null +++ b/compiler/sample/pages/testcases/expected/new-01-expected.js @@ -0,0 +1,10 @@ +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/sample/pages/testcases/expected/new-02-expected.js b/compiler/sample/pages/testcases/expected/new-02-expected.js new file mode 100644 index 0000000000000000000000000000000000000000..68c475807c92a9d8c5f2c1e60b11b0b52d5cf394 --- /dev/null +++ b/compiler/sample/pages/testcases/expected/new-02-expected.js @@ -0,0 +1,10 @@ +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/sample/pages/testcases/expected/new-03-expected.js b/compiler/sample/pages/testcases/expected/new-03-expected.js new file mode 100644 index 0000000000000000000000000000000000000000..4f153f34b13189530a6e242ff82ec80ffb8dbfd3 --- /dev/null +++ b/compiler/sample/pages/testcases/expected/new-03-expected.js @@ -0,0 +1,15 @@ +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/sample/pages/testcases/expected/new-04-expected.js b/compiler/sample/pages/testcases/expected/new-04-expected.js new file mode 100644 index 0000000000000000000000000000000000000000..4f153f34b13189530a6e242ff82ec80ffb8dbfd3 --- /dev/null +++ b/compiler/sample/pages/testcases/expected/new-04-expected.js @@ -0,0 +1,15 @@ +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/sample/pages/testcases/expected/struct-01-expected.js b/compiler/sample/pages/testcases/expected/struct-01-expected.js new file mode 100644 index 0000000000000000000000000000000000000000..8df48157ba1d981fa2a00133569a080fde1bf3b9 --- /dev/null +++ b/compiler/sample/pages/testcases/expected/struct-01-expected.js @@ -0,0 +1,6 @@ +class MyComponent extends View { + render() { + } + constructor() { super(); } +} +loadDocument(new MyComponent()); diff --git a/compiler/sample/pages/testcases/expected/struct-02-expected.js b/compiler/sample/pages/testcases/expected/struct-02-expected.js new file mode 100644 index 0000000000000000000000000000000000000000..a9ba8932dcf2f4afbc116d1519df79962a74720e --- /dev/null +++ b/compiler/sample/pages/testcases/expected/struct-02-expected.js @@ -0,0 +1,4 @@ +class MyComponent { + build() { + } +} diff --git a/compiler/sample/pages/testcases/forEachComplexModel.ets b/compiler/sample/pages/testcases/forEachComplexModel.ets new file mode 100644 index 0000000000000000000000000000000000000000..64ad0c5046b615f6a9df4b4ec0a7a8439e7040db --- /dev/null +++ b/compiler/sample/pages/testcases/forEachComplexModel.ets @@ -0,0 +1,47 @@ +// 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/sample/pages/testcases/forEachSimpleModel.ets b/compiler/sample/pages/testcases/forEachSimpleModel.ets new file mode 100644 index 0000000000000000000000000000000000000000..f98c4e704a78f3f7cd0145fb83915fc4ff505e84 --- /dev/null +++ b/compiler/sample/pages/testcases/forEachSimpleModel.ets @@ -0,0 +1,43 @@ +@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/sample/pages/testcases/image.ets b/compiler/sample/pages/testcases/image.ets new file mode 100644 index 0000000000000000000000000000000000000000..1fc8380654d797295abef6207eb1092a32323ba5 --- /dev/null +++ b/compiler/sample/pages/testcases/image.ets @@ -0,0 +1,18 @@ +@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/sample/pages/testcases/import-api-01.ets b/compiler/sample/pages/testcases/import-api-01.ets new file mode 100644 index 0000000000000000000000000000000000000000..2256c7e58601be023750fec011a0afb5b92cf204 --- /dev/null +++ b/compiler/sample/pages/testcases/import-api-01.ets @@ -0,0 +1,21 @@ +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/sample/pages/testcases/link-01.ets b/compiler/sample/pages/testcases/link-01.ets new file mode 100644 index 0000000000000000000000000000000000000000..55ffc8ca530a694eb33b01756195f78b286dd801 --- /dev/null +++ b/compiler/sample/pages/testcases/link-01.ets @@ -0,0 +1,36 @@ +@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/sample/pages/testcases/linkArrayModel.ets b/compiler/sample/pages/testcases/linkArrayModel.ets new file mode 100644 index 0000000000000000000000000000000000000000..45a1d9ccfac971082df8e997acab8f126c722b07 --- /dev/null +++ b/compiler/sample/pages/testcases/linkArrayModel.ets @@ -0,0 +1,32 @@ +@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/sample/pages/testcases/linkPropCombo.ets b/compiler/sample/pages/testcases/linkPropCombo.ets new file mode 100644 index 0000000000000000000000000000000000000000..7c689737d28d1be8f8680a869544fb6e5e9a78b8 --- /dev/null +++ b/compiler/sample/pages/testcases/linkPropCombo.ets @@ -0,0 +1,33 @@ +@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/sample/pages/testcases/linkSimpleModel.ets b/compiler/sample/pages/testcases/linkSimpleModel.ets new file mode 100644 index 0000000000000000000000000000000000000000..bf2ccc351bf40febb5f4a503fe2f0dcc40871dbb --- /dev/null +++ b/compiler/sample/pages/testcases/linkSimpleModel.ets @@ -0,0 +1,25 @@ +@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/sample/pages/testcases/new-01.ets b/compiler/sample/pages/testcases/new-01.ets new file mode 100644 index 0000000000000000000000000000000000000000..235c5dd3f751559c48e8d6b68f474bb5b14d8d73 --- /dev/null +++ b/compiler/sample/pages/testcases/new-01.ets @@ -0,0 +1,15 @@ +@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/sample/pages/testcases/new-0101.ets b/compiler/sample/pages/testcases/new-0101.ets new file mode 100644 index 0000000000000000000000000000000000000000..235c5dd3f751559c48e8d6b68f474bb5b14d8d73 --- /dev/null +++ b/compiler/sample/pages/testcases/new-0101.ets @@ -0,0 +1,15 @@ +@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/sample/pages/testcases/new-02.ets b/compiler/sample/pages/testcases/new-02.ets new file mode 100644 index 0000000000000000000000000000000000000000..ea285c94ff09bc9ca5a19dd2231380a43946a93f --- /dev/null +++ b/compiler/sample/pages/testcases/new-02.ets @@ -0,0 +1,15 @@ +@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/sample/pages/testcases/new-03.ets b/compiler/sample/pages/testcases/new-03.ets new file mode 100644 index 0000000000000000000000000000000000000000..fa0bc708c9c6dbbd681864a869b78fe7bcaaf9aa --- /dev/null +++ b/compiler/sample/pages/testcases/new-03.ets @@ -0,0 +1,23 @@ +@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/sample/pages/testcases/new-04.ets b/compiler/sample/pages/testcases/new-04.ets new file mode 100644 index 0000000000000000000000000000000000000000..73e6fff351673a89e14cdd08db640e0b50d9ed1c --- /dev/null +++ b/compiler/sample/pages/testcases/new-04.ets @@ -0,0 +1,23 @@ +@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/sample/pages/testcases/onclicktest.ets b/compiler/sample/pages/testcases/onclicktest.ets new file mode 100644 index 0000000000000000000000000000000000000000..2a11f36ed4acb1a59f33e9bc5d372ce1ef2c09a9 --- /dev/null +++ b/compiler/sample/pages/testcases/onclicktest.ets @@ -0,0 +1,41 @@ + +@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/sample/pages/testcases/propSimpleModel.ets b/compiler/sample/pages/testcases/propSimpleModel.ets new file mode 100644 index 0000000000000000000000000000000000000000..5c1569bfc653f1be8838d007f2ca0c5649a75c56 --- /dev/null +++ b/compiler/sample/pages/testcases/propSimpleModel.ets @@ -0,0 +1,47 @@ +@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/sample/pages/testcases/showcaseCovid19.ets b/compiler/sample/pages/testcases/showcaseCovid19.ets new file mode 100644 index 0000000000000000000000000000000000000000..b92d5a3cd31d7d71fae704932413a43eecb67758 --- /dev/null +++ b/compiler/sample/pages/testcases/showcaseCovid19.ets @@ -0,0 +1,3561 @@ + + +/** + * 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, + + // 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/sample/pages/testcases/simpleText.ets b/compiler/sample/pages/testcases/simpleText.ets new file mode 100644 index 0000000000000000000000000000000000000000..2d93d031800386184d77976df1dcfe1f5609db37 --- /dev/null +++ b/compiler/sample/pages/testcases/simpleText.ets @@ -0,0 +1,68 @@ +@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/sample/pages/testcases/stacktestsuite.ets b/compiler/sample/pages/testcases/stacktestsuite.ets new file mode 100644 index 0000000000000000000000000000000000000000..dfc9fcfd5329e9baee439f199ccb38855f6ca735 --- /dev/null +++ b/compiler/sample/pages/testcases/stacktestsuite.ets @@ -0,0 +1,134 @@ + +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/sample/pages/testcases/stateArrayReverse.ets b/compiler/sample/pages/testcases/stateArrayReverse.ets new file mode 100644 index 0000000000000000000000000000000000000000..d6a8903e44075a6d07d6f55191a97bcc1591fb04 --- /dev/null +++ b/compiler/sample/pages/testcases/stateArrayReverse.ets @@ -0,0 +1,56 @@ + +/* + 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. + +*/ + +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/sample/pages/testcases/stateArrayReverseCustomView.ets b/compiler/sample/pages/testcases/stateArrayReverseCustomView.ets new file mode 100644 index 0000000000000000000000000000000000000000..5a1a8119cbb32c30a353042f7bb8593172192df1 --- /dev/null +++ b/compiler/sample/pages/testcases/stateArrayReverseCustomView.ets @@ -0,0 +1,78 @@ +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/sample/pages/testcases/stateComplexType.ets b/compiler/sample/pages/testcases/stateComplexType.ets new file mode 100644 index 0000000000000000000000000000000000000000..abbe5c6b224b450d68f9a05406d91c7298dc2ef6 --- /dev/null +++ b/compiler/sample/pages/testcases/stateComplexType.ets @@ -0,0 +1,46 @@ +// 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/sample/pages/testcases/stateStateBindingProp.ets b/compiler/sample/pages/testcases/stateStateBindingProp.ets new file mode 100644 index 0000000000000000000000000000000000000000..d2ab7f71009dc46f3f25a0f6fa4db21859d443a1 --- /dev/null +++ b/compiler/sample/pages/testcases/stateStateBindingProp.ets @@ -0,0 +1,91 @@ +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/sample/pages/testcases/struct-01.ets b/compiler/sample/pages/testcases/struct-01.ets new file mode 100644 index 0000000000000000000000000000000000000000..0c8c1b7892eb3b94624ec3813dde50efa62bd539 --- /dev/null +++ b/compiler/sample/pages/testcases/struct-01.ets @@ -0,0 +1,6 @@ +@Component +@Entry +struct MyComponent7 { + build() { + } +} \ No newline at end of file diff --git a/compiler/sample/pages/testcases/struct-02.ets b/compiler/sample/pages/testcases/struct-02.ets new file mode 100644 index 0000000000000000000000000000000000000000..ee57c9cde71ef7fb63e4f028d23506e74790ffa4 --- /dev/null +++ b/compiler/sample/pages/testcases/struct-02.ets @@ -0,0 +1,4 @@ +struct MyComponent8 { + build() { + } +} \ No newline at end of file diff --git a/compiler/sample/pages/todo.ets b/compiler/sample/pages/todo.ets new file mode 100644 index 0000000000000000000000000000000000000000..f1b21f224a59140f5aca7560d5f538bfe8e4d71b --- /dev/null +++ b/compiler/sample/pages/todo.ets @@ -0,0 +1,162 @@ + +/** + * 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" }, + { 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/src/compile_info.ts b/compiler/src/compile_info.ts new file mode 100644 index 0000000000000000000000000000000000000000..80fbe1a464a351a9d5f0844af8ca479fad636e09 --- /dev/null +++ b/compiler/src/compile_info.ts @@ -0,0 +1,219 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT 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 +} 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.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', compilation => { + compilation.hooks.additionalAssets.tapAsync('Collect Components', callback => { + compilation.assets['./component_collection.txt'] = + new RawSource(Array.from(appComponentCollection).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 { + logger.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/src/component_map.ts b/compiler/src/component_map.ts new file mode 100644 index 0000000000000000000000000000000000000000..0c1e26ab670154cde3f33cf719863bf5699e289b --- /dev/null +++ b/compiler/src/component_map.ts @@ -0,0 +1,351 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT 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 = { + 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, + attrs: [ + 'state', 'duration', 'curve', 'delay', 'fillMode', 'iterations', 'playMode', 'motion', 'onStart', + 'onPause', 'onRepeat', 'onCancel', 'onFinish', 'onFrame' + ] + }, + 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' + ] + }, + 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'] + }, + 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'] + }, + Swiper: { + attrs: [ + 'index', 'autoPlay', 'interval', 'indicator', + 'loop', 'duration', 'vertical', 'itemSpace', 'onChange' + ] + }, + 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' + ] + }, + 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: [ + 'initialIndex', 'vertical', 'scrollable', 'barMode', 'barWidth', 'barHeight', 'animationDuration', + 'onChange' + ] + }, + TabContent: { + parents: ['Tabs'], + attrs: ['tabBar'] + }, + PageTransitionEnter: { + atomic: true, + attrs: ['onEnter'] + }, + PageTransitionExit: { + atomic: true, + attrs: ['onExit'] + }, + Blank: { + parents: ['Row', 'Column'], + automic: true, + attrs: ['color'] + }, + RowSplit: { + attrs: ['resizeable'] + }, + ColumnSplit: { + attrs: ['resizeable'] + }, + Toggle: { + attrs: ['onChange', 'selectedColor', 'swithPointStyle'] + }, + AlertDialog: { + 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', 'iteamSize', 'font', 'color', 'alignStyle' + ] + }, + Radio: { + atomic: true, + attrs: ['checked', 'onChange'] + }, + 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'] + }, +}; + +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', + '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' +]); +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']); + +export const INNER_COMPONENT_NAMES: 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(); + +(function initComponent() { + Object.keys(COMPONENT_MAP).forEach((componentName) => { + INNER_COMPONENT_NAMES.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); + }); + } + }); +})(); diff --git a/compiler/src/create.ts b/compiler/src/create.ts new file mode 100644 index 0000000000000000000000000000000000000000..c7e0c9cb939aabdd5485cd633a327e979bb9fcd6 --- /dev/null +++ b/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/src/gen_abc_plugin.ts b/compiler/src/gen_abc_plugin.ts new file mode 100644 index 0000000000000000000000000000000000000000..9041ed22c01dd6a459ca7ce6737224eb3d87d801 --- /dev/null +++ b/compiler/src/gen_abc_plugin.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. + */ + +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 pandaDir: string = path.join(__dirname, '..', 'bin', 'panda'); + +const forward: string = '(global.___mainEntry___ = function (globalObjects) {' + '\n' + + ' var define = globalObjects.define;' + '\n' + + ' var require = globalObjects.require;' + '\n' + + ' var bootstrap = globalObjects.bootstrap;' + '\n' + + ' var register = globalObjects.register;' + '\n' + + ' var render = globalObjects.render;' + '\n' + + ' var $app_define$ = globalObjects.$app_define$;' + '\n' + + ' var $app_bootstrap$ = globalObjects.$app_bootstrap$;' + '\n' + + ' var $app_require$ = globalObjects.$app_require$;' + '\n' + + ' var history = globalObjects.history;' + '\n' + + ' var Image = globalObjects.Image;' + '\n' + + ' (function(global) {' + '\n' + + ' "use strict";' + '\n'; +const last: string = '\n' + '})(this.__appProto__);' + '\n' + '})'; +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, 'panda/build-win'))) { + isWin = true; + } else { + if (fs.existsSync(path.resolve(webpackPath, 'panda/build-mac'))) { + isMac = true; + } else { + if (!fs.existsSync(path.resolve(webpackPath, 'panda/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 = forward + compilation.assets[key].source() + last; + 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)) { + ts2abcFirst(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 ts2abcFirst(inputPath: string): void { + let param: string = '-r'; + if (isDebug) { + param += ' --debug'; + } + + let ts2abc: string = path.join(pandaDir, 'build', 'src', 'index.js'); + if (isWin) { + ts2abc = path.join(pandaDir, 'build-win', 'src', 'index.js'); + } else if (isMac) { + ts2abc = path.join(pandaDir, 'build-mac', 'src', 'index.js'); + } + + const cmd: string = `node --expose-gc "${ts2abc}" "${inputPath}" ${param}`; + + try { + logger.info(blue, `ETS:INFO ${cmd}`, reset, '\n'); + 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/src/pre_define.ts b/compiler/src/pre_define.ts new file mode 100644 index 0000000000000000000000000000000000000000..fe9eb240892681d1b460c83adc379334731ce558 --- /dev/null +++ b/compiler/src/pre_define.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 NATIVE_MODULE: Set = new Set(['app', 'router', 'curves', '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 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_TYPE = { + color: 10001, + float: 10002, + string: 10003, + plural: 10004, + media: 20000 +}; + +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/src/pre_process.ts b/compiler/src/pre_process.ts new file mode 100644 index 0000000000000000000000000000000000000000..ce86a4c2a7de72666792da060b0f02919a4bad18 --- /dev/null +++ b/compiler/src/pre_process.ts @@ -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. + */ + +import { + sourceReplace, + validateUISyntax +} 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; + const newContent: string = sourceReplace(source); + const log: LogInfo[] = + validateUISyntax(source, newContent, this.resourcePath, this.resourceQuery); + if (log.length) { + emitLogInfo(this, log); + } + + return newContent; +} + +module.exports = preProcess; diff --git a/compiler/src/process_component_build.ts b/compiler/src/process_component_build.ts new file mode 100644 index 0000000000000000000000000000000000000000..c8a37eb4c29199d3ce55b859ab3700aea92b62e8 --- /dev/null +++ b/compiler/src/process_component_build.ts @@ -0,0 +1,690 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT 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 +} 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)) { + switch (getComponentType(item, log)) { + case ComponentType.innerComponent: + processInnerComponent(item, index, Array.from(node.statements), newStatements, log); + 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[]): void { + const res: CreateResult = createComponent(node, COMPONENT_CREATE_FUNCTION); + newStatements.push(res.newNode); + if (projectConfig.isPreview) { + const posOfNode: ts.LineAndCharacter = + transformLog.sourceFile.getLineAndCharacterOfPosition(node.getStart()); + 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 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[]): ComponentType { + const name: string = getName(node); + 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/src/process_component_class.ts b/compiler/src/process_component_class.ts new file mode 100644 index 0000000000000000000000000000000000000000..9fa5dfe02a870035f9114b40671dddff4e48c77e --- /dev/null +++ b/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); + 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); +} + +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; +} + +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/src/process_component_constructor.ts b/compiler/src/process_component_constructor.ts new file mode 100644 index 0000000000000000000000000000000000000000..c963af058d8c16ba8ac9d120f09af38eb4b39ade --- /dev/null +++ b/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/src/process_component_member.ts b/compiler/src/process_component_member.ts new file mode 100644 index 0000000000000000000000000000000000000000..f21635926b881123a9b930fa70bf4341020ae44e --- /dev/null +++ b/compiler/src/process_component_member.ts @@ -0,0 +1,885 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT 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'; + +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): 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)])); + 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); + } + 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): 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); + } + } + if (stateManagementDecoratorCount > 1) { + validateMultiDecorators(name, log); + return; + } +} + +function processStateDecorators(node: ts.PropertyDeclaration, decorator: string, + updateResult: UpdateResult, ctorNode: ts.ConstructorDeclaration, log: LogInfo[], + program: ts.Program): 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); + 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): 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); + 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[]): ts.ExpressionStatement { + const init: ts.Expression = processCustomDialogController(node, log); + 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/src/process_custom_component.ts b/compiler/src/process_custom_component.ts new file mode 100644 index 0000000000000000000000000000000000000000..163e8cbb3a3099176067d3c08cdcf7e6ea54e2be --- /dev/null +++ b/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/src/process_import.ts b/compiler/src/process_import.ts new file mode 100644 index 0000000000000000000000000000000000000000..47197ffa51a5f0ebc15c0174c982af649d2d6b16 --- /dev/null +++ b/compiler/src/process_import.ts @@ -0,0 +1,272 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT 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, + COMPONENT_DECORATOR_NAME_COMPONENT +} from './pre_define'; +import { + propertyCollection, + linkCollection, + componentCollection, + preprocessExtend, + preprocessNewExtend, + processSystemApi, + propCollection, + isObservedClass, + observedClassCollection, + enumCollection, + getComponentSet, + IComponentSet +} from './validate_ui_syntax'; +import { LogInfo } from './utils'; + +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); + } + if (fs.existsSync(fileResolvePath) && fs.statSync(fileResolvePath).isFile()) { + const content: string = preprocessNewExtend(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} `); + })))); + 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 (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) && + decoratorName.escapedText.toString() === COMPONENT_DECORATOR_NAME_COMPONENT) { + 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): string { + const moduleFilePath: string = getModuleFilePath(filePath); + const defaultModule: string = path.join(pagesDir, '../', moduleFilePath); + if (fs.existsSync(defaultModule)) { + return defaultModule; + } + const entryModule: string = path.join(pagesDir, '../../../../../../', 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/src/process_ui_syntax.ts b/compiler/src/process_ui_syntax.ts new file mode 100644 index 0000000000000000000000000000000000000000..b2012a7fac4ca051e2e6eb92e58242e758de4825 --- /dev/null +++ b/compiler/src/process_ui_syntax.ts @@ -0,0 +1,371 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT 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 +} 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, + INNER_COMPONENT_NAMES +} from './component_map'; +import { resources } from '../main'; + +export const transformLog: FileLog = new FileLog(); + +export function processUISyntax(program: ts.Program): 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 (path.basename(node.fileName) === 'app.ets.ts') { + 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 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 (INNER_COMPONENT_NAMES.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.arguments.length > 0; +} + +function processResourceData(node: ts.CallExpression): ts.Node { + if (ts.isStringLiteral(node.arguments[0])) { + // @ts-ignore + const resourceData: string[] = node.arguments[0].text.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]]; + const argsArr: ts.Expression[] = Array.from(node.arguments); + argsArr.splice(0, 1, ts.factory.createNumericLiteral(resourceValue), + ts.factory.createNumericLiteral(resourceType)); + return ts.factory.updateCallExpression(node, node.expression, node.typeArguments, argsArr); + } + } + return node; +} + +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/src/process_worker.ts b/compiler/src/process_worker.ts new file mode 100644 index 0000000000000000000000000000000000000000..56489fdbc973fb88ce49ea1d03d76495cc7dd729 --- /dev/null +++ b/compiler/src/process_worker.ts @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT 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 processWorker(source: string): string { + if (/workers/.test(this.resourcePath)) { + return processSystemApi(source); + } + return source; +}; diff --git a/compiler/src/result_process.ts b/compiler/src/result_process.ts new file mode 100644 index 0000000000000000000000000000000000000000..1d70cfe0fd4ff63374d8300c894ebb84f15390c1 --- /dev/null +++ b/compiler/src/result_process.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. + */ + +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'; + +module.exports = function resultProcess(source: string, map: any): string { + process.env.compiler = BUILD_OFF; + 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(); + } + if (path.basename(this.resourcePath) === 'app.ets') { + source = source.replace(/exports\.default/, 'globalThis.exports.default'); + } + + this.callback(null, source, map); + return; +}; diff --git a/compiler/src/utils.ts b/compiler/src/utils.ts new file mode 100644 index 0000000000000000000000000000000000000000..943c1aa7f6e5ec74c5a65e7e4299ac19c2edc9c0 --- /dev/null +++ b/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/src/validate_ui_syntax.ts b/compiler/src/validate_ui_syntax.ts new file mode 100644 index 0000000000000000000000000000000000000000..6cd1e67f56fe4595abf8da2e0ba9ead3d1ea1cdf --- /dev/null +++ b/compiler/src/validate_ui_syntax.ts @@ -0,0 +1,749 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT 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'; + +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 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) && /struct/.test(item.getText())) { + const message: string = `Please use a valid decorator.`; + addLog(LogType.ERROR, message, item.getStart(), log, sourceFile); + } + }); + validateEntryCount(result, fileQuery, sourceFile.fileName, log); + validatePreviewCount(result, 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 must have one and only one '@Entry' decorator with a struct.`, + fileName: fileName + }); + } +} + +function validatePreviewCount(result: DecoratorResult, fileName: string, log: LogInfo[]): void { + if (result.previewCount > 1) { + log.push({ + type: LogType.ERROR, + message: `A page can have at most one '@Preview' 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; +} + +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); + } +} + +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) && + !isForEachComponent(item.expression) && isComponent(item.expression, allComponentNames)) { + maxCount += 1; + if (i + 1 < length && ts.isBlock(blockNode.statements[i + 1])) { + ++i; + } + } + 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) && + !isForEachComponent(item.expression) && isComponent(item.expression, allComponentNames)) { + const isNonspecific: boolean = + isNonspecificChildNonForEach(item.expression, specificChildSet); + if (isNonspecific) { + return isNonspecific; + } + if (i + 1 < length && ts.isBlock(blockNode.statements[i + 1])) { + ++i; + } + } + } + } + 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 function sourceReplace(source: string): string { + let content: string = source; + + // 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); + content = preprocessNewExtend(content); + // process @system. + content = processSystemApi(content); + + return content; +} + +export function preprocessExtend(content: string): string { + const REG_EXTEND: RegExp = /(? { + collectExtend(item3, item4, item6); + return `${item1}${COMPONENT_EXTEND_DECORATOR} function${item2}__${item3}__${item4}${item5}${item6}${item7}${item3}`; + }); +} + +export function preprocessNewExtend(content: string): string { + const REG_EXTEND: RegExp = /(? { + collectExtend(item2, item5, item7); + return `${item1}${COMPONENT_EXTEND_DECORATOR}${item3}function${item4}__${item2}__${item5}${item6}${item7}${item8}${item2}`; + }); +} + +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; + if (NATIVE_MODULE.has(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/test/README.md b/compiler/test/README.md new file mode 100644 index 0000000000000000000000000000000000000000..8cb5288c54cd0a524ac9ef65ede22bd9febe5a13 --- /dev/null +++ b/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/test/pages/AMDComponent.ets b/compiler/test/pages/AMDComponent.ets new file mode 100644 index 0000000000000000000000000000000000000000..ab714803e55a7d73f9bc43debbeab19b0fd4f844 --- /dev/null +++ b/compiler/test/pages/AMDComponent.ets @@ -0,0 +1,16 @@ +@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/test/pages/DefaultComponent.ets b/compiler/test/pages/DefaultComponent.ets new file mode 100644 index 0000000000000000000000000000000000000000..94c842e7a0d22aaf4bbbe51638286c796970807b --- /dev/null +++ b/compiler/test/pages/DefaultComponent.ets @@ -0,0 +1,16 @@ +@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/test/pages/ExportComponent.ets b/compiler/test/pages/ExportComponent.ets new file mode 100644 index 0000000000000000000000000000000000000000..c8332c7f6dc3aa1a17bed7e9f648270e03472b0f --- /dev/null +++ b/compiler/test/pages/ExportComponent.ets @@ -0,0 +1,103 @@ +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/test/pages/ExportStarComponent.ets b/compiler/test/pages/ExportStarComponent.ets new file mode 100644 index 0000000000000000000000000000000000000000..ada6303134ea7f88014baeeb65b0ec777900a49a --- /dev/null +++ b/compiler/test/pages/ExportStarComponent.ets @@ -0,0 +1 @@ +export * as AllStarComponent from './test/pages/ExportComponent'; diff --git a/compiler/test/pages/LinkComponent.ets b/compiler/test/pages/LinkComponent.ets new file mode 100644 index 0000000000000000000000000000000000000000..1357500ba993e32068b1aead74541d300de1f5fa --- /dev/null +++ b/compiler/test/pages/LinkComponent.ets @@ -0,0 +1,105 @@ +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/test/pages/NamespaceComponent.ets b/compiler/test/pages/NamespaceComponent.ets new file mode 100644 index 0000000000000000000000000000000000000000..5f3b3e87a950633c0064aeda69933e2d0b800d12 --- /dev/null +++ b/compiler/test/pages/NamespaceComponent.ets @@ -0,0 +1,48 @@ +@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/test/pages/TsModule.ts b/compiler/test/pages/TsModule.ts new file mode 100644 index 0000000000000000000000000000000000000000..7faca616e352368eec75997457ff09286ebc520d --- /dev/null +++ b/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/test/test.ts b/compiler/test/test.ts new file mode 100644 index 0000000000000000000000000000000000000000..5ada0239a6ffa39d763245ea5151e0a4b3d082de --- /dev/null +++ b/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)] } + }); + 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/test/ut/animation/animation.ts b/compiler/test/ut/animation/animation.ts new file mode 100644 index 0000000000000000000000000000000000000000..a2cad53bef5e40332a5475763a120dea6f0f50b3 --- /dev/null +++ b/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/test/ut/build/build.ts b/compiler/test/ut/build/build.ts new file mode 100644 index 0000000000000000000000000000000000000000..65bb964d42cbb0da5d042a4915c707443bf75d43 --- /dev/null +++ b/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/test/ut/component/component.ts b/compiler/test/ut/component/component.ts new file mode 100644 index 0000000000000000000000000000000000000000..9b46eb74911cb70e292f506a6e7a4b9595a01eb5 --- /dev/null +++ b/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/test/ut/component/customComponent.ts b/compiler/test/ut/component/customComponent.ts new file mode 100644 index 0000000000000000000000000000000000000000..8a8fd15169de39fbe80d7b599a9bd8aa193bb8c6 --- /dev/null +++ b/compiler/test/ut/component/customComponent.ts @@ -0,0 +1,156 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT 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/test/ut/constructor/id.ts b/compiler/test/ut/constructor/id.ts new file mode 100644 index 0000000000000000000000000000000000000000..3a79203334c37a14350a200f6d5b69a385f8e00c --- /dev/null +++ b/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/test/ut/constructor/link.ts b/compiler/test/ut/constructor/link.ts new file mode 100644 index 0000000000000000000000000000000000000000..117c65802f796795d1de078bb3aff81ad96eb640 --- /dev/null +++ b/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/test/ut/constructor/observedObjectLink.ts b/compiler/test/ut/constructor/observedObjectLink.ts new file mode 100644 index 0000000000000000000000000000000000000000..1614e151290711b10b06fa669b66dcd8d9a6f8d5 --- /dev/null +++ b/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/test/ut/constructor/prop.ts b/compiler/test/ut/constructor/prop.ts new file mode 100644 index 0000000000000000000000000000000000000000..8765e74e5e5e1f87508d3ffabc3ec4fd20017ac6 --- /dev/null +++ b/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/test/ut/constructor/provideConsume.ts b/compiler/test/ut/constructor/provideConsume.ts new file mode 100644 index 0000000000000000000000000000000000000000..a8f884a1ee842d6e97cd67f2a391f9e313137169 --- /dev/null +++ b/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/test/ut/constructor/state.ts b/compiler/test/ut/constructor/state.ts new file mode 100644 index 0000000000000000000000000000000000000000..9f67c7c041835497c18105eb9a1163d6cddac16d --- /dev/null +++ b/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/test/ut/customDialog/customDialog.ts b/compiler/test/ut/customDialog/customDialog.ts new file mode 100644 index 0000000000000000000000000000000000000000..b57f513141cd1a59a3da84503ef89c62de28e1be --- /dev/null +++ b/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/test/ut/decorator/builder.ts b/compiler/test/ut/decorator/builder.ts new file mode 100644 index 0000000000000000000000000000000000000000..0bf64721d833dec0205b990f26acda3b95938043 --- /dev/null +++ b/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/test/ut/decorator/extend.ts b/compiler/test/ut/decorator/extend.ts new file mode 100644 index 0000000000000000000000000000000000000000..a8494672c8a9dd9ec59c62b652f404f482ca8a3e --- /dev/null +++ b/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/test/ut/decorator/watch.ts b/compiler/test/ut/decorator/watch.ts new file mode 100644 index 0000000000000000000000000000000000000000..90c2461944c1738d6175ff0611e71325d38681a0 --- /dev/null +++ b/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/test/ut/decorator/watchWithAnimateTo.ts b/compiler/test/ut/decorator/watchWithAnimateTo.ts new file mode 100644 index 0000000000000000000000000000000000000000..dc728962dd7a907c0878a36e925c2de17b9ce60d --- /dev/null +++ b/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/test/ut/geometryReader/geometryReader.ts b/compiler/test/ut/geometryReader/geometryReader.ts new file mode 100644 index 0000000000000000000000000000000000000000..e8b5b6c4fe0bcdadc94372f5f7441160d11fc4e4 --- /dev/null +++ b/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/test/ut/gesture/panGestrue.ts b/compiler/test/ut/gesture/panGestrue.ts new file mode 100644 index 0000000000000000000000000000000000000000..f558964a4b8a3833fec3bdd96cfadbba5f12f5aa --- /dev/null +++ b/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/test/ut/gesture/pinchGesture.ts b/compiler/test/ut/gesture/pinchGesture.ts new file mode 100644 index 0000000000000000000000000000000000000000..c85947f2b303c2f32fa4f01d186579e246387226 --- /dev/null +++ b/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/test/ut/gesture/rotationGesture.ts b/compiler/test/ut/gesture/rotationGesture.ts new file mode 100644 index 0000000000000000000000000000000000000000..87c0b76e9cab28a3f28438e7ee06827897b18c8b --- /dev/null +++ b/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/test/ut/gesture/tapGesture.ts b/compiler/test/ut/gesture/tapGesture.ts new file mode 100644 index 0000000000000000000000000000000000000000..4365532865e961b96607cb1c3f4e6e3222abdfe5 --- /dev/null +++ b/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/test/ut/import/importEts.ts b/compiler/test/ut/import/importEts.ts new file mode 100644 index 0000000000000000000000000000000000000000..783eb14a0bfdd5e366b97de371cee74d89848a7c --- /dev/null +++ b/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/test/ut/import/importSystemApi.ts b/compiler/test/ut/import/importSystemApi.ts new file mode 100644 index 0000000000000000000000000000000000000000..33f1646b18b51017600114147be4d1979d4517c0 --- /dev/null +++ b/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/test/ut/import/importTs.ts b/compiler/test/ut/import/importTs.ts new file mode 100644 index 0000000000000000000000000000000000000000..357302aecfc622376f80dbe694417bf880f01d22 --- /dev/null +++ b/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/test/ut/link/createLinkReference.ts b/compiler/test/ut/link/createLinkReference.ts new file mode 100644 index 0000000000000000000000000000000000000000..e9562301c442c391d893bba803b5ea2d75fc6217 --- /dev/null +++ b/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/test/ut/preview/previewDecorator.ts b/compiler/test/ut/preview/previewDecorator.ts new file mode 100644 index 0000000000000000000000000000000000000000..b1adbbbd44b64ce31a733577db5c9c1e33a8f67c --- /dev/null +++ b/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/test/ut/render/forEach/forEach01.ts b/compiler/test/ut/render/forEach/forEach01.ts new file mode 100644 index 0000000000000000000000000000000000000000..1f87b890404dd2e1d562068955bc3d74a2c47183 --- /dev/null +++ b/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/test/ut/render/forEach/forEach02.ts b/compiler/test/ut/render/forEach/forEach02.ts new file mode 100644 index 0000000000000000000000000000000000000000..4007051c15eeffbc290e62d1f6673cd693300905 --- /dev/null +++ b/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/test/ut/render/forEach/forEach03.ts b/compiler/test/ut/render/forEach/forEach03.ts new file mode 100644 index 0000000000000000000000000000000000000000..f3122986aa39930f026725a49e477894c73c6cd3 --- /dev/null +++ b/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/test/ut/render/forEach/forEach04.ts b/compiler/test/ut/render/forEach/forEach04.ts new file mode 100644 index 0000000000000000000000000000000000000000..586bd720492b3812dad5ced8c39d3040f07740e3 --- /dev/null +++ b/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/test/ut/render/forEach/forEachComplexModel.ts b/compiler/test/ut/render/forEach/forEachComplexModel.ts new file mode 100644 index 0000000000000000000000000000000000000000..5f5eb56d89e54a9cfa723e4c4332952e8e94f9a9 --- /dev/null +++ b/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/test/ut/render/forEach/forEachSimpleModel.ts b/compiler/test/ut/render/forEach/forEachSimpleModel.ts new file mode 100644 index 0000000000000000000000000000000000000000..92e66c9c1adf9c838f46bfc3fe98b663e0ade886 --- /dev/null +++ b/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/test/ut/render/if/if.ts b/compiler/test/ut/render/if/if.ts new file mode 100644 index 0000000000000000000000000000000000000000..38e086356c6ad83e3e9eb00cc982b854e272067a --- /dev/null +++ b/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/test/ut/render/if/ifIncludeForEach.ts b/compiler/test/ut/render/if/ifIncludeForEach.ts new file mode 100644 index 0000000000000000000000000000000000000000..becd794ee3e02ad52f1aa84d3b6ede7d42744117 --- /dev/null +++ b/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/test/ut/struct/struct_01.ts b/compiler/test/ut/struct/struct_01.ts new file mode 100644 index 0000000000000000000000000000000000000000..04d53f94bc54d8b8e632818697044721d40649cf --- /dev/null +++ b/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/test/ut/struct/struct_02.ts b/compiler/test/ut/struct/struct_02.ts new file mode 100644 index 0000000000000000000000000000000000000000..644ce3bb3e841fd7101470c467ba28bb8a201a2e --- /dev/null +++ b/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/test/ut/transition/transition.ts b/compiler/test/ut/transition/transition.ts new file mode 100644 index 0000000000000000000000000000000000000000..bae55792befe1424abf67bffbacb75c752fb36d6 --- /dev/null +++ b/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/tsconfig.json b/compiler/tsconfig.json new file mode 100644 index 0000000000000000000000000000000000000000..15ca7866fcfdb796ee13d487f7f0c644fda131b9 --- /dev/null +++ b/compiler/tsconfig.json @@ -0,0 +1,28 @@ +{ + "compileOnSave": false, + "compilerOptions": { + "allowSyntheticDefaultImports": true, + "esModuleInterop": true, + "noImplicitAny": false, + "noUnusedLocals": false, + "noUnusedParameters": false, + "experimentalDecorators": true, + "moduleResolution": "node", + "resolveJsonModule": true, + "sourceMap": true, + "module": "commonjs", + "target": "es2017", + "types": [ + "node" + ], + "typeRoots": [ + "./node_modules/@types" + ], + "lib": [ + "es2017" + ] + }, + "exclude": [ + "node_modules" + ] +} \ No newline at end of file diff --git a/compiler/webpack.config.js b/compiler/webpack.config.js new file mode 100644 index 0000000000000000000000000000000000000000..fe85894a61f9828a66c53431a913316ffcf10747 --- /dev/null +++ b/compiler/webpack.config.js @@ -0,0 +1,214 @@ +/* + * 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 +} = 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, + cache: { + type: 'filesystem' + }, + 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$/, + 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, path.join(projectPath, 'pages'))], + after: [] + }; + }, + ignoreDiagnostics: IGNORE_ERROR_CODE + } + }, + { loader: path.resolve(__dirname, 'lib/pre_process.js') } + ] + }, + { + test: /\.ts$/, + exclude: /node_modules/, + use: [ + { + loader: 'ts-loader', + options: { + onlyCompileBundledFiles: true, + configFile: path.resolve(__dirname, 'tsconfig.json'), + } + }, + { loader: path.resolve(__dirname, 'lib/process_worker.js') } + ] + }, + { + test: /\.js$/, + exclude: /node_modules/, + use: [ + { loader: path.resolve(__dirname, 'lib/process_worker.js') } + ] + } + ] + }, + node: { + global: false + }, + resolve: { + extensions:['.ts', '.ets', '.js'], + 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 CopyPlugin({ + patterns: [ + { + from: '**/*', + context: path.resolve(__dirname, projectConfig.projectPath), + globOptions: { + ignore: [ + '**/*.ets', + '**/*.ts', + '**/*.js', + path.resolve(__dirname, projectConfig.buildPath, '**').replace(/\\/g, '/') + ] + }, + noErrorOnMissing: true + }, + { from: projectConfig.manifestFilePath } + ] + }), + 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; + } +} + +module.exports = (env, argv) => { + const config = {}; + setProjectConfig(env); + loadEntryObj(projectConfig); + initConfig(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') { + const TerserPlugin = require('terser-webpack-plugin'); + config.mode = 'production'; + config.optimization = { + emitOnErrors: true, + usedExports: false, + minimize: true, + minimizer: [ + new TerserPlugin({ + minify: (file, sourceMap) => { + const uglifyEsOptions = { + compress: { + unused: true + }, + sourceMap: { + content: sourceMap + } + }; + if (/\/workers\//.test(Object.keys(file)[0])) { + uglifyEsOptions.compress.unused = false; + } + return require('uglify-es').minify(file, uglifyEsOptions); + }, + }), + ] + }; + config.output.sourceMapFilename = '_releaseMap/[name].js.map'; + } + + const appResourcePath = env.appResource || process.env.appResource; + if (appResourcePath) { + readAppResource(resources, appResourcePath); + } + return config; +} diff --git a/generateSysResource.py b/generateSysResource.py new file mode 100644 index 0000000000000000000000000000000000000000..95f0c0bf72b8cae3acb0662e99b88ed152ecfb59 --- /dev/null +++ b/generateSysResource.py @@ -0,0 +1,61 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +import json +import os +import argparse + + +class SysResource: + def __init__(self): + self.records = {} + self.json_records = None + + def read_json_file(self, json_file): + with open(os.path.join(json_file), 'r') as fp: + self.json_records = json.load(fp)["record"] + + def process_ids(self): + for item in self.json_records: + if ("flags" in item) and item["flags"].find("private") > -1: + continue + + item_type = item["type"] + if item_type != "color" \ + and item_type != "float" \ + and item_type != "media" \ + and item_type != "string" \ + and item_type != "plural": + continue + + item_name = item["name"] + item_id = item["order"] + 0x7000000 + if item_type not in self.records: + self.records[item_type] = dict() + self.records[item_type][item_name] = item_id + + def write_to_file(self, js_file): + context = "module.exports.sys = {\n" + for (item_type, dataset) in self.records.items(): + context += " " + item_type + ": {\n" + for (res_name, res_id) in dataset.items(): + context += " " + res_name + ": " + str(res_id) + ",\n" + # 移除最后一个多余的"," + context = context[:-2] + "\n" + context += " },\n" + # 移除最后一个多余的"," + context = context[:-2] + "\n" + context += "}\n" + with open(js_file, 'w+') as fp: + fp.write(context) + +if __name__ == "__main__": + parser = argparse.ArgumentParser() + parser.add_argument('--input-json', help='input path to id_defined.json') + parser.add_argument('--output-js', help='output path to sysResource.js') + options = parser.parse_args() + + processor = SysResource() + processor.read_json_file(options.input_json) + processor.process_ids() + processor.write_to_file(options.output_js) + diff --git a/prebuilts/babel.config.js b/prebuilts/babel.config.js new file mode 100644 index 0000000000000000000000000000000000000000..1c8aa70516ca7db5bda81d75107c87ef219eea50 --- /dev/null +++ b/prebuilts/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/prebuilts/build_declarations_file.js b/prebuilts/build_declarations_file.js new file mode 100644 index 0000000000000000000000000000000000000000..3b016b6364c1156db00f9cf6294c343c4d89e383 --- /dev/null +++ b/prebuilts/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/prebuilts/uglify-source.js b/prebuilts/uglify-source.js new file mode 100644 index 0000000000000000000000000000000000000000..0823ead66524970703a5b5b53b9e905b4e1757e6 --- /dev/null +++ b/prebuilts/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) +}