From bba90c67831f8542d4bd84e57756a5c451211c2e Mon Sep 17 00:00:00 2001 From: FatttSnake Date: Fri, 6 Sep 2024 15:43:39 +0800 Subject: [PATCH 01/19] Build(package.json): Update version from 1.0.0-SNAPSHOT to 1.0.1-SNAPSHOT --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 1676b36..788c866 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "oxygen-ui", "private": true, "type": "module", - "version": "1.0.0-SNAPSHOT", + "version": "1.0.1-SNAPSHOT", "description": "Oxygen Toolbox browser version", "author": { "name": "FatttSnake", From 51ee15749e159614ea3aa014a1d1e3f5ab5f1545 Mon Sep 17 00:00:00 2001 From: FatttSnake Date: Mon, 9 Sep 2024 16:24:22 +0800 Subject: [PATCH 02/19] Fix(Preview): Fixed code pollution bug Methods and variables in base and main code are isolated to solve the problem of code pollution. Close #4 --- package-lock.json | 10 +- package.json | 2 +- .../Playground/Output/Preview/index.tsx | 2 +- src/components/Playground/compiler.ts | 238 +++++++++--------- src/pages/System/Tools/Execute.tsx | 2 +- src/pages/Tools/Create.tsx | 2 +- src/pages/Tools/View.tsx | 4 +- 7 files changed, 129 insertions(+), 131 deletions(-) diff --git a/package-lock.json b/package-lock.json index ace8864..20541b2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "oxygen-ui", - "version": "1.0.0-SNAPSHOT", + "version": "1.0.1-SNAPSHOT", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "oxygen-ui", - "version": "1.0.0-SNAPSHOT", + "version": "1.0.1-SNAPSHOT", "dependencies": { "@ant-design/icons": "^5.3.7", "@dnd-kit/core": "^6.1.0", @@ -2153,9 +2153,9 @@ } }, "node_modules/acorn": { - "version": "8.11.3", - "resolved": "https://registry.npmmirror.com/acorn/-/acorn-8.11.3.tgz", - "integrity": "sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg==", + "version": "8.12.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.12.1.tgz", + "integrity": "sha512-tcpGyI9zbizT9JbV6oYE477V6mTlXvvi0T0G3SNIYE2apm/G5huBa1+K89VGeovbg+jycCrfhl3ADxErOuO6Jg==", "dev": true, "bin": { "acorn": "bin/acorn" diff --git a/package.json b/package.json index 788c866..5750c5a 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "type": "module", "version": "1.0.1-SNAPSHOT", "description": "Oxygen Toolbox browser version", - "author": { + "author": { "name": "FatttSnake", "email": "fatttsnake@fatweb.top", "url": "https://fatweb.top" diff --git a/src/components/Playground/Output/Preview/index.tsx b/src/components/Playground/Output/Preview/index.tsx index f9882e5..ea0145e 100644 --- a/src/components/Playground/Output/Preview/index.tsx +++ b/src/components/Playground/Output/Preview/index.tsx @@ -32,7 +32,7 @@ const Preview = ({ Compiler.compile(files, importMap, entryPoint) .then((result) => { setCompiledCode( - `${preExpansionCode}\n${result.outputFiles[0].text}\n${postExpansionCode}` + `(()=>{${preExpansionCode}})();\n(()=>{${result.outputFiles[0].text}})();\n(()=>{${postExpansionCode}})();` ) setErrorMsg('') }) diff --git a/src/components/Playground/compiler.ts b/src/components/Playground/compiler.ts index e7939f7..3502f8c 100644 --- a/src/components/Playground/compiler.ts +++ b/src/components/Playground/compiler.ts @@ -2,7 +2,7 @@ import esbuild, { Loader, OnLoadArgs, Plugin, PluginBuild } from 'esbuild-wasm' import localforage from 'localforage' import axios from 'axios' import { IFiles, IImportMap } from '@/components/Playground/shared' -import { cssToJs, jsonToJs, addReactImport } from '@/components/Playground/files' +import { addReactImport, cssToJs, jsonToJs } from '@/components/Playground/files' class Compiler { private init = false @@ -73,151 +73,149 @@ class Compiler { files: IFiles, importMap: IImportMap, entryPoint: string - ): Plugin => { - return { - name: 'file-resolver-plugin', - setup: (build: PluginBuild) => { - build.onResolve({ filter: /.*/ }, (args: esbuild.OnResolveArgs) => { - if (entryPoint === args.path) { - return { - namespace: 'OxygenToolbox', - path: args.path - } + ): Plugin => ({ + name: 'file-resolver-plugin', + setup: (build: PluginBuild) => { + build.onResolve({ filter: /.*/ }, (args: esbuild.OnResolveArgs) => { + if (entryPoint === args.path) { + return { + namespace: 'OxygenToolbox', + path: args.path } - if (args.path.startsWith('./') && files[args.path.substring(2)]) { - return { - namespace: 'OxygenToolbox', - path: args.path.substring(2) - } + } + if (args.path.startsWith('./') && files[args.path.substring(2)]) { + return { + namespace: 'OxygenToolbox', + path: args.path.substring(2) } - if (args.path.startsWith('./') && files[`${args.path.substring(2)}.tsx`]) { - return { - namespace: 'OxygenToolbox', - path: `${args.path.substring(2)}.tsx` - } + } + if (args.path.startsWith('./') && files[`${args.path.substring(2)}.tsx`]) { + return { + namespace: 'OxygenToolbox', + path: `${args.path.substring(2)}.tsx` } - if (args.path.startsWith('./') && files[`${args.path.substring(2)}.jsx`]) { - return { - namespace: 'OxygenToolbox', - path: `${args.path.substring(2)}.jsx` - } + } + if (args.path.startsWith('./') && files[`${args.path.substring(2)}.jsx`]) { + return { + namespace: 'OxygenToolbox', + path: `${args.path.substring(2)}.jsx` } - if (args.path.startsWith('./') && files[`${args.path.substring(2)}.ts`]) { - return { - namespace: 'OxygenToolbox', - path: `${args.path.substring(2)}.ts` - } + } + if (args.path.startsWith('./') && files[`${args.path.substring(2)}.ts`]) { + return { + namespace: 'OxygenToolbox', + path: `${args.path.substring(2)}.ts` } - if (args.path.startsWith('./') && files[`${args.path.substring(2)}.js`]) { - return { - namespace: 'OxygenToolbox', - path: `${args.path.substring(2)}.js` - } - } - if (/\.\/.*\.css/.test(args.path) && !args.resolveDir) { - throw Error(`Css '${args.path}' not found`) - } - - if (/^https?:\/\/.*/.test(args.path)) { - return { - namespace: 'default', - path: args.path - } - } - - if ( - args.path.includes('./') || - args.path.includes('../') || - args.path.startsWith('/') - ) { - return { - namespace: 'default', - path: new URL(args.path, args.resolveDir.substring(1)).href - } - } - - const path = importMap.imports[args.path] - - if (!path) { - throw Error(`Import '${args.path}' not found in Import Map`) + } + if (args.path.startsWith('./') && files[`${args.path.substring(2)}.js`]) { + return { + namespace: 'OxygenToolbox', + path: `${args.path.substring(2)}.js` } + } + if (/\.\/.*\.css/.test(args.path) && !args.resolveDir) { + throw Error(`Css '${args.path}' not found`) + } + if (/^https?:\/\/.*/.test(args.path)) { return { namespace: 'default', - path + path: args.path } - }) + } - build.onLoad({ filter: /.*\.css$/ }, (args: OnLoadArgs) => { - const contents = cssToJs(files[args.path]) + if ( + args.path.includes('./') || + args.path.includes('../') || + args.path.startsWith('/') + ) { return { - loader: 'js', - contents + namespace: 'default', + path: new URL(args.path, args.resolveDir.substring(1)).href } - }) + } - build.onLoad({ filter: /.*\.json$/ }, (args: OnLoadArgs) => { - const contents = jsonToJs(files[args.path]) + const path = importMap.imports[args.path] + + if (!path) { + throw Error(`Import '${args.path}' not found in Import Map`) + } + + return { + namespace: 'default', + path + } + }) + + build.onLoad({ filter: /.*\.css$/ }, (args: OnLoadArgs) => { + const contents = cssToJs(files[args.path]) + return { + loader: 'js', + contents + } + }) + + build.onLoad({ filter: /.*\.json$/ }, (args: OnLoadArgs) => { + const contents = jsonToJs(files[args.path]) + return { + loader: 'js', + contents + } + }) + + build.onLoad({ filter: /.*/ }, async (args: OnLoadArgs) => { + if (entryPoint === args.path) { return { - loader: 'js', - contents + loader: 'tsx', + contents: addReactImport(files[entryPoint].value) } - }) + } - build.onLoad({ filter: /.*/ }, async (args: OnLoadArgs) => { - if (entryPoint === args.path) { + if (files[args.path]) { + const contents = addReactImport(files[args.path].value) + if (args.path.endsWith('.jsx')) { return { - loader: 'tsx', - contents: addReactImport(files[entryPoint].value) - } - } - - if (files[args.path]) { - const contents = addReactImport(files[args.path].value) - if (args.path.endsWith('.jsx')) { - return { - loader: 'jsx', - contents - } - } - if (args.path.endsWith('.ts')) { - return { - loader: 'ts', - contents - } - } - if (args.path.endsWith('.js')) { - return { - loader: 'js', - contents - } - } - return { - loader: 'tsx', + loader: 'jsx', contents } } - - const cached = await this.fileCache.getItem(args.path) - - if (cached) { - return cached + if (args.path.endsWith('.ts')) { + return { + loader: 'ts', + contents + } } - - const axiosResponse = await axios.get(args.path) - const result: esbuild.OnLoadResult = { - loader: 'jsx', - contents: axiosResponse.data, - resolveDir: (axiosResponse.request as XMLHttpRequest).responseURL + if (args.path.endsWith('.js')) { + return { + loader: 'js', + contents + } } + return { + loader: 'tsx', + contents + } + } - await this.fileCache.setItem(args.path, result) + const cached = await this.fileCache.getItem(args.path) - return result - }) - } + if (cached) { + return cached + } + + const axiosResponse = await axios.get(args.path) + const result: esbuild.OnLoadResult = { + loader: 'jsx', + contents: axiosResponse.data, + resolveDir: (axiosResponse.request as XMLHttpRequest).responseURL + } + + await this.fileCache.setItem(args.path, result) + + return result + }) } - } + }) } export default new Compiler() diff --git a/src/pages/System/Tools/Execute.tsx b/src/pages/System/Tools/Execute.tsx index 11f88f1..3e76474 100644 --- a/src/pages/System/Tools/Execute.tsx +++ b/src/pages/System/Tools/Execute.tsx @@ -27,7 +27,7 @@ const Execute = () => { const output = result.outputFiles[0].text setCompiledCode('') setTimeout(() => { - setCompiledCode(`${output}\n${baseDist}`) + setCompiledCode(`(() => {${output}})();\n(() => {${baseDist}})();`) }, 100) }) .catch((reason) => { diff --git a/src/pages/Tools/Create.tsx b/src/pages/Tools/Create.tsx index 5fa73b1..450b5ba 100644 --- a/src/pages/Tools/Create.tsx +++ b/src/pages/Tools/Create.tsx @@ -145,7 +145,7 @@ const Create = () => { .compile(files, importMap, template.entryPoint) .then((result) => { const output = result.outputFiles[0].text - setCompiledCode(`${output}\n${baseDist}`) + setCompiledCode(`(() => {${output}})();\n(() => {${baseDist}})();`) }) .catch((reason) => { void message.error(`编译失败:${reason}`) diff --git a/src/pages/Tools/View.tsx b/src/pages/Tools/View.tsx index 327394f..03a9995 100644 --- a/src/pages/Tools/View.tsx +++ b/src/pages/Tools/View.tsx @@ -34,7 +34,7 @@ const View = () => { const output = result.outputFiles[0].text setCompiledCode('') setTimeout(() => { - setCompiledCode(`${output}\n${baseDist}`) + setCompiledCode(`(() => {${output}})();\n(() => {${baseDist}})();`) }, 100) }) .catch((reason) => { @@ -49,7 +49,7 @@ const View = () => { const dist = base64ToStr(toolVo.dist.data!) setCompiledCode('') setTimeout(() => { - setCompiledCode(`${dist}\n${baseDist}`) + setCompiledCode(`(() => {${dist}})();\n(() => {${baseDist}})();`) }, 100) } catch (e) { void message.error('载入工具失败') From 6302ec6ab35f5c9f6fd0a43a4e87fcc8fba146c4 Mon Sep 17 00:00:00 2001 From: FatttSnake Date: Tue, 10 Sep 2024 11:32:52 +0800 Subject: [PATCH 03/19] Fix(compiler): Fix multi-level dependency path compilation error BUG Close #6 --- src/components/Playground/compiler.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/components/Playground/compiler.ts b/src/components/Playground/compiler.ts index 3502f8c..6d7a5a7 100644 --- a/src/components/Playground/compiler.ts +++ b/src/components/Playground/compiler.ts @@ -135,7 +135,12 @@ class Compiler { } } - const path = importMap.imports[args.path] + let path = importMap.imports[args.path] + let tempPath = args.path + while (!path && tempPath.includes('/')) { + tempPath = tempPath.substring(0, tempPath.lastIndexOf('/')) + path = args.path.replace(tempPath, importMap.imports[tempPath]) + } if (!path) { throw Error(`Import '${args.path}' not found in Import Map`) From 21eaee22f78d29b97c500e659a2d2549f6b2b845 Mon Sep 17 00:00:00 2001 From: FatttSnake Date: Fri, 13 Sep 2024 15:24:16 +0800 Subject: [PATCH 04/19] Build(package.json): Update version from 1.0.0 to 1.0.1-SNAPSHOT --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 28c6bca..788c866 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "oxygen-ui", "private": true, "type": "module", - "version": "1.0.0", + "version": "1.0.1-SNAPSHOT", "description": "Oxygen Toolbox browser version", "author": { "name": "FatttSnake", From 72ab3907569432770d41b5627ef901deb8a11b04 Mon Sep 17 00:00:00 2001 From: FatttSnake Date: Fri, 13 Sep 2024 09:18:57 +0800 Subject: [PATCH 05/19] Refactor(files-util): Optimize the regular expression to match "import react" --- src/components/Playground/files.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Playground/files.ts b/src/components/Playground/files.ts index 7b91bb5..4769b99 100644 --- a/src/components/Playground/files.ts +++ b/src/components/Playground/files.ts @@ -106,7 +106,7 @@ export const cssToJs = (file: IFile) => { } export const addReactImport = (code: string) => { - if (!/import\s+React/g.test(code)) { + if (!/^\s*import\s+React\s+/g.test(code)) { return `import React from 'react';\n${code}` } return code From d6d5cd927c4be350e12a1a9fa894d2d7e566f9e6 Mon Sep 17 00:00:00 2001 From: FatttSnake Date: Fri, 13 Sep 2024 09:20:02 +0800 Subject: [PATCH 06/19] Refactor(Transform): Remove auto add react import when transform --- src/components/Playground/Output/Transform/index.tsx | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/components/Playground/Output/Transform/index.tsx b/src/components/Playground/Output/Transform/index.tsx index 849a44a..d135018 100644 --- a/src/components/Playground/Output/Transform/index.tsx +++ b/src/components/Playground/Output/Transform/index.tsx @@ -2,7 +2,7 @@ import MonacoEditor from '@monaco-editor/react' import { Loader } from 'esbuild-wasm' import '@/components/Playground/Output/Transform/transform.scss' import { IFile, ITheme } from '@/components/Playground/shared' -import { cssToJs, jsonToJs, addReactImport } from '@/components/Playground/files' +import { cssToJs, jsonToJs } from '@/components/Playground/files' import Compiler from '@/components/Playground/compiler' import { MonacoEditorConfig } from '@/components/Playground/CodeEditor/Editor/monacoConfig' @@ -16,12 +16,7 @@ const Transform = ({ file, theme }: OutputProps) => { const [errorMsg, setErrorMsg] = useState('') const compile = (code: string, loader: Loader) => { - let _code = code - if (['jsx', 'tsx'].includes(loader)) { - _code = addReactImport(code) - } - - Compiler?.transform(_code, loader) + Compiler?.transform(code, loader) .then((value) => { setCompiledCode(value.code) setErrorMsg('') From 89cf48e44917b283fd3b1b6fb10caed88625854e Mon Sep 17 00:00:00 2001 From: FatttSnake Date: Fri, 13 Sep 2024 16:12:59 +0800 Subject: [PATCH 07/19] Refactor(compiler): Optimize the logic of resolve import Automatically externalize packages defined in importMap. Solve the problems caused by multiple instances of packages such as React. Closes #9 --- src/components/Playground/compiler.ts | 140 ++++++++++---------------- 1 file changed, 55 insertions(+), 85 deletions(-) diff --git a/src/components/Playground/compiler.ts b/src/components/Playground/compiler.ts index 6d7a5a7..7a48291 100644 --- a/src/components/Playground/compiler.ts +++ b/src/components/Playground/compiler.ts @@ -1,7 +1,7 @@ import esbuild, { Loader, OnLoadArgs, Plugin, PluginBuild } from 'esbuild-wasm' import localforage from 'localforage' import axios from 'axios' -import { IFiles, IImportMap } from '@/components/Playground/shared' +import { IFile, IFiles, IImportMap } from '@/components/Playground/shared' import { addReactImport, cssToJs, jsonToJs } from '@/components/Playground/files' class Compiler { @@ -61,7 +61,7 @@ class Compiler { format: 'esm', metafile: true, write: false, - plugins: [this.fileResolverPlugin(files, importMap, entryPoint)] + plugins: [this.fileResolverPlugin(files, importMap)] }) }) @@ -69,54 +69,16 @@ class Compiler { void esbuild.stop() } - private fileResolverPlugin = ( - files: IFiles, - importMap: IImportMap, - entryPoint: string - ): Plugin => ({ + private fileResolverPlugin = (files: IFiles, importMap: IImportMap): Plugin => ({ name: 'file-resolver-plugin', setup: (build: PluginBuild) => { build.onResolve({ filter: /.*/ }, (args: esbuild.OnResolveArgs) => { - if (entryPoint === args.path) { + if (args.kind === 'entry-point') { return { - namespace: 'OxygenToolbox', + namespace: 'oxygen', path: args.path } } - if (args.path.startsWith('./') && files[args.path.substring(2)]) { - return { - namespace: 'OxygenToolbox', - path: args.path.substring(2) - } - } - if (args.path.startsWith('./') && files[`${args.path.substring(2)}.tsx`]) { - return { - namespace: 'OxygenToolbox', - path: `${args.path.substring(2)}.tsx` - } - } - if (args.path.startsWith('./') && files[`${args.path.substring(2)}.jsx`]) { - return { - namespace: 'OxygenToolbox', - path: `${args.path.substring(2)}.jsx` - } - } - if (args.path.startsWith('./') && files[`${args.path.substring(2)}.ts`]) { - return { - namespace: 'OxygenToolbox', - path: `${args.path.substring(2)}.ts` - } - } - if (args.path.startsWith('./') && files[`${args.path.substring(2)}.js`]) { - return { - namespace: 'OxygenToolbox', - path: `${args.path.substring(2)}.js` - } - } - if (/\.\/.*\.css/.test(args.path) && !args.resolveDir) { - throw Error(`Css '${args.path}' not found`) - } - if (/^https?:\/\/.*/.test(args.path)) { return { namespace: 'default', @@ -125,10 +87,20 @@ class Compiler { } if ( - args.path.includes('./') || - args.path.includes('../') || - args.path.startsWith('/') + args.path.startsWith('./') && + (!args.resolveDir.length || args.resolveDir in files) ) { + const suffix = ['', '.tsx', '.jsx', '.ts', '.js'].find((suffix) => { + return files[`${args.path.substring(2)}${suffix}`] + }) + if (suffix !== undefined) { + return { + namespace: 'oxygen', + path: `${args.path.substring(2)}${suffix}` + } + } + } + if (['./', '../', '/'].some((prefix) => args.path.startsWith(prefix))) { return { namespace: 'default', path: new URL(args.path, args.resolveDir.substring(1)).href @@ -139,16 +111,26 @@ class Compiler { let tempPath = args.path while (!path && tempPath.includes('/')) { tempPath = tempPath.substring(0, tempPath.lastIndexOf('/')) - path = args.path.replace(tempPath, importMap.imports[tempPath]) + if (importMap.imports[tempPath]) { + const suffix = args.path.replace(tempPath, '') + const importUrl = new URL(importMap.imports[tempPath]) + path = `${importUrl.origin}${importUrl.pathname}${suffix}${importUrl.search}` + } } - if (!path) { throw Error(`Import '${args.path}' not found in Import Map`) } - + const pathUrl = new URL(path) + const externals = pathUrl.searchParams.get('external')?.split(',') ?? [] + Object.keys(importMap.imports).forEach((item) => { + if (!(item in externals)) { + externals.push(item) + } + }) + pathUrl.searchParams.set('external', externals.join(',')) return { namespace: 'default', - path + path: pathUrl.href } }) @@ -168,40 +150,28 @@ class Compiler { } }) + build.onLoad({ namespace: 'oxygen', filter: /.*/ }, (args: OnLoadArgs) => { + let file: IFile | undefined + + void ['', '.tsx', '.jsx', '.ts', '.js'].forEach((suffix) => { + file = file || files[`${args.path}${suffix}`] + }) + if (file) { + return { + loader: (() => { + switch (file.language) { + case 'javascript': + return 'jsx' + default: + return 'tsx' + } + })(), + contents: addReactImport(file.value) + } + } + }) + build.onLoad({ filter: /.*/ }, async (args: OnLoadArgs) => { - if (entryPoint === args.path) { - return { - loader: 'tsx', - contents: addReactImport(files[entryPoint].value) - } - } - - if (files[args.path]) { - const contents = addReactImport(files[args.path].value) - if (args.path.endsWith('.jsx')) { - return { - loader: 'jsx', - contents - } - } - if (args.path.endsWith('.ts')) { - return { - loader: 'ts', - contents - } - } - if (args.path.endsWith('.js')) { - return { - loader: 'js', - contents - } - } - return { - loader: 'tsx', - contents - } - } - const cached = await this.fileCache.getItem(args.path) if (cached) { @@ -210,9 +180,9 @@ class Compiler { const axiosResponse = await axios.get(args.path) const result: esbuild.OnLoadResult = { - loader: 'jsx', + loader: 'js', contents: axiosResponse.data, - resolveDir: (axiosResponse.request as XMLHttpRequest).responseURL + resolveDir: args.path } await this.fileCache.setItem(args.path, result) From 4711f7892f6255aedb5e9775c4cf7fe799d5302c Mon Sep 17 00:00:00 2001 From: FatttSnake Date: Sun, 15 Sep 2024 10:54:14 +0800 Subject: [PATCH 08/19] Refactor(compiler): Support load css from ImportMap and load binary file --- .../Playground/Output/Transform/index.tsx | 6 +- src/components/Playground/compiler.ts | 245 +++++++++++++----- src/components/Playground/files.ts | 20 +- 3 files changed, 197 insertions(+), 74 deletions(-) diff --git a/src/components/Playground/Output/Transform/index.tsx b/src/components/Playground/Output/Transform/index.tsx index d135018..6883751 100644 --- a/src/components/Playground/Output/Transform/index.tsx +++ b/src/components/Playground/Output/Transform/index.tsx @@ -2,7 +2,7 @@ import MonacoEditor from '@monaco-editor/react' import { Loader } from 'esbuild-wasm' import '@/components/Playground/Output/Transform/transform.scss' import { IFile, ITheme } from '@/components/Playground/shared' -import { cssToJs, jsonToJs } from '@/components/Playground/files' +import { cssToJsFromFile, jsonToJsFromFile } from '@/components/Playground/files' import Compiler from '@/components/Playground/compiler' import { MonacoEditorConfig } from '@/components/Playground/CodeEditor/Editor/monacoConfig' @@ -39,10 +39,10 @@ const Transform = ({ file, theme }: OutputProps) => { compile(code, 'jsx') break case 'css': - setCompiledCode(cssToJs(file)) + setCompiledCode(cssToJsFromFile(file)) break case 'json': - setCompiledCode(jsonToJs(file)) + setCompiledCode(jsonToJsFromFile(file)) break case 'xml': setCompiledCode(code) diff --git a/src/components/Playground/compiler.ts b/src/components/Playground/compiler.ts index 7a48291..8b50012 100644 --- a/src/components/Playground/compiler.ts +++ b/src/components/Playground/compiler.ts @@ -1,8 +1,22 @@ -import esbuild, { Loader, OnLoadArgs, Plugin, PluginBuild } from 'esbuild-wasm' +import esbuild, { + Loader, + OnLoadArgs, + OnLoadResult, + OnResolveArgs, + OnResolveResult, + Plugin, + PluginBuild +} from 'esbuild-wasm' import localforage from 'localforage' import axios from 'axios' import { IFile, IFiles, IImportMap } from '@/components/Playground/shared' -import { addReactImport, cssToJs, jsonToJs } from '@/components/Playground/files' +import { + addReactImport, + cssToJs, + cssToJsFromFile, + jsonToJs, + jsonToJsFromFile +} from '@/components/Playground/files' class Compiler { private init = false @@ -26,44 +40,47 @@ class Compiler { } } - transform = (code: string, loader: Loader) => - new Promise((resolve) => { - if (this.init) { - resolve() - return - } - const timer = setInterval(() => { - if (this.init) { - clearInterval(timer) - resolve() + private waitInit = async () => { + if (!this.init) { + await new Promise((resolve) => { + const checkInit = () => { + if (this.init) { + resolve() + } else { + setTimeout(checkInit, 100) + } } - }, 100) - }).then(() => { - return esbuild.transform(code, { loader }) - }) - - compile = (files: IFiles, importMap: IImportMap, entryPoint: string) => - new Promise((resolve) => { - if (this.init) { - resolve() - return - } - const timer = setInterval(() => { - if (this.init) { - clearInterval(timer) - resolve() - } - }, 100) - }).then(() => { - return esbuild.build({ - bundle: true, - entryPoints: [entryPoint], - format: 'esm', - metafile: true, - write: false, - plugins: [this.fileResolverPlugin(files, importMap)] + checkInit() }) + } + } + + transform = async (code: string, loader: Loader) => { + await this.waitInit() + return esbuild.transform(code, { loader }) + } + + compile = async (files: IFiles, importMap: IImportMap, entryPoint: string) => { + await this.waitInit() + return esbuild.build({ + bundle: true, + entryPoints: [entryPoint], + format: 'esm', + metafile: true, + write: false, + plugins: [this.fileResolverPlugin(files, importMap)] }) + } + + compileCss = async (cssCode: string, basePath: string) => { + await this.waitInit() + return esbuild.build({ + bundle: true, + entryPoints: [basePath], + write: false, + plugins: [this.cssCodeResolverPlugin(cssCode, basePath)] + }) + } stop = () => { void esbuild.stop() @@ -72,7 +89,7 @@ class Compiler { private fileResolverPlugin = (files: IFiles, importMap: IImportMap): Plugin => ({ name: 'file-resolver-plugin', setup: (build: PluginBuild) => { - build.onResolve({ filter: /.*/ }, (args: esbuild.OnResolveArgs) => { + build.onResolve({ filter: /.*/ }, (args: OnResolveArgs): OnResolveResult => { if (args.kind === 'entry-point') { return { namespace: 'oxygen', @@ -134,54 +151,152 @@ class Compiler { } }) - build.onLoad({ filter: /.*\.css$/ }, (args: OnLoadArgs) => { - const contents = cssToJs(files[args.path]) + build.onLoad({ filter: /.*\.css$/ }, (args: OnLoadArgs): OnLoadResult => { + const contents = cssToJsFromFile(files[args.path]) return { loader: 'js', contents } }) - build.onLoad({ filter: /.*\.json$/ }, (args: OnLoadArgs) => { - const contents = jsonToJs(files[args.path]) + build.onLoad({ filter: /.*\.json$/ }, (args: OnLoadArgs): OnLoadResult => { + const contents = jsonToJsFromFile(files[args.path]) return { loader: 'js', contents } }) - build.onLoad({ namespace: 'oxygen', filter: /.*/ }, (args: OnLoadArgs) => { - let file: IFile | undefined + build.onLoad( + { namespace: 'oxygen', filter: /.*/ }, + (args: OnLoadArgs): OnLoadResult | undefined => { + let file: IFile | undefined - void ['', '.tsx', '.jsx', '.ts', '.js'].forEach((suffix) => { - file = file || files[`${args.path}${suffix}`] - }) - if (file) { - return { - loader: (() => { - switch (file.language) { - case 'javascript': - return 'jsx' - default: - return 'tsx' - } - })(), - contents: addReactImport(file.value) + void ['', '.tsx', '.jsx', '.ts', '.js'].forEach((suffix) => { + file = file || files[`${args.path}${suffix}`] + }) + if (file) { + return { + loader: (() => { + switch (file.language) { + case 'javascript': + return 'jsx' + default: + return 'tsx' + } + })(), + contents: addReactImport(file.value) + } } } - }) + ) - build.onLoad({ filter: /.*/ }, async (args: OnLoadArgs) => { - const cached = await this.fileCache.getItem(args.path) + build.onLoad({ filter: /.*/ }, async (args: OnLoadArgs): Promise => { + const cached = await this.fileCache.getItem(args.path) if (cached) { return cached } - const axiosResponse = await axios.get(args.path) - const result: esbuild.OnLoadResult = { - loader: 'js', - contents: axiosResponse.data, + const axiosResponse = await axios.get(args.path, { + responseType: 'arraybuffer' + }) + const contentType = axiosResponse.headers['content-type'] as string + const utf8Decoder = new TextDecoder('utf-8') + const result: OnLoadResult = { + loader: (() => { + if ( + contentType.includes('javascript') || + contentType.includes('css') || + contentType.includes('json') + ) { + return 'js' + } + return 'base64' + })(), + contents: await (async () => { + if (contentType.includes('css')) { + return cssToJs( + ( + await this.compileCss( + utf8Decoder.decode(axiosResponse.data), + args.path + ) + ).outputFiles[0].text + ) + } + if (contentType.includes('json')) { + return jsonToJs(utf8Decoder.decode(axiosResponse.data)) + } + return new Uint8Array(axiosResponse.data) + })(), + resolveDir: args.path + } + + await this.fileCache.setItem(args.path, result) + + return result + }) + } + }) + + private cssCodeResolverPlugin = (cssCode: string, basePath: string): Plugin => ({ + name: 'css-code-resolver-plugin', + setup: (build: PluginBuild) => { + build.onResolve({ filter: /.*/ }, (args: OnResolveArgs): OnResolveResult => { + if (args.kind === 'entry-point') { + return { + namespace: 'default', + path: basePath + } + } + return { + namespace: 'default', + path: args.resolveDir.length + ? new URL(args.path, args.resolveDir.substring(1)).href + : new URL(args.path, basePath).href + } + }) + + build.onLoad({ filter: /.*/ }, async (args: OnLoadArgs): Promise => { + if (args.path === basePath) { + return { + loader: 'css', + contents: cssCode, + resolveDir: basePath + } + } + const cached = await this.fileCache.getItem(args.path) + + if (cached) { + return cached + } + + const axiosResponse = await axios.get(args.path, { + responseType: 'arraybuffer' + }) + const contentType = axiosResponse.headers['content-type'] as string + const utf8Decoder = new TextDecoder('utf-8') + const result: OnLoadResult = { + loader: (() => { + if (contentType.includes('css')) { + return 'js' + } + return 'dataurl' + })(), + contents: await (async () => { + if (contentType.includes('css')) { + return cssToJs( + ( + await this.compileCss( + utf8Decoder.decode(axiosResponse.data), + args.path + ) + ).outputFiles[0].text + ) + } + return new Uint8Array(axiosResponse.data) + })(), resolveDir: args.path } diff --git a/src/components/Playground/files.ts b/src/components/Playground/files.ts index 4769b99..4577cbe 100644 --- a/src/components/Playground/files.ts +++ b/src/components/Playground/files.ts @@ -83,21 +83,25 @@ export const jsToBlob = (code: string) => { return URL.createObjectURL(new Blob([code], { type: 'application/javascript' })) } -export const jsonToJs = (file: IFile) => { - return `export default ${file.value}` +export const jsonToJs = (code: string) => { + return `export default ${code}` } -export const cssToJs = (file: IFile) => { +export const jsonToJsFromFile = (file: IFile) => { + return jsonToJs(file.value) +} + +export const cssToJs = (code: string, fileName?: string) => { const randomId = new Date().getTime() return `(() => { - let stylesheet = document.getElementById('style_${randomId}_${file.name}'); + let stylesheet = document.getElementById('style_${randomId}${fileName ? `_${fileName}` : ''}'); if (!stylesheet) { stylesheet = document.createElement('style') - stylesheet.setAttribute('id', 'style_${randomId}_${file.name}') + stylesheet.setAttribute('id', 'style_${randomId}_${fileName ? `_${fileName}` : ''}') document.head.appendChild(stylesheet) } const styles = document.createTextNode( -\`${file.value}\` +\`${code}\` ) stylesheet.innerHTML = '' stylesheet.appendChild(styles) @@ -105,6 +109,10 @@ export const cssToJs = (file: IFile) => { ` } +export const cssToJsFromFile = (file: IFile) => { + return cssToJs(file.value, file.name) +} + export const addReactImport = (code: string) => { if (!/^\s*import\s+React\s+/g.test(code)) { return `import React from 'react';\n${code}` From 9ca2ec8859c041bbdec77b1c91a8f06d1ec5f3ad Mon Sep 17 00:00:00 2001 From: FatttSnake Date: Sun, 15 Sep 2024 13:07:32 +0800 Subject: [PATCH 09/19] Refactor(BaseManagement): Support recompile --- src/pages/System/Tools/Base.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pages/System/Tools/Base.tsx b/src/pages/System/Tools/Base.tsx index 6cee084..ac8f54c 100644 --- a/src/pages/System/Tools/Base.tsx +++ b/src/pages/System/Tools/Base.tsx @@ -169,18 +169,18 @@ const Base = () => { )} ), - width: '12em', + width: '14em', align: 'center', render: (_, record) => ( <> - {!record.compiled && !Object.keys(hasEdited).length && ( + {!Object.keys(hasEdited).length && ( - 编译 + {record.compiled ? '重新编译' : '编译'} )} From fd4c3750fb4355b35d8c1709846308edcca61452 Mon Sep 17 00:00:00 2001 From: FatttSnake Date: Sun, 15 Sep 2024 13:09:19 +0800 Subject: [PATCH 10/19] Refactor(template): Remove unused templates --- src/components/Playground/shared.ts | 11 ---- src/components/Playground/templates.ts | 59 ----------------- .../Playground/templates/base/App.tsx | 5 -- .../Playground/templates/base/import-map.json | 6 -- .../Playground/templates/base/main.tsx | 10 --- .../Playground/templates/base/tsconfig.json | 21 ------ .../Playground/templates/demo/App.css | 65 ------------------- .../Playground/templates/demo/App.tsx | 17 ----- .../Playground/templates/demo/import-map.json | 6 -- .../Playground/templates/demo/main.tsx | 10 --- .../Playground/templates/demo/tsconfig.json | 21 ------ 11 files changed, 231 deletions(-) delete mode 100644 src/components/Playground/templates.ts delete mode 100644 src/components/Playground/templates/base/App.tsx delete mode 100644 src/components/Playground/templates/base/import-map.json delete mode 100644 src/components/Playground/templates/base/main.tsx delete mode 100644 src/components/Playground/templates/base/tsconfig.json delete mode 100644 src/components/Playground/templates/demo/App.css delete mode 100644 src/components/Playground/templates/demo/App.tsx delete mode 100644 src/components/Playground/templates/demo/import-map.json delete mode 100644 src/components/Playground/templates/demo/main.tsx delete mode 100644 src/components/Playground/templates/demo/tsconfig.json diff --git a/src/components/Playground/shared.ts b/src/components/Playground/shared.ts index d220e18..e144fdb 100644 --- a/src/components/Playground/shared.ts +++ b/src/components/Playground/shared.ts @@ -14,17 +14,6 @@ export interface IFiles { [key: string]: IFile } -export interface ITemplate { - name: string - tsconfig: ITsconfig - importMap: IImportMap - files: IFiles -} - -export interface ITemplates { - [key: string]: ITemplate -} - export interface IImportMap { imports: Record } diff --git a/src/components/Playground/templates.ts b/src/components/Playground/templates.ts deleted file mode 100644 index 3b1ac93..0000000 --- a/src/components/Playground/templates.ts +++ /dev/null @@ -1,59 +0,0 @@ -import { ITemplates } from '@/components/Playground/shared' -import { ENTRY_FILE_NAME, MAIN_FILE_NAME } from '@/components/Playground/files' - -import baseTsconfig from '@/components/Playground/templates/base/tsconfig.json' -import baseImportMap from '@/components/Playground/templates/base/import-map.json' -import baseMain from '@/components/Playground/templates/base/main.tsx?raw' -import baseApp from '@/components/Playground/templates/base/App.tsx?raw' - -import demoTsconfig from '@/components/Playground/templates/demo/tsconfig.json' -import demoImportMap from '@/components/Playground/templates/demo/import-map.json' -import demoMain from '@/components/Playground/templates/demo/main.tsx?raw' -import demoApp from '@/components/Playground/templates/demo/App.tsx?raw' -import demoAppCSS from '@/components/Playground/templates/demo/App.css?raw' - -const templates: ITemplates = { - base: { - name: '基础', - tsconfig: baseTsconfig, - importMap: baseImportMap, - files: { - [ENTRY_FILE_NAME]: { - name: ENTRY_FILE_NAME, - language: 'typescript', - value: baseMain, - hidden: true - }, - [MAIN_FILE_NAME]: { - name: MAIN_FILE_NAME, - language: 'typescript', - value: baseApp - } - } - }, - demo: { - name: 'Demo', - tsconfig: demoTsconfig, - importMap: demoImportMap, - files: { - [ENTRY_FILE_NAME]: { - name: ENTRY_FILE_NAME, - language: 'typescript', - value: demoMain, - hidden: true - }, - [MAIN_FILE_NAME]: { - name: MAIN_FILE_NAME, - language: 'typescript', - value: demoApp - }, - ['App.css']: { - name: 'App.css', - language: 'css', - value: demoAppCSS - } - } - } -} - -export default templates diff --git a/src/components/Playground/templates/base/App.tsx b/src/components/Playground/templates/base/App.tsx deleted file mode 100644 index b751878..0000000 --- a/src/components/Playground/templates/base/App.tsx +++ /dev/null @@ -1,5 +0,0 @@ -const App = () => { - return <> -} - -export default App diff --git a/src/components/Playground/templates/base/import-map.json b/src/components/Playground/templates/base/import-map.json deleted file mode 100644 index 7a84fdb..0000000 --- a/src/components/Playground/templates/base/import-map.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "imports": { - "react": "https://esm.sh/react@18.2.0", - "react-dom/client": "https://esm.sh/react-dom@18.2.0" - } -} \ No newline at end of file diff --git a/src/components/Playground/templates/base/main.tsx b/src/components/Playground/templates/base/main.tsx deleted file mode 100644 index 652c259..0000000 --- a/src/components/Playground/templates/base/main.tsx +++ /dev/null @@ -1,10 +0,0 @@ -import React from 'react' -import ReactDOM from 'react-dom/client' - -import App from './App' - -ReactDOM.createRoot(document.getElementById('root')!).render( - - - -) diff --git a/src/components/Playground/templates/base/tsconfig.json b/src/components/Playground/templates/base/tsconfig.json deleted file mode 100644 index 26da82b..0000000 --- a/src/components/Playground/templates/base/tsconfig.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "compilerOptions": { - "target": 7, - "useDefineForClassFields": true, - "module": 99, - "skipLibCheck": true, - "moduleResolution": 2, - "allowImportingTsExtensions": true, - "resolveJsonModule": true, - "isolatedModules": true, - "noEmit": true, - "jsx": 4, - "strict": true, - "noUnusedLocals": true, - "noUnusedParameters": true, - "noFallthroughCasesInSwitch": true, - "composite": true, - "types": ["node"], - "allowSyntheticDefaultImports": true - } -} \ No newline at end of file diff --git a/src/components/Playground/templates/demo/App.css b/src/components/Playground/templates/demo/App.css deleted file mode 100644 index d15241f..0000000 --- a/src/components/Playground/templates/demo/App.css +++ /dev/null @@ -1,65 +0,0 @@ -:root { - font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; - font-weight: 400; - line-height: 1.5; - color: rgb(255 255 255 / 87%); - text-rendering: optimizelegibility; - text-size-adjust: 100%; - background-color: #242424; - color-scheme: light dark; - font-synthesis: none; -} - -#root { - max-width: 1280px; - padding: 2rem; - margin: 0 auto; - text-align: center; -} - -body { - display: flex; - min-width: 320px; - min-height: 100vh; - margin: 0; - place-items: center; -} - -h1 { - font-size: 3.2em; - line-height: 1.1; -} - -button { - padding: 0.6em 1.2em; - font-family: inherit; - font-size: 1em; - font-weight: 500; - cursor: pointer; - background-color: #1a1a1a; - border: 1px solid transparent; - border-radius: 8px; - transition: border-color 0.25s; -} - -button:hover { - border-color: #646cff; -} - -button:focus, -button:focus-visible { - outline: 4px auto -webkit-focus-ring-color; -} - -@media (prefers-color-scheme: light) { - :root { - color: #213547; - background-color: #fff; - } - - button { - background-color: #f9f9f9; - } -} diff --git a/src/components/Playground/templates/demo/App.tsx b/src/components/Playground/templates/demo/App.tsx deleted file mode 100644 index 9409963..0000000 --- a/src/components/Playground/templates/demo/App.tsx +++ /dev/null @@ -1,17 +0,0 @@ -import { useState } from 'react' -import './App.css' - -const App = () => { - const [count, setCount] = useState(0) - - return ( - <> -

Hello World

-
- -
- - ) -} - -export default App diff --git a/src/components/Playground/templates/demo/import-map.json b/src/components/Playground/templates/demo/import-map.json deleted file mode 100644 index 7a84fdb..0000000 --- a/src/components/Playground/templates/demo/import-map.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "imports": { - "react": "https://esm.sh/react@18.2.0", - "react-dom/client": "https://esm.sh/react-dom@18.2.0" - } -} \ No newline at end of file diff --git a/src/components/Playground/templates/demo/main.tsx b/src/components/Playground/templates/demo/main.tsx deleted file mode 100644 index 652c259..0000000 --- a/src/components/Playground/templates/demo/main.tsx +++ /dev/null @@ -1,10 +0,0 @@ -import React from 'react' -import ReactDOM from 'react-dom/client' - -import App from './App' - -ReactDOM.createRoot(document.getElementById('root')!).render( - - - -) diff --git a/src/components/Playground/templates/demo/tsconfig.json b/src/components/Playground/templates/demo/tsconfig.json deleted file mode 100644 index 26da82b..0000000 --- a/src/components/Playground/templates/demo/tsconfig.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "compilerOptions": { - "target": 7, - "useDefineForClassFields": true, - "module": 99, - "skipLibCheck": true, - "moduleResolution": 2, - "allowImportingTsExtensions": true, - "resolveJsonModule": true, - "isolatedModules": true, - "noEmit": true, - "jsx": 4, - "strict": true, - "noUnusedLocals": true, - "noUnusedParameters": true, - "noFallthroughCasesInSwitch": true, - "composite": true, - "types": ["node"], - "allowSyntheticDefaultImports": true - } -} \ No newline at end of file From c557311dbc0e3bb06c45762c56749432f437fdb8 Mon Sep 17 00:00:00 2001 From: FatttSnake Date: Sun, 15 Sep 2024 14:54:10 +0800 Subject: [PATCH 11/19] Refactor(json schema): Optimize import map json schema --- src/components/Playground/compiler.ts | 8 +- src/components/Playground/files.ts | 10 +- .../Playground/import-map-schema.json | 4 +- src/components/Playground/index.tsx | 2 +- src/components/Playground/shared.ts | 4 +- .../Playground/tsconfig-schema.json | 1652 +++++++++-------- 6 files changed, 858 insertions(+), 822 deletions(-) diff --git a/src/components/Playground/compiler.ts b/src/components/Playground/compiler.ts index 8b50012..cdefd67 100644 --- a/src/components/Playground/compiler.ts +++ b/src/components/Playground/compiler.ts @@ -124,13 +124,13 @@ class Compiler { } } - let path = importMap.imports[args.path] + let path = importMap[args.path] let tempPath = args.path while (!path && tempPath.includes('/')) { tempPath = tempPath.substring(0, tempPath.lastIndexOf('/')) - if (importMap.imports[tempPath]) { + if (importMap[tempPath]) { const suffix = args.path.replace(tempPath, '') - const importUrl = new URL(importMap.imports[tempPath]) + const importUrl = new URL(importMap[tempPath]) path = `${importUrl.origin}${importUrl.pathname}${suffix}${importUrl.search}` } } @@ -139,7 +139,7 @@ class Compiler { } const pathUrl = new URL(path) const externals = pathUrl.searchParams.get('external')?.split(',') ?? [] - Object.keys(importMap.imports).forEach((item) => { + Object.keys(importMap).forEach((item) => { if (!(item in externals)) { externals.push(item) } diff --git a/src/components/Playground/files.ts b/src/components/Playground/files.ts index 4577cbe..5339948 100644 --- a/src/components/Playground/files.ts +++ b/src/components/Playground/files.ts @@ -126,18 +126,12 @@ export const tsconfigJsonDiagnosticsOptions: DiagnosticsOptions = { { uri: 'tsconfig.json', fileMatch: ['tsconfig.json'], - schema: { - type: 'object', - properties: tsconfigSchema - } + schema: tsconfigSchema }, { uri: 'import-map.json', fileMatch: ['import-map.json'], - schema: { - type: 'object', - properties: importMapSchema - } + schema: importMapSchema } ] } diff --git a/src/components/Playground/import-map-schema.json b/src/components/Playground/import-map-schema.json index 9c6f4b3..f79c32f 100644 --- a/src/components/Playground/import-map-schema.json +++ b/src/components/Playground/import-map-schema.json @@ -1,6 +1,4 @@ { - "imports": { "type": "object", - "description": "Import map" - } + "additionalProperties": {"type": "string"} } \ No newline at end of file diff --git a/src/components/Playground/index.tsx b/src/components/Playground/index.tsx index 44273ba..9e45a19 100644 --- a/src/components/Playground/index.tsx +++ b/src/components/Playground/index.tsx @@ -34,7 +34,7 @@ const Playground = ({ try { setImportMap(JSON.parse(importMapRaw) as IImportMap) } catch (e) { - setImportMap({ imports: {} }) + setImportMap({}) } } if (!tsconfig) { diff --git a/src/components/Playground/shared.ts b/src/components/Playground/shared.ts index e144fdb..7ea365a 100644 --- a/src/components/Playground/shared.ts +++ b/src/components/Playground/shared.ts @@ -14,9 +14,7 @@ export interface IFiles { [key: string]: IFile } -export interface IImportMap { - imports: Record -} +export type IImportMap = Record export interface ITsconfig { compilerOptions: CompilerOptions diff --git a/src/components/Playground/tsconfig-schema.json b/src/components/Playground/tsconfig-schema.json index f2556a1..b1a3818 100644 --- a/src/components/Playground/tsconfig-schema.json +++ b/src/components/Playground/tsconfig-schema.json @@ -1,820 +1,866 @@ { - "compilerOptions": { - "type": "object", - "description": "Instructs the TypeScript compiler how to compile .ts files.", - "properties": { - "allowJs": { - "description": "Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files.", - "type": "boolean", - "default": false, - "markdownDescription": "Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files.\n\nSee more: https://www.typescriptlang.org/tsconfig#allowJs" - }, - "allowSyntheticDefaultImports": { - "description": "Allow 'import x from y' when a module doesn't have a default export.", - "type": "boolean", - "markdownDescription": "Allow 'import x from y' when a module doesn't have a default export.\n\nSee more: https://www.typescriptlang.org/tsconfig#allowSyntheticDefaultImports" - }, - "allowUmdGlobalAccess": { - "description": "Allow accessing UMD globals from modules.", - "type": "boolean", - "default": false, - "markdownDescription": "Allow accessing UMD globals from modules.\n\nSee more: https://www.typescriptlang.org/tsconfig#allowUmdGlobalAccess" - }, - "allowUnreachableCode": { - "description": "Disable error reporting for unreachable code.", - "type": "boolean", - "markdownDescription": "Disable error reporting for unreachable code.\n\nSee more: https://www.typescriptlang.org/tsconfig#allowUnreachableCode" - }, - "allowUnusedLabels": { - "description": "Disable error reporting for unused labels.", - "type": "boolean", - "markdownDescription": "Disable error reporting for unused labels.\n\nSee more: https://www.typescriptlang.org/tsconfig#allowUnusedLabels" - }, - "alwaysStrict": { - "description": "Ensure 'use strict' is always emitted.", - "type": "boolean", - "markdownDescription": "Ensure 'use strict' is always emitted.\n\nSee more: https://www.typescriptlang.org/tsconfig#alwaysStrict" - }, - "baseUrl": { - "description": "Specify the base directory to resolve non-relative module names.", - "type": "string", - "markdownDescription": "Specify the base directory to resolve non-relative module names.\n\nSee more: https://www.typescriptlang.org/tsconfig#baseUrl" - }, - "charset": { - "description": "No longer supported. In early versions, manually set the text encoding for reading files.", - "type": "string", - "markdownDescription": "No longer supported. In early versions, manually set the text encoding for reading files.\n\nSee more: https://www.typescriptlang.org/tsconfig#charset" - }, - "checkJs": { - "description": "Enable error reporting in type-checked JavaScript files.", - "type": "boolean", - "default": false, - "markdownDescription": "Enable error reporting in type-checked JavaScript files.\n\nSee more: https://www.typescriptlang.org/tsconfig#checkJs" - }, - "declaration": { - "description": "Generate .d.ts files from TypeScript and JavaScript files in your project.", - "type": "boolean", - "default": false, - "markdownDescription": "Generate .d.ts files from TypeScript and JavaScript files in your project.\n\nSee more: https://www.typescriptlang.org/tsconfig#declaration" - }, - "declarationMap": { - "description": "Create sourcemaps for d.ts files.", - "type": "boolean", - "default": false, - "markdownDescription": "Create sourcemaps for d.ts files.\n\nSee more: https://www.typescriptlang.org/tsconfig#declarationMap" - }, - "emitDeclarationOnly": { - "description": "Only output d.ts files and not JavaScript files.", - "type": "boolean", - "default": false, - "markdownDescription": "Only output d.ts files and not JavaScript files.\n\nSee more: https://www.typescriptlang.org/tsconfig#emitDeclarationOnly" - }, - "declarationDir": { - "description": "Specify the output directory for generated declaration files.", - "type": ["string", "null"], - "markdownDescription": "Specify the output directory for generated declaration files.\n\nSee more: https://www.typescriptlang.org/tsconfig#declarationDir" - }, - "disableSizeLimit": { - "description": "Remove the 20mb cap on total source code size for JavaScript files in the TypeScript language server.", - "type": "boolean", - "default": false, - "markdownDescription": "Remove the 20mb cap on total source code size for JavaScript files in the TypeScript language server.\n\nSee more: https://www.typescriptlang.org/tsconfig#disableSizeLimit" - }, - "disableSourceOfProjectReferenceRedirect": { - "description": "Disable preferring source files instead of declaration files when referencing composite projects", - "type": "boolean", - "markdownDescription": "Disable preferring source files instead of declaration files when referencing composite projects\n\nSee more: https://www.typescriptlang.org/tsconfig#disableSourceOfProjectReferenceRedirect" - }, - "downlevelIteration": { - "description": "Emit more compliant, but verbose and less performant JavaScript for iteration.", - "type": "boolean", - "default": false, - "markdownDescription": "Emit more compliant, but verbose and less performant JavaScript for iteration.\n\nSee more: https://www.typescriptlang.org/tsconfig#downlevelIteration" - }, - "emitBOM": { - "description": "Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files.", - "type": "boolean", - "default": false, - "markdownDescription": "Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files.\n\nSee more: https://www.typescriptlang.org/tsconfig#emitBOM" - }, - "emitDecoratorMetadata": { - "description": "Emit design-type metadata for decorated declarations in source files.", - "type": "boolean", - "markdownDescription": "Emit design-type metadata for decorated declarations in source files.\n\nSee more: https://www.typescriptlang.org/tsconfig#emitDecoratorMetadata" - }, - "experimentalDecorators": { - "description": "Enable experimental support for TC39 stage 2 draft decorators.", - "type": "boolean", - "markdownDescription": "Enable experimental support for TC39 stage 2 draft decorators.\n\nSee more: https://www.typescriptlang.org/tsconfig#experimentalDecorators" - }, - "forceConsistentCasingInFileNames": { - "description": "Ensure that casing is correct in imports.", - "type": "boolean", - "default": false, - "markdownDescription": "Ensure that casing is correct in imports.\n\nSee more: https://www.typescriptlang.org/tsconfig#forceConsistentCasingInFileNames" - }, - "importHelpers": { - "description": "Allow importing helper functions from tslib once per project, instead of including them per-file.", - "type": "boolean", - "default": false, - "markdownDescription": "Allow importing helper functions from tslib once per project, instead of including them per-file.\n\nSee more: https://www.typescriptlang.org/tsconfig#importHelpers" - }, - "inlineSourceMap": { - "description": "Include sourcemap files inside the emitted JavaScript.", - "type": "boolean", - "default": false, - "markdownDescription": "Include sourcemap files inside the emitted JavaScript.\n\nSee more: https://www.typescriptlang.org/tsconfig#inlineSourceMap" - }, - "inlineSources": { - "description": "Include source code in the sourcemaps inside the emitted JavaScript.", - "type": "boolean", - "default": false, - "markdownDescription": "Include source code in the sourcemaps inside the emitted JavaScript.\n\nSee more: https://www.typescriptlang.org/tsconfig#inlineSources" - }, - "isolatedModules": { - "description": "Ensure that each file can be safely transpiled without relying on other imports.", - "type": "boolean", - "default": false, - "markdownDescription": "Ensure that each file can be safely transpiled without relying on other imports.\n\nSee more: https://www.typescriptlang.org/tsconfig#isolatedModules" - }, - "jsx": { - "description": "Specify what JSX code is generated.", - "type": "number", - "enum": [0, 1, 2, 3, 4, 5], - "markdownDescription": "Specify what JSX code is generated.\n\n0 = none\n\n1 = preserve\n\n2 = react\n\n3 = react-native\n\n4 = react-jsx\n\n5 = react-jsxdev" - }, - "keyofStringsOnly": { - "description": "Make keyof only return strings instead of string, numbers or symbols. Legacy option.", - "type": "boolean", - "default": false, - "markdownDescription": "Make keyof only return strings instead of string, numbers or symbols. Legacy option.\n\nSee more: https://www.typescriptlang.org/tsconfig#keyofStringsOnly" - }, - "lib": { - "description": "Specify a set of bundled library declaration files that describe the target runtime environment.", - "type": "array", - "uniqueItems": true, - "items": { - "type": "string", - "anyOf": [ - { - "enum": [ - "ES5", - "ES6", - "ES2015", - "ES2015.Collection", - "ES2015.Core", - "ES2015.Generator", - "ES2015.Iterable", - "ES2015.Promise", - "ES2015.Proxy", - "ES2015.Reflect", - "ES2015.Symbol.WellKnown", - "ES2015.Symbol", - "ES2016", - "ES2016.Array.Include", - "ES2017", - "ES2017.Intl", - "ES2017.Object", - "ES2017.SharedMemory", - "ES2017.String", - "ES2017.TypedArrays", - "ES2018", - "ES2018.AsyncGenerator", - "ES2018.AsyncIterable", - "ES2018.Intl", - "ES2018.Promise", - "ES2018.Regexp", - "ES2019", - "ES2019.Array", - "ES2019.Intl", - "ES2019.Object", - "ES2019.String", - "ES2019.Symbol", - "ES2020", - "ES2020.BigInt", - "ES2020.Promise", - "ES2020.String", - "ES2020.Symbol.WellKnown", - "ESNext", - "ESNext.Array", - "ESNext.AsyncIterable", - "ESNext.BigInt", - "ESNext.Intl", - "ESNext.Promise", - "ESNext.String", - "ESNext.Symbol", - "DOM", - "DOM.Iterable", - "ScriptHost", - "WebWorker", - "WebWorker.ImportScripts", - "Webworker.Iterable", - "ES7", - "ES2021", - "ES2020.SharedMemory", - "ES2020.Intl", - "ES2020.Date", - "ES2020.Number", - "ES2021.Promise", - "ES2021.String", - "ES2021.WeakRef", - "ESNext.WeakRef", - "ES2021.Intl", - "ES2022", - "ES2022.Array", - "ES2022.Error", - "ES2022.Intl", - "ES2022.Object", - "ES2022.String", - "ES2022.SharedMemory", - "ES2022.RegExp", - "ES2023", - "ES2023.Array", - "Decorators", - "Decorators.Legacy", - "ES2017.Date", - "ES2023.Collection", - "ESNext.Decorators", - "ESNext.Disposable" - ] - }, - { - "pattern": "^[Ee][Ss]5|[Ee][Ss]6|[Ee][Ss]7$" - }, - { - "pattern": "^[Ee][Ss]2015(\\.([Cc][Oo][Ll][Ll][Ee][Cc][Tt][Ii][Oo][Nn]|[Cc][Oo][Rr][Ee]|[Gg][Ee][Nn][Ee][Rr][Aa][Tt][Oo][Rr]|[Ii][Tt][Ee][Rr][Aa][Bb][Ll][Ee]|[Pp][Rr][Oo][Mm][Ii][Ss][Ee]|[Pp][Rr][Oo][Xx][Yy]|[Rr][Ee][Ff][Ll][Ee][Cc][Tt]|[Ss][Yy][Mm][Bb][Oo][Ll]\\.[Ww][Ee][Ll][Ll][Kk][Nn][Oo][Ww][Nn]|[Ss][Yy][Mm][Bb][Oo][Ll]))?$" - }, - { - "pattern": "^[Ee][Ss]2016(\\.[Aa][Rr][Rr][Aa][Yy]\\.[Ii][Nn][Cc][Ll][Uu][Dd][Ee])?$" - }, - { - "pattern": "^[Ee][Ss]2017(\\.([Ii][Nn][Tt][Ll]|[Oo][Bb][Jj][Ee][Cc][Tt]|[Ss][Hh][Aa][Rr][Ee][Dd][Mm][Ee][Mm][Oo][Rr][Yy]|[Ss][Tt][Rr][Ii][Nn][Gg]|[Tt][Yy][Pp][Ee][Dd][Aa][Rr][Rr][Aa][Yy][Ss]|[Dd][Aa][Tt][Ee]))?$" - }, - { - "pattern": "^[Ee][Ss]2018(\\.([Aa][Ss][Yy][Nn][Cc][Gg][Ee][Nn][Ee][Rr][Aa][Tt][Oo][Rr]|[Aa][Ss][Yy][Nn][Cc][Ii][Tt][Ee][Rr][Aa][Bb][Ll][Ee]|[Ii][Nn][Tt][Ll]|[Pp][Rr][Oo][Mm][Ii][Ss][Ee]|[Rr][Ee][Gg][Ee][Xx][Pp]))?$" - }, - { - "pattern": "^[Ee][Ss]2019(\\.([Aa][Rr][Rr][Aa][Yy]|[Ii][Nn][Tt][Ll]|[Oo][Bb][Jj][Ee][Cc][Tt]|[Ss][Tt][Rr][Ii][Nn][Gg]|[Ss][Yy][Mm][Bb][Oo][Ll]))?$" - }, - { - "pattern": "^[Ee][Ss]2020(\\.([Bb][Ii][Gg][Ii][Nn][Tt]|[Pp][Rr][Oo][Mm][Ii][Ss][Ee]|[Ss][Tt][Rr][Ii][Nn][Gg]|[Ss][Yy][Mm][Bb][Oo][Ll]\\.[Ww][Ee][Ll][Ll][Kk][Nn][Oo][Ww][Nn]|[Ss][Hh][Aa][Rr][Ee][Dd][Mm][Ee][Mm][Oo][Rr][Yy]|[Ii][Nn][Tt][Ll]|[Dd][Aa][Tt][Ee]|[Nn][Uu][Mm][Bb][Ee][Rr]))?$" - }, - { - "pattern": "^[Ee][Ss]2021(\\.([Ii][Nn][Tt][Ll]|[Pp][Rr][Oo][Mm][Ii][Ss][Ee]|[Ss][Tt][Rr][Ii][Nn][Gg]|[Ww][Ee][Aa][Kk][Rr][Ee][Ff]))?$" - }, - { - "pattern": "^[Ee][Ss]2022(\\.([Aa][Rr][Rr][Aa][Yy]|[Ee][Rr][Rr][Oo][Rr]|[Ii][Nn][Tt][Ll]|[Oo][Bb][Jj][Ee][Cc][Tt]|[Ss][Tt][Rr][Ii][Nn][Gg]|[Ss][Hh][Aa][Rr][Ee][Dd][Mm][Ee][Mm][Oo][Rr][Yy]|[Rr][Ee][Gg][Ee][Xx][Pp]))?$" - }, - { - "pattern": "^[Ee][Ss]2023(\\.([Aa][Rr][Rr][Aa][Yy]|[Cc][Oo][Ll][Ll][Ee][Cc][Tt][Ii][Oo][Nn]))?$" - }, - { - "pattern": "^[Ee][Ss][Nn][Ee][Xx][Tt](\\.([Aa][Rr][Rr][Aa][Yy]|[Aa][Ss][Yy][Nn][Cc][Ii][Tt][Ee][Rr][Aa][Bb][Ll][Ee]|[Bb][Ii][Gg][Ii][Nn][Tt]|[Ii][Nn][Tt][Ll]|[Pp][Rr][Oo][Mm][Ii][Ss][Ee]|[Ss][Tt][Rr][Ii][Nn][Gg]|[Ss][Yy][Mm][Bb][Oo][Ll]|[Ww][Ee][Aa][Kk][Rr][Ee][Ff]|[Dd][Ee][Cc][Oo][Rr][Aa][Tt][Oo][Rr][Ss]|[Dd][Ii][Ss][Pp][Oo][Ss][Aa][Bb][Ll][Ee]))?$" - }, - { - "pattern": "^[Dd][Oo][Mm](\\.[Ii][Tt][Ee][Rr][Aa][Bb][Ll][Ee])?$" - }, - { - "pattern": "^[Ss][Cc][Rr][Ii][Pp][Tt][Hh][Oo][Ss][Tt]$" - }, - { - "pattern": "^[Ww][Ee][Bb][Ww][Oo][Rr][Kk][Ee][Rr](\\.([Ii][Mm][Pp][Oo][Rr][Tt][Ss][Cc][Rr][Ii][Pp][Tt][Ss]|[Ii][Tt][Ee][Rr][Aa][Bb][Ll][Ee]))?$" - }, - { - "pattern": "^[Dd][Ee][Cc][Oo][Rr][Aa][Tt][Oo][Rr][Ss](\\.([Ll][Ee][Gg][Aa][Cc][Yy]))?$" - } - ] + "type": "object", + "properties": { + "compilerOptions": { + "type": "object", + "description": "Instructs the TypeScript compiler how to compile .ts files.", + "properties": { + "allowJs": { + "description": "Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files.", + "type": "boolean", + "default": false, + "markdownDescription": "Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files.\n\nSee more: https://www.typescriptlang.org/tsconfig#allowJs" }, - "markdownDescription": "Specify a set of bundled library declaration files that describe the target runtime environment.\n\nSee more: https://www.typescriptlang.org/tsconfig#lib" - }, - "locale": { - "description": "Locale", - "type": "string", - "markdownDescription": "Locale" - }, - "mapRoot": { - "description": "Specify the location where debugger should locate map files instead of generated locations.", - "type": "string", - "markdownDescription": "Specify the location where debugger should locate map files instead of generated locations.\n\nSee more: https://www.typescriptlang.org/tsconfig#mapRoot" - }, - "maxNodeModuleJsDepth": { - "description": "Specify the maximum folder depth used for checking JavaScript files from `node_modules`. Only applicable with `allowJs`.", - "type": "number", - "default": 0, - "markdownDescription": "Specify the maximum folder depth used for checking JavaScript files from `node_modules`. Only applicable with `allowJs`.\n\nSee more: https://www.typescriptlang.org/tsconfig#maxNodeModuleJsDepth" - }, - "module": { - "description": "Specify what module code is generated.", - "type": "number", - "enum": [0, 1, 2, 3, 4, 5, 99], - "markdownDescription": "Specify what module code is generated.\n\n0 = None\n\n1 = CommonJS\n\n2 = AMD\n\n3 = UMD\n\n4 = System\n\n5 = ES2015\n\n99 = ESNext" - }, - "moduleResolution": { - "description": "Specify how TypeScript looks up a file from a given module specifier.", - "type": "number", - "enum": [1, 2], - "markdownDescription": "Specify how TypeScript looks up a file from a given module specifier.\n\n1 = Classic\n\n2 = NodeJs" - }, - "newLine": { - "description": "Set the newline character for emitting files.", - "type": "number", - "enum": [0, 1], - "markdownDescription": "Set the newline character for emitting files.\n\n0 = CarriageReturnLineFeed\n\n1 = LineFeed" - }, - "noEmit": { - "description": "Disable emitting file from a compilation.", - "type": "boolean", - "default": false, - "markdownDescription": "Disable emitting file from a compilation.\n\nSee more: https://www.typescriptlang.org/tsconfig#noEmit" - }, - "noEmitHelpers": { - "description": "Disable generating custom helper functions like `__extends` in compiled output.", - "type": "boolean", - "default": false, - "markdownDescription": "Disable generating custom helper functions like `__extends` in compiled output.\n\nSee more: https://www.typescriptlang.org/tsconfig#noEmitHelpers" - }, - "noEmitOnError": { - "description": "Disable emitting files if any type checking errors are reported.", - "type": "boolean", - "default": false, - "markdownDescription": "Disable emitting files if any type checking errors are reported.\n\nSee more: https://www.typescriptlang.org/tsconfig#noEmitOnError" - }, - "noErrorTruncation": { - "description": "Disable truncating types in error messages.", - "type": "boolean", - "default": false, - "markdownDescription": "Disable truncating types in error messages.\n\nSee more: https://www.typescriptlang.org/tsconfig#noErrorTruncation" - }, - "noFallthroughCasesInSwitch": { - "description": "Enable error reporting for fallthrough cases in switch statements.", - "type": "boolean", - "default": false, - "markdownDescription": "Enable error reporting for fallthrough cases in switch statements.\n\nSee more: https://www.typescriptlang.org/tsconfig#noFallthroughCasesInSwitch" - }, - "noImplicitAny": { - "description": "Enable error reporting for expressions and declarations with an implied `any` type..", - "type": "boolean", - "markdownDescription": "Enable error reporting for expressions and declarations with an implied `any` type..\n\nSee more: https://www.typescriptlang.org/tsconfig#noImplicitAny" - }, - "noImplicitReturns": { - "description": "Enable error reporting for codepaths that do not explicitly return in a function.", - "type": "boolean", - "default": false, - "markdownDescription": "Enable error reporting for codepaths that do not explicitly return in a function.\n\nSee more: https://www.typescriptlang.org/tsconfig#noImplicitReturns" - }, - "noImplicitThis": { - "description": "Enable error reporting when `this` is given the type `any`.", - "type": "boolean", - "markdownDescription": "Enable error reporting when `this` is given the type `any`.\n\nSee more: https://www.typescriptlang.org/tsconfig#noImplicitThis" - }, - "noStrictGenericChecks": { - "description": "Disable strict checking of generic signatures in function types.", - "type": "boolean", - "default": false, - "markdownDescription": "Disable strict checking of generic signatures in function types.\n\nSee more: https://www.typescriptlang.org/tsconfig#noStrictGenericChecks" - }, - "noUnusedLocals": { - "description": "Enable error reporting when a local variables aren't read.", - "type": "boolean", - "default": false, - "markdownDescription": "Enable error reporting when a local variables aren't read.\n\nSee more: https://www.typescriptlang.org/tsconfig#noUnusedLocals" - }, - "noUnusedParameters": { - "description": "Raise an error when a function parameter isn't read", - "type": "boolean", - "default": false, - "markdownDescription": "Raise an error when a function parameter isn't read\n\nSee more: https://www.typescriptlang.org/tsconfig#noUnusedParameters" - }, - "noImplicitUseStrict": { - "description": "Disable adding 'use strict' directives in emitted JavaScript files.", - "type": "boolean", - "default": false, - "markdownDescription": "Disable adding 'use strict' directives in emitted JavaScript files.\n\nSee more: https://www.typescriptlang.org/tsconfig#noImplicitUseStrict" - }, - "noLib": { - "description": "Disable including any library files, including the default lib.d.ts.", - "type": "boolean", - "default": false, - "markdownDescription": "Disable including any library files, including the default lib.d.ts.\n\nSee more: https://www.typescriptlang.org/tsconfig#noLib" - }, - "noResolve": { - "description": "Disallow `import`s, `require`s or ``s from expanding the number of files TypeScript should add to a project.", - "type": "boolean", - "default": false, - "markdownDescription": "Disallow `import`s, `require`s or ``s from expanding the number of files TypeScript should add to a project.\n\nSee more: https://www.typescriptlang.org/tsconfig#noResolve" - }, - "out": { - "description": "Out", - "type": "string", - "markdownDescription": "Out" - }, - "outFile": { - "description": "Specify a file that bundles all outputs into one JavaScript file. If `declaration` is true, also designates a file that bundles all .d.ts output.", - "type": "string", - "markdownDescription": "Specify a file that bundles all outputs into one JavaScript file. If `declaration` is true, also designates a file that bundles all .d.ts output.\n\nSee more: https://www.typescriptlang.org/tsconfig#outFile" - }, - "outDir": { - "description": "Specify an output folder for all emitted files.", - "type": "string", - "markdownDescription": "Specify an output folder for all emitted files.\n\nSee more: https://www.typescriptlang.org/tsconfig#outDir" - }, - "paths": { - "description": "Specify a set of entries that re-map imports to additional lookup locations.", - "type": "object", - "additionalProperties": { + "allowSyntheticDefaultImports": { + "description": "Allow 'import x from y' when a module doesn't have a default export.", + "type": "boolean", + "markdownDescription": "Allow 'import x from y' when a module doesn't have a default export.\n\nSee more: https://www.typescriptlang.org/tsconfig#allowSyntheticDefaultImports" + }, + "allowUmdGlobalAccess": { + "description": "Allow accessing UMD globals from modules.", + "type": "boolean", + "default": false, + "markdownDescription": "Allow accessing UMD globals from modules.\n\nSee more: https://www.typescriptlang.org/tsconfig#allowUmdGlobalAccess" + }, + "allowUnreachableCode": { + "description": "Disable error reporting for unreachable code.", + "type": "boolean", + "markdownDescription": "Disable error reporting for unreachable code.\n\nSee more: https://www.typescriptlang.org/tsconfig#allowUnreachableCode" + }, + "allowUnusedLabels": { + "description": "Disable error reporting for unused labels.", + "type": "boolean", + "markdownDescription": "Disable error reporting for unused labels.\n\nSee more: https://www.typescriptlang.org/tsconfig#allowUnusedLabels" + }, + "alwaysStrict": { + "description": "Ensure 'use strict' is always emitted.", + "type": "boolean", + "markdownDescription": "Ensure 'use strict' is always emitted.\n\nSee more: https://www.typescriptlang.org/tsconfig#alwaysStrict" + }, + "baseUrl": { + "description": "Specify the base directory to resolve non-relative module names.", + "type": "string", + "markdownDescription": "Specify the base directory to resolve non-relative module names.\n\nSee more: https://www.typescriptlang.org/tsconfig#baseUrl" + }, + "charset": { + "description": "No longer supported. In early versions, manually set the text encoding for reading files.", + "type": "string", + "markdownDescription": "No longer supported. In early versions, manually set the text encoding for reading files.\n\nSee more: https://www.typescriptlang.org/tsconfig#charset" + }, + "checkJs": { + "description": "Enable error reporting in type-checked JavaScript files.", + "type": "boolean", + "default": false, + "markdownDescription": "Enable error reporting in type-checked JavaScript files.\n\nSee more: https://www.typescriptlang.org/tsconfig#checkJs" + }, + "declaration": { + "description": "Generate .d.ts files from TypeScript and JavaScript files in your project.", + "type": "boolean", + "default": false, + "markdownDescription": "Generate .d.ts files from TypeScript and JavaScript files in your project.\n\nSee more: https://www.typescriptlang.org/tsconfig#declaration" + }, + "declarationMap": { + "description": "Create sourcemaps for d.ts files.", + "type": "boolean", + "default": false, + "markdownDescription": "Create sourcemaps for d.ts files.\n\nSee more: https://www.typescriptlang.org/tsconfig#declarationMap" + }, + "emitDeclarationOnly": { + "description": "Only output d.ts files and not JavaScript files.", + "type": "boolean", + "default": false, + "markdownDescription": "Only output d.ts files and not JavaScript files.\n\nSee more: https://www.typescriptlang.org/tsconfig#emitDeclarationOnly" + }, + "declarationDir": { + "description": "Specify the output directory for generated declaration files.", + "type": [ + "string", + "null" + ], + "markdownDescription": "Specify the output directory for generated declaration files.\n\nSee more: https://www.typescriptlang.org/tsconfig#declarationDir" + }, + "disableSizeLimit": { + "description": "Remove the 20mb cap on total source code size for JavaScript files in the TypeScript language server.", + "type": "boolean", + "default": false, + "markdownDescription": "Remove the 20mb cap on total source code size for JavaScript files in the TypeScript language server.\n\nSee more: https://www.typescriptlang.org/tsconfig#disableSizeLimit" + }, + "disableSourceOfProjectReferenceRedirect": { + "description": "Disable preferring source files instead of declaration files when referencing composite projects", + "type": "boolean", + "markdownDescription": "Disable preferring source files instead of declaration files when referencing composite projects\n\nSee more: https://www.typescriptlang.org/tsconfig#disableSourceOfProjectReferenceRedirect" + }, + "downlevelIteration": { + "description": "Emit more compliant, but verbose and less performant JavaScript for iteration.", + "type": "boolean", + "default": false, + "markdownDescription": "Emit more compliant, but verbose and less performant JavaScript for iteration.\n\nSee more: https://www.typescriptlang.org/tsconfig#downlevelIteration" + }, + "emitBOM": { + "description": "Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files.", + "type": "boolean", + "default": false, + "markdownDescription": "Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files.\n\nSee more: https://www.typescriptlang.org/tsconfig#emitBOM" + }, + "emitDecoratorMetadata": { + "description": "Emit design-type metadata for decorated declarations in source files.", + "type": "boolean", + "markdownDescription": "Emit design-type metadata for decorated declarations in source files.\n\nSee more: https://www.typescriptlang.org/tsconfig#emitDecoratorMetadata" + }, + "experimentalDecorators": { + "description": "Enable experimental support for TC39 stage 2 draft decorators.", + "type": "boolean", + "markdownDescription": "Enable experimental support for TC39 stage 2 draft decorators.\n\nSee more: https://www.typescriptlang.org/tsconfig#experimentalDecorators" + }, + "forceConsistentCasingInFileNames": { + "description": "Ensure that casing is correct in imports.", + "type": "boolean", + "default": false, + "markdownDescription": "Ensure that casing is correct in imports.\n\nSee more: https://www.typescriptlang.org/tsconfig#forceConsistentCasingInFileNames" + }, + "importHelpers": { + "description": "Allow importing helper functions from tslib once per project, instead of including them per-file.", + "type": "boolean", + "default": false, + "markdownDescription": "Allow importing helper functions from tslib once per project, instead of including them per-file.\n\nSee more: https://www.typescriptlang.org/tsconfig#importHelpers" + }, + "inlineSourceMap": { + "description": "Include sourcemap files inside the emitted JavaScript.", + "type": "boolean", + "default": false, + "markdownDescription": "Include sourcemap files inside the emitted JavaScript.\n\nSee more: https://www.typescriptlang.org/tsconfig#inlineSourceMap" + }, + "inlineSources": { + "description": "Include source code in the sourcemaps inside the emitted JavaScript.", + "type": "boolean", + "default": false, + "markdownDescription": "Include source code in the sourcemaps inside the emitted JavaScript.\n\nSee more: https://www.typescriptlang.org/tsconfig#inlineSources" + }, + "isolatedModules": { + "description": "Ensure that each file can be safely transpiled without relying on other imports.", + "type": "boolean", + "default": false, + "markdownDescription": "Ensure that each file can be safely transpiled without relying on other imports.\n\nSee more: https://www.typescriptlang.org/tsconfig#isolatedModules" + }, + "jsx": { + "description": "Specify what JSX code is generated.", + "type": "number", + "enum": [ + 0, + 1, + 2, + 3, + 4, + 5 + ], + "markdownDescription": "Specify what JSX code is generated.\n\n0 = none\n\n1 = preserve\n\n2 = react\n\n3 = react-native\n\n4 = react-jsx\n\n5 = react-jsxdev" + }, + "keyofStringsOnly": { + "description": "Make keyof only return strings instead of string, numbers or symbols. Legacy option.", + "type": "boolean", + "default": false, + "markdownDescription": "Make keyof only return strings instead of string, numbers or symbols. Legacy option.\n\nSee more: https://www.typescriptlang.org/tsconfig#keyofStringsOnly" + }, + "lib": { + "description": "Specify a set of bundled library declaration files that describe the target runtime environment.", "type": "array", "uniqueItems": true, "items": { "type": "string", - "description": "Path mapping to be computed relative to baseUrl option." - } + "anyOf": [ + { + "enum": [ + "ES5", + "ES6", + "ES2015", + "ES2015.Collection", + "ES2015.Core", + "ES2015.Generator", + "ES2015.Iterable", + "ES2015.Promise", + "ES2015.Proxy", + "ES2015.Reflect", + "ES2015.Symbol.WellKnown", + "ES2015.Symbol", + "ES2016", + "ES2016.Array.Include", + "ES2017", + "ES2017.Intl", + "ES2017.Object", + "ES2017.SharedMemory", + "ES2017.String", + "ES2017.TypedArrays", + "ES2018", + "ES2018.AsyncGenerator", + "ES2018.AsyncIterable", + "ES2018.Intl", + "ES2018.Promise", + "ES2018.Regexp", + "ES2019", + "ES2019.Array", + "ES2019.Intl", + "ES2019.Object", + "ES2019.String", + "ES2019.Symbol", + "ES2020", + "ES2020.BigInt", + "ES2020.Promise", + "ES2020.String", + "ES2020.Symbol.WellKnown", + "ESNext", + "ESNext.Array", + "ESNext.AsyncIterable", + "ESNext.BigInt", + "ESNext.Intl", + "ESNext.Promise", + "ESNext.String", + "ESNext.Symbol", + "DOM", + "DOM.Iterable", + "ScriptHost", + "WebWorker", + "WebWorker.ImportScripts", + "Webworker.Iterable", + "ES7", + "ES2021", + "ES2020.SharedMemory", + "ES2020.Intl", + "ES2020.Date", + "ES2020.Number", + "ES2021.Promise", + "ES2021.String", + "ES2021.WeakRef", + "ESNext.WeakRef", + "ES2021.Intl", + "ES2022", + "ES2022.Array", + "ES2022.Error", + "ES2022.Intl", + "ES2022.Object", + "ES2022.String", + "ES2022.SharedMemory", + "ES2022.RegExp", + "ES2023", + "ES2023.Array", + "Decorators", + "Decorators.Legacy", + "ES2017.Date", + "ES2023.Collection", + "ESNext.Decorators", + "ESNext.Disposable" + ] + }, + { + "pattern": "^[Ee][Ss]5|[Ee][Ss]6|[Ee][Ss]7$" + }, + { + "pattern": "^[Ee][Ss]2015(\\.([Cc][Oo][Ll][Ll][Ee][Cc][Tt][Ii][Oo][Nn]|[Cc][Oo][Rr][Ee]|[Gg][Ee][Nn][Ee][Rr][Aa][Tt][Oo][Rr]|[Ii][Tt][Ee][Rr][Aa][Bb][Ll][Ee]|[Pp][Rr][Oo][Mm][Ii][Ss][Ee]|[Pp][Rr][Oo][Xx][Yy]|[Rr][Ee][Ff][Ll][Ee][Cc][Tt]|[Ss][Yy][Mm][Bb][Oo][Ll]\\.[Ww][Ee][Ll][Ll][Kk][Nn][Oo][Ww][Nn]|[Ss][Yy][Mm][Bb][Oo][Ll]))?$" + }, + { + "pattern": "^[Ee][Ss]2016(\\.[Aa][Rr][Rr][Aa][Yy]\\.[Ii][Nn][Cc][Ll][Uu][Dd][Ee])?$" + }, + { + "pattern": "^[Ee][Ss]2017(\\.([Ii][Nn][Tt][Ll]|[Oo][Bb][Jj][Ee][Cc][Tt]|[Ss][Hh][Aa][Rr][Ee][Dd][Mm][Ee][Mm][Oo][Rr][Yy]|[Ss][Tt][Rr][Ii][Nn][Gg]|[Tt][Yy][Pp][Ee][Dd][Aa][Rr][Rr][Aa][Yy][Ss]|[Dd][Aa][Tt][Ee]))?$" + }, + { + "pattern": "^[Ee][Ss]2018(\\.([Aa][Ss][Yy][Nn][Cc][Gg][Ee][Nn][Ee][Rr][Aa][Tt][Oo][Rr]|[Aa][Ss][Yy][Nn][Cc][Ii][Tt][Ee][Rr][Aa][Bb][Ll][Ee]|[Ii][Nn][Tt][Ll]|[Pp][Rr][Oo][Mm][Ii][Ss][Ee]|[Rr][Ee][Gg][Ee][Xx][Pp]))?$" + }, + { + "pattern": "^[Ee][Ss]2019(\\.([Aa][Rr][Rr][Aa][Yy]|[Ii][Nn][Tt][Ll]|[Oo][Bb][Jj][Ee][Cc][Tt]|[Ss][Tt][Rr][Ii][Nn][Gg]|[Ss][Yy][Mm][Bb][Oo][Ll]))?$" + }, + { + "pattern": "^[Ee][Ss]2020(\\.([Bb][Ii][Gg][Ii][Nn][Tt]|[Pp][Rr][Oo][Mm][Ii][Ss][Ee]|[Ss][Tt][Rr][Ii][Nn][Gg]|[Ss][Yy][Mm][Bb][Oo][Ll]\\.[Ww][Ee][Ll][Ll][Kk][Nn][Oo][Ww][Nn]|[Ss][Hh][Aa][Rr][Ee][Dd][Mm][Ee][Mm][Oo][Rr][Yy]|[Ii][Nn][Tt][Ll]|[Dd][Aa][Tt][Ee]|[Nn][Uu][Mm][Bb][Ee][Rr]))?$" + }, + { + "pattern": "^[Ee][Ss]2021(\\.([Ii][Nn][Tt][Ll]|[Pp][Rr][Oo][Mm][Ii][Ss][Ee]|[Ss][Tt][Rr][Ii][Nn][Gg]|[Ww][Ee][Aa][Kk][Rr][Ee][Ff]))?$" + }, + { + "pattern": "^[Ee][Ss]2022(\\.([Aa][Rr][Rr][Aa][Yy]|[Ee][Rr][Rr][Oo][Rr]|[Ii][Nn][Tt][Ll]|[Oo][Bb][Jj][Ee][Cc][Tt]|[Ss][Tt][Rr][Ii][Nn][Gg]|[Ss][Hh][Aa][Rr][Ee][Dd][Mm][Ee][Mm][Oo][Rr][Yy]|[Rr][Ee][Gg][Ee][Xx][Pp]))?$" + }, + { + "pattern": "^[Ee][Ss]2023(\\.([Aa][Rr][Rr][Aa][Yy]|[Cc][Oo][Ll][Ll][Ee][Cc][Tt][Ii][Oo][Nn]))?$" + }, + { + "pattern": "^[Ee][Ss][Nn][Ee][Xx][Tt](\\.([Aa][Rr][Rr][Aa][Yy]|[Aa][Ss][Yy][Nn][Cc][Ii][Tt][Ee][Rr][Aa][Bb][Ll][Ee]|[Bb][Ii][Gg][Ii][Nn][Tt]|[Ii][Nn][Tt][Ll]|[Pp][Rr][Oo][Mm][Ii][Ss][Ee]|[Ss][Tt][Rr][Ii][Nn][Gg]|[Ss][Yy][Mm][Bb][Oo][Ll]|[Ww][Ee][Aa][Kk][Rr][Ee][Ff]|[Dd][Ee][Cc][Oo][Rr][Aa][Tt][Oo][Rr][Ss]|[Dd][Ii][Ss][Pp][Oo][Ss][Aa][Bb][Ll][Ee]))?$" + }, + { + "pattern": "^[Dd][Oo][Mm](\\.[Ii][Tt][Ee][Rr][Aa][Bb][Ll][Ee])?$" + }, + { + "pattern": "^[Ss][Cc][Rr][Ii][Pp][Tt][Hh][Oo][Ss][Tt]$" + }, + { + "pattern": "^[Ww][Ee][Bb][Ww][Oo][Rr][Kk][Ee][Rr](\\.([Ii][Mm][Pp][Oo][Rr][Tt][Ss][Cc][Rr][Ii][Pp][Tt][Ss]|[Ii][Tt][Ee][Rr][Aa][Bb][Ll][Ee]))?$" + }, + { + "pattern": "^[Dd][Ee][Cc][Oo][Rr][Aa][Tt][Oo][Rr][Ss](\\.([Ll][Ee][Gg][Aa][Cc][Yy]))?$" + } + ] + }, + "markdownDescription": "Specify a set of bundled library declaration files that describe the target runtime environment.\n\nSee more: https://www.typescriptlang.org/tsconfig#lib" }, - "markdownDescription": "Specify a set of entries that re-map imports to additional lookup locations.\n\nSee more: https://www.typescriptlang.org/tsconfig#paths" - }, - "preserveConstEnums": { - "description": "Disable erasing `const enum` declarations in generated code.", - "type": "boolean", - "default": false, - "markdownDescription": "Disable erasing `const enum` declarations in generated code.\n\nSee more: https://www.typescriptlang.org/tsconfig#preserveConstEnums" - }, - "preserveSymlinks": { - "description": "Disable resolving symlinks to their realpath. This correlates to the same flag in node.", - "type": "boolean", - "default": false, - "markdownDescription": "Disable resolving symlinks to their realpath. This correlates to the same flag in node.\n\nSee more: https://www.typescriptlang.org/tsconfig#preserveSymlinks" - }, - "project": { - "description": "Project", - "type": "string", - "markdownDescription": "Project" - }, - "reactNamespace": { - "description": "Specify the object invoked for `createElement`. This only applies when targeting `react` JSX emit.", - "type": "string", - "default": "React", - "markdownDescription": "Specify the object invoked for `createElement`. This only applies when targeting `react` JSX emit.\n\nSee more: https://www.typescriptlang.org/tsconfig#reactNamespace" - }, - "jsxFactory": { - "description": "Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'", - "type": "string", - "default": "React.createElement", - "markdownDescription": "Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'\n\nSee more: https://www.typescriptlang.org/tsconfig#jsxFactory" - }, - "composite": { - "description": "Enable constraints that allow a TypeScript project to be used with project references.", - "type": "boolean", - "default": true, - "markdownDescription": "Enable constraints that allow a TypeScript project to be used with project references.\n\nSee more: https://www.typescriptlang.org/tsconfig#composite" - }, - "removeComments": { - "description": "Disable emitting comments.", - "type": "boolean", - "default": false, - "markdownDescription": "Disable emitting comments.\n\nSee more: https://www.typescriptlang.org/tsconfig#removeComments" - }, - "rootDir": { - "description": "Specify the root folder within your source files.", - "type": "string", - "markdownDescription": "Specify the root folder within your source files.\n\nSee more: https://www.typescriptlang.org/tsconfig#rootDir" - }, - "rootDirs": { - "description": "Allow multiple folders to be treated as one when resolving modules.", - "type": "array", - "uniqueItems": true, - "items": { - "type": "string" + "locale": { + "description": "Locale", + "type": "string", + "markdownDescription": "Locale" }, - "markdownDescription": "Allow multiple folders to be treated as one when resolving modules.\n\nSee more: https://www.typescriptlang.org/tsconfig#rootDirs" - }, - "skipLibCheck": { - "description": "Skip type checking all .d.ts files.", - "type": "boolean", - "default": false, - "markdownDescription": "Skip type checking all .d.ts files.\n\nSee more: https://www.typescriptlang.org/tsconfig#skipLibCheck" - }, - "skipDefaultLibCheck": { - "description": "Skip type checking .d.ts files that are included with TypeScript.", - "type": "boolean", - "default": false, - "markdownDescription": "Skip type checking .d.ts files that are included with TypeScript.\n\nSee more: https://www.typescriptlang.org/tsconfig#skipDefaultLibCheck" - }, - "sourceMap": { - "description": "Create source map files for emitted JavaScript files.", - "type": "boolean", - "default": false, - "markdownDescription": "Create source map files for emitted JavaScript files.\n\nSee more: https://www.typescriptlang.org/tsconfig#sourceMap" - }, - "sourceRoot": { - "description": "Specify the root path for debuggers to find the reference source code.", - "type": "string", - "markdownDescription": "Specify the root path for debuggers to find the reference source code.\n\nSee more: https://www.typescriptlang.org/tsconfig#sourceRoot" - }, - "strict": { - "description": "Enable all strict type checking options.", - "type": "boolean", - "default": false, - "markdownDescription": "Enable all strict type checking options.\n\nSee more: https://www.typescriptlang.org/tsconfig#strict" - }, - "strictFunctionTypes": { - "description": "When assigning functions, check to ensure parameters and the return values are subtype-compatible.", - "type": "boolean", - "default": false, - "markdownDescription": "When assigning functions, check to ensure parameters and the return values are subtype-compatible.\n\nSee more: https://www.typescriptlang.org/tsconfig#strictFunctionTypes" - }, - "strictBindCallApply": { - "description": "Check that the arguments for `bind`, `call`, and `apply` methods match the original function.", - "type": "boolean", - "default": false, - "markdownDescription": "Check that the arguments for `bind`, `call`, and `apply` methods match the original function.\n\nSee more: https://www.typescriptlang.org/tsconfig#strictBindCallApply" - }, - "strictNullChecks": { - "description": "When type checking, take into account `null` and `undefined`.", - "type": "boolean", - "default": false, - "markdownDescription": "When type checking, take into account `null` and `undefined`.\n\nSee more: https://www.typescriptlang.org/tsconfig#strictNullChecks" - }, - "strictPropertyInitialization": { - "description": "Check for class properties that are declared but not set in the constructor.", - "type": "boolean", - "default": false, - "markdownDescription": "Check for class properties that are declared but not set in the constructor.\n\nSee more: https://www.typescriptlang.org/tsconfig#strictPropertyInitialization" - }, - "stripInternal": { - "description": "Disable emitting declarations that have `@internal` in their JSDoc comments.", - "type": "boolean", - "markdownDescription": "Disable emitting declarations that have `@internal` in their JSDoc comments.\n\nSee more: https://www.typescriptlang.org/tsconfig#stripInternal" - }, - "suppressExcessPropertyErrors": { - "description": "Disable reporting of excess property errors during the creation of object literals.", - "type": "boolean", - "default": false, - "markdownDescription": "Disable reporting of excess property errors during the creation of object literals.\n\nSee more: https://www.typescriptlang.org/tsconfig#suppressExcessPropertyErrors" - }, - "suppressImplicitAnyIndexErrors": { - "description": "Suppress `noImplicitAny` errors when indexing objects that lack index signatures.", - "type": "boolean", - "default": false, - "markdownDescription": "Suppress `noImplicitAny` errors when indexing objects that lack index signatures.\n\nSee more: https://www.typescriptlang.org/tsconfig#suppressImplicitAnyIndexErrors" - }, - "target": { - "description": "Set the JavaScript language version for emitted JavaScript and include compatible library declarations.", - "type": "number", - "default": 0, - "enum": [0, 1, 2, 3, 4, 5, 6, 7, 99, 100, 99], - "markdownDescription": "Set the JavaScript language version for emitted JavaScript and include compatible library declarations.\n\n0 = ES3\n\n1 = ES5\n\n2 = ES2015\n\n3 = ES2016\n\n4 = ES2017\n\n5 = ES2018\n\n6 = ES2019\n\n7 = ES2020\n\n99 = ESNext\n\n100 = JSON\n\n99 = Latest" - }, - "traceResolution": { - "description": "Enable tracing of the name resolution process. Requires TypeScript version 2.0 or later.", - "type": "boolean", - "default": false - }, - "resolveJsonModule": { - "description": "Enable importing .json files", - "type": "boolean", - "default": false, - "markdownDescription": "Enable importing .json files\n\nSee more: https://www.typescriptlang.org/tsconfig#resolveJsonModule" - }, - "types": { - "description": "Specify type package names to be included without being referenced in a source file.", - "type": "array", - "uniqueItems": true, - "items": { - "type": "string" + "mapRoot": { + "description": "Specify the location where debugger should locate map files instead of generated locations.", + "type": "string", + "markdownDescription": "Specify the location where debugger should locate map files instead of generated locations.\n\nSee more: https://www.typescriptlang.org/tsconfig#mapRoot" }, - "markdownDescription": "Specify type package names to be included without being referenced in a source file.\n\nSee more: https://www.typescriptlang.org/tsconfig#types" - }, - "typeRoots": { - "description": "Specify multiple folders that act like `./node_modules/@types`.", - "type": "array", - "uniqueItems": true, - "items": { - "type": "string" + "maxNodeModuleJsDepth": { + "description": "Specify the maximum folder depth used for checking JavaScript files from `node_modules`. Only applicable with `allowJs`.", + "type": "number", + "default": 0, + "markdownDescription": "Specify the maximum folder depth used for checking JavaScript files from `node_modules`. Only applicable with `allowJs`.\n\nSee more: https://www.typescriptlang.org/tsconfig#maxNodeModuleJsDepth" }, - "markdownDescription": "Specify multiple folders that act like `./node_modules/@types`.\n\nSee more: https://www.typescriptlang.org/tsconfig#typeRoots" - }, - "esModuleInterop": { - "description": "Emit additional JavaScript to ease support for importing CommonJS modules. This enables `allowSyntheticDefaultImports` for type compatibility.", - "type": "boolean", - "default": false, - "markdownDescription": "Emit additional JavaScript to ease support for importing CommonJS modules. This enables `allowSyntheticDefaultImports` for type compatibility.\n\nSee more: https://www.typescriptlang.org/tsconfig#esModuleInterop" - }, - "useDefineForClassFields": { - "description": "Emit ECMAScript-standard-compliant class fields.", - "type": "boolean", - "default": false, - "markdownDescription": "Emit ECMAScript-standard-compliant class fields.\n\nSee more: https://www.typescriptlang.org/tsconfig#useDefineForClassFields" - }, - - "allowArbitraryExtensions": { - "description": "Enable importing files with any extension, provided a declaration file is present.", - "type": "boolean", - "markdownDescription": "Enable importing files with any extension, provided a declaration file is present.\n\nSee more: https://www.typescriptlang.org/tsconfig#allowImportingTsExtensions" - }, - "allowImportingTsExtensions": { - "description": "Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set.", - "type": "boolean", - "markdownDescription": "Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set.\n\nSee more: https://www.typescriptlang.org/tsconfig#allowImportingTsExtensions" - }, - "customConditions": { - "description": "Conditions to set in addition to the resolver-specific defaults when resolving imports.", - "type": "array", - "uniqueItems": true, - "items": { - "type": "string" + "module": { + "description": "Specify what module code is generated.", + "type": "number", + "enum": [ + 0, + 1, + 2, + 3, + 4, + 5, + 99 + ], + "markdownDescription": "Specify what module code is generated.\n\n0 = None\n\n1 = CommonJS\n\n2 = AMD\n\n3 = UMD\n\n4 = System\n\n5 = ES2015\n\n99 = ESNext" }, - "markdownDescription": "Conditions to set in addition to the resolver-specific defaults when resolving imports.\n\nSee more: https://www.typescriptlang.org/tsconfig#customConditions" - }, - "diagnostics": { - "description": "Output compiler performance information after building.", - "type": "boolean", - "markdownDescription": "Output compiler performance information after building.\n\nSee more: https://www.typescriptlang.org/tsconfig#diagnostics" - }, - "disableReferencedProjectLoad": { - "description": "Reduce the number of projects loaded automatically by TypeScript.", - "type": "boolean", - "markdownDescription": "Reduce the number of projects loaded automatically by TypeScript.\n\nSee more: https://www.typescriptlang.org/tsconfig#disableReferencedProjectLoad" - }, - "noPropertyAccessFromIndexSignature": { - "description": "Enforces using indexed accessors for keys declared using an indexed type", - "type": "boolean", - "markdownDescription": "Enforces using indexed accessors for keys declared using an indexed type\n\nSee more: https://www.typescriptlang.org/tsconfig#noPropertyAccessFromIndexSignature" - }, - "exactOptionalPropertyTypes": { - "description": "Differentiate between undefined and not present when type checking", - "type": "boolean", - "default": false, - "markdownDescription": "Differentiate between undefined and not present when type checking\n\nSee more: https://www.typescriptlang.org/tsconfig#exactOptionalPropertyTypes" - }, - "incremental": { - "description": "Enable incremental compilation. Requires TypeScript version 3.4 or later.", - "type": "boolean" - }, - "tsBuildInfoFile": { - "description": "Specify the folder for .tsbuildinfo incremental compilation files.", - "default": ".tsbuildinfo", - "type": "string", - "markdownDescription": "Specify the folder for .tsbuildinfo incremental compilation files.\n\nSee more: https://www.typescriptlang.org/tsconfig#tsBuildInfoFile" - }, - "jsxFragmentFactory": { - "description": "Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'.", - "type": "string", - "default": "React.Fragment", - "markdownDescription": "Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'.\n\nSee more: https://www.typescriptlang.org/tsconfig#jsxFragmentFactory" - }, - "jsxImportSource": { - "description": "Specify module specifier used to import the JSX factory functions when using `jsx: react-jsx`.", - "type": "string", - "default": "react", - "markdownDescription": "Specify module specifier used to import the JSX factory functions when using `jsx: react-jsx`.\n\nSee more: https://www.typescriptlang.org/tsconfig#jsxImportSource" - }, - "listFiles": { - "description": "Print all of the files read during the compilation.", - "type": "boolean", - "default": false, - "markdownDescription": "Print all of the files read during the compilation.\n\nSee more: https://www.typescriptlang.org/tsconfig#listFiles" - }, - "preserveValueImports": { - "description": "Preserve unused imported values in the JavaScript output that would otherwise be removed", - "type": "boolean", - "default": false, - "markdownDescription": "Preserve unused imported values in the JavaScript output that would otherwise be removed\n\nSee more: https://www.typescriptlang.org/tsconfig#preserveValueImports" - }, - "preserveWatchOutput": { - "description": "Disable wiping the console in watch mode", - "type": "boolean", - "markdownDescription": "Disable wiping the console in watch mode\n\nSee more: https://www.typescriptlang.org/tsconfig#preserveWatchOutput" - }, - "pretty": { - "description": "Enable color and formatting in output to make compiler errors easier to read", - "type": "boolean", - "default": true, - "markdownDescription": "Enable color and formatting in output to make compiler errors easier to read\n\nSee more: https://www.typescriptlang.org/tsconfig#pretty" - }, - "useUnknownInCatchVariables": { - "description": "Default catch clause variables as `unknown` instead of `any`.", - "type": "boolean", - "default": false, - "markdownDescription": "Default catch clause variables as `unknown` instead of `any`.\n\nSee more: https://www.typescriptlang.org/tsconfig#useUnknownInCatchVariables" - }, - "watch": { - "description": "Watch input files.", - "type": "boolean" - }, - "fallbackPolling": { - "description": "Specify the polling strategy to use when the system runs out of or doesn't support native file watchers. Requires TypeScript version 3.8 or later.", - "enum": [ - "fixedPollingInterval", - "priorityPollingInterval", - "dynamicPriorityPolling", - "fixedInterval", - "priorityInterval", - "dynamicPriority", - "fixedChunkSize" - ] - }, - "watchDirectory": { - "description": "Specify the strategy for watching directories under systems that lack recursive file-watching functionality. Requires TypeScript version 3.8 or later.", - "enum": [ - "useFsEvents", - "fixedPollingInterval", - "dynamicPriorityPolling", - "fixedChunkSizePolling" - ], - "default": "useFsEvents" - }, - "watchFile": { - "description": "Specify the strategy for watching individual files. Requires TypeScript version 3.8 or later.", - "enum": [ - "fixedPollingInterval", - "priorityPollingInterval", - "dynamicPriorityPolling", - "useFsEvents", - "useFsEventsOnParentDirectory", - "fixedChunkSizePolling" - ], - "default": "useFsEvents" - }, - "noUncheckedIndexedAccess": { - "description": "Add `undefined` to a type when accessed using an index.", - "type": "boolean", - "markdownDescription": "Add `undefined` to a type when accessed using an index.\n\nSee more: https://www.typescriptlang.org/tsconfig#noUncheckedIndexedAccess" - }, - "noImplicitOverride": { - "description": "Ensure overriding members in derived classes are marked with an override modifier.", - "type": "boolean", - "default": false, - "markdownDescription": "Ensure overriding members in derived classes are marked with an override modifier.\n\nSee more: https://www.typescriptlang.org/tsconfig#noImplicitOverride" - }, - "generateCpuProfile": { - "description": "Emit a v8 CPU profile of the compiler run for debugging.", - "type": "string", - "default": "profile.cpuprofile", - "markdownDescription": "Emit a v8 CPU profile of the compiler run for debugging.\n\nSee more: https://www.typescriptlang.org/tsconfig#generateCpuProfile" - }, - "plugins": { - "description": "Specify a list of language service plugins to include.", - "type": "array", - "items": { + "moduleResolution": { + "description": "Specify how TypeScript looks up a file from a given module specifier.", + "type": "number", + "enum": [ + 1, + 2 + ], + "markdownDescription": "Specify how TypeScript looks up a file from a given module specifier.\n\n1 = Classic\n\n2 = NodeJs" + }, + "newLine": { + "description": "Set the newline character for emitting files.", + "type": "number", + "enum": [ + 0, + 1 + ], + "markdownDescription": "Set the newline character for emitting files.\n\n0 = CarriageReturnLineFeed\n\n1 = LineFeed" + }, + "noEmit": { + "description": "Disable emitting file from a compilation.", + "type": "boolean", + "default": false, + "markdownDescription": "Disable emitting file from a compilation.\n\nSee more: https://www.typescriptlang.org/tsconfig#noEmit" + }, + "noEmitHelpers": { + "description": "Disable generating custom helper functions like `__extends` in compiled output.", + "type": "boolean", + "default": false, + "markdownDescription": "Disable generating custom helper functions like `__extends` in compiled output.\n\nSee more: https://www.typescriptlang.org/tsconfig#noEmitHelpers" + }, + "noEmitOnError": { + "description": "Disable emitting files if any type checking errors are reported.", + "type": "boolean", + "default": false, + "markdownDescription": "Disable emitting files if any type checking errors are reported.\n\nSee more: https://www.typescriptlang.org/tsconfig#noEmitOnError" + }, + "noErrorTruncation": { + "description": "Disable truncating types in error messages.", + "type": "boolean", + "default": false, + "markdownDescription": "Disable truncating types in error messages.\n\nSee more: https://www.typescriptlang.org/tsconfig#noErrorTruncation" + }, + "noFallthroughCasesInSwitch": { + "description": "Enable error reporting for fallthrough cases in switch statements.", + "type": "boolean", + "default": false, + "markdownDescription": "Enable error reporting for fallthrough cases in switch statements.\n\nSee more: https://www.typescriptlang.org/tsconfig#noFallthroughCasesInSwitch" + }, + "noImplicitAny": { + "description": "Enable error reporting for expressions and declarations with an implied `any` type..", + "type": "boolean", + "markdownDescription": "Enable error reporting for expressions and declarations with an implied `any` type..\n\nSee more: https://www.typescriptlang.org/tsconfig#noImplicitAny" + }, + "noImplicitReturns": { + "description": "Enable error reporting for codepaths that do not explicitly return in a function.", + "type": "boolean", + "default": false, + "markdownDescription": "Enable error reporting for codepaths that do not explicitly return in a function.\n\nSee more: https://www.typescriptlang.org/tsconfig#noImplicitReturns" + }, + "noImplicitThis": { + "description": "Enable error reporting when `this` is given the type `any`.", + "type": "boolean", + "markdownDescription": "Enable error reporting when `this` is given the type `any`.\n\nSee more: https://www.typescriptlang.org/tsconfig#noImplicitThis" + }, + "noStrictGenericChecks": { + "description": "Disable strict checking of generic signatures in function types.", + "type": "boolean", + "default": false, + "markdownDescription": "Disable strict checking of generic signatures in function types.\n\nSee more: https://www.typescriptlang.org/tsconfig#noStrictGenericChecks" + }, + "noUnusedLocals": { + "description": "Enable error reporting when a local variables aren't read.", + "type": "boolean", + "default": false, + "markdownDescription": "Enable error reporting when a local variables aren't read.\n\nSee more: https://www.typescriptlang.org/tsconfig#noUnusedLocals" + }, + "noUnusedParameters": { + "description": "Raise an error when a function parameter isn't read", + "type": "boolean", + "default": false, + "markdownDescription": "Raise an error when a function parameter isn't read\n\nSee more: https://www.typescriptlang.org/tsconfig#noUnusedParameters" + }, + "noImplicitUseStrict": { + "description": "Disable adding 'use strict' directives in emitted JavaScript files.", + "type": "boolean", + "default": false, + "markdownDescription": "Disable adding 'use strict' directives in emitted JavaScript files.\n\nSee more: https://www.typescriptlang.org/tsconfig#noImplicitUseStrict" + }, + "noLib": { + "description": "Disable including any library files, including the default lib.d.ts.", + "type": "boolean", + "default": false, + "markdownDescription": "Disable including any library files, including the default lib.d.ts.\n\nSee more: https://www.typescriptlang.org/tsconfig#noLib" + }, + "noResolve": { + "description": "Disallow `import`s, `require`s or ``s from expanding the number of files TypeScript should add to a project.", + "type": "boolean", + "default": false, + "markdownDescription": "Disallow `import`s, `require`s or ``s from expanding the number of files TypeScript should add to a project.\n\nSee more: https://www.typescriptlang.org/tsconfig#noResolve" + }, + "out": { + "description": "Out", + "type": "string", + "markdownDescription": "Out" + }, + "outFile": { + "description": "Specify a file that bundles all outputs into one JavaScript file. If `declaration` is true, also designates a file that bundles all .d.ts output.", + "type": "string", + "markdownDescription": "Specify a file that bundles all outputs into one JavaScript file. If `declaration` is true, also designates a file that bundles all .d.ts output.\n\nSee more: https://www.typescriptlang.org/tsconfig#outFile" + }, + "outDir": { + "description": "Specify an output folder for all emitted files.", + "type": "string", + "markdownDescription": "Specify an output folder for all emitted files.\n\nSee more: https://www.typescriptlang.org/tsconfig#outDir" + }, + "paths": { + "description": "Specify a set of entries that re-map imports to additional lookup locations.", "type": "object", - "properties": { - "name": { - "description": "Plugin name.", - "type": "string" + "additionalProperties": { + "type": "array", + "uniqueItems": true, + "items": { + "type": "string", + "description": "Path mapping to be computed relative to baseUrl option." } - } + }, + "markdownDescription": "Specify a set of entries that re-map imports to additional lookup locations.\n\nSee more: https://www.typescriptlang.org/tsconfig#paths" }, - "markdownDescription": "Specify a list of language service plugins to include.\n\nSee more: https://www.typescriptlang.org/tsconfig#plugins" - }, - "listEmittedFiles": { - "description": "Print the names of emitted files after a compilation.", - "type": "boolean", - "default": false, - "markdownDescription": "Print the names of emitted files after a compilation.\n\nSee more: https://www.typescriptlang.org/tsconfig#listEmittedFiles" - }, - "moduleDetection": { - "description": "Specify how TypeScript determine a file as module.", - "enum": ["auto", "legacy", "force"] - }, - "importsNotUsedAsValues": { - "description": "Specify emit/checking behavior for imports that are only used for types.", - "default": "remove", - "enum": ["remove", "preserve", "error"] - }, - "resolvePackageJsonExports": { - "description": "Use the package.json 'exports' field when resolving package imports.", - "type": "boolean", - "default": false, - "markdownDescription": "Use the package.json 'exports' field when resolving package imports.\n\nSee more: https://www.typescriptlang.org/tsconfig#resolvePackageJsonExports" - }, - "resolvePackageJsonImports": { - "description": "Use the package.json 'imports' field when resolving imports.", - "type": "boolean", - "default": false, - "markdownDescription": "Use the package.json 'imports' field when resolving imports.\n\nSee more: https://www.typescriptlang.org/tsconfig#resolvePackageJsonImports" - }, - "assumeChangesOnlyAffectDirectDependencies": { - "description": "Have recompiles in '--incremental' and '--watch' assume that changes within a file will only affect files directly depending on it. Requires TypeScript version 3.8 or later.", - "type": "boolean" - }, - "extendedDiagnostics": { - "description": "Output more detailed compiler performance information after building.", - "type": "boolean", - "default": false, - "markdownDescription": "Output more detailed compiler performance information after building.\n\nSee more: https://www.typescriptlang.org/tsconfig#extendedDiagnostics" - }, - "listFilesOnly": { - "description": "Print names of files that are part of the compilation and then stop processing.", - "type": "boolean" - }, - "disableSolutionSearching": { - "description": "Opt a project out of multi-project reference checking when editing.", - "type": "boolean", - "markdownDescription": "Opt a project out of multi-project reference checking when editing.\n\nSee more: https://www.typescriptlang.org/tsconfig#disableSolutionSearching" - }, - "verbatimModuleSyntax": { - "description": "Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting.", - "type": "boolean", - "markdownDescription": "Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting.\n\nSee more: https://www.typescriptlang.org/tsconfig#verbatimModuleSyntax" + "preserveConstEnums": { + "description": "Disable erasing `const enum` declarations in generated code.", + "type": "boolean", + "default": false, + "markdownDescription": "Disable erasing `const enum` declarations in generated code.\n\nSee more: https://www.typescriptlang.org/tsconfig#preserveConstEnums" + }, + "preserveSymlinks": { + "description": "Disable resolving symlinks to their realpath. This correlates to the same flag in node.", + "type": "boolean", + "default": false, + "markdownDescription": "Disable resolving symlinks to their realpath. This correlates to the same flag in node.\n\nSee more: https://www.typescriptlang.org/tsconfig#preserveSymlinks" + }, + "project": { + "description": "Project", + "type": "string", + "markdownDescription": "Project" + }, + "reactNamespace": { + "description": "Specify the object invoked for `createElement`. This only applies when targeting `react` JSX emit.", + "type": "string", + "default": "React", + "markdownDescription": "Specify the object invoked for `createElement`. This only applies when targeting `react` JSX emit.\n\nSee more: https://www.typescriptlang.org/tsconfig#reactNamespace" + }, + "jsxFactory": { + "description": "Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'", + "type": "string", + "default": "React.createElement", + "markdownDescription": "Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'\n\nSee more: https://www.typescriptlang.org/tsconfig#jsxFactory" + }, + "composite": { + "description": "Enable constraints that allow a TypeScript project to be used with project references.", + "type": "boolean", + "default": true, + "markdownDescription": "Enable constraints that allow a TypeScript project to be used with project references.\n\nSee more: https://www.typescriptlang.org/tsconfig#composite" + }, + "removeComments": { + "description": "Disable emitting comments.", + "type": "boolean", + "default": false, + "markdownDescription": "Disable emitting comments.\n\nSee more: https://www.typescriptlang.org/tsconfig#removeComments" + }, + "rootDir": { + "description": "Specify the root folder within your source files.", + "type": "string", + "markdownDescription": "Specify the root folder within your source files.\n\nSee more: https://www.typescriptlang.org/tsconfig#rootDir" + }, + "rootDirs": { + "description": "Allow multiple folders to be treated as one when resolving modules.", + "type": "array", + "uniqueItems": true, + "items": { + "type": "string" + }, + "markdownDescription": "Allow multiple folders to be treated as one when resolving modules.\n\nSee more: https://www.typescriptlang.org/tsconfig#rootDirs" + }, + "skipLibCheck": { + "description": "Skip type checking all .d.ts files.", + "type": "boolean", + "default": false, + "markdownDescription": "Skip type checking all .d.ts files.\n\nSee more: https://www.typescriptlang.org/tsconfig#skipLibCheck" + }, + "skipDefaultLibCheck": { + "description": "Skip type checking .d.ts files that are included with TypeScript.", + "type": "boolean", + "default": false, + "markdownDescription": "Skip type checking .d.ts files that are included with TypeScript.\n\nSee more: https://www.typescriptlang.org/tsconfig#skipDefaultLibCheck" + }, + "sourceMap": { + "description": "Create source map files for emitted JavaScript files.", + "type": "boolean", + "default": false, + "markdownDescription": "Create source map files for emitted JavaScript files.\n\nSee more: https://www.typescriptlang.org/tsconfig#sourceMap" + }, + "sourceRoot": { + "description": "Specify the root path for debuggers to find the reference source code.", + "type": "string", + "markdownDescription": "Specify the root path for debuggers to find the reference source code.\n\nSee more: https://www.typescriptlang.org/tsconfig#sourceRoot" + }, + "strict": { + "description": "Enable all strict type checking options.", + "type": "boolean", + "default": false, + "markdownDescription": "Enable all strict type checking options.\n\nSee more: https://www.typescriptlang.org/tsconfig#strict" + }, + "strictFunctionTypes": { + "description": "When assigning functions, check to ensure parameters and the return values are subtype-compatible.", + "type": "boolean", + "default": false, + "markdownDescription": "When assigning functions, check to ensure parameters and the return values are subtype-compatible.\n\nSee more: https://www.typescriptlang.org/tsconfig#strictFunctionTypes" + }, + "strictBindCallApply": { + "description": "Check that the arguments for `bind`, `call`, and `apply` methods match the original function.", + "type": "boolean", + "default": false, + "markdownDescription": "Check that the arguments for `bind`, `call`, and `apply` methods match the original function.\n\nSee more: https://www.typescriptlang.org/tsconfig#strictBindCallApply" + }, + "strictNullChecks": { + "description": "When type checking, take into account `null` and `undefined`.", + "type": "boolean", + "default": false, + "markdownDescription": "When type checking, take into account `null` and `undefined`.\n\nSee more: https://www.typescriptlang.org/tsconfig#strictNullChecks" + }, + "strictPropertyInitialization": { + "description": "Check for class properties that are declared but not set in the constructor.", + "type": "boolean", + "default": false, + "markdownDescription": "Check for class properties that are declared but not set in the constructor.\n\nSee more: https://www.typescriptlang.org/tsconfig#strictPropertyInitialization" + }, + "stripInternal": { + "description": "Disable emitting declarations that have `@internal` in their JSDoc comments.", + "type": "boolean", + "markdownDescription": "Disable emitting declarations that have `@internal` in their JSDoc comments.\n\nSee more: https://www.typescriptlang.org/tsconfig#stripInternal" + }, + "suppressExcessPropertyErrors": { + "description": "Disable reporting of excess property errors during the creation of object literals.", + "type": "boolean", + "default": false, + "markdownDescription": "Disable reporting of excess property errors during the creation of object literals.\n\nSee more: https://www.typescriptlang.org/tsconfig#suppressExcessPropertyErrors" + }, + "suppressImplicitAnyIndexErrors": { + "description": "Suppress `noImplicitAny` errors when indexing objects that lack index signatures.", + "type": "boolean", + "default": false, + "markdownDescription": "Suppress `noImplicitAny` errors when indexing objects that lack index signatures.\n\nSee more: https://www.typescriptlang.org/tsconfig#suppressImplicitAnyIndexErrors" + }, + "target": { + "description": "Set the JavaScript language version for emitted JavaScript and include compatible library declarations.", + "type": "number", + "default": 0, + "enum": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 99, + 100, + 99 + ], + "markdownDescription": "Set the JavaScript language version for emitted JavaScript and include compatible library declarations.\n\n0 = ES3\n\n1 = ES5\n\n2 = ES2015\n\n3 = ES2016\n\n4 = ES2017\n\n5 = ES2018\n\n6 = ES2019\n\n7 = ES2020\n\n99 = ESNext\n\n100 = JSON\n\n99 = Latest" + }, + "traceResolution": { + "description": "Enable tracing of the name resolution process. Requires TypeScript version 2.0 or later.", + "type": "boolean", + "default": false + }, + "resolveJsonModule": { + "description": "Enable importing .json files", + "type": "boolean", + "default": false, + "markdownDescription": "Enable importing .json files\n\nSee more: https://www.typescriptlang.org/tsconfig#resolveJsonModule" + }, + "types": { + "description": "Specify type package names to be included without being referenced in a source file.", + "type": "array", + "uniqueItems": true, + "items": { + "type": "string" + }, + "markdownDescription": "Specify type package names to be included without being referenced in a source file.\n\nSee more: https://www.typescriptlang.org/tsconfig#types" + }, + "typeRoots": { + "description": "Specify multiple folders that act like `./node_modules/@types`.", + "type": "array", + "uniqueItems": true, + "items": { + "type": "string" + }, + "markdownDescription": "Specify multiple folders that act like `./node_modules/@types`.\n\nSee more: https://www.typescriptlang.org/tsconfig#typeRoots" + }, + "esModuleInterop": { + "description": "Emit additional JavaScript to ease support for importing CommonJS modules. This enables `allowSyntheticDefaultImports` for type compatibility.", + "type": "boolean", + "default": false, + "markdownDescription": "Emit additional JavaScript to ease support for importing CommonJS modules. This enables `allowSyntheticDefaultImports` for type compatibility.\n\nSee more: https://www.typescriptlang.org/tsconfig#esModuleInterop" + }, + "useDefineForClassFields": { + "description": "Emit ECMAScript-standard-compliant class fields.", + "type": "boolean", + "default": false, + "markdownDescription": "Emit ECMAScript-standard-compliant class fields.\n\nSee more: https://www.typescriptlang.org/tsconfig#useDefineForClassFields" + }, + "allowArbitraryExtensions": { + "description": "Enable importing files with any extension, provided a declaration file is present.", + "type": "boolean", + "markdownDescription": "Enable importing files with any extension, provided a declaration file is present.\n\nSee more: https://www.typescriptlang.org/tsconfig#allowImportingTsExtensions" + }, + "allowImportingTsExtensions": { + "description": "Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set.", + "type": "boolean", + "markdownDescription": "Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set.\n\nSee more: https://www.typescriptlang.org/tsconfig#allowImportingTsExtensions" + }, + "customConditions": { + "description": "Conditions to set in addition to the resolver-specific defaults when resolving imports.", + "type": "array", + "uniqueItems": true, + "items": { + "type": "string" + }, + "markdownDescription": "Conditions to set in addition to the resolver-specific defaults when resolving imports.\n\nSee more: https://www.typescriptlang.org/tsconfig#customConditions" + }, + "diagnostics": { + "description": "Output compiler performance information after building.", + "type": "boolean", + "markdownDescription": "Output compiler performance information after building.\n\nSee more: https://www.typescriptlang.org/tsconfig#diagnostics" + }, + "disableReferencedProjectLoad": { + "description": "Reduce the number of projects loaded automatically by TypeScript.", + "type": "boolean", + "markdownDescription": "Reduce the number of projects loaded automatically by TypeScript.\n\nSee more: https://www.typescriptlang.org/tsconfig#disableReferencedProjectLoad" + }, + "noPropertyAccessFromIndexSignature": { + "description": "Enforces using indexed accessors for keys declared using an indexed type", + "type": "boolean", + "markdownDescription": "Enforces using indexed accessors for keys declared using an indexed type\n\nSee more: https://www.typescriptlang.org/tsconfig#noPropertyAccessFromIndexSignature" + }, + "exactOptionalPropertyTypes": { + "description": "Differentiate between undefined and not present when type checking", + "type": "boolean", + "default": false, + "markdownDescription": "Differentiate between undefined and not present when type checking\n\nSee more: https://www.typescriptlang.org/tsconfig#exactOptionalPropertyTypes" + }, + "incremental": { + "description": "Enable incremental compilation. Requires TypeScript version 3.4 or later.", + "type": "boolean" + }, + "tsBuildInfoFile": { + "description": "Specify the folder for .tsbuildinfo incremental compilation files.", + "default": ".tsbuildinfo", + "type": "string", + "markdownDescription": "Specify the folder for .tsbuildinfo incremental compilation files.\n\nSee more: https://www.typescriptlang.org/tsconfig#tsBuildInfoFile" + }, + "jsxFragmentFactory": { + "description": "Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'.", + "type": "string", + "default": "React.Fragment", + "markdownDescription": "Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'.\n\nSee more: https://www.typescriptlang.org/tsconfig#jsxFragmentFactory" + }, + "jsxImportSource": { + "description": "Specify module specifier used to import the JSX factory functions when using `jsx: react-jsx`.", + "type": "string", + "default": "react", + "markdownDescription": "Specify module specifier used to import the JSX factory functions when using `jsx: react-jsx`.\n\nSee more: https://www.typescriptlang.org/tsconfig#jsxImportSource" + }, + "listFiles": { + "description": "Print all of the files read during the compilation.", + "type": "boolean", + "default": false, + "markdownDescription": "Print all of the files read during the compilation.\n\nSee more: https://www.typescriptlang.org/tsconfig#listFiles" + }, + "preserveValueImports": { + "description": "Preserve unused imported values in the JavaScript output that would otherwise be removed", + "type": "boolean", + "default": false, + "markdownDescription": "Preserve unused imported values in the JavaScript output that would otherwise be removed\n\nSee more: https://www.typescriptlang.org/tsconfig#preserveValueImports" + }, + "preserveWatchOutput": { + "description": "Disable wiping the console in watch mode", + "type": "boolean", + "markdownDescription": "Disable wiping the console in watch mode\n\nSee more: https://www.typescriptlang.org/tsconfig#preserveWatchOutput" + }, + "pretty": { + "description": "Enable color and formatting in output to make compiler errors easier to read", + "type": "boolean", + "default": true, + "markdownDescription": "Enable color and formatting in output to make compiler errors easier to read\n\nSee more: https://www.typescriptlang.org/tsconfig#pretty" + }, + "useUnknownInCatchVariables": { + "description": "Default catch clause variables as `unknown` instead of `any`.", + "type": "boolean", + "default": false, + "markdownDescription": "Default catch clause variables as `unknown` instead of `any`.\n\nSee more: https://www.typescriptlang.org/tsconfig#useUnknownInCatchVariables" + }, + "watch": { + "description": "Watch input files.", + "type": "boolean" + }, + "fallbackPolling": { + "description": "Specify the polling strategy to use when the system runs out of or doesn't support native file watchers. Requires TypeScript version 3.8 or later.", + "enum": [ + "fixedPollingInterval", + "priorityPollingInterval", + "dynamicPriorityPolling", + "fixedInterval", + "priorityInterval", + "dynamicPriority", + "fixedChunkSize" + ] + }, + "watchDirectory": { + "description": "Specify the strategy for watching directories under systems that lack recursive file-watching functionality. Requires TypeScript version 3.8 or later.", + "enum": [ + "useFsEvents", + "fixedPollingInterval", + "dynamicPriorityPolling", + "fixedChunkSizePolling" + ], + "default": "useFsEvents" + }, + "watchFile": { + "description": "Specify the strategy for watching individual files. Requires TypeScript version 3.8 or later.", + "enum": [ + "fixedPollingInterval", + "priorityPollingInterval", + "dynamicPriorityPolling", + "useFsEvents", + "useFsEventsOnParentDirectory", + "fixedChunkSizePolling" + ], + "default": "useFsEvents" + }, + "noUncheckedIndexedAccess": { + "description": "Add `undefined` to a type when accessed using an index.", + "type": "boolean", + "markdownDescription": "Add `undefined` to a type when accessed using an index.\n\nSee more: https://www.typescriptlang.org/tsconfig#noUncheckedIndexedAccess" + }, + "noImplicitOverride": { + "description": "Ensure overriding members in derived classes are marked with an override modifier.", + "type": "boolean", + "default": false, + "markdownDescription": "Ensure overriding members in derived classes are marked with an override modifier.\n\nSee more: https://www.typescriptlang.org/tsconfig#noImplicitOverride" + }, + "generateCpuProfile": { + "description": "Emit a v8 CPU profile of the compiler run for debugging.", + "type": "string", + "default": "profile.cpuprofile", + "markdownDescription": "Emit a v8 CPU profile of the compiler run for debugging.\n\nSee more: https://www.typescriptlang.org/tsconfig#generateCpuProfile" + }, + "plugins": { + "description": "Specify a list of language service plugins to include.", + "type": "array", + "items": { + "type": "object", + "properties": { + "name": { + "description": "Plugin name.", + "type": "string" + } + } + }, + "markdownDescription": "Specify a list of language service plugins to include.\n\nSee more: https://www.typescriptlang.org/tsconfig#plugins" + }, + "listEmittedFiles": { + "description": "Print the names of emitted files after a compilation.", + "type": "boolean", + "default": false, + "markdownDescription": "Print the names of emitted files after a compilation.\n\nSee more: https://www.typescriptlang.org/tsconfig#listEmittedFiles" + }, + "moduleDetection": { + "description": "Specify how TypeScript determine a file as module.", + "enum": [ + "auto", + "legacy", + "force" + ] + }, + "importsNotUsedAsValues": { + "description": "Specify emit/checking behavior for imports that are only used for types.", + "default": "remove", + "enum": [ + "remove", + "preserve", + "error" + ] + }, + "resolvePackageJsonExports": { + "description": "Use the package.json 'exports' field when resolving package imports.", + "type": "boolean", + "default": false, + "markdownDescription": "Use the package.json 'exports' field when resolving package imports.\n\nSee more: https://www.typescriptlang.org/tsconfig#resolvePackageJsonExports" + }, + "resolvePackageJsonImports": { + "description": "Use the package.json 'imports' field when resolving imports.", + "type": "boolean", + "default": false, + "markdownDescription": "Use the package.json 'imports' field when resolving imports.\n\nSee more: https://www.typescriptlang.org/tsconfig#resolvePackageJsonImports" + }, + "assumeChangesOnlyAffectDirectDependencies": { + "description": "Have recompiles in '--incremental' and '--watch' assume that changes within a file will only affect files directly depending on it. Requires TypeScript version 3.8 or later.", + "type": "boolean" + }, + "extendedDiagnostics": { + "description": "Output more detailed compiler performance information after building.", + "type": "boolean", + "default": false, + "markdownDescription": "Output more detailed compiler performance information after building.\n\nSee more: https://www.typescriptlang.org/tsconfig#extendedDiagnostics" + }, + "listFilesOnly": { + "description": "Print names of files that are part of the compilation and then stop processing.", + "type": "boolean" + }, + "disableSolutionSearching": { + "description": "Opt a project out of multi-project reference checking when editing.", + "type": "boolean", + "markdownDescription": "Opt a project out of multi-project reference checking when editing.\n\nSee more: https://www.typescriptlang.org/tsconfig#disableSolutionSearching" + }, + "verbatimModuleSyntax": { + "description": "Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting.", + "type": "boolean", + "markdownDescription": "Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting.\n\nSee more: https://www.typescriptlang.org/tsconfig#verbatimModuleSyntax" + } } } } From fc18927116e089177a94bdd4ebe30501390dc377 Mon Sep 17 00:00:00 2001 From: FatttSnake Date: Sun, 15 Sep 2024 15:02:02 +0800 Subject: [PATCH 12/19] Style(close-editor-btn): Fix the bug of editor cover the editor close button --- src/assets/css/pages/system/tools/base.scss | 1 + src/assets/css/pages/system/tools/template.scss | 1 + 2 files changed, 2 insertions(+) diff --git a/src/assets/css/pages/system/tools/base.scss b/src/assets/css/pages/system/tools/base.scss index e23e257..8133ee5 100644 --- a/src/assets/css/pages/system/tools/base.scss +++ b/src/assets/css/pages/system/tools/base.scss @@ -38,6 +38,7 @@ opacity: 0.6; box-shadow: 2px 2px 10px 0 rgba(0,0,0,0.2); cursor: pointer; + z-index: 1000; } } } diff --git a/src/assets/css/pages/system/tools/template.scss b/src/assets/css/pages/system/tools/template.scss index dacf2c0..04b9f99 100644 --- a/src/assets/css/pages/system/tools/template.scss +++ b/src/assets/css/pages/system/tools/template.scss @@ -38,6 +38,7 @@ opacity: 0.6; box-shadow: 2px 2px 10px 0 rgba(0,0,0,0.2); cursor: pointer; + z-index: 1000; } } } From 77551804f7415e3f951965272d0c779fdd3bb58a Mon Sep 17 00:00:00 2001 From: FatttSnake Date: Sun, 15 Sep 2024 18:22:02 +0800 Subject: [PATCH 13/19] Refactor(ToolManagement): Optimize the prompt for required review option --- src/pages/System/Tools/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/System/Tools/index.tsx b/src/pages/System/Tools/index.tsx index 36690ca..976a198 100644 --- a/src/pages/System/Tools/index.tsx +++ b/src/pages/System/Tools/index.tsx @@ -219,7 +219,7 @@ const Tools = () => { 通过 From e17fcdb4011cebc7d2784f87fa58a47113c13687 Mon Sep 17 00:00:00 2001 From: FatttSnake Date: Sun, 15 Sep 2024 18:27:54 +0800 Subject: [PATCH 14/19] Refactor(BaseManagement): Optimize the filter of entry file --- src/pages/System/Tools/Base.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/pages/System/Tools/Base.tsx b/src/pages/System/Tools/Base.tsx index ac8f54c..148b314 100644 --- a/src/pages/System/Tools/Base.tsx +++ b/src/pages/System/Tools/Base.tsx @@ -304,7 +304,10 @@ const Base = () => { ![ IMPORT_MAP_FILE_NAME, TS_CONFIG_FILE_NAME - ].includes(value) + ].includes(value) && + !value.endsWith('.d.ts') && + !value.endsWith('.css') && + !value.endsWith('.json') ) .map((value) => ({ value, label: value }))} placeholder={'请选择入口文件'} From d5037dc14eaeaeaf74243dea20b4bd7b8ee4bcb6 Mon Sep 17 00:00:00 2001 From: FatttSnake Date: Sun, 15 Sep 2024 18:31:23 +0800 Subject: [PATCH 15/19] Docs(README): Add API version requirement --- README.md | 1 + README_zh.md | 1 + 2 files changed, 2 insertions(+) diff --git a/README.md b/README.md index 8378716..1380d76 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,7 @@ This project is a front-end web UI of Oxygen Toolbox and needs to be used with t # Requires - Web Server (e.g. Nginx, Apache httpd) +- [API of Oxygen Toolbox](https://github.com/FatttSnake/oxygen-api) (v1.0.0 and later versions) # Related projects diff --git a/README_zh.md b/README_zh.md index 352cae2..51308ed 100644 --- a/README_zh.md +++ b/README_zh.md @@ -24,6 +24,7 @@ # 环境要求 - Web 服务器(如 Nginx, Apache httpd) +- [API of Oxygen Toolbox](https://github.com/FatttSnake/oxygen-api) (v1.0.0 及更高版本) # 关联项目 From c2f6b5d49ea321ef20cfde05b80b7d8cbf569b2c Mon Sep 17 00:00:00 2001 From: FatttSnake Date: Mon, 16 Sep 2024 01:55:41 +0800 Subject: [PATCH 16/19] Fix(editor): Fix "net::ERR_INSUFFICIENT_RESOURCES" exception when the editor loads a large number of libraries --- .../Playground/CodeEditor/Editor/ata.ts | 28 ++++++++++++++++++- .../Playground/CodeEditor/Editor/hooks.ts | 4 +-- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/src/components/Playground/CodeEditor/Editor/ata.ts b/src/components/Playground/CodeEditor/Editor/ata.ts index df03b68..61ea987 100644 --- a/src/components/Playground/CodeEditor/Editor/ata.ts +++ b/src/components/Playground/CodeEditor/Editor/ata.ts @@ -36,6 +36,31 @@ export const createATA = async (): Promise => { // @ts-expect-error // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment const ts = await import('https://esm.sh/typescript@5.3.3') + + const maxConcurrentRequests = 50 + let activeRequests = 0 + const requestQueue: Array<() => void> = [] + const fetchWithQueue = (input: RequestInfo | URL, init?: RequestInit | undefined) => + new Promise((resolve, reject) => { + const attemptRequest = () => { + if (activeRequests < maxConcurrentRequests) { + activeRequests++ + fetch(input, init) + .then((response) => resolve(response)) + .catch((error) => reject(error)) + .finally(() => { + activeRequests-- + if (requestQueue.length > 0) { + requestQueue.shift()?.() + } + }) + } else { + requestQueue.push(attemptRequest) + } + } + attemptRequest() + }) + const ata = setupTypeAcquisition({ projectName: 'monaco-ts', // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment @@ -43,7 +68,7 @@ export const createATA = async (): Promise => { logger: console, fetcher: (input, init) => { try { - return fetch(input, init) + return fetchWithQueue(input, init) } catch (error) { console.error('Error fetching data:', error) } @@ -92,6 +117,7 @@ export const createATA = async (): Promise => { } return { + // eslint-disable-next-line @typescript-eslint/no-misused-promises acquireType, addListener, removeListener, diff --git a/src/components/Playground/CodeEditor/Editor/hooks.ts b/src/components/Playground/CodeEditor/Editor/hooks.ts index 2224b2f..b8aab77 100644 --- a/src/components/Playground/CodeEditor/Editor/hooks.ts +++ b/src/components/Playground/CodeEditor/Editor/hooks.ts @@ -12,8 +12,8 @@ export const useEditor = () => { const selection = input.options ? input.options.selection : null if (selection) { if ( - typeof selection.endLineNumber === 'number' && - typeof selection.endColumn === 'number' + typeof selection?.endLineNumber === 'number' && + typeof selection?.endColumn === 'number' ) { editor.setSelection(selection) editor.revealRangeInCenter(selection, ScrollType.Immediate) From 264534f47995dd4db838e2e059696a74cd5dc9fd Mon Sep 17 00:00:00 2001 From: FatttSnake Date: Thu, 19 Sep 2024 09:59:04 +0800 Subject: [PATCH 17/19] Fix(Management): Fix base and template management unable to jump file --- src/pages/System/Tools/Base.tsx | 2 +- src/pages/System/Tools/Template.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/System/Tools/Base.tsx b/src/pages/System/Tools/Base.tsx index 148b314..d647c0b 100644 --- a/src/pages/System/Tools/Base.tsx +++ b/src/pages/System/Tools/Base.tsx @@ -1100,7 +1100,7 @@ const Base = () => { {}} + onSelectedFileChange={setEditingFileName} onChangeFileContent={handleOnChangeFileContent} showFileSelector={false} tsconfig={tsconfig} diff --git a/src/pages/System/Tools/Template.tsx b/src/pages/System/Tools/Template.tsx index 310793f..44e62c1 100644 --- a/src/pages/System/Tools/Template.tsx +++ b/src/pages/System/Tools/Template.tsx @@ -1044,7 +1044,7 @@ const Template = () => { {}} + onSelectedFileChange={setEditingFileName} onChangeFileContent={handleOnChangeFileContent} showFileSelector={false} tsconfig={tsconfig} From 768f9bce0f1ca621b534eacaeeb6af8787f85c40 Mon Sep 17 00:00:00 2001 From: FatttSnake Date: Thu, 19 Sep 2024 13:56:04 +0800 Subject: [PATCH 18/19] Style(CodePage): Fix draggable mask incorrect style --- src/assets/css/pages/tools/edit.scss | 1 + 1 file changed, 1 insertion(+) diff --git a/src/assets/css/pages/tools/edit.scss b/src/assets/css/pages/tools/edit.scss index 2671d2c..8f8b25d 100644 --- a/src/assets/css/pages/tools/edit.scss +++ b/src/assets/css/pages/tools/edit.scss @@ -6,6 +6,7 @@ width: 100%; .root-content { + position: relative; width: 100%; height: 100%; From ebaa4d8851f20d5e8c94baf8144b6f066a256880 Mon Sep 17 00:00:00 2001 From: FatttSnake Date: Thu, 19 Sep 2024 16:37:43 +0800 Subject: [PATCH 19/19] Build(package.json): Update version from 1.0.1-SNAPSHOT to 1.0.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 5750c5a..eb4813d 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "oxygen-ui", "private": true, "type": "module", - "version": "1.0.1-SNAPSHOT", + "version": "1.0.1", "description": "Oxygen Toolbox browser version", "author": { "name": "FatttSnake",