Repositorio del curso CCOM4030 el semestre B91 del proyecto Artesanías con el Instituto de Cultura

index.js 824B

1234567891011121314151617181920212223
  1. // When on node 14, it validates that all of the commonjs exports
  2. // are correctly re-exported for es modules importers.
  3. const nodeMajor = Number(process.version.split(".")[0].slice(1))
  4. if (nodeMajor < 14) {
  5. console.log("Skipping because node does not support module exports.")
  6. process.exit(0)
  7. }
  8. // ES Modules import via the ./modules folder
  9. import * as esTSLib from "../../modules/index.js"
  10. // Force a commonjs resolve
  11. import { createRequire } from "module";
  12. const commonJSTSLib = createRequire(import.meta.url)("../../tslib.js");
  13. for (const key in commonJSTSLib) {
  14. if (commonJSTSLib.hasOwnProperty(key)) {
  15. if(!esTSLib[key]) throw new Error(`ESModules is missing ${key} - it needs to be re-exported in ./modules/index.js`)
  16. }
  17. }
  18. console.log("All exports in commonjs are available for es module consumers.")