From bc1dea9cbf2047a33da01896afab1aac406e74db Mon Sep 17 00:00:00 2001 From: Ezio Li Date: Tue, 7 Feb 2023 02:15:35 +0000 Subject: [PATCH] Setup project test framework and add the first unit test (#393) * Add unit test * Update * Update validation pipeline task * Update * Update --- .ci/common-validation.yml | 9 +- .eslintignore | 1 + .eslintrc.json | 3 +- .gitignore | 3 +- package-lock.json | 1328 ++++++++++++-- package.json | 5 +- test/resources/options.json | 17 + test/resources/testSampleProject/config.xml | 11 + .../platforms/browser/browser.json | 11 + .../platforms/browser/config.xml | 11 + .../platforms/browser/cordova/Api.js | 531 ++++++ .../browser/cordova/browser_handler.js | 135 ++ .../browser/cordova/browser_parser.js | 120 ++ .../platforms/browser/cordova/build | 34 + .../platforms/browser/cordova/build.bat | 26 + .../platforms/browser/cordova/clean | 36 + .../platforms/browser/cordova/clean.bat | 26 + .../platforms/browser/cordova/defaults.xml | 22 + .../platforms/browser/cordova/lib/build.js | 37 + .../browser/cordova/lib/check_reqs.js | 27 + .../platforms/browser/cordova/lib/clean.js | 51 + .../platforms/browser/cordova/lib/run.js | 68 + .../platforms/browser/cordova/log | 20 + .../platforms/browser/cordova/run | 53 + .../platforms/browser/cordova/run.bat | 26 + .../platforms/browser/cordova/version | 25 + .../platforms/browser/cordova/version.bat | 26 + .../cordova-js-src/confighelper.js | 90 + .../platform_www/cordova-js-src/exec.js | 114 ++ .../platform_www/cordova-js-src/platform.js | 46 + .../platforms/browser/platform_www/cordova.js | 1594 +++++++++++++++++ .../browser/platform_www/favicon.ico | Bin 0 -> 1150 bytes .../browser/platform_www/manifest.json | 24 + .../platforms/browser/www/config.xml | 11 + .../www/cordova-js-src/confighelper.js | 90 + .../browser/www/cordova-js-src/exec.js | 114 ++ .../browser/www/cordova-js-src/platform.js | 46 + .../platforms/browser/www/cordova.js | 1594 +++++++++++++++++ .../platforms/browser/www/css/index.css | 110 ++ .../platforms/browser/www/favicon.ico | Bin 0 -> 1150 bytes .../platforms/browser/www/img/logo.png | Bin 0 -> 21814 bytes .../platforms/browser/www/index.html | 50 + .../platforms/browser/www/js/index.js | 29 + .../platforms/browser/www/manifest.json | 11 + .../testSampleProject/www/css/index.css | 110 ++ .../testSampleProject/www/img/logo.png | Bin 0 -> 21814 bytes .../testSampleProject/www/index.html | 50 + .../testSampleProject/www/js/index.js | 29 + test/simulator.test.js | 17 + 49 files changed, 6627 insertions(+), 164 deletions(-) create mode 100644 test/resources/options.json create mode 100644 test/resources/testSampleProject/config.xml create mode 100644 test/resources/testSampleProject/platforms/browser/browser.json create mode 100644 test/resources/testSampleProject/platforms/browser/config.xml create mode 100644 test/resources/testSampleProject/platforms/browser/cordova/Api.js create mode 100644 test/resources/testSampleProject/platforms/browser/cordova/browser_handler.js create mode 100644 test/resources/testSampleProject/platforms/browser/cordova/browser_parser.js create mode 100755 test/resources/testSampleProject/platforms/browser/cordova/build create mode 100644 test/resources/testSampleProject/platforms/browser/cordova/build.bat create mode 100644 test/resources/testSampleProject/platforms/browser/cordova/clean create mode 100644 test/resources/testSampleProject/platforms/browser/cordova/clean.bat create mode 100644 test/resources/testSampleProject/platforms/browser/cordova/defaults.xml create mode 100644 test/resources/testSampleProject/platforms/browser/cordova/lib/build.js create mode 100644 test/resources/testSampleProject/platforms/browser/cordova/lib/check_reqs.js create mode 100644 test/resources/testSampleProject/platforms/browser/cordova/lib/clean.js create mode 100644 test/resources/testSampleProject/platforms/browser/cordova/lib/run.js create mode 100755 test/resources/testSampleProject/platforms/browser/cordova/log create mode 100755 test/resources/testSampleProject/platforms/browser/cordova/run create mode 100644 test/resources/testSampleProject/platforms/browser/cordova/run.bat create mode 100755 test/resources/testSampleProject/platforms/browser/cordova/version create mode 100644 test/resources/testSampleProject/platforms/browser/cordova/version.bat create mode 100644 test/resources/testSampleProject/platforms/browser/platform_www/cordova-js-src/confighelper.js create mode 100644 test/resources/testSampleProject/platforms/browser/platform_www/cordova-js-src/exec.js create mode 100644 test/resources/testSampleProject/platforms/browser/platform_www/cordova-js-src/platform.js create mode 100644 test/resources/testSampleProject/platforms/browser/platform_www/cordova.js create mode 100644 test/resources/testSampleProject/platforms/browser/platform_www/favicon.ico create mode 100644 test/resources/testSampleProject/platforms/browser/platform_www/manifest.json create mode 100644 test/resources/testSampleProject/platforms/browser/www/config.xml create mode 100644 test/resources/testSampleProject/platforms/browser/www/cordova-js-src/confighelper.js create mode 100644 test/resources/testSampleProject/platforms/browser/www/cordova-js-src/exec.js create mode 100644 test/resources/testSampleProject/platforms/browser/www/cordova-js-src/platform.js create mode 100644 test/resources/testSampleProject/platforms/browser/www/cordova.js create mode 100644 test/resources/testSampleProject/platforms/browser/www/css/index.css create mode 100644 test/resources/testSampleProject/platforms/browser/www/favicon.ico create mode 100644 test/resources/testSampleProject/platforms/browser/www/img/logo.png create mode 100644 test/resources/testSampleProject/platforms/browser/www/index.html create mode 100644 test/resources/testSampleProject/platforms/browser/www/js/index.js create mode 100644 test/resources/testSampleProject/platforms/browser/www/manifest.json create mode 100644 test/resources/testSampleProject/www/css/index.css create mode 100644 test/resources/testSampleProject/www/img/logo.png create mode 100644 test/resources/testSampleProject/www/index.html create mode 100644 test/resources/testSampleProject/www/js/index.js create mode 100644 test/simulator.test.js diff --git a/.ci/common-validation.yml b/.ci/common-validation.yml index a828a83f..2d4ba981 100644 --- a/.ci/common-validation.yml +++ b/.ci/common-validation.yml @@ -1,8 +1,8 @@ steps: - task: NodeTool@0 - displayName: "Use Node 10.x" + displayName: "Use Node 16.x" inputs: - versionSpec: 10.x + versionSpec: 16.x - bash: npm install gulp -g --force displayName: "npm install gulp -g" @@ -12,3 +12,8 @@ steps: - bash: gulp displayName: "gulp default" + + - bash: "npm run test --verbose" + displayName: "Run unit tests" + env: + DISPLAY: ":99.0" diff --git a/.eslintignore b/.eslintignore index edfc8389..bf249e5d 100644 --- a/.eslintignore +++ b/.eslintignore @@ -4,3 +4,4 @@ src/plugins/cordova-plugin-device-motion/draw.js src/plugins/cordova-plugin-globalization/accounting.js src/plugins/cordova-plugin-globalization/moment.js src/third-party/**/*.js +test/resources diff --git a/.eslintrc.json b/.eslintrc.json index 785fa5ca..4ff8f74d 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -16,6 +16,7 @@ "comma-spacing": ["error", { "before": false, "after": true }], "key-spacing": ["error", { "beforeColon": false }], "no-prototype-builtins": "off", - "no-redeclare": ["error", { "builtinGlobals": false }] + "no-redeclare": ["error", { "builtinGlobals": false }], + "no-undef": "warn" } } diff --git a/.gitignore b/.gitignore index 53daa650..1e1a46c3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ node_modules /.idea/ .DS_Store -.vscode \ No newline at end of file +.vscode +test/resources/testSampleProject/simulation \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 60d32a86..de087c81 100644 --- a/package-lock.json +++ b/package-lock.json @@ -28,12 +28,14 @@ "simulate": "bin/simulate" }, "devDependencies": { + "@types/mocha": "^10.0.1", "@xmldom/xmldom": "^0.8.3", "gulp": "^4.0.2", "gulp-eslint": "^6.0.0", "gulp-jsonlint": "^1.3.2", "husky": "^8.0.2", "in-publish": "^2.0.0", + "mocha": "^10.2.0", "mstranslator": "^3.0.0", "parse5": "^2.2.1", "pretty-data": "^0.40.0" @@ -116,6 +118,12 @@ "node": ">=4" } }, + "node_modules/@types/mocha": { + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-10.0.1.tgz", + "integrity": "sha512-/fvYntiO1GeICvqbQ3doGDIP97vWmvFt83GKguJ6prmQM2iXZfFcq6YE8KteFyRtX2/h5Hf91BYvPodJKFYv5Q==", + "dev": true + }, "node_modules/@xmldom/xmldom": { "version": "0.8.4", "resolved": "https://registry.npmjs.org/@xmldom/xmldom/-/xmldom-0.8.4.tgz", @@ -830,6 +838,12 @@ "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.1.7.tgz", "integrity": "sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs=" }, + "node_modules/browser-stdout": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", + "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", + "dev": true + }, "node_modules/browserify": { "version": "16.2.3", "resolved": "https://registry.npmjs.org/browserify/-/browserify-16.2.3.tgz", @@ -1075,29 +1089,35 @@ "dev": true }, "node_modules/chokidar": { - "version": "3.4.2", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.4.2.tgz", - "integrity": "sha512-IZHaDeBeI+sZJRX7lGcXsdzgvZqKv6sECqsbErJA4mHWfpRrD8B97kSFN4cQz6nGBGiuFia1MKR4d6c1o8Cv7A==", + "version": "3.5.3", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", + "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==", + "funding": [ + { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + ], "dependencies": { - "anymatch": "~3.1.1", + "anymatch": "~3.1.2", "braces": "~3.0.2", - "glob-parent": "~5.1.0", + "glob-parent": "~5.1.2", "is-binary-path": "~2.1.0", "is-glob": "~4.0.1", "normalize-path": "~3.0.0", - "readdirp": "~3.4.0" + "readdirp": "~3.6.0" }, "engines": { "node": ">= 8.10.0" }, "optionalDependencies": { - "fsevents": "~2.1.2" + "fsevents": "~2.3.2" } }, "node_modules/chokidar/node_modules/anymatch": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.1.tgz", - "integrity": "sha512-mM8522psRCqzV+6LhomX5wgp25YVibjh8Wj23I5RPkPppSVSjyKD2A2mBJmWGa+KN7f2D6LNh9jkBCeyLktzjg==", + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", "dependencies": { "normalize-path": "^3.0.0", "picomatch": "^2.0.4" @@ -1888,6 +1908,15 @@ "node": ">=0.8.0" } }, + "node_modules/diff": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-5.0.0.tgz", + "integrity": "sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w==", + "dev": true, + "engines": { + "node": ">=0.3.1" + } + }, "node_modules/diffie-hellman": { "version": "5.0.3", "resolved": "http://registry.npmjs.org/diffie-hellman/-/diffie-hellman-5.0.3.tgz", @@ -2127,6 +2156,15 @@ "es6-symbol": "^3.1.1" } }, + "node_modules/escalade": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", + "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", + "dev": true, + "engines": { + "node": ">=6" + } + }, "node_modules/escape-html": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", @@ -3021,6 +3059,15 @@ "node": ">= 0.10" } }, + "node_modules/flat": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz", + "integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==", + "dev": true, + "bin": { + "flat": "cli.js" + } + }, "node_modules/flat-cache": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-2.0.1.tgz", @@ -3134,10 +3181,9 @@ "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" }, "node_modules/fsevents": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.1.3.tgz", - "integrity": "sha512-Auw9a4AxqWpa9GUfj370BMPzzyncfBABW8Mab7BGWBYDj4Isgq+cDKtx0i6u9jcX9pQDnswsaaOTgTmA5pEjuQ==", - "deprecated": "\"Please update to latest v2.3 or v2.2\"", + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", "hasInstallScript": true, "optional": true, "os": [ @@ -3179,9 +3225,9 @@ } }, "node_modules/glob": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", - "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", + "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", @@ -3192,6 +3238,9 @@ }, "engines": { "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" } }, "node_modules/glob-parent": { @@ -3656,6 +3705,15 @@ "minimalistic-assert": "^1.0.1" } }, + "node_modules/he": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", + "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", + "dev": true, + "bin": { + "he": "bin/he" + } + }, "node_modules/hmac-drbg": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", @@ -4207,6 +4265,15 @@ "node": ">=0.10.0" } }, + "node_modules/is-plain-obj": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz", + "integrity": "sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/is-plain-object": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", @@ -4243,6 +4310,18 @@ "node": ">=0.10.0" } }, + "node_modules/is-unicode-supported": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz", + "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/is-utf8": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz", @@ -4519,6 +4598,21 @@ "node": ">=0.10.0" } }, + "node_modules/locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dev": true, + "dependencies": { + "p-locate": "^5.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/lodash": { "version": "4.17.21", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", @@ -4530,6 +4624,92 @@ "resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-3.0.4.tgz", "integrity": "sha1-LcvSwofLwKVcxCMovQxzYVDVPj8=" }, + "node_modules/log-symbols": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz", + "integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==", + "dev": true, + "dependencies": { + "chalk": "^4.1.0", + "is-unicode-supported": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/log-symbols/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/log-symbols/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/log-symbols/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/log-symbols/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/log-symbols/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/log-symbols/node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/make-iterator": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/make-iterator/-/make-iterator-1.0.1.tgz", @@ -4784,105 +4964,445 @@ "mkdirp": "bin/cmd.js" } }, - "node_modules/module-deps": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/module-deps/-/module-deps-6.2.0.tgz", - "integrity": "sha512-hKPmO06so6bL/ZvqVNVqdTVO8UAYsi3tQWlCa+z9KuWhoN4KDQtb5hcqQQv58qYiDE21wIvnttZEPiDgEbpwbA==", - "dependencies": { - "browser-resolve": "^1.7.0", - "cached-path-relative": "^1.0.0", - "concat-stream": "~1.6.0", - "defined": "^1.0.0", - "detective": "^5.0.2", - "duplexer2": "^0.1.2", - "inherits": "^2.0.1", - "JSONStream": "^1.0.3", - "parents": "^1.0.0", - "readable-stream": "^2.0.2", - "resolve": "^1.4.0", - "stream-combiner2": "^1.1.1", - "subarg": "^1.0.0", - "through2": "^2.0.0", - "xtend": "^4.0.0" + "node_modules/mocha": { + "version": "10.2.0", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-10.2.0.tgz", + "integrity": "sha512-IDY7fl/BecMwFHzoqF2sg/SHHANeBoMMXFlS9r0OXKDssYE1M5O43wUY/9BVPeIvfH2zmEbBfseqN9gBQZzXkg==", + "dev": true, + "dependencies": { + "ansi-colors": "4.1.1", + "browser-stdout": "1.3.1", + "chokidar": "3.5.3", + "debug": "4.3.4", + "diff": "5.0.0", + "escape-string-regexp": "4.0.0", + "find-up": "5.0.0", + "glob": "7.2.0", + "he": "1.2.0", + "js-yaml": "4.1.0", + "log-symbols": "4.1.0", + "minimatch": "5.0.1", + "ms": "2.1.3", + "nanoid": "3.3.3", + "serialize-javascript": "6.0.0", + "strip-json-comments": "3.1.1", + "supports-color": "8.1.1", + "workerpool": "6.2.1", + "yargs": "16.2.0", + "yargs-parser": "20.2.4", + "yargs-unparser": "2.0.0" }, "bin": { - "module-deps": "bin/cmd.js" + "_mocha": "bin/_mocha", + "mocha": "bin/mocha.js" }, "engines": { - "node": ">= 0.8.0" + "node": ">= 14.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/mochajs" } }, - "node_modules/ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" + "node_modules/mocha/node_modules/ansi-colors": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", + "integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==", + "dev": true, + "engines": { + "node": ">=6" + } }, - "node_modules/mstranslator": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/mstranslator/-/mstranslator-3.0.0.tgz", - "integrity": "sha1-ancOpFD/tMZfaNXmruBRuC3gXPM=", + "node_modules/mocha/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", "dev": true, "engines": { - "node": ">=0.4.7" + "node": ">=8" } }, - "node_modules/mute-stdout": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/mute-stdout/-/mute-stdout-1.0.1.tgz", - "integrity": "sha512-kDcwXR4PS7caBpuRYYBUz9iVixUk3anO3f5OYFiIPwK/20vCzKCHyKoulbiDY1S53zD2bxUpxN/IJ+TnXjfvxg==", + "node_modules/mocha/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, "engines": { - "node": ">= 0.10" + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, - "node_modules/mute-stream": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz", - "integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==", + "node_modules/mocha/node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", "dev": true }, - "node_modules/nan": { - "version": "2.15.0", - "resolved": "https://registry.npmjs.org/nan/-/nan-2.15.0.tgz", - "integrity": "sha512-8ZtvEnA2c5aYCZYd1cvgdnU6cqwixRoYg70xPLWUws5ORTa/lnw+u4amixRS/Ac5U5mQVgp9pnlSUnbNWFaWZQ==", + "node_modules/mocha/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", "dev": true, - "optional": true + "dependencies": { + "balanced-match": "^1.0.0" + } }, - "node_modules/nanomatch": { - "version": "1.2.13", - "resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.13.tgz", - "integrity": "sha512-fpoe2T0RbHwBTBUOftAfBPaDEi06ufaUai0mE6Yn1kacc3SnTErfb/h+X94VXzI64rKFHYImXSvdwGGCmwOqCA==", + "node_modules/mocha/node_modules/cliui": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", + "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", "dev": true, "dependencies": { - "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" + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^7.0.0" + } + }, + "node_modules/mocha/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" }, "engines": { - "node": ">=0.10.0" + "node": ">=7.0.0" } }, - "node_modules/natural-compare": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", - "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", + "node_modules/mocha/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, - "node_modules/negotiator": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.1.tgz", - "integrity": "sha1-KzJxhOiZIQEXeyhWP7XnECrNDKk=", - "engines": { - "node": ">= 0.6" - } + "node_modules/mocha/node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/mocha/node_modules/debug/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "node_modules/mocha/node_modules/escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/mocha/node_modules/find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dev": true, + "dependencies": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/mocha/node_modules/get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "dev": true, + "engines": { + "node": "6.* || 8.* || >= 10.*" + } + }, + "node_modules/mocha/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/mocha/node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/mocha/node_modules/js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "dev": true, + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/mocha/node_modules/minimatch": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.0.1.tgz", + "integrity": "sha512-nLDxIFRyhDblz3qMuq+SoRZED4+miJ/G+tdDrjkkkRnjAsBexeGpgjLEQ0blJy7rHhR2b93rhQY4SvyWu9v03g==", + "dev": true, + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/mocha/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true + }, + "node_modules/mocha/node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/mocha/node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/mocha/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/mocha/node_modules/supports-color": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/supports-color?sponsor=1" + } + }, + "node_modules/mocha/node_modules/wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/mocha/node_modules/y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "dev": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/mocha/node_modules/yargs": { + "version": "16.2.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", + "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", + "dev": true, + "dependencies": { + "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" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/mocha/node_modules/yargs-parser": { + "version": "20.2.4", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.4.tgz", + "integrity": "sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA==", + "dev": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/module-deps": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/module-deps/-/module-deps-6.2.0.tgz", + "integrity": "sha512-hKPmO06so6bL/ZvqVNVqdTVO8UAYsi3tQWlCa+z9KuWhoN4KDQtb5hcqQQv58qYiDE21wIvnttZEPiDgEbpwbA==", + "dependencies": { + "browser-resolve": "^1.7.0", + "cached-path-relative": "^1.0.0", + "concat-stream": "~1.6.0", + "defined": "^1.0.0", + "detective": "^5.0.2", + "duplexer2": "^0.1.2", + "inherits": "^2.0.1", + "JSONStream": "^1.0.3", + "parents": "^1.0.0", + "readable-stream": "^2.0.2", + "resolve": "^1.4.0", + "stream-combiner2": "^1.1.1", + "subarg": "^1.0.0", + "through2": "^2.0.0", + "xtend": "^4.0.0" + }, + "bin": { + "module-deps": "bin/cmd.js" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" + }, + "node_modules/mstranslator": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/mstranslator/-/mstranslator-3.0.0.tgz", + "integrity": "sha1-ancOpFD/tMZfaNXmruBRuC3gXPM=", + "dev": true, + "engines": { + "node": ">=0.4.7" + } + }, + "node_modules/mute-stdout": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/mute-stdout/-/mute-stdout-1.0.1.tgz", + "integrity": "sha512-kDcwXR4PS7caBpuRYYBUz9iVixUk3anO3f5OYFiIPwK/20vCzKCHyKoulbiDY1S53zD2bxUpxN/IJ+TnXjfvxg==", + "dev": true, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/mute-stream": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz", + "integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==", + "dev": true + }, + "node_modules/nan": { + "version": "2.15.0", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.15.0.tgz", + "integrity": "sha512-8ZtvEnA2c5aYCZYd1cvgdnU6cqwixRoYg70xPLWUws5ORTa/lnw+u4amixRS/Ac5U5mQVgp9pnlSUnbNWFaWZQ==", + "dev": true, + "optional": true + }, + "node_modules/nanoid": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.3.tgz", + "integrity": "sha512-p1sjXuopFs0xg+fPASzQ28agW1oHD7xDsd9Xkf3T15H3c/cifrFHVwrh74PdoklAPi+i7MdRsE47vm2r6JoB+w==", + "dev": true, + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, + "node_modules/nanomatch": { + "version": "1.2.13", + "resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.13.tgz", + "integrity": "sha512-fpoe2T0RbHwBTBUOftAfBPaDEi06ufaUai0mE6Yn1kacc3SnTErfb/h+X94VXzI64rKFHYImXSvdwGGCmwOqCA==", + "dev": true, + "dependencies": { + "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" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", + "dev": true + }, + "node_modules/negotiator": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.1.tgz", + "integrity": "sha1-KzJxhOiZIQEXeyhWP7XnECrNDKk=", + "engines": { + "node": ">= 0.6" + } }, "node_modules/next-tick": { "version": "1.0.0", @@ -5239,6 +5759,36 @@ "node": ">=0.10.0" } }, + "node_modules/p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "dependencies": { + "yocto-queue": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dev": true, + "dependencies": { + "p-limit": "^3.0.2" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/pako": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.7.tgz", @@ -5462,9 +6012,9 @@ } }, "node_modules/picomatch": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.2.tgz", - "integrity": "sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg==", + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", "engines": { "node": ">=8.6" }, @@ -5657,9 +6207,9 @@ } }, "node_modules/randombytes": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.0.6.tgz", - "integrity": "sha512-CIQ5OFxf4Jou6uOKe9t1AOgqpeU5fd70A8NPdHSGeYXqXsPe6peOwI0cUl88RWZ6sP1vPMV3avd/R6cZ5/sP1A==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", + "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", "dependencies": { "safe-buffer": "^5.1.0" } @@ -5761,9 +6311,9 @@ } }, "node_modules/readdirp": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.4.0.tgz", - "integrity": "sha512-0xe001vZBnJEK+uKcj8qOhyAKPzIT+gStxWr3LCB0DwcXR5NZJ3IaC+yGnHCYzB/S7ov3m3EEbZI2zeNvX+hGQ==", + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", "dependencies": { "picomatch": "^2.2.1" }, @@ -5987,26 +6537,6 @@ "rimraf": "bin.js" } }, - "node_modules/rimraf/node_modules/glob": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", - "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", - "dev": true, - "dependencies": { - "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" - }, - "engines": { - "node": "*" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, "node_modules/ripemd160": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/ripemd160/-/ripemd160-2.0.2.tgz", @@ -6208,6 +6738,15 @@ "node": ">=0.6" } }, + "node_modules/serialize-javascript": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.0.tgz", + "integrity": "sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag==", + "dev": true, + "dependencies": { + "randombytes": "^2.1.0" + } + }, "node_modules/serve-static": { "version": "1.14.2", "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.14.2.tgz", @@ -7569,6 +8108,12 @@ "node": ">=0.10.0" } }, + "node_modules/workerpool": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.2.1.tgz", + "integrity": "sha512-ILEIE97kDZvF9Wb9f6h5aXK4swSlKGUcOEGiIYb2OOu/IrDU9iwj0fD//SsA6E5ibwJxpEvhullJY4Sl4GcpAw==", + "dev": true + }, "node_modules/wrap-ansi": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", @@ -7672,10 +8217,61 @@ "object.assign": "^4.1.0" } }, + "node_modules/yargs-unparser": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-2.0.0.tgz", + "integrity": "sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA==", + "dev": true, + "dependencies": { + "camelcase": "^6.0.0", + "decamelize": "^4.0.0", + "flat": "^5.0.2", + "is-plain-obj": "^2.1.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/yargs-unparser/node_modules/camelcase": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", + "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/yargs-unparser/node_modules/decamelize": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-4.0.0.tgz", + "integrity": "sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/yeast": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/yeast/-/yeast-0.1.2.tgz", "integrity": "sha512-8HFIh676uyGYP6wP13R/j6OJ/1HwJ46snpvzE7aHAN3Ryqh2yX6Xox2B4CUmTwwOIzlG3Bs7ocsP5dZH/R1Qbg==" + }, + "node_modules/yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } } }, "dependencies": { @@ -7736,6 +8332,12 @@ } } }, + "@types/mocha": { + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-10.0.1.tgz", + "integrity": "sha512-/fvYntiO1GeICvqbQ3doGDIP97vWmvFt83GKguJ6prmQM2iXZfFcq6YE8KteFyRtX2/h5Hf91BYvPodJKFYv5Q==", + "dev": true + }, "@xmldom/xmldom": { "version": "0.8.4", "resolved": "https://registry.npmjs.org/@xmldom/xmldom/-/xmldom-0.8.4.tgz", @@ -8311,6 +8913,12 @@ } } }, + "browser-stdout": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", + "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", + "dev": true + }, "browserify": { "version": "16.2.3", "resolved": "https://registry.npmjs.org/browserify/-/browserify-16.2.3.tgz", @@ -8536,24 +9144,24 @@ "dev": true }, "chokidar": { - "version": "3.4.2", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.4.2.tgz", - "integrity": "sha512-IZHaDeBeI+sZJRX7lGcXsdzgvZqKv6sECqsbErJA4mHWfpRrD8B97kSFN4cQz6nGBGiuFia1MKR4d6c1o8Cv7A==", + "version": "3.5.3", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", + "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==", "requires": { - "anymatch": "~3.1.1", + "anymatch": "~3.1.2", "braces": "~3.0.2", - "fsevents": "~2.1.2", - "glob-parent": "~5.1.0", + "fsevents": "~2.3.2", + "glob-parent": "~5.1.2", "is-binary-path": "~2.1.0", "is-glob": "~4.0.1", "normalize-path": "~3.0.0", - "readdirp": "~3.4.0" + "readdirp": "~3.6.0" }, "dependencies": { "anymatch": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.1.tgz", - "integrity": "sha512-mM8522psRCqzV+6LhomX5wgp25YVibjh8Wj23I5RPkPppSVSjyKD2A2mBJmWGa+KN7f2D6LNh9jkBCeyLktzjg==", + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", "requires": { "normalize-path": "^3.0.0", "picomatch": "^2.0.4" @@ -9193,6 +9801,12 @@ "minimist": "^1.1.1" } }, + "diff": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-5.0.0.tgz", + "integrity": "sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w==", + "dev": true + }, "diffie-hellman": { "version": "5.0.3", "resolved": "http://registry.npmjs.org/diffie-hellman/-/diffie-hellman-5.0.3.tgz", @@ -9424,6 +10038,12 @@ "es6-symbol": "^3.1.1" } }, + "escalade": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", + "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", + "dev": true + }, "escape-html": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", @@ -10119,6 +10739,12 @@ "integrity": "sha512-lNaHNVymajmk0OJMBn8fVUAU1BtDeKIqKoVhk4xAALB57aALg6b4W0MfJ/cUE0g9YBXy5XhSlPIpYIJ7HaY/3Q==", "dev": true }, + "flat": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz", + "integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==", + "dev": true + }, "flat-cache": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-2.0.1.tgz", @@ -10213,9 +10839,9 @@ "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" }, "fsevents": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.1.3.tgz", - "integrity": "sha512-Auw9a4AxqWpa9GUfj370BMPzzyncfBABW8Mab7BGWBYDj4Isgq+cDKtx0i6u9jcX9pQDnswsaaOTgTmA5pEjuQ==", + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", "optional": true }, "function-bind": { @@ -10247,9 +10873,9 @@ "dev": true }, "glob": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", - "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", + "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", "requires": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", @@ -10634,6 +11260,12 @@ "minimalistic-assert": "^1.0.1" } }, + "he": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", + "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", + "dev": true + }, "hmac-drbg": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", @@ -11053,6 +11685,12 @@ } } }, + "is-plain-obj": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/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": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", @@ -11080,6 +11718,12 @@ "unc-path-regex": "^0.1.2" } }, + "is-unicode-supported": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz", + "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==", + "dev": true + }, "is-utf8": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz", @@ -11298,6 +11942,15 @@ "strip-bom": "^2.0.0" } }, + "locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dev": true, + "requires": { + "p-locate": "^5.0.0" + } + }, "lodash": { "version": "4.17.21", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", @@ -11309,6 +11962,67 @@ "resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-3.0.4.tgz", "integrity": "sha1-LcvSwofLwKVcxCMovQxzYVDVPj8=" }, + "log-symbols": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz", + "integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==", + "dev": true, + "requires": { + "chalk": "^4.1.0", + "is-unicode-supported": "^0.1.0" + }, + "dependencies": { + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, "make-iterator": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/make-iterator/-/make-iterator-1.0.1.tgz", @@ -11512,6 +12226,247 @@ "minimist": "^1.2.5" } }, + "mocha": { + "version": "10.2.0", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-10.2.0.tgz", + "integrity": "sha512-IDY7fl/BecMwFHzoqF2sg/SHHANeBoMMXFlS9r0OXKDssYE1M5O43wUY/9BVPeIvfH2zmEbBfseqN9gBQZzXkg==", + "dev": true, + "requires": { + "ansi-colors": "4.1.1", + "browser-stdout": "1.3.1", + "chokidar": "3.5.3", + "debug": "4.3.4", + "diff": "5.0.0", + "escape-string-regexp": "4.0.0", + "find-up": "5.0.0", + "glob": "7.2.0", + "he": "1.2.0", + "js-yaml": "4.1.0", + "log-symbols": "4.1.0", + "minimatch": "5.0.1", + "ms": "2.1.3", + "nanoid": "3.3.3", + "serialize-javascript": "6.0.0", + "strip-json-comments": "3.1.1", + "supports-color": "8.1.1", + "workerpool": "6.2.1", + "yargs": "16.2.0", + "yargs-parser": "20.2.4", + "yargs-unparser": "2.0.0" + }, + "dependencies": { + "ansi-colors": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", + "integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==", + "dev": true + }, + "ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true + }, + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true + }, + "brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0" + } + }, + "cliui": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", + "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", + "dev": true, + "requires": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^7.0.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, + "requires": { + "ms": "2.1.2" + }, + "dependencies": { + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + } + } + }, + "escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true + }, + "find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/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" + } + }, + "get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "dev": true + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true + }, + "js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "dev": true, + "requires": { + "argparse": "^2.0.1" + } + }, + "minimatch": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.0.1.tgz", + "integrity": "sha512-nLDxIFRyhDblz3qMuq+SoRZED4+miJ/G+tdDrjkkkRnjAsBexeGpgjLEQ0blJy7rHhR2b93rhQY4SvyWu9v03g==", + "dev": true, + "requires": { + "brace-expansion": "^2.0.1" + } + }, + "ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true + }, + "path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true + }, + "string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + } + }, + "strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "requires": { + "ansi-regex": "^5.0.1" + } + }, + "supports-color": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + }, + "wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "requires": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + } + }, + "y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "dev": true + }, + "yargs": { + "version": "16.2.0", + "resolved": "https://registry.npmjs.org/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": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.4.tgz", + "integrity": "sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA==", + "dev": true + } + } + }, "module-deps": { "version": "6.2.0", "resolved": "https://registry.npmjs.org/module-deps/-/module-deps-6.2.0.tgz", @@ -11564,6 +12519,12 @@ "dev": true, "optional": true }, + "nanoid": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.3.tgz", + "integrity": "sha512-p1sjXuopFs0xg+fPASzQ28agW1oHD7xDsd9Xkf3T15H3c/cifrFHVwrh74PdoklAPi+i7MdRsE47vm2r6JoB+w==", + "dev": true + }, "nanomatch": { "version": "1.2.13", "resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.13.tgz", @@ -11870,6 +12831,24 @@ "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", "dev": true }, + "p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "requires": { + "yocto-queue": "^0.1.0" + } + }, + "p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dev": true, + "requires": { + "p-limit": "^3.0.2" + } + }, "pako": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.7.tgz", @@ -12048,9 +13027,9 @@ } }, "picomatch": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.2.tgz", - "integrity": "sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg==" + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==" }, "pify": { "version": "2.3.0", @@ -12196,9 +13175,9 @@ "integrity": "sha1-nsYfeQSYdXB9aUFFlv2Qek1xHnM=" }, "randombytes": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.0.6.tgz", - "integrity": "sha512-CIQ5OFxf4Jou6uOKe9t1AOgqpeU5fd70A8NPdHSGeYXqXsPe6peOwI0cUl88RWZ6sP1vPMV3avd/R6cZ5/sP1A==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", + "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", "requires": { "safe-buffer": "^5.1.0" } @@ -12289,9 +13268,9 @@ } }, "readdirp": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.4.0.tgz", - "integrity": "sha512-0xe001vZBnJEK+uKcj8qOhyAKPzIT+gStxWr3LCB0DwcXR5NZJ3IaC+yGnHCYzB/S7ov3m3EEbZI2zeNvX+hGQ==", + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", "requires": { "picomatch": "^2.2.1" } @@ -12461,22 +13440,6 @@ "dev": true, "requires": { "glob": "^7.1.3" - }, - "dependencies": { - "glob": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", - "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", - "dev": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - } } }, "ripemd160": { @@ -12648,6 +13611,15 @@ } } }, + "serialize-javascript": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.0.tgz", + "integrity": "sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag==", + "dev": true, + "requires": { + "randombytes": "^2.1.0" + } + }, "serve-static": { "version": "1.14.2", "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.14.2.tgz", @@ -13807,6 +14779,12 @@ "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", "dev": true }, + "workerpool": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.2.1.tgz", + "integrity": "sha512-ILEIE97kDZvF9Wb9f6h5aXK4swSlKGUcOEGiIYb2OOu/IrDU9iwj0fD//SsA6E5ibwJxpEvhullJY4Sl4GcpAw==", + "dev": true + }, "wrap-ansi": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", @@ -13884,10 +14862,42 @@ "object.assign": "^4.1.0" } }, + "yargs-unparser": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/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.3.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", + "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", + "dev": true + }, + "decamelize": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-4.0.0.tgz", + "integrity": "sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==", + "dev": true + } + } + }, "yeast": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/yeast/-/yeast-0.1.2.tgz", "integrity": "sha512-8HFIh676uyGYP6wP13R/j6OJ/1HwJ46snpvzE7aHAN3Ryqh2yX6Xox2B4CUmTwwOIzlG3Bs7ocsP5dZH/R1Qbg==" + }, + "yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "dev": true } } } diff --git a/package.json b/package.json index 72311818..7835a4ee 100644 --- a/package.json +++ b/package.json @@ -44,12 +44,14 @@ "uuid": "^3.3.2" }, "devDependencies": { + "@types/mocha": "^10.0.1", "@xmldom/xmldom": "^0.8.3", "gulp": "^4.0.2", "gulp-eslint": "^6.0.0", "gulp-jsonlint": "^1.3.2", "husky": "^8.0.2", "in-publish": "^2.0.0", + "mocha": "^10.2.0", "mstranslator": "^3.0.0", "parse5": "^2.2.1", "pretty-data": "^0.40.0" @@ -57,6 +59,7 @@ "scripts": { "update-loc": "node ./tools/i18n/update", "eslint": "npx eslint .", - "prepare": "husky install" + "prepare": "husky install", + "test": "mocha --ui tdd ./test/*.js --timeout 100000" } } diff --git a/test/resources/options.json b/test/resources/options.json new file mode 100644 index 00000000..eaa47dde --- /dev/null +++ b/test/resources/options.json @@ -0,0 +1,17 @@ +{ + "corsproxy": true, + "device": null, + "dir": null, + "forceprepare": false, + "generateids": false, + "lang": null, + "livereload": true, + "middeware": null, + "platform": null, + "port": null, + "simhostui": null, + "simulationpath": null, + "spaurlrewrites": false, + "target": null, + "theme": null +} \ No newline at end of file diff --git a/test/resources/testSampleProject/config.xml b/test/resources/testSampleProject/config.xml new file mode 100644 index 00000000..92c30e03 --- /dev/null +++ b/test/resources/testSampleProject/config.xml @@ -0,0 +1,11 @@ + + + HelloCordova + Sample Apache Cordova App + + Apache Cordova Team + + + + + diff --git a/test/resources/testSampleProject/platforms/browser/browser.json b/test/resources/testSampleProject/platforms/browser/browser.json new file mode 100644 index 00000000..7325a44a --- /dev/null +++ b/test/resources/testSampleProject/platforms/browser/browser.json @@ -0,0 +1,11 @@ +{ + "prepare_queue": { + "installed": [], + "uninstalled": [] + }, + "config_munge": { + "files": {} + }, + "installed_plugins": {}, + "dependent_plugins": {} +} diff --git a/test/resources/testSampleProject/platforms/browser/config.xml b/test/resources/testSampleProject/platforms/browser/config.xml new file mode 100644 index 00000000..92c30e03 --- /dev/null +++ b/test/resources/testSampleProject/platforms/browser/config.xml @@ -0,0 +1,11 @@ + + + HelloCordova + Sample Apache Cordova App + + Apache Cordova Team + + + + + diff --git a/test/resources/testSampleProject/platforms/browser/cordova/Api.js b/test/resources/testSampleProject/platforms/browser/cordova/Api.js new file mode 100644 index 00000000..da0ec8af --- /dev/null +++ b/test/resources/testSampleProject/platforms/browser/cordova/Api.js @@ -0,0 +1,531 @@ +/** +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +'License'); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +'AS IS' BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +*/ + +/* + this file is found by cordova-lib when you attempt to + 'cordova platform add PATH' where path is this repo. +*/ + +var shell = require('shelljs'); +var path = require('path'); +var fs = require('fs'); + +var cdvcmn = require('cordova-common'); +var CordovaLogger = cdvcmn.CordovaLogger; +var ConfigParser = cdvcmn.ConfigParser; +var ActionStack = cdvcmn.ActionStack; +var selfEvents = cdvcmn.events; +var xmlHelpers = cdvcmn.xmlHelpers; +var PlatformJson = cdvcmn.PlatformJson; +var PlatformMunger = cdvcmn.ConfigChanges.PlatformMunger; +var PluginInfoProvider = cdvcmn.PluginInfoProvider; + +var BrowserParser = require('./browser_parser'); +var PLATFORM_NAME = 'browser'; + +function setupEvents (externalEventEmitter) { + if (externalEventEmitter) { + // This will make the platform internal events visible outside + selfEvents.forwardEventsTo(externalEventEmitter); + return externalEventEmitter; + } + + // There is no logger if external emitter is not present, + // so attach a console logger + CordovaLogger.get().subscribe(selfEvents); + return selfEvents; +} + +function Api (platform, platformRootDir, events) { + + this.platform = platform || PLATFORM_NAME; + + // MyApp/platforms/browser + this.root = path.resolve(__dirname, '..'); + this.events = setupEvents(events); + this.parser = new BrowserParser(this.root); + this._handler = require('./browser_handler'); + + this.locations = { + platformRootDir: platformRootDir, + root: this.root, + www: path.join(this.root, 'www'), + res: path.join(this.root, 'res'), + platformWww: path.join(this.root, 'platform_www'), + configXml: path.join(this.root, 'config.xml'), + defaultConfigXml: path.join(this.root, 'cordova/defaults.xml'), + build: path.join(this.root, 'build'), + // NOTE: Due to platformApi spec we need to return relative paths here + cordovaJs: 'bin/templates/project/assets/www/cordova.js', + cordovaJsSrc: 'cordova-js-src' + }; + + this._platformJson = PlatformJson.load(this.root, platform); + this._pluginInfoProvider = new PluginInfoProvider(); + this._munger = new PlatformMunger(platform, this.root, this._platformJson, this._pluginInfoProvider); +} + +Api.createPlatform = function (dest, config, options, events) { + + var creator = require('../../lib/create'); + events = setupEvents(events); + + var name = 'HelloCordova'; + var id = 'io.cordova.hellocordova'; + if (config) { + name = config.name(); + id = config.packageName(); + } + + var result; + try { + // we create the project using our scripts in this platform + result = creator.createProject(dest, id, name, options) + .then(function () { + // after platform is created we return Api instance based on new Api.js location + // Api.js has been copied to the new project + // This is required to correctly resolve paths in the future api calls + var PlatformApi = require(path.resolve(dest, 'cordova/Api')); + return new PlatformApi('browser', dest, events); + }); + } catch (e) { + events.emit('error', 'createPlatform is not callable from the browser project API.'); + throw (e); + } + return result; +}; + +Api.updatePlatform = function (dest, options, events) { + // console.log("test-platform:Api:updatePlatform"); + // todo?: create projectInstance and fulfill promise with it. + return Promise.resolve(); +}; + +Api.prototype.getPlatformInfo = function () { + // console.log("browser-platform:Api:getPlatformInfo"); + // return PlatformInfo object + return { + 'locations': this.locations, + 'root': this.root, + 'name': this.platform, + 'version': { 'version': '1.0.0' }, // um, todo! + 'projectConfig': this.config + }; +}; + +Api.prototype.prepare = function (cordovaProject, options) { + + // First cleanup current config and merge project's one into own + var defaultConfigPath = path.join(this.locations.platformRootDir, 'cordova', + 'defaults.xml'); + var ownConfigPath = this.locations.configXml; + var sourceCfg = cordovaProject.projectConfig; + + // If defaults.xml is present, overwrite platform config.xml with it. + // Otherwise save whatever is there as defaults so it can be + // restored or copy project config into platform if none exists. + if (fs.existsSync(defaultConfigPath)) { + this.events.emit('verbose', 'Generating config.xml from defaults for platform "' + this.platform + '"'); + shell.cp('-f', defaultConfigPath, ownConfigPath); + } else if (fs.existsSync(ownConfigPath)) { + this.events.emit('verbose', 'Generating defaults.xml from own config.xml for platform "' + this.platform + '"'); + shell.cp('-f', ownConfigPath, defaultConfigPath); + } else { + this.events.emit('verbose', 'case 3"' + this.platform + '"'); + shell.cp('-f', sourceCfg.path, ownConfigPath); + } + + // merge our configs + this.config = new ConfigParser(ownConfigPath); + xmlHelpers.mergeXml(cordovaProject.projectConfig.doc.getroot(), + this.config.doc.getroot(), + this.platform, true); + this.config.write(); + + // Update own www dir with project's www assets and plugins' assets and js-files + this.parser.update_www(cordovaProject, options); + + // Copy or Create manifest.json + // todo: move this to a manifest helper module + // output path + var manifestPath = path.join(this.locations.www, 'manifest.json'); + var srcManifestPath = path.join(cordovaProject.locations.www, 'manifest.json'); + if (fs.existsSync(srcManifestPath)) { + // just blindly copy it to our output/www + // todo: validate it? ensure all properties we expect exist? + this.events.emit('verbose', 'copying ' + srcManifestPath + ' => ' + manifestPath); + shell.cp('-f', srcManifestPath, manifestPath); + } else { + var manifestJson = { + 'background_color': '#FFF', + 'display': 'standalone' + }; + if (this.config) { + if (this.config.name()) { + manifestJson.name = this.config.name(); + } + if (this.config.shortName()) { + manifestJson.short_name = this.config.shortName(); + } + if (this.config.packageName()) { + manifestJson.version = this.config.packageName(); + } + if (this.config.description()) { + manifestJson.description = this.config.description(); + } + if (this.config.author()) { + manifestJson.author = this.config.author(); + } + // icons + var icons = this.config.getStaticResources('browser', 'icon'); + var manifestIcons = icons.map(function (icon) { + // given a tag like this : + // + /* configParser returns icons that look like this : + { src: 'res/ios/icon.png', + target: undefined, + density: 'mdpi', + platform: null, + width: 57, + height: 57 + } ******/ + /* manifest expects them to be like this : + { "src": "images/touch/icon-128x128.png", + "type": "image/png", + "sizes": "128x128" + } ******/ + // ?Is it worth looking at file extentions? + return { 'src': icon.src, + 'type': 'image/png', + 'sizes': (icon.width + 'x' + icon.height) }; + }); + manifestJson.icons = manifestIcons; + + // orientation + // + var oriPref = this.config.getGlobalPreference('Orientation'); + if (oriPref) { + // if it's a supported value, use it + if (['landscape', 'portrait'].indexOf(oriPref) > -1) { + manifestJson.orientation = oriPref; + } else { // anything else maps to 'any' + manifestJson.orientation = 'any'; + } + } + + // get start_url + var contentNode = this.config.doc.find('content') || { 'attrib': { 'src': 'index.html' } }; // sensible default + manifestJson.start_url = contentNode.attrib.src; + + // now we get some values from start_url page ... + var startUrlPath = path.join(cordovaProject.locations.www, manifestJson.start_url); + if (fs.existsSync(startUrlPath)) { + var contents = fs.readFileSync(startUrlPath, 'utf-8'); + // matches + var themeColorRegex = /]*name="theme-color")\s[^>]*content="([^>]*)"/i; + var result = themeColorRegex.exec(contents); + var themeColor; + if (result && result.length >= 2) { + themeColor = result[1]; + } else { // see if there is a preference in config.xml + // + themeColor = this.config.getGlobalPreference('StatusBarBackgroundColor'); + } + if (themeColor) { + manifestJson.theme_color = themeColor; + } + } + } + fs.writeFileSync(manifestPath, JSON.stringify(manifestJson, null, 2), 'utf8'); + } + + // update project according to config.xml changes. + return this.parser.update_project(this.config, options); +}; + +Api.prototype.addPlugin = function (pluginInfo, installOptions) { + + // console.log(new Error().stack); + if (!pluginInfo) { + return Promise.reject(new Error('The parameter is incorrect. The first parameter ' + + 'should be valid PluginInfo instance')); + } + + installOptions = installOptions || {}; + installOptions.variables = installOptions.variables || {}; + // CB-10108 platformVersion option is required for proper plugin installation + installOptions.platformVersion = installOptions.platformVersion || + this.getPlatformInfo().version; + + var self = this; + var actions = new ActionStack(); + var projectFile = this._handler.parseProjectFile && this._handler.parseProjectFile(this.root); + + // gather all files needs to be handled during install + pluginInfo.getFilesAndFrameworks(this.platform) + .concat(pluginInfo.getAssets(this.platform)) + .concat(pluginInfo.getJsModules(this.platform)) + .forEach(function (item) { + actions.push(actions.createAction( + self._getInstaller(item.itemType), + [item, pluginInfo.dir, pluginInfo.id, installOptions, projectFile], + self._getUninstaller(item.itemType), + [item, pluginInfo.dir, pluginInfo.id, installOptions, projectFile])); + }); + + // run through the action stack + return actions.process(this.platform, this.root) + .then(function () { + if (projectFile) { + projectFile.write(); + } + + // Add PACKAGE_NAME variable into vars + if (!installOptions.variables.PACKAGE_NAME) { + installOptions.variables.PACKAGE_NAME = self._handler.package_name(self.root); + } + + self._munger + // Ignore passed `is_top_level` option since platform itself doesn't know + // anything about managing dependencies - it's responsibility of caller. + .add_plugin_changes(pluginInfo, installOptions.variables, /* is_top_level= */true, /* should_increment= */true) + .save_all(); + + var targetDir = installOptions.usePlatformWww ? + self.getPlatformInfo().locations.platformWww : + self.getPlatformInfo().locations.www; + + self._addModulesInfo(pluginInfo, targetDir); + }); +}; + +Api.prototype.removePlugin = function (plugin, uninstallOptions) { + // console.log("NotImplemented :: browser-platform:Api:removePlugin ",plugin, uninstallOptions); + + uninstallOptions = uninstallOptions || {}; + // CB-10108 platformVersion option is required for proper plugin installation + uninstallOptions.platformVersion = uninstallOptions.platformVersion || + this.getPlatformInfo().version; + + var self = this; + var actions = new ActionStack(); + var projectFile = this._handler.parseProjectFile && this._handler.parseProjectFile(this.root); + + // queue up plugin files + plugin.getFilesAndFrameworks(this.platform) + .concat(plugin.getAssets(this.platform)) + .concat(plugin.getJsModules(this.platform)) + .forEach(function (item) { + actions.push(actions.createAction( + self._getUninstaller(item.itemType), [item, plugin.dir, plugin.id, uninstallOptions, projectFile], + self._getInstaller(item.itemType), [item, plugin.dir, plugin.id, uninstallOptions, projectFile])); + }); + + // run through the action stack + return actions.process(this.platform, this.root) + .then(function () { + if (projectFile) { + projectFile.write(); + } + + self._munger + // Ignore passed `is_top_level` option since platform itself doesn't know + // anything about managing dependencies - it's responsibility of caller. + .remove_plugin_changes(plugin, /* is_top_level= */true) + .save_all(); + + var targetDir = uninstallOptions.usePlatformWww ? + self.getPlatformInfo().locations.platformWww : + self.getPlatformInfo().locations.www; + + self._removeModulesInfo(plugin, targetDir); + // Remove stale plugin directory + // TODO: this should be done by plugin files uninstaller + shell.rm('-rf', path.resolve(self.root, 'Plugins', plugin.id)); + }); +}; + +Api.prototype._getInstaller = function (type) { + var self = this; + return function (item, plugin_dir, plugin_id, options, project) { + var installer = self._handler[type]; + + if (!installer) { + console.log('unrecognized type ' + type); + + } else { + var wwwDest = options.usePlatformWww ? + self.getPlatformInfo().locations.platformWww : + self._handler.www_dir(self.root); + + if (type === 'asset') { + installer.install(item, plugin_dir, wwwDest); + } else if (type === 'js-module') { + installer.install(item, plugin_dir, plugin_id, wwwDest); + } else { + installer.install(item, plugin_dir, self.root, plugin_id, options, project); + } + } + }; +}; + +Api.prototype._getUninstaller = function (type) { + var self = this; + return function (item, plugin_dir, plugin_id, options, project) { + var installer = self._handler[type]; + + if (!installer) { + console.log('browser plugin uninstall: unrecognized type, skipping : ' + type); + + } else { + var wwwDest = options.usePlatformWww ? + self.getPlatformInfo().locations.platformWww : + self._handler.www_dir(self.root); + + if (['asset', 'js-module'].indexOf(type) > -1) { + return installer.uninstall(item, wwwDest, plugin_id); + } else { + return installer.uninstall(item, self.root, plugin_id, options, project); + } + + } + }; +}; + +/** + * Removes the specified modules from list of installed modules and updates + * platform_json and cordova_plugins.js on disk. + * + * @param {PluginInfo} plugin PluginInfo instance for plugin, which modules + * needs to be added. + * @param {String} targetDir The directory, where updated cordova_plugins.js + * should be written to. + */ +Api.prototype._addModulesInfo = function (plugin, targetDir) { + var installedModules = this._platformJson.root.modules || []; + + var installedPaths = installedModules.map(function (installedModule) { + return installedModule.file; + }); + + var modulesToInstall = plugin.getJsModules(this.platform) + .filter(function (moduleToInstall) { + return installedPaths.indexOf(moduleToInstall.file) === -1; + }).map(function (moduleToInstall) { + var moduleName = plugin.id + '.' + (moduleToInstall.name || moduleToInstall.src.match(/([^\/]+)\.js/)[1]); + var obj = { + file: ['plugins', plugin.id, moduleToInstall.src].join('/'), /* eslint no-useless-escape : 0 */ + id: moduleName, + pluginId: plugin.id + }; + if (moduleToInstall.clobbers.length > 0) { + obj.clobbers = moduleToInstall.clobbers.map(function (o) { return o.target; }); + } + if (moduleToInstall.merges.length > 0) { + obj.merges = moduleToInstall.merges.map(function (o) { return o.target; }); + } + if (moduleToInstall.runs) { + obj.runs = true; + } + + return obj; + }); + + this._platformJson.root.modules = installedModules.concat(modulesToInstall); + if (!this._platformJson.root.plugin_metadata) { + this._platformJson.root.plugin_metadata = {}; + } + this._platformJson.root.plugin_metadata[plugin.id] = plugin.version; + + this._writePluginModules(targetDir); + this._platformJson.save(); +}; +/** + * Fetches all installed modules, generates cordova_plugins contents and writes + * it to file. + * + * @param {String} targetDir Directory, where write cordova_plugins.js to. + * Ususally it is either /www or /platform_www + * directories. + */ +Api.prototype._writePluginModules = function (targetDir) { + // Write out moduleObjects as JSON wrapped in a cordova module to cordova_plugins.js + var final_contents = 'cordova.define(\'cordova/plugin_list\', function(require, exports, module) {\n'; + final_contents += 'module.exports = ' + JSON.stringify(this._platformJson.root.modules, null, ' ') + ';\n'; + final_contents += 'module.exports.metadata = \n'; + final_contents += '// TOP OF METADATA\n'; + final_contents += JSON.stringify(this._platformJson.root.plugin_metadata || {}, null, ' ') + '\n'; + final_contents += '// BOTTOM OF METADATA\n'; + final_contents += '});'; // Close cordova.define. + + shell.mkdir('-p', targetDir); + fs.writeFileSync(path.join(targetDir, 'cordova_plugins.js'), final_contents, 'utf-8'); +}; + +/** + * Removes the specified modules from list of installed modules and updates + * platform_json and cordova_plugins.js on disk. + * + * @param {PluginInfo} plugin PluginInfo instance for plugin, which modules + * needs to be removed. + * @param {String} targetDir The directory, where updated cordova_plugins.js + * should be written to. + */ +Api.prototype._removeModulesInfo = function (plugin, targetDir) { + var installedModules = this._platformJson.root.modules || []; + var modulesToRemove = plugin.getJsModules(this.platform) + .map(function (jsModule) { + return ['plugins', plugin.id, jsModule.src].join('/'); + }); + + var updatedModules = installedModules + .filter(function (installedModule) { + return (modulesToRemove.indexOf(installedModule.file) === -1); + }); + + this._platformJson.root.modules = updatedModules; + if (this._platformJson.root.plugin_metadata) { + delete this._platformJson.root.plugin_metadata[plugin.id]; + } + + this._writePluginModules(targetDir); + this._platformJson.save(); +}; + +Api.prototype.build = function (buildOptions) { + var self = this; + return require('./lib/check_reqs').run() + .then(function () { + return require('./lib/build').run.call(self, buildOptions); + }); +}; + +Api.prototype.run = function (runOptions) { + return require('./lib/run').run(runOptions); +}; + +Api.prototype.clean = function (cleanOptions) { + return require('./lib/clean').run(cleanOptions); +}; + +Api.prototype.requirements = function () { + return require('./lib/check_reqs').run(); +}; + +module.exports = Api; diff --git a/test/resources/testSampleProject/platforms/browser/cordova/browser_handler.js b/test/resources/testSampleProject/platforms/browser/cordova/browser_handler.js new file mode 100644 index 00000000..bccddb49 --- /dev/null +++ b/test/resources/testSampleProject/platforms/browser/cordova/browser_handler.js @@ -0,0 +1,135 @@ +/** + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +*/ + +var path = require('path'); +var fs = require('fs'); +var shell = require('shelljs'); +var events = require('cordova-common').events; + +module.exports = { + www_dir: function (project_dir) { + return path.join(project_dir, 'www'); + }, + package_name: function (project_dir) { + // this method should the id from root config.xml => 1) { + pkgName = res[1]; + } + } + return pkgName; + }, + 'js-module': { + install: function (jsModule, plugin_dir, plugin_id, www_dir) { + // Copy the plugin's files into the www directory. + var moduleSource = path.resolve(plugin_dir, jsModule.src); + // Get module name based on existing 'name' attribute or filename + // Must use path.extname/path.basename instead of path.parse due to CB-9981 + var moduleName = plugin_id + '.' + (jsModule.name || path.basename(jsModule.src, path.extname(jsModule.src))); + + // Read in the file, prepend the cordova.define, and write it back out. + var scriptContent = fs.readFileSync(moduleSource, 'utf-8').replace(/^\ufeff/, ''); // Window BOM + if (moduleSource.match(/.*\.json$/)) { + scriptContent = 'module.exports = ' + scriptContent; + } + scriptContent = 'cordova.define("' + moduleName + '", function(require, exports, module) { ' + scriptContent + '\n});\n'; + + var moduleDestination = path.resolve(www_dir, 'plugins', plugin_id, jsModule.src); + shell.mkdir('-p', path.dirname(moduleDestination)); + fs.writeFileSync(moduleDestination, scriptContent, 'utf-8'); + }, + uninstall: function (jsModule, www_dir, plugin_id) { + var pluginRelativePath = path.join('plugins', plugin_id, jsModule.src); + // common.removeFileAndParents(www_dir, pluginRelativePath); + console.log('js-module uninstall called : ' + pluginRelativePath); + } + }, + 'source-file': { + install: function (obj, plugin_dir, project_dir, plugin_id, options) { + // var dest = path.join(obj.targetDir, path.basename(obj.src)); + // common.copyFile(plugin_dir, obj.src, project_dir, dest); + console.log('install called'); + }, + uninstall: function (obj, project_dir, plugin_id, options) { + // var dest = path.join(obj.targetDir, path.basename(obj.src)); + // common.removeFile(project_dir, dest); + console.log('uninstall called'); + } + }, + 'header-file': { + install: function (obj, plugin_dir, project_dir, plugin_id, options) { + events.emit('verbose', 'header-fileinstall is not supported for browser'); + }, + uninstall: function (obj, project_dir, plugin_id, options) { + events.emit('verbose', 'header-file.uninstall is not supported for browser'); + } + }, + 'resource-file': { + install: function (obj, plugin_dir, project_dir, plugin_id, options) { + events.emit('verbose', 'resource-file.install is not supported for browser'); + }, + uninstall: function (obj, project_dir, plugin_id, options) { + events.emit('verbose', 'resource-file.uninstall is not supported for browser'); + } + }, + 'framework': { + install: function (obj, plugin_dir, project_dir, plugin_id, options) { + events.emit('verbose', 'framework.install is not supported for browser'); + }, + uninstall: function (obj, project_dir, plugin_id, options) { + events.emit('verbose', 'framework.uninstall is not supported for browser'); + } + }, + 'lib-file': { + install: function (obj, plugin_dir, project_dir, plugin_id, options) { + events.emit('verbose', 'lib-file.install is not supported for browser'); + }, + uninstall: function (obj, project_dir, plugin_id, options) { + events.emit('verbose', 'lib-file.uninstall is not supported for browser'); + } + }, + asset: { + install: function (asset, plugin_dir, wwwDest) { + var src = path.join(plugin_dir, asset.src); + var dest = path.join(wwwDest, asset.target); + var destDir = path.parse(dest).dir; + if (destDir !== '' && !fs.existsSync(destDir)) { + shell.mkdir('-p', destDir); + } + + if (fs.statSync(src).isDirectory()) { + shell.cp('-Rf', src + '/*', dest); + } else { + shell.cp('-f', src, dest); + } + }, + uninstall: function (asset, wwwDest, plugin_id) { + shell.rm('-rf', path.join(wwwDest, asset.target)); + shell.rm('-rf', path.join(wwwDest, 'plugins', plugin_id)); + } + } +}; diff --git a/test/resources/testSampleProject/platforms/browser/cordova/browser_parser.js b/test/resources/testSampleProject/platforms/browser/cordova/browser_parser.js new file mode 100644 index 00000000..99397c3a --- /dev/null +++ b/test/resources/testSampleProject/platforms/browser/cordova/browser_parser.js @@ -0,0 +1,120 @@ +/** + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +*/ + +var fs = require('fs'); +var path = require('path'); +var shell = require('shelljs'); +var CordovaError = require('cordova-common').CordovaError; +var events = require('cordova-common').events; +var FileUpdater = require('cordova-common').FileUpdater; + +function dirExists (dir) { + return fs.existsSync(dir) && fs.statSync(dir).isDirectory(); +} + +function browser_parser (project) { + if (!dirExists(project) || !dirExists(path.join(project, 'cordova'))) { + throw new CordovaError('The provided path "' + project + '" is not a valid browser project.'); + } + this.path = project; +} + +module.exports = browser_parser; + +// Returns a promise. +browser_parser.prototype.update_from_config = function () { + return Promise.resolve(); +}; + +browser_parser.prototype.www_dir = function () { + return path.join(this.path, 'www'); +}; + +// Used for creating platform_www in projects created by older versions. +browser_parser.prototype.cordovajs_path = function (libDir) { + var jsPath = path.join(libDir, 'cordova-lib', 'cordova.js'); + return path.resolve(jsPath); +}; + +browser_parser.prototype.cordovajs_src_path = function (libDir) { + // console.log("cordovajs_src_path"); + var jsPath = path.join(libDir, 'cordova-js-src'); + return path.resolve(jsPath); +}; + +/** + * Logs all file operations via the verbose event stream, indented. + */ +function logFileOp (message) { + events.emit('verbose', ' ' + message); +} + +// Replace the www dir with contents of platform_www and app www. +browser_parser.prototype.update_www = function (cordovaProject, opts) { + var platform_www = path.join(this.path, 'platform_www'); + var my_www = this.www_dir(); + // add cordova www and platform_www to sourceDirs + var sourceDirs = [ + path.relative(cordovaProject.root, cordovaProject.locations.www), + path.relative(cordovaProject.root, platform_www) + ]; + + // If project contains 'merges' for our platform, use them as another overrides + var merges_path = path.join(cordovaProject.root, 'merges', 'browser'); + if (fs.existsSync(merges_path)) { + events.emit('verbose', 'Found "merges/browser" folder. Copying its contents into the browser project.'); + // add merges/browser to sourceDirs + sourceDirs.push(path.join('merges', 'browser')); + } + + // targetDir points to browser/www + var targetDir = path.relative(cordovaProject.root, my_www); + events.emit('verbose', 'Merging and updating files from [' + sourceDirs.join(', ') + '] to ' + targetDir); + FileUpdater.mergeAndUpdateDir(sourceDirs, targetDir, { rootDir: cordovaProject.root }, logFileOp); +}; + +browser_parser.prototype.update_overrides = function () { + // console.log("update_overrides"); + + // TODO: ? + // var projectRoot = util.isCordova(this.path); + // var mergesPath = path.join(util.appDir(projectRoot), 'merges', 'browser'); + // if(fs.existsSync(mergesPath)) { + // var overrides = path.join(mergesPath, '*'); + // shell.cp('-rf', overrides, this.www_dir()); + // } +}; + +browser_parser.prototype.config_xml = function () { + return path.join(this.path, 'config.xml'); +}; + +// Returns a promise. +browser_parser.prototype.update_project = function (cfg) { + // console.log("update_project ",cfg); + var defer = this.update_from_config(); + var self = this; + var www_dir = self.www_dir(); + defer.then(function () { + self.update_overrides(); + // Copy munged config.xml to platform www dir + shell.cp('-rf', path.join(www_dir, '..', 'config.xml'), www_dir); + }); + return defer; +}; diff --git a/test/resources/testSampleProject/platforms/browser/cordova/build b/test/resources/testSampleProject/platforms/browser/cordova/build new file mode 100755 index 00000000..e867ab1b --- /dev/null +++ b/test/resources/testSampleProject/platforms/browser/cordova/build @@ -0,0 +1,34 @@ +#!/usr/bin/env node + +/* + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +*/ + + +var build = require('./lib/build'), + args = process.argv; + +// provide help +if ( args[2] == '--help' || args[2] == '/?' || args[2] == '-h' || args[2] == '/h' || + args[2] == 'help' || args[2] == '-help' || args[2] == '/help') { + build.help(); + process.exit(0); +} else { + + build.run(); +} diff --git a/test/resources/testSampleProject/platforms/browser/cordova/build.bat b/test/resources/testSampleProject/platforms/browser/cordova/build.bat new file mode 100644 index 00000000..02641bc8 --- /dev/null +++ b/test/resources/testSampleProject/platforms/browser/cordova/build.bat @@ -0,0 +1,26 @@ +:: Licensed to the Apache Software Foundation (ASF) under one +:: or more contributor license agreements. See the NOTICE file +:: distributed with this work for additional information +:: regarding copyright ownership. The ASF licenses this file +:: to you under the Apache License, Version 2.0 (the +:: "License"); you may not use this file except in compliance +:: with the License. You may obtain a copy of the License at +:: +:: http://www.apache.org/licenses/LICENSE-2.0 +:: +:: Unless required by applicable law or agreed to in writing, +:: software distributed under the License is distributed on an +:: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +:: KIND, either express or implied. See the License for the +:: specific language governing permissions and limitations +:: under the License. + +@ECHO OFF +SET script_path="%~dp0build" +IF EXIST %script_path% ( + node %script_path% %* +) ELSE ( + ECHO. + ECHO ERROR: Could not find 'build' script in 'cordova' folder, aborting...>&2 + EXIT /B 1 +) diff --git a/test/resources/testSampleProject/platforms/browser/cordova/clean b/test/resources/testSampleProject/platforms/browser/cordova/clean new file mode 100644 index 00000000..1852d66c --- /dev/null +++ b/test/resources/testSampleProject/platforms/browser/cordova/clean @@ -0,0 +1,36 @@ +#!/usr/bin/env node + +/* + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +*/ + + +var path = require('path'), + clean = require('./lib/clean'), + args = process.argv; + +// Support basic help commands +if ( args.length > 2 + || args[2] == '--help' || args[2] == '/?' || args[2] == '-h' || + args[2] == 'help' || args[2] == '-help' || args[2] == '/help') { + console.log('Usage: ' + path.relative(process.cwd(), path.join(__dirname, 'clean')) ); + process.exit(0); +} else { + clean.run(); +} + diff --git a/test/resources/testSampleProject/platforms/browser/cordova/clean.bat b/test/resources/testSampleProject/platforms/browser/cordova/clean.bat new file mode 100644 index 00000000..5c572aaf --- /dev/null +++ b/test/resources/testSampleProject/platforms/browser/cordova/clean.bat @@ -0,0 +1,26 @@ +:: Licensed to the Apache Software Foundation (ASF) under one +:: or more contributor license agreements. See the NOTICE file +:: distributed with this work for additional information +:: regarding copyright ownership. The ASF licenses this file +:: to you under the Apache License, Version 2.0 (the +:: "License"); you may not use this file except in compliance +:: with the License. You may obtain a copy of the License at +:: +:: http://www.apache.org/licenses/LICENSE-2.0 +:: +:: Unless required by applicable law or agreed to in writing, +:: software distributed under the License is distributed on an +:: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +:: KIND, either express or implied. See the License for the +:: specific language governing permissions and limitations +:: under the License. + +@ECHO OFF +SET script_path="%~dp0clean" +IF EXIST %script_path% ( + node %script_path% %* +) ELSE ( + ECHO. + ECHO ERROR: Could not find 'clean' script in 'cordova' folder, aborting...>&2 + EXIT /B 1 +) diff --git a/test/resources/testSampleProject/platforms/browser/cordova/defaults.xml b/test/resources/testSampleProject/platforms/browser/cordova/defaults.xml new file mode 100644 index 00000000..a7b31c04 --- /dev/null +++ b/test/resources/testSampleProject/platforms/browser/cordova/defaults.xml @@ -0,0 +1,22 @@ + + + + + diff --git a/test/resources/testSampleProject/platforms/browser/cordova/lib/build.js b/test/resources/testSampleProject/platforms/browser/cordova/lib/build.js new file mode 100644 index 00000000..01f3fb14 --- /dev/null +++ b/test/resources/testSampleProject/platforms/browser/cordova/lib/build.js @@ -0,0 +1,37 @@ +#!/usr/bin/env node + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +var path = require('path'); +var check_reqs = require('./check_reqs'); + +/** + * run + * Creates a zip file int platform/build folder + */ +module.exports.run = function () { + return check_reqs.run(); +}; + +module.exports.help = function () { + console.log('Usage: cordova build browser'); + var wwwPath = path.resolve(path.join(__dirname, '../../www')); + console.log("Build will create the packaged app in '" + wwwPath + "'."); +}; diff --git a/test/resources/testSampleProject/platforms/browser/cordova/lib/check_reqs.js b/test/resources/testSampleProject/platforms/browser/cordova/lib/check_reqs.js new file mode 100644 index 00000000..c615e149 --- /dev/null +++ b/test/resources/testSampleProject/platforms/browser/cordova/lib/check_reqs.js @@ -0,0 +1,27 @@ +#!/usr/bin/env node + +/* +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +*/ + +// add methods as we determine what are the requirements + +module.exports.run = function () { + // caller expects a promise resolved with an array of conditions + return Promise.resolve([]); +}; diff --git a/test/resources/testSampleProject/platforms/browser/cordova/lib/clean.js b/test/resources/testSampleProject/platforms/browser/cordova/lib/clean.js new file mode 100644 index 00000000..6ee76751 --- /dev/null +++ b/test/resources/testSampleProject/platforms/browser/cordova/lib/clean.js @@ -0,0 +1,51 @@ +#!/usr/bin/env node + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +var fs = require('fs'); +var shell = require('shelljs'); +var path = require('path'); +var check_reqs = require('./check_reqs'); +var platformBuildDir = path.join('platforms', 'browser', 'www'); + +var run = function () { + + // TODO: everything calls check_reqs ... why? + // Check that requirements are (still) met + if (!check_reqs.run()) { + console.error('Please make sure you meet the software requirements in order to clean an browser cordova project'); + process.exit(2); + } + + try { + if (fs.existsSync(platformBuildDir)) { + shell.rm('-r', platformBuildDir); + } + } catch (err) { + console.log('could not remove ' + platformBuildDir + ' : ' + err.message); + } +}; + +module.exports.run = run; +// just on the off chance something is still calling cleanProject, we will leave this here for a while +module.exports.cleanProject = function () { + console.log('lib/clean will soon only export a `run` command, please update to not call `cleanProject`.'); + return run(); +}; diff --git a/test/resources/testSampleProject/platforms/browser/cordova/lib/run.js b/test/resources/testSampleProject/platforms/browser/cordova/lib/run.js new file mode 100644 index 00000000..0846231d --- /dev/null +++ b/test/resources/testSampleProject/platforms/browser/cordova/lib/run.js @@ -0,0 +1,68 @@ +#!/usr/bin/env node + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +var fs = require('fs'); +var path = require('path'); +var url = require('url'); +var cordovaServe = require('cordova-serve'); + +module.exports.run = function (args) { + // defaults + args.port = args.port || 8000; + args.target = args.target || 'default'; // make default the system browser + args.noLogOutput = args.silent || false; + + var wwwPath = path.join(__dirname, '../../www'); + var manifestFilePath = path.resolve(path.join(wwwPath, 'manifest.json')); + + var startPage; + + // get start page from manifest + if (fs.existsSync(manifestFilePath)) { + try { + var manifest = require(manifestFilePath); + startPage = manifest.start_url; + } catch (err) { + console.log('failed to require manifest ... ' + err); + } + } + + var server = cordovaServe(); + server.servePlatform('browser', { port: args.port, noServerInfo: true, noLogOutput: args.noLogOutput }) + .then(function () { + if (!startPage) { + // failing all else, set the default + startPage = 'index.html'; + } + + var projectUrl = (new url.URL(`http://localhost:${server.port}/${startPage}`)).href; + + console.log('startPage = ' + startPage); + console.log('Static file server running @ ' + projectUrl + '\nCTRL + C to shut down'); + return server.launchBrowser({ 'target': args.target, 'url': projectUrl }); + }) + .catch(function (error) { + console.log(error.message || error.toString()); + if (server.server) { + server.server.close(); + } + }); +}; diff --git a/test/resources/testSampleProject/platforms/browser/cordova/log b/test/resources/testSampleProject/platforms/browser/cordova/log new file mode 100755 index 00000000..bb6fb8cd --- /dev/null +++ b/test/resources/testSampleProject/platforms/browser/cordova/log @@ -0,0 +1,20 @@ +#!/usr/bin/env node + +/* + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +*/ + +console.log("cordova/log"); \ No newline at end of file diff --git a/test/resources/testSampleProject/platforms/browser/cordova/run b/test/resources/testSampleProject/platforms/browser/cordova/run new file mode 100755 index 00000000..b41e2994 --- /dev/null +++ b/test/resources/testSampleProject/platforms/browser/cordova/run @@ -0,0 +1,53 @@ +#!/usr/bin/env node + +/* + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +*/ + +var fs = require('fs'), + path = require('path'), + nopt = require('nopt'), + url = require('url'), + runForrest = require('./lib/run'), + cordovaServe = require('cordova-serve'); + +var args = process.argv; + +start(args); + +function start(argv) { + var args = nopt({'help': Boolean, 'target': String, 'port': Number}, {'help': ['/?', '-h', 'help', '-help', '/help']}, argv); + if(args.help) { + help(); + } + else { + return runForrest.run(args); + } +} + +function help() { + console.log("\nUsage: run [ --target= ] [ --port= ]"); + console.log(" --target= : Launches the specified browser. Chrome is default."); + console.log(" --port= : Http server uses specified port number."); + console.log("Examples:"); + console.log(" run"); + console.log(" run -- --target=ie"); + console.log(" run -- --target=chrome --port=8000"); + console.log(""); + process.exit(0); +} diff --git a/test/resources/testSampleProject/platforms/browser/cordova/run.bat b/test/resources/testSampleProject/platforms/browser/cordova/run.bat new file mode 100644 index 00000000..b9c44028 --- /dev/null +++ b/test/resources/testSampleProject/platforms/browser/cordova/run.bat @@ -0,0 +1,26 @@ +:: Licensed to the Apache Software Foundation (ASF) under one +:: or more contributor license agreements. See the NOTICE file +:: distributed with this work for additional information +:: regarding copyright ownership. The ASF licenses this file +:: to you under the Apache License, Version 2.0 (the +:: "License"); you may not use this file except in compliance +:: with the License. You may obtain a copy of the License at +:: +:: http://www.apache.org/licenses/LICENSE-2.0 +:: +:: Unless required by applicable law or agreed to in writing, +:: software distributed under the License is distributed on an +:: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +:: KIND, either express or implied. See the License for the +:: specific language governing permissions and limitations +:: under the License. + +@ECHO OFF +SET script_path="%~dp0run" +IF EXIST %script_path% ( + node %script_path% %* +) ELSE ( + ECHO. + ECHO ERROR: Could not find 'run' script in 'cordova' folder, aborting...>&2 + EXIT /B 1 +) diff --git a/test/resources/testSampleProject/platforms/browser/cordova/version b/test/resources/testSampleProject/platforms/browser/cordova/version new file mode 100755 index 00000000..814b805d --- /dev/null +++ b/test/resources/testSampleProject/platforms/browser/cordova/version @@ -0,0 +1,25 @@ +#!/usr/bin/env node + +/* + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +*/ + +// Coho updates this line: +var VERSION = "6.0.0"; + +console.log(VERSION); diff --git a/test/resources/testSampleProject/platforms/browser/cordova/version.bat b/test/resources/testSampleProject/platforms/browser/cordova/version.bat new file mode 100644 index 00000000..3610c17b --- /dev/null +++ b/test/resources/testSampleProject/platforms/browser/cordova/version.bat @@ -0,0 +1,26 @@ +:: Licensed to the Apache Software Foundation (ASF) under one +:: or more contributor license agreements. See the NOTICE file +:: distributed with this work for additional information +:: regarding copyright ownership. The ASF licenses this file +:: to you under the Apache License, Version 2.0 (the +:: "License"); you may not use this file except in compliance +:: with the License. You may obtain a copy of the License at +:: +:: http://www.apache.org/licenses/LICENSE-2.0 +:: +:: Unless required by applicable law or agreed to in writing, +:: software distributed under the License is distributed on an +:: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +:: KIND, either express or implied. See the License for the +:: specific language governing permissions and limitations +:: under the License. + +@ECHO OFF +SET script_path="%~dp0version" +IF EXIST %script_path% ( + node %script_path% %* +) ELSE ( + ECHO. + ECHO ERROR: Could not find 'version' script in 'cordova' folder, aborting...>&2 + EXIT /B 1 +) diff --git a/test/resources/testSampleProject/platforms/browser/platform_www/cordova-js-src/confighelper.js b/test/resources/testSampleProject/platforms/browser/platform_www/cordova-js-src/confighelper.js new file mode 100644 index 00000000..34d8b19d --- /dev/null +++ b/test/resources/testSampleProject/platforms/browser/platform_www/cordova-js-src/confighelper.js @@ -0,0 +1,90 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * +*/ + +var config; + +function Config(xhr) { + function loadPreferences(xhr) { + var parser = new DOMParser(); + var doc = parser.parseFromString(xhr.responseText, "application/xml"); + + var preferences = doc.getElementsByTagName("preference"); + return Array.prototype.slice.call(preferences); + } + + this.xhr = xhr; + this.preferences = loadPreferences(this.xhr); +} + +function readConfig(success, error) { + var xhr; + + if(typeof config != 'undefined') { + success(config); + } + + function fail(msg) { + console.error(msg); + + if(error) { + error(msg); + } + } + + var xhrStatusChangeHandler = function() { + if (xhr.readyState == 4) { + if (xhr.status == 200 || xhr.status == 304 || xhr.status === 0 /* file:// */) { + config = new Config(xhr); + success(config); + } + else { + fail('[Browser][cordova.js][xhrStatusChangeHandler] Could not XHR config.xml: ' + xhr.statusText); + } + } + }; + + xhr = new XMLHttpRequest(); + xhr.addEventListener("load", xhrStatusChangeHandler); + + + try { + xhr.open("get", "config.xml", true); + xhr.send(); + } catch(e) { + fail('[Browser][cordova.js][readConfig] Could not XHR config.xml: ' + JSON.stringify(e)); + } +} + +/** + * Reads a preference value from config.xml. + * Returns preference value or undefined if it does not exist. + * @param {String} preferenceName Preference name to read */ +Config.prototype.getPreferenceValue = function getPreferenceValue(preferenceName) { + var preferenceItem = this.preferences && this.preferences.filter(function(item) { + return item.attributes.name && item.attributes.name.value === preferenceName; + }); + + if(preferenceItem && preferenceItem[0] && preferenceItem[0].attributes && preferenceItem[0].attributes.value) { + return preferenceItem[0].attributes.value.value; + } +}; + +exports.readConfig = readConfig; diff --git a/test/resources/testSampleProject/platforms/browser/platform_www/cordova-js-src/exec.js b/test/resources/testSampleProject/platforms/browser/platform_www/cordova-js-src/exec.js new file mode 100644 index 00000000..97f736a2 --- /dev/null +++ b/test/resources/testSampleProject/platforms/browser/platform_www/cordova-js-src/exec.js @@ -0,0 +1,114 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * +*/ + +/*jslint sloppy:true, plusplus:true*/ +/*global require, module, console */ + +var cordova = require('cordova'); +var execProxy = require('cordova/exec/proxy'); + +/** + * Execute a cordova command. It is up to the native side whether this action + * is synchronous or asynchronous. The native side can return: + * Synchronous: PluginResult object as a JSON string + * Asynchronous: Empty string "" + * If async, the native side will cordova.callbackSuccess or cordova.callbackError, + * depending upon the result of the action. + * + * @param {Function} success The success callback + * @param {Function} fail The fail callback + * @param {String} service The name of the service to use + * @param {String} action Action to be run in cordova + * @param {String[]} [args] Zero or more arguments to pass to the method + */ +module.exports = function (success, fail, service, action, args) { + + var proxy = execProxy.get(service, action); + + args = args || []; + + if (proxy) { + + var callbackId = service + cordova.callbackId++; + + if (typeof success === "function" || typeof fail === "function") { + cordova.callbacks[callbackId] = {success: success, fail: fail}; + } + try { + + + + // callbackOptions param represents additional optional parameters command could pass back, like keepCallback or + // custom callbackId, for example {callbackId: id, keepCallback: true, status: cordova.callbackStatus.JSON_EXCEPTION } + var onSuccess = function (result, callbackOptions) { + callbackOptions = callbackOptions || {}; + var callbackStatus; + // covering both undefined and null. + // strict null comparison was causing callbackStatus to be undefined + // and then no callback was called because of the check in cordova.callbackFromNative + // see CB-8996 Mobilespec app hang on windows + if (callbackOptions.status !== undefined && callbackOptions.status !== null) { + callbackStatus = callbackOptions.status; + } + else { + callbackStatus = cordova.callbackStatus.OK; + } + cordova.callbackSuccess(callbackOptions.callbackId || callbackId, + { + status: callbackStatus, + message: result, + keepCallback: callbackOptions.keepCallback || false + }); + }; + var onError = function (err, callbackOptions) { + callbackOptions = callbackOptions || {}; + var callbackStatus; + // covering both undefined and null. + // strict null comparison was causing callbackStatus to be undefined + // and then no callback was called because of the check in cordova.callbackFromNative + // note: status can be 0 + if (callbackOptions.status !== undefined && callbackOptions.status !== null) { + callbackStatus = callbackOptions.status; + } + else { + callbackStatus = cordova.callbackStatus.OK; + } + cordova.callbackError(callbackOptions.callbackId || callbackId, + { + status: callbackStatus, + message: err, + keepCallback: callbackOptions.keepCallback || false + }); + }; + proxy(onSuccess, onError, args); + + } catch (e) { + console.log("Exception calling native with command :: " + service + " :: " + action + " ::exception=" + e); + } + } else { + + console.log("Error: exec proxy not found for :: " + service + " :: " + action); + + if(typeof fail === "function" ) { + fail("Missing Command Error"); + } + } +}; diff --git a/test/resources/testSampleProject/platforms/browser/platform_www/cordova-js-src/platform.js b/test/resources/testSampleProject/platforms/browser/platform_www/cordova-js-src/platform.js new file mode 100644 index 00000000..96eb943a --- /dev/null +++ b/test/resources/testSampleProject/platforms/browser/platform_www/cordova-js-src/platform.js @@ -0,0 +1,46 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 = { + id: 'browser', + cordovaVersion: '4.2.0', // cordova-js + + bootstrap: function() { + + var modulemapper = require('cordova/modulemapper'); + var channel = require('cordova/channel'); + + modulemapper.clobbers('cordova/exec/proxy', 'cordova.commandProxy'); + + channel.onNativeReady.fire(); + + document.addEventListener("visibilitychange", function(){ + if(document.hidden) { + channel.onPause.fire(); + } + else { + channel.onResume.fire(); + } + }); + + // End of bootstrap + } +}; diff --git a/test/resources/testSampleProject/platforms/browser/platform_www/cordova.js b/test/resources/testSampleProject/platforms/browser/platform_www/cordova.js new file mode 100644 index 00000000..02de9c75 --- /dev/null +++ b/test/resources/testSampleProject/platforms/browser/platform_www/cordova.js @@ -0,0 +1,1594 @@ +// Platform: browser +// d07d9d0989196f1b90fe962ca68f5ceb355c69ec +/* + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +*/ +;(function() { +var PLATFORM_VERSION_BUILD_LABEL = '6.0.0'; +// file: src/scripts/require.js + +var require; +var define; + +(function () { + var modules = {}; + // Stack of moduleIds currently being built. + var requireStack = []; + // Map of module ID -> index into requireStack of modules currently being built. + var inProgressModules = {}; + var SEPARATOR = '.'; + + function build (module) { + var factory = module.factory; + var localRequire = function (id) { + var resultantId = id; + // Its a relative path, so lop off the last portion and add the id (minus "./") + if (id.charAt(0) === '.') { + resultantId = module.id.slice(0, module.id.lastIndexOf(SEPARATOR)) + SEPARATOR + id.slice(2); + } + return require(resultantId); + }; + module.exports = {}; + delete module.factory; + factory(localRequire, module.exports, module); + return module.exports; + } + + require = function (id) { + if (!modules[id]) { + throw 'module ' + id + ' not found'; + } else if (id in inProgressModules) { + var cycle = requireStack.slice(inProgressModules[id]).join('->') + '->' + id; + throw 'Cycle in require graph: ' + cycle; + } + if (modules[id].factory) { + try { + inProgressModules[id] = requireStack.length; + requireStack.push(id); + return build(modules[id]); + } finally { + delete inProgressModules[id]; + requireStack.pop(); + } + } + return modules[id].exports; + }; + + define = function (id, factory) { + if (modules[id]) { + throw 'module ' + id + ' already defined'; + } + + modules[id] = { + id: id, + factory: factory + }; + }; + + define.remove = function (id) { + delete modules[id]; + }; + + define.moduleMap = modules; +})(); + +// Export for use in node +if (typeof module === 'object' && typeof require === 'function') { + module.exports.require = require; + module.exports.define = define; +} + +// file: src/cordova.js +define("cordova", function(require, exports, module) { + +// Workaround for Windows 10 in hosted environment case +// http://www.w3.org/html/wg/drafts/html/master/browsers.html#named-access-on-the-window-object +if (window.cordova && !(window.cordova instanceof HTMLElement)) { // eslint-disable-line no-undef + throw new Error('cordova already defined'); +} + +var channel = require('cordova/channel'); +var platform = require('cordova/platform'); + +/** + * Intercept calls to addEventListener + removeEventListener and handle deviceready, + * resume, and pause events. + */ +var m_document_addEventListener = document.addEventListener; +var m_document_removeEventListener = document.removeEventListener; +var m_window_addEventListener = window.addEventListener; +var m_window_removeEventListener = window.removeEventListener; + +/** + * Houses custom event handlers to intercept on document + window event listeners. + */ +var documentEventHandlers = {}; +var windowEventHandlers = {}; + +document.addEventListener = function (evt, handler, capture) { + var e = evt.toLowerCase(); + if (typeof documentEventHandlers[e] !== 'undefined') { + documentEventHandlers[e].subscribe(handler); + } else { + m_document_addEventListener.call(document, evt, handler, capture); + } +}; + +window.addEventListener = function (evt, handler, capture) { + var e = evt.toLowerCase(); + if (typeof windowEventHandlers[e] !== 'undefined') { + windowEventHandlers[e].subscribe(handler); + } else { + m_window_addEventListener.call(window, evt, handler, capture); + } +}; + +document.removeEventListener = function (evt, handler, capture) { + var e = evt.toLowerCase(); + // If unsubscribing from an event that is handled by a plugin + if (typeof documentEventHandlers[e] !== 'undefined') { + documentEventHandlers[e].unsubscribe(handler); + } else { + m_document_removeEventListener.call(document, evt, handler, capture); + } +}; + +window.removeEventListener = function (evt, handler, capture) { + var e = evt.toLowerCase(); + // If unsubscribing from an event that is handled by a plugin + if (typeof windowEventHandlers[e] !== 'undefined') { + windowEventHandlers[e].unsubscribe(handler); + } else { + m_window_removeEventListener.call(window, evt, handler, capture); + } +}; + +function createEvent (type, data) { + var event = document.createEvent('Events'); + event.initEvent(type, false, false); + if (data) { + for (var i in data) { + if (data.hasOwnProperty(i)) { + event[i] = data[i]; + } + } + } + return event; +} + +/* eslint-disable no-undef */ +var cordova = { + define: define, + require: require, + version: PLATFORM_VERSION_BUILD_LABEL, + platformVersion: PLATFORM_VERSION_BUILD_LABEL, + platformId: platform.id, + + /* eslint-enable no-undef */ + + /** + * Methods to add/remove your own addEventListener hijacking on document + window. + */ + addWindowEventHandler: function (event) { + return (windowEventHandlers[event] = channel.create(event)); + }, + addStickyDocumentEventHandler: function (event) { + return (documentEventHandlers[event] = channel.createSticky(event)); + }, + addDocumentEventHandler: function (event) { + return (documentEventHandlers[event] = channel.create(event)); + }, + removeWindowEventHandler: function (event) { + delete windowEventHandlers[event]; + }, + removeDocumentEventHandler: function (event) { + delete documentEventHandlers[event]; + }, + /** + * Retrieve original event handlers that were replaced by Cordova + * + * @return object + */ + getOriginalHandlers: function () { + return {'document': {'addEventListener': m_document_addEventListener, 'removeEventListener': m_document_removeEventListener}, + 'window': {'addEventListener': m_window_addEventListener, 'removeEventListener': m_window_removeEventListener}}; + }, + /** + * Method to fire event from native code + * bNoDetach is required for events which cause an exception which needs to be caught in native code + */ + fireDocumentEvent: function (type, data, bNoDetach) { + var evt = createEvent(type, data); + if (typeof documentEventHandlers[type] !== 'undefined') { + if (bNoDetach) { + documentEventHandlers[type].fire(evt); + } else { + setTimeout(function () { + // Fire deviceready on listeners that were registered before cordova.js was loaded. + if (type === 'deviceready') { + document.dispatchEvent(evt); + } + documentEventHandlers[type].fire(evt); + }, 0); + } + } else { + document.dispatchEvent(evt); + } + }, + fireWindowEvent: function (type, data) { + var evt = createEvent(type, data); + if (typeof windowEventHandlers[type] !== 'undefined') { + setTimeout(function () { + windowEventHandlers[type].fire(evt); + }, 0); + } else { + window.dispatchEvent(evt); + } + }, + + /** + * Plugin callback mechanism. + */ + // Randomize the starting callbackId to avoid collisions after refreshing or navigating. + // This way, it's very unlikely that any new callback would get the same callbackId as an old callback. + callbackId: Math.floor(Math.random() * 2000000000), + callbacks: {}, + callbackStatus: { + NO_RESULT: 0, + OK: 1, + CLASS_NOT_FOUND_EXCEPTION: 2, + ILLEGAL_ACCESS_EXCEPTION: 3, + INSTANTIATION_EXCEPTION: 4, + MALFORMED_URL_EXCEPTION: 5, + IO_EXCEPTION: 6, + INVALID_ACTION: 7, + JSON_EXCEPTION: 8, + ERROR: 9 + }, + + /** + * Called by native code when returning successful result from an action. + */ + callbackSuccess: function (callbackId, args) { + cordova.callbackFromNative(callbackId, true, args.status, [args.message], args.keepCallback); + }, + + /** + * Called by native code when returning error result from an action. + */ + callbackError: function (callbackId, args) { + // TODO: Deprecate callbackSuccess and callbackError in favour of callbackFromNative. + // Derive success from status. + cordova.callbackFromNative(callbackId, false, args.status, [args.message], args.keepCallback); + }, + + /** + * Called by native code when returning the result from an action. + */ + callbackFromNative: function (callbackId, isSuccess, status, args, keepCallback) { + try { + var callback = cordova.callbacks[callbackId]; + if (callback) { + if (isSuccess && status === cordova.callbackStatus.OK) { + callback.success && callback.success.apply(null, args); + } else if (!isSuccess) { + callback.fail && callback.fail.apply(null, args); + } + /* + else + Note, this case is intentionally not caught. + this can happen if isSuccess is true, but callbackStatus is NO_RESULT + which is used to remove a callback from the list without calling the callbacks + typically keepCallback is false in this case + */ + // Clear callback if not expecting any more results + if (!keepCallback) { + delete cordova.callbacks[callbackId]; + } + } + } catch (err) { + var msg = 'Error in ' + (isSuccess ? 'Success' : 'Error') + ' callbackId: ' + callbackId + ' : ' + err; + console && console.log && console.log(msg); + console && console.log && err.stack && console.log(err.stack); + cordova.fireWindowEvent('cordovacallbackerror', { 'message': msg }); + throw err; + } + }, + addConstructor: function (func) { + channel.onCordovaReady.subscribe(function () { + try { + func(); + } catch (e) { + console.log('Failed to run constructor: ' + e); + } + }); + } +}; + +module.exports = cordova; + +}); + +// file: src/common/argscheck.js +define("cordova/argscheck", function(require, exports, module) { + +var utils = require('cordova/utils'); + +var moduleExports = module.exports; + +var typeMap = { + 'A': 'Array', + 'D': 'Date', + 'N': 'Number', + 'S': 'String', + 'F': 'Function', + 'O': 'Object' +}; + +function extractParamName (callee, argIndex) { + return (/.*?\((.*?)\)/).exec(callee)[1].split(', ')[argIndex]; +} + +function checkArgs (spec, functionName, args, opt_callee) { + if (!moduleExports.enableChecks) { + return; + } + var errMsg = null; + var typeName; + for (var i = 0; i < spec.length; ++i) { + var c = spec.charAt(i); + var cUpper = c.toUpperCase(); + var arg = args[i]; + // Asterix means allow anything. + if (c === '*') { + continue; + } + typeName = utils.typeName(arg); + if ((arg === null || arg === undefined) && c === cUpper) { + continue; + } + if (typeName !== typeMap[cUpper]) { + errMsg = 'Expected ' + typeMap[cUpper]; + break; + } + } + if (errMsg) { + errMsg += ', but got ' + typeName + '.'; + errMsg = 'Wrong type for parameter "' + extractParamName(opt_callee || args.callee, i) + '" of ' + functionName + ': ' + errMsg; + // Don't log when running unit tests. + if (typeof jasmine === 'undefined') { + console.error(errMsg); + } + throw TypeError(errMsg); + } +} + +function getValue (value, defaultValue) { + return value === undefined ? defaultValue : value; +} + +moduleExports.checkArgs = checkArgs; +moduleExports.getValue = getValue; +moduleExports.enableChecks = true; + +}); + +// file: src/common/base64.js +define("cordova/base64", function(require, exports, module) { + +var base64 = exports; + +base64.fromArrayBuffer = function (arrayBuffer) { + var array = new Uint8Array(arrayBuffer); + return uint8ToBase64(array); +}; + +base64.toArrayBuffer = function (str) { + var decodedStr = typeof atob !== 'undefined' ? atob(str) : Buffer.from(str, 'base64').toString('binary'); // eslint-disable-line no-undef + var arrayBuffer = new ArrayBuffer(decodedStr.length); + var array = new Uint8Array(arrayBuffer); + for (var i = 0, len = decodedStr.length; i < len; i++) { + array[i] = decodedStr.charCodeAt(i); + } + return arrayBuffer; +}; + +// ------------------------------------------------------------------------------ + +/* This code is based on the performance tests at http://jsperf.com/b64tests + * This 12-bit-at-a-time algorithm was the best performing version on all + * platforms tested. + */ + +var b64_6bit = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; +var b64_12bit; + +var b64_12bitTable = function () { + b64_12bit = []; + for (var i = 0; i < 64; i++) { + for (var j = 0; j < 64; j++) { + b64_12bit[i * 64 + j] = b64_6bit[i] + b64_6bit[j]; + } + } + b64_12bitTable = function () { return b64_12bit; }; + return b64_12bit; +}; + +function uint8ToBase64 (rawData) { + var numBytes = rawData.byteLength; + var output = ''; + var segment; + var table = b64_12bitTable(); + for (var i = 0; i < numBytes - 2; i += 3) { + segment = (rawData[i] << 16) + (rawData[i + 1] << 8) + rawData[i + 2]; + output += table[segment >> 12]; + output += table[segment & 0xfff]; + } + if (numBytes - i === 2) { + segment = (rawData[i] << 16) + (rawData[i + 1] << 8); + output += table[segment >> 12]; + output += b64_6bit[(segment & 0xfff) >> 6]; + output += '='; + } else if (numBytes - i === 1) { + segment = (rawData[i] << 16); + output += table[segment >> 12]; + output += '=='; + } + return output; +} + +}); + +// file: src/common/builder.js +define("cordova/builder", function(require, exports, module) { + +var utils = require('cordova/utils'); + +function each (objects, func, context) { + for (var prop in objects) { + if (objects.hasOwnProperty(prop)) { + func.apply(context, [objects[prop], prop]); + } + } +} + +function clobber (obj, key, value) { + exports.replaceHookForTesting(obj, key); + var needsProperty = false; + try { + obj[key] = value; + } catch (e) { + needsProperty = true; + } + // Getters can only be overridden by getters. + if (needsProperty || obj[key] !== value) { + utils.defineGetter(obj, key, function () { + return value; + }); + } +} + +function assignOrWrapInDeprecateGetter (obj, key, value, message) { + if (message) { + utils.defineGetter(obj, key, function () { + console.log(message); + delete obj[key]; + clobber(obj, key, value); + return value; + }); + } else { + clobber(obj, key, value); + } +} + +function include (parent, objects, clobber, merge) { + each(objects, function (obj, key) { + try { + var result = obj.path ? require(obj.path) : {}; + + if (clobber) { + // Clobber if it doesn't exist. + if (typeof parent[key] === 'undefined') { + assignOrWrapInDeprecateGetter(parent, key, result, obj.deprecated); + } else if (typeof obj.path !== 'undefined') { + // If merging, merge properties onto parent, otherwise, clobber. + if (merge) { + recursiveMerge(parent[key], result); + } else { + assignOrWrapInDeprecateGetter(parent, key, result, obj.deprecated); + } + } + result = parent[key]; + } else { + // Overwrite if not currently defined. + if (typeof parent[key] === 'undefined') { + assignOrWrapInDeprecateGetter(parent, key, result, obj.deprecated); + } else { + // Set result to what already exists, so we can build children into it if they exist. + result = parent[key]; + } + } + + if (obj.children) { + include(result, obj.children, clobber, merge); + } + } catch (e) { + utils.alert('Exception building Cordova JS globals: ' + e + ' for key "' + key + '"'); + } + }); +} + +/** + * Merge properties from one object onto another recursively. Properties from + * the src object will overwrite existing target property. + * + * @param target Object to merge properties into. + * @param src Object to merge properties from. + */ +function recursiveMerge (target, src) { + for (var prop in src) { + if (src.hasOwnProperty(prop)) { + if (target.prototype && target.prototype.constructor === target) { + // If the target object is a constructor override off prototype. + clobber(target.prototype, prop, src[prop]); + } else { + if (typeof src[prop] === 'object' && typeof target[prop] === 'object') { + recursiveMerge(target[prop], src[prop]); + } else { + clobber(target, prop, src[prop]); + } + } + } + } +} + +exports.buildIntoButDoNotClobber = function (objects, target) { + include(target, objects, false, false); +}; +exports.buildIntoAndClobber = function (objects, target) { + include(target, objects, true, false); +}; +exports.buildIntoAndMerge = function (objects, target) { + include(target, objects, true, true); +}; +exports.recursiveMerge = recursiveMerge; +exports.assignOrWrapInDeprecateGetter = assignOrWrapInDeprecateGetter; +exports.replaceHookForTesting = function () {}; + +}); + +// file: src/common/channel.js +define("cordova/channel", function(require, exports, module) { + +var utils = require('cordova/utils'); +var nextGuid = 1; + +/** + * Custom pub-sub "channel" that can have functions subscribed to it + * This object is used to define and control firing of events for + * cordova initialization, as well as for custom events thereafter. + * + * The order of events during page load and Cordova startup is as follows: + * + * onDOMContentLoaded* Internal event that is received when the web page is loaded and parsed. + * onNativeReady* Internal event that indicates the Cordova native side is ready. + * onCordovaReady* Internal event fired when all Cordova JavaScript objects have been created. + * onDeviceReady* User event fired to indicate that Cordova is ready + * onResume User event fired to indicate a start/resume lifecycle event + * onPause User event fired to indicate a pause lifecycle event + * + * The events marked with an * are sticky. Once they have fired, they will stay in the fired state. + * All listeners that subscribe after the event is fired will be executed right away. + * + * The only Cordova events that user code should register for are: + * deviceready Cordova native code is initialized and Cordova APIs can be called from JavaScript + * pause App has moved to background + * resume App has returned to foreground + * + * Listeners can be registered as: + * document.addEventListener("deviceready", myDeviceReadyListener, false); + * document.addEventListener("resume", myResumeListener, false); + * document.addEventListener("pause", myPauseListener, false); + * + * The DOM lifecycle events should be used for saving and restoring state + * window.onload + * window.onunload + * + */ + +/** + * Channel + * @constructor + * @param type String the channel name + */ +var Channel = function (type, sticky) { + this.type = type; + // Map of guid -> function. + this.handlers = {}; + // 0 = Non-sticky, 1 = Sticky non-fired, 2 = Sticky fired. + this.state = sticky ? 1 : 0; + // Used in sticky mode to remember args passed to fire(). + this.fireArgs = null; + // Used by onHasSubscribersChange to know if there are any listeners. + this.numHandlers = 0; + // Function that is called when the first listener is subscribed, or when + // the last listener is unsubscribed. + this.onHasSubscribersChange = null; +}; +var channel = { + /** + * Calls the provided function only after all of the channels specified + * have been fired. All channels must be sticky channels. + */ + join: function (h, c) { + var len = c.length; + var i = len; + var f = function () { + if (!(--i)) h(); + }; + for (var j = 0; j < len; j++) { + if (c[j].state === 0) { + throw Error('Can only use join with sticky channels.'); + } + c[j].subscribe(f); + } + if (!len) h(); + }, + /* eslint-disable no-return-assign */ + create: function (type) { + return channel[type] = new Channel(type, false); + }, + createSticky: function (type) { + return channel[type] = new Channel(type, true); + }, + /* eslint-enable no-return-assign */ + /** + * cordova Channels that must fire before "deviceready" is fired. + */ + deviceReadyChannelsArray: [], + deviceReadyChannelsMap: {}, + + /** + * Indicate that a feature needs to be initialized before it is ready to be used. + * This holds up Cordova's "deviceready" event until the feature has been initialized + * and Cordova.initComplete(feature) is called. + * + * @param feature {String} The unique feature name + */ + waitForInitialization: function (feature) { + if (feature) { + var c = channel[feature] || this.createSticky(feature); + this.deviceReadyChannelsMap[feature] = c; + this.deviceReadyChannelsArray.push(c); + } + }, + + /** + * Indicate that initialization code has completed and the feature is ready to be used. + * + * @param feature {String} The unique feature name + */ + initializationComplete: function (feature) { + var c = this.deviceReadyChannelsMap[feature]; + if (c) { + c.fire(); + } + } +}; + +function checkSubscriptionArgument (argument) { + if (typeof argument !== 'function' && typeof argument.handleEvent !== 'function') { + throw new Error( + 'Must provide a function or an EventListener object ' + + 'implementing the handleEvent interface.' + ); + } +} + +/** + * Subscribes the given function to the channel. Any time that + * Channel.fire is called so too will the function. + * Optionally specify an execution context for the function + * and a guid that can be used to stop subscribing to the channel. + * Returns the guid. + */ +Channel.prototype.subscribe = function (eventListenerOrFunction, eventListener) { + checkSubscriptionArgument(eventListenerOrFunction); + var handleEvent, guid; + + if (eventListenerOrFunction && typeof eventListenerOrFunction === 'object') { + // Received an EventListener object implementing the handleEvent interface + handleEvent = eventListenerOrFunction.handleEvent; + eventListener = eventListenerOrFunction; + } else { + // Received a function to handle event + handleEvent = eventListenerOrFunction; + } + + if (this.state === 2) { + handleEvent.apply(eventListener || this, this.fireArgs); + return; + } + + guid = eventListenerOrFunction.observer_guid; + if (typeof eventListener === 'object') { + handleEvent = utils.close(eventListener, handleEvent); + } + + if (!guid) { + // First time any channel has seen this subscriber + guid = '' + nextGuid++; + } + handleEvent.observer_guid = guid; + eventListenerOrFunction.observer_guid = guid; + + // Don't add the same handler more than once. + if (!this.handlers[guid]) { + this.handlers[guid] = handleEvent; + this.numHandlers++; + if (this.numHandlers === 1) { + this.onHasSubscribersChange && this.onHasSubscribersChange(); + } + } +}; + +/** + * Unsubscribes the function with the given guid from the channel. + */ +Channel.prototype.unsubscribe = function (eventListenerOrFunction) { + checkSubscriptionArgument(eventListenerOrFunction); + var handleEvent, guid, handler; + + if (eventListenerOrFunction && typeof eventListenerOrFunction === 'object') { + // Received an EventListener object implementing the handleEvent interface + handleEvent = eventListenerOrFunction.handleEvent; + } else { + // Received a function to handle event + handleEvent = eventListenerOrFunction; + } + + guid = handleEvent.observer_guid; + handler = this.handlers[guid]; + if (handler) { + delete this.handlers[guid]; + this.numHandlers--; + if (this.numHandlers === 0) { + this.onHasSubscribersChange && this.onHasSubscribersChange(); + } + } +}; + +/** + * Calls all functions subscribed to this channel. + */ +Channel.prototype.fire = function (e) { + var fail = false; // eslint-disable-line no-unused-vars + var fireArgs = Array.prototype.slice.call(arguments); + // Apply stickiness. + if (this.state === 1) { + this.state = 2; + this.fireArgs = fireArgs; + } + if (this.numHandlers) { + // Copy the values first so that it is safe to modify it from within + // callbacks. + var toCall = []; + for (var item in this.handlers) { + toCall.push(this.handlers[item]); + } + for (var i = 0; i < toCall.length; ++i) { + toCall[i].apply(this, fireArgs); + } + if (this.state === 2 && this.numHandlers) { + this.numHandlers = 0; + this.handlers = {}; + this.onHasSubscribersChange && this.onHasSubscribersChange(); + } + } +}; + +// defining them here so they are ready super fast! +// DOM event that is received when the web page is loaded and parsed. +channel.createSticky('onDOMContentLoaded'); + +// Event to indicate the Cordova native side is ready. +channel.createSticky('onNativeReady'); + +// Event to indicate that all Cordova JavaScript objects have been created +// and it's time to run plugin constructors. +channel.createSticky('onCordovaReady'); + +// Event to indicate that all automatically loaded JS plugins are loaded and ready. +// FIXME remove this +channel.createSticky('onPluginsReady'); + +// Event to indicate that Cordova is ready +channel.createSticky('onDeviceReady'); + +// Event to indicate a resume lifecycle event +channel.create('onResume'); + +// Event to indicate a pause lifecycle event +channel.create('onPause'); + +// Channels that must fire before "deviceready" is fired. +channel.waitForInitialization('onCordovaReady'); +channel.waitForInitialization('onDOMContentLoaded'); + +module.exports = channel; + +}); + +// file: /Users/erisu/git/apache/cordova/cordova-browser/cordova-js-src/confighelper.js +define("cordova/confighelper", function(require, exports, module) { + +var config; + +function Config(xhr) { + function loadPreferences(xhr) { + var parser = new DOMParser(); + var doc = parser.parseFromString(xhr.responseText, "application/xml"); + + var preferences = doc.getElementsByTagName("preference"); + return Array.prototype.slice.call(preferences); + } + + this.xhr = xhr; + this.preferences = loadPreferences(this.xhr); +} + +function readConfig(success, error) { + var xhr; + + if(typeof config != 'undefined') { + success(config); + } + + function fail(msg) { + console.error(msg); + + if(error) { + error(msg); + } + } + + var xhrStatusChangeHandler = function() { + if (xhr.readyState == 4) { + if (xhr.status == 200 || xhr.status == 304 || xhr.status === 0 /* file:// */) { + config = new Config(xhr); + success(config); + } + else { + fail('[Browser][cordova.js][xhrStatusChangeHandler] Could not XHR config.xml: ' + xhr.statusText); + } + } + }; + + xhr = new XMLHttpRequest(); + xhr.addEventListener("load", xhrStatusChangeHandler); + + + try { + xhr.open("get", "config.xml", true); + xhr.send(); + } catch(e) { + fail('[Browser][cordova.js][readConfig] Could not XHR config.xml: ' + JSON.stringify(e)); + } +} + +/** + * Reads a preference value from config.xml. + * Returns preference value or undefined if it does not exist. + * @param {String} preferenceName Preference name to read */ +Config.prototype.getPreferenceValue = function getPreferenceValue(preferenceName) { + var preferenceItem = this.preferences && this.preferences.filter(function(item) { + return item.attributes.name && item.attributes.name.value === preferenceName; + }); + + if(preferenceItem && preferenceItem[0] && preferenceItem[0].attributes && preferenceItem[0].attributes.value) { + return preferenceItem[0].attributes.value.value; + } +}; + +exports.readConfig = readConfig; + +}); + +// file: /Users/erisu/git/apache/cordova/cordova-browser/cordova-js-src/exec.js +define("cordova/exec", function(require, exports, module) { + +/*jslint sloppy:true, plusplus:true*/ +/*global require, module, console */ + +var cordova = require('cordova'); +var execProxy = require('cordova/exec/proxy'); + +/** + * Execute a cordova command. It is up to the native side whether this action + * is synchronous or asynchronous. The native side can return: + * Synchronous: PluginResult object as a JSON string + * Asynchronous: Empty string "" + * If async, the native side will cordova.callbackSuccess or cordova.callbackError, + * depending upon the result of the action. + * + * @param {Function} success The success callback + * @param {Function} fail The fail callback + * @param {String} service The name of the service to use + * @param {String} action Action to be run in cordova + * @param {String[]} [args] Zero or more arguments to pass to the method + */ +module.exports = function (success, fail, service, action, args) { + + var proxy = execProxy.get(service, action); + + args = args || []; + + if (proxy) { + + var callbackId = service + cordova.callbackId++; + + if (typeof success === "function" || typeof fail === "function") { + cordova.callbacks[callbackId] = {success: success, fail: fail}; + } + try { + + + + // callbackOptions param represents additional optional parameters command could pass back, like keepCallback or + // custom callbackId, for example {callbackId: id, keepCallback: true, status: cordova.callbackStatus.JSON_EXCEPTION } + var onSuccess = function (result, callbackOptions) { + callbackOptions = callbackOptions || {}; + var callbackStatus; + // covering both undefined and null. + // strict null comparison was causing callbackStatus to be undefined + // and then no callback was called because of the check in cordova.callbackFromNative + // see CB-8996 Mobilespec app hang on windows + if (callbackOptions.status !== undefined && callbackOptions.status !== null) { + callbackStatus = callbackOptions.status; + } + else { + callbackStatus = cordova.callbackStatus.OK; + } + cordova.callbackSuccess(callbackOptions.callbackId || callbackId, + { + status: callbackStatus, + message: result, + keepCallback: callbackOptions.keepCallback || false + }); + }; + var onError = function (err, callbackOptions) { + callbackOptions = callbackOptions || {}; + var callbackStatus; + // covering both undefined and null. + // strict null comparison was causing callbackStatus to be undefined + // and then no callback was called because of the check in cordova.callbackFromNative + // note: status can be 0 + if (callbackOptions.status !== undefined && callbackOptions.status !== null) { + callbackStatus = callbackOptions.status; + } + else { + callbackStatus = cordova.callbackStatus.OK; + } + cordova.callbackError(callbackOptions.callbackId || callbackId, + { + status: callbackStatus, + message: err, + keepCallback: callbackOptions.keepCallback || false + }); + }; + proxy(onSuccess, onError, args); + + } catch (e) { + console.log("Exception calling native with command :: " + service + " :: " + action + " ::exception=" + e); + } + } else { + + console.log("Error: exec proxy not found for :: " + service + " :: " + action); + + if(typeof fail === "function" ) { + fail("Missing Command Error"); + } + } +}; + +}); + +// file: src/common/exec/proxy.js +define("cordova/exec/proxy", function(require, exports, module) { + +// internal map of proxy function +var CommandProxyMap = {}; + +module.exports = { + + // example: cordova.commandProxy.add("Accelerometer",{getCurrentAcceleration: function(successCallback, errorCallback, options) {...},...); + add: function (id, proxyObj) { + console.log('adding proxy for ' + id); + CommandProxyMap[id] = proxyObj; + return proxyObj; + }, + + // cordova.commandProxy.remove("Accelerometer"); + remove: function (id) { + var proxy = CommandProxyMap[id]; + delete CommandProxyMap[id]; + CommandProxyMap[id] = null; + return proxy; + }, + + get: function (service, action) { + return (CommandProxyMap[service] ? CommandProxyMap[service][action] : null); + } +}; + +}); + +// file: src/common/init.js +define("cordova/init", function(require, exports, module) { + +var channel = require('cordova/channel'); +var cordova = require('cordova'); +var modulemapper = require('cordova/modulemapper'); +var platform = require('cordova/platform'); +var pluginloader = require('cordova/pluginloader'); +var utils = require('cordova/utils'); + +var platformInitChannelsArray = [channel.onNativeReady, channel.onPluginsReady]; + +function logUnfiredChannels (arr) { + for (var i = 0; i < arr.length; ++i) { + if (arr[i].state !== 2) { + console.log('Channel not fired: ' + arr[i].type); + } + } +} + +window.setTimeout(function () { + if (channel.onDeviceReady.state !== 2) { + console.log('deviceready has not fired after 5 seconds.'); + logUnfiredChannels(platformInitChannelsArray); + logUnfiredChannels(channel.deviceReadyChannelsArray); + } +}, 5000); + +// Replace navigator before any modules are required(), to ensure it happens as soon as possible. +// We replace it so that properties that can't be clobbered can instead be overridden. +function replaceNavigator (origNavigator) { + var CordovaNavigator = function () {}; + CordovaNavigator.prototype = origNavigator; + var newNavigator = new CordovaNavigator(); + // This work-around really only applies to new APIs that are newer than Function.bind. + // Without it, APIs such as getGamepads() break. + if (CordovaNavigator.bind) { + for (var key in origNavigator) { + if (typeof origNavigator[key] === 'function') { + newNavigator[key] = origNavigator[key].bind(origNavigator); + } else { + (function (k) { + utils.defineGetterSetter(newNavigator, key, function () { + return origNavigator[k]; + }); + })(key); + } + } + } + return newNavigator; +} + +if (window.navigator) { + window.navigator = replaceNavigator(window.navigator); +} + +if (!window.console) { + window.console = { + log: function () {} + }; +} +if (!window.console.warn) { + window.console.warn = function (msg) { + this.log('warn: ' + msg); + }; +} + +// Register pause, resume and deviceready channels as events on document. +channel.onPause = cordova.addDocumentEventHandler('pause'); +channel.onResume = cordova.addDocumentEventHandler('resume'); +channel.onActivated = cordova.addDocumentEventHandler('activated'); +channel.onDeviceReady = cordova.addStickyDocumentEventHandler('deviceready'); + +// Listen for DOMContentLoaded and notify our channel subscribers. +if (document.readyState === 'complete' || document.readyState === 'interactive') { + channel.onDOMContentLoaded.fire(); +} else { + document.addEventListener('DOMContentLoaded', function () { + channel.onDOMContentLoaded.fire(); + }, false); +} + +// _nativeReady is global variable that the native side can set +// to signify that the native code is ready. It is a global since +// it may be called before any cordova JS is ready. +if (window._nativeReady) { + channel.onNativeReady.fire(); +} + +modulemapper.clobbers('cordova', 'cordova'); +modulemapper.clobbers('cordova/exec', 'cordova.exec'); +modulemapper.clobbers('cordova/exec', 'Cordova.exec'); + +// Call the platform-specific initialization. +platform.bootstrap && platform.bootstrap(); + +// Wrap in a setTimeout to support the use-case of having plugin JS appended to cordova.js. +// The delay allows the attached modules to be defined before the plugin loader looks for them. +setTimeout(function () { + pluginloader.load(function () { + channel.onPluginsReady.fire(); + }); +}, 0); + +/** + * Create all cordova objects once native side is ready. + */ +channel.join(function () { + modulemapper.mapModules(window); + + platform.initialize && platform.initialize(); + + // Fire event to notify that all objects are created + channel.onCordovaReady.fire(); + + // Fire onDeviceReady event once page has fully loaded, all + // constructors have run and cordova info has been received from native + // side. + channel.join(function () { + require('cordova').fireDocumentEvent('deviceready'); + }, channel.deviceReadyChannelsArray); + +}, platformInitChannelsArray); + +}); + +// file: src/common/modulemapper.js +define("cordova/modulemapper", function(require, exports, module) { + +var builder = require('cordova/builder'); +var moduleMap = define.moduleMap; // eslint-disable-line no-undef +var symbolList; +var deprecationMap; + +exports.reset = function () { + symbolList = []; + deprecationMap = {}; +}; + +function addEntry (strategy, moduleName, symbolPath, opt_deprecationMessage) { + if (!(moduleName in moduleMap)) { + throw new Error('Module ' + moduleName + ' does not exist.'); + } + symbolList.push(strategy, moduleName, symbolPath); + if (opt_deprecationMessage) { + deprecationMap[symbolPath] = opt_deprecationMessage; + } +} + +// Note: Android 2.3 does have Function.bind(). +exports.clobbers = function (moduleName, symbolPath, opt_deprecationMessage) { + addEntry('c', moduleName, symbolPath, opt_deprecationMessage); +}; + +exports.merges = function (moduleName, symbolPath, opt_deprecationMessage) { + addEntry('m', moduleName, symbolPath, opt_deprecationMessage); +}; + +exports.defaults = function (moduleName, symbolPath, opt_deprecationMessage) { + addEntry('d', moduleName, symbolPath, opt_deprecationMessage); +}; + +exports.runs = function (moduleName) { + addEntry('r', moduleName, null); +}; + +function prepareNamespace (symbolPath, context) { + if (!symbolPath) { + return context; + } + var parts = symbolPath.split('.'); + var cur = context; + for (var i = 0, part; part = parts[i]; ++i) { // eslint-disable-line no-cond-assign + cur = cur[part] = cur[part] || {}; + } + return cur; +} + +exports.mapModules = function (context) { + var origSymbols = {}; + context.CDV_origSymbols = origSymbols; + for (var i = 0, len = symbolList.length; i < len; i += 3) { + var strategy = symbolList[i]; + var moduleName = symbolList[i + 1]; + var module = require(moduleName); + // + if (strategy === 'r') { + continue; + } + var symbolPath = symbolList[i + 2]; + var lastDot = symbolPath.lastIndexOf('.'); + var namespace = symbolPath.substr(0, lastDot); + var lastName = symbolPath.substr(lastDot + 1); + + var deprecationMsg = symbolPath in deprecationMap ? 'Access made to deprecated symbol: ' + symbolPath + '. ' + deprecationMsg : null; + var parentObj = prepareNamespace(namespace, context); + var target = parentObj[lastName]; + + if (strategy === 'm' && target) { + builder.recursiveMerge(target, module); + } else if ((strategy === 'd' && !target) || (strategy !== 'd')) { + if (!(symbolPath in origSymbols)) { + origSymbols[symbolPath] = target; + } + builder.assignOrWrapInDeprecateGetter(parentObj, lastName, module, deprecationMsg); + } + } +}; + +exports.getOriginalSymbol = function (context, symbolPath) { + var origSymbols = context.CDV_origSymbols; + if (origSymbols && (symbolPath in origSymbols)) { + return origSymbols[symbolPath]; + } + var parts = symbolPath.split('.'); + var obj = context; + for (var i = 0; i < parts.length; ++i) { + obj = obj && obj[parts[i]]; + } + return obj; +}; + +exports.reset(); + +}); + +// file: /Users/erisu/git/apache/cordova/cordova-browser/cordova-js-src/platform.js +define("cordova/platform", function(require, exports, module) { + +module.exports = { + id: 'browser', + cordovaVersion: '4.2.0', // cordova-js + + bootstrap: function() { + + var modulemapper = require('cordova/modulemapper'); + var channel = require('cordova/channel'); + + modulemapper.clobbers('cordova/exec/proxy', 'cordova.commandProxy'); + + channel.onNativeReady.fire(); + + document.addEventListener("visibilitychange", function(){ + if(document.hidden) { + channel.onPause.fire(); + } + else { + channel.onResume.fire(); + } + }); + + // End of bootstrap + } +}; + +}); + +// file: src/common/pluginloader.js +define("cordova/pluginloader", function(require, exports, module) { + +var modulemapper = require('cordova/modulemapper'); + +// Helper function to inject a + + + diff --git a/test/resources/testSampleProject/platforms/browser/www/js/index.js b/test/resources/testSampleProject/platforms/browser/www/js/index.js new file mode 100644 index 00000000..6fc66e58 --- /dev/null +++ b/test/resources/testSampleProject/platforms/browser/www/js/index.js @@ -0,0 +1,29 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +// Wait for the deviceready event before using any of Cordova's device APIs. +// See https://cordova.apache.org/docs/en/latest/cordova/events/events.html#deviceready +document.addEventListener('deviceready', onDeviceReady, false); + +function onDeviceReady() { + // Cordova is now initialized. Have fun! + + console.log('Running cordova-' + cordova.platformId + '@' + cordova.version); + document.getElementById('deviceready').classList.add('ready'); +} diff --git a/test/resources/testSampleProject/platforms/browser/www/manifest.json b/test/resources/testSampleProject/platforms/browser/www/manifest.json new file mode 100644 index 00000000..56a156f6 --- /dev/null +++ b/test/resources/testSampleProject/platforms/browser/www/manifest.json @@ -0,0 +1,11 @@ +{ + "background_color": "#FFF", + "display": "standalone", + "name": "HelloCordova", + "short_name": "HelloCordova", + "version": "io.cordova.hellocordova", + "description": "Sample Apache Cordova App", + "author": "Apache Cordova Team", + "icons": [], + "start_url": "index.html" +} \ No newline at end of file diff --git a/test/resources/testSampleProject/www/css/index.css b/test/resources/testSampleProject/www/css/index.css new file mode 100644 index 00000000..ecea7e8e --- /dev/null +++ b/test/resources/testSampleProject/www/css/index.css @@ -0,0 +1,110 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +* { + -webkit-tap-highlight-color: rgba(0,0,0,0); /* make transparent link selection, adjust last value opacity 0 to 1.0 */ +} + +body { + -webkit-touch-callout: none; /* prevent callout to copy image, etc when tap to hold */ + -webkit-text-size-adjust: none; /* prevent webkit from resizing text to fit */ + -webkit-user-select: none; /* prevent copy paste, to allow, change 'none' to 'text' */ + background-color:#E4E4E4; + background-image:linear-gradient(to bottom, #A7A7A7 0%, #E4E4E4 51%); + font-family: system-ui, -apple-system, -apple-system-font, 'Segoe UI', 'Roboto', sans-serif; + font-size:12px; + height:100vh; + margin:0px; + padding:0px; + /* Padding to avoid the "unsafe" areas behind notches in the screen */ + padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px); + text-transform:uppercase; + width:100%; +} + +/* Portrait layout (default) */ +.app { + background:url(../img/logo.png) no-repeat center top; /* 170px x 200px */ + position:absolute; /* position in the center of the screen */ + left:50%; + top:50%; + height:50px; /* text area height */ + width:225px; /* text area width */ + text-align:center; + padding:180px 0px 0px 0px; /* image height is 200px (bottom 20px are overlapped with text) */ + margin:-115px 0px 0px -112px; /* offset vertical: half of image height and text area height */ + /* offset horizontal: half of text area width */ +} + +/* Landscape layout (with min-width) */ +@media screen and (min-aspect-ratio: 1/1) and (min-width:400px) { + .app { + background-position:left center; + padding:75px 0px 75px 170px; /* padding-top + padding-bottom + text area = image height */ + margin:-90px 0px 0px -198px; /* offset vertical: half of image height */ + /* offset horizontal: half of image width and text area width */ + } +} + +h1 { + font-size:24px; + font-weight:normal; + margin:0px; + overflow:visible; + padding:0px; + text-align:center; +} + +.event { + border-radius:4px; + color:#FFFFFF; + font-size:12px; + margin:0px 30px; + padding:2px 0px; +} + +.event.listening { + background-color:#333333; + display:block; +} + +.event.received { + background-color:#4B946A; + display:none; +} + +#deviceready.ready .event.listening { display: none; } +#deviceready.ready .event.received { display: block; } + +@keyframes fade { + from { opacity: 1.0; } + 50% { opacity: 0.4; } + to { opacity: 1.0; } +} + +.blink { + animation:fade 3000ms infinite; + -webkit-animation:fade 3000ms infinite; +} + + +@media screen and (prefers-color-scheme: dark) { + body { + background-image:linear-gradient(to bottom, #585858 0%, #1B1B1B 51%); + } +} diff --git a/test/resources/testSampleProject/www/img/logo.png b/test/resources/testSampleProject/www/img/logo.png new file mode 100644 index 0000000000000000000000000000000000000000..9519e7dd78adb6e44548c08510a7bf02442a7697 GIT binary patch literal 21814 zcmV*iKuy1iP)KLZ*U+IBfRsybQWXdwQbLP>6pAqfylh#{fb6;Z(vMMVS~$e@S=j*ftg6;Uhf59&ghTmgWD0l;*T zI709Y^p6lP1rIRMx#05C~cW=H_Aw*bJ-5DT&Z2n+x)QHX^p z00esgV8|mQcmRZ%02D^@S3L16t`O%c004NIvOKvYIYoh62rY33S640`D9%Y2D-rV&neh&#Q1i z007~1e$oCcFS8neI|hJl{-P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u59~eR)xwbOMMf z0EjA>@kWXnpbRN0N>n`|KQu=rDxF>sF@Nd!6O0%u55#$-KK7E_Q%>LUeUejR{w8auU0P(YP9TY0L!s`^(c zVa65dwuD42Q~#U+PEl~f;pXM+m**_yaimqcYS0;^nobj-RFQZ`Maf#m4&+6yvH}6B zg4EA7WAbcN9fXwPa)oCtRL1xs-gn*R3+;4T5*_WAxWu3opO$og%UQPN*Fc| z+*v{_k2=d#|3zMZT7qVo1p1GqO@L5+iwvM6LprC`ds*y0&nA7ns{AS@0HHW0pJxWt zk+Nk#tz(;V+Uu`MO{o-bnO6Vl*)rQ!@=){&xBy?S~bgR?3lkQZ{zBJPW5rlLA6 zRG1v49I;u0J5AeuoC2%L;6XV<8cSq1v#6u$QSh2kFIV=p22{>?9#w5tlz_EJ(y9`0 zmq}BUdHrcXQi0t=DT%1xSec5ZjNhRQb09BvkDT+QKd&N9=`|=ht4LKsd9^^6W-O{4 zC}Isz;Aoen1ag)$Rn&)XLv(&6808o|_1Qh3smf4l|tNtB!Q#*CDXE=7g?7VR4R$!4>u|bJWV{vSS0aj)a{C&?hN9U#~!&wX>CH z-&Tz@@s!ui(-gna6riID$IrsqIX4Mr2jZdzZB-@W)Dkqk?{O13rimEM(vv^mP8Z-@ z^Ef`{q=}9(W(1U3W;4yCv&Q*0H8A;@pgxZD%sp<_J(=l9p%rJEutl zol{P)O&ga_ + + + + + + + + + + + + Hello World + + +
+

Apache Cordova

+ +
+ + + + diff --git a/test/resources/testSampleProject/www/js/index.js b/test/resources/testSampleProject/www/js/index.js new file mode 100644 index 00000000..6fc66e58 --- /dev/null +++ b/test/resources/testSampleProject/www/js/index.js @@ -0,0 +1,29 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +// Wait for the deviceready event before using any of Cordova's device APIs. +// See https://cordova.apache.org/docs/en/latest/cordova/events/events.html#deviceready +document.addEventListener('deviceready', onDeviceReady, false); + +function onDeviceReady() { + // Cordova is now initialized. Have fun! + + console.log('Running cordova-' + cordova.platformId + '@' + cordova.version); + document.getElementById('deviceready').classList.add('ready'); +} diff --git a/test/simulator.test.js b/test/simulator.test.js new file mode 100644 index 00000000..3ae0f51a --- /dev/null +++ b/test/simulator.test.js @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for details. + +const assert = require('assert'); +const path = require('path'); +var Simulator = require('../src/server/simulator'); + +suite('simulatorProcess', function () { + test('After simulator init, simulator.state should be IDLE', (done) => { + const options = require('./resources/options.json'); + options.dir = path.join(__dirname, './resources/testSampleProject'); + var simulator = new Simulator(options); + assert.equal(simulator._state, Simulator.State.IDLE); + done(); + }); +}); +