esmHelpers.js 778 B

12345678910111213141516171819
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.unwrapJavascript = exports.unwrapTypescript = void 0;
  4. /** Typescript thinks import('...js/.d.ts') needs mod.default.default */
  5. function fakeUnwrapDefault(mod) {
  6. // console.log("fakeUnwrapDefault", mod)
  7. return mod.default;
  8. }
  9. /** Typescript thinks import('...ts') doesn't need mod.default.default, but does */
  10. function actualUnwrapDefault(mod) {
  11. // console.log("actualUnwrapDefault", mod)
  12. const maybeUnwrap = mod.default;
  13. return maybeUnwrap ?? mod;
  14. }
  15. // I'm not sure if this behavior is needed in all runtimes,
  16. // or just for mocha + ts-node.
  17. exports.unwrapTypescript = actualUnwrapDefault;
  18. exports.unwrapJavascript = fakeUnwrapDefault;
  19. //# sourceMappingURL=esmHelpers.js.map