Closed robertkiel closed 2 years ago
@robertkiel can you get the build to pass?
@robertkiel can you get the build to pass?
Yes, for sure. Currently awaiting the final release of Typescript 4.7 to have proper builds. Will add some commits in the next days.
Managed to squeeze the last burning issue regarding default exports of CommonJS scripts and default exports of ECMAScript modules. Tests are supposed to run green now.
thank you @robertkiel !! huge lift!
Still WIP, postponed until release of Typescript 4.7Adds support for ESM-based projects
Main change:
https://github.com/hoprnet/open-api/blob/4d00559ee5e445f1f176f494ebcc4a9e26da978c/packages/openapi-framework/index.ts#L233-L236
Context
Within the Node.js ecosystem, there exist two package formats, CommonJS and the new de-facto standard ECMAScript Modules aka ESM.
CommonJS modues are usually loaded synchronously using
require()
, whereas ES modules are loaded either using theimport
keyword or are loaded dynamically, but asynchronously, using the builtinimport()
function.To support loading both types of modules, the de-facto way to go is using
import()
as it supports both formats, CommonJS and ESM. Changing this turns various synchronous functions into asynchronous ones.Changes
openapi-framework
, change fromrequire
toimport
of modules