Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: introduce tsup for bundling (#25)
* chore: introduce tsup for bundling Added the package `tsup` to assist in bundling `@mswjs/source`-package so it both supports CommonJS and ESM modules. The `package.json` file has been modified so the appropriate properties for the modern `exports`-approach of exporting, and the older `main`-`module` combination. During building and running the tests the `fromOpenApi` had issues to pass the tests or build due to the way the `SwaggerParser` utility class was exporter. The code has been updated so it refers to the `deferences`-function via `SwaggerParser.deferences()` instead of trying to instantiate the class. For this reason the `tsconfig.json` has been updated so that it enables `esModuleInterop` and `allowSyntheticDefaultImports` after this change the package build and bundled successfully with `tsup` and passed the unit tests, before errors like below were shown: src/fromOpenApi/fromOpenApi.ts:16:35 - error TS2351: This expression is not constructable. Type 'typeof SwaggerParser' has no construct signatures. 16 const specification = await new SwaggerParser().dereference(document) ~~~~~~~~~~~~~ * chore: remove unused scripts * chore: use "tsup" for local development Co-authored-by: Weyert de Boer <weyert@innerfuse.biz> Co-authored-by: Artem Zakharchenko <kettanaito@gmail.com>
- Loading branch information