diff --git a/.vscode/launch.json b/.vscode/launch.json index 8fc202f89..cbace349c 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -2,6 +2,13 @@ // Use IntelliSense to learn about possible attributes. // Hover to view descriptions of existing attributes. "configurations": [ + { + "command": "pnpm generate:types", + "name": "Generate Types CLI", + "request": "launch", + "type": "node-terminal", + "cwd": "${workspaceFolder}" + }, { "command": "pnpm run dev _community -- --no-turbo", "cwd": "${workspaceFolder}", @@ -102,17 +109,6 @@ "request": "launch", "type": "node-terminal" }, - { - "command": "ts-node ./packages/payload/src/bin/index.ts generate:types", - "env": { - "PAYLOAD_CONFIG_PATH": "test/_community/config.ts", - "DISABLE_SWC": "true" // SWC messes up debugging the bin scripts - }, - "name": "Generate Types CLI", - "outputCapture": "std", - "request": "launch", - "type": "node-terminal" - }, { "command": "ts-node ./packages/payload/src/bin/index.ts migrate:status", "env": { diff --git a/package.json b/package.json index 835dee0ec..b0a83b1f2 100644 --- a/package.json +++ b/package.json @@ -47,6 +47,7 @@ "docker:start": "docker-compose -f packages/plugin-cloud-storage/docker-compose.yml up -d", "docker:stop": "docker-compose -f packages/plugin-cloud-storage/docker-compose.yml down", "fix": "eslint \"packages/**/*.ts\" --fix", + "generate:types": "PAYLOAD_CONFIG_PATH=./test/_community/config.ts node ./packages/payload/bin.js", "lint": "eslint \"packages/**/*.ts\"", "lint-staged": "lint-staged", "prepare": "husky install", @@ -72,7 +73,6 @@ "@playwright/test": "1.42.1", "@swc/cli": "^0.1.62", "@swc/jest": "0.2.36", - "@swc/register": "0.1.10", "@testing-library/jest-dom": "6.4.2", "@testing-library/react": "14.2.1", "@types/concat-stream": "^2.0.1", diff --git a/packages/payload/bin.js b/packages/payload/bin.js index bfec46741..bba28c674 100755 --- a/packages/payload/bin.js +++ b/packages/payload/bin.js @@ -1,51 +1,30 @@ #!/usr/bin/env node /* eslint-disable @typescript-eslint/no-var-requires */ -import swcRegister from '@swc/register' -import { getTsconfig } from 'get-tsconfig' -import path from 'path' +import { register } from 'node:module' +import path from 'node:path' +import { fileURLToPath, pathToFileURL } from 'node:url' import bin from './dist/bin/index.js' import { loadEnv } from './dist/bin/loadEnv.js' -import findConfig from './dist/config/find.js' +import { findConfig } from './dist/config/find.js' -const tsConfig = getTsconfig() - -const swcOptions = { - ignore: [/.*[\\/]node_modules[\\/].*/], - jsc: { - baseUrl: path.resolve('../../'), - parser: { - syntax: 'typescript', - tsx: true, - }, - paths: undefined, - }, - module: { - type: 'es6', - }, - sourceMaps: 'inline', -} - -if (tsConfig?.config?.compilerOptions?.paths) { - swcOptions.jsc.paths = tsConfig.config.compilerOptions.paths - if (tsConfig?.config?.compilerOptions?.baseUrl) { - swcOptions.jsc.baseUrl = path.resolve(tsConfig.config.compilerOptions.baseUrl) - } -} // Allow disabling SWC for debugging if (process.env.DISABLE_SWC !== 'true') { - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-expect-error - bad @swc/register types - swcRegister(swcOptions) + const oldURL = pathToFileURL('./').toString() + const filename = fileURLToPath(import.meta.url) + const dirname = path.dirname(filename) + const url = pathToFileURL(dirname).toString() + '/' + + register('./dist/bin/register/index.js', url) } -loadEnv() -const configPath = findConfig() - const start = async () => { - const sanitized = configPath.replace('.ts', '.js') - const configPromise = await import(sanitized) + loadEnv() + const configPath = findConfig() + + const sanitized = configPath.replace('.ts', '') + const configPromise = await import(configPath) const config = await configPromise bin(config) diff --git a/packages/payload/package.json b/packages/payload/package.json index 9bd75a677..dd0a92176 100644 --- a/packages/payload/package.json +++ b/packages/payload/package.json @@ -39,15 +39,20 @@ "release:major": "release-it major", "release:minor": "release-it minor", "release:patch": "release-it patch", - "translateNewKeys": "ts-node -T ./scripts/translateNewKeys.ts", - "generate:types": "PAYLOAD_CONFIG_PATH=../../test/_community/config.ts node ./bin.js" + "translateNewKeys": "ts-node -T ./scripts/translateNewKeys.ts" }, "dependencies": { "@payloadcms/translations": "workspace:*", + "@swc-node/core": "^1.13.0", + "@swc-node/register": "^1.9.0", + "@swc-node/sourcemap-support": "^0.5.0", + "@swc/register": "^0.1.10", "bson-objectid": "2.0.4", + "colorette": "^2.0.20", "conf": "10.2.0", "console-table-printer": "2.11.2", "dataloader": "2.2.2", + "debug": "^4.3.4", "deepmerge": "4.3.1", "dotenv": "8.6.0", "file-type": "16.5.4", @@ -64,6 +69,7 @@ "nodemailer": "6.9.10", "pino": "8.15.0", "pino-pretty": "10.2.0", + "pirates": "^4.0.6", "pluralize": "8.0.0", "sanitize-filename": "1.6.3", "scheduler": "0.23.0", diff --git a/packages/payload/src/bin/register/index.ts b/packages/payload/src/bin/register/index.ts new file mode 100644 index 000000000..e019f6b25 --- /dev/null +++ b/packages/payload/src/bin/register/index.ts @@ -0,0 +1,128 @@ +import { getTsconfig } from 'get-tsconfig' +import path from 'path' +import ts from 'typescript' +import { fileURLToPath, pathToFileURL } from 'url' + +import { compile } from './register.js' + +interface ResolveContext { + conditions: string[] + parentURL: string | undefined +} +interface ResolveResult { + format?: string + shortCircuit?: boolean + url: string +} +type ResolveArgs = [ + specifier: string, + context?: ResolveContext, + nextResolve?: (...args: ResolveArgs) => Promise, +] +type ResolveFn = (...args: Required) => Promise + +const locatedConfig = getTsconfig() +const tsconfig = locatedConfig.config.compilerOptions as unknown as ts.CompilerOptions + +tsconfig.module = ts.ModuleKind.ESNext +tsconfig.moduleResolution = ts.ModuleResolutionKind.NodeNext + +const moduleResolutionCache = ts.createModuleResolutionCache( + ts.sys.getCurrentDirectory(), + (x) => x, + tsconfig, +) +const host: ts.ModuleResolutionHost = { + fileExists: ts.sys.fileExists, + readFile: ts.sys.readFile, +} +const EXTENSIONS: string[] = [ts.Extension.Ts, ts.Extension.Tsx, ts.Extension.Dts, ts.Extension.Mts] + +export const resolve: ResolveFn = async (specifier, context, nextResolve) => { + const isTS = EXTENSIONS.some((ext) => specifier.endsWith(ext)) + + // entrypoint + if (!context.parentURL) { + return { + format: isTS ? 'ts' : undefined, + shortCircuit: true, + url: specifier, + } + } + + // import/require from external library + if (context.parentURL.includes('/node_modules/') && !isTS) { + return nextResolve(specifier) + } + + const { resolvedModule } = ts.resolveModuleName( + specifier, + fileURLToPath(context.parentURL), + tsconfig, + host, + moduleResolutionCache, + ) + + // import from local project to local project TS file + if ( + resolvedModule && + !resolvedModule.resolvedFileName.includes('/node_modules/') && + EXTENSIONS.includes(resolvedModule.extension) + ) { + return { + format: 'ts', + shortCircuit: true, + url: pathToFileURL(resolvedModule.resolvedFileName).href, + } + } + + // import from local project to either: + // - something TS couldn't resolve + // - external library + // - local project non-TS file + return nextResolve(specifier) +} + +interface LoadContext { + conditions: string[] + format: null | string | undefined +} +interface LoadResult { + format: string + shortCircuit?: boolean + source: ArrayBuffer | SharedArrayBuffer | Uint8Array | string +} +type LoadArgs = [ + url: string, + context: LoadContext, + nextLoad?: (...args: LoadArgs) => Promise, +] +type LoadFn = (...args: Required) => Promise + +const swcOptions = { + ...tsconfig, + baseUrl: path.resolve(''), + paths: undefined, +} + +if (tsconfig.paths) { + swcOptions.paths = tsconfig.paths + if (tsconfig.baseUrl) { + swcOptions.baseUrl = path.resolve(tsconfig.baseUrl) + } +} + +export const load: LoadFn = async (url, context, nextLoad) => { + if (context.format === 'ts') { + const { source } = await nextLoad(url, context) + const code = typeof source === 'string' ? source : Buffer.from(source).toString() + const compiled = await compile(code, fileURLToPath(url), swcOptions, true) + return { + format: 'module', + shortCircuit: true, + source: compiled, + } + } else { + return nextLoad(url, context) + } +} diff --git a/packages/payload/src/bin/register/read-default-tsconfig.ts b/packages/payload/src/bin/register/read-default-tsconfig.ts new file mode 100644 index 000000000..f2227b18d --- /dev/null +++ b/packages/payload/src/bin/register/read-default-tsconfig.ts @@ -0,0 +1,108 @@ +import type { Options } from '@swc-node/core' + +import { resolve } from 'path' +import ts from 'typescript' + +function toTsTarget(target: ts.ScriptTarget): Options['target'] { + switch (target) { + case ts.ScriptTarget.ES3: + return 'es3' + case ts.ScriptTarget.ES5: + return 'es5' + case ts.ScriptTarget.ES2015: + return 'es2015' + case ts.ScriptTarget.ES2016: + return 'es2016' + case ts.ScriptTarget.ES2017: + return 'es2017' + case ts.ScriptTarget.ES2018: + return 'es2018' + case ts.ScriptTarget.ES2019: + return 'es2019' + case ts.ScriptTarget.ES2020: + return 'es2020' + case ts.ScriptTarget.ES2021: + return 'es2021' + case ts.ScriptTarget.ES2022: + case ts.ScriptTarget.ESNext: + case ts.ScriptTarget.Latest: + return 'es2022' + case ts.ScriptTarget.JSON: + return 'es5' + } +} + +function toModule(moduleKind: ts.ModuleKind) { + switch (moduleKind) { + case ts.ModuleKind.CommonJS: + return 'commonjs' + case ts.ModuleKind.UMD: + return 'umd' + case ts.ModuleKind.AMD: + return 'amd' + case ts.ModuleKind.ES2015: + case ts.ModuleKind.ES2020: + case ts.ModuleKind.ES2022: + case ts.ModuleKind.ESNext: + case ts.ModuleKind.Node16: + case ts.ModuleKind.NodeNext: + case ts.ModuleKind.None: + return 'es6' + case ts.ModuleKind.System: + throw new TypeError('Do not support system kind module') + } +} + +/** + * The default value for useDefineForClassFields depends on the emit target + * @see https://www.typescriptlang.org/tsconfig#useDefineForClassFields + */ +function getUseDefineForClassFields( + compilerOptions: ts.CompilerOptions, + target: ts.ScriptTarget, +): boolean { + return compilerOptions.useDefineForClassFields ?? target >= ts.ScriptTarget.ES2022 +} + +export function tsCompilerOptionsToSwcConfig( + options: ts.CompilerOptions, + filename: string, +): Options { + const isJsx = filename.endsWith('.tsx') || filename.endsWith('.jsx') || Boolean(options.jsx) + const target = options.target ?? ts.ScriptTarget.ES2018 + return { + baseUrl: options.baseUrl ? resolve(options.baseUrl) : undefined, + dynamicImport: true, + emitDecoratorMetadata: options.emitDecoratorMetadata ?? false, + esModuleInterop: options.esModuleInterop ?? false, + experimentalDecorators: options.experimentalDecorators ?? false, + externalHelpers: Boolean(options.importHelpers), + ignoreDynamic: Boolean(process.env.SWC_NODE_IGNORE_DYNAMIC), + jsx: isJsx, + keepClassNames: true, + module: toModule(options.module ?? ts.ModuleKind.ES2015), + paths: Object.fromEntries( + Object.entries(options.paths ?? {}).map(([aliasKey, aliasPaths]) => [ + aliasKey, + (aliasPaths ?? []).map((path) => resolve(options.baseUrl ?? './', path)), + ]), + ) as Options['paths'], + react: + options.jsxFactory ?? options.jsxFragmentFactory ?? options.jsx ?? options.jsxImportSource + ? { + importSource: options.jsxImportSource ?? 'react', + pragma: options.jsxFactory, + pragmaFrag: options.jsxFragmentFactory, + runtime: (options.jsx ?? 0) >= ts.JsxEmit.ReactJSX ? 'automatic' : 'classic', + useBuiltins: true, + } + : undefined, + sourcemap: options.sourceMap && options.inlineSourceMap ? 'inline' : Boolean(options.sourceMap), + swc: { + inputSourceMap: options.inlineSourceMap, + sourceRoot: options.sourceRoot, + }, + target: toTsTarget(target), + useDefineForClassFields: getUseDefineForClassFields(options, target), + } +} diff --git a/packages/payload/src/bin/register/register.ts b/packages/payload/src/bin/register/register.ts new file mode 100644 index 000000000..c36ad1349 --- /dev/null +++ b/packages/payload/src/bin/register/register.ts @@ -0,0 +1,125 @@ +import type { Options } from '@swc-node/core' + +import { transform, transformSync } from '@swc-node/core' +import { SourcemapMap, installSourceMapSupport } from '@swc-node/sourcemap-support' +import { getTsconfig } from 'get-tsconfig' +import { platform } from 'os' +import { resolve } from 'path' +import { addHook } from 'pirates' +import * as ts from 'typescript' + +import { tsCompilerOptionsToSwcConfig } from './read-default-tsconfig.js' + +const DEFAULT_EXTENSIONS = ['.js', '.jsx', '.es6', '.es', '.mjs', '.ts', '.tsx'] +const PLATFORM = platform() + +const injectInlineSourceMap = ({ + code, + filename, + map, +}: { + code: string + filename: string + map: string | undefined +}): string => { + if (map) { + SourcemapMap.set(filename, map) + const base64Map = Buffer.from(map, 'utf8').toString('base64') + const sourceMapContent = `//# sourceMappingURL=data:application/json;charset=utf-8;base64,${base64Map}` + return `${code}\n${sourceMapContent}` + } + return code +} + +export function compile( + sourcecode: string, + filename: string, + options: ts.CompilerOptions & { fallbackToTs?: (filename: string) => boolean }, +): string + +export function compile( + sourcecode: string, + filename: string, + options: ts.CompilerOptions & { fallbackToTs?: (filename: string) => boolean }, + async: false, +): string + +export function compile( + sourcecode: string, + filename: string, + options: ts.CompilerOptions & { fallbackToTs?: (filename: string) => boolean }, + async: true, +): Promise + +export function compile( + sourcecode: string, + filename: string, + options: ts.CompilerOptions & { fallbackToTs?: (filename: string) => boolean }, + async: boolean, +): Promise | string + +export function compile( + sourcecode: string, + filename: string, + options: ts.CompilerOptions & { fallbackToTs?: (filename: string) => boolean }, + async = false, +) { + if (filename.endsWith('.d.ts')) { + return '' + } + if (options.files && (options.files as string[]).length) { + if ( + PLATFORM === 'win32' && + (options.files as string[]).every((file) => filename !== resolve(process.cwd(), file)) + ) { + return sourcecode + } + if ( + PLATFORM !== 'win32' && + (options.files as string[]).every((file) => !filename.endsWith(file)) + ) { + return sourcecode + } + } + if (options && typeof options.fallbackToTs === 'function' && options.fallbackToTs(filename)) { + delete options.fallbackToTs + const { outputText, sourceMapText } = ts.transpileModule(sourcecode, { + compilerOptions: options, + fileName: filename, + }) + return injectInlineSourceMap({ code: outputText, filename, map: sourceMapText }) + } + + let swcRegisterConfig: Options + if (process.env.SWCRC) { + // when SWCRC environment variable is set to true it will use swcrc file + swcRegisterConfig = { + swc: { + swcrc: true, + }, + } + } else { + swcRegisterConfig = tsCompilerOptionsToSwcConfig(options, filename) + } + + if (async) { + return transform(sourcecode, filename, swcRegisterConfig).then(({ code, map }) => { + return injectInlineSourceMap({ code, filename, map }) + }) + } else { + const { code, map } = transformSync(sourcecode, filename, swcRegisterConfig) + return injectInlineSourceMap({ code, filename, map }) + } +} + +export function register(options: Partial = {}, hookOpts = {}) { + const locatedConfig = getTsconfig() + const tsconfig = locatedConfig.config.compilerOptions as unknown as ts.CompilerOptions + options = tsconfig + // options.module = ts.ModuleKind.CommonJS + installSourceMapSupport() + return addHook((code, filename) => compile(code, filename, options), { + exts: DEFAULT_EXTENSIONS, + ...hookOpts, + }) +} diff --git a/packages/payload/src/config/find.ts b/packages/payload/src/config/find.ts index d8770be78..26ab846fb 100644 --- a/packages/payload/src/config/find.ts +++ b/packages/payload/src/config/find.ts @@ -38,7 +38,7 @@ const getTSConfigPaths = (): { outPath: string; srcPath: string } => { * @returns The absolute path to the Payload configuration file. * @throws An error if no configuration file is found. */ -const findConfig = (): string => { +export const findConfig = (): string => { // If the developer has specified a config path, // format it if relative and use it directly if absolute if (process.env.PAYLOAD_CONFIG_PATH) { @@ -101,5 +101,3 @@ const findConfig = (): string => { 'Error: cannot find Payload config. Please create a configuration file located at the root of your current working directory called "payload.config.js" or "payload.config.ts".', ) } - -export default findConfig diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 1e17d2313..fc96b3759 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -49,9 +49,6 @@ importers: '@swc/jest': specifier: 0.2.36 version: 0.2.36(@swc/core@1.4.2) - '@swc/register': - specifier: 0.1.10 - version: 0.1.10(@swc/core@1.4.2) '@testing-library/jest-dom': specifier: 6.4.2 version: 6.4.2(@types/jest@29.5.12)(jest@29.7.0) @@ -604,9 +601,24 @@ importers: '@payloadcms/translations': specifier: workspace:* version: link:../translations + '@swc-node/core': + specifier: ^1.13.0 + version: 1.13.0(@swc/core@1.4.2)(@swc/types@0.1.5) + '@swc-node/register': + specifier: ^1.9.0 + version: 1.9.0(@swc/core@1.4.2)(@swc/types@0.1.5)(typescript@5.2.2) + '@swc-node/sourcemap-support': + specifier: ^0.5.0 + version: 0.5.0 + '@swc/register': + specifier: ^0.1.10 + version: 0.1.10(@swc/core@1.4.2) bson-objectid: specifier: 2.0.4 version: 2.0.4 + colorette: + specifier: ^2.0.20 + version: 2.0.20 conf: specifier: 10.2.0 version: 10.2.0 @@ -616,6 +628,9 @@ importers: dataloader: specifier: 2.2.2 version: 2.2.2 + debug: + specifier: ^4.3.4 + version: 4.3.4(supports-color@5.5.0) deepmerge: specifier: 4.3.1 version: 4.3.1 @@ -664,6 +679,9 @@ importers: pino-pretty: specifier: 10.2.0 version: 10.2.0 + pirates: + specifier: ^4.0.6 + version: 4.0.6 pluralize: specifier: 8.0.0 version: 8.0.0 @@ -5305,6 +5323,43 @@ packages: '@smithy/types': 2.10.1 tslib: 2.6.2 + /@swc-node/core@1.13.0(@swc/core@1.4.2)(@swc/types@0.1.5): + resolution: {integrity: sha512-lFPD4nmy4ifAOVMChFjwlpXN5KQXvegqeyuzz1KQz42q1lf+cL3Qux1/GteGuZjh8HC+Rj1RdNrHpE/MCfJSTw==} + engines: {node: '>= 10'} + peerDependencies: + '@swc/core': '>= 1.3' + '@swc/types': '>= 0.1' + dependencies: + '@swc/core': 1.4.2 + '@swc/types': 0.1.5 + dev: false + + /@swc-node/register@1.9.0(@swc/core@1.4.2)(@swc/types@0.1.5)(typescript@5.2.2): + resolution: {integrity: sha512-i0iYInD4q5v3xQC6bKvs0QtfUxu197CU5qKALmpxEqTYs7sIhQ7KFLe3kP+eAR4gRkJTvAgjQgrokXLN2jZrOw==} + peerDependencies: + '@swc/core': '>= 1.3' + typescript: 5.2.2 + dependencies: + '@swc-node/core': 1.13.0(@swc/core@1.4.2)(@swc/types@0.1.5) + '@swc-node/sourcemap-support': 0.5.0 + '@swc/core': 1.4.2 + colorette: 2.0.20 + debug: 4.3.4(supports-color@5.5.0) + pirates: 4.0.6 + tslib: 2.6.2 + typescript: 5.2.2 + transitivePeerDependencies: + - '@swc/types' + - supports-color + dev: false + + /@swc-node/sourcemap-support@0.5.0: + resolution: {integrity: sha512-fbhjL5G0YvFoWwNhWleuBUfotiX+USiA9oJqu9STFw+Hb0Cgnddn+HVS/K5fI45mn92e8V+cHD2jgFjk4w2T9Q==} + dependencies: + source-map-support: 0.5.21 + tslib: 2.6.2 + dev: false + /@swc/cli@0.1.65(@swc/core@1.4.2): resolution: {integrity: sha512-4NcgsvJVHhA7trDnMmkGLLvWMHu2kSy+qHx6QwRhhJhdiYdNUrhdp+ERxen73sYtaeEOYeLJcWrQ60nzKi6rpg==} engines: {node: '>= 12.13'} @@ -5332,7 +5387,6 @@ packages: cpu: [arm64] os: [darwin] requiresBuild: true - dev: true optional: true /@swc/core-darwin-x64@1.4.2: @@ -5341,7 +5395,6 @@ packages: cpu: [x64] os: [darwin] requiresBuild: true - dev: true optional: true /@swc/core-linux-arm-gnueabihf@1.4.2: @@ -5350,7 +5403,6 @@ packages: cpu: [arm] os: [linux] requiresBuild: true - dev: true optional: true /@swc/core-linux-arm64-gnu@1.4.2: @@ -5359,7 +5411,6 @@ packages: cpu: [arm64] os: [linux] requiresBuild: true - dev: true optional: true /@swc/core-linux-arm64-musl@1.4.2: @@ -5368,7 +5419,6 @@ packages: cpu: [arm64] os: [linux] requiresBuild: true - dev: true optional: true /@swc/core-linux-x64-gnu@1.4.2: @@ -5377,7 +5427,6 @@ packages: cpu: [x64] os: [linux] requiresBuild: true - dev: true optional: true /@swc/core-linux-x64-musl@1.4.2: @@ -5386,7 +5435,6 @@ packages: cpu: [x64] os: [linux] requiresBuild: true - dev: true optional: true /@swc/core-win32-arm64-msvc@1.4.2: @@ -5395,7 +5443,6 @@ packages: cpu: [arm64] os: [win32] requiresBuild: true - dev: true optional: true /@swc/core-win32-ia32-msvc@1.4.2: @@ -5404,7 +5451,6 @@ packages: cpu: [ia32] os: [win32] requiresBuild: true - dev: true optional: true /@swc/core-win32-x64-msvc@1.4.2: @@ -5413,7 +5459,6 @@ packages: cpu: [x64] os: [win32] requiresBuild: true - dev: true optional: true /@swc/core@1.4.2: @@ -5439,7 +5484,6 @@ packages: '@swc/core-win32-arm64-msvc': 1.4.2 '@swc/core-win32-ia32-msvc': 1.4.2 '@swc/core-win32-x64-msvc': 1.4.2 - dev: true /@swc/counter@0.1.3: resolution: {integrity: sha512-e2BR4lsJkkRlKZ/qCHPw9ZaSxc0MVUd7gtbtaB7aMvHeJVYe8sOB8DBZkP2DtISHGSku9sCK6T6cnY0CtXrOCQ==} @@ -5480,11 +5524,10 @@ packages: lodash.clonedeep: 4.5.0 pirates: 4.0.6 source-map-support: 0.5.21 - dev: true + dev: false /@swc/types@0.1.5: resolution: {integrity: sha512-myfUej5naTBWnqOCc/MdVOLVjXUXtIA+NpDrDBKJtLLg2shUjBu3cZmB/85RyitKc55+lUUyl7oRfLOvkr2hsw==} - dev: true /@szmarczak/http-timer@4.0.6: resolution: {integrity: sha512-4BAffykYOgO+5nzBWYwE3W90sBgLJoUPRWWcL8wlyiM8IB8ipJz3UMJ9KXQd1RKQXpKp8Tutn80HZtWsu2u76w==} @@ -9586,7 +9629,7 @@ packages: dependencies: loader-utils: 2.0.4 schema-utils: 3.3.0 - webpack: 5.90.3 + webpack: 5.90.3(@swc/core@1.4.2) dev: true /file-type@16.5.4: @@ -12182,7 +12225,7 @@ packages: /lodash.clonedeep@4.5.0: resolution: {integrity: sha512-H5ZhCF25riFd9uB5UCkVKo61m3S/xZk1x4wA6yp/L3RFP6Z/eHH1ymQcGLo7J3GMPfm0V/7m1tryHuGVxpqEBQ==} - dev: true + dev: false /lodash.deburr@4.1.0: resolution: {integrity: sha512-m/M1U1f3ddMCs6Hq2tAsYThTBDaAKFDX3dwDo97GEYzamXi9SqUpjWi/Rrj/gf3X2n8ktwgZrlP1z6E3v/IExQ==} @@ -12462,7 +12505,7 @@ packages: dependencies: loader-utils: 2.0.4 schema-utils: 3.3.0 - webpack: 5.90.3 + webpack: 5.90.3(@swc/core@1.4.2) webpack-sources: 1.4.3 dev: true @@ -15311,30 +15354,6 @@ packages: webpack: 5.90.3(@swc/core@1.4.2) dev: true - /terser-webpack-plugin@5.3.10(webpack@5.90.3): - resolution: {integrity: sha512-BKFPWlPDndPs+NGGCr1U59t0XScL5317Y0UReNrHaw9/FwhPENlq6bfgs+4yPfyP51vqC1bQ4rp1EfXW5ZSH9w==} - engines: {node: '>= 10.13.0'} - peerDependencies: - '@swc/core': '*' - esbuild: '*' - uglify-js: '*' - webpack: ^5.1.0 - peerDependenciesMeta: - '@swc/core': - optional: true - esbuild: - optional: true - uglify-js: - optional: true - dependencies: - '@jridgewell/trace-mapping': 0.3.23 - jest-worker: 27.5.1 - schema-utils: 3.3.0 - serialize-javascript: 6.0.2 - terser: 5.28.1 - webpack: 5.90.3 - dev: true - /terser@5.28.1: resolution: {integrity: sha512-wM+bZp54v/E9eRRGXb5ZFDvinrJIOaTapx3WUokyVGZu5ucVCK55zEgGd5Dl2fSr3jUo5sDiERErUWLY6QPFyA==} engines: {node: '>=10'} @@ -16093,46 +16112,6 @@ packages: engines: {node: '>=10.13.0'} dev: true - /webpack@5.90.3: - resolution: {integrity: sha512-h6uDYlWCctQRuXBs1oYpVe6sFcWedl0dpcVaTf/YF67J9bKvwJajFulMVSYKHrksMB3I/pIagRzDxwxkebuzKA==} - engines: {node: '>=10.13.0'} - hasBin: true - peerDependencies: - webpack-cli: '*' - peerDependenciesMeta: - webpack-cli: - optional: true - dependencies: - '@types/eslint-scope': 3.7.7 - '@types/estree': 1.0.5 - '@webassemblyjs/ast': 1.11.6 - '@webassemblyjs/wasm-edit': 1.11.6 - '@webassemblyjs/wasm-parser': 1.11.6 - acorn: 8.11.3 - acorn-import-assertions: 1.9.0(acorn@8.11.3) - browserslist: 4.23.0 - chrome-trace-event: 1.0.3 - enhanced-resolve: 5.15.1 - es-module-lexer: 1.4.1 - eslint-scope: 5.1.1 - events: 3.3.0 - glob-to-regexp: 0.4.1 - graceful-fs: 4.2.11 - json-parse-even-better-errors: 2.3.1 - loader-runner: 4.3.0 - mime-types: 2.1.35 - neo-async: 2.6.2 - schema-utils: 3.3.0 - tapable: 2.2.1 - terser-webpack-plugin: 5.3.10(webpack@5.90.3) - watchpack: 2.4.0 - webpack-sources: 3.2.3 - transitivePeerDependencies: - - '@swc/core' - - esbuild - - uglify-js - dev: true - /webpack@5.90.3(@swc/core@1.4.2): resolution: {integrity: sha512-h6uDYlWCctQRuXBs1oYpVe6sFcWedl0dpcVaTf/YF67J9bKvwJajFulMVSYKHrksMB3I/pIagRzDxwxkebuzKA==} engines: {node: '>=10.13.0'} diff --git a/tsconfig.json b/tsconfig.json index 0eb8e7247..426caf83c 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,5 +1,6 @@ { "compilerOptions": { + "baseUrl": ".", "declaration": true, "declarationMap": true, "target": "esnext",