Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Convert first file to TypeScript * Transpile using TypeScript * Remove Babel * Add back missing dependencies for ESLint * Move eslint exceptions into .eslintrc * Move logger.js to TypeScript * Rename tsconfig-base.json to tsconfig.json * Move upload.js to TypeScript * Move all node-related source files to TypeScript * Move browser source code to TypeScript * Lint * Add linting rules for TypeScript * Remove obsolete type definitions * Properly transpile to ESM and CJS * Fix build command * Restructure exports in `package.json` I mainly followed the recommendations from https://github.com/frehner/modern-guide-to-packaging-js-library with one exception: We don't use `browser` anymore, but consider the browser-versions the default. Node 12+ will automatically resolve to the node-version as it supports the new `exports` syntax. `arethetypeswrong` and `publint` are also happy: ``` $ npx @arethetypeswrong/cli --pack . tus-js-client v4.1.0 Build tools: - typescript@^5.4.5 No problems found 🌟 ┌───────────────────┬─────────────────┬──────────────────────────────┐ │ │ "tus-js-client" │ "tus-js-client/package.json" │ ├───────────────────┼─────────────────┼──────────────────────────────┤ │ node10 │ 🟢 │ 🟢 (JSON) │ ├───────────────────┼─────────────────┼──────────────────────────────┤ │ node16 (from CJS) │ 🟢 (CJS) │ 🟢 (JSON) │ ├───────────────────┼─────────────────┼──────────────────────────────┤ │ node16 (from ESM) │ 🟢 (ESM) │ 🟢 (JSON) │ ├───────────────────┼─────────────────┼──────────────────────────────┤ │ bundler │ 🟢 │ 🟢 (JSON) │ └───────────────────┴─────────────────┴──────────────────────────────┘ $ npx publint tus-js-client lint results: All good! ``` * Keep main pointing to Node index * Remove ESLint comments * Remove typescript-eslint * Remove Babel (again) * Remove empty line * Revert to original structure in `package.json` * Remove `tsd` * Rename `lib.es5` to more appropriate `lib.cjs` * Explicitly install `types/node` It was previously only provided through a transitive dependency on puppeteer and karma * Move types and values for options in own file * Remove `unknown` type for timeout value * Remove generics to unify the types for Browser and Node.js * Better detect input types for fingerprinting * Move to TypeScript: Upload, StreamSource (#734) * browser StreamSource TS * TS upload and options * Remove whitespace * Fix type of default options * Only pass strings to `HttpRequest#setHeader` (#709) * setHeader value arg should be string * Explicit casting of header values, number to string * Fix syntax * Fix lint --------- Co-Authored-By: Marius Kleidl <[email protected]> * Fix error emission Co-Authored-By: Marius Kleidl <[email protected]> * Allows `bytesTotal` to be null for progress events Co-Authored-By: Marius Kleidl <[email protected]> --------- Co-authored-by: Matthew Holloway <Matthew Holloway> Co-authored-by: Marius Kleidl <[email protected]> Co-authored-by: dragan_d_dragon <[email protected]> * Error message for React Native environments * Comment for TODO * Rename classes and files for file sources * Remove comment about exports syntax That comment is no longer valid since we switched from CommonJS exports to ESM exports in bdb6144. --------- Co-authored-by: Matthew Holloway <[email protected]> Co-authored-by: dragan_d_dragon <[email protected]>
- Loading branch information