'use strict';

var path = require('path');

const defaultIndex = {
  mount: ".",
  path: "src/index.ts",
  name: "index",
  ext: ".ts"
};
function parseEntryPoint(mount, path$1) {
  let name = mount;
  if (name === ".") {
    name = "index";
  } else if (name.startsWith("./")) {
    name = name.slice(2);
  }
  if (name.includes("/")) {
    throw new Error(`Mount point '${mount}' may not contain multiple slashes`);
  }
  return { mount, path: path$1, name, ext: path.extname(path$1) };
}
function readEntryPoints(pkg) {
  const exp = pkg.exports;
  if (typeof exp === "string") {
    return [defaultIndex];
  } else if (exp && typeof exp === "object" && !Array.isArray(exp)) {
    const entryPoints = new Array();
    for (const mount of Object.keys(exp)) {
      const path = exp[mount];
      if (typeof path !== "string") {
        throw new Error(
          `Exports field value must be a string, got '${JSON.stringify(path)}'`
        );
      }
      entryPoints.push(parseEntryPoint(mount, path));
    }
    return entryPoints;
  }
  return [defaultIndex];
}

exports.readEntryPoints = readEntryPoints;
//# sourceMappingURL=entryPoints-CoHH4lBA.cjs.js.map
