From 01b9f002eaa767eb9be26049d731b9dccac96dea Mon Sep 17 00:00:00 2001 From: Armano Date: Tue, 21 Mar 2023 02:32:25 +0100 Subject: [PATCH 1/9] chore(website-eslint): update build script to use esbuild instead of rollup --- packages/website-eslint/build.ts | 139 ++++++++++ packages/website-eslint/package.json | 20 +- .../website-eslint/rollup-plugin/replace.js | 96 ------- packages/website-eslint/rollup.config.js | 139 ---------- packages/website-eslint/src/index.js | 22 ++ packages/website-eslint/src/linter/linter.js | 27 -- packages/website-eslint/src/mock/empty.js | 1 - .../website-eslint/src/mock/eslint-rules.js | 1 + packages/website-eslint/src/mock/eslint.js | 6 + packages/website-eslint/src/mock/globby.js | 4 - packages/website-eslint/src/mock/is-glob.js | 4 - packages/website-eslint/src/mock/lru-cache.js | 14 ++ packages/website-eslint/src/mock/path.js | 22 +- packages/website-eslint/src/mock/semver.js | 7 - packages/website-eslint/src/mock/ts-estree.js | 2 + packages/website-eslint/src/mock/util.js | 2 +- packages/website-eslint/tsconfig.json | 2 +- yarn.lock | 238 +++++++++++------- 18 files changed, 343 insertions(+), 403 deletions(-) create mode 100644 packages/website-eslint/build.ts delete mode 100644 packages/website-eslint/rollup-plugin/replace.js delete mode 100644 packages/website-eslint/rollup.config.js create mode 100644 packages/website-eslint/src/index.js delete mode 100644 packages/website-eslint/src/linter/linter.js create mode 100644 packages/website-eslint/src/mock/eslint-rules.js create mode 100644 packages/website-eslint/src/mock/eslint.js delete mode 100644 packages/website-eslint/src/mock/globby.js delete mode 100644 packages/website-eslint/src/mock/is-glob.js create mode 100644 packages/website-eslint/src/mock/lru-cache.js delete mode 100644 packages/website-eslint/src/mock/semver.js create mode 100644 packages/website-eslint/src/mock/ts-estree.js diff --git a/packages/website-eslint/build.ts b/packages/website-eslint/build.ts new file mode 100644 index 000000000000..20432358c61c --- /dev/null +++ b/packages/website-eslint/build.ts @@ -0,0 +1,139 @@ +/* eslint-disable no-process-exit, no-console */ + +import * as fs from 'node:fs/promises'; +import { createRequire } from 'node:module'; +import * as path from 'node:path'; + +import * as esbuild from 'esbuild'; + +function requireResolved(targetPath: string): string { + return createRequire(__filename).resolve(targetPath); +} + +function normalizePath(filePath: string): string { + return filePath.replace(/\\/g, '/'); +} + +function requireMock(targetPath: string): Promise { + return fs.readFile(requireResolved(targetPath), 'utf8'); +} + +function makeFilter(filePath: string | string[]): { filter: RegExp } { + const paths = Array.isArray(filePath) ? filePath : [filePath]; + const norm = paths.map(item => + normalizePath(item).replace(/\//g, '[\\\\/]').replace(/\./g, '\\.'), + ); + return { filter: new RegExp('(' + norm.join('|') + ')$') }; +} + +async function buildPackage(name: string, file: string): Promise { + const eslintRoot = requireResolved('eslint/package.json'); + const linterPath = path.join(eslintRoot, '../lib/linter/linter.js'); + const rulesPath = path.join(eslintRoot, '../lib/rules/index.js'); + + const output = await esbuild.build({ + entryPoints: { + [name]: requireResolved(file), + }, + format: 'cjs', + platform: 'browser', + bundle: true, + external: [], + minify: true, + treeShaking: true, + write: true, + target: 'es2020', + sourcemap: 'linked', + outdir: './dist/', + supported: {}, + define: { + 'process.env.NODE_ENV': '"production"', + 'process.env.NODE_DEBUG': 'false', + 'process.env.IGNORE_TEST_WIN32': 'true', + 'process.env.DEBUG': 'false', + 'process.emitWarning': 'console.warn', + 'process.platform': '"browser"', + 'process.env.TIMING': 'undefined', + 'define.amd': 'false', + global: 'window', + // 'process.env': 'undefined', + // process: 'undefined', + }, + alias: { + util: requireResolved('./src/mock/util.js'), + assert: requireResolved('./src/mock/assert.js'), + path: requireResolved('./src/mock/path.js'), + typescript: requireResolved('./src/mock/typescript.js'), + 'lru-cache': requireResolved('./src/mock/lru-cache.js'), + }, + plugins: [ + { + name: 'replace-plugin', + setup(build): void { + build.onLoad( + makeFilter([ + '/eslint-utils/rule-tester/RuleTester.js', + '/utils/dist/ts-eslint/ESLint.js', + '/utils/dist/ts-eslint/RuleTester.js', + '/utils/dist/ts-eslint/CLIEngine.js', + ]), + async args => { + console.log('onLoad:replace', args.path); + const text = await requireMock('./src/mock/empty.js'); + return { contents: text, loader: 'js' }; + }, + ); + build.onLoad( + makeFilter('/eslint/lib/unsupported-api.js'), + async args => { + console.log('onLoad:eslint:unsupported-api', args.path); + let text = await requireMock('./src/mock/eslint-rules.js'); + // this is needed to bypass system module resolver + text = text.replace('vt:eslint/rules', normalizePath(rulesPath)); + return { contents: text, loader: 'js' }; + }, + ); + build.onLoad(makeFilter('/eslint/lib/api.js'), async args => { + console.log('onLoad:eslint', args.path); + let text = await requireMock('./src/mock/eslint.js'); + // this is needed to bypass system module resolver + text = text.replace('vt:eslint/linter', normalizePath(linterPath)); + return { contents: text, loader: 'js' }; + }); + build.onLoad( + makeFilter('/typescript-estree/dist/index.js'), + async args => { + console.log('onLoad:typescript-estree', args.path); + const text = await requireMock('./src/mock/ts-estree.js'); + return { contents: text, loader: 'js' }; + }, + ); + }, + }, + ], + }); + + if (output.errors) { + for (const error of output.errors) { + console.error(error); + } + for (const warning of output.warnings) { + console.warn(warning); + } + + if (output.errors.length > 0) { + throw new Error('error occurred'); + } + } +} + +console.time('building eslint for web'); + +buildPackage('index', './src/index.js') + .then(() => { + console.timeEnd('building eslint for web'); + }) + .catch(e => { + console.error(e); + process.exit(1); + }); diff --git a/packages/website-eslint/package.json b/packages/website-eslint/package.json index 6e5c0fde52cf..d82b4f67f12d 100644 --- a/packages/website-eslint/package.json +++ b/packages/website-eslint/package.json @@ -2,10 +2,8 @@ "name": "@typescript-eslint/website-eslint", "version": "5.55.0", "private": true, + "types": "types/index.d.ts", "description": "ESLint which works in browsers.", - "files": [ - "dist" - ], "type": "commonjs", "exports": { ".": { @@ -17,30 +15,22 @@ "node": "^14.18.0 || ^16.0.0 || >=18.0.0" }, "scripts": { - "build": "rollup --config=rollup.config.js", + "build": "yarn tsx ./build.ts", "format": "prettier --write \"./**/*.{ts,mts,cts,tsx,js,mjs,cjs,jsx,json,md,css}\" --ignore-path ../../.prettierignore", "lint": "nx lint", "typecheck": "tsc --noEmit" }, - "dependencies": { - "@typescript-eslint/types": "5.55.0", - "@typescript-eslint/utils": "5.55.0" - }, "devDependencies": { - "@rollup/plugin-commonjs": "^23.0.0", - "@rollup/plugin-json": "^5.0.0", - "@rollup/plugin-node-resolve": "^15.0.0", - "@rollup/plugin-terser": "^0.4.0", - "@rollup/pluginutils": "^5.0.0", "@typescript-eslint/eslint-plugin": "5.55.0", "@typescript-eslint/parser": "5.55.0", "@typescript-eslint/scope-manager": "5.55.0", "@typescript-eslint/typescript-estree": "5.55.0", "@typescript-eslint/visitor-keys": "5.55.0", + "@typescript-eslint/types": "5.55.0", + "@typescript-eslint/utils": "5.55.0", "eslint": "*", + "esbuild": "~0.17.12", "esquery": "*", - "magic-string": "0.25.9", - "rollup": "^2.75.4", "semver": "^7.3.7" } } diff --git a/packages/website-eslint/rollup-plugin/replace.js b/packages/website-eslint/rollup-plugin/replace.js deleted file mode 100644 index 559367c34a26..000000000000 --- a/packages/website-eslint/rollup-plugin/replace.js +++ /dev/null @@ -1,96 +0,0 @@ -const path = require('path'); -const Module = require('module'); -const rollupPluginUtils = require('@rollup/pluginutils'); -const MagicString = require('magic-string'); - -function toAbsolute(id) { - return id.startsWith('./') ? path.resolve(id) : require.resolve(id); -} - -function log(opts, message, type = 'info') { - if (opts.verbose) { - // eslint-disable-next-line no-console - console.log('rollup-plugin-replace > [' + type + ']', message); - } -} - -function createMatcher(it) { - if (typeof it === 'function') { - return it; - } else { - return rollupPluginUtils.createFilter(it); - } -} - -module.exports = (options = {}) => { - const aliasesCache = new Map(); - const aliases = (options.alias || []).map(item => { - return { - match: item.match, - matcher: createMatcher(item.match), - target: item.target, - absoluteTarget: toAbsolute(item.target), - }; - }); - const replaces = (options.replace || []).map(item => { - return { - match: item.match, - test: item.test, - replace: - typeof item.replace === 'string' ? () => item.replace : item.replace, - - matcher: createMatcher(item.match), - }; - }); - - return { - name: 'rollup-plugin-replace', - resolveId(id, importerPath) { - const importeePath = - id.startsWith('./') || id.startsWith('../') - ? Module.createRequire(importerPath).resolve(id) - : id; - - let result = aliasesCache.get(importeePath); - if (result) { - return result; - } - - result = aliases.find(item => item.matcher(importeePath)); - if (result) { - aliasesCache.set(importeePath, result.absoluteTarget); - log(options, `${importeePath} as ${result.target}`, 'resolve'); - return result.absoluteTarget; - } - - return null; - }, - transform(code, id) { - let hasReplacements = false; - let magicString = new MagicString(code); - - replaces.forEach(item => { - if (item.matcher && !item.matcher(id)) { - return; - } - - let match = item.test.exec(code); - let start; - let end; - while (match) { - hasReplacements = true; - start = match.index; - end = start + match[0].length; - magicString.overwrite(start, end, item.replace(match)); - match = item.test.global ? item.test.exec(code) : null; - } - }); - - if (!hasReplacements) { - return; - } - log(options, id, 'replace'); - return { code: magicString.toString() }; - }, - }; -}; diff --git a/packages/website-eslint/rollup.config.js b/packages/website-eslint/rollup.config.js deleted file mode 100644 index 1ba2e0991135..000000000000 --- a/packages/website-eslint/rollup.config.js +++ /dev/null @@ -1,139 +0,0 @@ -import commonjs from '@rollup/plugin-commonjs'; -import json from '@rollup/plugin-json'; -import resolve from '@rollup/plugin-node-resolve'; -import terser from '@rollup/plugin-terser'; - -const replace = require('./rollup-plugin/replace'); - -module.exports = { - input: 'src/linter/linter.js', - output: { - format: 'amd', - interop: 'auto', - freeze: false, - sourcemap: true, - file: 'dist/index.js', - }, - external: ['vs/language/typescript/tsWorker'], - plugins: [ - terser({ - keep_classnames: true, - compress: { - global_defs: { - 'process.platform': '"browser"', - 'process.env.CI': 'undefined', - '@process.env.TSESTREE_SINGLE_RUN': 'undefined', - '@process.env.DEBUG': 'undefined', - }, - }, - }), - replace({ - // verbose: true, - alias: [ - { - // those files should be omitted, we do not want them to be exposed to web - match: [ - /eslint\/lib\/(rule-tester|eslint|cli-engine|init)\//u, - /eslint\/lib\/cli\.js$/, - /utils\/dist\/eslint-utils\/rule-tester\/RuleTester\.js$/, - /utils\/dist\/ts-eslint\/CLIEngine\.js$/, - /utils\/dist\/ts-eslint\/RuleTester\.js$/, - /typescript-estree\/dist\/create-program\/getWatchProgramsForProjects\.js/, - /typescript-estree\/dist\/create-program\/createProjectProgram\.js/, - /typescript-estree\/dist\/create-program\/createIsolatedProgram\.js/, - /typescript-estree\/dist\/clear-caches\.js/, - /utils\/dist\/ts-eslint\/ESLint\.js/, - /ajv\/lib\/definition_schema\.js/, - /stream/, - /os/, - /fs/, - ], - target: './src/mock/empty.js', - }, - { - // use window.ts instead of bundling typescript - match: /typescript$/u, - target: './src/mock/typescript.js', - }, - { - // assert for web - match: /^assert$/u, - target: './src/mock/assert.js', - }, - { - // path for web - match: /^path$/u, - target: './src/mock/path.js', - }, - { - // util for web - match: /^util$/u, - target: './src/mock/util.js', - }, - { - // semver simplified, solve issue with circular dependencies - match: /semver$/u, - target: './src/mock/semver.js', - }, - { - match: /^globby$/u, - target: './src/mock/globby.js', - }, - { - match: /^is-glob$/u, - target: './src/mock/is-glob.js', - }, - ], - replace: [ - { - // we do not want dynamic imports - match: /eslint\/lib\/linter\/rules\.js$/u, - test: /require\(this\._rules\[ruleId\]\)/u, - replace: 'null', - }, - { - // esquery has both browser and node versions, we are bundling browser version that has different export - test: /esquery\.parse\(/u, - replace: 'esquery.default.parse(', - }, - { - // esquery has both browser and node versions, we are bundling browser version that has different export - test: /esquery\.matches\(/u, - replace: 'esquery.default.matches(', - }, - { - // replace all process.env.NODE_DEBUG with false - test: /process\.env\.NODE_DEBUG/u, - replace: 'false', - }, - { - // replace all process.env.TIMING with false - test: /process\.env\.TIMING/u, - replace: 'false', - }, - { - // replace all process.env.IGNORE_TEST_WIN32 with true - test: /process\.env\.IGNORE_TEST_WIN32/u, - replace: 'true', - }, - { - // replace all process.cwd with "/" - test: /process\.cwd\(\)/u, - replace: '"/"', - }, - { - // replace all process.emitWarning with console.warn - test: /process.emitWarning/u, - replace: 'console.warn', - }, - ], - }), - resolve({ - browser: true, - exportConditions: ['require'], - preferBuiltins: false, - }), - commonjs(), - json({ preferConst: true }), - ], -}; diff --git a/packages/website-eslint/src/index.js b/packages/website-eslint/src/index.js new file mode 100644 index 000000000000..0834cf66f2d5 --- /dev/null +++ b/packages/website-eslint/src/index.js @@ -0,0 +1,22 @@ +define(['exports', 'vs/language/typescript/tsWorker'], function (e, _t) { + const eslintPlugin = require('@typescript-eslint/eslint-plugin'); + const Linter = require('eslint').Linter; + + e.getScriptKind = + require('@typescript-eslint/typescript-estree/use-at-your-own-risk/getScriptKind').getScriptKind; + e.analyze = + require('@typescript-eslint/scope-manager/use-at-your-own-risk/analyze').analyze; + e.visitorKeys = + require('@typescript-eslint/visitor-keys/use-at-your-own-risk/visitor-keys').visitorKeys; + e.astConverter = + require('@typescript-eslint/typescript-estree/use-at-your-own-risk/ast-converter').astConverter; + e.esquery = require('esquery'); + + e.createLinter = function () { + const linter = new Linter(); + for (const name in eslintPlugin.rules) { + linter.defineRule(`@typescript-eslint/${name}`, eslintPlugin.rules[name]); + } + return linter; + }; +}); diff --git a/packages/website-eslint/src/linter/linter.js b/packages/website-eslint/src/linter/linter.js deleted file mode 100644 index c6953a894316..000000000000 --- a/packages/website-eslint/src/linter/linter.js +++ /dev/null @@ -1,27 +0,0 @@ -/* -NOTE - this file intentionally uses deep `/use-at-your-own-risk` imports into our packages. -This is so that rollup can properly tree-shake and only include the necessary code. -This saves us having to mock unnecessary things and reduces our bundle size. -*/ -// @ts-check - -import 'vs/language/typescript/tsWorker'; - -import rules from '@typescript-eslint/eslint-plugin/use-at-your-own-risk/rules'; -import { Linter } from 'eslint'; -import esquery from 'esquery'; - -export function createLinter() { - const linter = new Linter(); - for (const name in rules) { - linter.defineRule(`@typescript-eslint/${name}`, rules[name]); - } - return linter; -} - -export { analyze } from '@typescript-eslint/scope-manager/use-at-your-own-risk/analyze'; -export { visitorKeys } from '@typescript-eslint/visitor-keys/use-at-your-own-risk/visitor-keys'; -export { astConverter } from '@typescript-eslint/typescript-estree/use-at-your-own-risk/ast-converter'; -export { getScriptKind } from '@typescript-eslint/typescript-estree/use-at-your-own-risk/getScriptKind'; - -export { esquery }; diff --git a/packages/website-eslint/src/mock/empty.js b/packages/website-eslint/src/mock/empty.js index ff8b4c56321a..e69de29bb2d1 100644 --- a/packages/website-eslint/src/mock/empty.js +++ b/packages/website-eslint/src/mock/empty.js @@ -1 +0,0 @@ -export default {}; diff --git a/packages/website-eslint/src/mock/eslint-rules.js b/packages/website-eslint/src/mock/eslint-rules.js new file mode 100644 index 000000000000..e38eed4cefbd --- /dev/null +++ b/packages/website-eslint/src/mock/eslint-rules.js @@ -0,0 +1 @@ +exports.builtinRules = require('vt:eslint/rules'); diff --git a/packages/website-eslint/src/mock/eslint.js b/packages/website-eslint/src/mock/eslint.js new file mode 100644 index 000000000000..575e8eb7d238 --- /dev/null +++ b/packages/website-eslint/src/mock/eslint.js @@ -0,0 +1,6 @@ +class RuleTester {} +class SourceCode {} + +exports.Linter = require('vt:eslint/linter').Linter; +exports.RuleTester = RuleTester; +exports.SourceCode = SourceCode; diff --git a/packages/website-eslint/src/mock/globby.js b/packages/website-eslint/src/mock/globby.js deleted file mode 100644 index 80c2ae2d9e13..000000000000 --- a/packages/website-eslint/src/mock/globby.js +++ /dev/null @@ -1,4 +0,0 @@ -export function sync() { - // the website config is static and doesn't use glob config - return []; -} diff --git a/packages/website-eslint/src/mock/is-glob.js b/packages/website-eslint/src/mock/is-glob.js deleted file mode 100644 index e35771f6460f..000000000000 --- a/packages/website-eslint/src/mock/is-glob.js +++ /dev/null @@ -1,4 +0,0 @@ -export default function isGlob() { - // the website config is static and doesn't use glob config - return false; -} diff --git a/packages/website-eslint/src/mock/lru-cache.js b/packages/website-eslint/src/mock/lru-cache.js new file mode 100644 index 000000000000..ed112299ab18 --- /dev/null +++ b/packages/website-eslint/src/mock/lru-cache.js @@ -0,0 +1,14 @@ +class LruCache { + constructor() { + this.cache = new Map(); + } + get(name) { + return this.cache.get(name); + } + set(name, value) { + this.cache.set(name, value); + return value; + } +} + +module.exports = LruCache; diff --git a/packages/website-eslint/src/mock/path.js b/packages/website-eslint/src/mock/path.js index abf5e0f2466c..3af045a76fe0 100644 --- a/packages/website-eslint/src/mock/path.js +++ b/packages/website-eslint/src/mock/path.js @@ -59,7 +59,7 @@ const splitPath = function (filename) { // path.resolve([from ...], to) // posix version -export function resolve() { +function resolve() { let resolvedPath = ''; let resolvedAbsolute = false; @@ -93,7 +93,7 @@ export function resolve() { // path.normalize(path) // posix version -export function normalize(path) { +function normalize(path) { let isPathAbsolute = isAbsolute(path); let trailingSlash = path.endsWith('/'); @@ -116,12 +116,12 @@ export function normalize(path) { } // posix version -export function isAbsolute(path) { +function isAbsolute(path) { return path.charAt(0) === '/'; } // posix version -export function join() { +function join() { const paths = Array.prototype.slice.call(arguments, 0); return normalize( filter(paths, function (p) { @@ -135,7 +135,7 @@ export function join() { // path.relative(from, to) // posix version -export function relative(from, to) { +function relative(from, to) { from = resolve(from).slice(1); to = resolve(to).slice(1); @@ -182,10 +182,10 @@ export function relative(from, to) { return outputParts.join('/'); } -export const sep = '/'; -export const delimiter = ':'; +const sep = '/'; +const delimiter = ':'; -export function dirname(path) { +function dirname(path) { const result = splitPath(path); const root = result[0]; let dir = result[1]; @@ -203,7 +203,7 @@ export function dirname(path) { return root + dir; } -export function basename(path, ext) { +function basename(path, ext) { let f = splitPath(path)[2]; // TODO: make this comparison case-insensitive on windows? if (ext && f.slice(-1 * ext.length) === ext) { @@ -212,11 +212,11 @@ export function basename(path, ext) { return f; } -export function extname(path) { +function extname(path) { return splitPath(path)[3]; } -export default { +module.exports = { extname: extname, basename: basename, dirname: dirname, diff --git a/packages/website-eslint/src/mock/semver.js b/packages/website-eslint/src/mock/semver.js deleted file mode 100644 index ef1ba71db660..000000000000 --- a/packages/website-eslint/src/mock/semver.js +++ /dev/null @@ -1,7 +0,0 @@ -import major from 'semver/functions/major'; -import satisfies from 'semver/functions/satisfies'; - -// just in case someone adds a import * as semver usage -export { satisfies, major }; - -export default { satisfies, major }; diff --git a/packages/website-eslint/src/mock/ts-estree.js b/packages/website-eslint/src/mock/ts-estree.js new file mode 100644 index 000000000000..ed102ac3d349 --- /dev/null +++ b/packages/website-eslint/src/mock/ts-estree.js @@ -0,0 +1,2 @@ +exports.astConverter = + require('@typescript-eslint/typescript-estree/use-at-your-own-risk/ast-converter').astConverter; diff --git a/packages/website-eslint/src/mock/util.js b/packages/website-eslint/src/mock/util.js index 3e5cd5e0e71b..13e7fa4bada0 100644 --- a/packages/website-eslint/src/mock/util.js +++ b/packages/website-eslint/src/mock/util.js @@ -4,4 +4,4 @@ util.inspect = function (value) { return value; }; -export default util; +module.exports = util; diff --git a/packages/website-eslint/tsconfig.json b/packages/website-eslint/tsconfig.json index fe93b0d695fe..46fcbe96e9bf 100644 --- a/packages/website-eslint/tsconfig.json +++ b/packages/website-eslint/tsconfig.json @@ -8,6 +8,6 @@ "noEmit": true, "skipLibCheck": true }, - "include": ["src", "types", "rollup-plugin"], + "include": ["src", "types", "build.ts"], "references": [] } diff --git a/yarn.lock b/yarn.lock index aa53921f868d..47455040bf91 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1997,16 +1997,126 @@ "@esbuild-kit/core-utils" "^3.0.0" get-tsconfig "^4.2.0" +"@esbuild/android-arm64@0.17.12": + version "0.17.12" + resolved "https://registry.yarnpkg.com/@esbuild/android-arm64/-/android-arm64-0.17.12.tgz#15a8e2b407d03989b899e325151dc2e96d19c620" + integrity sha512-WQ9p5oiXXYJ33F2EkE3r0FRDFVpEdcDiwNX3u7Xaibxfx6vQE0Sb8ytrfQsA5WO6kDn6mDfKLh6KrPBjvkk7xA== + "@esbuild/android-arm@0.15.18": version "0.15.18" resolved "https://registry.yarnpkg.com/@esbuild/android-arm/-/android-arm-0.15.18.tgz#266d40b8fdcf87962df8af05b76219bc786b4f80" integrity sha512-5GT+kcs2WVGjVs7+boataCkO5Fg0y4kCjzkB5bAip7H4jfnOS3dA6KPiww9W1OEKTKeAcUVhdZGvgI65OXmUnw== +"@esbuild/android-arm@0.17.12": + version "0.17.12" + resolved "https://registry.yarnpkg.com/@esbuild/android-arm/-/android-arm-0.17.12.tgz#677a09297e1f4f37aba7b4fc4f31088b00484985" + integrity sha512-E/sgkvwoIfj4aMAPL2e35VnUJspzVYl7+M1B2cqeubdBhADV4uPon0KCc8p2G+LqSJ6i8ocYPCqY3A4GGq0zkQ== + +"@esbuild/android-x64@0.17.12": + version "0.17.12" + resolved "https://registry.yarnpkg.com/@esbuild/android-x64/-/android-x64-0.17.12.tgz#b292729eef4e0060ae1941f6a021c4d2542a3521" + integrity sha512-m4OsaCr5gT+se25rFPHKQXARMyAehHTQAz4XX1Vk3d27VtqiX0ALMBPoXZsGaB6JYryCLfgGwUslMqTfqeLU0w== + +"@esbuild/darwin-arm64@0.17.12": + version "0.17.12" + resolved "https://registry.yarnpkg.com/@esbuild/darwin-arm64/-/darwin-arm64-0.17.12.tgz#efa35318df931da05825894e1787b976d55adbe3" + integrity sha512-O3GCZghRIx+RAN0NDPhyyhRgwa19MoKlzGonIb5hgTj78krqp9XZbYCvFr9N1eUxg0ZQEpiiZ4QvsOQwBpP+lg== + +"@esbuild/darwin-x64@0.17.12": + version "0.17.12" + resolved "https://registry.yarnpkg.com/@esbuild/darwin-x64/-/darwin-x64-0.17.12.tgz#e7b54bb3f6dc81aadfd0485cd1623c648157e64d" + integrity sha512-5D48jM3tW27h1qjaD9UNRuN+4v0zvksqZSPZqeSWggfMlsVdAhH3pwSfQIFJwcs9QJ9BRibPS4ViZgs3d2wsCA== + +"@esbuild/freebsd-arm64@0.17.12": + version "0.17.12" + resolved "https://registry.yarnpkg.com/@esbuild/freebsd-arm64/-/freebsd-arm64-0.17.12.tgz#99a18a8579d6299c449566fe91d9b6a54cf2a591" + integrity sha512-OWvHzmLNTdF1erSvrfoEBGlN94IE6vCEaGEkEH29uo/VoONqPnoDFfShi41Ew+yKimx4vrmmAJEGNoyyP+OgOQ== + +"@esbuild/freebsd-x64@0.17.12": + version "0.17.12" + resolved "https://registry.yarnpkg.com/@esbuild/freebsd-x64/-/freebsd-x64-0.17.12.tgz#0e090190fede307fb4022f671791a50dd5121abd" + integrity sha512-A0Xg5CZv8MU9xh4a+7NUpi5VHBKh1RaGJKqjxe4KG87X+mTjDE6ZvlJqpWoeJxgfXHT7IMP9tDFu7IZ03OtJAw== + +"@esbuild/linux-arm64@0.17.12": + version "0.17.12" + resolved "https://registry.yarnpkg.com/@esbuild/linux-arm64/-/linux-arm64-0.17.12.tgz#7fe2a69f8a1a7153fa2b0f44aabcadb59475c7e0" + integrity sha512-cK3AjkEc+8v8YG02hYLQIQlOznW+v9N+OI9BAFuyqkfQFR+DnDLhEM5N8QRxAUz99cJTo1rLNXqRrvY15gbQUg== + +"@esbuild/linux-arm@0.17.12": + version "0.17.12" + resolved "https://registry.yarnpkg.com/@esbuild/linux-arm/-/linux-arm-0.17.12.tgz#b87c76ebf1fe03e01fd6bb5cfc2f3c5becd5ee93" + integrity sha512-WsHyJ7b7vzHdJ1fv67Yf++2dz3D726oO3QCu8iNYik4fb5YuuReOI9OtA+n7Mk0xyQivNTPbl181s+5oZ38gyA== + +"@esbuild/linux-ia32@0.17.12": + version "0.17.12" + resolved "https://registry.yarnpkg.com/@esbuild/linux-ia32/-/linux-ia32-0.17.12.tgz#9e9357090254524d32e6708883a47328f3037858" + integrity sha512-jdOBXJqcgHlah/nYHnj3Hrnl9l63RjtQ4vn9+bohjQPI2QafASB5MtHAoEv0JQHVb/xYQTFOeuHnNYE1zF7tYw== + "@esbuild/linux-loong64@0.15.18": version "0.15.18" resolved "https://registry.yarnpkg.com/@esbuild/linux-loong64/-/linux-loong64-0.15.18.tgz#128b76ecb9be48b60cf5cfc1c63a4f00691a3239" integrity sha512-L4jVKS82XVhw2nvzLg/19ClLWg0y27ulRwuP7lcyL6AbUWB5aPglXY3M21mauDQMDfRLs8cQmeT03r/+X3cZYQ== +"@esbuild/linux-loong64@0.17.12": + version "0.17.12" + resolved "https://registry.yarnpkg.com/@esbuild/linux-loong64/-/linux-loong64-0.17.12.tgz#9deb605f9e2c82f59412ddfefb4b6b96d54b5b5b" + integrity sha512-GTOEtj8h9qPKXCyiBBnHconSCV9LwFyx/gv3Phw0pa25qPYjVuuGZ4Dk14bGCfGX3qKF0+ceeQvwmtI+aYBbVA== + +"@esbuild/linux-mips64el@0.17.12": + version "0.17.12" + resolved "https://registry.yarnpkg.com/@esbuild/linux-mips64el/-/linux-mips64el-0.17.12.tgz#6ef170b974ddf5e6acdfa5b05f22b6e9dfd2b003" + integrity sha512-o8CIhfBwKcxmEENOH9RwmUejs5jFiNoDw7YgS0EJTF6kgPgcqLFjgoc5kDey5cMHRVCIWc6kK2ShUePOcc7RbA== + +"@esbuild/linux-ppc64@0.17.12": + version "0.17.12" + resolved "https://registry.yarnpkg.com/@esbuild/linux-ppc64/-/linux-ppc64-0.17.12.tgz#1638d3d4acf1d34aaf37cf8908c2e1cefed16204" + integrity sha512-biMLH6NR/GR4z+ap0oJYb877LdBpGac8KfZoEnDiBKd7MD/xt8eaw1SFfYRUeMVx519kVkAOL2GExdFmYnZx3A== + +"@esbuild/linux-riscv64@0.17.12": + version "0.17.12" + resolved "https://registry.yarnpkg.com/@esbuild/linux-riscv64/-/linux-riscv64-0.17.12.tgz#135b6e9270a8e2de2b9094bb21a287517df520ef" + integrity sha512-jkphYUiO38wZGeWlfIBMB72auOllNA2sLfiZPGDtOBb1ELN8lmqBrlMiucgL8awBw1zBXN69PmZM6g4yTX84TA== + +"@esbuild/linux-s390x@0.17.12": + version "0.17.12" + resolved "https://registry.yarnpkg.com/@esbuild/linux-s390x/-/linux-s390x-0.17.12.tgz#21e40830770c5d08368e300842bde382ce97d615" + integrity sha512-j3ucLdeY9HBcvODhCY4b+Ds3hWGO8t+SAidtmWu/ukfLLG/oYDMaA+dnugTVAg5fnUOGNbIYL9TOjhWgQB8W5g== + +"@esbuild/linux-x64@0.17.12": + version "0.17.12" + resolved "https://registry.yarnpkg.com/@esbuild/linux-x64/-/linux-x64-0.17.12.tgz#76c1c199871d48e1aaa47a762fb9e0dca52e1f7a" + integrity sha512-uo5JL3cgaEGotaqSaJdRfFNSCUJOIliKLnDGWaVCgIKkHxwhYMm95pfMbWZ9l7GeW9kDg0tSxcy9NYdEtjwwmA== + +"@esbuild/netbsd-x64@0.17.12": + version "0.17.12" + resolved "https://registry.yarnpkg.com/@esbuild/netbsd-x64/-/netbsd-x64-0.17.12.tgz#c7c3b3017a4b938c76c35f66af529baf62eac527" + integrity sha512-DNdoRg8JX+gGsbqt2gPgkgb00mqOgOO27KnrWZtdABl6yWTST30aibGJ6geBq3WM2TIeW6COs5AScnC7GwtGPg== + +"@esbuild/openbsd-x64@0.17.12": + version "0.17.12" + resolved "https://registry.yarnpkg.com/@esbuild/openbsd-x64/-/openbsd-x64-0.17.12.tgz#05d04217d980e049001afdbeacbb58d31bb5cefb" + integrity sha512-aVsENlr7B64w8I1lhHShND5o8cW6sB9n9MUtLumFlPhG3elhNWtE7M1TFpj3m7lT3sKQUMkGFjTQBrvDDO1YWA== + +"@esbuild/sunos-x64@0.17.12": + version "0.17.12" + resolved "https://registry.yarnpkg.com/@esbuild/sunos-x64/-/sunos-x64-0.17.12.tgz#cf3862521600e4eb6c440ec3bad31ed40fb87ef3" + integrity sha512-qbHGVQdKSwi0JQJuZznS4SyY27tYXYF0mrgthbxXrZI3AHKuRvU+Eqbg/F0rmLDpW/jkIZBlCO1XfHUBMNJ1pg== + +"@esbuild/win32-arm64@0.17.12": + version "0.17.12" + resolved "https://registry.yarnpkg.com/@esbuild/win32-arm64/-/win32-arm64-0.17.12.tgz#43dd7fb5be77bf12a1550355ab2b123efd60868e" + integrity sha512-zsCp8Ql+96xXTVTmm6ffvoTSZSV2B/LzzkUXAY33F/76EajNw1m+jZ9zPfNJlJ3Rh4EzOszNDHsmG/fZOhtqDg== + +"@esbuild/win32-ia32@0.17.12": + version "0.17.12" + resolved "https://registry.yarnpkg.com/@esbuild/win32-ia32/-/win32-ia32-0.17.12.tgz#9940963d0bff4ea3035a84e2b4c6e41c5e6296eb" + integrity sha512-FfrFjR4id7wcFYOdqbDfDET3tjxCozUgbqdkOABsSFzoZGFC92UK7mg4JKRc/B3NNEf1s2WHxJ7VfTdVDPN3ng== + +"@esbuild/win32-x64@0.17.12": + version "0.17.12" + resolved "https://registry.yarnpkg.com/@esbuild/win32-x64/-/win32-x64-0.17.12.tgz#3a11d13e9a5b0c05db88991b234d8baba1f96487" + integrity sha512-JOOxw49BVZx2/5tW3FqkdjSD/5gXYeVGPDcB0lvap0gLQshkh1Nyel1QazC+wNxus3xPlsYAgqU1BUmrmCvWtw== + "@eslint-community/eslint-utils@^4.1.2", "@eslint-community/eslint-utils@^4.2.0": version "4.2.0" resolved "https://registry.yarnpkg.com/@eslint-community/eslint-utils/-/eslint-utils-4.2.0.tgz#a831e6e468b4b2b5ae42bf658bea015bf10bc518" @@ -2929,25 +3039,6 @@ "@babel/helper-module-imports" "^7.10.4" "@rollup/pluginutils" "^3.1.0" -"@rollup/plugin-commonjs@^23.0.0": - version "23.0.0" - resolved "https://registry.yarnpkg.com/@rollup/plugin-commonjs/-/plugin-commonjs-23.0.0.tgz#3f64a49409d0681cd7496a71dd6577f07d39c3b0" - integrity sha512-JbrTRyDNtLQj/rhl7RFUuYXwQ2fac+33oLDAu2k++WD95zweyo28UAomLVA0JMGx4vmCa7Nw4T6k/1F6lelExg== - dependencies: - "@rollup/pluginutils" "^4.2.1" - commondir "^1.0.1" - estree-walker "^2.0.2" - glob "^8.0.3" - is-reference "1.2.1" - magic-string "^0.26.4" - -"@rollup/plugin-json@^5.0.0": - version "5.0.0" - resolved "https://registry.yarnpkg.com/@rollup/plugin-json/-/plugin-json-5.0.0.tgz#1e3e18302637760353c83a41d1f3c4e760afb20d" - integrity sha512-LsWDA5wJs/ggzakVuKQhZo7HPRcQZgBa3jWIVxQSFxaRToUGNi8ZBh3+k/gQ+1eInVYJgn4WBRCUkmoDrmmGzw== - dependencies: - "@rollup/pluginutils" "^4.2.1" - "@rollup/plugin-node-resolve@^11.2.1": version "11.2.1" resolved "https://registry.yarnpkg.com/@rollup/plugin-node-resolve/-/plugin-node-resolve-11.2.1.tgz#82aa59397a29cd4e13248b106e6a4a1880362a60" @@ -2960,18 +3051,6 @@ is-module "^1.0.0" resolve "^1.19.0" -"@rollup/plugin-node-resolve@^15.0.0": - version "15.0.0" - resolved "https://registry.yarnpkg.com/@rollup/plugin-node-resolve/-/plugin-node-resolve-15.0.0.tgz#44ded58b36702de27bf36bbf19ca420bbd1d0c27" - integrity sha512-iwJbzfTzlzDDQcGmkS7EkCKwe2kSkdBrjX87Fy/KrNjr6UNnLpod0t6X66e502LRe5JJCA4FFqrEscWPnZAkig== - dependencies: - "@rollup/pluginutils" "^4.2.1" - "@types/resolve" "1.20.2" - deepmerge "^4.2.2" - is-builtin-module "^3.2.0" - is-module "^1.0.0" - resolve "^1.22.1" - "@rollup/plugin-replace@^2.4.1": version "2.4.2" resolved "https://registry.yarnpkg.com/@rollup/plugin-replace/-/plugin-replace-2.4.2.tgz#a2d539314fbc77c244858faa523012825068510a" @@ -2980,15 +3059,6 @@ "@rollup/pluginutils" "^3.1.0" magic-string "^0.25.7" -"@rollup/plugin-terser@^0.4.0": - version "0.4.0" - resolved "https://registry.yarnpkg.com/@rollup/plugin-terser/-/plugin-terser-0.4.0.tgz#4c76249ad337f3eb04ab409332f23717af2c1fbf" - integrity sha512-Ipcf3LPNerey1q9ZMjiaWHlNPEHNU/B5/uh9zXLltfEQ1lVSLLeZSgAtTPWGyw8Ip1guOeq+mDtdOlEj/wNxQw== - dependencies: - serialize-javascript "^6.0.0" - smob "^0.0.6" - terser "^5.15.1" - "@rollup/pluginutils@^3.1.0": version "3.1.0" resolved "https://registry.yarnpkg.com/@rollup/pluginutils/-/pluginutils-3.1.0.tgz#706b4524ee6dc8b103b3c995533e5ad680c02b9b" @@ -2998,23 +3068,6 @@ estree-walker "^1.0.1" picomatch "^2.2.2" -"@rollup/pluginutils@^4.2.1": - version "4.2.1" - resolved "https://registry.yarnpkg.com/@rollup/pluginutils/-/pluginutils-4.2.1.tgz#e6c6c3aba0744edce3fb2074922d3776c0af2a6d" - integrity sha512-iKnFXr7NkdZAIHiIWE+BX5ULi/ucVFYWD6TbAV+rZctiRTY2PL6tsIKhoIOaoskiWAkgu+VsbXgUVDNLHf+InQ== - dependencies: - estree-walker "^2.0.1" - picomatch "^2.2.2" - -"@rollup/pluginutils@^5.0.0": - version "5.0.1" - resolved "https://registry.yarnpkg.com/@rollup/pluginutils/-/pluginutils-5.0.1.tgz#63def51f5a76dadd984689d33c7f000164152a97" - integrity sha512-4HaCVEXXuObvcPUaUlLt4faHYHCeQOOWNj8NKFGaRSrw3ZLD0TWeAFZicV9vXjnE2nkNuaVTfTuwAnjR+6uc9A== - dependencies: - "@types/estree" "^1.0.0" - estree-walker "^2.0.2" - picomatch "^2.3.1" - "@rushstack/node-core-library@3.55.2": version "3.55.2" resolved "https://registry.yarnpkg.com/@rushstack/node-core-library/-/node-core-library-3.55.2.tgz#d951470bac98171de13a8a351d4537c63fbfd0b6" @@ -3460,10 +3513,6 @@ version "0.0.0" uid "" -"@types/estree@*": - version "0.0.0" - uid "" - "@types/estree@0.0.39": version "0.0.0" uid "" @@ -3472,10 +3521,6 @@ version "0.0.0" uid "" -"@types/estree@^1.0.0": - version "0.0.0" - uid "" - "@types/estree@link:./tools/dummypkg": version "0.0.0" uid "" @@ -3733,11 +3778,6 @@ dependencies: "@types/node" "*" -"@types/resolve@1.20.2": - version "1.20.2" - resolved "https://registry.yarnpkg.com/@types/resolve/-/resolve-1.20.2.tgz#97d26e00cd4a0423b4af620abecf3e6f442b7975" - integrity sha512-60BCwRFOZCQhDncwQdxxeOEEkbc5dIMccYLwbxsS4TUNeVECQ/pBJ0j09mrHOl/JJvpRPGwO9SvE4nR2Nb/a4Q== - "@types/retry@^0.12.0": version "0.12.1" resolved "https://registry.yarnpkg.com/@types/retry/-/retry-0.12.1.tgz#d8f1c0d0dc23afad6dc16a9e993a0865774b4065" @@ -6597,6 +6637,34 @@ esbuild@~0.15.10: esbuild-windows-64 "0.15.18" esbuild-windows-arm64 "0.15.18" +esbuild@~0.17.12: + version "0.17.12" + resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.17.12.tgz#2ad7523bf1bc01881e9d904bc04e693bd3bdcf2f" + integrity sha512-bX/zHl7Gn2CpQwcMtRogTTBf9l1nl+H6R8nUbjk+RuKqAE3+8FDulLA+pHvX7aA7Xe07Iwa+CWvy9I8Y2qqPKQ== + optionalDependencies: + "@esbuild/android-arm" "0.17.12" + "@esbuild/android-arm64" "0.17.12" + "@esbuild/android-x64" "0.17.12" + "@esbuild/darwin-arm64" "0.17.12" + "@esbuild/darwin-x64" "0.17.12" + "@esbuild/freebsd-arm64" "0.17.12" + "@esbuild/freebsd-x64" "0.17.12" + "@esbuild/linux-arm" "0.17.12" + "@esbuild/linux-arm64" "0.17.12" + "@esbuild/linux-ia32" "0.17.12" + "@esbuild/linux-loong64" "0.17.12" + "@esbuild/linux-mips64el" "0.17.12" + "@esbuild/linux-ppc64" "0.17.12" + "@esbuild/linux-riscv64" "0.17.12" + "@esbuild/linux-s390x" "0.17.12" + "@esbuild/linux-x64" "0.17.12" + "@esbuild/netbsd-x64" "0.17.12" + "@esbuild/openbsd-x64" "0.17.12" + "@esbuild/sunos-x64" "0.17.12" + "@esbuild/win32-arm64" "0.17.12" + "@esbuild/win32-ia32" "0.17.12" + "@esbuild/win32-x64" "0.17.12" + escalade@^3.1.1: version "3.1.1" resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.1.tgz#d8cfdc7000965c5a0174b4a82eaa5c0552742e40" @@ -6892,11 +6960,6 @@ estree-walker@^1.0.1: resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-1.0.1.tgz#31bc5d612c96b704106b477e6dd5d8aa138cb700" integrity sha512-1fMXF3YP4pZZVozF8j/ZLfvnR8NSIljt56UhbZ5PeeDmmGHpgpdwQt7ITlGvYaQukCvuBRMLEiKiYC+oeIg4cg== -estree-walker@^2.0.1, estree-walker@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-2.0.2.tgz#52f010178c2a4c117a7757cfe942adb7d2da4cac" - integrity sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w== - esutils@^2.0.2: version "2.0.3" resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64" @@ -8612,13 +8675,6 @@ is-promise@^2.2.2: resolved "https://registry.yarnpkg.com/is-promise/-/is-promise-2.2.2.tgz#39ab959ccbf9a774cf079f7b40c7a26f763135f1" integrity sha512-+lP4/6lKUBfQjZ2pdxThZvLUAafmZb8OAxFb8XXtiQmS35INgr85hdOGoEs124ez1FCnZJt6jau/T+alh58QFQ== -is-reference@1.2.1: - version "1.2.1" - resolved "https://registry.yarnpkg.com/is-reference/-/is-reference-1.2.1.tgz#8b2dac0b371f4bc994fdeaba9eb542d03002d0b7" - integrity sha512-U82MsXXiFIrjCK4otLT+o2NA2Cd2g5MLoOVXUZjIOhLurrRxpEXzI8O0KZHr3IjLvlAH1kTPYSuqer5T9ZVBKQ== - dependencies: - "@types/estree" "*" - is-regex@^1.1.4: version "1.1.4" resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.1.4.tgz#eef5663cd59fa4c0ae339505323df6854bb15958" @@ -9824,20 +9880,13 @@ lzstring.ts@^2.0.2: dependencies: tslib "^1.10.0" -magic-string@0.25.9, magic-string@^0.25.0, magic-string@^0.25.7: +magic-string@^0.25.0, magic-string@^0.25.7: version "0.25.9" resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.25.9.tgz#de7f9faf91ef8a1c91d02c2e5314c8277dbcdd1c" integrity sha512-RmF0AsMzgt25qzqqLc1+MbHmhdx0ojF2Fvs4XnOqz2ZOBXzzkEwc/dJQZCYHAn7v1jbVOjAZfK8msRn4BxO4VQ== dependencies: sourcemap-codec "^1.4.8" -magic-string@^0.26.4: - version "0.26.7" - resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.26.7.tgz#caf7daf61b34e9982f8228c4527474dac8981d6f" - integrity sha512-hX9XH3ziStPoPhJxLq1syWuZMxbDvGNbVchfrdCtanC7D13888bMFow61x8axrx+GfHLtVeAx2kxL7tTGRl+Ow== - dependencies: - sourcemap-codec "^1.4.8" - make-dir@*, make-dir@3.1.0, make-dir@^3.0.0, make-dir@^3.0.2, make-dir@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-3.1.0.tgz#415e967046b3a7f1d185277d84aa58203726a13f" @@ -12382,7 +12431,7 @@ rollup-plugin-terser@^7.0.0: serialize-javascript "^4.0.0" terser "^5.0.0" -rollup@^2.43.1, rollup@^2.75.4: +rollup@^2.43.1: version "2.79.1" resolved "https://registry.yarnpkg.com/rollup/-/rollup-2.79.1.tgz#bedee8faef7c9f93a2647ac0108748f497f081c7" integrity sha512-uKxbd0IhMZOhjAiD5oAFp7BqvkA4Dv47qpOCtaNvng4HBwdbWtdOh8f5nZNuk2rp51PMGk3bzfWu5oayNEuYnw== @@ -12795,11 +12844,6 @@ smart-buffer@^4.2.0: resolved "https://registry.yarnpkg.com/smart-buffer/-/smart-buffer-4.2.0.tgz#6e1d71fa4f18c05f7d0ff216dd16a481d0e8d9ae" integrity sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg== -smob@^0.0.6: - version "0.0.6" - resolved "https://registry.yarnpkg.com/smob/-/smob-0.0.6.tgz#09b268fea916158a2781c152044c6155adbb8aa1" - integrity sha512-V21+XeNni+tTyiST1MHsa84AQhT1aFZipzPpOFAVB8DkHzwJyjjAmt9bgwnuZiZWnIbMo2duE29wybxv/7HWUw== - sockjs@^0.3.24: version "0.3.24" resolved "https://registry.yarnpkg.com/sockjs/-/sockjs-0.3.24.tgz#c9bc8995f33a111bea0395ec30aa3206bdb5ccce" @@ -13279,7 +13323,7 @@ terser-webpack-plugin@^5.1.3, terser-webpack-plugin@^5.3.3: serialize-javascript "^6.0.0" terser "^5.7.2" -terser@^5.0.0, terser@^5.10.0, terser@^5.15.1, terser@^5.7.2: +terser@^5.0.0, terser@^5.10.0, terser@^5.7.2: version "5.16.5" resolved "https://registry.yarnpkg.com/terser/-/terser-5.16.5.tgz#1c285ca0655f467f92af1bbab46ab72d1cb08e5a" integrity sha512-qcwfg4+RZa3YvlFh0qjifnzBHjKGNbtDo9yivMqMFDy9Q6FSaQWSB/j1xKhsoUFJIqDOM3TsN6D5xbrMrFcHbg== From 539e39147ced8d1373d192f725d70c3723f62092 Mon Sep 17 00:00:00 2001 From: Armano Date: Tue, 21 Mar 2023 12:13:47 +0100 Subject: [PATCH 2/9] fix: correct linting issues --- packages/website-eslint/src/index.js | 1 + packages/website-eslint/src/mock/eslint.js | 1 + 2 files changed, 2 insertions(+) diff --git a/packages/website-eslint/src/index.js b/packages/website-eslint/src/index.js index 0834cf66f2d5..079cf19a1004 100644 --- a/packages/website-eslint/src/index.js +++ b/packages/website-eslint/src/index.js @@ -1,3 +1,4 @@ +// eslint-disable-next-line no-undef,import/no-amd define(['exports', 'vs/language/typescript/tsWorker'], function (e, _t) { const eslintPlugin = require('@typescript-eslint/eslint-plugin'); const Linter = require('eslint').Linter; diff --git a/packages/website-eslint/src/mock/eslint.js b/packages/website-eslint/src/mock/eslint.js index 575e8eb7d238..bb112732ff67 100644 --- a/packages/website-eslint/src/mock/eslint.js +++ b/packages/website-eslint/src/mock/eslint.js @@ -2,5 +2,6 @@ class RuleTester {} class SourceCode {} exports.Linter = require('vt:eslint/linter').Linter; + exports.RuleTester = RuleTester; exports.SourceCode = SourceCode; From 3a68591a2ed18bd1c556d389f6a9f23666172630 Mon Sep 17 00:00:00 2001 From: Armano Date: Fri, 24 Mar 2023 09:38:03 +0100 Subject: [PATCH 3/9] chore: build bundle from source code and remove unnecessary use-at-your-own-risk --- packages/scope-manager/package.json | 6 +- packages/typescript-estree/package.json | 14 +--- .../src/use-at-your-own-risk.ts | 8 ++ packages/visitor-keys/package.json | 6 +- packages/website-eslint/build.ts | 74 +++++++++++-------- packages/website-eslint/src/index.js | 40 ++++++---- packages/website-eslint/src/mock/path.js | 22 +++--- packages/website-eslint/src/mock/ts-estree.js | 2 - .../src/components/editor/loadSandbox.ts | 30 ++++---- .../src/components/linter/WebLinter.ts | 6 +- .../website/src/components/linter/config.ts | 2 +- packages/website/src/globals.d.ts | 13 +--- 12 files changed, 116 insertions(+), 107 deletions(-) create mode 100644 packages/typescript-estree/src/use-at-your-own-risk.ts delete mode 100644 packages/website-eslint/src/mock/ts-estree.js diff --git a/packages/scope-manager/package.json b/packages/scope-manager/package.json index e02f58c3b1a5..cc88c8f313ab 100644 --- a/packages/scope-manager/package.json +++ b/packages/scope-manager/package.json @@ -14,11 +14,7 @@ "types": "./dist/index.d.ts", "default": "./dist/index.js" }, - "./package.json": "./package.json", - "./use-at-your-own-risk/analyze": { - "types": "./dist/analyze.d.ts", - "default": "./dist/analyze.js" - } + "./package.json": "./package.json" }, "engines": { "node": "^14.18.0 || ^16.0.0 || >=18.0.0" diff --git a/packages/typescript-estree/package.json b/packages/typescript-estree/package.json index 2128ffb4674f..76de95f5a1c5 100644 --- a/packages/typescript-estree/package.json +++ b/packages/typescript-estree/package.json @@ -15,17 +15,9 @@ "default": "./dist/index.js" }, "./package.json": "./package.json", - "./use-at-your-own-risk/ast-converter": { - "types": "./dist/ast-converter.d.ts", - "default": "./dist/ast-converter.js" - }, - "./use-at-your-own-risk/parseSettings": { - "types": "./dist/parseSettings/index.d.ts", - "default": "./dist/parseSettings/index.js" - }, - "./use-at-your-own-risk/getScriptKind": { - "types": "./dist/create-program/getScriptKind.d.ts", - "default": "./dist/create-program/getScriptKind.js" + "./use-at-your-own-risk": { + "types": "./dist/use-at-your-own-risk.d.ts", + "default": "./dist/use-at-your-own-risk.js" } }, "engines": { diff --git a/packages/typescript-estree/src/use-at-your-own-risk.ts b/packages/typescript-estree/src/use-at-your-own-risk.ts new file mode 100644 index 000000000000..c289e11086ca --- /dev/null +++ b/packages/typescript-estree/src/use-at-your-own-risk.ts @@ -0,0 +1,8 @@ +// required by website +export * from './create-program/getScriptKind'; +export * from './ast-converter'; +export type { ParseSettings } from './parseSettings'; + +// required by packages/utils/src/ts-estree.ts +export * from './getModifiers'; +export { typescriptVersionIsAtLeast } from './version-check'; diff --git a/packages/visitor-keys/package.json b/packages/visitor-keys/package.json index ee1aea006d1c..a7276671f51b 100644 --- a/packages/visitor-keys/package.json +++ b/packages/visitor-keys/package.json @@ -15,11 +15,7 @@ "types": "./dist/index.d.ts", "default": "./dist/index.js" }, - "./package.json": "./package.json", - "./use-at-your-own-risk/visitor-keys": { - "types": "./dist/visitor-keys.d.ts", - "default": "./dist/visitor-keys.js" - } + "./package.json": "./package.json" }, "engines": { "node": "^14.18.0 || ^16.0.0 || >=18.0.0" diff --git a/packages/website-eslint/build.ts b/packages/website-eslint/build.ts index 20432358c61c..fd7bb448bc8d 100644 --- a/packages/website-eslint/build.ts +++ b/packages/website-eslint/build.ts @@ -26,6 +26,16 @@ function makeFilter(filePath: string | string[]): { filter: RegExp } { return { filter: new RegExp('(' + norm.join('|') + ')$') }; } +function createResolve( + targetPath: string, + join: string, +): esbuild.OnResolveResult { + const resolvedPackage = requireResolved(targetPath + '/package.json'); + return { + path: path.join(resolvedPackage, '../src/', join), + }; +} + async function buildPackage(name: string, file: string): Promise { const eslintRoot = requireResolved('eslint/package.json'); const linterPath = path.join(eslintRoot, '../lib/linter/linter.js'); @@ -56,8 +66,6 @@ async function buildPackage(name: string, file: string): Promise { 'process.env.TIMING': 'undefined', 'define.amd': 'false', global: 'window', - // 'process.env': 'undefined', - // process: 'undefined', }, alias: { util: requireResolved('./src/mock/util.js'), @@ -72,25 +80,28 @@ async function buildPackage(name: string, file: string): Promise { setup(build): void { build.onLoad( makeFilter([ - '/eslint-utils/rule-tester/RuleTester.js', - '/utils/dist/ts-eslint/ESLint.js', - '/utils/dist/ts-eslint/RuleTester.js', - '/utils/dist/ts-eslint/CLIEngine.js', + '/eslint-utils/rule-tester/RuleTester.ts', + '/ts-eslint/ESLint.ts', + '/ts-eslint/RuleTester.ts', + '/ts-eslint/CLIEngine.ts', ]), async args => { console.log('onLoad:replace', args.path); - const text = await requireMock('./src/mock/empty.js'); - return { contents: text, loader: 'js' }; + const contents = await requireMock('./src/mock/empty.js'); + return { contents, loader: 'js' }; }, ); build.onLoad( makeFilter('/eslint/lib/unsupported-api.js'), async args => { console.log('onLoad:eslint:unsupported-api', args.path); - let text = await requireMock('./src/mock/eslint-rules.js'); + let contents = await requireMock('./src/mock/eslint-rules.js'); // this is needed to bypass system module resolver - text = text.replace('vt:eslint/rules', normalizePath(rulesPath)); - return { contents: text, loader: 'js' }; + contents = contents.replace( + 'vt:eslint/rules', + normalizePath(rulesPath), + ); + return { contents, loader: 'js' }; }, ); build.onLoad(makeFilter('/eslint/lib/api.js'), async args => { @@ -100,30 +111,35 @@ async function buildPackage(name: string, file: string): Promise { text = text.replace('vt:eslint/linter', normalizePath(linterPath)); return { contents: text, loader: 'js' }; }); - build.onLoad( - makeFilter('/typescript-estree/dist/index.js'), - async args => { - console.log('onLoad:typescript-estree', args.path); - const text = await requireMock('./src/mock/ts-estree.js'); - return { contents: text, loader: 'js' }; - }, + build.onResolve( + makeFilter([ + '@typescript-eslint/typescript-estree', + '@typescript-eslint/typescript-estree/use-at-your-own-risk', + ]), + () => + createResolve( + '@typescript-eslint/typescript-estree', + 'use-at-your-own-risk.ts', + ), + ); + build.onResolve( + makeFilter('@typescript-eslint/utils/ast-utils'), + () => + createResolve('@typescript-eslint/utils', 'ast-utils/index.ts'), + ); + build.onResolve(makeFilter('@typescript-eslint/[a-z-]+'), args => + createResolve(args.path, 'index.ts'), ); }, }, ], }); - if (output.errors) { - for (const error of output.errors) { - console.error(error); - } - for (const warning of output.warnings) { - console.warn(warning); - } - - if (output.errors.length > 0) { - throw new Error('error occurred'); - } + for (const error of output.errors) { + console.error(error); + } + for (const warning of output.warnings) { + console.warn(warning); } } diff --git a/packages/website-eslint/src/index.js b/packages/website-eslint/src/index.js index 079cf19a1004..b05f23af4e93 100644 --- a/packages/website-eslint/src/index.js +++ b/packages/website-eslint/src/index.js @@ -1,22 +1,30 @@ -// eslint-disable-next-line no-undef,import/no-amd -define(['exports', 'vs/language/typescript/tsWorker'], function (e, _t) { - const eslintPlugin = require('@typescript-eslint/eslint-plugin'); - const Linter = require('eslint').Linter; +// @ts-check +/* eslint-disable import/no-amd */ +/* global define */ - e.getScriptKind = - require('@typescript-eslint/typescript-estree/use-at-your-own-risk/getScriptKind').getScriptKind; - e.analyze = - require('@typescript-eslint/scope-manager/use-at-your-own-risk/analyze').analyze; - e.visitorKeys = - require('@typescript-eslint/visitor-keys/use-at-your-own-risk/visitor-keys').visitorKeys; - e.astConverter = - require('@typescript-eslint/typescript-estree/use-at-your-own-risk/ast-converter').astConverter; - e.esquery = require('esquery'); +import { rules } from '@typescript-eslint/eslint-plugin'; +import { analyze } from '@typescript-eslint/scope-manager'; +import { + astConverter, + getScriptKind, +} from '@typescript-eslint/typescript-estree/use-at-your-own-risk'; +import { visitorKeys } from '@typescript-eslint/visitor-keys'; +import { Linter } from 'eslint'; +import esquery from 'esquery'; - e.createLinter = function () { +// @ts-expect-error define is not defined +define(['exports', 'vs/language/typescript/tsWorker'], function (exports) { + // don't change exports to export * + exports.getScriptKind = getScriptKind; + exports.analyze = analyze; + exports.visitorKeys = visitorKeys; + exports.astConverter = astConverter; + exports.esquery = esquery; + + exports.createLinter = function () { const linter = new Linter(); - for (const name in eslintPlugin.rules) { - linter.defineRule(`@typescript-eslint/${name}`, eslintPlugin.rules[name]); + for (const name in rules) { + linter.defineRule(`@typescript-eslint/${name}`, rules[name]); } return linter; }; diff --git a/packages/website-eslint/src/mock/path.js b/packages/website-eslint/src/mock/path.js index 3af045a76fe0..abf5e0f2466c 100644 --- a/packages/website-eslint/src/mock/path.js +++ b/packages/website-eslint/src/mock/path.js @@ -59,7 +59,7 @@ const splitPath = function (filename) { // path.resolve([from ...], to) // posix version -function resolve() { +export function resolve() { let resolvedPath = ''; let resolvedAbsolute = false; @@ -93,7 +93,7 @@ function resolve() { // path.normalize(path) // posix version -function normalize(path) { +export function normalize(path) { let isPathAbsolute = isAbsolute(path); let trailingSlash = path.endsWith('/'); @@ -116,12 +116,12 @@ function normalize(path) { } // posix version -function isAbsolute(path) { +export function isAbsolute(path) { return path.charAt(0) === '/'; } // posix version -function join() { +export function join() { const paths = Array.prototype.slice.call(arguments, 0); return normalize( filter(paths, function (p) { @@ -135,7 +135,7 @@ function join() { // path.relative(from, to) // posix version -function relative(from, to) { +export function relative(from, to) { from = resolve(from).slice(1); to = resolve(to).slice(1); @@ -182,10 +182,10 @@ function relative(from, to) { return outputParts.join('/'); } -const sep = '/'; -const delimiter = ':'; +export const sep = '/'; +export const delimiter = ':'; -function dirname(path) { +export function dirname(path) { const result = splitPath(path); const root = result[0]; let dir = result[1]; @@ -203,7 +203,7 @@ function dirname(path) { return root + dir; } -function basename(path, ext) { +export function basename(path, ext) { let f = splitPath(path)[2]; // TODO: make this comparison case-insensitive on windows? if (ext && f.slice(-1 * ext.length) === ext) { @@ -212,11 +212,11 @@ function basename(path, ext) { return f; } -function extname(path) { +export function extname(path) { return splitPath(path)[3]; } -module.exports = { +export default { extname: extname, basename: basename, dirname: dirname, diff --git a/packages/website-eslint/src/mock/ts-estree.js b/packages/website-eslint/src/mock/ts-estree.js deleted file mode 100644 index ed102ac3d349..000000000000 --- a/packages/website-eslint/src/mock/ts-estree.js +++ /dev/null @@ -1,2 +0,0 @@ -exports.astConverter = - require('@typescript-eslint/typescript-estree/use-at-your-own-risk/ast-converter').astConverter; diff --git a/packages/website/src/components/editor/loadSandbox.ts b/packages/website/src/components/editor/loadSandbox.ts index 17efeb38429b..334f44907c82 100644 --- a/packages/website/src/components/editor/loadSandbox.ts +++ b/packages/website/src/components/editor/loadSandbox.ts @@ -1,17 +1,19 @@ import type MonacoType from 'monaco-editor'; import type * as TSType from 'typescript'; -import type * as SandboxFactory from '../../vendor/sandbox'; -import type * as TsWorker from '../../vendor/tsWorker'; +import type * as SandboxFactoryType from '../../vendor/sandbox'; +import type * as TsWorkerType from '../../vendor/tsWorker'; import type { LintUtils } from '../linter/WebLinter'; type Monaco = typeof MonacoType; type TS = typeof TSType; +type TsWorker = typeof TsWorkerType; +type SandboxFactory = typeof SandboxFactoryType; export interface SandboxModel { main: Monaco; - tsWorker: typeof TsWorker; - sandboxFactory: typeof SandboxFactory; + tsWorker: TsWorker; + sandboxFactory: SandboxFactory; ts: TS; lintUtils: LintUtils; } @@ -36,22 +38,24 @@ function loadSandbox(tsVersion: string): Promise { }); // Grab a copy of monaco, TypeScript and the sandbox - window.require( + window.require<[Monaco, TsWorker, SandboxFactory]>( [ 'vs/editor/editor.main', 'vs/language/typescript/tsWorker', 'sandbox/index', - 'linter/index', ], - (main, tsWorker, sandboxFactory, lintUtils) => { + (main, tsWorker, sandboxFactory) => { const isOK = main && window.ts && sandboxFactory; if (isOK) { - resolve({ - main, - tsWorker, - sandboxFactory, - ts: window.ts, - lintUtils, + // https://github.com/evanw/esbuild/issues/819 - update linter/index to proper amd to fix this + window.require<[LintUtils]>(['linter/index'], lintUtils => { + resolve({ + main, + tsWorker, + sandboxFactory, + ts: window.ts, + lintUtils, + }); }); } else { reject( diff --git a/packages/website/src/components/linter/WebLinter.ts b/packages/website/src/components/linter/WebLinter.ts index 23fd3406fb5a..22fa52eae421 100644 --- a/packages/website/src/components/linter/WebLinter.ts +++ b/packages/website/src/components/linter/WebLinter.ts @@ -2,8 +2,10 @@ import { createVirtualCompilerHost } from '@site/src/components/linter/CompilerH import { parseSettings } from '@site/src/components/linter/config'; import type { analyze } from '@typescript-eslint/scope-manager'; import type { ParserOptions } from '@typescript-eslint/types'; -import type { astConverter } from '@typescript-eslint/typescript-estree/use-at-your-own-risk/ast-converter'; -import type { getScriptKind } from '@typescript-eslint/typescript-estree/use-at-your-own-risk/getScriptKind'; +import type { + astConverter, + getScriptKind, +} from '@typescript-eslint/typescript-estree/use-at-your-own-risk'; import type { TSESLint, TSESTree } from '@typescript-eslint/utils'; import type esquery from 'esquery'; import type { diff --git a/packages/website/src/components/linter/config.ts b/packages/website/src/components/linter/config.ts index e528d202e643..93466f9451ab 100644 --- a/packages/website/src/components/linter/config.ts +++ b/packages/website/src/components/linter/config.ts @@ -1,4 +1,4 @@ -import type { ParseSettings } from '@typescript-eslint/typescript-estree/use-at-your-own-risk/parseSettings'; +import type { ParseSettings } from '@typescript-eslint/typescript-estree/use-at-your-own-risk'; export const parseSettings: ParseSettings = { allowInvalidAST: false, diff --git a/packages/website/src/globals.d.ts b/packages/website/src/globals.d.ts index 4ac1667b75fc..f5e2923d6d68 100644 --- a/packages/website/src/globals.d.ts +++ b/packages/website/src/globals.d.ts @@ -1,20 +1,9 @@ -import type * as SandboxFactory from '@site/src/vendor/sandbox'; -import type * as TsWorker from '@site/src/vendor/tsWorker'; import type esquery from 'esquery'; -import type MonacoType from 'monaco-editor'; import type * as TSType from 'typescript'; -import type { LintUtils } from './components/linter/WebLinter'; - declare global { - type WindowRequireCb = ( - main: typeof MonacoType, - tsWorker: typeof TsWorker, - sandboxFactory: typeof SandboxFactory, - lintUtils: LintUtils, - ) => void; interface WindowRequire { - (files: string[], cb: WindowRequireCb): void; + (files: string[], cb: (...arg: T) => void): void; config: (arg: { paths?: Record; ignoreDuplicateModules?: string[]; From f6fb77fa38524a08fa662b4f6d55e81c439ce64c Mon Sep 17 00:00:00 2001 From: Armano Date: Fri, 24 Mar 2023 11:56:54 +0100 Subject: [PATCH 4/9] fix: correct displaying errors and warning --- packages/website-eslint/build.ts | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/packages/website-eslint/build.ts b/packages/website-eslint/build.ts index fd7bb448bc8d..ac4d26c0a56f 100644 --- a/packages/website-eslint/build.ts +++ b/packages/website-eslint/build.ts @@ -41,7 +41,7 @@ async function buildPackage(name: string, file: string): Promise { const linterPath = path.join(eslintRoot, '../lib/linter/linter.js'); const rulesPath = path.join(eslintRoot, '../lib/rules/index.js'); - const output = await esbuild.build({ + await esbuild.build({ entryPoints: { [name]: requireResolved(file), }, @@ -130,17 +130,18 @@ async function buildPackage(name: string, file: string): Promise { build.onResolve(makeFilter('@typescript-eslint/[a-z-]+'), args => createResolve(args.path, 'index.ts'), ); + build.onEnd(e => { + for (const error of e.errors) { + console.error(error); + } + for (const warning of e.warnings) { + console.warn(warning); + } + }); }, }, ], }); - - for (const error of output.errors) { - console.error(error); - } - for (const warning of output.warnings) { - console.warn(warning); - } } console.time('building eslint for web'); @@ -149,7 +150,7 @@ buildPackage('index', './src/index.js') .then(() => { console.timeEnd('building eslint for web'); }) - .catch(e => { - console.error(e); + .catch((e: unknown) => { + console.error(String(e)); process.exit(1); }); From 22b855b7c2e4bfe9480c289a185c05557c8621c1 Mon Sep 17 00:00:00 2001 From: Armano Date: Sat, 25 Mar 2023 04:36:59 +0100 Subject: [PATCH 5/9] fix: build code as iife to not pollute global scope --- packages/website-eslint/build.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/website-eslint/build.ts b/packages/website-eslint/build.ts index ac4d26c0a56f..372f6fe0ebf8 100644 --- a/packages/website-eslint/build.ts +++ b/packages/website-eslint/build.ts @@ -45,7 +45,7 @@ async function buildPackage(name: string, file: string): Promise { entryPoints: { [name]: requireResolved(file), }, - format: 'cjs', + format: 'iife', platform: 'browser', bundle: true, external: [], From f1799d9ba9b42fc504984ebab637afb7e0ad714c Mon Sep 17 00:00:00 2001 From: Armano Date: Sat, 25 Mar 2023 06:06:13 +0100 Subject: [PATCH 6/9] fix: use banner & footer as amd wrapper --- packages/website-eslint/build.ts | 10 +++++- packages/website-eslint/src/index.js | 31 ++++++++----------- .../src/components/editor/loadSandbox.ts | 20 ++++++------ 3 files changed, 31 insertions(+), 30 deletions(-) diff --git a/packages/website-eslint/build.ts b/packages/website-eslint/build.ts index 372f6fe0ebf8..1df4d68c8fe7 100644 --- a/packages/website-eslint/build.ts +++ b/packages/website-eslint/build.ts @@ -45,7 +45,7 @@ async function buildPackage(name: string, file: string): Promise { entryPoints: { [name]: requireResolved(file), }, - format: 'iife', + format: 'cjs', platform: 'browser', bundle: true, external: [], @@ -56,6 +56,14 @@ async function buildPackage(name: string, file: string): Promise { sourcemap: 'linked', outdir: './dist/', supported: {}, + banner: { + // https://github.com/evanw/esbuild/issues/819 + js: `define(['exports', 'vs/language/typescript/tsWorker'], function (exports) {`, + }, + footer: { + // https://github.com/evanw/esbuild/issues/819 + js: `});`, + }, define: { 'process.env.NODE_ENV': '"production"', 'process.env.NODE_DEBUG': 'false', diff --git a/packages/website-eslint/src/index.js b/packages/website-eslint/src/index.js index b05f23af4e93..17bf81afce01 100644 --- a/packages/website-eslint/src/index.js +++ b/packages/website-eslint/src/index.js @@ -1,6 +1,4 @@ // @ts-check -/* eslint-disable import/no-amd */ -/* global define */ import { rules } from '@typescript-eslint/eslint-plugin'; import { analyze } from '@typescript-eslint/scope-manager'; @@ -12,20 +10,17 @@ import { visitorKeys } from '@typescript-eslint/visitor-keys'; import { Linter } from 'eslint'; import esquery from 'esquery'; -// @ts-expect-error define is not defined -define(['exports', 'vs/language/typescript/tsWorker'], function (exports) { - // don't change exports to export * - exports.getScriptKind = getScriptKind; - exports.analyze = analyze; - exports.visitorKeys = visitorKeys; - exports.astConverter = astConverter; - exports.esquery = esquery; +// don't change exports to export * +exports.getScriptKind = getScriptKind; +exports.analyze = analyze; +exports.visitorKeys = visitorKeys; +exports.astConverter = astConverter; +exports.esquery = esquery; - exports.createLinter = function () { - const linter = new Linter(); - for (const name in rules) { - linter.defineRule(`@typescript-eslint/${name}`, rules[name]); - } - return linter; - }; -}); +exports.createLinter = function () { + const linter = new Linter(); + for (const name in rules) { + linter.defineRule(`@typescript-eslint/${name}`, rules[name]); + } + return linter; +}; diff --git a/packages/website/src/components/editor/loadSandbox.ts b/packages/website/src/components/editor/loadSandbox.ts index 334f44907c82..2cf3517b2b9a 100644 --- a/packages/website/src/components/editor/loadSandbox.ts +++ b/packages/website/src/components/editor/loadSandbox.ts @@ -38,24 +38,22 @@ function loadSandbox(tsVersion: string): Promise { }); // Grab a copy of monaco, TypeScript and the sandbox - window.require<[Monaco, TsWorker, SandboxFactory]>( + window.require<[Monaco, TsWorker, SandboxFactory, LintUtils]>( [ 'vs/editor/editor.main', 'vs/language/typescript/tsWorker', 'sandbox/index', + 'linter/index', ], - (main, tsWorker, sandboxFactory) => { + (main, tsWorker, sandboxFactory, lintUtils) => { const isOK = main && window.ts && sandboxFactory; if (isOK) { - // https://github.com/evanw/esbuild/issues/819 - update linter/index to proper amd to fix this - window.require<[LintUtils]>(['linter/index'], lintUtils => { - resolve({ - main, - tsWorker, - sandboxFactory, - ts: window.ts, - lintUtils, - }); + resolve({ + main, + tsWorker, + sandboxFactory, + ts: window.ts, + lintUtils, }); } else { reject( From 58d543df18dea05802e31241c11324ec4435e5ae Mon Sep 17 00:00:00 2001 From: Armano Date: Sat, 25 Mar 2023 06:42:51 +0100 Subject: [PATCH 7/9] fix: add missing support for aliases --- packages/website-eslint/build.ts | 13 ++++++++----- packages/website-eslint/src/mock/empty.js | 1 + 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/packages/website-eslint/build.ts b/packages/website-eslint/build.ts index 1df4d68c8fe7..ee24cee305a7 100644 --- a/packages/website-eslint/build.ts +++ b/packages/website-eslint/build.ts @@ -130,11 +130,14 @@ async function buildPackage(name: string, file: string): Promise { 'use-at-your-own-risk.ts', ), ); - build.onResolve( - makeFilter('@typescript-eslint/utils/ast-utils'), - () => - createResolve('@typescript-eslint/utils', 'ast-utils/index.ts'), - ); + const anyAlias = /^(@typescript-eslint\/[a-z-]+)\/([a-z-]+)$/; + build.onResolve({ filter: anyAlias }, args => { + const parts = args.path.match(anyAlias); + if (parts) { + return createResolve(parts[1], `${parts[2]}/index.ts`); + } + return null; + }); build.onResolve(makeFilter('@typescript-eslint/[a-z-]+'), args => createResolve(args.path, 'index.ts'), ); diff --git a/packages/website-eslint/src/mock/empty.js b/packages/website-eslint/src/mock/empty.js index e69de29bb2d1..cb0ff5c3b541 100644 --- a/packages/website-eslint/src/mock/empty.js +++ b/packages/website-eslint/src/mock/empty.js @@ -0,0 +1 @@ +export {}; From 8c9a0cd56ab66c25b6ad93b2eee393c14d75d7a7 Mon Sep 17 00:00:00 2001 From: Armano Date: Wed, 29 Mar 2023 18:18:02 +0200 Subject: [PATCH 8/9] chore: restore missing comment --- packages/website-eslint/src/index.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/website-eslint/src/index.js b/packages/website-eslint/src/index.js index 17bf81afce01..c00a82466473 100644 --- a/packages/website-eslint/src/index.js +++ b/packages/website-eslint/src/index.js @@ -1,3 +1,8 @@ +/* +NOTE - this file intentionally uses deep `/use-at-your-own-risk` imports into our packages. +This is so that rollup can properly tree-shake and only include the necessary code. +This saves us having to mock unnecessary things and reduces our bundle size. +*/ // @ts-check import { rules } from '@typescript-eslint/eslint-plugin'; From 2d992dcd481cac3d2351e64a354df0e8f24ee1b9 Mon Sep 17 00:00:00 2001 From: Armano Date: Thu, 30 Mar 2023 04:26:36 +0200 Subject: [PATCH 9/9] chore: remove rollup from renovate --- .github/renovate.json5 | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/.github/renovate.json5 b/.github/renovate.json5 index c14c3ed55e56..b8d7426f2cff 100644 --- a/.github/renovate.json5 +++ b/.github/renovate.json5 @@ -16,16 +16,6 @@ '@nrwl/jest', '@nrwl/nx-cloud', '@nrwl/tao', - // TODO - once we bump pass the major, we can remove these. Currently renovate is creating broken, immortal PRs - '@rollup/plugin-babel', - '@rollup/plugin-commonjs', - '@rollup/plugin-json', - '@rollup/plugin-node-resolve', - '@rollup/plugin-replace', - '@rollup/plugin-terser', - '@rollup/pluginutils', - 'rollup-plugin-terser', - 'rollup', ], ignorePaths: [ // integration test package.json's should never be updated as they're purposely fixed tests @@ -85,11 +75,6 @@ matchPackagePrefixes: ['@types/jest', 'jest-', '@jest/'], groupName: 'jest', }, - { - matchPackagePrefixes: ['@rollup', 'rollup-'], - matchPackageNames: ['rollup'], - groupName: 'rollup', - }, ], postUpdateOptions: [ // run yarn dedupe to cleanup the lockfile after updates