Explorar el Código

meta: add support for TypeScript plugins (#4640)

Antoine du Hamel hace 1 año
padre
commit
773c8cb9a1

+ 10 - 0
.eslintrc.js

@@ -357,11 +357,13 @@ module.exports = {
         'test/**/*.js',
         'test/**/*.ts',
         '*.test.js',
+        '*.test.ts',
         '*.test-d.ts',
         '*.test-d.tsx',
         'postcss.config.js',
         '.eslintrc.js',
         'private/**/*.js',
+        'private/**/*.mjs',
       ],
       rules: {
         'no-console': 'off',
@@ -461,9 +463,17 @@ module.exports = {
       rules: {
         'import/prefer-default-export': 'off',
         '@typescript-eslint/no-explicit-any': 'off',
+        '@typescript-eslint/no-extra-semi': 'off',
         '@typescript-eslint/no-namespace': 'off',
       },
     },
+    {
+      files: ['packages/@uppy/*/src/**/*.ts', 'packages/@uppy/*/src/**/*.tsx'],
+      excludedFiles: ['packages/@uppy/**/*.test.ts'],
+      rules: {
+        '@typescript-eslint/explicit-function-return-type': 'error',
+      },
+    },
     {
       files: ['**/*.md/*.*'],
       rules: {

+ 2 - 0
.github/workflows/ci.yml

@@ -103,3 +103,5 @@ jobs:
           corepack yarn run build:locale-pack
       - name: Run type tests
         run: corepack yarn run test:type
+      - name: Attempt building TS packages
+        run: corepack yarn run build:ts

+ 2 - 0
.gitignore

@@ -14,6 +14,8 @@ node_modules
 yarn-error.log
 .idea
 .env
+tsconfig.tsbuildinfo
+tsconfig.build.tsbuildinfo
 
 dist/
 lib/

+ 1 - 0
.prettierignore

@@ -3,5 +3,6 @@ node_modules/
 *.jsx
 *.cjs
 *.mjs
+!private/js2ts/*
 *.md
 *.lock

+ 22 - 22
bin/build-lib.js

@@ -8,9 +8,9 @@ const path = require('node:path')
 const { mkdir, stat, writeFile } = fs.promises
 
 const PACKAGE_JSON_IMPORT = /^\..*\/package.json$/
-const SOURCE = 'packages/{*,@uppy/*}/src/**/*.js?(x)'
+const SOURCE = 'packages/{*,@uppy/*}/src/**/*.{js,ts}?(x)'
 // Files not to build (such as tests)
-const IGNORE = /\.test\.js$|__mocks__|svelte|angular|companion\//
+const IGNORE = /\.test\.[jt]s$|__mocks__|svelte|angular|companion\//
 // Files that should trigger a rebuild of everything on change
 const META_FILES = [
   'babel.config.js',
@@ -32,32 +32,28 @@ function lastModified (file, createParentDir = false) {
   })
 }
 
-const moduleTypeCache = new Map()
 const versionCache = new Map()
-async function isTypeModule (file) {
-  const packageFolder = file.slice(0, file.indexOf('/src/'))
 
-  const cachedValue = moduleTypeCache.get(packageFolder)
-  if (cachedValue != null) return cachedValue
+async function preparePackage (file) {
+  const packageFolder = file.slice(0, file.indexOf('/src/'))
+  if (versionCache.has(packageFolder)) return
 
   // eslint-disable-next-line import/no-dynamic-require, global-require
-  const { type, version } = require(path.join(__dirname, '..', packageFolder, 'package.json'))
-  const typeModule = type === 'module'
+  const { version } = require(path.join(__dirname, '..', packageFolder, 'package.json'))
   if (process.env.FRESH) {
     // in case it hasn't been done before.
     await mkdir(path.join(packageFolder, 'lib'), { recursive: true })
   }
-  moduleTypeCache.set(packageFolder, typeModule)
   versionCache.set(packageFolder, version)
-  return typeModule
 }
 
+const nonJSImport = /^\.\.?\/.+\.([jt]sx|ts)$/
 // eslint-disable-next-line no-shadow
-function transformJSXImportsToJS (path) {
-  const { value } = path.node.source
-  if (value.endsWith('.jsx') && (value.startsWith('./') || value.startsWith('../'))) {
-    // Rewrite .jsx imports to .js:
-    path.node.source.value = value.slice(0, -1) // eslint-disable-line no-param-reassign
+function rewriteNonJSImportsToJS (path) {
+  const match = nonJSImport.exec(path.node.source.value)
+  if (match) {
+    // eslint-disable-next-line no-param-reassign
+    path.node.source.value = `${match[0].slice(0, -match[1].length)}js`
   }
 }
 
@@ -71,7 +67,8 @@ async function buildLib () {
     if (IGNORE.test(file)) {
       continue
     }
-    const libFile = file.replace('/src/', '/lib/').replace(/\.jsx$/, '.js')
+    await preparePackage(file)
+    const libFile = file.replace('/src/', '/lib/').replace(/\.[jt]sx?$/, '.js')
 
     // on a fresh build, rebuild everything.
     if (!process.env.FRESH) {
@@ -85,11 +82,11 @@ async function buildLib () {
       }
     }
 
-    const plugins = await isTypeModule(file) ? [{
+    const plugins = [{
       visitor: {
         // eslint-disable-next-line no-shadow
         ImportDeclaration (path) {
-          transformJSXImportsToJS(path)
+          rewriteNonJSImportsToJS(path)
           if (PACKAGE_JSON_IMPORT.test(path.node.source.value)
               && path.node.specifiers.length === 1
               && path.node.specifiers[0].type === 'ImportDefaultSpecifier') {
@@ -107,15 +104,18 @@ async function buildLib () {
           }
         },
 
-        ExportAllDeclaration: transformJSXImportsToJS,
+        ExportAllDeclaration: rewriteNonJSImportsToJS,
         // eslint-disable-next-line no-shadow
         ExportNamedDeclaration (path) {
           if (path.node.source != null) {
-            transformJSXImportsToJS(path)
+            rewriteNonJSImportsToJS(path)
           }
         },
       },
-    }] : undefined
+    }]
+    const isTSX = file.endsWith('.tsx')
+    if (isTSX || file.endsWith('.ts')) { plugins.push(['@babel/plugin-transform-typescript', { disallowAmbiguousJSXLike: true, isTSX, jsxPragma: 'h' }]) }
+
     const { code, map } = await babel.transformFileAsync(file, { sourceMaps: true, plugins })
     const [{ default: chalk }] = await Promise.all([
       import('chalk'),

+ 41 - 0
bin/build-ts.mjs

@@ -0,0 +1,41 @@
+#!/usr/bin/env node
+
+import { spawn } from 'node:child_process'
+import { once } from 'node:events'
+import { existsSync } from 'node:fs'
+import path from 'node:path'
+import { stdin, env } from 'node:process'
+import { createInterface as readLines } from 'node:readline'
+import { fileURLToPath } from 'node:url'
+
+const fromYarn = 'npm_execpath' in env
+const exe = fromYarn ? env.npm_execpath : 'corepack'
+const argv0 = fromYarn ? [] : ['yarn']
+
+const cwd = fileURLToPath(new URL('../', import.meta.url))
+
+for await (const line of readLines(stdin)) {
+  const { location, name } = JSON.parse(line)
+  if (existsSync(path.join(cwd, location, 'tsconfig.json'))) {
+    const cp = spawn(exe, [...argv0, 'tsc', '-p', location], {
+      stdio: 'inherit',
+      cwd,
+    })
+    await Promise.race([
+      once(cp, 'error').then(err => Promise.reject(err)),
+      await once(cp, 'exit')
+        .then(([code]) => (code && Promise.reject(new Error(`Non-zero exit code when building "${name}": ${code}`)))),
+    ])
+  }
+  if (existsSync(path.join(cwd, location, 'tsconfig.build.json'))) {
+    const cp = spawn(exe, [...argv0, 'tsc', '--build', path.join(cwd, location, 'tsconfig.build.json')], {
+      stdio: 'inherit',
+      cwd,
+    })
+    await Promise.race([
+      once(cp, 'error').then(err => Promise.reject(err)),
+      await once(cp, 'exit')
+        .then(([code]) => (code && Promise.reject(new Error(`Non-zero exit code when building "${name}": ${code}`)))),
+    ])
+  }
+}

+ 22 - 0
e2e/cypress/integration/dashboard-transloadit.spec.ts

@@ -40,6 +40,8 @@ describe('Dashboard with Transloadit', () => {
       cy.get('.uppy-StatusBar-actionBtn--upload').click()
 
       cy.wait(['@createAssemblies']).then(() => {
+        // eslint-disable-next-line
+        // @ts-ignore fix me
         expect(
           Object.values(uppy.getPlugin('Transloadit').activeAssemblies).every(
             (a: any) => a.pollInterval,
@@ -49,6 +51,8 @@ describe('Dashboard with Transloadit', () => {
         uppy.cancelAll()
 
         cy.wait(['@delete']).then(() => {
+          // eslint-disable-next-line
+          // @ts-ignore fix me
           expect(
             Object.values(uppy.getPlugin('Transloadit').activeAssemblies).some(
               (a: any) => a.pollInterval,
@@ -67,6 +71,8 @@ describe('Dashboard with Transloadit', () => {
     const spy = cy.spy()
 
     cy.window().then(({ uppy }) => {
+      // eslint-disable-next-line
+      // @ts-ignore fix me
       uppy.on('transloadit:assembly-cancelled', spy)
 
       cy.get('@file-input').selectFile(
@@ -111,6 +117,8 @@ describe('Dashboard with Transloadit', () => {
     const spy = cy.spy()
 
     cy.window().then(({ uppy }) => {
+      // eslint-disable-next-line
+      // @ts-ignore fix me
       uppy.on('transloadit:assembly-cancelled', spy)
 
       cy.get('@file-input').selectFile(
@@ -141,6 +149,8 @@ describe('Dashboard with Transloadit', () => {
 
       cy.get('.uppy-StatusBar-actionBtn--upload').click()
       cy.wait('@assemblyPolling')
+      // eslint-disable-next-line
+      // @ts-ignore fix me
       expect(
         Object.values(uppy.getPlugin('Transloadit').activeAssemblies).every(
           (a: any) => a.pollInterval,
@@ -148,9 +158,13 @@ describe('Dashboard with Transloadit', () => {
       ).to.equal(true)
 
       const { files } = uppy.getState()
+      // eslint-disable-next-line
+      // @ts-ignore fix me
       uppy.removeFiles(Object.keys(files))
 
       cy.wait('@assemblyDeletion').then(() => {
+        // eslint-disable-next-line
+        // @ts-ignore fix me
         expect(
           Object.values(uppy.getPlugin('Transloadit').activeAssemblies).some(
             (a: any) => a.pollInterval,
@@ -172,14 +186,20 @@ describe('Dashboard with Transloadit', () => {
     cy.get('.uppy-StatusBar-actionBtn--upload').click()
 
     cy.window().then(({ uppy }) => {
+      // eslint-disable-next-line
+      // @ts-ignore fix me
       expect(
         Object.values(uppy.getPlugin('Transloadit').activeAssemblies).length,
       ).to.equal(0)
 
       const { files } = uppy.getState()
+      // eslint-disable-next-line
+      // @ts-ignore fix me
       uppy.removeFiles(Object.keys(files))
 
       cy.wait('@createAssemblies').then(() => {
+        // eslint-disable-next-line
+        // @ts-ignore fix me
         expect(
           Object.values(uppy.getPlugin('Transloadit').activeAssemblies).some(
             (a: any) => a.pollInterval,
@@ -201,6 +221,8 @@ describe('Dashboard with Transloadit', () => {
     cy.get('.uppy-StatusBar-actionBtn--upload').click()
 
     cy.window().then(({ uppy }) => {
+      // eslint-disable-next-line
+      // @ts-ignore fix me
       expect(
         Object.values(uppy.getPlugin('Transloadit').activeAssemblies).length,
       ).to.equal(0)

+ 2 - 0
e2e/cypress/integration/react.spec.ts

@@ -52,6 +52,8 @@ describe('@uppy/react', () => {
   it('should render Drag & Drop in React and create a thumbail with @uppy/thumbnail-generator', () => {
     const spy = cy.spy()
 
+    // eslint-disable-next-line
+    // @ts-ignore fix me
     cy.window().then(({ uppy }) => uppy.on('thumbnail:generated', spy))
     cy.get('@dragdrop-input').selectFile(
       [

+ 0 - 1
e2e/package.json

@@ -49,7 +49,6 @@
     "cypress": "^13.0.0",
     "cypress-terminal-report": "^5.0.0",
     "deep-freeze": "^0.0.1",
-    "execa": "^6.1.0",
     "parcel": "^2.9.3",
     "process": "^0.11.10",
     "prompts": "^2.4.2",

+ 38 - 15
e2e/start-companion-with-load-balancer.mjs

@@ -1,8 +1,9 @@
 #!/usr/bin/env node
 
-import { execa } from 'execa'
+import { spawn } from 'node:child_process'
 import http from 'node:http'
 import httpProxy from 'http-proxy'
+import process from 'node:process'
 
 const numInstances = 3
 const lbPort = 3020
@@ -45,20 +46,42 @@ function createLoadBalancer (baseUrls) {
   return server
 }
 
-const startCompanion = ({ name, port }) => execa('nodemon', [
-  '--watch', 'packages/@uppy/companion/src', '--exec', 'node', '-r', 'dotenv/config', './packages/@uppy/companion/src/standalone/start-server.js',
-], {
-  cwd: new URL('../', import.meta.url),
-  stdio: 'inherit',
-  env: {
-    // Note: these env variables will override anything set in .env
-    COMPANION_PORT: port,
-    COMPANION_SECRET: 'development', // multi instance will not work without secret set
-    COMPANION_PREAUTH_SECRET: 'development', // multi instance will not work without secret set
-    COMPANION_ALLOW_LOCAL_URLS: 'true',
-    COMPANION_LOGGER_PROCESS_NAME: name,
-  },
-})
+const isWindows = process.platform === 'win32'
+const isOSX = process.platform === 'darwin'
+
+const startCompanion = ({ name, port }) => {
+  const cp = spawn(process.execPath, [
+    '-r', 'dotenv/config',
+    // Watch mode support is limited to Windows and macOS at the time of writing.
+    ...(isWindows || isOSX ? ['--watch-path', 'packages/@uppy/companion/src', '--watch'] : []),
+    './packages/@uppy/companion/src/standalone/start-server.js',
+  ], {
+    cwd: new URL('../', import.meta.url),
+    stdio: 'inherit',
+    env: {
+      // Note: these env variables will override anything set in .env
+      ...process.env,
+      COMPANION_PORT: port,
+      COMPANION_SECRET: 'development', // multi instance will not work without secret set
+      COMPANION_PREAUTH_SECRET: 'development', // multi instance will not work without secret set
+      COMPANION_ALLOW_LOCAL_URLS: 'true',
+      COMPANION_LOGGER_PROCESS_NAME: name,
+    },
+  })
+  // Adding a `then` property so the return value is awaitable:
+  return Object.defineProperty(cp, 'then', {
+    __proto__: null,
+    writable: true,
+    configurable: true,
+    value: Promise.prototype.then.bind(new Promise((resolve, reject) => {
+      cp.on('exit', (code) => {
+        if (code === 0) resolve(cp)
+        else reject(new Error(`Non-zero exit code: ${code}`))
+      })
+      cp.on('error', reject)
+    })),
+  })
+}
 
 const hosts = Array.from({ length: numInstances }, (_, index) => {
   const port = companionStartPort + index

+ 2 - 0
e2e/tsconfig.json

@@ -1,5 +1,7 @@
 {
   "compilerOptions": {
+    "moduleResolution": "NodeNext",
+    "noEmit": true,
     "target": "es2020",
     "lib": ["es2020", "dom"],
     "types": ["cypress"]

+ 2 - 2
examples/svelte-example/package.json

@@ -26,9 +26,9 @@
     "rollup-plugin-terser": "^7.0.0",
     "svelte": ">=3.24.0",
     "svelte-check": "^1.6.0",
-    "svelte-preprocess": "^4.6.1",
+    "svelte-preprocess": "^5.0.0",
     "tslib": "^2.0.0",
-    "typescript": "~4.8"
+    "typescript": "~5.1"
   },
   "dependencies": {
     "@uppy/core": "workspace:*",

+ 3 - 1
package.json

@@ -46,6 +46,7 @@
     "@babel/plugin-proposal-optional-chaining": "^7.16.0",
     "@babel/plugin-transform-modules-commonjs": "^7.16.8",
     "@babel/plugin-transform-react-jsx": "^7.10.4",
+    "@babel/plugin-transform-typescript": "^7.22.10",
     "@babel/preset-env": "^7.14.7",
     "@babel/register": "^7.10.5",
     "@babel/types": "^7.17.0",
@@ -106,7 +107,7 @@
     "stylelint-config-standard": "^34.0.0",
     "stylelint-config-standard-scss": "^10.0.0",
     "tar": "^6.1.0",
-    "tsd": "^0.22.0",
+    "tsd": "^0.28.0",
     "typescript": "~5.1",
     "vitest": "^0.34.5",
     "vue-template-compiler": "workspace:*"
@@ -121,6 +122,7 @@
     "build:svelte": "yarn workspace @uppy/svelte build",
     "build:angular": "yarn workspace angular build",
     "build:js": "npm-run-all build:lib build:companion build:locale-pack build:svelte build:angular build:bundle",
+    "build:ts": "yarn workspaces list --no-private --json | yarn node ./bin/build-ts.mjs",
     "build:lib": "yarn node ./bin/build-lib.js",
     "build:locale-pack": "yarn workspace @uppy-dev/locale-pack build && eslint packages/@uppy/locales/src/en_US.js --fix && yarn workspace @uppy-dev/locale-pack test unused",
     "build": "npm-run-all --parallel build:js build:css --serial size",

+ 1 - 1
packages/@uppy/aws-s3/types/index.test-d.ts

@@ -1,4 +1,4 @@
-import { Uppy, UppyFile } from '@uppy/core'
+import { Uppy, type UppyFile } from '@uppy/core'
 import { expectType, expectError } from 'tsd'
 import type { AwsS3Part } from '@uppy/aws-s3-multipart'
 import AwsS3 from '..'

+ 1 - 1
packages/@uppy/companion/package.json

@@ -89,7 +89,7 @@
     "jest": "^29.0.0",
     "nock": "^13.1.3",
     "supertest": "6.2.4",
-    "typescript": "~4.8"
+    "typescript": "~5.1"
   },
   "files": [
     "bin/",

+ 1 - 0
packages/@uppy/core/src/Uppy.test.js

@@ -13,6 +13,7 @@ import AcquirerPlugin2 from './mocks/acquirerPlugin2.js'
 import InvalidPlugin from './mocks/invalidPlugin.js'
 import InvalidPluginWithoutId from './mocks/invalidPluginWithoutId.js'
 import InvalidPluginWithoutType from './mocks/invalidPluginWithoutType.js'
+// @ts-ignore trying to import a file from outside the package
 import DeepFrozenStore from '../../../../e2e/cypress/fixtures/DeepFrozenStore.mjs'
 
 // eslint-disable-next-line no-restricted-globals

+ 1 - 1
packages/@uppy/google-drive/types/index.test-d.ts

@@ -1,4 +1,4 @@
-import Uppy, { UIPlugin, UIPluginOptions } from '@uppy/core'
+import Uppy, { UIPlugin, type UIPluginOptions } from '@uppy/core'
 import GoogleDrive from '..'
 
 class SomePlugin extends UIPlugin<UIPluginOptions> {}

+ 0 - 1
packages/@uppy/provider-views/src/ProviderView/ProviderView.jsx

@@ -1,5 +1,4 @@
 import { h } from 'preact'
-// eslint-disable-next-line import/no-unresolved
 import PQueue from 'p-queue'
 
 import { getSafeFileId } from '@uppy/utils/lib/generateFileID'

+ 10 - 0
packages/uppy/tsconfig.json

@@ -0,0 +1,10 @@
+{
+  "extends": "../../tsconfig.shared",
+  "compilerOptions": {
+    "allowJs": true,
+    "emitDeclarationOnly": false,
+    "skipLibCheck": true,
+    "noEmit": true
+  },
+  "include": ["types/*"]
+}

+ 2 - 1
private/dev/vite.config.js

@@ -21,6 +21,7 @@ const config = {
     },
   },
   esbuild: {
+    jsx: 'transform',
     jsxFactory: 'h',
     jsxFragment: 'Fragment',
   },
@@ -32,7 +33,7 @@ const config = {
       },
       {
         find: /^@uppy\/([^/]+)$/,
-        replacement: `${PACKAGES_ROOT}@uppy/$1/src/index.js`,
+        replacement: `${PACKAGES_ROOT}@uppy/$1/src/index`,
       },
       {
         find: /^@uppy\/([^/]+)\/lib\/(.+)$/,

+ 111 - 0
private/js2ts/index.mjs

@@ -0,0 +1,111 @@
+#!/usr/bin/env node
+
+/**
+ * This script can be used to initiate the transition for a plugin from ESM source to
+ * TS source. It will rename the files, update the imports, and add a `tsconfig.json`.
+ */
+
+import { opendir, readFile, open, writeFile, rm } from 'node:fs/promises'
+import { argv } from 'node:process'
+import { extname } from 'node:path'
+import { existsSync } from 'node:fs'
+
+const packageRoot = new URL(`../../packages/${argv[2]}/`, import.meta.url)
+let dir
+
+try {
+  dir = await opendir(new URL('./src/', packageRoot), { recursive: true })
+} catch (cause) {
+  throw new Error(`Unable to find package "${argv[2]}"`, { cause })
+}
+const packageJSON = JSON.parse(
+  await readFile(new URL('./package.json', packageRoot), 'utf-8'),
+)
+
+if (packageJSON.type !== 'module') {
+  throw new Error('Cannot convert non-ESM package to TS')
+}
+
+const references = Object.keys(packageJSON.dependencies || {})
+  .concat(Object.keys(packageJSON.peerDependencies || {}))
+  .filter((pkg) => pkg.startsWith('@uppy/'))
+  .map((pkg) => ({ path: `../${pkg.slice('@uppy/'.length)}` }))
+
+const depsNotYetConvertedToTS = references.filter(
+  (ref) =>
+    !existsSync(new URL(`${ref.path.slice(1)}/tsconfig.json`, packageRoot)),
+)
+
+if (depsNotYetConvertedToTS.length) {
+  // We need to first convert the dependencies, otherwise we won't be working with the correct types.
+  throw new Error('Some dependencies have not yet been converted to TS', {
+    cause: depsNotYetConvertedToTS.map((ref) =>
+      ref.path.replace(/^\.\./, '@uppy'),
+    ),
+  })
+}
+
+let tsConfig
+try {
+  tsConfig = await open(new URL('./tsconfig.json', packageRoot), 'wx')
+} catch (cause) {
+  throw new Error('It seems this package has already been transitioned to TS', {
+    cause,
+  })
+}
+
+for await (const dirent of dir) {
+  if (!dirent.isDirectory()) {
+    const { path: filepath } = dirent
+    const ext = extname(filepath)
+    await writeFile(
+      filepath.replace(ext, ext.replace('js', 'ts')),
+      (await readFile(filepath, 'utf-8')).replace(
+        /((?:^|\n)import[^\n]*["']\.\.?\/[^'"]+\.)js(x?["'])/g,
+        '$1ts$2',
+      ),
+    )
+    await rm(filepath)
+  }
+}
+
+await tsConfig.writeFile(
+  `${JSON.stringify(
+    {
+      extends: '../../../tsconfig.shared',
+      compilerOptions: {
+        emitDeclarationOnly: false,
+        noEmit: true,
+      },
+      include: ['./package.json', './src/**/*.'],
+      references,
+    },
+    undefined,
+    2,
+  )}\n`,
+)
+
+await tsConfig.close()
+
+await writeFile(
+  new URL('./tsconfig.build.json', import.meta.url),
+  `${JSON.stringify(
+    {
+      extends: '../../../tsconfig.shared',
+      compilerOptions: {
+        outDir: './lib',
+        rootDir: './src',
+        resolveJsonModule: false,
+        noImplicitAny: false,
+        skipLibCheck: true,
+      },
+      include: ['./src/**/*.'],
+      exclude: ['./src/**/*.test.ts'],
+      references,
+    },
+    undefined,
+    2,
+  )}\n`,
+)
+
+console.log('Done')

+ 1 - 1
private/remark-lint-uppy/package.json

@@ -28,7 +28,7 @@
     "retext-quotes": "^5.0.0",
     "retext-simplify": "^7.0.0",
     "retext-syntax-mentions": "^3.1.0",
-    "unified": "^10.0.0",
+    "unified": "^11.0.0",
     "unified-message-control": "^4.0.0"
   },
   "type": "module",

+ 0 - 23
tsconfig.json

@@ -1,23 +0,0 @@
-{
-  "compilerOptions": {
-    "target": "esnext",
-    "module": "commonjs",
-    "lib": ["dom", "esnext"],
-    "resolveJsonModule": true,
-    "allowJs": true,
-    "noImplicitAny": true,
-    "noImplicitThis": true,
-    "strictNullChecks": true,
-    "types": [],
-    "noEmit": true,
-    "esModuleInterop": true,
-    "allowSyntheticDefaultImports": false,
-    "strictFunctionTypes": true,
-    "forceConsistentCasingInFileNames": true
-  },
-  "include": [
-    "packages/*/types/index.d.ts",
-    "packages/@uppy/*/types/index.d.ts"
-  ],
-  "exclude": ["packages/@uppy/companion"]
-}

+ 25 - 0
tsconfig.shared.json

@@ -0,0 +1,25 @@
+{
+  "compilerOptions": {
+    "composite": true,
+    "incremental": true,
+    "target": "ESnext",
+    "module": "ESNext",
+    "moduleResolution": "Bundler",
+    "lib": ["dom", "ESnext"],
+    "resolveJsonModule": true,
+    "allowImportingTsExtensions": true,
+    "allowJs": false,
+    "declaration": true,
+    "emitDeclarationOnly": true,
+    "declarationMap": true,
+    "jsx": "preserve",
+    "noImplicitAny": true,
+    "noImplicitThis": true,
+    "strictNullChecks": true,
+    "verbatimModuleSyntax": true,
+    "esModuleInterop": true,
+    "allowSyntheticDefaultImports": true,
+    "strictFunctionTypes": true,
+    "forceConsistentCasingInFileNames": true
+  }
+}

La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 56 - 603
yarn.lock


Algunos archivos no se mostraron porque demasiados archivos cambiaron en este cambio