From e5aa6aded6be14fcea3724c292da79e53d7357a5 Mon Sep 17 00:00:00 2001 From: Luca Casonato Date: Mon, 23 Aug 2021 21:50:30 +0200 Subject: [PATCH] ESM all the things This PR changes all internal code (scripts/, test/, util/) to ESM. The built package for NPM now contains an ESM and CJS entrypoint. --- README.md | 2 +- index.d.ts | 7 +- index.js | 12 +- package-lock.json | 1718 ++++++++++++++++- package.json | 17 +- schemas/browsers-schema.md | 4 +- scripts/compare-features.js | 4 +- scripts/diff-features.js | 12 +- scripts/enumerate-features.js | 23 +- scripts/fix-browser-order.js | 19 +- scripts/fix-feature-order.js | 23 +- scripts/fix-format.js | 6 +- scripts/fix.js | 18 +- scripts/migrations/001-sort-features.js | 4 +- .../migrations/002-remove-webview-flags.js | 19 +- .../002-remove-webview-flags.test.js | 15 +- scripts/migrations/003-sort-features.js | 4 +- scripts/migrations/004-prettify.js | 4 +- scripts/mirror.js | 38 +- scripts/release-build.js | 55 +- scripts/release-build.test.js | 13 +- scripts/release-pulls.js | 6 +- scripts/release-stats.js | 13 +- scripts/release-utils.js | 11 +- scripts/statistics.js | 18 +- scripts/traverse.js | 7 +- test/lint.js | 32 +- test/linter/index.js | 21 +- test/linter/test-browsers.js | 21 +- test/linter/test-consistency.js | 15 +- test/linter/test-descriptions.js | 13 +- test/linter/test-links.js | 14 +- test/linter/test-prefix.js | 19 +- test/linter/test-real-values.js | 24 +- test/linter/test-schema.js | 21 +- test/linter/test-style.js | 15 +- test/linter/test-versions.js | 22 +- test/linter/utils.js | 6 +- test/spec-urls.test.js | 14 +- test/test-compare-features.js | 9 +- test/test-format.js | 7 +- test/test-migrations.js | 9 +- test/test-regexes.js | 5 +- test/utils.js | 7 +- test/utils.test.js | 5 +- utils/index.js | 15 +- utils/iter-support.js | 4 +- utils/iter-support.test.js | 4 +- utils/query.js | 6 +- utils/query.test.js | 4 +- utils/visit.js | 10 +- utils/visit.test.js | 6 +- utils/walk.js | 12 +- utils/walk.test.js | 7 +- utils/walkingUtils.js | 16 +- utils/walkingUtils.test.js | 8 +- 56 files changed, 2074 insertions(+), 369 deletions(-) diff --git a/README.md b/README.md index 421e5955211be9..c885cdb28cfedd 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ npm install @mdn/browser-compat-data ## Usage ```js -const bcd = require('@mdn/browser-compat-data'); +import bcd from '@mdn/browser-compat-data'; bcd.css.properties.background; // returns a compat data object (see schema) ``` diff --git a/index.d.ts b/index.d.ts index 87727fa413bc00..97dd9fe99c8349 100644 --- a/index.d.ts +++ b/index.d.ts @@ -1,9 +1,6 @@ /* Any copyright is dedicated to the Public Domain. * http://creativecommons.org/publicdomain/zero/1.0/ */ -/// + import { CompatData } from './types'; -// This is necessary to have intellisense in projects which -// import data from this package. -declare const compatData: CompatData; -export = compatData; +export default CompatData; diff --git a/index.js b/index.js index 4d92ac49e3f5ed..41b4a3d0222d07 100644 --- a/index.js +++ b/index.js @@ -1,6 +1,8 @@ -'use strict'; -const fs = require('fs'); -const path = require('path'); +import fs from 'node:fs'; +import path from 'node:path'; +import { fileURLToPath } from 'node:url'; + +const dirname = fileURLToPath(new URL('.', import.meta.url)); function load() { // Recursively load one or more directories passed as arguments. @@ -32,7 +34,7 @@ function load() { } for (dir of arguments) { - dir = path.resolve(__dirname, dir); + dir = path.resolve(dirname, dir); fs.readdirSync(dir).forEach(processFilename); } @@ -59,7 +61,7 @@ function extend(target, source) { } } -module.exports = load( +export default load( 'api', 'browsers', 'css', diff --git a/package-lock.json b/package-lock.json index bed2319976b419..a2c4a065be424a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,8 +1,1706 @@ { "name": "@mdn/browser-compat-data", "version": "4.0.0", - "lockfileVersion": 1, + "lockfileVersion": 2, "requires": true, + "packages": { + "": { + "name": "@mdn/browser-compat-data", + "version": "4.0.0", + "license": "CC0-1.0", + "devDependencies": { + "ajv": "~6.12.2", + "better-ajv-errors": "~0.7.0", + "browser-specs": "~2.7.0", + "chalk": "~4.1.0", + "compare-versions": "~3.6.0", + "mdn-confluence": "~2.2.2", + "mocha": "~9.1.0", + "ora": "~5.4.0", + "prettier": "~2.3.0", + "yargs": "~17.1.0" + }, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/@babel/code-frame": { + "version": "7.12.11", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.12.11.tgz", + "integrity": "sha512-Zt1yodBx1UcyiePMSkWnU4hPqhwq7hGi2nFL1LeA3EUl+q2LQx16MISgJ0+z7dnmgvP9QtIleuETGOiOH1RcIw==", + "dev": true, + "dependencies": { + "@babel/highlight": "^7.10.4" + } + }, + "node_modules/@babel/helper-validator-identifier": { + "version": "7.12.11", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.12.11.tgz", + "integrity": "sha512-np/lG3uARFybkoHokJUmf1QfEvRVCPbmQeUQpKow5cQ3xWrV9i3rUHodKDJPQfTVX61qKi+UdYk8kik84n7XOw==", + "dev": true + }, + "node_modules/@babel/highlight": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.10.4.tgz", + "integrity": "sha512-i6rgnR/YgPEQzZZnbTHHuZdlE8qyoBNalD6F+q4vAFlcMEcqmkoG+mPqJYJCo63qPf74+Y1UZsl3l6f7/RIkmA==", + "dev": true, + "dependencies": { + "@babel/helper-validator-identifier": "^7.10.4", + "chalk": "^2.0.0", + "js-tokens": "^4.0.0" + } + }, + "node_modules/@babel/highlight/node_modules/chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/highlight/node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/highlight/node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/runtime": { + "version": "7.12.5", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.12.5.tgz", + "integrity": "sha512-plcc+hbExy3McchJCEQG3knOsuh3HH+Prx1P6cLIkET/0dLuQDEnrT+s27Axgc9bqfsmNUNHfscgMUdBpC9xfg==", + "dev": true, + "dependencies": { + "regenerator-runtime": "^0.13.4" + } + }, + "node_modules/@ungap/promise-all-settled": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@ungap/promise-all-settled/-/promise-all-settled-1.1.2.tgz", + "integrity": "sha512-sL/cEvJWAnClXw0wHk85/2L0G6Sj8UB0Ctc1TEMbKSsmpRosqhwj9gWgFRZSrBr2f9tiXISwNhCPmlfqUqyb9Q==", + "dev": true + }, + "node_modules/ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dev": true, + "dependencies": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "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/ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "dependencies": { + "color-convert": "^1.9.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/anymatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.2.tgz", + "integrity": "sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg==", + "dev": true, + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, + "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/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true + }, + "node_modules/base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/better-ajv-errors": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/better-ajv-errors/-/better-ajv-errors-0.7.0.tgz", + "integrity": "sha512-6GtJQ/AwVSo1pI1MDQU/yg8O86gMsrt5RKtELo08Epa2zWJPCOK85v/O8/U5A9JkWmwRkE16JpSgssKSx6moog==", + "dev": true, + "dependencies": { + "@babel/code-frame": "^7.0.0", + "@babel/runtime": "^7.0.0", + "chalk": "^2.4.1", + "core-js": "^3.2.1", + "json-to-ast": "^2.0.3", + "jsonpointer": "^4.0.1", + "leven": "^3.1.0" + }, + "peerDependencies": { + "ajv": "4.11.8 - 6" + } + }, + "node_modules/better-ajv-errors/node_modules/chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/better-ajv-errors/node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/better-ajv-errors/node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/binary-extensions": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", + "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/bl": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", + "integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==", + "dev": true, + "dependencies": { + "buffer": "^5.5.0", + "inherits": "^2.0.4", + "readable-stream": "^3.4.0" + } + }, + "node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dev": true, + "dependencies": { + "fill-range": "^7.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/browser-specs": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/browser-specs/-/browser-specs-2.7.0.tgz", + "integrity": "sha512-jtrx9wQCbmZDZhbP9FNkRwwUYcrHJyB33Qtbuqe7L1XtndaptQvcIrpTDWBJjrECfJfNEH7ah7bjubzUM0fZFQ==", + "dev": true + }, + "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/buffer": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", + "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.1.13" + } + }, + "node_modules/camelcase": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.2.0.tgz", + "integrity": "sha512-c7wVvbw3f37nuobQNtgsgG9POC9qMbNuMQmTCqZv23b6MIz0fcYpBiOlv9gEN/hdLdnZTDQhg6e9Dq5M1vKvfg==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "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/chalk/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/chalk/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/chalk/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/chokidar": { + "version": "3.5.2", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.2.tgz", + "integrity": "sha512-ekGhOnNVPgT77r4K/U3GDhu+FQ2S8TnK/s2KbIGXi0SZWuwkZ2QNyfWdZW+TVfn84DpEP7rLeCt2UI6bJ8GwbQ==", + "dev": true, + "dependencies": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + }, + "engines": { + "node": ">= 8.10.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, + "node_modules/cli-cursor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz", + "integrity": "sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==", + "dev": true, + "dependencies": { + "restore-cursor": "^3.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/cli-spinners": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/cli-spinners/-/cli-spinners-2.6.0.tgz", + "integrity": "sha512-t+4/y50K/+4xcCRosKkA7W4gTr1MySvLV0q+PxmG7FJ5g+66ChKurYjxBCjHggHH3HA5Hh9cy+lcUGWDqVH+4Q==", + "dev": true, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "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": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^7.0.0" + } + }, + "node_modules/cliui/node_modules/ansi-regex": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", + "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/cliui/node_modules/strip-ansi": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", + "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/clone": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/clone/-/clone-1.0.4.tgz", + "integrity": "sha1-2jCcwmPfFZlMaIypAheco8fNfH4=", + "dev": true, + "engines": { + "node": ">=0.8" + } + }, + "node_modules/code-error-fragment": { + "version": "0.0.230", + "resolved": "https://registry.npmjs.org/code-error-fragment/-/code-error-fragment-0.0.230.tgz", + "integrity": "sha512-cadkfKp6932H8UkhzE/gcUqhRMNf8jHzkAN7+5Myabswaghu4xABTgPHDCjW+dBAJxj/SpkTYokpzDqY4pCzQw==", + "dev": true, + "engines": { + "node": ">= 4" + } + }, + "node_modules/color-convert": { + "version": "1.9.2", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.2.tgz", + "integrity": "sha512-3NUJZdhMhcdPn8vJ9v2UQJoH0qqoGUkYTgFEPZaPjEtwmmKUfNV46zZmgB2M5M4DCEQHMaCfWHCxiBflLm04Tg==", + "dev": true, + "dependencies": { + "color-name": "1.1.1" + } + }, + "node_modules/color-name": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.1.tgz", + "integrity": "sha1-SxQVMEz1ACjqgWQ2Q72C6gWANok=", + "dev": true + }, + "node_modules/compare-versions": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/compare-versions/-/compare-versions-3.6.0.tgz", + "integrity": "sha512-W6Af2Iw1z4CB7q4uU4hv646dW9GQuBM+YpC0UvUCWSD8w90SJjp+ujJuXaEMtAXBtSqGfMPuFOVn4/+FlaqfBA==", + "dev": true + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "dev": true + }, + "node_modules/core-js": { + "version": "3.8.2", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.8.2.tgz", + "integrity": "sha512-FfApuSRgrR6G5s58casCBd9M2k+4ikuu4wbW6pJyYU7bd9zvFc9qf7vr5xmrZOhT9nn+8uwlH1oRR9jTnFoA3A==", + "dev": true, + "hasInstallScript": true, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/core-js" + } + }, + "node_modules/debug": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", + "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", + "dev": true, + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "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/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/defaults": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.3.tgz", + "integrity": "sha1-xlYFHpgX2f8I7YgUd/P+QBnz730=", + "dev": true, + "dependencies": { + "clone": "^1.0.2" + } + }, + "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/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "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-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "dev": true, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true + }, + "node_modules/fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true + }, + "node_modules/fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dev": true, + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "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/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/fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "dev": true + }, + "node_modules/fsevents": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "dev": true, + "hasInstallScript": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "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/glob": { + "version": "7.1.7", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.7.tgz", + "integrity": "sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ==", + "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/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/graceful-fs": { + "version": "4.2.6", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.6.tgz", + "integrity": "sha512-nTnJ528pbqxYanhpDYsi4Rd8MAeaBA67+RZ10CM1m3bTAVFEDcd5AuA4a6W5YkGZ1iNXHzZz8T6TBKLeBuNriQ==", + "dev": true + }, + "node_modules/grapheme-splitter": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/grapheme-splitter/-/grapheme-splitter-1.0.4.tgz", + "integrity": "sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ==", + "dev": true + }, + "node_modules/growl": { + "version": "1.10.5", + "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz", + "integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==", + "dev": true, + "engines": { + "node": ">=4.x" + } + }, + "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/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/ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "dev": true, + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true + }, + "node_modules/is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dev": true, + "dependencies": { + "binary-extensions": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/is-glob": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz", + "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==", + "dev": true, + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-interactive": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-interactive/-/is-interactive-1.0.0.tgz", + "integrity": "sha512-2HvIEKRoqS62guEC+qBjpvRubdX910WCMuJTZ+I9yvqKU2/12eSL549HMwtabb4oupdj2sMP50k+XJfB/8JE6w==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true, + "engines": { + "node": ">=0.12.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-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/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", + "dev": true + }, + "node_modules/js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true + }, + "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/json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true + }, + "node_modules/json-to-ast": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/json-to-ast/-/json-to-ast-2.1.0.tgz", + "integrity": "sha512-W9Lq347r8tA1DfMvAGn9QNcgYm4Wm7Yc+k8e6vezpMnRT+NHbtlxgNBXRVjXe9YM6eTn6+p/MKOlV/aABJcSnQ==", + "dev": true, + "dependencies": { + "code-error-fragment": "0.0.230", + "grapheme-splitter": "^1.0.4" + }, + "engines": { + "node": ">= 4" + } + }, + "node_modules/jsonpointer": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/jsonpointer/-/jsonpointer-4.1.0.tgz", + "integrity": "sha512-CXcRvMyTlnR53xMcKnuMzfCA5i/nfblTnnr74CZb6C4vG39eu6w51t7nKmU5MfLfbTgGItliNyjO/ciNPDqClg==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/klaw": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/klaw/-/klaw-3.0.0.tgz", + "integrity": "sha512-0Fo5oir+O9jnXu5EefYbVK+mHMBeEVEy2cmctR1O1NECcCkPRreJKrS6Qt/j3KC2C148Dfo9i3pCmCMsdqGr0g==", + "dev": true, + "dependencies": { + "graceful-fs": "^4.1.9" + } + }, + "node_modules/leven": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/leven/-/leven-3.1.0.tgz", + "integrity": "sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "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/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/mdn-confluence": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/mdn-confluence/-/mdn-confluence-2.2.2.tgz", + "integrity": "sha512-HGbHxAV6MxGrz+ZDZzuIRL9guq5Ih0kDLCAYUoTDnrT6THu0NN98mjRO8IjK+cL1X52AydQwyYNwzVZisc/VeQ==", + "dev": true, + "dependencies": { + "compare-versions": "^3.6.0", + "klaw": "^3.0.0", + "yargs": "^16.2.0" + }, + "engines": { + "node": ">=10.12.0" + } + }, + "node_modules/mdn-confluence/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/mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/mocha": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-9.1.0.tgz", + "integrity": "sha512-Kjg/XxYOFFUi0h/FwMOeb6RoroiZ+P1yOfya6NK7h3dNhahrJx1r2XIT3ge4ZQvJM86mdjNA+W5phqRQh7DwCg==", + "dev": true, + "dependencies": { + "@ungap/promise-all-settled": "1.1.2", + "ansi-colors": "4.1.1", + "browser-stdout": "1.3.1", + "chokidar": "3.5.2", + "debug": "4.3.1", + "diff": "5.0.0", + "escape-string-regexp": "4.0.0", + "find-up": "5.0.0", + "glob": "7.1.7", + "growl": "1.10.5", + "he": "1.2.0", + "js-yaml": "4.1.0", + "log-symbols": "4.1.0", + "minimatch": "3.0.4", + "ms": "2.1.3", + "nanoid": "3.1.23", + "serialize-javascript": "6.0.0", + "strip-json-comments": "3.1.1", + "supports-color": "8.1.1", + "which": "2.0.2", + "wide-align": "1.1.3", + "workerpool": "6.1.5", + "yargs": "16.2.0", + "yargs-parser": "20.2.4", + "yargs-unparser": "2.0.0" + }, + "bin": { + "_mocha": "bin/_mocha", + "mocha": "bin/mocha" + }, + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/mochajs" + } + }, + "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/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/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/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/nanoid": { + "version": "3.1.23", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.23.tgz", + "integrity": "sha512-FiB0kzdP0FFVGDKlRLEQ1BgDzU87dy5NnzjeW9YZNt+/c3+q82EQDUwniSAUxp/F0gFNI1ZhKU1FqYsMuqZVnw==", + "dev": true, + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dev": true, + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/onetime": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", + "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", + "dev": true, + "dependencies": { + "mimic-fn": "^2.1.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ora": { + "version": "5.4.1", + "resolved": "https://registry.npmjs.org/ora/-/ora-5.4.1.tgz", + "integrity": "sha512-5b6Y85tPxZZ7QytO+BQzysW31HJku27cRIlkbAXaNx+BdcVi+LlRFmVXzeF6a7JCwJpyw5c4b+YSVImQIrBpuQ==", + "dev": true, + "dependencies": { + "bl": "^4.1.0", + "chalk": "^4.1.0", + "cli-cursor": "^3.1.0", + "cli-spinners": "^2.5.0", + "is-interactive": "^1.0.0", + "is-unicode-supported": "^0.1.0", + "log-symbols": "^4.1.0", + "strip-ansi": "^6.0.0", + "wcwidth": "^1.0.1" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ora/node_modules/ansi-regex": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", + "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/ora/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/ora/node_modules/strip-ansi": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", + "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "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/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/path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/picomatch": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.0.tgz", + "integrity": "sha512-lY1Q/PiJGC2zOv/z391WOTD+Z02bCgsFfvxoXXf6h7kv9o+WmsmzYqrAwY63sNgOxE4xEdq0WyUnXfKeBrSvYw==", + "dev": true, + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/prettier": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.3.2.tgz", + "integrity": "sha512-lnJzDfJ66zkMy58OL5/NY5zp70S7Nz6KqcKkXYzn2tMVrNxvbqaBpg7H3qHaLxCJ5lNMsGuM8+ohS7cZrthdLQ==", + "dev": true, + "bin": { + "prettier": "bin-prettier.js" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/punycode": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", + "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/randombytes": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", + "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", + "dev": true, + "dependencies": { + "safe-buffer": "^5.1.0" + } + }, + "node_modules/readable-stream": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "dev": true, + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "dev": true, + "dependencies": { + "picomatch": "^2.2.1" + }, + "engines": { + "node": ">=8.10.0" + } + }, + "node_modules/regenerator-runtime": { + "version": "0.13.7", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.7.tgz", + "integrity": "sha512-a54FxoJDIr27pgf7IgeQGxmqUNYrcV338lf/6gH456HZ/PhX+5BcwHXG9ajESmwe6WRO0tAzRUrRmNONWgkrew==", + "dev": true + }, + "node_modules/require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/restore-cursor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-3.1.0.tgz", + "integrity": "sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==", + "dev": true, + "dependencies": { + "onetime": "^5.1.0", + "signal-exit": "^3.0.2" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "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/signal-exit": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz", + "integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==", + "dev": true + }, + "node_modules/string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "dev": true, + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, + "node_modules/string-width": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.2.tgz", + "integrity": "sha512-XBJbT3N4JhVumXE0eoLU9DCjcaF92KLNqTmFCnG1pf8duUxFGwtP6AD6nkjw9a3IdiRtL3E2w3JDiE/xi3vOeA==", + "dev": true, + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/string-width/node_modules/ansi-regex": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", + "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/string-width/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/string-width/node_modules/strip-ansi": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", + "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "dependencies": { + "ansi-regex": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "dev": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "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/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/uri-js": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.0.tgz", + "integrity": "sha512-B0yRTzYdUCCn9n+F4+Gh4yIDtMQcaJsmYBDsTSG8g/OejKBodLQ2IHfN3bM7jUsRXndopT7OIXWdYqc1fjmV6g==", + "dev": true, + "dependencies": { + "punycode": "^2.1.0" + } + }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", + "dev": true + }, + "node_modules/wcwidth": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/wcwidth/-/wcwidth-1.0.1.tgz", + "integrity": "sha1-8LDc+RW8X/FSivrbLA4XtTLaL+g=", + "dev": true, + "dependencies": { + "defaults": "^1.0.3" + } + }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/wide-align": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz", + "integrity": "sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==", + "dev": true, + "dependencies": { + "string-width": "^1.0.2 || 2" + } + }, + "node_modules/wide-align/node_modules/string-width": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "dev": true, + "dependencies": { + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^4.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/workerpool": { + "version": "6.1.5", + "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.1.5.tgz", + "integrity": "sha512-XdKkCK0Zqc6w3iTxLckiuJ81tiD/o5rBE/m+nXpRCB+/Sq4DqkfXZ/x0jW02DG1tGsfUGXbTJyZDP+eu67haSw==", + "dev": true + }, + "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/wrap-ansi/node_modules/ansi-regex": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", + "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/wrap-ansi/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/wrap-ansi/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/wrap-ansi/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/wrap-ansi/node_modules/strip-ansi": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", + "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "dev": true + }, + "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/yargs": { + "version": "17.1.1", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.1.1.tgz", + "integrity": "sha512-c2k48R0PwKIqKhPMWjeiF6y2xY/gPMUlro0sgxqXpbOIohWiLNXWslsootttv7E1e73QPAMQSg5FeySbVcpsPQ==", + "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": ">=12" + } + }, + "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/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/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": { "@babel/code-frame": { "version": "7.12.11", @@ -1007,6 +2705,15 @@ "integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==", "dev": true }, + "string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "dev": true, + "requires": { + "safe-buffer": "~5.2.0" + } + }, "string-width": { "version": "4.2.2", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.2.tgz", @@ -1041,15 +2748,6 @@ } } }, - "string_decoder": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", - "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", - "dev": true, - "requires": { - "safe-buffer": "~5.2.0" - } - }, "strip-ansi": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", diff --git a/package.json b/package.json index 50d7de6bb56a12..0ea77f023512a8 100644 --- a/package.json +++ b/package.json @@ -4,6 +4,7 @@ "description": "Browser compatibility data provided by MDN Web Docs", "main": "index.js", "types": "index.d.ts", + "type": "module", "engines": { "node": ">=10.0.0" }, @@ -41,15 +42,15 @@ "scripts": { "confluence": "node ./node_modules/mdn-confluence/main/generate.es6.js --output-dir=. --bcd-module=./index.js", "mocha": "mocha \"*/**.test.js\"", - "lint": "node test/lint", - "fix": "node scripts/fix", - "mirror": "node scripts/mirror", - "stats": "node scripts/statistics", - "release-build": "node scripts/release-build", - "release-pulls": "node scripts/release-pulls", - "release-stats": "node scripts/release-stats", + "lint": "node test/lint.js", + "fix": "node scripts/fix.js", + "mirror": "node scripts/mirror.js", + "stats": "node scripts/statistics.js", + "release-build": "node scripts/release-build.js", + "release-pulls": "node scripts/release-pulls.js", + "release-stats": "node scripts/release-stats.js", "show-errors": "npm test 1> /dev/null", "test": "npm run lint && npm run mocha", - "traverse": "node scripts/traverse" + "traverse": "node scripts/traverse.js" } } diff --git a/schemas/browsers-schema.md b/schemas/browsers-schema.md index 2b06633c2367e4..50e3a656db5df0 100644 --- a/schemas/browsers-schema.md +++ b/schemas/browsers-schema.md @@ -84,7 +84,7 @@ The release objects consist of the following properties: This structure is exported for consumers of `@mdn/browser-compat-data`: ```js -> const compat = require('@mdn/browser-compat-data'); -> compat.browsers.firefox.releases['1.5'].status; +> import bcd from '@mdn/browser-compat-data'; +> bcd.browsers.firefox.releases['1.5'].status; // "retired" ``` diff --git a/scripts/compare-features.js b/scripts/compare-features.js index 3784fd99fed53a..f9acee43655585 100644 --- a/scripts/compare-features.js +++ b/scripts/compare-features.js @@ -2,8 +2,6 @@ /* Any copyright is dedicated to the Public Domain. * http://creativecommons.org/publicdomain/zero/1.0/ */ -'use strict'; - /** * * Sort a list of features based upon a specific order: @@ -36,4 +34,4 @@ const compareFeatures = (a, b) => { return a.localeCompare(b, 'en'); }; -module.exports = compareFeatures; +export default compareFeatures; diff --git a/scripts/diff-features.js b/scripts/diff-features.js index 72189276ffd74b..2d29253e132e2b 100644 --- a/scripts/diff-features.js +++ b/scripts/diff-features.js @@ -1,7 +1,8 @@ -const { execSync } = require('child_process'); -const fs = require('fs'); +import { execSync } from 'node:child_process'; +import fs from 'node:fs'; +import { fileURLToPath } from 'node:url'; -const yargs = require('yargs'); +import yargs from 'yargs'; function main({ ref1, ref2, format }) { let refA, refB; @@ -73,7 +74,7 @@ function printMarkdown({ added, removed }) { } } -const { argv } = yargs.command( +const { argv } = yargs().command( '$0 [ref1] [ref2]', 'Compare the set of features at refA and refB', yargs => { @@ -99,6 +100,7 @@ const { argv } = yargs.command( }, ); -if (require.main === module) { +const self = fileURLToPath(import.meta.url); +if (process.argv[1] === self) { main(argv); } diff --git a/scripts/enumerate-features.js b/scripts/enumerate-features.js index 64362a78be5a7d..d1e4f4c5e3a418 100644 --- a/scripts/enumerate-features.js +++ b/scripts/enumerate-features.js @@ -1,9 +1,10 @@ -const yargs = require('yargs'); +import yargs from 'yargs'; -const fs = require('fs'); -const path = require('path'); +import fs from 'node:fs'; +import path from 'node:path'; +import { fileURLToPath } from 'node:url'; -const { walk } = require('../utils'); +import { walk } from '../utils/index.js'; function main({ dest, dataFrom }) { fs.writeFileSync(dest, JSON.stringify(enumerateFeatures(dataFrom))); @@ -13,7 +14,12 @@ function enumerateFeatures(dataFrom) { const feats = []; const walker = dataFrom - ? walk(undefined, require(path.join(process.cwd(), dataFrom))) + ? walk( + undefined, + JSON.parse( + fs.readFileSync(path.join(process.cwd(), dataFrom), 'utf-8'), + ), + ) : walk(); for (const { path, compat } of walker) { @@ -25,7 +31,7 @@ function enumerateFeatures(dataFrom) { return feats; } -const { argv } = yargs.command( +const { argv } = yargs().command( '$0 [dest]', 'Write a JSON-formatted list of feature paths', yargs => { @@ -41,8 +47,9 @@ const { argv } = yargs.command( }, ); -if (require.main === module) { +const self = fileURLToPath(import.meta.url); +if (process.argv[1] === self) { main(argv); } -module.exports = enumerateFeatures; +export default enumerateFeatures; diff --git a/scripts/fix-browser-order.js b/scripts/fix-browser-order.js index c9475bbb70135b..9ddf2a5c80d39d 100644 --- a/scripts/fix-browser-order.js +++ b/scripts/fix-browser-order.js @@ -15,10 +15,12 @@ * @returns {*} The new value */ -'use strict'; -const fs = require('fs'); -const path = require('path'); -const { platform } = require('os'); +import fs from 'node:fs'; +import path from 'node:path'; +import { platform } from 'node:os'; +import { fileURLToPath } from 'node:url'; + +const dirname = fileURLToPath(new URL('.', import.meta.url)); /** Determines if the OS is Windows */ const IS_WINDOWS = platform() === 'win32'; @@ -53,14 +55,15 @@ const fixBrowserOrder = filename => { } }; -if (require.main === module) { +const self = fileURLToPath(import.meta.url); +if (process.argv[1] === self) { /** * @param {string[]} files */ function load(...files) { for (let file of files) { - if (file.indexOf(__dirname) !== 0) { - file = path.resolve(__dirname, '..', file); + if (file.indexOf(dirname) !== 0) { + file = path.resolve(dirname, '..', file); } if (!fs.existsSync(file)) { @@ -101,4 +104,4 @@ if (require.main === module) { } } -module.exports = fixBrowserOrder; +export default fixBrowserOrder; diff --git a/scripts/fix-feature-order.js b/scripts/fix-feature-order.js index 428dafad1ee804..5dbf4ad9545137 100644 --- a/scripts/fix-feature-order.js +++ b/scripts/fix-feature-order.js @@ -15,16 +15,18 @@ * @returns {*} The new value */ -'use strict'; -const fs = require('fs'); -const path = require('path'); -const { platform } = require('os'); +import fs from 'node:fs'; +import path from 'node:path'; +import { platform } from 'node:os'; +import { fileURLToPath } from 'node:url'; + +import compareFeatures from './compare-features.js'; + +const dirname = fileURLToPath(new URL('.', import.meta.url)); /** Determines if the OS is Windows */ const IS_WINDOWS = platform() === 'win32'; -const compareFeatures = require('./compare-features'); - function orderFeatures(key, value) { if (value instanceof Object && '__compat' in value) { value = Object.keys(value) @@ -55,14 +57,15 @@ const fixFeatureOrder = filename => { } }; -if (require.main === module) { +const self = fileURLToPath(import.meta.url); +if (process.argv[1] === self) { /** * @param {string[]} files */ function load(...files) { for (let file of files) { - if (file.indexOf(__dirname) !== 0) { - file = path.resolve(__dirname, '..', file); + if (file.indexOf(dirname) !== 0) { + file = path.resolve(dirname, '..', file); } if (!fs.existsSync(file)) { @@ -103,4 +106,4 @@ if (require.main === module) { } } -module.exports = fixFeatureOrder; +export default fixFeatureOrder; diff --git a/scripts/fix-format.js b/scripts/fix-format.js index 018cbfade0bae0..be64db6483d32c 100644 --- a/scripts/fix-format.js +++ b/scripts/fix-format.js @@ -2,12 +2,10 @@ /* Any copyright is dedicated to the Public Domain. * http://creativecommons.org/publicdomain/zero/1.0/ */ -'use strict'; - -const { exec } = require('child_process'); +import { exec } from 'node:child_process'; const format = () => { exec('npx prettier --write "**/*.js" "**/*.ts" "**/*.md"'); }; -module.exports = format; +export default format; diff --git a/scripts/fix.js b/scripts/fix.js index a2550ae062240c..ba67cb3e8e5a8d 100644 --- a/scripts/fix.js +++ b/scripts/fix.js @@ -1,17 +1,19 @@ -'use strict'; -const fs = require('fs'); -const path = require('path'); -const fixBrowserOrder = require('./fix-browser-order'); -const fixFeatureOrder = require('./fix-feature-order'); -const format = require('./fix-format'); +import fs from 'node:fs'; +import path from 'node:path'; +import { fileURLToPath } from 'node:url'; +import fixBrowserOrder from './fix-browser-order.js'; +import fixFeatureOrder from './fix-feature-order.js'; +import format from './fix-format.js'; + +const dirname = fileURLToPath(new URL('.', import.meta.url)); /** * @param {string[]} files */ function load(...files) { for (let file of files) { - if (file.indexOf(__dirname) !== 0) { - file = path.resolve(__dirname, '..', file); + if (file.indexOf(dirname) !== 0) { + file = path.resolve(dirname, '..', file); } if (!fs.existsSync(file)) { diff --git a/scripts/migrations/001-sort-features.js b/scripts/migrations/001-sort-features.js index b15b53f305ab13..f3800bd4b48e51 100644 --- a/scripts/migrations/001-sort-features.js +++ b/scripts/migrations/001-sort-features.js @@ -2,8 +2,6 @@ /* Any copyright is dedicated to the Public Domain. * http://creativecommons.org/publicdomain/zero/1.0/ */ -'use strict'; - -const { exec } = require('child_process'); +import { exec } from 'node:child_process'; exec('node scripts/fix-feature-order.js'); diff --git a/scripts/migrations/002-remove-webview-flags.js b/scripts/migrations/002-remove-webview-flags.js index 1f8c362b876008..6190bff8ce1c62 100644 --- a/scripts/migrations/002-remove-webview-flags.js +++ b/scripts/migrations/002-remove-webview-flags.js @@ -2,10 +2,12 @@ /* Any copyright is dedicated to the Public Domain. * http://creativecommons.org/publicdomain/zero/1.0/ */ -'use strict'; -const fs = require('fs'); -const path = require('path'); -const { platform } = require('os'); +import fs from 'node:fs'; +import path from 'node:path'; +import { platform } from 'node:os'; +import { fileURLToPath } from 'node:url'; + +const dirname = fileURLToPath(new URL('.', import.meta.url)); /** Determines if the OS is Windows */ const IS_WINDOWS = platform() === 'win32'; @@ -58,14 +60,15 @@ const fixWebViewFlags = filename => { } }; -if (require.main === module) { +const self = fileURLToPath(import.meta.url); +if (process.argv[1] === self) { /** * @param {string[]} files */ function load(...files) { for (let file of files) { - if (file.indexOf(__dirname) !== 0) { - file = path.resolve(__dirname, '..', '..', file); + if (file.indexOf(dirname) !== 0) { + file = path.resolve(dirname, '..', '..', file); } if (!fs.existsSync(file)) { @@ -106,4 +109,4 @@ if (require.main === module) { } } -module.exports = { removeWebViewFlags, fixWebViewFlags }; +export { fixWebViewFlags, removeWebViewFlags }; diff --git a/scripts/migrations/002-remove-webview-flags.test.js b/scripts/migrations/002-remove-webview-flags.test.js index e0dcf59a3f6e8c..8a20a590da6aed 100644 --- a/scripts/migrations/002-remove-webview-flags.test.js +++ b/scripts/migrations/002-remove-webview-flags.test.js @@ -2,13 +2,11 @@ /* Any copyright is dedicated to the Public Domain. * http://creativecommons.org/publicdomain/zero/1.0/ */ -'use strict'; -const fs = require('fs'); -const path = require('path'); -const chalk = require('chalk'); -const { platform } = require('os'); +import { fileURLToPath } from 'node:url'; -const { removeWebViewFlags } = require('./002-remove-webview-flags.js'); +import chalk from 'chalk'; + +import { removeWebViewFlags } from './002-remove-webview-flags.js'; const tests = [ { @@ -155,8 +153,9 @@ const testFixWebViewFlags = (logger = console) => { return hasErrors; }; -if (require.main === module) { +const self = fileURLToPath(import.meta.url); +if (process.argv[1] === self) { testFixWebViewFlags(); } -module.exports = testFixWebViewFlags; +export default testFixWebViewFlags; diff --git a/scripts/migrations/003-sort-features.js b/scripts/migrations/003-sort-features.js index b15b53f305ab13..f3800bd4b48e51 100644 --- a/scripts/migrations/003-sort-features.js +++ b/scripts/migrations/003-sort-features.js @@ -2,8 +2,6 @@ /* Any copyright is dedicated to the Public Domain. * http://creativecommons.org/publicdomain/zero/1.0/ */ -'use strict'; - -const { exec } = require('child_process'); +import { exec } from 'node:child_process'; exec('node scripts/fix-feature-order.js'); diff --git a/scripts/migrations/004-prettify.js b/scripts/migrations/004-prettify.js index 9c9ce95d44f213..300b14449a823b 100644 --- a/scripts/migrations/004-prettify.js +++ b/scripts/migrations/004-prettify.js @@ -2,8 +2,6 @@ /* Any copyright is dedicated to the Public Domain. * http://creativecommons.org/publicdomain/zero/1.0/ */ -'use strict'; - -const { exec } = require('child_process'); +import { exec } from 'node:child_process'; exec('npx prettier --write **/*.js **/*.ts'); diff --git a/scripts/mirror.js b/scripts/mirror.js index eb004f19881af6..23598926fa9057 100644 --- a/scripts/mirror.js +++ b/scripts/mirror.js @@ -8,15 +8,19 @@ * @typedef {import('../types').ReleaseStatement} ReleaseStatement */ -'use strict'; -const fs = require('fs'); -const path = require('path'); +import fs from 'node:fs'; +import path from 'node:path'; +import { fileURLToPath } from 'node:url'; -const compareVersions = require('compare-versions'); +import compareVersions from 'compare-versions'; +import yargs from 'yargs'; -const browsers = require('..').browsers; +import bcd from '../index.js'; +const { browsers } = bcd; -const { argv } = require('yargs').command( +const dirname = fileURLToPath(new URL('.', import.meta.url)); + +const { argv } = yargs().command( '$0 [feature_or_file]', 'Mirror values onto a specified browser if "version_added" is true/null, based upon its parent or a specified source', yargs => { @@ -664,8 +668,8 @@ const setFeatureRecursive = (data, browser, source, modify) => { */ function mirrorDataByFile(browser, filepath, source, modify) { let file = filepath; - if (file.indexOf(__dirname) !== 0) { - file = path.resolve(__dirname, '..', file); + if (file.indexOf(dirname) !== 0) { + file = path.resolve(dirname, '..', file); } if (!fs.existsSync(file)) { @@ -674,7 +678,9 @@ function mirrorDataByFile(browser, filepath, source, modify) { if (fs.statSync(file).isFile()) { if (path.extname(file) === '.json') { - let data = require(file); + let data = JSON.parse( + fs.readFileSync(new URL(file, import.meta.url), 'utf-8'), + ); let newData = setFeatureRecursive(data, browser, source, modify); fs.writeFileSync(file, JSON.stringify(newData, null, 2) + '\n', 'utf-8'); @@ -708,7 +714,7 @@ function mirrorDataByFile(browser, filepath, source, modify) { * @returns {boolean} */ const mirrorDataByFeature = (browser, featureIdent, source, modify) => { - let filepath = path.resolve(__dirname, '..'); + let filepath = path.resolve(dirname, '..'); let feature = featureIdent.split('.'); let found = false; @@ -727,7 +733,9 @@ const mirrorDataByFeature = (browser, featureIdent, source, modify) => { return false; } - let data = require(filepath); + let data = JSON.parse( + fs.readFileSync(new URL(filepath, import.meta.url), 'utf-8'), + ); let newData = setFeature(data, feature, browser, source, modify); fs.writeFileSync(filepath, JSON.stringify(newData, null, 2) + '\n', 'utf-8'); @@ -758,8 +766,9 @@ const mirrorData = (browser, feature_or_file, forced_source, modify) => { fs.existsSync(feature_or_file) && (fs.statSync(feature_or_file).isFile() || fs.statSync(feature_or_file).isDirectory()) - ) + ) { doMirror = mirrorDataByFile; + } doMirror(browser, feature_or_file, source, modify); } else { @@ -785,8 +794,9 @@ const mirrorData = (browser, feature_or_file, forced_source, modify) => { return true; }; -if (require.main === module) { +const self = fileURLToPath(import.meta.url); +if (process.argv[1] === self) { mirrorData(argv.browser, argv.feature_or_file, argv.source, argv.modify); } -module.exports = mirrorData; +export default mirrorData; diff --git a/scripts/release-build.js b/scripts/release-build.js index 58183dd814c9fc..0cefa1f114906c 100644 --- a/scripts/release-build.js +++ b/scripts/release-build.js @@ -1,32 +1,35 @@ -'use strict'; - -const fs = require('fs').promises; -const path = require('path'); +import { promises as fs } from 'node:fs'; +import path from 'node:path'; const directory = './build/'; const verbatimFiles = ['LICENSE', 'README.md', 'index.d.ts', 'types.d.ts']; // Returns a string representing data ready for writing to JSON file -function createDataBundle() { - const bcd = require('../index.js'); +async function createDataBundle() { + const { default: bcd } = await import('../index.js'); const string = JSON.stringify(bcd); return string; } // Returns a promise for writing the data to JSON file -async function writeData() { +async function writeData(data) { const dest = path.resolve(directory, 'data.json'); - const data = createDataBundle(); await fs.writeFile(dest, data); } -async function writeIndex() { - const dest = path.resolve(directory, 'index.js'); +async function writeIndexCJS() { + const dest = path.resolve(directory, 'index.cjs'); const content = `module.exports = require("./data.json");\n`; await fs.writeFile(dest, content); } +async function writeIndexJS(data) { + const dest = path.resolve(directory, 'index.js'); + const content = `export default ${data};\n`; + await fs.writeFile(dest, content); +} + // Returns an array of promises for copying of all files that don't need transformation async function copyFiles() { for (const file of verbatimFiles) { @@ -36,9 +39,17 @@ async function copyFiles() { } } -function createManifest() { - const full = require('../package.json'); - const minimal = { main: 'index.js' }; +async function createManifest() { + const packageJSONRaw = await fs.readFile( + new URL('../package.json', import.meta.url), + 'utf-8', + ); + const full = JSON.parse(packageJSONRaw); + const minimal = { + main: 'index.cjs', + exports: { import: './index.js', require: './index.cjs' }, + type: 'module', + }; const minimalKeys = [ 'name', @@ -65,14 +76,14 @@ function createManifest() { async function writeManifest() { const dest = path.resolve(directory, 'package.json'); - const manifest = createManifest(); + const manifest = await createManifest(); await fs.writeFile(dest, manifest); } async function main() { // Remove existing files, if there are any await fs - .rmdir(directory, { + .rm(directory, { force: true, recursive: true, }) @@ -84,17 +95,15 @@ async function main() { // Crate a new directory await fs.mkdir(directory); + const data = await createDataBundle(); + await writeManifest(); - await writeData(); - await writeIndex(); + await writeData(data); + await writeIndexCJS(); + await writeIndexJS(data); await copyFiles(); console.log('Data bundle is ready'); } -// This is needed because NodeJS does not support top-level await. -// Also, make sure to log all errors and exit with failure code. -main().catch(e => { - console.error(e); - process.exit(1); -}); +await main(); diff --git a/scripts/release-build.test.js b/scripts/release-build.test.js index c8321f4b5a2fc1..f62cfcdb1e97fd 100644 --- a/scripts/release-build.test.js +++ b/scripts/release-build.test.js @@ -1,14 +1,13 @@ -'use strict'; -const assert = require('assert'); -const { execSync } = require('child_process'); +import assert from 'node:assert'; +import { execSync } from 'node:child_process'; -const prebuiltPath = '../build'; +const prebuiltPath = '../build/index.js'; describe('release-build', () => { - it('pre-built bundles are identical to the source', () => { + it('pre-built bundles are identical to the source', async () => { execSync('npm run release-build'); - const regular = require('..'); - const bundled = require(prebuiltPath); + const { default: regular } = await import('../index.js'); + const { default: bundled } = await import(prebuiltPath); assert.deepEqual(regular, bundled); }).timeout(5000); // Timeout must be long enough for all the file I/O }); diff --git a/scripts/release-pulls.js b/scripts/release-pulls.js index e7bf4c17e7f2bc..b7a7c98fd098d1 100644 --- a/scripts/release-pulls.js +++ b/scripts/release-pulls.js @@ -1,13 +1,13 @@ -const assert = require('assert').strict; +import yargs from 'yargs'; -const { getRefDate, releaseYargsBuilder } = require('./release-utils'); +import { getRefDate, releaseYargsBuilder } from './release-utils.js'; const pullsBaseURL = new URL( 'https://github.com/mdn/browser-compat-data/pulls', ); const releaseNotesLabel = 'label:"needs-release-note :newspaper:"'; -const { argv } = require('yargs').command( +const { argv } = yargs().command( '$0 [start-version-tag [end-version-tag]]', 'Get a link to PRs that need release notes between two tags (or other commits)', releaseYargsBuilder, diff --git a/scripts/release-stats.js b/scripts/release-stats.js index c026fb618755e2..a3dca5c51041eb 100644 --- a/scripts/release-stats.js +++ b/scripts/release-stats.js @@ -1,12 +1,11 @@ -const http = require('https'); -const readline = require('readline'); -const chalk = require('chalk'); +import http from 'node:https'; +import readline from 'readline'; +import yargs from 'yargs'; -const bcd = require('..'); -const { exec, releaseYargsBuilder } = require('./release-utils'); -const { walk } = require('../utils'); +import { exec, releaseYargsBuilder } from './release-utils.js'; +import { walk } from '../utils/index.js'; -const { argv } = require('yargs').command( +const { argv } = yargs().command( '$0 [start-version-tag [end-version-tag]]', 'Generate statistics for release notes', releaseYargsBuilder, diff --git a/scripts/release-utils.js b/scripts/release-utils.js index 4823ab3184a2b6..eff04b6e8b9b51 100644 --- a/scripts/release-utils.js +++ b/scripts/release-utils.js @@ -1,12 +1,10 @@ -const assert = require('assert').strict; -const { execSync } = require('child_process'); +import { execSync } from 'node:child_process'; function exec(command) { return execSync(command, { encoding: 'utf8' }).trim(); } function getLatestTag() { - const currentBranch = exec('git rev-parse --abbrev-ref HEAD'); return exec('git describe --abbrev=0 --tags'); } @@ -31,9 +29,4 @@ function releaseYargsBuilder(yargs) { }); } -module.exports = { - exec, - getLatestTag, - getRefDate, - releaseYargsBuilder, -}; +export { exec, getLatestTag, getRefDate, releaseYargsBuilder }; diff --git a/scripts/statistics.js b/scripts/statistics.js index d17748848f9073..9e0f5fa39885f2 100644 --- a/scripts/statistics.js +++ b/scripts/statistics.js @@ -2,13 +2,16 @@ /* Any copyright is dedicated to the Public Domain. * http://creativecommons.org/publicdomain/zero/1.0/ */ -'use strict'; -const chalk = require('chalk'); +import { fileURLToPath } from 'node:url'; -const bcd = require('..'); -const { getRefDate } = require('./release-utils'); +import chalk from 'chalk'; +import yargs from 'yargs'; -const { argv } = require('yargs').command( +import bcd from '../index.js'; + +import { getRefDate } from './release-utils.js'; + +const { argv } = yargs().command( '$0 [folder]', 'Print a markdown-formatted table displaying the statistics of real, ranged, true, and null values for each browser', yargs => { @@ -206,8 +209,9 @@ const printStats = (stats, folder) => { console.log(table); }; -if (require.main === module) { +const self = fileURLToPath(import.meta.url); +if (process.argv[1] === self) { printStats(getStats(argv.folder, argv.all), argv.folder); } -module.exports = getStats; +export default getStats; diff --git a/scripts/traverse.js b/scripts/traverse.js index d911f49afc714f..190e56f3f082bb 100644 --- a/scripts/traverse.js +++ b/scripts/traverse.js @@ -1,7 +1,8 @@ -'use strict'; -const bcd = require('..'); +import yargs from 'yargs'; -const { argv } = require('yargs').command( +import bcd from '../index.js'; + +const { argv } = yargs().command( '$0 [folder] [value]', 'Test for specified values in any specified browser', yargs => { diff --git a/test/lint.js b/test/lint.js index df96d2b793a00a..9eb7e9cb764052 100644 --- a/test/lint.js +++ b/test/lint.js @@ -1,10 +1,10 @@ -'use strict'; -const fs = require('fs'); -const path = require('path'); -const ora = require('ora'); -const yargs = require('yargs'); -const chalk = require('chalk'); -const { +import fs from 'node:fs'; +import path from 'node:path'; +import { fileURLToPath } from 'node:url'; +import ora from 'ora'; +import yargs from 'yargs'; +import chalk from 'chalk'; +import { testBrowsers, testLinks, testPrefix, @@ -14,16 +14,18 @@ const { testVersions, testConsistency, testDescriptions, -} = require('./linter/index.js'); -const { IS_CI } = require('./utils.js'); -const testCompareFeatures = require('./test-compare-features'); -const testMigrations = require('./test-migrations'); -const testFormat = require('./test-format'); +} from './linter/index.js'; +import { IS_CI } from './utils.js'; +import testCompareFeatures from './test-compare-features.js'; +import testMigrations from './test-migrations.js'; +import testFormat from './test-format.js'; + +const dirname = fileURLToPath(new URL('.', import.meta.url)); /** @type {Map} */ const filesWithErrors = new Map(); -const argv = yargs +const argv = yargs() .alias('version', 'v') .usage('$0 [[--] files...]', false, yargs => { return yargs.positional('files...', { @@ -42,8 +44,8 @@ const argv = yargs */ function load(...files) { return files.reduce((prevHasErrors, file) => { - if (file.indexOf(__dirname) !== 0) { - file = path.resolve(__dirname, '..', file); + if (file.indexOf(dirname) !== 0) { + file = path.resolve(dirname, '..', file); } if (!fs.existsSync(file)) { diff --git a/test/linter/index.js b/test/linter/index.js index 3f435f5fe846c8..c20193541a4fd9 100644 --- a/test/linter/index.js +++ b/test/linter/index.js @@ -1,15 +1,14 @@ -'use strict'; -const testBrowsers = require('./test-browsers.js'); -const testLinks = require('./test-links.js'); -const testPrefix = require('./test-prefix.js'); -const testRealValues = require('./test-real-values.js'); -const testSchema = require('./test-schema.js'); -const testStyle = require('./test-style.js'); -const testVersions = require('./test-versions.js'); -const testConsistency = require('./test-consistency.js'); -const testDescriptions = require('./test-descriptions.js'); +import testBrowsers from './test-browsers.js'; +import testLinks from './test-links.js'; +import testPrefix from './test-prefix.js'; +import testRealValues from './test-real-values.js'; +import testSchema from './test-schema.js'; +import testStyle from './test-style.js'; +import testVersions from './test-versions.js'; +import testConsistency from './test-consistency.js'; +import testDescriptions from './test-descriptions.js'; -module.exports = { +export { testBrowsers, testLinks, testPrefix, diff --git a/test/linter/test-browsers.js b/test/linter/test-browsers.js index d982afa2158061..73c33b81a2ecc2 100644 --- a/test/linter/test-browsers.js +++ b/test/linter/test-browsers.js @@ -1,7 +1,10 @@ -'use strict'; -const path = require('path'); -const chalk = require('chalk'); -const { Logger } = require('./utils.js'); +import path from 'node:path'; +import fs from 'node:fs'; +import { fileURLToPath } from 'node:url'; +import chalk from 'chalk'; +import { Logger } from './utils.js'; + +const dirname = fileURLToPath(new URL('.', import.meta.url)); /** * @typedef {import('../../types').Identifier} Identifier @@ -106,15 +109,17 @@ function processData( * @param {string} filename * @returns {boolean} If the file contains errors */ -function testBrowsers(filename) { +export default function testBrowsers(filename) { const relativePath = path.relative( - path.resolve(__dirname, '..', '..'), + path.resolve(dirname, '..', '..'), filename, ); const category = relativePath.includes(path.sep) && relativePath.split(path.sep)[0]; /** @type {Identifier} */ - const data = require(filename); + const data = JSON.parse( + fs.readFileSync(new URL(filename, import.meta.url), 'utf-8'), + ); if (!category) { console.warn(chalk.blackBright(' Browsers – Unknown category')); @@ -147,5 +152,3 @@ function testBrowsers(filename) { logger.emit(); return logger.hasErrors(); } - -module.exports = testBrowsers; diff --git a/test/linter/test-consistency.js b/test/linter/test-consistency.js index d029f0bf44af75..678876ea00e262 100644 --- a/test/linter/test-consistency.js +++ b/test/linter/test-consistency.js @@ -1,7 +1,6 @@ -'use strict'; -const path = require('path'); -const compareVersions = require('compare-versions'); -const chalk = require('chalk'); +import fs from 'node:fs'; +import compareVersions from 'compare-versions'; +import chalk from 'chalk'; /** * @typedef {import('../../types').CompatStatement} CompatStatement @@ -365,9 +364,11 @@ class ConsistencyChecker { /** * @param {string} filename */ -function testConsistency(filename) { +export default function testConsistency(filename) { /** @type {Identifier} */ - let data = require(filename); + const data = JSON.parse( + fs.readFileSync(new URL(filename, import.meta.url), 'utf-8'), + ); const checker = new ConsistencyChecker(); const errors = checker.check(data); @@ -412,5 +413,3 @@ function testConsistency(filename) { } return false; } - -module.exports = testConsistency; diff --git a/test/linter/test-descriptions.js b/test/linter/test-descriptions.js index 8945295f226958..fd9655f435f32d 100644 --- a/test/linter/test-descriptions.js +++ b/test/linter/test-descriptions.js @@ -1,5 +1,6 @@ -const chalk = require('chalk'); -const { Logger } = require('./utils.js'); +import fs from 'node:fs'; +import chalk from 'chalk'; +import { Logger } from './utils.js'; /** * @typedef {import('../../types').Identifier} Identifier @@ -101,9 +102,11 @@ function hasCorrectPermissionDescription(apiData, apiName, logger) { /** * @param {string} filename */ -function testDescriptions(filename) { +export default function testDescriptions(filename) { /** @type {Identifier} */ - const data = require(filename); + const data = JSON.parse( + fs.readFileSync(new URL(filename, import.meta.url), 'utf-8'), + ); const logger = new Logger('Descriptions'); @@ -127,5 +130,3 @@ function testDescriptions(filename) { logger.emit(); return logger.hasErrors(); } - -module.exports = testDescriptions; diff --git a/test/linter/test-links.js b/test/linter/test-links.js index 0566ab580fcf80..a92d5f9822a0d7 100644 --- a/test/linter/test-links.js +++ b/test/linter/test-links.js @@ -1,8 +1,6 @@ -'use strict'; -const fs = require('fs'); -const url = require('url'); -const chalk = require('chalk'); -const { IS_WINDOWS, indexToPos, indexToPosRaw } = require('../utils.js'); +import fs from 'node:fs'; +import chalk from 'chalk'; +import { IS_WINDOWS, indexToPos, indexToPosRaw } from '../utils.js'; /** * @param {string} filename @@ -172,7 +170,7 @@ function processData(filename) { actual, String.raw`]+)'>((?:.(?!))*.)`, match => { - if (url.parse(match[1]).hostname === null) { + if (new URL(match[1]).hostname === null) { return { issue: 'Include hostname in URL', actualLink: match[1], @@ -216,7 +214,7 @@ function processLink(errors, actual, regexp, matchHandler) { /** * @param {string} filename */ -function testLinks(filename) { +export default function testLinks(filename) { /** @type {Object[]} */ let errors = processData(filename); @@ -235,5 +233,3 @@ function testLinks(filename) { } return false; } - -module.exports = testLinks; diff --git a/test/linter/test-prefix.js b/test/linter/test-prefix.js index 542e3939060dec..6ae6676beac05a 100644 --- a/test/linter/test-prefix.js +++ b/test/linter/test-prefix.js @@ -1,6 +1,9 @@ -'use strict'; -const path = require('path'); -const chalk = require('chalk'); +import fs from 'node:fs'; +import path from 'node:path'; +import { fileURLToPath } from 'node:url'; +import chalk from 'chalk'; + +const dirname = fileURLToPath(new URL('.', import.meta.url)); /** * @typedef {import('../../types').Identifier} Identifier @@ -61,14 +64,16 @@ function processData(data, category) { /** * @param {string} filename */ -function testPrefix(filename) { +export default function testPrefix(filename) { const relativePath = path.relative( - path.resolve(__dirname, '..', '..'), + path.resolve(dirname, '..', '..'), filename, ); const category = relativePath.includes(path.sep) && relativePath.split(path.sep)[0]; - const data = require(filename); + const data = JSON.parse( + fs.readFileSync(new URL(filename, import.meta.url), 'utf-8'), + ); const errors = processData(data, category); if (errors.length) { @@ -84,5 +89,3 @@ function testPrefix(filename) { } return false; } - -module.exports = testPrefix; diff --git a/test/linter/test-real-values.js b/test/linter/test-real-values.js index 3e07f424a7bb8d..68261fb33f601f 100644 --- a/test/linter/test-real-values.js +++ b/test/linter/test-real-values.js @@ -1,7 +1,10 @@ -'use strict'; -const path = require('path'); -const chalk = require('chalk'); -const { Logger } = require('./utils.js'); +import fs from 'node:fs'; +import path from 'node:path'; +import { fileURLToPath } from 'node:url'; +import chalk from 'chalk'; +import { Logger } from './utils.js'; + +const dirname = fileURLToPath(new URL('.', import.meta.url)); /** * @typedef {import('../../types').Identifier} Identifier @@ -79,15 +82,17 @@ function checkRealValues(supportData, blockList, relPath, logger) { /** * @param {string} filename */ -function testRealValues(filename) { +export default function testRealValues(filename) { const relativePath = path.relative( - path.resolve(__dirname, '..', '..'), + path.resolve(dirname, '..', '..'), filename, ); const category = relativePath.includes(path.sep) && relativePath.split(path.sep)[0]; /** @type {Identifier} */ - const data = require(filename); + const data = JSON.parse( + fs.readFileSync(new URL(filename, import.meta.url), 'utf-8'), + ); const logger = new Logger('Real values'); /** @@ -97,13 +102,14 @@ function testRealValues(filename) { function findSupport(data, relPath) { for (const prop in data) { if (prop === '__compat' && data[prop].support) { - if (blockList[category] && blockList[category].length > 0) + if (blockList[category] && blockList[category].length > 0) { checkRealValues( data[prop].support, blockList[category], relPath, logger, ); + } } const sub = data[prop]; if (typeof sub === 'object') { @@ -116,5 +122,3 @@ function testRealValues(filename) { logger.emit(); return logger.hasErrors(); } - -module.exports = testRealValues; diff --git a/test/linter/test-schema.js b/test/linter/test-schema.js index 9cb809552b0c3d..09302f063d862c 100644 --- a/test/linter/test-schema.js +++ b/test/linter/test-schema.js @@ -1,8 +1,7 @@ -'use strict'; -const Ajv = require('ajv'); -const betterAjvErrors = require('better-ajv-errors'); -const path = require('path'); -const chalk = require('chalk'); +import fs from 'node:fs'; +import Ajv from 'ajv'; +import betterAjvErrors from 'better-ajv-errors'; +import chalk from 'chalk'; const ajv = new Ajv({ jsonPointers: true, allErrors: true }); @@ -10,12 +9,16 @@ const ajv = new Ajv({ jsonPointers: true, allErrors: true }); * @param {string} dataFilename * @param {string} [schemaFilename] */ -function testSchema( +export default function testSchema( dataFilename, schemaFilename = './../../schemas/compat-data.schema.json', ) { - const schema = require(schemaFilename); - const data = require(dataFilename); + const schema = JSON.parse( + fs.readFileSync(new URL(schemaFilename, import.meta.url), 'utf-8'), + ); + const data = JSON.parse( + fs.readFileSync(new URL(dataFilename, import.meta.url), 'utf-8'), + ); const valid = ajv.validate(schema, data); @@ -34,5 +37,3 @@ function testSchema( } return false; } - -module.exports = testSchema; diff --git a/test/linter/test-style.js b/test/linter/test-style.js index 5d0d1406a1384b..096b24c2bc22dd 100644 --- a/test/linter/test-style.js +++ b/test/linter/test-style.js @@ -1,9 +1,8 @@ -'use strict'; -const fs = require('fs'); -const chalk = require('chalk'); -const { IS_WINDOWS, indexToPos, jsonDiff } = require('../utils.js'); -const compareFeatures = require('../../scripts/compare-features'); -const { Logger } = require('./utils.js'); +import fs from 'node:fs'; +import chalk from 'chalk'; +import { IS_WINDOWS, indexToPos, jsonDiff } from '../utils.js'; +import compareFeatures from '../../scripts/compare-features.js'; +import { Logger } from './utils.js'; /** * Return a new "support_block" object whose first-level properties @@ -106,7 +105,7 @@ function processData(filename, logger) { } } -function testStyle(filename) { +export default function testStyle(filename) { const logger = new Logger('Style'); processData(filename, logger); @@ -114,5 +113,3 @@ function testStyle(filename) { logger.emit(); return logger.hasErrors(); } - -module.exports = testStyle; diff --git a/test/linter/test-versions.js b/test/linter/test-versions.js index c4abf83478a03d..90210309bb36c6 100644 --- a/test/linter/test-versions.js +++ b/test/linter/test-versions.js @@ -1,7 +1,7 @@ -'use strict'; -const compareVersions = require('compare-versions'); -const chalk = require('chalk'); -const { Logger } = require('./utils.js'); +import fs from 'node:fs'; +import compareVersions from 'compare-versions'; +import chalk from 'chalk'; +import { Logger } from './utils.js'; /** * @typedef {import('../../types').Identifier} Identifier @@ -9,7 +9,8 @@ const { Logger } = require('./utils.js'); * @typedef {import('../../types').SupportBlock} SupportBlock * @typedef {import('../../types').VersionValue} VersionValue */ -const browsers = require('../..').browsers; +import bcd from '../../index.js'; +const { browsers } = bcd; /** @type {Object} */ const validBrowserVersions = {}; @@ -153,9 +154,14 @@ function checkVersions(supportData, relPath, logger) { /** * @param {string} filename */ -function testVersions(filename) { +export default function testVersions(filename) { /** @type {Identifier} */ - const data = require(filename); + const data = JSON.parse( + fs.readFileSync( + new URL(new URL(filename, import.meta.url), import.meta.url), + 'utf-8', + ), + ); const logger = new Logger('Versions'); @@ -179,5 +185,3 @@ function testVersions(filename) { logger.emit(); return logger.hasErrors(); } - -module.exports = testVersions; diff --git a/test/linter/utils.js b/test/linter/utils.js index 053b56862696bb..5942f81d7584e6 100644 --- a/test/linter/utils.js +++ b/test/linter/utils.js @@ -1,6 +1,6 @@ -const chalk = require('chalk'); +import chalk from 'chalk'; -class Logger { +export class Logger { /** @param {string} title */ constructor(title) { this.title = title; @@ -30,5 +30,3 @@ class Logger { return !!this.errors.length; } } - -module.exports = { Logger }; diff --git a/test/spec-urls.test.js b/test/spec-urls.test.js index 184cc1b59823cb..9169c4e902c4a8 100644 --- a/test/spec-urls.test.js +++ b/test/spec-urls.test.js @@ -1,7 +1,13 @@ -'use strict'; -const assert = require('assert'); -const specData = require('browser-specs'); -const { walk } = require('../utils'); +import fs from 'node:fs'; +import assert from 'node:assert'; +import { walk } from '../utils/index.js'; + +const specData = JSON.parse( + fs.readFileSync( + new URL('../node_modules/browser-specs/index.json', import.meta.url), + 'utf-8', + ), +); describe('spec_url data', () => { it('spec_urls only use allow listed hosts by w3c/browser-specs (and our exception list)', () => { diff --git a/test/test-compare-features.js b/test/test-compare-features.js index 99df00d46331cd..114675768584d9 100644 --- a/test/test-compare-features.js +++ b/test/test-compare-features.js @@ -2,12 +2,9 @@ /* Any copyright is dedicated to the Public Domain. * http://creativecommons.org/publicdomain/zero/1.0/ */ -'use strict'; -const fs = require('fs'); -const path = require('path'); -const chalk = require('chalk'); +import chalk from 'chalk'; -const compareFeatures = require('../scripts/compare-features'); +import compareFeatures from '../scripts/compare-features.js'; /** * A unit test for the compareFeatures() function, to ensure that features are sorted as expected. @@ -64,4 +61,4 @@ const testFeatureOrder = () => { return false; }; -module.exports = testFeatureOrder; +export default testFeatureOrder; diff --git a/test/test-format.js b/test/test-format.js index 095481ea56d410..3b092de2d82107 100644 --- a/test/test-format.js +++ b/test/test-format.js @@ -1,6 +1,5 @@ -'use strict'; -const { execSync } = require('child_process'); -const chalk = require('chalk'); +import { execSync } from 'node:child_process'; +import chalk from 'chalk'; const testFormat = () => { try { @@ -19,4 +18,4 @@ const testFormat = () => { return false; }; -module.exports = testFormat; +export default testFormat; diff --git a/test/test-migrations.js b/test/test-migrations.js index 086a308a4f8011..7481b6a2ad41c1 100644 --- a/test/test-migrations.js +++ b/test/test-migrations.js @@ -2,12 +2,9 @@ /* Any copyright is dedicated to the Public Domain. * http://creativecommons.org/publicdomain/zero/1.0/ */ -'use strict'; -const fs = require('fs'); -const path = require('path'); -const chalk = require('chalk'); +import chalk from 'chalk'; -const m002 = require('../scripts/migrations/002-remove-webview-flags.test.js'); +import m002 from '../scripts/migrations/002-remove-webview-flags.test.js'; /** * @returns {boolean} If the migrations aren't functioning properly @@ -38,4 +35,4 @@ const testMigrations = () => { return false; }; -module.exports = testMigrations; +export default testMigrations; diff --git a/test/test-regexes.js b/test/test-regexes.js index 470b1abda0ef43..e4a307fb3f1ff3 100644 --- a/test/test-regexes.js +++ b/test/test-regexes.js @@ -1,5 +1,4 @@ -'use strict'; -const assert = require('assert'); +import assert from 'node:assert'; /** * @typedef {import('../types').Identifier} Identifier @@ -11,7 +10,7 @@ const assert = require('assert'); */ /** @type {Identifier} */ -const bcd = require('..'); +import bcd from '../index.js'; /** * @param {string} dottedFeature diff --git a/test/utils.js b/test/utils.js index 0e787834141cd8..dc931565b51f0c 100644 --- a/test/utils.js +++ b/test/utils.js @@ -1,6 +1,5 @@ -'use strict'; -const { platform } = require('os'); -const chalk = require('chalk'); +import { platform } from 'node:os'; +import chalk from 'chalk'; /** @type {{readonly [char: string]: string}} */ const INVISIBLES_MAP = Object.freeze( @@ -108,7 +107,7 @@ function jsonDiff(actual, expected) { } } -module.exports = { +export { INVISIBLES_MAP, IS_CI, IS_WINDOWS, diff --git a/test/utils.test.js b/test/utils.test.js index 3af1446d78672a..583dc134a4fa50 100644 --- a/test/utils.test.js +++ b/test/utils.test.js @@ -1,6 +1,5 @@ -'use strict'; -const assert = require('assert'); -const { escapeInvisibles } = require('./utils.js'); +import assert from 'node:assert'; +import { escapeInvisibles } from './utils.js'; describe('utils', () => { it('`escapeInvisibles()` works correctly', () => { diff --git a/utils/index.js b/utils/index.js index bf4f64333d61e6..a2c65cf63b8274 100644 --- a/utils/index.js +++ b/utils/index.js @@ -1,11 +1,6 @@ -const iterSupport = require('./iter-support'); -const query = require('./query'); -const { walk } = require('./walk'); -const visit = require('./visit'); +import iterSupport from './iter-support.js'; +import query from './query.js'; +import { walk } from './walk.js'; +import visit from './visit.js'; -module.exports = { - iterSupport, - query, - walk, - visit, -}; +export { iterSupport, query, walk, visit }; diff --git a/utils/iter-support.js b/utils/iter-support.js index 0a3102dc4afe7a..c4a1c1d13a765f 100644 --- a/utils/iter-support.js +++ b/utils/iter-support.js @@ -1,4 +1,4 @@ -function iterSupport(compat, browser) { +export default function iterSupport(compat, browser) { if (browser in compat.support) { const data = compat.support[browser]; return Array.isArray(data) ? data : [data]; @@ -6,5 +6,3 @@ function iterSupport(compat, browser) { return [{ version_added: null }]; } - -module.exports = iterSupport; diff --git a/utils/iter-support.test.js b/utils/iter-support.test.js index a5cb1de1438ea7..9cf38b92f78957 100644 --- a/utils/iter-support.test.js +++ b/utils/iter-support.test.js @@ -1,6 +1,6 @@ -const assert = require('assert').strict; +import { strict as assert } from 'node:assert'; -const iterSupport = require('./iter-support'); +import iterSupport from './iter-support.js'; describe('iterSupport()', function () { it('returns a `"version_added": null` support statement for non-existent browsers', function () { diff --git a/utils/query.js b/utils/query.js index 4e393c92197ac9..3a26068e513d27 100644 --- a/utils/query.js +++ b/utils/query.js @@ -1,4 +1,4 @@ -const bcd = require('..'); +import bcd from '../index.js'; /** * Get a subtree of compat data. @@ -8,7 +8,7 @@ const bcd = require('..'); * @returns {*} A BCD subtree * @throws {ReferenceError} For invalid identifiers */ -function query(path, data = bcd) { +export default function query(path, data = bcd) { const pathElements = path.split('.'); let lookup = data; while (pathElements.length) { @@ -22,5 +22,3 @@ function query(path, data = bcd) { } return lookup; } - -module.exports = query; diff --git a/utils/query.test.js b/utils/query.test.js index 57357b6cad3799..9f7c1e9b2f47fa 100644 --- a/utils/query.test.js +++ b/utils/query.test.js @@ -1,6 +1,6 @@ -const assert = require('assert').strict; +import { strict as assert } from 'node:assert'; -const query = require('./query'); +import query from './query.js'; describe('query()', function () { describe('should throw on non-existent features', function () { diff --git a/utils/visit.js b/utils/visit.js index 7427c4d3f830ec..162bb8fed901ea 100644 --- a/utils/visit.js +++ b/utils/visit.js @@ -1,11 +1,11 @@ -const bcd = require('..'); -const query = require('./query'); -const { descendantKeys, joinPath, isFeature } = require('./walkingUtils'); +import bcd from '../index.js'; +import query from './query.js'; +import { descendantKeys, joinPath, isFeature } from './walkingUtils.js'; const BREAK = Symbol('break'); const CONTINUE = Symbol('continue'); -function visit(visitor, options = {}) { +export default function visit(visitor, options = {}) { const { entryPoint, data } = options; const test = options.test !== undefined ? options.test : () => true; @@ -35,5 +35,3 @@ function visit(visitor, options = {}) { visit.BREAK = BREAK; visit.CONTINUE = CONTINUE; - -module.exports = visit; diff --git a/utils/visit.test.js b/utils/visit.test.js index d9dbef7740ece9..1eea11da0dbb40 100644 --- a/utils/visit.test.js +++ b/utils/visit.test.js @@ -1,7 +1,7 @@ -const assert = require('assert').strict; +import { strict as assert } from 'node:assert'; -const visit = require('./visit'); -const { walk } = require('./walk'); +import visit from './visit.js'; +import { walk } from './walk.js'; describe('visit()', function () { it('runs the function on all features if no other entry point is specified', function () { diff --git a/utils/walk.js b/utils/walk.js index d7f44c3c0eecbd..e9b05d14b92e77 100644 --- a/utils/walk.js +++ b/utils/walk.js @@ -1,8 +1,8 @@ -const bcd = require('..'); -const { isBrowser, descendantKeys, joinPath } = require('./walkingUtils'); -const query = require('./query'); +import bcd from '../index.js'; +import { isBrowser, descendantKeys, joinPath } from './walkingUtils.js'; +import query from './query.js'; -function* lowLevelWalk(data = bcd, path, depth = Infinity) { +export function* lowLevelWalk(data = bcd, path, depth = Infinity) { if (path !== undefined) { const next = { path, @@ -24,7 +24,7 @@ function* lowLevelWalk(data = bcd, path, depth = Infinity) { } } -function* walk(entryPoints, data = bcd) { +export function* walk(entryPoints, data = bcd) { const walkers = []; if (entryPoints === undefined) { @@ -46,5 +46,3 @@ function* walk(entryPoints, data = bcd) { } } } - -module.exports = { walk, lowLevelWalk }; diff --git a/utils/walk.test.js b/utils/walk.test.js index 35c5b4871ebbf8..f7555d16e34d69 100644 --- a/utils/walk.test.js +++ b/utils/walk.test.js @@ -1,8 +1,7 @@ -const assert = require('assert').strict; +import { strict as assert } from 'node:assert'; -const bcd = require('..'); -const { walk } = require('./index'); -const { lowLevelWalk } = require('./walk'); +import bcd from '../index.js'; +import { walk, lowLevelWalk } from './walk.js'; describe('lowLevelWalk()', function () { it('visits every top-level tree', function () { diff --git a/utils/walkingUtils.js b/utils/walkingUtils.js index 7fde7b5f2a9c71..d964fa4d6585e2 100644 --- a/utils/walkingUtils.js +++ b/utils/walkingUtils.js @@ -1,15 +1,16 @@ -function joinPath() { +export function joinPath() { return Array.from(arguments).filter(Boolean).join('.'); } -function isFeature(obj) { +export function isFeature(obj) { return '__compat' in obj; } -function isBrowser(obj) { + +export function isBrowser(obj) { return 'name' in obj && 'releases' in obj; } -function descendantKeys(data) { +export function descendantKeys(data) { if (isFeature(data)) { return Object.keys(data).filter(key => key !== '__compat'); } @@ -21,10 +22,3 @@ function descendantKeys(data) { return Object.keys(data); } - -module.exports = { - joinPath, - isFeature, - isBrowser, - descendantKeys, -}; diff --git a/utils/walkingUtils.test.js b/utils/walkingUtils.test.js index 44be5d47e5e397..6229900d2a37ac 100644 --- a/utils/walkingUtils.test.js +++ b/utils/walkingUtils.test.js @@ -1,8 +1,8 @@ -const assert = require('assert').strict; +import { strict as assert } from 'node:assert'; -const bcd = require('..'); -const query = require('./query'); -const { joinPath, isBrowser, isFeature } = require('./walkingUtils'); +import bcd from '../index.js'; +import query from './query.js'; +import { joinPath, isBrowser, isFeature } from './walkingUtils.js'; describe('joinPath()', function () { it('joins dotted paths to features', function () {