"use strict"; var __create = Object.create; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __getProtoOf = Object.getPrototypeOf; var __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( // If the importer is in node compatibility mode or this is not an ESM // file that has been converted to a CommonJS file using a Babel- // compatible transform (i.e. "__esModule" has not been set), then set // "default" to the CommonJS "module.exports" for node compatibility. isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod )); var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); // src/index.ts var src_exports = {}; __export(src_exports, { interfaceVersion: () => interfaceVersion, resolve: () => resolve }); module.exports = __toCommonJS(src_exports); var import_node_module = require("module"); var import_node_path2 = require("path"); var import_oxc_resolver = require("oxc-resolver"); // src/normalizeOptions.ts var import_node_fs = __toESM(require("fs"), 1); var import_node_path = __toESM(require("path"), 1); var import_node_process = require("process"); var defaultOptions = { aliasFields: [ ["browser"] ], conditionNames: [ "default", "types", "import", "require", "node", "node-addons", "browser", // APF: https://angular.io/guide/angular-package-format "esm2020", "es2020", "es2015" ], extensionAlias: { ".js": [ ".ts", // `.tsx` can also be compiled as `.js` ".tsx", ".d.ts", ".js" ], ".jsx": [".tsx", ".d.ts", ".jsx"], ".cjs": [".cts", ".d.cts", ".cjs"], ".mjs": [".mts", ".d.mts", ".mjs"] }, extensions: [ ".ts", ".tsx", ".d.ts", ".js", ".jsx", ".json", ".node" ], mainFields: [ "types", "typings", // APF: https://angular.io/guide/angular-package-format "fesm2020", "fesm2015", "esm2020", "es2020", "main", "module", "browser", "jsnext:main" ], roots: [(0, import_node_process.cwd)()] }; function normalizeOptions(options = {}) { if (!options?.tsconfig) { const configFile = import_node_path.default.resolve((0, import_node_process.cwd)(), "./tsconfig.json"); if (import_node_fs.default.existsSync(configFile)) { defaultOptions.tsconfig = { configFile, references: "auto" }; } } return { ...defaultOptions, ...options }; } // src/index.ts var resolver; function resolve(source, file, options = {}) { if ((0, import_node_module.isBuiltin)(source)) return { found: true, path: null }; if (!resolver) { options = normalizeOptions(options); resolver = new import_oxc_resolver.ResolverFactory(options); } const result = resolver.sync((0, import_node_path2.dirname)(file), source); return { found: !!result.path, path: result.path }; } var interfaceVersion = 2; // Annotate the CommonJS export names for ESM import in node: 0 && (module.exports = { interfaceVersion, resolve });