@r_masseater/vite-plus-adopt 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -69
- package/dist/attempt-B93fjWiJ.mjs.map +1 -1
- package/dist/attw.mjs.map +1 -1
- package/dist/cli.mjs +45 -17
- package/dist/cli.mjs.map +1 -1
- package/dist/{config-BdAPwzCc.mjs → config-BR_LIdmG.mjs} +3 -1
- package/dist/config-BR_LIdmG.mjs.map +1 -0
- package/dist/fsd.d.mts +3 -3
- package/dist/fsd.mjs +2 -1
- package/dist/fsd.mjs.map +1 -1
- package/dist/index.d.mts +5 -3
- package/dist/index.mjs +1 -1
- package/dist/{install-C-6lZ_z7.mjs → install-D6kuA6Oe.mjs} +7 -2
- package/dist/install-D6kuA6Oe.mjs.map +1 -0
- package/dist/json-D-rhjlSM.mjs.map +1 -1
- package/dist/postinstall.mjs +1 -1
- package/dist/{types-LygeEwCK.d.mts → types-D-w4yqEn.d.mts} +2 -1
- package/package.json +11 -11
- package/dist/config-BdAPwzCc.mjs.map +0 -1
- package/dist/install-C-6lZ_z7.mjs.map +0 -1
package/dist/attw.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attw.mjs","names":["DATA_FIRST_ARITY","EMPTY","Fn","Arr","DATA_FIRST_ARITY","DATA_FIRST_ARITY_3","Str","escapeLeadingUnderscores","Fn","DATA_FIRST_ARITY","Fn","escapeLeadingUnderscores","isRequireCall","DATA_FIRST_ARITY","Arr","Fn","DATA_FIRST_ARITY","Fn","declarationOfBinding","escapeLeadingUnderscores","DATA_FIRST_ARITY","Str","Arr","Fn","DATA_FIRST_ARITY_3","START","Fn","Str","FIRST","NEXT","Str","DATA_FIRST_ARITY","SEPARATOR","ROOT_LENGTH","NOT_FOUND","FIRST","SECOND","Str","Arr","Fn","forEachAncestorDirectory","DATA_FIRST_ARITY_3","EMPTY","Fn","Rec","DATA_FIRST_ARITY","RANGE_OPTIONS","Rec","Arr","Fn","DATA_FIRST_ARITY","DATA_FIRST_ARITY_3","Fn","DATA_FIRST_ARITY","DATA_FIRST_ARITY_3","EXPORT_PROPERTY","EXPORT_ALIAS","Str","Fn","escapeLeadingUnderscores","DATA_FIRST_ARITY","Arr","Fn","Arr","DATA_FIRST_ARITY_3","Arr","Fn","DATA_FIRST_ARITY_3","Arr","Fn","DATA_FIRST_ARITY","Fn","isRequireCall","Fn","Arr","ALIAS","DATA_FIRST_ARITY_3","isRequireCall","Fn","Arr","Arr","DATA_FIRST_ARITY","Arr","Fn","Str","DATA_FIRST_ARITY","Fn","packageJsonScopeOf","DATA_FIRST_ARITY","DATA_FIRST_ARITY_3","Arr","packageJsonScopeOf","getModeForUsageLocation","Fn","DATA_FIRST_ARITY_3","START","SECOND","Str","Arr","Fn","Rec","modeForUsage","getNameOfAccessExpression","DATA_FIRST_ARITY","NEXT","START","Str","Fn","DATA_FIRST_ARITY","Str","Arr","Fn","forEachAncestor","assignment","cjsParse","isModuleExports","getNameOfAccessExpression","entrypointResolutions","moduleKindDisagreement","exportDefaultDisagreement","namedExports","cjsOnlyExportsDefault","unexpectedModuleSyntax","internalResolutionError","Arr","DATA_FIRST_ARITY","Arr","escapeSymbolName","Fn","escapeLeadingUnderscores","Arr","NONE","escapeSymbolName","Arr","DATA_FIRST_ARITY","DATA_FIRST_ARITY_3","EMPTY","Str","reuseCachedWithTrace","Fn","forEachAncestorDirectory","Rec","Arr","DATA_FIRST_ARITY","DATA_FIRST_ARITY_3","STAR_LENGTH","START","Str","Fn","Arr","DATA_FIRST_ARITY","DATA_FIRST_ARITY_3","Fn","Arr","Str","DATA_FIRST_ARITY_3","EMPTY","Str","Arr","Rec","Fn","DATA_FIRST_ARITY_3","DATA_FIRST_ARITY","Str","Rec","Arr","Fn","DATA_FIRST_ARITY","START","Str","Arr","Fn","Rec","DATA_FIRST_ARITY","Fn","START","Str","DATA_FIRST_ARITY","DATA_FIRST_ARITY_3","Fn","Arr","DATA_FIRST_ARITY","Fn","DATA_FIRST_ARITY","DATA_FIRST_ARITY_3","EMPTY","Fn","DATA_FIRST_ARITY_3","Rec","Fn","DATA_FIRST_ARITY","EMPTY","Arr","forEachAncestorDirectory","Fn","DATA_FIRST_ARITY","DATA_FIRST_ARITY_3","EMPTY","Str","Fn","DATA_FIRST_ARITY","Arr","Fn","featuresFor","conditionsFor","DATA_FIRST_ARITY_3","Str","Fn","Arr","DATA_FIRST_ARITY","OUTSIDE_NODE_MODULES","Fn","DATA_FIRST_ARITY_3","MAX_NODE_MODULE_JS_DEPTH","TS_EXTENSIONS","JS_EXTENSIONS","Str","Arr","getModeForUsageLocation","Fn","DATA_FIRST_ARITY_3","Str","Arr","Fn","DATA_FIRST_ARITY","Fn","DATA_FIRST_ARITY","Fn","Str","Str","DATA_FIRST_ARITY","Arr","Fn","DATA_FIRST_ARITY","Fn","DATA_FIRST_ARITY","Fn","Fn","Arr","initCjsLexer","checks"],"sources":["../src/attw/flags.ts","../src/attw/binder-symbols.ts","../src/attw/binder-syntax.ts","../src/attw/binder-assignment.ts","../src/attw/binder-names.ts","../src/attw/messages.ts","../src/attw/text-search.ts","../src/attw/path-roots.ts","../src/attw/paths.ts","../src/attw/package-json-fields.ts","../src/attw/types-versions.ts","../src/attw/binder-declarations.ts","../src/attw/binder-cjs.ts","../src/attw/binder-scopes.ts","../src/attw/binder-jsdoc.ts","../src/attw/binder-expando-symbol.ts","../src/attw/binder-expando.ts","../src/attw/binder-module-exports.ts","../src/attw/binder-this.ts","../src/attw/binder-expressions.ts","../src/attw/binder-module-state.ts","../src/attw/binder-nodes.ts","../src/attw/binder-variables.ts","../src/attw/binder-walk.ts","../src/attw/binder.ts","../src/attw/extensions.ts","../src/attw/source-file.ts","../src/attw/module-mode.ts","../src/attw/resolution-mode-numbers.ts","../src/attw/ts-api.ts","../src/attw/typescript-files.ts","../src/attw/typescript-guards.ts","../src/attw/package-names.ts","../src/attw/path-compare.ts","../src/attw/typescript-paths.ts","../src/attw/typescript.ts","../upstream/attw-core/lib/internal/defineCheck.js","../upstream/attw-core/lib/internal/checks/cjsOnlyExportsDefault.js","../upstream/attw-core/lib/utils.js","../upstream/attw-core/lib/createPackage.js","../upstream/attw-core/lib/internal/esm/esmBindings.js","../upstream/attw-core/lib/internal/esm/cjsBindings.js","../upstream/attw-core/lib/internal/esm/resolve.js","../upstream/attw-core/lib/internal/esm/cjsNamespace.js","../upstream/attw-core/lib/internal/esm/esmNamespace.js","../upstream/attw-core/lib/internal/checks/namedExports.js","../upstream/attw-core/lib/internal/checks/entrypointResolutions.js","../upstream/attw-core/lib/internal/getProbableExports.js","../upstream/attw-core/lib/internal/checks/exportDefaultDisagreement.js","../upstream/attw-core/lib/internal/checks/internalResolutionError.js","../upstream/attw-core/lib/internal/checks/moduleKindDisagreement.js","../upstream/attw-core/lib/internal/checks/unexpectedModuleSyntax.js","../upstream/attw-core/lib/internal/checks/index.js","../upstream/attw-core/lib/internal/minimalLibDts.js","../src/attw/checker-session.ts","../src/attw/checker-symbols.ts","../src/attw/type-only.ts","../src/attw/checker.ts","../src/attw/package-json.ts","../src/attw/resolver-patterns.ts","../src/attw/resolver-files.ts","../src/attw/resolver-target.ts","../src/attw/resolver-exports.ts","../src/attw/paths-mapping.ts","../src/attw/resolver-directory.ts","../src/attw/node-modules-paths.ts","../src/attw/resolver-state.ts","../src/attw/resolver-relative.ts","../src/attw/resolver-package-loader.ts","../src/attw/resolver-package.ts","../src/attw/resolver-node-modules.ts","../src/attw/resolver-attempt.ts","../src/attw/resolver.ts","../src/attw/compiler-checker.ts","../src/attw/host-types.ts","../src/attw/program-build.ts","../src/attw/program-imports.ts","../src/attw/program.ts","../src/attw/compiler-program.ts","../src/attw/resolution-cache.ts","../src/attw/host-resolutions.ts","../src/attw/compiler-host-wrapper.ts","../src/attw/host-files.ts","../src/attw/host-sources.ts","../src/attw/type-reference-state.ts","../src/attw/type-reference.ts","../src/attw/host-wrapper.ts","../src/attw/compiler-hosts.ts","../upstream/attw-core/lib/internal/getEntrypointInfo.js","../upstream/attw-core/lib/checkPackage.js"],"sourcesContent":["import { Array as Arr, Function as Fn } from \"effect\";\n\nconst DATA_FIRST_ARITY = 2;\n\nconst EMPTY = 0;\nconst SET_BIT = 1;\nconst BINARY = 2;\n\nconst sharedFlags = (left: number, right: number): number => {\n if (left === EMPTY || right === EMPTY) {\n return EMPTY;\n }\n const lowest = Number(left % BINARY === SET_BIT && right % BINARY === SET_BIT);\n return lowest + BINARY * sharedFlags(Math.floor(left / BINARY), Math.floor(right / BINARY));\n};\n\nconst hasFlag: {\n (mask: number): (flags: number) => boolean;\n (flags: number, mask: number): boolean;\n} = Fn.dual(\n DATA_FIRST_ARITY,\n (flags: number, mask: number): boolean => sharedFlags(flags, mask) !== EMPTY,\n);\n\nconst withFlags: {\n (mask: number): (flags: number) => number;\n (flags: number, mask: number): number;\n} = Fn.dual(\n DATA_FIRST_ARITY,\n (flags: number, mask: number): number => flags + mask - sharedFlags(flags, mask),\n);\n\nconst withoutFlags: {\n (mask: number): (flags: number) => number;\n (flags: number, mask: number): number;\n} = Fn.dual(\n DATA_FIRST_ARITY,\n (flags: number, mask: number): number => flags - sharedFlags(flags, mask),\n);\n\nconst combineFlags = (...masks: readonly number[]): number => Arr.reduce(masks, EMPTY, withFlags);\n\nexport { EMPTY, combineFlags, hasFlag, withFlags, withoutFlags };\n","import { Option, Predicate, String as Str, Function as Fn } from \"effect\";\nimport { NodeFlags, ScriptKind, SyntaxKind } from \"typescript/ast\";\nimport type { Node } from \"typescript/ast\";\nimport { isSourceFile } from \"typescript/ast/is\";\nimport { SymbolFlags } from \"typescript/sync\";\n\nimport { EMPTY, combineFlags, hasFlag, withFlags } from \"./flags.ts\";\n\nconst DATA_FIRST_ARITY = 2;\nconst DATA_FIRST_ARITY_3 = 3;\n\ninterface BoundSymbol {\n flags: number;\n readonly escapedName: string;\n readonly name: string;\n declarations?: Node[];\n valueDeclaration?: Node;\n exports?: SymbolTable;\n members?: SymbolTable;\n parent?: BoundSymbol;\n exportSymbol?: BoundSymbol;\n}\n\ninterface SymbolTable extends Map<string, BoundSymbol> {}\n\ninterface SymbolDeclaration {\n readonly table: Option.Option<SymbolTable>;\n readonly parent: Option.Option<BoundSymbol>;\n readonly node: Node;\n readonly name: Option.Option<string>;\n readonly includes: number;\n readonly excludes: number;\n}\n\nconst UNDERSCORE = \"_\";\nconst DOUBLE_UNDERSCORE = \"__\";\nconst TRIPLE_UNDERSCORE = \"___\";\nconst MISSING_NAME = \"__missing\";\n\nconst unescapeLeadingUnderscores = (name: string): string => {\n if (Str.startsWith(TRIPLE_UNDERSCORE)(name)) {\n return Str.slice(UNDERSCORE.length)(name);\n }\n return name;\n};\n\nconst escapeLeadingUnderscores = (name: string): string => {\n if (Str.startsWith(DOUBLE_UNDERSCORE)(name)) {\n return `${UNDERSCORE}${name}`;\n }\n return name;\n};\n\nconst createSymbol: {\n (escapedName: string): (flags: number) => BoundSymbol;\n (flags: number, escapedName: string): BoundSymbol;\n} = Fn.dual(DATA_FIRST_ARITY, (flags: number, escapedName: string): BoundSymbol => ({\n flags,\n escapedName,\n name: unescapeLeadingUnderscores(escapedName),\n}));\n\nconst isInJsFileNode = (node: Node): boolean => {\n let current = node;\n while (!isSourceFile(current)) {\n current = current.parent;\n }\n return current.scriptKind === ScriptKind.JS || current.scriptKind === ScriptKind.JSX;\n};\n\nconst isAmbientNode = (node: Node): boolean => hasFlag(node.flags, NodeFlags.Ambient);\n\nconst ASSIGNMENT_DECLARATION_KINDS: ReadonlySet<SyntaxKind> = new Set([\n SyntaxKind.BinaryExpression,\n SyntaxKind.PropertyAccessExpression,\n SyntaxKind.ElementAccessExpression,\n SyntaxKind.Identifier,\n SyntaxKind.CallExpression,\n]);\n\nconst isAssignmentDeclarationNode = (node: Node): boolean =>\n ASSIGNMENT_DECLARATION_KINDS.has(node.kind);\n\nconst isEffectiveModuleDeclaration = (node: Node): boolean =>\n node.kind === SyntaxKind.ModuleDeclaration || node.kind === SyntaxKind.Identifier;\n\nconst isAmbientOverride = (existing: Node, node: Node): boolean =>\n isAmbientNode(node) && !isInJsFileNode(node) && !isAmbientNode(existing);\n\nconst replacesAssignmentDeclaration = (existing: Node, node: Node): boolean =>\n !isAmbientOverride(existing, node) &&\n isAssignmentDeclarationNode(existing) &&\n !isAssignmentDeclarationNode(node);\n\nconst replacesModuleDeclaration = (existing: Node, node: Node): boolean =>\n existing.kind !== node.kind && isEffectiveModuleDeclaration(existing);\n\nconst replacesValueDeclaration = (existing: Node, node: Node): boolean =>\n replacesAssignmentDeclaration(existing, node) || replacesModuleDeclaration(existing, node);\n\nconst setValueDeclaration: {\n (node: Node): (symbol: BoundSymbol) => void;\n (symbol: BoundSymbol, node: Node): void;\n} = Fn.dual(DATA_FIRST_ARITY, (symbol: BoundSymbol, node: Node): void => {\n const existing = symbol.valueDeclaration;\n if (Predicate.isUndefined(existing) || replacesValueDeclaration(existing, node)) {\n symbol.valueDeclaration = node;\n }\n});\n\nconst EXPORT_TABLE_FLAGS = combineFlags(\n SymbolFlags.Class,\n SymbolFlags.Enum,\n SymbolFlags.Module,\n SymbolFlags.Variable,\n);\n\nconst MEMBER_TABLE_FLAGS = combineFlags(\n SymbolFlags.Class,\n SymbolFlags.Interface,\n SymbolFlags.TypeLiteral,\n SymbolFlags.ObjectLiteral,\n);\n\nconst recordDeclaration = (symbol: BoundSymbol, node: Node): void => {\n const declarations = symbol.declarations ?? [];\n if (!declarations.includes(node)) {\n declarations.push(node);\n }\n symbol.declarations = declarations;\n};\n\nconst DECLARATION_EFFECTS: readonly (readonly [\n required: number,\n apply: (symbol: BoundSymbol, node: Node) => void,\n])[] = [\n [\n EXPORT_TABLE_FLAGS,\n (symbol) => {\n symbol.exports ??= new Map();\n },\n ],\n [\n MEMBER_TABLE_FLAGS,\n (symbol) => {\n symbol.members ??= new Map();\n },\n ],\n [\n SymbolFlags.Value,\n (symbol, node) => {\n setValueDeclaration(symbol, node);\n },\n ],\n];\n\nconst addDeclarationToSymbol: {\n (node: Node, flags: number): (symbol: BoundSymbol) => void;\n (symbol: BoundSymbol, node: Node, flags: number): void;\n} = Fn.dual(DATA_FIRST_ARITY_3, (symbol: BoundSymbol, node: Node, flags: number): void => {\n symbol.flags = withFlags(symbol.flags, flags);\n recordDeclaration(symbol, node);\n for (const [required, apply] of DECLARATION_EFFECTS) {\n if (hasFlag(flags, required)) {\n apply(symbol, node);\n }\n }\n});\n\nconst conflicts = (found: BoundSymbol, declaration: SymbolDeclaration): boolean =>\n hasFlag(found.flags, declaration.excludes) &&\n !(\n hasFlag(declaration.includes, SymbolFlags.Variable) &&\n hasFlag(found.flags, SymbolFlags.Assignment)\n );\n\nconst symbolInTable = (\n table: SymbolTable,\n name: string,\n declaration: SymbolDeclaration,\n): BoundSymbol => {\n const found = table.get(name);\n if (Predicate.isUndefined(found)) {\n const created = createSymbol(EMPTY, name);\n table.set(name, created);\n return created;\n }\n if (conflicts(found, declaration)) {\n return createSymbol(EMPTY, name);\n }\n return found;\n};\n\nconst exportOf: {\n (name: string): (owner: BoundSymbol) => Option.Option<BoundSymbol>;\n (owner: BoundSymbol, name: string): Option.Option<BoundSymbol>;\n} = Fn.dual(DATA_FIRST_ARITY, (owner: BoundSymbol, name: string): Option.Option<BoundSymbol> =>\n Option.flatMap(Option.fromNullishOr(owner.exports), (table) =>\n Option.fromNullishOr(table.get(name)),\n ),\n);\n\nconst declareSymbol = (declaration: SymbolDeclaration): BoundSymbol => {\n const symbol = Option.getOrElse(\n Option.zipWith(declaration.table, declaration.name, (table, name) =>\n symbolInTable(table, name, declaration),\n ),\n () => createSymbol(EMPTY, MISSING_NAME),\n );\n addDeclarationToSymbol(symbol, declaration.node, declaration.includes);\n if (Predicate.isUndefined(symbol.parent) && Option.isSome(declaration.parent)) {\n symbol.parent = declaration.parent.value;\n }\n return symbol;\n};\n\nexport {\n addDeclarationToSymbol,\n createSymbol,\n declareSymbol,\n escapeLeadingUnderscores,\n exportOf,\n setValueDeclaration,\n unescapeLeadingUnderscores,\n};\nexport type { BoundSymbol, SymbolDeclaration, SymbolTable };\n","import { Option, Function as Fn } from \"effect\";\nimport { SyntaxKind } from \"typescript/ast\";\nimport type {\n BinaryExpression,\n CallExpression,\n ElementAccessExpression,\n Identifier,\n NoSubstitutionTemplateLiteral,\n Node,\n NumericLiteral,\n PropertyAccessExpression,\n StringLiteral,\n} from \"typescript/ast\";\nimport {\n isBinaryExpression,\n isCallExpression,\n isElementAccessExpression,\n isIdentifier,\n isNumericLiteral,\n isParenthesizedExpression,\n isPrefixUnaryExpression,\n isPropertyAccessExpression,\n isStringLiteralLikeNode,\n isVoidExpression,\n} from \"typescript/ast/is\";\n\nimport { escapeLeadingUnderscores } from \"./binder-symbols.ts\";\n\nconst DATA_FIRST_ARITY = 2;\n\ntype AccessExpression = PropertyAccessExpression | ElementAccessExpression;\ntype LiteralLike = StringLiteral | NoSubstitutionTemplateLiteral | NumericLiteral;\n\nconst REQUIRE_ARGUMENTS = 1;\nconst DEFINE_PROPERTY_ARGUMENTS = 3;\nconst ZERO_TEXT = \"0\";\n\nconst isStringOrNumericLiteralLike = (node: Node): node is LiteralLike =>\n isStringLiteralLikeNode(node) || isNumericLiteral(node);\n\nconst isAccessExpression = (node: Node): node is AccessExpression =>\n isPropertyAccessExpression(node) || isElementAccessExpression(node);\n\nconst isThisKeyword = (node: Node): boolean => node.kind === SyntaxKind.ThisKeyword;\n\nconst skipParentheses = (node: Node): Node => {\n let current = node;\n while (isParenthesizedExpression(current)) {\n current = current.expression;\n }\n return current;\n};\n\nconst isEntityNameExpression = (node: Node): boolean =>\n isIdentifier(node) ||\n (isPropertyAccessExpression(node) &&\n isIdentifier(node.name) &&\n isEntityNameExpression(node.expression));\n\nconst isLiteralLikeElementAccess = (node: Node): node is ElementAccessExpression =>\n isElementAccessExpression(node) && isStringOrNumericLiteralLike(node.argumentExpression);\n\ninterface BindableStaticRules {\n readonly excludeThisKeyword: boolean;\n readonly allowEntityName: boolean;\n}\n\nconst STATIC_ACCESS: BindableStaticRules = { excludeThisKeyword: false, allowEntityName: false };\nconst STATIC_NAME: BindableStaticRules = { excludeThisKeyword: true, allowEntityName: true };\n\nconst isAllowedEntityName = (node: Node, rules: BindableStaticRules): boolean =>\n rules.allowEntityName && isEntityNameExpression(node);\n\nconst isStaticAccess = (node: Node): node is AccessExpression =>\n isPropertyAccessExpression(node) || isLiteralLikeElementAccess(node);\n\nconst hasStaticName = (node: AccessExpression): boolean =>\n !isPropertyAccessExpression(node) || isIdentifier(node.name);\n\nconst isAllowedThis = (node: Node, rules: BindableStaticRules): boolean =>\n !rules.excludeThisKeyword && isThisKeyword(node);\n\nconst hasBindableOwner = (\n node: AccessExpression,\n rules: BindableStaticRules,\n isBindable: (owner: Node, ownerRules: BindableStaticRules) => boolean,\n): boolean =>\n isAllowedThis(node.expression, rules) ||\n (hasStaticName(node) && isBindable(node.expression, STATIC_NAME));\n\nconst isBindableStatic: {\n (rules: BindableStaticRules): (node: Node) => boolean;\n (node: Node, rules: BindableStaticRules): boolean;\n} = Fn.dual(\n DATA_FIRST_ARITY,\n (node: Node, rules: BindableStaticRules): boolean =>\n isAllowedEntityName(node, rules) ||\n (isStaticAccess(node) && hasBindableOwner(node, rules, isBindableStatic)),\n);\n\nconst nameText = (node: Node): Option.Option<string> => {\n if (isIdentifier(node) || isStringOrNumericLiteralLike(node)) {\n return Option.some(node.text);\n }\n return Option.none();\n};\n\nconst getElementOrPropertyAccessName = (node: AccessExpression): Option.Option<string> => {\n if (isPropertyAccessExpression(node)) {\n return nameText(node.name).pipe(Option.map(escapeLeadingUnderscores));\n }\n return Option.liftPredicate(\n skipParentheses(node.argumentExpression),\n isStringOrNumericLiteralLike,\n ).pipe(Option.map((literal) => escapeLeadingUnderscores(literal.text)));\n};\n\nconst isNamedIdentifier: {\n (name: string): (node: Node) => node is Identifier;\n (node: Node, name: string): node is Identifier;\n} = Fn.dual(\n DATA_FIRST_ARITY,\n (node: Node, name: string): node is Identifier => isIdentifier(node) && node.text === name,\n);\n\nconst isExportsIdentifier = (node: Node): boolean => isIdentifier(node) && node.text === \"exports\";\n\nconst isModuleExportsAccessExpression = (node: Node): boolean =>\n (isPropertyAccessExpression(node) || isLiteralLikeElementAccess(node)) &&\n isNamedIdentifier(node.expression, \"module\") &&\n Option.contains(getElementOrPropertyAccessName(node), \"exports\");\n\nconst hasRequireArgument = (node: CallExpression, requireStringLiteral: boolean): boolean => {\n const [argument] = node.arguments;\n return (\n node.arguments.length === REQUIRE_ARGUMENTS &&\n (!requireStringLiteral ||\n Option.fromNullishOr(argument).pipe(Option.exists((value) => isStringLiteralLikeNode(value))))\n );\n};\n\nconst isRequireCall: {\n (requireStringLiteral: boolean): (node: Node) => node is CallExpression;\n (node: Node, requireStringLiteral: boolean): node is CallExpression;\n} = Fn.dual(\n DATA_FIRST_ARITY,\n (node: Node, requireStringLiteral: boolean): node is CallExpression =>\n isCallExpression(node) &&\n isNamedIdentifier(node.expression, \"require\") &&\n hasRequireArgument(node, requireStringLiteral),\n);\n\nconst isAssignmentExpression = (node: Node): node is BinaryExpression =>\n isBinaryExpression(node) && node.operatorToken.kind === SyntaxKind.EqualsToken;\n\nconst getRightMostAssignedExpression = (node: Node): Node => {\n let current = node;\n while (isAssignmentExpression(current)) {\n current = current.right;\n }\n return current;\n};\n\nconst isVoidZero = (node: Node): boolean =>\n isVoidExpression(node) && isNumericLiteral(node.expression) && node.expression.text === ZERO_TEXT;\n\nconst isSignedNumericLiteral = (node: Node): boolean =>\n isPrefixUnaryExpression(node) &&\n (node.operator === SyntaxKind.PlusToken || node.operator === SyntaxKind.MinusToken) &&\n isNumericLiteral(node.operand);\n\nconst isDynamicElementAccess = (node: Node): boolean => {\n if (!isElementAccessExpression(node)) {\n return false;\n }\n const argument = skipParentheses(node.argumentExpression);\n return !isStringOrNumericLiteralLike(argument) && !isSignedNumericLiteral(argument);\n};\n\nconst isObjectDefinePropertyCallee = (node: Node): boolean =>\n isPropertyAccessExpression(node) &&\n isNamedIdentifier(node.expression, \"Object\") &&\n isNamedIdentifier(node.name, \"defineProperty\");\n\nconst isBindableObjectDefinePropertyCall = (node: CallExpression): boolean => {\n const [target, property] = node.arguments;\n return (\n node.arguments.length === DEFINE_PROPERTY_ARGUMENTS &&\n isObjectDefinePropertyCallee(node.expression) &&\n Option.exists(Option.fromNullishOr(property), isStringOrNumericLiteralLike) &&\n Option.exists(Option.fromNullishOr(target), (value) => isBindableStatic(value, STATIC_NAME))\n );\n};\n\nconst isAliasableExpression = (node: Node): boolean =>\n isEntityNameExpression(node) || node.kind === SyntaxKind.ClassExpression;\n\nexport {\n STATIC_ACCESS,\n STATIC_NAME,\n getElementOrPropertyAccessName,\n getRightMostAssignedExpression,\n isAccessExpression,\n isAliasableExpression,\n isAssignmentExpression,\n isBindableObjectDefinePropertyCall,\n isBindableStatic,\n isDynamicElementAccess,\n isExportsIdentifier,\n isModuleExportsAccessExpression,\n isNamedIdentifier,\n isRequireCall,\n isStringOrNumericLiteralLike,\n isThisKeyword,\n isVoidZero,\n nameText,\n skipParentheses,\n};\nexport type { AccessExpression, BindableStaticRules, LiteralLike };\n","import { Option, Function as Fn, Array as Arr } from \"effect\";\nimport { SyntaxKind } from \"typescript/ast\";\nimport type { BinaryExpression, CallExpression, Node } from \"typescript/ast\";\nimport { isBinaryExpression, isCallExpression, isObjectLiteralExpression } from \"typescript/ast/is\";\n\nimport {\n STATIC_ACCESS,\n STATIC_NAME,\n getElementOrPropertyAccessName,\n getRightMostAssignedExpression,\n isAccessExpression,\n isBindableObjectDefinePropertyCall,\n isBindableStatic,\n isDynamicElementAccess,\n isExportsIdentifier,\n isModuleExportsAccessExpression,\n isNamedIdentifier,\n isThisKeyword,\n isVoidZero,\n} from \"./binder-syntax.ts\";\nimport type { AccessExpression } from \"./binder-syntax.ts\";\n\nconst DATA_FIRST_ARITY = 2;\n\nconst AssignmentKind = {\n None: \"None\",\n ExportsProperty: \"ExportsProperty\",\n ModuleExports: \"ModuleExports\",\n PrototypeProperty: \"PrototypeProperty\",\n ThisProperty: \"ThisProperty\",\n Property: \"Property\",\n Prototype: \"Prototype\",\n ObjectDefinePropertyValue: \"ObjectDefinePropertyValue\",\n ObjectDefinePropertyExports: \"ObjectDefinePropertyExports\",\n ObjectDefinePrototypeProperty: \"ObjectDefinePrototypeProperty\",\n} as const;\n\ntype AssignmentDeclarationKind = (typeof AssignmentKind)[keyof typeof AssignmentKind];\n\nconst PROTOTYPE = \"prototype\";\n\nconst isPrototypeAccess = (node: Node): boolean =>\n isAccessExpression(node) &&\n isBindableStatic(node, STATIC_ACCESS) &&\n Option.contains(getElementOrPropertyAccessName(node), PROTOTYPE);\n\nconst definePropertyTargetKind = (target: Node): AssignmentDeclarationKind => {\n if (isExportsIdentifier(target) || isModuleExportsAccessExpression(target)) {\n return AssignmentKind.ObjectDefinePropertyExports;\n }\n if (isPrototypeAccess(target)) {\n return AssignmentKind.ObjectDefinePrototypeProperty;\n }\n return AssignmentKind.ObjectDefinePropertyValue;\n};\n\nconst callAssignmentKind = (node: CallExpression): AssignmentDeclarationKind => {\n const [target] = node.arguments;\n if (!isBindableObjectDefinePropertyCall(node)) {\n return AssignmentKind.None;\n }\n return Option.match(Option.fromNullishOr(target), {\n onNone: () => AssignmentKind.None,\n onSome: definePropertyTargetKind,\n });\n};\n\nconst leftmostAccess = (node: AccessExpression): AccessExpression => {\n let current = node;\n while (isAccessExpression(current.expression)) {\n current = current.expression;\n }\n return current;\n};\n\nconst isExportsTarget = (nextToLast: AccessExpression): boolean =>\n isNamedIdentifier(nextToLast.expression, \"exports\") ||\n (isNamedIdentifier(nextToLast.expression, \"module\") &&\n Option.contains(getElementOrPropertyAccessName(nextToLast), \"exports\"));\n\ntype KindRule<Subject> = readonly [\n matches: (subject: Subject) => boolean,\n kind: AssignmentDeclarationKind,\n];\n\nconst firstMatchingKind = <Subject>(\n rules: readonly KindRule<Subject>[],\n subject: Subject,\n): AssignmentDeclarationKind =>\n Arr.findFirst(rules, ([matches]) => matches(subject)).pipe(\n Option.map(([, kind]) => kind),\n Option.getOrElse((): AssignmentDeclarationKind => AssignmentKind.None),\n );\n\nconst isExportsProperty = (left: AccessExpression): boolean =>\n isExportsTarget(leftmostAccess(left)) && isBindableStatic(left, STATIC_ACCESS);\n\nconst isNamedProperty = (left: AccessExpression): boolean =>\n isBindableStatic(left, STATIC_NAME) || isDynamicElementAccess(left);\n\nconst STATIC_NAME_KINDS: readonly KindRule<AccessExpression>[] = [\n [(left) => isPrototypeAccess(left.expression), AssignmentKind.PrototypeProperty],\n [isExportsProperty, AssignmentKind.ExportsProperty],\n [isNamedProperty, AssignmentKind.Property],\n];\n\nconst staticNamePropertyKind = (left: AccessExpression): AssignmentDeclarationKind =>\n firstMatchingKind(STATIC_NAME_KINDS, left);\n\nconst propertyAccessKind = (left: AccessExpression): AssignmentDeclarationKind => {\n if (isThisKeyword(left.expression)) {\n return AssignmentKind.ThisProperty;\n }\n if (isModuleExportsAccessExpression(left)) {\n return AssignmentKind.ModuleExports;\n }\n if (isBindableStatic(left.expression, STATIC_NAME)) {\n return staticNamePropertyKind(left);\n }\n return AssignmentKind.None;\n};\n\nconst initializerOfBinary = (node: BinaryExpression): Node => {\n let current = node;\n while (isBinaryExpression(current.right)) {\n current = current.right;\n }\n return current.right;\n};\n\nconst isPrototypeObjectAssignment = (node: BinaryExpression, left: AccessExpression): boolean =>\n isBindableStatic(left.expression, STATIC_NAME) &&\n Option.contains(getElementOrPropertyAccessName(left), PROTOTYPE) &&\n isObjectLiteralExpression(initializerOfBinary(node));\n\nconst isPlainAssignment = (node: BinaryExpression): boolean =>\n node.operatorToken.kind === SyntaxKind.EqualsToken &&\n !isVoidZero(getRightMostAssignedExpression(node));\n\nconst assignedAccess = (node: BinaryExpression): Option.Option<AccessExpression> =>\n Option.liftPredicate(node.left, isAccessExpression).pipe(\n Option.filter(() => isPlainAssignment(node)),\n );\n\nconst accessAssignmentKind = (\n node: BinaryExpression,\n left: AccessExpression,\n): AssignmentDeclarationKind => {\n if (isPrototypeObjectAssignment(node, left)) {\n return AssignmentKind.Prototype;\n }\n return propertyAccessKind(left);\n};\n\nconst binaryAssignmentKind = (node: BinaryExpression): AssignmentDeclarationKind =>\n assignedAccess(node).pipe(\n Option.map((left) => accessAssignmentKind(node, left)),\n Option.getOrElse((): AssignmentDeclarationKind => AssignmentKind.None),\n );\n\nconst getAssignmentDeclarationKind: {\n (inJsFile: boolean): (node: BinaryExpression | CallExpression) => AssignmentDeclarationKind;\n (node: BinaryExpression | CallExpression, inJsFile: boolean): AssignmentDeclarationKind;\n} = Fn.dual(\n DATA_FIRST_ARITY,\n (node: BinaryExpression | CallExpression, inJsFile: boolean): AssignmentDeclarationKind => {\n const kind = Option.match(Option.liftPredicate(node, isCallExpression), {\n onNone: () =>\n Option.match(Option.liftPredicate(node, isBinaryExpression), {\n onNone: () => AssignmentKind.None,\n onSome: binaryAssignmentKind,\n }),\n onSome: callAssignmentKind,\n });\n if (kind === AssignmentKind.Property || inJsFile) {\n return kind;\n }\n return AssignmentKind.None;\n },\n);\n\nexport { AssignmentKind, getAssignmentDeclarationKind, isPrototypeAccess };\nexport type { AssignmentDeclarationKind };\n","import { Option, Predicate, Function as Fn } from \"effect\";\nimport { ModifierFlags, SyntaxKind } from \"typescript/ast\";\nimport type { BinaryExpression, CallExpression, ModuleDeclaration, Node } from \"typescript/ast\";\nimport {\n isBinaryExpression,\n isBindingElement,\n isCallExpression,\n isExportAssignment,\n isExportDeclaration,\n isIdentifier,\n isModuleDeclaration,\n isPropertyAccessExpression,\n isStringLiteral,\n isVariableDeclaration,\n isVariableStatement,\n} from \"typescript/ast/is\";\n\nimport { AssignmentKind, getAssignmentDeclarationKind } from \"./binder-assignment.ts\";\nimport { escapeLeadingUnderscores } from \"./binder-symbols.ts\";\nimport {\n getElementOrPropertyAccessName,\n isAccessExpression,\n isStringOrNumericLiteralLike,\n nameText,\n} from \"./binder-syntax.ts\";\nimport type { AccessExpression } from \"./binder-syntax.ts\";\nimport { EMPTY, hasFlag, withFlags } from \"./flags.ts\";\n\nconst DATA_FIRST_ARITY = 2;\n\nconst isNodeValue = (value: unknown): value is Node =>\n Predicate.hasProperty(value, \"kind\") && Predicate.isNumber(value.kind);\n\nconst declaredName = (node: Node): Option.Option<Node> => {\n if (\"name\" in node && isNodeValue(node.name)) {\n return Option.some(node.name);\n }\n return Option.none();\n};\n\nconst syntacticModifierFlags = (node: Node): number => {\n if (\"modifierFlags\" in node && Predicate.isNumber(node.modifierFlags)) {\n return node.modifierFlags;\n }\n return EMPTY;\n};\n\nconst hasSyntacticModifier: {\n (flag: number): (node: Node) => boolean;\n (node: Node, flag: number): boolean;\n} = Fn.dual(DATA_FIRST_ARITY, (node: Node, flag: number): boolean =>\n hasFlag(syntacticModifierFlags(node), flag),\n);\n\nconst declarationOfBinding = (node: Node): Node => {\n let current = node;\n while (isBindingElement(current)) {\n current = current.parent.parent;\n }\n return current;\n};\n\nconst combinedModifierFlags = (node: Node): number => {\n const declaration = declarationOfBinding(node);\n const own = syntacticModifierFlags(declaration);\n if (!isVariableDeclaration(declaration)) {\n return own;\n }\n const list = declaration.parent;\n const withList = withFlags(own, syntacticModifierFlags(list));\n if (isVariableStatement(list.parent)) {\n return withFlags(withList, syntacticModifierFlags(list.parent));\n }\n return withList;\n};\n\nconst hasExportModifier = (node: Node): boolean =>\n hasFlag(combinedModifierFlags(node), ModifierFlags.Export);\n\nconst nameOfAccess = (node: AccessExpression): Node => {\n if (isPropertyAccessExpression(node)) {\n return node.name;\n }\n if (isStringOrNumericLiteralLike(node.argumentExpression)) {\n return node.argumentExpression;\n }\n return node;\n};\n\nconst assignmentName = (node: BinaryExpression, inJsFile: boolean): Option.Option<Node> => {\n const kind = getAssignmentDeclarationKind(node, inJsFile);\n if (kind === AssignmentKind.ModuleExports || kind === AssignmentKind.None) {\n return Option.none();\n }\n return Option.map(Option.liftPredicate(node.left, isAccessExpression), nameOfAccess);\n};\n\nconst definedPropertyName = (node: CallExpression): Option.Option<Node> => {\n const [, property] = node.arguments;\n return Option.fromNullishOr(property);\n};\n\nconst nameOfNamedNode = (node: Node): Option.Option<Node> => {\n if (isAccessExpression(node)) {\n return Option.some(nameOfAccess(node));\n }\n if (isExportDeclaration(node)) {\n return Option.none();\n }\n return declaredName(node);\n};\n\nconst nameOfDeclaration = (node: Node, inJsFile: boolean): Option.Option<Node> => {\n if (isBinaryExpression(node)) {\n return assignmentName(node, inJsFile);\n }\n if (isCallExpression(node)) {\n return definedPropertyName(node);\n }\n return nameOfNamedNode(node);\n};\n\nconst isGlobalScopeAugmentation = (node: ModuleDeclaration): boolean =>\n isIdentifier(node.name) &&\n node.name.text === \"global\" &&\n node.keyword !== SyntaxKind.NamespaceKeyword;\n\nconst isAmbientModule = (node: Node): node is ModuleDeclaration =>\n isModuleDeclaration(node) && (isStringLiteral(node.name) || isGlobalScopeAugmentation(node));\n\nconst ambientModuleName = (name: Node): string => {\n if (isIdentifier(name)) {\n return \"__global\";\n }\n return `\"${Option.getOrElse(nameText(name), () => \"\")}\"`;\n};\n\nconst nameOfNamedDeclaration = (node: Node, name: Node): Option.Option<string> => {\n if (isAmbientModule(node)) {\n return Option.some(ambientModuleName(name));\n }\n if (isAccessExpression(name)) {\n return getElementOrPropertyAccessName(name);\n }\n return Option.map(nameText(name), escapeLeadingUnderscores);\n};\n\nconst unnamedDeclarationName = (node: Node): Option.Option<string> => {\n if (node.kind === SyntaxKind.ExportDeclaration) {\n return Option.some(\"__export\");\n }\n if (node.kind === SyntaxKind.SourceFile || node.kind === SyntaxKind.BinaryExpression) {\n return Option.some(\"export=\");\n }\n return Option.none();\n};\n\nconst declarationName: {\n (inJsFile: boolean): (node: Node) => Option.Option<string>;\n (node: Node, inJsFile: boolean): Option.Option<string>;\n} = Fn.dual(DATA_FIRST_ARITY, (node: Node, inJsFile: boolean): Option.Option<string> => {\n if (isExportAssignment(node)) {\n return Option.some(\n Option.match(\n Option.liftPredicate(node, () => node.isExportEquals),\n {\n onNone: () => \"default\",\n onSome: () => \"export=\",\n },\n ),\n );\n }\n return Option.match(nameOfDeclaration(node, inJsFile), {\n onNone: () => unnamedDeclarationName(node),\n onSome: (name) => nameOfNamedDeclaration(node, name),\n });\n});\n\nexport { declarationName, hasExportModifier, hasSyntacticModifier, isAmbientModule, isNodeValue };\n","import { Array as Arr, Option, String as Str, Function as Fn, pipe } from \"effect\";\n\nimport type { ResolutionState, TraceSink } from \"./resolution-types.ts\";\n\nconst DATA_FIRST_ARITY = 2;\n\nconst Messages = {\n directoryDoesNotExist: \"Directory '{0}' does not exist, skipping all lookups in it.\",\n directoryHasNoPackageScope:\n \"Directory '{0}' has no containing package.json scope. Imports will not resolve.\",\n enteringConditionalExports: \"Entering conditional exports.\",\n exitingConditionalExports: \"Exiting conditional exports.\",\n expectedFieldType: \"Expected type of '{0}' field in 'package.json' to be '{1}', got '{2}'.\",\n explicitResolutionKind: \"Explicitly specified module resolution kind: '{0}'.\",\n exportSpecifierDoesNotExist:\n \"Export specifier '{0}' does not exist in package.json scope at path '{1}'.\",\n failedToFindPeerDependency: \"Failed to find peerDependency '{0}'.\",\n failedUnderCondition: \"Failed to resolve under condition '{0}'.\",\n fileDoesNotExist: \"File '{0}' does not exist.\",\n fileDoesNotExistCached: \"File '{0}' does not exist according to earlier cached lookups.\",\n fileExistsCached: \"File '{0}' exists according to earlier cached lookups.\",\n fileExistsUseIt: \"File '{0}' exists - use it as a name resolution result.\",\n fileHasExtensionStripping: \"File name '{0}' has a '{1}' extension - stripping it.\",\n foundPackageJson: \"Found 'package.json' at '{0}'.\",\n foundPeerDependency: \"Found peerDependency '{0}' with '{1}' version.\",\n importSpecifierDoesNotExist:\n \"Import specifier '{0}' does not exist in package.json scope at path '{1}'.\",\n invalidImportSpecifier: \"Invalid import specifier '{0}' has no possible resolutions.\",\n loadingFromNodeModules:\n \"Loading module '{0}' from 'node_modules' folder, target file types: {1}.\",\n loadingAsFileOrFolder:\n \"Loading module as file / folder, candidate module location '{0}', target file types: {1}.\",\n lookingUpInNodeModules: \"Looking up in 'node_modules' folder, initial location '{0}'.\",\n matchedCondition: \"Matched '{0}' condition '{1}'.\",\n matchedPattern: \"Module name '{0}', matched pattern '{1}'.\",\n moduleNotResolved: \"======== Module name '{0}' was not resolved. ========\",\n moduleResolved: \"======== Module name '{0}' was successfully resolved to '{1}'. ========\",\n moduleResolvedWithPackageId:\n \"======== Module name '{0}' was successfully resolved to '{1}' with Package ID '{2}'. ========\",\n resolutionFoundInCache: \"Resolution for module '{0}' was found in cache from location '{1}'.\",\n retryWithoutModernFeatures:\n \"Resolution of non-relative name failed; trying with modern Node resolution features disabled to see if npm library needs configuration update.\",\n retryWithBundler:\n \"Resolution of non-relative name failed; trying with '--moduleResolution bundler' to see if project may need configuration update.\",\n resolvedUnderCondition: \"Resolved under condition '{0}'.\",\n resolvingInMode: \"Resolving in {0} mode with conditions {1}.\",\n resolvingModule: \"======== Resolving module '{0}' from '{1}'. ========\",\n resolvingTypeReference:\n \"======== Resolving type reference directive '{0}', containing file '{1}', root directory '{2}'. ========\",\n resolvingWithPrimarySearchPath: \"Resolving with primary search path '{0}'.\",\n sawNonMatchingCondition: \"Saw non-matching condition '{0}'.\",\n scopedPackageDetected: \"Scoped package detected, looking in '{0}'\",\n searchingFallbackExtensions:\n \"Searching all ancestor node_modules directories for fallback extensions: {0}.\",\n searchingPreferredExtensions:\n \"Searching all ancestor node_modules directories for preferred extensions: {0}.\",\n skippingAbsoluteUri:\n \"Skipping module '{0}' that looks like an absolute URI, target file types: {1}.\",\n tryingSubstitution: \"Trying substitution '{0}', candidate module location: '{1}'.\",\n typeReferenceNotResolved: \"======== Type reference directive '{0}' was not resolved. ========\",\n usingSubpath: \"Using '{0}' subpath '{1}' with target '{2}'.\",\n packageJsonMissingField: \"'package.json' does not have a '{0}' field.\",\n packageJsonNoMatchingTypesVersions:\n \"'package.json' does not have a 'typesVersions' entry that matches version '{0}'.\",\n packageJsonFalsyField: \"'package.json' had a falsy '{0}' field.\",\n packageJsonFieldReferences: \"'package.json' has '{0}' field '{1}' that references '{2}'.\",\n packageJsonHasPeerDependencies: \"'package.json' has a 'peerDependencies' field.\",\n packageJsonInvalidTypesVersionsRange:\n \"'package.json' has a 'typesVersions' entry '{0}' that is not a valid semver range.\",\n packageJsonTypesVersionsMatch:\n \"'package.json' has a 'typesVersions' entry '{0}' that matches compiler version '{1}', looking for a pattern to match module name '{2}'.\",\n packageJsonHasTypesVersions:\n \"'package.json' has a 'typesVersions' field with version-specific path mappings.\",\n packageJsonMapsToNull: \"package.json scope '{0}' explicitly maps specifier '{1}' to null.\",\n packageJsonInvalidTarget:\n \"package.json scope '{0}' has invalid type for target of specifier '{1}'\",\n packageJsonNoImports: \"package.json scope '{0}' has no imports defined.\",\n} as const;\n\ntype Message = (typeof Messages)[keyof typeof Messages];\n\nconst PLACEHOLDER = /\\{(?<index>\\d+)\\}/u;\nconst PLACEHOLDER_STEP = 2;\nconst TEXT_PART = 0;\n\nconst filled =\n (args: readonly string[]) =>\n (part: string, position: number): string => {\n if (position % PLACEHOLDER_STEP === TEXT_PART) {\n return part;\n }\n return args[Number(part)] ?? `{${part}}`;\n };\n\nconst formatMessage = (message: Message, ...args: readonly string[]): string =>\n pipe(Str.split(message, PLACEHOLDER), Arr.map(filled(args)), Arr.join(\"\"));\n\nconst emitTrace: {\n (message: string): (trace: Option.Option<TraceSink>) => void;\n (trace: Option.Option<TraceSink>, message: string): void;\n} = Fn.dual(DATA_FIRST_ARITY, (trace: Option.Option<TraceSink>, message: string): void => {\n for (const sink of Option.toArray(trace)) {\n sink(message);\n }\n});\n\nconst traceMessage = (\n state: Pick<ResolutionState, \"trace\">,\n message: Message,\n ...args: readonly string[]\n): void => {\n emitTrace(state.trace, formatMessage(message, ...args));\n};\n\nexport { Messages, emitTrace, formatMessage, traceMessage };\nexport type { Message };\n","import { Function as Fn, Option, String as Str } from \"effect\";\n\nconst DATA_FIRST_ARITY_3 = 3;\nconst START = 0;\n\nconst indexFrom: {\n (search: string, from: number): (text: string) => Option.Option<number>;\n (text: string, search: string, from: number): Option.Option<number>;\n} = Fn.dual(\n DATA_FIRST_ARITY_3,\n (text: string, search: string, from: number): Option.Option<number> =>\n Option.map(Str.indexOf(search)(Str.slice(from)(text)), (found) => found + from),\n);\n\nconst lastIndexUpTo: {\n (search: string, position: number): (text: string) => Option.Option<number>;\n (text: string, search: string, position: number): Option.Option<number>;\n} = Fn.dual(\n DATA_FIRST_ARITY_3,\n (text: string, search: string, position: number): Option.Option<number> =>\n Str.lastIndexOf(search)(Str.slice(START, Math.max(position, START) + search.length)(text)),\n);\n\nexport { indexFrom, lastIndexUpTo };\n","import { Option, Predicate, String as Str } from \"effect\";\n\nimport { indexFrom } from \"./text-search.ts\";\n\ninterface PathRoot {\n readonly length: number;\n readonly isUrl: boolean;\n}\n\nconst FIRST = 0;\nconst NEXT = 1;\nconst AFTER_NEXT = 2;\nconst DOS_ROOT_LENGTH = 3;\nconst DOS_DRIVE_LENGTH = 2;\nconst ENCODED_SEPARATOR_LENGTH = 3;\nconst SLASH = \"/\";\nconst BACKSLASH = \"\\\\\";\nconst SCHEME_SEPARATOR = \"://\";\nconst DOS_ROOT = /^[A-Za-z]:[/\\\\]/u;\nconst DOS_DRIVE = /^[A-Za-z]:$/u;\nconst VOLUME_CHARACTER = /^[A-Za-z]$/u;\nconst ENCODED_VOLUME_SEPARATOR = /^%3[Aa]/u;\nconst FILE_SCHEME = \"file\";\nconst LOCAL_AUTHORITIES: ReadonlySet<string> = new Set([\"\", \"localhost\"]);\n\nconst RELATIVE: PathRoot = { length: FIRST, isUrl: false };\n\nconst diskRoot = (length: number): PathRoot => ({ length, isUrl: false });\nconst urlRoot = (length: number): PathRoot => ({ length, isUrl: true });\n\nconst isVolumeCharacter = (character: string | undefined): boolean =>\n Predicate.isNotUndefined(character) && VOLUME_CHARACTER.test(character);\n\nconst posixOrUncRoot = (path: string, separator: string): PathRoot => {\n if (path[NEXT] !== separator) {\n return diskRoot(NEXT);\n }\n return Option.match(indexFrom(path, separator, AFTER_NEXT), {\n onNone: () => diskRoot(path.length),\n onSome: (serverEnd) => diskRoot(serverEnd + NEXT),\n });\n};\n\nconst dosRoot = (path: string): Option.Option<PathRoot> => {\n if (DOS_ROOT.test(path)) {\n return Option.some(diskRoot(DOS_ROOT_LENGTH));\n }\n return Option.liftPredicate(diskRoot(DOS_DRIVE_LENGTH), () => DOS_DRIVE.test(path));\n};\n\nconst fileUrlVolumeSeparatorEnd = (url: string, start: number): Option.Option<number> => {\n if (url[start] === \":\") {\n return Option.some(start + NEXT);\n }\n return Option.liftPredicate(start + ENCODED_SEPARATOR_LENGTH, () =>\n ENCODED_VOLUME_SEPARATOR.test(Str.slice(start)(url)),\n );\n};\n\nconst fileUrlVolumeRoot = (url: string, authorityEnd: number): Option.Option<PathRoot> =>\n fileUrlVolumeSeparatorEnd(url, authorityEnd + AFTER_NEXT).pipe(\n Option.flatMap((end) => {\n if (url[end] === SLASH) {\n return Option.some(urlRoot(end + NEXT));\n }\n return Option.liftPredicate(urlRoot(end), () => end === url.length);\n }),\n );\n\nconst isLocalFileUrl = (url: string, schemeEnd: number, authorityEnd: number): boolean =>\n Str.slice(FIRST, schemeEnd)(url) === FILE_SCHEME &&\n LOCAL_AUTHORITIES.has(Str.slice(schemeEnd + SCHEME_SEPARATOR.length, authorityEnd)(url)) &&\n isVolumeCharacter(url[authorityEnd + NEXT]);\n\nconst urlRootAt = (url: string, schemeEnd: number, authorityEnd: number): PathRoot => {\n const volume = Option.liftPredicate(url, () => isLocalFileUrl(url, schemeEnd, authorityEnd)).pipe(\n Option.flatMap(() => fileUrlVolumeRoot(url, authorityEnd)),\n );\n return Option.getOrElse(volume, () => urlRoot(authorityEnd + NEXT));\n};\n\nconst urlRootOf = (url: string, schemeEnd: number): PathRoot =>\n Option.match(indexFrom(url, SLASH, schemeEnd + SCHEME_SEPARATOR.length), {\n onNone: () => urlRoot(url.length),\n onSome: (authorityEnd) => urlRootAt(url, schemeEnd, authorityEnd),\n });\n\nconst getPathRoot = (path: string): PathRoot => {\n const [first] = path;\n if (first === SLASH || first === BACKSLASH) {\n return posixOrUncRoot(path, first);\n }\n return dosRoot(path).pipe(\n Option.getOrElse(() =>\n Option.match(Str.indexOf(SCHEME_SEPARATOR)(path), {\n onNone: () => RELATIVE,\n onSome: (schemeEnd) => urlRootOf(path, schemeEnd),\n }),\n ),\n );\n};\n\nconst getRootLength = (path: string): number => getPathRoot(path).length;\n\nconst isRootedDiskPath = (path: string): boolean => {\n const root = getPathRoot(path);\n return root.length > FIRST && !root.isUrl;\n};\n\nexport { getRootLength, isRootedDiskPath };\n","import { Array as Arr, Option, String as Str, pipe, Function as Fn } from \"effect\";\n\nimport { getRootLength, isRootedDiskPath } from \"./path-roots.ts\";\n\nconst DATA_FIRST_ARITY = 2;\n\nconst SEPARATOR = \"/\";\nconst ROOT_LENGTH = 1;\nconst NOT_FOUND = -1;\nconst FIRST = 0;\nconst SECOND = 1;\nconst PARENT = \"..\";\nconst CURRENT = \".\";\nconst RELATIVE_SEGMENT = /\\/\\/|(?:^|\\/)\\.\\.?(?:$|\\/)/u;\nconst RELATIVE_NAMES: ReadonlySet<string> = new Set([\".\", \"..\"]);\nconst RELATIVE_PREFIXES: readonly string[] = [\"./\", \".\\\\\", \"../\", \"..\\\\\"];\n\nconst normalizeSlashes = (path: string): string => Str.replaceAll(\"\\\\\", SEPARATOR)(path);\n\nconst hasTrailingDirectorySeparator = (path: string): boolean => Str.endsWith(SEPARATOR)(path);\n\nconst removeTrailingDirectorySeparator = (path: string): string =>\n Option.liftPredicate(path, hasTrailingDirectorySeparator).pipe(\n Option.match({ onNone: () => path, onSome: (value) => Str.slice(FIRST, NOT_FOUND)(value) }),\n );\n\nconst ensureTrailingDirectorySeparator = (path: string): string =>\n Option.liftPredicate(path, hasTrailingDirectorySeparator).pipe(\n Option.getOrElse(() => `${path}${SEPARATOR}`),\n );\n\nconst combineTwo = (base: string, next: string): string => {\n if (next.length === FIRST) {\n return base;\n }\n const relative = normalizeSlashes(next);\n if (base.length === FIRST || getRootLength(relative) !== FIRST) {\n return relative;\n }\n return `${ensureTrailingDirectorySeparator(base)}${relative}`;\n};\n\nconst combinePaths = (path: string, ...paths: readonly string[]): string =>\n Arr.reduce(paths, normalizeSlashes(path), combineTwo);\n\nconst pathComponents = (path: string, rootLength: number): readonly string[] => {\n const rest = Str.split(Str.slice(rootLength)(path), SEPARATOR);\n const trimmed = Option.liftPredicate(rest, (parts) => Arr.last(parts).pipe(Option.contains(\"\")));\n return [\n Str.slice(FIRST, rootLength)(path),\n ...Option.match(trimmed, {\n onNone: () => rest,\n onSome: (parts) => parts.slice(FIRST, NOT_FOUND),\n }),\n ];\n};\n\nconst getPathComponents = (path: string): readonly string[] => {\n const normalized = normalizeSlashes(path);\n return pathComponents(normalized, getRootLength(normalized));\n};\n\nconst isNoopComponent = (component: string): boolean =>\n component.length === FIRST || component === CURRENT;\n\nconst canPopParent = (reduced: readonly string[]): boolean =>\n reduced.length > SECOND && Arr.last(reduced).pipe(Option.exists((last) => last !== PARENT));\n\nconst keepsParent = (reduced: readonly string[]): boolean =>\n reduced.length > SECOND || reduced[FIRST] === \"\";\n\nconst applyParent = (reduced: readonly string[], component: string): readonly string[] => {\n if (canPopParent(reduced)) {\n return reduced.slice(FIRST, NOT_FOUND);\n }\n if (keepsParent(reduced)) {\n return [...reduced, component];\n }\n return reduced;\n};\n\nconst reduceComponent = (reduced: readonly string[], component: string): readonly string[] => {\n if (isNoopComponent(component)) {\n return reduced;\n }\n if (component !== PARENT) {\n return [...reduced, component];\n }\n return applyParent(reduced, component);\n};\n\nconst reducePathComponents = (components: readonly string[]): readonly string[] =>\n Arr.match(components, {\n onEmpty: (): readonly string[] => [],\n onNonEmpty: ([root, ...rest]) => Arr.reduce(rest, [root], reduceComponent),\n });\n\nconst getPathFromPathComponents = (components: readonly string[]): string =>\n Arr.match(components, {\n onEmpty: () => \"\",\n onNonEmpty: ([root, ...rest]) =>\n `${Option.liftPredicate(root, Str.isNonEmpty).pipe(Option.match({ onNone: () => \"\", onSome: ensureTrailingDirectorySeparator }))}${pipe(rest, Arr.join(SEPARATOR))}`,\n });\n\nconst normalizeComponents = (path: string): string => {\n const normalized = getPathFromPathComponents(reducePathComponents(getPathComponents(path)));\n return Option.liftPredicate(\n normalized,\n (value) => value.length > FIRST && hasTrailingDirectorySeparator(path),\n ).pipe(Option.match({ onNone: () => normalized, onSome: ensureTrailingDirectorySeparator }));\n};\n\nconst simplifyCurrentSegments = (path: string): string =>\n Str.replace(/^\\.\\//u, \"\")(Str.replaceAll(\"/./\", SEPARATOR)(path));\n\nconst normalizePath = (path: string): string => {\n const slashed = normalizeSlashes(path);\n if (!RELATIVE_SEGMENT.test(slashed)) {\n return slashed;\n }\n const simplified = simplifyCurrentSegments(slashed);\n if (!RELATIVE_SEGMENT.test(simplified)) {\n return simplified;\n }\n return normalizeComponents(simplified);\n};\n\nconst getDirectoryPath = (path: string): string => {\n const slashed = normalizeSlashes(path);\n const rootLength = getRootLength(slashed);\n if (rootLength === slashed.length) {\n return slashed;\n }\n const trimmed = removeTrailingDirectorySeparator(slashed);\n const end = Option.match(Str.lastIndexOf(SEPARATOR)(trimmed), {\n onNone: () => rootLength,\n onSome: (separator) => Math.max(rootLength, separator),\n });\n return Str.slice(FIRST, end)(trimmed);\n};\n\nconst getBaseFileName = (path: string): string => {\n const slashed = normalizeSlashes(path);\n if (getRootLength(slashed) === slashed.length) {\n return \"\";\n }\n const trimmed = removeTrailingDirectorySeparator(slashed);\n const rootLength = getRootLength(trimmed);\n const start = Option.match(Str.lastIndexOf(SEPARATOR)(trimmed), {\n onNone: () => rootLength,\n onSome: (separator) => Math.max(rootLength, separator + ROOT_LENGTH),\n });\n return Str.slice(start)(trimmed);\n};\n\nconst getNormalizedAbsolutePath: {\n (currentDirectory: string): (path: string) => string;\n (path: string, currentDirectory: string): string;\n} = Fn.dual(DATA_FIRST_ARITY, (path: string, currentDirectory: string): string => {\n const components = getPathComponents(combinePaths(currentDirectory, path));\n return getPathFromPathComponents(reducePathComponents(components));\n});\n\nconst toPath = (fileName: string): string =>\n Option.liftPredicate(fileName, isRootedDiskPath).pipe(\n Option.match({\n onNone: () => getNormalizedAbsolutePath(fileName, SEPARATOR),\n onSome: normalizePath,\n }),\n Str.toLowerCase,\n );\n\nconst forEachAncestorDirectory: {\n <Found>(\n visit: (ancestor: string) => Option.Option<Found>,\n ): (directory: string) => Option.Option<Found>;\n <Found>(\n directory: string,\n visit: (ancestor: string) => Option.Option<Found>,\n ): Option.Option<Found>;\n} = Fn.dual(\n DATA_FIRST_ARITY,\n <Found>(\n directory: string,\n visit: (ancestor: string) => Option.Option<Found>,\n ): Option.Option<Found> => {\n let current = directory;\n for (;;) {\n const result = visit(current);\n const parent = getDirectoryPath(current);\n if (Option.isSome(result) || parent === current) {\n return result;\n }\n current = parent;\n }\n },\n);\n\nconst pathIsRelative = (path: string): boolean =>\n RELATIVE_NAMES.has(path) ||\n pipe(\n RELATIVE_PREFIXES,\n Arr.some((prefix) => Str.startsWith(prefix)(path)),\n );\n\nconst isExternalModuleNameRelative = (moduleName: string): boolean =>\n pathIsRelative(moduleName) || isRootedDiskPath(moduleName);\n\nconst sharedPrefixLength = (from: readonly string[], to: readonly string[]): number => {\n const limit = Math.min(from.length, to.length);\n let index = FIRST;\n while (index < limit && from[index] === to[index]) {\n index += ROOT_LENGTH;\n }\n return index;\n};\n\nconst getRelativePathFromDirectory: {\n (to: string): (fromDirectory: string) => string;\n (fromDirectory: string, to: string): string;\n} = Fn.dual(DATA_FIRST_ARITY, (fromDirectory: string, to: string): string => {\n const from = reducePathComponents(getPathComponents(fromDirectory));\n const target = reducePathComponents(getPathComponents(to));\n const start = sharedPrefixLength(from, target);\n if (start === FIRST) {\n return getPathFromPathComponents(target);\n }\n return getPathFromPathComponents([\n \"\",\n ...Array.from({ length: from.length - start }, () => PARENT),\n ...target.slice(start),\n ]);\n});\n\nconst containsPath: {\n (child: string): (parent: string) => boolean;\n (parent: string, child: string): boolean;\n} = Fn.dual(DATA_FIRST_ARITY, (parent: string, child: string): boolean => {\n const parentComponents = reducePathComponents(getPathComponents(parent));\n const childComponents = reducePathComponents(getPathComponents(child));\n return (\n parent === child ||\n (childComponents.length >= parentComponents.length &&\n sharedPrefixLength(parentComponents, childComponents) === parentComponents.length)\n );\n});\n\nexport {\n combinePaths,\n containsPath,\n ensureTrailingDirectorySeparator,\n forEachAncestorDirectory,\n getBaseFileName,\n getDirectoryPath,\n getNormalizedAbsolutePath,\n getPathComponents,\n getRelativePathFromDirectory,\n hasTrailingDirectorySeparator,\n isExternalModuleNameRelative,\n normalizePath,\n normalizeSlashes,\n pathIsRelative,\n RELATIVE_SEGMENT,\n reducePathComponents,\n toPath,\n};\n","import { Option, Predicate, Record as Rec, Function as Fn } from \"effect\";\n\nimport { Messages, traceMessage } from \"./messages.ts\";\nimport { combinePaths, normalizePath } from \"./paths.ts\";\nimport type { PackageJsonContent, ResolutionState } from \"./resolution-types.ts\";\n\nconst DATA_FIRST_ARITY_3 = 3;\n\ninterface FieldRequest {\n readonly field: string;\n readonly expected: \"string\" | \"object\";\n}\n\ninterface PathFieldRequest {\n readonly field: string;\n readonly baseDirectory: string;\n}\n\nconst EMPTY = 0;\n\nconst typeName = (value: unknown): string => {\n if (Predicate.isNull(value)) {\n return \"null\";\n }\n return typeof value;\n};\n\nconst resolvePackageJsonFieldWithTrace: {\n (\n request: FieldRequest,\n state: ResolutionState,\n ): (content: PackageJsonContent) => Option.Option<unknown>;\n (\n content: PackageJsonContent,\n request: FieldRequest,\n state: ResolutionState,\n ): Option.Option<unknown>;\n} = Fn.dual(\n DATA_FIRST_ARITY_3,\n (\n content: PackageJsonContent,\n { field, expected }: FieldRequest,\n state: ResolutionState,\n ): Option.Option<unknown> => {\n if (!Rec.has(content, field)) {\n traceMessage(state, Messages.packageJsonMissingField, field);\n return Option.none();\n }\n const value = content[field];\n if (typeof value !== expected || Predicate.isNull(value)) {\n traceMessage(state, Messages.expectedFieldType, field, expected, typeName(value));\n return Option.none();\n }\n return Option.some(value);\n },\n);\n\nconst resolvePathWithTrace = (\n fileName: string,\n { field, baseDirectory }: PathFieldRequest,\n state: ResolutionState,\n): Option.Option<string> => {\n if (fileName.length === EMPTY) {\n traceMessage(state, Messages.packageJsonFalsyField, field);\n return Option.none();\n }\n const path = normalizePath(combinePaths(baseDirectory, fileName));\n traceMessage(state, Messages.packageJsonFieldReferences, field, fileName, path);\n return Option.some(path);\n};\n\nconst resolvePackageJsonPathWithTrace = (\n content: PackageJsonContent,\n request: PathFieldRequest,\n state: ResolutionState,\n): Option.Option<string> =>\n resolvePackageJsonFieldWithTrace(\n content,\n { field: request.field, expected: \"string\" },\n state,\n ).pipe(\n Option.filter((value) => Predicate.isString(value)),\n Option.flatMap((fileName) => resolvePathWithTrace(fileName, request, state)),\n );\n\nconst readPackageJsonTypesFields: {\n (\n baseDirectory: string,\n state: ResolutionState,\n ): (content: PackageJsonContent) => Option.Option<string>;\n (\n content: PackageJsonContent,\n baseDirectory: string,\n state: ResolutionState,\n ): Option.Option<string>;\n} = Fn.dual(\n DATA_FIRST_ARITY_3,\n (\n content: PackageJsonContent,\n baseDirectory: string,\n state: ResolutionState,\n ): Option.Option<string> =>\n resolvePackageJsonPathWithTrace(content, { field: \"typings\", baseDirectory }, state).pipe(\n Option.orElse(() =>\n resolvePackageJsonPathWithTrace(content, { field: \"types\", baseDirectory }, state),\n ),\n ),\n);\n\nconst readPackageJsonMainField: {\n (\n baseDirectory: string,\n state: ResolutionState,\n ): (content: PackageJsonContent) => Option.Option<string>;\n (\n content: PackageJsonContent,\n baseDirectory: string,\n state: ResolutionState,\n ): Option.Option<string>;\n} = Fn.dual(\n DATA_FIRST_ARITY_3,\n (\n content: PackageJsonContent,\n baseDirectory: string,\n state: ResolutionState,\n ): Option.Option<string> =>\n resolvePackageJsonPathWithTrace(content, { field: \"main\", baseDirectory }, state),\n);\n\nconst asRecord = (value: unknown): Readonly<Record<string, unknown>> =>\n Option.liftPredicate(value, Predicate.isObject).pipe(Option.getOrElse(() => ({})));\n\nexport {\n asRecord,\n readPackageJsonMainField,\n readPackageJsonTypesFields,\n resolvePackageJsonFieldWithTrace,\n};\nexport type { FieldRequest };\n","import { Array as Arr, Option, Predicate, Record as Rec, Function as Fn } from \"effect\";\nimport semver from \"semver\";\n\nimport { Messages, traceMessage } from \"./messages.ts\";\nimport { asRecord, resolvePackageJsonFieldWithTrace } from \"./package-json-fields.ts\";\nimport type {\n PackageJsonContent,\n PackageJsonInfo,\n ResolutionState,\n VersionPaths,\n} from \"./resolution-types.ts\";\n\nconst DATA_FIRST_ARITY = 2;\n\nconst RESOLUTION_VERSION = \"5.6.1-rc\";\nconst RESOLUTION_VERSION_MAJOR_MINOR = \"5.6\";\nconst RANGE_OPTIONS = { includePrerelease: true } as const;\n\nconst isValidRange = (key: string): boolean =>\n Predicate.isNotNull(semver.validRange(key, RANGE_OPTIONS));\n\nconst rangeMatches = (range: string, version: string): boolean =>\n isValidRange(range) && semver.satisfies(version, range, RANGE_OPTIONS);\n\nconst traceInvalidRanges = (\n typesVersions: Readonly<Record<string, unknown>>,\n state: ResolutionState,\n): void => {\n for (const key of Rec.keys(typesVersions)) {\n if (!isValidRange(key)) {\n traceMessage(state, Messages.packageJsonInvalidTypesVersionsRange, key);\n }\n }\n};\n\nconst matchingTypesVersions = (\n typesVersions: Readonly<Record<string, unknown>>,\n): Option.Option<readonly [string, unknown]> =>\n Arr.findFirst(Rec.toEntries(typesVersions), ([key]) => rangeMatches(key, RESOLUTION_VERSION));\n\nconst validateVersionPathsWithTrace = (\n [version, paths]: readonly [string, unknown],\n state: ResolutionState,\n): Option.Option<VersionPaths> => {\n if (typeof paths !== \"object\") {\n traceMessage(\n state,\n Messages.expectedFieldType,\n `typesVersions['${version}']`,\n \"object\",\n typeof paths,\n );\n return Option.none();\n }\n return Option.some({ version, paths: asRecord(paths) });\n};\n\nconst selectVersionPathsWithTrace = (\n typesVersions: Readonly<Record<string, unknown>>,\n state: ResolutionState,\n): Option.Option<VersionPaths> => {\n traceMessage(state, Messages.packageJsonHasTypesVersions);\n traceInvalidRanges(typesVersions, state);\n const entry = matchingTypesVersions(typesVersions);\n if (Option.isNone(entry)) {\n traceMessage(\n state,\n Messages.packageJsonNoMatchingTypesVersions,\n RESOLUTION_VERSION_MAJOR_MINOR,\n );\n return Option.none();\n }\n return validateVersionPathsWithTrace(entry.value, state);\n};\n\nconst resolveTypesVersionPathsWithTrace = (\n content: PackageJsonContent,\n state: ResolutionState,\n): Option.Option<VersionPaths> =>\n resolvePackageJsonFieldWithTrace(\n content,\n { field: \"typesVersions\", expected: \"object\" },\n state,\n ).pipe(\n Option.flatMap((typesVersions) => selectVersionPathsWithTrace(asRecord(typesVersions), state)),\n );\n\nconst getVersionPaths: {\n (state: ResolutionState): (info: PackageJsonInfo) => Option.Option<VersionPaths>;\n (info: PackageJsonInfo, state: ResolutionState): Option.Option<VersionPaths>;\n} = Fn.dual(\n DATA_FIRST_ARITY,\n (info: PackageJsonInfo, state: ResolutionState): Option.Option<VersionPaths> =>\n info.contents.versionPaths(() =>\n resolveTypesVersionPathsWithTrace(info.contents.packageJsonContent, state),\n ),\n);\n\nexport { RESOLUTION_VERSION, getVersionPaths };\n","import { Option, Predicate, Function as Fn } from \"effect\";\nimport { ModifierFlags } from \"typescript/ast\";\nimport type { Node, SourceFile } from \"typescript/ast\";\nimport {\n isExportSpecifier,\n isImportEqualsDeclaration,\n isJSDocCallbackTag,\n isJSDocTypedefTag,\n} from \"typescript/ast/is\";\nimport { SymbolFlags } from \"typescript/sync\";\n\nimport {\n declarationName,\n hasExportModifier,\n hasSyntacticModifier,\n isAmbientModule,\n} from \"./binder-names.ts\";\nimport { declareSymbol } from \"./binder-symbols.ts\";\nimport type { BoundSymbol, SymbolTable } from \"./binder-symbols.ts\";\nimport { nameText } from \"./binder-syntax.ts\";\nimport { hasFlag } from \"./flags.ts\";\n\nconst DATA_FIRST_ARITY = 2;\nconst DATA_FIRST_ARITY_3 = 3;\n\ninterface FileBinding {\n readonly file: SourceFile;\n readonly locals: SymbolTable;\n readonly isJs: boolean;\n readonly exportContext: boolean;\n readonly strict: boolean;\n readonly isExternalModule: boolean;\n symbol?: BoundSymbol;\n commonJsModuleIndicator?: Node;\n}\n\ninterface Scope {\n readonly containerIsFile: boolean;\n readonly blockIsFile: boolean;\n}\n\ninterface DeclarationTarget {\n readonly table: Option.Option<SymbolTable>;\n readonly parent: Option.Option<BoundSymbol>;\n}\n\ninterface SymbolFlagPair {\n readonly includes: number;\n readonly excludes: number;\n}\n\ninterface DeclareRequest {\n readonly target: DeclarationTarget;\n readonly node: Node;\n readonly flags: SymbolFlagPair;\n}\n\nconst DEFAULT_NAME = \"default\";\n\nconst exportsOf = (owner: Option.Option<BoundSymbol>): DeclarationTarget => ({\n table: owner.pipe(Option.flatMap((symbol) => Option.fromNullishOr(symbol.exports))),\n parent: owner,\n});\n\nconst fileExports = (binding: FileBinding): DeclarationTarget =>\n exportsOf(Option.fromNullishOr(binding.symbol));\n\nconst fileLocals = (binding: FileBinding): DeclarationTarget => ({\n table: Option.some(binding.locals),\n parent: Option.none(),\n});\n\nconst isExportSpecifierNamedDefault = (node: Node): boolean =>\n isExportSpecifier(node) && Option.contains(nameText(node.name), DEFAULT_NAME);\n\nconst isDefaultExport = (request: DeclareRequest): boolean =>\n Option.isSome(request.target.parent) &&\n (hasSyntacticModifier(request.node, ModifierFlags.Default) ||\n isExportSpecifierNamedDefault(request.node));\n\nconst declare: {\n (request: DeclareRequest): (binding: FileBinding) => BoundSymbol;\n (binding: FileBinding, request: DeclareRequest): BoundSymbol;\n} = Fn.dual(DATA_FIRST_ARITY, (binding: FileBinding, request: DeclareRequest): BoundSymbol => {\n const name = Option.orElse(\n Option.liftPredicate(DEFAULT_NAME, () => isDefaultExport(request)),\n () => declarationName(request.node, binding.isJs),\n );\n return declareSymbol({\n table: request.target.table,\n parent: request.target.parent,\n node: request.node,\n name,\n includes: request.flags.includes,\n excludes: request.flags.excludes,\n });\n});\n\nconst declareLocal = (binding: FileBinding, node: Node, flags: SymbolFlagPair): BoundSymbol =>\n declare(binding, { target: fileLocals(binding), node, flags });\n\nconst declareExport: {\n (node: Node, flags: SymbolFlagPair): (binding: FileBinding) => BoundSymbol;\n (binding: FileBinding, node: Node, flags: SymbolFlagPair): BoundSymbol;\n} = Fn.dual(\n DATA_FIRST_ARITY_3,\n (binding: FileBinding, node: Node, flags: SymbolFlagPair): BoundSymbol =>\n declare(binding, { target: fileExports(binding), node, flags }),\n);\n\nconst isJSDocTypeAliasWithName = (node: Node): boolean =>\n (isJSDocTypedefTag(node) || isJSDocCallbackTag(node)) && Predicate.isNotUndefined(node.name);\n\nconst isExportedMember = (node: Node): boolean =>\n hasExportModifier(node) || isJSDocTypeAliasWithName(node);\n\nconst declareAlias = (binding: FileBinding, node: Node, flags: SymbolFlagPair): BoundSymbol => {\n if (isExportSpecifier(node) || (isImportEqualsDeclaration(node) && isExportedMember(node))) {\n return declareExport(binding, node, flags);\n }\n return declareLocal(binding, node, flags);\n};\n\nconst localExportFlags = (flags: SymbolFlagPair): SymbolFlagPair => ({\n includes: Number(hasFlag(flags.includes, SymbolFlags.Value)) * SymbolFlags.ExportValue,\n excludes: flags.excludes,\n});\n\nconst declareExportedMember = (\n binding: FileBinding,\n node: Node,\n flags: SymbolFlagPair,\n): BoundSymbol => {\n if (\n hasSyntacticModifier(node, ModifierFlags.Default) &&\n Option.isNone(declarationName(node, binding.isJs))\n ) {\n return declareExport(binding, node, flags);\n }\n const local = declareLocal(binding, node, localExportFlags(flags));\n local.exportSymbol = declareExport(binding, node, flags);\n return local;\n};\n\nconst isExportedDeclaration = (binding: FileBinding, node: Node): boolean =>\n !isAmbientModule(node) && (isExportedMember(node) || binding.exportContext);\n\nconst declareModuleMember = (\n binding: FileBinding,\n node: Node,\n flags: SymbolFlagPair,\n): BoundSymbol => {\n if (hasFlag(flags.includes, SymbolFlags.Alias)) {\n return declareAlias(binding, node, flags);\n }\n if (isExportedDeclaration(binding, node)) {\n return declareExportedMember(binding, node, flags);\n }\n return declareLocal(binding, node, flags);\n};\n\nconst declareSourceFileMember: {\n (node: Node, flags: SymbolFlagPair): (binding: FileBinding) => BoundSymbol;\n (binding: FileBinding, node: Node, flags: SymbolFlagPair): BoundSymbol;\n} = Fn.dual(\n DATA_FIRST_ARITY_3,\n (binding: FileBinding, node: Node, flags: SymbolFlagPair): BoundSymbol => {\n if (binding.isExternalModule) {\n return declareModuleMember(binding, node, flags);\n }\n return declareLocal(binding, node, flags);\n },\n);\n\nconst declareBlockScoped: {\n (node: Node, flags: SymbolFlagPair): (binding: FileBinding) => BoundSymbol;\n (binding: FileBinding, node: Node, flags: SymbolFlagPair): BoundSymbol;\n} = Fn.dual(\n DATA_FIRST_ARITY_3,\n (binding: FileBinding, node: Node, flags: SymbolFlagPair): BoundSymbol => {\n if (binding.isExternalModule || Predicate.isNotUndefined(binding.commonJsModuleIndicator)) {\n return declareModuleMember(binding, node, flags);\n }\n return declareLocal(binding, node, flags);\n },\n);\n\nexport { declare, declareBlockScoped, declareExport, declareSourceFileMember, exportsOf };\nexport type { DeclarationTarget, DeclareRequest, FileBinding, Scope, SymbolFlagPair };\n","import { Option, Predicate, String as Str, Function as Fn } from \"effect\";\nimport type { BinaryExpression, CallExpression, Node } from \"typescript/ast\";\nimport { isIdentifier, isPropertyAccessExpression, isVariableDeclaration } from \"typescript/ast/is\";\nimport { SymbolFlags } from \"typescript/sync\";\n\nimport { declare, exportsOf } from \"./binder-declarations.ts\";\nimport type { FileBinding, Scope, SymbolFlagPair } from \"./binder-declarations.ts\";\nimport {\n addDeclarationToSymbol,\n createSymbol,\n escapeLeadingUnderscores,\n exportOf,\n} from \"./binder-symbols.ts\";\nimport type { BoundSymbol } from \"./binder-symbols.ts\";\nimport {\n getElementOrPropertyAccessName,\n isAccessExpression,\n isAliasableExpression,\n isAssignmentExpression,\n isExportsIdentifier,\n isModuleExportsAccessExpression,\n} from \"./binder-syntax.ts\";\nimport type { AccessExpression } from \"./binder-syntax.ts\";\nimport { EMPTY, combineFlags } from \"./flags.ts\";\n\nconst DATA_FIRST_ARITY = 2;\nconst DATA_FIRST_ARITY_3 = 3;\n\ninterface EntityNameWalk {\n readonly node: Node;\n readonly containerIsFile: boolean;\n readonly action: (\n name: Node,\n symbol: Option.Option<BoundSymbol>,\n parent: Option.Option<BoundSymbol>,\n ) => Option.Option<BoundSymbol>;\n}\n\nconst MAX_ALIAS_STEPS = 100;\nconst ALIAS_STEP = 1;\nconst EXTENSION = /\\.[^./]*$/u;\nconst MODULE_ASSIGNMENT = combineFlags(SymbolFlags.Module, SymbolFlags.Assignment);\nconst EXPORT_PROPERTY: SymbolFlagPair = {\n includes: combineFlags(SymbolFlags.Property, SymbolFlags.ExportValue),\n excludes: EMPTY,\n};\nconst EXPORT_ALIAS: SymbolFlagPair = { includes: SymbolFlags.Alias, excludes: EMPTY };\n\nconst createFileSymbol = (binding: FileBinding): void => {\n const symbol = createSymbol(EMPTY, `\"${Str.replace(EXTENSION, \"\")(binding.file.fileName)}\"`);\n addDeclarationToSymbol(symbol, binding.file, SymbolFlags.ValueModule);\n binding.symbol = symbol;\n};\n\nconst lookupSymbolForName: {\n (name: string): (binding: FileBinding) => Option.Option<BoundSymbol>;\n (binding: FileBinding, name: string): Option.Option<BoundSymbol>;\n} = Fn.dual(DATA_FIRST_ARITY, (binding: FileBinding, name: string): Option.Option<BoundSymbol> => {\n const local = Option.fromNullishOr(binding.locals.get(name)).pipe(\n Option.map((found) => found.exportSymbol ?? found),\n );\n return local.pipe(\n Option.orElse(() =>\n Option.fromNullishOr(binding.symbol).pipe(Option.flatMap((file) => exportOf(file, name))),\n ),\n );\n});\n\nconst lookupIdentifier: {\n (node: Node): (binding: FileBinding) => Option.Option<BoundSymbol>;\n (binding: FileBinding, node: Node): Option.Option<BoundSymbol>;\n} = Fn.dual(DATA_FIRST_ARITY, (binding: FileBinding, node: Node): Option.Option<BoundSymbol> =>\n Option.flatMap(Option.liftPredicate(node, isIdentifier), (identifier) =>\n lookupSymbolForName(binding, escapeLeadingUnderscores(identifier.text)),\n ),\n);\n\nconst variableInitializer: {\n (node: Node): (binding: FileBinding) => Option.Option<Node>;\n (binding: FileBinding, node: Node): Option.Option<Node>;\n} = Fn.dual(DATA_FIRST_ARITY, (binding: FileBinding, node: Node): Option.Option<Node> =>\n lookupIdentifier(binding, node).pipe(\n Option.flatMap((symbol) => Option.fromNullishOr(symbol.valueDeclaration)),\n Option.filter(isVariableDeclaration),\n Option.flatMap((declaration) => Option.fromNullishOr(declaration.initializer)),\n ),\n);\n\nconst aliasSources = (binding: FileBinding, node: Node): readonly Node[] =>\n variableInitializer(binding, node).pipe(\n Option.map((initializer): readonly Node[] =>\n Option.match(Option.liftPredicate(initializer, isAssignmentExpression), {\n onNone: () => [initializer],\n onSome: (assignment) => [initializer, assignment.left, assignment.right],\n }),\n ),\n Option.getOrElse((): readonly Node[] => []),\n );\n\nconst isExportsReference = (node: Node): boolean =>\n isExportsIdentifier(node) || isModuleExportsAccessExpression(node);\n\nconst searchExportsAlias = (\n binding: FileBinding,\n queue: readonly Node[],\n steps: number,\n): boolean => {\n const [next, ...rest] = queue;\n if (Predicate.isUndefined(next) || steps >= MAX_ALIAS_STEPS) {\n return false;\n }\n return (\n isExportsReference(next) ||\n searchExportsAlias(binding, [...rest, ...aliasSources(binding, next)], steps + ALIAS_STEP)\n );\n};\n\nconst isExportsOrModuleExportsOrAlias: {\n (node: Node): (binding: FileBinding) => boolean;\n (binding: FileBinding, node: Node): boolean;\n} = Fn.dual(DATA_FIRST_ARITY, (binding: FileBinding, node: Node): boolean =>\n searchExportsAlias(binding, [node], EMPTY),\n);\n\nconst setCommonJsModuleIndicator: {\n (node: Node): (binding: FileBinding) => boolean;\n (binding: FileBinding, node: Node): boolean;\n} = Fn.dual(DATA_FIRST_ARITY, (binding: FileBinding, node: Node): boolean => {\n if (binding.isExternalModule) {\n return false;\n }\n if (Predicate.isUndefined(binding.commonJsModuleIndicator)) {\n binding.commonJsModuleIndicator = node;\n createFileSymbol(binding);\n }\n return true;\n});\n\nconst accessNameOrArgument = (node: AccessExpression): Node => {\n if (isPropertyAccessExpression(node)) {\n return node.name;\n }\n return node.argumentExpression;\n};\n\nconst lookupInFileContainer = (\n binding: FileBinding,\n walk: EntityNameWalk,\n): Option.Option<BoundSymbol> =>\n Option.liftPredicate(binding, () => walk.containerIsFile).pipe(\n Option.flatMap((bound) => lookupIdentifier(bound, walk.node)),\n );\n\nconst memberOfAccess = (\n node: AccessExpression,\n parent: Option.Option<BoundSymbol>,\n): Option.Option<BoundSymbol> =>\n getElementOrPropertyAccessName(node).pipe(\n Option.flatMap((key) => parent.pipe(Option.flatMap((symbol) => exportOf(symbol, key)))),\n );\n\nconst forEachIdentifierInEntityName: {\n (walk: EntityNameWalk): (binding: FileBinding) => Option.Option<BoundSymbol>;\n (binding: FileBinding, walk: EntityNameWalk): Option.Option<BoundSymbol>;\n} = Fn.dual(\n DATA_FIRST_ARITY,\n (binding: FileBinding, walk: EntityNameWalk): Option.Option<BoundSymbol> => {\n const { node } = walk;\n if (isExportsOrModuleExportsOrAlias(binding, node)) {\n return Option.fromNullishOr(binding.symbol);\n }\n if (isIdentifier(node)) {\n return walk.action(node, lookupInFileContainer(binding, walk), Option.none());\n }\n if (!isAccessExpression(node)) {\n return Option.none();\n }\n const parent = forEachIdentifierInEntityName(binding, { ...walk, node: node.expression });\n return walk.action(accessNameOrArgument(node), memberOfAccess(node, parent), parent);\n },\n);\n\nconst markModuleAssignment = (\n name: Node,\n symbol: Option.Option<BoundSymbol>,\n): Option.Option<BoundSymbol> =>\n symbol.pipe(\n Option.map((found) => {\n addDeclarationToSymbol(found, name, MODULE_ASSIGNMENT);\n return found;\n }),\n );\n\nconst exportsPropertyFlags = (node: BinaryExpression): SymbolFlagPair => {\n const target = node.left;\n const isAlias =\n isAliasableExpression(node.right) &&\n isAccessExpression(target) &&\n (isExportsIdentifier(target.expression) || isModuleExportsAccessExpression(target.expression));\n return Option.getOrElse(\n Option.liftPredicate(EXPORT_ALIAS, () => isAlias),\n () => EXPORT_PROPERTY,\n );\n};\n\nconst bindExportsPropertyAssignment: {\n (node: BinaryExpression, scope: Scope): (binding: FileBinding) => void;\n (binding: FileBinding, node: BinaryExpression, scope: Scope): void;\n} = Fn.dual(\n DATA_FIRST_ARITY_3,\n (binding: FileBinding, node: BinaryExpression, scope: Scope): void => {\n const { left } = node;\n if (!setCommonJsModuleIndicator(binding, node) || !isAccessExpression(left)) {\n return;\n }\n const owner = forEachIdentifierInEntityName(binding, {\n node: left.expression,\n containerIsFile: scope.containerIsFile,\n action: markModuleAssignment,\n });\n if (Option.isSome(owner)) {\n declare(binding, { target: exportsOf(owner), node: left, flags: exportsPropertyFlags(node) });\n }\n },\n);\n\nconst bindObjectDefinePropertyExport: {\n (node: CallExpression, scope: Scope): (binding: FileBinding) => void;\n (binding: FileBinding, node: CallExpression, scope: Scope): void;\n} = Fn.dual(\n DATA_FIRST_ARITY_3,\n (binding: FileBinding, node: CallExpression, scope: Scope): void => {\n const [target] = node.arguments;\n if (!setCommonJsModuleIndicator(binding, node) || Predicate.isUndefined(target)) {\n return;\n }\n const owner = forEachIdentifierInEntityName(binding, {\n node: target,\n containerIsFile: scope.containerIsFile,\n action: markModuleAssignment,\n });\n if (Option.isSome(owner)) {\n declare(binding, { target: exportsOf(owner), node, flags: EXPORT_PROPERTY });\n }\n },\n);\n\nexport {\n bindExportsPropertyAssignment,\n bindObjectDefinePropertyExport,\n createFileSymbol,\n forEachIdentifierInEntityName,\n isExportsOrModuleExportsOrAlias,\n lookupIdentifier,\n lookupSymbolForName,\n setCommonJsModuleIndicator,\n variableInitializer,\n};\nexport type { EntityNameWalk };\n","import { Predicate } from \"effect\";\nimport { SyntaxKind } from \"typescript/ast\";\nimport type { Node } from \"typescript/ast\";\nimport { isSourceFile } from \"typescript/ast/is\";\n\nconst CONTAINER_KINDS: ReadonlySet<SyntaxKind> = new Set([\n SyntaxKind.ClassExpression,\n SyntaxKind.ClassDeclaration,\n SyntaxKind.EnumDeclaration,\n SyntaxKind.ObjectLiteralExpression,\n SyntaxKind.TypeLiteral,\n SyntaxKind.JSDocTypeLiteral,\n SyntaxKind.JsxAttributes,\n SyntaxKind.InterfaceDeclaration,\n SyntaxKind.ModuleDeclaration,\n SyntaxKind.TypeAliasDeclaration,\n SyntaxKind.MappedType,\n SyntaxKind.IndexSignature,\n SyntaxKind.SourceFile,\n SyntaxKind.GetAccessor,\n SyntaxKind.SetAccessor,\n SyntaxKind.MethodDeclaration,\n SyntaxKind.Constructor,\n SyntaxKind.FunctionDeclaration,\n SyntaxKind.MethodSignature,\n SyntaxKind.CallSignature,\n SyntaxKind.JSDocSignature,\n SyntaxKind.FunctionType,\n SyntaxKind.ConstructSignature,\n SyntaxKind.ConstructorType,\n SyntaxKind.ClassStaticBlockDeclaration,\n SyntaxKind.FunctionExpression,\n SyntaxKind.ArrowFunction,\n]);\n\nconst FUNCTION_LIKE_KINDS: ReadonlySet<SyntaxKind> = new Set([\n SyntaxKind.FunctionDeclaration,\n SyntaxKind.FunctionExpression,\n SyntaxKind.ArrowFunction,\n SyntaxKind.MethodDeclaration,\n SyntaxKind.Constructor,\n SyntaxKind.GetAccessor,\n SyntaxKind.SetAccessor,\n SyntaxKind.ClassStaticBlockDeclaration,\n SyntaxKind.MethodSignature,\n SyntaxKind.CallSignature,\n SyntaxKind.ConstructSignature,\n SyntaxKind.IndexSignature,\n SyntaxKind.FunctionType,\n SyntaxKind.ConstructorType,\n SyntaxKind.JSDocSignature,\n]);\n\nconst BLOCK_SCOPE_KINDS: ReadonlySet<SyntaxKind> = new Set([\n SyntaxKind.ModuleBlock,\n SyntaxKind.CatchClause,\n SyntaxKind.ForStatement,\n SyntaxKind.ForInStatement,\n SyntaxKind.ForOfStatement,\n SyntaxKind.CaseBlock,\n]);\n\nconst isContainer = (node: Node): boolean => CONTAINER_KINDS.has(node.kind);\n\nconst isFunctionLike = (node: Node | undefined): node is Node =>\n Predicate.isNotUndefined(node) && FUNCTION_LIKE_KINDS.has(node.kind);\n\nconst isBlockScopeContainer = (node: Node): boolean =>\n isContainer(node) ||\n BLOCK_SCOPE_KINDS.has(node.kind) ||\n (node.kind === SyntaxKind.Block && !isFunctionLike(node.parent));\n\nconst hasAncestor = (node: Node, predicate: (candidate: Node) => boolean): boolean => {\n let current = node.parent;\n while (!isSourceFile(current)) {\n if (predicate(current)) {\n return true;\n }\n current = current.parent;\n }\n return false;\n};\n\nconst containerIsFile = (node: Node): boolean => !hasAncestor(node, isContainer);\n\nconst blockScopeIsFile = (node: Node): boolean => !hasAncestor(node, isBlockScopeContainer);\n\nexport { blockScopeIsFile, containerIsFile, isBlockScopeContainer, isContainer, isFunctionLike };\n","import { Array as Arr, Predicate, pipe, Function as Fn } from \"effect\";\nimport type { JSDocCallbackTag, JSDocTag, JSDocTypedefTag, Node } from \"typescript/ast\";\nimport { isIdentifier, isJSDoc, isJSDocCallbackTag, isJSDocTypedefTag } from \"typescript/ast/is\";\nimport { SymbolFlags } from \"typescript/sync\";\n\nimport { declareBlockScoped } from \"./binder-declarations.ts\";\nimport type { FileBinding, SymbolFlagPair } from \"./binder-declarations.ts\";\nimport { blockScopeIsFile, containerIsFile } from \"./binder-scopes.ts\";\n\nconst DATA_FIRST_ARITY = 2;\n\ntype TypeAliasTag = JSDocCallbackTag | JSDocTypedefTag;\n\ninterface TypeAliasTagSite {\n readonly tag: TypeAliasTag;\n readonly host: Node;\n}\n\nconst TYPE_ALIAS: SymbolFlagPair = {\n includes: SymbolFlags.TypeAlias,\n excludes: SymbolFlags.TypeAliasExcludes,\n};\n\nconst NO_TAGS: readonly JSDocTag[] = [];\n\nconst isTypeAliasTag = (tag: JSDocTag): tag is TypeAliasTag =>\n isJSDocTypedefTag(tag) || isJSDocCallbackTag(tag);\n\nconst typeAliasTagsOf = (host: Node): readonly TypeAliasTag[] =>\n pipe(\n host.jsDoc ?? [],\n Arr.filter(isJSDoc),\n Arr.flatMap((doc) => pipe(doc.tags ?? NO_TAGS, Arr.filter(isTypeAliasTag))),\n );\n\nconst typeAliasTagSites = (hosts: readonly Node[]): readonly TypeAliasTagSite[] =>\n Arr.dedupeWith(\n pipe(\n hosts,\n Arr.flatMap((host) =>\n pipe(\n typeAliasTagsOf(host),\n Arr.map((tag) => ({ tag, host })),\n ),\n ),\n ),\n (left, right) => left.tag.pos === right.tag.pos,\n );\n\nconst declaresFileTypeAlias = (site: TypeAliasTagSite): boolean =>\n Predicate.isNotUndefined(site.tag.name) &&\n isIdentifier(site.tag.name) &&\n containerIsFile(site.host) &&\n blockScopeIsFile(site.host);\n\nconst bindJSDocTypeAliases: {\n (hosts: readonly Node[]): (binding: FileBinding) => void;\n (binding: FileBinding, hosts: readonly Node[]): void;\n} = Fn.dual(DATA_FIRST_ARITY, (binding: FileBinding, hosts: readonly Node[]): void => {\n for (const site of typeAliasTagSites(hosts)) {\n if (declaresFileTypeAlias(site)) {\n declareBlockScoped(binding, site.tag, TYPE_ALIAS);\n }\n }\n});\n\nexport { bindJSDocTypeAliases };\n","import { Array as Arr, Option } from \"effect\";\nimport { SyntaxKind } from \"typescript/ast\";\nimport type { Node } from \"typescript/ast\";\nimport {\n isArrowFunction,\n isBinaryExpression,\n isCallExpression,\n isClassExpression,\n isFunctionDeclaration,\n isFunctionExpression,\n isObjectLiteralExpression,\n isPropertyAccessExpression,\n isVariableDeclaration,\n} from \"typescript/ast/is\";\nimport { SymbolFlags } from \"typescript/sync\";\n\nimport { isPrototypeAccess } from \"./binder-assignment.ts\";\nimport { isFunctionLike } from \"./binder-scopes.ts\";\nimport type { BoundSymbol } from \"./binder-symbols.ts\";\nimport {\n getRightMostAssignedExpression,\n isAssignmentExpression,\n skipParentheses,\n} from \"./binder-syntax.ts\";\nimport { combineFlags, hasFlag } from \"./flags.ts\";\n\nconst EXPANDO_FLAGS = combineFlags(\n SymbolFlags.Function,\n SymbolFlags.Class,\n SymbolFlags.NamespaceModule,\n);\n\nconst isFunctionOrArrow = (node: Node): boolean =>\n isFunctionExpression(node) || isArrowFunction(node);\n\nconst expandoInitializer = (\n initializer: Node,\n isPrototypeAssignment: boolean,\n): Option.Option<Node> => {\n if (isCallExpression(initializer)) {\n return Option.liftPredicate(initializer, () =>\n isFunctionOrArrow(skipParentheses(initializer.expression)),\n );\n }\n if (isFunctionOrArrow(initializer) || isClassExpression(initializer)) {\n return Option.some(initializer);\n }\n return Option.liftPredicate(\n initializer,\n (candidate) =>\n isObjectLiteralExpression(candidate) &&\n (!Arr.isReadonlyArrayNonEmpty(candidate.properties) || isPrototypeAssignment),\n );\n};\n\nconst assignedExpandoInitializer = (node: Node): Option.Option<Node> =>\n Option.flatMap(Option.liftPredicate(node.parent, isAssignmentExpression), (assignment) =>\n expandoInitializer(assignment.right, isPrototypeAccess(assignment.left)),\n );\n\nconst assignedRight = (node: Node): Option.Option<Node> =>\n Option.liftPredicate(node.parent, isBinaryExpression).pipe(\n Option.filter(() => isPropertyAccessExpression(node)),\n Option.map((assignment) => assignment.right),\n );\n\nconst initializerOf = (node: Node): Option.Option<Node> => {\n if (isVariableDeclaration(node)) {\n return Option.fromNullishOr(node.initializer);\n }\n if (isBinaryExpression(node)) {\n return Option.some(node.right);\n }\n return assignedRight(node);\n};\n\nconst prototypeTargetOf = (node: Node): Node => {\n if (isVariableDeclaration(node)) {\n return node.name;\n }\n if (isBinaryExpression(node)) {\n return node.left;\n }\n return node;\n};\n\nconst isDefaultingOperator = (kind: SyntaxKind): boolean =>\n kind === SyntaxKind.BarBarToken || kind === SyntaxKind.QuestionQuestionToken;\n\nconst defaultedValue = (node: Node): Node => {\n if (isBinaryExpression(node) && isDefaultingOperator(node.operatorToken.kind)) {\n return node.right;\n }\n return node;\n};\n\nconst declarationIsExpando = (node: Node): boolean => {\n if (isCallExpression(node)) {\n return Option.isSome(assignedExpandoInitializer(node));\n }\n const isPrototype = isPrototypeAccess(prototypeTargetOf(node));\n return initializerOf(node).pipe(\n Option.map((initializer) => defaultedValue(getRightMostAssignedExpression(initializer))),\n Option.flatMap((value) => expandoInitializer(value, isPrototype)),\n Option.isSome,\n );\n};\n\nconst isExpandoSymbol = (symbol: BoundSymbol): boolean =>\n hasFlag(symbol.flags, EXPANDO_FLAGS) ||\n Option.exists(Option.fromNullishOr(symbol.valueDeclaration), declarationIsExpando);\n\nconst isFunctionSymbol = (symbol: Option.Option<BoundSymbol>): boolean =>\n symbol.pipe(\n Option.flatMap((found) => Option.fromNullishOr(found.valueDeclaration)),\n Option.exists(\n (declaration) =>\n isFunctionDeclaration(declaration) ||\n (isVariableDeclaration(declaration) && isFunctionLike(declaration.initializer)),\n ),\n );\n\nconst hasFunctionLikeExpandoInitializer = (declaration: Node): boolean =>\n Option.exists(assignedExpandoInitializer(declaration), isFunctionOrArrow);\n\nexport { hasFunctionLikeExpandoInitializer, isExpandoSymbol, isFunctionSymbol };\n","import { Option, Predicate, Array as Arr, pipe, Function as Fn } from \"effect\";\nimport type { BinaryExpression, CallExpression, Node } from \"typescript/ast\";\nimport {\n isBinaryExpression,\n isCallExpression,\n isIdentifier,\n isObjectLiteralExpression,\n isSourceFile,\n} from \"typescript/ast/is\";\nimport { SymbolFlags } from \"typescript/sync\";\n\nimport {\n bindExportsPropertyAssignment,\n forEachIdentifierInEntityName,\n isExportsOrModuleExportsOrAlias,\n lookupIdentifier,\n} from \"./binder-cjs.ts\";\nimport { declare, exportsOf } from \"./binder-declarations.ts\";\nimport type { FileBinding, Scope, SymbolFlagPair } from \"./binder-declarations.ts\";\nimport {\n hasFunctionLikeExpandoInitializer,\n isExpandoSymbol,\n isFunctionSymbol,\n} from \"./binder-expando-symbol.ts\";\nimport { addDeclarationToSymbol, exportOf } from \"./binder-symbols.ts\";\nimport type { BoundSymbol } from \"./binder-symbols.ts\";\nimport {\n getElementOrPropertyAccessName,\n isAccessExpression,\n isDynamicElementAccess,\n} from \"./binder-syntax.ts\";\nimport type { AccessExpression } from \"./binder-syntax.ts\";\nimport { EMPTY, combineFlags, hasFlag, withFlags, withoutFlags } from \"./flags.ts\";\n\nconst DATA_FIRST_ARITY_3 = 3;\n\nconst DESCRIPTOR_ARGUMENT = 2;\n\nconst NAMESPACE_FLAGS: SymbolFlagPair = {\n includes: combineFlags(SymbolFlags.Module, SymbolFlags.Assignment),\n excludes: withoutFlags(SymbolFlags.ValueModuleExcludes, SymbolFlags.Assignment),\n};\n\nconst METHOD_FLAGS: SymbolFlagPair = {\n includes: SymbolFlags.Method,\n excludes: SymbolFlags.MethodExcludes,\n};\n\nconst PROPERTY_FLAGS: SymbolFlagPair = {\n includes: SymbolFlags.Property,\n excludes: SymbolFlags.PropertyExcludes,\n};\n\nconst ACCESSOR_FLAGS: readonly (readonly [string, SymbolFlagPair])[] = [\n [\n \"set\",\n {\n includes: combineFlags(SymbolFlags.SetAccessor, SymbolFlags.Property),\n excludes: SymbolFlags.SetAccessorExcludes,\n },\n ],\n [\n \"get\",\n {\n includes: combineFlags(SymbolFlags.GetAccessor, SymbolFlags.Property),\n excludes: SymbolFlags.GetAccessorExcludes,\n },\n ],\n];\n\nconst lookupSymbolForPropertyAccess = (\n binding: FileBinding,\n node: Node,\n): Option.Option<BoundSymbol> => {\n if (isIdentifier(node)) {\n return lookupIdentifier(binding, node);\n }\n if (!isAccessExpression(node)) {\n return Option.none();\n }\n const parent = lookupSymbolForPropertyAccess(binding, node.expression);\n return getElementOrPropertyAccessName(node).pipe(\n Option.flatMap((name) => parent.pipe(Option.flatMap((owner) => exportOf(owner, name)))),\n );\n};\n\nconst isAliasSymbol = (symbol: Option.Option<BoundSymbol>): boolean =>\n Option.exists(symbol, (found) => hasFlag(found.flags, SymbolFlags.Alias));\n\nconst addNamespaceDeclaration =\n (binding: FileBinding) =>\n (\n name: Node,\n symbol: Option.Option<BoundSymbol>,\n parent: Option.Option<BoundSymbol>,\n ): Option.Option<BoundSymbol> => {\n if (Option.isSome(symbol)) {\n addDeclarationToSymbol(symbol.value, name, NAMESPACE_FLAGS.includes);\n return symbol;\n }\n return parent.pipe(\n Option.map((owner) =>\n declare(binding, {\n target: exportsOf(Option.some(owner)),\n node: name,\n flags: NAMESPACE_FLAGS,\n }),\n ),\n );\n };\n\nconst bindMissingNamespaces = (\n binding: FileBinding,\n entityName: Node,\n): Option.Option<BoundSymbol> =>\n forEachIdentifierInEntityName(binding, {\n node: entityName,\n containerIsFile: true,\n action: addNamespaceDeclaration(binding),\n });\n\nconst descriptorPropertyNames = (call: CallExpression): readonly string[] => {\n const descriptor = call.arguments[DESCRIPTOR_ARGUMENT];\n if (Predicate.isUndefined(descriptor) || !isObjectLiteralExpression(descriptor)) {\n return [];\n }\n return pipe(\n descriptor.properties,\n Arr.flatMap((property) => {\n if (\"name\" in property && isIdentifier(property.name)) {\n return [property.name.text];\n }\n return [];\n }),\n );\n};\n\nconst accessorFlags = (call: CallExpression): SymbolFlagPair => {\n const names = descriptorPropertyNames(call);\n const matched = pipe(\n ACCESSOR_FLAGS,\n Arr.filter(([name]) => names.includes(name)),\n Arr.map(([, flags]) => flags),\n );\n return {\n includes: combineFlags(\n ...pipe(\n matched,\n Arr.map((flags) => flags.includes),\n ),\n ),\n excludes: combineFlags(\n ...pipe(\n matched,\n Arr.map((flags) => flags.excludes),\n ),\n ),\n };\n};\n\nconst expandoMemberFlags = (declaration: Node): SymbolFlagPair => {\n if (hasFunctionLikeExpandoInitializer(declaration)) {\n return METHOD_FLAGS;\n }\n if (isCallExpression(declaration)) {\n const accessors = accessorFlags(declaration);\n if (accessors.includes !== EMPTY) {\n return accessors;\n }\n }\n return PROPERTY_FLAGS;\n};\n\nconst bindExpandoMember = (\n binding: FileBinding,\n declaration: Node,\n namespace: Option.Option<BoundSymbol>,\n): void => {\n const owner = namespace.pipe(Option.filter(isExpandoSymbol));\n if (Option.isNone(owner)) {\n return;\n }\n owner.value.exports ??= new Map();\n const flags = expandoMemberFlags(declaration);\n declare(binding, {\n target: exportsOf(owner),\n node: declaration,\n flags: {\n includes: withFlags(flags.includes, SymbolFlags.Assignment),\n excludes: withoutFlags(flags.excludes, SymbolFlags.Assignment),\n },\n });\n};\n\nconst parentOfBinaryChain = (node: Node): Node => {\n let current = node;\n while (isBinaryExpression(current.parent)) {\n current = current.parent;\n }\n return current.parent;\n};\n\nconst isTopLevelNamespaceAssignment = (access: AccessExpression): boolean => {\n if (isBinaryExpression(access.parent)) {\n return isSourceFile(parentOfBinaryChain(access.parent).parent);\n }\n return isSourceFile(access.parent.parent);\n};\n\nconst namespaceFor = (\n binding: FileBinding,\n target: Node,\n isTopLevel: boolean,\n): Option.Option<BoundSymbol> => {\n const found = lookupSymbolForPropertyAccess(binding, target);\n if (isTopLevel && !isAliasSymbol(found)) {\n return bindMissingNamespaces(binding, target);\n }\n return found;\n};\n\nconst leftmostRoot = (node: Node): Node => {\n let current = node;\n while (isAccessExpression(current)) {\n current = current.expression;\n }\n return current;\n};\n\nconst skipsPropertyAssignment = (binding: FileBinding, left: AccessExpression): boolean =>\n (!binding.isJs && !isFunctionSymbol(lookupSymbolForPropertyAccess(binding, left.expression))) ||\n isAliasSymbol(lookupIdentifier(binding, leftmostRoot(left)));\n\nconst bindPropertyOfNamespace = (binding: FileBinding, left: AccessExpression): void => {\n const namespace = namespaceFor(binding, left.expression, isTopLevelNamespaceAssignment(left));\n if (!isDynamicElementAccess(left)) {\n bindExpandoMember(binding, left, namespace);\n }\n};\n\nconst bindableAccess = (\n binding: FileBinding,\n node: BinaryExpression,\n scope: Scope,\n): Option.Option<AccessExpression> =>\n Option.liftPredicate(node.left, isAccessExpression).pipe(\n Option.filter((left) => scope.containerIsFile && !skipsPropertyAssignment(binding, left)),\n );\n\nconst isExportsAliasAccess = (binding: FileBinding, left: AccessExpression): boolean =>\n isIdentifier(left.expression) && isExportsOrModuleExportsOrAlias(binding, left.expression);\n\nconst bindSpecialPropertyAssignment: {\n (node: BinaryExpression, scope: Scope): (binding: FileBinding) => void;\n (binding: FileBinding, node: BinaryExpression, scope: Scope): void;\n} = Fn.dual(\n DATA_FIRST_ARITY_3,\n (binding: FileBinding, node: BinaryExpression, scope: Scope): void => {\n const left = bindableAccess(binding, node, scope);\n if (Option.isNone(left)) {\n return;\n }\n if (isExportsAliasAccess(binding, left.value)) {\n bindExportsPropertyAssignment(binding, node, scope);\n return;\n }\n bindPropertyOfNamespace(binding, left.value);\n },\n);\n\nconst bindObjectDefinePropertyAssignment: {\n (call: CallExpression, scope: Scope): (binding: FileBinding) => void;\n (binding: FileBinding, call: CallExpression, scope: Scope): void;\n} = Fn.dual(\n DATA_FIRST_ARITY_3,\n (binding: FileBinding, call: CallExpression, scope: Scope): void => {\n const [target] = call.arguments;\n if (!scope.containerIsFile || Predicate.isUndefined(target)) {\n return;\n }\n const isTopLevel = isSourceFile(call.parent.parent);\n bindExpandoMember(binding, call, namespaceFor(binding, target, isTopLevel));\n },\n);\n\nexport { bindObjectDefinePropertyAssignment, bindSpecialPropertyAssignment };\n","import { Array as Arr, Option, Predicate, pipe, Function as Fn } from \"effect\";\nimport type { BinaryExpression, Node } from \"typescript/ast\";\nimport { isObjectLiteralExpression, isShorthandPropertyAssignment } from \"typescript/ast/is\";\nimport { SymbolFlags } from \"typescript/sync\";\n\nimport {\n isExportsOrModuleExportsOrAlias,\n lookupSymbolForName,\n setCommonJsModuleIndicator,\n} from \"./binder-cjs.ts\";\nimport { declare, declareExport } from \"./binder-declarations.ts\";\nimport type { FileBinding, Scope, SymbolFlagPair } from \"./binder-declarations.ts\";\nimport { setValueDeclaration } from \"./binder-symbols.ts\";\nimport {\n getRightMostAssignedExpression,\n isAccessExpression,\n isAliasableExpression,\n isModuleExportsAccessExpression,\n} from \"./binder-syntax.ts\";\nimport { EMPTY, combineFlags } from \"./flags.ts\";\n\nconst DATA_FIRST_ARITY_3 = 3;\n\nconst isEmptyObjectLiteral = (node: Node): boolean =>\n isObjectLiteralExpression(node) && !Arr.isReadonlyArrayNonEmpty(node.properties);\n\nconst MODULE_EXPORTS_ALIAS: SymbolFlagPair = {\n includes: combineFlags(SymbolFlags.Alias, SymbolFlags.Assignment),\n excludes: EMPTY,\n};\nconst MODULE_EXPORTS_VALUE: SymbolFlagPair = {\n includes: combineFlags(\n SymbolFlags.Property,\n SymbolFlags.ExportValue,\n SymbolFlags.ValueModule,\n SymbolFlags.Assignment,\n ),\n excludes: EMPTY,\n};\n\nconst bindShorthandExports = (binding: FileBinding, assigned: Node): boolean => {\n if (\n !isObjectLiteralExpression(assigned) ||\n !pipe(assigned.properties, Arr.every(isShorthandPropertyAssignment))\n ) {\n return false;\n }\n for (const property of assigned.properties) {\n declareExport(binding, property, MODULE_EXPORTS_ALIAS);\n }\n return true;\n};\n\nconst isUnboundModuleExportsValue = (binding: FileBinding, assigned: Node, scope: Scope): boolean =>\n isEmptyObjectLiteral(assigned) ||\n (scope.containerIsFile && isExportsOrModuleExportsOrAlias(binding, assigned));\n\nconst bindModuleExportsAssignment: {\n (node: BinaryExpression, scope: Scope): (binding: FileBinding) => void;\n (binding: FileBinding, node: BinaryExpression, scope: Scope): void;\n} = Fn.dual(\n DATA_FIRST_ARITY_3,\n (binding: FileBinding, node: BinaryExpression, scope: Scope): void => {\n const assigned = getRightMostAssignedExpression(node.right);\n if (\n !setCommonJsModuleIndicator(binding, node) ||\n isUnboundModuleExportsValue(binding, assigned, scope) ||\n bindShorthandExports(binding, assigned)\n ) {\n return;\n }\n const flags = Option.getOrElse(\n Option.liftPredicate(MODULE_EXPORTS_ALIAS, () => isAliasableExpression(node.right)),\n () => MODULE_EXPORTS_VALUE,\n );\n setValueDeclaration(declareExport(binding, node, flags), node);\n },\n);\n\nconst MODULE_LOCAL: SymbolFlagPair = {\n includes: combineFlags(SymbolFlags.FunctionScopedVariable, SymbolFlags.ModuleExports),\n excludes: SymbolFlags.FunctionScopedVariableExcludes,\n};\n\nconst shadowsModule = (binding: FileBinding, scope: Scope): boolean =>\n scope.blockIsFile && Option.isSome(lookupSymbolForName(binding, \"module\"));\n\nconst isTrackedModuleExportsAccess = (binding: FileBinding, node: Node): boolean =>\n binding.isJs &&\n Predicate.isNotUndefined(binding.commonJsModuleIndicator) &&\n isModuleExportsAccessExpression(node);\n\nconst bindModuleExportsAccess: {\n (node: Node, scope: Scope): (binding: FileBinding) => void;\n (binding: FileBinding, node: Node, scope: Scope): void;\n} = Fn.dual(DATA_FIRST_ARITY_3, (binding: FileBinding, node: Node, scope: Scope): void => {\n if (\n !isAccessExpression(node) ||\n !isTrackedModuleExportsAccess(binding, node) ||\n shadowsModule(binding, scope)\n ) {\n return;\n }\n declare(binding, {\n target: { table: Option.some(binding.locals), parent: Option.none() },\n node: node.expression,\n flags: MODULE_LOCAL,\n });\n});\n\nexport { bindModuleExportsAccess, bindModuleExportsAssignment };\n","import { Option, Predicate, Function as Fn } from \"effect\";\nimport { SyntaxKind } from \"typescript/ast\";\nimport type { BinaryExpression, Node } from \"typescript/ast\";\nimport { isSourceFile } from \"typescript/ast/is\";\nimport { SymbolFlags } from \"typescript/sync\";\n\nimport { variableInitializer } from \"./binder-cjs.ts\";\nimport { declareExport, declareSourceFileMember } from \"./binder-declarations.ts\";\nimport type { FileBinding, SymbolFlagPair } from \"./binder-declarations.ts\";\nimport { isAccessExpression, isDynamicElementAccess, isThisKeyword } from \"./binder-syntax.ts\";\nimport { EMPTY, combineFlags } from \"./flags.ts\";\n\nconst DATA_FIRST_ARITY = 2;\n\nconst THIS_CONTAINER_KINDS: ReadonlySet<SyntaxKind> = new Set([\n SyntaxKind.FunctionDeclaration,\n SyntaxKind.FunctionExpression,\n SyntaxKind.ModuleDeclaration,\n SyntaxKind.ClassStaticBlockDeclaration,\n SyntaxKind.PropertyDeclaration,\n SyntaxKind.PropertySignature,\n SyntaxKind.MethodDeclaration,\n SyntaxKind.MethodSignature,\n SyntaxKind.Constructor,\n SyntaxKind.GetAccessor,\n SyntaxKind.SetAccessor,\n SyntaxKind.CallSignature,\n SyntaxKind.ConstructSignature,\n SyntaxKind.IndexSignature,\n SyntaxKind.EnumDeclaration,\n SyntaxKind.SourceFile,\n]);\n\nconst THIS_PROPERTY_EXPORT: SymbolFlagPair = {\n includes: combineFlags(SymbolFlags.Property, SymbolFlags.ExportValue),\n excludes: EMPTY,\n};\n\nconst THIS_PROPERTY_LOCAL: SymbolFlagPair = {\n includes: SymbolFlags.FunctionScopedVariable,\n excludes: SymbolFlags.FunctionScopedVariableExcludes,\n};\n\nconst thisContainerIsFile = (node: Node): boolean => {\n let current = node.parent;\n while (!THIS_CONTAINER_KINDS.has(current.kind)) {\n current = current.parent;\n }\n return isSourceFile(current);\n};\n\nconst bindThisPropertyAssignment: {\n (node: BinaryExpression): (binding: FileBinding) => void;\n (binding: FileBinding, node: BinaryExpression): void;\n} = Fn.dual(DATA_FIRST_ARITY, (binding: FileBinding, node: BinaryExpression): void => {\n if (!thisContainerIsFile(node) || isDynamicElementAccess(node.left)) {\n return;\n }\n if (Predicate.isNotUndefined(binding.commonJsModuleIndicator)) {\n declareExport(binding, node, THIS_PROPERTY_EXPORT);\n return;\n }\n declareSourceFileMember(binding, node, THIS_PROPERTY_LOCAL);\n});\n\nconst isThisInitialized: {\n (node: BinaryExpression): (binding: FileBinding) => boolean;\n (binding: FileBinding, node: BinaryExpression): boolean;\n} = Fn.dual(\n DATA_FIRST_ARITY,\n (binding: FileBinding, node: BinaryExpression): boolean =>\n isAccessExpression(node.left) &&\n variableInitializer(binding, node.left.expression).pipe(Option.exists(isThisKeyword)),\n);\n\nexport { bindThisPropertyAssignment, isThisInitialized };\n","import { Function as Fn, Predicate } from \"effect\";\nimport type { BinaryExpression, CallExpression, Node } from \"typescript/ast\";\nimport { isBinaryExpression, isCallExpression } from \"typescript/ast/is\";\n\nimport { AssignmentKind, getAssignmentDeclarationKind } from \"./binder-assignment.ts\";\nimport type { AssignmentDeclarationKind } from \"./binder-assignment.ts\";\nimport {\n bindExportsPropertyAssignment,\n bindObjectDefinePropertyExport,\n setCommonJsModuleIndicator,\n} from \"./binder-cjs.ts\";\nimport type { FileBinding, Scope } from \"./binder-declarations.ts\";\nimport {\n bindObjectDefinePropertyAssignment,\n bindSpecialPropertyAssignment,\n} from \"./binder-expando.ts\";\nimport { bindModuleExportsAccess, bindModuleExportsAssignment } from \"./binder-module-exports.ts\";\nimport { isRequireCall } from \"./binder-syntax.ts\";\nimport { bindThisPropertyAssignment, isThisInitialized } from \"./binder-this.ts\";\n\nconst EXPRESSION_ARITY = 3;\n\ntype ExpressionBinder<Bound extends Node> = (\n binding: FileBinding,\n node: Bound,\n scope: Scope,\n) => void;\n\nconst isThisAliasAssignment: (\n binding: FileBinding,\n node: BinaryExpression,\n scope: Scope,\n) => boolean = (binding, node, scope) =>\n binding.isJs && scope.blockIsFile && isThisInitialized(binding, node);\n\nconst bindPropertyAssignment: ExpressionBinder<BinaryExpression> = (binding, node, scope) => {\n if (isThisAliasAssignment(binding, node, scope)) {\n bindThisPropertyAssignment(binding, node);\n return;\n }\n bindSpecialPropertyAssignment(binding, node, scope);\n};\n\nconst BINARY_BINDERS: ReadonlyMap<\n AssignmentDeclarationKind,\n ExpressionBinder<BinaryExpression>\n> = new Map([\n [\n AssignmentKind.ExportsProperty,\n (binding, node, scope) => {\n bindExportsPropertyAssignment(binding, node, scope);\n },\n ],\n [\n AssignmentKind.ModuleExports,\n (binding, node, scope) => {\n bindModuleExportsAssignment(binding, node, scope);\n },\n ],\n [\n AssignmentKind.ThisProperty,\n (binding, node) => {\n bindThisPropertyAssignment(binding, node);\n },\n ],\n [AssignmentKind.Property, bindPropertyAssignment],\n]);\n\nconst CALL_BINDERS: ReadonlyMap<\n AssignmentDeclarationKind,\n ExpressionBinder<CallExpression>\n> = new Map([\n [AssignmentKind.ObjectDefinePropertyExports, bindObjectDefinePropertyExport],\n [AssignmentKind.ObjectDefinePropertyValue, bindObjectDefinePropertyAssignment],\n]);\n\nconst bindBinaryExpression: ExpressionBinder<BinaryExpression> = (binding, node, scope) => {\n const binder = BINARY_BINDERS.get(getAssignmentDeclarationKind(node, binding.isJs));\n if (Predicate.isNotUndefined(binder)) {\n binder(binding, node, scope);\n }\n};\n\nconst marksCommonJsModule = (binding: FileBinding, node: CallExpression): boolean =>\n binding.isJs &&\n Predicate.isUndefined(binding.commonJsModuleIndicator) &&\n isRequireCall(node, false);\n\nconst bindCallExpression: ExpressionBinder<CallExpression> = (binding, node, scope) => {\n const kind = getAssignmentDeclarationKind(node, binding.isJs);\n const binder = CALL_BINDERS.get(kind);\n if (Predicate.isNotUndefined(binder)) {\n binder(binding, node, scope);\n return;\n }\n if (kind === AssignmentKind.None && marksCommonJsModule(binding, node)) {\n setCommonJsModuleIndicator(binding, node);\n }\n};\n\nconst bindExpression: {\n (node: Node, scope: Scope): (binding: FileBinding) => void;\n (binding: FileBinding, node: Node, scope: Scope): void;\n} = Fn.dual(EXPRESSION_ARITY, (binding: FileBinding, node: Node, scope: Scope): void => {\n if (isBinaryExpression(node)) {\n bindBinaryExpression(binding, node, scope);\n return;\n }\n if (isCallExpression(node)) {\n bindCallExpression(binding, node, scope);\n return;\n }\n bindModuleExportsAccess(binding, node, scope);\n});\n\nexport { bindExpression };\n","import { Array as Arr, Option, Predicate, pipe } from \"effect\";\nimport { ModifierFlags } from \"typescript/ast\";\nimport type { ExportDeclaration, ExportSpecifier, NamedExports, Node } from \"typescript/ast\";\nimport {\n isEnumDeclaration,\n isExportDeclaration,\n isImportDeclaration,\n isImportEqualsDeclaration,\n isInterfaceDeclaration,\n isModuleBlock,\n isModuleDeclaration,\n isNamedExports,\n isTypeAliasDeclaration,\n} from \"typescript/ast/is\";\n\nimport { hasSyntacticModifier, isNodeValue } from \"./binder-names.ts\";\nimport { nameText } from \"./binder-syntax.ts\";\n\nconst NON_INSTANTIATED = 0;\nconst INSTANTIATED = 1;\nconst CONST_ENUM_ONLY = 2;\n\ntype ModuleInstanceState = typeof NON_INSTANTIATED | typeof INSTANTIATED | typeof CONST_ENUM_ONLY;\n\ntype StateOf = (node: Node) => ModuleInstanceState;\n\nconst isConstEnum = (node: Node): boolean => hasSyntacticModifier(node, ModifierFlags.Const);\n\nconst keepFirstInstantiated = (\n state: ModuleInstanceState,\n next: ModuleInstanceState,\n): ModuleInstanceState => {\n if (state === INSTANTIATED || next <= state) {\n return state;\n }\n return next;\n};\n\nconst keepBlockState = (\n state: ModuleInstanceState,\n next: ModuleInstanceState,\n): ModuleInstanceState => {\n if (state === INSTANTIATED || next === NON_INSTANTIATED) {\n return state;\n }\n return next;\n};\n\nconst declaresName = (statement: Node, name: string): boolean =>\n \"name\" in statement &&\n isNodeValue(statement.name) &&\n Option.contains(nameText(statement.name), name);\n\nconst statementsOf = (node: Node): readonly Node[] => {\n if (isModuleBlock(node)) {\n return node.statements;\n }\n return [];\n};\n\nconst aliasTargetState = (specifier: ExportSpecifier, stateOf: StateOf): ModuleInstanceState => {\n const name = Option.getOrElse(nameText(specifier.propertyName ?? specifier.name), () => \"\");\n const matching = pipe(\n statementsOf(specifier.parent.parent.parent),\n Arr.filter((statement) => declaresName(statement, name)),\n );\n if (!Arr.isReadonlyArrayNonEmpty(matching)) {\n return INSTANTIATED;\n }\n return Arr.reduce(matching, NON_INSTANTIATED, (state: ModuleInstanceState, statement) =>\n keepFirstInstantiated(state, stateOf(statement)),\n );\n};\n\nconst localNamedExports = (node: ExportDeclaration): Option.Option<NamedExports> =>\n Option.fromNullishOr(node.exportClause).pipe(\n Option.flatMap((clause) => Option.liftPredicate(clause, isNamedExports)),\n Option.filter(() => Predicate.isUndefined(node.moduleSpecifier)),\n );\n\nconst exportDeclarationState = (node: ExportDeclaration, stateOf: StateOf): ModuleInstanceState => {\n if (node.isTypeOnly) {\n return NON_INSTANTIATED;\n }\n return Option.match(localNamedExports(node), {\n onNone: () => INSTANTIATED,\n onSome: (clause) =>\n Arr.reduce(clause.elements, NON_INSTANTIATED, (state: ModuleInstanceState, specifier) =>\n keepFirstInstantiated(state, aliasTargetState(specifier, stateOf)),\n ),\n });\n};\n\nconst isTypeDeclaration = (node: Node): boolean =>\n isInterfaceDeclaration(node) || isTypeAliasDeclaration(node);\n\nconst isConstEnumDeclaration = (node: Node): boolean =>\n isEnumDeclaration(node) && isConstEnum(node);\n\nconst isUnexportedImport = (node: Node): boolean =>\n (isImportDeclaration(node) || isImportEqualsDeclaration(node)) &&\n !hasSyntacticModifier(node, ModifierFlags.Export);\n\nconst DECLARATION_STATES: readonly (readonly [\n matches: (node: Node) => boolean,\n state: ModuleInstanceState,\n])[] = [\n [isTypeDeclaration, NON_INSTANTIATED],\n [isConstEnumDeclaration, CONST_ENUM_ONLY],\n [isUnexportedImport, NON_INSTANTIATED],\n];\n\nconst declarationState = (node: Node): Option.Option<ModuleInstanceState> =>\n Arr.findFirst(DECLARATION_STATES, ([matches]) => matches(node)).pipe(\n Option.map(([, state]) => state),\n );\n\nconst containerState = (node: Node, stateOf: StateOf): ModuleInstanceState => {\n if (isExportDeclaration(node)) {\n return exportDeclarationState(node, stateOf);\n }\n if (isModuleBlock(node)) {\n return Arr.reduce(node.statements, NON_INSTANTIATED, (state: ModuleInstanceState, statement) =>\n keepBlockState(state, stateOf(statement)),\n );\n }\n if (isModuleDeclaration(node)) {\n return Option.match(Option.fromNullishOr(node.body), {\n onNone: () => INSTANTIATED,\n onSome: stateOf,\n });\n }\n return INSTANTIATED;\n};\n\nconst getModuleInstanceState: StateOf = (node) =>\n Option.getOrElse(declarationState(node), () => containerState(node, getModuleInstanceState));\n\nexport { NON_INSTANTIATED, getModuleInstanceState, isConstEnum };\nexport type { ModuleInstanceState, StateOf };\n","import { Option, Predicate } from \"effect\";\nimport { SyntaxKind } from \"typescript/ast\";\nimport type { ExportDeclaration, Node } from \"typescript/ast\";\nimport {\n isExportAssignment,\n isExportDeclaration,\n isImportClause,\n isModuleDeclaration,\n isNamespaceExport,\n isSourceFile,\n} from \"typescript/ast/is\";\nimport { SymbolFlags } from \"typescript/sync\";\n\nimport {\n declareBlockScoped,\n declareExport,\n declareSourceFileMember,\n} from \"./binder-declarations.ts\";\nimport type { FileBinding, Scope, SymbolFlagPair } from \"./binder-declarations.ts\";\nimport { NON_INSTANTIATED, getModuleInstanceState, isConstEnum } from \"./binder-module-state.ts\";\nimport { isAmbientModule } from \"./binder-names.ts\";\nimport { setValueDeclaration } from \"./binder-symbols.ts\";\nimport { isAliasableExpression } from \"./binder-syntax.ts\";\nimport { EMPTY } from \"./flags.ts\";\n\ntype NodeBinder = (binding: FileBinding, node: Node, scope: Scope) => void;\n\nconst flagPair = (includes: number, excludes: number): SymbolFlagPair => ({ includes, excludes });\n\nconst ALIAS = flagPair(SymbolFlags.Alias, SymbolFlags.AliasExcludes);\nconst FUNCTION = flagPair(SymbolFlags.Function, SymbolFlags.FunctionExcludes);\nconst VALUE_MODULE = flagPair(SymbolFlags.ValueModule, SymbolFlags.ValueModuleExcludes);\nconst NAMESPACE_MODULE = flagPair(SymbolFlags.NamespaceModule, SymbolFlags.NamespaceModuleExcludes);\nconst CONST_ENUM = flagPair(SymbolFlags.ConstEnum, SymbolFlags.ConstEnumExcludes);\nconst REGULAR_ENUM = flagPair(SymbolFlags.RegularEnum, SymbolFlags.RegularEnumExcludes);\nconst EXPORT_STAR = flagPair(SymbolFlags.ExportStar, EMPTY);\nconst EXPORT_ALIAS = flagPair(SymbolFlags.Alias, SymbolFlags.All);\nconst EXPORT_PROPERTY = flagPair(SymbolFlags.Property, SymbolFlags.All);\n\nconst inContainer =\n (flags: SymbolFlagPair): NodeBinder =>\n (binding, node, scope) => {\n if (scope.containerIsFile) {\n declareSourceFileMember(binding, node, flags);\n }\n };\n\nconst inBlock =\n (flags: SymbolFlagPair): NodeBinder =>\n (binding, node, scope) => {\n if (scope.blockIsFile) {\n declareBlockScoped(binding, node, flags);\n }\n };\n\nconst bindFunction: NodeBinder = (binding, node, scope) => {\n if (binding.strict) {\n inBlock(FUNCTION)(binding, node, scope);\n return;\n }\n inContainer(FUNCTION)(binding, node, scope);\n};\n\nconst bindEnum: NodeBinder = (binding, node, scope) => {\n if (isConstEnum(node)) {\n inBlock(CONST_ENUM)(binding, node, scope);\n return;\n }\n inBlock(REGULAR_ENUM)(binding, node, scope);\n};\n\nconst isModuleAugmentationExternal = (binding: FileBinding, node: Node): boolean =>\n isSourceFile(node.parent) && binding.isExternalModule;\n\nconst moduleFlags = (binding: FileBinding, node: Node): SymbolFlagPair => {\n if (isAmbientModule(node) && !isModuleAugmentationExternal(binding, node)) {\n return VALUE_MODULE;\n }\n if (getModuleInstanceState(node) === NON_INSTANTIATED) {\n return NAMESPACE_MODULE;\n }\n return VALUE_MODULE;\n};\n\nconst bindModuleDeclaration: NodeBinder = (binding, node, scope) => {\n if (scope.containerIsFile && isModuleDeclaration(node)) {\n declareSourceFileMember(binding, node, moduleFlags(binding, node));\n }\n};\n\nconst bindImportClause: NodeBinder = (binding, node, scope) => {\n if (isImportClause(node) && Predicate.isNotUndefined(node.name)) {\n inContainer(ALIAS)(binding, node, scope);\n }\n};\n\nconst hasFileExports = (binding: FileBinding, scope: Scope): boolean =>\n scope.containerIsFile && Option.isSome(Option.fromNullishOr(binding.symbol));\n\nconst bindExportClause = (binding: FileBinding, node: ExportDeclaration): void => {\n const clause = node.exportClause;\n if (Predicate.isUndefined(clause)) {\n declareExport(binding, node, EXPORT_STAR);\n return;\n }\n if (isNamespaceExport(clause)) {\n declareExport(binding, clause, ALIAS);\n }\n};\n\nconst bindExportDeclaration: NodeBinder = (binding, node, scope) => {\n if (hasFileExports(binding, scope) && isExportDeclaration(node)) {\n bindExportClause(binding, node);\n }\n};\n\nconst bindExportAssignment: NodeBinder = (binding, node, scope) => {\n if (!hasFileExports(binding, scope) || !isExportAssignment(node)) {\n return;\n }\n const flags = Option.getOrElse(\n Option.liftPredicate(EXPORT_ALIAS, () => isAliasableExpression(node.expression)),\n () => EXPORT_PROPERTY,\n );\n const symbol = declareExport(binding, node, flags);\n if (node.isExportEquals) {\n setValueDeclaration(symbol, node);\n }\n};\n\nconst DECLARATION_BINDERS: ReadonlyMap<SyntaxKind, NodeBinder> = new Map([\n [SyntaxKind.FunctionDeclaration, bindFunction],\n [SyntaxKind.ClassDeclaration, inBlock(flagPair(SymbolFlags.Class, SymbolFlags.ClassExcludes))],\n [\n SyntaxKind.InterfaceDeclaration,\n inBlock(flagPair(SymbolFlags.Interface, SymbolFlags.InterfaceExcludes)),\n ],\n [\n SyntaxKind.TypeAliasDeclaration,\n inBlock(flagPair(SymbolFlags.TypeAlias, SymbolFlags.TypeAliasExcludes)),\n ],\n [SyntaxKind.EnumDeclaration, bindEnum],\n [SyntaxKind.ModuleDeclaration, bindModuleDeclaration],\n [SyntaxKind.ImportEqualsDeclaration, inContainer(ALIAS)],\n [SyntaxKind.NamespaceImport, inContainer(ALIAS)],\n [SyntaxKind.ImportSpecifier, inContainer(ALIAS)],\n [SyntaxKind.ExportSpecifier, inContainer(ALIAS)],\n [SyntaxKind.ImportClause, bindImportClause],\n [SyntaxKind.ExportDeclaration, bindExportDeclaration],\n [SyntaxKind.ExportAssignment, bindExportAssignment],\n]);\n\nexport { DECLARATION_BINDERS };\nexport type { NodeBinder };\n","import { Option, Predicate, Function as Fn } from \"effect\";\nimport { NodeFlags } from \"typescript/ast\";\nimport type { BindingElement, Node, VariableDeclaration } from \"typescript/ast\";\nimport {\n isArrayBindingPattern,\n isBindingElement,\n isCatchClause,\n isObjectBindingPattern,\n isParameterDeclaration,\n isVariableDeclaration,\n isVariableDeclarationList,\n} from \"typescript/ast/is\";\nimport { SymbolFlags } from \"typescript/sync\";\n\nimport { declareBlockScoped, declareSourceFileMember } from \"./binder-declarations.ts\";\nimport type { FileBinding, Scope, SymbolFlagPair } from \"./binder-declarations.ts\";\nimport { hasExportModifier } from \"./binder-names.ts\";\nimport { isAccessExpression, isRequireCall } from \"./binder-syntax.ts\";\nimport { hasFlag } from \"./flags.ts\";\n\nconst DATA_FIRST_ARITY_3 = 3;\n\ntype VariableLike = VariableDeclaration | BindingElement;\n\nconst ALIAS: SymbolFlagPair = { includes: SymbolFlags.Alias, excludes: SymbolFlags.AliasExcludes };\nconst BLOCK_VARIABLE: SymbolFlagPair = {\n includes: SymbolFlags.BlockScopedVariable,\n excludes: SymbolFlags.BlockScopedVariableExcludes,\n};\nconst FUNCTION_VARIABLE: SymbolFlagPair = {\n includes: SymbolFlags.FunctionScopedVariable,\n excludes: SymbolFlags.FunctionScopedVariableExcludes,\n};\n\nconst isBindingPattern = (node: Node | undefined): boolean =>\n Predicate.isNotUndefined(node) && (isObjectBindingPattern(node) || isArrayBindingPattern(node));\n\nconst isReparsed = (node: Node): boolean => hasFlag(node.flags, NodeFlags.Reparsed);\n\nconst declarationOfBinding = (node: Node): Node => {\n let current = node;\n while (isBindingElement(current)) {\n current = current.parent.parent;\n }\n return current;\n};\n\nconst isBlockOrCatchScoped = (node: Node): boolean => {\n const declaration = declarationOfBinding(node);\n return (\n isVariableDeclaration(declaration) &&\n (isCatchClause(declaration.parent) ||\n (isVariableDeclarationList(declaration.parent) &&\n hasFlag(declaration.parent.flags, NodeFlags.BlockScoped)))\n );\n};\n\nconst isParameterBinding = (node: Node): boolean =>\n isParameterDeclaration(declarationOfBinding(node));\n\nconst hasJSDocTypeTag = (node: VariableLike): boolean =>\n isVariableDeclaration(node) && Option.exists(Option.fromNullishOr(node.type), isReparsed);\n\nconst leftmostAccessTarget = (node: Node): Node => {\n let current = node;\n while (isAccessExpression(current)) {\n current = current.expression;\n }\n return current;\n};\n\nconst isRequireInitialized = (node: Node): boolean =>\n isVariableDeclaration(node) &&\n Option.exists(Option.fromNullishOr(node.initializer), (initializer) =>\n isRequireCall(leftmostAccessTarget(initializer), true),\n );\n\nconst possibleDeclarationOf = (node: VariableLike): Node => {\n if (isVariableDeclaration(node)) {\n return node;\n }\n return node.parent.parent;\n};\n\nconst isRequireAlias = (binding: FileBinding, node: VariableLike): boolean =>\n binding.isJs &&\n isRequireInitialized(possibleDeclarationOf(node)) &&\n !hasJSDocTypeTag(node) &&\n !hasExportModifier(node);\n\ntype VariableBinder = (binding: FileBinding, node: VariableLike, scope: Scope) => void;\n\nconst bindRequireAlias: VariableBinder = (binding, node, scope) => {\n if (scope.containerIsFile) {\n declareSourceFileMember(binding, node, ALIAS);\n }\n};\n\nconst bindBlockVariable: VariableBinder = (binding, node, scope) => {\n if (scope.blockIsFile) {\n declareBlockScoped(binding, node, BLOCK_VARIABLE);\n }\n};\n\nconst bindFunctionVariable: VariableBinder = (binding, node, scope) => {\n if (scope.containerIsFile && !isParameterBinding(node)) {\n declareSourceFileMember(binding, node, FUNCTION_VARIABLE);\n }\n};\n\nconst variableBinderFor = (binding: FileBinding, node: VariableLike): VariableBinder => {\n if (isRequireAlias(binding, node)) {\n return bindRequireAlias;\n }\n if (isBlockOrCatchScoped(node)) {\n return bindBlockVariable;\n }\n return bindFunctionVariable;\n};\n\nconst bindVariable: {\n (node: VariableLike, scope: Scope): (binding: FileBinding) => void;\n (binding: FileBinding, node: VariableLike, scope: Scope): void;\n} = Fn.dual(DATA_FIRST_ARITY_3, (binding: FileBinding, node: VariableLike, scope: Scope): void => {\n if (!isBindingPattern(node.name)) {\n variableBinderFor(binding, node)(binding, node, scope);\n }\n});\n\nexport { bindVariable, isReparsed };\nexport type { VariableLike };\n","import { Array as Arr, Predicate, pipe } from \"effect\";\nimport type { Node } from \"typescript/ast\";\nimport { isBindingElement, isVariableDeclaration } from \"typescript/ast/is\";\n\nimport type { FileBinding, Scope } from \"./binder-declarations.ts\";\nimport { bindExpression } from \"./binder-expressions.ts\";\nimport { DECLARATION_BINDERS } from \"./binder-nodes.ts\";\nimport { isBlockScopeContainer, isContainer } from \"./binder-scopes.ts\";\nimport { bindVariable, isReparsed } from \"./binder-variables.ts\";\n\ninterface Frame {\n readonly node: Node;\n readonly scope: Scope;\n}\n\nconst FILE_SCOPE: Scope = { containerIsFile: true, blockIsFile: true };\nconst NESTED_CONTAINER_SCOPE: Scope = { containerIsFile: false, blockIsFile: false };\n\nconst childScope = (node: Node, scope: Scope): Scope => {\n if (isContainer(node)) {\n return NESTED_CONTAINER_SCOPE;\n }\n if (isBlockScopeContainer(node)) {\n return { containerIsFile: scope.containerIsFile, blockIsFile: false };\n }\n return scope;\n};\n\nconst childFramesInReverse = (node: Node, scope: Scope): readonly Frame[] => {\n const frames: Frame[] = [];\n node.forEachChild((next) => {\n frames.push({ node: next, scope });\n });\n return Arr.reverse(frames);\n};\n\nconst bindNode = (binding: FileBinding, node: Node, scope: Scope): void => {\n if (isVariableDeclaration(node) || isBindingElement(node)) {\n bindVariable(binding, node, scope);\n return;\n }\n const binder = DECLARATION_BINDERS.get(node.kind);\n if (Predicate.isNotUndefined(binder)) {\n binder(binding, node, scope);\n return;\n }\n bindExpression(binding, node, scope);\n};\n\nconst bindFrame = (binding: FileBinding, frame: Frame): readonly Frame[] => {\n if (isReparsed(frame.node)) {\n return [];\n }\n bindNode(binding, frame.node, frame.scope);\n return childFramesInReverse(frame.node, childScope(frame.node, frame.scope));\n};\n\nconst bindFileNodes = (binding: FileBinding): readonly Node[] => {\n const bound: Node[] = [];\n const stack: Frame[] = [...childFramesInReverse(binding.file, FILE_SCOPE)];\n let frame = stack.pop();\n while (Predicate.isNotUndefined(frame)) {\n bound.push(frame.node);\n stack.push(...bindFrame(binding, frame));\n frame = stack.pop();\n }\n return pipe(\n bound,\n Arr.filter((node) => !isReparsed(node)),\n );\n};\n\nexport { bindFileNodes };\n","import { Array as Arr, Option, Predicate, pipe } from \"effect\";\nimport { ScriptKind } from \"typescript/ast\";\nimport type { Node, SourceFile } from \"typescript/ast\";\nimport {\n isExportAssignment,\n isExportDeclaration,\n isExpressionStatement,\n isStringLiteral,\n} from \"typescript/ast/is\";\nimport { SymbolFlags } from \"typescript/sync\";\n\nimport { createFileSymbol } from \"./binder-cjs.ts\";\nimport { declareExport } from \"./binder-declarations.ts\";\nimport type { FileBinding, SymbolFlagPair } from \"./binder-declarations.ts\";\nimport { bindJSDocTypeAliases } from \"./binder-jsdoc.ts\";\nimport { bindFileNodes } from \"./binder-walk.ts\";\n\nconst USE_STRICT = \"use strict\";\n\nconst JSON_EXPORT: SymbolFlagPair = { includes: SymbolFlags.Property, excludes: SymbolFlags.All };\n\nconst bindings = new WeakMap<SourceFile, FileBinding>();\n\nconst isJsFile = (file: SourceFile): boolean =>\n file.scriptKind === ScriptKind.JS || file.scriptKind === ScriptKind.JSX;\n\nconst hasExportDeclarations = (file: SourceFile): boolean =>\n pipe(\n file.statements,\n Arr.some((statement) => isExportDeclaration(statement) || isExportAssignment(statement)),\n );\n\nconst directiveText = (statement: Node): Option.Option<string> =>\n Option.liftPredicate(statement, isExpressionStatement).pipe(\n Option.map((directive) => directive.expression),\n Option.filter(isStringLiteral),\n Option.map((literal) => literal.text),\n );\n\nconst hasUseStrictPrologue = (file: SourceFile): boolean =>\n pipe(\n file.statements,\n Arr.map(directiveText),\n Arr.takeWhile(Option.isSome),\n Arr.some((text) => Option.contains(text, USE_STRICT)),\n );\n\nconst createBinding = (file: SourceFile): FileBinding => {\n const isExternalModule =\n Predicate.isNotUndefined(file.externalModuleIndicator) && file.externalModuleIndicator !== true;\n return {\n file,\n locals: new Map(),\n isJs: isJsFile(file),\n exportContext: file.isDeclarationFile && !hasExportDeclarations(file),\n strict: isExternalModule || hasUseStrictPrologue(file),\n isExternalModule,\n };\n};\n\nconst declareFileSymbol = (binding: FileBinding): void => {\n if (binding.isExternalModule) {\n createFileSymbol(binding);\n return;\n }\n if (binding.file.scriptKind === ScriptKind.JSON) {\n createFileSymbol(binding);\n declareExport(binding, binding.file, JSON_EXPORT);\n }\n};\n\nconst writableValue = (value: unknown): PropertyDescriptor => ({\n value,\n writable: true,\n configurable: true,\n enumerable: true,\n});\n\nconst exposeOnSourceFile = (binding: FileBinding): void => {\n Object.defineProperties(binding.file, {\n symbol: writableValue(binding.symbol),\n locals: writableValue(binding.locals),\n commonJsModuleIndicator: writableValue(binding.commonJsModuleIndicator),\n });\n};\n\nconst bindingOf = (file: SourceFile): Option.Option<FileBinding> =>\n Option.fromNullishOr(bindings.get(file));\n\nconst bindSourceFile = (file: SourceFile): void => {\n if (bindings.has(file)) {\n return;\n }\n const binding = createBinding(file);\n bindings.set(file, binding);\n declareFileSymbol(binding);\n const nodes = bindFileNodes(binding);\n if (binding.isJs) {\n bindJSDocTypeAliases(binding, nodes);\n }\n exposeOnSourceFile(binding);\n};\n\nexport { bindSourceFile, bindingOf };\n","import { Array as Arr, Option, pipe, String as Str, Function as Fn } from \"effect\";\n\nimport { getBaseFileName } from \"./paths.ts\";\n\nconst DATA_FIRST_ARITY = 2;\n\nconst Extension = {\n Ts: \".ts\",\n Tsx: \".tsx\",\n Dts: \".d.ts\",\n Js: \".js\",\n Jsx: \".jsx\",\n Json: \".json\",\n TsBuildInfo: \".tsbuildinfo\",\n Mjs: \".mjs\",\n Mts: \".mts\",\n Dmts: \".d.mts\",\n Cjs: \".cjs\",\n Cts: \".cts\",\n Dcts: \".d.cts\",\n} as const;\n\ntype ExtensionKind = \"TypeScript\" | \"JavaScript\" | \"Declaration\" | \"Json\";\n\ntype Extensions = readonly ExtensionKind[];\n\nconst EXTENSION_KIND_ORDER: readonly ExtensionKind[] = [\n \"TypeScript\",\n \"JavaScript\",\n \"Declaration\",\n \"Json\",\n];\n\nconst EXTENSION_KIND_NAMES: Readonly<Record<ExtensionKind, string>> = {\n TypeScript: \"TypeScript\",\n JavaScript: \"JavaScript\",\n Declaration: \"Declaration\",\n Json: \"JSON\",\n};\n\nconst extensionsOf = (...kinds: readonly ExtensionKind[]): Extensions =>\n pipe(\n EXTENSION_KIND_ORDER,\n Arr.filter((kind) => kinds.includes(kind)),\n );\n\nconst PRIORITY_KINDS: Extensions = extensionsOf(\"TypeScript\", \"Declaration\");\n\nconst intersectExtensions: {\n (right: Extensions): (left: Extensions) => Extensions;\n (left: Extensions, right: Extensions): Extensions;\n} = Fn.dual(DATA_FIRST_ARITY, (left: Extensions, right: Extensions): Extensions =>\n pipe(\n left,\n Arr.filter((kind) => right.includes(kind)),\n ),\n);\n\nconst subtractExtensions: {\n (right: Extensions): (left: Extensions) => Extensions;\n (left: Extensions, right: Extensions): Extensions;\n} = Fn.dual(DATA_FIRST_ARITY, (left: Extensions, right: Extensions): Extensions =>\n pipe(\n left,\n Arr.filter((kind) => !right.includes(kind)),\n ),\n);\n\nconst formatExtensions = (extensions: Extensions): string =>\n pipe(\n extensions,\n Arr.map((kind) => EXTENSION_KIND_NAMES[kind]),\n Arr.join(\", \"),\n );\n\nconst SUPPORTED_TS: readonly string[] = [\n Extension.Ts,\n Extension.Tsx,\n Extension.Dts,\n Extension.Cts,\n Extension.Dcts,\n Extension.Mts,\n Extension.Dmts,\n];\n\nconst SUPPORTED_JS: readonly string[] = [Extension.Js, Extension.Jsx, Extension.Mjs, Extension.Cjs];\n\nconst SUPPORTED_DECLARATION: readonly string[] = [Extension.Dts, Extension.Dcts, Extension.Dmts];\n\nconst SUPPORTED_TS_IMPLEMENTATION: readonly string[] = [\n Extension.Ts,\n Extension.Cts,\n Extension.Mts,\n Extension.Tsx,\n];\n\nconst EXTRACTABLE_TS: readonly string[] = [\n Extension.Dts,\n Extension.Dcts,\n Extension.Dmts,\n Extension.Cts,\n Extension.Mts,\n Extension.Ts,\n Extension.Tsx,\n];\n\nconst REMOVABLE: readonly string[] = [\n Extension.Dts,\n Extension.Dmts,\n Extension.Dcts,\n Extension.Mjs,\n Extension.Mts,\n Extension.Cjs,\n Extension.Cts,\n Extension.Ts,\n Extension.Js,\n Extension.Tsx,\n Extension.Jsx,\n Extension.Json,\n];\n\nconst ZERO = 0;\n\nconst fileExtensionIs = (path: string, extension: string): boolean =>\n path.length > extension.length && Str.endsWith(extension)(path);\n\nconst fileExtensionIsOneOf: {\n (extensions: readonly string[]): (path: string) => boolean;\n (path: string, extensions: readonly string[]): boolean;\n} = Fn.dual(DATA_FIRST_ARITY, (path: string, extensions: readonly string[]): boolean =>\n pipe(\n extensions,\n Arr.some((extension) => fileExtensionIs(path, extension)),\n ),\n);\n\nconst findExtension = (path: string, extensions: readonly string[]): Option.Option<string> =>\n Arr.findFirst(extensions, (extension) => fileExtensionIs(path, extension));\n\nconst hasTSFileExtension = (fileName: string): boolean =>\n fileExtensionIsOneOf(fileName, SUPPORTED_TS);\n\nconst hasJSFileExtension = (fileName: string): boolean =>\n fileExtensionIsOneOf(fileName, SUPPORTED_JS);\n\nconst ARBITRARY_DECLARATION = \".d.\";\n\nconst getArbitraryDeclarationExtension = (fileName: string): Option.Option<string> =>\n Option.liftPredicate(fileName, (name) => fileExtensionIs(name, Extension.Ts)).pipe(\n Option.flatMap((name) =>\n Str.lastIndexOf(ARBITRARY_DECLARATION)(getBaseFileName(name)).pipe(\n Option.map((index) => Str.slice(name.length - getBaseFileName(name).length + index)(name)),\n ),\n ),\n );\n\nconst getDeclarationFileExtension = (fileName: string): Option.Option<string> =>\n Arr.findFirst(SUPPORTED_DECLARATION, (extension) => Str.endsWith(extension)(fileName)).pipe(\n Option.orElse(() => getArbitraryDeclarationExtension(fileName)),\n );\n\nconst isDeclarationFileName = (fileName: string): boolean =>\n Option.isSome(getDeclarationFileExtension(fileName));\n\nconst getAnyExtensionFromPath = (path: string): string => {\n const base = getBaseFileName(path);\n return Str.lastIndexOf(\".\")(base).pipe(\n Option.match({ onNone: () => \"\", onSome: (index) => Str.slice(index)(base) }),\n );\n};\n\nconst removeFileExtension = (path: string): string =>\n findExtension(path, REMOVABLE).pipe(\n Option.match({\n onNone: () => path,\n onSome: (extension) => Str.slice(ZERO, path.length - extension.length)(path),\n }),\n );\n\nconst tryGetExtensionFromPath = (path: string): Option.Option<string> =>\n findExtension(path, REMOVABLE);\n\nconst tryExtractTSExtension = (fileName: string): Option.Option<string> =>\n findExtension(fileName, EXTRACTABLE_TS);\n\nconst isTSFileExtensionForPackageField: {\n (candidate: string): (extensions: Extensions) => boolean;\n (extensions: Extensions, candidate: string): boolean;\n} = Fn.dual(\n DATA_FIRST_ARITY,\n (extensions: Extensions, candidate: string): boolean =>\n (extensions.includes(\"TypeScript\") &&\n fileExtensionIsOneOf(candidate, SUPPORTED_TS_IMPLEMENTATION)) ||\n (extensions.includes(\"Declaration\") && fileExtensionIsOneOf(candidate, SUPPORTED_DECLARATION)),\n);\n\nconst EXTENSIONS_FOR_KIND: Readonly<Record<ExtensionKind, readonly string[]>> = {\n TypeScript: [Extension.Ts, Extension.Tsx, Extension.Mts, Extension.Cts],\n JavaScript: [Extension.Js, Extension.Jsx, Extension.Mjs, Extension.Cjs],\n Declaration: [Extension.Dts, Extension.Dmts, Extension.Dcts],\n Json: [Extension.Json],\n};\n\nconst extensionIsOk: {\n (extension: string): (extensions: Extensions) => boolean;\n (extensions: Extensions, extension: string): boolean;\n} = Fn.dual(DATA_FIRST_ARITY, (extensions: Extensions, extension: string): boolean =>\n pipe(\n EXTENSION_KIND_ORDER,\n Arr.some((kind) => extensions.includes(kind) && EXTENSIONS_FOR_KIND[kind].includes(extension)),\n ),\n);\n\nexport {\n Extension,\n PRIORITY_KINDS,\n extensionIsOk,\n extensionsOf,\n fileExtensionIsOneOf,\n formatExtensions,\n getAnyExtensionFromPath,\n hasJSFileExtension,\n hasTSFileExtension,\n intersectExtensions,\n isDeclarationFileName,\n isTSFileExtensionForPackageField,\n removeFileExtension,\n subtractExtensions,\n tryExtractTSExtension,\n tryGetExtensionFromPath,\n};\nexport type { ExtensionKind, Extensions };\n","import { Option, Function as Fn } from \"effect\";\nimport { NodeFlags, ScriptKind } from \"typescript/ast\";\nimport type { Node, SourceFile } from \"typescript/ast\";\n\nimport { hasFlag } from \"./flags.ts\";\nimport type { PackageJsonInfo, ResolutionMode } from \"./resolution-types.ts\";\n\nconst DATA_FIRST_ARITY = 2;\n\ninterface FileInfo {\n readonly impliedNodeFormat: Option.Option<ResolutionMode>;\n readonly packageJsonScope: Option.Option<PackageJsonInfo>;\n readonly imports: readonly Node[];\n readonly moduleAugmentations: readonly Node[];\n}\n\nconst infos = new WeakMap<SourceFile, FileInfo>();\n\nconst UNSET = Object.freeze({\n writable: true,\n configurable: true,\n enumerable: true,\n});\n\nconst attachFileInfo: {\n (impliedNodeFormat: Option.Option<ResolutionMode>): (sourceFile: SourceFile) => SourceFile;\n (sourceFile: SourceFile, impliedNodeFormat: Option.Option<ResolutionMode>): SourceFile;\n} = Fn.dual(\n DATA_FIRST_ARITY,\n (sourceFile: SourceFile, impliedNodeFormat: Option.Option<ResolutionMode>): SourceFile => {\n infos.set(sourceFile, {\n impliedNodeFormat,\n packageJsonScope: Option.none(),\n imports: sourceFile.imports,\n moduleAugmentations: sourceFile.moduleAugmentations,\n });\n Object.defineProperty(sourceFile, \"imports\", UNSET);\n Object.defineProperty(sourceFile, \"moduleAugmentations\", UNSET);\n return sourceFile;\n },\n);\n\nconst infoOf = (sourceFile: SourceFile): Option.Option<FileInfo> =>\n Option.fromNullishOr(infos.get(sourceFile));\n\nconst impliedNodeFormatOf = (sourceFile: SourceFile): Option.Option<ResolutionMode> =>\n Option.flatMap(infoOf(sourceFile), (info) => info.impliedNodeFormat);\n\nconst packageJsonScopeOf = (sourceFile: SourceFile): Option.Option<PackageJsonInfo> =>\n Option.flatMap(infoOf(sourceFile), (info) => info.packageJsonScope);\n\nconst setPackageJsonScope: {\n (scope: Option.Option<PackageJsonInfo>): (sourceFile: SourceFile) => void;\n (sourceFile: SourceFile, scope: Option.Option<PackageJsonInfo>): void;\n} = Fn.dual(\n DATA_FIRST_ARITY,\n (sourceFile: SourceFile, scope: Option.Option<PackageJsonInfo>): void => {\n Option.map(infoOf(sourceFile), (info) =>\n infos.set(sourceFile, { ...info, packageJsonScope: scope }),\n );\n },\n);\n\nconst collectExternalModuleReferences = (sourceFile: SourceFile): void => {\n Option.map(infoOf(sourceFile), (info) => {\n Object.defineProperty(sourceFile, \"imports\", { ...UNSET, value: info.imports });\n Object.defineProperty(sourceFile, \"moduleAugmentations\", {\n ...UNSET,\n value: info.moduleAugmentations,\n });\n return info;\n });\n};\n\nconst importsOf = (sourceFile: SourceFile): readonly Node[] =>\n Option.match(infoOf(sourceFile), {\n onNone: () => sourceFile.imports,\n onSome: (info) => info.imports,\n });\n\nconst moduleAugmentationsOf = (sourceFile: SourceFile): readonly Node[] =>\n Option.match(infoOf(sourceFile), {\n onNone: () => sourceFile.moduleAugmentations,\n onSome: (info) => info.moduleAugmentations,\n });\n\nconst isSourceFileJS = (sourceFile: SourceFile): boolean =>\n sourceFile.scriptKind === ScriptKind.JS || sourceFile.scriptKind === ScriptKind.JSX;\n\nconst isJSDocNode = (node: Node): boolean => hasFlag(node.flags, NodeFlags.JSDoc);\n\nexport {\n attachFileInfo,\n collectExternalModuleReferences,\n impliedNodeFormatOf,\n importsOf,\n isJSDocNode,\n isSourceFileJS,\n moduleAugmentationsOf,\n packageJsonScopeOf,\n setPackageJsonScope,\n};\n","import { Array as Arr, Option, Function as Fn } from \"effect\";\nimport { SyntaxKind } from \"typescript/ast\";\nimport type {\n ExportDeclaration,\n ImportDeclaration,\n JSDocImportTag,\n Node,\n SourceFile,\n} from \"typescript/ast\";\nimport {\n isCallExpression,\n isExportDeclaration,\n isIdentifier,\n isImportAttributes,\n isImportClause,\n isImportDeclaration,\n isImportEqualsDeclaration,\n isImportTypeNode,\n isJSDocImportTag,\n isParenthesizedExpression,\n isStringLiteralLikeNode,\n} from \"typescript/ast/is\";\n\nimport { fileExtensionIsOneOf } from \"./extensions.ts\";\nimport type { ResolutionKind, ResolutionMode } from \"./resolution-types.ts\";\nimport { impliedNodeFormatOf, packageJsonScopeOf } from \"./source-file.ts\";\n\nconst DATA_FIRST_ARITY = 2;\nconst DATA_FIRST_ARITY_3 = 3;\n\ntype EmitModuleKind = \"CommonJS\" | \"ESNext\" | \"Node16\";\n\ninterface ModeOptions {\n readonly moduleResolution: ResolutionKind;\n readonly module: EmitModuleKind;\n}\n\nconst SINGLE = 1;\nconst RESOLUTION_MODES: ReadonlyMap<string, ResolutionMode> = new Map([\n [\"import\", \"ESNext\"],\n [\"require\", \"CommonJS\"],\n]);\n\nconst resolutionModeOf = (text: string): Option.Option<ResolutionMode> =>\n Option.fromNullishOr(RESOLUTION_MODES.get(text));\n\nconst isTypeOnlyImport = (clause: Node | undefined): boolean =>\n Option.fromNullishOr(clause).pipe(\n Option.filter((node) => isImportClause(node)),\n Option.exists((node) => node.phaseModifier === SyntaxKind.TypeKeyword),\n );\n\nconst resolutionModeOverride = (attributes: Node | undefined): Option.Option<ResolutionMode> =>\n Option.fromNullishOr(attributes).pipe(\n Option.filter((node) => isImportAttributes(node)),\n Option.map((node) => node.attributes),\n Option.filter((elements) => elements.length === SINGLE),\n Option.flatMap((elements) => Arr.head(elements)),\n Option.filter(\n (element) => isStringLiteralLikeNode(element.name) && element.name.text === \"resolution-mode\",\n ),\n Option.flatMap((element) =>\n Option.liftPredicate(element.value, (value) => isStringLiteralLikeNode(value)),\n ),\n Option.flatMap((value) => resolutionModeOf(value.text)),\n );\n\ntype TypeOnlyStatement = ExportDeclaration | ImportDeclaration | JSDocImportTag;\n\nconst isTypeOnlyExport = (node: Node): node is ExportDeclaration =>\n isExportDeclaration(node) && node.isTypeOnly;\n\nconst isImportStatement = (node: Node): node is ImportDeclaration | JSDocImportTag =>\n isImportDeclaration(node) || isJSDocImportTag(node);\n\nconst isTypeOnlyImportStatement = (node: Node): node is ImportDeclaration | JSDocImportTag =>\n isImportStatement(node) && isTypeOnlyImport(node.importClause);\n\nconst isTypeOnlyStatement = (node: Node): node is TypeOnlyStatement =>\n isTypeOnlyExport(node) || isTypeOnlyImportStatement(node);\n\nconst typeOnlyOverride = (usage: Node): Option.Option<ResolutionMode> =>\n Option.liftPredicate(usage.parent, isTypeOnlyStatement).pipe(\n Option.flatMap((statement) => resolutionModeOverride(statement.attributes)),\n );\n\nconst importTypeOverride = (usage: Node): Option.Option<ResolutionMode> =>\n Option.fromNullishOr(usage.parent.parent).pipe(\n Option.filter((node) => isImportTypeNode(node)),\n Option.flatMap((node) => resolutionModeOverride(node.attributes)),\n );\n\nconst importSyntaxAffectsModuleResolution = (options: ModeOptions): boolean =>\n options.moduleResolution !== \"Node10\";\n\ninterface ExplicitFormat {\n readonly format: ResolutionMode;\n readonly scopeType: string;\n readonly extensions: readonly string[];\n}\n\nconst EXPLICIT_FORMATS: readonly ExplicitFormat[] = [\n { format: \"CommonJS\", scopeType: \"commonjs\", extensions: [\".cjs\", \".cts\"] },\n { format: \"ESNext\", scopeType: \"module\", extensions: [\".mjs\", \".mts\"] },\n];\n\nconst declaresFormat = (\n sourceFile: SourceFile,\n scopeType: Option.Option<unknown>,\n explicit: ExplicitFormat,\n): boolean =>\n Option.contains(scopeType, explicit.scopeType) ||\n fileExtensionIsOneOf(sourceFile.fileName, explicit.extensions);\n\nconst explicitFormatOf = (\n sourceFile: SourceFile,\n implied: Option.Option<ResolutionMode>,\n): Option.Option<ResolutionMode> => {\n const scopeType = packageJsonScopeOf(sourceFile).pipe(\n Option.map((scope) => scope.contents.packageJsonContent[\"type\"]),\n );\n return Arr.findFirst(\n EXPLICIT_FORMATS,\n (explicit) =>\n Option.contains(implied, explicit.format) && declaresFormat(sourceFile, scopeType, explicit),\n ).pipe(Option.map((explicit) => explicit.format));\n};\n\nconst impliedNodeFormatForEmit = (\n sourceFile: SourceFile,\n options: ModeOptions,\n): Option.Option<ResolutionMode> => {\n const implied = impliedNodeFormatOf(sourceFile);\n if (options.module === \"Node16\") {\n return implied;\n }\n return explicitFormatOf(sourceFile, implied);\n};\n\nconst emitModuleFormat = (sourceFile: SourceFile, options: ModeOptions): EmitModuleKind =>\n impliedNodeFormatForEmit(sourceFile, options).pipe(Option.getOrElse(() => options.module));\n\nconst walkUpParentheses = (node: Node): Node => {\n let current = node;\n while (isParenthesizedExpression(current)) {\n current = current.parent;\n }\n return current;\n};\n\nconst isRequireCall = (node: Node): boolean =>\n isCallExpression(node) &&\n isIdentifier(node.expression) &&\n node.expression.text === \"require\" &&\n node.arguments.length === SINGLE;\n\nconst isImportCall = (node: Node): boolean =>\n isCallExpression(node) && node.expression.kind === SyntaxKind.ImportKeyword;\n\nconst importCallMode = (sourceFile: SourceFile, options: ModeOptions): ResolutionMode => {\n if (options.module !== \"Node16\" && emitModuleFormat(sourceFile, options) === \"CommonJS\") {\n return \"CommonJS\";\n }\n return \"ESNext\";\n};\n\nconst isCommonJsSyntax = (container: Node, usage: Node): boolean =>\n isImportEqualsDeclaration(container.parent) || isRequireCall(usage.parent);\n\nconst emitSyntaxForUsage = (\n sourceFile: SourceFile,\n usage: Node,\n options: ModeOptions,\n): Option.Option<ResolutionMode> => {\n const container = walkUpParentheses(usage.parent);\n if (isCommonJsSyntax(container, usage)) {\n return Option.some(\"CommonJS\");\n }\n if (isImportCall(container)) {\n return Option.some(importCallMode(sourceFile, options));\n }\n return Option.liftPredicate(\n emitModuleFormat(sourceFile, options),\n (format): format is ResolutionMode => format !== \"Node16\",\n );\n};\n\nconst getModeForUsageLocation: {\n (usage: Node, options: ModeOptions): (sourceFile: SourceFile) => Option.Option<ResolutionMode>;\n (sourceFile: SourceFile, usage: Node, options: ModeOptions): Option.Option<ResolutionMode>;\n} = Fn.dual(\n DATA_FIRST_ARITY_3,\n (sourceFile: SourceFile, usage: Node, options: ModeOptions): Option.Option<ResolutionMode> =>\n typeOnlyOverride(usage).pipe(\n Option.orElse(() => importTypeOverride(usage)),\n Option.orElse(() =>\n Option.liftPredicate(options, importSyntaxAffectsModuleResolution).pipe(\n Option.flatMap(() => emitSyntaxForUsage(sourceFile, usage, options)),\n ),\n ),\n ),\n);\n\nconst getDefaultResolutionModeForFile: {\n (options: ModeOptions): (sourceFile: SourceFile) => Option.Option<ResolutionMode>;\n (sourceFile: SourceFile, options: ModeOptions): Option.Option<ResolutionMode>;\n} = Fn.dual(\n DATA_FIRST_ARITY,\n (sourceFile: SourceFile, options: ModeOptions): Option.Option<ResolutionMode> =>\n Option.liftPredicate(options, importSyntaxAffectsModuleResolution).pipe(\n Option.flatMap(() => impliedNodeFormatForEmit(sourceFile, options)),\n ),\n);\n\nexport { getDefaultResolutionModeForFile, getModeForUsageLocation };\nexport type { EmitModuleKind, ModeOptions };\n","import { Option } from \"effect\";\nimport { ModuleKind } from \"typescript/sync\";\n\nimport type { ResolutionMode } from \"./resolution-types.ts\";\n\nconst MODE_NUMBERS: Readonly<Record<ResolutionMode, ModuleKind>> = {\n CommonJS: ModuleKind.CommonJS,\n ESNext: ModuleKind.ESNext,\n};\n\nconst MODES_BY_NUMBER: ReadonlyMap<number, ResolutionMode> = new Map([\n [ModuleKind.CommonJS, \"CommonJS\"],\n [ModuleKind.ESNext, \"ESNext\"],\n]);\n\nconst modeFromNumber = (mode: number | undefined): Option.Option<ResolutionMode> =>\n Option.fromNullishOr(mode).pipe(\n Option.flatMap((value) => Option.fromNullishOr(MODES_BY_NUMBER.get(value))),\n );\n\nconst modeToNumber = (mode: ResolutionMode): ModuleKind => MODE_NUMBERS[mode];\n\nexport { modeFromNumber, modeToNumber };\n","import { Option, Predicate, Array as Arr, String as Str, pipe, Function as Fn } from \"effect\";\nimport type { SourceFile } from \"typescript/ast\";\nimport { serverFS } from \"typescript/fs\";\nimport type { FileSystemCallbacks, FileSystemEntries } from \"typescript/fs\";\nimport { API } from \"typescript/sync\";\nimport type { ScriptKind } from \"typescript/sync\";\n\nimport { ensureTrailingDirectorySeparator } from \"./paths.ts\";\n\nconst DATA_FIRST_ARITY_3 = 3;\n\ninterface VirtualFileSystem {\n readonly fileExists: (path: string) => boolean;\n readonly directoryExists: (path: string) => boolean;\n readonly readFile: (path: string) => Option.Option<string>;\n readonly listFiles: () => readonly string[];\n}\n\ninterface Mount {\n readonly fileSystem: VirtualFileSystem;\n readonly path: string;\n}\n\ninterface MountedFileSystem {\n readonly fileSystem: VirtualFileSystem;\n readonly root: string;\n}\n\nconst MOUNT_ROOT = \"/attw\";\nconst SEPARATOR = \"/\";\nconst START = 0;\nconst SECOND = 1;\nconst MOUNT_DIRECTORY = Str.slice(SEPARATOR.length)(MOUNT_ROOT);\n\nconst mounts = new Map<string, WeakRef<VirtualFileSystem>>();\nconst counter = { next: 0 };\n\nconst mountOf = (path: string): Option.Option<Mount> => {\n if (!Str.startsWith(`${MOUNT_ROOT}${SEPARATOR}`)(path)) {\n return Option.none();\n }\n const rest = Str.slice(MOUNT_ROOT.length + SEPARATOR.length)(path);\n const id = Option.match(\n Option.filter(Str.indexOf(SEPARATOR)(rest), (index) => index >= SECOND),\n {\n onNone: () => rest,\n onSome: (index) => Str.slice(START, index)(rest),\n },\n );\n const inner = Option.liftPredicate(\n Str.slice(id.length)(rest),\n (remainder) => remainder.length > START,\n );\n return Option.fromNullishOr(mounts.get(id)).pipe(\n Option.flatMap((reference) => Option.fromNullishOr(reference.deref())),\n Option.map((fileSystem) => ({ fileSystem, path: Option.getOrElse(inner, () => SEPARATOR) })),\n );\n};\n\nconst uniqueEntries = (names: readonly string[]): string[] => [...new Set(names)];\n\nconst childEntries = (paths: readonly string[], directory: string): FileSystemEntries => {\n const prefix = ensureTrailingDirectorySeparator(directory);\n const children = pipe(\n paths,\n Arr.filter((path) => Str.startsWith(prefix)(path)),\n Arr.map((path) => Str.slice(prefix.length)(path)),\n );\n const nested = pipe(\n children,\n Arr.filter((child) => Str.includes(SEPARATOR)(child)),\n );\n return {\n files: uniqueEntries(\n pipe(\n children,\n Arr.filter((child) => !Str.includes(SEPARATOR)(child)),\n ),\n ),\n directories: uniqueEntries(\n pipe(\n nested,\n Arr.map((child) =>\n Option.match(Str.indexOf(SEPARATOR)(child), {\n onNone: () => child,\n onSome: (end) => Str.slice(START, end)(child),\n }),\n ),\n ),\n ),\n symlinks: [],\n };\n};\n\nconst liveMountIds = (): string[] =>\n pipe(\n [...mounts.entries()],\n Arr.filter(([, reference]) => Predicate.isNotUndefined(reference.deref())),\n Arr.map(([id]) => id),\n );\n\nconst ANCESTOR_DIRECTORIES: ReadonlyMap<string, () => readonly string[]> = new Map([\n [SEPARATOR, (): readonly string[] => [MOUNT_DIRECTORY]],\n [MOUNT_ROOT, liveMountIds],\n]);\n\nconst ancestorEntries = (path: string): FileSystemEntries => ({\n files: [],\n directories: Option.fromNullishOr(ANCESTOR_DIRECTORIES.get(path)).pipe(\n Option.map((directories) => [...directories()]),\n Option.getOrElse((): string[] => []),\n ),\n symlinks: [],\n});\n\nconst isMountAncestor = (path: string): boolean =>\n path === SEPARATOR || path === MOUNT_ROOT || Option.isSome(mountOf(`${path}${SEPARATOR}`));\n\nconst routedFileSystem: FileSystemCallbacks = {\n fileExists: (path) =>\n Option.match(mountOf(path), {\n onNone: () => false,\n onSome: (mount) => mount.fileSystem.fileExists(mount.path),\n }),\n directoryExists: (path) =>\n Option.match(mountOf(path), {\n onNone: () => isMountAncestor(path),\n onSome: (mount) => mount.path === SEPARATOR || mount.fileSystem.directoryExists(mount.path),\n }),\n readFile: (path) =>\n Option.getOrUndefined(\n mountOf(path).pipe(Option.flatMap((mount) => mount.fileSystem.readFile(mount.path))),\n ),\n getAccessibleEntries: (path) =>\n Option.match(mountOf(path), {\n onNone: () => ancestorEntries(path),\n onSome: (mount) => childEntries(mount.fileSystem.listFiles(), mount.path),\n }),\n realpath: serverFS.identity,\n stat: serverFS.fakeStat,\n writeFile: serverFS.error,\n removeFile: serverFS.error,\n};\n\nconst holder: { api: Option.Option<API> } = { api: Option.none() };\n\nconst sharedApi = (): API =>\n Option.getOrElse(holder.api, () => {\n const created = new API({\n cwd: SEPARATOR,\n useCaseSensitiveFileNames: true,\n fs: routedFileSystem,\n });\n holder.api = Option.some(created);\n return created;\n });\n\nconst mount = (fileSystem: VirtualFileSystem): MountedFileSystem => {\n counter.next += SECOND;\n const id = String(counter.next);\n for (const [key, reference] of mounts) {\n if (Predicate.isUndefined(reference.deref())) {\n mounts.delete(key);\n }\n }\n mounts.set(id, new WeakRef(fileSystem));\n return { fileSystem, root: `${MOUNT_ROOT}${SEPARATOR}${id}` };\n};\n\nconst parseSourceFile: {\n (text: string, scriptKind: Option.Option<ScriptKind>): (fileName: string) => SourceFile;\n (fileName: string, text: string, scriptKind: Option.Option<ScriptKind>): SourceFile;\n} = Fn.dual(\n DATA_FIRST_ARITY_3,\n (fileName: string, text: string, scriptKind: Option.Option<ScriptKind>): SourceFile => {\n const retained = sharedApi().createSourceFile(\n fileName,\n text,\n Option.match(scriptKind, { onNone: () => ({}), onSome: (kind) => ({ scriptKind: kind }) }),\n );\n const { sourceFile } = retained;\n retained.dispose();\n return sourceFile;\n },\n);\n\nexport { mount, parseSourceFile, sharedApi };\nexport type { MountedFileSystem, VirtualFileSystem };\n","import { Option, Predicate, Record as Rec } from \"effect\";\nimport { ScriptKind } from \"typescript/ast\";\nimport type { Node, SourceFile } from \"typescript/ast\";\nimport { ModuleKind, ModuleResolutionKind } from \"typescript/sync\";\n\nimport { bindSourceFile } from \"./binder.ts\";\nimport { getModeForUsageLocation as modeForUsage } from \"./module-mode.ts\";\nimport type { ModeOptions } from \"./module-mode.ts\";\nimport { getNormalizedAbsolutePath } from \"./paths.ts\";\nimport { modeToNumber } from \"./resolution-mode-numbers.ts\";\nimport { parseSourceFile } from \"./ts-api.ts\";\n\ntype CompilerOptionsLike = Readonly<Partial<Record<\"module\" | \"moduleResolution\", number>>>;\n\nconst ROOT = \"/\";\nconst SCRIPT_KIND_AFTER_TEXT = 2;\n\nconst RESOLUTION_NAMES: ReadonlyMap<number, ModeOptions[\"moduleResolution\"]> = new Map([\n [ModuleResolutionKind.Node10, \"Node10\"],\n [ModuleResolutionKind.Node16, \"Node16\"],\n [ModuleResolutionKind.NodeNext, \"Node16\"],\n [ModuleResolutionKind.Bundler, \"Bundler\"],\n]);\n\nconst MODULE_NAMES: ReadonlyMap<number, ModeOptions[\"module\"]> = new Map([\n [ModuleKind.CommonJS, \"CommonJS\"],\n [ModuleKind.ESNext, \"ESNext\"],\n [ModuleKind.Node16, \"Node16\"],\n [ModuleKind.NodeNext, \"Node16\"],\n]);\n\nconst SCRIPT_KINDS: ReadonlySet<unknown> = new Set(Rec.values(ScriptKind));\n\nconst resolutionNameOf = (kind: number | undefined): ModeOptions[\"moduleResolution\"] =>\n Option.fromNullishOr(kind).pipe(\n Option.flatMapNullishOr((value) => RESOLUTION_NAMES.get(value)),\n Option.getOrElse((): ModeOptions[\"moduleResolution\"] => \"Node10\"),\n );\n\nconst moduleNameOf = (kind: number | undefined): ModeOptions[\"module\"] =>\n Option.fromNullishOr(kind).pipe(\n Option.flatMapNullishOr((value) => MODULE_NAMES.get(value)),\n Option.getOrElse((): ModeOptions[\"module\"] => \"CommonJS\"),\n );\n\nconst modeOptionsOf = (options: CompilerOptionsLike): ModeOptions => ({\n moduleResolution: resolutionNameOf(options.moduleResolution),\n module: moduleNameOf(options.module),\n});\n\nconst getModeForUsageLocation = (\n sourceFile: SourceFile,\n usage: Node,\n options: CompilerOptionsLike,\n): ModuleKind | undefined =>\n Option.getOrUndefined(\n modeForUsage(sourceFile, usage, modeOptionsOf(options)).pipe(\n Option.map((mode) => modeToNumber(mode)),\n ),\n );\n\nconst isScriptKind = (value: unknown): value is ScriptKind =>\n Predicate.isNumber(value) && SCRIPT_KINDS.has(value);\n\nconst createSourceFile = (\n fileName: string,\n text: string,\n ...parseArguments: readonly unknown[]\n): SourceFile =>\n parseSourceFile(\n getNormalizedAbsolutePath(fileName, ROOT),\n text,\n Option.liftPredicate(parseArguments[SCRIPT_KIND_AFTER_TEXT], isScriptKind),\n );\n\nconst fileFunctions = { bindSourceFile, createSourceFile, getModeForUsageLocation };\n\nexport { fileFunctions };\n","import { Option, Predicate } from \"effect\";\nimport type { Node } from \"typescript/ast\";\nimport {\n isArrayLiteralExpression,\n isArrowFunction,\n isBinaryExpression,\n isBlock,\n isCallExpression,\n isExpressionStatement,\n isForInStatement,\n isFunctionExpression,\n isIdentifier,\n isNumericLiteral,\n isObjectLiteralExpression,\n isPropertyAccessExpression,\n isPropertyAssignment,\n isReturnStatement,\n isShorthandPropertyAssignment,\n isSourceFile,\n isStringLiteral,\n isStringLiteralLikeNode,\n isVariableDeclaration,\n} from \"typescript/ast/is\";\n\nimport { isFunctionLike } from \"./binder-scopes.ts\";\nimport {\n isAccessExpression,\n isStringOrNumericLiteralLike,\n skipParentheses,\n} from \"./binder-syntax.ts\";\nimport type { AccessExpression } from \"./binder-syntax.ts\";\n\ntype AncestorVerdict = boolean | \"quit\";\n\nconst QUIT = \"quit\";\n\nconst toleratingAbsence =\n <Narrowed extends Node>(guard: (node: Node) => node is Narrowed) =>\n (node: Node | undefined): node is Narrowed =>\n Predicate.isNotUndefined(node) && guard(node);\n\nconst isFunctionBlock = (node: Node | undefined): boolean =>\n Predicate.isNotUndefined(node) && isBlock(node) && isFunctionLike(node.parent);\n\nconst isFunctionExpressionOrArrowFunction = (node: Node | undefined): boolean =>\n Predicate.isNotUndefined(node) && (isFunctionExpression(node) || isArrowFunction(node));\n\nconst ancestorMatching = (\n node: Option.Option<Node>,\n judge: (candidate: Node) => AncestorVerdict,\n): Option.Option<Node> => {\n if (Option.isNone(node)) {\n return node;\n }\n const verdict = judge(node.value);\n if (verdict === QUIT) {\n return Option.none();\n }\n if (verdict) {\n return node;\n }\n return ancestorMatching(Option.fromNullishOr(node.value.parent), judge);\n};\n\nconst findAncestor = (\n node: Node | undefined,\n judge: (candidate: Node) => AncestorVerdict,\n): Node | undefined => Option.getOrUndefined(ancestorMatching(Option.fromNullishOr(node), judge));\n\nconst getNameOfAccessExpression = (node: AccessExpression): Node => {\n if (isPropertyAccessExpression(node)) {\n return node.name;\n }\n return skipParentheses(node.argumentExpression);\n};\n\nconst nodeFunctions = {\n findAncestor,\n forEachChild: (node: Node, visit: (child: Node) => unknown): unknown => node.forEachChild(visit),\n getNameOfAccessExpression,\n isAccessExpression: toleratingAbsence(isAccessExpression),\n isArrayLiteralExpression: toleratingAbsence(isArrayLiteralExpression),\n isBinaryExpression: toleratingAbsence(isBinaryExpression),\n isBlock: toleratingAbsence(isBlock),\n isCallExpression: toleratingAbsence(isCallExpression),\n isExpressionStatement: toleratingAbsence(isExpressionStatement),\n isForInStatement: toleratingAbsence(isForInStatement),\n isFunctionBlock,\n isFunctionExpression: toleratingAbsence(isFunctionExpression),\n isFunctionExpressionOrArrowFunction,\n isIdentifier: toleratingAbsence(isIdentifier),\n isNumericLiteral: toleratingAbsence(isNumericLiteral),\n isObjectLiteralExpression: toleratingAbsence(isObjectLiteralExpression),\n isPropertyAssignment: toleratingAbsence(isPropertyAssignment),\n isReturnStatement: toleratingAbsence(isReturnStatement),\n isShorthandPropertyAssignment: toleratingAbsence(isShorthandPropertyAssignment),\n isSourceFile: toleratingAbsence(isSourceFile),\n isStringLiteral: toleratingAbsence(isStringLiteral),\n isStringLiteralLike: toleratingAbsence(isStringLiteralLikeNode),\n isStringOrNumericLiteralLike: toleratingAbsence(isStringOrNumericLiteralLike),\n isVariableDeclaration: toleratingAbsence(isVariableDeclaration),\n skipParentheses,\n};\n\nexport { nodeFunctions };\n","import { Option, String as Str, Function as Fn } from \"effect\";\n\nimport { Messages, traceMessage } from \"./messages.ts\";\nimport type { ResolutionState } from \"./resolution-types.ts\";\nimport { indexFrom } from \"./text-search.ts\";\n\nconst DATA_FIRST_ARITY = 2;\n\ninterface PackageNameParts {\n readonly packageName: string;\n readonly rest: string;\n}\n\nconst NEXT = 1;\nconst START = 0;\nconst SCOPE_SEPARATOR = \"__\";\nconst SCOPE_MARKER_LENGTH = 1;\n\nconst packageNameEnd = (moduleName: string): Option.Option<number> => {\n const first = Str.indexOf(\"/\")(moduleName);\n if (Str.startsWith(\"@\")(moduleName)) {\n return first.pipe(Option.flatMap((index) => indexFrom(moduleName, \"/\", index + NEXT)));\n }\n return first;\n};\n\nconst parsePackageName = (moduleName: string): PackageNameParts =>\n Option.match(packageNameEnd(moduleName), {\n onNone: () => ({ packageName: moduleName, rest: \"\" }),\n onSome: (end) => ({\n packageName: Str.slice(START, end)(moduleName),\n rest: Str.slice(end + NEXT)(moduleName),\n }),\n });\n\nconst mangleScopedPackageName = (packageName: string): string => {\n if (!Str.startsWith(\"@\")(packageName)) {\n return packageName;\n }\n const replaced = Str.replace(\"/\", SCOPE_SEPARATOR)(packageName);\n if (replaced === packageName) {\n return packageName;\n }\n return Str.slice(SCOPE_MARKER_LENGTH)(replaced);\n};\n\nconst unmangleScopedPackageName = (typesPackageName: string): string => {\n if (!Str.includes(SCOPE_SEPARATOR)(typesPackageName)) {\n return typesPackageName;\n }\n return `@${Str.replace(SCOPE_SEPARATOR, \"/\")(typesPackageName)}`;\n};\n\nconst getTypesPackageName = (packageName: string): string =>\n `@types/${mangleScopedPackageName(packageName)}`;\n\nconst mangleScopedPackageNameWithTrace: {\n (state: ResolutionState): (packageName: string) => string;\n (packageName: string, state: ResolutionState): string;\n} = Fn.dual(DATA_FIRST_ARITY, (packageName: string, state: ResolutionState): string => {\n const mangled = mangleScopedPackageName(packageName);\n if (mangled !== packageName) {\n traceMessage(state, Messages.scopedPackageDetected, mangled);\n }\n return mangled;\n});\n\nexport {\n getTypesPackageName,\n mangleScopedPackageName,\n mangleScopedPackageNameWithTrace,\n parsePackageName,\n unmangleScopedPackageName,\n};\nexport type { PackageNameParts };\n","import { Array as Arr, Option, String as Str, pipe, Function as Fn } from \"effect\";\n\nimport { getRootLength } from \"./path-roots.ts\";\nimport { RELATIVE_SEGMENT, getPathComponents, reducePathComponents } from \"./paths.ts\";\n\nconst DATA_FIRST_ARITY = 2;\nconst FIRST = 0;\nconst SECOND = 1;\n\nconst compareStrings = (left: string, right: string): number =>\n Math.sign(Number(left > right) - Number(left < right));\n\nconst compareCaseInsensitive = (left: string, right: string): number =>\n compareStrings(Str.toUpperCase(left), Str.toUpperCase(right));\n\nconst compareComponents = (left: readonly string[], right: readonly string[]): number =>\n pipe(\n Arr.zip(left, right),\n Arr.drop(SECOND),\n Arr.map(([leftComponent, rightComponent]) =>\n compareCaseInsensitive(leftComponent, rightComponent),\n ),\n Arr.findFirst((result) => result !== FIRST),\n Option.getOrElse(() => Math.sign(left.length - right.length)),\n );\n\nconst compareRests = (left: string, right: string): number => {\n if (!RELATIVE_SEGMENT.test(left) && !RELATIVE_SEGMENT.test(right)) {\n return compareCaseInsensitive(left, right);\n }\n return compareComponents(\n reducePathComponents(getPathComponents(left)),\n reducePathComponents(getPathComponents(right)),\n );\n};\n\nconst comparePathsCaseInsensitive: {\n (right: string): (left: string) => number;\n (left: string, right: string): number;\n} = Fn.dual(DATA_FIRST_ARITY, (left: string, right: string): number => {\n const leftRoot = Str.slice(FIRST, getRootLength(left))(left);\n const rightRoot = Str.slice(FIRST, getRootLength(right))(right);\n return Option.liftPredicate(\n compareCaseInsensitive(leftRoot, rightRoot),\n (result) => result !== FIRST,\n ).pipe(\n Option.getOrElse(() =>\n compareRests(Str.slice(leftRoot.length)(left), Str.slice(rightRoot.length)(right)),\n ),\n );\n});\n\nexport { comparePathsCaseInsensitive };\n","import { Option } from \"effect\";\n\nimport {\n Extension,\n hasJSFileExtension,\n hasTSFileExtension,\n isDeclarationFileName,\n} from \"./extensions.ts\";\nimport { getTypesPackageName, unmangleScopedPackageName } from \"./package-names.ts\";\nimport { comparePathsCaseInsensitive } from \"./path-compare.ts\";\nimport {\n combinePaths,\n ensureTrailingDirectorySeparator,\n forEachAncestorDirectory as forEachAncestor,\n pathIsRelative,\n} from \"./paths.ts\";\n\nconst forEachAncestorDirectory = <Found>(\n directory: string,\n visit: (ancestor: string) => Found | undefined,\n): Found | undefined =>\n Option.getOrUndefined(\n forEachAncestor(directory, (ancestor) => Option.fromUndefinedOr(visit(ancestor))),\n );\n\nconst pathFunctions = {\n Extension,\n combinePaths,\n comparePathsCaseInsensitive,\n ensureTrailingDirectorySeparator,\n forEachAncestorDirectory,\n getTypesPackageName,\n hasJSFileExtension,\n hasTSFileExtension,\n isDeclarationFileName,\n pathIsRelative,\n unmangleScopedPackageName,\n};\n\nexport { pathFunctions };\n","import {\n InternalSymbolName,\n ModifierFlags,\n ScriptKind,\n ScriptTarget,\n SyntaxKind,\n} from \"typescript/ast\";\nimport { ModuleKind, ModuleResolutionKind, SymbolFlags, TypeFlags } from \"typescript/sync\";\n\nimport { hasSyntacticModifier } from \"./binder-names.ts\";\nimport { escapeLeadingUnderscores, unescapeLeadingUnderscores } from \"./binder-symbols.ts\";\nimport { RESOLUTION_VERSION } from \"./types-versions.ts\";\nimport { fileFunctions } from \"./typescript-files.ts\";\nimport { nodeFunctions } from \"./typescript-guards.ts\";\nimport { pathFunctions } from \"./typescript-paths.ts\";\n\nconst ts = {\n ...fileFunctions,\n ...nodeFunctions,\n ...pathFunctions,\n InternalSymbolName,\n ModifierFlags,\n ModuleKind,\n ModuleResolutionKind,\n ScriptKind,\n ScriptTarget,\n SymbolFlags,\n SyntaxKind,\n TypeFlags,\n escapeLeadingUnderscores,\n hasSyntacticModifier,\n unescapeLeadingUnderscores,\n version: RESOLUTION_VERSION,\n};\n\nexport default ts;\n","export function defineCheck(options) {\n return options;\n}\n//# sourceMappingURL=defineCheck.js.map","import ts from \"typescript\";\nimport { defineCheck } from \"../defineCheck.js\";\nexport default defineCheck({\n name: \"CJSOnlyExportsDefault\",\n dependencies: ({ entrypoints, subpath, resolutionKind }) => {\n var _a;\n const entrypoint = entrypoints[subpath].resolutions[resolutionKind];\n const implementationFileName = (_a = entrypoint.implementationResolution) === null || _a === void 0 ? void 0 : _a.fileName;\n return [implementationFileName, resolutionKind];\n },\n execute: ([implementationFileName, resolutionKind], context) => {\n var _a, _b;\n var _c;\n if (!implementationFileName) {\n return;\n }\n if (resolutionKind === \"node10\" || resolutionKind === \"node16-cjs\") {\n // Here, we have a CJS file (most likely transpiled ESM) resolving to a\n // CJS transpiled ESM file. This is fine when considered in isolation.\n // The pattern of having `module.exports.default = ...` is a problem\n // primarily because ESM-detected files in Node (and the same files in\n // Webpack/esbuild) will treat `module.exports` as the default export,\n // which is both unexpected and different from Babel-style interop seen\n // in transpiled default imports and most bundler scenarios. But if Node,\n // Webpack, and esbuild never see this file, then it's fine. So, while\n // the problematic pattern is a feature of the file alone, the bad outcome\n // comes from a combination of the file and the module system that imports\n // it. For dual packages that point Node imports and bundlers to a true\n // ESM default export, while pointing requires to this CJS \"default export,\"\n // we don't want to report a problem.\n //\n // TODO: It would be nice to report this information *somehow*, as neutral\n // metadata attached to the file (c.f. `Analysis[\"programInfo\"]`).\n return;\n }\n const host = (_c = context.hosts.findHostForFiles([implementationFileName])) !== null && _c !== void 0 ? _c : context.hosts.bundler;\n const sourceFile = host.getSourceFile(implementationFileName);\n if (!sourceFile.externalModuleIndicator &&\n sourceFile.commonJsModuleIndicator &&\n ((_b = (_a = sourceFile.symbol) === null || _a === void 0 ? void 0 : _a.exports) === null || _b === void 0 ? void 0 : _b.has(ts.InternalSymbolName.Default)) &&\n sourceFile.symbol.exports.has(ts.escapeLeadingUnderscores(\"__esModule\")) &&\n !sourceFile.symbol.exports.has(ts.InternalSymbolName.ExportEquals)) {\n const decl = sourceFile.symbol.exports.get(ts.InternalSymbolName.Default).declarations[0];\n return {\n kind: \"CJSOnlyExportsDefault\",\n fileName: implementationFileName,\n pos: decl.getStart(sourceFile),\n end: decl.end,\n };\n }\n },\n});\n//# sourceMappingURL=cjsOnlyExportsDefault.js.map","import { valid, validRange } from \"semver\";\nimport validatePackgeName from \"validate-npm-package-name\";\nexport const allResolutionOptions = [\"node10\", \"node16\", \"bundler\"];\nexport const allResolutionKinds = [\"node10\", \"node16-cjs\", \"node16-esm\", \"bundler\"];\nexport function getResolutionOption(resolutionKind) {\n switch (resolutionKind) {\n case \"node10\":\n return \"node10\";\n case \"node16-cjs\":\n case \"node16-esm\":\n return \"node16\";\n case \"bundler\":\n return \"bundler\";\n }\n}\nexport function getResolutionKinds(resolutionOption) {\n switch (resolutionOption) {\n case \"node10\":\n return [\"node10\"];\n case \"node16\":\n return [\"node16-cjs\", \"node16-esm\"];\n case \"bundler\":\n return [\"bundler\"];\n }\n}\nexport function isDefined(value) {\n return value !== undefined;\n}\nexport function resolvedThroughFallback(traces) {\n let i = 0;\n while (i < traces.length) {\n i = traces.indexOf(\"Entering conditional exports.\", i);\n if (i === -1) {\n return false;\n }\n if (conditionalExportsResolvedThroughFallback()) {\n return true;\n }\n }\n function conditionalExportsResolvedThroughFallback() {\n i++;\n let seenFailure = false;\n for (; i < traces.length; i++) {\n if (traces[i].startsWith(\"Failed to resolve under condition '\")) {\n seenFailure = true;\n }\n else if (seenFailure && traces[i].startsWith(\"Resolved under condition '\")) {\n return true;\n }\n else if (traces[i] === \"Entering conditional exports.\") {\n if (conditionalExportsResolvedThroughFallback()) {\n return true;\n }\n }\n else if (traces[i] === \"Exiting conditional exports.\") {\n return false;\n }\n }\n return false;\n }\n}\nexport function visitResolutions(entrypoints, visitor) {\n for (const entrypoint of Object.values(entrypoints)) {\n for (const resolution of Object.values(entrypoint.resolutions)) {\n if (visitor(resolution, entrypoint)) {\n return;\n }\n }\n }\n}\nexport function groupProblemsByKind(problems) {\n var _a;\n var _b;\n const result = {};\n for (const problem of problems) {\n ((_a = result[_b = problem.kind]) !== null && _a !== void 0 ? _a : (result[_b] = [])).push(problem);\n }\n return result;\n}\nexport function parsePackageSpec(input) {\n let name;\n let version;\n let i = 0;\n if (input.startsWith(\"@\")) {\n i = input.indexOf(\"/\");\n if (i === -1 || i === 1) {\n return {\n status: \"error\",\n error: \"Invalid package name\",\n };\n }\n i++;\n }\n i = input.indexOf(\"@\", i);\n if (i === -1) {\n name = input;\n }\n else {\n name = input.slice(0, i);\n version = input.slice(i + 1);\n }\n if (validatePackgeName(name).errors) {\n return {\n status: \"error\",\n error: \"Invalid package name\",\n };\n }\n if (!version) {\n return {\n status: \"success\",\n data: { versionKind: \"none\", name, version: \"\" },\n };\n }\n if (valid(version)) {\n return {\n status: \"success\",\n data: { versionKind: \"exact\", name, version },\n };\n }\n if (validRange(version)) {\n return {\n status: \"success\",\n data: { versionKind: \"range\", name, version },\n };\n }\n return {\n status: \"success\",\n data: { versionKind: \"tag\", name, version },\n };\n}\nexport const allBuildTools = Object.keys({\n \"@arethetypeswrong/cli\": true,\n typescript: true,\n rollup: true,\n \"@rollup/plugin-typescript\": true,\n \"@rollup/plugin-typescript2\": true,\n webpack: true,\n esbuild: true,\n \"parcel-bundler\": true,\n \"@preconstruct/cli\": true,\n vite: true,\n snowpack: true,\n microbundle: true,\n \"@microsoft/api-extractor\": true,\n tshy: true,\n \"@rspack/cli\": true,\n tsup: true,\n tsdown: true,\n});\n//# sourceMappingURL=utils.js.map","var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\n};\nvar __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\n};\nvar _Package_files;\nimport { untar } from \"@andrewbranch/untar.js\";\nimport { Gunzip, FlateErrorCode } from \"fflate\";\nimport { major, maxSatisfying, minor, valid, validRange } from \"semver\";\nimport ts from \"typescript\";\nimport { parsePackageSpec } from \"./utils.js\";\nexport class Package {\n constructor(files, packageName, packageVersion, resolvedUrl, typesPackage) {\n _Package_files.set(this, {});\n __classPrivateFieldSet(this, _Package_files, files, \"f\");\n this.packageName = packageName;\n this.packageVersion = packageVersion;\n this.resolvedUrl = resolvedUrl;\n this.typesPackage = typesPackage;\n }\n tryReadFile(path) {\n const file = __classPrivateFieldGet(this, _Package_files, \"f\")[path];\n if (file === undefined) {\n return undefined;\n }\n if (typeof file === \"string\") {\n return file;\n }\n const content = new TextDecoder().decode(file);\n __classPrivateFieldGet(this, _Package_files, \"f\")[path] = content;\n return content;\n }\n readFile(path) {\n const content = this.tryReadFile(path);\n if (content === undefined) {\n throw new Error(`File not found: ${path}`);\n }\n return content;\n }\n fileExists(path) {\n return path in __classPrivateFieldGet(this, _Package_files, \"f\");\n }\n directoryExists(path) {\n path = ts.ensureTrailingDirectorySeparator(path);\n for (const file in __classPrivateFieldGet(this, _Package_files, \"f\")) {\n if (file.startsWith(path)) {\n return true;\n }\n }\n return false;\n }\n containsTypes(directory = \"/\") {\n return this.listFiles(directory).some(ts.hasTSFileExtension);\n }\n listFiles(directory = \"/\") {\n directory = ts.ensureTrailingDirectorySeparator(directory);\n return directory === \"/\"\n ? Object.keys(__classPrivateFieldGet(this, _Package_files, \"f\"))\n : Object.keys(__classPrivateFieldGet(this, _Package_files, \"f\")).filter((f) => f.startsWith(directory));\n }\n mergedWithTypes(typesPackage) {\n const files = { ...__classPrivateFieldGet(this, _Package_files, \"f\"), ...__classPrivateFieldGet(typesPackage, _Package_files, \"f\") };\n return new Package(files, this.packageName, this.packageVersion, this.resolvedUrl, {\n packageName: typesPackage.packageName,\n packageVersion: typesPackage.packageVersion,\n resolvedUrl: typesPackage.resolvedUrl,\n });\n }\n}\n_Package_files = new WeakMap();\nexport async function createPackageFromNpm(packageSpec, { definitelyTyped = true, ...options } = {}) {\n const parsed = parsePackageSpec(packageSpec);\n if (parsed.status === \"error\") {\n throw new Error(parsed.error);\n }\n const packageName = parsed.data.name;\n const typesPackageName = ts.getTypesPackageName(packageName);\n const { tarballUrl, packageVersion } = parsed.data.versionKind === \"none\" && typeof definitelyTyped === \"string\"\n ? await resolveImplementationPackageForTypesPackage(typesPackageName, definitelyTyped, options)\n : await getNpmTarballUrl([parsed.data], options);\n const pkg = await createPackageFromTarballUrl(tarballUrl);\n if (!definitelyTyped || pkg.containsTypes()) {\n return pkg;\n }\n let typesPackageData;\n if (definitelyTyped === true) {\n typesPackageData = await resolveTypesPackageForPackage(packageName, packageVersion, options);\n }\n else {\n typesPackageData = await getNpmTarballUrl([\n {\n name: typesPackageName,\n versionKind: valid(definitelyTyped) ? \"exact\" : validRange(definitelyTyped) ? \"range\" : \"tag\",\n version: definitelyTyped,\n },\n ], options);\n }\n if (typesPackageData) {\n return pkg.mergedWithTypes(await createPackageFromTarballUrl(typesPackageData.tarballUrl));\n }\n return pkg;\n}\nexport async function resolveImplementationPackageForTypesPackage(typesPackageName, typesPackageVersion, options) {\n if (!typesPackageName.startsWith(\"@types/\")) {\n throw new Error(`'resolveImplementationPackageForTypesPackage' expects an @types package name and version`);\n }\n const packageName = ts.unmangleScopedPackageName(typesPackageName.slice(\"@types/\".length));\n const version = valid(typesPackageVersion);\n if (version) {\n return getNpmTarballUrl([\n parsePackageSpec(`${packageName}@${major(version)}.${minor(version)}`).data,\n parsePackageSpec(`${packageName}@${major(version)}`).data,\n parsePackageSpec(`${packageName}@latest`).data,\n ], options);\n }\n const range = validRange(typesPackageVersion);\n if (range) {\n return getNpmTarballUrl([\n { name: packageName, versionKind: \"range\", version: range },\n { name: packageName, versionKind: \"tag\", version: \"latest\" },\n ], options);\n }\n throw new Error(`'resolveImplementationPackageForTypesPackage' expects a valid SemVer version or range`);\n}\nexport async function resolveTypesPackageForPackage(packageName, packageVersion, options) {\n const typesPackageName = ts.getTypesPackageName(packageName);\n try {\n return await getNpmTarballUrl([\n {\n name: typesPackageName,\n versionKind: \"range\",\n version: `${major(packageVersion)}.${minor(packageVersion)}`,\n },\n {\n name: typesPackageName,\n versionKind: \"range\",\n version: `${major(packageVersion)}`,\n },\n {\n name: typesPackageName,\n versionKind: \"tag\",\n version: \"latest\",\n },\n ], options);\n }\n catch { }\n}\nasync function getNpmTarballUrl(packageSpecs, { before, allowDeprecated } = {}) {\n var _a, _b, _c;\n const fetchPackument = packageSpecs.some((spec) => spec.versionKind === \"range\" || (spec.versionKind === \"tag\" && spec.version !== \"latest\"));\n const packumentUrl = `https://registry.npmjs.org/${packageSpecs[0].name}`;\n const includeTimes = before !== undefined && packageSpecs.some((spec) => spec.versionKind !== \"exact\");\n const Accept = includeTimes ? \"application/json\" : \"application/vnd.npm.install-v1+json\";\n const packument = fetchPackument\n ? await fetch(packumentUrl, { headers: { Accept } }).then((r) => r.json())\n : undefined;\n for (const packageSpec of packageSpecs) {\n const manifestUrl = `https://registry.npmjs.org/${packageSpec.name}/${packageSpec.version || \"latest\"}`;\n const doc = packument || (await fetch(manifestUrl).then((r) => r.json()));\n if (typeof doc !== \"object\" || (doc.error && doc.error !== \"Not found\")) {\n throw new Error(`Unexpected response from ${manifestUrl}: ${JSON.stringify(doc)}`);\n }\n const isManifest = !!doc.version;\n let tarballUrl, packageVersion;\n if (packageSpec.versionKind === \"range\") {\n packageVersion =\n doc.versions &&\n maxSatisfying(Object.keys(doc.versions).filter((v) => (allowDeprecated || !doc.versions[v].deprecated) &&\n (!before || !doc.time || new Date(doc.time[v]) <= before)), packageSpec.version);\n if (!packageVersion) {\n continue;\n }\n tarballUrl = doc.versions[packageVersion].dist.tarball;\n }\n else if (packageSpec.versionKind === \"tag\" && packageSpec.version !== \"latest\") {\n packageVersion = doc[\"dist-tags\"][packageSpec.version];\n if (!packageVersion) {\n continue;\n }\n if (before && doc.time && new Date(doc.time[packageVersion]) > before) {\n continue;\n }\n tarballUrl = doc.versions[packageVersion].dist.tarball;\n }\n else if (isManifest) {\n packageVersion = doc.version;\n tarballUrl = (_a = doc.dist) === null || _a === void 0 ? void 0 : _a.tarball;\n }\n else {\n packageVersion = (_b = doc[\"dist-tags\"]) === null || _b === void 0 ? void 0 : _b.latest;\n tarballUrl = (_c = doc.versions) === null || _c === void 0 ? void 0 : _c[packageVersion].dist.tarball;\n }\n if (packageVersion && tarballUrl) {\n return { packageName: packageSpec.name, packageVersion, tarballUrl };\n }\n }\n throw new Npm404Error(packageSpecs);\n}\nexport class Npm404Error extends Error {\n constructor(packageSpecs) {\n super(`Failed to find a matching version for ${packageSpecs[0].name}`);\n this.packageSpecs = packageSpecs;\n this.kind = \"Npm404Error\";\n }\n}\nexport async function createPackageFromTarballUrl(tarballUrl) {\n const tarball = await fetchTarball(tarballUrl);\n const { files, packageName, packageVersion } = extractTarball(tarball);\n return new Package(files, packageName, packageVersion, tarballUrl);\n}\nasync function fetchTarball(tarballUrl) {\n return new Uint8Array((await fetch(tarballUrl).then((r) => r.arrayBuffer())));\n}\nexport function createPackageFromTarballData(tarball) {\n const { files, packageName, packageVersion } = extractTarball(tarball);\n return new Package(files, packageName, packageVersion);\n}\nfunction extractTarball(tarball) {\n var _a;\n // Use streaming API to work around https://github.com/101arrowz/fflate/issues/207\n const chunks = [];\n try {\n new Gunzip((chunk) => chunks.push(chunk)).push(tarball, /*final*/ true);\n }\n catch (err) {\n // this happens for zero-padded tarballs; can safely ignore\n if (err.code !== FlateErrorCode.InvalidHeader) {\n throw err;\n }\n }\n const unzipped = new Uint8Array(chunks.reduce((a, b) => a + b.length, 0));\n let offset = 0;\n for (const chunk of chunks) {\n unzipped.set(chunk, offset);\n offset += chunk.length;\n }\n const data = untar(unzipped.buffer);\n const prefix = data[0].filename.substring(0, data[0].filename.indexOf(\"/\") + 1);\n const packageJsonText = (_a = data.find((f) => f.filename === `${prefix}package.json`)) === null || _a === void 0 ? void 0 : _a.fileData;\n const packageJson = JSON.parse(new TextDecoder().decode(packageJsonText));\n const packageName = packageJson.name;\n const packageVersion = packageJson.version;\n const files = data.reduce((acc, file) => {\n acc[ts.combinePaths(\"/node_modules/\" + packageName, file.filename.substring(prefix.length))] = file.fileData;\n return acc;\n }, {});\n return { files, packageName, packageVersion };\n}\n//# sourceMappingURL=createPackage.js.map","import ts from \"typescript\";\n// Note: There is a pretty solid module `es-module-lexer` which performs a similar lexing operation\n// as `cjs-module-lexer`, but has some limitations in what it can express. This implementation\n// should be more complete.\nfunction* extractDestructedNames(node) {\n switch (node.kind) {\n case ts.SyntaxKind.ArrayBindingPattern:\n for (const element of node.elements) {\n if (element.kind === ts.SyntaxKind.BindingElement) {\n yield* extractDestructedNames(element.name);\n }\n }\n break;\n case ts.SyntaxKind.Identifier:\n yield node.text;\n break;\n case ts.SyntaxKind.ObjectBindingPattern:\n for (const element of node.elements) {\n yield* extractDestructedNames(element.name);\n }\n break;\n default:\n node;\n }\n}\nexport function getEsmModuleBindings(sourceText) {\n const options = {\n languageVersion: ts.ScriptTarget.ESNext,\n impliedNodeFormat: ts.ModuleKind.ESNext,\n };\n const sourceFile = ts.createSourceFile(\"module.cjs\", sourceText, options, false, ts.ScriptKind.JS);\n const exports = [];\n const reexports = [];\n for (const statement of sourceFile.statements) {\n switch (statement.kind) {\n case ts.SyntaxKind.ExportDeclaration: {\n const declaration = statement;\n const { exportClause } = declaration;\n if (!declaration.isTypeOnly) {\n if (exportClause) {\n if (exportClause.kind === ts.SyntaxKind.NamedExports) {\n // `export { foo }`;\n // `export { foo } from 'specifier'`;\n for (const element of exportClause.elements) {\n if (!element.isTypeOnly) {\n exports.push(element.name.text);\n }\n }\n }\n else {\n // `export * as namespace from 'specifier'`\n exports.push(exportClause.name.text);\n }\n }\n else if (declaration.moduleSpecifier && ts.isStringLiteral(declaration.moduleSpecifier)) {\n // `export * from 'specifier'`\n reexports.push(declaration.moduleSpecifier.text);\n }\n }\n break;\n }\n case ts.SyntaxKind.ExportAssignment: {\n const assignment = statement;\n if (!assignment.isExportEquals) {\n // `export default ...`\n exports.push(\"default\");\n }\n break;\n }\n case ts.SyntaxKind.ClassDeclaration:\n case ts.SyntaxKind.FunctionDeclaration: {\n const declaration = statement;\n if (ts.hasSyntacticModifier(declaration, ts.ModifierFlags.Export)) {\n if (ts.hasSyntacticModifier(declaration, ts.ModifierFlags.Default)) {\n // `export default class {}`\n // `export default function () {}`\n exports.push(\"default\");\n }\n else if (declaration.name) {\n // `export class Foo {}`\n // `export function foo() {}`\n exports.push(declaration.name.text);\n }\n }\n break;\n }\n case ts.SyntaxKind.VariableStatement: {\n const declaration = statement;\n if (ts.hasSyntacticModifier(declaration, ts.ModifierFlags.Export)) {\n // `export const foo = null;`\n // `export const { foo, bar } = null;`\n for (const declarator of declaration.declarationList.declarations) {\n exports.push(...extractDestructedNames(declarator.name));\n }\n }\n break;\n }\n }\n }\n return { exports, reexports };\n}\n//# sourceMappingURL=esmBindings.js.map","import { parse as cjsParse } from \"cjs-module-lexer\";\nexport function getCjsModuleBindings(sourceText) {\n return cjsParse(sourceText);\n}\n//# sourceMappingURL=cjsBindings.js.map","import * as cjs from \"@loaderkit/resolve/cjs\";\nimport * as esm from \"@loaderkit/resolve/esm\";\nfunction makeFileSystemAdapter(fs) {\n return {\n directoryExists: url => fs.directoryExists(url.pathname),\n fileExists: url => fs.fileExists(url.pathname),\n readFileJSON: (url) => JSON.parse(fs.readFile(url.pathname)),\n readLink: () => undefined,\n };\n}\nexport function cjsResolve(fs, specifier, parentURL) {\n return cjs.resolveSync(makeFileSystemAdapter(fs), specifier, parentURL);\n}\nexport function esmResolve(fs, specifier, parentURL) {\n return esm.resolveSync(makeFileSystemAdapter(fs), specifier, parentURL);\n}\n//# sourceMappingURL=resolve.js.map","import { Package } from \"../../createPackage.js\";\nimport { getCjsModuleBindings } from \"./cjsBindings.js\";\nimport { cjsResolve } from \"./resolve.js\";\nexport function getCjsModuleNamespace(fs, file, seen = new Set()) {\n seen.add(file.pathname);\n const exports = new Set();\n const bindings = getCjsModuleBindings(fs.readFile(file.pathname));\n bindings.exports.forEach((name) => exports.add(name));\n // CJS always exports `default`\n if (!exports.has(\"default\")) {\n exports.add(\"default\");\n }\n // Additionally, resolve facade reexports\n for (const source of bindings.reexports.reverse()) {\n try {\n const { format, url } = cjsResolve(fs, source, file);\n if (format === \"commonjs\" && !seen.has(url.pathname)) {\n const reexported = getCjsModuleNamespace(fs, url, seen);\n reexported.forEach((name) => exports.add(name));\n }\n }\n catch { }\n }\n return exports;\n}\n//# sourceMappingURL=cjsNamespace.js.map","import { Package } from \"../../createPackage.js\";\nimport { getEsmModuleBindings } from \"./esmBindings.js\";\nimport { getCjsModuleNamespace } from \"./cjsNamespace.js\";\nimport { esmResolve } from \"./resolve.js\";\n// Note: this doesn't handle ambiguous indirect exports which probably isn't worth the\n// implementation complexity.\nexport function getEsmModuleNamespace(fs, specifier, parentURL = new URL(\"file:///\"), seen = new Set()) {\n // Resolve specifier\n const { format, url } = esmResolve(fs, specifier, parentURL);\n // Don't recurse for circular indirect exports\n if (seen.has(url.pathname)) {\n return [];\n }\n seen.add(url.pathname);\n if (format === \"commonjs\") {\n return [...getCjsModuleNamespace(fs, url)];\n }\n // Parse module bindings\n const bindings = (format !== null && format !== void 0 ? format : \"module\") === \"module\"\n ? getEsmModuleBindings(fs.readFile(url.pathname))\n : // Maybe JSON, WASM, etc\n { exports: [\"default\"], reexports: [] };\n // Concat indirect exports\n const indirect = bindings.reexports\n .flatMap((specifier) => getEsmModuleNamespace(fs, specifier, url, seen))\n .filter((name) => name !== \"default\");\n return [...new Set([...bindings.exports, ...indirect])];\n}\n//# sourceMappingURL=esmNamespace.js.map","import ts from \"typescript\";\nimport { defineCheck } from \"../defineCheck.js\";\nimport { getEsmModuleNamespace } from \"../esm/esmNamespace.js\";\nimport { getResolutionOption } from \"../../utils.js\";\nexport default defineCheck({\n name: \"NamedExports\",\n dependencies: ({ entrypoints, subpath, resolutionKind, programInfo }) => {\n var _a, _b, _c, _d;\n const entrypoint = entrypoints[subpath].resolutions[resolutionKind];\n const typesFileName = ((_a = entrypoint.resolution) === null || _a === void 0 ? void 0 : _a.isTypeScript) && entrypoint.resolution.fileName;\n const resolutionOption = getResolutionOption(resolutionKind);\n const typesModuleKind = typesFileName ? (_b = programInfo[resolutionOption].moduleKinds) === null || _b === void 0 ? void 0 : _b[typesFileName] : undefined;\n const implementationFileName = (_c = entrypoint.implementationResolution) === null || _c === void 0 ? void 0 : _c.fileName;\n const implementationModuleKind = implementationFileName\n ? (_d = programInfo[resolutionOption].moduleKinds) === null || _d === void 0 ? void 0 : _d[implementationFileName]\n : undefined;\n return [implementationFileName, implementationModuleKind, typesFileName, typesModuleKind, resolutionKind];\n },\n execute: ([implementationFileName, implementationModuleKind, typesFileName, typesModuleKind, resolutionKind], context) => {\n if (!implementationFileName ||\n !typesFileName ||\n resolutionKind !== \"node16-esm\" ||\n (typesModuleKind === null || typesModuleKind === void 0 ? void 0 : typesModuleKind.detectedKind) !== ts.ModuleKind.CommonJS ||\n (implementationModuleKind === null || implementationModuleKind === void 0 ? void 0 : implementationModuleKind.detectedKind) !== ts.ModuleKind.CommonJS) {\n return;\n }\n // Get declared exported names from TypeScript\n const host = context.hosts.findHostForFiles([typesFileName]);\n const typesSourceFile = host.getSourceFile(typesFileName);\n if (typesSourceFile.scriptKind === ts.ScriptKind.JSON || !typesSourceFile.symbol) {\n return;\n }\n const typeChecker = host.createAuxiliaryProgram([typesFileName]).getTypeChecker();\n const moduleType = typeChecker.getTypeOfSymbol(typeChecker.resolveExternalModuleSymbol(typesSourceFile.symbol));\n if (typeChecker.isArrayLikeType(moduleType) || typeChecker.getPropertyOfType(moduleType, \"0\")) {\n return;\n }\n const expectedNames = Array.from(new Set(typeChecker\n .getExportsAndPropertiesOfModule(typesSourceFile.symbol)\n .filter((symbol) => {\n return (\n // TS treats `prototype` and other static class members as exports. There's possibly\n // a fix to be done in TS itself, since these show up as auto-imports.\n symbol.name !== \"prototype\" &&\n // @ts-expect-error `getSymbolFlags` extra arguments are not declared on TypeChecker\n typeChecker.getSymbolFlags(symbol, /*excludeTypeOnlyMeanings*/ true) & ts.SymbolFlags.Value);\n })\n .map((symbol) => symbol.name)));\n // Get actual exported names as seen by nodejs\n let exports;\n try {\n exports = getEsmModuleNamespace(context.pkg, implementationFileName);\n }\n catch {\n // If this fails then the result is indeterminate. This could happen in many cases, but\n // a common one would be for packages which re-export from another another package.\n return;\n }\n const missing = expectedNames.filter((name) => !exports.includes(name));\n if (missing.length > 0) {\n const lengthWithoutDefault = (names) => names.length - (names.includes(\"default\") ? 1 : 0);\n return {\n kind: \"NamedExports\",\n implementationFileName,\n typesFileName,\n isMissingAllNamed: lengthWithoutDefault(missing) === lengthWithoutDefault(expectedNames),\n missing,\n };\n }\n },\n});\n//# sourceMappingURL=namedExports.js.map","import ts from \"typescript\";\nimport { resolvedThroughFallback } from \"../../utils.js\";\nimport { defineCheck } from \"../defineCheck.js\";\nexport default defineCheck({\n name: \"EntrypointResolutions\",\n dependencies: ({ subpath, resolutionKind }) => [subpath, resolutionKind],\n execute: ([subpath, resolutionKind], context) => {\n var _a, _b;\n const problems = [];\n const entrypoint = context.entrypoints[subpath].resolutions[resolutionKind];\n if (entrypoint.isWildcard) {\n return;\n }\n if (!entrypoint.resolution) {\n problems.push({\n kind: \"NoResolution\",\n entrypoint: subpath,\n resolutionKind,\n });\n }\n else if (!entrypoint.resolution.isTypeScript && !entrypoint.resolution.isJson) {\n problems.push({\n kind: \"UntypedResolution\",\n entrypoint: subpath,\n resolutionKind,\n });\n }\n if (resolutionKind === \"node16-cjs\" &&\n ((!entrypoint.implementationResolution &&\n entrypoint.resolution &&\n ((_a = context.programInfo[\"node16\"].moduleKinds[entrypoint.resolution.fileName]) === null || _a === void 0 ? void 0 : _a.detectedKind) ===\n ts.ModuleKind.ESNext) ||\n (entrypoint.implementationResolution &&\n ((_b = context.programInfo[\"node16\"].moduleKinds[entrypoint.implementationResolution.fileName]) === null || _b === void 0 ? void 0 : _b.detectedKind) ===\n ts.ModuleKind.ESNext))) {\n problems.push({\n kind: \"CJSResolvesToESM\",\n entrypoint: subpath,\n resolutionKind,\n });\n }\n if (entrypoint.resolution && resolvedThroughFallback(entrypoint.resolution.trace)) {\n problems.push({\n kind: \"FallbackCondition\",\n entrypoint: subpath,\n resolutionKind,\n });\n }\n return problems;\n },\n});\n//# sourceMappingURL=entrypointResolutions.js.map","import ts from \"typescript\";\nconst minifiedVariableAssignmentPattern = /[^\\s];(?:var|let|const) [a-zA-Z0-9_]=[^\\s]/;\nexport function getProbableExports(sourceFile) {\n var _a, _b;\n return (_b = (_a = getEsbuildBabelSwcExports(sourceFile)) !== null && _a !== void 0 ? _a : getWebpackBootstrapExports(sourceFile)) !== null && _b !== void 0 ? _b : [];\n}\nfunction getEsbuildBabelSwcExports(sourceFile) {\n var _a, _b;\n let possibleIndex = sourceFile.text.indexOf(\"\\n__export(\");\n if (possibleIndex === -1) {\n possibleIndex = sourceFile.text.indexOf(\"\\n_export(\");\n }\n if (possibleIndex === -1 && !isProbablyMinified(sourceFile.text)) {\n return undefined;\n }\n for (const statement of sourceFile.statements) {\n if (possibleIndex !== -1 && statement.end < possibleIndex) {\n continue;\n }\n if (possibleIndex !== -1 && statement.pos > possibleIndex) {\n break;\n }\n if (ts.isExpressionStatement(statement) &&\n ts.isCallExpression(statement.expression) &&\n ts.isIdentifier(statement.expression.expression) &&\n statement.expression.arguments.length === 2 &&\n ts.isIdentifier(statement.expression.arguments[0]) &&\n ts.isObjectLiteralExpression(statement.expression.arguments[1])) {\n const callTarget = statement.expression.expression;\n const isExport = callTarget.text === \"__export\" ||\n callTarget.text === \"_export\" ||\n isEsbuildExportFunction((_b = (_a = sourceFile.locals) === null || _a === void 0 ? void 0 : _a.get(ts.escapeLeadingUnderscores(callTarget.text))) === null || _b === void 0 ? void 0 : _b.valueDeclaration);\n if (isExport) {\n return statement.expression.arguments[1].properties.flatMap((prop) => {\n if (ts.isPropertyAssignment(prop) &&\n (ts.isIdentifier(prop.name) || ts.isStringOrNumericLiteralLike(prop.name))) {\n return [{ name: prop.name.text, node: prop }];\n }\n if (ts.isShorthandPropertyAssignment(prop)) {\n return [{ name: prop.name.text, node: prop }];\n }\n return [];\n });\n }\n }\n }\n}\nfunction isEsbuildExportFunction(decl) {\n /*\n esbuild:\n var __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n };\n \n esbuild min:\n b=(o,r)=>{for(var e in r)n(o,e,{get:r[e],enumerable:!0})}\n \n swc?\n function _export(target, all) {\n for(var name in all)Object.defineProperty(target, name, {\n enumerable: true,\n get: all[name]\n });\n }\n */\n if (!decl) {\n return false;\n }\n return (ts.isVariableDeclaration(decl) &&\n decl.initializer &&\n ts.isFunctionExpressionOrArrowFunction(decl.initializer) &&\n ts.isBlock(decl.initializer.body) &&\n decl.initializer.body.statements.length == 1 &&\n ts.isForInStatement(decl.initializer.body.statements[0]));\n}\nfunction isProbablyMinified(text) {\n return minifiedVariableAssignmentPattern.test(text);\n}\nfunction getWebpackBootstrapExports(sourceFile) {\n var _a;\n for (const statement of sourceFile.statements) {\n if (!ts.isExpressionStatement(statement) || !ts.isBinaryExpression(statement.expression)) {\n continue;\n }\n const assignment = statement.expression;\n if (assignment.operatorToken.kind !== ts.SyntaxKind.EqualsToken || !isModuleExports(assignment.left)) {\n continue;\n }\n const bootstrapCall = ts.skipParentheses(assignment.right);\n if (!ts.isCallExpression(bootstrapCall)) {\n continue;\n }\n const bootstrap = ts.skipParentheses(bootstrapCall.expression);\n if (!ts.isFunctionExpression(bootstrap) ||\n !ts.isBlock(bootstrap.body) ||\n bootstrapCall.arguments.length !== 1 ||\n !ts.isArrayLiteralExpression(bootstrapCall.arguments[0])) {\n continue;\n }\n const entryModuleId = getWebpackEntryModuleId(bootstrap.body);\n if (entryModuleId === undefined) {\n continue;\n }\n const entryModule = bootstrapCall.arguments[0].elements[entryModuleId];\n if (!entryModule || !ts.isFunctionExpression(entryModule)) {\n continue;\n }\n const exportsParameterName = (_a = entryModule.parameters[1]) === null || _a === void 0 ? void 0 : _a.name;\n if (!exportsParameterName || !ts.isIdentifier(exportsParameterName)) {\n continue;\n }\n const exportsParameterText = exportsParameterName.text;\n const exports = [];\n visit(entryModule.body);\n return exports;\n function visit(node) {\n if (ts.isBinaryExpression(node) &&\n node.operatorToken.kind === ts.SyntaxKind.EqualsToken &&\n ts.isAccessExpression(node.left) &&\n ts.isIdentifier(node.left.expression) &&\n node.left.expression.text === exportsParameterText) {\n const name = getNameOfAccessExpression(node.left);\n if (name !== undefined) {\n exports.push({ name, node });\n }\n }\n ts.forEachChild(node, visit);\n }\n }\n}\nfunction getWebpackEntryModuleId(body) {\n for (const statement of body.statements) {\n if (!ts.isReturnStatement(statement) || !statement.expression) {\n continue;\n }\n return getWebpackEntryModuleIdFromExpression(statement.expression);\n }\n}\nfunction getWebpackEntryModuleIdFromExpression(expression) {\n expression = ts.skipParentheses(expression);\n if (ts.isCallExpression(expression) && expression.arguments.length === 1) {\n return getNumericValue(expression.arguments[0]);\n }\n if (ts.isBinaryExpression(expression) && expression.operatorToken.kind === ts.SyntaxKind.CommaToken) {\n return getWebpackEntryModuleIdFromExpression(expression.right);\n }\n}\nfunction getNumericValue(node) {\n node = ts.skipParentheses(node);\n if (ts.isNumericLiteral(node)) {\n return Number(node.text);\n }\n if (ts.isBinaryExpression(node) && node.operatorToken.kind === ts.SyntaxKind.EqualsToken) {\n return getNumericValue(node.right);\n }\n}\nfunction isModuleExports(node) {\n return (ts.isAccessExpression(node) &&\n ts.isIdentifier(node.expression) &&\n node.expression.text === \"module\" &&\n getNameOfAccessExpression(node) === \"exports\");\n}\nfunction getNameOfAccessExpression(accessExpression) {\n const node = ts.getNameOfAccessExpression(accessExpression);\n if (ts.isIdentifier(node) || ts.isStringLiteralLike(node)) {\n return node.text;\n }\n}\n//# sourceMappingURL=getProbableExports.js.map","import ts from \"typescript\";\nimport { defineCheck } from \"../defineCheck.js\";\nimport { getProbableExports } from \"../getProbableExports.js\";\nimport { getResolutionOption } from \"../../utils.js\";\nconst bindOptions = {\n target: ts.ScriptTarget.Latest,\n allowJs: true,\n checkJs: true,\n};\nexport default defineCheck({\n name: \"ExportDefaultDisagreement\",\n dependencies: ({ entrypoints, subpath, resolutionKind, programInfo }) => {\n var _a, _b, _c, _d, _e, _f;\n const entrypoint = entrypoints[subpath].resolutions[resolutionKind];\n const typesFileName = (_a = entrypoint.resolution) === null || _a === void 0 ? void 0 : _a.fileName;\n const implementationFileName = (_b = entrypoint.implementationResolution) === null || _b === void 0 ? void 0 : _b.fileName;\n if ((typesFileName &&\n ((_d = (_c = programInfo[getResolutionOption(resolutionKind)].moduleKinds) === null || _c === void 0 ? void 0 : _c[typesFileName]) === null || _d === void 0 ? void 0 : _d.detectedKind) ===\n ts.ModuleKind.ESNext) ||\n (implementationFileName &&\n ((_f = (_e = programInfo[getResolutionOption(resolutionKind)].moduleKinds) === null || _e === void 0 ? void 0 : _e[implementationFileName]) === null || _f === void 0 ? void 0 : _f.detectedKind) ===\n ts.ModuleKind.ESNext)) {\n return [];\n }\n return [typesFileName, implementationFileName];\n },\n execute: ([typesFileName, implementationFileName], context) => {\n var _a, _b;\n // Technically, much of this implementation should go in `dependencies`, since\n // different resolution modes can result in different program graphs, resulting\n // in different types, which are queried heavily here. However, it would be much\n // more expensive to run this type-heavy code in `dependencies`, where it would\n // reevaluate for every entrypoint/resolution matrix cell, when chances are\n // extremely high that a given pair of types/implementation files are intended\n // to act the same under all resolution modes.\n if (!typesFileName || !implementationFileName || !ts.hasTSFileExtension(typesFileName)) {\n return;\n }\n const host = context.hosts.findHostForFiles([typesFileName]);\n const typesSourceFile = host.getSourceFile(typesFileName);\n ts.bindSourceFile(typesSourceFile, bindOptions);\n if (!((_a = typesSourceFile.symbol) === null || _a === void 0 ? void 0 : _a.exports)) {\n return;\n }\n const implementationSourceFile = host.getSourceFile(implementationFileName);\n ts.bindSourceFile(implementationSourceFile, bindOptions);\n if (!((_b = implementationSourceFile.symbol) === null || _b === void 0 ? void 0 : _b.exports) || implementationSourceFile.externalModuleIndicator) {\n return;\n }\n // FalseExportDefault: types have a default, JS doesn't.\n // For this check, we're going to require the types to have a top-level\n // default export, which means we might miss something like:\n //\n // declare namespace foo {\n // const _default: string;\n // export { _default as default };\n // }\n // export = foo;\n //\n // But that's not a mistake people really make. If we don't need to\n // recognize that pattern, we can avoid creating a program and checker\n // for this error.\n const typesHaveSyntacticDefault = typesSourceFile.symbol.exports.has(ts.InternalSymbolName.Default);\n if (typesHaveSyntacticDefault && !getImplHasDefault() && implIsAnalyzable()) {\n return {\n kind: \"FalseExportDefault\",\n typesFileName,\n implementationFileName,\n };\n }\n // MissingExportEquals: types and JS have a default, but JS also has a\n // module.exports = not reflected in the types.\n // There are a few variations of this problem. The most straightforward\n // is when the types declare *only* a default export, and the JS declares\n // a module.exports and a module.exports.default in different declarations:\n //\n // module.exports = SomeClass;\n // module.exports.default = SomeClass;\n //\n // Then, there's the slight variation on this where the `default` property\n // is separately declared on `SomeClass`. This requires the type checker.\n // Finally, there's the case where the types declare a default export along\n // with other named exports. That *could* accurately represent a\n // `module.exports = { default, ... }` in JS, but only if the named exports\n // are values, not types. It also *couldn't* accurately represent a\n // `module.exports = SomeClass`, where the exported value is callable,\n // constructable, or a primitive.\n if (!getImplHasDefault() || !implIsAnalyzable()) {\n // The implementation not having a default doesn't necessarily mean the\n // following checks are irrelevant, but this rule is designed primarily\n // to catch cases where type definition authors correctly notice that\n // their implementation has a `module.exports.default`, but don't realize\n // that the same object is exposed as `module.exports`. We bail early\n // here primarily because these checks are expensive.\n return;\n }\n if (!typesSourceFile.symbol.exports.has(ts.InternalSymbolName.ExportEquals) &&\n implementationSourceFile.symbol.exports.has(ts.InternalSymbolName.ExportEquals) &&\n getTypesDefaultSymbol() &&\n ((getImplExportEqualsIsExportDefault() &&\n getTypesChecker().typeHasCallOrConstructSignatures(getTypesTypeOfDefault())) ||\n getImplChecker().typeHasCallOrConstructSignatures(getImplTypeOfModuleExports()))) {\n return {\n kind: \"MissingExportEquals\",\n typesFileName,\n implementationFileName,\n };\n }\n // TODO: does not account for export *\n const typesHaveNonDefaultValueExport = Array.from(typesSourceFile.symbol.exports.values()).some((s) => {\n if (s.escapedName === \"default\") {\n return false;\n }\n if (s.flags & ts.SymbolFlags.Value) {\n return true;\n }\n while (s.flags & ts.SymbolFlags.Alias) {\n s = getTypesChecker().getAliasedSymbol(s);\n if (s.flags & ts.SymbolFlags.Value) {\n return true;\n }\n }\n });\n if (!typesHaveNonDefaultValueExport &&\n typeIsObjecty(getTypesTypeOfDefault(), getTypesChecker()) &&\n (Array.from(implementationSourceFile.symbol.exports.keys()).some((name) => isNotDefaultOrEsModule(ts.unescapeLeadingUnderscores(name))) ||\n getImplProbableExports().some(({ name }) => isNotDefaultOrEsModule(name))) &&\n getTypesDefaultSymbol()) {\n // Here, the types have a lone default export of a non-callable object,\n // and the implementation has multiple named exports along with `default`.\n // This is the biggest heuristic leap for this rule, but the assumption is\n // that the default export in the types was intended to represent the object\n // shape of `module.exports`, not `module.exports.default`. This may result\n // in false positives, but those false positives can be silenced by adding\n // exports in the types for other named exports in the JS. It's detecting\n // a definite problem; it's just not always accurate about the diagnosis.\n return {\n kind: \"MissingExportEquals\",\n typesFileName,\n implementationFileName,\n };\n }\n var implProbableExports, implChecker, implHasDefault, implTypeOfModuleExports, implExportEqualsIsExportDefault, typesChecker, typesDefaultSymbol, typesTypeOfDefault;\n function getImplProbableExports() {\n var _a;\n return ((_a = implProbableExports) !== null && _a !== void 0 ? _a : (implProbableExports = getProbableExports(implementationSourceFile)));\n }\n function getImplChecker() {\n var _a;\n return ((_a = implChecker) !== null && _a !== void 0 ? _a : (implChecker = host\n .createAuxiliaryProgram([implementationFileName])\n .getTypeChecker()));\n }\n function getImplHasDefault() {\n var _a, _b, _c, _d, _e;\n var _f;\n return ((_f = implHasDefault) !== null && _f !== void 0 ? _f : (implHasDefault = ((_b = (_a = implementationSourceFile === null || implementationSourceFile === void 0 ? void 0 : implementationSourceFile.symbol) === null || _a === void 0 ? void 0 : _a.exports) === null || _b === void 0 ? void 0 : _b.has(ts.InternalSymbolName.Default)) ||\n ((_c = getImplProbableExports()) === null || _c === void 0 ? void 0 : _c.some((s) => s.name === \"default\")) ||\n (!!((_e = (_d = implementationSourceFile.symbol) === null || _d === void 0 ? void 0 : _d.exports) === null || _e === void 0 ? void 0 : _e.size) &&\n getImplChecker()\n .getExportsAndPropertiesOfModule(implementationSourceFile.symbol)\n .some((s) => s.name === \"default\"))));\n }\n function getTypesChecker() {\n var _a;\n return ((_a = typesChecker) !== null && _a !== void 0 ? _a : (typesChecker = host.createAuxiliaryProgram([typesFileName]).getTypeChecker()));\n }\n function getTypesDefaultSymbol() {\n var _a, _b;\n return ((_a = typesDefaultSymbol) !== null && _a !== void 0 ? _a : (typesDefaultSymbol = (_b = typesSourceFile.symbol.exports.get(ts.InternalSymbolName.Default)) !== null && _b !== void 0 ? _b : getTypesChecker()\n .getExportsAndPropertiesOfModule(typesSourceFile.symbol)\n .find((s) => s.escapedName === \"default\")));\n }\n function getTypesTypeOfDefault() {\n var _a;\n const symbol = getTypesDefaultSymbol();\n return ((_a = typesTypeOfDefault) !== null && _a !== void 0 ? _a : (typesTypeOfDefault = symbol\n ? getTypesChecker().getTypeOfSymbol(symbol)\n : getTypesChecker().getAnyType()));\n }\n function getImplTypeOfModuleExports() {\n if (implTypeOfModuleExports) {\n return implTypeOfModuleExports;\n }\n const type = getImplChecker().getTypeOfSymbol(getImplChecker().resolveExternalModuleSymbol(implementationSourceFile.symbol));\n if (type.flags & ts.TypeFlags.Any && getImplExportEqualsIsExportDefault()) {\n return (implTypeOfModuleExports = getImplChecker().getTypeOfSymbol(implementationSourceFile.symbol.exports.get(ts.InternalSymbolName.Default)));\n }\n return (implTypeOfModuleExports = type);\n }\n function getImplExportEqualsIsExportDefault() {\n var _a;\n // TypeScript has a circularity error on `module.exports = exports.default`, so\n // detect that pattern syntactically.\n if (implExportEqualsIsExportDefault !== undefined) {\n return implExportEqualsIsExportDefault;\n }\n const exportEquals = implementationSourceFile.symbol.exports.get(ts.InternalSymbolName.ExportEquals);\n if (!exportEquals) {\n return (implExportEqualsIsExportDefault = false);\n }\n const exportDefault = implementationSourceFile.symbol.exports.get(ts.InternalSymbolName.Default);\n if (!exportDefault) {\n return (implExportEqualsIsExportDefault = false);\n }\n for (const assignment of [\n exportEquals.valueDeclaration,\n ts.findAncestor((_a = exportDefault.declarations) === null || _a === void 0 ? void 0 : _a[0], ts.isBinaryExpression),\n ]) {\n let seenModuleExports = false, seenExportsDefault = false;\n if (assignment &&\n ts.isBinaryExpression(assignment) &&\n assignment.operatorToken.kind === ts.SyntaxKind.EqualsToken) {\n const res = !!forEachAssignmentTarget(assignment, (target) => {\n if (!seenExportsDefault && isExportsDefault(target)) {\n seenExportsDefault = true;\n }\n else if (!seenModuleExports && isModuleExports(target)) {\n seenModuleExports = true;\n }\n return seenExportsDefault && seenModuleExports;\n });\n if (res) {\n return (implExportEqualsIsExportDefault = true);\n }\n }\n }\n return (implExportEqualsIsExportDefault = false);\n }\n function implIsAnalyzable() {\n var _a, _b, _c;\n if (((_b = (_a = implementationSourceFile.symbol.exports.get(ts.InternalSymbolName.ExportEquals)) === null || _a === void 0 ? void 0 : _a.declarations) === null || _b === void 0 ? void 0 : _b.length) > 1) {\n // Multiple assignments in different function bodies is probably a bundle we can't analyze.\n // Multiple assignments in the same function body might just be an environment-conditional\n // module.exports inside an IIFE.\n let commonContainer;\n for (const decl of implementationSourceFile.symbol.exports.get(ts.InternalSymbolName.ExportEquals)\n .declarations) {\n const container = ts.findAncestor(decl, (node) => ts.isFunctionBlock(node) || ts.isSourceFile(node));\n if (commonContainer === undefined) {\n commonContainer = container;\n }\n else if (commonContainer !== container) {\n return false;\n }\n }\n }\n return !!(implementationSourceFile.symbol.exports.size || ((_c = getImplProbableExports()) === null || _c === void 0 ? void 0 : _c.length));\n }\n },\n});\nfunction typeIsObjecty(type, checker) {\n return (type.flags & ts.TypeFlags.Object &&\n !(type.flags & ts.TypeFlags.Primitive) &&\n !checker.typeHasCallOrConstructSignatures(type));\n}\nfunction isModuleExports(target) {\n return ((ts.isAccessExpression(target) &&\n ts.isIdentifier(target.expression) &&\n target.expression.text === \"module\" &&\n getNameOfAccessExpression(target) === \"exports\") ||\n (ts.isIdentifier(target) && target.text === \"exports\"));\n}\nfunction isExportsDefault(target) {\n return ((ts.isAccessExpression(target) &&\n ts.isIdentifier(target.expression) &&\n target.expression.text === \"exports\" &&\n getNameOfAccessExpression(target) === \"default\") ||\n (ts.isAccessExpression(target) &&\n ts.isAccessExpression(target.expression) &&\n ts.isIdentifier(target.expression.expression) &&\n target.expression.expression.text === \"module\" &&\n getNameOfAccessExpression(target.expression) === \"exports\" &&\n getNameOfAccessExpression(target) === \"default\"));\n}\nfunction isNotDefaultOrEsModule(name) {\n return name !== \"default\" && name !== \"__esModule\";\n}\nfunction forEachAssignmentTarget(assignment, cb) {\n // For `module.exports = exports = exports.default`, fires `cb` once for\n // `exports.default`, once for `exports`, and once for `module.exports`.\n const target = ts.skipParentheses(assignment.right);\n if (ts.isBinaryExpression(target) && target.operatorToken.kind === ts.SyntaxKind.EqualsToken) {\n const res = forEachAssignmentTarget(target, cb);\n if (res) {\n return res;\n }\n }\n else {\n const res = cb(target);\n if (res) {\n return res;\n }\n }\n return cb(ts.skipParentheses(assignment.left));\n}\nfunction getNameOfAccessExpression(accessExpression) {\n const node = ts.getNameOfAccessExpression(accessExpression);\n if (ts.isIdentifier(node) || ts.isStringLiteralLike(node)) {\n return node.text;\n }\n}\n//# sourceMappingURL=exportDefaultDisagreement.js.map","import ts from \"typescript\";\nimport { defineCheck } from \"../defineCheck.js\";\nexport default defineCheck({\n name: \"InternalResolutionError\",\n enumerateFiles: true,\n dependencies: ({ resolutionOption, fileName }) => [resolutionOption, fileName],\n execute: ([resolutionOption, fileName], context) => {\n if (!ts.hasTSFileExtension(fileName)) {\n return;\n }\n const host = context.hosts[resolutionOption];\n const sourceFile = host.getSourceFile(fileName);\n if (sourceFile === null || sourceFile === void 0 ? void 0 : sourceFile.imports) {\n const problems = [];\n for (const moduleSpecifier of sourceFile.imports) {\n const reference = moduleSpecifier.text;\n if (reference !== context.pkg.packageName &&\n !reference.startsWith(`${context.pkg.packageName}/`) &&\n reference[0] !== \"#\" &&\n !ts.pathIsRelative(reference)) {\n // Probably a reference to something we'd have to npm install.\n // These can definitely be errors, but I'm not installing a whole\n // graph for now.\n continue;\n }\n const resolutionMode = ts.getModeForUsageLocation(sourceFile, moduleSpecifier, host.getCompilerOptions());\n const resolution = host.getResolvedModule(sourceFile, moduleSpecifier.text, resolutionMode);\n if (!resolution) {\n throw new Error(`Expected resolution for '${moduleSpecifier.text}' in ${fileName}`);\n }\n if (!resolution.resolvedModule) {\n problems.push({\n kind: \"InternalResolutionError\",\n resolutionOption,\n fileName,\n moduleSpecifier: reference,\n pos: moduleSpecifier.pos,\n end: moduleSpecifier.end,\n resolutionMode,\n trace: host.getTrace(fileName, moduleSpecifier.text, resolutionMode),\n });\n }\n }\n return problems;\n }\n },\n});\n//# sourceMappingURL=internalResolutionError.js.map","import ts from \"typescript\";\nimport { defineCheck } from \"../defineCheck.js\";\nexport default defineCheck({\n name: \"ModuleKindDisagreement\",\n dependencies: ({ entrypoints, subpath, resolutionKind, resolutionOption, programInfo }) => {\n var _a, _b, _c, _d, _e, _f;\n const entrypoint = entrypoints[subpath].resolutions[resolutionKind];\n const typesFileName = (_a = entrypoint.resolution) === null || _a === void 0 ? void 0 : _a.fileName;\n const implementationFileName = (_b = entrypoint.implementationResolution) === null || _b === void 0 ? void 0 : _b.fileName;\n return [\n typesFileName,\n implementationFileName,\n typesFileName ? (_d = (_c = programInfo[resolutionOption]) === null || _c === void 0 ? void 0 : _c.moduleKinds) === null || _d === void 0 ? void 0 : _d[typesFileName] : undefined,\n implementationFileName ? (_f = (_e = programInfo[resolutionOption]) === null || _e === void 0 ? void 0 : _e.moduleKinds) === null || _f === void 0 ? void 0 : _f[implementationFileName] : undefined,\n ];\n },\n execute: ([typesFileName, implementationFileName, typesModuleKind, implementationModuleKind]) => {\n if (typesFileName && implementationFileName && typesModuleKind && implementationModuleKind) {\n if (typesModuleKind.detectedKind === ts.ModuleKind.ESNext &&\n implementationModuleKind.detectedKind === ts.ModuleKind.CommonJS) {\n return {\n kind: \"FalseESM\",\n typesFileName,\n implementationFileName,\n typesModuleKind,\n implementationModuleKind,\n };\n }\n else if (typesModuleKind.detectedKind === ts.ModuleKind.CommonJS &&\n implementationModuleKind.detectedKind === ts.ModuleKind.ESNext) {\n return {\n kind: \"FalseCJS\",\n typesFileName,\n implementationFileName,\n typesModuleKind,\n implementationModuleKind,\n };\n }\n }\n },\n});\n//# sourceMappingURL=moduleKindDisagreement.js.map","import ts from \"typescript\";\nimport { defineCheck } from \"../defineCheck.js\";\nexport default defineCheck({\n name: \"UnexpectedModuleSyntax\",\n enumerateFiles: true,\n dependencies: ({ fileName, resolutionOption, programInfo }) => {\n var _a;\n return [fileName, (_a = programInfo[resolutionOption].moduleKinds) === null || _a === void 0 ? void 0 : _a[fileName]];\n },\n execute: ([fileName, expectedModuleKind], context) => {\n var _a, _b;\n if (!expectedModuleKind || !ts.hasJSFileExtension(fileName)) {\n return;\n }\n const host = (_a = context.hosts.findHostForFiles([fileName])) !== null && _a !== void 0 ? _a : context.hosts.bundler;\n const sourceFile = host.getSourceFile(fileName);\n const syntaxImpliedModuleKind = sourceFile.externalModuleIndicator\n ? ts.ModuleKind.ESNext\n : sourceFile.commonJsModuleIndicator\n ? ts.ModuleKind.CommonJS\n : undefined;\n if (syntaxImpliedModuleKind !== undefined && expectedModuleKind.detectedKind !== syntaxImpliedModuleKind) {\n // Value cannot be `true` because we set `moduleDetection: \"legacy\"`\n const syntax = ((_b = sourceFile.externalModuleIndicator) !== null && _b !== void 0 ? _b : sourceFile.commonJsModuleIndicator);\n return {\n kind: \"UnexpectedModuleSyntax\",\n fileName,\n moduleKind: expectedModuleKind,\n syntax: syntaxImpliedModuleKind,\n pos: syntax.getStart(sourceFile),\n end: syntax.end,\n };\n }\n },\n});\n//# sourceMappingURL=unexpectedModuleSyntax.js.map","import cjsOnlyExportsDefault from \"./cjsOnlyExportsDefault.js\";\nimport namedExports from \"./namedExports.js\";\nimport entrypointResolutions from \"./entrypointResolutions.js\";\nimport exportDefaultDisagreement from \"./exportDefaultDisagreement.js\";\nimport internalResolutionError from \"./internalResolutionError.js\";\nimport moduleKindDisagreement from \"./moduleKindDisagreement.js\";\nimport unexpectedModuleSyntax from \"./unexpectedModuleSyntax.js\";\nexport default [\n entrypointResolutions,\n moduleKindDisagreement,\n exportDefaultDisagreement,\n namedExports,\n cjsOnlyExportsDefault,\n unexpectedModuleSyntax,\n internalResolutionError,\n];\n//# sourceMappingURL=index.js.map","// The contents of this string are derived from typescript/lib/lib.es5.d.ts.\n// These types are all that are needed for the NamedExports check to work.\n/*! *****************************************************************************\nCopyright (c) Microsoft Corporation. All rights reserved.\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\nthis file except in compliance with the License. You may obtain a copy of the\nLicense at http://www.apache.org/licenses/LICENSE-2.0\n\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\nMERCHANTABLITY OR NON-INFRINGEMENT.\n\nSee the Apache Version 2.0 License for specific language governing permissions\nand limitations under the License.\n***************************************************************************** */\nexport default `\ninterface ReadonlyArray<T> {\n readonly length: number;\n toString(): string;\n toLocaleString(): string;\n concat(...items: ConcatArray<T>[]): T[];\n concat(...items: (T | ConcatArray<T>)[]): T[];\n join(separator?: string): string;\n slice(start?: number, end?: number): T[];\n indexOf(searchElement: T, fromIndex?: number): number;\n lastIndexOf(searchElement: T, fromIndex?: number): number;\n every<S extends T>(predicate: (value: T, index: number, array: readonly T[]) => value is S, thisArg?: any): this is readonly S[];\n every(predicate: (value: T, index: number, array: readonly T[]) => unknown, thisArg?: any): boolean;\n some(predicate: (value: T, index: number, array: readonly T[]) => unknown, thisArg?: any): boolean;\n forEach(callbackfn: (value: T, index: number, array: readonly T[]) => void, thisArg?: any): void;\n map<U>(callbackfn: (value: T, index: number, array: readonly T[]) => U, thisArg?: any): U[];\n filter<S extends T>(predicate: (value: T, index: number, array: readonly T[]) => value is S, thisArg?: any): S[];\n filter(predicate: (value: T, index: number, array: readonly T[]) => unknown, thisArg?: any): T[];\n reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: readonly T[]) => T): T;\n reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: readonly T[]) => T, initialValue: T): T;\n reduce<U>(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: readonly T[]) => U, initialValue: U): U;\n reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: readonly T[]) => T): T;\n reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: readonly T[]) => T, initialValue: T): T;\n reduceRight<U>(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: readonly T[]) => U, initialValue: U): U;\n readonly [n: number]: T;\n}\n\ninterface Array<T> {\n length: number;\n toString(): string;\n toLocaleString(): string;\n pop(): T | undefined;\n push(...items: T[]): number;\n concat(...items: ConcatArray<T>[]): T[];\n concat(...items: (T | ConcatArray<T>)[]): T[];\n join(separator?: string): string;\n reverse(): T[];\n shift(): T | undefined;\n slice(start?: number, end?: number): T[];\n sort(compareFn?: (a: T, b: T) => number): this;\n splice(start: number, deleteCount?: number): T[];\n splice(start: number, deleteCount: number, ...items: T[]): T[];\n unshift(...items: T[]): number;\n indexOf(searchElement: T, fromIndex?: number): number;\n lastIndexOf(searchElement: T, fromIndex?: number): number;\n every<S extends T>(predicate: (value: T, index: number, array: T[]) => value is S, thisArg?: any): this is S[];\n every(predicate: (value: T, index: number, array: T[]) => unknown, thisArg?: any): boolean;\n some(predicate: (value: T, index: number, array: T[]) => unknown, thisArg?: any): boolean;\n forEach(callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any): void;\n map<U>(callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[];\n filter<S extends T>(predicate: (value: T, index: number, array: T[]) => value is S, thisArg?: any): S[];\n filter(predicate: (value: T, index: number, array: T[]) => unknown, thisArg?: any): T[];\n reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T): T;\n reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue: T): T;\n reduce<U>(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U;\n reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T): T;\n reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue: T): T;\n reduceRight<U>(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U;\n [n: number]: T;\n}\n`;\n//# sourceMappingURL=minimalLibDts.js.map","import { Option, Array as Arr, pipe } from \"effect\";\nimport type { Checker, Project } from \"typescript/sync\";\n\nimport { sharedApi } from \"./ts-api.ts\";\n\ninterface CheckerProgram {\n readonly mountPath: string;\n readonly rootNames: readonly string[];\n readonly compilerOptions: Readonly<Record<string, unknown>>;\n readonly resolve: (\n moduleName: string,\n containingDirectory: string,\n mode: number | undefined,\n ) => Option.Option<{ readonly resolvedFileName: string }>;\n}\n\ninterface CheckerSession {\n readonly checker: Checker;\n readonly project: Project;\n readonly mountPath: string;\n readonly dispose: () => void;\n}\n\nconst openCheckerSession = (program: CheckerProgram): CheckerSession => {\n const api = sharedApi();\n const moduleResolver = api.createModuleResolver(program.compilerOptions, {\n resolveModuleName: (moduleName, containingDirectory, mode) =>\n Option.getOrUndefined(program.resolve(moduleName, containingDirectory, mode)),\n });\n const snapshot = api.createSnapshot({\n createPrograms: [\n {\n rootFiles: pipe(\n program.rootNames,\n Arr.map((name) => `${program.mountPath}${name}`),\n ),\n compilerOptions: program.compilerOptions,\n options: { moduleResolver },\n },\n ],\n });\n const [created] = snapshot.operation.createdPrograms;\n const project = created.getProject();\n return {\n checker: project.checker,\n project,\n mountPath: program.mountPath,\n dispose: () => {\n snapshot.dispose();\n moduleResolver.dispose();\n },\n };\n};\n\nexport { openCheckerSession };\nexport type { CheckerProgram, CheckerSession };\n","import { Array as Arr, Option, pipe, Function as Fn } from \"effect\";\nimport { escapeLeadingUnderscores as escapeSymbolName, getNameOfDeclaration } from \"typescript/ast\";\nimport type { Declaration, Expression, Node, SourceFile } from \"typescript/ast\";\nimport {\n isBinaryExpression,\n isClassDeclaration,\n isEnumDeclaration,\n isExportAssignment,\n isExportSpecifier,\n isExpression,\n isFunctionDeclaration,\n isIdentifier,\n isImportClause,\n isImportEqualsDeclaration,\n isImportSpecifier,\n isInterfaceDeclaration,\n isModuleDeclaration,\n isNamespaceExport,\n isNamespaceImport,\n isSourceFile,\n isTypeAliasDeclaration,\n isVariableDeclaration,\n} from \"typescript/ast/is\";\nimport { SymbolFlags } from \"typescript/sync\";\nimport type { Symbol as CheckerSymbol } from \"typescript/sync\";\n\nimport { escapeLeadingUnderscores } from \"./binder-symbols.ts\";\nimport type { BoundSymbol } from \"./binder-symbols.ts\";\nimport { bindingOf } from \"./binder.ts\";\nimport type { CheckerSession } from \"./checker-session.ts\";\nimport { hasFlag } from \"./flags.ts\";\n\nconst DATA_FIRST_ARITY = 2;\n\ntype AnySymbol = BoundSymbol | CheckerSymbol;\n\ntype SymbolConverter = (session: CheckerSession, symbol: AnySymbol) => CheckerSymbol;\n\nconst EXPORT_EQUALS = \"export=\";\n\nconst isCheckerSymbol = (symbol: AnySymbol): symbol is CheckerSymbol => \"getExports\" in symbol;\n\nconst sourceFileOf = (node: Node): SourceFile => {\n let current = node;\n while (!isSourceFile(current)) {\n current = current.parent;\n }\n return current;\n};\n\nconst firstDeclaration = (symbol: BoundSymbol): Option.Option<Node> =>\n Option.fromNullishOr(symbol.declarations).pipe(\n Option.flatMap((declarations) => Arr.head(declarations)),\n );\n\nconst NAMEABLE_GUARDS: readonly ((node: Node) => boolean)[] = [\n isExpression,\n isFunctionDeclaration,\n isClassDeclaration,\n isVariableDeclaration,\n isModuleDeclaration,\n isEnumDeclaration,\n isInterfaceDeclaration,\n isTypeAliasDeclaration,\n isImportEqualsDeclaration,\n isImportClause,\n isImportSpecifier,\n isNamespaceImport,\n isExportSpecifier,\n isExportAssignment,\n isNamespaceExport,\n];\n\nconst isNameable = (node: Node): node is Declaration | Expression =>\n pipe(\n NAMEABLE_GUARDS,\n Arr.some((guard) => guard(node)),\n );\n\nconst nameNode = (declaration: Node): Node =>\n Option.liftPredicate(declaration, isNameable).pipe(\n Option.flatMapNullishOr((nameable) => getNameOfDeclaration(nameable)),\n Option.getOrElse(() => declaration),\n );\n\nconst missingSymbol = (symbol: BoundSymbol): Error =>\n new Error(`TypeScript has no symbol for ${symbol.name}`);\n\nconst fromSourceFile = (\n session: CheckerSession,\n file: SourceFile,\n symbol: BoundSymbol,\n): CheckerSymbol =>\n Option.fromNullishOr(\n session.checker.getSymbolOfSourceFile(`${session.mountPath}${file.fileName}`),\n ).pipe(Option.getOrThrowWith(() => missingSymbol(symbol)));\n\nconst isFileSymbol = (symbol: BoundSymbol): boolean =>\n firstDeclaration(symbol).pipe(Option.exists((declaration) => isSourceFile(declaration)));\n\nconst fromParentExports = (\n session: CheckerSession,\n symbol: BoundSymbol,\n convert: SymbolConverter,\n): Option.Option<CheckerSymbol> =>\n Option.fromNullishOr(symbol.parent).pipe(\n Option.filter((parent) => isFileSymbol(parent)),\n Option.flatMap((parent) =>\n Option.fromNullishOr(\n convert(session, parent).getExports().get(escapeSymbolName(symbol.name)),\n ),\n ),\n );\n\nconst fromPosition = (\n session: CheckerSession,\n declaration: Node,\n symbol: BoundSymbol,\n): CheckerSymbol => {\n const file = sourceFileOf(declaration);\n const found = session.checker.getSymbolAtPosition(\n `${session.mountPath}${file.fileName}`,\n nameNode(declaration).getStart(file),\n );\n return Option.fromNullishOr(found).pipe(Option.getOrThrowWith(() => missingSymbol(symbol)));\n};\n\nconst fromBound = (\n session: CheckerSession,\n symbol: BoundSymbol,\n convert: SymbolConverter,\n): CheckerSymbol => {\n const declaration = firstDeclaration(symbol).pipe(\n Option.getOrThrowWith(() => new Error(`Symbol ${symbol.name} has no declaration`)),\n );\n if (isSourceFile(declaration)) {\n return fromSourceFile(session, declaration, symbol);\n }\n return fromParentExports(session, symbol, convert).pipe(\n Option.getOrElse(() => fromPosition(session, declaration, symbol)),\n );\n};\n\nconst toCheckerSymbol: {\n (symbol: AnySymbol): (session: CheckerSession) => CheckerSymbol;\n (session: CheckerSession, symbol: AnySymbol): CheckerSymbol;\n} = Fn.dual(DATA_FIRST_ARITY, (session: CheckerSession, symbol: AnySymbol): CheckerSymbol => {\n if (isCheckerSymbol(symbol)) {\n return symbol;\n }\n return fromBound(session, symbol, toCheckerSymbol);\n});\n\nconst assignedIdentifier = (declaration: Node): Option.Option<Node> => {\n if (isBinaryExpression(declaration)) {\n return Option.liftPredicate(declaration.right, (node) => isIdentifier(node));\n }\n if (isExportAssignment(declaration)) {\n return Option.liftPredicate(declaration.expression, (node) => isIdentifier(node));\n }\n return Option.none();\n};\n\nconst localNamed = (identifier: Node): Option.Option<BoundSymbol> =>\n bindingOf(sourceFileOf(identifier)).pipe(\n Option.flatMap((binding) =>\n Option.liftPredicate(identifier, (node) => isIdentifier(node)).pipe(\n Option.flatMap((node) =>\n Option.fromNullishOr(binding.locals.get(escapeLeadingUnderscores(node.text))),\n ),\n ),\n ),\n );\n\nconst boundExpandoExports = (moduleSymbol: BoundSymbol): readonly BoundSymbol[] =>\n Option.fromNullishOr(moduleSymbol.exports).pipe(\n Option.flatMap((exports) => Option.fromNullishOr(exports.get(EXPORT_EQUALS))),\n Option.flatMap((exportEquals) => firstDeclaration(exportEquals)),\n Option.flatMap((declaration) => assignedIdentifier(declaration)),\n Option.flatMap((identifier) => localNamed(identifier)),\n Option.flatMap((local) => Option.fromNullishOr(local.exports)),\n Option.map((members) =>\n pipe(\n [...members.values()],\n Arr.filter((member) => hasFlag(member.flags, SymbolFlags.Assignment)),\n ),\n ),\n Option.getOrElse((): readonly BoundSymbol[] => []),\n );\n\nexport { EXPORT_EQUALS, boundExpandoExports, isCheckerSymbol, toCheckerSymbol };\nexport type { AnySymbol };\n","import { Array as Arr, Option, Predicate, pipe } from \"effect\";\nimport { SyntaxKind } from \"typescript/ast\";\nimport type { ExportDeclaration, Node } from \"typescript/ast\";\nimport {\n isExportDeclaration,\n isExportSpecifier,\n isImportClause,\n isImportEqualsDeclaration,\n isImportSpecifier,\n isNamespaceExport,\n isNamespaceImport,\n} from \"typescript/ast/is\";\n\nconst isTypeOnlyImportClause = (node: Node): boolean =>\n isImportClause(node) && node.phaseModifier === SyntaxKind.TypeKeyword;\n\ntype TypeOnlyRule = (node: Node) => Option.Option<boolean>;\n\nconst rule =\n <Narrowed extends Node>(\n guard: (node: Node) => node is Narrowed,\n test: (node: Narrowed) => boolean,\n ): TypeOnlyRule =>\n (node) =>\n Option.liftPredicate(node, guard).pipe(Option.map(test));\n\nconst isTypeOnlyExportStatement = (node: Node): boolean =>\n isExportDeclaration(node) && node.isTypeOnly;\n\nconst isTypeOnlyReexportAll = (node: ExportDeclaration): boolean =>\n pipe(\n [\n node.isTypeOnly,\n Predicate.isNotUndefined(node.moduleSpecifier),\n Predicate.isUndefined(node.exportClause),\n ],\n Arr.every(Boolean),\n );\n\nconst TYPE_ONLY_RULES: readonly TypeOnlyRule[] = [\n rule(\n isImportSpecifier,\n (specifier) => specifier.isTypeOnly || isTypeOnlyImportClause(specifier.parent.parent),\n ),\n rule(isNamespaceImport, (namespace) => isTypeOnlyImportClause(namespace.parent)),\n rule(isImportEqualsDeclaration, (declaration) => declaration.isTypeOnly),\n rule(isImportClause, isTypeOnlyImportClause),\n rule(\n isExportSpecifier,\n (specifier) => specifier.isTypeOnly || isTypeOnlyExportStatement(specifier.parent.parent),\n ),\n rule(isExportDeclaration, isTypeOnlyReexportAll),\n rule(isNamespaceExport, (namespace) => isTypeOnlyExportStatement(namespace.parent)),\n];\n\nconst isTypeOnlyImportOrExportDeclaration = (node: Node): boolean =>\n Arr.findFirst(TYPE_ONLY_RULES, (check) => check(node)).pipe(Option.getOrElse(() => false));\n\nexport { isTypeOnlyImportOrExportDeclaration };\n","import { Option, Array as Arr, pipe } from \"effect\";\nimport { escapeLeadingUnderscores as escapeSymbolName } from \"typescript/ast\";\nimport { ObjectFlags, SignatureKind, SymbolFlags, TypeFlags, isObjectType } from \"typescript/sync\";\nimport type { Checker, Symbol as CheckerSymbol, Type } from \"typescript/sync\";\n\nimport { openCheckerSession } from \"./checker-session.ts\";\nimport type { CheckerProgram, CheckerSession } from \"./checker-session.ts\";\nimport {\n EXPORT_EQUALS,\n boundExpandoExports,\n isCheckerSymbol,\n toCheckerSymbol,\n} from \"./checker-symbols.ts\";\nimport type { AnySymbol } from \"./checker-symbols.ts\";\nimport { hasFlag, withFlags } from \"./flags.ts\";\nimport { isTypeOnlyImportOrExportDeclaration } from \"./type-only.ts\";\n\ninterface TypeCheckerFacade {\n readonly resolveExternalModuleSymbol: (symbol: AnySymbol) => CheckerSymbol;\n readonly getTypeOfSymbol: (symbol: AnySymbol) => Type;\n readonly getExportsAndPropertiesOfModule: (symbol: AnySymbol) => readonly AnySymbol[];\n readonly getSymbolFlags: (symbol: AnySymbol, excludeTypeOnlyMeanings: boolean) => number;\n readonly getAliasedSymbol: (symbol: AnySymbol) => CheckerSymbol;\n readonly getAnyType: Checker[\"getAnyType\"];\n readonly isArrayLikeType: Checker[\"isArrayLikeType\"];\n readonly getPropertyOfType: Checker[\"getPropertyOfType\"];\n readonly typeHasCallOrConstructSignatures: (type: Type) => boolean;\n readonly dispose: () => void;\n}\n\nconst UNKNOWN = \"unknown\";\nconst NONE = 0;\n\nconst isAlias = (symbol: AnySymbol): boolean => hasFlag(symbol.flags, SymbolFlags.Alias);\n\nconst isUnknownSymbol = (symbol: CheckerSymbol): boolean =>\n symbol.name === UNKNOWN &&\n symbol.declarations.length === NONE &&\n symbol.flags === SymbolFlags.Property;\n\nconst resolveExternalModuleSymbol = (session: CheckerSession, symbol: AnySymbol): CheckerSymbol => {\n const moduleSymbol = toCheckerSymbol(session, symbol);\n return Option.fromNullishOr(moduleSymbol.getExports().get(escapeSymbolName(EXPORT_EQUALS))).pipe(\n Option.map((exportEquals) => {\n if (isAlias(exportEquals)) {\n return session.checker.getAliasedSymbol(exportEquals);\n }\n return exportEquals;\n }),\n Option.getOrElse(() => moduleSymbol),\n );\n};\n\nconst isClassInstanceType = (type: Type): boolean =>\n isObjectType(type) && hasFlag(type.objectFlags, ObjectFlags.Class);\n\nconst isListType = (checker: Checker, type: Type): boolean =>\n checker.isArrayType(type) || checker.isTupleType(type);\n\nconst shouldTreatPropertiesAsExports = (checker: Checker, type: Type): boolean =>\n !hasFlag(type.flags, TypeFlags.Primitive) &&\n !isClassInstanceType(type) &&\n !isListType(checker, type);\n\nconst expandosOf = (\n symbol: AnySymbol,\n properties: readonly CheckerSymbol[],\n): readonly AnySymbol[] => {\n if (isCheckerSymbol(symbol)) {\n return [];\n }\n const names = new Set(\n pipe(\n properties,\n Arr.map((property) => property.name),\n ),\n );\n return pipe(\n boundExpandoExports(symbol),\n Arr.filter((member) => !names.has(member.name)),\n );\n};\n\nconst propertiesAsExports = (\n session: CheckerSession,\n symbol: AnySymbol,\n exportEquals: CheckerSymbol,\n): readonly AnySymbol[] => {\n const type = session.checker.getTypeOfSymbol(exportEquals);\n if (!shouldTreatPropertiesAsExports(session.checker, type)) {\n return [];\n }\n const properties = session.checker.getPropertiesOfType(type);\n return [...properties, ...expandosOf(symbol, properties)];\n};\n\nconst exportsAndPropertiesOf = (\n session: CheckerSession,\n symbol: AnySymbol,\n): readonly AnySymbol[] => {\n const moduleSymbol = toCheckerSymbol(session, symbol);\n const exports = session.checker.getExportsOfModule(moduleSymbol);\n const exportEquals = resolveExternalModuleSymbol(session, moduleSymbol);\n if (exportEquals.id === moduleSymbol.id) {\n return exports;\n }\n return [...exports, ...propertiesAsExports(session, symbol, exportEquals)];\n};\n\nconst aliasHasTypeOnlyDeclaration = (session: CheckerSession, symbol: CheckerSymbol): boolean =>\n pipe(\n symbol.declarations,\n Arr.some((handle) =>\n Option.fromNullishOr(handle.resolve(session.project)).pipe(\n Option.exists((declaration) => isTypeOnlyImportOrExportDeclaration(declaration)),\n ),\n ),\n );\n\nconst aliasChainIsTypeOnly = (session: CheckerSession, symbol: CheckerSymbol): boolean => {\n const seen = new Set<number>();\n const isUnvisitedAlias = (candidate: CheckerSymbol): boolean =>\n isAlias(candidate) && !seen.has(candidate.id);\n let current = Option.some(symbol).pipe(Option.filter((candidate) => isUnvisitedAlias(candidate)));\n while (Option.isSome(current)) {\n seen.add(current.value.id);\n if (aliasHasTypeOnlyDeclaration(session, current.value)) {\n return true;\n }\n current = Option.fromNullishOr(session.checker.getImmediateAliasedSymbol(current.value)).pipe(\n Option.filter((next) => isUnvisitedAlias(next)),\n );\n }\n return false;\n};\n\nconst resolvedAliasFlags = (\n session: CheckerSession,\n symbol: AnySymbol,\n target: CheckerSymbol,\n): number => {\n const resolved = session.checker.getAliasedSymbol(target);\n if (resolved.id === target.id) {\n return symbol.flags;\n }\n if (isUnknownSymbol(resolved)) {\n return SymbolFlags.All;\n }\n return withFlags(symbol.flags, resolved.flags);\n};\n\nconst symbolFlagsOf = (\n session: CheckerSession,\n symbol: AnySymbol,\n excludeTypeOnlyMeanings: boolean,\n): number => {\n if (!isAlias(symbol)) {\n return symbol.flags;\n }\n const target = toCheckerSymbol(session, symbol);\n if (excludeTypeOnlyMeanings && aliasChainIsTypeOnly(session, target)) {\n return symbol.flags;\n }\n return resolvedAliasFlags(session, symbol, target);\n};\n\nconst hasCallOrConstructSignatures = (checker: Checker, type: Type): boolean =>\n checker.getSignaturesOfType(type, SignatureKind.Call).length > NONE ||\n checker.getSignaturesOfType(type, SignatureKind.Construct).length > NONE;\n\nconst createTypeChecker = (program: CheckerProgram): TypeCheckerFacade => {\n const session = openCheckerSession(program);\n const { checker } = session;\n return {\n resolveExternalModuleSymbol: (symbol) => resolveExternalModuleSymbol(session, symbol),\n getTypeOfSymbol: (symbol) => checker.getTypeOfSymbol(toCheckerSymbol(session, symbol)),\n getExportsAndPropertiesOfModule: (symbol) => exportsAndPropertiesOf(session, symbol),\n getSymbolFlags: (symbol, excludeTypeOnlyMeanings) =>\n symbolFlagsOf(session, symbol, excludeTypeOnlyMeanings),\n getAliasedSymbol: (symbol) => checker.getAliasedSymbol(toCheckerSymbol(session, symbol)),\n getAnyType: checker.getAnyType,\n isArrayLikeType: checker.isArrayLikeType,\n getPropertyOfType: checker.getPropertyOfType,\n typeHasCallOrConstructSignatures: (type) => hasCallOrConstructSignatures(checker, type),\n dispose: session.dispose,\n };\n};\n\nexport { createTypeChecker };\nexport type { TypeCheckerFacade };\n","import {\n MutableRef,\n Option,\n Predicate,\n Record as Rec,\n String as Str,\n Array as Arr,\n pipe,\n Function as Fn,\n} from \"effect\";\n\nimport { parseJson } from \"#src/json.ts\";\n\nimport { Messages, traceMessage } from \"./messages.ts\";\nimport { asRecord, resolvePackageJsonFieldWithTrace } from \"./package-json-fields.ts\";\nimport { combinePaths, forEachAncestorDirectory, toPath } from \"./paths.ts\";\nimport type {\n PackageId,\n PackageJsonCache,\n PackageJsonCacheEntry,\n PackageJsonContent,\n PackageJsonContents,\n PackageJsonInfo,\n PathAndExtension,\n Resolved,\n ResolutionState,\n} from \"./resolution-types.ts\";\n\nconst DATA_FIRST_ARITY = 2;\nconst DATA_FIRST_ARITY_3 = 3;\n\ninterface PackageJsonLocation {\n readonly packageDirectory: string;\n readonly packageJsonPath: string;\n}\n\nconst PACKAGE_JSON = \"package.json\";\nconst NODE_MODULES = \"node_modules\";\nconst SEPARATOR_LENGTH = 1;\nconst EMPTY = 0;\nconst BYTE_ORDER_MARK = /^\\uFEFF/u;\n\nconst memo = <Value>(): ((compute: () => Option.Option<Value>) => Option.Option<Value>) => {\n const cell = MutableRef.make(Option.none<Option.Option<Value>>());\n return (compute) => {\n const value = MutableRef.get(cell).pipe(Option.getOrElse(compute));\n MutableRef.set(cell, Option.some(value));\n return value;\n };\n};\n\nconst createContents = (packageJsonContent: PackageJsonContent): PackageJsonContents => ({\n packageJsonContent,\n versionPaths: memo(),\n peerDependencies: memo(),\n});\n\nconst createPackageJsonCache = (): PackageJsonCache => {\n const entries = new Map<string, PackageJsonCacheEntry>();\n return {\n get: (packageJsonPath) => Option.fromNullishOr(entries.get(toPath(packageJsonPath))),\n set: (packageJsonPath, entry) => {\n entries.set(toPath(packageJsonPath), entry);\n },\n };\n};\n\nconst parseText = (text: string): Option.Option<unknown> =>\n parseJson(Str.replace(BYTE_ORDER_MARK, \"\")(text));\n\nconst readJson = (path: string, state: ResolutionState): PackageJsonContent =>\n state.host.readFile(path).pipe(\n Option.flatMap((text) => parseText(text)),\n Option.map((value) => asRecord(value)),\n Option.getOrElse(() => ({})),\n );\n\nconst reuseCachedWithTrace = (\n { packageDirectory, packageJsonPath }: PackageJsonLocation,\n entry: PackageJsonCacheEntry,\n state: ResolutionState,\n): Option.Option<PackageJsonInfo> => {\n if (entry.kind === \"found\") {\n traceMessage(state, Messages.fileExistsCached, packageJsonPath);\n return Option.some({ packageDirectory, contents: entry.info.contents });\n }\n if (entry.missing.directoryExists) {\n traceMessage(state, Messages.fileDoesNotExistCached, packageJsonPath);\n }\n return Option.none();\n};\n\nconst remember = (\n state: ResolutionState,\n packageJsonPath: string,\n entry: PackageJsonCacheEntry,\n): void => {\n for (const cache of Option.toArray(state.packageJsonCache)) {\n cache.set(packageJsonPath, entry);\n }\n};\n\nconst cacheFoundWithTrace = (\n { packageDirectory, packageJsonPath }: PackageJsonLocation,\n state: ResolutionState,\n): Option.Option<PackageJsonInfo> => {\n const contents = createContents(readJson(packageJsonPath, state));\n traceMessage(state, Messages.foundPackageJson, packageJsonPath);\n const info = { packageDirectory, contents };\n remember(state, packageJsonPath, { kind: \"found\", info });\n return Option.some(info);\n};\n\nconst resolveAndCacheWithTrace = (\n location: PackageJsonLocation,\n state: ResolutionState,\n): Option.Option<PackageJsonInfo> => {\n const { packageDirectory, packageJsonPath } = location;\n const directoryExists = state.host.directoryExists(packageDirectory);\n if (directoryExists && state.host.fileExists(packageJsonPath)) {\n return cacheFoundWithTrace(location, state);\n }\n if (directoryExists) {\n traceMessage(state, Messages.fileDoesNotExist, packageJsonPath);\n }\n remember(state, packageJsonPath, {\n kind: \"missing\",\n missing: { packageDirectory, directoryExists },\n });\n return Option.none();\n};\n\nconst resolvePackageJsonInfo: {\n (\n onlyRecordFailures: boolean,\n state: ResolutionState,\n ): (packageDirectory: string) => Option.Option<PackageJsonInfo>;\n (\n packageDirectory: string,\n onlyRecordFailures: boolean,\n state: ResolutionState,\n ): Option.Option<PackageJsonInfo>;\n} = Fn.dual(\n DATA_FIRST_ARITY_3,\n (\n packageDirectory: string,\n onlyRecordFailures: boolean,\n state: ResolutionState,\n ): Option.Option<PackageJsonInfo> => {\n if (onlyRecordFailures) {\n return Option.none();\n }\n const location = {\n packageDirectory,\n packageJsonPath: combinePaths(packageDirectory, PACKAGE_JSON),\n };\n return state.packageJsonCache.pipe(\n Option.flatMap((cache) => cache.get(location.packageJsonPath)),\n Option.match({\n onNone: () => resolveAndCacheWithTrace(location, state),\n onSome: (entry) => reuseCachedWithTrace(location, entry, state),\n }),\n );\n },\n);\n\nconst getPackageScopeForPath: {\n (state: ResolutionState): (directory: string) => Option.Option<PackageJsonInfo>;\n (directory: string, state: ResolutionState): Option.Option<PackageJsonInfo>;\n} = Fn.dual(\n DATA_FIRST_ARITY,\n (directory: string, state: ResolutionState): Option.Option<PackageJsonInfo> =>\n forEachAncestorDirectory(directory, (ancestor) =>\n resolvePackageJsonInfo(ancestor, false, state),\n ),\n);\n\nconst peerVersion = (peer: string, nodeModules: string, state: ResolutionState): string =>\n resolvePackageJsonInfo(`${nodeModules}${peer}`, false, state).pipe(\n Option.match({\n onNone: () => {\n traceMessage(state, Messages.failedToFindPeerDependency, peer);\n return \"\";\n },\n onSome: (peerInfo) => {\n const version = String(peerInfo.contents.packageJsonContent[\"version\"]);\n traceMessage(state, Messages.foundPeerDependency, peer, version);\n return `+${peer}@${version}`;\n },\n }),\n );\n\nconst nodeModulesOf = (packageDirectory: string): string => {\n const end = Option.match(Str.lastIndexOf(NODE_MODULES)(packageDirectory), {\n onNone: () => packageDirectory.length,\n onSome: (index) => index + NODE_MODULES.length,\n });\n return `${Str.slice(EMPTY, end)(packageDirectory)}/`;\n};\n\nconst resolvePeerDependenciesWithTrace = (\n info: PackageJsonInfo,\n state: ResolutionState,\n): Option.Option<string> =>\n resolvePackageJsonFieldWithTrace(\n info.contents.packageJsonContent,\n { field: \"peerDependencies\", expected: \"object\" },\n state,\n ).pipe(\n Option.map((peers) => {\n traceMessage(state, Messages.packageJsonHasPeerDependencies);\n const nodeModules = nodeModulesOf(info.packageDirectory);\n return pipe(\n Rec.keys(asRecord(peers)),\n Arr.map((peer) => peerVersion(peer, nodeModules, state)),\n Arr.join(\"\"),\n );\n }),\n Option.filter((joined) => Str.isNonEmpty(joined)),\n );\n\nconst getPeerDependencies = (info: PackageJsonInfo, state: ResolutionState): string =>\n info.contents\n .peerDependencies(() => resolvePeerDependenciesWithTrace(info, state))\n .pipe(Option.getOrElse(() => \"\"));\n\nconst packageIdOf = (\n info: PackageJsonInfo,\n resolved: PathAndExtension,\n state: ResolutionState,\n): Option.Option<PackageId> => {\n const { name, version } = info.contents.packageJsonContent;\n if (!Predicate.isString(name) || !Predicate.isString(version)) {\n return Option.none();\n }\n return Option.some({\n name,\n subModuleName: Str.slice(info.packageDirectory.length + SEPARATOR_LENGTH)(resolved.path),\n version,\n peerDependencies: getPeerDependencies(info, state),\n });\n};\n\nconst withPackageId: {\n (\n resolved: Option.Option<PathAndExtension>,\n state: ResolutionState,\n ): (info: Option.Option<PackageJsonInfo>) => Option.Option<Resolved>;\n (\n info: Option.Option<PackageJsonInfo>,\n resolved: Option.Option<PathAndExtension>,\n state: ResolutionState,\n ): Option.Option<Resolved>;\n} = Fn.dual(\n DATA_FIRST_ARITY_3,\n (\n info: Option.Option<PackageJsonInfo>,\n resolved: Option.Option<PathAndExtension>,\n state: ResolutionState,\n ): Option.Option<Resolved> =>\n resolved.pipe(\n Option.map((value): Resolved => ({\n path: value.path,\n extension: value.extension,\n resolvedUsingTsExtension: value.resolvedUsingTsExtension,\n packageId: info.pipe(\n Option.flatMap((packageInfo) => packageIdOf(packageInfo, value, state)),\n ),\n originalPath: Option.none(),\n })),\n ),\n);\n\nconst qualifiedName = (packageId: PackageId): string => {\n if (packageId.subModuleName.length > EMPTY) {\n return `${packageId.name}/${packageId.subModuleName}`;\n }\n return packageId.name;\n};\n\nconst packageIdToString = (packageId: PackageId): string =>\n `${qualifiedName(packageId)}@${packageId.version}${packageId.peerDependencies}`;\n\nexport {\n createPackageJsonCache,\n getPackageScopeForPath,\n packageIdToString,\n resolvePackageJsonInfo,\n withPackageId,\n};\n","import { Array as Arr, Option, String as Str, Function as Fn } from \"effect\";\n\nimport type { ResolutionState } from \"./resolution-types.ts\";\nimport type { TargetRequest } from \"./resolver-target.ts\";\n\nconst DATA_FIRST_ARITY = 2;\nconst DATA_FIRST_ARITY_3 = 3;\n\nconst NOT_FOUND = -1;\nconst STAR_LENGTH = 1;\nconst START = 0;\nconst BEFORE = -1;\nconst AFTER = 1;\nconst EQUAL = 0;\n\nconst baseLength = (key: string): number =>\n Option.match(Str.indexOf(\"*\")(key), {\n onNone: () => key.length,\n onSome: (star) => star + STAR_LENGTH,\n });\n\ninterface KeyPair {\n readonly left: string;\n readonly right: string;\n}\n\nconst KEY_ORDER_RULES: readonly ((pair: KeyPair) => Option.Option<number>)[] = [\n ({ left, right }) =>\n Option.liftPredicate(Math.sign(baseLength(right) - baseLength(left)), (sign) => sign !== EQUAL),\n ({ left }) => Option.liftPredicate(AFTER, () => !Str.includes(\"*\")(left)),\n ({ right }) => Option.liftPredicate(BEFORE, () => !Str.includes(\"*\")(right)),\n];\n\nconst comparePatternKeys: {\n (right: string): (left: string) => number;\n (left: string, right: string): number;\n} = Fn.dual(DATA_FIRST_ARITY, (left: string, right: string): number =>\n Arr.findFirst(KEY_ORDER_RULES, (rule) => rule({ left, right })).pipe(\n Option.getOrElse(() => Math.sign(right.length - left.length)),\n ),\n);\n\nconst hasOneAsterisk = (key: string): boolean =>\n Option.exists(Str.indexOf(\"*\")(key), (first) =>\n Option.contains(Str.lastIndexOf(\"*\")(key), first),\n );\n\nconst surroundsName = (target: string, star: number, name: string): boolean =>\n Str.startsWith(Str.slice(START, star)(target))(name) &&\n Str.endsWith(Str.slice(star + STAR_LENGTH)(target))(name);\n\nconst matchesPatternWithTrailer = (target: string, name: string): boolean =>\n !Str.endsWith(\"*\")(target) &&\n Option.exists(Str.indexOf(\"*\")(target), (star) => surroundsName(target, star, name));\n\ntype Expansion = Option.Option<Omit<TargetRequest, \"key\">>;\n\nconst trailerExpansion = (key: string, name: string, state: ResolutionState): Expansion =>\n Option.liftPredicate(\n key,\n (candidate) => state.features.patternTrailers && matchesPatternWithTrailer(candidate, name),\n ).pipe(\n Option.flatMap((candidate) =>\n Option.map(Str.indexOf(\"*\")(candidate), (star) => {\n const end = name.length - (candidate.length - STAR_LENGTH - star);\n return { subpath: Str.slice(star, end)(name), pattern: true };\n }),\n ),\n );\n\nconst starSuffixExpansion = (key: string, name: string): Expansion =>\n Option.liftPredicate(\n { subpath: Str.slice(key.length - STAR_LENGTH)(name), pattern: true },\n () => Str.endsWith(\"*\")(key) && Str.startsWith(Str.slice(START, NOT_FOUND)(key))(name),\n );\n\nconst prefixExpansion = (key: string, name: string): Expansion =>\n Option.liftPredicate({ subpath: Str.slice(key.length)(name), pattern: false }, () =>\n Str.startsWith(key)(name),\n );\n\nconst expandedSubpath: {\n (name: string, state: ResolutionState): (key: string) => Expansion;\n (key: string, name: string, state: ResolutionState): Expansion;\n} = Fn.dual(DATA_FIRST_ARITY_3, (key: string, name: string, state: ResolutionState): Expansion =>\n trailerExpansion(key, name, state).pipe(\n Option.orElse(() => starSuffixExpansion(key, name)),\n Option.orElse(() => prefixExpansion(key, name)),\n ),\n);\n\nexport { comparePatternKeys, expandedSubpath, hasOneAsterisk };\nexport type { Expansion };\n","import { Array as Arr, Option, String as Str, pipe, Function as Fn } from \"effect\";\n\nimport {\n Extension,\n isDeclarationFileName,\n isTSFileExtensionForPackageField,\n removeFileExtension,\n tryExtractTSExtension,\n} from \"./extensions.ts\";\nimport type { ExtensionKind } from \"./extensions.ts\";\nimport { Messages, traceMessage } from \"./messages.ts\";\nimport { getBaseFileName, getDirectoryPath } from \"./paths.ts\";\nimport type { CandidateRequest, PathAndExtension, ResolutionState } from \"./resolution-types.ts\";\n\nconst DATA_FIRST_ARITY = 2;\nconst DATA_FIRST_ARITY_3 = 3;\n\ninterface ExtensionAttempt {\n readonly kind: ExtensionKind;\n readonly extension: string;\n readonly usingTsExtension: boolean;\n}\n\nconst attempt = (\n kind: ExtensionKind,\n extension: string,\n usingTsExtension = false,\n): ExtensionAttempt => ({\n kind,\n extension,\n usingTsExtension,\n});\n\nconst esmAttempts = (original: string): readonly ExtensionAttempt[] => {\n const explicit = original === Extension.Mts || original === Extension.Dmts;\n return [\n attempt(\"TypeScript\", Extension.Mts, explicit),\n attempt(\"Declaration\", Extension.Dmts, explicit),\n attempt(\"JavaScript\", Extension.Mjs),\n ];\n};\n\nconst cjsAttempts = (original: string): readonly ExtensionAttempt[] => {\n const explicit = original === Extension.Cts || original === Extension.Dcts;\n return [\n attempt(\"TypeScript\", Extension.Cts, explicit),\n attempt(\"Declaration\", Extension.Dcts, explicit),\n attempt(\"JavaScript\", Extension.Cjs),\n ];\n};\n\nconst jsonAttempts = (): readonly ExtensionAttempt[] => [\n attempt(\"Declaration\", \".d.json.ts\"),\n attempt(\"Json\", Extension.Json),\n];\n\nconst jsxAttempts = (original: string): readonly ExtensionAttempt[] => {\n const explicit = original === Extension.Tsx;\n return [\n attempt(\"TypeScript\", Extension.Tsx, explicit),\n attempt(\"TypeScript\", Extension.Ts, explicit),\n attempt(\"Declaration\", Extension.Dts, explicit),\n attempt(\"JavaScript\", Extension.Jsx),\n attempt(\"JavaScript\", Extension.Js),\n ];\n};\n\nconst defaultAttempts = (original: string): readonly ExtensionAttempt[] => {\n const explicit = original === Extension.Ts || original === Extension.Dts;\n return [\n attempt(\"TypeScript\", Extension.Ts, explicit),\n attempt(\"TypeScript\", Extension.Tsx, explicit),\n attempt(\"Declaration\", Extension.Dts, explicit),\n attempt(\"JavaScript\", Extension.Js),\n attempt(\"JavaScript\", Extension.Jsx),\n ];\n};\n\nconst arbitraryAttempts = (candidate: string, original: string): readonly ExtensionAttempt[] =>\n Option.liftPredicate(`${candidate}${original}`, (path) => !isDeclarationFileName(path)).pipe(\n Option.match({\n onNone: (): readonly ExtensionAttempt[] => [],\n onSome: () => [attempt(\"Declaration\", `.d${original}.ts`)],\n }),\n );\n\nconst ATTEMPTS_BY_EXTENSION: Readonly<\n Record<string, (original: string) => readonly ExtensionAttempt[]>\n> = {\n [Extension.Mjs]: esmAttempts,\n [Extension.Mts]: esmAttempts,\n [Extension.Dmts]: esmAttempts,\n [Extension.Cjs]: cjsAttempts,\n [Extension.Cts]: cjsAttempts,\n [Extension.Dcts]: cjsAttempts,\n [Extension.Json]: jsonAttempts,\n [Extension.Tsx]: jsxAttempts,\n [Extension.Jsx]: jsxAttempts,\n [Extension.Ts]: defaultAttempts,\n [Extension.Dts]: defaultAttempts,\n [Extension.Js]: defaultAttempts,\n \"\": defaultAttempts,\n};\n\nconst attemptsFor = (candidate: string, original: string): readonly ExtensionAttempt[] =>\n Option.fromNullishOr(ATTEMPTS_BY_EXTENSION[original]).pipe(\n Option.match({\n onNone: () => arbitraryAttempts(candidate, original),\n onSome: (attempts) => attempts(original),\n }),\n );\n\nconst NONE = 0;\n\nconst tryFile: {\n (\n onlyRecordFailures: boolean,\n state: ResolutionState,\n ): (fileName: string) => Option.Option<string>;\n (fileName: string, onlyRecordFailures: boolean, state: ResolutionState): Option.Option<string>;\n} = Fn.dual(\n DATA_FIRST_ARITY_3,\n (\n fileName: string,\n onlyRecordFailures: boolean,\n state: ResolutionState,\n ): Option.Option<string> => {\n if (onlyRecordFailures) {\n return Option.none();\n }\n if (state.host.fileExists(fileName)) {\n traceMessage(state, Messages.fileExistsUseIt, fileName);\n return Option.some(fileName);\n }\n traceMessage(state, Messages.fileDoesNotExist, fileName);\n return Option.none();\n },\n);\n\nconst directoryProbablyMissing = (candidate: string, state: ResolutionState): boolean => {\n const directory = getDirectoryPath(candidate);\n return directory.length > NONE && !state.host.directoryExists(directory);\n};\n\ninterface ExtensionRequest extends CandidateRequest {\n readonly originalExtension: string;\n}\n\nconst tryAttempt = (\n candidate: string,\n { extension, usingTsExtension }: ExtensionAttempt,\n state: ResolutionState,\n): Option.Option<PathAndExtension> =>\n tryFile(`${candidate}${extension}`, false, state).pipe(\n Option.map((path) => ({\n path,\n extension,\n resolvedUsingTsExtension: !state.candidateIsFromPackageJsonField && usingTsExtension,\n })),\n );\n\nconst tryAddingExtensions = (\n request: ExtensionRequest,\n state: ResolutionState,\n): Option.Option<PathAndExtension> => {\n if (request.onlyRecordFailures || directoryProbablyMissing(request.candidate, state)) {\n return Option.none();\n }\n const attempts = pipe(\n attemptsFor(request.candidate, request.originalExtension),\n Arr.filter(({ kind }) => request.extensions.includes(kind)),\n );\n return Arr.findFirst(attempts, (current) => tryAttempt(request.candidate, current, state));\n};\n\nconst resolveBySwappingExtensionWithTrace = (\n request: CandidateRequest,\n state: ResolutionState,\n): Option.Option<PathAndExtension> => {\n const { candidate } = request;\n if (!Str.includes(\".\")(getBaseFileName(candidate))) {\n return Option.none();\n }\n const removed = removeFileExtension(candidate);\n const extensionless = Option.liftPredicate(removed, (path) => path !== candidate).pipe(\n Option.getOrElse(() =>\n Option.match(Str.lastIndexOf(\".\")(candidate), {\n onNone: () => candidate,\n onSome: (dot) => Str.slice(NONE, dot)(candidate),\n }),\n ),\n );\n const extension = Str.slice(extensionless.length)(candidate);\n traceMessage(state, Messages.fileHasExtensionStripping, candidate, extension);\n return tryAddingExtensions(\n { ...request, candidate: extensionless, originalExtension: extension },\n state,\n );\n};\n\nconst loadModuleFromFile: {\n (state: ResolutionState): (request: CandidateRequest) => Option.Option<PathAndExtension>;\n (request: CandidateRequest, state: ResolutionState): Option.Option<PathAndExtension>;\n} = Fn.dual(\n DATA_FIRST_ARITY,\n (request: CandidateRequest, state: ResolutionState): Option.Option<PathAndExtension> =>\n resolveBySwappingExtensionWithTrace(request, state).pipe(\n Option.orElse(() =>\n Option.liftPredicate(state, ({ features }) => !features.esmMode).pipe(\n Option.flatMap(() => tryAddingExtensions({ ...request, originalExtension: \"\" }, state)),\n ),\n ),\n ),\n);\n\nconst loadFileNameFromPackageJsonField: {\n (state: ResolutionState): (request: CandidateRequest) => Option.Option<PathAndExtension>;\n (request: CandidateRequest, state: ResolutionState): Option.Option<PathAndExtension>;\n} = Fn.dual(\n DATA_FIRST_ARITY,\n (request: CandidateRequest, state: ResolutionState): Option.Option<PathAndExtension> => {\n const { candidate } = request;\n if (!isTSFileExtensionForPackageField(request.extensions, candidate)) {\n return resolveBySwappingExtensionWithTrace(request, state);\n }\n return tryFile(candidate, request.onlyRecordFailures, state).pipe(\n Option.map(() => ({\n path: candidate,\n extension: Option.getOrElse(tryExtractTSExtension(candidate), () => \"\"),\n resolvedUsingTsExtension: false,\n })),\n );\n },\n);\n\nexport { loadFileNameFromPackageJsonField, loadModuleFromFile, tryFile };\n","import {\n Array as Arr,\n Option,\n Predicate,\n Record as Rec,\n String as Str,\n pipe,\n Function as Fn,\n} from \"effect\";\nimport semver from \"semver\";\n\nimport type { Extensions } from \"./extensions.ts\";\nimport { Messages, traceMessage } from \"./messages.ts\";\nimport { withPackageId } from \"./package-json.ts\";\nimport {\n combinePaths,\n getNormalizedAbsolutePath,\n getPathComponents,\n pathIsRelative,\n} from \"./paths.ts\";\nimport type {\n PackageJsonInfo,\n Resolved,\n ResolutionState,\n SearchResult,\n} from \"./resolution-types.ts\";\nimport { loadFileNameFromPackageJsonField } from \"./resolver-files.ts\";\nimport { RESOLUTION_VERSION } from \"./types-versions.ts\";\n\nconst DATA_FIRST_ARITY_3 = 3;\n\ninterface TargetContext {\n readonly extensions: Extensions;\n readonly moduleName: string;\n readonly scope: PackageJsonInfo;\n readonly isImports: boolean;\n}\n\ninterface TargetRequest {\n readonly subpath: string;\n readonly pattern: boolean;\n readonly key: string;\n}\n\ninterface TargetSite {\n readonly context: TargetContext;\n readonly request: TargetRequest;\n}\n\ntype TargetLoader = (target: unknown, site: TargetSite, state: ResolutionState) => SearchResult;\n\nconst FORBIDDEN_SEGMENTS: ReadonlySet<string> = new Set([\"..\", \".\", \"node_modules\"]);\nconst VERSIONED_TYPES_PREFIX = \"types@\";\nconst RANGE_OPTIONS = { includePrerelease: true } as const;\nconst FIRST_SEGMENT = 1;\nconst EMPTY = 0;\n\nconst notFound: SearchResult = Option.none();\n\nconst asSearchResult = (resolved: Option.Option<Resolved>): SearchResult =>\n resolved.pipe(Option.map((value) => Option.some(value)));\n\nconst invalidTarget = ({ context }: TargetSite, state: ResolutionState): SearchResult => {\n traceMessage(\n state,\n Messages.packageJsonInvalidTarget,\n context.scope.packageDirectory,\n context.moduleName,\n );\n return notFound;\n};\n\nconst fieldName = (context: TargetContext): string => {\n if (context.isImports) {\n return \"imports\";\n }\n return \"exports\";\n};\n\nconst substitute = (target: string, request: TargetRequest): string => {\n if (request.pattern) {\n return Str.replaceAll(\"*\", request.subpath)(target);\n }\n return `${target}${request.subpath}`;\n};\n\nconst hasForbiddenSegment = (parts: readonly string[]): boolean =>\n pipe(\n parts,\n Arr.some((part) => FORBIDDEN_SEGMENTS.has(part)),\n );\n\nconst resolveImportToPackage = (\n target: string,\n { context, request }: TargetSite,\n state: ResolutionState,\n): SearchResult => {\n const combinedLookup = substitute(target, request);\n const containingDirectory = `${context.scope.packageDirectory}/`;\n traceMessage(state, Messages.usingSubpath, \"imports\", request.key, combinedLookup);\n traceMessage(state, Messages.resolvingModule, combinedLookup, containingDirectory);\n const result = state.resolveNested(state, {\n moduleName: combinedLookup,\n containingDirectory,\n extensions: context.extensions,\n });\n return asSearchResult(\n result.resolvedModule.pipe(\n Option.map((module) => ({\n path: module.resolvedFileName,\n extension: module.extension,\n packageId: module.packageId,\n originalPath: module.originalPath,\n resolvedUsingTsExtension: module.resolvedUsingTsExtension,\n })),\n ),\n );\n};\n\nconst isPackageImportTarget = (target: string, context: TargetContext): boolean =>\n context.isImports && !Str.startsWith(\"../\")(target) && !Str.startsWith(\"/\")(target);\n\nconst targetParts = (target: string): readonly string[] => {\n const parts = getPathComponents(target);\n if (pathIsRelative(target)) {\n return parts.slice(FIRST_SEGMENT);\n }\n return parts;\n};\n\nconst resolveRelativeTargetWithTrace = (\n target: string,\n site: TargetSite,\n state: ResolutionState,\n): SearchResult => {\n const { context, request } = site;\n if (\n hasForbiddenSegment(targetParts(target).slice(FIRST_SEGMENT)) ||\n hasForbiddenSegment(getPathComponents(request.subpath))\n ) {\n return invalidTarget(site, state);\n }\n traceMessage(\n state,\n Messages.usingSubpath,\n fieldName(context),\n request.key,\n substitute(target, request),\n );\n const candidate = getNormalizedAbsolutePath(\n substitute(combinePaths(context.scope.packageDirectory, target), request),\n \"/\",\n );\n const loaded = loadFileNameFromPackageJsonField(\n { extensions: context.extensions, candidate, onlyRecordFailures: false },\n state,\n );\n return asSearchResult(withPackageId(Option.some(context.scope), loaded, state));\n};\n\ntype StringTargetLoader = (\n target: string,\n site: TargetSite,\n state: ResolutionState,\n) => SearchResult;\n\nconst STRING_TARGET_LOADERS: readonly (readonly [\n (target: string, context: TargetContext) => boolean,\n StringTargetLoader,\n])[] = [\n [(target) => Str.startsWith(\"./\")(target), resolveRelativeTargetWithTrace],\n [isPackageImportTarget, resolveImportToPackage],\n];\n\nconst isMissingTrailingSlash = (target: string, request: TargetRequest): boolean =>\n !request.pattern && request.subpath.length > EMPTY && !Str.endsWith(\"/\")(target);\n\nconst loadStringTarget: StringTargetLoader = (target, site, state) => {\n if (isMissingTrailingSlash(target, site.request)) {\n return invalidTarget(site, state);\n }\n return Arr.findFirst(STRING_TARGET_LOADERS, ([applies]) => applies(target, site.context)).pipe(\n Option.match({\n onNone: () => invalidTarget(site, state),\n onSome: ([, load]) => load(target, site, state),\n }),\n );\n};\n\nconst isApplicableVersionedTypesKey = (conditions: readonly string[], key: string): boolean => {\n const range = Str.slice(VERSIONED_TYPES_PREFIX.length)(key);\n return (\n conditions.includes(\"types\") &&\n Str.startsWith(VERSIONED_TYPES_PREFIX)(key) &&\n Predicate.isNotNull(semver.validRange(range, RANGE_OPTIONS)) &&\n semver.satisfies(RESOLUTION_VERSION, range, RANGE_OPTIONS)\n );\n};\n\nconst conditionMatches = (condition: string, state: ResolutionState): boolean =>\n condition === \"default\" ||\n state.conditions.includes(condition) ||\n isApplicableVersionedTypesKey(state.conditions, condition);\n\nconst tryCondition =\n (loadTarget: TargetLoader, target: Readonly<Record<string, unknown>>) =>\n (condition: string, site: TargetSite, state: ResolutionState): SearchResult => {\n if (!conditionMatches(condition, state)) {\n traceMessage(state, Messages.sawNonMatchingCondition, condition);\n return Option.none();\n }\n traceMessage(state, Messages.matchedCondition, fieldName(site.context), condition);\n const result = loadTarget(target[condition], site, state);\n if (Option.isSome(result)) {\n traceMessage(state, Messages.resolvedUnderCondition, condition);\n return result;\n }\n traceMessage(state, Messages.failedUnderCondition, condition);\n return result;\n };\n\nconst resolveConditionsWithTrace =\n (loadTarget: TargetLoader) =>\n (\n target: Readonly<Record<string, unknown>>,\n site: TargetSite,\n state: ResolutionState,\n ): SearchResult => {\n traceMessage(state, Messages.enteringConditionalExports);\n const attempt = tryCondition(loadTarget, target);\n const result = Arr.findFirst(Rec.keys(target), (condition) => attempt(condition, site, state));\n traceMessage(state, Messages.exitingConditionalExports);\n return result;\n };\n\nconst loadArrayTarget =\n (loadTarget: TargetLoader) =>\n (target: readonly unknown[], site: TargetSite, state: ResolutionState): SearchResult => {\n if (target.length === EMPTY) {\n return invalidTarget(site, state);\n }\n return Arr.findFirst(target, (element) => loadTarget(element, site, state)).pipe(\n Option.orElse(() => invalidTarget(site, state)),\n );\n };\n\nconst nullTarget = ({ context }: TargetSite, state: ResolutionState): SearchResult => {\n traceMessage(\n state,\n Messages.packageJsonMapsToNull,\n context.scope.packageDirectory,\n context.moduleName,\n );\n return notFound;\n};\n\nconst loadScalarTarget = (\n target: unknown,\n site: TargetSite,\n state: ResolutionState,\n): SearchResult => {\n if (Predicate.isNull(target)) {\n return nullTarget(site, state);\n }\n return invalidTarget(site, state);\n};\n\nconst loadStructuredTarget =\n (loadTarget: TargetLoader): TargetLoader =>\n (target, site, state) => {\n if (Arr.isArray(target)) {\n return loadArrayTarget(loadTarget)(target, site, state);\n }\n if (Predicate.isObject(target)) {\n return resolveConditionsWithTrace(loadTarget)(target, site, state);\n }\n return loadScalarTarget(target, site, state);\n };\n\nconst loadTarget: {\n (site: TargetSite, state: ResolutionState): (target: unknown) => SearchResult;\n (target: unknown, site: TargetSite, state: ResolutionState): SearchResult;\n} = Fn.dual(\n DATA_FIRST_ARITY_3,\n (target: unknown, site: TargetSite, state: ResolutionState): SearchResult => {\n if (Predicate.isString(target)) {\n return loadStringTarget(target, site, state);\n }\n return loadStructuredTarget(loadTarget)(target, site, state);\n },\n);\n\nexport { loadTarget, notFound };\nexport type { TargetContext, TargetRequest, TargetSite };\n","import {\n Array as Arr,\n Option,\n Predicate,\n Record as Rec,\n String as Str,\n pipe,\n Function as Fn,\n Order,\n} from \"effect\";\n\nimport { PRIORITY_KINDS, intersectExtensions, subtractExtensions } from \"./extensions.ts\";\nimport type { Extensions } from \"./extensions.ts\";\nimport { Messages, traceMessage } from \"./messages.ts\";\nimport { getPackageScopeForPath } from \"./package-json.ts\";\nimport { getNormalizedAbsolutePath, getPathComponents } from \"./paths.ts\";\nimport type {\n ModuleLookup,\n PackageJsonInfo,\n ResolutionState,\n SearchResult,\n} from \"./resolution-types.ts\";\nimport { comparePatternKeys, expandedSubpath, hasOneAsterisk } from \"./resolver-patterns.ts\";\nimport { loadTarget, notFound } from \"./resolver-target.ts\";\nimport type { TargetContext } from \"./resolver-target.ts\";\n\nconst DATA_FIRST_ARITY_3 = 3;\n\nconst DATA_FIRST_ARITY = 2;\nconst SAME_ORDER = 0;\n\nconst patternKeyOrder: Order.Order<string> = (left, right) =>\n Order.Number(comparePatternKeys(left, right), SAME_ORDER);\n\ntype LookupTable = Readonly<Record<string, unknown>>;\n\ninterface LookupSite {\n readonly lookupTable: LookupTable;\n readonly context: TargetContext;\n}\n\ninterface ExportsRequest {\n readonly extensions: Extensions;\n readonly subpath: string;\n}\n\nconst expandKey = (\n key: string,\n site: LookupSite,\n state: ResolutionState,\n): Option.Option<SearchResult> =>\n expandedSubpath(key, site.context.moduleName, state).pipe(\n Option.map((expansion) =>\n loadTarget(\n site.lookupTable[key],\n { context: site.context, request: { ...expansion, key } },\n state,\n ),\n ),\n );\n\nconst loadModuleFromImportsOrExports = (site: LookupSite, state: ResolutionState): SearchResult => {\n const { context, lookupTable } = site;\n const name = context.moduleName;\n if (!Str.endsWith(\"/\")(name) && !Str.includes(\"*\")(name) && Rec.has(lookupTable, name)) {\n return loadTarget(\n lookupTable[name],\n { context, request: { subpath: \"\", pattern: false, key: name } },\n state,\n );\n }\n const expandingKeys = pipe(\n Rec.keys(lookupTable),\n Arr.filter((key) => hasOneAsterisk(key) || Str.endsWith(\"/\")(key)),\n (keys) => Arr.sort(keys, patternKeyOrder),\n );\n return Arr.findFirst(expandingKeys, (key) => expandKey(key, site, state)).pipe(Option.flatten);\n};\n\nconst noKeyStartsWithDot = (value: LookupTable): boolean =>\n !pipe(\n Rec.keys(value),\n Arr.some((key) => Str.startsWith(\".\")(key)),\n );\n\nconst allKeysStartWithDot = (value: LookupTable): boolean =>\n pipe(\n Rec.keys(value),\n Arr.every((key) => Str.startsWith(\".\")(key)),\n );\n\nconst isDirectExport = (exports: unknown): boolean =>\n Predicate.isString(exports) || Arr.isArray(exports);\n\nconst objectMainExport = (exports: LookupTable): Option.Option<unknown> => {\n if (noKeyStartsWithDot(exports)) {\n return Option.some(exports);\n }\n return Option.liftPredicate(exports[\".\"], Predicate.isTruthy).pipe(\n Option.filter(() => Rec.has(exports, \".\")),\n );\n};\n\nconst mainExportOf = (exports: unknown): Option.Option<unknown> => {\n if (isDirectExport(exports)) {\n return Option.some(exports);\n }\n return Option.liftPredicate(exports, Predicate.isObject).pipe(Option.flatMap(objectMainExport));\n};\n\nconst exportDoesNotExist = (context: TargetContext, state: ResolutionState): SearchResult => {\n traceMessage(\n state,\n Messages.exportSpecifierDoesNotExist,\n context.moduleName,\n context.scope.packageDirectory,\n );\n return notFound;\n};\n\nconst loadSubpathExport = (\n exports: unknown,\n context: TargetContext,\n state: ResolutionState,\n): SearchResult => {\n if (!Predicate.isObject(exports) || !allKeysStartWithDot(exports)) {\n return exportDoesNotExist(context, state);\n }\n return loadModuleFromImportsOrExports({ lookupTable: exports, context }, state).pipe(\n Option.orElse(() => exportDoesNotExist(context, state)),\n );\n};\n\nconst loadModuleFromExports: {\n (request: ExportsRequest, state: ResolutionState): (scope: PackageJsonInfo) => SearchResult;\n (scope: PackageJsonInfo, request: ExportsRequest, state: ResolutionState): SearchResult;\n} = Fn.dual(\n DATA_FIRST_ARITY_3,\n (\n scope: PackageJsonInfo,\n { extensions, subpath }: ExportsRequest,\n state: ResolutionState,\n ): SearchResult => {\n const { exports } = scope.contents.packageJsonContent;\n if (!Predicate.isTruthy(exports)) {\n return Option.none();\n }\n const context: TargetContext = { extensions, moduleName: subpath, scope, isImports: false };\n if (subpath !== \".\") {\n return loadSubpathExport(exports, context, state);\n }\n return mainExportOf(exports).pipe(\n Option.match({\n onNone: () => exportDoesNotExist(context, state),\n onSome: (mainExport) =>\n loadTarget(\n mainExport,\n { context, request: { subpath: \"\", pattern: false, key: \".\" } },\n state,\n ),\n }),\n );\n },\n);\n\nconst asLookupTable = (value: unknown): LookupTable =>\n Option.liftPredicate(value, Predicate.isObject).pipe(Option.getOrElse(() => ({})));\n\nconst reportMissingImport = (context: TargetContext, state: ResolutionState): SearchResult => {\n traceMessage(\n state,\n Messages.importSpecifierDoesNotExist,\n context.moduleName,\n context.scope.packageDirectory,\n );\n return notFound;\n};\n\nconst resolveImportsWithTrace = (\n lookup: ModuleLookup,\n scope: PackageJsonInfo,\n state: ResolutionState,\n): SearchResult => {\n const { imports } = scope.contents.packageJsonContent;\n if (!Predicate.isTruthy(imports)) {\n traceMessage(state, Messages.packageJsonNoImports, scope.packageDirectory);\n return notFound;\n }\n const context: TargetContext = {\n extensions: lookup.extensions,\n moduleName: lookup.moduleName,\n scope,\n isImports: true,\n };\n return loadModuleFromImportsOrExports(\n { lookupTable: asLookupTable(imports), context },\n state,\n ).pipe(Option.orElse(() => reportMissingImport(context, state)));\n};\n\nconst reportMissingScope = (directoryPath: string, state: ResolutionState): SearchResult => {\n traceMessage(state, Messages.directoryHasNoPackageScope, directoryPath);\n return notFound;\n};\n\nconst resolvePackageImportWithTrace: {\n (state: ResolutionState): (lookup: ModuleLookup) => SearchResult;\n (lookup: ModuleLookup, state: ResolutionState): SearchResult;\n} = Fn.dual(DATA_FIRST_ARITY, (lookup: ModuleLookup, state: ResolutionState): SearchResult => {\n const { moduleName } = lookup;\n if (moduleName === \"#\" || Str.startsWith(\"#/\")(moduleName)) {\n traceMessage(state, Messages.invalidImportSpecifier, moduleName);\n return notFound;\n }\n const directoryPath = getNormalizedAbsolutePath(lookup.directory, \"/\");\n return getPackageScopeForPath(directoryPath, state).pipe(\n Option.match({\n onNone: () => reportMissingScope(directoryPath, state),\n onSome: (scope) => resolveImportsWithTrace(lookup, scope, state),\n }),\n );\n});\n\nconst selfNameSubpath = (moduleName: string, packageName: string): Option.Option<string> => {\n const parts = getPathComponents(moduleName);\n const nameParts = getPathComponents(packageName);\n if (\n !pipe(\n nameParts,\n Arr.every((part, index) => parts[index] === part),\n )\n ) {\n return Option.none();\n }\n const trailing = parts.slice(nameParts.length);\n if (Arr.isReadonlyArrayNonEmpty(trailing)) {\n return Option.some(`./${pipe(trailing, Arr.join(\"/\"))}`);\n }\n return Option.some(\".\");\n};\n\nconst loadFromOwnExports = (\n scope: PackageJsonInfo,\n { extensions, subpath }: ExportsRequest,\n state: ResolutionState,\n): SearchResult =>\n loadModuleFromExports(\n scope,\n { extensions: intersectExtensions(extensions, PRIORITY_KINDS), subpath },\n state,\n ).pipe(\n Option.orElse(() =>\n loadModuleFromExports(\n scope,\n { extensions: subtractExtensions(extensions, PRIORITY_KINDS), subpath },\n state,\n ),\n ),\n );\n\nconst loadModuleFromSelfNameReference: {\n (state: ResolutionState): (lookup: ModuleLookup) => SearchResult;\n (lookup: ModuleLookup, state: ResolutionState): SearchResult;\n} = Fn.dual(DATA_FIRST_ARITY, (lookup: ModuleLookup, state: ResolutionState): SearchResult =>\n getPackageScopeForPath(getNormalizedAbsolutePath(lookup.directory, \"/\"), state).pipe(\n Option.filter((scope) => Predicate.isTruthy(scope.contents.packageJsonContent[\"exports\"])),\n Option.flatMap((scope) =>\n Option.liftPredicate(scope.contents.packageJsonContent[\"name\"], Predicate.isString).pipe(\n Option.flatMap((name) => selfNameSubpath(lookup.moduleName, name)),\n Option.flatMap((subpath) =>\n loadFromOwnExports(scope, { extensions: lookup.extensions, subpath }, state),\n ),\n ),\n ),\n ),\n);\n\nexport { loadModuleFromExports, loadModuleFromSelfNameReference, resolvePackageImportWithTrace };\nexport type { ExportsRequest };\n","import {\n Array as Arr,\n Option,\n Predicate,\n Record as Rec,\n pipe,\n String as Str,\n Function as Fn,\n} from \"effect\";\n\nimport { tryGetExtensionFromPath } from \"./extensions.ts\";\nimport type { Extensions } from \"./extensions.ts\";\nimport { Messages, traceMessage } from \"./messages.ts\";\nimport { combinePaths, getDirectoryPath, normalizePath } from \"./paths.ts\";\nimport type { CandidateRequest, PathAndExtension, ResolutionState } from \"./resolution-types.ts\";\nimport { tryFile } from \"./resolver-files.ts\";\n\nconst DATA_FIRST_ARITY = 2;\n\ntype Loader<Found = PathAndExtension> = (\n request: CandidateRequest,\n state: ResolutionState,\n) => Option.Option<Found>;\n\ninterface PathsRequest<Found> {\n readonly extensions: Extensions;\n readonly moduleName: string;\n readonly baseDirectory: string;\n readonly paths: Readonly<Record<string, unknown>>;\n readonly loader: Loader<Found>;\n readonly onlyRecordFailures: boolean;\n readonly fromFile: (file: PathAndExtension) => Found;\n}\n\ninterface Pattern {\n readonly prefix: string;\n readonly suffix: string;\n}\n\ntype PatternOrExact =\n | { readonly kind: \"exact\"; readonly text: string }\n | { readonly kind: \"pattern\"; readonly pattern: Pattern };\n\nconst STAR_LENGTH = 1;\nconst START = 0;\n\nconst patternAt = (key: string, star: number): Option.Option<PatternOrExact> =>\n Option.liftPredicate(key, (text) => !Str.includes(\"*\", star + STAR_LENGTH)(text)).pipe(\n Option.map((text) => ({\n kind: \"pattern\",\n pattern: {\n prefix: Str.slice(START, star)(text),\n suffix: Str.slice(star + STAR_LENGTH)(text),\n },\n })),\n );\n\nconst tryParsePattern = (key: string): Option.Option<PatternOrExact> =>\n Option.match(Str.indexOf(\"*\")(key), {\n onNone: () => Option.some({ kind: \"exact\", text: key }),\n onSome: (star) => patternAt(key, star),\n });\n\nconst isPatternMatch = ({ prefix, suffix }: Pattern, candidate: string): boolean =>\n candidate.length >= prefix.length + suffix.length &&\n Str.startsWith(prefix)(candidate) &&\n Str.endsWith(suffix)(candidate);\n\nconst bestPattern = (patterns: readonly Pattern[], candidate: string): Option.Option<Pattern> =>\n Arr.reduce(patterns, Option.none<Pattern>(), (best, pattern) =>\n Option.liftPredicate(\n pattern,\n (current) =>\n isPatternMatch(current, candidate) &&\n Option.match(best, {\n onNone: () => true,\n onSome: (previous) => current.prefix.length > previous.prefix.length,\n }),\n ).pipe(Option.orElse(() => best)),\n );\n\nconst patternOf = (entry: PatternOrExact): Option.Option<Pattern> => {\n if (entry.kind === \"pattern\") {\n return Option.some(entry.pattern);\n }\n return Option.none();\n};\n\ninterface MatchedPattern {\n readonly text: string;\n readonly star: string;\n}\n\nconst matchedBy =\n (candidate: string) =>\n (pattern: Pattern): MatchedPattern => ({\n text: `${pattern.prefix}*${pattern.suffix}`,\n star: Str.slice(pattern.prefix.length, candidate.length - pattern.suffix.length)(candidate),\n });\n\nconst patternMatch = (\n entries: readonly PatternOrExact[],\n candidate: string,\n): Option.Option<MatchedPattern> => {\n const patterns = pipe(\n entries,\n Arr.map((entry) => patternOf(entry)),\n Arr.getSomes,\n );\n return Option.map(bestPattern(patterns, candidate), matchedBy(candidate));\n};\n\nconst matchPatternOrExact = (\n entries: readonly PatternOrExact[],\n candidate: string,\n): Option.Option<MatchedPattern> =>\n pipe(\n entries,\n Arr.findFirst((entry) => entry.kind === \"exact\" && entry.text === candidate),\n Option.map((): MatchedPattern => ({ text: candidate, star: \"\" })),\n Option.orElse(() => patternMatch(entries, candidate)),\n );\n\nconst substitutionsOf = (\n paths: Readonly<Record<string, unknown>>,\n key: string,\n): readonly string[] =>\n Option.fromNullishOr(paths[key]).pipe(\n Option.filter((value) => Arr.isArray(value)),\n Option.map((values: readonly unknown[]) =>\n pipe(\n values,\n Arr.filter((value): value is string => Predicate.isString(value)),\n ),\n ),\n Option.getOrElse((): readonly string[] => []),\n );\n\ninterface Substitution {\n readonly text: string;\n readonly matched: MatchedPattern;\n}\n\nconst trySubstitution = <Found>(\n { text, matched }: Substitution,\n context: PathsRequest<Found>,\n state: ResolutionState,\n): Option.Option<Found> => {\n const path = Option.liftPredicate(matched.star, (star) => star.length > START).pipe(\n Option.match({ onNone: () => text, onSome: (star) => Str.replace(\"*\", star)(text) }),\n );\n const candidate = normalizePath(combinePaths(context.baseDirectory, path));\n traceMessage(state, Messages.tryingSubstitution, text, path);\n return tryGetExtensionFromPath(text).pipe(\n Option.flatMap((extension) =>\n tryFile(candidate, context.onlyRecordFailures, state).pipe(\n Option.map((found) =>\n context.fromFile({ path: found, extension, resolvedUsingTsExtension: false }),\n ),\n ),\n ),\n Option.orElse(() =>\n context.loader(\n {\n extensions: context.extensions,\n candidate,\n onlyRecordFailures:\n context.onlyRecordFailures || !state.host.directoryExists(getDirectoryPath(candidate)),\n },\n state,\n ),\n ),\n );\n};\n\nconst tryLoadModuleUsingPaths: {\n (\n state: ResolutionState,\n ): <Found>(context: PathsRequest<Found>) => Option.Option<Option.Option<Found>>;\n <Found>(\n context: PathsRequest<Found>,\n state: ResolutionState,\n ): Option.Option<Option.Option<Found>>;\n} = Fn.dual(\n DATA_FIRST_ARITY,\n <Found>(\n context: PathsRequest<Found>,\n state: ResolutionState,\n ): Option.Option<Option.Option<Found>> => {\n const entries = Arr.getSomes(\n pipe(\n Rec.keys(context.paths),\n Arr.map((key) => tryParsePattern(key)),\n ),\n );\n return matchPatternOrExact(entries, context.moduleName).pipe(\n Option.map((matched) => {\n traceMessage(state, Messages.matchedPattern, context.moduleName, matched.text);\n return pipe(\n substitutionsOf(context.paths, matched.text),\n Arr.findFirst((text) => trySubstitution({ text, matched }, context, state)),\n );\n }),\n );\n },\n);\n\nexport { tryLoadModuleUsingPaths };\nexport type { Loader, PathsRequest };\n","import { Option, Function as Fn } from \"effect\";\n\nimport { extensionsOf } from \"./extensions.ts\";\nimport type { Extensions } from \"./extensions.ts\";\nimport { Messages, traceMessage } from \"./messages.ts\";\nimport { readPackageJsonMainField, readPackageJsonTypesFields } from \"./package-json-fields.ts\";\nimport { resolvePackageJsonInfo, withPackageId } from \"./package-json.ts\";\nimport { tryLoadModuleUsingPaths } from \"./paths-mapping.ts\";\nimport type { Loader } from \"./paths-mapping.ts\";\nimport {\n combinePaths,\n containsPath,\n getDirectoryPath,\n getRelativePathFromDirectory,\n} from \"./paths.ts\";\nimport type {\n CandidateRequest,\n PackageJsonContent,\n PackageJsonInfo,\n PathAndExtension,\n Resolved,\n ResolutionState,\n VersionPaths,\n} from \"./resolution-types.ts\";\nimport { loadFileNameFromPackageJsonField, loadModuleFromFile } from \"./resolver-files.ts\";\nimport { RESOLUTION_VERSION, getVersionPaths } from \"./types-versions.ts\";\n\nconst DATA_FIRST_ARITY = 2;\n\ninterface RelativeRequest extends CandidateRequest {\n readonly considerPackageJson: boolean;\n}\n\ntype RelativeLoader = (request: RelativeRequest, state: ResolutionState) => Option.Option<Resolved>;\n\ninterface PackageDirectoryContents {\n readonly jsonContent: Option.Option<PackageJsonContent>;\n readonly versionPaths: Option.Option<VersionPaths>;\n}\n\ninterface DirectoryLoadRequest extends RelativeRequest {\n readonly loadRelative: RelativeLoader;\n}\n\ninterface DirectoryWorkerRequest extends CandidateRequest, PackageDirectoryContents {\n readonly loadRelative: RelativeLoader;\n}\n\ninterface PackageEntry {\n readonly packageFile: Option.Option<string>;\n readonly loader: Loader;\n readonly onlyRecordFailuresForPackageFile: boolean;\n readonly onlyRecordFailuresForIndex: boolean;\n}\n\nconst DECLARATION_ONLY_SIZE = 1;\nconst INDEX = \"index\";\n\nconst expandDeclarationOnly = (extensions: Extensions): Extensions => {\n if (extensions.length === DECLARATION_ONLY_SIZE && extensions.includes(\"Declaration\")) {\n return extensionsOf(\"TypeScript\", \"Declaration\");\n }\n return extensions;\n};\n\nconst packageFieldState = (\n state: ResolutionState,\n jsonContent: Option.Option<PackageJsonContent>,\n): ResolutionState => ({\n ...state,\n candidateIsFromPackageJsonField: true,\n features: {\n ...state.features,\n esmMode:\n state.features.esmMode &&\n Option.exists(jsonContent, (content) => content[\"type\"] === \"module\"),\n },\n});\n\nconst packageFieldLoader =\n (jsonContent: Option.Option<PackageJsonContent>, loadRelative: RelativeLoader): Loader =>\n (request, state) =>\n loadFileNameFromPackageJsonField(request, state).pipe(\n Option.orElse(() =>\n loadRelative(\n {\n ...request,\n extensions: expandDeclarationOnly(request.extensions),\n considerPackageJson: false,\n },\n packageFieldState(state, jsonContent),\n ).pipe(\n Option.map(({ path, extension, resolvedUsingTsExtension }): PathAndExtension => ({\n path,\n extension,\n resolvedUsingTsExtension,\n })),\n ),\n ),\n );\n\nconst readPackageFile = (\n request: CandidateRequest,\n jsonContent: Option.Option<PackageJsonContent>,\n state: ResolutionState,\n): Option.Option<string> =>\n jsonContent.pipe(\n Option.flatMap((content) =>\n Option.liftPredicate(request.extensions, (value) => value.includes(\"Declaration\")).pipe(\n Option.flatMap(() => readPackageJsonTypesFields(content, request.candidate, state)),\n Option.orElse(() => readPackageJsonMainField(content, request.candidate, state)),\n ),\n ),\n );\n\nconst tryVersionPaths = (\n context: Readonly<{\n extensions: Extensions;\n candidate: string;\n packageFile: Option.Option<string>;\n versionPaths: VersionPaths;\n loader: Loader;\n onlyRecordFailures: boolean;\n }>,\n state: ResolutionState,\n): Option.Option<Option.Option<PathAndExtension>> => {\n const moduleName = getRelativePathFromDirectory(\n context.candidate,\n Option.getOrElse(context.packageFile, () => combinePaths(context.candidate, INDEX)),\n );\n traceMessage(\n state,\n Messages.packageJsonTypesVersionsMatch,\n context.versionPaths.version,\n RESOLUTION_VERSION,\n moduleName,\n );\n return tryLoadModuleUsingPaths(\n {\n extensions: context.extensions,\n moduleName,\n baseDirectory: context.candidate,\n paths: context.versionPaths.paths,\n loader: context.loader,\n onlyRecordFailures: context.onlyRecordFailures,\n fromFile: (file) => file,\n },\n state,\n );\n};\n\nconst packageEntryOf = (request: DirectoryWorkerRequest, state: ResolutionState): PackageEntry => {\n const packageFile = readPackageFile(request, request.jsonContent, state);\n return {\n packageFile,\n loader: packageFieldLoader(request.jsonContent, request.loadRelative),\n onlyRecordFailuresForPackageFile: Option.exists(\n packageFile,\n (file) => !state.host.directoryExists(getDirectoryPath(file)),\n ),\n onlyRecordFailuresForIndex:\n request.onlyRecordFailures || !state.host.directoryExists(request.candidate),\n };\n};\n\nconst fromVersionPaths = (\n request: DirectoryWorkerRequest,\n entry: PackageEntry,\n state: ResolutionState,\n): Option.Option<Option.Option<PathAndExtension>> =>\n request.versionPaths.pipe(\n Option.filter(() =>\n Option.match(entry.packageFile, {\n onNone: () => true,\n onSome: (file) => containsPath(request.candidate, file),\n }),\n ),\n Option.flatMap((paths) =>\n tryVersionPaths(\n {\n extensions: request.extensions,\n candidate: request.candidate,\n packageFile: entry.packageFile,\n versionPaths: paths,\n loader: entry.loader,\n onlyRecordFailures:\n entry.onlyRecordFailuresForPackageFile || entry.onlyRecordFailuresForIndex,\n },\n state,\n ),\n ),\n );\n\nconst fromIndexFile = (\n request: DirectoryWorkerRequest,\n entry: PackageEntry,\n state: ResolutionState,\n): Option.Option<PathAndExtension> => {\n if (state.features.esmMode) {\n return Option.none();\n }\n return loadModuleFromFile(\n {\n extensions: request.extensions,\n candidate: combinePaths(request.candidate, INDEX),\n onlyRecordFailures: entry.onlyRecordFailuresForIndex,\n },\n state,\n );\n};\n\nconst fromPackageFileOrIndex = (\n request: DirectoryWorkerRequest,\n entry: PackageEntry,\n state: ResolutionState,\n): Option.Option<PathAndExtension> =>\n entry.packageFile.pipe(\n Option.flatMap((file) =>\n entry.loader(\n {\n extensions: request.extensions,\n candidate: file,\n onlyRecordFailures: entry.onlyRecordFailuresForPackageFile,\n },\n state,\n ),\n ),\n Option.orElse(() => fromIndexFile(request, entry, state)),\n );\n\nconst loadNodeModuleFromDirectoryWorker: {\n (state: ResolutionState): (request: DirectoryWorkerRequest) => Option.Option<PathAndExtension>;\n (request: DirectoryWorkerRequest, state: ResolutionState): Option.Option<PathAndExtension>;\n} = Fn.dual(\n DATA_FIRST_ARITY,\n (request: DirectoryWorkerRequest, state: ResolutionState): Option.Option<PathAndExtension> => {\n const entry = packageEntryOf(request, state);\n return fromVersionPaths(request, entry, state).pipe(\n Option.getOrElse(() => fromPackageFileOrIndex(request, entry, state)),\n );\n },\n);\n\nconst loadNodeModuleFromDirectory: {\n (state: ResolutionState): (request: DirectoryLoadRequest) => Option.Option<Resolved>;\n (request: DirectoryLoadRequest, state: ResolutionState): Option.Option<Resolved>;\n} = Fn.dual(\n DATA_FIRST_ARITY,\n (request: DirectoryLoadRequest, state: ResolutionState): Option.Option<Resolved> => {\n const info = Option.liftPredicate(request.considerPackageJson, (consider) => consider).pipe(\n Option.flatMap(() =>\n resolvePackageJsonInfo(request.candidate, request.onlyRecordFailures, state),\n ),\n );\n const versionPaths = info.pipe(\n Option.flatMap((packageInfo) => getVersionPaths(packageInfo, state)),\n );\n const jsonContent = info.pipe(\n Option.map((packageInfo: PackageJsonInfo) => packageInfo.contents.packageJsonContent),\n );\n const found = loadNodeModuleFromDirectoryWorker(\n { ...request, jsonContent, versionPaths },\n state,\n );\n return withPackageId(info, found, state);\n },\n);\n\nexport { loadNodeModuleFromDirectory, loadNodeModuleFromDirectoryWorker };\nexport type {\n DirectoryLoadRequest,\n DirectoryWorkerRequest,\n PackageDirectoryContents,\n RelativeLoader,\n RelativeRequest,\n};\n","import { Option, String as Str } from \"effect\";\n\nimport { normalizePath } from \"./paths.ts\";\nimport { indexFrom } from \"./text-search.ts\";\n\nconst START = 0;\nconst SEPARATOR_STEP = 1;\nconst NODE_MODULES_PART = \"/node_modules/\";\n\nconst nextSeparator = (path: string, previous: number): number =>\n Option.getOrElse(indexFrom(path, \"/\", previous + SEPARATOR_STEP), () => previous);\n\nconst packageDirectoryEnd = (path: string, nodeModulesIndex: number): number => {\n const afterNodeModules = nodeModulesIndex + NODE_MODULES_PART.length;\n const afterName = nextSeparator(path, afterNodeModules);\n if (path[afterNodeModules] === \"@\") {\n return nextSeparator(path, afterName);\n }\n return afterName;\n};\n\nconst parseNodeModuleFromPath = (resolved: string): Option.Option<string> => {\n const path = normalizePath(resolved);\n return Option.map(Str.lastIndexOf(NODE_MODULES_PART)(path), (index) =>\n Str.slice(START, packageDirectoryEnd(path, index))(path),\n );\n};\n\nconst pathContainsNodeModules = (path: string): boolean => Str.includes(NODE_MODULES_PART)(path);\n\nexport { parseNodeModuleFromPath, pathContainsNodeModules };\n","import { MutableRef, Option, Array as Arr, pipe, Function as Fn } from \"effect\";\n\nimport type { Extensions } from \"./extensions.ts\";\nimport {\n combinePaths,\n ensureTrailingDirectorySeparator,\n getPathComponents,\n normalizePath,\n} from \"./paths.ts\";\nimport type {\n Features,\n ModuleResolutionCache,\n NestedResolution,\n Outcome,\n ResolutionMode,\n ResolutionResult,\n ResolutionState,\n ResolverHost,\n ResolverOptions,\n TraceSink,\n} from \"./resolution-types.ts\";\n\nconst DATA_FIRST_ARITY = 2;\nconst DATA_FIRST_ARITY_3 = 3;\n\ninterface WorkerRequest {\n readonly features: Features;\n readonly moduleName: string;\n readonly containingDirectory: string;\n readonly options: ResolverOptions;\n readonly extensions: Extensions;\n readonly conditions: Option.Option<readonly string[]>;\n}\n\ninterface WorkerContext {\n readonly host: ResolverHost;\n readonly trace: Option.Option<TraceSink>;\n readonly cache: Option.Option<ModuleResolutionCache>;\n}\n\ntype OptionalCondition = readonly [string, (options: ResolverOptions) => boolean];\n\nconst LAST = -1;\n\nconst NO_FEATURES: Features = {\n imports: false,\n selfName: false,\n exports: false,\n patternTrailers: false,\n esmMode: false,\n};\n\nconst ALL_FEATURES: Features = {\n imports: true,\n selfName: true,\n exports: true,\n patternTrailers: true,\n esmMode: false,\n};\n\nconst OPTIONAL_CONDITIONS: readonly OptionalCondition[] = [\n [\"types\", (options) => !options.noDtsResolution],\n [\"node\", (options) => options.moduleResolution !== \"Bundler\"],\n];\n\nconst createOutcome = (): Outcome => {\n const packageDirectory = MutableRef.make(false);\n const cached = MutableRef.make(Option.none<ResolutionResult>());\n return {\n markResolvedPackageDirectory: () => {\n MutableRef.set(packageDirectory, true);\n },\n resolvedPackageDirectory: () => MutableRef.get(packageDirectory),\n rememberResultFromCache: (result) => {\n MutableRef.set(cached, Option.some(result));\n },\n resultFromCache: () => MutableRef.get(cached),\n };\n};\n\nconst moduleCondition = (esm: boolean): string => {\n if (esm) {\n return \"import\";\n }\n return \"require\";\n};\n\nconst isUnconditional = (options: ResolverOptions, mode: Option.Option<ResolutionMode>): boolean =>\n Option.isNone(mode) && options.moduleResolution === \"Node10\";\n\nconst usesImportCondition = (\n options: ResolverOptions,\n mode: Option.Option<ResolutionMode>,\n): boolean =>\n mode.pipe(\n Option.map((kind) => kind === \"ESNext\"),\n Option.getOrElse(() => options.moduleResolution === \"Bundler\"),\n );\n\nconst getConditions: {\n (mode: Option.Option<ResolutionMode>): (options: ResolverOptions) => readonly string[];\n (options: ResolverOptions, mode: Option.Option<ResolutionMode>): readonly string[];\n} = Fn.dual(\n DATA_FIRST_ARITY,\n (options: ResolverOptions, mode: Option.Option<ResolutionMode>): readonly string[] => {\n if (isUnconditional(options, mode)) {\n return [];\n }\n const optional = pipe(\n OPTIONAL_CONDITIONS,\n Arr.filter(([, applies]) => applies(options)),\n Arr.map(([name]) => name),\n );\n return [moduleCondition(usesImportCondition(options, mode)), ...optional];\n },\n);\n\nconst normalizePathForCJSResolution: {\n (\n moduleName: string,\n ): (containingDirectory: string) => { readonly path: string; readonly parts: readonly string[] };\n (\n containingDirectory: string,\n moduleName: string,\n ): { readonly path: string; readonly parts: readonly string[] };\n} = Fn.dual(\n DATA_FIRST_ARITY,\n (\n containingDirectory: string,\n moduleName: string,\n ): { readonly path: string; readonly parts: readonly string[] } => {\n const combined = combinePaths(containingDirectory, moduleName);\n const parts = getPathComponents(combined);\n const last = parts.at(LAST) ?? \"\";\n const normalized = normalizePath(combined);\n if (last === \".\" || last === \"..\") {\n return { path: ensureTrailingDirectorySeparator(normalized), parts };\n }\n return { path: normalized, parts };\n },\n);\n\nconst workerMode = (request: WorkerRequest): Option.Option<ResolutionMode> => {\n if (request.options.moduleResolution !== \"Node16\") {\n return Option.none();\n }\n if (request.features.esmMode) {\n return Option.some(\"ESNext\");\n }\n return Option.some(\"CommonJS\");\n};\n\nconst nestedRequest: {\n (nested: NestedResolution): (state: ResolutionState) => WorkerRequest;\n (state: ResolutionState, nested: NestedResolution): WorkerRequest;\n} = Fn.dual(\n DATA_FIRST_ARITY,\n (state: ResolutionState, nested: NestedResolution): WorkerRequest => ({\n features: state.features,\n moduleName: nested.moduleName,\n containingDirectory: nested.containingDirectory,\n options: state.options,\n extensions: nested.extensions,\n conditions: Option.some(state.conditions),\n }),\n);\n\nconst nestedContext = (state: ResolutionState): WorkerContext => ({\n host: state.host,\n trace: state.trace,\n cache: state.cache,\n});\n\nconst createState: {\n (\n context: WorkerContext,\n conditions: readonly string[],\n ): (request: WorkerRequest) => Omit<ResolutionState, \"resolveNested\">;\n (\n request: WorkerRequest,\n context: WorkerContext,\n conditions: readonly string[],\n ): Omit<ResolutionState, \"resolveNested\">;\n} = Fn.dual(\n DATA_FIRST_ARITY_3,\n (\n request: WorkerRequest,\n context: WorkerContext,\n conditions: readonly string[],\n ): Omit<ResolutionState, \"resolveNested\"> => ({\n host: context.host,\n trace: context.trace,\n options: request.options,\n cache: context.cache,\n packageJsonCache: context.cache.pipe(Option.map((cache) => cache.packageJson)),\n features: request.features,\n conditions,\n candidateIsFromPackageJsonField: false,\n outcome: createOutcome(),\n }),\n);\n\nexport {\n ALL_FEATURES,\n NO_FEATURES,\n createOutcome,\n createState,\n getConditions,\n nestedContext,\n nestedRequest,\n normalizePathForCJSResolution,\n workerMode,\n};\nexport type { WorkerContext, WorkerRequest };\n","import { Option, Function as Fn } from \"effect\";\n\nimport { formatExtensions } from \"./extensions.ts\";\nimport { Messages, traceMessage } from \"./messages.ts\";\nimport { parseNodeModuleFromPath } from \"./node-modules-paths.ts\";\nimport { resolvePackageJsonInfo, withPackageId } from \"./package-json.ts\";\nimport { getDirectoryPath, hasTrailingDirectorySeparator } from \"./paths.ts\";\nimport type {\n ModuleLookup,\n PackageJsonInfo,\n PathAndExtension,\n Resolved,\n ResolutionState,\n} from \"./resolution-types.ts\";\nimport { loadNodeModuleFromDirectory } from \"./resolver-directory.ts\";\nimport type { RelativeRequest } from \"./resolver-directory.ts\";\nimport { loadModuleFromFile } from \"./resolver-files.ts\";\nimport { normalizePathForCJSResolution } from \"./resolver-state.ts\";\n\nconst DATA_FIRST_ARITY = 2;\n\ninterface RelativeModule {\n readonly resolved: Option.Option<Resolved>;\n readonly insideNodeModules: boolean;\n}\n\ninterface FileAttempt {\n readonly found: Option.Option<Resolved>;\n readonly onlyRecordFailures: boolean;\n}\n\nconst directoryMissing: {\n (state: ResolutionState): (directory: string) => boolean;\n (directory: string, state: ResolutionState): boolean;\n} = Fn.dual(DATA_FIRST_ARITY, (directory: string, state: ResolutionState): boolean => {\n if (state.host.directoryExists(directory)) {\n return false;\n }\n traceMessage(state, Messages.directoryDoesNotExist, directory);\n return true;\n});\n\nconst packageInfoOfFile = (\n request: RelativeRequest,\n resolved: PathAndExtension,\n state: ResolutionState,\n): Option.Option<PackageJsonInfo> =>\n Option.liftPredicate(request.considerPackageJson, (consider) => consider).pipe(\n Option.flatMap(() => parseNodeModuleFromPath(resolved.path)),\n Option.flatMap((packageDirectory) => resolvePackageJsonInfo(packageDirectory, false, state)),\n );\n\nconst loadAsFile = (request: RelativeRequest, state: ResolutionState): Option.Option<Resolved> =>\n loadModuleFromFile(request, state).pipe(\n Option.flatMap((resolved) =>\n withPackageId(packageInfoOfFile(request, resolved, state), Option.some(resolved), state),\n ),\n );\n\nconst fileAttempt = (request: RelativeRequest, state: ResolutionState): FileAttempt => {\n if (hasTrailingDirectorySeparator(request.candidate)) {\n return { found: Option.none(), onlyRecordFailures: request.onlyRecordFailures };\n }\n const onlyRecordFailures =\n request.onlyRecordFailures || directoryMissing(getDirectoryPath(request.candidate), state);\n return { found: loadAsFile({ ...request, onlyRecordFailures }, state), onlyRecordFailures };\n};\n\nconst nodeLoadModuleByRelativeName: {\n (state: ResolutionState): (request: RelativeRequest) => Option.Option<Resolved>;\n (request: RelativeRequest, state: ResolutionState): Option.Option<Resolved>;\n} = Fn.dual(\n DATA_FIRST_ARITY,\n (request: RelativeRequest, state: ResolutionState): Option.Option<Resolved> => {\n traceMessage(\n state,\n Messages.loadingAsFileOrFolder,\n request.candidate,\n formatExtensions(request.extensions),\n );\n const attempt = fileAttempt(request, state);\n if (Option.isSome(attempt.found)) {\n return attempt.found;\n }\n const onlyRecordFailures =\n attempt.onlyRecordFailures || directoryMissing(request.candidate, state);\n if (state.features.esmMode) {\n return Option.none();\n }\n return loadNodeModuleFromDirectory(\n { ...request, onlyRecordFailures, loadRelative: nodeLoadModuleByRelativeName },\n state,\n );\n },\n);\n\nconst loadRelativeModule: {\n (state: ResolutionState): (lookup: ModuleLookup) => RelativeModule;\n (lookup: ModuleLookup, state: ResolutionState): RelativeModule;\n} = Fn.dual(DATA_FIRST_ARITY, (lookup: ModuleLookup, state: ResolutionState): RelativeModule => {\n const { path, parts } = normalizePathForCJSResolution(lookup.directory, lookup.moduleName);\n const resolved = nodeLoadModuleByRelativeName(\n {\n extensions: lookup.extensions,\n candidate: path,\n onlyRecordFailures: false,\n considerPackageJson: true,\n },\n state,\n );\n return { resolved, insideNodeModules: parts.includes(\"node_modules\") };\n});\n\nexport { directoryMissing, loadRelativeModule, nodeLoadModuleByRelativeName };\nexport type { RelativeModule };\n","import { Option, Predicate, Function as Fn } from \"effect\";\n\nimport { Messages, traceMessage } from \"./messages.ts\";\nimport { withPackageId } from \"./package-json.ts\";\nimport { tryLoadModuleUsingPaths } from \"./paths-mapping.ts\";\nimport type { Loader } from \"./paths-mapping.ts\";\nimport { combinePaths } from \"./paths.ts\";\nimport type {\n CandidateRequest,\n PackageJsonInfo,\n PathAndExtension,\n Resolved,\n ResolutionState,\n} from \"./resolution-types.ts\";\nimport { loadNodeModuleFromDirectoryWorker } from \"./resolver-directory.ts\";\nimport { loadModuleFromFile } from \"./resolver-files.ts\";\nimport { nodeLoadModuleByRelativeName } from \"./resolver-relative.ts\";\nimport { RESOLUTION_VERSION, getVersionPaths } from \"./types-versions.ts\";\n\nconst DATA_FIRST_ARITY = 2;\nconst DATA_FIRST_ARITY_3 = 3;\n\ninterface SpecificRequest {\n readonly extensions: CandidateRequest[\"extensions\"];\n readonly moduleName: string;\n readonly nodeModulesDirectory: string;\n readonly nodeModulesDirectoryExists: boolean;\n}\n\ninterface PackagePaths {\n readonly candidate: string;\n readonly rest: string;\n readonly packageDirectory: string;\n}\n\ninterface PackageLocation extends PackagePaths {\n readonly packageInfo: Option.Option<PackageJsonInfo>;\n}\n\nconst EMPTY = 0;\n\nconst loadFromDirectory: {\n (\n packageInfo: Option.Option<PackageJsonInfo>,\n state: ResolutionState,\n ): (request: CandidateRequest) => Option.Option<PathAndExtension>;\n (\n request: CandidateRequest,\n packageInfo: Option.Option<PackageJsonInfo>,\n state: ResolutionState,\n ): Option.Option<PathAndExtension>;\n} = Fn.dual(\n DATA_FIRST_ARITY_3,\n (\n request: CandidateRequest,\n packageInfo: Option.Option<PackageJsonInfo>,\n state: ResolutionState,\n ): Option.Option<PathAndExtension> =>\n loadNodeModuleFromDirectoryWorker(\n {\n ...request,\n jsonContent: packageInfo.pipe(Option.map((info) => info.contents.packageJsonContent)),\n versionPaths: packageInfo.pipe(Option.flatMap((info) => getVersionPaths(info, state))),\n loadRelative: nodeLoadModuleByRelativeName,\n },\n state,\n ),\n);\n\nconst loadEsmIndexFallback = (\n request: CandidateRequest,\n packageInfo: Option.Option<PackageJsonInfo>,\n state: ResolutionState,\n): Option.Option<PathAndExtension> =>\n packageInfo.pipe(\n Option.filter(\n (info) =>\n state.features.esmMode && Predicate.isNullish(info.contents.packageJsonContent[\"exports\"]),\n ),\n Option.flatMap(() =>\n loadModuleFromFile(\n { ...request, candidate: combinePaths(request.candidate, \"index.js\") },\n state,\n ),\n ),\n );\n\nconst loadFileFirst = (\n request: CandidateRequest,\n rest: string,\n state: ResolutionState,\n): Option.Option<PathAndExtension> => {\n if (rest.length > EMPTY || !state.features.esmMode) {\n return loadModuleFromFile(request, state);\n }\n return Option.none();\n};\n\nconst specificLoader: {\n (rest: string): (packageInfo: Option.Option<PackageJsonInfo>) => Loader<Resolved>;\n (packageInfo: Option.Option<PackageJsonInfo>, rest: string): Loader<Resolved>;\n} = Fn.dual(\n DATA_FIRST_ARITY,\n (packageInfo: Option.Option<PackageJsonInfo>, rest: string): Loader<Resolved> =>\n (request, state) => {\n const pathAndExtension = loadFileFirst(request, rest, state).pipe(\n Option.orElse(() => loadFromDirectory(request, packageInfo, state)),\n Option.orElse(() => loadEsmIndexFallback(request, packageInfo, state)),\n );\n return withPackageId(packageInfo, pathAndExtension, state);\n },\n);\n\nconst withoutPackageMetadata = (file: PathAndExtension): Resolved => ({\n ...file,\n packageId: Option.none(),\n originalPath: Option.none(),\n});\n\nconst resolveVersionPathsWithTrace: {\n (\n location: PackageLocation,\n state: ResolutionState,\n ): (request: SpecificRequest) => Option.Option<Option.Option<Resolved>>;\n (\n request: SpecificRequest,\n location: PackageLocation,\n state: ResolutionState,\n ): Option.Option<Option.Option<Resolved>>;\n} = Fn.dual(\n DATA_FIRST_ARITY_3,\n (\n request: SpecificRequest,\n location: PackageLocation,\n state: ResolutionState,\n ): Option.Option<Option.Option<Resolved>> =>\n Option.liftPredicate(location.rest, (rest) => rest.length > EMPTY).pipe(\n Option.flatMap(() =>\n location.packageInfo.pipe(Option.flatMap((info) => getVersionPaths(info, state))),\n ),\n Option.flatMap((versionPaths) => {\n traceMessage(\n state,\n Messages.packageJsonTypesVersionsMatch,\n versionPaths.version,\n RESOLUTION_VERSION,\n location.rest,\n );\n const packageDirectoryExists =\n request.nodeModulesDirectoryExists &&\n state.host.directoryExists(location.packageDirectory);\n return tryLoadModuleUsingPaths(\n {\n extensions: request.extensions,\n moduleName: location.rest,\n baseDirectory: location.packageDirectory,\n paths: versionPaths.paths,\n loader: specificLoader(location.packageInfo, location.rest),\n onlyRecordFailures: !packageDirectoryExists,\n fromFile: withoutPackageMetadata,\n },\n state,\n );\n }),\n ),\n);\n\nexport { loadFromDirectory, resolveVersionPathsWithTrace, specificLoader };\nexport type { PackageLocation, PackagePaths, SpecificRequest };\n","import { Option, Predicate, Record as Rec, Function as Fn } from \"effect\";\n\nimport { resolvePackageJsonInfo, withPackageId } from \"./package-json.ts\";\nimport { combinePaths } from \"./paths.ts\";\nimport type {\n CandidateRequest,\n PackageJsonInfo,\n Resolved,\n ResolutionState,\n} from \"./resolution-types.ts\";\nimport { loadModuleFromExports } from \"./resolver-exports.ts\";\nimport { loadModuleFromFile } from \"./resolver-files.ts\";\nimport {\n loadFromDirectory,\n resolveVersionPathsWithTrace,\n specificLoader,\n} from \"./resolver-package-loader.ts\";\nimport type { PackageLocation, PackagePaths, SpecificRequest } from \"./resolver-package-loader.ts\";\n\nconst DATA_FIRST_ARITY_3 = 3;\n\nconst loadSubpathWithoutExports = (\n request: SpecificRequest,\n location: PackagePaths & { readonly packageInfo: PackageJsonInfo },\n state: ResolutionState,\n): Option.Option<Resolved> => {\n const candidateRequest: CandidateRequest = {\n extensions: request.extensions,\n candidate: location.candidate,\n onlyRecordFailures: !request.nodeModulesDirectoryExists,\n };\n const fromFile = loadModuleFromFile(candidateRequest, state);\n if (Option.isSome(fromFile)) {\n return withPackageId(Option.none(), fromFile, state);\n }\n const packageInfo = Option.some(location.packageInfo);\n const fromDirectory = loadFromDirectory(candidateRequest, packageInfo, state);\n return withPackageId(packageInfo, fromDirectory, state);\n};\n\nconst rootHasExports = (rootInfo: Option.Option<PackageJsonInfo>): boolean =>\n Option.exists(rootInfo, (info) => Rec.has(info.contents.packageJsonContent, \"exports\"));\n\nconst resolveInPackage: {\n (\n location: PackageLocation,\n state: ResolutionState,\n ): (request: SpecificRequest) => Option.Option<Resolved>;\n (\n request: SpecificRequest,\n location: PackageLocation,\n state: ResolutionState,\n ): Option.Option<Resolved>;\n} = Fn.dual(\n DATA_FIRST_ARITY_3,\n (\n request: SpecificRequest,\n location: PackageLocation,\n state: ResolutionState,\n ): Option.Option<Resolved> => {\n if (Option.isSome(location.packageInfo)) {\n state.outcome.markResolvedPackageDirectory();\n }\n const exportsInfo = location.packageInfo.pipe(\n Option.filter(\n (info) =>\n state.features.exports && Predicate.isTruthy(info.contents.packageJsonContent[\"exports\"]),\n ),\n );\n if (Option.isSome(exportsInfo)) {\n const subpath = combinePaths(\".\", location.rest);\n return loadModuleFromExports(\n exportsInfo.value,\n { extensions: request.extensions, subpath },\n state,\n ).pipe(Option.flatten);\n }\n return resolveVersionPathsWithTrace(request, location, state).pipe(\n Option.getOrElse(() =>\n specificLoader(location.packageInfo, location.rest)(\n {\n extensions: request.extensions,\n candidate: location.candidate,\n onlyRecordFailures: !request.nodeModulesDirectoryExists,\n },\n state,\n ),\n ),\n );\n },\n);\n\nconst loadSubpathOfNestedPackage = (\n request: SpecificRequest,\n location: PackagePaths & { readonly packageInfo: PackageJsonInfo },\n state: ResolutionState,\n): Option.Option<Resolved> => {\n if (!state.features.exports) {\n return loadSubpathWithoutExports(request, location, state);\n }\n const missing = !request.nodeModulesDirectoryExists;\n const rootInfo = resolvePackageJsonInfo(location.packageDirectory, missing, state);\n if (!rootHasExports(rootInfo)) {\n return loadSubpathWithoutExports(request, location, state);\n }\n return resolveInPackage(request, { ...location, packageInfo: rootInfo }, state);\n};\n\nconst loadSubpath: {\n (\n location: PackageLocation,\n state: ResolutionState,\n ): (request: SpecificRequest) => Option.Option<Resolved>;\n (\n request: SpecificRequest,\n location: PackageLocation,\n state: ResolutionState,\n ): Option.Option<Resolved>;\n} = Fn.dual(\n DATA_FIRST_ARITY_3,\n (\n request: SpecificRequest,\n location: PackageLocation,\n state: ResolutionState,\n ): Option.Option<Resolved> => {\n if (Option.isSome(location.packageInfo)) {\n return loadSubpathOfNestedPackage(\n request,\n { ...location, packageInfo: location.packageInfo.value },\n state,\n );\n }\n const missing = !request.nodeModulesDirectoryExists;\n const packageInfo = resolvePackageJsonInfo(location.packageDirectory, missing, state);\n return resolveInPackage(request, { ...location, packageInfo }, state);\n },\n);\n\nexport { loadSubpath, resolveInPackage };\n","import { Option, Array as Arr, pipe, Function as Fn } from \"effect\";\n\nimport {\n PRIORITY_KINDS,\n extensionsOf,\n formatExtensions,\n intersectExtensions,\n subtractExtensions,\n} from \"./extensions.ts\";\nimport { Messages, traceMessage } from \"./messages.ts\";\nimport { resolvePackageJsonInfo } from \"./package-json.ts\";\nimport { mangleScopedPackageNameWithTrace, parsePackageName } from \"./package-names.ts\";\nimport {\n combinePaths,\n forEachAncestorDirectory,\n getBaseFileName,\n normalizePath,\n normalizeSlashes,\n} from \"./paths.ts\";\nimport type {\n ModuleLookup,\n ResolutionMode,\n ResolutionState,\n Resolved,\n SearchResult,\n} from \"./resolution-types.ts\";\nimport type { PackageLocation, SpecificRequest } from \"./resolver-package-loader.ts\";\nimport { loadSubpath, resolveInPackage } from \"./resolver-package.ts\";\nimport { directoryMissing } from \"./resolver-relative.ts\";\n\nconst DATA_FIRST_ARITY = 2;\n\ninterface NodeModulesSearch extends ModuleLookup {\n readonly typesScopeOnly: boolean;\n}\n\ninterface NodeModulesFolder {\n readonly moduleName: string;\n readonly path: string;\n readonly exists: boolean;\n}\n\nconst EMPTY = 0;\n\nconst FEATURE_NAMES: readonly (keyof ResolutionState[\"features\"])[] = [\n \"imports\",\n \"selfName\",\n \"exports\",\n \"patternTrailers\",\n \"esmMode\",\n];\n\nconst hasNoFeatures = ({ features }: ResolutionState): boolean =>\n !pipe(\n FEATURE_NAMES,\n Arr.some((name) => features[name]),\n );\n\nconst cacheModeOf = (state: ResolutionState): Option.Option<ResolutionMode> => {\n if (hasNoFeatures(state)) {\n return Option.none();\n }\n if (state.features.esmMode) {\n return Option.some(\"ESNext\");\n }\n return Option.some(\"CommonJS\");\n};\n\nconst reuseCachedResolution = (lookup: ModuleLookup, state: ResolutionState): SearchResult =>\n state.cache.pipe(\n Option.flatMap((cache) =>\n cache.getFromNonRelative({\n name: lookup.moduleName,\n mode: cacheModeOf(state),\n directory: lookup.directory,\n }),\n ),\n Option.map((result) => {\n traceMessage(state, Messages.resolutionFoundInCache, lookup.moduleName, lookup.directory);\n state.outcome.rememberResultFromCache(result);\n return result.resolvedModule.pipe(\n Option.map((module): Resolved => ({\n path: module.resolvedFileName,\n extension: module.extension,\n packageId: module.packageId,\n originalPath: module.originalPath,\n resolvedUsingTsExtension: module.resolvedUsingTsExtension,\n })),\n );\n }),\n );\n\nconst loadModuleFromSpecificNodeModulesDirectory = (\n request: SpecificRequest,\n state: ResolutionState,\n): Option.Option<Resolved> => {\n const candidate = normalizePath(combinePaths(request.nodeModulesDirectory, request.moduleName));\n const { packageName, rest } = parsePackageName(request.moduleName);\n const location: PackageLocation = {\n candidate,\n rest,\n packageDirectory: combinePaths(request.nodeModulesDirectory, packageName),\n packageInfo: resolvePackageJsonInfo(candidate, !request.nodeModulesDirectoryExists, state),\n };\n if (rest.length === EMPTY) {\n return resolveInPackage(request, location, state);\n }\n return loadSubpath(request, location, state);\n};\n\nconst loadFromTypesDirectory = (\n folder: NodeModulesFolder,\n state: ResolutionState,\n): Option.Option<Resolved> => {\n const atTypes = combinePaths(folder.path, \"@types\");\n const atTypesExists = folder.exists && !directoryMissing(atTypes, state);\n return loadModuleFromSpecificNodeModulesDirectory(\n {\n extensions: extensionsOf(\"Declaration\"),\n moduleName: mangleScopedPackageNameWithTrace(folder.moduleName, state),\n nodeModulesDirectory: atTypes,\n nodeModulesDirectoryExists: atTypesExists,\n },\n state,\n );\n};\n\nconst loadFromPackageFolder = (\n search: NodeModulesSearch,\n folder: NodeModulesFolder,\n state: ResolutionState,\n): Option.Option<Resolved> => {\n if (search.typesScopeOnly) {\n return Option.none();\n }\n return loadModuleFromSpecificNodeModulesDirectory(\n {\n extensions: search.extensions,\n moduleName: search.moduleName,\n nodeModulesDirectory: folder.path,\n nodeModulesDirectoryExists: folder.exists,\n },\n state,\n );\n};\n\nconst loadModuleFromImmediateNodeModulesDirectory = (\n search: NodeModulesSearch,\n state: ResolutionState,\n): Option.Option<Resolved> => {\n const path = combinePaths(search.directory, \"node_modules\");\n const folder: NodeModulesFolder = {\n moduleName: search.moduleName,\n path,\n exists: !directoryMissing(path, state),\n };\n return loadFromPackageFolder(search, folder, state).pipe(\n Option.orElse(() =>\n Option.liftPredicate(search.extensions, (extensions) =>\n extensions.includes(\"Declaration\"),\n ).pipe(Option.flatMap(() => loadFromTypesDirectory(folder, state))),\n ),\n );\n};\n\nconst lookupAncestors = (search: NodeModulesSearch, state: ResolutionState): SearchResult =>\n forEachAncestorDirectory(normalizeSlashes(search.directory), (ancestor): SearchResult => {\n if (getBaseFileName(ancestor) === \"node_modules\") {\n return Option.none();\n }\n const atAncestor = { ...search, directory: ancestor };\n return reuseCachedResolution(atAncestor, state).pipe(\n Option.orElse(() =>\n loadModuleFromImmediateNodeModulesDirectory(atAncestor, state).pipe(\n Option.map((resolved) => Option.some(resolved)),\n ),\n ),\n );\n });\n\nconst resolvePreferredWithTrace = (\n search: NodeModulesSearch,\n state: ResolutionState,\n): SearchResult => {\n const preferred = intersectExtensions(search.extensions, PRIORITY_KINDS);\n if (preferred.length === EMPTY) {\n return Option.none();\n }\n traceMessage(state, Messages.searchingPreferredExtensions, formatExtensions(preferred));\n return lookupAncestors({ ...search, extensions: preferred }, state);\n};\n\nconst resolveFallbackWithTrace = (\n search: NodeModulesSearch,\n state: ResolutionState,\n): SearchResult => {\n const fallback = subtractExtensions(search.extensions, PRIORITY_KINDS);\n if (fallback.length === EMPTY || search.typesScopeOnly) {\n return Option.none();\n }\n traceMessage(state, Messages.searchingFallbackExtensions, formatExtensions(fallback));\n return lookupAncestors({ ...search, extensions: fallback }, state);\n};\n\nconst loadModuleFromNearestNodeModulesDirectory: {\n (state: ResolutionState): (search: NodeModulesSearch) => SearchResult;\n (search: NodeModulesSearch, state: ResolutionState): SearchResult;\n} = Fn.dual(DATA_FIRST_ARITY, (search: NodeModulesSearch, state: ResolutionState): SearchResult =>\n resolvePreferredWithTrace(search, state).pipe(\n Option.orElse(() => resolveFallbackWithTrace(search, state)),\n ),\n);\n\nexport { loadModuleFromNearestNodeModulesDirectory };\nexport type { NodeModulesSearch };\n","import { Option, String as Str, Function as Fn } from \"effect\";\n\nimport {\n PRIORITY_KINDS,\n extensionIsOk,\n formatExtensions,\n intersectExtensions,\n subtractExtensions,\n} from \"./extensions.ts\";\nimport type { Extensions } from \"./extensions.ts\";\nimport { Messages, traceMessage } from \"./messages.ts\";\nimport { isExternalModuleNameRelative } from \"./paths.ts\";\nimport type {\n Features,\n ModuleLookup,\n Resolved,\n ResolutionState,\n ResolverOptions,\n SearchResult,\n} from \"./resolution-types.ts\";\nimport {\n loadModuleFromSelfNameReference,\n resolvePackageImportWithTrace,\n} from \"./resolver-exports.ts\";\nimport { loadModuleFromNearestNodeModulesDirectory } from \"./resolver-node-modules.ts\";\nimport { loadRelativeModule } from \"./resolver-relative.ts\";\nimport { ALL_FEATURES, createOutcome, getConditions } from \"./resolver-state.ts\";\nimport type { WorkerRequest } from \"./resolver-state.ts\";\n\nconst DATA_FIRST_ARITY = 2;\nconst DATA_FIRST_ARITY_3 = 3;\n\ninterface Found {\n readonly resolved: Resolved;\n readonly isExternalLibraryImport: boolean;\n}\n\ntype FoundResult = Option.Option<Option.Option<Found>>;\n\nconst EMPTY = 0;\n\nconst resolveFromNodeModulesWithTrace = (\n lookup: ModuleLookup,\n state: ResolutionState,\n): SearchResult => {\n const extensions = formatExtensions(lookup.extensions);\n if (Str.includes(\":\")(lookup.moduleName)) {\n traceMessage(state, Messages.skippingAbsoluteUri, lookup.moduleName, extensions);\n return Option.none();\n }\n traceMessage(state, Messages.loadingFromNodeModules, lookup.moduleName, extensions);\n return loadModuleFromNearestNodeModulesDirectory({ ...lookup, typesScopeOnly: false }, state);\n};\n\nconst fromPackageImports = (\n lookup: ModuleLookup,\n features: Features,\n state: ResolutionState,\n): SearchResult => {\n if (features.imports && Str.startsWith(\"#\")(lookup.moduleName)) {\n return resolvePackageImportWithTrace(lookup, state);\n }\n return Option.none();\n};\n\nconst fromSelfName = (\n lookup: ModuleLookup,\n features: Features,\n state: ResolutionState,\n): SearchResult => {\n if (features.selfName) {\n return loadModuleFromSelfNameReference(lookup, state);\n }\n return Option.none();\n};\n\nconst resolveNonRelative = (\n lookup: ModuleLookup,\n features: Features,\n state: ResolutionState,\n): FoundResult =>\n fromPackageImports(lookup, features, state).pipe(\n Option.orElse(() => fromSelfName(lookup, features, state)),\n Option.orElse(() => resolveFromNodeModulesWithTrace(lookup, state)),\n Option.map(Option.map((resolved): Found => ({ resolved, isExternalLibraryImport: true }))),\n );\n\nconst resolveRelative = (lookup: ModuleLookup, state: ResolutionState): Option.Option<Found> => {\n const { resolved, insideNodeModules } = loadRelativeModule(lookup, state);\n return resolved.pipe(\n Option.map((value) => ({ resolved: value, isExternalLibraryImport: insideNodeModules })),\n );\n};\n\nconst tryResolve = (\n extensions: Extensions,\n request: WorkerRequest,\n state: ResolutionState,\n): FoundResult => {\n const lookup: ModuleLookup = {\n extensions,\n moduleName: request.moduleName,\n directory: request.containingDirectory,\n };\n if (!isExternalModuleNameRelative(request.moduleName)) {\n return resolveNonRelative(lookup, request.features, state);\n }\n return resolveRelative(lookup, state).pipe(Option.map((found) => Option.some(found)));\n};\n\nconst tryNonEmpty = (\n extensions: Extensions,\n request: WorkerRequest,\n state: ResolutionState,\n): FoundResult => {\n if (extensions.length === EMPTY) {\n return Option.none();\n }\n return tryResolve(extensions, request, state);\n};\n\nconst resolveWithPriority: {\n (state: ResolutionState): (request: WorkerRequest) => FoundResult;\n (request: WorkerRequest, state: ResolutionState): FoundResult;\n} = Fn.dual(DATA_FIRST_ARITY, (request: WorkerRequest, state: ResolutionState): FoundResult => {\n if (request.options.moduleResolution !== \"Node10\") {\n return tryResolve(request.extensions, request, state);\n }\n return tryNonEmpty(intersectExtensions(request.extensions, PRIORITY_KINDS), request, state).pipe(\n Option.orElse(() =>\n tryNonEmpty(subtractExtensions(request.extensions, PRIORITY_KINDS), request, state),\n ),\n );\n});\n\nconst diagnosticPath = (request: WorkerRequest, state: ResolutionState): Option.Option<string> =>\n tryResolve(intersectExtensions(request.extensions, PRIORITY_KINDS), request, state).pipe(\n Option.flatten,\n Option.filter((found) => found.isExternalLibraryImport),\n Option.map((found) => found.resolved.path),\n );\n\nconst wantedTypesButGotJs = (request: WorkerRequest, result: Option.Option<Found>): boolean => {\n const wantsTypes =\n request.extensions.includes(\"TypeScript\") || request.extensions.includes(\"Declaration\");\n return Option.exists(\n result,\n (found) => wantsTypes && !extensionIsOk(PRIORITY_KINDS, found.resolved.extension),\n );\n};\n\nconst shouldRetryWithoutExports = (\n request: WorkerRequest,\n result: Option.Option<Found>,\n state: ResolutionState,\n): boolean =>\n Option.exists(result, (found) => found.isExternalLibraryImport) &&\n wantedTypesButGotJs(request, result) &&\n request.features.exports &&\n state.conditions.includes(\"import\");\n\nconst shouldRetryWithBundler = (request: WorkerRequest, result: Option.Option<Found>): boolean =>\n (Option.isNone(result) || wantedTypesButGotJs(request, result)) &&\n request.options.moduleResolution === \"Node10\";\n\nconst retryWithBundler = (\n request: WorkerRequest,\n state: ResolutionState,\n): Option.Option<string> => {\n traceMessage(state, Messages.retryWithBundler);\n const options: ResolverOptions = { ...request.options, moduleResolution: \"Bundler\" };\n return diagnosticPath(request, {\n ...state,\n options,\n features: ALL_FEATURES,\n conditions: getConditions(options, Option.none()),\n outcome: createOutcome(),\n });\n};\n\nconst resolveAlternateResultWithTrace: {\n (\n result: Option.Option<Found>,\n state: ResolutionState,\n ): (request: WorkerRequest) => Option.Option<string>;\n (\n request: WorkerRequest,\n result: Option.Option<Found>,\n state: ResolutionState,\n ): Option.Option<string>;\n} = Fn.dual(\n DATA_FIRST_ARITY_3,\n (\n request: WorkerRequest,\n result: Option.Option<Found>,\n state: ResolutionState,\n ): Option.Option<string> => {\n if (shouldRetryWithoutExports(request, result, state)) {\n traceMessage(state, Messages.retryWithoutModernFeatures);\n return diagnosticPath(request, {\n ...state,\n features: { ...state.features, exports: false },\n outcome: createOutcome(),\n });\n }\n if (shouldRetryWithBundler(request, result)) {\n return retryWithBundler(request, state);\n }\n return Option.none();\n },\n);\n\nexport { resolveAlternateResultWithTrace, resolveWithPriority };\nexport type { Found, FoundResult };\n","import { Option, Array as Arr, pipe, Function as Fn } from \"effect\";\n\nimport { extensionsOf } from \"./extensions.ts\";\nimport type { Extensions } from \"./extensions.ts\";\nimport { Messages, emitTrace, formatMessage, traceMessage } from \"./messages.ts\";\nimport { packageIdToString } from \"./package-json.ts\";\nimport { getDirectoryPath, isExternalModuleNameRelative } from \"./paths.ts\";\nimport type {\n Features,\n NestedResolution,\n ResolutionMode,\n ResolutionResult,\n ResolutionState,\n ResolvedModule,\n ResolverOptions,\n TraceSink,\n} from \"./resolution-types.ts\";\nimport { resolveAlternateResultWithTrace, resolveWithPriority } from \"./resolver-attempt.ts\";\nimport type { Found } from \"./resolver-attempt.ts\";\nimport {\n ALL_FEATURES,\n NO_FEATURES,\n createState,\n getConditions,\n nestedContext,\n nestedRequest,\n workerMode,\n} from \"./resolver-state.ts\";\nimport type { WorkerContext, WorkerRequest } from \"./resolver-state.ts\";\n\nconst DATA_FIRST_ARITY = 2;\n\ninterface ResolveModuleNameRequest {\n readonly moduleName: string;\n readonly containingFile: string;\n readonly options: ResolverOptions;\n readonly mode: Option.Option<ResolutionMode>;\n}\n\ninterface DirectoryRequest {\n readonly moduleName: string;\n readonly containingDirectory: string;\n readonly options: ResolverOptions;\n readonly mode: Option.Option<ResolutionMode>;\n}\n\nconst supportsExportsAndImports = (request: WorkerRequest): boolean =>\n request.options.moduleResolution !== \"Node10\";\n\nconst modeLabel = (features: Features): string => {\n if (features.esmMode) {\n return \"ESM\";\n }\n return \"CJS\";\n};\n\nconst announceMode = (request: WorkerRequest, state: ResolutionState): void => {\n if (!supportsExportsAndImports(request)) {\n return;\n }\n traceMessage(\n state,\n Messages.resolvingInMode,\n modeLabel(request.features),\n pipe(\n state.conditions,\n Arr.map((condition) => `'${condition}'`),\n Arr.join(\", \"),\n ),\n );\n};\n\nconst toResolutionResult = (\n found: Option.Option<Found>,\n alternateResult: Option.Option<string>,\n): ResolutionResult => ({\n resolvedModule: found.pipe(\n Option.map(({ resolved, isExternalLibraryImport }): ResolvedModule => ({\n resolvedFileName: resolved.path,\n originalPath: resolved.originalPath,\n extension: resolved.extension,\n isExternalLibraryImport,\n packageId: resolved.packageId,\n resolvedUsingTsExtension: resolved.resolvedUsingTsExtension,\n })),\n ),\n alternateResult,\n});\n\nconst alternateResultOf = (\n request: WorkerRequest,\n result: Option.Option<Found>,\n state: ResolutionState,\n): Option.Option<string> => {\n if (\n !state.outcome.resolvedPackageDirectory() ||\n isExternalModuleNameRelative(request.moduleName)\n ) {\n return Option.none();\n }\n return resolveAlternateResultWithTrace(request, result, state);\n};\n\nconst nodeModuleNameResolverWorker = (\n request: WorkerRequest,\n context: WorkerContext,\n): ResolutionResult => {\n const conditions = request.conditions.pipe(\n Option.getOrElse(() => getConditions(request.options, workerMode(request))),\n );\n const state: ResolutionState = {\n ...createState(request, context, conditions),\n resolveNested: (current, nested) =>\n nodeModuleNameResolverWorker(nestedRequest(current, nested), nestedContext(current)),\n };\n announceMode(request, state);\n const result = Option.flatten(resolveWithPriority(request, state));\n const alternateResult = alternateResultOf(request, result, state);\n return state.outcome\n .resultFromCache()\n .pipe(Option.getOrElse(() => toResolutionResult(result, alternateResult)));\n};\n\nconst resolveNestedModule: {\n (nested: NestedResolution): (state: ResolutionState) => ResolutionResult;\n (state: ResolutionState, nested: NestedResolution): ResolutionResult;\n} = Fn.dual(\n DATA_FIRST_ARITY,\n (state: ResolutionState, nested: NestedResolution): ResolutionResult =>\n nodeModuleNameResolverWorker(nestedRequest(state, nested), nestedContext(state)),\n);\n\nconst extensionsFor = (options: ResolverOptions): Extensions => {\n if (options.noDtsResolution) {\n return extensionsOf(\"TypeScript\", \"JavaScript\", \"Json\");\n }\n return extensionsOf(\"TypeScript\", \"JavaScript\", \"Declaration\", \"Json\");\n};\n\nconst featuresFor = (request: DirectoryRequest): Features => {\n if (request.options.moduleResolution === \"Node16\") {\n return { ...ALL_FEATURES, esmMode: Option.contains(request.mode, \"ESNext\") };\n }\n if (request.options.moduleResolution === \"Bundler\" || Option.isSome(request.mode)) {\n return ALL_FEATURES;\n }\n return NO_FEATURES;\n};\n\nconst conditionsFor = (request: DirectoryRequest): Option.Option<readonly string[]> => {\n if (request.options.moduleResolution === \"Node16\") {\n return Option.none();\n }\n return request.mode.pipe(Option.map((mode) => getConditions(request.options, Option.some(mode))));\n};\n\nconst resolveInDirectory: {\n (context: WorkerContext): (request: DirectoryRequest) => ResolutionResult;\n (request: DirectoryRequest, context: WorkerContext): ResolutionResult;\n} = Fn.dual(\n DATA_FIRST_ARITY,\n (request: DirectoryRequest, context: WorkerContext): ResolutionResult =>\n nodeModuleNameResolverWorker(\n {\n features: featuresFor(request),\n moduleName: request.moduleName,\n containingDirectory: request.containingDirectory,\n options: request.options,\n extensions: extensionsFor(request.options),\n conditions: conditionsFor(request),\n },\n context,\n ),\n);\n\nconst resolveUncached = (\n request: ResolveModuleNameRequest,\n context: WorkerContext,\n): ResolutionResult => {\n const containingDirectory = getDirectoryPath(request.containingFile);\n traceMessage(context, Messages.explicitResolutionKind, request.options.moduleResolution);\n const result = resolveInDirectory({ ...request, containingDirectory }, context);\n const key = { name: request.moduleName, mode: request.mode, directory: containingDirectory };\n for (const cache of Option.toArray(context.cache)) {\n cache.setForDirectory(key, result);\n if (!isExternalModuleNameRelative(request.moduleName)) {\n cache.setForNonRelative(key, result);\n }\n }\n return result;\n};\n\nconst resolvedMessage = (moduleName: string, module: ResolvedModule): string =>\n module.packageId.pipe(\n Option.match({\n onNone: () => formatMessage(Messages.moduleResolved, moduleName, module.resolvedFileName),\n onSome: (packageId) =>\n formatMessage(\n Messages.moduleResolvedWithPackageId,\n moduleName,\n module.resolvedFileName,\n packageIdToString(packageId),\n ),\n }),\n );\n\nconst traceOutcome = (\n moduleName: string,\n result: ResolutionResult,\n trace: Option.Option<TraceSink>,\n): void => {\n const message = result.resolvedModule.pipe(\n Option.match({\n onNone: () => formatMessage(Messages.moduleNotResolved, moduleName),\n onSome: (module) => resolvedMessage(moduleName, module),\n }),\n );\n emitTrace(trace, message);\n};\n\nconst reuseCachedWithTrace = (\n request: ResolveModuleNameRequest,\n context: WorkerContext,\n): Option.Option<ResolutionResult> => {\n const directory = getDirectoryPath(request.containingFile);\n return context.cache.pipe(\n Option.flatMap((cache) =>\n cache.getFromDirectory({ name: request.moduleName, mode: request.mode, directory }),\n ),\n Option.map((cached) => {\n traceMessage(context, Messages.resolutionFoundInCache, request.moduleName, directory);\n return cached;\n }),\n );\n};\n\nconst resolveModuleName: {\n (context: WorkerContext): (request: ResolveModuleNameRequest) => ResolutionResult;\n (request: ResolveModuleNameRequest, context: WorkerContext): ResolutionResult;\n} = Fn.dual(\n DATA_FIRST_ARITY,\n (request: ResolveModuleNameRequest, context: WorkerContext): ResolutionResult => {\n traceMessage(context, Messages.resolvingModule, request.moduleName, request.containingFile);\n const result = reuseCachedWithTrace(request, context).pipe(\n Option.getOrElse(() => resolveUncached(request, context)),\n );\n traceOutcome(request.moduleName, result, context.trace);\n return result;\n },\n);\n\nexport { resolveInDirectory, resolveModuleName, resolveNestedModule };\nexport type { DirectoryRequest, ResolveModuleNameRequest };\n","import { Option, Array as Arr, String as Str, pipe, Function as Fn } from \"effect\";\n\nimport { bindSourceFile } from \"./binder.ts\";\nimport type { CheckerProgram } from \"./checker-session.ts\";\nimport { createTypeChecker } from \"./checker.ts\";\nimport type { TypeCheckerFacade } from \"./checker.ts\";\nimport type { HostWrapperCore } from \"./host-types.ts\";\nimport { toPath } from \"./paths.ts\";\nimport type { ProgramFile, ProgramOptions } from \"./program-build.ts\";\nimport { modeFromNumber } from \"./resolution-mode-numbers.ts\";\nimport { resolveInDirectory } from \"./resolver.ts\";\n\nconst DATA_FIRST_ARITY_3 = 3;\n\ninterface CheckerSite {\n readonly core: HostWrapperCore;\n readonly mountRoot: string;\n readonly options: ProgramOptions;\n}\n\nconst checkerOptions = (core: HostWrapperCore): CheckerProgram[\"compilerOptions\"] => ({\n module: core.compilerOptions[\"module\"],\n moduleResolution: core.compilerOptions[\"moduleResolution\"],\n noLib: true,\n allowJs: true,\n resolveJsonModule: true,\n types: [],\n});\n\nconst relativeDirectory = (site: CheckerSite, directory: string): string => {\n const relative = Str.slice(site.mountRoot.length)(directory);\n if (relative === \"\") {\n return \"/\";\n }\n return relative;\n};\n\nconst checkerResolver =\n (site: CheckerSite, isProgramFile: (path: string) => boolean): CheckerProgram[\"resolve\"] =>\n (moduleName, containingDirectory, mode) =>\n Option.liftPredicate(containingDirectory, (directory) =>\n Str.startsWith(site.mountRoot)(directory),\n ).pipe(\n Option.flatMap(\n (directory) =>\n resolveInDirectory(\n {\n moduleName,\n containingDirectory: relativeDirectory(site, directory),\n options: {\n moduleResolution: site.core.kind,\n noDtsResolution: site.options.noDtsResolution,\n },\n mode: modeFromNumber(mode),\n },\n { host: site.core.resolverHost, trace: Option.none(), cache: Option.none() },\n ).resolvedModule,\n ),\n Option.filter((module) => isProgramFile(toPath(module.resolvedFileName))),\n Option.map((module) => ({ resolvedFileName: `${site.mountRoot}${module.resolvedFileName}` })),\n );\n\nconst openChecker: {\n (\n files: readonly ProgramFile[],\n rootNames: readonly string[],\n ): (site: CheckerSite) => TypeCheckerFacade;\n (\n site: CheckerSite,\n files: readonly ProgramFile[],\n rootNames: readonly string[],\n ): TypeCheckerFacade;\n} = Fn.dual(\n DATA_FIRST_ARITY_3,\n (\n site: CheckerSite,\n files: readonly ProgramFile[],\n rootNames: readonly string[],\n ): TypeCheckerFacade => {\n for (const file of files) {\n bindSourceFile(file.sourceFile);\n }\n const fileNames = pipe(\n files,\n Arr.map((file) => file.fileName),\n );\n const filePaths = new Set(\n pipe(\n fileNames,\n Arr.map((name) => toPath(name)),\n ),\n );\n return createTypeChecker({\n mountPath: site.mountRoot,\n rootNames: [...new Set([...fileNames, ...rootNames])],\n compilerOptions: checkerOptions(site.core),\n resolve: checkerResolver(site, (path) => filePaths.has(path)),\n });\n },\n);\n\nexport { openChecker };\nexport type { CheckerSite };\n","import type { Option } from \"effect\";\nimport type { SourceFile } from \"typescript/ast\";\nimport type { RawCompilerOptions } from \"typescript/sync\";\n\nimport type { ModeOptions } from \"./module-mode.ts\";\nimport type { ModuleNameRequest, TypeReferenceLookup } from \"./program-build.ts\";\nimport type {\n PackageJsonInfo,\n ResolutionKind,\n ResolutionResult,\n ResolverHost,\n} from \"./resolution-types.ts\";\nimport type { ResolvedTypeReference } from \"./type-reference.ts\";\n\ntype ExtraOptions = Readonly<Pick<RawCompilerOptions, \"allowJs\" | \"checkJs\" | \"noDtsResolution\">>;\n\ninterface PackageFileSystem {\n readonly fileExists: (path: string) => boolean;\n readonly directoryExists: (path: string) => boolean;\n readonly tryReadFile: (path: string) => string | undefined;\n readonly listFiles: () => readonly string[];\n}\n\ninterface TsPackageId {\n readonly name: string;\n readonly subModuleName: string;\n readonly version: string;\n readonly peerDependencies: string | undefined;\n}\n\ninterface TsResolvedModule {\n readonly resolvedFileName: string;\n readonly originalPath: string | undefined;\n readonly extension: string;\n readonly isExternalLibraryImport: boolean;\n readonly packageId: TsPackageId | undefined;\n readonly resolvedUsingTsExtension: boolean;\n}\n\ninterface TsResolution {\n readonly resolvedModule: TsResolvedModule | undefined;\n}\n\ninterface CachedResolution {\n readonly result: ResolutionResult;\n readonly resolution: TsResolution;\n readonly trace: readonly string[];\n}\n\ntype ModuleKindReason = \"extension\" | \"type\" | \"no:type\";\n\ninterface ModuleKindInfo {\n readonly detectedKind: number;\n readonly detectedReason: ModuleKindReason;\n readonly reasonFileName: string;\n}\n\ninterface HostWrapperCore {\n readonly kind: ResolutionKind;\n readonly modeOptions: ModeOptions;\n readonly resolverHost: ResolverHost;\n readonly compilerOptions: Readonly<Record<string, number | boolean>>;\n readonly getSourceFile: (fileName: string) => Option.Option<SourceFile>;\n readonly getSourceFileFromCache: (fileName: string) => Option.Option<SourceFile>;\n readonly getModuleKindForFile: (fileName: string) => Option.Option<ModuleKindInfo>;\n readonly resolve: (request: ModuleNameRequest) => CachedResolution;\n readonly getTrace: (request: ModuleNameRequest) => Option.Option<readonly string[]>;\n readonly packageJsonScopeFor: (fileName: string) => Option.Option<PackageJsonInfo>;\n readonly resolveTypeReference: (\n request: TypeReferenceLookup,\n ) => Option.Option<ResolvedTypeReference>;\n}\n\nconst LIB_FILE_NAME = \"/node_modules/typescript/lib/lib.d.ts\";\n\nexport { LIB_FILE_NAME };\nexport type {\n CachedResolution,\n ExtraOptions,\n TsPackageId,\n HostWrapperCore,\n ModuleKindInfo,\n ModuleKindReason,\n PackageFileSystem,\n TsResolution,\n TsResolvedModule,\n};\n","import { MutableRef, Option, Function as Fn } from \"effect\";\nimport type { SourceFile } from \"typescript/ast\";\n\nimport type { ModeOptions } from \"./module-mode.ts\";\nimport { packageIdToString } from \"./package-json.ts\";\nimport { toPath } from \"./paths.ts\";\nimport type {\n PackageId,\n PackageJsonInfo,\n ResolutionMode,\n ResolutionResult,\n} from \"./resolution-types.ts\";\nimport type { ResolvedTypeReference } from \"./type-reference.ts\";\n\nconst DATA_FIRST_ARITY = 2;\n\ninterface ProgramOptions {\n readonly allowJs: boolean;\n readonly noDtsResolution: boolean;\n}\n\ninterface ModuleNameRequest {\n readonly moduleName: string;\n readonly containingFile: string;\n readonly mode: Option.Option<ResolutionMode>;\n readonly noDtsResolution: boolean;\n}\n\ninterface TypeReferenceLookup {\n readonly name: string;\n readonly containingFile: string;\n readonly mode: Option.Option<ResolutionMode>;\n}\n\ninterface ProgramHost {\n readonly modeOptions: ModeOptions;\n readonly defaultLibFileName: string;\n readonly getSourceFile: (fileName: string) => Option.Option<SourceFile>;\n readonly resolveModuleName: (request: ModuleNameRequest) => ResolutionResult;\n readonly resolveTypeReference: (\n request: TypeReferenceLookup,\n ) => Option.Option<ResolvedTypeReference>;\n readonly packageJsonScopeFor: (fileName: string) => Option.Option<PackageJsonInfo>;\n}\n\ninterface ProgramFile {\n readonly fileName: string;\n readonly sourceFile: SourceFile;\n}\n\ninterface ResolvedModuleEntry {\n readonly moduleName: string;\n readonly mode: Option.Option<ResolutionMode>;\n readonly resolution: ResolutionResult;\n}\n\ninterface ProgramFiles {\n readonly files: readonly ProgramFile[];\n readonly resolvedModules: ReadonlyMap<string, readonly ResolvedModuleEntry[]>;\n}\n\ninterface FileRequest {\n readonly fileName: string;\n readonly isDefaultLib: boolean;\n readonly packageId: Option.Option<PackageId>;\n}\n\ntype FileFlag = \"foundInNodeModules\" | \"elided\";\n\ninterface FileRegistry {\n readonly lookup: (fileName: string) => Option.Option<Option.Option<SourceFile>>;\n readonly record: (request: FileRequest, file: Option.Option<SourceFile>) => void;\n readonly include: (file: ProgramFile, isDefaultLib: boolean) => void;\n readonly fileForPackage: (packageId: PackageId) => Option.Option<SourceFile>;\n readonly setFlag: (fileName: string, flag: FileFlag, value: boolean) => void;\n readonly hasFlag: (fileName: string, flag: FileFlag) => boolean;\n readonly recordResolutions: (fileName: string, entries: readonly ResolvedModuleEntry[]) => void;\n readonly result: () => ProgramFiles;\n}\n\ninterface DepthCounter {\n readonly current: () => number;\n readonly enter: (external: boolean) => void;\n readonly leave: (external: boolean) => void;\n}\n\ninterface ProgramBuild {\n readonly host: ProgramHost;\n readonly options: ProgramOptions;\n readonly registry: FileRegistry;\n readonly depth: DepthCounter;\n}\n\ntype IncludeSourceFile = (build: ProgramBuild, request: FileRequest) => Option.Option<SourceFile>;\n\nconst OUTSIDE_NODE_MODULES = 0;\n\nconst createDepthCounter = (): DepthCounter => {\n const depth = MutableRef.make(OUTSIDE_NODE_MODULES);\n return {\n current: () => MutableRef.get(depth),\n enter: (external) => {\n if (external) {\n MutableRef.increment(depth);\n }\n },\n leave: (external) => {\n if (external) {\n MutableRef.decrement(depth);\n }\n },\n };\n};\n\nconst createFlagStore = (): Pick<FileRegistry, \"hasFlag\" | \"setFlag\"> => {\n const flags = new Map<string, Set<FileFlag>>();\n return {\n hasFlag: (fileName, flag) =>\n Option.fromNullishOr(flags.get(toPath(fileName))).pipe(Option.exists((own) => own.has(flag))),\n setFlag: (fileName, flag, value) => {\n const path = toPath(fileName);\n const own = flags.get(path) ?? new Set<FileFlag>();\n flags.set(path, own);\n if (value) {\n own.add(flag);\n return;\n }\n own.delete(flag);\n },\n };\n};\n\nconst createFileRegistry = (): FileRegistry => {\n const filesByName = new Map<string, Option.Option<SourceFile>>();\n const byPackage = new Map<string, SourceFile>();\n const resolvedModules = new Map<string, readonly ResolvedModuleEntry[]>();\n const defaultLibFiles: ProgramFile[] = [];\n const otherFiles: ProgramFile[] = [];\n return {\n ...createFlagStore(),\n lookup: (fileName) => Option.fromNullishOr(filesByName.get(toPath(fileName))),\n record: (request, file) => {\n for (const [id, sourceFile] of Option.toArray(Option.all([request.packageId, file]))) {\n byPackage.set(packageIdToString(id), sourceFile);\n }\n filesByName.set(toPath(request.fileName), file);\n },\n include: (file, isDefaultLib) => {\n if (isDefaultLib) {\n defaultLibFiles.push(file);\n return;\n }\n otherFiles.push(file);\n },\n fileForPackage: (packageId) =>\n Option.fromNullishOr(byPackage.get(packageIdToString(packageId))),\n recordResolutions: (fileName, entries) => {\n resolvedModules.set(toPath(fileName), entries);\n },\n result: () => ({ files: [...defaultLibFiles, ...otherFiles], resolvedModules }),\n };\n};\n\nconst createProgramBuild: {\n (options: ProgramOptions): (host: ProgramHost) => ProgramBuild;\n (host: ProgramHost, options: ProgramOptions): ProgramBuild;\n} = Fn.dual(DATA_FIRST_ARITY, (host: ProgramHost, options: ProgramOptions): ProgramBuild => ({\n host,\n options,\n registry: createFileRegistry(),\n depth: createDepthCounter(),\n}));\n\nexport { createProgramBuild };\nexport type {\n DepthCounter,\n FileFlag,\n FileRegistry,\n FileRequest,\n IncludeSourceFile,\n ModuleNameRequest,\n ProgramBuild,\n ProgramFile,\n ProgramFiles,\n ProgramHost,\n ProgramOptions,\n ResolvedModuleEntry,\n TypeReferenceLookup,\n};\n","import { Option, Array as Arr, String as Str, pipe, Function as Fn } from \"effect\";\nimport type { Node, SourceFile } from \"typescript/ast\";\nimport { isStringLiteralLikeNode } from \"typescript/ast/is\";\n\nimport { getModeForUsageLocation } from \"./module-mode.ts\";\nimport type { IncludeSourceFile, ProgramBuild, ResolvedModuleEntry } from \"./program-build.ts\";\nimport type { ResolvedModule } from \"./resolution-types.ts\";\nimport {\n collectExternalModuleReferences,\n importsOf,\n isJSDocNode,\n isSourceFileJS,\n moduleAugmentationsOf,\n} from \"./source-file.ts\";\n\nconst DATA_FIRST_ARITY_3 = 3;\n\ninterface ModuleNameSite {\n readonly node: Node;\n readonly text: string;\n readonly isImport: boolean;\n}\n\ninterface ImportSite {\n readonly site: ModuleNameSite;\n readonly entry: ResolvedModuleEntry;\n}\n\ninterface ImportWalk {\n readonly build: ProgramBuild;\n readonly include: IncludeSourceFile;\n readonly importer: SourceFile;\n}\n\nconst MAX_NODE_MODULE_JS_DEPTH = 0;\nconst EMPTY = 0;\nconst TS_EXTENSIONS: ReadonlySet<string> = new Set([\n \".ts\",\n \".tsx\",\n \".d.ts\",\n \".cts\",\n \".d.cts\",\n \".mts\",\n \".d.mts\",\n]);\nconst JS_EXTENSIONS: ReadonlySet<string> = new Set([\".js\", \".jsx\", \".mjs\", \".cjs\"]);\nconst JSX_EXTENSIONS: ReadonlySet<string> = new Set([\".tsx\", \".jsx\"]);\n\nconst isTsOrJsonResolution = (extension: string): boolean =>\n TS_EXTENSIONS.has(extension) ||\n extension === \".json\" ||\n (Str.startsWith(\".d.\")(extension) && Str.endsWith(\".ts\")(extension));\n\nconst isKnownExtension = (extension: string): boolean =>\n TS_EXTENSIONS.has(extension) || JS_EXTENSIONS.has(extension) || extension === \".json\";\n\nconst hasResolutionDiagnostic = (module: ResolvedModule, importer: SourceFile): boolean =>\n JSX_EXTENSIONS.has(module.extension) ||\n (!isKnownExtension(module.extension) && !importer.isDeclarationFile);\n\nconst literalSites = (nodes: readonly Node[], isImport: boolean): readonly ModuleNameSite[] =>\n pipe(\n nodes,\n Arr.flatMap((node) => {\n if (isStringLiteralLikeNode(node)) {\n return [{ node, text: node.text, isImport }];\n }\n return [];\n }),\n );\n\nconst moduleNameSitesOf = (sourceFile: SourceFile): readonly ModuleNameSite[] => [\n ...literalSites(importsOf(sourceFile), true),\n ...literalSites(moduleAugmentationsOf(sourceFile), false),\n];\n\nconst resolveSite = (\n build: ProgramBuild,\n importer: SourceFile,\n site: ModuleNameSite,\n): ImportSite => {\n const mode = getModeForUsageLocation(importer, site.node, build.host.modeOptions);\n const resolution = build.host.resolveModuleName({\n moduleName: site.text,\n containingFile: importer.fileName,\n mode,\n noDtsResolution: build.options.noDtsResolution,\n });\n return { site, entry: { moduleName: site.text, mode, resolution } };\n};\n\nconst isAllowedExtension = (walk: ImportWalk, module: ResolvedModule): boolean =>\n isTsOrJsonResolution(module.extension) || walk.build.options.allowJs;\n\nconst isVisibleSite = (walk: ImportWalk, site: ModuleNameSite): boolean =>\n site.isImport && (isSourceFileJS(walk.importer) || !isJSDocNode(site.node));\n\nconst shouldAddFile = (walk: ImportWalk, site: ModuleNameSite, module: ResolvedModule): boolean =>\n !hasResolutionDiagnostic(module, walk.importer) &&\n isAllowedExtension(walk, module) &&\n isVisibleSite(walk, site);\n\nconst isElidedImport = (build: ProgramBuild, module: ResolvedModule): boolean =>\n module.isExternalLibraryImport &&\n !isTsOrJsonResolution(module.extension) &&\n build.depth.current() > MAX_NODE_MODULE_JS_DEPTH;\n\nconst followResolvedModule = (\n walk: ImportWalk,\n site: ModuleNameSite,\n module: ResolvedModule,\n): void => {\n const { build } = walk;\n build.depth.enter(module.isExternalLibraryImport);\n if (isElidedImport(build, module)) {\n build.registry.setFlag(walk.importer.fileName, \"elided\", true);\n } else if (shouldAddFile(walk, site, module)) {\n walk.include(build, {\n fileName: module.resolvedFileName,\n isDefaultLib: false,\n packageId: module.packageId,\n });\n }\n build.depth.leave(module.isExternalLibraryImport);\n};\n\nconst processImportedModules: {\n (importer: SourceFile, include: IncludeSourceFile): (build: ProgramBuild) => void;\n (build: ProgramBuild, importer: SourceFile, include: IncludeSourceFile): void;\n} = Fn.dual(\n DATA_FIRST_ARITY_3,\n (build: ProgramBuild, importer: SourceFile, include: IncludeSourceFile): void => {\n collectExternalModuleReferences(importer);\n const sites = moduleNameSitesOf(importer);\n if (sites.length === EMPTY) {\n return;\n }\n const resolved = pipe(\n sites,\n Arr.map((site) => resolveSite(build, importer, site)),\n );\n build.registry.recordResolutions(\n importer.fileName,\n pipe(\n resolved,\n Arr.map(({ entry }) => entry),\n ),\n );\n const walk: ImportWalk = { build, include, importer };\n for (const { site, entry } of resolved) {\n for (const module of Option.toArray(entry.resolution.resolvedModule)) {\n followResolvedModule(walk, site, module);\n }\n }\n },\n);\n\nexport { processImportedModules };\n","import { Array as Arr, Option, String as Str, pipe, Function as Fn } from \"effect\";\nimport type { SourceFile } from \"typescript/ast\";\n\nimport { fileExtensionIsOneOf } from \"./extensions.ts\";\nimport { getDefaultResolutionModeForFile } from \"./module-mode.ts\";\nimport { combinePaths, getBaseFileName, getDirectoryPath, normalizePath } from \"./paths.ts\";\nimport { createProgramBuild } from \"./program-build.ts\";\nimport type {\n FileRequest,\n IncludeSourceFile,\n ProgramBuild,\n ProgramFiles,\n ProgramHost,\n ProgramOptions,\n} from \"./program-build.ts\";\nimport { processImportedModules } from \"./program-imports.ts\";\nimport { modeFromNumber } from \"./resolution-mode-numbers.ts\";\nimport { setPackageJsonScope } from \"./source-file.ts\";\n\nconst DATA_FIRST_ARITY_3 = 3;\n\ninterface ReferenceWalk {\n readonly build: ProgramBuild;\n readonly include: IncludeSourceFile;\n readonly sourceFile: SourceFile;\n readonly isDefaultLib: boolean;\n}\n\nconst TS_EXTENSIONS = [\".ts\", \".tsx\", \".d.ts\", \".cts\", \".d.cts\", \".mts\", \".d.mts\"];\nconst JS_EXTENSIONS = [\".js\", \".jsx\", \".mjs\", \".cjs\"];\nconst IMPLICIT_EXTENSIONS = [\".ts\", \".tsx\", \".d.ts\"];\nconst OUTSIDE_NODE_MODULES = 0;\nconst NO_ROOTS = 0;\nconst MAX_NODE_MODULE_JS_DEPTH = 0;\n\nconst supportedExtensions = (options: ProgramOptions): readonly string[] => {\n if (options.allowJs) {\n return [...TS_EXTENSIONS, ...JS_EXTENSIONS, \".json\"];\n }\n return [...TS_EXTENSIONS, \".json\"];\n};\n\nconst processSourceFile = (\n build: ProgramBuild,\n request: FileRequest,\n include: IncludeSourceFile,\n): void => {\n const { fileName } = request;\n if (Str.includes(\".\")(getBaseFileName(fileName))) {\n if (fileExtensionIsOneOf(Str.toLowerCase(fileName), supportedExtensions(build.options))) {\n include(build, request);\n }\n return;\n }\n pipe(\n IMPLICIT_EXTENSIONS,\n Arr.some((extension) =>\n Option.isSome(include(build, { ...request, fileName: `${fileName}${extension}` })),\n ),\n );\n};\n\nconst processReferencedFiles = (walk: ReferenceWalk): void => {\n const directory = getDirectoryPath(walk.sourceFile.fileName);\n for (const reference of walk.sourceFile.referencedFiles) {\n const fileName = normalizePath(combinePaths(directory, reference.fileName));\n processSourceFile(\n walk.build,\n { fileName, isDefaultLib: walk.isDefaultLib, packageId: Option.none() },\n walk.include,\n );\n }\n};\n\nconst processTypeReferenceDirectives = (walk: ReferenceWalk): void => {\n const { build, sourceFile } = walk;\n const fileMode = getDefaultResolutionModeForFile(sourceFile, build.host.modeOptions);\n for (const reference of sourceFile.typeReferenceDirectives) {\n const mode = modeFromNumber(reference.resolutionMode).pipe(Option.orElse(() => fileMode));\n const lookup = { name: reference.fileName, containingFile: sourceFile.fileName, mode };\n for (const resolved of Option.toArray(build.host.resolveTypeReference(lookup))) {\n build.depth.enter(resolved.isExternalLibraryImport);\n const request = {\n fileName: resolved.resolvedFileName,\n isDefaultLib: false,\n packageId: resolved.packageId,\n };\n processSourceFile(build, request, walk.include);\n build.depth.leave(resolved.isExternalLibraryImport);\n }\n }\n};\n\nconst processLibReferenceDirectives = (walk: ReferenceWalk): void => {\n const libDirectory = getDirectoryPath(walk.build.host.defaultLibFileName);\n for (const reference of walk.sourceFile.libReferenceDirectives) {\n const fileName = combinePaths(libDirectory, `lib.${Str.toLowerCase(reference.fileName)}.d.ts`);\n processSourceFile(\n walk.build,\n { fileName, isDefaultLib: true, packageId: Option.none() },\n walk.include,\n );\n }\n};\n\nconst processReferences = (walk: ReferenceWalk): void => {\n processReferencedFiles(walk);\n processTypeReferenceDirectives(walk);\n processLibReferenceDirectives(walk);\n};\n\nconst resumeImports = (walk: ReferenceWalk): void => {\n walk.build.registry.setFlag(walk.sourceFile.fileName, \"elided\", false);\n processImportedModules(walk.build, walk.sourceFile, walk.include);\n};\n\nconst isReachedFromRoot = (walk: ReferenceWalk): boolean =>\n walk.build.registry.hasFlag(walk.sourceFile.fileName, \"foundInNodeModules\") &&\n walk.build.depth.current() === OUTSIDE_NODE_MODULES;\n\nconst canResumeElided = (walk: ReferenceWalk): boolean =>\n walk.build.registry.hasFlag(walk.sourceFile.fileName, \"elided\") &&\n walk.build.depth.current() < MAX_NODE_MODULE_JS_DEPTH;\n\nconst promoteToRoot = (walk: ReferenceWalk): void => {\n walk.build.registry.setFlag(walk.sourceFile.fileName, \"foundInNodeModules\", false);\n processReferences(walk);\n resumeImports(walk);\n};\n\nconst REVISITS: readonly (readonly [\n (walk: ReferenceWalk) => boolean,\n (walk: ReferenceWalk) => void,\n])[] = [\n [isReachedFromRoot, promoteToRoot],\n [canResumeElided, resumeImports],\n];\n\nconst revisitExisting = (walk: ReferenceWalk): void => {\n const revisit = Arr.findFirst(REVISITS, ([applies]) => applies(walk));\n for (const [, apply] of Option.toArray(revisit)) {\n apply(walk);\n }\n};\n\nconst addNewFile = (walk: ReferenceWalk, fileName: string): void => {\n const { build, sourceFile } = walk;\n const insideNodeModules = build.depth.current() > OUTSIDE_NODE_MODULES;\n build.registry.setFlag(fileName, \"foundInNodeModules\", insideNodeModules);\n setPackageJsonScope(sourceFile, build.host.packageJsonScopeFor(fileName));\n processReferences(walk);\n processImportedModules(build, sourceFile, walk.include);\n build.registry.include({ fileName, sourceFile }, walk.isDefaultLib);\n};\n\nconst recordOrReuseDuplicate = (\n build: ProgramBuild,\n request: FileRequest,\n file: Option.Option<SourceFile>,\n): Option.Option<SourceFile> => {\n const duplicate = request.packageId.pipe(\n Option.flatMap((id) => build.registry.fileForPackage(id)),\n );\n if (Option.isNone(duplicate)) {\n build.registry.record(request, file);\n return duplicate;\n }\n build.registry.record(request, duplicate);\n build.registry.include({ fileName: request.fileName, sourceFile: duplicate.value }, false);\n return duplicate;\n};\n\nconst includeSourceFile: IncludeSourceFile = (build, request) => {\n const walkOf = (sourceFile: SourceFile): ReferenceWalk => ({\n build,\n include: includeSourceFile,\n sourceFile,\n isDefaultLib: request.isDefaultLib,\n });\n const existing = build.registry.lookup(request.fileName);\n if (Option.isSome(existing)) {\n for (const sourceFile of Option.toArray(existing.value)) {\n revisitExisting(walkOf(sourceFile));\n }\n return existing.value;\n }\n const file = build.host.getSourceFile(request.fileName);\n return recordOrReuseDuplicate(build, request, file).pipe(\n Option.orElse(() => {\n for (const sourceFile of Option.toArray(file)) {\n addNewFile(walkOf(sourceFile), request.fileName);\n }\n return file;\n }),\n );\n};\n\nconst createProgramFiles: {\n (options: ProgramOptions, host: ProgramHost): (rootNames: readonly string[]) => ProgramFiles;\n (rootNames: readonly string[], options: ProgramOptions, host: ProgramHost): ProgramFiles;\n} = Fn.dual(\n DATA_FIRST_ARITY_3,\n (rootNames: readonly string[], options: ProgramOptions, host: ProgramHost): ProgramFiles => {\n const build = createProgramBuild(host, options);\n for (const rootName of rootNames) {\n const request = {\n fileName: normalizePath(rootName),\n isDefaultLib: false,\n packageId: Option.none(),\n };\n processSourceFile(build, request, includeSourceFile);\n }\n if (rootNames.length > NO_ROOTS) {\n const request = {\n fileName: host.defaultLibFileName,\n isDefaultLib: true,\n packageId: Option.none(),\n };\n processSourceFile(build, request, includeSourceFile);\n }\n return build.registry.result();\n },\n);\n\nexport { createProgramFiles };\n","import { MutableRef, Option, Function as Fn } from \"effect\";\n\nimport type { TypeCheckerFacade } from \"./checker.ts\";\nimport { openChecker } from \"./compiler-checker.ts\";\nimport { LIB_FILE_NAME } from \"./host-types.ts\";\nimport type { HostWrapperCore } from \"./host-types.ts\";\nimport type { ProgramFile, ProgramFiles, ProgramOptions } from \"./program-build.ts\";\nimport { createProgramFiles } from \"./program.ts\";\nimport type { MountedFileSystem } from \"./ts-api.ts\";\n\nconst DATA_FIRST_ARITY = 2;\n\ninterface Program {\n readonly getSourceFiles: () => readonly ProgramFile[];\n readonly getTypeChecker: () => TypeCheckerFacade;\n}\n\ninterface ProgramSite {\n readonly core: HostWrapperCore;\n readonly mounted: MountedFileSystem;\n readonly options: ProgramOptions;\n}\n\ninterface CachedProgram {\n readonly program: Program;\n readonly resolvedModules: ProgramFiles[\"resolvedModules\"];\n readonly dispose: () => void;\n}\n\nconst buildProgramFiles = (site: ProgramSite, rootNames: readonly string[]): ProgramFiles =>\n createProgramFiles(rootNames, site.options, {\n modeOptions: site.core.modeOptions,\n defaultLibFileName: LIB_FILE_NAME,\n getSourceFile: site.core.getSourceFile,\n resolveModuleName: (request) => site.core.resolve(request).result,\n resolveTypeReference: site.core.resolveTypeReference,\n packageJsonScopeFor: site.core.packageJsonScopeFor,\n });\n\nconst createProgram: {\n (rootNames: readonly string[]): (site: ProgramSite) => CachedProgram;\n (site: ProgramSite, rootNames: readonly string[]): CachedProgram;\n} = Fn.dual(DATA_FIRST_ARITY, (site: ProgramSite, rootNames: readonly string[]): CachedProgram => {\n const programFiles = buildProgramFiles(site, rootNames);\n const checkerSite = { core: site.core, mountRoot: site.mounted.root, options: site.options };\n const checker = MutableRef.make(Option.none<TypeCheckerFacade>());\n const openCheckerOnce = (): TypeCheckerFacade =>\n Option.getOrElse(MutableRef.get(checker), () => {\n const created = openChecker(checkerSite, programFiles.files, rootNames);\n MutableRef.set(checker, Option.some(created));\n return created;\n });\n return {\n program: { getSourceFiles: () => programFiles.files, getTypeChecker: openCheckerOnce },\n resolvedModules: programFiles.resolvedModules,\n dispose: () => {\n for (const created of Option.toArray(MutableRef.get(checker))) {\n created.dispose();\n }\n },\n };\n});\n\nexport { createProgram };\nexport type { CachedProgram, Program, ProgramSite };\n","import { Option, String as Str, Function as Fn } from \"effect\";\n\nimport { createPackageJsonCache } from \"./package-json.ts\";\nimport { getDirectoryPath, toPath } from \"./paths.ts\";\nimport type {\n ModuleResolutionCache,\n ResolutionMode,\n ResolutionResult,\n} from \"./resolution-types.ts\";\nimport { lastIndexUpTo } from \"./text-search.ts\";\n\nconst DATA_FIRST_ARITY = 2;\n\nconst NEXT = 1;\nconst START = 0;\nconst ROOT_LENGTH = 1;\n\nconst modeKey: {\n (mode: Option.Option<ResolutionMode>): (name: string) => string;\n (name: string, mode: Option.Option<ResolutionMode>): string;\n} = Fn.dual(\n DATA_FIRST_ARITY,\n (name: string, mode: Option.Option<ResolutionMode>): string =>\n `${Option.getOrElse(mode, () => \"\")}|${name}`,\n);\n\nconst resolvedFileNameOf = (result: ResolutionResult): Option.Option<string> =>\n result.resolvedModule.pipe(\n Option.map((module) => Option.getOrElse(module.originalPath, () => module.resolvedFileName)),\n );\n\nconst sharedLength = (left: string, right: string): number => {\n const limit = Math.min(left.length, right.length);\n let index = START;\n while (index < limit && left[index] === right[index]) {\n index += NEXT;\n }\n return index;\n};\n\nconst isWholeDirectoryShared = (\n directory: string,\n resolutionDirectory: string,\n index: number,\n): boolean =>\n index === directory.length &&\n (resolutionDirectory.length === index || resolutionDirectory[index] === \"/\");\n\nconst enclosingDirectory = (directory: string, index: number): Option.Option<string> =>\n lastIndexUpTo(directory, \"/\", index - NEXT).pipe(\n Option.map((separator) => Str.slice(START, Math.max(separator, ROOT_LENGTH))(directory)),\n );\n\nconst getCommonPrefix = (directory: string, resolution: string): Option.Option<string> => {\n const resolutionDirectory = toPath(getDirectoryPath(resolution));\n const index = sharedLength(directory, resolutionDirectory);\n if (isWholeDirectoryShared(directory, resolutionDirectory, index)) {\n return Option.some(directory);\n }\n if (index < ROOT_LENGTH) {\n return Option.none();\n }\n return enclosingDirectory(directory, index);\n};\n\nconst ancestorsToCache = (\n path: string,\n result: ResolutionResult,\n isCached: (directory: string) => boolean,\n): readonly string[] => {\n const commonPrefix = resolvedFileNameOf(result).pipe(\n Option.flatMap((fileName) => getCommonPrefix(path, fileName)),\n );\n const directories = [path];\n let current = path;\n let parent = getDirectoryPath(current);\n while (!Option.contains(commonPrefix, current) && parent !== current && !isCached(parent)) {\n directories.push(parent);\n current = parent;\n parent = getDirectoryPath(current);\n }\n return directories;\n};\n\ninterface ResultTables {\n readonly get: (outer: string, inner: string) => Option.Option<ResolutionResult>;\n readonly tableFor: (outer: string) => Map<string, ResolutionResult>;\n}\n\nconst createResultTables = (): ResultTables => {\n const tables = new Map<string, Map<string, ResolutionResult>>();\n return {\n get: (outer, inner) =>\n Option.fromNullishOr(tables.get(outer)).pipe(\n Option.flatMap((table) => Option.fromNullishOr(table.get(inner))),\n ),\n tableFor: (outer) => {\n const table = tables.get(outer) ?? new Map<string, ResolutionResult>();\n tables.set(outer, table);\n return table;\n },\n };\n};\n\nconst createModuleResolutionCache = (): ModuleResolutionCache => {\n const perDirectory = createResultTables();\n const nonRelative = createResultTables();\n return {\n packageJson: createPackageJsonCache(),\n getFromDirectory: (key) => perDirectory.get(toPath(key.directory), modeKey(key.name, key.mode)),\n setForDirectory: (key, result) => {\n perDirectory.tableFor(toPath(key.directory)).set(modeKey(key.name, key.mode), result);\n },\n getFromNonRelative: (key) =>\n nonRelative.get(modeKey(key.name, key.mode), toPath(key.directory)),\n setForNonRelative: (key, result) => {\n const table = nonRelative.tableFor(modeKey(key.name, key.mode));\n const path = toPath(key.directory);\n if (table.has(path)) {\n return;\n }\n for (const directory of ancestorsToCache(path, result, (candidate) => table.has(candidate))) {\n table.set(directory, result);\n }\n },\n };\n};\n\nexport { createModuleResolutionCache, modeKey };\n","import { MutableRef, Option, String as Str } from \"effect\";\n\nimport type { CachedResolution, TsPackageId, TsResolution } from \"./host-types.ts\";\nimport type { ModuleNameRequest } from \"./program-build.ts\";\nimport { createModuleResolutionCache } from \"./resolution-cache.ts\";\nimport { modeToNumber } from \"./resolution-mode-numbers.ts\";\nimport type {\n ModuleResolutionCache,\n PackageId,\n ResolutionKind,\n ResolutionMode,\n ResolutionResult,\n ResolverHost,\n TraceSink,\n} from \"./resolution-types.ts\";\nimport { resolveModuleName } from \"./resolver.ts\";\n\ninterface ResolutionSource {\n readonly host: ResolverHost;\n readonly kind: ResolutionKind;\n readonly normalCache: ModuleResolutionCache;\n}\n\ninterface ResolutionStore {\n readonly resolve: (request: ModuleNameRequest) => CachedResolution;\n readonly getTrace: (request: ModuleNameRequest) => Option.Option<readonly string[]>;\n}\n\nconst DEFAULT_MODE = 1;\nconst ALLOW_JS_FLAG = 0;\n\nconst modeNumber = (mode: Option.Option<ResolutionMode>): number =>\n mode.pipe(\n Option.map((value) => modeToNumber(value)),\n Option.getOrElse(() => DEFAULT_MODE),\n );\n\nconst resolutionKey = (request: ModuleNameRequest): string =>\n `${String(modeNumber(request.mode))}:${String(Number(request.noDtsResolution))}:${String(ALLOW_JS_FLAG)}:${request.moduleName}`;\n\nconst toTsPackageId = (packageId: PackageId): TsPackageId => ({\n name: packageId.name,\n subModuleName: packageId.subModuleName,\n version: packageId.version,\n peerDependencies: Option.getOrUndefined(\n Option.liftPredicate(packageId.peerDependencies, Str.isNonEmpty),\n ),\n});\n\nconst toTsResolution = (result: ResolutionResult): TsResolution => ({\n resolvedModule: result.resolvedModule.pipe(\n Option.map((module) => ({\n resolvedFileName: module.resolvedFileName,\n originalPath: Option.getOrUndefined(module.originalPath),\n extension: module.extension,\n isExternalLibraryImport: module.isExternalLibraryImport,\n packageId: module.packageId.pipe(Option.map(toTsPackageId), Option.getOrUndefined),\n resolvedUsingTsExtension: module.resolvedUsingTsExtension,\n })),\n Option.getOrUndefined,\n ),\n});\n\nconst resolveWithTrace = (\n source: ResolutionSource,\n request: ModuleNameRequest,\n cache: ModuleResolutionCache,\n): CachedResolution => {\n const lines = MutableRef.make<readonly string[]>([]);\n const sink: TraceSink = (message) => {\n MutableRef.update(lines, (current) => [...current, message]);\n };\n const { moduleName, containingFile, mode, noDtsResolution } = request;\n const result = resolveModuleName(\n {\n moduleName,\n containingFile,\n options: { moduleResolution: source.kind, noDtsResolution },\n mode,\n },\n {\n host: source.host,\n trace: Option.some(sink),\n cache: Option.some(cache),\n },\n );\n return { result, resolution: toTsResolution(result), trace: MutableRef.get(lines) };\n};\n\nconst createResolutionStore = (source: ResolutionSource): ResolutionStore => {\n const noDtsCache = createModuleResolutionCache();\n const byFile = new Map<string, Map<string, CachedResolution>>();\n const tableFor = (containingFile: string): Map<string, CachedResolution> => {\n const table = byFile.get(containingFile) ?? new Map<string, CachedResolution>();\n byFile.set(containingFile, table);\n return table;\n };\n const cacheFor = (request: ModuleNameRequest): ModuleResolutionCache => {\n if (request.noDtsResolution) {\n return noDtsCache;\n }\n return source.normalCache;\n };\n const lookup = (request: ModuleNameRequest): Option.Option<CachedResolution> =>\n Option.fromNullishOr(byFile.get(request.containingFile)).pipe(\n Option.flatMap((table) => Option.fromNullishOr(table.get(resolutionKey(request)))),\n );\n return {\n resolve: (request) =>\n Option.getOrElse(lookup(request), () => {\n const entry = resolveWithTrace(source, request, cacheFor(request));\n tableFor(request.containingFile).set(resolutionKey(request), entry);\n return entry;\n }),\n getTrace: (request) => lookup(request).pipe(Option.map((entry) => entry.trace)),\n };\n};\n\nexport { createResolutionStore, toTsResolution };\nexport type { ResolutionSource, ResolutionStore };\n","import { Array as Arr, Option, Function as Fn } from \"effect\";\nimport type { SourceFile } from \"typescript/ast\";\n\nimport { createProgram } from \"./compiler-program.ts\";\nimport type { CachedProgram, Program, ProgramSite } from \"./compiler-program.ts\";\nimport { toTsResolution } from \"./host-resolutions.ts\";\nimport type { ExtraOptions, HostWrapperCore, ModuleKindInfo, TsResolution } from \"./host-types.ts\";\nimport { toPath } from \"./paths.ts\";\nimport type { ProgramOptions, ResolvedModuleEntry } from \"./program-build.ts\";\nimport { modeKey } from \"./resolution-cache.ts\";\nimport { modeFromNumber } from \"./resolution-mode-numbers.ts\";\nimport type { ResolutionMode } from \"./resolution-types.ts\";\n\nconst DATA_FIRST_ARITY = 2;\n\ninterface ModuleNameResolution {\n readonly resolution: TsResolution;\n readonly trace: readonly string[];\n}\n\ntype ResolveModuleNameArguments = readonly [\n moduleName: string,\n containingFile: string,\n resolutionMode?: number,\n noDtsResolution?: boolean,\n];\n\ninterface CompilerHostWrapper {\n readonly getCompilerOptions: () => Readonly<Record<string, number | boolean>>;\n readonly getSourceFile: (fileName: string) => SourceFile | undefined;\n readonly getSourceFileFromCache: (fileName: string) => SourceFile | undefined;\n readonly getModuleKindForFile: (fileName: string) => ModuleKindInfo | undefined;\n readonly resolveModuleName: (...args: ResolveModuleNameArguments) => ModuleNameResolution;\n readonly getTrace: (\n fileName: string,\n moduleSpecifier: string,\n resolutionMode: number | undefined,\n ) => readonly string[] | undefined;\n readonly createPrimaryProgram: (rootName: string) => Program;\n readonly createAuxiliaryProgram: (\n rootNames: readonly string[],\n extraOptions?: ExtraOptions,\n ) => Program;\n readonly getResolvedModule: (\n sourceFile: SourceFile,\n moduleName: string,\n resolutionMode: number | undefined,\n ) => TsResolution | undefined;\n}\n\ninterface ResolvedModuleTable {\n readonly record: (fileName: string, entries: readonly ResolvedModuleEntry[]) => void;\n readonly lookup: (\n fileName: string,\n moduleName: string,\n mode: Option.Option<ResolutionMode>,\n ) => Option.Option<TsResolution>;\n}\n\ntype ProgramLookup = (rootNames: readonly string[], options: ProgramOptions) => CachedProgram;\n\nconst PROGRAM_CACHE_SIZE = 2;\nconst PRIMARY_OPTIONS: ProgramOptions = { allowJs: false, noDtsResolution: false };\n\nconst createProgramCache = (site: Omit<ProgramSite, \"options\">): ProgramLookup => {\n const programs = new Map<string, CachedProgram>();\n return (rootNames, options) => {\n const key = Arr.join(\n [...rootNames, String(options.allowJs), String(options.noDtsResolution)],\n \"\\0\",\n );\n const program = programs.get(key) ?? createProgram({ ...site, options }, rootNames);\n programs.delete(key);\n programs.set(key, program);\n for (const [staleKey, stale] of programs) {\n if (programs.size <= PROGRAM_CACHE_SIZE) {\n break;\n }\n programs.delete(staleKey);\n stale.dispose();\n }\n return program;\n };\n};\n\nconst createResolvedModuleTable = (): ResolvedModuleTable => {\n const byFile = new Map<string, Map<string, TsResolution>>();\n return {\n record: (fileName, entries) => {\n const path = toPath(fileName);\n const own = byFile.get(path) ?? new Map<string, TsResolution>();\n byFile.set(path, own);\n for (const entry of entries) {\n own.set(modeKey(entry.moduleName, entry.mode), toTsResolution(entry.resolution));\n }\n },\n lookup: (fileName, moduleName, mode) =>\n Option.fromNullishOr(byFile.get(toPath(fileName))).pipe(\n Option.flatMap((own) => Option.fromNullishOr(own.get(modeKey(moduleName, mode)))),\n ),\n };\n};\n\nconst auxiliaryOptions = (extraOptions: ExtraOptions | undefined): ProgramOptions => {\n const extra = Option.fromNullishOr(extraOptions);\n return {\n allowJs: Option.exists(extra, (options) => options.allowJs === true),\n noDtsResolution: Option.exists(extra, (options) => options.noDtsResolution === true),\n };\n};\n\nconst resolveModuleNameWith =\n (core: HostWrapperCore) =>\n (\n ...[moduleName, containingFile, resolutionMode, noDtsResolution]: ResolveModuleNameArguments\n ): ModuleNameResolution => {\n const entry = core.resolve({\n moduleName,\n containingFile,\n mode: modeFromNumber(resolutionMode),\n noDtsResolution: noDtsResolution === true,\n });\n return { resolution: entry.resolution, trace: entry.trace };\n };\n\nconst wrapHost: {\n (site: Omit<ProgramSite, \"core\" | \"options\">): (core: HostWrapperCore) => CompilerHostWrapper;\n (core: HostWrapperCore, site: Omit<ProgramSite, \"core\" | \"options\">): CompilerHostWrapper;\n} = Fn.dual(\n DATA_FIRST_ARITY,\n (core: HostWrapperCore, site: Omit<ProgramSite, \"core\" | \"options\">): CompilerHostWrapper => {\n const getProgram = createProgramCache({ ...site, core });\n const resolvedModules = createResolvedModuleTable();\n return {\n getCompilerOptions: () => core.compilerOptions,\n getSourceFile: (fileName) => Option.getOrUndefined(core.getSourceFile(fileName)),\n getSourceFileFromCache: (fileName) =>\n Option.getOrUndefined(core.getSourceFileFromCache(fileName)),\n getModuleKindForFile: (fileName) =>\n Option.getOrUndefined(core.getModuleKindForFile(fileName)),\n resolveModuleName: resolveModuleNameWith(core),\n getTrace: (containingFile, moduleName, resolutionMode) =>\n Option.getOrUndefined(\n core.getTrace({\n moduleName,\n containingFile,\n mode: modeFromNumber(resolutionMode),\n noDtsResolution: false,\n }),\n ),\n createPrimaryProgram: (rootName) => {\n const created = getProgram([rootName], PRIMARY_OPTIONS);\n for (const [fileName, entries] of created.resolvedModules) {\n resolvedModules.record(fileName, entries);\n }\n return created.program;\n },\n createAuxiliaryProgram: (rootNames, extraOptions) =>\n getProgram(rootNames, auxiliaryOptions(extraOptions)).program,\n getResolvedModule: (sourceFile, moduleName, resolutionMode) =>\n Option.getOrUndefined(\n resolvedModules.lookup(sourceFile.fileName, moduleName, modeFromNumber(resolutionMode)),\n ),\n };\n },\n);\n\nexport { wrapHost };\nexport type { CompilerHostWrapper, ModuleNameResolution, ResolveModuleNameArguments };\n","import { Option, Predicate } from \"effect\";\nimport { ModuleKind } from \"typescript/sync\";\n\nimport { fileExtensionIsOneOf, getAnyExtensionFromPath } from \"./extensions.ts\";\nimport type { ModuleKindInfo, ModuleKindReason } from \"./host-types.ts\";\nimport { pathContainsNodeModules } from \"./node-modules-paths.ts\";\nimport { getPackageScopeForPath } from \"./package-json.ts\";\nimport { combinePaths, getDirectoryPath, getNormalizedAbsolutePath, toPath } from \"./paths.ts\";\nimport type {\n PackageJsonCache,\n PackageJsonInfo,\n ResolutionKind,\n ResolutionMode,\n ResolutionState,\n ResolverHost,\n} from \"./resolution-types.ts\";\nimport { NO_FEATURES, createOutcome } from \"./resolver-state.ts\";\nimport { resolveNestedModule } from \"./resolver.ts\";\n\ninterface FileFormatSource {\n readonly host: ResolverHost;\n readonly kind: ResolutionKind;\n readonly packageJsonCache: PackageJsonCache;\n}\n\ninterface FileFormats {\n readonly impliedFormat: (fileName: string) => Option.Option<ResolutionMode>;\n readonly moduleKind: (fileName: string) => Option.Option<ModuleKindInfo>;\n readonly packageJsonScopeFor: (fileName: string) => Option.Option<PackageJsonInfo>;\n}\n\nconst ESM_EXTENSIONS = [\".d.mts\", \".mts\", \".mjs\"];\nconst CJS_EXTENSIONS = [\".d.cts\", \".cts\", \".cjs\"];\nconst EXPLICIT_FORMAT_EXTENSIONS = [...ESM_EXTENSIONS, ...CJS_EXTENSIONS];\nconst LOOKUP_EXTENSIONS = [\".d.ts\", \".ts\", \".tsx\", \".js\", \".jsx\"];\nconst MODULE_SYNTAX_EXTENSIONS: ReadonlySet<string> = new Set(EXPLICIT_FORMAT_EXTENSIONS);\n\nconst DETECTED_KINDS: Readonly<Record<ResolutionMode, number>> = {\n ESNext: ModuleKind.ESNext,\n CommonJS: ModuleKind.CommonJS,\n};\n\nconst lookupState = (\n source: FileFormatSource,\n packageJsonCache: Option.Option<PackageJsonCache>,\n): ResolutionState => ({\n host: source.host,\n trace: Option.none(),\n options: { moduleResolution: source.kind, noDtsResolution: false },\n cache: Option.none(),\n packageJsonCache,\n features: NO_FEATURES,\n conditions: [],\n candidateIsFromPackageJsonField: false,\n outcome: createOutcome(),\n resolveNested: resolveNestedModule,\n});\n\nconst shouldLookupPackageJson = (kind: ResolutionKind, path: string): boolean =>\n (kind === \"Node16\" || pathContainsNodeModules(path)) &&\n fileExtensionIsOneOf(path, LOOKUP_EXTENSIONS);\n\nconst isModuleScope = (info: PackageJsonInfo): boolean =>\n info.contents.packageJsonContent[\"type\"] === \"module\";\n\nconst formatOfScope = (scope: Option.Option<PackageJsonInfo>): ResolutionMode => {\n if (Option.exists(scope, isModuleScope)) {\n return \"ESNext\";\n }\n return \"CommonJS\";\n};\n\nconst cachedScope = (source: FileFormatSource, path: string): Option.Option<PackageJsonInfo> =>\n getPackageScopeForPath(path, lookupState(source, Option.some(source.packageJsonCache)));\n\nconst impliedFormatOf = (\n source: FileFormatSource,\n fileName: string,\n): Option.Option<ResolutionMode> => {\n const path = toPath(fileName);\n if (fileExtensionIsOneOf(path, ESM_EXTENSIONS)) {\n return Option.some(\"ESNext\");\n }\n if (fileExtensionIsOneOf(path, CJS_EXTENSIONS)) {\n return Option.some(\"CommonJS\");\n }\n if (!shouldLookupPackageJson(source.kind, path)) {\n return Option.none();\n }\n const scope = cachedScope(source, getDirectoryPath(path));\n return Option.some(formatOfScope(scope));\n};\n\nconst scopeReason = (info: PackageJsonInfo): ModuleKindReason => {\n if (Predicate.isTruthy(info.contents.packageJsonContent[\"type\"])) {\n return \"type\";\n }\n return \"no:type\";\n};\n\nconst reasonFor = (\n source: FileFormatSource,\n fileName: string,\n): Pick<ModuleKindInfo, \"detectedReason\" | \"reasonFileName\"> => {\n if (MODULE_SYNTAX_EXTENSIONS.has(getAnyExtensionFromPath(fileName))) {\n return { detectedReason: \"extension\", reasonFileName: fileName };\n }\n return Option.match(cachedScope(source, fileName), {\n onNone: () => ({ detectedReason: \"no:type\", reasonFileName: fileName }),\n onSome: (info) => ({\n detectedReason: scopeReason(info),\n reasonFileName: combinePaths(info.packageDirectory, \"package.json\"),\n }),\n });\n};\n\nconst moduleKindOf = (source: FileFormatSource, fileName: string): Option.Option<ModuleKindInfo> =>\n impliedFormatOf(source, fileName).pipe(\n Option.map((format) => ({\n detectedKind: DETECTED_KINDS[format],\n ...reasonFor(source, fileName),\n })),\n );\n\nconst packageJsonScopeOf = (\n source: FileFormatSource,\n fileName: string,\n): Option.Option<PackageJsonInfo> => {\n const path = getNormalizedAbsolutePath(fileName, \"/\");\n if (\n fileExtensionIsOneOf(path, EXPLICIT_FORMAT_EXTENSIONS) ||\n !shouldLookupPackageJson(source.kind, path)\n ) {\n return Option.none();\n }\n return getPackageScopeForPath(getDirectoryPath(path), lookupState(source, Option.none()));\n};\n\nconst createFileFormats = (source: FileFormatSource): FileFormats => ({\n impliedFormat: (fileName) => impliedFormatOf(source, fileName),\n moduleKind: (fileName) => moduleKindOf(source, fileName),\n packageJsonScopeFor: (fileName) => packageJsonScopeOf(source, fileName),\n});\n\nexport { createFileFormats };\nexport type { FileFormatSource, FileFormats };\n","import { Option } from \"effect\";\nimport type { SourceFile } from \"typescript/ast\";\n\nimport { toPath } from \"./paths.ts\";\nimport type { ResolutionMode } from \"./resolution-types.ts\";\nimport { attachFileInfo } from \"./source-file.ts\";\nimport { parseSourceFile } from \"./ts-api.ts\";\n\ninterface SourceFileOrigin {\n readonly read: (fileName: string) => Option.Option<string>;\n readonly impliedFormat: (fileName: string) => Option.Option<ResolutionMode>;\n}\n\ninterface SourceFileStore {\n readonly open: (fileName: string) => Option.Option<SourceFile>;\n readonly cached: (fileName: string) => Option.Option<SourceFile>;\n}\n\nconst createSourceFileStore = (origin: SourceFileOrigin): SourceFileStore => {\n const sourceFiles = new Map<string, SourceFile>();\n const cached = (fileName: string): Option.Option<SourceFile> =>\n Option.fromNullishOr(sourceFiles.get(toPath(fileName)));\n const storeParsed = (fileName: string, content: string): SourceFile => {\n const parsed = parseSourceFile(fileName, content, Option.none());\n const sourceFile = attachFileInfo(parsed, origin.impliedFormat(fileName));\n sourceFiles.set(toPath(fileName), sourceFile);\n return sourceFile;\n };\n return {\n open: (fileName) =>\n Option.orElse(cached(fileName), () =>\n origin.read(fileName).pipe(Option.map((content) => storeParsed(fileName, content))),\n ),\n cached,\n };\n};\n\nexport { createSourceFileStore };\nexport type { SourceFileOrigin, SourceFileStore };\n","import { Option, Function as Fn } from \"effect\";\n\nimport type {\n Features,\n ResolutionMode,\n ResolutionState,\n ResolverHost,\n ResolverOptions,\n} from \"./resolution-types.ts\";\nimport { ALL_FEATURES, NO_FEATURES, createOutcome, getConditions } from \"./resolver-state.ts\";\nimport { resolveNestedModule } from \"./resolver.ts\";\n\nconst DATA_FIRST_ARITY = 2;\n\ninterface TypeReferenceRequest {\n readonly name: string;\n readonly containingFile: string;\n readonly options: ResolverOptions;\n readonly mode: Option.Option<ResolutionMode>;\n}\n\nconst conditionsFor = (\n request: TypeReferenceRequest,\n exportsEnabled: boolean,\n): readonly string[] => {\n if (!exportsEnabled) {\n return [];\n }\n return getConditions(request.options, request.mode);\n};\n\nconst featuresFor = (request: TypeReferenceRequest): Features => {\n if (request.options.moduleResolution !== \"Node10\" || Option.isSome(request.mode)) {\n return ALL_FEATURES;\n }\n return NO_FEATURES;\n};\n\nconst stateFor: {\n (host: ResolverHost): (request: TypeReferenceRequest) => ResolutionState;\n (request: TypeReferenceRequest, host: ResolverHost): ResolutionState;\n} = Fn.dual(\n DATA_FIRST_ARITY,\n (request: TypeReferenceRequest, host: ResolverHost): ResolutionState => {\n const kind = request.options.moduleResolution;\n const features = {\n ...featuresFor(request),\n esmMode: kind === \"Node16\" && Option.contains(request.mode, \"ESNext\"),\n };\n return {\n host,\n trace: Option.none(),\n options: request.options,\n cache: Option.none(),\n packageJsonCache: Option.none(),\n features,\n conditions: conditionsFor(request, features.exports),\n candidateIsFromPackageJsonField: false,\n outcome: createOutcome(),\n resolveNested: resolveNestedModule,\n };\n },\n);\n\nexport { stateFor };\nexport type { TypeReferenceRequest };\n","import { Option, Function as Fn } from \"effect\";\n\nimport { extensionsOf } from \"./extensions.ts\";\nimport { pathContainsNodeModules } from \"./node-modules-paths.ts\";\nimport { mangleScopedPackageName } from \"./package-names.ts\";\nimport { combinePaths, getDirectoryPath, isExternalModuleNameRelative } from \"./paths.ts\";\nimport type { PackageId, Resolved, ResolutionState, ResolverHost } from \"./resolution-types.ts\";\nimport { loadNodeModuleFromDirectory } from \"./resolver-directory.ts\";\nimport { loadModuleFromNearestNodeModulesDirectory } from \"./resolver-node-modules.ts\";\nimport { loadRelativeModule, nodeLoadModuleByRelativeName } from \"./resolver-relative.ts\";\nimport { stateFor } from \"./type-reference-state.ts\";\nimport type { TypeReferenceRequest } from \"./type-reference-state.ts\";\n\nconst DATA_FIRST_ARITY = 2;\n\ninterface ResolvedTypeReference {\n readonly resolvedFileName: string;\n readonly packageId: Option.Option<PackageId>;\n readonly isExternalLibraryImport: boolean;\n}\n\nconst TYPE_ROOT = \"/node_modules/@types\";\nconst DECLARATION = extensionsOf(\"Declaration\");\n\nconst primaryLookup = (\n request: TypeReferenceRequest,\n state: ResolutionState,\n): Option.Option<Resolved> => {\n const candidate = combinePaths(TYPE_ROOT, mangleScopedPackageName(request.name));\n const directoryExists = state.host.directoryExists(TYPE_ROOT);\n return loadNodeModuleFromDirectory(\n {\n extensions: DECLARATION,\n candidate,\n onlyRecordFailures: !directoryExists,\n considerPackageJson: true,\n loadRelative: nodeLoadModuleByRelativeName,\n },\n state,\n );\n};\n\nconst secondaryLookup = (\n request: TypeReferenceRequest,\n state: ResolutionState,\n): Option.Option<Resolved> => {\n const directory = getDirectoryPath(request.containingFile);\n if (!isExternalModuleNameRelative(request.name)) {\n return Option.flatten(\n loadModuleFromNearestNodeModulesDirectory(\n { extensions: DECLARATION, moduleName: request.name, directory, typesScopeOnly: false },\n state,\n ),\n );\n }\n return loadRelativeModule({ extensions: DECLARATION, moduleName: request.name, directory }, state)\n .resolved;\n};\n\nconst resolveTypeReferenceDirective: {\n (host: ResolverHost): (request: TypeReferenceRequest) => Option.Option<ResolvedTypeReference>;\n (request: TypeReferenceRequest, host: ResolverHost): Option.Option<ResolvedTypeReference>;\n} = Fn.dual(\n DATA_FIRST_ARITY,\n (request: TypeReferenceRequest, host: ResolverHost): Option.Option<ResolvedTypeReference> => {\n const state = stateFor(request, host);\n return primaryLookup(request, state).pipe(\n Option.orElse(() => secondaryLookup(request, state)),\n Option.map((resolved) => ({\n resolvedFileName: resolved.path,\n packageId: resolved.packageId,\n isExternalLibraryImport: pathContainsNodeModules(resolved.path),\n })),\n );\n },\n);\n\nexport { resolveTypeReferenceDirective };\nexport type { ResolvedTypeReference };\n","import { Option } from \"effect\";\nimport { ModuleKind, ModuleResolutionKind } from \"typescript/sync\";\n\nimport { createFileFormats } from \"./host-files.ts\";\nimport { createResolutionStore } from \"./host-resolutions.ts\";\nimport { createSourceFileStore } from \"./host-sources.ts\";\nimport { LIB_FILE_NAME } from \"./host-types.ts\";\nimport type { HostWrapperCore, PackageFileSystem } from \"./host-types.ts\";\nimport type { ModeOptions } from \"./module-mode.ts\";\nimport { createModuleResolutionCache } from \"./resolution-cache.ts\";\nimport type { ResolutionKind, ResolverHost } from \"./resolution-types.ts\";\nimport { resolveTypeReferenceDirective } from \"./type-reference.ts\";\n\ninterface HostSource {\n readonly fs: PackageFileSystem;\n readonly kind: ResolutionKind;\n readonly minimalLib: string;\n}\n\nconst TARGET_LATEST = 99;\n\nconst MODULE_KINDS: Readonly<Record<ResolutionKind, number>> = {\n Node10: ModuleKind.CommonJS,\n Node16: ModuleKind.Node16,\n Bundler: ModuleKind.ESNext,\n};\n\nconst RESOLUTION_KINDS: Readonly<Record<ResolutionKind, number>> = {\n Node10: ModuleResolutionKind.Node10,\n Node16: ModuleResolutionKind.Node16,\n Bundler: ModuleResolutionKind.Bundler,\n};\n\nconst MODE_MODULES: Readonly<Record<ResolutionKind, ModeOptions[\"module\"]>> = {\n Node10: \"CommonJS\",\n Node16: \"Node16\",\n Bundler: \"ESNext\",\n};\n\nconst resolverHostOf = (fs: PackageFileSystem): ResolverHost => ({\n fileExists: fs.fileExists.bind(fs),\n directoryExists: fs.directoryExists.bind(fs),\n readFile: (path) => Option.fromNullishOr(fs.tryReadFile(path)),\n});\n\nconst fileReader =\n (source: HostSource) =>\n (fileName: string): Option.Option<string> => {\n if (fileName === LIB_FILE_NAME) {\n return Option.some(source.minimalLib);\n }\n return Option.fromNullishOr(source.fs.tryReadFile(fileName));\n };\n\nconst compilerOptionsFor = (kind: ResolutionKind): HostWrapperCore[\"compilerOptions\"] => ({\n moduleResolution: RESOLUTION_KINDS[kind],\n module: MODULE_KINDS[kind],\n target: TARGET_LATEST,\n resolveJsonModule: true,\n traceResolution: true,\n});\n\nconst createHostWrapper = (source: HostSource): HostWrapperCore => {\n const { kind } = source;\n const resolverHost = resolverHostOf(source.fs);\n const normalCache = createModuleResolutionCache();\n const formats = createFileFormats({\n host: resolverHost,\n kind,\n packageJsonCache: normalCache.packageJson,\n });\n const sources = createSourceFileStore({\n read: fileReader(source),\n impliedFormat: formats.impliedFormat,\n });\n const resolutions = createResolutionStore({ host: resolverHost, kind, normalCache });\n return {\n kind,\n modeOptions: { moduleResolution: kind, module: MODE_MODULES[kind] },\n resolverHost,\n compilerOptions: compilerOptionsFor(kind),\n getSourceFile: sources.open,\n getSourceFileFromCache: sources.cached,\n getModuleKindForFile: formats.moduleKind,\n resolve: resolutions.resolve,\n getTrace: resolutions.getTrace,\n packageJsonScopeFor: formats.packageJsonScopeFor,\n resolveTypeReference: ({ name, containingFile, mode }) =>\n resolveTypeReferenceDirective(\n { name, containingFile, options: { moduleResolution: kind, noDtsResolution: false }, mode },\n resolverHost,\n ),\n };\n};\n\nexport { createHostWrapper };\nexport type { HostSource };\n","import { Option, Predicate, Array as Arr, pipe, Function as Fn } from \"effect\";\nimport { ModuleResolutionKind } from \"typescript/sync\";\n\nimport { wrapHost } from \"./compiler-host-wrapper.ts\";\nimport type { CompilerHostWrapper } from \"./compiler-host-wrapper.ts\";\nimport { LIB_FILE_NAME } from \"./host-types.ts\";\nimport type { PackageFileSystem } from \"./host-types.ts\";\nimport { createHostWrapper } from \"./host-wrapper.ts\";\nimport type { ResolutionKind } from \"./resolution-types.ts\";\nimport { mount } from \"./ts-api.ts\";\nimport type { MountedFileSystem } from \"./ts-api.ts\";\n\nconst DATA_FIRST_ARITY = 2;\nconst DATA_FIRST_ARITY_3 = 3;\n\ninterface CompilerHosts {\n readonly node10: CompilerHostWrapper;\n readonly node16: CompilerHostWrapper;\n readonly bundler: CompilerHostWrapper;\n readonly findHostForFiles: (files: readonly string[]) => CompilerHostWrapper | undefined;\n}\n\nconst RESOLUTION_KINDS_BY_OPTION: ReadonlyMap<number, ResolutionKind> = new Map([\n [ModuleResolutionKind.Node10, \"Node10\"],\n [ModuleResolutionKind.Node16, \"Node16\"],\n [ModuleResolutionKind.NodeNext, \"Node16\"],\n [ModuleResolutionKind.Bundler, \"Bundler\"],\n]);\n\nconst mountFileSystem = (fs: PackageFileSystem, minimalLib: string): MountedFileSystem =>\n mount({\n fileExists: (path) => path === LIB_FILE_NAME || fs.fileExists(path),\n directoryExists: (path) => fs.directoryExists(path),\n readFile: (path) => {\n if (path === LIB_FILE_NAME) {\n return Option.some(minimalLib);\n }\n return Option.fromNullishOr(fs.tryReadFile(path));\n },\n listFiles: () => [LIB_FILE_NAME, ...fs.listFiles()],\n });\n\nconst createCompilerHostWrapperWith: {\n (moduleResolution: number, minimalLib: string): (fs: PackageFileSystem) => CompilerHostWrapper;\n (fs: PackageFileSystem, moduleResolution: number, minimalLib: string): CompilerHostWrapper;\n} = Fn.dual(\n DATA_FIRST_ARITY_3,\n (fs: PackageFileSystem, moduleResolution: number, minimalLib: string): CompilerHostWrapper => {\n const kind = RESOLUTION_KINDS_BY_OPTION.get(moduleResolution);\n if (Predicate.isUndefined(kind)) {\n throw new TypeError(`Unsupported module resolution kind: ${String(moduleResolution)}`);\n }\n return wrapHost(createHostWrapper({ fs, kind, minimalLib }), {\n mounted: mountFileSystem(fs, minimalLib),\n });\n },\n);\n\nconst holdsAll =\n (files: readonly string[]) =>\n (host: CompilerHostWrapper): boolean =>\n pipe(\n files,\n Arr.every((file) => Predicate.isNotUndefined(host.getSourceFileFromCache(file))),\n );\n\nconst createCompilerHostsWith: {\n (minimalLib: string): (fs: PackageFileSystem) => CompilerHosts;\n (fs: PackageFileSystem, minimalLib: string): CompilerHosts;\n} = Fn.dual(DATA_FIRST_ARITY, (fs: PackageFileSystem, minimalLib: string): CompilerHosts => {\n const mounted = mountFileSystem(fs, minimalLib);\n const create = (kind: ResolutionKind): CompilerHostWrapper =>\n wrapHost(createHostWrapper({ fs, kind, minimalLib }), { mounted });\n const node10 = create(\"Node10\");\n const node16 = create(\"Node16\");\n const bundler = create(\"Bundler\");\n return {\n node10,\n node16,\n bundler,\n findHostForFiles: (files) =>\n Option.getOrUndefined(Arr.findFirst([node10, node16, bundler], holdsAll(files))),\n };\n});\n\nexport { createCompilerHostWrapperWith, createCompilerHostsWith };\nexport type { CompilerHosts };\n","import ts from \"typescript\";\nimport { CompilerHostWrapper } from \"./multiCompilerHost.js\";\nimport { allBuildTools, getResolutionKinds } from \"../utils.js\";\nconst extensions = new Set([\".jsx\", \".tsx\", \".js\", \".ts\", \".mjs\", \".cjs\", \".mts\", \".cjs\"]);\nfunction getEntrypoints(fs, exportsObject, options) {\n var _a;\n var _b;\n if (options === null || options === void 0 ? void 0 : options.entrypoints) {\n return options.entrypoints.map((e) => formatEntrypointString(e, fs.packageName));\n }\n if (exportsObject === undefined && fs) {\n const rootDir = `/node_modules/${fs.packageName}`;\n const proxies = getProxyDirectories(rootDir, fs);\n if (proxies.length === 0) {\n if (options === null || options === void 0 ? void 0 : options.entrypointsLegacy) {\n return fs\n .listFiles()\n .filter((f) => !ts.isDeclarationFileName(f) && extensions.has(f.slice(f.lastIndexOf(\".\"))))\n .map((f) => \".\" + f.slice(rootDir.length));\n }\n return [\".\"];\n }\n return proxies;\n }\n const detectedSubpaths = getSubpaths(exportsObject);\n if (detectedSubpaths.length === 0 && hasExportTarget(exportsObject)) {\n detectedSubpaths.push(\".\");\n }\n const included = unique([\n ...detectedSubpaths,\n ...((_b = (_a = options === null || options === void 0 ? void 0 : options.includeEntrypoints) === null || _a === void 0 ? void 0 : _a.map((e) => formatEntrypointString(e, fs.packageName))) !== null && _b !== void 0 ? _b : []),\n ]);\n if (!(options === null || options === void 0 ? void 0 : options.excludeEntrypoints)) {\n return included;\n }\n return included.filter((entrypoint) => {\n return !options.excludeEntrypoints.some((exclusion) => {\n if (typeof exclusion === \"string\") {\n return formatEntrypointString(exclusion, fs.packageName) === entrypoint;\n }\n return exclusion.test(entrypoint);\n });\n });\n}\nfunction formatEntrypointString(path, packageName) {\n return (path === \".\" || path.startsWith(\"./\")\n ? path\n : path === packageName\n ? \".\"\n : path.startsWith(`${packageName}/`)\n ? `.${path.slice(packageName.length)}`\n : `./${path}`).trim();\n}\nfunction getSubpaths(exportsObject) {\n var _a;\n if (!exportsObject || typeof exportsObject !== \"object\" || Array.isArray(exportsObject)) {\n return [];\n }\n const keys = Object.keys(exportsObject);\n if ((_a = keys[0]) === null || _a === void 0 ? void 0 : _a.startsWith(\".\")) {\n return keys.filter((key) => hasExportTarget(exportsObject[key]));\n }\n return keys.flatMap((key) => getSubpaths(exportsObject[key]));\n}\nfunction hasExportTarget(exportsObject) {\n if (exportsObject === null || exportsObject === undefined) {\n return false;\n }\n if (typeof exportsObject !== \"object\") {\n return true;\n }\n if (Array.isArray(exportsObject)) {\n return exportsObject.some(hasExportTarget);\n }\n return Object.keys(exportsObject).some((key) => hasExportTarget(exportsObject[key]));\n}\nfunction getProxyDirectories(rootDir, fs) {\n const vendorDirectories = new Set();\n const proxyDirectories = [];\n const files = fs.listFiles().sort((a, b) => a.length - b.length);\n for (const file of files) {\n if (file.startsWith(rootDir) && file.endsWith(\"/package.json\")) {\n try {\n const packageJson = JSON.parse(fs.readFile(file));\n if (packageJson.name && !packageJson.name.startsWith(fs.packageName)) {\n // Name unrelated to the root package, this is a vendored package\n const vendorDir = file.slice(0, file.lastIndexOf(\"/\"));\n vendorDirectories.add(vendorDir);\n }\n else if (\"main\" in packageJson && !isInsideVendorDirectory(file)) {\n // No name or name starting with root package name, this is intended to be an entrypoint\n const proxyDir = \".\" + file.slice(rootDir.length, file.lastIndexOf(\"/\"));\n proxyDirectories.push(proxyDir);\n }\n }\n catch { }\n }\n }\n return proxyDirectories.sort((a, b) => {\n return ts.comparePathsCaseInsensitive(a, b);\n });\n function isInsideVendorDirectory(file) {\n return !!ts.forEachAncestorDirectory(file, (dir) => {\n if (vendorDirectories.has(dir)) {\n return true;\n }\n });\n }\n}\nexport function getEntrypointInfo(packageName, fs, hosts, options) {\n const packageJson = JSON.parse(fs.readFile(`/node_modules/${packageName}/package.json`));\n let entrypoints = getEntrypoints(fs, packageJson.exports, options);\n if (fs.typesPackage) {\n const typesPackageJson = JSON.parse(fs.readFile(`/node_modules/${fs.typesPackage.packageName}/package.json`));\n const typesEntrypoints = getEntrypoints(fs, typesPackageJson.exports, options);\n entrypoints = unique([...entrypoints, ...typesEntrypoints]);\n }\n const result = {};\n for (const entrypoint of entrypoints) {\n const resolutions = {\n node10: getEntrypointResolution(packageName, hosts.node10, \"node10\", entrypoint),\n \"node16-cjs\": getEntrypointResolution(packageName, hosts.node16, \"node16-cjs\", entrypoint),\n \"node16-esm\": getEntrypointResolution(packageName, hosts.node16, \"node16-esm\", entrypoint),\n bundler: getEntrypointResolution(packageName, hosts.bundler, \"bundler\", entrypoint),\n };\n result[entrypoint] = {\n subpath: entrypoint,\n resolutions,\n hasTypes: Object.values(resolutions).some((r) => { var _a; return (_a = r.resolution) === null || _a === void 0 ? void 0 : _a.isTypeScript; }),\n isWildcard: !!resolutions.bundler.isWildcard,\n };\n }\n return result;\n}\nfunction getEntrypointResolution(packageName, host, resolutionKind, entrypoint) {\n if (entrypoint.includes(\"*\")) {\n return { name: entrypoint, resolutionKind, isWildcard: true };\n }\n const moduleSpecifier = packageName + entrypoint.substring(1); // remove leading . before slash\n const importingFileName = resolutionKind === \"node16-esm\" ? \"/index.mts\" : \"/index.ts\";\n const resolutionMode = resolutionKind === \"node16-esm\"\n ? ts.ModuleKind.ESNext\n : resolutionKind === \"node16-cjs\"\n ? ts.ModuleKind.CommonJS\n : undefined;\n const resolution = tryResolve();\n const implementationResolution = tryResolve(/*noDtsResolution*/ true);\n const files = resolution\n ? host\n .createPrimaryProgram(resolution.fileName)\n .getSourceFiles()\n .map((f) => f.fileName)\n : undefined;\n return {\n name: entrypoint,\n resolutionKind,\n resolution,\n implementationResolution,\n files,\n };\n function tryResolve(noDtsResolution) {\n var _a;\n const { resolution, trace } = host.resolveModuleName(moduleSpecifier, importingFileName, resolutionMode, noDtsResolution);\n const fileName = (_a = resolution.resolvedModule) === null || _a === void 0 ? void 0 : _a.resolvedFileName;\n if (!fileName) {\n return undefined;\n }\n return {\n fileName,\n isJson: resolution.resolvedModule.extension === ts.Extension.Json,\n isTypeScript: ts.hasTSFileExtension(resolution.resolvedModule.resolvedFileName),\n trace,\n };\n }\n}\nfunction unique(array) {\n return array.filter((value, index) => array.indexOf(value) === index);\n}\nexport function getBuildTools(packageJson) {\n if (!packageJson.devDependencies) {\n return {};\n }\n const result = {};\n for (const buildTool of allBuildTools) {\n if (buildTool in packageJson.devDependencies) {\n result[buildTool] = packageJson.devDependencies[buildTool];\n }\n }\n return result;\n}\nexport function getModuleKinds(entrypoints, resolutionOption, hosts) {\n var _a;\n const host = hosts[resolutionOption];\n const result = {};\n for (const resolutionKind of getResolutionKinds(resolutionOption)) {\n for (const entrypoint of Object.values(entrypoints)) {\n const resolution = entrypoint.resolutions[resolutionKind];\n for (const fileName of (_a = resolution.files) !== null && _a !== void 0 ? _a : []) {\n if (!result[fileName]) {\n result[fileName] = host.getModuleKindForFile(fileName);\n }\n }\n if (resolution.implementationResolution) {\n const fileName = resolution.implementationResolution.fileName;\n if (!result[fileName]) {\n result[fileName] = host.getModuleKindForFile(fileName);\n }\n }\n }\n }\n return result;\n}\n//# sourceMappingURL=getEntrypointInfo.js.map","import { init as initCjsLexer } from \"cjs-module-lexer\";\nimport checks from \"./internal/checks/index.js\";\nimport { createCompilerHosts } from \"./internal/multiCompilerHost.js\";\nimport { getResolutionOption, visitResolutions } from \"./utils.js\";\nimport { getEntrypointInfo, getModuleKinds, getBuildTools } from \"./internal/getEntrypointInfo.js\";\nexport async function checkPackage(pkg, options) {\n const types = pkg.typesPackage\n ? {\n kind: \"@types\",\n ...pkg.typesPackage,\n definitelyTypedUrl: JSON.parse(pkg.readFile(`/node_modules/${pkg.typesPackage.packageName}/package.json`))\n .homepage,\n }\n : pkg.containsTypes()\n ? { kind: \"included\" }\n : false;\n const { packageName, packageVersion } = pkg;\n if (!types) {\n return { packageName, packageVersion, types };\n }\n const hosts = createCompilerHosts(pkg);\n const entrypointResolutions = getEntrypointInfo(packageName, pkg, hosts, options);\n const programInfo = {\n node10: {},\n node16: { moduleKinds: getModuleKinds(entrypointResolutions, \"node16\", hosts) },\n bundler: {},\n };\n await initCjsLexer();\n const problems = [];\n const problemIdsToIndices = new Map();\n visitResolutions(entrypointResolutions, (analysis, info) => {\n var _a;\n for (const check of checks) {\n const context = {\n pkg,\n hosts,\n entrypoints: entrypointResolutions,\n programInfo,\n subpath: info.subpath,\n resolutionKind: analysis.resolutionKind,\n resolutionOption: getResolutionOption(analysis.resolutionKind),\n fileName: undefined,\n };\n if (check.enumerateFiles) {\n for (const fileName of (_a = analysis.files) !== null && _a !== void 0 ? _a : []) {\n runCheck(check, { ...context, fileName }, analysis);\n }\n if (analysis.implementationResolution) {\n runCheck(check, { ...context, fileName: analysis.implementationResolution.fileName }, analysis);\n }\n }\n else {\n runCheck(check, context, analysis);\n }\n }\n });\n return {\n packageName,\n packageVersion,\n types,\n buildTools: getBuildTools(JSON.parse(pkg.readFile(`/node_modules/${packageName}/package.json`))),\n entrypoints: entrypointResolutions,\n programInfo,\n problems,\n };\n function runCheck(check, context, analysis) {\n var _a, _b;\n const dependencies = check.dependencies(context);\n const id = check.name +\n JSON.stringify(dependencies, (_, value) => {\n if (typeof value === \"function\") {\n throw new Error(\"Encountered unexpected function in check dependencies\");\n }\n return value;\n });\n let indices = problemIdsToIndices.get(id);\n if (indices) {\n ((_a = analysis.visibleProblems) !== null && _a !== void 0 ? _a : (analysis.visibleProblems = [])).push(...indices);\n }\n else {\n indices = [];\n const checkProblems = check.execute(dependencies, context);\n for (const problem of Array.isArray(checkProblems) ? checkProblems : checkProblems ? [checkProblems] : []) {\n indices.push(problems.length);\n problems.push(problem);\n }\n problemIdsToIndices.set(id, indices);\n ((_b = analysis.visibleProblems) !== null && _b !== void 0 ? _b : (analysis.visibleProblems = [])).push(...indices);\n }\n }\n}\n//# sourceMappingURL=checkPackage.js.map"],"mappings":";;;;;;;;;;;;;;AAEA,MAAMA,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AAc,OAAO;GACzD,KAAK,MAAM,WAAW,MAAM,QAAQ,aAAa,IAAI,gBAAgB,gBAAgB,CAAC,aAAa,IAAI,CAAC,GAAG;IACvG,QAAQ,KAAK,SAAS,MAAM;IAC5B,SAAS,KAAK,OAAO;GACzB;GACA,oBAAoB,IAAI,IAAI,OAAO;GACnC,EAAE,KAAK,SAAS,qBAAqB,QAAQ,OAAO,KAAK,IAAI,KAAM,SAAS,kBAAkB,CAAC,EAAA,CAAI,KAAK,GAAG,OAAO;EACtH;CACJ;AACJ"}
|
|
1
|
+
{"version":3,"file":"attw.mjs","names":["DATA_FIRST_ARITY","EMPTY","Fn","Arr","DATA_FIRST_ARITY","DATA_FIRST_ARITY_3","Str","escapeLeadingUnderscores","Fn","DATA_FIRST_ARITY","Fn","escapeLeadingUnderscores","isRequireCall","DATA_FIRST_ARITY","Arr","Fn","DATA_FIRST_ARITY","Fn","declarationOfBinding","escapeLeadingUnderscores","DATA_FIRST_ARITY","Str","Arr","Fn","DATA_FIRST_ARITY_3","START","Fn","Str","FIRST","NEXT","Str","DATA_FIRST_ARITY","SEPARATOR","ROOT_LENGTH","NOT_FOUND","FIRST","SECOND","Str","Arr","Fn","forEachAncestorDirectory","DATA_FIRST_ARITY_3","EMPTY","Fn","Rec","DATA_FIRST_ARITY","RANGE_OPTIONS","Rec","Arr","Fn","DATA_FIRST_ARITY","DATA_FIRST_ARITY_3","Fn","DATA_FIRST_ARITY","DATA_FIRST_ARITY_3","EXPORT_PROPERTY","EXPORT_ALIAS","Str","Fn","escapeLeadingUnderscores","DATA_FIRST_ARITY","Arr","Fn","Arr","DATA_FIRST_ARITY_3","Arr","Fn","DATA_FIRST_ARITY_3","Arr","Fn","DATA_FIRST_ARITY","Fn","isRequireCall","Fn","Arr","ALIAS","DATA_FIRST_ARITY_3","isRequireCall","Fn","Arr","Arr","DATA_FIRST_ARITY","Arr","Fn","Str","DATA_FIRST_ARITY","Fn","packageJsonScopeOf","DATA_FIRST_ARITY","DATA_FIRST_ARITY_3","Arr","packageJsonScopeOf","getModeForUsageLocation","Fn","DATA_FIRST_ARITY_3","START","SECOND","Str","Arr","Fn","Rec","modeForUsage","getNameOfAccessExpression","DATA_FIRST_ARITY","NEXT","START","Str","Fn","DATA_FIRST_ARITY","Str","Arr","Fn","forEachAncestor","assignment","cjsParse","isModuleExports","getNameOfAccessExpression","entrypointResolutions","moduleKindDisagreement","exportDefaultDisagreement","namedExports","cjsOnlyExportsDefault","unexpectedModuleSyntax","internalResolutionError","Arr","DATA_FIRST_ARITY","Arr","escapeSymbolName","Fn","escapeLeadingUnderscores","Arr","NONE","escapeSymbolName","Arr","DATA_FIRST_ARITY","DATA_FIRST_ARITY_3","EMPTY","Str","reuseCachedWithTrace","Fn","forEachAncestorDirectory","Rec","Arr","DATA_FIRST_ARITY","DATA_FIRST_ARITY_3","STAR_LENGTH","START","Str","Fn","Arr","DATA_FIRST_ARITY","DATA_FIRST_ARITY_3","Fn","Arr","Str","DATA_FIRST_ARITY_3","EMPTY","Str","Arr","Rec","Fn","DATA_FIRST_ARITY_3","DATA_FIRST_ARITY","Str","Rec","Arr","Fn","DATA_FIRST_ARITY","START","Str","Arr","Fn","Rec","DATA_FIRST_ARITY","Fn","START","Str","DATA_FIRST_ARITY","DATA_FIRST_ARITY_3","Fn","Arr","DATA_FIRST_ARITY","Fn","DATA_FIRST_ARITY","DATA_FIRST_ARITY_3","EMPTY","Fn","DATA_FIRST_ARITY_3","Rec","Fn","DATA_FIRST_ARITY","EMPTY","Arr","forEachAncestorDirectory","Fn","DATA_FIRST_ARITY","DATA_FIRST_ARITY_3","EMPTY","Str","Fn","DATA_FIRST_ARITY","Arr","Fn","featuresFor","conditionsFor","DATA_FIRST_ARITY_3","Str","Fn","Arr","DATA_FIRST_ARITY","OUTSIDE_NODE_MODULES","Fn","DATA_FIRST_ARITY_3","MAX_NODE_MODULE_JS_DEPTH","TS_EXTENSIONS","JS_EXTENSIONS","Str","Arr","getModeForUsageLocation","Fn","DATA_FIRST_ARITY_3","Str","Arr","Fn","DATA_FIRST_ARITY","Fn","DATA_FIRST_ARITY","Fn","Str","Str","DATA_FIRST_ARITY","Arr","Fn","DATA_FIRST_ARITY","Fn","DATA_FIRST_ARITY","Fn","Fn","Arr","initCjsLexer","checks"],"sources":["../src/attw/flags.ts","../src/attw/binder-symbols.ts","../src/attw/binder-syntax.ts","../src/attw/binder-assignment.ts","../src/attw/binder-names.ts","../src/attw/messages.ts","../src/attw/text-search.ts","../src/attw/path-roots.ts","../src/attw/paths.ts","../src/attw/package-json-fields.ts","../src/attw/types-versions.ts","../src/attw/binder-declarations.ts","../src/attw/binder-cjs.ts","../src/attw/binder-scopes.ts","../src/attw/binder-jsdoc.ts","../src/attw/binder-expando-symbol.ts","../src/attw/binder-expando.ts","../src/attw/binder-module-exports.ts","../src/attw/binder-this.ts","../src/attw/binder-expressions.ts","../src/attw/binder-module-state.ts","../src/attw/binder-nodes.ts","../src/attw/binder-variables.ts","../src/attw/binder-walk.ts","../src/attw/binder.ts","../src/attw/extensions.ts","../src/attw/source-file.ts","../src/attw/module-mode.ts","../src/attw/resolution-mode-numbers.ts","../src/attw/ts-api.ts","../src/attw/typescript-files.ts","../src/attw/typescript-guards.ts","../src/attw/package-names.ts","../src/attw/path-compare.ts","../src/attw/typescript-paths.ts","../src/attw/typescript.ts","../upstream/attw-core/lib/internal/defineCheck.js","../upstream/attw-core/lib/internal/checks/cjsOnlyExportsDefault.js","../upstream/attw-core/lib/utils.js","../upstream/attw-core/lib/createPackage.js","../upstream/attw-core/lib/internal/esm/esmBindings.js","../upstream/attw-core/lib/internal/esm/cjsBindings.js","../upstream/attw-core/lib/internal/esm/resolve.js","../upstream/attw-core/lib/internal/esm/cjsNamespace.js","../upstream/attw-core/lib/internal/esm/esmNamespace.js","../upstream/attw-core/lib/internal/checks/namedExports.js","../upstream/attw-core/lib/internal/checks/entrypointResolutions.js","../upstream/attw-core/lib/internal/getProbableExports.js","../upstream/attw-core/lib/internal/checks/exportDefaultDisagreement.js","../upstream/attw-core/lib/internal/checks/internalResolutionError.js","../upstream/attw-core/lib/internal/checks/moduleKindDisagreement.js","../upstream/attw-core/lib/internal/checks/unexpectedModuleSyntax.js","../upstream/attw-core/lib/internal/checks/index.js","../upstream/attw-core/lib/internal/minimalLibDts.js","../src/attw/checker-session.ts","../src/attw/checker-symbols.ts","../src/attw/type-only.ts","../src/attw/checker.ts","../src/attw/package-json.ts","../src/attw/resolver-patterns.ts","../src/attw/resolver-files.ts","../src/attw/resolver-target.ts","../src/attw/resolver-exports.ts","../src/attw/paths-mapping.ts","../src/attw/resolver-directory.ts","../src/attw/node-modules-paths.ts","../src/attw/resolver-state.ts","../src/attw/resolver-relative.ts","../src/attw/resolver-package-loader.ts","../src/attw/resolver-package.ts","../src/attw/resolver-node-modules.ts","../src/attw/resolver-attempt.ts","../src/attw/resolver.ts","../src/attw/compiler-checker.ts","../src/attw/host-types.ts","../src/attw/program-build.ts","../src/attw/program-imports.ts","../src/attw/program.ts","../src/attw/compiler-program.ts","../src/attw/resolution-cache.ts","../src/attw/host-resolutions.ts","../src/attw/compiler-host-wrapper.ts","../src/attw/host-files.ts","../src/attw/host-sources.ts","../src/attw/type-reference-state.ts","../src/attw/type-reference.ts","../src/attw/host-wrapper.ts","../src/attw/compiler-hosts.ts","../upstream/attw-core/lib/internal/getEntrypointInfo.js","../upstream/attw-core/lib/checkPackage.js"],"sourcesContent":["import { Array as Arr, Function as Fn } from \"effect\";\n\nconst DATA_FIRST_ARITY = 2;\n\nexport const EMPTY = 0;\nconst SET_BIT = 1;\nconst BINARY = 2;\n\nconst sharedFlags = (left: number, right: number): number => {\n if (left === EMPTY || right === EMPTY) {\n return EMPTY;\n }\n const lowest = Number(left % BINARY === SET_BIT && right % BINARY === SET_BIT);\n return lowest + BINARY * sharedFlags(Math.floor(left / BINARY), Math.floor(right / BINARY));\n};\n\nexport const hasFlag: {\n (mask: number): (flags: number) => boolean;\n (flags: number, mask: number): boolean;\n} = Fn.dual(\n DATA_FIRST_ARITY,\n (flags: number, mask: number): boolean => sharedFlags(flags, mask) !== EMPTY,\n);\n\nexport const withFlags: {\n (mask: number): (flags: number) => number;\n (flags: number, mask: number): number;\n} = Fn.dual(\n DATA_FIRST_ARITY,\n (flags: number, mask: number): number => flags + mask - sharedFlags(flags, mask),\n);\n\nexport const withoutFlags: {\n (mask: number): (flags: number) => number;\n (flags: number, mask: number): number;\n} = Fn.dual(\n DATA_FIRST_ARITY,\n (flags: number, mask: number): number => flags - sharedFlags(flags, mask),\n);\n\nexport const combineFlags = (...masks: readonly number[]): number =>\n Arr.reduce(masks, EMPTY, withFlags);\n","import { Option, Predicate, String as Str, Function as Fn } from \"effect\";\nimport { NodeFlags, ScriptKind, SyntaxKind } from \"typescript/ast\";\nimport type { Node } from \"typescript/ast\";\nimport { isSourceFile } from \"typescript/ast/is\";\nimport { SymbolFlags } from \"typescript/sync\";\n\nimport { EMPTY, combineFlags, hasFlag, withFlags } from \"./flags.ts\";\n\nconst DATA_FIRST_ARITY = 2;\nconst DATA_FIRST_ARITY_3 = 3;\n\nexport interface BoundSymbol {\n flags: number;\n readonly escapedName: string;\n readonly name: string;\n declarations?: Node[];\n valueDeclaration?: Node;\n exports?: SymbolTable;\n members?: SymbolTable;\n parent?: BoundSymbol;\n exportSymbol?: BoundSymbol;\n}\n\nexport interface SymbolTable extends Map<string, BoundSymbol> {}\n\nexport interface SymbolDeclaration {\n readonly table: Option.Option<SymbolTable>;\n readonly parent: Option.Option<BoundSymbol>;\n readonly node: Node;\n readonly name: Option.Option<string>;\n readonly includes: number;\n readonly excludes: number;\n}\n\nconst UNDERSCORE = \"_\";\nconst DOUBLE_UNDERSCORE = \"__\";\nconst TRIPLE_UNDERSCORE = \"___\";\nconst MISSING_NAME = \"__missing\";\n\nexport const unescapeLeadingUnderscores = (name: string): string => {\n if (Str.startsWith(TRIPLE_UNDERSCORE)(name)) {\n return Str.slice(UNDERSCORE.length)(name);\n }\n return name;\n};\n\nexport const escapeLeadingUnderscores = (name: string): string => {\n if (Str.startsWith(DOUBLE_UNDERSCORE)(name)) {\n return `${UNDERSCORE}${name}`;\n }\n return name;\n};\n\nexport const createSymbol: {\n (escapedName: string): (flags: number) => BoundSymbol;\n (flags: number, escapedName: string): BoundSymbol;\n} = Fn.dual(DATA_FIRST_ARITY, (flags: number, escapedName: string): BoundSymbol => ({\n flags,\n escapedName,\n name: unescapeLeadingUnderscores(escapedName),\n}));\n\nconst isInJsFileNode = (node: Node): boolean => {\n let current = node;\n while (!isSourceFile(current)) {\n current = current.parent;\n }\n return current.scriptKind === ScriptKind.JS || current.scriptKind === ScriptKind.JSX;\n};\n\nconst isAmbientNode = (node: Node): boolean => hasFlag(node.flags, NodeFlags.Ambient);\n\nconst ASSIGNMENT_DECLARATION_KINDS: ReadonlySet<SyntaxKind> = new Set([\n SyntaxKind.BinaryExpression,\n SyntaxKind.PropertyAccessExpression,\n SyntaxKind.ElementAccessExpression,\n SyntaxKind.Identifier,\n SyntaxKind.CallExpression,\n]);\n\nconst isAssignmentDeclarationNode = (node: Node): boolean =>\n ASSIGNMENT_DECLARATION_KINDS.has(node.kind);\n\nconst isEffectiveModuleDeclaration = (node: Node): boolean =>\n node.kind === SyntaxKind.ModuleDeclaration || node.kind === SyntaxKind.Identifier;\n\nconst isAmbientOverride = (existing: Node, node: Node): boolean =>\n isAmbientNode(node) && !isInJsFileNode(node) && !isAmbientNode(existing);\n\nconst replacesAssignmentDeclaration = (existing: Node, node: Node): boolean =>\n !isAmbientOverride(existing, node) &&\n isAssignmentDeclarationNode(existing) &&\n !isAssignmentDeclarationNode(node);\n\nconst replacesModuleDeclaration = (existing: Node, node: Node): boolean =>\n existing.kind !== node.kind && isEffectiveModuleDeclaration(existing);\n\nconst replacesValueDeclaration = (existing: Node, node: Node): boolean =>\n replacesAssignmentDeclaration(existing, node) || replacesModuleDeclaration(existing, node);\n\nexport const setValueDeclaration: {\n (node: Node): (symbol: BoundSymbol) => void;\n (symbol: BoundSymbol, node: Node): void;\n} = Fn.dual(DATA_FIRST_ARITY, (symbol: BoundSymbol, node: Node): void => {\n const existing = symbol.valueDeclaration;\n if (Predicate.isUndefined(existing) || replacesValueDeclaration(existing, node)) {\n symbol.valueDeclaration = node;\n }\n});\n\nconst EXPORT_TABLE_FLAGS = combineFlags(\n SymbolFlags.Class,\n SymbolFlags.Enum,\n SymbolFlags.Module,\n SymbolFlags.Variable,\n);\n\nconst MEMBER_TABLE_FLAGS = combineFlags(\n SymbolFlags.Class,\n SymbolFlags.Interface,\n SymbolFlags.TypeLiteral,\n SymbolFlags.ObjectLiteral,\n);\n\nconst recordDeclaration = (symbol: BoundSymbol, node: Node): void => {\n const declarations = symbol.declarations ?? [];\n if (!declarations.includes(node)) {\n declarations.push(node);\n }\n symbol.declarations = declarations;\n};\n\nconst DECLARATION_EFFECTS: readonly (readonly [\n required: number,\n apply: (symbol: BoundSymbol, node: Node) => void,\n])[] = [\n [\n EXPORT_TABLE_FLAGS,\n (symbol) => {\n symbol.exports ??= new Map();\n },\n ],\n [\n MEMBER_TABLE_FLAGS,\n (symbol) => {\n symbol.members ??= new Map();\n },\n ],\n [\n SymbolFlags.Value,\n (symbol, node) => {\n setValueDeclaration(symbol, node);\n },\n ],\n];\n\nexport const addDeclarationToSymbol: {\n (node: Node, flags: number): (symbol: BoundSymbol) => void;\n (symbol: BoundSymbol, node: Node, flags: number): void;\n} = Fn.dual(DATA_FIRST_ARITY_3, (symbol: BoundSymbol, node: Node, flags: number): void => {\n symbol.flags = withFlags(symbol.flags, flags);\n recordDeclaration(symbol, node);\n for (const [required, apply] of DECLARATION_EFFECTS) {\n if (hasFlag(flags, required)) {\n apply(symbol, node);\n }\n }\n});\n\nconst conflicts = (found: BoundSymbol, declaration: SymbolDeclaration): boolean =>\n hasFlag(found.flags, declaration.excludes) &&\n !(\n hasFlag(declaration.includes, SymbolFlags.Variable) &&\n hasFlag(found.flags, SymbolFlags.Assignment)\n );\n\nconst symbolInTable = (\n table: SymbolTable,\n name: string,\n declaration: SymbolDeclaration,\n): BoundSymbol => {\n const found = table.get(name);\n if (Predicate.isUndefined(found)) {\n const created = createSymbol(EMPTY, name);\n table.set(name, created);\n return created;\n }\n if (conflicts(found, declaration)) {\n return createSymbol(EMPTY, name);\n }\n return found;\n};\n\nexport const exportOf: {\n (name: string): (owner: BoundSymbol) => Option.Option<BoundSymbol>;\n (owner: BoundSymbol, name: string): Option.Option<BoundSymbol>;\n} = Fn.dual(DATA_FIRST_ARITY, (owner: BoundSymbol, name: string): Option.Option<BoundSymbol> =>\n Option.flatMap(Option.fromNullishOr(owner.exports), (table) =>\n Option.fromNullishOr(table.get(name)),\n ),\n);\n\nexport const declareSymbol = (declaration: SymbolDeclaration): BoundSymbol => {\n const symbol = Option.getOrElse(\n Option.zipWith(declaration.table, declaration.name, (table, name) =>\n symbolInTable(table, name, declaration),\n ),\n () => createSymbol(EMPTY, MISSING_NAME),\n );\n addDeclarationToSymbol(symbol, declaration.node, declaration.includes);\n if (Predicate.isUndefined(symbol.parent) && Option.isSome(declaration.parent)) {\n symbol.parent = declaration.parent.value;\n }\n return symbol;\n};\n","import { Option, Function as Fn } from \"effect\";\nimport { SyntaxKind } from \"typescript/ast\";\nimport type {\n BinaryExpression,\n CallExpression,\n ElementAccessExpression,\n Identifier,\n NoSubstitutionTemplateLiteral,\n Node,\n NumericLiteral,\n PropertyAccessExpression,\n StringLiteral,\n} from \"typescript/ast\";\nimport {\n isBinaryExpression,\n isCallExpression,\n isElementAccessExpression,\n isIdentifier,\n isNumericLiteral,\n isParenthesizedExpression,\n isPrefixUnaryExpression,\n isPropertyAccessExpression,\n isStringLiteralLikeNode,\n isVoidExpression,\n} from \"typescript/ast/is\";\n\nimport { escapeLeadingUnderscores } from \"./binder-symbols.ts\";\n\nconst DATA_FIRST_ARITY = 2;\n\nexport type AccessExpression = PropertyAccessExpression | ElementAccessExpression;\nexport type LiteralLike = StringLiteral | NoSubstitutionTemplateLiteral | NumericLiteral;\n\nconst REQUIRE_ARGUMENTS = 1;\nconst DEFINE_PROPERTY_ARGUMENTS = 3;\nconst ZERO_TEXT = \"0\";\n\nexport const isStringOrNumericLiteralLike = (node: Node): node is LiteralLike =>\n isStringLiteralLikeNode(node) || isNumericLiteral(node);\n\nexport const isAccessExpression = (node: Node): node is AccessExpression =>\n isPropertyAccessExpression(node) || isElementAccessExpression(node);\n\nexport const isThisKeyword = (node: Node): boolean => node.kind === SyntaxKind.ThisKeyword;\n\nexport const skipParentheses = (node: Node): Node => {\n let current = node;\n while (isParenthesizedExpression(current)) {\n current = current.expression;\n }\n return current;\n};\n\nconst isEntityNameExpression = (node: Node): boolean =>\n isIdentifier(node) ||\n (isPropertyAccessExpression(node) &&\n isIdentifier(node.name) &&\n isEntityNameExpression(node.expression));\n\nconst isLiteralLikeElementAccess = (node: Node): node is ElementAccessExpression =>\n isElementAccessExpression(node) && isStringOrNumericLiteralLike(node.argumentExpression);\n\nexport interface BindableStaticRules {\n readonly excludeThisKeyword: boolean;\n readonly allowEntityName: boolean;\n}\n\nexport const STATIC_ACCESS: BindableStaticRules = {\n excludeThisKeyword: false,\n allowEntityName: false,\n};\nexport const STATIC_NAME: BindableStaticRules = { excludeThisKeyword: true, allowEntityName: true };\n\nconst isAllowedEntityName = (node: Node, rules: BindableStaticRules): boolean =>\n rules.allowEntityName && isEntityNameExpression(node);\n\nconst isStaticAccess = (node: Node): node is AccessExpression =>\n isPropertyAccessExpression(node) || isLiteralLikeElementAccess(node);\n\nconst hasStaticName = (node: AccessExpression): boolean =>\n !isPropertyAccessExpression(node) || isIdentifier(node.name);\n\nconst isAllowedThis = (node: Node, rules: BindableStaticRules): boolean =>\n !rules.excludeThisKeyword && isThisKeyword(node);\n\nconst hasBindableOwner = (\n node: AccessExpression,\n rules: BindableStaticRules,\n isBindable: (owner: Node, ownerRules: BindableStaticRules) => boolean,\n): boolean =>\n isAllowedThis(node.expression, rules) ||\n (hasStaticName(node) && isBindable(node.expression, STATIC_NAME));\n\nexport const isBindableStatic: {\n (rules: BindableStaticRules): (node: Node) => boolean;\n (node: Node, rules: BindableStaticRules): boolean;\n} = Fn.dual(\n DATA_FIRST_ARITY,\n (node: Node, rules: BindableStaticRules): boolean =>\n isAllowedEntityName(node, rules) ||\n (isStaticAccess(node) && hasBindableOwner(node, rules, isBindableStatic)),\n);\n\nexport const nameText = (node: Node): Option.Option<string> => {\n if (isIdentifier(node) || isStringOrNumericLiteralLike(node)) {\n return Option.some(node.text);\n }\n return Option.none();\n};\n\nexport const getElementOrPropertyAccessName = (node: AccessExpression): Option.Option<string> => {\n if (isPropertyAccessExpression(node)) {\n return nameText(node.name).pipe(Option.map(escapeLeadingUnderscores));\n }\n return Option.liftPredicate(\n skipParentheses(node.argumentExpression),\n isStringOrNumericLiteralLike,\n ).pipe(Option.map((literal) => escapeLeadingUnderscores(literal.text)));\n};\n\nexport const isNamedIdentifier: {\n (name: string): (node: Node) => node is Identifier;\n (node: Node, name: string): node is Identifier;\n} = Fn.dual(\n DATA_FIRST_ARITY,\n (node: Node, name: string): node is Identifier => isIdentifier(node) && node.text === name,\n);\n\nexport const isExportsIdentifier = (node: Node): boolean =>\n isIdentifier(node) && node.text === \"exports\";\n\nexport const isModuleExportsAccessExpression = (node: Node): boolean =>\n (isPropertyAccessExpression(node) || isLiteralLikeElementAccess(node)) &&\n isNamedIdentifier(node.expression, \"module\") &&\n Option.contains(getElementOrPropertyAccessName(node), \"exports\");\n\nconst hasRequireArgument = (node: CallExpression, requireStringLiteral: boolean): boolean => {\n const [argument] = node.arguments;\n return (\n node.arguments.length === REQUIRE_ARGUMENTS &&\n (!requireStringLiteral ||\n Option.fromNullishOr(argument).pipe(Option.exists((value) => isStringLiteralLikeNode(value))))\n );\n};\n\nexport const isRequireCall: {\n (requireStringLiteral: boolean): (node: Node) => node is CallExpression;\n (node: Node, requireStringLiteral: boolean): node is CallExpression;\n} = Fn.dual(\n DATA_FIRST_ARITY,\n (node: Node, requireStringLiteral: boolean): node is CallExpression =>\n isCallExpression(node) &&\n isNamedIdentifier(node.expression, \"require\") &&\n hasRequireArgument(node, requireStringLiteral),\n);\n\nexport const isAssignmentExpression = (node: Node): node is BinaryExpression =>\n isBinaryExpression(node) && node.operatorToken.kind === SyntaxKind.EqualsToken;\n\nexport const getRightMostAssignedExpression = (node: Node): Node => {\n let current = node;\n while (isAssignmentExpression(current)) {\n current = current.right;\n }\n return current;\n};\n\nexport const isVoidZero = (node: Node): boolean =>\n isVoidExpression(node) && isNumericLiteral(node.expression) && node.expression.text === ZERO_TEXT;\n\nconst isSignedNumericLiteral = (node: Node): boolean =>\n isPrefixUnaryExpression(node) &&\n (node.operator === SyntaxKind.PlusToken || node.operator === SyntaxKind.MinusToken) &&\n isNumericLiteral(node.operand);\n\nexport const isDynamicElementAccess = (node: Node): boolean => {\n if (!isElementAccessExpression(node)) {\n return false;\n }\n const argument = skipParentheses(node.argumentExpression);\n return !isStringOrNumericLiteralLike(argument) && !isSignedNumericLiteral(argument);\n};\n\nconst isObjectDefinePropertyCallee = (node: Node): boolean =>\n isPropertyAccessExpression(node) &&\n isNamedIdentifier(node.expression, \"Object\") &&\n isNamedIdentifier(node.name, \"defineProperty\");\n\nexport const isBindableObjectDefinePropertyCall = (node: CallExpression): boolean => {\n const [target, property] = node.arguments;\n return (\n node.arguments.length === DEFINE_PROPERTY_ARGUMENTS &&\n isObjectDefinePropertyCallee(node.expression) &&\n Option.exists(Option.fromNullishOr(property), isStringOrNumericLiteralLike) &&\n Option.exists(Option.fromNullishOr(target), (value) => isBindableStatic(value, STATIC_NAME))\n );\n};\n\nexport const isAliasableExpression = (node: Node): boolean =>\n isEntityNameExpression(node) || node.kind === SyntaxKind.ClassExpression;\n","import { Option, Function as Fn, Array as Arr } from \"effect\";\nimport { SyntaxKind } from \"typescript/ast\";\nimport type { BinaryExpression, CallExpression, Node } from \"typescript/ast\";\nimport { isBinaryExpression, isCallExpression, isObjectLiteralExpression } from \"typescript/ast/is\";\n\nimport {\n STATIC_ACCESS,\n STATIC_NAME,\n getElementOrPropertyAccessName,\n getRightMostAssignedExpression,\n isAccessExpression,\n isBindableObjectDefinePropertyCall,\n isBindableStatic,\n isDynamicElementAccess,\n isExportsIdentifier,\n isModuleExportsAccessExpression,\n isNamedIdentifier,\n isThisKeyword,\n isVoidZero,\n} from \"./binder-syntax.ts\";\nimport type { AccessExpression } from \"./binder-syntax.ts\";\n\nconst DATA_FIRST_ARITY = 2;\n\nexport const AssignmentKind = {\n None: \"None\",\n ExportsProperty: \"ExportsProperty\",\n ModuleExports: \"ModuleExports\",\n PrototypeProperty: \"PrototypeProperty\",\n ThisProperty: \"ThisProperty\",\n Property: \"Property\",\n Prototype: \"Prototype\",\n ObjectDefinePropertyValue: \"ObjectDefinePropertyValue\",\n ObjectDefinePropertyExports: \"ObjectDefinePropertyExports\",\n ObjectDefinePrototypeProperty: \"ObjectDefinePrototypeProperty\",\n} as const;\n\nexport type AssignmentDeclarationKind = (typeof AssignmentKind)[keyof typeof AssignmentKind];\n\nconst PROTOTYPE = \"prototype\";\n\nexport const isPrototypeAccess = (node: Node): boolean =>\n isAccessExpression(node) &&\n isBindableStatic(node, STATIC_ACCESS) &&\n Option.contains(getElementOrPropertyAccessName(node), PROTOTYPE);\n\nconst definePropertyTargetKind = (target: Node): AssignmentDeclarationKind => {\n if (isExportsIdentifier(target) || isModuleExportsAccessExpression(target)) {\n return AssignmentKind.ObjectDefinePropertyExports;\n }\n if (isPrototypeAccess(target)) {\n return AssignmentKind.ObjectDefinePrototypeProperty;\n }\n return AssignmentKind.ObjectDefinePropertyValue;\n};\n\nconst callAssignmentKind = (node: CallExpression): AssignmentDeclarationKind => {\n const [target] = node.arguments;\n if (!isBindableObjectDefinePropertyCall(node)) {\n return AssignmentKind.None;\n }\n return Option.match(Option.fromNullishOr(target), {\n onNone: () => AssignmentKind.None,\n onSome: definePropertyTargetKind,\n });\n};\n\nconst leftmostAccess = (node: AccessExpression): AccessExpression => {\n let current = node;\n while (isAccessExpression(current.expression)) {\n current = current.expression;\n }\n return current;\n};\n\nconst isExportsTarget = (nextToLast: AccessExpression): boolean =>\n isNamedIdentifier(nextToLast.expression, \"exports\") ||\n (isNamedIdentifier(nextToLast.expression, \"module\") &&\n Option.contains(getElementOrPropertyAccessName(nextToLast), \"exports\"));\n\ntype KindRule<Subject> = readonly [\n matches: (subject: Subject) => boolean,\n kind: AssignmentDeclarationKind,\n];\n\nconst firstMatchingKind = <Subject>(\n rules: readonly KindRule<Subject>[],\n subject: Subject,\n): AssignmentDeclarationKind =>\n Arr.findFirst(rules, ([matches]) => matches(subject)).pipe(\n Option.map(([, kind]) => kind),\n Option.getOrElse((): AssignmentDeclarationKind => AssignmentKind.None),\n );\n\nconst isExportsProperty = (left: AccessExpression): boolean =>\n isExportsTarget(leftmostAccess(left)) && isBindableStatic(left, STATIC_ACCESS);\n\nconst isNamedProperty = (left: AccessExpression): boolean =>\n isBindableStatic(left, STATIC_NAME) || isDynamicElementAccess(left);\n\nconst STATIC_NAME_KINDS: readonly KindRule<AccessExpression>[] = [\n [(left) => isPrototypeAccess(left.expression), AssignmentKind.PrototypeProperty],\n [isExportsProperty, AssignmentKind.ExportsProperty],\n [isNamedProperty, AssignmentKind.Property],\n];\n\nconst staticNamePropertyKind = (left: AccessExpression): AssignmentDeclarationKind =>\n firstMatchingKind(STATIC_NAME_KINDS, left);\n\nconst propertyAccessKind = (left: AccessExpression): AssignmentDeclarationKind => {\n if (isThisKeyword(left.expression)) {\n return AssignmentKind.ThisProperty;\n }\n if (isModuleExportsAccessExpression(left)) {\n return AssignmentKind.ModuleExports;\n }\n if (isBindableStatic(left.expression, STATIC_NAME)) {\n return staticNamePropertyKind(left);\n }\n return AssignmentKind.None;\n};\n\nconst initializerOfBinary = (node: BinaryExpression): Node => {\n let current = node;\n while (isBinaryExpression(current.right)) {\n current = current.right;\n }\n return current.right;\n};\n\nconst isPrototypeObjectAssignment = (node: BinaryExpression, left: AccessExpression): boolean =>\n isBindableStatic(left.expression, STATIC_NAME) &&\n Option.contains(getElementOrPropertyAccessName(left), PROTOTYPE) &&\n isObjectLiteralExpression(initializerOfBinary(node));\n\nconst isPlainAssignment = (node: BinaryExpression): boolean =>\n node.operatorToken.kind === SyntaxKind.EqualsToken &&\n !isVoidZero(getRightMostAssignedExpression(node));\n\nconst assignedAccess = (node: BinaryExpression): Option.Option<AccessExpression> =>\n Option.liftPredicate(node.left, isAccessExpression).pipe(\n Option.filter(() => isPlainAssignment(node)),\n );\n\nconst accessAssignmentKind = (\n node: BinaryExpression,\n left: AccessExpression,\n): AssignmentDeclarationKind => {\n if (isPrototypeObjectAssignment(node, left)) {\n return AssignmentKind.Prototype;\n }\n return propertyAccessKind(left);\n};\n\nconst binaryAssignmentKind = (node: BinaryExpression): AssignmentDeclarationKind =>\n assignedAccess(node).pipe(\n Option.map((left) => accessAssignmentKind(node, left)),\n Option.getOrElse((): AssignmentDeclarationKind => AssignmentKind.None),\n );\n\nexport const getAssignmentDeclarationKind: {\n (inJsFile: boolean): (node: BinaryExpression | CallExpression) => AssignmentDeclarationKind;\n (node: BinaryExpression | CallExpression, inJsFile: boolean): AssignmentDeclarationKind;\n} = Fn.dual(\n DATA_FIRST_ARITY,\n (node: BinaryExpression | CallExpression, inJsFile: boolean): AssignmentDeclarationKind => {\n const kind = Option.match(Option.liftPredicate(node, isCallExpression), {\n onNone: () =>\n Option.match(Option.liftPredicate(node, isBinaryExpression), {\n onNone: () => AssignmentKind.None,\n onSome: binaryAssignmentKind,\n }),\n onSome: callAssignmentKind,\n });\n if (kind === AssignmentKind.Property || inJsFile) {\n return kind;\n }\n return AssignmentKind.None;\n },\n);\n","import { Option, Predicate, Function as Fn } from \"effect\";\nimport { ModifierFlags, SyntaxKind } from \"typescript/ast\";\nimport type { BinaryExpression, CallExpression, ModuleDeclaration, Node } from \"typescript/ast\";\nimport {\n isBinaryExpression,\n isBindingElement,\n isCallExpression,\n isExportAssignment,\n isExportDeclaration,\n isIdentifier,\n isModuleDeclaration,\n isPropertyAccessExpression,\n isStringLiteral,\n isVariableDeclaration,\n isVariableStatement,\n} from \"typescript/ast/is\";\n\nimport { AssignmentKind, getAssignmentDeclarationKind } from \"./binder-assignment.ts\";\nimport { escapeLeadingUnderscores } from \"./binder-symbols.ts\";\nimport {\n getElementOrPropertyAccessName,\n isAccessExpression,\n isStringOrNumericLiteralLike,\n nameText,\n} from \"./binder-syntax.ts\";\nimport type { AccessExpression } from \"./binder-syntax.ts\";\nimport { EMPTY, hasFlag, withFlags } from \"./flags.ts\";\n\nconst DATA_FIRST_ARITY = 2;\n\nexport const isNodeValue = (value: unknown): value is Node =>\n Predicate.hasProperty(value, \"kind\") && Predicate.isNumber(value.kind);\n\nconst declaredName = (node: Node): Option.Option<Node> => {\n if (\"name\" in node && isNodeValue(node.name)) {\n return Option.some(node.name);\n }\n return Option.none();\n};\n\nconst syntacticModifierFlags = (node: Node): number => {\n if (\"modifierFlags\" in node && Predicate.isNumber(node.modifierFlags)) {\n return node.modifierFlags;\n }\n return EMPTY;\n};\n\nexport const hasSyntacticModifier: {\n (flag: number): (node: Node) => boolean;\n (node: Node, flag: number): boolean;\n} = Fn.dual(DATA_FIRST_ARITY, (node: Node, flag: number): boolean =>\n hasFlag(syntacticModifierFlags(node), flag),\n);\n\nconst declarationOfBinding = (node: Node): Node => {\n let current = node;\n while (isBindingElement(current)) {\n current = current.parent.parent;\n }\n return current;\n};\n\nconst combinedModifierFlags = (node: Node): number => {\n const declaration = declarationOfBinding(node);\n const own = syntacticModifierFlags(declaration);\n if (!isVariableDeclaration(declaration)) {\n return own;\n }\n const list = declaration.parent;\n const withList = withFlags(own, syntacticModifierFlags(list));\n if (isVariableStatement(list.parent)) {\n return withFlags(withList, syntacticModifierFlags(list.parent));\n }\n return withList;\n};\n\nexport const hasExportModifier = (node: Node): boolean =>\n hasFlag(combinedModifierFlags(node), ModifierFlags.Export);\n\nconst nameOfAccess = (node: AccessExpression): Node => {\n if (isPropertyAccessExpression(node)) {\n return node.name;\n }\n if (isStringOrNumericLiteralLike(node.argumentExpression)) {\n return node.argumentExpression;\n }\n return node;\n};\n\nconst assignmentName = (node: BinaryExpression, inJsFile: boolean): Option.Option<Node> => {\n const kind = getAssignmentDeclarationKind(node, inJsFile);\n if (kind === AssignmentKind.ModuleExports || kind === AssignmentKind.None) {\n return Option.none();\n }\n return Option.map(Option.liftPredicate(node.left, isAccessExpression), nameOfAccess);\n};\n\nconst definedPropertyName = (node: CallExpression): Option.Option<Node> => {\n const [, property] = node.arguments;\n return Option.fromNullishOr(property);\n};\n\nconst nameOfNamedNode = (node: Node): Option.Option<Node> => {\n if (isAccessExpression(node)) {\n return Option.some(nameOfAccess(node));\n }\n if (isExportDeclaration(node)) {\n return Option.none();\n }\n return declaredName(node);\n};\n\nconst nameOfDeclaration = (node: Node, inJsFile: boolean): Option.Option<Node> => {\n if (isBinaryExpression(node)) {\n return assignmentName(node, inJsFile);\n }\n if (isCallExpression(node)) {\n return definedPropertyName(node);\n }\n return nameOfNamedNode(node);\n};\n\nconst isGlobalScopeAugmentation = (node: ModuleDeclaration): boolean =>\n isIdentifier(node.name) &&\n node.name.text === \"global\" &&\n node.keyword !== SyntaxKind.NamespaceKeyword;\n\nexport const isAmbientModule = (node: Node): node is ModuleDeclaration =>\n isModuleDeclaration(node) && (isStringLiteral(node.name) || isGlobalScopeAugmentation(node));\n\nconst ambientModuleName = (name: Node): string => {\n if (isIdentifier(name)) {\n return \"__global\";\n }\n return `\"${Option.getOrElse(nameText(name), () => \"\")}\"`;\n};\n\nconst nameOfNamedDeclaration = (node: Node, name: Node): Option.Option<string> => {\n if (isAmbientModule(node)) {\n return Option.some(ambientModuleName(name));\n }\n if (isAccessExpression(name)) {\n return getElementOrPropertyAccessName(name);\n }\n return Option.map(nameText(name), escapeLeadingUnderscores);\n};\n\nconst unnamedDeclarationName = (node: Node): Option.Option<string> => {\n if (node.kind === SyntaxKind.ExportDeclaration) {\n return Option.some(\"__export\");\n }\n if (node.kind === SyntaxKind.SourceFile || node.kind === SyntaxKind.BinaryExpression) {\n return Option.some(\"export=\");\n }\n return Option.none();\n};\n\nexport const declarationName: {\n (inJsFile: boolean): (node: Node) => Option.Option<string>;\n (node: Node, inJsFile: boolean): Option.Option<string>;\n} = Fn.dual(DATA_FIRST_ARITY, (node: Node, inJsFile: boolean): Option.Option<string> => {\n if (isExportAssignment(node)) {\n return Option.some(\n Option.match(\n Option.liftPredicate(node, () => node.isExportEquals),\n {\n onNone: () => \"default\",\n onSome: () => \"export=\",\n },\n ),\n );\n }\n return Option.match(nameOfDeclaration(node, inJsFile), {\n onNone: () => unnamedDeclarationName(node),\n onSome: (name) => nameOfNamedDeclaration(node, name),\n });\n});\n","import { Array as Arr, Option, String as Str, Function as Fn, pipe } from \"effect\";\n\nimport type { ResolutionState, TraceSink } from \"./resolution-types.ts\";\n\nconst DATA_FIRST_ARITY = 2;\n\nexport const Messages = {\n directoryDoesNotExist: \"Directory '{0}' does not exist, skipping all lookups in it.\",\n directoryHasNoPackageScope:\n \"Directory '{0}' has no containing package.json scope. Imports will not resolve.\",\n enteringConditionalExports: \"Entering conditional exports.\",\n exitingConditionalExports: \"Exiting conditional exports.\",\n expectedFieldType: \"Expected type of '{0}' field in 'package.json' to be '{1}', got '{2}'.\",\n explicitResolutionKind: \"Explicitly specified module resolution kind: '{0}'.\",\n exportSpecifierDoesNotExist:\n \"Export specifier '{0}' does not exist in package.json scope at path '{1}'.\",\n failedToFindPeerDependency: \"Failed to find peerDependency '{0}'.\",\n failedUnderCondition: \"Failed to resolve under condition '{0}'.\",\n fileDoesNotExist: \"File '{0}' does not exist.\",\n fileDoesNotExistCached: \"File '{0}' does not exist according to earlier cached lookups.\",\n fileExistsCached: \"File '{0}' exists according to earlier cached lookups.\",\n fileExistsUseIt: \"File '{0}' exists - use it as a name resolution result.\",\n fileHasExtensionStripping: \"File name '{0}' has a '{1}' extension - stripping it.\",\n foundPackageJson: \"Found 'package.json' at '{0}'.\",\n foundPeerDependency: \"Found peerDependency '{0}' with '{1}' version.\",\n importSpecifierDoesNotExist:\n \"Import specifier '{0}' does not exist in package.json scope at path '{1}'.\",\n invalidImportSpecifier: \"Invalid import specifier '{0}' has no possible resolutions.\",\n loadingFromNodeModules:\n \"Loading module '{0}' from 'node_modules' folder, target file types: {1}.\",\n loadingAsFileOrFolder:\n \"Loading module as file / folder, candidate module location '{0}', target file types: {1}.\",\n lookingUpInNodeModules: \"Looking up in 'node_modules' folder, initial location '{0}'.\",\n matchedCondition: \"Matched '{0}' condition '{1}'.\",\n matchedPattern: \"Module name '{0}', matched pattern '{1}'.\",\n moduleNotResolved: \"======== Module name '{0}' was not resolved. ========\",\n moduleResolved: \"======== Module name '{0}' was successfully resolved to '{1}'. ========\",\n moduleResolvedWithPackageId:\n \"======== Module name '{0}' was successfully resolved to '{1}' with Package ID '{2}'. ========\",\n resolutionFoundInCache: \"Resolution for module '{0}' was found in cache from location '{1}'.\",\n retryWithoutModernFeatures:\n \"Resolution of non-relative name failed; trying with modern Node resolution features disabled to see if npm library needs configuration update.\",\n retryWithBundler:\n \"Resolution of non-relative name failed; trying with '--moduleResolution bundler' to see if project may need configuration update.\",\n resolvedUnderCondition: \"Resolved under condition '{0}'.\",\n resolvingInMode: \"Resolving in {0} mode with conditions {1}.\",\n resolvingModule: \"======== Resolving module '{0}' from '{1}'. ========\",\n resolvingTypeReference:\n \"======== Resolving type reference directive '{0}', containing file '{1}', root directory '{2}'. ========\",\n resolvingWithPrimarySearchPath: \"Resolving with primary search path '{0}'.\",\n sawNonMatchingCondition: \"Saw non-matching condition '{0}'.\",\n scopedPackageDetected: \"Scoped package detected, looking in '{0}'\",\n searchingFallbackExtensions:\n \"Searching all ancestor node_modules directories for fallback extensions: {0}.\",\n searchingPreferredExtensions:\n \"Searching all ancestor node_modules directories for preferred extensions: {0}.\",\n skippingAbsoluteUri:\n \"Skipping module '{0}' that looks like an absolute URI, target file types: {1}.\",\n tryingSubstitution: \"Trying substitution '{0}', candidate module location: '{1}'.\",\n typeReferenceNotResolved: \"======== Type reference directive '{0}' was not resolved. ========\",\n usingSubpath: \"Using '{0}' subpath '{1}' with target '{2}'.\",\n packageJsonMissingField: \"'package.json' does not have a '{0}' field.\",\n packageJsonNoMatchingTypesVersions:\n \"'package.json' does not have a 'typesVersions' entry that matches version '{0}'.\",\n packageJsonFalsyField: \"'package.json' had a falsy '{0}' field.\",\n packageJsonFieldReferences: \"'package.json' has '{0}' field '{1}' that references '{2}'.\",\n packageJsonHasPeerDependencies: \"'package.json' has a 'peerDependencies' field.\",\n packageJsonInvalidTypesVersionsRange:\n \"'package.json' has a 'typesVersions' entry '{0}' that is not a valid semver range.\",\n packageJsonTypesVersionsMatch:\n \"'package.json' has a 'typesVersions' entry '{0}' that matches compiler version '{1}', looking for a pattern to match module name '{2}'.\",\n packageJsonHasTypesVersions:\n \"'package.json' has a 'typesVersions' field with version-specific path mappings.\",\n packageJsonMapsToNull: \"package.json scope '{0}' explicitly maps specifier '{1}' to null.\",\n packageJsonInvalidTarget:\n \"package.json scope '{0}' has invalid type for target of specifier '{1}'\",\n packageJsonNoImports: \"package.json scope '{0}' has no imports defined.\",\n} as const;\n\nexport type Message = (typeof Messages)[keyof typeof Messages];\n\nconst PLACEHOLDER = /\\{(?<index>\\d+)\\}/u;\nconst PLACEHOLDER_STEP = 2;\nconst TEXT_PART = 0;\n\nconst filled =\n (args: readonly string[]) =>\n (part: string, position: number): string => {\n if (position % PLACEHOLDER_STEP === TEXT_PART) {\n return part;\n }\n return args[Number(part)] ?? `{${part}}`;\n };\n\nexport const formatMessage = (message: Message, ...args: readonly string[]): string =>\n pipe(Str.split(message, PLACEHOLDER), Arr.map(filled(args)), Arr.join(\"\"));\n\nexport const emitTrace: {\n (message: string): (trace: Option.Option<TraceSink>) => void;\n (trace: Option.Option<TraceSink>, message: string): void;\n} = Fn.dual(DATA_FIRST_ARITY, (trace: Option.Option<TraceSink>, message: string): void => {\n for (const sink of Option.toArray(trace)) {\n sink(message);\n }\n});\n\nexport const traceMessage = (\n state: Pick<ResolutionState, \"trace\">,\n message: Message,\n ...args: readonly string[]\n): void => {\n emitTrace(state.trace, formatMessage(message, ...args));\n};\n","import { Function as Fn, Option, String as Str } from \"effect\";\n\nconst DATA_FIRST_ARITY_3 = 3;\nconst START = 0;\n\nexport const indexFrom: {\n (search: string, from: number): (text: string) => Option.Option<number>;\n (text: string, search: string, from: number): Option.Option<number>;\n} = Fn.dual(\n DATA_FIRST_ARITY_3,\n (text: string, search: string, from: number): Option.Option<number> =>\n Option.map(Str.indexOf(search)(Str.slice(from)(text)), (found) => found + from),\n);\n\nexport const lastIndexUpTo: {\n (search: string, position: number): (text: string) => Option.Option<number>;\n (text: string, search: string, position: number): Option.Option<number>;\n} = Fn.dual(\n DATA_FIRST_ARITY_3,\n (text: string, search: string, position: number): Option.Option<number> =>\n Str.lastIndexOf(search)(Str.slice(START, Math.max(position, START) + search.length)(text)),\n);\n","import { Option, Predicate, String as Str } from \"effect\";\n\nimport { indexFrom } from \"./text-search.ts\";\n\ninterface PathRoot {\n readonly length: number;\n readonly isUrl: boolean;\n}\n\nconst FIRST = 0;\nconst NEXT = 1;\nconst AFTER_NEXT = 2;\nconst DOS_ROOT_LENGTH = 3;\nconst DOS_DRIVE_LENGTH = 2;\nconst ENCODED_SEPARATOR_LENGTH = 3;\nconst SLASH = \"/\";\nconst BACKSLASH = \"\\\\\";\nconst SCHEME_SEPARATOR = \"://\";\nconst DOS_ROOT = /^[A-Za-z]:[/\\\\]/u;\nconst DOS_DRIVE = /^[A-Za-z]:$/u;\nconst VOLUME_CHARACTER = /^[A-Za-z]$/u;\nconst ENCODED_VOLUME_SEPARATOR = /^%3[Aa]/u;\nconst FILE_SCHEME = \"file\";\nconst LOCAL_AUTHORITIES: ReadonlySet<string> = new Set([\"\", \"localhost\"]);\n\nconst RELATIVE: PathRoot = { length: FIRST, isUrl: false };\n\nconst diskRoot = (length: number): PathRoot => ({ length, isUrl: false });\nconst urlRoot = (length: number): PathRoot => ({ length, isUrl: true });\n\nconst isVolumeCharacter = (character: string | undefined): boolean =>\n Predicate.isNotUndefined(character) && VOLUME_CHARACTER.test(character);\n\nconst posixOrUncRoot = (path: string, separator: string): PathRoot => {\n if (path[NEXT] !== separator) {\n return diskRoot(NEXT);\n }\n return Option.match(indexFrom(path, separator, AFTER_NEXT), {\n onNone: () => diskRoot(path.length),\n onSome: (serverEnd) => diskRoot(serverEnd + NEXT),\n });\n};\n\nconst dosRoot = (path: string): Option.Option<PathRoot> => {\n if (DOS_ROOT.test(path)) {\n return Option.some(diskRoot(DOS_ROOT_LENGTH));\n }\n return Option.liftPredicate(diskRoot(DOS_DRIVE_LENGTH), () => DOS_DRIVE.test(path));\n};\n\nconst fileUrlVolumeSeparatorEnd = (url: string, start: number): Option.Option<number> => {\n if (url[start] === \":\") {\n return Option.some(start + NEXT);\n }\n return Option.liftPredicate(start + ENCODED_SEPARATOR_LENGTH, () =>\n ENCODED_VOLUME_SEPARATOR.test(Str.slice(start)(url)),\n );\n};\n\nconst fileUrlVolumeRoot = (url: string, authorityEnd: number): Option.Option<PathRoot> =>\n fileUrlVolumeSeparatorEnd(url, authorityEnd + AFTER_NEXT).pipe(\n Option.flatMap((end) => {\n if (url[end] === SLASH) {\n return Option.some(urlRoot(end + NEXT));\n }\n return Option.liftPredicate(urlRoot(end), () => end === url.length);\n }),\n );\n\nconst isLocalFileUrl = (url: string, schemeEnd: number, authorityEnd: number): boolean =>\n Str.slice(FIRST, schemeEnd)(url) === FILE_SCHEME &&\n LOCAL_AUTHORITIES.has(Str.slice(schemeEnd + SCHEME_SEPARATOR.length, authorityEnd)(url)) &&\n isVolumeCharacter(url[authorityEnd + NEXT]);\n\nconst urlRootAt = (url: string, schemeEnd: number, authorityEnd: number): PathRoot => {\n const volume = Option.liftPredicate(url, () => isLocalFileUrl(url, schemeEnd, authorityEnd)).pipe(\n Option.flatMap(() => fileUrlVolumeRoot(url, authorityEnd)),\n );\n return Option.getOrElse(volume, () => urlRoot(authorityEnd + NEXT));\n};\n\nconst urlRootOf = (url: string, schemeEnd: number): PathRoot =>\n Option.match(indexFrom(url, SLASH, schemeEnd + SCHEME_SEPARATOR.length), {\n onNone: () => urlRoot(url.length),\n onSome: (authorityEnd) => urlRootAt(url, schemeEnd, authorityEnd),\n });\n\nconst getPathRoot = (path: string): PathRoot => {\n const [first] = path;\n if (first === SLASH || first === BACKSLASH) {\n return posixOrUncRoot(path, first);\n }\n return dosRoot(path).pipe(\n Option.getOrElse(() =>\n Option.match(Str.indexOf(SCHEME_SEPARATOR)(path), {\n onNone: () => RELATIVE,\n onSome: (schemeEnd) => urlRootOf(path, schemeEnd),\n }),\n ),\n );\n};\n\nexport const getRootLength = (path: string): number => getPathRoot(path).length;\n\nexport const isRootedDiskPath = (path: string): boolean => {\n const root = getPathRoot(path);\n return root.length > FIRST && !root.isUrl;\n};\n","import { Array as Arr, Option, String as Str, pipe, Function as Fn } from \"effect\";\n\nimport { getRootLength, isRootedDiskPath } from \"./path-roots.ts\";\n\nconst DATA_FIRST_ARITY = 2;\n\nconst SEPARATOR = \"/\";\nconst ROOT_LENGTH = 1;\nconst NOT_FOUND = -1;\nconst FIRST = 0;\nconst SECOND = 1;\nconst PARENT = \"..\";\nconst CURRENT = \".\";\nexport const RELATIVE_SEGMENT = /\\/\\/|(?:^|\\/)\\.\\.?(?:$|\\/)/u;\nconst RELATIVE_NAMES: ReadonlySet<string> = new Set([\".\", \"..\"]);\nconst RELATIVE_PREFIXES: readonly string[] = [\"./\", \".\\\\\", \"../\", \"..\\\\\"];\n\nexport const normalizeSlashes = (path: string): string => Str.replaceAll(\"\\\\\", SEPARATOR)(path);\n\nexport const hasTrailingDirectorySeparator = (path: string): boolean =>\n Str.endsWith(SEPARATOR)(path);\n\nconst removeTrailingDirectorySeparator = (path: string): string =>\n Option.liftPredicate(path, hasTrailingDirectorySeparator).pipe(\n Option.match({ onNone: () => path, onSome: (value) => Str.slice(FIRST, NOT_FOUND)(value) }),\n );\n\nexport const ensureTrailingDirectorySeparator = (path: string): string =>\n Option.liftPredicate(path, hasTrailingDirectorySeparator).pipe(\n Option.getOrElse(() => `${path}${SEPARATOR}`),\n );\n\nconst combineTwo = (base: string, next: string): string => {\n if (next.length === FIRST) {\n return base;\n }\n const relative = normalizeSlashes(next);\n if (base.length === FIRST || getRootLength(relative) !== FIRST) {\n return relative;\n }\n return `${ensureTrailingDirectorySeparator(base)}${relative}`;\n};\n\nexport const combinePaths = (path: string, ...paths: readonly string[]): string =>\n Arr.reduce(paths, normalizeSlashes(path), combineTwo);\n\nconst pathComponents = (path: string, rootLength: number): readonly string[] => {\n const rest = Str.split(Str.slice(rootLength)(path), SEPARATOR);\n const trimmed = Option.liftPredicate(rest, (parts) => Arr.last(parts).pipe(Option.contains(\"\")));\n return [\n Str.slice(FIRST, rootLength)(path),\n ...Option.match(trimmed, {\n onNone: () => rest,\n onSome: (parts) => parts.slice(FIRST, NOT_FOUND),\n }),\n ];\n};\n\nexport const getPathComponents = (path: string): readonly string[] => {\n const normalized = normalizeSlashes(path);\n return pathComponents(normalized, getRootLength(normalized));\n};\n\nconst isNoopComponent = (component: string): boolean =>\n component.length === FIRST || component === CURRENT;\n\nconst canPopParent = (reduced: readonly string[]): boolean =>\n reduced.length > SECOND && Arr.last(reduced).pipe(Option.exists((last) => last !== PARENT));\n\nconst keepsParent = (reduced: readonly string[]): boolean =>\n reduced.length > SECOND || reduced[FIRST] === \"\";\n\nconst applyParent = (reduced: readonly string[], component: string): readonly string[] => {\n if (canPopParent(reduced)) {\n return reduced.slice(FIRST, NOT_FOUND);\n }\n if (keepsParent(reduced)) {\n return [...reduced, component];\n }\n return reduced;\n};\n\nconst reduceComponent = (reduced: readonly string[], component: string): readonly string[] => {\n if (isNoopComponent(component)) {\n return reduced;\n }\n if (component !== PARENT) {\n return [...reduced, component];\n }\n return applyParent(reduced, component);\n};\n\nexport const reducePathComponents = (components: readonly string[]): readonly string[] =>\n Arr.match(components, {\n onEmpty: (): readonly string[] => [],\n onNonEmpty: ([root, ...rest]) => Arr.reduce(rest, [root], reduceComponent),\n });\n\nconst getPathFromPathComponents = (components: readonly string[]): string =>\n Arr.match(components, {\n onEmpty: () => \"\",\n onNonEmpty: ([root, ...rest]) =>\n `${Option.liftPredicate(root, Str.isNonEmpty).pipe(Option.match({ onNone: () => \"\", onSome: ensureTrailingDirectorySeparator }))}${pipe(rest, Arr.join(SEPARATOR))}`,\n });\n\nconst normalizeComponents = (path: string): string => {\n const normalized = getPathFromPathComponents(reducePathComponents(getPathComponents(path)));\n return Option.liftPredicate(\n normalized,\n (value) => value.length > FIRST && hasTrailingDirectorySeparator(path),\n ).pipe(Option.match({ onNone: () => normalized, onSome: ensureTrailingDirectorySeparator }));\n};\n\nconst simplifyCurrentSegments = (path: string): string =>\n Str.replace(/^\\.\\//u, \"\")(Str.replaceAll(\"/./\", SEPARATOR)(path));\n\nexport const normalizePath = (path: string): string => {\n const slashed = normalizeSlashes(path);\n if (!RELATIVE_SEGMENT.test(slashed)) {\n return slashed;\n }\n const simplified = simplifyCurrentSegments(slashed);\n if (!RELATIVE_SEGMENT.test(simplified)) {\n return simplified;\n }\n return normalizeComponents(simplified);\n};\n\nexport const getDirectoryPath = (path: string): string => {\n const slashed = normalizeSlashes(path);\n const rootLength = getRootLength(slashed);\n if (rootLength === slashed.length) {\n return slashed;\n }\n const trimmed = removeTrailingDirectorySeparator(slashed);\n const end = Option.match(Str.lastIndexOf(SEPARATOR)(trimmed), {\n onNone: () => rootLength,\n onSome: (separator) => Math.max(rootLength, separator),\n });\n return Str.slice(FIRST, end)(trimmed);\n};\n\nexport const getBaseFileName = (path: string): string => {\n const slashed = normalizeSlashes(path);\n if (getRootLength(slashed) === slashed.length) {\n return \"\";\n }\n const trimmed = removeTrailingDirectorySeparator(slashed);\n const rootLength = getRootLength(trimmed);\n const start = Option.match(Str.lastIndexOf(SEPARATOR)(trimmed), {\n onNone: () => rootLength,\n onSome: (separator) => Math.max(rootLength, separator + ROOT_LENGTH),\n });\n return Str.slice(start)(trimmed);\n};\n\nexport const getNormalizedAbsolutePath: {\n (currentDirectory: string): (path: string) => string;\n (path: string, currentDirectory: string): string;\n} = Fn.dual(DATA_FIRST_ARITY, (path: string, currentDirectory: string): string => {\n const components = getPathComponents(combinePaths(currentDirectory, path));\n return getPathFromPathComponents(reducePathComponents(components));\n});\n\nexport const toPath = (fileName: string): string =>\n Option.liftPredicate(fileName, isRootedDiskPath).pipe(\n Option.match({\n onNone: () => getNormalizedAbsolutePath(fileName, SEPARATOR),\n onSome: normalizePath,\n }),\n Str.toLowerCase,\n );\n\nexport const forEachAncestorDirectory: {\n <Found>(\n visit: (ancestor: string) => Option.Option<Found>,\n ): (directory: string) => Option.Option<Found>;\n <Found>(\n directory: string,\n visit: (ancestor: string) => Option.Option<Found>,\n ): Option.Option<Found>;\n} = Fn.dual(\n DATA_FIRST_ARITY,\n <Found>(\n directory: string,\n visit: (ancestor: string) => Option.Option<Found>,\n ): Option.Option<Found> => {\n let current = directory;\n for (;;) {\n const result = visit(current);\n const parent = getDirectoryPath(current);\n if (Option.isSome(result) || parent === current) {\n return result;\n }\n current = parent;\n }\n },\n);\n\nexport const pathIsRelative = (path: string): boolean =>\n RELATIVE_NAMES.has(path) ||\n pipe(\n RELATIVE_PREFIXES,\n Arr.some((prefix) => Str.startsWith(prefix)(path)),\n );\n\nexport const isExternalModuleNameRelative = (moduleName: string): boolean =>\n pathIsRelative(moduleName) || isRootedDiskPath(moduleName);\n\nconst sharedPrefixLength = (from: readonly string[], to: readonly string[]): number => {\n const limit = Math.min(from.length, to.length);\n let index = FIRST;\n while (index < limit && from[index] === to[index]) {\n index += ROOT_LENGTH;\n }\n return index;\n};\n\nexport const getRelativePathFromDirectory: {\n (to: string): (fromDirectory: string) => string;\n (fromDirectory: string, to: string): string;\n} = Fn.dual(DATA_FIRST_ARITY, (fromDirectory: string, to: string): string => {\n const from = reducePathComponents(getPathComponents(fromDirectory));\n const target = reducePathComponents(getPathComponents(to));\n const start = sharedPrefixLength(from, target);\n if (start === FIRST) {\n return getPathFromPathComponents(target);\n }\n return getPathFromPathComponents([\n \"\",\n ...Array.from({ length: from.length - start }, () => PARENT),\n ...target.slice(start),\n ]);\n});\n\nexport const containsPath: {\n (child: string): (parent: string) => boolean;\n (parent: string, child: string): boolean;\n} = Fn.dual(DATA_FIRST_ARITY, (parent: string, child: string): boolean => {\n const parentComponents = reducePathComponents(getPathComponents(parent));\n const childComponents = reducePathComponents(getPathComponents(child));\n return (\n parent === child ||\n (childComponents.length >= parentComponents.length &&\n sharedPrefixLength(parentComponents, childComponents) === parentComponents.length)\n );\n});\n","import { Option, Predicate, Record as Rec, Function as Fn } from \"effect\";\n\nimport { Messages, traceMessage } from \"./messages.ts\";\nimport { combinePaths, normalizePath } from \"./paths.ts\";\nimport type { PackageJsonContent, ResolutionState } from \"./resolution-types.ts\";\n\nconst DATA_FIRST_ARITY_3 = 3;\n\nexport interface FieldRequest {\n readonly field: string;\n readonly expected: \"string\" | \"object\";\n}\n\ninterface PathFieldRequest {\n readonly field: string;\n readonly baseDirectory: string;\n}\n\nconst EMPTY = 0;\n\nconst typeName = (value: unknown): string => {\n if (Predicate.isNull(value)) {\n return \"null\";\n }\n return typeof value;\n};\n\nexport const resolvePackageJsonFieldWithTrace: {\n (\n request: FieldRequest,\n state: ResolutionState,\n ): (content: PackageJsonContent) => Option.Option<unknown>;\n (\n content: PackageJsonContent,\n request: FieldRequest,\n state: ResolutionState,\n ): Option.Option<unknown>;\n} = Fn.dual(\n DATA_FIRST_ARITY_3,\n (\n content: PackageJsonContent,\n { field, expected }: FieldRequest,\n state: ResolutionState,\n ): Option.Option<unknown> => {\n if (!Rec.has(content, field)) {\n traceMessage(state, Messages.packageJsonMissingField, field);\n return Option.none();\n }\n const value = content[field];\n if (typeof value !== expected || Predicate.isNull(value)) {\n traceMessage(state, Messages.expectedFieldType, field, expected, typeName(value));\n return Option.none();\n }\n return Option.some(value);\n },\n);\n\nconst resolvePathWithTrace = (\n fileName: string,\n { field, baseDirectory }: PathFieldRequest,\n state: ResolutionState,\n): Option.Option<string> => {\n if (fileName.length === EMPTY) {\n traceMessage(state, Messages.packageJsonFalsyField, field);\n return Option.none();\n }\n const path = normalizePath(combinePaths(baseDirectory, fileName));\n traceMessage(state, Messages.packageJsonFieldReferences, field, fileName, path);\n return Option.some(path);\n};\n\nconst resolvePackageJsonPathWithTrace = (\n content: PackageJsonContent,\n request: PathFieldRequest,\n state: ResolutionState,\n): Option.Option<string> =>\n resolvePackageJsonFieldWithTrace(\n content,\n { field: request.field, expected: \"string\" },\n state,\n ).pipe(\n Option.filter((value) => Predicate.isString(value)),\n Option.flatMap((fileName) => resolvePathWithTrace(fileName, request, state)),\n );\n\nexport const readPackageJsonTypesFields: {\n (\n baseDirectory: string,\n state: ResolutionState,\n ): (content: PackageJsonContent) => Option.Option<string>;\n (\n content: PackageJsonContent,\n baseDirectory: string,\n state: ResolutionState,\n ): Option.Option<string>;\n} = Fn.dual(\n DATA_FIRST_ARITY_3,\n (\n content: PackageJsonContent,\n baseDirectory: string,\n state: ResolutionState,\n ): Option.Option<string> =>\n resolvePackageJsonPathWithTrace(content, { field: \"typings\", baseDirectory }, state).pipe(\n Option.orElse(() =>\n resolvePackageJsonPathWithTrace(content, { field: \"types\", baseDirectory }, state),\n ),\n ),\n);\n\nexport const readPackageJsonMainField: {\n (\n baseDirectory: string,\n state: ResolutionState,\n ): (content: PackageJsonContent) => Option.Option<string>;\n (\n content: PackageJsonContent,\n baseDirectory: string,\n state: ResolutionState,\n ): Option.Option<string>;\n} = Fn.dual(\n DATA_FIRST_ARITY_3,\n (\n content: PackageJsonContent,\n baseDirectory: string,\n state: ResolutionState,\n ): Option.Option<string> =>\n resolvePackageJsonPathWithTrace(content, { field: \"main\", baseDirectory }, state),\n);\n\nexport const asRecord = (value: unknown): Readonly<Record<string, unknown>> =>\n Option.liftPredicate(value, Predicate.isObject).pipe(Option.getOrElse(() => ({})));\n","import { Array as Arr, Option, Predicate, Record as Rec, Function as Fn } from \"effect\";\nimport semver from \"semver\";\n\nimport { Messages, traceMessage } from \"./messages.ts\";\nimport { asRecord, resolvePackageJsonFieldWithTrace } from \"./package-json-fields.ts\";\nimport type {\n PackageJsonContent,\n PackageJsonInfo,\n ResolutionState,\n VersionPaths,\n} from \"./resolution-types.ts\";\n\nconst DATA_FIRST_ARITY = 2;\n\nexport const RESOLUTION_VERSION = \"5.6.1-rc\";\nconst RESOLUTION_VERSION_MAJOR_MINOR = \"5.6\";\nconst RANGE_OPTIONS = { includePrerelease: true } as const;\n\nconst isValidRange = (key: string): boolean =>\n Predicate.isNotNull(semver.validRange(key, RANGE_OPTIONS));\n\nconst rangeMatches = (range: string, version: string): boolean =>\n isValidRange(range) && semver.satisfies(version, range, RANGE_OPTIONS);\n\nconst traceInvalidRanges = (\n typesVersions: Readonly<Record<string, unknown>>,\n state: ResolutionState,\n): void => {\n for (const key of Rec.keys(typesVersions)) {\n if (!isValidRange(key)) {\n traceMessage(state, Messages.packageJsonInvalidTypesVersionsRange, key);\n }\n }\n};\n\nconst matchingTypesVersions = (\n typesVersions: Readonly<Record<string, unknown>>,\n): Option.Option<readonly [string, unknown]> =>\n Arr.findFirst(Rec.toEntries(typesVersions), ([key]) => rangeMatches(key, RESOLUTION_VERSION));\n\nconst validateVersionPathsWithTrace = (\n [version, paths]: readonly [string, unknown],\n state: ResolutionState,\n): Option.Option<VersionPaths> => {\n if (typeof paths !== \"object\") {\n traceMessage(\n state,\n Messages.expectedFieldType,\n `typesVersions['${version}']`,\n \"object\",\n typeof paths,\n );\n return Option.none();\n }\n return Option.some({ version, paths: asRecord(paths) });\n};\n\nconst selectVersionPathsWithTrace = (\n typesVersions: Readonly<Record<string, unknown>>,\n state: ResolutionState,\n): Option.Option<VersionPaths> => {\n traceMessage(state, Messages.packageJsonHasTypesVersions);\n traceInvalidRanges(typesVersions, state);\n const entry = matchingTypesVersions(typesVersions);\n if (Option.isNone(entry)) {\n traceMessage(\n state,\n Messages.packageJsonNoMatchingTypesVersions,\n RESOLUTION_VERSION_MAJOR_MINOR,\n );\n return Option.none();\n }\n return validateVersionPathsWithTrace(entry.value, state);\n};\n\nconst resolveTypesVersionPathsWithTrace = (\n content: PackageJsonContent,\n state: ResolutionState,\n): Option.Option<VersionPaths> =>\n resolvePackageJsonFieldWithTrace(\n content,\n { field: \"typesVersions\", expected: \"object\" },\n state,\n ).pipe(\n Option.flatMap((typesVersions) => selectVersionPathsWithTrace(asRecord(typesVersions), state)),\n );\n\nexport const getVersionPaths: {\n (state: ResolutionState): (info: PackageJsonInfo) => Option.Option<VersionPaths>;\n (info: PackageJsonInfo, state: ResolutionState): Option.Option<VersionPaths>;\n} = Fn.dual(\n DATA_FIRST_ARITY,\n (info: PackageJsonInfo, state: ResolutionState): Option.Option<VersionPaths> =>\n info.contents.versionPaths(() =>\n resolveTypesVersionPathsWithTrace(info.contents.packageJsonContent, state),\n ),\n);\n","import { Option, Predicate, Function as Fn } from \"effect\";\nimport { ModifierFlags } from \"typescript/ast\";\nimport type { Node, SourceFile } from \"typescript/ast\";\nimport {\n isExportSpecifier,\n isImportEqualsDeclaration,\n isJSDocCallbackTag,\n isJSDocTypedefTag,\n} from \"typescript/ast/is\";\nimport { SymbolFlags } from \"typescript/sync\";\n\nimport {\n declarationName,\n hasExportModifier,\n hasSyntacticModifier,\n isAmbientModule,\n} from \"./binder-names.ts\";\nimport { declareSymbol } from \"./binder-symbols.ts\";\nimport type { BoundSymbol, SymbolTable } from \"./binder-symbols.ts\";\nimport { nameText } from \"./binder-syntax.ts\";\nimport { hasFlag } from \"./flags.ts\";\n\nconst DATA_FIRST_ARITY = 2;\nconst DATA_FIRST_ARITY_3 = 3;\n\nexport interface FileBinding {\n readonly file: SourceFile;\n readonly locals: SymbolTable;\n readonly isJs: boolean;\n readonly exportContext: boolean;\n readonly strict: boolean;\n readonly isExternalModule: boolean;\n symbol?: BoundSymbol;\n commonJsModuleIndicator?: Node;\n}\n\nexport interface Scope {\n readonly containerIsFile: boolean;\n readonly blockIsFile: boolean;\n}\n\nexport interface DeclarationTarget {\n readonly table: Option.Option<SymbolTable>;\n readonly parent: Option.Option<BoundSymbol>;\n}\n\nexport interface SymbolFlagPair {\n readonly includes: number;\n readonly excludes: number;\n}\n\nexport interface DeclareRequest {\n readonly target: DeclarationTarget;\n readonly node: Node;\n readonly flags: SymbolFlagPair;\n}\n\nconst DEFAULT_NAME = \"default\";\n\nexport const exportsOf = (owner: Option.Option<BoundSymbol>): DeclarationTarget => ({\n table: owner.pipe(Option.flatMap((symbol) => Option.fromNullishOr(symbol.exports))),\n parent: owner,\n});\n\nconst fileExports = (binding: FileBinding): DeclarationTarget =>\n exportsOf(Option.fromNullishOr(binding.symbol));\n\nconst fileLocals = (binding: FileBinding): DeclarationTarget => ({\n table: Option.some(binding.locals),\n parent: Option.none(),\n});\n\nconst isExportSpecifierNamedDefault = (node: Node): boolean =>\n isExportSpecifier(node) && Option.contains(nameText(node.name), DEFAULT_NAME);\n\nconst isDefaultExport = (request: DeclareRequest): boolean =>\n Option.isSome(request.target.parent) &&\n (hasSyntacticModifier(request.node, ModifierFlags.Default) ||\n isExportSpecifierNamedDefault(request.node));\n\nexport const declare: {\n (request: DeclareRequest): (binding: FileBinding) => BoundSymbol;\n (binding: FileBinding, request: DeclareRequest): BoundSymbol;\n} = Fn.dual(DATA_FIRST_ARITY, (binding: FileBinding, request: DeclareRequest): BoundSymbol => {\n const name = Option.orElse(\n Option.liftPredicate(DEFAULT_NAME, () => isDefaultExport(request)),\n () => declarationName(request.node, binding.isJs),\n );\n return declareSymbol({\n table: request.target.table,\n parent: request.target.parent,\n node: request.node,\n name,\n includes: request.flags.includes,\n excludes: request.flags.excludes,\n });\n});\n\nconst declareLocal = (binding: FileBinding, node: Node, flags: SymbolFlagPair): BoundSymbol =>\n declare(binding, { target: fileLocals(binding), node, flags });\n\nexport const declareExport: {\n (node: Node, flags: SymbolFlagPair): (binding: FileBinding) => BoundSymbol;\n (binding: FileBinding, node: Node, flags: SymbolFlagPair): BoundSymbol;\n} = Fn.dual(\n DATA_FIRST_ARITY_3,\n (binding: FileBinding, node: Node, flags: SymbolFlagPair): BoundSymbol =>\n declare(binding, { target: fileExports(binding), node, flags }),\n);\n\nconst isJSDocTypeAliasWithName = (node: Node): boolean =>\n (isJSDocTypedefTag(node) || isJSDocCallbackTag(node)) && Predicate.isNotUndefined(node.name);\n\nconst isExportedMember = (node: Node): boolean =>\n hasExportModifier(node) || isJSDocTypeAliasWithName(node);\n\nconst declareAlias = (binding: FileBinding, node: Node, flags: SymbolFlagPair): BoundSymbol => {\n if (isExportSpecifier(node) || (isImportEqualsDeclaration(node) && isExportedMember(node))) {\n return declareExport(binding, node, flags);\n }\n return declareLocal(binding, node, flags);\n};\n\nconst localExportFlags = (flags: SymbolFlagPair): SymbolFlagPair => ({\n includes: Number(hasFlag(flags.includes, SymbolFlags.Value)) * SymbolFlags.ExportValue,\n excludes: flags.excludes,\n});\n\nconst declareExportedMember = (\n binding: FileBinding,\n node: Node,\n flags: SymbolFlagPair,\n): BoundSymbol => {\n if (\n hasSyntacticModifier(node, ModifierFlags.Default) &&\n Option.isNone(declarationName(node, binding.isJs))\n ) {\n return declareExport(binding, node, flags);\n }\n const local = declareLocal(binding, node, localExportFlags(flags));\n local.exportSymbol = declareExport(binding, node, flags);\n return local;\n};\n\nconst isExportedDeclaration = (binding: FileBinding, node: Node): boolean =>\n !isAmbientModule(node) && (isExportedMember(node) || binding.exportContext);\n\nconst declareModuleMember = (\n binding: FileBinding,\n node: Node,\n flags: SymbolFlagPair,\n): BoundSymbol => {\n if (hasFlag(flags.includes, SymbolFlags.Alias)) {\n return declareAlias(binding, node, flags);\n }\n if (isExportedDeclaration(binding, node)) {\n return declareExportedMember(binding, node, flags);\n }\n return declareLocal(binding, node, flags);\n};\n\nexport const declareSourceFileMember: {\n (node: Node, flags: SymbolFlagPair): (binding: FileBinding) => BoundSymbol;\n (binding: FileBinding, node: Node, flags: SymbolFlagPair): BoundSymbol;\n} = Fn.dual(\n DATA_FIRST_ARITY_3,\n (binding: FileBinding, node: Node, flags: SymbolFlagPair): BoundSymbol => {\n if (binding.isExternalModule) {\n return declareModuleMember(binding, node, flags);\n }\n return declareLocal(binding, node, flags);\n },\n);\n\nexport const declareBlockScoped: {\n (node: Node, flags: SymbolFlagPair): (binding: FileBinding) => BoundSymbol;\n (binding: FileBinding, node: Node, flags: SymbolFlagPair): BoundSymbol;\n} = Fn.dual(\n DATA_FIRST_ARITY_3,\n (binding: FileBinding, node: Node, flags: SymbolFlagPair): BoundSymbol => {\n if (binding.isExternalModule || Predicate.isNotUndefined(binding.commonJsModuleIndicator)) {\n return declareModuleMember(binding, node, flags);\n }\n return declareLocal(binding, node, flags);\n },\n);\n","import { Option, Predicate, String as Str, Function as Fn } from \"effect\";\nimport type { BinaryExpression, CallExpression, Node } from \"typescript/ast\";\nimport { isIdentifier, isPropertyAccessExpression, isVariableDeclaration } from \"typescript/ast/is\";\nimport { SymbolFlags } from \"typescript/sync\";\n\nimport { declare, exportsOf } from \"./binder-declarations.ts\";\nimport type { FileBinding, Scope, SymbolFlagPair } from \"./binder-declarations.ts\";\nimport {\n addDeclarationToSymbol,\n createSymbol,\n escapeLeadingUnderscores,\n exportOf,\n} from \"./binder-symbols.ts\";\nimport type { BoundSymbol } from \"./binder-symbols.ts\";\nimport {\n getElementOrPropertyAccessName,\n isAccessExpression,\n isAliasableExpression,\n isAssignmentExpression,\n isExportsIdentifier,\n isModuleExportsAccessExpression,\n} from \"./binder-syntax.ts\";\nimport type { AccessExpression } from \"./binder-syntax.ts\";\nimport { EMPTY, combineFlags } from \"./flags.ts\";\n\nconst DATA_FIRST_ARITY = 2;\nconst DATA_FIRST_ARITY_3 = 3;\n\nexport interface EntityNameWalk {\n readonly node: Node;\n readonly containerIsFile: boolean;\n readonly action: (\n name: Node,\n symbol: Option.Option<BoundSymbol>,\n parent: Option.Option<BoundSymbol>,\n ) => Option.Option<BoundSymbol>;\n}\n\nconst MAX_ALIAS_STEPS = 100;\nconst ALIAS_STEP = 1;\nconst EXTENSION = /\\.[^./]*$/u;\nconst MODULE_ASSIGNMENT = combineFlags(SymbolFlags.Module, SymbolFlags.Assignment);\nconst EXPORT_PROPERTY: SymbolFlagPair = {\n includes: combineFlags(SymbolFlags.Property, SymbolFlags.ExportValue),\n excludes: EMPTY,\n};\nconst EXPORT_ALIAS: SymbolFlagPair = { includes: SymbolFlags.Alias, excludes: EMPTY };\n\nexport const createFileSymbol = (binding: FileBinding): void => {\n const symbol = createSymbol(EMPTY, `\"${Str.replace(EXTENSION, \"\")(binding.file.fileName)}\"`);\n addDeclarationToSymbol(symbol, binding.file, SymbolFlags.ValueModule);\n binding.symbol = symbol;\n};\n\nexport const lookupSymbolForName: {\n (name: string): (binding: FileBinding) => Option.Option<BoundSymbol>;\n (binding: FileBinding, name: string): Option.Option<BoundSymbol>;\n} = Fn.dual(DATA_FIRST_ARITY, (binding: FileBinding, name: string): Option.Option<BoundSymbol> => {\n const local = Option.fromNullishOr(binding.locals.get(name)).pipe(\n Option.map((found) => found.exportSymbol ?? found),\n );\n return local.pipe(\n Option.orElse(() =>\n Option.fromNullishOr(binding.symbol).pipe(Option.flatMap((file) => exportOf(file, name))),\n ),\n );\n});\n\nexport const lookupIdentifier: {\n (node: Node): (binding: FileBinding) => Option.Option<BoundSymbol>;\n (binding: FileBinding, node: Node): Option.Option<BoundSymbol>;\n} = Fn.dual(DATA_FIRST_ARITY, (binding: FileBinding, node: Node): Option.Option<BoundSymbol> =>\n Option.flatMap(Option.liftPredicate(node, isIdentifier), (identifier) =>\n lookupSymbolForName(binding, escapeLeadingUnderscores(identifier.text)),\n ),\n);\n\nexport const variableInitializer: {\n (node: Node): (binding: FileBinding) => Option.Option<Node>;\n (binding: FileBinding, node: Node): Option.Option<Node>;\n} = Fn.dual(DATA_FIRST_ARITY, (binding: FileBinding, node: Node): Option.Option<Node> =>\n lookupIdentifier(binding, node).pipe(\n Option.flatMap((symbol) => Option.fromNullishOr(symbol.valueDeclaration)),\n Option.filter(isVariableDeclaration),\n Option.flatMap((declaration) => Option.fromNullishOr(declaration.initializer)),\n ),\n);\n\nconst aliasSources = (binding: FileBinding, node: Node): readonly Node[] =>\n variableInitializer(binding, node).pipe(\n Option.map((initializer): readonly Node[] =>\n Option.match(Option.liftPredicate(initializer, isAssignmentExpression), {\n onNone: () => [initializer],\n onSome: (assignment) => [initializer, assignment.left, assignment.right],\n }),\n ),\n Option.getOrElse((): readonly Node[] => []),\n );\n\nconst isExportsReference = (node: Node): boolean =>\n isExportsIdentifier(node) || isModuleExportsAccessExpression(node);\n\nconst searchExportsAlias = (\n binding: FileBinding,\n queue: readonly Node[],\n steps: number,\n): boolean => {\n const [next, ...rest] = queue;\n if (Predicate.isUndefined(next) || steps >= MAX_ALIAS_STEPS) {\n return false;\n }\n return (\n isExportsReference(next) ||\n searchExportsAlias(binding, [...rest, ...aliasSources(binding, next)], steps + ALIAS_STEP)\n );\n};\n\nexport const isExportsOrModuleExportsOrAlias: {\n (node: Node): (binding: FileBinding) => boolean;\n (binding: FileBinding, node: Node): boolean;\n} = Fn.dual(DATA_FIRST_ARITY, (binding: FileBinding, node: Node): boolean =>\n searchExportsAlias(binding, [node], EMPTY),\n);\n\nexport const setCommonJsModuleIndicator: {\n (node: Node): (binding: FileBinding) => boolean;\n (binding: FileBinding, node: Node): boolean;\n} = Fn.dual(DATA_FIRST_ARITY, (binding: FileBinding, node: Node): boolean => {\n if (binding.isExternalModule) {\n return false;\n }\n if (Predicate.isUndefined(binding.commonJsModuleIndicator)) {\n binding.commonJsModuleIndicator = node;\n createFileSymbol(binding);\n }\n return true;\n});\n\nconst accessNameOrArgument = (node: AccessExpression): Node => {\n if (isPropertyAccessExpression(node)) {\n return node.name;\n }\n return node.argumentExpression;\n};\n\nconst lookupInFileContainer = (\n binding: FileBinding,\n walk: EntityNameWalk,\n): Option.Option<BoundSymbol> =>\n Option.liftPredicate(binding, () => walk.containerIsFile).pipe(\n Option.flatMap((bound) => lookupIdentifier(bound, walk.node)),\n );\n\nconst memberOfAccess = (\n node: AccessExpression,\n parent: Option.Option<BoundSymbol>,\n): Option.Option<BoundSymbol> =>\n getElementOrPropertyAccessName(node).pipe(\n Option.flatMap((key) => parent.pipe(Option.flatMap((symbol) => exportOf(symbol, key)))),\n );\n\nexport const forEachIdentifierInEntityName: {\n (walk: EntityNameWalk): (binding: FileBinding) => Option.Option<BoundSymbol>;\n (binding: FileBinding, walk: EntityNameWalk): Option.Option<BoundSymbol>;\n} = Fn.dual(\n DATA_FIRST_ARITY,\n (binding: FileBinding, walk: EntityNameWalk): Option.Option<BoundSymbol> => {\n const { node } = walk;\n if (isExportsOrModuleExportsOrAlias(binding, node)) {\n return Option.fromNullishOr(binding.symbol);\n }\n if (isIdentifier(node)) {\n return walk.action(node, lookupInFileContainer(binding, walk), Option.none());\n }\n if (!isAccessExpression(node)) {\n return Option.none();\n }\n const parent = forEachIdentifierInEntityName(binding, { ...walk, node: node.expression });\n return walk.action(accessNameOrArgument(node), memberOfAccess(node, parent), parent);\n },\n);\n\nconst markModuleAssignment = (\n name: Node,\n symbol: Option.Option<BoundSymbol>,\n): Option.Option<BoundSymbol> =>\n symbol.pipe(\n Option.map((found) => {\n addDeclarationToSymbol(found, name, MODULE_ASSIGNMENT);\n return found;\n }),\n );\n\nconst exportsPropertyFlags = (node: BinaryExpression): SymbolFlagPair => {\n const target = node.left;\n const isAlias =\n isAliasableExpression(node.right) &&\n isAccessExpression(target) &&\n (isExportsIdentifier(target.expression) || isModuleExportsAccessExpression(target.expression));\n return Option.getOrElse(\n Option.liftPredicate(EXPORT_ALIAS, () => isAlias),\n () => EXPORT_PROPERTY,\n );\n};\n\nexport const bindExportsPropertyAssignment: {\n (node: BinaryExpression, scope: Scope): (binding: FileBinding) => void;\n (binding: FileBinding, node: BinaryExpression, scope: Scope): void;\n} = Fn.dual(\n DATA_FIRST_ARITY_3,\n (binding: FileBinding, node: BinaryExpression, scope: Scope): void => {\n const { left } = node;\n if (!setCommonJsModuleIndicator(binding, node) || !isAccessExpression(left)) {\n return;\n }\n const owner = forEachIdentifierInEntityName(binding, {\n node: left.expression,\n containerIsFile: scope.containerIsFile,\n action: markModuleAssignment,\n });\n if (Option.isSome(owner)) {\n declare(binding, { target: exportsOf(owner), node: left, flags: exportsPropertyFlags(node) });\n }\n },\n);\n\nexport const bindObjectDefinePropertyExport: {\n (node: CallExpression, scope: Scope): (binding: FileBinding) => void;\n (binding: FileBinding, node: CallExpression, scope: Scope): void;\n} = Fn.dual(\n DATA_FIRST_ARITY_3,\n (binding: FileBinding, node: CallExpression, scope: Scope): void => {\n const [target] = node.arguments;\n if (!setCommonJsModuleIndicator(binding, node) || Predicate.isUndefined(target)) {\n return;\n }\n const owner = forEachIdentifierInEntityName(binding, {\n node: target,\n containerIsFile: scope.containerIsFile,\n action: markModuleAssignment,\n });\n if (Option.isSome(owner)) {\n declare(binding, { target: exportsOf(owner), node, flags: EXPORT_PROPERTY });\n }\n },\n);\n","import { Predicate } from \"effect\";\nimport { SyntaxKind } from \"typescript/ast\";\nimport type { Node } from \"typescript/ast\";\nimport { isSourceFile } from \"typescript/ast/is\";\n\nconst CONTAINER_KINDS: ReadonlySet<SyntaxKind> = new Set([\n SyntaxKind.ClassExpression,\n SyntaxKind.ClassDeclaration,\n SyntaxKind.EnumDeclaration,\n SyntaxKind.ObjectLiteralExpression,\n SyntaxKind.TypeLiteral,\n SyntaxKind.JSDocTypeLiteral,\n SyntaxKind.JsxAttributes,\n SyntaxKind.InterfaceDeclaration,\n SyntaxKind.ModuleDeclaration,\n SyntaxKind.TypeAliasDeclaration,\n SyntaxKind.MappedType,\n SyntaxKind.IndexSignature,\n SyntaxKind.SourceFile,\n SyntaxKind.GetAccessor,\n SyntaxKind.SetAccessor,\n SyntaxKind.MethodDeclaration,\n SyntaxKind.Constructor,\n SyntaxKind.FunctionDeclaration,\n SyntaxKind.MethodSignature,\n SyntaxKind.CallSignature,\n SyntaxKind.JSDocSignature,\n SyntaxKind.FunctionType,\n SyntaxKind.ConstructSignature,\n SyntaxKind.ConstructorType,\n SyntaxKind.ClassStaticBlockDeclaration,\n SyntaxKind.FunctionExpression,\n SyntaxKind.ArrowFunction,\n]);\n\nconst FUNCTION_LIKE_KINDS: ReadonlySet<SyntaxKind> = new Set([\n SyntaxKind.FunctionDeclaration,\n SyntaxKind.FunctionExpression,\n SyntaxKind.ArrowFunction,\n SyntaxKind.MethodDeclaration,\n SyntaxKind.Constructor,\n SyntaxKind.GetAccessor,\n SyntaxKind.SetAccessor,\n SyntaxKind.ClassStaticBlockDeclaration,\n SyntaxKind.MethodSignature,\n SyntaxKind.CallSignature,\n SyntaxKind.ConstructSignature,\n SyntaxKind.IndexSignature,\n SyntaxKind.FunctionType,\n SyntaxKind.ConstructorType,\n SyntaxKind.JSDocSignature,\n]);\n\nconst BLOCK_SCOPE_KINDS: ReadonlySet<SyntaxKind> = new Set([\n SyntaxKind.ModuleBlock,\n SyntaxKind.CatchClause,\n SyntaxKind.ForStatement,\n SyntaxKind.ForInStatement,\n SyntaxKind.ForOfStatement,\n SyntaxKind.CaseBlock,\n]);\n\nexport const isContainer = (node: Node): boolean => CONTAINER_KINDS.has(node.kind);\n\nexport const isFunctionLike = (node: Node | undefined): node is Node =>\n Predicate.isNotUndefined(node) && FUNCTION_LIKE_KINDS.has(node.kind);\n\nexport const isBlockScopeContainer = (node: Node): boolean =>\n isContainer(node) ||\n BLOCK_SCOPE_KINDS.has(node.kind) ||\n (node.kind === SyntaxKind.Block && !isFunctionLike(node.parent));\n\nconst hasAncestor = (node: Node, predicate: (candidate: Node) => boolean): boolean => {\n let current = node.parent;\n while (!isSourceFile(current)) {\n if (predicate(current)) {\n return true;\n }\n current = current.parent;\n }\n return false;\n};\n\nexport const containerIsFile = (node: Node): boolean => !hasAncestor(node, isContainer);\n\nexport const blockScopeIsFile = (node: Node): boolean => !hasAncestor(node, isBlockScopeContainer);\n","import { Array as Arr, Predicate, pipe, Function as Fn } from \"effect\";\nimport type { JSDocCallbackTag, JSDocTag, JSDocTypedefTag, Node } from \"typescript/ast\";\nimport { isIdentifier, isJSDoc, isJSDocCallbackTag, isJSDocTypedefTag } from \"typescript/ast/is\";\nimport { SymbolFlags } from \"typescript/sync\";\n\nimport { declareBlockScoped } from \"./binder-declarations.ts\";\nimport type { FileBinding, SymbolFlagPair } from \"./binder-declarations.ts\";\nimport { blockScopeIsFile, containerIsFile } from \"./binder-scopes.ts\";\n\nconst DATA_FIRST_ARITY = 2;\n\ntype TypeAliasTag = JSDocCallbackTag | JSDocTypedefTag;\n\ninterface TypeAliasTagSite {\n readonly tag: TypeAliasTag;\n readonly host: Node;\n}\n\nconst TYPE_ALIAS: SymbolFlagPair = {\n includes: SymbolFlags.TypeAlias,\n excludes: SymbolFlags.TypeAliasExcludes,\n};\n\nconst NO_TAGS: readonly JSDocTag[] = [];\n\nconst isTypeAliasTag = (tag: JSDocTag): tag is TypeAliasTag =>\n isJSDocTypedefTag(tag) || isJSDocCallbackTag(tag);\n\nconst typeAliasTagsOf = (host: Node): readonly TypeAliasTag[] =>\n pipe(\n host.jsDoc ?? [],\n Arr.filter(isJSDoc),\n Arr.flatMap((doc) => pipe(doc.tags ?? NO_TAGS, Arr.filter(isTypeAliasTag))),\n );\n\nconst typeAliasTagSites = (hosts: readonly Node[]): readonly TypeAliasTagSite[] =>\n Arr.dedupeWith(\n pipe(\n hosts,\n Arr.flatMap((host) =>\n pipe(\n typeAliasTagsOf(host),\n Arr.map((tag) => ({ tag, host })),\n ),\n ),\n ),\n (left, right) => left.tag.pos === right.tag.pos,\n );\n\nconst declaresFileTypeAlias = (site: TypeAliasTagSite): boolean =>\n Predicate.isNotUndefined(site.tag.name) &&\n isIdentifier(site.tag.name) &&\n containerIsFile(site.host) &&\n blockScopeIsFile(site.host);\n\nexport const bindJSDocTypeAliases: {\n (hosts: readonly Node[]): (binding: FileBinding) => void;\n (binding: FileBinding, hosts: readonly Node[]): void;\n} = Fn.dual(DATA_FIRST_ARITY, (binding: FileBinding, hosts: readonly Node[]): void => {\n for (const site of typeAliasTagSites(hosts)) {\n if (declaresFileTypeAlias(site)) {\n declareBlockScoped(binding, site.tag, TYPE_ALIAS);\n }\n }\n});\n","import { Array as Arr, Option } from \"effect\";\nimport { SyntaxKind } from \"typescript/ast\";\nimport type { Node } from \"typescript/ast\";\nimport {\n isArrowFunction,\n isBinaryExpression,\n isCallExpression,\n isClassExpression,\n isFunctionDeclaration,\n isFunctionExpression,\n isObjectLiteralExpression,\n isPropertyAccessExpression,\n isVariableDeclaration,\n} from \"typescript/ast/is\";\nimport { SymbolFlags } from \"typescript/sync\";\n\nimport { isPrototypeAccess } from \"./binder-assignment.ts\";\nimport { isFunctionLike } from \"./binder-scopes.ts\";\nimport type { BoundSymbol } from \"./binder-symbols.ts\";\nimport {\n getRightMostAssignedExpression,\n isAssignmentExpression,\n skipParentheses,\n} from \"./binder-syntax.ts\";\nimport { combineFlags, hasFlag } from \"./flags.ts\";\n\nconst EXPANDO_FLAGS = combineFlags(\n SymbolFlags.Function,\n SymbolFlags.Class,\n SymbolFlags.NamespaceModule,\n);\n\nconst isFunctionOrArrow = (node: Node): boolean =>\n isFunctionExpression(node) || isArrowFunction(node);\n\nconst expandoInitializer = (\n initializer: Node,\n isPrototypeAssignment: boolean,\n): Option.Option<Node> => {\n if (isCallExpression(initializer)) {\n return Option.liftPredicate(initializer, () =>\n isFunctionOrArrow(skipParentheses(initializer.expression)),\n );\n }\n if (isFunctionOrArrow(initializer) || isClassExpression(initializer)) {\n return Option.some(initializer);\n }\n return Option.liftPredicate(\n initializer,\n (candidate) =>\n isObjectLiteralExpression(candidate) &&\n (!Arr.isReadonlyArrayNonEmpty(candidate.properties) || isPrototypeAssignment),\n );\n};\n\nconst assignedExpandoInitializer = (node: Node): Option.Option<Node> =>\n Option.flatMap(Option.liftPredicate(node.parent, isAssignmentExpression), (assignment) =>\n expandoInitializer(assignment.right, isPrototypeAccess(assignment.left)),\n );\n\nconst assignedRight = (node: Node): Option.Option<Node> =>\n Option.liftPredicate(node.parent, isBinaryExpression).pipe(\n Option.filter(() => isPropertyAccessExpression(node)),\n Option.map((assignment) => assignment.right),\n );\n\nconst initializerOf = (node: Node): Option.Option<Node> => {\n if (isVariableDeclaration(node)) {\n return Option.fromNullishOr(node.initializer);\n }\n if (isBinaryExpression(node)) {\n return Option.some(node.right);\n }\n return assignedRight(node);\n};\n\nconst prototypeTargetOf = (node: Node): Node => {\n if (isVariableDeclaration(node)) {\n return node.name;\n }\n if (isBinaryExpression(node)) {\n return node.left;\n }\n return node;\n};\n\nconst isDefaultingOperator = (kind: SyntaxKind): boolean =>\n kind === SyntaxKind.BarBarToken || kind === SyntaxKind.QuestionQuestionToken;\n\nconst defaultedValue = (node: Node): Node => {\n if (isBinaryExpression(node) && isDefaultingOperator(node.operatorToken.kind)) {\n return node.right;\n }\n return node;\n};\n\nconst declarationIsExpando = (node: Node): boolean => {\n if (isCallExpression(node)) {\n return Option.isSome(assignedExpandoInitializer(node));\n }\n const isPrototype = isPrototypeAccess(prototypeTargetOf(node));\n return initializerOf(node).pipe(\n Option.map((initializer) => defaultedValue(getRightMostAssignedExpression(initializer))),\n Option.flatMap((value) => expandoInitializer(value, isPrototype)),\n Option.isSome,\n );\n};\n\nexport const isExpandoSymbol = (symbol: BoundSymbol): boolean =>\n hasFlag(symbol.flags, EXPANDO_FLAGS) ||\n Option.exists(Option.fromNullishOr(symbol.valueDeclaration), declarationIsExpando);\n\nexport const isFunctionSymbol = (symbol: Option.Option<BoundSymbol>): boolean =>\n symbol.pipe(\n Option.flatMap((found) => Option.fromNullishOr(found.valueDeclaration)),\n Option.exists(\n (declaration) =>\n isFunctionDeclaration(declaration) ||\n (isVariableDeclaration(declaration) && isFunctionLike(declaration.initializer)),\n ),\n );\n\nexport const hasFunctionLikeExpandoInitializer = (declaration: Node): boolean =>\n Option.exists(assignedExpandoInitializer(declaration), isFunctionOrArrow);\n","import { Option, Predicate, Array as Arr, pipe, Function as Fn } from \"effect\";\nimport type { BinaryExpression, CallExpression, Node } from \"typescript/ast\";\nimport {\n isBinaryExpression,\n isCallExpression,\n isIdentifier,\n isObjectLiteralExpression,\n isSourceFile,\n} from \"typescript/ast/is\";\nimport { SymbolFlags } from \"typescript/sync\";\n\nimport {\n bindExportsPropertyAssignment,\n forEachIdentifierInEntityName,\n isExportsOrModuleExportsOrAlias,\n lookupIdentifier,\n} from \"./binder-cjs.ts\";\nimport { declare, exportsOf } from \"./binder-declarations.ts\";\nimport type { FileBinding, Scope, SymbolFlagPair } from \"./binder-declarations.ts\";\nimport {\n hasFunctionLikeExpandoInitializer,\n isExpandoSymbol,\n isFunctionSymbol,\n} from \"./binder-expando-symbol.ts\";\nimport { addDeclarationToSymbol, exportOf } from \"./binder-symbols.ts\";\nimport type { BoundSymbol } from \"./binder-symbols.ts\";\nimport {\n getElementOrPropertyAccessName,\n isAccessExpression,\n isDynamicElementAccess,\n} from \"./binder-syntax.ts\";\nimport type { AccessExpression } from \"./binder-syntax.ts\";\nimport { EMPTY, combineFlags, hasFlag, withFlags, withoutFlags } from \"./flags.ts\";\n\nconst DATA_FIRST_ARITY_3 = 3;\n\nconst DESCRIPTOR_ARGUMENT = 2;\n\nconst NAMESPACE_FLAGS: SymbolFlagPair = {\n includes: combineFlags(SymbolFlags.Module, SymbolFlags.Assignment),\n excludes: withoutFlags(SymbolFlags.ValueModuleExcludes, SymbolFlags.Assignment),\n};\n\nconst METHOD_FLAGS: SymbolFlagPair = {\n includes: SymbolFlags.Method,\n excludes: SymbolFlags.MethodExcludes,\n};\n\nconst PROPERTY_FLAGS: SymbolFlagPair = {\n includes: SymbolFlags.Property,\n excludes: SymbolFlags.PropertyExcludes,\n};\n\nconst ACCESSOR_FLAGS: readonly (readonly [string, SymbolFlagPair])[] = [\n [\n \"set\",\n {\n includes: combineFlags(SymbolFlags.SetAccessor, SymbolFlags.Property),\n excludes: SymbolFlags.SetAccessorExcludes,\n },\n ],\n [\n \"get\",\n {\n includes: combineFlags(SymbolFlags.GetAccessor, SymbolFlags.Property),\n excludes: SymbolFlags.GetAccessorExcludes,\n },\n ],\n];\n\nconst lookupSymbolForPropertyAccess = (\n binding: FileBinding,\n node: Node,\n): Option.Option<BoundSymbol> => {\n if (isIdentifier(node)) {\n return lookupIdentifier(binding, node);\n }\n if (!isAccessExpression(node)) {\n return Option.none();\n }\n const parent = lookupSymbolForPropertyAccess(binding, node.expression);\n return getElementOrPropertyAccessName(node).pipe(\n Option.flatMap((name) => parent.pipe(Option.flatMap((owner) => exportOf(owner, name)))),\n );\n};\n\nconst isAliasSymbol = (symbol: Option.Option<BoundSymbol>): boolean =>\n Option.exists(symbol, (found) => hasFlag(found.flags, SymbolFlags.Alias));\n\nconst addNamespaceDeclaration =\n (binding: FileBinding) =>\n (\n name: Node,\n symbol: Option.Option<BoundSymbol>,\n parent: Option.Option<BoundSymbol>,\n ): Option.Option<BoundSymbol> => {\n if (Option.isSome(symbol)) {\n addDeclarationToSymbol(symbol.value, name, NAMESPACE_FLAGS.includes);\n return symbol;\n }\n return parent.pipe(\n Option.map((owner) =>\n declare(binding, {\n target: exportsOf(Option.some(owner)),\n node: name,\n flags: NAMESPACE_FLAGS,\n }),\n ),\n );\n };\n\nconst bindMissingNamespaces = (\n binding: FileBinding,\n entityName: Node,\n): Option.Option<BoundSymbol> =>\n forEachIdentifierInEntityName(binding, {\n node: entityName,\n containerIsFile: true,\n action: addNamespaceDeclaration(binding),\n });\n\nconst descriptorPropertyNames = (call: CallExpression): readonly string[] => {\n const descriptor = call.arguments[DESCRIPTOR_ARGUMENT];\n if (Predicate.isUndefined(descriptor) || !isObjectLiteralExpression(descriptor)) {\n return [];\n }\n return pipe(\n descriptor.properties,\n Arr.flatMap((property) => {\n if (\"name\" in property && isIdentifier(property.name)) {\n return [property.name.text];\n }\n return [];\n }),\n );\n};\n\nconst accessorFlags = (call: CallExpression): SymbolFlagPair => {\n const names = descriptorPropertyNames(call);\n const matched = pipe(\n ACCESSOR_FLAGS,\n Arr.filter(([name]) => names.includes(name)),\n Arr.map(([, flags]) => flags),\n );\n return {\n includes: combineFlags(\n ...pipe(\n matched,\n Arr.map((flags) => flags.includes),\n ),\n ),\n excludes: combineFlags(\n ...pipe(\n matched,\n Arr.map((flags) => flags.excludes),\n ),\n ),\n };\n};\n\nconst expandoMemberFlags = (declaration: Node): SymbolFlagPair => {\n if (hasFunctionLikeExpandoInitializer(declaration)) {\n return METHOD_FLAGS;\n }\n if (isCallExpression(declaration)) {\n const accessors = accessorFlags(declaration);\n if (accessors.includes !== EMPTY) {\n return accessors;\n }\n }\n return PROPERTY_FLAGS;\n};\n\nconst bindExpandoMember = (\n binding: FileBinding,\n declaration: Node,\n namespace: Option.Option<BoundSymbol>,\n): void => {\n const owner = namespace.pipe(Option.filter(isExpandoSymbol));\n if (Option.isNone(owner)) {\n return;\n }\n owner.value.exports ??= new Map();\n const flags = expandoMemberFlags(declaration);\n declare(binding, {\n target: exportsOf(owner),\n node: declaration,\n flags: {\n includes: withFlags(flags.includes, SymbolFlags.Assignment),\n excludes: withoutFlags(flags.excludes, SymbolFlags.Assignment),\n },\n });\n};\n\nconst parentOfBinaryChain = (node: Node): Node => {\n let current = node;\n while (isBinaryExpression(current.parent)) {\n current = current.parent;\n }\n return current.parent;\n};\n\nconst isTopLevelNamespaceAssignment = (access: AccessExpression): boolean => {\n if (isBinaryExpression(access.parent)) {\n return isSourceFile(parentOfBinaryChain(access.parent).parent);\n }\n return isSourceFile(access.parent.parent);\n};\n\nconst namespaceFor = (\n binding: FileBinding,\n target: Node,\n isTopLevel: boolean,\n): Option.Option<BoundSymbol> => {\n const found = lookupSymbolForPropertyAccess(binding, target);\n if (isTopLevel && !isAliasSymbol(found)) {\n return bindMissingNamespaces(binding, target);\n }\n return found;\n};\n\nconst leftmostRoot = (node: Node): Node => {\n let current = node;\n while (isAccessExpression(current)) {\n current = current.expression;\n }\n return current;\n};\n\nconst skipsPropertyAssignment = (binding: FileBinding, left: AccessExpression): boolean =>\n (!binding.isJs && !isFunctionSymbol(lookupSymbolForPropertyAccess(binding, left.expression))) ||\n isAliasSymbol(lookupIdentifier(binding, leftmostRoot(left)));\n\nconst bindPropertyOfNamespace = (binding: FileBinding, left: AccessExpression): void => {\n const namespace = namespaceFor(binding, left.expression, isTopLevelNamespaceAssignment(left));\n if (!isDynamicElementAccess(left)) {\n bindExpandoMember(binding, left, namespace);\n }\n};\n\nconst bindableAccess = (\n binding: FileBinding,\n node: BinaryExpression,\n scope: Scope,\n): Option.Option<AccessExpression> =>\n Option.liftPredicate(node.left, isAccessExpression).pipe(\n Option.filter((left) => scope.containerIsFile && !skipsPropertyAssignment(binding, left)),\n );\n\nconst isExportsAliasAccess = (binding: FileBinding, left: AccessExpression): boolean =>\n isIdentifier(left.expression) && isExportsOrModuleExportsOrAlias(binding, left.expression);\n\nexport const bindSpecialPropertyAssignment: {\n (node: BinaryExpression, scope: Scope): (binding: FileBinding) => void;\n (binding: FileBinding, node: BinaryExpression, scope: Scope): void;\n} = Fn.dual(\n DATA_FIRST_ARITY_3,\n (binding: FileBinding, node: BinaryExpression, scope: Scope): void => {\n const left = bindableAccess(binding, node, scope);\n if (Option.isNone(left)) {\n return;\n }\n if (isExportsAliasAccess(binding, left.value)) {\n bindExportsPropertyAssignment(binding, node, scope);\n return;\n }\n bindPropertyOfNamespace(binding, left.value);\n },\n);\n\nexport const bindObjectDefinePropertyAssignment: {\n (call: CallExpression, scope: Scope): (binding: FileBinding) => void;\n (binding: FileBinding, call: CallExpression, scope: Scope): void;\n} = Fn.dual(\n DATA_FIRST_ARITY_3,\n (binding: FileBinding, call: CallExpression, scope: Scope): void => {\n const [target] = call.arguments;\n if (!scope.containerIsFile || Predicate.isUndefined(target)) {\n return;\n }\n const isTopLevel = isSourceFile(call.parent.parent);\n bindExpandoMember(binding, call, namespaceFor(binding, target, isTopLevel));\n },\n);\n","import { Array as Arr, Option, Predicate, pipe, Function as Fn } from \"effect\";\nimport type { BinaryExpression, Node } from \"typescript/ast\";\nimport { isObjectLiteralExpression, isShorthandPropertyAssignment } from \"typescript/ast/is\";\nimport { SymbolFlags } from \"typescript/sync\";\n\nimport {\n isExportsOrModuleExportsOrAlias,\n lookupSymbolForName,\n setCommonJsModuleIndicator,\n} from \"./binder-cjs.ts\";\nimport { declare, declareExport } from \"./binder-declarations.ts\";\nimport type { FileBinding, Scope, SymbolFlagPair } from \"./binder-declarations.ts\";\nimport { setValueDeclaration } from \"./binder-symbols.ts\";\nimport {\n getRightMostAssignedExpression,\n isAccessExpression,\n isAliasableExpression,\n isModuleExportsAccessExpression,\n} from \"./binder-syntax.ts\";\nimport { EMPTY, combineFlags } from \"./flags.ts\";\n\nconst DATA_FIRST_ARITY_3 = 3;\n\nconst isEmptyObjectLiteral = (node: Node): boolean =>\n isObjectLiteralExpression(node) && !Arr.isReadonlyArrayNonEmpty(node.properties);\n\nconst MODULE_EXPORTS_ALIAS: SymbolFlagPair = {\n includes: combineFlags(SymbolFlags.Alias, SymbolFlags.Assignment),\n excludes: EMPTY,\n};\nconst MODULE_EXPORTS_VALUE: SymbolFlagPair = {\n includes: combineFlags(\n SymbolFlags.Property,\n SymbolFlags.ExportValue,\n SymbolFlags.ValueModule,\n SymbolFlags.Assignment,\n ),\n excludes: EMPTY,\n};\n\nconst bindShorthandExports = (binding: FileBinding, assigned: Node): boolean => {\n if (\n !isObjectLiteralExpression(assigned) ||\n !pipe(assigned.properties, Arr.every(isShorthandPropertyAssignment))\n ) {\n return false;\n }\n for (const property of assigned.properties) {\n declareExport(binding, property, MODULE_EXPORTS_ALIAS);\n }\n return true;\n};\n\nconst isUnboundModuleExportsValue = (binding: FileBinding, assigned: Node, scope: Scope): boolean =>\n isEmptyObjectLiteral(assigned) ||\n (scope.containerIsFile && isExportsOrModuleExportsOrAlias(binding, assigned));\n\nexport const bindModuleExportsAssignment: {\n (node: BinaryExpression, scope: Scope): (binding: FileBinding) => void;\n (binding: FileBinding, node: BinaryExpression, scope: Scope): void;\n} = Fn.dual(\n DATA_FIRST_ARITY_3,\n (binding: FileBinding, node: BinaryExpression, scope: Scope): void => {\n const assigned = getRightMostAssignedExpression(node.right);\n if (\n !setCommonJsModuleIndicator(binding, node) ||\n isUnboundModuleExportsValue(binding, assigned, scope) ||\n bindShorthandExports(binding, assigned)\n ) {\n return;\n }\n const flags = Option.getOrElse(\n Option.liftPredicate(MODULE_EXPORTS_ALIAS, () => isAliasableExpression(node.right)),\n () => MODULE_EXPORTS_VALUE,\n );\n setValueDeclaration(declareExport(binding, node, flags), node);\n },\n);\n\nconst MODULE_LOCAL: SymbolFlagPair = {\n includes: combineFlags(SymbolFlags.FunctionScopedVariable, SymbolFlags.ModuleExports),\n excludes: SymbolFlags.FunctionScopedVariableExcludes,\n};\n\nconst shadowsModule = (binding: FileBinding, scope: Scope): boolean =>\n scope.blockIsFile && Option.isSome(lookupSymbolForName(binding, \"module\"));\n\nconst isTrackedModuleExportsAccess = (binding: FileBinding, node: Node): boolean =>\n binding.isJs &&\n Predicate.isNotUndefined(binding.commonJsModuleIndicator) &&\n isModuleExportsAccessExpression(node);\n\nexport const bindModuleExportsAccess: {\n (node: Node, scope: Scope): (binding: FileBinding) => void;\n (binding: FileBinding, node: Node, scope: Scope): void;\n} = Fn.dual(DATA_FIRST_ARITY_3, (binding: FileBinding, node: Node, scope: Scope): void => {\n if (\n !isAccessExpression(node) ||\n !isTrackedModuleExportsAccess(binding, node) ||\n shadowsModule(binding, scope)\n ) {\n return;\n }\n declare(binding, {\n target: { table: Option.some(binding.locals), parent: Option.none() },\n node: node.expression,\n flags: MODULE_LOCAL,\n });\n});\n","import { Option, Predicate, Function as Fn } from \"effect\";\nimport { SyntaxKind } from \"typescript/ast\";\nimport type { BinaryExpression, Node } from \"typescript/ast\";\nimport { isSourceFile } from \"typescript/ast/is\";\nimport { SymbolFlags } from \"typescript/sync\";\n\nimport { variableInitializer } from \"./binder-cjs.ts\";\nimport { declareExport, declareSourceFileMember } from \"./binder-declarations.ts\";\nimport type { FileBinding, SymbolFlagPair } from \"./binder-declarations.ts\";\nimport { isAccessExpression, isDynamicElementAccess, isThisKeyword } from \"./binder-syntax.ts\";\nimport { EMPTY, combineFlags } from \"./flags.ts\";\n\nconst DATA_FIRST_ARITY = 2;\n\nconst THIS_CONTAINER_KINDS: ReadonlySet<SyntaxKind> = new Set([\n SyntaxKind.FunctionDeclaration,\n SyntaxKind.FunctionExpression,\n SyntaxKind.ModuleDeclaration,\n SyntaxKind.ClassStaticBlockDeclaration,\n SyntaxKind.PropertyDeclaration,\n SyntaxKind.PropertySignature,\n SyntaxKind.MethodDeclaration,\n SyntaxKind.MethodSignature,\n SyntaxKind.Constructor,\n SyntaxKind.GetAccessor,\n SyntaxKind.SetAccessor,\n SyntaxKind.CallSignature,\n SyntaxKind.ConstructSignature,\n SyntaxKind.IndexSignature,\n SyntaxKind.EnumDeclaration,\n SyntaxKind.SourceFile,\n]);\n\nconst THIS_PROPERTY_EXPORT: SymbolFlagPair = {\n includes: combineFlags(SymbolFlags.Property, SymbolFlags.ExportValue),\n excludes: EMPTY,\n};\n\nconst THIS_PROPERTY_LOCAL: SymbolFlagPair = {\n includes: SymbolFlags.FunctionScopedVariable,\n excludes: SymbolFlags.FunctionScopedVariableExcludes,\n};\n\nconst thisContainerIsFile = (node: Node): boolean => {\n let current = node.parent;\n while (!THIS_CONTAINER_KINDS.has(current.kind)) {\n current = current.parent;\n }\n return isSourceFile(current);\n};\n\nexport const bindThisPropertyAssignment: {\n (node: BinaryExpression): (binding: FileBinding) => void;\n (binding: FileBinding, node: BinaryExpression): void;\n} = Fn.dual(DATA_FIRST_ARITY, (binding: FileBinding, node: BinaryExpression): void => {\n if (!thisContainerIsFile(node) || isDynamicElementAccess(node.left)) {\n return;\n }\n if (Predicate.isNotUndefined(binding.commonJsModuleIndicator)) {\n declareExport(binding, node, THIS_PROPERTY_EXPORT);\n return;\n }\n declareSourceFileMember(binding, node, THIS_PROPERTY_LOCAL);\n});\n\nexport const isThisInitialized: {\n (node: BinaryExpression): (binding: FileBinding) => boolean;\n (binding: FileBinding, node: BinaryExpression): boolean;\n} = Fn.dual(\n DATA_FIRST_ARITY,\n (binding: FileBinding, node: BinaryExpression): boolean =>\n isAccessExpression(node.left) &&\n variableInitializer(binding, node.left.expression).pipe(Option.exists(isThisKeyword)),\n);\n","import { Function as Fn, Predicate } from \"effect\";\nimport type { BinaryExpression, CallExpression, Node } from \"typescript/ast\";\nimport { isBinaryExpression, isCallExpression } from \"typescript/ast/is\";\n\nimport { AssignmentKind, getAssignmentDeclarationKind } from \"./binder-assignment.ts\";\nimport type { AssignmentDeclarationKind } from \"./binder-assignment.ts\";\nimport {\n bindExportsPropertyAssignment,\n bindObjectDefinePropertyExport,\n setCommonJsModuleIndicator,\n} from \"./binder-cjs.ts\";\nimport type { FileBinding, Scope } from \"./binder-declarations.ts\";\nimport {\n bindObjectDefinePropertyAssignment,\n bindSpecialPropertyAssignment,\n} from \"./binder-expando.ts\";\nimport { bindModuleExportsAccess, bindModuleExportsAssignment } from \"./binder-module-exports.ts\";\nimport { isRequireCall } from \"./binder-syntax.ts\";\nimport { bindThisPropertyAssignment, isThisInitialized } from \"./binder-this.ts\";\n\nconst EXPRESSION_ARITY = 3;\n\ntype ExpressionBinder<Bound extends Node> = (\n binding: FileBinding,\n node: Bound,\n scope: Scope,\n) => void;\n\nconst isThisAliasAssignment: (\n binding: FileBinding,\n node: BinaryExpression,\n scope: Scope,\n) => boolean = (binding, node, scope) =>\n binding.isJs && scope.blockIsFile && isThisInitialized(binding, node);\n\nconst bindPropertyAssignment: ExpressionBinder<BinaryExpression> = (binding, node, scope) => {\n if (isThisAliasAssignment(binding, node, scope)) {\n bindThisPropertyAssignment(binding, node);\n return;\n }\n bindSpecialPropertyAssignment(binding, node, scope);\n};\n\nconst BINARY_BINDERS: ReadonlyMap<\n AssignmentDeclarationKind,\n ExpressionBinder<BinaryExpression>\n> = new Map([\n [\n AssignmentKind.ExportsProperty,\n (binding, node, scope) => {\n bindExportsPropertyAssignment(binding, node, scope);\n },\n ],\n [\n AssignmentKind.ModuleExports,\n (binding, node, scope) => {\n bindModuleExportsAssignment(binding, node, scope);\n },\n ],\n [\n AssignmentKind.ThisProperty,\n (binding, node) => {\n bindThisPropertyAssignment(binding, node);\n },\n ],\n [AssignmentKind.Property, bindPropertyAssignment],\n]);\n\nconst CALL_BINDERS: ReadonlyMap<\n AssignmentDeclarationKind,\n ExpressionBinder<CallExpression>\n> = new Map([\n [AssignmentKind.ObjectDefinePropertyExports, bindObjectDefinePropertyExport],\n [AssignmentKind.ObjectDefinePropertyValue, bindObjectDefinePropertyAssignment],\n]);\n\nconst bindBinaryExpression: ExpressionBinder<BinaryExpression> = (binding, node, scope) => {\n const binder = BINARY_BINDERS.get(getAssignmentDeclarationKind(node, binding.isJs));\n if (Predicate.isNotUndefined(binder)) {\n binder(binding, node, scope);\n }\n};\n\nconst marksCommonJsModule = (binding: FileBinding, node: CallExpression): boolean =>\n binding.isJs &&\n Predicate.isUndefined(binding.commonJsModuleIndicator) &&\n isRequireCall(node, false);\n\nconst bindCallExpression: ExpressionBinder<CallExpression> = (binding, node, scope) => {\n const kind = getAssignmentDeclarationKind(node, binding.isJs);\n const binder = CALL_BINDERS.get(kind);\n if (Predicate.isNotUndefined(binder)) {\n binder(binding, node, scope);\n return;\n }\n if (kind === AssignmentKind.None && marksCommonJsModule(binding, node)) {\n setCommonJsModuleIndicator(binding, node);\n }\n};\n\nexport const bindExpression: {\n (node: Node, scope: Scope): (binding: FileBinding) => void;\n (binding: FileBinding, node: Node, scope: Scope): void;\n} = Fn.dual(EXPRESSION_ARITY, (binding: FileBinding, node: Node, scope: Scope): void => {\n if (isBinaryExpression(node)) {\n bindBinaryExpression(binding, node, scope);\n return;\n }\n if (isCallExpression(node)) {\n bindCallExpression(binding, node, scope);\n return;\n }\n bindModuleExportsAccess(binding, node, scope);\n});\n","import { Array as Arr, Option, Predicate, pipe } from \"effect\";\nimport { ModifierFlags } from \"typescript/ast\";\nimport type { ExportDeclaration, ExportSpecifier, NamedExports, Node } from \"typescript/ast\";\nimport {\n isEnumDeclaration,\n isExportDeclaration,\n isImportDeclaration,\n isImportEqualsDeclaration,\n isInterfaceDeclaration,\n isModuleBlock,\n isModuleDeclaration,\n isNamedExports,\n isTypeAliasDeclaration,\n} from \"typescript/ast/is\";\n\nimport { hasSyntacticModifier, isNodeValue } from \"./binder-names.ts\";\nimport { nameText } from \"./binder-syntax.ts\";\n\nexport const NON_INSTANTIATED = 0;\nconst INSTANTIATED = 1;\nconst CONST_ENUM_ONLY = 2;\n\nexport type ModuleInstanceState =\n | typeof NON_INSTANTIATED\n | typeof INSTANTIATED\n | typeof CONST_ENUM_ONLY;\n\nexport type StateOf = (node: Node) => ModuleInstanceState;\n\nexport const isConstEnum = (node: Node): boolean => hasSyntacticModifier(node, ModifierFlags.Const);\n\nconst keepFirstInstantiated = (\n state: ModuleInstanceState,\n next: ModuleInstanceState,\n): ModuleInstanceState => {\n if (state === INSTANTIATED || next <= state) {\n return state;\n }\n return next;\n};\n\nconst keepBlockState = (\n state: ModuleInstanceState,\n next: ModuleInstanceState,\n): ModuleInstanceState => {\n if (state === INSTANTIATED || next === NON_INSTANTIATED) {\n return state;\n }\n return next;\n};\n\nconst declaresName = (statement: Node, name: string): boolean =>\n \"name\" in statement &&\n isNodeValue(statement.name) &&\n Option.contains(nameText(statement.name), name);\n\nconst statementsOf = (node: Node): readonly Node[] => {\n if (isModuleBlock(node)) {\n return node.statements;\n }\n return [];\n};\n\nconst aliasTargetState = (specifier: ExportSpecifier, stateOf: StateOf): ModuleInstanceState => {\n const name = Option.getOrElse(nameText(specifier.propertyName ?? specifier.name), () => \"\");\n const matching = pipe(\n statementsOf(specifier.parent.parent.parent),\n Arr.filter((statement) => declaresName(statement, name)),\n );\n if (!Arr.isReadonlyArrayNonEmpty(matching)) {\n return INSTANTIATED;\n }\n return Arr.reduce(matching, NON_INSTANTIATED, (state: ModuleInstanceState, statement) =>\n keepFirstInstantiated(state, stateOf(statement)),\n );\n};\n\nconst localNamedExports = (node: ExportDeclaration): Option.Option<NamedExports> =>\n Option.fromNullishOr(node.exportClause).pipe(\n Option.flatMap((clause) => Option.liftPredicate(clause, isNamedExports)),\n Option.filter(() => Predicate.isUndefined(node.moduleSpecifier)),\n );\n\nconst exportDeclarationState = (node: ExportDeclaration, stateOf: StateOf): ModuleInstanceState => {\n if (node.isTypeOnly) {\n return NON_INSTANTIATED;\n }\n return Option.match(localNamedExports(node), {\n onNone: () => INSTANTIATED,\n onSome: (clause) =>\n Arr.reduce(clause.elements, NON_INSTANTIATED, (state: ModuleInstanceState, specifier) =>\n keepFirstInstantiated(state, aliasTargetState(specifier, stateOf)),\n ),\n });\n};\n\nconst isTypeDeclaration = (node: Node): boolean =>\n isInterfaceDeclaration(node) || isTypeAliasDeclaration(node);\n\nconst isConstEnumDeclaration = (node: Node): boolean =>\n isEnumDeclaration(node) && isConstEnum(node);\n\nconst isUnexportedImport = (node: Node): boolean =>\n (isImportDeclaration(node) || isImportEqualsDeclaration(node)) &&\n !hasSyntacticModifier(node, ModifierFlags.Export);\n\nconst DECLARATION_STATES: readonly (readonly [\n matches: (node: Node) => boolean,\n state: ModuleInstanceState,\n])[] = [\n [isTypeDeclaration, NON_INSTANTIATED],\n [isConstEnumDeclaration, CONST_ENUM_ONLY],\n [isUnexportedImport, NON_INSTANTIATED],\n];\n\nconst declarationState = (node: Node): Option.Option<ModuleInstanceState> =>\n Arr.findFirst(DECLARATION_STATES, ([matches]) => matches(node)).pipe(\n Option.map(([, state]) => state),\n );\n\nconst containerState = (node: Node, stateOf: StateOf): ModuleInstanceState => {\n if (isExportDeclaration(node)) {\n return exportDeclarationState(node, stateOf);\n }\n if (isModuleBlock(node)) {\n return Arr.reduce(node.statements, NON_INSTANTIATED, (state: ModuleInstanceState, statement) =>\n keepBlockState(state, stateOf(statement)),\n );\n }\n if (isModuleDeclaration(node)) {\n return Option.match(Option.fromNullishOr(node.body), {\n onNone: () => INSTANTIATED,\n onSome: stateOf,\n });\n }\n return INSTANTIATED;\n};\n\nexport const getModuleInstanceState: StateOf = (node) =>\n Option.getOrElse(declarationState(node), () => containerState(node, getModuleInstanceState));\n","import { Option, Predicate } from \"effect\";\nimport { SyntaxKind } from \"typescript/ast\";\nimport type { ExportDeclaration, Node } from \"typescript/ast\";\nimport {\n isExportAssignment,\n isExportDeclaration,\n isImportClause,\n isModuleDeclaration,\n isNamespaceExport,\n isSourceFile,\n} from \"typescript/ast/is\";\nimport { SymbolFlags } from \"typescript/sync\";\n\nimport {\n declareBlockScoped,\n declareExport,\n declareSourceFileMember,\n} from \"./binder-declarations.ts\";\nimport type { FileBinding, Scope, SymbolFlagPair } from \"./binder-declarations.ts\";\nimport { NON_INSTANTIATED, getModuleInstanceState, isConstEnum } from \"./binder-module-state.ts\";\nimport { isAmbientModule } from \"./binder-names.ts\";\nimport { setValueDeclaration } from \"./binder-symbols.ts\";\nimport { isAliasableExpression } from \"./binder-syntax.ts\";\nimport { EMPTY } from \"./flags.ts\";\n\nexport type NodeBinder = (binding: FileBinding, node: Node, scope: Scope) => void;\n\nconst flagPair = (includes: number, excludes: number): SymbolFlagPair => ({ includes, excludes });\n\nconst ALIAS = flagPair(SymbolFlags.Alias, SymbolFlags.AliasExcludes);\nconst FUNCTION = flagPair(SymbolFlags.Function, SymbolFlags.FunctionExcludes);\nconst VALUE_MODULE = flagPair(SymbolFlags.ValueModule, SymbolFlags.ValueModuleExcludes);\nconst NAMESPACE_MODULE = flagPair(SymbolFlags.NamespaceModule, SymbolFlags.NamespaceModuleExcludes);\nconst CONST_ENUM = flagPair(SymbolFlags.ConstEnum, SymbolFlags.ConstEnumExcludes);\nconst REGULAR_ENUM = flagPair(SymbolFlags.RegularEnum, SymbolFlags.RegularEnumExcludes);\nconst EXPORT_STAR = flagPair(SymbolFlags.ExportStar, EMPTY);\nconst EXPORT_ALIAS = flagPair(SymbolFlags.Alias, SymbolFlags.All);\nconst EXPORT_PROPERTY = flagPair(SymbolFlags.Property, SymbolFlags.All);\n\nconst inContainer =\n (flags: SymbolFlagPair): NodeBinder =>\n (binding, node, scope) => {\n if (scope.containerIsFile) {\n declareSourceFileMember(binding, node, flags);\n }\n };\n\nconst inBlock =\n (flags: SymbolFlagPair): NodeBinder =>\n (binding, node, scope) => {\n if (scope.blockIsFile) {\n declareBlockScoped(binding, node, flags);\n }\n };\n\nconst bindFunction: NodeBinder = (binding, node, scope) => {\n if (binding.strict) {\n inBlock(FUNCTION)(binding, node, scope);\n return;\n }\n inContainer(FUNCTION)(binding, node, scope);\n};\n\nconst bindEnum: NodeBinder = (binding, node, scope) => {\n if (isConstEnum(node)) {\n inBlock(CONST_ENUM)(binding, node, scope);\n return;\n }\n inBlock(REGULAR_ENUM)(binding, node, scope);\n};\n\nconst isModuleAugmentationExternal = (binding: FileBinding, node: Node): boolean =>\n isSourceFile(node.parent) && binding.isExternalModule;\n\nconst moduleFlags = (binding: FileBinding, node: Node): SymbolFlagPair => {\n if (isAmbientModule(node) && !isModuleAugmentationExternal(binding, node)) {\n return VALUE_MODULE;\n }\n if (getModuleInstanceState(node) === NON_INSTANTIATED) {\n return NAMESPACE_MODULE;\n }\n return VALUE_MODULE;\n};\n\nconst bindModuleDeclaration: NodeBinder = (binding, node, scope) => {\n if (scope.containerIsFile && isModuleDeclaration(node)) {\n declareSourceFileMember(binding, node, moduleFlags(binding, node));\n }\n};\n\nconst bindImportClause: NodeBinder = (binding, node, scope) => {\n if (isImportClause(node) && Predicate.isNotUndefined(node.name)) {\n inContainer(ALIAS)(binding, node, scope);\n }\n};\n\nconst hasFileExports = (binding: FileBinding, scope: Scope): boolean =>\n scope.containerIsFile && Option.isSome(Option.fromNullishOr(binding.symbol));\n\nconst bindExportClause = (binding: FileBinding, node: ExportDeclaration): void => {\n const clause = node.exportClause;\n if (Predicate.isUndefined(clause)) {\n declareExport(binding, node, EXPORT_STAR);\n return;\n }\n if (isNamespaceExport(clause)) {\n declareExport(binding, clause, ALIAS);\n }\n};\n\nconst bindExportDeclaration: NodeBinder = (binding, node, scope) => {\n if (hasFileExports(binding, scope) && isExportDeclaration(node)) {\n bindExportClause(binding, node);\n }\n};\n\nconst bindExportAssignment: NodeBinder = (binding, node, scope) => {\n if (!hasFileExports(binding, scope) || !isExportAssignment(node)) {\n return;\n }\n const flags = Option.getOrElse(\n Option.liftPredicate(EXPORT_ALIAS, () => isAliasableExpression(node.expression)),\n () => EXPORT_PROPERTY,\n );\n const symbol = declareExport(binding, node, flags);\n if (node.isExportEquals) {\n setValueDeclaration(symbol, node);\n }\n};\n\nexport const DECLARATION_BINDERS: ReadonlyMap<SyntaxKind, NodeBinder> = new Map([\n [SyntaxKind.FunctionDeclaration, bindFunction],\n [SyntaxKind.ClassDeclaration, inBlock(flagPair(SymbolFlags.Class, SymbolFlags.ClassExcludes))],\n [\n SyntaxKind.InterfaceDeclaration,\n inBlock(flagPair(SymbolFlags.Interface, SymbolFlags.InterfaceExcludes)),\n ],\n [\n SyntaxKind.TypeAliasDeclaration,\n inBlock(flagPair(SymbolFlags.TypeAlias, SymbolFlags.TypeAliasExcludes)),\n ],\n [SyntaxKind.EnumDeclaration, bindEnum],\n [SyntaxKind.ModuleDeclaration, bindModuleDeclaration],\n [SyntaxKind.ImportEqualsDeclaration, inContainer(ALIAS)],\n [SyntaxKind.NamespaceImport, inContainer(ALIAS)],\n [SyntaxKind.ImportSpecifier, inContainer(ALIAS)],\n [SyntaxKind.ExportSpecifier, inContainer(ALIAS)],\n [SyntaxKind.ImportClause, bindImportClause],\n [SyntaxKind.ExportDeclaration, bindExportDeclaration],\n [SyntaxKind.ExportAssignment, bindExportAssignment],\n]);\n","import { Option, Predicate, Function as Fn } from \"effect\";\nimport { NodeFlags } from \"typescript/ast\";\nimport type { BindingElement, Node, VariableDeclaration } from \"typescript/ast\";\nimport {\n isArrayBindingPattern,\n isBindingElement,\n isCatchClause,\n isObjectBindingPattern,\n isParameterDeclaration,\n isVariableDeclaration,\n isVariableDeclarationList,\n} from \"typescript/ast/is\";\nimport { SymbolFlags } from \"typescript/sync\";\n\nimport { declareBlockScoped, declareSourceFileMember } from \"./binder-declarations.ts\";\nimport type { FileBinding, Scope, SymbolFlagPair } from \"./binder-declarations.ts\";\nimport { hasExportModifier } from \"./binder-names.ts\";\nimport { isAccessExpression, isRequireCall } from \"./binder-syntax.ts\";\nimport { hasFlag } from \"./flags.ts\";\n\nconst DATA_FIRST_ARITY_3 = 3;\n\nexport type VariableLike = VariableDeclaration | BindingElement;\n\nconst ALIAS: SymbolFlagPair = { includes: SymbolFlags.Alias, excludes: SymbolFlags.AliasExcludes };\nconst BLOCK_VARIABLE: SymbolFlagPair = {\n includes: SymbolFlags.BlockScopedVariable,\n excludes: SymbolFlags.BlockScopedVariableExcludes,\n};\nconst FUNCTION_VARIABLE: SymbolFlagPair = {\n includes: SymbolFlags.FunctionScopedVariable,\n excludes: SymbolFlags.FunctionScopedVariableExcludes,\n};\n\nconst isBindingPattern = (node: Node | undefined): boolean =>\n Predicate.isNotUndefined(node) && (isObjectBindingPattern(node) || isArrayBindingPattern(node));\n\nexport const isReparsed = (node: Node): boolean => hasFlag(node.flags, NodeFlags.Reparsed);\n\nconst declarationOfBinding = (node: Node): Node => {\n let current = node;\n while (isBindingElement(current)) {\n current = current.parent.parent;\n }\n return current;\n};\n\nconst isBlockOrCatchScoped = (node: Node): boolean => {\n const declaration = declarationOfBinding(node);\n return (\n isVariableDeclaration(declaration) &&\n (isCatchClause(declaration.parent) ||\n (isVariableDeclarationList(declaration.parent) &&\n hasFlag(declaration.parent.flags, NodeFlags.BlockScoped)))\n );\n};\n\nconst isParameterBinding = (node: Node): boolean =>\n isParameterDeclaration(declarationOfBinding(node));\n\nconst hasJSDocTypeTag = (node: VariableLike): boolean =>\n isVariableDeclaration(node) && Option.exists(Option.fromNullishOr(node.type), isReparsed);\n\nconst leftmostAccessTarget = (node: Node): Node => {\n let current = node;\n while (isAccessExpression(current)) {\n current = current.expression;\n }\n return current;\n};\n\nconst isRequireInitialized = (node: Node): boolean =>\n isVariableDeclaration(node) &&\n Option.exists(Option.fromNullishOr(node.initializer), (initializer) =>\n isRequireCall(leftmostAccessTarget(initializer), true),\n );\n\nconst possibleDeclarationOf = (node: VariableLike): Node => {\n if (isVariableDeclaration(node)) {\n return node;\n }\n return node.parent.parent;\n};\n\nconst isRequireAlias = (binding: FileBinding, node: VariableLike): boolean =>\n binding.isJs &&\n isRequireInitialized(possibleDeclarationOf(node)) &&\n !hasJSDocTypeTag(node) &&\n !hasExportModifier(node);\n\ntype VariableBinder = (binding: FileBinding, node: VariableLike, scope: Scope) => void;\n\nconst bindRequireAlias: VariableBinder = (binding, node, scope) => {\n if (scope.containerIsFile) {\n declareSourceFileMember(binding, node, ALIAS);\n }\n};\n\nconst bindBlockVariable: VariableBinder = (binding, node, scope) => {\n if (scope.blockIsFile) {\n declareBlockScoped(binding, node, BLOCK_VARIABLE);\n }\n};\n\nconst bindFunctionVariable: VariableBinder = (binding, node, scope) => {\n if (scope.containerIsFile && !isParameterBinding(node)) {\n declareSourceFileMember(binding, node, FUNCTION_VARIABLE);\n }\n};\n\nconst variableBinderFor = (binding: FileBinding, node: VariableLike): VariableBinder => {\n if (isRequireAlias(binding, node)) {\n return bindRequireAlias;\n }\n if (isBlockOrCatchScoped(node)) {\n return bindBlockVariable;\n }\n return bindFunctionVariable;\n};\n\nexport const bindVariable: {\n (node: VariableLike, scope: Scope): (binding: FileBinding) => void;\n (binding: FileBinding, node: VariableLike, scope: Scope): void;\n} = Fn.dual(DATA_FIRST_ARITY_3, (binding: FileBinding, node: VariableLike, scope: Scope): void => {\n if (!isBindingPattern(node.name)) {\n variableBinderFor(binding, node)(binding, node, scope);\n }\n});\n","import { Array as Arr, Predicate, pipe } from \"effect\";\nimport type { Node } from \"typescript/ast\";\nimport { isBindingElement, isVariableDeclaration } from \"typescript/ast/is\";\n\nimport type { FileBinding, Scope } from \"./binder-declarations.ts\";\nimport { bindExpression } from \"./binder-expressions.ts\";\nimport { DECLARATION_BINDERS } from \"./binder-nodes.ts\";\nimport { isBlockScopeContainer, isContainer } from \"./binder-scopes.ts\";\nimport { bindVariable, isReparsed } from \"./binder-variables.ts\";\n\ninterface Frame {\n readonly node: Node;\n readonly scope: Scope;\n}\n\nconst FILE_SCOPE: Scope = { containerIsFile: true, blockIsFile: true };\nconst NESTED_CONTAINER_SCOPE: Scope = { containerIsFile: false, blockIsFile: false };\n\nconst childScope = (node: Node, scope: Scope): Scope => {\n if (isContainer(node)) {\n return NESTED_CONTAINER_SCOPE;\n }\n if (isBlockScopeContainer(node)) {\n return { containerIsFile: scope.containerIsFile, blockIsFile: false };\n }\n return scope;\n};\n\nconst childFramesInReverse = (node: Node, scope: Scope): readonly Frame[] => {\n const frames: Frame[] = [];\n node.forEachChild((next) => {\n frames.push({ node: next, scope });\n });\n return Arr.reverse(frames);\n};\n\nconst bindNode = (binding: FileBinding, node: Node, scope: Scope): void => {\n if (isVariableDeclaration(node) || isBindingElement(node)) {\n bindVariable(binding, node, scope);\n return;\n }\n const binder = DECLARATION_BINDERS.get(node.kind);\n if (Predicate.isNotUndefined(binder)) {\n binder(binding, node, scope);\n return;\n }\n bindExpression(binding, node, scope);\n};\n\nconst bindFrame = (binding: FileBinding, frame: Frame): readonly Frame[] => {\n if (isReparsed(frame.node)) {\n return [];\n }\n bindNode(binding, frame.node, frame.scope);\n return childFramesInReverse(frame.node, childScope(frame.node, frame.scope));\n};\n\nexport const bindFileNodes = (binding: FileBinding): readonly Node[] => {\n const bound: Node[] = [];\n const stack: Frame[] = [...childFramesInReverse(binding.file, FILE_SCOPE)];\n let frame = stack.pop();\n while (Predicate.isNotUndefined(frame)) {\n bound.push(frame.node);\n stack.push(...bindFrame(binding, frame));\n frame = stack.pop();\n }\n return pipe(\n bound,\n Arr.filter((node) => !isReparsed(node)),\n );\n};\n","import { Array as Arr, Option, Predicate, pipe } from \"effect\";\nimport { ScriptKind } from \"typescript/ast\";\nimport type { Node, SourceFile } from \"typescript/ast\";\nimport {\n isExportAssignment,\n isExportDeclaration,\n isExpressionStatement,\n isStringLiteral,\n} from \"typescript/ast/is\";\nimport { SymbolFlags } from \"typescript/sync\";\n\nimport { createFileSymbol } from \"./binder-cjs.ts\";\nimport { declareExport } from \"./binder-declarations.ts\";\nimport type { FileBinding, SymbolFlagPair } from \"./binder-declarations.ts\";\nimport { bindJSDocTypeAliases } from \"./binder-jsdoc.ts\";\nimport { bindFileNodes } from \"./binder-walk.ts\";\n\nconst USE_STRICT = \"use strict\";\n\nconst JSON_EXPORT: SymbolFlagPair = { includes: SymbolFlags.Property, excludes: SymbolFlags.All };\n\nconst bindings = new WeakMap<SourceFile, FileBinding>();\n\nconst isJsFile = (file: SourceFile): boolean =>\n file.scriptKind === ScriptKind.JS || file.scriptKind === ScriptKind.JSX;\n\nconst hasExportDeclarations = (file: SourceFile): boolean =>\n pipe(\n file.statements,\n Arr.some((statement) => isExportDeclaration(statement) || isExportAssignment(statement)),\n );\n\nconst directiveText = (statement: Node): Option.Option<string> =>\n Option.liftPredicate(statement, isExpressionStatement).pipe(\n Option.map((directive) => directive.expression),\n Option.filter(isStringLiteral),\n Option.map((literal) => literal.text),\n );\n\nconst hasUseStrictPrologue = (file: SourceFile): boolean =>\n pipe(\n file.statements,\n Arr.map(directiveText),\n Arr.takeWhile(Option.isSome),\n Arr.some((text) => Option.contains(text, USE_STRICT)),\n );\n\nconst createBinding = (file: SourceFile): FileBinding => {\n const isExternalModule =\n Predicate.isNotUndefined(file.externalModuleIndicator) && file.externalModuleIndicator !== true;\n return {\n file,\n locals: new Map(),\n isJs: isJsFile(file),\n exportContext: file.isDeclarationFile && !hasExportDeclarations(file),\n strict: isExternalModule || hasUseStrictPrologue(file),\n isExternalModule,\n };\n};\n\nconst declareFileSymbol = (binding: FileBinding): void => {\n if (binding.isExternalModule) {\n createFileSymbol(binding);\n return;\n }\n if (binding.file.scriptKind === ScriptKind.JSON) {\n createFileSymbol(binding);\n declareExport(binding, binding.file, JSON_EXPORT);\n }\n};\n\nconst writableValue = (value: unknown): PropertyDescriptor => ({\n value,\n writable: true,\n configurable: true,\n enumerable: true,\n});\n\nconst exposeOnSourceFile = (binding: FileBinding): void => {\n Object.defineProperties(binding.file, {\n symbol: writableValue(binding.symbol),\n locals: writableValue(binding.locals),\n commonJsModuleIndicator: writableValue(binding.commonJsModuleIndicator),\n });\n};\n\nexport const bindingOf = (file: SourceFile): Option.Option<FileBinding> =>\n Option.fromNullishOr(bindings.get(file));\n\nexport const bindSourceFile = (file: SourceFile): void => {\n if (bindings.has(file)) {\n return;\n }\n const binding = createBinding(file);\n bindings.set(file, binding);\n declareFileSymbol(binding);\n const nodes = bindFileNodes(binding);\n if (binding.isJs) {\n bindJSDocTypeAliases(binding, nodes);\n }\n exposeOnSourceFile(binding);\n};\n","import { Array as Arr, Option, pipe, String as Str, Function as Fn } from \"effect\";\n\nimport { getBaseFileName } from \"./paths.ts\";\n\nconst DATA_FIRST_ARITY = 2;\n\nexport const Extension = {\n Ts: \".ts\",\n Tsx: \".tsx\",\n Dts: \".d.ts\",\n Js: \".js\",\n Jsx: \".jsx\",\n Json: \".json\",\n TsBuildInfo: \".tsbuildinfo\",\n Mjs: \".mjs\",\n Mts: \".mts\",\n Dmts: \".d.mts\",\n Cjs: \".cjs\",\n Cts: \".cts\",\n Dcts: \".d.cts\",\n} as const;\n\nexport type ExtensionKind = \"TypeScript\" | \"JavaScript\" | \"Declaration\" | \"Json\";\n\nexport type Extensions = readonly ExtensionKind[];\n\nconst EXTENSION_KIND_ORDER: readonly ExtensionKind[] = [\n \"TypeScript\",\n \"JavaScript\",\n \"Declaration\",\n \"Json\",\n];\n\nconst EXTENSION_KIND_NAMES: Readonly<Record<ExtensionKind, string>> = {\n TypeScript: \"TypeScript\",\n JavaScript: \"JavaScript\",\n Declaration: \"Declaration\",\n Json: \"JSON\",\n};\n\nexport const extensionsOf = (...kinds: readonly ExtensionKind[]): Extensions =>\n pipe(\n EXTENSION_KIND_ORDER,\n Arr.filter((kind) => kinds.includes(kind)),\n );\n\nexport const PRIORITY_KINDS: Extensions = extensionsOf(\"TypeScript\", \"Declaration\");\n\nexport const intersectExtensions: {\n (right: Extensions): (left: Extensions) => Extensions;\n (left: Extensions, right: Extensions): Extensions;\n} = Fn.dual(DATA_FIRST_ARITY, (left: Extensions, right: Extensions): Extensions =>\n pipe(\n left,\n Arr.filter((kind) => right.includes(kind)),\n ),\n);\n\nexport const subtractExtensions: {\n (right: Extensions): (left: Extensions) => Extensions;\n (left: Extensions, right: Extensions): Extensions;\n} = Fn.dual(DATA_FIRST_ARITY, (left: Extensions, right: Extensions): Extensions =>\n pipe(\n left,\n Arr.filter((kind) => !right.includes(kind)),\n ),\n);\n\nexport const formatExtensions = (extensions: Extensions): string =>\n pipe(\n extensions,\n Arr.map((kind) => EXTENSION_KIND_NAMES[kind]),\n Arr.join(\", \"),\n );\n\nconst SUPPORTED_TS: readonly string[] = [\n Extension.Ts,\n Extension.Tsx,\n Extension.Dts,\n Extension.Cts,\n Extension.Dcts,\n Extension.Mts,\n Extension.Dmts,\n];\n\nconst SUPPORTED_JS: readonly string[] = [Extension.Js, Extension.Jsx, Extension.Mjs, Extension.Cjs];\n\nconst SUPPORTED_DECLARATION: readonly string[] = [Extension.Dts, Extension.Dcts, Extension.Dmts];\n\nconst SUPPORTED_TS_IMPLEMENTATION: readonly string[] = [\n Extension.Ts,\n Extension.Cts,\n Extension.Mts,\n Extension.Tsx,\n];\n\nconst EXTRACTABLE_TS: readonly string[] = [\n Extension.Dts,\n Extension.Dcts,\n Extension.Dmts,\n Extension.Cts,\n Extension.Mts,\n Extension.Ts,\n Extension.Tsx,\n];\n\nconst REMOVABLE: readonly string[] = [\n Extension.Dts,\n Extension.Dmts,\n Extension.Dcts,\n Extension.Mjs,\n Extension.Mts,\n Extension.Cjs,\n Extension.Cts,\n Extension.Ts,\n Extension.Js,\n Extension.Tsx,\n Extension.Jsx,\n Extension.Json,\n];\n\nconst ZERO = 0;\n\nconst fileExtensionIs = (path: string, extension: string): boolean =>\n path.length > extension.length && Str.endsWith(extension)(path);\n\nexport const fileExtensionIsOneOf: {\n (extensions: readonly string[]): (path: string) => boolean;\n (path: string, extensions: readonly string[]): boolean;\n} = Fn.dual(DATA_FIRST_ARITY, (path: string, extensions: readonly string[]): boolean =>\n pipe(\n extensions,\n Arr.some((extension) => fileExtensionIs(path, extension)),\n ),\n);\n\nconst findExtension = (path: string, extensions: readonly string[]): Option.Option<string> =>\n Arr.findFirst(extensions, (extension) => fileExtensionIs(path, extension));\n\nexport const hasTSFileExtension = (fileName: string): boolean =>\n fileExtensionIsOneOf(fileName, SUPPORTED_TS);\n\nexport const hasJSFileExtension = (fileName: string): boolean =>\n fileExtensionIsOneOf(fileName, SUPPORTED_JS);\n\nconst ARBITRARY_DECLARATION = \".d.\";\n\nconst getArbitraryDeclarationExtension = (fileName: string): Option.Option<string> =>\n Option.liftPredicate(fileName, (name) => fileExtensionIs(name, Extension.Ts)).pipe(\n Option.flatMap((name) =>\n Str.lastIndexOf(ARBITRARY_DECLARATION)(getBaseFileName(name)).pipe(\n Option.map((index) => Str.slice(name.length - getBaseFileName(name).length + index)(name)),\n ),\n ),\n );\n\nconst getDeclarationFileExtension = (fileName: string): Option.Option<string> =>\n Arr.findFirst(SUPPORTED_DECLARATION, (extension) => Str.endsWith(extension)(fileName)).pipe(\n Option.orElse(() => getArbitraryDeclarationExtension(fileName)),\n );\n\nexport const isDeclarationFileName = (fileName: string): boolean =>\n Option.isSome(getDeclarationFileExtension(fileName));\n\nexport const getAnyExtensionFromPath = (path: string): string => {\n const base = getBaseFileName(path);\n return Str.lastIndexOf(\".\")(base).pipe(\n Option.match({ onNone: () => \"\", onSome: (index) => Str.slice(index)(base) }),\n );\n};\n\nexport const removeFileExtension = (path: string): string =>\n findExtension(path, REMOVABLE).pipe(\n Option.match({\n onNone: () => path,\n onSome: (extension) => Str.slice(ZERO, path.length - extension.length)(path),\n }),\n );\n\nexport const tryGetExtensionFromPath = (path: string): Option.Option<string> =>\n findExtension(path, REMOVABLE);\n\nexport const tryExtractTSExtension = (fileName: string): Option.Option<string> =>\n findExtension(fileName, EXTRACTABLE_TS);\n\nexport const isTSFileExtensionForPackageField: {\n (candidate: string): (extensions: Extensions) => boolean;\n (extensions: Extensions, candidate: string): boolean;\n} = Fn.dual(\n DATA_FIRST_ARITY,\n (extensions: Extensions, candidate: string): boolean =>\n (extensions.includes(\"TypeScript\") &&\n fileExtensionIsOneOf(candidate, SUPPORTED_TS_IMPLEMENTATION)) ||\n (extensions.includes(\"Declaration\") && fileExtensionIsOneOf(candidate, SUPPORTED_DECLARATION)),\n);\n\nconst EXTENSIONS_FOR_KIND: Readonly<Record<ExtensionKind, readonly string[]>> = {\n TypeScript: [Extension.Ts, Extension.Tsx, Extension.Mts, Extension.Cts],\n JavaScript: [Extension.Js, Extension.Jsx, Extension.Mjs, Extension.Cjs],\n Declaration: [Extension.Dts, Extension.Dmts, Extension.Dcts],\n Json: [Extension.Json],\n};\n\nexport const extensionIsOk: {\n (extension: string): (extensions: Extensions) => boolean;\n (extensions: Extensions, extension: string): boolean;\n} = Fn.dual(DATA_FIRST_ARITY, (extensions: Extensions, extension: string): boolean =>\n pipe(\n EXTENSION_KIND_ORDER,\n Arr.some((kind) => extensions.includes(kind) && EXTENSIONS_FOR_KIND[kind].includes(extension)),\n ),\n);\n","import { Option, Function as Fn } from \"effect\";\nimport { NodeFlags, ScriptKind } from \"typescript/ast\";\nimport type { Node, SourceFile } from \"typescript/ast\";\n\nimport { hasFlag } from \"./flags.ts\";\nimport type { PackageJsonInfo, ResolutionMode } from \"./resolution-types.ts\";\n\nconst DATA_FIRST_ARITY = 2;\n\ninterface FileInfo {\n readonly impliedNodeFormat: Option.Option<ResolutionMode>;\n readonly packageJsonScope: Option.Option<PackageJsonInfo>;\n readonly imports: readonly Node[];\n readonly moduleAugmentations: readonly Node[];\n}\n\nconst infos = new WeakMap<SourceFile, FileInfo>();\n\nconst UNSET = Object.freeze({\n writable: true,\n configurable: true,\n enumerable: true,\n});\n\nexport const attachFileInfo: {\n (impliedNodeFormat: Option.Option<ResolutionMode>): (sourceFile: SourceFile) => SourceFile;\n (sourceFile: SourceFile, impliedNodeFormat: Option.Option<ResolutionMode>): SourceFile;\n} = Fn.dual(\n DATA_FIRST_ARITY,\n (sourceFile: SourceFile, impliedNodeFormat: Option.Option<ResolutionMode>): SourceFile => {\n infos.set(sourceFile, {\n impliedNodeFormat,\n packageJsonScope: Option.none(),\n imports: sourceFile.imports,\n moduleAugmentations: sourceFile.moduleAugmentations,\n });\n Object.defineProperty(sourceFile, \"imports\", UNSET);\n Object.defineProperty(sourceFile, \"moduleAugmentations\", UNSET);\n return sourceFile;\n },\n);\n\nconst infoOf = (sourceFile: SourceFile): Option.Option<FileInfo> =>\n Option.fromNullishOr(infos.get(sourceFile));\n\nexport const impliedNodeFormatOf = (sourceFile: SourceFile): Option.Option<ResolutionMode> =>\n Option.flatMap(infoOf(sourceFile), (info) => info.impliedNodeFormat);\n\nexport const packageJsonScopeOf = (sourceFile: SourceFile): Option.Option<PackageJsonInfo> =>\n Option.flatMap(infoOf(sourceFile), (info) => info.packageJsonScope);\n\nexport const setPackageJsonScope: {\n (scope: Option.Option<PackageJsonInfo>): (sourceFile: SourceFile) => void;\n (sourceFile: SourceFile, scope: Option.Option<PackageJsonInfo>): void;\n} = Fn.dual(\n DATA_FIRST_ARITY,\n (sourceFile: SourceFile, scope: Option.Option<PackageJsonInfo>): void => {\n Option.map(infoOf(sourceFile), (info) =>\n infos.set(sourceFile, { ...info, packageJsonScope: scope }),\n );\n },\n);\n\nexport const collectExternalModuleReferences = (sourceFile: SourceFile): void => {\n Option.map(infoOf(sourceFile), (info) => {\n Object.defineProperty(sourceFile, \"imports\", { ...UNSET, value: info.imports });\n Object.defineProperty(sourceFile, \"moduleAugmentations\", {\n ...UNSET,\n value: info.moduleAugmentations,\n });\n return info;\n });\n};\n\nexport const importsOf = (sourceFile: SourceFile): readonly Node[] =>\n Option.match(infoOf(sourceFile), {\n onNone: () => sourceFile.imports,\n onSome: (info) => info.imports,\n });\n\nexport const moduleAugmentationsOf = (sourceFile: SourceFile): readonly Node[] =>\n Option.match(infoOf(sourceFile), {\n onNone: () => sourceFile.moduleAugmentations,\n onSome: (info) => info.moduleAugmentations,\n });\n\nexport const isSourceFileJS = (sourceFile: SourceFile): boolean =>\n sourceFile.scriptKind === ScriptKind.JS || sourceFile.scriptKind === ScriptKind.JSX;\n\nexport const isJSDocNode = (node: Node): boolean => hasFlag(node.flags, NodeFlags.JSDoc);\n","import { Array as Arr, Option, Function as Fn } from \"effect\";\nimport { SyntaxKind } from \"typescript/ast\";\nimport type {\n ExportDeclaration,\n ImportDeclaration,\n JSDocImportTag,\n Node,\n SourceFile,\n} from \"typescript/ast\";\nimport {\n isCallExpression,\n isExportDeclaration,\n isIdentifier,\n isImportAttributes,\n isImportClause,\n isImportDeclaration,\n isImportEqualsDeclaration,\n isImportTypeNode,\n isJSDocImportTag,\n isParenthesizedExpression,\n isStringLiteralLikeNode,\n} from \"typescript/ast/is\";\n\nimport { fileExtensionIsOneOf } from \"./extensions.ts\";\nimport type { ResolutionKind, ResolutionMode } from \"./resolution-types.ts\";\nimport { impliedNodeFormatOf, packageJsonScopeOf } from \"./source-file.ts\";\n\nconst DATA_FIRST_ARITY = 2;\nconst DATA_FIRST_ARITY_3 = 3;\n\nexport type EmitModuleKind = \"CommonJS\" | \"ESNext\" | \"Node16\";\n\nexport interface ModeOptions {\n readonly moduleResolution: ResolutionKind;\n readonly module: EmitModuleKind;\n}\n\nconst SINGLE = 1;\nconst RESOLUTION_MODES: ReadonlyMap<string, ResolutionMode> = new Map([\n [\"import\", \"ESNext\"],\n [\"require\", \"CommonJS\"],\n]);\n\nconst resolutionModeOf = (text: string): Option.Option<ResolutionMode> =>\n Option.fromNullishOr(RESOLUTION_MODES.get(text));\n\nconst isTypeOnlyImport = (clause: Node | undefined): boolean =>\n Option.fromNullishOr(clause).pipe(\n Option.filter((node) => isImportClause(node)),\n Option.exists((node) => node.phaseModifier === SyntaxKind.TypeKeyword),\n );\n\nconst resolutionModeOverride = (attributes: Node | undefined): Option.Option<ResolutionMode> =>\n Option.fromNullishOr(attributes).pipe(\n Option.filter((node) => isImportAttributes(node)),\n Option.map((node) => node.attributes),\n Option.filter((elements) => elements.length === SINGLE),\n Option.flatMap((elements) => Arr.head(elements)),\n Option.filter(\n (element) => isStringLiteralLikeNode(element.name) && element.name.text === \"resolution-mode\",\n ),\n Option.flatMap((element) =>\n Option.liftPredicate(element.value, (value) => isStringLiteralLikeNode(value)),\n ),\n Option.flatMap((value) => resolutionModeOf(value.text)),\n );\n\ntype TypeOnlyStatement = ExportDeclaration | ImportDeclaration | JSDocImportTag;\n\nconst isTypeOnlyExport = (node: Node): node is ExportDeclaration =>\n isExportDeclaration(node) && node.isTypeOnly;\n\nconst isImportStatement = (node: Node): node is ImportDeclaration | JSDocImportTag =>\n isImportDeclaration(node) || isJSDocImportTag(node);\n\nconst isTypeOnlyImportStatement = (node: Node): node is ImportDeclaration | JSDocImportTag =>\n isImportStatement(node) && isTypeOnlyImport(node.importClause);\n\nconst isTypeOnlyStatement = (node: Node): node is TypeOnlyStatement =>\n isTypeOnlyExport(node) || isTypeOnlyImportStatement(node);\n\nconst typeOnlyOverride = (usage: Node): Option.Option<ResolutionMode> =>\n Option.liftPredicate(usage.parent, isTypeOnlyStatement).pipe(\n Option.flatMap((statement) => resolutionModeOverride(statement.attributes)),\n );\n\nconst importTypeOverride = (usage: Node): Option.Option<ResolutionMode> =>\n Option.fromNullishOr(usage.parent.parent).pipe(\n Option.filter((node) => isImportTypeNode(node)),\n Option.flatMap((node) => resolutionModeOverride(node.attributes)),\n );\n\nconst importSyntaxAffectsModuleResolution = (options: ModeOptions): boolean =>\n options.moduleResolution !== \"Node10\";\n\ninterface ExplicitFormat {\n readonly format: ResolutionMode;\n readonly scopeType: string;\n readonly extensions: readonly string[];\n}\n\nconst EXPLICIT_FORMATS: readonly ExplicitFormat[] = [\n { format: \"CommonJS\", scopeType: \"commonjs\", extensions: [\".cjs\", \".cts\"] },\n { format: \"ESNext\", scopeType: \"module\", extensions: [\".mjs\", \".mts\"] },\n];\n\nconst declaresFormat = (\n sourceFile: SourceFile,\n scopeType: Option.Option<unknown>,\n explicit: ExplicitFormat,\n): boolean =>\n Option.contains(scopeType, explicit.scopeType) ||\n fileExtensionIsOneOf(sourceFile.fileName, explicit.extensions);\n\nconst explicitFormatOf = (\n sourceFile: SourceFile,\n implied: Option.Option<ResolutionMode>,\n): Option.Option<ResolutionMode> => {\n const scopeType = packageJsonScopeOf(sourceFile).pipe(\n Option.map((scope) => scope.contents.packageJsonContent[\"type\"]),\n );\n return Arr.findFirst(\n EXPLICIT_FORMATS,\n (explicit) =>\n Option.contains(implied, explicit.format) && declaresFormat(sourceFile, scopeType, explicit),\n ).pipe(Option.map((explicit) => explicit.format));\n};\n\nconst impliedNodeFormatForEmit = (\n sourceFile: SourceFile,\n options: ModeOptions,\n): Option.Option<ResolutionMode> => {\n const implied = impliedNodeFormatOf(sourceFile);\n if (options.module === \"Node16\") {\n return implied;\n }\n return explicitFormatOf(sourceFile, implied);\n};\n\nconst emitModuleFormat = (sourceFile: SourceFile, options: ModeOptions): EmitModuleKind =>\n impliedNodeFormatForEmit(sourceFile, options).pipe(Option.getOrElse(() => options.module));\n\nconst walkUpParentheses = (node: Node): Node => {\n let current = node;\n while (isParenthesizedExpression(current)) {\n current = current.parent;\n }\n return current;\n};\n\nconst isRequireCall = (node: Node): boolean =>\n isCallExpression(node) &&\n isIdentifier(node.expression) &&\n node.expression.text === \"require\" &&\n node.arguments.length === SINGLE;\n\nconst isImportCall = (node: Node): boolean =>\n isCallExpression(node) && node.expression.kind === SyntaxKind.ImportKeyword;\n\nconst importCallMode = (sourceFile: SourceFile, options: ModeOptions): ResolutionMode => {\n if (options.module !== \"Node16\" && emitModuleFormat(sourceFile, options) === \"CommonJS\") {\n return \"CommonJS\";\n }\n return \"ESNext\";\n};\n\nconst isCommonJsSyntax = (container: Node, usage: Node): boolean =>\n isImportEqualsDeclaration(container.parent) || isRequireCall(usage.parent);\n\nconst emitSyntaxForUsage = (\n sourceFile: SourceFile,\n usage: Node,\n options: ModeOptions,\n): Option.Option<ResolutionMode> => {\n const container = walkUpParentheses(usage.parent);\n if (isCommonJsSyntax(container, usage)) {\n return Option.some(\"CommonJS\");\n }\n if (isImportCall(container)) {\n return Option.some(importCallMode(sourceFile, options));\n }\n return Option.liftPredicate(\n emitModuleFormat(sourceFile, options),\n (format): format is ResolutionMode => format !== \"Node16\",\n );\n};\n\nexport const getModeForUsageLocation: {\n (usage: Node, options: ModeOptions): (sourceFile: SourceFile) => Option.Option<ResolutionMode>;\n (sourceFile: SourceFile, usage: Node, options: ModeOptions): Option.Option<ResolutionMode>;\n} = Fn.dual(\n DATA_FIRST_ARITY_3,\n (sourceFile: SourceFile, usage: Node, options: ModeOptions): Option.Option<ResolutionMode> =>\n typeOnlyOverride(usage).pipe(\n Option.orElse(() => importTypeOverride(usage)),\n Option.orElse(() =>\n Option.liftPredicate(options, importSyntaxAffectsModuleResolution).pipe(\n Option.flatMap(() => emitSyntaxForUsage(sourceFile, usage, options)),\n ),\n ),\n ),\n);\n\nexport const getDefaultResolutionModeForFile: {\n (options: ModeOptions): (sourceFile: SourceFile) => Option.Option<ResolutionMode>;\n (sourceFile: SourceFile, options: ModeOptions): Option.Option<ResolutionMode>;\n} = Fn.dual(\n DATA_FIRST_ARITY,\n (sourceFile: SourceFile, options: ModeOptions): Option.Option<ResolutionMode> =>\n Option.liftPredicate(options, importSyntaxAffectsModuleResolution).pipe(\n Option.flatMap(() => impliedNodeFormatForEmit(sourceFile, options)),\n ),\n);\n","import { Option } from \"effect\";\nimport { ModuleKind } from \"typescript/sync\";\n\nimport type { ResolutionMode } from \"./resolution-types.ts\";\n\nconst MODE_NUMBERS: Readonly<Record<ResolutionMode, ModuleKind>> = {\n CommonJS: ModuleKind.CommonJS,\n ESNext: ModuleKind.ESNext,\n};\n\nconst MODES_BY_NUMBER: ReadonlyMap<number, ResolutionMode> = new Map([\n [ModuleKind.CommonJS, \"CommonJS\"],\n [ModuleKind.ESNext, \"ESNext\"],\n]);\n\nexport const modeFromNumber = (mode: number | undefined): Option.Option<ResolutionMode> =>\n Option.fromNullishOr(mode).pipe(\n Option.flatMap((value) => Option.fromNullishOr(MODES_BY_NUMBER.get(value))),\n );\n\nexport const modeToNumber = (mode: ResolutionMode): ModuleKind => MODE_NUMBERS[mode];\n","import { Option, Predicate, Array as Arr, String as Str, pipe, Function as Fn } from \"effect\";\nimport type { SourceFile } from \"typescript/ast\";\nimport { serverFS } from \"typescript/fs\";\nimport type { FileSystemCallbacks, FileSystemEntries } from \"typescript/fs\";\nimport { API } from \"typescript/sync\";\nimport type { ScriptKind } from \"typescript/sync\";\n\nimport { ensureTrailingDirectorySeparator } from \"./paths.ts\";\n\nconst DATA_FIRST_ARITY_3 = 3;\n\nexport interface VirtualFileSystem {\n readonly fileExists: (path: string) => boolean;\n readonly directoryExists: (path: string) => boolean;\n readonly readFile: (path: string) => Option.Option<string>;\n readonly listFiles: () => readonly string[];\n}\n\ninterface Mount {\n readonly fileSystem: VirtualFileSystem;\n readonly path: string;\n}\n\nexport interface MountedFileSystem {\n readonly fileSystem: VirtualFileSystem;\n readonly root: string;\n}\n\nconst MOUNT_ROOT = \"/attw\";\nconst SEPARATOR = \"/\";\nconst START = 0;\nconst SECOND = 1;\nconst MOUNT_DIRECTORY = Str.slice(SEPARATOR.length)(MOUNT_ROOT);\n\nconst mounts = new Map<string, WeakRef<VirtualFileSystem>>();\nconst counter = { next: 0 };\n\nconst mountOf = (path: string): Option.Option<Mount> => {\n if (!Str.startsWith(`${MOUNT_ROOT}${SEPARATOR}`)(path)) {\n return Option.none();\n }\n const rest = Str.slice(MOUNT_ROOT.length + SEPARATOR.length)(path);\n const id = Option.match(\n Option.filter(Str.indexOf(SEPARATOR)(rest), (index) => index >= SECOND),\n {\n onNone: () => rest,\n onSome: (index) => Str.slice(START, index)(rest),\n },\n );\n const inner = Option.liftPredicate(\n Str.slice(id.length)(rest),\n (remainder) => remainder.length > START,\n );\n return Option.fromNullishOr(mounts.get(id)).pipe(\n Option.flatMap((reference) => Option.fromNullishOr(reference.deref())),\n Option.map((fileSystem) => ({ fileSystem, path: Option.getOrElse(inner, () => SEPARATOR) })),\n );\n};\n\nconst uniqueEntries = (names: readonly string[]): string[] => [...new Set(names)];\n\nconst childEntries = (paths: readonly string[], directory: string): FileSystemEntries => {\n const prefix = ensureTrailingDirectorySeparator(directory);\n const children = pipe(\n paths,\n Arr.filter((path) => Str.startsWith(prefix)(path)),\n Arr.map((path) => Str.slice(prefix.length)(path)),\n );\n const nested = pipe(\n children,\n Arr.filter((child) => Str.includes(SEPARATOR)(child)),\n );\n return {\n files: uniqueEntries(\n pipe(\n children,\n Arr.filter((child) => !Str.includes(SEPARATOR)(child)),\n ),\n ),\n directories: uniqueEntries(\n pipe(\n nested,\n Arr.map((child) =>\n Option.match(Str.indexOf(SEPARATOR)(child), {\n onNone: () => child,\n onSome: (end) => Str.slice(START, end)(child),\n }),\n ),\n ),\n ),\n symlinks: [],\n };\n};\n\nconst liveMountIds = (): string[] =>\n pipe(\n [...mounts.entries()],\n Arr.filter(([, reference]) => Predicate.isNotUndefined(reference.deref())),\n Arr.map(([id]) => id),\n );\n\nconst ANCESTOR_DIRECTORIES: ReadonlyMap<string, () => readonly string[]> = new Map([\n [SEPARATOR, (): readonly string[] => [MOUNT_DIRECTORY]],\n [MOUNT_ROOT, liveMountIds],\n]);\n\nconst ancestorEntries = (path: string): FileSystemEntries => ({\n files: [],\n directories: Option.fromNullishOr(ANCESTOR_DIRECTORIES.get(path)).pipe(\n Option.map((directories) => [...directories()]),\n Option.getOrElse((): string[] => []),\n ),\n symlinks: [],\n});\n\nconst isMountAncestor = (path: string): boolean =>\n path === SEPARATOR || path === MOUNT_ROOT || Option.isSome(mountOf(`${path}${SEPARATOR}`));\n\nconst routedFileSystem: FileSystemCallbacks = {\n fileExists: (path) =>\n Option.match(mountOf(path), {\n onNone: () => false,\n onSome: (mount) => mount.fileSystem.fileExists(mount.path),\n }),\n directoryExists: (path) =>\n Option.match(mountOf(path), {\n onNone: () => isMountAncestor(path),\n onSome: (mount) => mount.path === SEPARATOR || mount.fileSystem.directoryExists(mount.path),\n }),\n readFile: (path) =>\n Option.getOrUndefined(\n mountOf(path).pipe(Option.flatMap((mount) => mount.fileSystem.readFile(mount.path))),\n ),\n getAccessibleEntries: (path) =>\n Option.match(mountOf(path), {\n onNone: () => ancestorEntries(path),\n onSome: (mount) => childEntries(mount.fileSystem.listFiles(), mount.path),\n }),\n realpath: serverFS.identity,\n stat: serverFS.fakeStat,\n writeFile: serverFS.error,\n removeFile: serverFS.error,\n};\n\nconst holder: { api: Option.Option<API> } = { api: Option.none() };\n\nexport const sharedApi = (): API =>\n Option.getOrElse(holder.api, () => {\n const created = new API({\n cwd: SEPARATOR,\n useCaseSensitiveFileNames: true,\n fs: routedFileSystem,\n });\n holder.api = Option.some(created);\n return created;\n });\n\nexport const mount = (fileSystem: VirtualFileSystem): MountedFileSystem => {\n counter.next += SECOND;\n const id = String(counter.next);\n for (const [key, reference] of mounts) {\n if (Predicate.isUndefined(reference.deref())) {\n mounts.delete(key);\n }\n }\n mounts.set(id, new WeakRef(fileSystem));\n return { fileSystem, root: `${MOUNT_ROOT}${SEPARATOR}${id}` };\n};\n\nexport const parseSourceFile: {\n (text: string, scriptKind: Option.Option<ScriptKind>): (fileName: string) => SourceFile;\n (fileName: string, text: string, scriptKind: Option.Option<ScriptKind>): SourceFile;\n} = Fn.dual(\n DATA_FIRST_ARITY_3,\n (fileName: string, text: string, scriptKind: Option.Option<ScriptKind>): SourceFile => {\n const retained = sharedApi().createSourceFile(\n fileName,\n text,\n Option.match(scriptKind, { onNone: () => ({}), onSome: (kind) => ({ scriptKind: kind }) }),\n );\n const { sourceFile } = retained;\n retained.dispose();\n return sourceFile;\n },\n);\n","import { Option, Predicate, Record as Rec } from \"effect\";\nimport { ScriptKind } from \"typescript/ast\";\nimport type { Node, SourceFile } from \"typescript/ast\";\nimport { ModuleKind, ModuleResolutionKind } from \"typescript/sync\";\n\nimport { bindSourceFile } from \"./binder.ts\";\nimport { getModeForUsageLocation as modeForUsage } from \"./module-mode.ts\";\nimport type { ModeOptions } from \"./module-mode.ts\";\nimport { getNormalizedAbsolutePath } from \"./paths.ts\";\nimport { modeToNumber } from \"./resolution-mode-numbers.ts\";\nimport { parseSourceFile } from \"./ts-api.ts\";\n\ntype CompilerOptionsLike = Readonly<Partial<Record<\"module\" | \"moduleResolution\", number>>>;\n\nconst ROOT = \"/\";\nconst SCRIPT_KIND_AFTER_TEXT = 2;\n\nconst RESOLUTION_NAMES: ReadonlyMap<number, ModeOptions[\"moduleResolution\"]> = new Map([\n [ModuleResolutionKind.Node10, \"Node10\"],\n [ModuleResolutionKind.Node16, \"Node16\"],\n [ModuleResolutionKind.NodeNext, \"Node16\"],\n [ModuleResolutionKind.Bundler, \"Bundler\"],\n]);\n\nconst MODULE_NAMES: ReadonlyMap<number, ModeOptions[\"module\"]> = new Map([\n [ModuleKind.CommonJS, \"CommonJS\"],\n [ModuleKind.ESNext, \"ESNext\"],\n [ModuleKind.Node16, \"Node16\"],\n [ModuleKind.NodeNext, \"Node16\"],\n]);\n\nconst SCRIPT_KINDS: ReadonlySet<unknown> = new Set(Rec.values(ScriptKind));\n\nconst resolutionNameOf = (kind: number | undefined): ModeOptions[\"moduleResolution\"] =>\n Option.fromNullishOr(kind).pipe(\n Option.flatMapNullishOr((value) => RESOLUTION_NAMES.get(value)),\n Option.getOrElse((): ModeOptions[\"moduleResolution\"] => \"Node10\"),\n );\n\nconst moduleNameOf = (kind: number | undefined): ModeOptions[\"module\"] =>\n Option.fromNullishOr(kind).pipe(\n Option.flatMapNullishOr((value) => MODULE_NAMES.get(value)),\n Option.getOrElse((): ModeOptions[\"module\"] => \"CommonJS\"),\n );\n\nconst modeOptionsOf = (options: CompilerOptionsLike): ModeOptions => ({\n moduleResolution: resolutionNameOf(options.moduleResolution),\n module: moduleNameOf(options.module),\n});\n\nconst getModeForUsageLocation = (\n sourceFile: SourceFile,\n usage: Node,\n options: CompilerOptionsLike,\n): ModuleKind | undefined =>\n Option.getOrUndefined(\n modeForUsage(sourceFile, usage, modeOptionsOf(options)).pipe(\n Option.map((mode) => modeToNumber(mode)),\n ),\n );\n\nconst isScriptKind = (value: unknown): value is ScriptKind =>\n Predicate.isNumber(value) && SCRIPT_KINDS.has(value);\n\nconst createSourceFile = (\n fileName: string,\n text: string,\n ...parseArguments: readonly unknown[]\n): SourceFile =>\n parseSourceFile(\n getNormalizedAbsolutePath(fileName, ROOT),\n text,\n Option.liftPredicate(parseArguments[SCRIPT_KIND_AFTER_TEXT], isScriptKind),\n );\n\nexport const fileFunctions = { bindSourceFile, createSourceFile, getModeForUsageLocation };\n","import { Option, Predicate } from \"effect\";\nimport type { Node } from \"typescript/ast\";\nimport {\n isArrayLiteralExpression,\n isArrowFunction,\n isBinaryExpression,\n isBlock,\n isCallExpression,\n isExpressionStatement,\n isForInStatement,\n isFunctionExpression,\n isIdentifier,\n isNumericLiteral,\n isObjectLiteralExpression,\n isPropertyAccessExpression,\n isPropertyAssignment,\n isReturnStatement,\n isShorthandPropertyAssignment,\n isSourceFile,\n isStringLiteral,\n isStringLiteralLikeNode,\n isVariableDeclaration,\n} from \"typescript/ast/is\";\n\nimport { isFunctionLike } from \"./binder-scopes.ts\";\nimport {\n isAccessExpression,\n isStringOrNumericLiteralLike,\n skipParentheses,\n} from \"./binder-syntax.ts\";\nimport type { AccessExpression } from \"./binder-syntax.ts\";\n\ntype AncestorVerdict = boolean | \"quit\";\n\nconst QUIT = \"quit\";\n\nconst toleratingAbsence =\n <Narrowed extends Node>(guard: (node: Node) => node is Narrowed) =>\n (node: Node | undefined): node is Narrowed =>\n Predicate.isNotUndefined(node) && guard(node);\n\nconst isFunctionBlock = (node: Node | undefined): boolean =>\n Predicate.isNotUndefined(node) && isBlock(node) && isFunctionLike(node.parent);\n\nconst isFunctionExpressionOrArrowFunction = (node: Node | undefined): boolean =>\n Predicate.isNotUndefined(node) && (isFunctionExpression(node) || isArrowFunction(node));\n\nconst ancestorMatching = (\n node: Option.Option<Node>,\n judge: (candidate: Node) => AncestorVerdict,\n): Option.Option<Node> => {\n if (Option.isNone(node)) {\n return node;\n }\n const verdict = judge(node.value);\n if (verdict === QUIT) {\n return Option.none();\n }\n if (verdict) {\n return node;\n }\n return ancestorMatching(Option.fromNullishOr(node.value.parent), judge);\n};\n\nconst findAncestor = (\n node: Node | undefined,\n judge: (candidate: Node) => AncestorVerdict,\n): Node | undefined => Option.getOrUndefined(ancestorMatching(Option.fromNullishOr(node), judge));\n\nconst getNameOfAccessExpression = (node: AccessExpression): Node => {\n if (isPropertyAccessExpression(node)) {\n return node.name;\n }\n return skipParentheses(node.argumentExpression);\n};\n\nexport const nodeFunctions = {\n findAncestor,\n forEachChild: (node: Node, visit: (child: Node) => unknown): unknown => node.forEachChild(visit),\n getNameOfAccessExpression,\n isAccessExpression: toleratingAbsence(isAccessExpression),\n isArrayLiteralExpression: toleratingAbsence(isArrayLiteralExpression),\n isBinaryExpression: toleratingAbsence(isBinaryExpression),\n isBlock: toleratingAbsence(isBlock),\n isCallExpression: toleratingAbsence(isCallExpression),\n isExpressionStatement: toleratingAbsence(isExpressionStatement),\n isForInStatement: toleratingAbsence(isForInStatement),\n isFunctionBlock,\n isFunctionExpression: toleratingAbsence(isFunctionExpression),\n isFunctionExpressionOrArrowFunction,\n isIdentifier: toleratingAbsence(isIdentifier),\n isNumericLiteral: toleratingAbsence(isNumericLiteral),\n isObjectLiteralExpression: toleratingAbsence(isObjectLiteralExpression),\n isPropertyAssignment: toleratingAbsence(isPropertyAssignment),\n isReturnStatement: toleratingAbsence(isReturnStatement),\n isShorthandPropertyAssignment: toleratingAbsence(isShorthandPropertyAssignment),\n isSourceFile: toleratingAbsence(isSourceFile),\n isStringLiteral: toleratingAbsence(isStringLiteral),\n isStringLiteralLike: toleratingAbsence(isStringLiteralLikeNode),\n isStringOrNumericLiteralLike: toleratingAbsence(isStringOrNumericLiteralLike),\n isVariableDeclaration: toleratingAbsence(isVariableDeclaration),\n skipParentheses,\n};\n","import { Option, String as Str, Function as Fn } from \"effect\";\n\nimport { Messages, traceMessage } from \"./messages.ts\";\nimport type { ResolutionState } from \"./resolution-types.ts\";\nimport { indexFrom } from \"./text-search.ts\";\n\nconst DATA_FIRST_ARITY = 2;\n\nexport interface PackageNameParts {\n readonly packageName: string;\n readonly rest: string;\n}\n\nconst NEXT = 1;\nconst START = 0;\nconst SCOPE_SEPARATOR = \"__\";\nconst SCOPE_MARKER_LENGTH = 1;\n\nconst packageNameEnd = (moduleName: string): Option.Option<number> => {\n const first = Str.indexOf(\"/\")(moduleName);\n if (Str.startsWith(\"@\")(moduleName)) {\n return first.pipe(Option.flatMap((index) => indexFrom(moduleName, \"/\", index + NEXT)));\n }\n return first;\n};\n\nexport const parsePackageName = (moduleName: string): PackageNameParts =>\n Option.match(packageNameEnd(moduleName), {\n onNone: () => ({ packageName: moduleName, rest: \"\" }),\n onSome: (end) => ({\n packageName: Str.slice(START, end)(moduleName),\n rest: Str.slice(end + NEXT)(moduleName),\n }),\n });\n\nexport const mangleScopedPackageName = (packageName: string): string => {\n if (!Str.startsWith(\"@\")(packageName)) {\n return packageName;\n }\n const replaced = Str.replace(\"/\", SCOPE_SEPARATOR)(packageName);\n if (replaced === packageName) {\n return packageName;\n }\n return Str.slice(SCOPE_MARKER_LENGTH)(replaced);\n};\n\nexport const unmangleScopedPackageName = (typesPackageName: string): string => {\n if (!Str.includes(SCOPE_SEPARATOR)(typesPackageName)) {\n return typesPackageName;\n }\n return `@${Str.replace(SCOPE_SEPARATOR, \"/\")(typesPackageName)}`;\n};\n\nexport const getTypesPackageName = (packageName: string): string =>\n `@types/${mangleScopedPackageName(packageName)}`;\n\nexport const mangleScopedPackageNameWithTrace: {\n (state: ResolutionState): (packageName: string) => string;\n (packageName: string, state: ResolutionState): string;\n} = Fn.dual(DATA_FIRST_ARITY, (packageName: string, state: ResolutionState): string => {\n const mangled = mangleScopedPackageName(packageName);\n if (mangled !== packageName) {\n traceMessage(state, Messages.scopedPackageDetected, mangled);\n }\n return mangled;\n});\n","import { Array as Arr, Option, String as Str, pipe, Function as Fn } from \"effect\";\n\nimport { getRootLength } from \"./path-roots.ts\";\nimport { RELATIVE_SEGMENT, getPathComponents, reducePathComponents } from \"./paths.ts\";\n\nconst DATA_FIRST_ARITY = 2;\nconst FIRST = 0;\nconst SECOND = 1;\n\nconst compareStrings = (left: string, right: string): number =>\n Math.sign(Number(left > right) - Number(left < right));\n\nconst compareCaseInsensitive = (left: string, right: string): number =>\n compareStrings(Str.toUpperCase(left), Str.toUpperCase(right));\n\nconst compareComponents = (left: readonly string[], right: readonly string[]): number =>\n pipe(\n Arr.zip(left, right),\n Arr.drop(SECOND),\n Arr.map(([leftComponent, rightComponent]) =>\n compareCaseInsensitive(leftComponent, rightComponent),\n ),\n Arr.findFirst((result) => result !== FIRST),\n Option.getOrElse(() => Math.sign(left.length - right.length)),\n );\n\nconst compareRests = (left: string, right: string): number => {\n if (!RELATIVE_SEGMENT.test(left) && !RELATIVE_SEGMENT.test(right)) {\n return compareCaseInsensitive(left, right);\n }\n return compareComponents(\n reducePathComponents(getPathComponents(left)),\n reducePathComponents(getPathComponents(right)),\n );\n};\n\nexport const comparePathsCaseInsensitive: {\n (right: string): (left: string) => number;\n (left: string, right: string): number;\n} = Fn.dual(DATA_FIRST_ARITY, (left: string, right: string): number => {\n const leftRoot = Str.slice(FIRST, getRootLength(left))(left);\n const rightRoot = Str.slice(FIRST, getRootLength(right))(right);\n return Option.liftPredicate(\n compareCaseInsensitive(leftRoot, rightRoot),\n (result) => result !== FIRST,\n ).pipe(\n Option.getOrElse(() =>\n compareRests(Str.slice(leftRoot.length)(left), Str.slice(rightRoot.length)(right)),\n ),\n );\n});\n","import { Option } from \"effect\";\n\nimport {\n Extension,\n hasJSFileExtension,\n hasTSFileExtension,\n isDeclarationFileName,\n} from \"./extensions.ts\";\nimport { getTypesPackageName, unmangleScopedPackageName } from \"./package-names.ts\";\nimport { comparePathsCaseInsensitive } from \"./path-compare.ts\";\nimport {\n combinePaths,\n ensureTrailingDirectorySeparator,\n forEachAncestorDirectory as forEachAncestor,\n pathIsRelative,\n} from \"./paths.ts\";\n\nconst forEachAncestorDirectory = <Found>(\n directory: string,\n visit: (ancestor: string) => Found | undefined,\n): Found | undefined =>\n Option.getOrUndefined(\n forEachAncestor(directory, (ancestor) => Option.fromUndefinedOr(visit(ancestor))),\n );\n\nexport const pathFunctions = {\n Extension,\n combinePaths,\n comparePathsCaseInsensitive,\n ensureTrailingDirectorySeparator,\n forEachAncestorDirectory,\n getTypesPackageName,\n hasJSFileExtension,\n hasTSFileExtension,\n isDeclarationFileName,\n pathIsRelative,\n unmangleScopedPackageName,\n};\n","import {\n InternalSymbolName,\n ModifierFlags,\n ScriptKind,\n ScriptTarget,\n SyntaxKind,\n} from \"typescript/ast\";\nimport { ModuleKind, ModuleResolutionKind, SymbolFlags, TypeFlags } from \"typescript/sync\";\n\nimport { hasSyntacticModifier } from \"./binder-names.ts\";\nimport { escapeLeadingUnderscores, unescapeLeadingUnderscores } from \"./binder-symbols.ts\";\nimport { RESOLUTION_VERSION } from \"./types-versions.ts\";\nimport { fileFunctions } from \"./typescript-files.ts\";\nimport { nodeFunctions } from \"./typescript-guards.ts\";\nimport { pathFunctions } from \"./typescript-paths.ts\";\n\nconst ts = {\n ...fileFunctions,\n ...nodeFunctions,\n ...pathFunctions,\n InternalSymbolName,\n ModifierFlags,\n ModuleKind,\n ModuleResolutionKind,\n ScriptKind,\n ScriptTarget,\n SymbolFlags,\n SyntaxKind,\n TypeFlags,\n escapeLeadingUnderscores,\n hasSyntacticModifier,\n unescapeLeadingUnderscores,\n version: RESOLUTION_VERSION,\n};\n\nexport default ts;\n","export function defineCheck(options) {\n return options;\n}\n//# sourceMappingURL=defineCheck.js.map","import ts from \"typescript\";\nimport { defineCheck } from \"../defineCheck.js\";\nexport default defineCheck({\n name: \"CJSOnlyExportsDefault\",\n dependencies: ({ entrypoints, subpath, resolutionKind }) => {\n var _a;\n const entrypoint = entrypoints[subpath].resolutions[resolutionKind];\n const implementationFileName = (_a = entrypoint.implementationResolution) === null || _a === void 0 ? void 0 : _a.fileName;\n return [implementationFileName, resolutionKind];\n },\n execute: ([implementationFileName, resolutionKind], context) => {\n var _a, _b;\n var _c;\n if (!implementationFileName) {\n return;\n }\n if (resolutionKind === \"node10\" || resolutionKind === \"node16-cjs\") {\n // Here, we have a CJS file (most likely transpiled ESM) resolving to a\n // CJS transpiled ESM file. This is fine when considered in isolation.\n // The pattern of having `module.exports.default = ...` is a problem\n // primarily because ESM-detected files in Node (and the same files in\n // Webpack/esbuild) will treat `module.exports` as the default export,\n // which is both unexpected and different from Babel-style interop seen\n // in transpiled default imports and most bundler scenarios. But if Node,\n // Webpack, and esbuild never see this file, then it's fine. So, while\n // the problematic pattern is a feature of the file alone, the bad outcome\n // comes from a combination of the file and the module system that imports\n // it. For dual packages that point Node imports and bundlers to a true\n // ESM default export, while pointing requires to this CJS \"default export,\"\n // we don't want to report a problem.\n //\n // TODO: It would be nice to report this information *somehow*, as neutral\n // metadata attached to the file (c.f. `Analysis[\"programInfo\"]`).\n return;\n }\n const host = (_c = context.hosts.findHostForFiles([implementationFileName])) !== null && _c !== void 0 ? _c : context.hosts.bundler;\n const sourceFile = host.getSourceFile(implementationFileName);\n if (!sourceFile.externalModuleIndicator &&\n sourceFile.commonJsModuleIndicator &&\n ((_b = (_a = sourceFile.symbol) === null || _a === void 0 ? void 0 : _a.exports) === null || _b === void 0 ? void 0 : _b.has(ts.InternalSymbolName.Default)) &&\n sourceFile.symbol.exports.has(ts.escapeLeadingUnderscores(\"__esModule\")) &&\n !sourceFile.symbol.exports.has(ts.InternalSymbolName.ExportEquals)) {\n const decl = sourceFile.symbol.exports.get(ts.InternalSymbolName.Default).declarations[0];\n return {\n kind: \"CJSOnlyExportsDefault\",\n fileName: implementationFileName,\n pos: decl.getStart(sourceFile),\n end: decl.end,\n };\n }\n },\n});\n//# sourceMappingURL=cjsOnlyExportsDefault.js.map","import { valid, validRange } from \"semver\";\nimport validatePackgeName from \"validate-npm-package-name\";\nexport const allResolutionOptions = [\"node10\", \"node16\", \"bundler\"];\nexport const allResolutionKinds = [\"node10\", \"node16-cjs\", \"node16-esm\", \"bundler\"];\nexport function getResolutionOption(resolutionKind) {\n switch (resolutionKind) {\n case \"node10\":\n return \"node10\";\n case \"node16-cjs\":\n case \"node16-esm\":\n return \"node16\";\n case \"bundler\":\n return \"bundler\";\n }\n}\nexport function getResolutionKinds(resolutionOption) {\n switch (resolutionOption) {\n case \"node10\":\n return [\"node10\"];\n case \"node16\":\n return [\"node16-cjs\", \"node16-esm\"];\n case \"bundler\":\n return [\"bundler\"];\n }\n}\nexport function isDefined(value) {\n return value !== undefined;\n}\nexport function resolvedThroughFallback(traces) {\n let i = 0;\n while (i < traces.length) {\n i = traces.indexOf(\"Entering conditional exports.\", i);\n if (i === -1) {\n return false;\n }\n if (conditionalExportsResolvedThroughFallback()) {\n return true;\n }\n }\n function conditionalExportsResolvedThroughFallback() {\n i++;\n let seenFailure = false;\n for (; i < traces.length; i++) {\n if (traces[i].startsWith(\"Failed to resolve under condition '\")) {\n seenFailure = true;\n }\n else if (seenFailure && traces[i].startsWith(\"Resolved under condition '\")) {\n return true;\n }\n else if (traces[i] === \"Entering conditional exports.\") {\n if (conditionalExportsResolvedThroughFallback()) {\n return true;\n }\n }\n else if (traces[i] === \"Exiting conditional exports.\") {\n return false;\n }\n }\n return false;\n }\n}\nexport function visitResolutions(entrypoints, visitor) {\n for (const entrypoint of Object.values(entrypoints)) {\n for (const resolution of Object.values(entrypoint.resolutions)) {\n if (visitor(resolution, entrypoint)) {\n return;\n }\n }\n }\n}\nexport function groupProblemsByKind(problems) {\n var _a;\n var _b;\n const result = {};\n for (const problem of problems) {\n ((_a = result[_b = problem.kind]) !== null && _a !== void 0 ? _a : (result[_b] = [])).push(problem);\n }\n return result;\n}\nexport function parsePackageSpec(input) {\n let name;\n let version;\n let i = 0;\n if (input.startsWith(\"@\")) {\n i = input.indexOf(\"/\");\n if (i === -1 || i === 1) {\n return {\n status: \"error\",\n error: \"Invalid package name\",\n };\n }\n i++;\n }\n i = input.indexOf(\"@\", i);\n if (i === -1) {\n name = input;\n }\n else {\n name = input.slice(0, i);\n version = input.slice(i + 1);\n }\n if (validatePackgeName(name).errors) {\n return {\n status: \"error\",\n error: \"Invalid package name\",\n };\n }\n if (!version) {\n return {\n status: \"success\",\n data: { versionKind: \"none\", name, version: \"\" },\n };\n }\n if (valid(version)) {\n return {\n status: \"success\",\n data: { versionKind: \"exact\", name, version },\n };\n }\n if (validRange(version)) {\n return {\n status: \"success\",\n data: { versionKind: \"range\", name, version },\n };\n }\n return {\n status: \"success\",\n data: { versionKind: \"tag\", name, version },\n };\n}\nexport const allBuildTools = Object.keys({\n \"@arethetypeswrong/cli\": true,\n typescript: true,\n rollup: true,\n \"@rollup/plugin-typescript\": true,\n \"@rollup/plugin-typescript2\": true,\n webpack: true,\n esbuild: true,\n \"parcel-bundler\": true,\n \"@preconstruct/cli\": true,\n vite: true,\n snowpack: true,\n microbundle: true,\n \"@microsoft/api-extractor\": true,\n tshy: true,\n \"@rspack/cli\": true,\n tsup: true,\n tsdown: true,\n});\n//# sourceMappingURL=utils.js.map","var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\n};\nvar __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\n};\nvar _Package_files;\nimport { untar } from \"@andrewbranch/untar.js\";\nimport { Gunzip, FlateErrorCode } from \"fflate\";\nimport { major, maxSatisfying, minor, valid, validRange } from \"semver\";\nimport ts from \"typescript\";\nimport { parsePackageSpec } from \"./utils.js\";\nexport class Package {\n constructor(files, packageName, packageVersion, resolvedUrl, typesPackage) {\n _Package_files.set(this, {});\n __classPrivateFieldSet(this, _Package_files, files, \"f\");\n this.packageName = packageName;\n this.packageVersion = packageVersion;\n this.resolvedUrl = resolvedUrl;\n this.typesPackage = typesPackage;\n }\n tryReadFile(path) {\n const file = __classPrivateFieldGet(this, _Package_files, \"f\")[path];\n if (file === undefined) {\n return undefined;\n }\n if (typeof file === \"string\") {\n return file;\n }\n const content = new TextDecoder().decode(file);\n __classPrivateFieldGet(this, _Package_files, \"f\")[path] = content;\n return content;\n }\n readFile(path) {\n const content = this.tryReadFile(path);\n if (content === undefined) {\n throw new Error(`File not found: ${path}`);\n }\n return content;\n }\n fileExists(path) {\n return path in __classPrivateFieldGet(this, _Package_files, \"f\");\n }\n directoryExists(path) {\n path = ts.ensureTrailingDirectorySeparator(path);\n for (const file in __classPrivateFieldGet(this, _Package_files, \"f\")) {\n if (file.startsWith(path)) {\n return true;\n }\n }\n return false;\n }\n containsTypes(directory = \"/\") {\n return this.listFiles(directory).some(ts.hasTSFileExtension);\n }\n listFiles(directory = \"/\") {\n directory = ts.ensureTrailingDirectorySeparator(directory);\n return directory === \"/\"\n ? Object.keys(__classPrivateFieldGet(this, _Package_files, \"f\"))\n : Object.keys(__classPrivateFieldGet(this, _Package_files, \"f\")).filter((f) => f.startsWith(directory));\n }\n mergedWithTypes(typesPackage) {\n const files = { ...__classPrivateFieldGet(this, _Package_files, \"f\"), ...__classPrivateFieldGet(typesPackage, _Package_files, \"f\") };\n return new Package(files, this.packageName, this.packageVersion, this.resolvedUrl, {\n packageName: typesPackage.packageName,\n packageVersion: typesPackage.packageVersion,\n resolvedUrl: typesPackage.resolvedUrl,\n });\n }\n}\n_Package_files = new WeakMap();\nexport async function createPackageFromNpm(packageSpec, { definitelyTyped = true, ...options } = {}) {\n const parsed = parsePackageSpec(packageSpec);\n if (parsed.status === \"error\") {\n throw new Error(parsed.error);\n }\n const packageName = parsed.data.name;\n const typesPackageName = ts.getTypesPackageName(packageName);\n const { tarballUrl, packageVersion } = parsed.data.versionKind === \"none\" && typeof definitelyTyped === \"string\"\n ? await resolveImplementationPackageForTypesPackage(typesPackageName, definitelyTyped, options)\n : await getNpmTarballUrl([parsed.data], options);\n const pkg = await createPackageFromTarballUrl(tarballUrl);\n if (!definitelyTyped || pkg.containsTypes()) {\n return pkg;\n }\n let typesPackageData;\n if (definitelyTyped === true) {\n typesPackageData = await resolveTypesPackageForPackage(packageName, packageVersion, options);\n }\n else {\n typesPackageData = await getNpmTarballUrl([\n {\n name: typesPackageName,\n versionKind: valid(definitelyTyped) ? \"exact\" : validRange(definitelyTyped) ? \"range\" : \"tag\",\n version: definitelyTyped,\n },\n ], options);\n }\n if (typesPackageData) {\n return pkg.mergedWithTypes(await createPackageFromTarballUrl(typesPackageData.tarballUrl));\n }\n return pkg;\n}\nexport async function resolveImplementationPackageForTypesPackage(typesPackageName, typesPackageVersion, options) {\n if (!typesPackageName.startsWith(\"@types/\")) {\n throw new Error(`'resolveImplementationPackageForTypesPackage' expects an @types package name and version`);\n }\n const packageName = ts.unmangleScopedPackageName(typesPackageName.slice(\"@types/\".length));\n const version = valid(typesPackageVersion);\n if (version) {\n return getNpmTarballUrl([\n parsePackageSpec(`${packageName}@${major(version)}.${minor(version)}`).data,\n parsePackageSpec(`${packageName}@${major(version)}`).data,\n parsePackageSpec(`${packageName}@latest`).data,\n ], options);\n }\n const range = validRange(typesPackageVersion);\n if (range) {\n return getNpmTarballUrl([\n { name: packageName, versionKind: \"range\", version: range },\n { name: packageName, versionKind: \"tag\", version: \"latest\" },\n ], options);\n }\n throw new Error(`'resolveImplementationPackageForTypesPackage' expects a valid SemVer version or range`);\n}\nexport async function resolveTypesPackageForPackage(packageName, packageVersion, options) {\n const typesPackageName = ts.getTypesPackageName(packageName);\n try {\n return await getNpmTarballUrl([\n {\n name: typesPackageName,\n versionKind: \"range\",\n version: `${major(packageVersion)}.${minor(packageVersion)}`,\n },\n {\n name: typesPackageName,\n versionKind: \"range\",\n version: `${major(packageVersion)}`,\n },\n {\n name: typesPackageName,\n versionKind: \"tag\",\n version: \"latest\",\n },\n ], options);\n }\n catch { }\n}\nasync function getNpmTarballUrl(packageSpecs, { before, allowDeprecated } = {}) {\n var _a, _b, _c;\n const fetchPackument = packageSpecs.some((spec) => spec.versionKind === \"range\" || (spec.versionKind === \"tag\" && spec.version !== \"latest\"));\n const packumentUrl = `https://registry.npmjs.org/${packageSpecs[0].name}`;\n const includeTimes = before !== undefined && packageSpecs.some((spec) => spec.versionKind !== \"exact\");\n const Accept = includeTimes ? \"application/json\" : \"application/vnd.npm.install-v1+json\";\n const packument = fetchPackument\n ? await fetch(packumentUrl, { headers: { Accept } }).then((r) => r.json())\n : undefined;\n for (const packageSpec of packageSpecs) {\n const manifestUrl = `https://registry.npmjs.org/${packageSpec.name}/${packageSpec.version || \"latest\"}`;\n const doc = packument || (await fetch(manifestUrl).then((r) => r.json()));\n if (typeof doc !== \"object\" || (doc.error && doc.error !== \"Not found\")) {\n throw new Error(`Unexpected response from ${manifestUrl}: ${JSON.stringify(doc)}`);\n }\n const isManifest = !!doc.version;\n let tarballUrl, packageVersion;\n if (packageSpec.versionKind === \"range\") {\n packageVersion =\n doc.versions &&\n maxSatisfying(Object.keys(doc.versions).filter((v) => (allowDeprecated || !doc.versions[v].deprecated) &&\n (!before || !doc.time || new Date(doc.time[v]) <= before)), packageSpec.version);\n if (!packageVersion) {\n continue;\n }\n tarballUrl = doc.versions[packageVersion].dist.tarball;\n }\n else if (packageSpec.versionKind === \"tag\" && packageSpec.version !== \"latest\") {\n packageVersion = doc[\"dist-tags\"][packageSpec.version];\n if (!packageVersion) {\n continue;\n }\n if (before && doc.time && new Date(doc.time[packageVersion]) > before) {\n continue;\n }\n tarballUrl = doc.versions[packageVersion].dist.tarball;\n }\n else if (isManifest) {\n packageVersion = doc.version;\n tarballUrl = (_a = doc.dist) === null || _a === void 0 ? void 0 : _a.tarball;\n }\n else {\n packageVersion = (_b = doc[\"dist-tags\"]) === null || _b === void 0 ? void 0 : _b.latest;\n tarballUrl = (_c = doc.versions) === null || _c === void 0 ? void 0 : _c[packageVersion].dist.tarball;\n }\n if (packageVersion && tarballUrl) {\n return { packageName: packageSpec.name, packageVersion, tarballUrl };\n }\n }\n throw new Npm404Error(packageSpecs);\n}\nexport class Npm404Error extends Error {\n constructor(packageSpecs) {\n super(`Failed to find a matching version for ${packageSpecs[0].name}`);\n this.packageSpecs = packageSpecs;\n this.kind = \"Npm404Error\";\n }\n}\nexport async function createPackageFromTarballUrl(tarballUrl) {\n const tarball = await fetchTarball(tarballUrl);\n const { files, packageName, packageVersion } = extractTarball(tarball);\n return new Package(files, packageName, packageVersion, tarballUrl);\n}\nasync function fetchTarball(tarballUrl) {\n return new Uint8Array((await fetch(tarballUrl).then((r) => r.arrayBuffer())));\n}\nexport function createPackageFromTarballData(tarball) {\n const { files, packageName, packageVersion } = extractTarball(tarball);\n return new Package(files, packageName, packageVersion);\n}\nfunction extractTarball(tarball) {\n var _a;\n // Use streaming API to work around https://github.com/101arrowz/fflate/issues/207\n const chunks = [];\n try {\n new Gunzip((chunk) => chunks.push(chunk)).push(tarball, /*final*/ true);\n }\n catch (err) {\n // this happens for zero-padded tarballs; can safely ignore\n if (err.code !== FlateErrorCode.InvalidHeader) {\n throw err;\n }\n }\n const unzipped = new Uint8Array(chunks.reduce((a, b) => a + b.length, 0));\n let offset = 0;\n for (const chunk of chunks) {\n unzipped.set(chunk, offset);\n offset += chunk.length;\n }\n const data = untar(unzipped.buffer);\n const prefix = data[0].filename.substring(0, data[0].filename.indexOf(\"/\") + 1);\n const packageJsonText = (_a = data.find((f) => f.filename === `${prefix}package.json`)) === null || _a === void 0 ? void 0 : _a.fileData;\n const packageJson = JSON.parse(new TextDecoder().decode(packageJsonText));\n const packageName = packageJson.name;\n const packageVersion = packageJson.version;\n const files = data.reduce((acc, file) => {\n acc[ts.combinePaths(\"/node_modules/\" + packageName, file.filename.substring(prefix.length))] = file.fileData;\n return acc;\n }, {});\n return { files, packageName, packageVersion };\n}\n//# sourceMappingURL=createPackage.js.map","import ts from \"typescript\";\n// Note: There is a pretty solid module `es-module-lexer` which performs a similar lexing operation\n// as `cjs-module-lexer`, but has some limitations in what it can express. This implementation\n// should be more complete.\nfunction* extractDestructedNames(node) {\n switch (node.kind) {\n case ts.SyntaxKind.ArrayBindingPattern:\n for (const element of node.elements) {\n if (element.kind === ts.SyntaxKind.BindingElement) {\n yield* extractDestructedNames(element.name);\n }\n }\n break;\n case ts.SyntaxKind.Identifier:\n yield node.text;\n break;\n case ts.SyntaxKind.ObjectBindingPattern:\n for (const element of node.elements) {\n yield* extractDestructedNames(element.name);\n }\n break;\n default:\n node;\n }\n}\nexport function getEsmModuleBindings(sourceText) {\n const options = {\n languageVersion: ts.ScriptTarget.ESNext,\n impliedNodeFormat: ts.ModuleKind.ESNext,\n };\n const sourceFile = ts.createSourceFile(\"module.cjs\", sourceText, options, false, ts.ScriptKind.JS);\n const exports = [];\n const reexports = [];\n for (const statement of sourceFile.statements) {\n switch (statement.kind) {\n case ts.SyntaxKind.ExportDeclaration: {\n const declaration = statement;\n const { exportClause } = declaration;\n if (!declaration.isTypeOnly) {\n if (exportClause) {\n if (exportClause.kind === ts.SyntaxKind.NamedExports) {\n // `export { foo }`;\n // `export { foo } from 'specifier'`;\n for (const element of exportClause.elements) {\n if (!element.isTypeOnly) {\n exports.push(element.name.text);\n }\n }\n }\n else {\n // `export * as namespace from 'specifier'`\n exports.push(exportClause.name.text);\n }\n }\n else if (declaration.moduleSpecifier && ts.isStringLiteral(declaration.moduleSpecifier)) {\n // `export * from 'specifier'`\n reexports.push(declaration.moduleSpecifier.text);\n }\n }\n break;\n }\n case ts.SyntaxKind.ExportAssignment: {\n const assignment = statement;\n if (!assignment.isExportEquals) {\n // `export default ...`\n exports.push(\"default\");\n }\n break;\n }\n case ts.SyntaxKind.ClassDeclaration:\n case ts.SyntaxKind.FunctionDeclaration: {\n const declaration = statement;\n if (ts.hasSyntacticModifier(declaration, ts.ModifierFlags.Export)) {\n if (ts.hasSyntacticModifier(declaration, ts.ModifierFlags.Default)) {\n // `export default class {}`\n // `export default function () {}`\n exports.push(\"default\");\n }\n else if (declaration.name) {\n // `export class Foo {}`\n // `export function foo() {}`\n exports.push(declaration.name.text);\n }\n }\n break;\n }\n case ts.SyntaxKind.VariableStatement: {\n const declaration = statement;\n if (ts.hasSyntacticModifier(declaration, ts.ModifierFlags.Export)) {\n // `export const foo = null;`\n // `export const { foo, bar } = null;`\n for (const declarator of declaration.declarationList.declarations) {\n exports.push(...extractDestructedNames(declarator.name));\n }\n }\n break;\n }\n }\n }\n return { exports, reexports };\n}\n//# sourceMappingURL=esmBindings.js.map","import { parse as cjsParse } from \"cjs-module-lexer\";\nexport function getCjsModuleBindings(sourceText) {\n return cjsParse(sourceText);\n}\n//# sourceMappingURL=cjsBindings.js.map","import * as cjs from \"@loaderkit/resolve/cjs\";\nimport * as esm from \"@loaderkit/resolve/esm\";\nfunction makeFileSystemAdapter(fs) {\n return {\n directoryExists: url => fs.directoryExists(url.pathname),\n fileExists: url => fs.fileExists(url.pathname),\n readFileJSON: (url) => JSON.parse(fs.readFile(url.pathname)),\n readLink: () => undefined,\n };\n}\nexport function cjsResolve(fs, specifier, parentURL) {\n return cjs.resolveSync(makeFileSystemAdapter(fs), specifier, parentURL);\n}\nexport function esmResolve(fs, specifier, parentURL) {\n return esm.resolveSync(makeFileSystemAdapter(fs), specifier, parentURL);\n}\n//# sourceMappingURL=resolve.js.map","import { Package } from \"../../createPackage.js\";\nimport { getCjsModuleBindings } from \"./cjsBindings.js\";\nimport { cjsResolve } from \"./resolve.js\";\nexport function getCjsModuleNamespace(fs, file, seen = new Set()) {\n seen.add(file.pathname);\n const exports = new Set();\n const bindings = getCjsModuleBindings(fs.readFile(file.pathname));\n bindings.exports.forEach((name) => exports.add(name));\n // CJS always exports `default`\n if (!exports.has(\"default\")) {\n exports.add(\"default\");\n }\n // Additionally, resolve facade reexports\n for (const source of bindings.reexports.reverse()) {\n try {\n const { format, url } = cjsResolve(fs, source, file);\n if (format === \"commonjs\" && !seen.has(url.pathname)) {\n const reexported = getCjsModuleNamespace(fs, url, seen);\n reexported.forEach((name) => exports.add(name));\n }\n }\n catch { }\n }\n return exports;\n}\n//# sourceMappingURL=cjsNamespace.js.map","import { Package } from \"../../createPackage.js\";\nimport { getEsmModuleBindings } from \"./esmBindings.js\";\nimport { getCjsModuleNamespace } from \"./cjsNamespace.js\";\nimport { esmResolve } from \"./resolve.js\";\n// Note: this doesn't handle ambiguous indirect exports which probably isn't worth the\n// implementation complexity.\nexport function getEsmModuleNamespace(fs, specifier, parentURL = new URL(\"file:///\"), seen = new Set()) {\n // Resolve specifier\n const { format, url } = esmResolve(fs, specifier, parentURL);\n // Don't recurse for circular indirect exports\n if (seen.has(url.pathname)) {\n return [];\n }\n seen.add(url.pathname);\n if (format === \"commonjs\") {\n return [...getCjsModuleNamespace(fs, url)];\n }\n // Parse module bindings\n const bindings = (format !== null && format !== void 0 ? format : \"module\") === \"module\"\n ? getEsmModuleBindings(fs.readFile(url.pathname))\n : // Maybe JSON, WASM, etc\n { exports: [\"default\"], reexports: [] };\n // Concat indirect exports\n const indirect = bindings.reexports\n .flatMap((specifier) => getEsmModuleNamespace(fs, specifier, url, seen))\n .filter((name) => name !== \"default\");\n return [...new Set([...bindings.exports, ...indirect])];\n}\n//# sourceMappingURL=esmNamespace.js.map","import ts from \"typescript\";\nimport { defineCheck } from \"../defineCheck.js\";\nimport { getEsmModuleNamespace } from \"../esm/esmNamespace.js\";\nimport { getResolutionOption } from \"../../utils.js\";\nexport default defineCheck({\n name: \"NamedExports\",\n dependencies: ({ entrypoints, subpath, resolutionKind, programInfo }) => {\n var _a, _b, _c, _d;\n const entrypoint = entrypoints[subpath].resolutions[resolutionKind];\n const typesFileName = ((_a = entrypoint.resolution) === null || _a === void 0 ? void 0 : _a.isTypeScript) && entrypoint.resolution.fileName;\n const resolutionOption = getResolutionOption(resolutionKind);\n const typesModuleKind = typesFileName ? (_b = programInfo[resolutionOption].moduleKinds) === null || _b === void 0 ? void 0 : _b[typesFileName] : undefined;\n const implementationFileName = (_c = entrypoint.implementationResolution) === null || _c === void 0 ? void 0 : _c.fileName;\n const implementationModuleKind = implementationFileName\n ? (_d = programInfo[resolutionOption].moduleKinds) === null || _d === void 0 ? void 0 : _d[implementationFileName]\n : undefined;\n return [implementationFileName, implementationModuleKind, typesFileName, typesModuleKind, resolutionKind];\n },\n execute: ([implementationFileName, implementationModuleKind, typesFileName, typesModuleKind, resolutionKind], context) => {\n if (!implementationFileName ||\n !typesFileName ||\n resolutionKind !== \"node16-esm\" ||\n (typesModuleKind === null || typesModuleKind === void 0 ? void 0 : typesModuleKind.detectedKind) !== ts.ModuleKind.CommonJS ||\n (implementationModuleKind === null || implementationModuleKind === void 0 ? void 0 : implementationModuleKind.detectedKind) !== ts.ModuleKind.CommonJS) {\n return;\n }\n // Get declared exported names from TypeScript\n const host = context.hosts.findHostForFiles([typesFileName]);\n const typesSourceFile = host.getSourceFile(typesFileName);\n if (typesSourceFile.scriptKind === ts.ScriptKind.JSON || !typesSourceFile.symbol) {\n return;\n }\n const typeChecker = host.createAuxiliaryProgram([typesFileName]).getTypeChecker();\n const moduleType = typeChecker.getTypeOfSymbol(typeChecker.resolveExternalModuleSymbol(typesSourceFile.symbol));\n if (typeChecker.isArrayLikeType(moduleType) || typeChecker.getPropertyOfType(moduleType, \"0\")) {\n return;\n }\n const expectedNames = Array.from(new Set(typeChecker\n .getExportsAndPropertiesOfModule(typesSourceFile.symbol)\n .filter((symbol) => {\n return (\n // TS treats `prototype` and other static class members as exports. There's possibly\n // a fix to be done in TS itself, since these show up as auto-imports.\n symbol.name !== \"prototype\" &&\n // @ts-expect-error `getSymbolFlags` extra arguments are not declared on TypeChecker\n typeChecker.getSymbolFlags(symbol, /*excludeTypeOnlyMeanings*/ true) & ts.SymbolFlags.Value);\n })\n .map((symbol) => symbol.name)));\n // Get actual exported names as seen by nodejs\n let exports;\n try {\n exports = getEsmModuleNamespace(context.pkg, implementationFileName);\n }\n catch {\n // If this fails then the result is indeterminate. This could happen in many cases, but\n // a common one would be for packages which re-export from another another package.\n return;\n }\n const missing = expectedNames.filter((name) => !exports.includes(name));\n if (missing.length > 0) {\n const lengthWithoutDefault = (names) => names.length - (names.includes(\"default\") ? 1 : 0);\n return {\n kind: \"NamedExports\",\n implementationFileName,\n typesFileName,\n isMissingAllNamed: lengthWithoutDefault(missing) === lengthWithoutDefault(expectedNames),\n missing,\n };\n }\n },\n});\n//# sourceMappingURL=namedExports.js.map","import ts from \"typescript\";\nimport { resolvedThroughFallback } from \"../../utils.js\";\nimport { defineCheck } from \"../defineCheck.js\";\nexport default defineCheck({\n name: \"EntrypointResolutions\",\n dependencies: ({ subpath, resolutionKind }) => [subpath, resolutionKind],\n execute: ([subpath, resolutionKind], context) => {\n var _a, _b;\n const problems = [];\n const entrypoint = context.entrypoints[subpath].resolutions[resolutionKind];\n if (entrypoint.isWildcard) {\n return;\n }\n if (!entrypoint.resolution) {\n problems.push({\n kind: \"NoResolution\",\n entrypoint: subpath,\n resolutionKind,\n });\n }\n else if (!entrypoint.resolution.isTypeScript && !entrypoint.resolution.isJson) {\n problems.push({\n kind: \"UntypedResolution\",\n entrypoint: subpath,\n resolutionKind,\n });\n }\n if (resolutionKind === \"node16-cjs\" &&\n ((!entrypoint.implementationResolution &&\n entrypoint.resolution &&\n ((_a = context.programInfo[\"node16\"].moduleKinds[entrypoint.resolution.fileName]) === null || _a === void 0 ? void 0 : _a.detectedKind) ===\n ts.ModuleKind.ESNext) ||\n (entrypoint.implementationResolution &&\n ((_b = context.programInfo[\"node16\"].moduleKinds[entrypoint.implementationResolution.fileName]) === null || _b === void 0 ? void 0 : _b.detectedKind) ===\n ts.ModuleKind.ESNext))) {\n problems.push({\n kind: \"CJSResolvesToESM\",\n entrypoint: subpath,\n resolutionKind,\n });\n }\n if (entrypoint.resolution && resolvedThroughFallback(entrypoint.resolution.trace)) {\n problems.push({\n kind: \"FallbackCondition\",\n entrypoint: subpath,\n resolutionKind,\n });\n }\n return problems;\n },\n});\n//# sourceMappingURL=entrypointResolutions.js.map","import ts from \"typescript\";\nconst minifiedVariableAssignmentPattern = /[^\\s];(?:var|let|const) [a-zA-Z0-9_]=[^\\s]/;\nexport function getProbableExports(sourceFile) {\n var _a, _b;\n return (_b = (_a = getEsbuildBabelSwcExports(sourceFile)) !== null && _a !== void 0 ? _a : getWebpackBootstrapExports(sourceFile)) !== null && _b !== void 0 ? _b : [];\n}\nfunction getEsbuildBabelSwcExports(sourceFile) {\n var _a, _b;\n let possibleIndex = sourceFile.text.indexOf(\"\\n__export(\");\n if (possibleIndex === -1) {\n possibleIndex = sourceFile.text.indexOf(\"\\n_export(\");\n }\n if (possibleIndex === -1 && !isProbablyMinified(sourceFile.text)) {\n return undefined;\n }\n for (const statement of sourceFile.statements) {\n if (possibleIndex !== -1 && statement.end < possibleIndex) {\n continue;\n }\n if (possibleIndex !== -1 && statement.pos > possibleIndex) {\n break;\n }\n if (ts.isExpressionStatement(statement) &&\n ts.isCallExpression(statement.expression) &&\n ts.isIdentifier(statement.expression.expression) &&\n statement.expression.arguments.length === 2 &&\n ts.isIdentifier(statement.expression.arguments[0]) &&\n ts.isObjectLiteralExpression(statement.expression.arguments[1])) {\n const callTarget = statement.expression.expression;\n const isExport = callTarget.text === \"__export\" ||\n callTarget.text === \"_export\" ||\n isEsbuildExportFunction((_b = (_a = sourceFile.locals) === null || _a === void 0 ? void 0 : _a.get(ts.escapeLeadingUnderscores(callTarget.text))) === null || _b === void 0 ? void 0 : _b.valueDeclaration);\n if (isExport) {\n return statement.expression.arguments[1].properties.flatMap((prop) => {\n if (ts.isPropertyAssignment(prop) &&\n (ts.isIdentifier(prop.name) || ts.isStringOrNumericLiteralLike(prop.name))) {\n return [{ name: prop.name.text, node: prop }];\n }\n if (ts.isShorthandPropertyAssignment(prop)) {\n return [{ name: prop.name.text, node: prop }];\n }\n return [];\n });\n }\n }\n }\n}\nfunction isEsbuildExportFunction(decl) {\n /*\n esbuild:\n var __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n };\n \n esbuild min:\n b=(o,r)=>{for(var e in r)n(o,e,{get:r[e],enumerable:!0})}\n \n swc?\n function _export(target, all) {\n for(var name in all)Object.defineProperty(target, name, {\n enumerable: true,\n get: all[name]\n });\n }\n */\n if (!decl) {\n return false;\n }\n return (ts.isVariableDeclaration(decl) &&\n decl.initializer &&\n ts.isFunctionExpressionOrArrowFunction(decl.initializer) &&\n ts.isBlock(decl.initializer.body) &&\n decl.initializer.body.statements.length == 1 &&\n ts.isForInStatement(decl.initializer.body.statements[0]));\n}\nfunction isProbablyMinified(text) {\n return minifiedVariableAssignmentPattern.test(text);\n}\nfunction getWebpackBootstrapExports(sourceFile) {\n var _a;\n for (const statement of sourceFile.statements) {\n if (!ts.isExpressionStatement(statement) || !ts.isBinaryExpression(statement.expression)) {\n continue;\n }\n const assignment = statement.expression;\n if (assignment.operatorToken.kind !== ts.SyntaxKind.EqualsToken || !isModuleExports(assignment.left)) {\n continue;\n }\n const bootstrapCall = ts.skipParentheses(assignment.right);\n if (!ts.isCallExpression(bootstrapCall)) {\n continue;\n }\n const bootstrap = ts.skipParentheses(bootstrapCall.expression);\n if (!ts.isFunctionExpression(bootstrap) ||\n !ts.isBlock(bootstrap.body) ||\n bootstrapCall.arguments.length !== 1 ||\n !ts.isArrayLiteralExpression(bootstrapCall.arguments[0])) {\n continue;\n }\n const entryModuleId = getWebpackEntryModuleId(bootstrap.body);\n if (entryModuleId === undefined) {\n continue;\n }\n const entryModule = bootstrapCall.arguments[0].elements[entryModuleId];\n if (!entryModule || !ts.isFunctionExpression(entryModule)) {\n continue;\n }\n const exportsParameterName = (_a = entryModule.parameters[1]) === null || _a === void 0 ? void 0 : _a.name;\n if (!exportsParameterName || !ts.isIdentifier(exportsParameterName)) {\n continue;\n }\n const exportsParameterText = exportsParameterName.text;\n const exports = [];\n visit(entryModule.body);\n return exports;\n function visit(node) {\n if (ts.isBinaryExpression(node) &&\n node.operatorToken.kind === ts.SyntaxKind.EqualsToken &&\n ts.isAccessExpression(node.left) &&\n ts.isIdentifier(node.left.expression) &&\n node.left.expression.text === exportsParameterText) {\n const name = getNameOfAccessExpression(node.left);\n if (name !== undefined) {\n exports.push({ name, node });\n }\n }\n ts.forEachChild(node, visit);\n }\n }\n}\nfunction getWebpackEntryModuleId(body) {\n for (const statement of body.statements) {\n if (!ts.isReturnStatement(statement) || !statement.expression) {\n continue;\n }\n return getWebpackEntryModuleIdFromExpression(statement.expression);\n }\n}\nfunction getWebpackEntryModuleIdFromExpression(expression) {\n expression = ts.skipParentheses(expression);\n if (ts.isCallExpression(expression) && expression.arguments.length === 1) {\n return getNumericValue(expression.arguments[0]);\n }\n if (ts.isBinaryExpression(expression) && expression.operatorToken.kind === ts.SyntaxKind.CommaToken) {\n return getWebpackEntryModuleIdFromExpression(expression.right);\n }\n}\nfunction getNumericValue(node) {\n node = ts.skipParentheses(node);\n if (ts.isNumericLiteral(node)) {\n return Number(node.text);\n }\n if (ts.isBinaryExpression(node) && node.operatorToken.kind === ts.SyntaxKind.EqualsToken) {\n return getNumericValue(node.right);\n }\n}\nfunction isModuleExports(node) {\n return (ts.isAccessExpression(node) &&\n ts.isIdentifier(node.expression) &&\n node.expression.text === \"module\" &&\n getNameOfAccessExpression(node) === \"exports\");\n}\nfunction getNameOfAccessExpression(accessExpression) {\n const node = ts.getNameOfAccessExpression(accessExpression);\n if (ts.isIdentifier(node) || ts.isStringLiteralLike(node)) {\n return node.text;\n }\n}\n//# sourceMappingURL=getProbableExports.js.map","import ts from \"typescript\";\nimport { defineCheck } from \"../defineCheck.js\";\nimport { getProbableExports } from \"../getProbableExports.js\";\nimport { getResolutionOption } from \"../../utils.js\";\nconst bindOptions = {\n target: ts.ScriptTarget.Latest,\n allowJs: true,\n checkJs: true,\n};\nexport default defineCheck({\n name: \"ExportDefaultDisagreement\",\n dependencies: ({ entrypoints, subpath, resolutionKind, programInfo }) => {\n var _a, _b, _c, _d, _e, _f;\n const entrypoint = entrypoints[subpath].resolutions[resolutionKind];\n const typesFileName = (_a = entrypoint.resolution) === null || _a === void 0 ? void 0 : _a.fileName;\n const implementationFileName = (_b = entrypoint.implementationResolution) === null || _b === void 0 ? void 0 : _b.fileName;\n if ((typesFileName &&\n ((_d = (_c = programInfo[getResolutionOption(resolutionKind)].moduleKinds) === null || _c === void 0 ? void 0 : _c[typesFileName]) === null || _d === void 0 ? void 0 : _d.detectedKind) ===\n ts.ModuleKind.ESNext) ||\n (implementationFileName &&\n ((_f = (_e = programInfo[getResolutionOption(resolutionKind)].moduleKinds) === null || _e === void 0 ? void 0 : _e[implementationFileName]) === null || _f === void 0 ? void 0 : _f.detectedKind) ===\n ts.ModuleKind.ESNext)) {\n return [];\n }\n return [typesFileName, implementationFileName];\n },\n execute: ([typesFileName, implementationFileName], context) => {\n var _a, _b;\n // Technically, much of this implementation should go in `dependencies`, since\n // different resolution modes can result in different program graphs, resulting\n // in different types, which are queried heavily here. However, it would be much\n // more expensive to run this type-heavy code in `dependencies`, where it would\n // reevaluate for every entrypoint/resolution matrix cell, when chances are\n // extremely high that a given pair of types/implementation files are intended\n // to act the same under all resolution modes.\n if (!typesFileName || !implementationFileName || !ts.hasTSFileExtension(typesFileName)) {\n return;\n }\n const host = context.hosts.findHostForFiles([typesFileName]);\n const typesSourceFile = host.getSourceFile(typesFileName);\n ts.bindSourceFile(typesSourceFile, bindOptions);\n if (!((_a = typesSourceFile.symbol) === null || _a === void 0 ? void 0 : _a.exports)) {\n return;\n }\n const implementationSourceFile = host.getSourceFile(implementationFileName);\n ts.bindSourceFile(implementationSourceFile, bindOptions);\n if (!((_b = implementationSourceFile.symbol) === null || _b === void 0 ? void 0 : _b.exports) || implementationSourceFile.externalModuleIndicator) {\n return;\n }\n // FalseExportDefault: types have a default, JS doesn't.\n // For this check, we're going to require the types to have a top-level\n // default export, which means we might miss something like:\n //\n // declare namespace foo {\n // const _default: string;\n // export { _default as default };\n // }\n // export = foo;\n //\n // But that's not a mistake people really make. If we don't need to\n // recognize that pattern, we can avoid creating a program and checker\n // for this error.\n const typesHaveSyntacticDefault = typesSourceFile.symbol.exports.has(ts.InternalSymbolName.Default);\n if (typesHaveSyntacticDefault && !getImplHasDefault() && implIsAnalyzable()) {\n return {\n kind: \"FalseExportDefault\",\n typesFileName,\n implementationFileName,\n };\n }\n // MissingExportEquals: types and JS have a default, but JS also has a\n // module.exports = not reflected in the types.\n // There are a few variations of this problem. The most straightforward\n // is when the types declare *only* a default export, and the JS declares\n // a module.exports and a module.exports.default in different declarations:\n //\n // module.exports = SomeClass;\n // module.exports.default = SomeClass;\n //\n // Then, there's the slight variation on this where the `default` property\n // is separately declared on `SomeClass`. This requires the type checker.\n // Finally, there's the case where the types declare a default export along\n // with other named exports. That *could* accurately represent a\n // `module.exports = { default, ... }` in JS, but only if the named exports\n // are values, not types. It also *couldn't* accurately represent a\n // `module.exports = SomeClass`, where the exported value is callable,\n // constructable, or a primitive.\n if (!getImplHasDefault() || !implIsAnalyzable()) {\n // The implementation not having a default doesn't necessarily mean the\n // following checks are irrelevant, but this rule is designed primarily\n // to catch cases where type definition authors correctly notice that\n // their implementation has a `module.exports.default`, but don't realize\n // that the same object is exposed as `module.exports`. We bail early\n // here primarily because these checks are expensive.\n return;\n }\n if (!typesSourceFile.symbol.exports.has(ts.InternalSymbolName.ExportEquals) &&\n implementationSourceFile.symbol.exports.has(ts.InternalSymbolName.ExportEquals) &&\n getTypesDefaultSymbol() &&\n ((getImplExportEqualsIsExportDefault() &&\n getTypesChecker().typeHasCallOrConstructSignatures(getTypesTypeOfDefault())) ||\n getImplChecker().typeHasCallOrConstructSignatures(getImplTypeOfModuleExports()))) {\n return {\n kind: \"MissingExportEquals\",\n typesFileName,\n implementationFileName,\n };\n }\n // TODO: does not account for export *\n const typesHaveNonDefaultValueExport = Array.from(typesSourceFile.symbol.exports.values()).some((s) => {\n if (s.escapedName === \"default\") {\n return false;\n }\n if (s.flags & ts.SymbolFlags.Value) {\n return true;\n }\n while (s.flags & ts.SymbolFlags.Alias) {\n s = getTypesChecker().getAliasedSymbol(s);\n if (s.flags & ts.SymbolFlags.Value) {\n return true;\n }\n }\n });\n if (!typesHaveNonDefaultValueExport &&\n typeIsObjecty(getTypesTypeOfDefault(), getTypesChecker()) &&\n (Array.from(implementationSourceFile.symbol.exports.keys()).some((name) => isNotDefaultOrEsModule(ts.unescapeLeadingUnderscores(name))) ||\n getImplProbableExports().some(({ name }) => isNotDefaultOrEsModule(name))) &&\n getTypesDefaultSymbol()) {\n // Here, the types have a lone default export of a non-callable object,\n // and the implementation has multiple named exports along with `default`.\n // This is the biggest heuristic leap for this rule, but the assumption is\n // that the default export in the types was intended to represent the object\n // shape of `module.exports`, not `module.exports.default`. This may result\n // in false positives, but those false positives can be silenced by adding\n // exports in the types for other named exports in the JS. It's detecting\n // a definite problem; it's just not always accurate about the diagnosis.\n return {\n kind: \"MissingExportEquals\",\n typesFileName,\n implementationFileName,\n };\n }\n var implProbableExports, implChecker, implHasDefault, implTypeOfModuleExports, implExportEqualsIsExportDefault, typesChecker, typesDefaultSymbol, typesTypeOfDefault;\n function getImplProbableExports() {\n var _a;\n return ((_a = implProbableExports) !== null && _a !== void 0 ? _a : (implProbableExports = getProbableExports(implementationSourceFile)));\n }\n function getImplChecker() {\n var _a;\n return ((_a = implChecker) !== null && _a !== void 0 ? _a : (implChecker = host\n .createAuxiliaryProgram([implementationFileName])\n .getTypeChecker()));\n }\n function getImplHasDefault() {\n var _a, _b, _c, _d, _e;\n var _f;\n return ((_f = implHasDefault) !== null && _f !== void 0 ? _f : (implHasDefault = ((_b = (_a = implementationSourceFile === null || implementationSourceFile === void 0 ? void 0 : implementationSourceFile.symbol) === null || _a === void 0 ? void 0 : _a.exports) === null || _b === void 0 ? void 0 : _b.has(ts.InternalSymbolName.Default)) ||\n ((_c = getImplProbableExports()) === null || _c === void 0 ? void 0 : _c.some((s) => s.name === \"default\")) ||\n (!!((_e = (_d = implementationSourceFile.symbol) === null || _d === void 0 ? void 0 : _d.exports) === null || _e === void 0 ? void 0 : _e.size) &&\n getImplChecker()\n .getExportsAndPropertiesOfModule(implementationSourceFile.symbol)\n .some((s) => s.name === \"default\"))));\n }\n function getTypesChecker() {\n var _a;\n return ((_a = typesChecker) !== null && _a !== void 0 ? _a : (typesChecker = host.createAuxiliaryProgram([typesFileName]).getTypeChecker()));\n }\n function getTypesDefaultSymbol() {\n var _a, _b;\n return ((_a = typesDefaultSymbol) !== null && _a !== void 0 ? _a : (typesDefaultSymbol = (_b = typesSourceFile.symbol.exports.get(ts.InternalSymbolName.Default)) !== null && _b !== void 0 ? _b : getTypesChecker()\n .getExportsAndPropertiesOfModule(typesSourceFile.symbol)\n .find((s) => s.escapedName === \"default\")));\n }\n function getTypesTypeOfDefault() {\n var _a;\n const symbol = getTypesDefaultSymbol();\n return ((_a = typesTypeOfDefault) !== null && _a !== void 0 ? _a : (typesTypeOfDefault = symbol\n ? getTypesChecker().getTypeOfSymbol(symbol)\n : getTypesChecker().getAnyType()));\n }\n function getImplTypeOfModuleExports() {\n if (implTypeOfModuleExports) {\n return implTypeOfModuleExports;\n }\n const type = getImplChecker().getTypeOfSymbol(getImplChecker().resolveExternalModuleSymbol(implementationSourceFile.symbol));\n if (type.flags & ts.TypeFlags.Any && getImplExportEqualsIsExportDefault()) {\n return (implTypeOfModuleExports = getImplChecker().getTypeOfSymbol(implementationSourceFile.symbol.exports.get(ts.InternalSymbolName.Default)));\n }\n return (implTypeOfModuleExports = type);\n }\n function getImplExportEqualsIsExportDefault() {\n var _a;\n // TypeScript has a circularity error on `module.exports = exports.default`, so\n // detect that pattern syntactically.\n if (implExportEqualsIsExportDefault !== undefined) {\n return implExportEqualsIsExportDefault;\n }\n const exportEquals = implementationSourceFile.symbol.exports.get(ts.InternalSymbolName.ExportEquals);\n if (!exportEquals) {\n return (implExportEqualsIsExportDefault = false);\n }\n const exportDefault = implementationSourceFile.symbol.exports.get(ts.InternalSymbolName.Default);\n if (!exportDefault) {\n return (implExportEqualsIsExportDefault = false);\n }\n for (const assignment of [\n exportEquals.valueDeclaration,\n ts.findAncestor((_a = exportDefault.declarations) === null || _a === void 0 ? void 0 : _a[0], ts.isBinaryExpression),\n ]) {\n let seenModuleExports = false, seenExportsDefault = false;\n if (assignment &&\n ts.isBinaryExpression(assignment) &&\n assignment.operatorToken.kind === ts.SyntaxKind.EqualsToken) {\n const res = !!forEachAssignmentTarget(assignment, (target) => {\n if (!seenExportsDefault && isExportsDefault(target)) {\n seenExportsDefault = true;\n }\n else if (!seenModuleExports && isModuleExports(target)) {\n seenModuleExports = true;\n }\n return seenExportsDefault && seenModuleExports;\n });\n if (res) {\n return (implExportEqualsIsExportDefault = true);\n }\n }\n }\n return (implExportEqualsIsExportDefault = false);\n }\n function implIsAnalyzable() {\n var _a, _b, _c;\n if (((_b = (_a = implementationSourceFile.symbol.exports.get(ts.InternalSymbolName.ExportEquals)) === null || _a === void 0 ? void 0 : _a.declarations) === null || _b === void 0 ? void 0 : _b.length) > 1) {\n // Multiple assignments in different function bodies is probably a bundle we can't analyze.\n // Multiple assignments in the same function body might just be an environment-conditional\n // module.exports inside an IIFE.\n let commonContainer;\n for (const decl of implementationSourceFile.symbol.exports.get(ts.InternalSymbolName.ExportEquals)\n .declarations) {\n const container = ts.findAncestor(decl, (node) => ts.isFunctionBlock(node) || ts.isSourceFile(node));\n if (commonContainer === undefined) {\n commonContainer = container;\n }\n else if (commonContainer !== container) {\n return false;\n }\n }\n }\n return !!(implementationSourceFile.symbol.exports.size || ((_c = getImplProbableExports()) === null || _c === void 0 ? void 0 : _c.length));\n }\n },\n});\nfunction typeIsObjecty(type, checker) {\n return (type.flags & ts.TypeFlags.Object &&\n !(type.flags & ts.TypeFlags.Primitive) &&\n !checker.typeHasCallOrConstructSignatures(type));\n}\nfunction isModuleExports(target) {\n return ((ts.isAccessExpression(target) &&\n ts.isIdentifier(target.expression) &&\n target.expression.text === \"module\" &&\n getNameOfAccessExpression(target) === \"exports\") ||\n (ts.isIdentifier(target) && target.text === \"exports\"));\n}\nfunction isExportsDefault(target) {\n return ((ts.isAccessExpression(target) &&\n ts.isIdentifier(target.expression) &&\n target.expression.text === \"exports\" &&\n getNameOfAccessExpression(target) === \"default\") ||\n (ts.isAccessExpression(target) &&\n ts.isAccessExpression(target.expression) &&\n ts.isIdentifier(target.expression.expression) &&\n target.expression.expression.text === \"module\" &&\n getNameOfAccessExpression(target.expression) === \"exports\" &&\n getNameOfAccessExpression(target) === \"default\"));\n}\nfunction isNotDefaultOrEsModule(name) {\n return name !== \"default\" && name !== \"__esModule\";\n}\nfunction forEachAssignmentTarget(assignment, cb) {\n // For `module.exports = exports = exports.default`, fires `cb` once for\n // `exports.default`, once for `exports`, and once for `module.exports`.\n const target = ts.skipParentheses(assignment.right);\n if (ts.isBinaryExpression(target) && target.operatorToken.kind === ts.SyntaxKind.EqualsToken) {\n const res = forEachAssignmentTarget(target, cb);\n if (res) {\n return res;\n }\n }\n else {\n const res = cb(target);\n if (res) {\n return res;\n }\n }\n return cb(ts.skipParentheses(assignment.left));\n}\nfunction getNameOfAccessExpression(accessExpression) {\n const node = ts.getNameOfAccessExpression(accessExpression);\n if (ts.isIdentifier(node) || ts.isStringLiteralLike(node)) {\n return node.text;\n }\n}\n//# sourceMappingURL=exportDefaultDisagreement.js.map","import ts from \"typescript\";\nimport { defineCheck } from \"../defineCheck.js\";\nexport default defineCheck({\n name: \"InternalResolutionError\",\n enumerateFiles: true,\n dependencies: ({ resolutionOption, fileName }) => [resolutionOption, fileName],\n execute: ([resolutionOption, fileName], context) => {\n if (!ts.hasTSFileExtension(fileName)) {\n return;\n }\n const host = context.hosts[resolutionOption];\n const sourceFile = host.getSourceFile(fileName);\n if (sourceFile === null || sourceFile === void 0 ? void 0 : sourceFile.imports) {\n const problems = [];\n for (const moduleSpecifier of sourceFile.imports) {\n const reference = moduleSpecifier.text;\n if (reference !== context.pkg.packageName &&\n !reference.startsWith(`${context.pkg.packageName}/`) &&\n reference[0] !== \"#\" &&\n !ts.pathIsRelative(reference)) {\n // Probably a reference to something we'd have to npm install.\n // These can definitely be errors, but I'm not installing a whole\n // graph for now.\n continue;\n }\n const resolutionMode = ts.getModeForUsageLocation(sourceFile, moduleSpecifier, host.getCompilerOptions());\n const resolution = host.getResolvedModule(sourceFile, moduleSpecifier.text, resolutionMode);\n if (!resolution) {\n throw new Error(`Expected resolution for '${moduleSpecifier.text}' in ${fileName}`);\n }\n if (!resolution.resolvedModule) {\n problems.push({\n kind: \"InternalResolutionError\",\n resolutionOption,\n fileName,\n moduleSpecifier: reference,\n pos: moduleSpecifier.pos,\n end: moduleSpecifier.end,\n resolutionMode,\n trace: host.getTrace(fileName, moduleSpecifier.text, resolutionMode),\n });\n }\n }\n return problems;\n }\n },\n});\n//# sourceMappingURL=internalResolutionError.js.map","import ts from \"typescript\";\nimport { defineCheck } from \"../defineCheck.js\";\nexport default defineCheck({\n name: \"ModuleKindDisagreement\",\n dependencies: ({ entrypoints, subpath, resolutionKind, resolutionOption, programInfo }) => {\n var _a, _b, _c, _d, _e, _f;\n const entrypoint = entrypoints[subpath].resolutions[resolutionKind];\n const typesFileName = (_a = entrypoint.resolution) === null || _a === void 0 ? void 0 : _a.fileName;\n const implementationFileName = (_b = entrypoint.implementationResolution) === null || _b === void 0 ? void 0 : _b.fileName;\n return [\n typesFileName,\n implementationFileName,\n typesFileName ? (_d = (_c = programInfo[resolutionOption]) === null || _c === void 0 ? void 0 : _c.moduleKinds) === null || _d === void 0 ? void 0 : _d[typesFileName] : undefined,\n implementationFileName ? (_f = (_e = programInfo[resolutionOption]) === null || _e === void 0 ? void 0 : _e.moduleKinds) === null || _f === void 0 ? void 0 : _f[implementationFileName] : undefined,\n ];\n },\n execute: ([typesFileName, implementationFileName, typesModuleKind, implementationModuleKind]) => {\n if (typesFileName && implementationFileName && typesModuleKind && implementationModuleKind) {\n if (typesModuleKind.detectedKind === ts.ModuleKind.ESNext &&\n implementationModuleKind.detectedKind === ts.ModuleKind.CommonJS) {\n return {\n kind: \"FalseESM\",\n typesFileName,\n implementationFileName,\n typesModuleKind,\n implementationModuleKind,\n };\n }\n else if (typesModuleKind.detectedKind === ts.ModuleKind.CommonJS &&\n implementationModuleKind.detectedKind === ts.ModuleKind.ESNext) {\n return {\n kind: \"FalseCJS\",\n typesFileName,\n implementationFileName,\n typesModuleKind,\n implementationModuleKind,\n };\n }\n }\n },\n});\n//# sourceMappingURL=moduleKindDisagreement.js.map","import ts from \"typescript\";\nimport { defineCheck } from \"../defineCheck.js\";\nexport default defineCheck({\n name: \"UnexpectedModuleSyntax\",\n enumerateFiles: true,\n dependencies: ({ fileName, resolutionOption, programInfo }) => {\n var _a;\n return [fileName, (_a = programInfo[resolutionOption].moduleKinds) === null || _a === void 0 ? void 0 : _a[fileName]];\n },\n execute: ([fileName, expectedModuleKind], context) => {\n var _a, _b;\n if (!expectedModuleKind || !ts.hasJSFileExtension(fileName)) {\n return;\n }\n const host = (_a = context.hosts.findHostForFiles([fileName])) !== null && _a !== void 0 ? _a : context.hosts.bundler;\n const sourceFile = host.getSourceFile(fileName);\n const syntaxImpliedModuleKind = sourceFile.externalModuleIndicator\n ? ts.ModuleKind.ESNext\n : sourceFile.commonJsModuleIndicator\n ? ts.ModuleKind.CommonJS\n : undefined;\n if (syntaxImpliedModuleKind !== undefined && expectedModuleKind.detectedKind !== syntaxImpliedModuleKind) {\n // Value cannot be `true` because we set `moduleDetection: \"legacy\"`\n const syntax = ((_b = sourceFile.externalModuleIndicator) !== null && _b !== void 0 ? _b : sourceFile.commonJsModuleIndicator);\n return {\n kind: \"UnexpectedModuleSyntax\",\n fileName,\n moduleKind: expectedModuleKind,\n syntax: syntaxImpliedModuleKind,\n pos: syntax.getStart(sourceFile),\n end: syntax.end,\n };\n }\n },\n});\n//# sourceMappingURL=unexpectedModuleSyntax.js.map","import cjsOnlyExportsDefault from \"./cjsOnlyExportsDefault.js\";\nimport namedExports from \"./namedExports.js\";\nimport entrypointResolutions from \"./entrypointResolutions.js\";\nimport exportDefaultDisagreement from \"./exportDefaultDisagreement.js\";\nimport internalResolutionError from \"./internalResolutionError.js\";\nimport moduleKindDisagreement from \"./moduleKindDisagreement.js\";\nimport unexpectedModuleSyntax from \"./unexpectedModuleSyntax.js\";\nexport default [\n entrypointResolutions,\n moduleKindDisagreement,\n exportDefaultDisagreement,\n namedExports,\n cjsOnlyExportsDefault,\n unexpectedModuleSyntax,\n internalResolutionError,\n];\n//# sourceMappingURL=index.js.map","// The contents of this string are derived from typescript/lib/lib.es5.d.ts.\n// These types are all that are needed for the NamedExports check to work.\n/*! *****************************************************************************\nCopyright (c) Microsoft Corporation. All rights reserved.\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\nthis file except in compliance with the License. You may obtain a copy of the\nLicense at http://www.apache.org/licenses/LICENSE-2.0\n\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\nMERCHANTABLITY OR NON-INFRINGEMENT.\n\nSee the Apache Version 2.0 License for specific language governing permissions\nand limitations under the License.\n***************************************************************************** */\nexport default `\ninterface ReadonlyArray<T> {\n readonly length: number;\n toString(): string;\n toLocaleString(): string;\n concat(...items: ConcatArray<T>[]): T[];\n concat(...items: (T | ConcatArray<T>)[]): T[];\n join(separator?: string): string;\n slice(start?: number, end?: number): T[];\n indexOf(searchElement: T, fromIndex?: number): number;\n lastIndexOf(searchElement: T, fromIndex?: number): number;\n every<S extends T>(predicate: (value: T, index: number, array: readonly T[]) => value is S, thisArg?: any): this is readonly S[];\n every(predicate: (value: T, index: number, array: readonly T[]) => unknown, thisArg?: any): boolean;\n some(predicate: (value: T, index: number, array: readonly T[]) => unknown, thisArg?: any): boolean;\n forEach(callbackfn: (value: T, index: number, array: readonly T[]) => void, thisArg?: any): void;\n map<U>(callbackfn: (value: T, index: number, array: readonly T[]) => U, thisArg?: any): U[];\n filter<S extends T>(predicate: (value: T, index: number, array: readonly T[]) => value is S, thisArg?: any): S[];\n filter(predicate: (value: T, index: number, array: readonly T[]) => unknown, thisArg?: any): T[];\n reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: readonly T[]) => T): T;\n reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: readonly T[]) => T, initialValue: T): T;\n reduce<U>(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: readonly T[]) => U, initialValue: U): U;\n reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: readonly T[]) => T): T;\n reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: readonly T[]) => T, initialValue: T): T;\n reduceRight<U>(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: readonly T[]) => U, initialValue: U): U;\n readonly [n: number]: T;\n}\n\ninterface Array<T> {\n length: number;\n toString(): string;\n toLocaleString(): string;\n pop(): T | undefined;\n push(...items: T[]): number;\n concat(...items: ConcatArray<T>[]): T[];\n concat(...items: (T | ConcatArray<T>)[]): T[];\n join(separator?: string): string;\n reverse(): T[];\n shift(): T | undefined;\n slice(start?: number, end?: number): T[];\n sort(compareFn?: (a: T, b: T) => number): this;\n splice(start: number, deleteCount?: number): T[];\n splice(start: number, deleteCount: number, ...items: T[]): T[];\n unshift(...items: T[]): number;\n indexOf(searchElement: T, fromIndex?: number): number;\n lastIndexOf(searchElement: T, fromIndex?: number): number;\n every<S extends T>(predicate: (value: T, index: number, array: T[]) => value is S, thisArg?: any): this is S[];\n every(predicate: (value: T, index: number, array: T[]) => unknown, thisArg?: any): boolean;\n some(predicate: (value: T, index: number, array: T[]) => unknown, thisArg?: any): boolean;\n forEach(callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any): void;\n map<U>(callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[];\n filter<S extends T>(predicate: (value: T, index: number, array: T[]) => value is S, thisArg?: any): S[];\n filter(predicate: (value: T, index: number, array: T[]) => unknown, thisArg?: any): T[];\n reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T): T;\n reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue: T): T;\n reduce<U>(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U;\n reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T): T;\n reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue: T): T;\n reduceRight<U>(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U;\n [n: number]: T;\n}\n`;\n//# sourceMappingURL=minimalLibDts.js.map","import { Option, Array as Arr, pipe } from \"effect\";\nimport type { Checker, Project } from \"typescript/sync\";\n\nimport { sharedApi } from \"./ts-api.ts\";\n\nexport interface CheckerProgram {\n readonly mountPath: string;\n readonly rootNames: readonly string[];\n readonly compilerOptions: Readonly<Record<string, unknown>>;\n readonly resolve: (\n moduleName: string,\n containingDirectory: string,\n mode: number | undefined,\n ) => Option.Option<{ readonly resolvedFileName: string }>;\n}\n\nexport interface CheckerSession {\n readonly checker: Checker;\n readonly project: Project;\n readonly mountPath: string;\n readonly dispose: () => void;\n}\n\nexport const openCheckerSession = (program: CheckerProgram): CheckerSession => {\n const api = sharedApi();\n const moduleResolver = api.createModuleResolver(program.compilerOptions, {\n resolveModuleName: (moduleName, containingDirectory, mode) =>\n Option.getOrUndefined(program.resolve(moduleName, containingDirectory, mode)),\n });\n const snapshot = api.createSnapshot({\n createPrograms: [\n {\n rootFiles: pipe(\n program.rootNames,\n Arr.map((name) => `${program.mountPath}${name}`),\n ),\n compilerOptions: program.compilerOptions,\n options: { moduleResolver },\n },\n ],\n });\n const [created] = snapshot.operation.createdPrograms;\n const project = created.getProject();\n return {\n checker: project.checker,\n project,\n mountPath: program.mountPath,\n dispose: () => {\n snapshot.dispose();\n moduleResolver.dispose();\n },\n };\n};\n","import { Array as Arr, Option, pipe, Function as Fn } from \"effect\";\nimport { escapeLeadingUnderscores as escapeSymbolName, getNameOfDeclaration } from \"typescript/ast\";\nimport type { Declaration, Expression, Node, SourceFile } from \"typescript/ast\";\nimport {\n isBinaryExpression,\n isClassDeclaration,\n isEnumDeclaration,\n isExportAssignment,\n isExportSpecifier,\n isExpression,\n isFunctionDeclaration,\n isIdentifier,\n isImportClause,\n isImportEqualsDeclaration,\n isImportSpecifier,\n isInterfaceDeclaration,\n isModuleDeclaration,\n isNamespaceExport,\n isNamespaceImport,\n isSourceFile,\n isTypeAliasDeclaration,\n isVariableDeclaration,\n} from \"typescript/ast/is\";\nimport { SymbolFlags } from \"typescript/sync\";\nimport type { Symbol as CheckerSymbol } from \"typescript/sync\";\n\nimport { escapeLeadingUnderscores } from \"./binder-symbols.ts\";\nimport type { BoundSymbol } from \"./binder-symbols.ts\";\nimport { bindingOf } from \"./binder.ts\";\nimport type { CheckerSession } from \"./checker-session.ts\";\nimport { hasFlag } from \"./flags.ts\";\n\nconst DATA_FIRST_ARITY = 2;\n\nexport type AnySymbol = BoundSymbol | CheckerSymbol;\n\ntype SymbolConverter = (session: CheckerSession, symbol: AnySymbol) => CheckerSymbol;\n\nexport const EXPORT_EQUALS = \"export=\";\n\nexport const isCheckerSymbol = (symbol: AnySymbol): symbol is CheckerSymbol =>\n \"getExports\" in symbol;\n\nconst sourceFileOf = (node: Node): SourceFile => {\n let current = node;\n while (!isSourceFile(current)) {\n current = current.parent;\n }\n return current;\n};\n\nconst firstDeclaration = (symbol: BoundSymbol): Option.Option<Node> =>\n Option.fromNullishOr(symbol.declarations).pipe(\n Option.flatMap((declarations) => Arr.head(declarations)),\n );\n\nconst NAMEABLE_GUARDS: readonly ((node: Node) => boolean)[] = [\n isExpression,\n isFunctionDeclaration,\n isClassDeclaration,\n isVariableDeclaration,\n isModuleDeclaration,\n isEnumDeclaration,\n isInterfaceDeclaration,\n isTypeAliasDeclaration,\n isImportEqualsDeclaration,\n isImportClause,\n isImportSpecifier,\n isNamespaceImport,\n isExportSpecifier,\n isExportAssignment,\n isNamespaceExport,\n];\n\nconst isNameable = (node: Node): node is Declaration | Expression =>\n pipe(\n NAMEABLE_GUARDS,\n Arr.some((guard) => guard(node)),\n );\n\nconst nameNode = (declaration: Node): Node =>\n Option.liftPredicate(declaration, isNameable).pipe(\n Option.flatMapNullishOr((nameable) => getNameOfDeclaration(nameable)),\n Option.getOrElse(() => declaration),\n );\n\nconst missingSymbol = (symbol: BoundSymbol): Error =>\n new Error(`TypeScript has no symbol for ${symbol.name}`);\n\nconst fromSourceFile = (\n session: CheckerSession,\n file: SourceFile,\n symbol: BoundSymbol,\n): CheckerSymbol =>\n Option.fromNullishOr(\n session.checker.getSymbolOfSourceFile(`${session.mountPath}${file.fileName}`),\n ).pipe(Option.getOrThrowWith(() => missingSymbol(symbol)));\n\nconst isFileSymbol = (symbol: BoundSymbol): boolean =>\n firstDeclaration(symbol).pipe(Option.exists((declaration) => isSourceFile(declaration)));\n\nconst fromParentExports = (\n session: CheckerSession,\n symbol: BoundSymbol,\n convert: SymbolConverter,\n): Option.Option<CheckerSymbol> =>\n Option.fromNullishOr(symbol.parent).pipe(\n Option.filter((parent) => isFileSymbol(parent)),\n Option.flatMap((parent) =>\n Option.fromNullishOr(\n convert(session, parent).getExports().get(escapeSymbolName(symbol.name)),\n ),\n ),\n );\n\nconst fromPosition = (\n session: CheckerSession,\n declaration: Node,\n symbol: BoundSymbol,\n): CheckerSymbol => {\n const file = sourceFileOf(declaration);\n const found = session.checker.getSymbolAtPosition(\n `${session.mountPath}${file.fileName}`,\n nameNode(declaration).getStart(file),\n );\n return Option.fromNullishOr(found).pipe(Option.getOrThrowWith(() => missingSymbol(symbol)));\n};\n\nconst fromBound = (\n session: CheckerSession,\n symbol: BoundSymbol,\n convert: SymbolConverter,\n): CheckerSymbol => {\n const declaration = firstDeclaration(symbol).pipe(\n Option.getOrThrowWith(() => new Error(`Symbol ${symbol.name} has no declaration`)),\n );\n if (isSourceFile(declaration)) {\n return fromSourceFile(session, declaration, symbol);\n }\n return fromParentExports(session, symbol, convert).pipe(\n Option.getOrElse(() => fromPosition(session, declaration, symbol)),\n );\n};\n\nexport const toCheckerSymbol: {\n (symbol: AnySymbol): (session: CheckerSession) => CheckerSymbol;\n (session: CheckerSession, symbol: AnySymbol): CheckerSymbol;\n} = Fn.dual(DATA_FIRST_ARITY, (session: CheckerSession, symbol: AnySymbol): CheckerSymbol => {\n if (isCheckerSymbol(symbol)) {\n return symbol;\n }\n return fromBound(session, symbol, toCheckerSymbol);\n});\n\nconst assignedIdentifier = (declaration: Node): Option.Option<Node> => {\n if (isBinaryExpression(declaration)) {\n return Option.liftPredicate(declaration.right, (node) => isIdentifier(node));\n }\n if (isExportAssignment(declaration)) {\n return Option.liftPredicate(declaration.expression, (node) => isIdentifier(node));\n }\n return Option.none();\n};\n\nconst localNamed = (identifier: Node): Option.Option<BoundSymbol> =>\n bindingOf(sourceFileOf(identifier)).pipe(\n Option.flatMap((binding) =>\n Option.liftPredicate(identifier, (node) => isIdentifier(node)).pipe(\n Option.flatMap((node) =>\n Option.fromNullishOr(binding.locals.get(escapeLeadingUnderscores(node.text))),\n ),\n ),\n ),\n );\n\nexport const boundExpandoExports = (moduleSymbol: BoundSymbol): readonly BoundSymbol[] =>\n Option.fromNullishOr(moduleSymbol.exports).pipe(\n Option.flatMap((exports) => Option.fromNullishOr(exports.get(EXPORT_EQUALS))),\n Option.flatMap((exportEquals) => firstDeclaration(exportEquals)),\n Option.flatMap((declaration) => assignedIdentifier(declaration)),\n Option.flatMap((identifier) => localNamed(identifier)),\n Option.flatMap((local) => Option.fromNullishOr(local.exports)),\n Option.map((members) =>\n pipe(\n [...members.values()],\n Arr.filter((member) => hasFlag(member.flags, SymbolFlags.Assignment)),\n ),\n ),\n Option.getOrElse((): readonly BoundSymbol[] => []),\n );\n","import { Array as Arr, Option, Predicate, pipe } from \"effect\";\nimport { SyntaxKind } from \"typescript/ast\";\nimport type { ExportDeclaration, Node } from \"typescript/ast\";\nimport {\n isExportDeclaration,\n isExportSpecifier,\n isImportClause,\n isImportEqualsDeclaration,\n isImportSpecifier,\n isNamespaceExport,\n isNamespaceImport,\n} from \"typescript/ast/is\";\n\nconst isTypeOnlyImportClause = (node: Node): boolean =>\n isImportClause(node) && node.phaseModifier === SyntaxKind.TypeKeyword;\n\ntype TypeOnlyRule = (node: Node) => Option.Option<boolean>;\n\nconst rule =\n <Narrowed extends Node>(\n guard: (node: Node) => node is Narrowed,\n test: (node: Narrowed) => boolean,\n ): TypeOnlyRule =>\n (node) =>\n Option.liftPredicate(node, guard).pipe(Option.map(test));\n\nconst isTypeOnlyExportStatement = (node: Node): boolean =>\n isExportDeclaration(node) && node.isTypeOnly;\n\nconst isTypeOnlyReexportAll = (node: ExportDeclaration): boolean =>\n pipe(\n [\n node.isTypeOnly,\n Predicate.isNotUndefined(node.moduleSpecifier),\n Predicate.isUndefined(node.exportClause),\n ],\n Arr.every(Boolean),\n );\n\nconst TYPE_ONLY_RULES: readonly TypeOnlyRule[] = [\n rule(\n isImportSpecifier,\n (specifier) => specifier.isTypeOnly || isTypeOnlyImportClause(specifier.parent.parent),\n ),\n rule(isNamespaceImport, (namespace) => isTypeOnlyImportClause(namespace.parent)),\n rule(isImportEqualsDeclaration, (declaration) => declaration.isTypeOnly),\n rule(isImportClause, isTypeOnlyImportClause),\n rule(\n isExportSpecifier,\n (specifier) => specifier.isTypeOnly || isTypeOnlyExportStatement(specifier.parent.parent),\n ),\n rule(isExportDeclaration, isTypeOnlyReexportAll),\n rule(isNamespaceExport, (namespace) => isTypeOnlyExportStatement(namespace.parent)),\n];\n\nexport const isTypeOnlyImportOrExportDeclaration = (node: Node): boolean =>\n Arr.findFirst(TYPE_ONLY_RULES, (check) => check(node)).pipe(Option.getOrElse(() => false));\n","import { Option, Array as Arr, pipe } from \"effect\";\nimport { escapeLeadingUnderscores as escapeSymbolName } from \"typescript/ast\";\nimport { ObjectFlags, SignatureKind, SymbolFlags, TypeFlags, isObjectType } from \"typescript/sync\";\nimport type { Checker, Symbol as CheckerSymbol, Type } from \"typescript/sync\";\n\nimport { openCheckerSession } from \"./checker-session.ts\";\nimport type { CheckerProgram, CheckerSession } from \"./checker-session.ts\";\nimport {\n EXPORT_EQUALS,\n boundExpandoExports,\n isCheckerSymbol,\n toCheckerSymbol,\n} from \"./checker-symbols.ts\";\nimport type { AnySymbol } from \"./checker-symbols.ts\";\nimport { hasFlag, withFlags } from \"./flags.ts\";\nimport { isTypeOnlyImportOrExportDeclaration } from \"./type-only.ts\";\n\nexport interface TypeCheckerFacade {\n readonly resolveExternalModuleSymbol: (symbol: AnySymbol) => CheckerSymbol;\n readonly getTypeOfSymbol: (symbol: AnySymbol) => Type;\n readonly getExportsAndPropertiesOfModule: (symbol: AnySymbol) => readonly AnySymbol[];\n readonly getSymbolFlags: (symbol: AnySymbol, excludeTypeOnlyMeanings: boolean) => number;\n readonly getAliasedSymbol: (symbol: AnySymbol) => CheckerSymbol;\n readonly getAnyType: Checker[\"getAnyType\"];\n readonly isArrayLikeType: Checker[\"isArrayLikeType\"];\n readonly getPropertyOfType: Checker[\"getPropertyOfType\"];\n readonly typeHasCallOrConstructSignatures: (type: Type) => boolean;\n readonly dispose: () => void;\n}\n\nconst UNKNOWN = \"unknown\";\nconst NONE = 0;\n\nconst isAlias = (symbol: AnySymbol): boolean => hasFlag(symbol.flags, SymbolFlags.Alias);\n\nconst isUnknownSymbol = (symbol: CheckerSymbol): boolean =>\n symbol.name === UNKNOWN &&\n symbol.declarations.length === NONE &&\n symbol.flags === SymbolFlags.Property;\n\nconst resolveExternalModuleSymbol = (session: CheckerSession, symbol: AnySymbol): CheckerSymbol => {\n const moduleSymbol = toCheckerSymbol(session, symbol);\n return Option.fromNullishOr(moduleSymbol.getExports().get(escapeSymbolName(EXPORT_EQUALS))).pipe(\n Option.map((exportEquals) => {\n if (isAlias(exportEquals)) {\n return session.checker.getAliasedSymbol(exportEquals);\n }\n return exportEquals;\n }),\n Option.getOrElse(() => moduleSymbol),\n );\n};\n\nconst isClassInstanceType = (type: Type): boolean =>\n isObjectType(type) && hasFlag(type.objectFlags, ObjectFlags.Class);\n\nconst isListType = (checker: Checker, type: Type): boolean =>\n checker.isArrayType(type) || checker.isTupleType(type);\n\nconst shouldTreatPropertiesAsExports = (checker: Checker, type: Type): boolean =>\n !hasFlag(type.flags, TypeFlags.Primitive) &&\n !isClassInstanceType(type) &&\n !isListType(checker, type);\n\nconst expandosOf = (\n symbol: AnySymbol,\n properties: readonly CheckerSymbol[],\n): readonly AnySymbol[] => {\n if (isCheckerSymbol(symbol)) {\n return [];\n }\n const names = new Set(\n pipe(\n properties,\n Arr.map((property) => property.name),\n ),\n );\n return pipe(\n boundExpandoExports(symbol),\n Arr.filter((member) => !names.has(member.name)),\n );\n};\n\nconst propertiesAsExports = (\n session: CheckerSession,\n symbol: AnySymbol,\n exportEquals: CheckerSymbol,\n): readonly AnySymbol[] => {\n const type = session.checker.getTypeOfSymbol(exportEquals);\n if (!shouldTreatPropertiesAsExports(session.checker, type)) {\n return [];\n }\n const properties = session.checker.getPropertiesOfType(type);\n return [...properties, ...expandosOf(symbol, properties)];\n};\n\nconst exportsAndPropertiesOf = (\n session: CheckerSession,\n symbol: AnySymbol,\n): readonly AnySymbol[] => {\n const moduleSymbol = toCheckerSymbol(session, symbol);\n const exports = session.checker.getExportsOfModule(moduleSymbol);\n const exportEquals = resolveExternalModuleSymbol(session, moduleSymbol);\n if (exportEquals.id === moduleSymbol.id) {\n return exports;\n }\n return [...exports, ...propertiesAsExports(session, symbol, exportEquals)];\n};\n\nconst aliasHasTypeOnlyDeclaration = (session: CheckerSession, symbol: CheckerSymbol): boolean =>\n pipe(\n symbol.declarations,\n Arr.some((handle) =>\n Option.fromNullishOr(handle.resolve(session.project)).pipe(\n Option.exists((declaration) => isTypeOnlyImportOrExportDeclaration(declaration)),\n ),\n ),\n );\n\nconst aliasChainIsTypeOnly = (session: CheckerSession, symbol: CheckerSymbol): boolean => {\n const seen = new Set<number>();\n const isUnvisitedAlias = (candidate: CheckerSymbol): boolean =>\n isAlias(candidate) && !seen.has(candidate.id);\n let current = Option.some(symbol).pipe(Option.filter((candidate) => isUnvisitedAlias(candidate)));\n while (Option.isSome(current)) {\n seen.add(current.value.id);\n if (aliasHasTypeOnlyDeclaration(session, current.value)) {\n return true;\n }\n current = Option.fromNullishOr(session.checker.getImmediateAliasedSymbol(current.value)).pipe(\n Option.filter((next) => isUnvisitedAlias(next)),\n );\n }\n return false;\n};\n\nconst resolvedAliasFlags = (\n session: CheckerSession,\n symbol: AnySymbol,\n target: CheckerSymbol,\n): number => {\n const resolved = session.checker.getAliasedSymbol(target);\n if (resolved.id === target.id) {\n return symbol.flags;\n }\n if (isUnknownSymbol(resolved)) {\n return SymbolFlags.All;\n }\n return withFlags(symbol.flags, resolved.flags);\n};\n\nconst symbolFlagsOf = (\n session: CheckerSession,\n symbol: AnySymbol,\n excludeTypeOnlyMeanings: boolean,\n): number => {\n if (!isAlias(symbol)) {\n return symbol.flags;\n }\n const target = toCheckerSymbol(session, symbol);\n if (excludeTypeOnlyMeanings && aliasChainIsTypeOnly(session, target)) {\n return symbol.flags;\n }\n return resolvedAliasFlags(session, symbol, target);\n};\n\nconst hasCallOrConstructSignatures = (checker: Checker, type: Type): boolean =>\n checker.getSignaturesOfType(type, SignatureKind.Call).length > NONE ||\n checker.getSignaturesOfType(type, SignatureKind.Construct).length > NONE;\n\nexport const createTypeChecker = (program: CheckerProgram): TypeCheckerFacade => {\n const session = openCheckerSession(program);\n const { checker } = session;\n return {\n resolveExternalModuleSymbol: (symbol) => resolveExternalModuleSymbol(session, symbol),\n getTypeOfSymbol: (symbol) => checker.getTypeOfSymbol(toCheckerSymbol(session, symbol)),\n getExportsAndPropertiesOfModule: (symbol) => exportsAndPropertiesOf(session, symbol),\n getSymbolFlags: (symbol, excludeTypeOnlyMeanings) =>\n symbolFlagsOf(session, symbol, excludeTypeOnlyMeanings),\n getAliasedSymbol: (symbol) => checker.getAliasedSymbol(toCheckerSymbol(session, symbol)),\n getAnyType: checker.getAnyType,\n isArrayLikeType: checker.isArrayLikeType,\n getPropertyOfType: checker.getPropertyOfType,\n typeHasCallOrConstructSignatures: (type) => hasCallOrConstructSignatures(checker, type),\n dispose: session.dispose,\n };\n};\n","import {\n MutableRef,\n Option,\n Predicate,\n Record as Rec,\n String as Str,\n Array as Arr,\n pipe,\n Function as Fn,\n} from \"effect\";\n\nimport { parseJson } from \"#src/json.ts\";\n\nimport { Messages, traceMessage } from \"./messages.ts\";\nimport { asRecord, resolvePackageJsonFieldWithTrace } from \"./package-json-fields.ts\";\nimport { combinePaths, forEachAncestorDirectory, toPath } from \"./paths.ts\";\nimport type {\n PackageId,\n PackageJsonCache,\n PackageJsonCacheEntry,\n PackageJsonContent,\n PackageJsonContents,\n PackageJsonInfo,\n PathAndExtension,\n Resolved,\n ResolutionState,\n} from \"./resolution-types.ts\";\n\nconst DATA_FIRST_ARITY = 2;\nconst DATA_FIRST_ARITY_3 = 3;\n\ninterface PackageJsonLocation {\n readonly packageDirectory: string;\n readonly packageJsonPath: string;\n}\n\nconst PACKAGE_JSON = \"package.json\";\nconst NODE_MODULES = \"node_modules\";\nconst SEPARATOR_LENGTH = 1;\nconst EMPTY = 0;\nconst BYTE_ORDER_MARK = /^\\uFEFF/u;\n\nconst memo = <Value>(): ((compute: () => Option.Option<Value>) => Option.Option<Value>) => {\n const cell = MutableRef.make(Option.none<Option.Option<Value>>());\n return (compute) => {\n const value = MutableRef.get(cell).pipe(Option.getOrElse(compute));\n MutableRef.set(cell, Option.some(value));\n return value;\n };\n};\n\nconst createContents = (packageJsonContent: PackageJsonContent): PackageJsonContents => ({\n packageJsonContent,\n versionPaths: memo(),\n peerDependencies: memo(),\n});\n\nexport const createPackageJsonCache = (): PackageJsonCache => {\n const entries = new Map<string, PackageJsonCacheEntry>();\n return {\n get: (packageJsonPath) => Option.fromNullishOr(entries.get(toPath(packageJsonPath))),\n set: (packageJsonPath, entry) => {\n entries.set(toPath(packageJsonPath), entry);\n },\n };\n};\n\nconst parseText = (text: string): Option.Option<unknown> =>\n parseJson(Str.replace(BYTE_ORDER_MARK, \"\")(text));\n\nconst readJson = (path: string, state: ResolutionState): PackageJsonContent =>\n state.host.readFile(path).pipe(\n Option.flatMap((text) => parseText(text)),\n Option.map((value) => asRecord(value)),\n Option.getOrElse(() => ({})),\n );\n\nconst reuseCachedWithTrace = (\n { packageDirectory, packageJsonPath }: PackageJsonLocation,\n entry: PackageJsonCacheEntry,\n state: ResolutionState,\n): Option.Option<PackageJsonInfo> => {\n if (entry.kind === \"found\") {\n traceMessage(state, Messages.fileExistsCached, packageJsonPath);\n return Option.some({ packageDirectory, contents: entry.info.contents });\n }\n if (entry.missing.directoryExists) {\n traceMessage(state, Messages.fileDoesNotExistCached, packageJsonPath);\n }\n return Option.none();\n};\n\nconst remember = (\n state: ResolutionState,\n packageJsonPath: string,\n entry: PackageJsonCacheEntry,\n): void => {\n for (const cache of Option.toArray(state.packageJsonCache)) {\n cache.set(packageJsonPath, entry);\n }\n};\n\nconst cacheFoundWithTrace = (\n { packageDirectory, packageJsonPath }: PackageJsonLocation,\n state: ResolutionState,\n): Option.Option<PackageJsonInfo> => {\n const contents = createContents(readJson(packageJsonPath, state));\n traceMessage(state, Messages.foundPackageJson, packageJsonPath);\n const info = { packageDirectory, contents };\n remember(state, packageJsonPath, { kind: \"found\", info });\n return Option.some(info);\n};\n\nconst resolveAndCacheWithTrace = (\n location: PackageJsonLocation,\n state: ResolutionState,\n): Option.Option<PackageJsonInfo> => {\n const { packageDirectory, packageJsonPath } = location;\n const directoryExists = state.host.directoryExists(packageDirectory);\n if (directoryExists && state.host.fileExists(packageJsonPath)) {\n return cacheFoundWithTrace(location, state);\n }\n if (directoryExists) {\n traceMessage(state, Messages.fileDoesNotExist, packageJsonPath);\n }\n remember(state, packageJsonPath, {\n kind: \"missing\",\n missing: { packageDirectory, directoryExists },\n });\n return Option.none();\n};\n\nexport const resolvePackageJsonInfo: {\n (\n onlyRecordFailures: boolean,\n state: ResolutionState,\n ): (packageDirectory: string) => Option.Option<PackageJsonInfo>;\n (\n packageDirectory: string,\n onlyRecordFailures: boolean,\n state: ResolutionState,\n ): Option.Option<PackageJsonInfo>;\n} = Fn.dual(\n DATA_FIRST_ARITY_3,\n (\n packageDirectory: string,\n onlyRecordFailures: boolean,\n state: ResolutionState,\n ): Option.Option<PackageJsonInfo> => {\n if (onlyRecordFailures) {\n return Option.none();\n }\n const location = {\n packageDirectory,\n packageJsonPath: combinePaths(packageDirectory, PACKAGE_JSON),\n };\n return state.packageJsonCache.pipe(\n Option.flatMap((cache) => cache.get(location.packageJsonPath)),\n Option.match({\n onNone: () => resolveAndCacheWithTrace(location, state),\n onSome: (entry) => reuseCachedWithTrace(location, entry, state),\n }),\n );\n },\n);\n\nexport const getPackageScopeForPath: {\n (state: ResolutionState): (directory: string) => Option.Option<PackageJsonInfo>;\n (directory: string, state: ResolutionState): Option.Option<PackageJsonInfo>;\n} = Fn.dual(\n DATA_FIRST_ARITY,\n (directory: string, state: ResolutionState): Option.Option<PackageJsonInfo> =>\n forEachAncestorDirectory(directory, (ancestor) =>\n resolvePackageJsonInfo(ancestor, false, state),\n ),\n);\n\nconst peerVersion = (peer: string, nodeModules: string, state: ResolutionState): string =>\n resolvePackageJsonInfo(`${nodeModules}${peer}`, false, state).pipe(\n Option.match({\n onNone: () => {\n traceMessage(state, Messages.failedToFindPeerDependency, peer);\n return \"\";\n },\n onSome: (peerInfo) => {\n const version = String(peerInfo.contents.packageJsonContent[\"version\"]);\n traceMessage(state, Messages.foundPeerDependency, peer, version);\n return `+${peer}@${version}`;\n },\n }),\n );\n\nconst nodeModulesOf = (packageDirectory: string): string => {\n const end = Option.match(Str.lastIndexOf(NODE_MODULES)(packageDirectory), {\n onNone: () => packageDirectory.length,\n onSome: (index) => index + NODE_MODULES.length,\n });\n return `${Str.slice(EMPTY, end)(packageDirectory)}/`;\n};\n\nconst resolvePeerDependenciesWithTrace = (\n info: PackageJsonInfo,\n state: ResolutionState,\n): Option.Option<string> =>\n resolvePackageJsonFieldWithTrace(\n info.contents.packageJsonContent,\n { field: \"peerDependencies\", expected: \"object\" },\n state,\n ).pipe(\n Option.map((peers) => {\n traceMessage(state, Messages.packageJsonHasPeerDependencies);\n const nodeModules = nodeModulesOf(info.packageDirectory);\n return pipe(\n Rec.keys(asRecord(peers)),\n Arr.map((peer) => peerVersion(peer, nodeModules, state)),\n Arr.join(\"\"),\n );\n }),\n Option.filter((joined) => Str.isNonEmpty(joined)),\n );\n\nconst getPeerDependencies = (info: PackageJsonInfo, state: ResolutionState): string =>\n info.contents\n .peerDependencies(() => resolvePeerDependenciesWithTrace(info, state))\n .pipe(Option.getOrElse(() => \"\"));\n\nconst packageIdOf = (\n info: PackageJsonInfo,\n resolved: PathAndExtension,\n state: ResolutionState,\n): Option.Option<PackageId> => {\n const { name, version } = info.contents.packageJsonContent;\n if (!Predicate.isString(name) || !Predicate.isString(version)) {\n return Option.none();\n }\n return Option.some({\n name,\n subModuleName: Str.slice(info.packageDirectory.length + SEPARATOR_LENGTH)(resolved.path),\n version,\n peerDependencies: getPeerDependencies(info, state),\n });\n};\n\nexport const withPackageId: {\n (\n resolved: Option.Option<PathAndExtension>,\n state: ResolutionState,\n ): (info: Option.Option<PackageJsonInfo>) => Option.Option<Resolved>;\n (\n info: Option.Option<PackageJsonInfo>,\n resolved: Option.Option<PathAndExtension>,\n state: ResolutionState,\n ): Option.Option<Resolved>;\n} = Fn.dual(\n DATA_FIRST_ARITY_3,\n (\n info: Option.Option<PackageJsonInfo>,\n resolved: Option.Option<PathAndExtension>,\n state: ResolutionState,\n ): Option.Option<Resolved> =>\n resolved.pipe(\n Option.map((value): Resolved => ({\n path: value.path,\n extension: value.extension,\n resolvedUsingTsExtension: value.resolvedUsingTsExtension,\n packageId: info.pipe(\n Option.flatMap((packageInfo) => packageIdOf(packageInfo, value, state)),\n ),\n originalPath: Option.none(),\n })),\n ),\n);\n\nconst qualifiedName = (packageId: PackageId): string => {\n if (packageId.subModuleName.length > EMPTY) {\n return `${packageId.name}/${packageId.subModuleName}`;\n }\n return packageId.name;\n};\n\nexport const packageIdToString = (packageId: PackageId): string =>\n `${qualifiedName(packageId)}@${packageId.version}${packageId.peerDependencies}`;\n","import { Array as Arr, Option, String as Str, Function as Fn } from \"effect\";\n\nimport type { ResolutionState } from \"./resolution-types.ts\";\nimport type { TargetRequest } from \"./resolver-target.ts\";\n\nconst DATA_FIRST_ARITY = 2;\nconst DATA_FIRST_ARITY_3 = 3;\n\nconst NOT_FOUND = -1;\nconst STAR_LENGTH = 1;\nconst START = 0;\nconst BEFORE = -1;\nconst AFTER = 1;\nconst EQUAL = 0;\n\nconst baseLength = (key: string): number =>\n Option.match(Str.indexOf(\"*\")(key), {\n onNone: () => key.length,\n onSome: (star) => star + STAR_LENGTH,\n });\n\ninterface KeyPair {\n readonly left: string;\n readonly right: string;\n}\n\nconst KEY_ORDER_RULES: readonly ((pair: KeyPair) => Option.Option<number>)[] = [\n ({ left, right }) =>\n Option.liftPredicate(Math.sign(baseLength(right) - baseLength(left)), (sign) => sign !== EQUAL),\n ({ left }) => Option.liftPredicate(AFTER, () => !Str.includes(\"*\")(left)),\n ({ right }) => Option.liftPredicate(BEFORE, () => !Str.includes(\"*\")(right)),\n];\n\nexport const comparePatternKeys: {\n (right: string): (left: string) => number;\n (left: string, right: string): number;\n} = Fn.dual(DATA_FIRST_ARITY, (left: string, right: string): number =>\n Arr.findFirst(KEY_ORDER_RULES, (rule) => rule({ left, right })).pipe(\n Option.getOrElse(() => Math.sign(right.length - left.length)),\n ),\n);\n\nexport const hasOneAsterisk = (key: string): boolean =>\n Option.exists(Str.indexOf(\"*\")(key), (first) =>\n Option.contains(Str.lastIndexOf(\"*\")(key), first),\n );\n\nconst surroundsName = (target: string, star: number, name: string): boolean =>\n Str.startsWith(Str.slice(START, star)(target))(name) &&\n Str.endsWith(Str.slice(star + STAR_LENGTH)(target))(name);\n\nconst matchesPatternWithTrailer = (target: string, name: string): boolean =>\n !Str.endsWith(\"*\")(target) &&\n Option.exists(Str.indexOf(\"*\")(target), (star) => surroundsName(target, star, name));\n\nexport type Expansion = Option.Option<Omit<TargetRequest, \"key\">>;\n\nconst trailerExpansion = (key: string, name: string, state: ResolutionState): Expansion =>\n Option.liftPredicate(\n key,\n (candidate) => state.features.patternTrailers && matchesPatternWithTrailer(candidate, name),\n ).pipe(\n Option.flatMap((candidate) =>\n Option.map(Str.indexOf(\"*\")(candidate), (star) => {\n const end = name.length - (candidate.length - STAR_LENGTH - star);\n return { subpath: Str.slice(star, end)(name), pattern: true };\n }),\n ),\n );\n\nconst starSuffixExpansion = (key: string, name: string): Expansion =>\n Option.liftPredicate(\n { subpath: Str.slice(key.length - STAR_LENGTH)(name), pattern: true },\n () => Str.endsWith(\"*\")(key) && Str.startsWith(Str.slice(START, NOT_FOUND)(key))(name),\n );\n\nconst prefixExpansion = (key: string, name: string): Expansion =>\n Option.liftPredicate({ subpath: Str.slice(key.length)(name), pattern: false }, () =>\n Str.startsWith(key)(name),\n );\n\nexport const expandedSubpath: {\n (name: string, state: ResolutionState): (key: string) => Expansion;\n (key: string, name: string, state: ResolutionState): Expansion;\n} = Fn.dual(DATA_FIRST_ARITY_3, (key: string, name: string, state: ResolutionState): Expansion =>\n trailerExpansion(key, name, state).pipe(\n Option.orElse(() => starSuffixExpansion(key, name)),\n Option.orElse(() => prefixExpansion(key, name)),\n ),\n);\n","import { Array as Arr, Option, String as Str, pipe, Function as Fn } from \"effect\";\n\nimport {\n Extension,\n isDeclarationFileName,\n isTSFileExtensionForPackageField,\n removeFileExtension,\n tryExtractTSExtension,\n} from \"./extensions.ts\";\nimport type { ExtensionKind } from \"./extensions.ts\";\nimport { Messages, traceMessage } from \"./messages.ts\";\nimport { getBaseFileName, getDirectoryPath } from \"./paths.ts\";\nimport type { CandidateRequest, PathAndExtension, ResolutionState } from \"./resolution-types.ts\";\n\nconst DATA_FIRST_ARITY = 2;\nconst DATA_FIRST_ARITY_3 = 3;\n\ninterface ExtensionAttempt {\n readonly kind: ExtensionKind;\n readonly extension: string;\n readonly usingTsExtension: boolean;\n}\n\nconst attempt = (\n kind: ExtensionKind,\n extension: string,\n usingTsExtension = false,\n): ExtensionAttempt => ({\n kind,\n extension,\n usingTsExtension,\n});\n\nconst esmAttempts = (original: string): readonly ExtensionAttempt[] => {\n const explicit = original === Extension.Mts || original === Extension.Dmts;\n return [\n attempt(\"TypeScript\", Extension.Mts, explicit),\n attempt(\"Declaration\", Extension.Dmts, explicit),\n attempt(\"JavaScript\", Extension.Mjs),\n ];\n};\n\nconst cjsAttempts = (original: string): readonly ExtensionAttempt[] => {\n const explicit = original === Extension.Cts || original === Extension.Dcts;\n return [\n attempt(\"TypeScript\", Extension.Cts, explicit),\n attempt(\"Declaration\", Extension.Dcts, explicit),\n attempt(\"JavaScript\", Extension.Cjs),\n ];\n};\n\nconst jsonAttempts = (): readonly ExtensionAttempt[] => [\n attempt(\"Declaration\", \".d.json.ts\"),\n attempt(\"Json\", Extension.Json),\n];\n\nconst jsxAttempts = (original: string): readonly ExtensionAttempt[] => {\n const explicit = original === Extension.Tsx;\n return [\n attempt(\"TypeScript\", Extension.Tsx, explicit),\n attempt(\"TypeScript\", Extension.Ts, explicit),\n attempt(\"Declaration\", Extension.Dts, explicit),\n attempt(\"JavaScript\", Extension.Jsx),\n attempt(\"JavaScript\", Extension.Js),\n ];\n};\n\nconst defaultAttempts = (original: string): readonly ExtensionAttempt[] => {\n const explicit = original === Extension.Ts || original === Extension.Dts;\n return [\n attempt(\"TypeScript\", Extension.Ts, explicit),\n attempt(\"TypeScript\", Extension.Tsx, explicit),\n attempt(\"Declaration\", Extension.Dts, explicit),\n attempt(\"JavaScript\", Extension.Js),\n attempt(\"JavaScript\", Extension.Jsx),\n ];\n};\n\nconst arbitraryAttempts = (candidate: string, original: string): readonly ExtensionAttempt[] =>\n Option.liftPredicate(`${candidate}${original}`, (path) => !isDeclarationFileName(path)).pipe(\n Option.match({\n onNone: (): readonly ExtensionAttempt[] => [],\n onSome: () => [attempt(\"Declaration\", `.d${original}.ts`)],\n }),\n );\n\nconst ATTEMPTS_BY_EXTENSION: Readonly<\n Record<string, (original: string) => readonly ExtensionAttempt[]>\n> = {\n [Extension.Mjs]: esmAttempts,\n [Extension.Mts]: esmAttempts,\n [Extension.Dmts]: esmAttempts,\n [Extension.Cjs]: cjsAttempts,\n [Extension.Cts]: cjsAttempts,\n [Extension.Dcts]: cjsAttempts,\n [Extension.Json]: jsonAttempts,\n [Extension.Tsx]: jsxAttempts,\n [Extension.Jsx]: jsxAttempts,\n [Extension.Ts]: defaultAttempts,\n [Extension.Dts]: defaultAttempts,\n [Extension.Js]: defaultAttempts,\n \"\": defaultAttempts,\n};\n\nconst attemptsFor = (candidate: string, original: string): readonly ExtensionAttempt[] =>\n Option.fromNullishOr(ATTEMPTS_BY_EXTENSION[original]).pipe(\n Option.match({\n onNone: () => arbitraryAttempts(candidate, original),\n onSome: (attempts) => attempts(original),\n }),\n );\n\nconst NONE = 0;\n\nexport const tryFile: {\n (\n onlyRecordFailures: boolean,\n state: ResolutionState,\n ): (fileName: string) => Option.Option<string>;\n (fileName: string, onlyRecordFailures: boolean, state: ResolutionState): Option.Option<string>;\n} = Fn.dual(\n DATA_FIRST_ARITY_3,\n (\n fileName: string,\n onlyRecordFailures: boolean,\n state: ResolutionState,\n ): Option.Option<string> => {\n if (onlyRecordFailures) {\n return Option.none();\n }\n if (state.host.fileExists(fileName)) {\n traceMessage(state, Messages.fileExistsUseIt, fileName);\n return Option.some(fileName);\n }\n traceMessage(state, Messages.fileDoesNotExist, fileName);\n return Option.none();\n },\n);\n\nconst directoryProbablyMissing = (candidate: string, state: ResolutionState): boolean => {\n const directory = getDirectoryPath(candidate);\n return directory.length > NONE && !state.host.directoryExists(directory);\n};\n\ninterface ExtensionRequest extends CandidateRequest {\n readonly originalExtension: string;\n}\n\nconst tryAttempt = (\n candidate: string,\n { extension, usingTsExtension }: ExtensionAttempt,\n state: ResolutionState,\n): Option.Option<PathAndExtension> =>\n tryFile(`${candidate}${extension}`, false, state).pipe(\n Option.map((path) => ({\n path,\n extension,\n resolvedUsingTsExtension: !state.candidateIsFromPackageJsonField && usingTsExtension,\n })),\n );\n\nconst tryAddingExtensions = (\n request: ExtensionRequest,\n state: ResolutionState,\n): Option.Option<PathAndExtension> => {\n if (request.onlyRecordFailures || directoryProbablyMissing(request.candidate, state)) {\n return Option.none();\n }\n const attempts = pipe(\n attemptsFor(request.candidate, request.originalExtension),\n Arr.filter(({ kind }) => request.extensions.includes(kind)),\n );\n return Arr.findFirst(attempts, (current) => tryAttempt(request.candidate, current, state));\n};\n\nconst resolveBySwappingExtensionWithTrace = (\n request: CandidateRequest,\n state: ResolutionState,\n): Option.Option<PathAndExtension> => {\n const { candidate } = request;\n if (!Str.includes(\".\")(getBaseFileName(candidate))) {\n return Option.none();\n }\n const removed = removeFileExtension(candidate);\n const extensionless = Option.liftPredicate(removed, (path) => path !== candidate).pipe(\n Option.getOrElse(() =>\n Option.match(Str.lastIndexOf(\".\")(candidate), {\n onNone: () => candidate,\n onSome: (dot) => Str.slice(NONE, dot)(candidate),\n }),\n ),\n );\n const extension = Str.slice(extensionless.length)(candidate);\n traceMessage(state, Messages.fileHasExtensionStripping, candidate, extension);\n return tryAddingExtensions(\n { ...request, candidate: extensionless, originalExtension: extension },\n state,\n );\n};\n\nexport const loadModuleFromFile: {\n (state: ResolutionState): (request: CandidateRequest) => Option.Option<PathAndExtension>;\n (request: CandidateRequest, state: ResolutionState): Option.Option<PathAndExtension>;\n} = Fn.dual(\n DATA_FIRST_ARITY,\n (request: CandidateRequest, state: ResolutionState): Option.Option<PathAndExtension> =>\n resolveBySwappingExtensionWithTrace(request, state).pipe(\n Option.orElse(() =>\n Option.liftPredicate(state, ({ features }) => !features.esmMode).pipe(\n Option.flatMap(() => tryAddingExtensions({ ...request, originalExtension: \"\" }, state)),\n ),\n ),\n ),\n);\n\nexport const loadFileNameFromPackageJsonField: {\n (state: ResolutionState): (request: CandidateRequest) => Option.Option<PathAndExtension>;\n (request: CandidateRequest, state: ResolutionState): Option.Option<PathAndExtension>;\n} = Fn.dual(\n DATA_FIRST_ARITY,\n (request: CandidateRequest, state: ResolutionState): Option.Option<PathAndExtension> => {\n const { candidate } = request;\n if (!isTSFileExtensionForPackageField(request.extensions, candidate)) {\n return resolveBySwappingExtensionWithTrace(request, state);\n }\n return tryFile(candidate, request.onlyRecordFailures, state).pipe(\n Option.map(() => ({\n path: candidate,\n extension: Option.getOrElse(tryExtractTSExtension(candidate), () => \"\"),\n resolvedUsingTsExtension: false,\n })),\n );\n },\n);\n","import {\n Array as Arr,\n Option,\n Predicate,\n Record as Rec,\n String as Str,\n pipe,\n Function as Fn,\n} from \"effect\";\nimport semver from \"semver\";\n\nimport type { Extensions } from \"./extensions.ts\";\nimport { Messages, traceMessage } from \"./messages.ts\";\nimport { withPackageId } from \"./package-json.ts\";\nimport {\n combinePaths,\n getNormalizedAbsolutePath,\n getPathComponents,\n pathIsRelative,\n} from \"./paths.ts\";\nimport type {\n PackageJsonInfo,\n Resolved,\n ResolutionState,\n SearchResult,\n} from \"./resolution-types.ts\";\nimport { loadFileNameFromPackageJsonField } from \"./resolver-files.ts\";\nimport { RESOLUTION_VERSION } from \"./types-versions.ts\";\n\nconst DATA_FIRST_ARITY_3 = 3;\n\nexport interface TargetContext {\n readonly extensions: Extensions;\n readonly moduleName: string;\n readonly scope: PackageJsonInfo;\n readonly isImports: boolean;\n}\n\nexport interface TargetRequest {\n readonly subpath: string;\n readonly pattern: boolean;\n readonly key: string;\n}\n\nexport interface TargetSite {\n readonly context: TargetContext;\n readonly request: TargetRequest;\n}\n\ntype TargetLoader = (target: unknown, site: TargetSite, state: ResolutionState) => SearchResult;\n\nconst FORBIDDEN_SEGMENTS: ReadonlySet<string> = new Set([\"..\", \".\", \"node_modules\"]);\nconst VERSIONED_TYPES_PREFIX = \"types@\";\nconst RANGE_OPTIONS = { includePrerelease: true } as const;\nconst FIRST_SEGMENT = 1;\nconst EMPTY = 0;\n\nexport const notFound: SearchResult = Option.none();\n\nconst asSearchResult = (resolved: Option.Option<Resolved>): SearchResult =>\n resolved.pipe(Option.map((value) => Option.some(value)));\n\nconst invalidTarget = ({ context }: TargetSite, state: ResolutionState): SearchResult => {\n traceMessage(\n state,\n Messages.packageJsonInvalidTarget,\n context.scope.packageDirectory,\n context.moduleName,\n );\n return notFound;\n};\n\nconst fieldName = (context: TargetContext): string => {\n if (context.isImports) {\n return \"imports\";\n }\n return \"exports\";\n};\n\nconst substitute = (target: string, request: TargetRequest): string => {\n if (request.pattern) {\n return Str.replaceAll(\"*\", request.subpath)(target);\n }\n return `${target}${request.subpath}`;\n};\n\nconst hasForbiddenSegment = (parts: readonly string[]): boolean =>\n pipe(\n parts,\n Arr.some((part) => FORBIDDEN_SEGMENTS.has(part)),\n );\n\nconst resolveImportToPackage = (\n target: string,\n { context, request }: TargetSite,\n state: ResolutionState,\n): SearchResult => {\n const combinedLookup = substitute(target, request);\n const containingDirectory = `${context.scope.packageDirectory}/`;\n traceMessage(state, Messages.usingSubpath, \"imports\", request.key, combinedLookup);\n traceMessage(state, Messages.resolvingModule, combinedLookup, containingDirectory);\n const result = state.resolveNested(state, {\n moduleName: combinedLookup,\n containingDirectory,\n extensions: context.extensions,\n });\n return asSearchResult(\n result.resolvedModule.pipe(\n Option.map((module) => ({\n path: module.resolvedFileName,\n extension: module.extension,\n packageId: module.packageId,\n originalPath: module.originalPath,\n resolvedUsingTsExtension: module.resolvedUsingTsExtension,\n })),\n ),\n );\n};\n\nconst isPackageImportTarget = (target: string, context: TargetContext): boolean =>\n context.isImports && !Str.startsWith(\"../\")(target) && !Str.startsWith(\"/\")(target);\n\nconst targetParts = (target: string): readonly string[] => {\n const parts = getPathComponents(target);\n if (pathIsRelative(target)) {\n return parts.slice(FIRST_SEGMENT);\n }\n return parts;\n};\n\nconst resolveRelativeTargetWithTrace = (\n target: string,\n site: TargetSite,\n state: ResolutionState,\n): SearchResult => {\n const { context, request } = site;\n if (\n hasForbiddenSegment(targetParts(target).slice(FIRST_SEGMENT)) ||\n hasForbiddenSegment(getPathComponents(request.subpath))\n ) {\n return invalidTarget(site, state);\n }\n traceMessage(\n state,\n Messages.usingSubpath,\n fieldName(context),\n request.key,\n substitute(target, request),\n );\n const candidate = getNormalizedAbsolutePath(\n substitute(combinePaths(context.scope.packageDirectory, target), request),\n \"/\",\n );\n const loaded = loadFileNameFromPackageJsonField(\n { extensions: context.extensions, candidate, onlyRecordFailures: false },\n state,\n );\n return asSearchResult(withPackageId(Option.some(context.scope), loaded, state));\n};\n\ntype StringTargetLoader = (\n target: string,\n site: TargetSite,\n state: ResolutionState,\n) => SearchResult;\n\nconst STRING_TARGET_LOADERS: readonly (readonly [\n (target: string, context: TargetContext) => boolean,\n StringTargetLoader,\n])[] = [\n [(target) => Str.startsWith(\"./\")(target), resolveRelativeTargetWithTrace],\n [isPackageImportTarget, resolveImportToPackage],\n];\n\nconst isMissingTrailingSlash = (target: string, request: TargetRequest): boolean =>\n !request.pattern && request.subpath.length > EMPTY && !Str.endsWith(\"/\")(target);\n\nconst loadStringTarget: StringTargetLoader = (target, site, state) => {\n if (isMissingTrailingSlash(target, site.request)) {\n return invalidTarget(site, state);\n }\n return Arr.findFirst(STRING_TARGET_LOADERS, ([applies]) => applies(target, site.context)).pipe(\n Option.match({\n onNone: () => invalidTarget(site, state),\n onSome: ([, load]) => load(target, site, state),\n }),\n );\n};\n\nconst isApplicableVersionedTypesKey = (conditions: readonly string[], key: string): boolean => {\n const range = Str.slice(VERSIONED_TYPES_PREFIX.length)(key);\n return (\n conditions.includes(\"types\") &&\n Str.startsWith(VERSIONED_TYPES_PREFIX)(key) &&\n Predicate.isNotNull(semver.validRange(range, RANGE_OPTIONS)) &&\n semver.satisfies(RESOLUTION_VERSION, range, RANGE_OPTIONS)\n );\n};\n\nconst conditionMatches = (condition: string, state: ResolutionState): boolean =>\n condition === \"default\" ||\n state.conditions.includes(condition) ||\n isApplicableVersionedTypesKey(state.conditions, condition);\n\nconst tryCondition =\n (loadTarget: TargetLoader, target: Readonly<Record<string, unknown>>) =>\n (condition: string, site: TargetSite, state: ResolutionState): SearchResult => {\n if (!conditionMatches(condition, state)) {\n traceMessage(state, Messages.sawNonMatchingCondition, condition);\n return Option.none();\n }\n traceMessage(state, Messages.matchedCondition, fieldName(site.context), condition);\n const result = loadTarget(target[condition], site, state);\n if (Option.isSome(result)) {\n traceMessage(state, Messages.resolvedUnderCondition, condition);\n return result;\n }\n traceMessage(state, Messages.failedUnderCondition, condition);\n return result;\n };\n\nconst resolveConditionsWithTrace =\n (loadTarget: TargetLoader) =>\n (\n target: Readonly<Record<string, unknown>>,\n site: TargetSite,\n state: ResolutionState,\n ): SearchResult => {\n traceMessage(state, Messages.enteringConditionalExports);\n const attempt = tryCondition(loadTarget, target);\n const result = Arr.findFirst(Rec.keys(target), (condition) => attempt(condition, site, state));\n traceMessage(state, Messages.exitingConditionalExports);\n return result;\n };\n\nconst loadArrayTarget =\n (loadTarget: TargetLoader) =>\n (target: readonly unknown[], site: TargetSite, state: ResolutionState): SearchResult => {\n if (target.length === EMPTY) {\n return invalidTarget(site, state);\n }\n return Arr.findFirst(target, (element) => loadTarget(element, site, state)).pipe(\n Option.orElse(() => invalidTarget(site, state)),\n );\n };\n\nconst nullTarget = ({ context }: TargetSite, state: ResolutionState): SearchResult => {\n traceMessage(\n state,\n Messages.packageJsonMapsToNull,\n context.scope.packageDirectory,\n context.moduleName,\n );\n return notFound;\n};\n\nconst loadScalarTarget = (\n target: unknown,\n site: TargetSite,\n state: ResolutionState,\n): SearchResult => {\n if (Predicate.isNull(target)) {\n return nullTarget(site, state);\n }\n return invalidTarget(site, state);\n};\n\nconst loadStructuredTarget =\n (loadTarget: TargetLoader): TargetLoader =>\n (target, site, state) => {\n if (Arr.isArray(target)) {\n return loadArrayTarget(loadTarget)(target, site, state);\n }\n if (Predicate.isObject(target)) {\n return resolveConditionsWithTrace(loadTarget)(target, site, state);\n }\n return loadScalarTarget(target, site, state);\n };\n\nexport const loadTarget: {\n (site: TargetSite, state: ResolutionState): (target: unknown) => SearchResult;\n (target: unknown, site: TargetSite, state: ResolutionState): SearchResult;\n} = Fn.dual(\n DATA_FIRST_ARITY_3,\n (target: unknown, site: TargetSite, state: ResolutionState): SearchResult => {\n if (Predicate.isString(target)) {\n return loadStringTarget(target, site, state);\n }\n return loadStructuredTarget(loadTarget)(target, site, state);\n },\n);\n","import {\n Array as Arr,\n Option,\n Predicate,\n Record as Rec,\n String as Str,\n pipe,\n Function as Fn,\n Order,\n} from \"effect\";\n\nimport { PRIORITY_KINDS, intersectExtensions, subtractExtensions } from \"./extensions.ts\";\nimport type { Extensions } from \"./extensions.ts\";\nimport { Messages, traceMessage } from \"./messages.ts\";\nimport { getPackageScopeForPath } from \"./package-json.ts\";\nimport { getNormalizedAbsolutePath, getPathComponents } from \"./paths.ts\";\nimport type {\n ModuleLookup,\n PackageJsonInfo,\n ResolutionState,\n SearchResult,\n} from \"./resolution-types.ts\";\nimport { comparePatternKeys, expandedSubpath, hasOneAsterisk } from \"./resolver-patterns.ts\";\nimport { loadTarget, notFound } from \"./resolver-target.ts\";\nimport type { TargetContext } from \"./resolver-target.ts\";\n\nconst DATA_FIRST_ARITY_3 = 3;\n\nconst DATA_FIRST_ARITY = 2;\nconst SAME_ORDER = 0;\n\nconst patternKeyOrder: Order.Order<string> = (left, right) =>\n Order.Number(comparePatternKeys(left, right), SAME_ORDER);\n\ntype LookupTable = Readonly<Record<string, unknown>>;\n\ninterface LookupSite {\n readonly lookupTable: LookupTable;\n readonly context: TargetContext;\n}\n\nexport interface ExportsRequest {\n readonly extensions: Extensions;\n readonly subpath: string;\n}\n\nconst expandKey = (\n key: string,\n site: LookupSite,\n state: ResolutionState,\n): Option.Option<SearchResult> =>\n expandedSubpath(key, site.context.moduleName, state).pipe(\n Option.map((expansion) =>\n loadTarget(\n site.lookupTable[key],\n { context: site.context, request: { ...expansion, key } },\n state,\n ),\n ),\n );\n\nconst loadModuleFromImportsOrExports = (site: LookupSite, state: ResolutionState): SearchResult => {\n const { context, lookupTable } = site;\n const name = context.moduleName;\n if (!Str.endsWith(\"/\")(name) && !Str.includes(\"*\")(name) && Rec.has(lookupTable, name)) {\n return loadTarget(\n lookupTable[name],\n { context, request: { subpath: \"\", pattern: false, key: name } },\n state,\n );\n }\n const expandingKeys = pipe(\n Rec.keys(lookupTable),\n Arr.filter((key) => hasOneAsterisk(key) || Str.endsWith(\"/\")(key)),\n (keys) => Arr.sort(keys, patternKeyOrder),\n );\n return Arr.findFirst(expandingKeys, (key) => expandKey(key, site, state)).pipe(Option.flatten);\n};\n\nconst noKeyStartsWithDot = (value: LookupTable): boolean =>\n !pipe(\n Rec.keys(value),\n Arr.some((key) => Str.startsWith(\".\")(key)),\n );\n\nconst allKeysStartWithDot = (value: LookupTable): boolean =>\n pipe(\n Rec.keys(value),\n Arr.every((key) => Str.startsWith(\".\")(key)),\n );\n\nconst isDirectExport = (exports: unknown): boolean =>\n Predicate.isString(exports) || Arr.isArray(exports);\n\nconst objectMainExport = (exports: LookupTable): Option.Option<unknown> => {\n if (noKeyStartsWithDot(exports)) {\n return Option.some(exports);\n }\n return Option.liftPredicate(exports[\".\"], Predicate.isTruthy).pipe(\n Option.filter(() => Rec.has(exports, \".\")),\n );\n};\n\nconst mainExportOf = (exports: unknown): Option.Option<unknown> => {\n if (isDirectExport(exports)) {\n return Option.some(exports);\n }\n return Option.liftPredicate(exports, Predicate.isObject).pipe(Option.flatMap(objectMainExport));\n};\n\nconst exportDoesNotExist = (context: TargetContext, state: ResolutionState): SearchResult => {\n traceMessage(\n state,\n Messages.exportSpecifierDoesNotExist,\n context.moduleName,\n context.scope.packageDirectory,\n );\n return notFound;\n};\n\nconst loadSubpathExport = (\n exports: unknown,\n context: TargetContext,\n state: ResolutionState,\n): SearchResult => {\n if (!Predicate.isObject(exports) || !allKeysStartWithDot(exports)) {\n return exportDoesNotExist(context, state);\n }\n return loadModuleFromImportsOrExports({ lookupTable: exports, context }, state).pipe(\n Option.orElse(() => exportDoesNotExist(context, state)),\n );\n};\n\nexport const loadModuleFromExports: {\n (request: ExportsRequest, state: ResolutionState): (scope: PackageJsonInfo) => SearchResult;\n (scope: PackageJsonInfo, request: ExportsRequest, state: ResolutionState): SearchResult;\n} = Fn.dual(\n DATA_FIRST_ARITY_3,\n (\n scope: PackageJsonInfo,\n { extensions, subpath }: ExportsRequest,\n state: ResolutionState,\n ): SearchResult => {\n const { exports } = scope.contents.packageJsonContent;\n if (!Predicate.isTruthy(exports)) {\n return Option.none();\n }\n const context: TargetContext = { extensions, moduleName: subpath, scope, isImports: false };\n if (subpath !== \".\") {\n return loadSubpathExport(exports, context, state);\n }\n return mainExportOf(exports).pipe(\n Option.match({\n onNone: () => exportDoesNotExist(context, state),\n onSome: (mainExport) =>\n loadTarget(\n mainExport,\n { context, request: { subpath: \"\", pattern: false, key: \".\" } },\n state,\n ),\n }),\n );\n },\n);\n\nconst asLookupTable = (value: unknown): LookupTable =>\n Option.liftPredicate(value, Predicate.isObject).pipe(Option.getOrElse(() => ({})));\n\nconst reportMissingImport = (context: TargetContext, state: ResolutionState): SearchResult => {\n traceMessage(\n state,\n Messages.importSpecifierDoesNotExist,\n context.moduleName,\n context.scope.packageDirectory,\n );\n return notFound;\n};\n\nconst resolveImportsWithTrace = (\n lookup: ModuleLookup,\n scope: PackageJsonInfo,\n state: ResolutionState,\n): SearchResult => {\n const { imports } = scope.contents.packageJsonContent;\n if (!Predicate.isTruthy(imports)) {\n traceMessage(state, Messages.packageJsonNoImports, scope.packageDirectory);\n return notFound;\n }\n const context: TargetContext = {\n extensions: lookup.extensions,\n moduleName: lookup.moduleName,\n scope,\n isImports: true,\n };\n return loadModuleFromImportsOrExports(\n { lookupTable: asLookupTable(imports), context },\n state,\n ).pipe(Option.orElse(() => reportMissingImport(context, state)));\n};\n\nconst reportMissingScope = (directoryPath: string, state: ResolutionState): SearchResult => {\n traceMessage(state, Messages.directoryHasNoPackageScope, directoryPath);\n return notFound;\n};\n\nexport const resolvePackageImportWithTrace: {\n (state: ResolutionState): (lookup: ModuleLookup) => SearchResult;\n (lookup: ModuleLookup, state: ResolutionState): SearchResult;\n} = Fn.dual(DATA_FIRST_ARITY, (lookup: ModuleLookup, state: ResolutionState): SearchResult => {\n const { moduleName } = lookup;\n if (moduleName === \"#\" || Str.startsWith(\"#/\")(moduleName)) {\n traceMessage(state, Messages.invalidImportSpecifier, moduleName);\n return notFound;\n }\n const directoryPath = getNormalizedAbsolutePath(lookup.directory, \"/\");\n return getPackageScopeForPath(directoryPath, state).pipe(\n Option.match({\n onNone: () => reportMissingScope(directoryPath, state),\n onSome: (scope) => resolveImportsWithTrace(lookup, scope, state),\n }),\n );\n});\n\nconst selfNameSubpath = (moduleName: string, packageName: string): Option.Option<string> => {\n const parts = getPathComponents(moduleName);\n const nameParts = getPathComponents(packageName);\n if (\n !pipe(\n nameParts,\n Arr.every((part, index) => parts[index] === part),\n )\n ) {\n return Option.none();\n }\n const trailing = parts.slice(nameParts.length);\n if (Arr.isReadonlyArrayNonEmpty(trailing)) {\n return Option.some(`./${pipe(trailing, Arr.join(\"/\"))}`);\n }\n return Option.some(\".\");\n};\n\nconst loadFromOwnExports = (\n scope: PackageJsonInfo,\n { extensions, subpath }: ExportsRequest,\n state: ResolutionState,\n): SearchResult =>\n loadModuleFromExports(\n scope,\n { extensions: intersectExtensions(extensions, PRIORITY_KINDS), subpath },\n state,\n ).pipe(\n Option.orElse(() =>\n loadModuleFromExports(\n scope,\n { extensions: subtractExtensions(extensions, PRIORITY_KINDS), subpath },\n state,\n ),\n ),\n );\n\nexport const loadModuleFromSelfNameReference: {\n (state: ResolutionState): (lookup: ModuleLookup) => SearchResult;\n (lookup: ModuleLookup, state: ResolutionState): SearchResult;\n} = Fn.dual(DATA_FIRST_ARITY, (lookup: ModuleLookup, state: ResolutionState): SearchResult =>\n getPackageScopeForPath(getNormalizedAbsolutePath(lookup.directory, \"/\"), state).pipe(\n Option.filter((scope) => Predicate.isTruthy(scope.contents.packageJsonContent[\"exports\"])),\n Option.flatMap((scope) =>\n Option.liftPredicate(scope.contents.packageJsonContent[\"name\"], Predicate.isString).pipe(\n Option.flatMap((name) => selfNameSubpath(lookup.moduleName, name)),\n Option.flatMap((subpath) =>\n loadFromOwnExports(scope, { extensions: lookup.extensions, subpath }, state),\n ),\n ),\n ),\n ),\n);\n","import {\n Array as Arr,\n Option,\n Predicate,\n Record as Rec,\n pipe,\n String as Str,\n Function as Fn,\n} from \"effect\";\n\nimport { tryGetExtensionFromPath } from \"./extensions.ts\";\nimport type { Extensions } from \"./extensions.ts\";\nimport { Messages, traceMessage } from \"./messages.ts\";\nimport { combinePaths, getDirectoryPath, normalizePath } from \"./paths.ts\";\nimport type { CandidateRequest, PathAndExtension, ResolutionState } from \"./resolution-types.ts\";\nimport { tryFile } from \"./resolver-files.ts\";\n\nconst DATA_FIRST_ARITY = 2;\n\nexport type Loader<Found = PathAndExtension> = (\n request: CandidateRequest,\n state: ResolutionState,\n) => Option.Option<Found>;\n\nexport interface PathsRequest<Found> {\n readonly extensions: Extensions;\n readonly moduleName: string;\n readonly baseDirectory: string;\n readonly paths: Readonly<Record<string, unknown>>;\n readonly loader: Loader<Found>;\n readonly onlyRecordFailures: boolean;\n readonly fromFile: (file: PathAndExtension) => Found;\n}\n\ninterface Pattern {\n readonly prefix: string;\n readonly suffix: string;\n}\n\ntype PatternOrExact =\n | { readonly kind: \"exact\"; readonly text: string }\n | { readonly kind: \"pattern\"; readonly pattern: Pattern };\n\nconst STAR_LENGTH = 1;\nconst START = 0;\n\nconst patternAt = (key: string, star: number): Option.Option<PatternOrExact> =>\n Option.liftPredicate(key, (text) => !Str.includes(\"*\", star + STAR_LENGTH)(text)).pipe(\n Option.map((text) => ({\n kind: \"pattern\",\n pattern: {\n prefix: Str.slice(START, star)(text),\n suffix: Str.slice(star + STAR_LENGTH)(text),\n },\n })),\n );\n\nconst tryParsePattern = (key: string): Option.Option<PatternOrExact> =>\n Option.match(Str.indexOf(\"*\")(key), {\n onNone: () => Option.some({ kind: \"exact\", text: key }),\n onSome: (star) => patternAt(key, star),\n });\n\nconst isPatternMatch = ({ prefix, suffix }: Pattern, candidate: string): boolean =>\n candidate.length >= prefix.length + suffix.length &&\n Str.startsWith(prefix)(candidate) &&\n Str.endsWith(suffix)(candidate);\n\nconst bestPattern = (patterns: readonly Pattern[], candidate: string): Option.Option<Pattern> =>\n Arr.reduce(patterns, Option.none<Pattern>(), (best, pattern) =>\n Option.liftPredicate(\n pattern,\n (current) =>\n isPatternMatch(current, candidate) &&\n Option.match(best, {\n onNone: () => true,\n onSome: (previous) => current.prefix.length > previous.prefix.length,\n }),\n ).pipe(Option.orElse(() => best)),\n );\n\nconst patternOf = (entry: PatternOrExact): Option.Option<Pattern> => {\n if (entry.kind === \"pattern\") {\n return Option.some(entry.pattern);\n }\n return Option.none();\n};\n\ninterface MatchedPattern {\n readonly text: string;\n readonly star: string;\n}\n\nconst matchedBy =\n (candidate: string) =>\n (pattern: Pattern): MatchedPattern => ({\n text: `${pattern.prefix}*${pattern.suffix}`,\n star: Str.slice(pattern.prefix.length, candidate.length - pattern.suffix.length)(candidate),\n });\n\nconst patternMatch = (\n entries: readonly PatternOrExact[],\n candidate: string,\n): Option.Option<MatchedPattern> => {\n const patterns = pipe(\n entries,\n Arr.map((entry) => patternOf(entry)),\n Arr.getSomes,\n );\n return Option.map(bestPattern(patterns, candidate), matchedBy(candidate));\n};\n\nconst matchPatternOrExact = (\n entries: readonly PatternOrExact[],\n candidate: string,\n): Option.Option<MatchedPattern> =>\n pipe(\n entries,\n Arr.findFirst((entry) => entry.kind === \"exact\" && entry.text === candidate),\n Option.map((): MatchedPattern => ({ text: candidate, star: \"\" })),\n Option.orElse(() => patternMatch(entries, candidate)),\n );\n\nconst substitutionsOf = (\n paths: Readonly<Record<string, unknown>>,\n key: string,\n): readonly string[] =>\n Option.fromNullishOr(paths[key]).pipe(\n Option.filter((value) => Arr.isArray(value)),\n Option.map((values: readonly unknown[]) =>\n pipe(\n values,\n Arr.filter((value): value is string => Predicate.isString(value)),\n ),\n ),\n Option.getOrElse((): readonly string[] => []),\n );\n\ninterface Substitution {\n readonly text: string;\n readonly matched: MatchedPattern;\n}\n\nconst trySubstitution = <Found>(\n { text, matched }: Substitution,\n context: PathsRequest<Found>,\n state: ResolutionState,\n): Option.Option<Found> => {\n const path = Option.liftPredicate(matched.star, (star) => star.length > START).pipe(\n Option.match({ onNone: () => text, onSome: (star) => Str.replace(\"*\", star)(text) }),\n );\n const candidate = normalizePath(combinePaths(context.baseDirectory, path));\n traceMessage(state, Messages.tryingSubstitution, text, path);\n return tryGetExtensionFromPath(text).pipe(\n Option.flatMap((extension) =>\n tryFile(candidate, context.onlyRecordFailures, state).pipe(\n Option.map((found) =>\n context.fromFile({ path: found, extension, resolvedUsingTsExtension: false }),\n ),\n ),\n ),\n Option.orElse(() =>\n context.loader(\n {\n extensions: context.extensions,\n candidate,\n onlyRecordFailures:\n context.onlyRecordFailures || !state.host.directoryExists(getDirectoryPath(candidate)),\n },\n state,\n ),\n ),\n );\n};\n\nexport const tryLoadModuleUsingPaths: {\n (\n state: ResolutionState,\n ): <Found>(context: PathsRequest<Found>) => Option.Option<Option.Option<Found>>;\n <Found>(\n context: PathsRequest<Found>,\n state: ResolutionState,\n ): Option.Option<Option.Option<Found>>;\n} = Fn.dual(\n DATA_FIRST_ARITY,\n <Found>(\n context: PathsRequest<Found>,\n state: ResolutionState,\n ): Option.Option<Option.Option<Found>> => {\n const entries = Arr.getSomes(\n pipe(\n Rec.keys(context.paths),\n Arr.map((key) => tryParsePattern(key)),\n ),\n );\n return matchPatternOrExact(entries, context.moduleName).pipe(\n Option.map((matched) => {\n traceMessage(state, Messages.matchedPattern, context.moduleName, matched.text);\n return pipe(\n substitutionsOf(context.paths, matched.text),\n Arr.findFirst((text) => trySubstitution({ text, matched }, context, state)),\n );\n }),\n );\n },\n);\n","import { Option, Function as Fn } from \"effect\";\n\nimport { extensionsOf } from \"./extensions.ts\";\nimport type { Extensions } from \"./extensions.ts\";\nimport { Messages, traceMessage } from \"./messages.ts\";\nimport { readPackageJsonMainField, readPackageJsonTypesFields } from \"./package-json-fields.ts\";\nimport { resolvePackageJsonInfo, withPackageId } from \"./package-json.ts\";\nimport { tryLoadModuleUsingPaths } from \"./paths-mapping.ts\";\nimport type { Loader } from \"./paths-mapping.ts\";\nimport {\n combinePaths,\n containsPath,\n getDirectoryPath,\n getRelativePathFromDirectory,\n} from \"./paths.ts\";\nimport type {\n CandidateRequest,\n PackageJsonContent,\n PackageJsonInfo,\n PathAndExtension,\n Resolved,\n ResolutionState,\n VersionPaths,\n} from \"./resolution-types.ts\";\nimport { loadFileNameFromPackageJsonField, loadModuleFromFile } from \"./resolver-files.ts\";\nimport { RESOLUTION_VERSION, getVersionPaths } from \"./types-versions.ts\";\n\nconst DATA_FIRST_ARITY = 2;\n\nexport interface RelativeRequest extends CandidateRequest {\n readonly considerPackageJson: boolean;\n}\n\nexport type RelativeLoader = (\n request: RelativeRequest,\n state: ResolutionState,\n) => Option.Option<Resolved>;\n\nexport interface PackageDirectoryContents {\n readonly jsonContent: Option.Option<PackageJsonContent>;\n readonly versionPaths: Option.Option<VersionPaths>;\n}\n\nexport interface DirectoryLoadRequest extends RelativeRequest {\n readonly loadRelative: RelativeLoader;\n}\n\nexport interface DirectoryWorkerRequest extends CandidateRequest, PackageDirectoryContents {\n readonly loadRelative: RelativeLoader;\n}\n\ninterface PackageEntry {\n readonly packageFile: Option.Option<string>;\n readonly loader: Loader;\n readonly onlyRecordFailuresForPackageFile: boolean;\n readonly onlyRecordFailuresForIndex: boolean;\n}\n\nconst DECLARATION_ONLY_SIZE = 1;\nconst INDEX = \"index\";\n\nconst expandDeclarationOnly = (extensions: Extensions): Extensions => {\n if (extensions.length === DECLARATION_ONLY_SIZE && extensions.includes(\"Declaration\")) {\n return extensionsOf(\"TypeScript\", \"Declaration\");\n }\n return extensions;\n};\n\nconst packageFieldState = (\n state: ResolutionState,\n jsonContent: Option.Option<PackageJsonContent>,\n): ResolutionState => ({\n ...state,\n candidateIsFromPackageJsonField: true,\n features: {\n ...state.features,\n esmMode:\n state.features.esmMode &&\n Option.exists(jsonContent, (content) => content[\"type\"] === \"module\"),\n },\n});\n\nconst packageFieldLoader =\n (jsonContent: Option.Option<PackageJsonContent>, loadRelative: RelativeLoader): Loader =>\n (request, state) =>\n loadFileNameFromPackageJsonField(request, state).pipe(\n Option.orElse(() =>\n loadRelative(\n {\n ...request,\n extensions: expandDeclarationOnly(request.extensions),\n considerPackageJson: false,\n },\n packageFieldState(state, jsonContent),\n ).pipe(\n Option.map(({ path, extension, resolvedUsingTsExtension }): PathAndExtension => ({\n path,\n extension,\n resolvedUsingTsExtension,\n })),\n ),\n ),\n );\n\nconst readPackageFile = (\n request: CandidateRequest,\n jsonContent: Option.Option<PackageJsonContent>,\n state: ResolutionState,\n): Option.Option<string> =>\n jsonContent.pipe(\n Option.flatMap((content) =>\n Option.liftPredicate(request.extensions, (value) => value.includes(\"Declaration\")).pipe(\n Option.flatMap(() => readPackageJsonTypesFields(content, request.candidate, state)),\n Option.orElse(() => readPackageJsonMainField(content, request.candidate, state)),\n ),\n ),\n );\n\nconst tryVersionPaths = (\n context: Readonly<{\n extensions: Extensions;\n candidate: string;\n packageFile: Option.Option<string>;\n versionPaths: VersionPaths;\n loader: Loader;\n onlyRecordFailures: boolean;\n }>,\n state: ResolutionState,\n): Option.Option<Option.Option<PathAndExtension>> => {\n const moduleName = getRelativePathFromDirectory(\n context.candidate,\n Option.getOrElse(context.packageFile, () => combinePaths(context.candidate, INDEX)),\n );\n traceMessage(\n state,\n Messages.packageJsonTypesVersionsMatch,\n context.versionPaths.version,\n RESOLUTION_VERSION,\n moduleName,\n );\n return tryLoadModuleUsingPaths(\n {\n extensions: context.extensions,\n moduleName,\n baseDirectory: context.candidate,\n paths: context.versionPaths.paths,\n loader: context.loader,\n onlyRecordFailures: context.onlyRecordFailures,\n fromFile: (file) => file,\n },\n state,\n );\n};\n\nconst packageEntryOf = (request: DirectoryWorkerRequest, state: ResolutionState): PackageEntry => {\n const packageFile = readPackageFile(request, request.jsonContent, state);\n return {\n packageFile,\n loader: packageFieldLoader(request.jsonContent, request.loadRelative),\n onlyRecordFailuresForPackageFile: Option.exists(\n packageFile,\n (file) => !state.host.directoryExists(getDirectoryPath(file)),\n ),\n onlyRecordFailuresForIndex:\n request.onlyRecordFailures || !state.host.directoryExists(request.candidate),\n };\n};\n\nconst fromVersionPaths = (\n request: DirectoryWorkerRequest,\n entry: PackageEntry,\n state: ResolutionState,\n): Option.Option<Option.Option<PathAndExtension>> =>\n request.versionPaths.pipe(\n Option.filter(() =>\n Option.match(entry.packageFile, {\n onNone: () => true,\n onSome: (file) => containsPath(request.candidate, file),\n }),\n ),\n Option.flatMap((paths) =>\n tryVersionPaths(\n {\n extensions: request.extensions,\n candidate: request.candidate,\n packageFile: entry.packageFile,\n versionPaths: paths,\n loader: entry.loader,\n onlyRecordFailures:\n entry.onlyRecordFailuresForPackageFile || entry.onlyRecordFailuresForIndex,\n },\n state,\n ),\n ),\n );\n\nconst fromIndexFile = (\n request: DirectoryWorkerRequest,\n entry: PackageEntry,\n state: ResolutionState,\n): Option.Option<PathAndExtension> => {\n if (state.features.esmMode) {\n return Option.none();\n }\n return loadModuleFromFile(\n {\n extensions: request.extensions,\n candidate: combinePaths(request.candidate, INDEX),\n onlyRecordFailures: entry.onlyRecordFailuresForIndex,\n },\n state,\n );\n};\n\nconst fromPackageFileOrIndex = (\n request: DirectoryWorkerRequest,\n entry: PackageEntry,\n state: ResolutionState,\n): Option.Option<PathAndExtension> =>\n entry.packageFile.pipe(\n Option.flatMap((file) =>\n entry.loader(\n {\n extensions: request.extensions,\n candidate: file,\n onlyRecordFailures: entry.onlyRecordFailuresForPackageFile,\n },\n state,\n ),\n ),\n Option.orElse(() => fromIndexFile(request, entry, state)),\n );\n\nexport const loadNodeModuleFromDirectoryWorker: {\n (state: ResolutionState): (request: DirectoryWorkerRequest) => Option.Option<PathAndExtension>;\n (request: DirectoryWorkerRequest, state: ResolutionState): Option.Option<PathAndExtension>;\n} = Fn.dual(\n DATA_FIRST_ARITY,\n (request: DirectoryWorkerRequest, state: ResolutionState): Option.Option<PathAndExtension> => {\n const entry = packageEntryOf(request, state);\n return fromVersionPaths(request, entry, state).pipe(\n Option.getOrElse(() => fromPackageFileOrIndex(request, entry, state)),\n );\n },\n);\n\nexport const loadNodeModuleFromDirectory: {\n (state: ResolutionState): (request: DirectoryLoadRequest) => Option.Option<Resolved>;\n (request: DirectoryLoadRequest, state: ResolutionState): Option.Option<Resolved>;\n} = Fn.dual(\n DATA_FIRST_ARITY,\n (request: DirectoryLoadRequest, state: ResolutionState): Option.Option<Resolved> => {\n const info = Option.liftPredicate(request.considerPackageJson, (consider) => consider).pipe(\n Option.flatMap(() =>\n resolvePackageJsonInfo(request.candidate, request.onlyRecordFailures, state),\n ),\n );\n const versionPaths = info.pipe(\n Option.flatMap((packageInfo) => getVersionPaths(packageInfo, state)),\n );\n const jsonContent = info.pipe(\n Option.map((packageInfo: PackageJsonInfo) => packageInfo.contents.packageJsonContent),\n );\n const found = loadNodeModuleFromDirectoryWorker(\n { ...request, jsonContent, versionPaths },\n state,\n );\n return withPackageId(info, found, state);\n },\n);\n","import { Option, String as Str } from \"effect\";\n\nimport { normalizePath } from \"./paths.ts\";\nimport { indexFrom } from \"./text-search.ts\";\n\nconst START = 0;\nconst SEPARATOR_STEP = 1;\nconst NODE_MODULES_PART = \"/node_modules/\";\n\nconst nextSeparator = (path: string, previous: number): number =>\n Option.getOrElse(indexFrom(path, \"/\", previous + SEPARATOR_STEP), () => previous);\n\nconst packageDirectoryEnd = (path: string, nodeModulesIndex: number): number => {\n const afterNodeModules = nodeModulesIndex + NODE_MODULES_PART.length;\n const afterName = nextSeparator(path, afterNodeModules);\n if (path[afterNodeModules] === \"@\") {\n return nextSeparator(path, afterName);\n }\n return afterName;\n};\n\nexport const parseNodeModuleFromPath = (resolved: string): Option.Option<string> => {\n const path = normalizePath(resolved);\n return Option.map(Str.lastIndexOf(NODE_MODULES_PART)(path), (index) =>\n Str.slice(START, packageDirectoryEnd(path, index))(path),\n );\n};\n\nexport const pathContainsNodeModules = (path: string): boolean =>\n Str.includes(NODE_MODULES_PART)(path);\n","import { MutableRef, Option, Array as Arr, pipe, Function as Fn } from \"effect\";\n\nimport type { Extensions } from \"./extensions.ts\";\nimport {\n combinePaths,\n ensureTrailingDirectorySeparator,\n getPathComponents,\n normalizePath,\n} from \"./paths.ts\";\nimport type {\n Features,\n ModuleResolutionCache,\n NestedResolution,\n Outcome,\n ResolutionMode,\n ResolutionResult,\n ResolutionState,\n ResolverHost,\n ResolverOptions,\n TraceSink,\n} from \"./resolution-types.ts\";\n\nconst DATA_FIRST_ARITY = 2;\nconst DATA_FIRST_ARITY_3 = 3;\n\nexport interface WorkerRequest {\n readonly features: Features;\n readonly moduleName: string;\n readonly containingDirectory: string;\n readonly options: ResolverOptions;\n readonly extensions: Extensions;\n readonly conditions: Option.Option<readonly string[]>;\n}\n\nexport interface WorkerContext {\n readonly host: ResolverHost;\n readonly trace: Option.Option<TraceSink>;\n readonly cache: Option.Option<ModuleResolutionCache>;\n}\n\ntype OptionalCondition = readonly [string, (options: ResolverOptions) => boolean];\n\nconst LAST = -1;\n\nexport const NO_FEATURES: Features = {\n imports: false,\n selfName: false,\n exports: false,\n patternTrailers: false,\n esmMode: false,\n};\n\nexport const ALL_FEATURES: Features = {\n imports: true,\n selfName: true,\n exports: true,\n patternTrailers: true,\n esmMode: false,\n};\n\nconst OPTIONAL_CONDITIONS: readonly OptionalCondition[] = [\n [\"types\", (options) => !options.noDtsResolution],\n [\"node\", (options) => options.moduleResolution !== \"Bundler\"],\n];\n\nexport const createOutcome = (): Outcome => {\n const packageDirectory = MutableRef.make(false);\n const cached = MutableRef.make(Option.none<ResolutionResult>());\n return {\n markResolvedPackageDirectory: () => {\n MutableRef.set(packageDirectory, true);\n },\n resolvedPackageDirectory: () => MutableRef.get(packageDirectory),\n rememberResultFromCache: (result) => {\n MutableRef.set(cached, Option.some(result));\n },\n resultFromCache: () => MutableRef.get(cached),\n };\n};\n\nconst moduleCondition = (esm: boolean): string => {\n if (esm) {\n return \"import\";\n }\n return \"require\";\n};\n\nconst isUnconditional = (options: ResolverOptions, mode: Option.Option<ResolutionMode>): boolean =>\n Option.isNone(mode) && options.moduleResolution === \"Node10\";\n\nconst usesImportCondition = (\n options: ResolverOptions,\n mode: Option.Option<ResolutionMode>,\n): boolean =>\n mode.pipe(\n Option.map((kind) => kind === \"ESNext\"),\n Option.getOrElse(() => options.moduleResolution === \"Bundler\"),\n );\n\nexport const getConditions: {\n (mode: Option.Option<ResolutionMode>): (options: ResolverOptions) => readonly string[];\n (options: ResolverOptions, mode: Option.Option<ResolutionMode>): readonly string[];\n} = Fn.dual(\n DATA_FIRST_ARITY,\n (options: ResolverOptions, mode: Option.Option<ResolutionMode>): readonly string[] => {\n if (isUnconditional(options, mode)) {\n return [];\n }\n const optional = pipe(\n OPTIONAL_CONDITIONS,\n Arr.filter(([, applies]) => applies(options)),\n Arr.map(([name]) => name),\n );\n return [moduleCondition(usesImportCondition(options, mode)), ...optional];\n },\n);\n\nexport const normalizePathForCJSResolution: {\n (\n moduleName: string,\n ): (containingDirectory: string) => { readonly path: string; readonly parts: readonly string[] };\n (\n containingDirectory: string,\n moduleName: string,\n ): { readonly path: string; readonly parts: readonly string[] };\n} = Fn.dual(\n DATA_FIRST_ARITY,\n (\n containingDirectory: string,\n moduleName: string,\n ): { readonly path: string; readonly parts: readonly string[] } => {\n const combined = combinePaths(containingDirectory, moduleName);\n const parts = getPathComponents(combined);\n const last = parts.at(LAST) ?? \"\";\n const normalized = normalizePath(combined);\n if (last === \".\" || last === \"..\") {\n return { path: ensureTrailingDirectorySeparator(normalized), parts };\n }\n return { path: normalized, parts };\n },\n);\n\nexport const workerMode = (request: WorkerRequest): Option.Option<ResolutionMode> => {\n if (request.options.moduleResolution !== \"Node16\") {\n return Option.none();\n }\n if (request.features.esmMode) {\n return Option.some(\"ESNext\");\n }\n return Option.some(\"CommonJS\");\n};\n\nexport const nestedRequest: {\n (nested: NestedResolution): (state: ResolutionState) => WorkerRequest;\n (state: ResolutionState, nested: NestedResolution): WorkerRequest;\n} = Fn.dual(\n DATA_FIRST_ARITY,\n (state: ResolutionState, nested: NestedResolution): WorkerRequest => ({\n features: state.features,\n moduleName: nested.moduleName,\n containingDirectory: nested.containingDirectory,\n options: state.options,\n extensions: nested.extensions,\n conditions: Option.some(state.conditions),\n }),\n);\n\nexport const nestedContext = (state: ResolutionState): WorkerContext => ({\n host: state.host,\n trace: state.trace,\n cache: state.cache,\n});\n\nexport const createState: {\n (\n context: WorkerContext,\n conditions: readonly string[],\n ): (request: WorkerRequest) => Omit<ResolutionState, \"resolveNested\">;\n (\n request: WorkerRequest,\n context: WorkerContext,\n conditions: readonly string[],\n ): Omit<ResolutionState, \"resolveNested\">;\n} = Fn.dual(\n DATA_FIRST_ARITY_3,\n (\n request: WorkerRequest,\n context: WorkerContext,\n conditions: readonly string[],\n ): Omit<ResolutionState, \"resolveNested\"> => ({\n host: context.host,\n trace: context.trace,\n options: request.options,\n cache: context.cache,\n packageJsonCache: context.cache.pipe(Option.map((cache) => cache.packageJson)),\n features: request.features,\n conditions,\n candidateIsFromPackageJsonField: false,\n outcome: createOutcome(),\n }),\n);\n","import { Option, Function as Fn } from \"effect\";\n\nimport { formatExtensions } from \"./extensions.ts\";\nimport { Messages, traceMessage } from \"./messages.ts\";\nimport { parseNodeModuleFromPath } from \"./node-modules-paths.ts\";\nimport { resolvePackageJsonInfo, withPackageId } from \"./package-json.ts\";\nimport { getDirectoryPath, hasTrailingDirectorySeparator } from \"./paths.ts\";\nimport type {\n ModuleLookup,\n PackageJsonInfo,\n PathAndExtension,\n Resolved,\n ResolutionState,\n} from \"./resolution-types.ts\";\nimport { loadNodeModuleFromDirectory } from \"./resolver-directory.ts\";\nimport type { RelativeRequest } from \"./resolver-directory.ts\";\nimport { loadModuleFromFile } from \"./resolver-files.ts\";\nimport { normalizePathForCJSResolution } from \"./resolver-state.ts\";\n\nconst DATA_FIRST_ARITY = 2;\n\nexport interface RelativeModule {\n readonly resolved: Option.Option<Resolved>;\n readonly insideNodeModules: boolean;\n}\n\ninterface FileAttempt {\n readonly found: Option.Option<Resolved>;\n readonly onlyRecordFailures: boolean;\n}\n\nexport const directoryMissing: {\n (state: ResolutionState): (directory: string) => boolean;\n (directory: string, state: ResolutionState): boolean;\n} = Fn.dual(DATA_FIRST_ARITY, (directory: string, state: ResolutionState): boolean => {\n if (state.host.directoryExists(directory)) {\n return false;\n }\n traceMessage(state, Messages.directoryDoesNotExist, directory);\n return true;\n});\n\nconst packageInfoOfFile = (\n request: RelativeRequest,\n resolved: PathAndExtension,\n state: ResolutionState,\n): Option.Option<PackageJsonInfo> =>\n Option.liftPredicate(request.considerPackageJson, (consider) => consider).pipe(\n Option.flatMap(() => parseNodeModuleFromPath(resolved.path)),\n Option.flatMap((packageDirectory) => resolvePackageJsonInfo(packageDirectory, false, state)),\n );\n\nconst loadAsFile = (request: RelativeRequest, state: ResolutionState): Option.Option<Resolved> =>\n loadModuleFromFile(request, state).pipe(\n Option.flatMap((resolved) =>\n withPackageId(packageInfoOfFile(request, resolved, state), Option.some(resolved), state),\n ),\n );\n\nconst fileAttempt = (request: RelativeRequest, state: ResolutionState): FileAttempt => {\n if (hasTrailingDirectorySeparator(request.candidate)) {\n return { found: Option.none(), onlyRecordFailures: request.onlyRecordFailures };\n }\n const onlyRecordFailures =\n request.onlyRecordFailures || directoryMissing(getDirectoryPath(request.candidate), state);\n return { found: loadAsFile({ ...request, onlyRecordFailures }, state), onlyRecordFailures };\n};\n\nexport const nodeLoadModuleByRelativeName: {\n (state: ResolutionState): (request: RelativeRequest) => Option.Option<Resolved>;\n (request: RelativeRequest, state: ResolutionState): Option.Option<Resolved>;\n} = Fn.dual(\n DATA_FIRST_ARITY,\n (request: RelativeRequest, state: ResolutionState): Option.Option<Resolved> => {\n traceMessage(\n state,\n Messages.loadingAsFileOrFolder,\n request.candidate,\n formatExtensions(request.extensions),\n );\n const attempt = fileAttempt(request, state);\n if (Option.isSome(attempt.found)) {\n return attempt.found;\n }\n const onlyRecordFailures =\n attempt.onlyRecordFailures || directoryMissing(request.candidate, state);\n if (state.features.esmMode) {\n return Option.none();\n }\n return loadNodeModuleFromDirectory(\n { ...request, onlyRecordFailures, loadRelative: nodeLoadModuleByRelativeName },\n state,\n );\n },\n);\n\nexport const loadRelativeModule: {\n (state: ResolutionState): (lookup: ModuleLookup) => RelativeModule;\n (lookup: ModuleLookup, state: ResolutionState): RelativeModule;\n} = Fn.dual(DATA_FIRST_ARITY, (lookup: ModuleLookup, state: ResolutionState): RelativeModule => {\n const { path, parts } = normalizePathForCJSResolution(lookup.directory, lookup.moduleName);\n const resolved = nodeLoadModuleByRelativeName(\n {\n extensions: lookup.extensions,\n candidate: path,\n onlyRecordFailures: false,\n considerPackageJson: true,\n },\n state,\n );\n return { resolved, insideNodeModules: parts.includes(\"node_modules\") };\n});\n","import { Option, Predicate, Function as Fn } from \"effect\";\n\nimport { Messages, traceMessage } from \"./messages.ts\";\nimport { withPackageId } from \"./package-json.ts\";\nimport { tryLoadModuleUsingPaths } from \"./paths-mapping.ts\";\nimport type { Loader } from \"./paths-mapping.ts\";\nimport { combinePaths } from \"./paths.ts\";\nimport type {\n CandidateRequest,\n PackageJsonInfo,\n PathAndExtension,\n Resolved,\n ResolutionState,\n} from \"./resolution-types.ts\";\nimport { loadNodeModuleFromDirectoryWorker } from \"./resolver-directory.ts\";\nimport { loadModuleFromFile } from \"./resolver-files.ts\";\nimport { nodeLoadModuleByRelativeName } from \"./resolver-relative.ts\";\nimport { RESOLUTION_VERSION, getVersionPaths } from \"./types-versions.ts\";\n\nconst DATA_FIRST_ARITY = 2;\nconst DATA_FIRST_ARITY_3 = 3;\n\nexport interface SpecificRequest {\n readonly extensions: CandidateRequest[\"extensions\"];\n readonly moduleName: string;\n readonly nodeModulesDirectory: string;\n readonly nodeModulesDirectoryExists: boolean;\n}\n\nexport interface PackagePaths {\n readonly candidate: string;\n readonly rest: string;\n readonly packageDirectory: string;\n}\n\nexport interface PackageLocation extends PackagePaths {\n readonly packageInfo: Option.Option<PackageJsonInfo>;\n}\n\nconst EMPTY = 0;\n\nexport const loadFromDirectory: {\n (\n packageInfo: Option.Option<PackageJsonInfo>,\n state: ResolutionState,\n ): (request: CandidateRequest) => Option.Option<PathAndExtension>;\n (\n request: CandidateRequest,\n packageInfo: Option.Option<PackageJsonInfo>,\n state: ResolutionState,\n ): Option.Option<PathAndExtension>;\n} = Fn.dual(\n DATA_FIRST_ARITY_3,\n (\n request: CandidateRequest,\n packageInfo: Option.Option<PackageJsonInfo>,\n state: ResolutionState,\n ): Option.Option<PathAndExtension> =>\n loadNodeModuleFromDirectoryWorker(\n {\n ...request,\n jsonContent: packageInfo.pipe(Option.map((info) => info.contents.packageJsonContent)),\n versionPaths: packageInfo.pipe(Option.flatMap((info) => getVersionPaths(info, state))),\n loadRelative: nodeLoadModuleByRelativeName,\n },\n state,\n ),\n);\n\nconst loadEsmIndexFallback = (\n request: CandidateRequest,\n packageInfo: Option.Option<PackageJsonInfo>,\n state: ResolutionState,\n): Option.Option<PathAndExtension> =>\n packageInfo.pipe(\n Option.filter(\n (info) =>\n state.features.esmMode && Predicate.isNullish(info.contents.packageJsonContent[\"exports\"]),\n ),\n Option.flatMap(() =>\n loadModuleFromFile(\n { ...request, candidate: combinePaths(request.candidate, \"index.js\") },\n state,\n ),\n ),\n );\n\nconst loadFileFirst = (\n request: CandidateRequest,\n rest: string,\n state: ResolutionState,\n): Option.Option<PathAndExtension> => {\n if (rest.length > EMPTY || !state.features.esmMode) {\n return loadModuleFromFile(request, state);\n }\n return Option.none();\n};\n\nexport const specificLoader: {\n (rest: string): (packageInfo: Option.Option<PackageJsonInfo>) => Loader<Resolved>;\n (packageInfo: Option.Option<PackageJsonInfo>, rest: string): Loader<Resolved>;\n} = Fn.dual(\n DATA_FIRST_ARITY,\n (packageInfo: Option.Option<PackageJsonInfo>, rest: string): Loader<Resolved> =>\n (request, state) => {\n const pathAndExtension = loadFileFirst(request, rest, state).pipe(\n Option.orElse(() => loadFromDirectory(request, packageInfo, state)),\n Option.orElse(() => loadEsmIndexFallback(request, packageInfo, state)),\n );\n return withPackageId(packageInfo, pathAndExtension, state);\n },\n);\n\nconst withoutPackageMetadata = (file: PathAndExtension): Resolved => ({\n ...file,\n packageId: Option.none(),\n originalPath: Option.none(),\n});\n\nexport const resolveVersionPathsWithTrace: {\n (\n location: PackageLocation,\n state: ResolutionState,\n ): (request: SpecificRequest) => Option.Option<Option.Option<Resolved>>;\n (\n request: SpecificRequest,\n location: PackageLocation,\n state: ResolutionState,\n ): Option.Option<Option.Option<Resolved>>;\n} = Fn.dual(\n DATA_FIRST_ARITY_3,\n (\n request: SpecificRequest,\n location: PackageLocation,\n state: ResolutionState,\n ): Option.Option<Option.Option<Resolved>> =>\n Option.liftPredicate(location.rest, (rest) => rest.length > EMPTY).pipe(\n Option.flatMap(() =>\n location.packageInfo.pipe(Option.flatMap((info) => getVersionPaths(info, state))),\n ),\n Option.flatMap((versionPaths) => {\n traceMessage(\n state,\n Messages.packageJsonTypesVersionsMatch,\n versionPaths.version,\n RESOLUTION_VERSION,\n location.rest,\n );\n const packageDirectoryExists =\n request.nodeModulesDirectoryExists &&\n state.host.directoryExists(location.packageDirectory);\n return tryLoadModuleUsingPaths(\n {\n extensions: request.extensions,\n moduleName: location.rest,\n baseDirectory: location.packageDirectory,\n paths: versionPaths.paths,\n loader: specificLoader(location.packageInfo, location.rest),\n onlyRecordFailures: !packageDirectoryExists,\n fromFile: withoutPackageMetadata,\n },\n state,\n );\n }),\n ),\n);\n","import { Option, Predicate, Record as Rec, Function as Fn } from \"effect\";\n\nimport { resolvePackageJsonInfo, withPackageId } from \"./package-json.ts\";\nimport { combinePaths } from \"./paths.ts\";\nimport type {\n CandidateRequest,\n PackageJsonInfo,\n Resolved,\n ResolutionState,\n} from \"./resolution-types.ts\";\nimport { loadModuleFromExports } from \"./resolver-exports.ts\";\nimport { loadModuleFromFile } from \"./resolver-files.ts\";\nimport {\n loadFromDirectory,\n resolveVersionPathsWithTrace,\n specificLoader,\n} from \"./resolver-package-loader.ts\";\nimport type { PackageLocation, PackagePaths, SpecificRequest } from \"./resolver-package-loader.ts\";\n\nconst DATA_FIRST_ARITY_3 = 3;\n\nconst loadSubpathWithoutExports = (\n request: SpecificRequest,\n location: PackagePaths & { readonly packageInfo: PackageJsonInfo },\n state: ResolutionState,\n): Option.Option<Resolved> => {\n const candidateRequest: CandidateRequest = {\n extensions: request.extensions,\n candidate: location.candidate,\n onlyRecordFailures: !request.nodeModulesDirectoryExists,\n };\n const fromFile = loadModuleFromFile(candidateRequest, state);\n if (Option.isSome(fromFile)) {\n return withPackageId(Option.none(), fromFile, state);\n }\n const packageInfo = Option.some(location.packageInfo);\n const fromDirectory = loadFromDirectory(candidateRequest, packageInfo, state);\n return withPackageId(packageInfo, fromDirectory, state);\n};\n\nconst rootHasExports = (rootInfo: Option.Option<PackageJsonInfo>): boolean =>\n Option.exists(rootInfo, (info) => Rec.has(info.contents.packageJsonContent, \"exports\"));\n\nexport const resolveInPackage: {\n (\n location: PackageLocation,\n state: ResolutionState,\n ): (request: SpecificRequest) => Option.Option<Resolved>;\n (\n request: SpecificRequest,\n location: PackageLocation,\n state: ResolutionState,\n ): Option.Option<Resolved>;\n} = Fn.dual(\n DATA_FIRST_ARITY_3,\n (\n request: SpecificRequest,\n location: PackageLocation,\n state: ResolutionState,\n ): Option.Option<Resolved> => {\n if (Option.isSome(location.packageInfo)) {\n state.outcome.markResolvedPackageDirectory();\n }\n const exportsInfo = location.packageInfo.pipe(\n Option.filter(\n (info) =>\n state.features.exports && Predicate.isTruthy(info.contents.packageJsonContent[\"exports\"]),\n ),\n );\n if (Option.isSome(exportsInfo)) {\n const subpath = combinePaths(\".\", location.rest);\n return loadModuleFromExports(\n exportsInfo.value,\n { extensions: request.extensions, subpath },\n state,\n ).pipe(Option.flatten);\n }\n return resolveVersionPathsWithTrace(request, location, state).pipe(\n Option.getOrElse(() =>\n specificLoader(location.packageInfo, location.rest)(\n {\n extensions: request.extensions,\n candidate: location.candidate,\n onlyRecordFailures: !request.nodeModulesDirectoryExists,\n },\n state,\n ),\n ),\n );\n },\n);\n\nconst loadSubpathOfNestedPackage = (\n request: SpecificRequest,\n location: PackagePaths & { readonly packageInfo: PackageJsonInfo },\n state: ResolutionState,\n): Option.Option<Resolved> => {\n if (!state.features.exports) {\n return loadSubpathWithoutExports(request, location, state);\n }\n const missing = !request.nodeModulesDirectoryExists;\n const rootInfo = resolvePackageJsonInfo(location.packageDirectory, missing, state);\n if (!rootHasExports(rootInfo)) {\n return loadSubpathWithoutExports(request, location, state);\n }\n return resolveInPackage(request, { ...location, packageInfo: rootInfo }, state);\n};\n\nexport const loadSubpath: {\n (\n location: PackageLocation,\n state: ResolutionState,\n ): (request: SpecificRequest) => Option.Option<Resolved>;\n (\n request: SpecificRequest,\n location: PackageLocation,\n state: ResolutionState,\n ): Option.Option<Resolved>;\n} = Fn.dual(\n DATA_FIRST_ARITY_3,\n (\n request: SpecificRequest,\n location: PackageLocation,\n state: ResolutionState,\n ): Option.Option<Resolved> => {\n if (Option.isSome(location.packageInfo)) {\n return loadSubpathOfNestedPackage(\n request,\n { ...location, packageInfo: location.packageInfo.value },\n state,\n );\n }\n const missing = !request.nodeModulesDirectoryExists;\n const packageInfo = resolvePackageJsonInfo(location.packageDirectory, missing, state);\n return resolveInPackage(request, { ...location, packageInfo }, state);\n },\n);\n","import { Option, Array as Arr, pipe, Function as Fn } from \"effect\";\n\nimport {\n PRIORITY_KINDS,\n extensionsOf,\n formatExtensions,\n intersectExtensions,\n subtractExtensions,\n} from \"./extensions.ts\";\nimport { Messages, traceMessage } from \"./messages.ts\";\nimport { resolvePackageJsonInfo } from \"./package-json.ts\";\nimport { mangleScopedPackageNameWithTrace, parsePackageName } from \"./package-names.ts\";\nimport {\n combinePaths,\n forEachAncestorDirectory,\n getBaseFileName,\n normalizePath,\n normalizeSlashes,\n} from \"./paths.ts\";\nimport type {\n ModuleLookup,\n ResolutionMode,\n ResolutionState,\n Resolved,\n SearchResult,\n} from \"./resolution-types.ts\";\nimport type { PackageLocation, SpecificRequest } from \"./resolver-package-loader.ts\";\nimport { loadSubpath, resolveInPackage } from \"./resolver-package.ts\";\nimport { directoryMissing } from \"./resolver-relative.ts\";\n\nconst DATA_FIRST_ARITY = 2;\n\nexport interface NodeModulesSearch extends ModuleLookup {\n readonly typesScopeOnly: boolean;\n}\n\ninterface NodeModulesFolder {\n readonly moduleName: string;\n readonly path: string;\n readonly exists: boolean;\n}\n\nconst EMPTY = 0;\n\nconst FEATURE_NAMES: readonly (keyof ResolutionState[\"features\"])[] = [\n \"imports\",\n \"selfName\",\n \"exports\",\n \"patternTrailers\",\n \"esmMode\",\n];\n\nconst hasNoFeatures = ({ features }: ResolutionState): boolean =>\n !pipe(\n FEATURE_NAMES,\n Arr.some((name) => features[name]),\n );\n\nconst cacheModeOf = (state: ResolutionState): Option.Option<ResolutionMode> => {\n if (hasNoFeatures(state)) {\n return Option.none();\n }\n if (state.features.esmMode) {\n return Option.some(\"ESNext\");\n }\n return Option.some(\"CommonJS\");\n};\n\nconst reuseCachedResolution = (lookup: ModuleLookup, state: ResolutionState): SearchResult =>\n state.cache.pipe(\n Option.flatMap((cache) =>\n cache.getFromNonRelative({\n name: lookup.moduleName,\n mode: cacheModeOf(state),\n directory: lookup.directory,\n }),\n ),\n Option.map((result) => {\n traceMessage(state, Messages.resolutionFoundInCache, lookup.moduleName, lookup.directory);\n state.outcome.rememberResultFromCache(result);\n return result.resolvedModule.pipe(\n Option.map((module): Resolved => ({\n path: module.resolvedFileName,\n extension: module.extension,\n packageId: module.packageId,\n originalPath: module.originalPath,\n resolvedUsingTsExtension: module.resolvedUsingTsExtension,\n })),\n );\n }),\n );\n\nconst loadModuleFromSpecificNodeModulesDirectory = (\n request: SpecificRequest,\n state: ResolutionState,\n): Option.Option<Resolved> => {\n const candidate = normalizePath(combinePaths(request.nodeModulesDirectory, request.moduleName));\n const { packageName, rest } = parsePackageName(request.moduleName);\n const location: PackageLocation = {\n candidate,\n rest,\n packageDirectory: combinePaths(request.nodeModulesDirectory, packageName),\n packageInfo: resolvePackageJsonInfo(candidate, !request.nodeModulesDirectoryExists, state),\n };\n if (rest.length === EMPTY) {\n return resolveInPackage(request, location, state);\n }\n return loadSubpath(request, location, state);\n};\n\nconst loadFromTypesDirectory = (\n folder: NodeModulesFolder,\n state: ResolutionState,\n): Option.Option<Resolved> => {\n const atTypes = combinePaths(folder.path, \"@types\");\n const atTypesExists = folder.exists && !directoryMissing(atTypes, state);\n return loadModuleFromSpecificNodeModulesDirectory(\n {\n extensions: extensionsOf(\"Declaration\"),\n moduleName: mangleScopedPackageNameWithTrace(folder.moduleName, state),\n nodeModulesDirectory: atTypes,\n nodeModulesDirectoryExists: atTypesExists,\n },\n state,\n );\n};\n\nconst loadFromPackageFolder = (\n search: NodeModulesSearch,\n folder: NodeModulesFolder,\n state: ResolutionState,\n): Option.Option<Resolved> => {\n if (search.typesScopeOnly) {\n return Option.none();\n }\n return loadModuleFromSpecificNodeModulesDirectory(\n {\n extensions: search.extensions,\n moduleName: search.moduleName,\n nodeModulesDirectory: folder.path,\n nodeModulesDirectoryExists: folder.exists,\n },\n state,\n );\n};\n\nconst loadModuleFromImmediateNodeModulesDirectory = (\n search: NodeModulesSearch,\n state: ResolutionState,\n): Option.Option<Resolved> => {\n const path = combinePaths(search.directory, \"node_modules\");\n const folder: NodeModulesFolder = {\n moduleName: search.moduleName,\n path,\n exists: !directoryMissing(path, state),\n };\n return loadFromPackageFolder(search, folder, state).pipe(\n Option.orElse(() =>\n Option.liftPredicate(search.extensions, (extensions) =>\n extensions.includes(\"Declaration\"),\n ).pipe(Option.flatMap(() => loadFromTypesDirectory(folder, state))),\n ),\n );\n};\n\nconst lookupAncestors = (search: NodeModulesSearch, state: ResolutionState): SearchResult =>\n forEachAncestorDirectory(normalizeSlashes(search.directory), (ancestor): SearchResult => {\n if (getBaseFileName(ancestor) === \"node_modules\") {\n return Option.none();\n }\n const atAncestor = { ...search, directory: ancestor };\n return reuseCachedResolution(atAncestor, state).pipe(\n Option.orElse(() =>\n loadModuleFromImmediateNodeModulesDirectory(atAncestor, state).pipe(\n Option.map((resolved) => Option.some(resolved)),\n ),\n ),\n );\n });\n\nconst resolvePreferredWithTrace = (\n search: NodeModulesSearch,\n state: ResolutionState,\n): SearchResult => {\n const preferred = intersectExtensions(search.extensions, PRIORITY_KINDS);\n if (preferred.length === EMPTY) {\n return Option.none();\n }\n traceMessage(state, Messages.searchingPreferredExtensions, formatExtensions(preferred));\n return lookupAncestors({ ...search, extensions: preferred }, state);\n};\n\nconst resolveFallbackWithTrace = (\n search: NodeModulesSearch,\n state: ResolutionState,\n): SearchResult => {\n const fallback = subtractExtensions(search.extensions, PRIORITY_KINDS);\n if (fallback.length === EMPTY || search.typesScopeOnly) {\n return Option.none();\n }\n traceMessage(state, Messages.searchingFallbackExtensions, formatExtensions(fallback));\n return lookupAncestors({ ...search, extensions: fallback }, state);\n};\n\nexport const loadModuleFromNearestNodeModulesDirectory: {\n (state: ResolutionState): (search: NodeModulesSearch) => SearchResult;\n (search: NodeModulesSearch, state: ResolutionState): SearchResult;\n} = Fn.dual(DATA_FIRST_ARITY, (search: NodeModulesSearch, state: ResolutionState): SearchResult =>\n resolvePreferredWithTrace(search, state).pipe(\n Option.orElse(() => resolveFallbackWithTrace(search, state)),\n ),\n);\n","import { Option, String as Str, Function as Fn } from \"effect\";\n\nimport {\n PRIORITY_KINDS,\n extensionIsOk,\n formatExtensions,\n intersectExtensions,\n subtractExtensions,\n} from \"./extensions.ts\";\nimport type { Extensions } from \"./extensions.ts\";\nimport { Messages, traceMessage } from \"./messages.ts\";\nimport { isExternalModuleNameRelative } from \"./paths.ts\";\nimport type {\n Features,\n ModuleLookup,\n Resolved,\n ResolutionState,\n ResolverOptions,\n SearchResult,\n} from \"./resolution-types.ts\";\nimport {\n loadModuleFromSelfNameReference,\n resolvePackageImportWithTrace,\n} from \"./resolver-exports.ts\";\nimport { loadModuleFromNearestNodeModulesDirectory } from \"./resolver-node-modules.ts\";\nimport { loadRelativeModule } from \"./resolver-relative.ts\";\nimport { ALL_FEATURES, createOutcome, getConditions } from \"./resolver-state.ts\";\nimport type { WorkerRequest } from \"./resolver-state.ts\";\n\nconst DATA_FIRST_ARITY = 2;\nconst DATA_FIRST_ARITY_3 = 3;\n\nexport interface Found {\n readonly resolved: Resolved;\n readonly isExternalLibraryImport: boolean;\n}\n\nexport type FoundResult = Option.Option<Option.Option<Found>>;\n\nconst EMPTY = 0;\n\nconst resolveFromNodeModulesWithTrace = (\n lookup: ModuleLookup,\n state: ResolutionState,\n): SearchResult => {\n const extensions = formatExtensions(lookup.extensions);\n if (Str.includes(\":\")(lookup.moduleName)) {\n traceMessage(state, Messages.skippingAbsoluteUri, lookup.moduleName, extensions);\n return Option.none();\n }\n traceMessage(state, Messages.loadingFromNodeModules, lookup.moduleName, extensions);\n return loadModuleFromNearestNodeModulesDirectory({ ...lookup, typesScopeOnly: false }, state);\n};\n\nconst fromPackageImports = (\n lookup: ModuleLookup,\n features: Features,\n state: ResolutionState,\n): SearchResult => {\n if (features.imports && Str.startsWith(\"#\")(lookup.moduleName)) {\n return resolvePackageImportWithTrace(lookup, state);\n }\n return Option.none();\n};\n\nconst fromSelfName = (\n lookup: ModuleLookup,\n features: Features,\n state: ResolutionState,\n): SearchResult => {\n if (features.selfName) {\n return loadModuleFromSelfNameReference(lookup, state);\n }\n return Option.none();\n};\n\nconst resolveNonRelative = (\n lookup: ModuleLookup,\n features: Features,\n state: ResolutionState,\n): FoundResult =>\n fromPackageImports(lookup, features, state).pipe(\n Option.orElse(() => fromSelfName(lookup, features, state)),\n Option.orElse(() => resolveFromNodeModulesWithTrace(lookup, state)),\n Option.map(Option.map((resolved): Found => ({ resolved, isExternalLibraryImport: true }))),\n );\n\nconst resolveRelative = (lookup: ModuleLookup, state: ResolutionState): Option.Option<Found> => {\n const { resolved, insideNodeModules } = loadRelativeModule(lookup, state);\n return resolved.pipe(\n Option.map((value) => ({ resolved: value, isExternalLibraryImport: insideNodeModules })),\n );\n};\n\nconst tryResolve = (\n extensions: Extensions,\n request: WorkerRequest,\n state: ResolutionState,\n): FoundResult => {\n const lookup: ModuleLookup = {\n extensions,\n moduleName: request.moduleName,\n directory: request.containingDirectory,\n };\n if (!isExternalModuleNameRelative(request.moduleName)) {\n return resolveNonRelative(lookup, request.features, state);\n }\n return resolveRelative(lookup, state).pipe(Option.map((found) => Option.some(found)));\n};\n\nconst tryNonEmpty = (\n extensions: Extensions,\n request: WorkerRequest,\n state: ResolutionState,\n): FoundResult => {\n if (extensions.length === EMPTY) {\n return Option.none();\n }\n return tryResolve(extensions, request, state);\n};\n\nexport const resolveWithPriority: {\n (state: ResolutionState): (request: WorkerRequest) => FoundResult;\n (request: WorkerRequest, state: ResolutionState): FoundResult;\n} = Fn.dual(DATA_FIRST_ARITY, (request: WorkerRequest, state: ResolutionState): FoundResult => {\n if (request.options.moduleResolution !== \"Node10\") {\n return tryResolve(request.extensions, request, state);\n }\n return tryNonEmpty(intersectExtensions(request.extensions, PRIORITY_KINDS), request, state).pipe(\n Option.orElse(() =>\n tryNonEmpty(subtractExtensions(request.extensions, PRIORITY_KINDS), request, state),\n ),\n );\n});\n\nconst diagnosticPath = (request: WorkerRequest, state: ResolutionState): Option.Option<string> =>\n tryResolve(intersectExtensions(request.extensions, PRIORITY_KINDS), request, state).pipe(\n Option.flatten,\n Option.filter((found) => found.isExternalLibraryImport),\n Option.map((found) => found.resolved.path),\n );\n\nconst wantedTypesButGotJs = (request: WorkerRequest, result: Option.Option<Found>): boolean => {\n const wantsTypes =\n request.extensions.includes(\"TypeScript\") || request.extensions.includes(\"Declaration\");\n return Option.exists(\n result,\n (found) => wantsTypes && !extensionIsOk(PRIORITY_KINDS, found.resolved.extension),\n );\n};\n\nconst shouldRetryWithoutExports = (\n request: WorkerRequest,\n result: Option.Option<Found>,\n state: ResolutionState,\n): boolean =>\n Option.exists(result, (found) => found.isExternalLibraryImport) &&\n wantedTypesButGotJs(request, result) &&\n request.features.exports &&\n state.conditions.includes(\"import\");\n\nconst shouldRetryWithBundler = (request: WorkerRequest, result: Option.Option<Found>): boolean =>\n (Option.isNone(result) || wantedTypesButGotJs(request, result)) &&\n request.options.moduleResolution === \"Node10\";\n\nconst retryWithBundler = (\n request: WorkerRequest,\n state: ResolutionState,\n): Option.Option<string> => {\n traceMessage(state, Messages.retryWithBundler);\n const options: ResolverOptions = { ...request.options, moduleResolution: \"Bundler\" };\n return diagnosticPath(request, {\n ...state,\n options,\n features: ALL_FEATURES,\n conditions: getConditions(options, Option.none()),\n outcome: createOutcome(),\n });\n};\n\nexport const resolveAlternateResultWithTrace: {\n (\n result: Option.Option<Found>,\n state: ResolutionState,\n ): (request: WorkerRequest) => Option.Option<string>;\n (\n request: WorkerRequest,\n result: Option.Option<Found>,\n state: ResolutionState,\n ): Option.Option<string>;\n} = Fn.dual(\n DATA_FIRST_ARITY_3,\n (\n request: WorkerRequest,\n result: Option.Option<Found>,\n state: ResolutionState,\n ): Option.Option<string> => {\n if (shouldRetryWithoutExports(request, result, state)) {\n traceMessage(state, Messages.retryWithoutModernFeatures);\n return diagnosticPath(request, {\n ...state,\n features: { ...state.features, exports: false },\n outcome: createOutcome(),\n });\n }\n if (shouldRetryWithBundler(request, result)) {\n return retryWithBundler(request, state);\n }\n return Option.none();\n },\n);\n","import { Option, Array as Arr, pipe, Function as Fn } from \"effect\";\n\nimport { extensionsOf } from \"./extensions.ts\";\nimport type { Extensions } from \"./extensions.ts\";\nimport { Messages, emitTrace, formatMessage, traceMessage } from \"./messages.ts\";\nimport { packageIdToString } from \"./package-json.ts\";\nimport { getDirectoryPath, isExternalModuleNameRelative } from \"./paths.ts\";\nimport type {\n Features,\n NestedResolution,\n ResolutionMode,\n ResolutionResult,\n ResolutionState,\n ResolvedModule,\n ResolverOptions,\n TraceSink,\n} from \"./resolution-types.ts\";\nimport { resolveAlternateResultWithTrace, resolveWithPriority } from \"./resolver-attempt.ts\";\nimport type { Found } from \"./resolver-attempt.ts\";\nimport {\n ALL_FEATURES,\n NO_FEATURES,\n createState,\n getConditions,\n nestedContext,\n nestedRequest,\n workerMode,\n} from \"./resolver-state.ts\";\nimport type { WorkerContext, WorkerRequest } from \"./resolver-state.ts\";\n\nconst DATA_FIRST_ARITY = 2;\n\nexport interface ResolveModuleNameRequest {\n readonly moduleName: string;\n readonly containingFile: string;\n readonly options: ResolverOptions;\n readonly mode: Option.Option<ResolutionMode>;\n}\n\nexport interface DirectoryRequest {\n readonly moduleName: string;\n readonly containingDirectory: string;\n readonly options: ResolverOptions;\n readonly mode: Option.Option<ResolutionMode>;\n}\n\nconst supportsExportsAndImports = (request: WorkerRequest): boolean =>\n request.options.moduleResolution !== \"Node10\";\n\nconst modeLabel = (features: Features): string => {\n if (features.esmMode) {\n return \"ESM\";\n }\n return \"CJS\";\n};\n\nconst announceMode = (request: WorkerRequest, state: ResolutionState): void => {\n if (!supportsExportsAndImports(request)) {\n return;\n }\n traceMessage(\n state,\n Messages.resolvingInMode,\n modeLabel(request.features),\n pipe(\n state.conditions,\n Arr.map((condition) => `'${condition}'`),\n Arr.join(\", \"),\n ),\n );\n};\n\nconst toResolutionResult = (\n found: Option.Option<Found>,\n alternateResult: Option.Option<string>,\n): ResolutionResult => ({\n resolvedModule: found.pipe(\n Option.map(({ resolved, isExternalLibraryImport }): ResolvedModule => ({\n resolvedFileName: resolved.path,\n originalPath: resolved.originalPath,\n extension: resolved.extension,\n isExternalLibraryImport,\n packageId: resolved.packageId,\n resolvedUsingTsExtension: resolved.resolvedUsingTsExtension,\n })),\n ),\n alternateResult,\n});\n\nconst alternateResultOf = (\n request: WorkerRequest,\n result: Option.Option<Found>,\n state: ResolutionState,\n): Option.Option<string> => {\n if (\n !state.outcome.resolvedPackageDirectory() ||\n isExternalModuleNameRelative(request.moduleName)\n ) {\n return Option.none();\n }\n return resolveAlternateResultWithTrace(request, result, state);\n};\n\nconst nodeModuleNameResolverWorker = (\n request: WorkerRequest,\n context: WorkerContext,\n): ResolutionResult => {\n const conditions = request.conditions.pipe(\n Option.getOrElse(() => getConditions(request.options, workerMode(request))),\n );\n const state: ResolutionState = {\n ...createState(request, context, conditions),\n resolveNested: (current, nested) =>\n nodeModuleNameResolverWorker(nestedRequest(current, nested), nestedContext(current)),\n };\n announceMode(request, state);\n const result = Option.flatten(resolveWithPriority(request, state));\n const alternateResult = alternateResultOf(request, result, state);\n return state.outcome\n .resultFromCache()\n .pipe(Option.getOrElse(() => toResolutionResult(result, alternateResult)));\n};\n\nexport const resolveNestedModule: {\n (nested: NestedResolution): (state: ResolutionState) => ResolutionResult;\n (state: ResolutionState, nested: NestedResolution): ResolutionResult;\n} = Fn.dual(\n DATA_FIRST_ARITY,\n (state: ResolutionState, nested: NestedResolution): ResolutionResult =>\n nodeModuleNameResolverWorker(nestedRequest(state, nested), nestedContext(state)),\n);\n\nconst extensionsFor = (options: ResolverOptions): Extensions => {\n if (options.noDtsResolution) {\n return extensionsOf(\"TypeScript\", \"JavaScript\", \"Json\");\n }\n return extensionsOf(\"TypeScript\", \"JavaScript\", \"Declaration\", \"Json\");\n};\n\nconst featuresFor = (request: DirectoryRequest): Features => {\n if (request.options.moduleResolution === \"Node16\") {\n return { ...ALL_FEATURES, esmMode: Option.contains(request.mode, \"ESNext\") };\n }\n if (request.options.moduleResolution === \"Bundler\" || Option.isSome(request.mode)) {\n return ALL_FEATURES;\n }\n return NO_FEATURES;\n};\n\nconst conditionsFor = (request: DirectoryRequest): Option.Option<readonly string[]> => {\n if (request.options.moduleResolution === \"Node16\") {\n return Option.none();\n }\n return request.mode.pipe(Option.map((mode) => getConditions(request.options, Option.some(mode))));\n};\n\nexport const resolveInDirectory: {\n (context: WorkerContext): (request: DirectoryRequest) => ResolutionResult;\n (request: DirectoryRequest, context: WorkerContext): ResolutionResult;\n} = Fn.dual(\n DATA_FIRST_ARITY,\n (request: DirectoryRequest, context: WorkerContext): ResolutionResult =>\n nodeModuleNameResolverWorker(\n {\n features: featuresFor(request),\n moduleName: request.moduleName,\n containingDirectory: request.containingDirectory,\n options: request.options,\n extensions: extensionsFor(request.options),\n conditions: conditionsFor(request),\n },\n context,\n ),\n);\n\nconst resolveUncached = (\n request: ResolveModuleNameRequest,\n context: WorkerContext,\n): ResolutionResult => {\n const containingDirectory = getDirectoryPath(request.containingFile);\n traceMessage(context, Messages.explicitResolutionKind, request.options.moduleResolution);\n const result = resolveInDirectory({ ...request, containingDirectory }, context);\n const key = { name: request.moduleName, mode: request.mode, directory: containingDirectory };\n for (const cache of Option.toArray(context.cache)) {\n cache.setForDirectory(key, result);\n if (!isExternalModuleNameRelative(request.moduleName)) {\n cache.setForNonRelative(key, result);\n }\n }\n return result;\n};\n\nconst resolvedMessage = (moduleName: string, module: ResolvedModule): string =>\n module.packageId.pipe(\n Option.match({\n onNone: () => formatMessage(Messages.moduleResolved, moduleName, module.resolvedFileName),\n onSome: (packageId) =>\n formatMessage(\n Messages.moduleResolvedWithPackageId,\n moduleName,\n module.resolvedFileName,\n packageIdToString(packageId),\n ),\n }),\n );\n\nconst traceOutcome = (\n moduleName: string,\n result: ResolutionResult,\n trace: Option.Option<TraceSink>,\n): void => {\n const message = result.resolvedModule.pipe(\n Option.match({\n onNone: () => formatMessage(Messages.moduleNotResolved, moduleName),\n onSome: (module) => resolvedMessage(moduleName, module),\n }),\n );\n emitTrace(trace, message);\n};\n\nconst reuseCachedWithTrace = (\n request: ResolveModuleNameRequest,\n context: WorkerContext,\n): Option.Option<ResolutionResult> => {\n const directory = getDirectoryPath(request.containingFile);\n return context.cache.pipe(\n Option.flatMap((cache) =>\n cache.getFromDirectory({ name: request.moduleName, mode: request.mode, directory }),\n ),\n Option.map((cached) => {\n traceMessage(context, Messages.resolutionFoundInCache, request.moduleName, directory);\n return cached;\n }),\n );\n};\n\nexport const resolveModuleName: {\n (context: WorkerContext): (request: ResolveModuleNameRequest) => ResolutionResult;\n (request: ResolveModuleNameRequest, context: WorkerContext): ResolutionResult;\n} = Fn.dual(\n DATA_FIRST_ARITY,\n (request: ResolveModuleNameRequest, context: WorkerContext): ResolutionResult => {\n traceMessage(context, Messages.resolvingModule, request.moduleName, request.containingFile);\n const result = reuseCachedWithTrace(request, context).pipe(\n Option.getOrElse(() => resolveUncached(request, context)),\n );\n traceOutcome(request.moduleName, result, context.trace);\n return result;\n },\n);\n","import { Option, Array as Arr, String as Str, pipe, Function as Fn } from \"effect\";\n\nimport { bindSourceFile } from \"./binder.ts\";\nimport type { CheckerProgram } from \"./checker-session.ts\";\nimport { createTypeChecker } from \"./checker.ts\";\nimport type { TypeCheckerFacade } from \"./checker.ts\";\nimport type { HostWrapperCore } from \"./host-types.ts\";\nimport { toPath } from \"./paths.ts\";\nimport type { ProgramFile, ProgramOptions } from \"./program-build.ts\";\nimport { modeFromNumber } from \"./resolution-mode-numbers.ts\";\nimport { resolveInDirectory } from \"./resolver.ts\";\n\nconst DATA_FIRST_ARITY_3 = 3;\n\nexport interface CheckerSite {\n readonly core: HostWrapperCore;\n readonly mountRoot: string;\n readonly options: ProgramOptions;\n}\n\nconst checkerOptions = (core: HostWrapperCore): CheckerProgram[\"compilerOptions\"] => ({\n module: core.compilerOptions[\"module\"],\n moduleResolution: core.compilerOptions[\"moduleResolution\"],\n noLib: true,\n allowJs: true,\n resolveJsonModule: true,\n types: [],\n});\n\nconst relativeDirectory = (site: CheckerSite, directory: string): string => {\n const relative = Str.slice(site.mountRoot.length)(directory);\n if (relative === \"\") {\n return \"/\";\n }\n return relative;\n};\n\nconst checkerResolver =\n (site: CheckerSite, isProgramFile: (path: string) => boolean): CheckerProgram[\"resolve\"] =>\n (moduleName, containingDirectory, mode) =>\n Option.liftPredicate(containingDirectory, (directory) =>\n Str.startsWith(site.mountRoot)(directory),\n ).pipe(\n Option.flatMap(\n (directory) =>\n resolveInDirectory(\n {\n moduleName,\n containingDirectory: relativeDirectory(site, directory),\n options: {\n moduleResolution: site.core.kind,\n noDtsResolution: site.options.noDtsResolution,\n },\n mode: modeFromNumber(mode),\n },\n { host: site.core.resolverHost, trace: Option.none(), cache: Option.none() },\n ).resolvedModule,\n ),\n Option.filter((module) => isProgramFile(toPath(module.resolvedFileName))),\n Option.map((module) => ({ resolvedFileName: `${site.mountRoot}${module.resolvedFileName}` })),\n );\n\nexport const openChecker: {\n (\n files: readonly ProgramFile[],\n rootNames: readonly string[],\n ): (site: CheckerSite) => TypeCheckerFacade;\n (\n site: CheckerSite,\n files: readonly ProgramFile[],\n rootNames: readonly string[],\n ): TypeCheckerFacade;\n} = Fn.dual(\n DATA_FIRST_ARITY_3,\n (\n site: CheckerSite,\n files: readonly ProgramFile[],\n rootNames: readonly string[],\n ): TypeCheckerFacade => {\n for (const file of files) {\n bindSourceFile(file.sourceFile);\n }\n const fileNames = pipe(\n files,\n Arr.map((file) => file.fileName),\n );\n const filePaths = new Set(\n pipe(\n fileNames,\n Arr.map((name) => toPath(name)),\n ),\n );\n return createTypeChecker({\n mountPath: site.mountRoot,\n rootNames: [...new Set([...fileNames, ...rootNames])],\n compilerOptions: checkerOptions(site.core),\n resolve: checkerResolver(site, (path) => filePaths.has(path)),\n });\n },\n);\n","import type { Option } from \"effect\";\nimport type { SourceFile } from \"typescript/ast\";\nimport type { RawCompilerOptions } from \"typescript/sync\";\n\nimport type { ModeOptions } from \"./module-mode.ts\";\nimport type { ModuleNameRequest, TypeReferenceLookup } from \"./program-build.ts\";\nimport type {\n PackageJsonInfo,\n ResolutionKind,\n ResolutionResult,\n ResolverHost,\n} from \"./resolution-types.ts\";\nimport type { ResolvedTypeReference } from \"./type-reference.ts\";\n\nexport type ExtraOptions = Readonly<\n Pick<RawCompilerOptions, \"allowJs\" | \"checkJs\" | \"noDtsResolution\">\n>;\n\nexport interface PackageFileSystem {\n readonly fileExists: (path: string) => boolean;\n readonly directoryExists: (path: string) => boolean;\n readonly tryReadFile: (path: string) => string | undefined;\n readonly listFiles: () => readonly string[];\n}\n\nexport interface TsPackageId {\n readonly name: string;\n readonly subModuleName: string;\n readonly version: string;\n readonly peerDependencies: string | undefined;\n}\n\nexport interface TsResolvedModule {\n readonly resolvedFileName: string;\n readonly originalPath: string | undefined;\n readonly extension: string;\n readonly isExternalLibraryImport: boolean;\n readonly packageId: TsPackageId | undefined;\n readonly resolvedUsingTsExtension: boolean;\n}\n\nexport interface TsResolution {\n readonly resolvedModule: TsResolvedModule | undefined;\n}\n\nexport interface CachedResolution {\n readonly result: ResolutionResult;\n readonly resolution: TsResolution;\n readonly trace: readonly string[];\n}\n\nexport type ModuleKindReason = \"extension\" | \"type\" | \"no:type\";\n\nexport interface ModuleKindInfo {\n readonly detectedKind: number;\n readonly detectedReason: ModuleKindReason;\n readonly reasonFileName: string;\n}\n\nexport interface HostWrapperCore {\n readonly kind: ResolutionKind;\n readonly modeOptions: ModeOptions;\n readonly resolverHost: ResolverHost;\n readonly compilerOptions: Readonly<Record<string, number | boolean>>;\n readonly getSourceFile: (fileName: string) => Option.Option<SourceFile>;\n readonly getSourceFileFromCache: (fileName: string) => Option.Option<SourceFile>;\n readonly getModuleKindForFile: (fileName: string) => Option.Option<ModuleKindInfo>;\n readonly resolve: (request: ModuleNameRequest) => CachedResolution;\n readonly getTrace: (request: ModuleNameRequest) => Option.Option<readonly string[]>;\n readonly packageJsonScopeFor: (fileName: string) => Option.Option<PackageJsonInfo>;\n readonly resolveTypeReference: (\n request: TypeReferenceLookup,\n ) => Option.Option<ResolvedTypeReference>;\n}\n\nexport const LIB_FILE_NAME = \"/node_modules/typescript/lib/lib.d.ts\";\n","import { MutableRef, Option, Function as Fn } from \"effect\";\nimport type { SourceFile } from \"typescript/ast\";\n\nimport type { ModeOptions } from \"./module-mode.ts\";\nimport { packageIdToString } from \"./package-json.ts\";\nimport { toPath } from \"./paths.ts\";\nimport type {\n PackageId,\n PackageJsonInfo,\n ResolutionMode,\n ResolutionResult,\n} from \"./resolution-types.ts\";\nimport type { ResolvedTypeReference } from \"./type-reference.ts\";\n\nconst DATA_FIRST_ARITY = 2;\n\nexport interface ProgramOptions {\n readonly allowJs: boolean;\n readonly noDtsResolution: boolean;\n}\n\nexport interface ModuleNameRequest {\n readonly moduleName: string;\n readonly containingFile: string;\n readonly mode: Option.Option<ResolutionMode>;\n readonly noDtsResolution: boolean;\n}\n\nexport interface TypeReferenceLookup {\n readonly name: string;\n readonly containingFile: string;\n readonly mode: Option.Option<ResolutionMode>;\n}\n\nexport interface ProgramHost {\n readonly modeOptions: ModeOptions;\n readonly defaultLibFileName: string;\n readonly getSourceFile: (fileName: string) => Option.Option<SourceFile>;\n readonly resolveModuleName: (request: ModuleNameRequest) => ResolutionResult;\n readonly resolveTypeReference: (\n request: TypeReferenceLookup,\n ) => Option.Option<ResolvedTypeReference>;\n readonly packageJsonScopeFor: (fileName: string) => Option.Option<PackageJsonInfo>;\n}\n\nexport interface ProgramFile {\n readonly fileName: string;\n readonly sourceFile: SourceFile;\n}\n\nexport interface ResolvedModuleEntry {\n readonly moduleName: string;\n readonly mode: Option.Option<ResolutionMode>;\n readonly resolution: ResolutionResult;\n}\n\nexport interface ProgramFiles {\n readonly files: readonly ProgramFile[];\n readonly resolvedModules: ReadonlyMap<string, readonly ResolvedModuleEntry[]>;\n}\n\nexport interface FileRequest {\n readonly fileName: string;\n readonly isDefaultLib: boolean;\n readonly packageId: Option.Option<PackageId>;\n}\n\nexport type FileFlag = \"foundInNodeModules\" | \"elided\";\n\nexport interface FileRegistry {\n readonly lookup: (fileName: string) => Option.Option<Option.Option<SourceFile>>;\n readonly record: (request: FileRequest, file: Option.Option<SourceFile>) => void;\n readonly include: (file: ProgramFile, isDefaultLib: boolean) => void;\n readonly fileForPackage: (packageId: PackageId) => Option.Option<SourceFile>;\n readonly setFlag: (fileName: string, flag: FileFlag, value: boolean) => void;\n readonly hasFlag: (fileName: string, flag: FileFlag) => boolean;\n readonly recordResolutions: (fileName: string, entries: readonly ResolvedModuleEntry[]) => void;\n readonly result: () => ProgramFiles;\n}\n\nexport interface DepthCounter {\n readonly current: () => number;\n readonly enter: (external: boolean) => void;\n readonly leave: (external: boolean) => void;\n}\n\nexport interface ProgramBuild {\n readonly host: ProgramHost;\n readonly options: ProgramOptions;\n readonly registry: FileRegistry;\n readonly depth: DepthCounter;\n}\n\nexport type IncludeSourceFile = (\n build: ProgramBuild,\n request: FileRequest,\n) => Option.Option<SourceFile>;\n\nconst OUTSIDE_NODE_MODULES = 0;\n\nconst createDepthCounter = (): DepthCounter => {\n const depth = MutableRef.make(OUTSIDE_NODE_MODULES);\n return {\n current: () => MutableRef.get(depth),\n enter: (external) => {\n if (external) {\n MutableRef.increment(depth);\n }\n },\n leave: (external) => {\n if (external) {\n MutableRef.decrement(depth);\n }\n },\n };\n};\n\nconst createFlagStore = (): Pick<FileRegistry, \"hasFlag\" | \"setFlag\"> => {\n const flags = new Map<string, Set<FileFlag>>();\n return {\n hasFlag: (fileName, flag) =>\n Option.fromNullishOr(flags.get(toPath(fileName))).pipe(Option.exists((own) => own.has(flag))),\n setFlag: (fileName, flag, value) => {\n const path = toPath(fileName);\n const own = flags.get(path) ?? new Set<FileFlag>();\n flags.set(path, own);\n if (value) {\n own.add(flag);\n return;\n }\n own.delete(flag);\n },\n };\n};\n\nconst createFileRegistry = (): FileRegistry => {\n const filesByName = new Map<string, Option.Option<SourceFile>>();\n const byPackage = new Map<string, SourceFile>();\n const resolvedModules = new Map<string, readonly ResolvedModuleEntry[]>();\n const defaultLibFiles: ProgramFile[] = [];\n const otherFiles: ProgramFile[] = [];\n return {\n ...createFlagStore(),\n lookup: (fileName) => Option.fromNullishOr(filesByName.get(toPath(fileName))),\n record: (request, file) => {\n for (const [id, sourceFile] of Option.toArray(Option.all([request.packageId, file]))) {\n byPackage.set(packageIdToString(id), sourceFile);\n }\n filesByName.set(toPath(request.fileName), file);\n },\n include: (file, isDefaultLib) => {\n if (isDefaultLib) {\n defaultLibFiles.push(file);\n return;\n }\n otherFiles.push(file);\n },\n fileForPackage: (packageId) =>\n Option.fromNullishOr(byPackage.get(packageIdToString(packageId))),\n recordResolutions: (fileName, entries) => {\n resolvedModules.set(toPath(fileName), entries);\n },\n result: () => ({ files: [...defaultLibFiles, ...otherFiles], resolvedModules }),\n };\n};\n\nexport const createProgramBuild: {\n (options: ProgramOptions): (host: ProgramHost) => ProgramBuild;\n (host: ProgramHost, options: ProgramOptions): ProgramBuild;\n} = Fn.dual(DATA_FIRST_ARITY, (host: ProgramHost, options: ProgramOptions): ProgramBuild => ({\n host,\n options,\n registry: createFileRegistry(),\n depth: createDepthCounter(),\n}));\n","import { Option, Array as Arr, String as Str, pipe, Function as Fn } from \"effect\";\nimport type { Node, SourceFile } from \"typescript/ast\";\nimport { isStringLiteralLikeNode } from \"typescript/ast/is\";\n\nimport { getModeForUsageLocation } from \"./module-mode.ts\";\nimport type { IncludeSourceFile, ProgramBuild, ResolvedModuleEntry } from \"./program-build.ts\";\nimport type { ResolvedModule } from \"./resolution-types.ts\";\nimport {\n collectExternalModuleReferences,\n importsOf,\n isJSDocNode,\n isSourceFileJS,\n moduleAugmentationsOf,\n} from \"./source-file.ts\";\n\nconst DATA_FIRST_ARITY_3 = 3;\n\ninterface ModuleNameSite {\n readonly node: Node;\n readonly text: string;\n readonly isImport: boolean;\n}\n\ninterface ImportSite {\n readonly site: ModuleNameSite;\n readonly entry: ResolvedModuleEntry;\n}\n\ninterface ImportWalk {\n readonly build: ProgramBuild;\n readonly include: IncludeSourceFile;\n readonly importer: SourceFile;\n}\n\nconst MAX_NODE_MODULE_JS_DEPTH = 0;\nconst EMPTY = 0;\nconst TS_EXTENSIONS: ReadonlySet<string> = new Set([\n \".ts\",\n \".tsx\",\n \".d.ts\",\n \".cts\",\n \".d.cts\",\n \".mts\",\n \".d.mts\",\n]);\nconst JS_EXTENSIONS: ReadonlySet<string> = new Set([\".js\", \".jsx\", \".mjs\", \".cjs\"]);\nconst JSX_EXTENSIONS: ReadonlySet<string> = new Set([\".tsx\", \".jsx\"]);\n\nconst isTsOrJsonResolution = (extension: string): boolean =>\n TS_EXTENSIONS.has(extension) ||\n extension === \".json\" ||\n (Str.startsWith(\".d.\")(extension) && Str.endsWith(\".ts\")(extension));\n\nconst isKnownExtension = (extension: string): boolean =>\n TS_EXTENSIONS.has(extension) || JS_EXTENSIONS.has(extension) || extension === \".json\";\n\nconst hasResolutionDiagnostic = (module: ResolvedModule, importer: SourceFile): boolean =>\n JSX_EXTENSIONS.has(module.extension) ||\n (!isKnownExtension(module.extension) && !importer.isDeclarationFile);\n\nconst literalSites = (nodes: readonly Node[], isImport: boolean): readonly ModuleNameSite[] =>\n pipe(\n nodes,\n Arr.flatMap((node) => {\n if (isStringLiteralLikeNode(node)) {\n return [{ node, text: node.text, isImport }];\n }\n return [];\n }),\n );\n\nconst moduleNameSitesOf = (sourceFile: SourceFile): readonly ModuleNameSite[] => [\n ...literalSites(importsOf(sourceFile), true),\n ...literalSites(moduleAugmentationsOf(sourceFile), false),\n];\n\nconst resolveSite = (\n build: ProgramBuild,\n importer: SourceFile,\n site: ModuleNameSite,\n): ImportSite => {\n const mode = getModeForUsageLocation(importer, site.node, build.host.modeOptions);\n const resolution = build.host.resolveModuleName({\n moduleName: site.text,\n containingFile: importer.fileName,\n mode,\n noDtsResolution: build.options.noDtsResolution,\n });\n return { site, entry: { moduleName: site.text, mode, resolution } };\n};\n\nconst isAllowedExtension = (walk: ImportWalk, module: ResolvedModule): boolean =>\n isTsOrJsonResolution(module.extension) || walk.build.options.allowJs;\n\nconst isVisibleSite = (walk: ImportWalk, site: ModuleNameSite): boolean =>\n site.isImport && (isSourceFileJS(walk.importer) || !isJSDocNode(site.node));\n\nconst shouldAddFile = (walk: ImportWalk, site: ModuleNameSite, module: ResolvedModule): boolean =>\n !hasResolutionDiagnostic(module, walk.importer) &&\n isAllowedExtension(walk, module) &&\n isVisibleSite(walk, site);\n\nconst isElidedImport = (build: ProgramBuild, module: ResolvedModule): boolean =>\n module.isExternalLibraryImport &&\n !isTsOrJsonResolution(module.extension) &&\n build.depth.current() > MAX_NODE_MODULE_JS_DEPTH;\n\nconst followResolvedModule = (\n walk: ImportWalk,\n site: ModuleNameSite,\n module: ResolvedModule,\n): void => {\n const { build } = walk;\n build.depth.enter(module.isExternalLibraryImport);\n if (isElidedImport(build, module)) {\n build.registry.setFlag(walk.importer.fileName, \"elided\", true);\n } else if (shouldAddFile(walk, site, module)) {\n walk.include(build, {\n fileName: module.resolvedFileName,\n isDefaultLib: false,\n packageId: module.packageId,\n });\n }\n build.depth.leave(module.isExternalLibraryImport);\n};\n\nexport const processImportedModules: {\n (importer: SourceFile, include: IncludeSourceFile): (build: ProgramBuild) => void;\n (build: ProgramBuild, importer: SourceFile, include: IncludeSourceFile): void;\n} = Fn.dual(\n DATA_FIRST_ARITY_3,\n (build: ProgramBuild, importer: SourceFile, include: IncludeSourceFile): void => {\n collectExternalModuleReferences(importer);\n const sites = moduleNameSitesOf(importer);\n if (sites.length === EMPTY) {\n return;\n }\n const resolved = pipe(\n sites,\n Arr.map((site) => resolveSite(build, importer, site)),\n );\n build.registry.recordResolutions(\n importer.fileName,\n pipe(\n resolved,\n Arr.map(({ entry }) => entry),\n ),\n );\n const walk: ImportWalk = { build, include, importer };\n for (const { site, entry } of resolved) {\n for (const module of Option.toArray(entry.resolution.resolvedModule)) {\n followResolvedModule(walk, site, module);\n }\n }\n },\n);\n","import { Array as Arr, Option, String as Str, pipe, Function as Fn } from \"effect\";\nimport type { SourceFile } from \"typescript/ast\";\n\nimport { fileExtensionIsOneOf } from \"./extensions.ts\";\nimport { getDefaultResolutionModeForFile } from \"./module-mode.ts\";\nimport { combinePaths, getBaseFileName, getDirectoryPath, normalizePath } from \"./paths.ts\";\nimport { createProgramBuild } from \"./program-build.ts\";\nimport type {\n FileRequest,\n IncludeSourceFile,\n ProgramBuild,\n ProgramFiles,\n ProgramHost,\n ProgramOptions,\n} from \"./program-build.ts\";\nimport { processImportedModules } from \"./program-imports.ts\";\nimport { modeFromNumber } from \"./resolution-mode-numbers.ts\";\nimport { setPackageJsonScope } from \"./source-file.ts\";\n\nconst DATA_FIRST_ARITY_3 = 3;\n\ninterface ReferenceWalk {\n readonly build: ProgramBuild;\n readonly include: IncludeSourceFile;\n readonly sourceFile: SourceFile;\n readonly isDefaultLib: boolean;\n}\n\nconst TS_EXTENSIONS = [\".ts\", \".tsx\", \".d.ts\", \".cts\", \".d.cts\", \".mts\", \".d.mts\"];\nconst JS_EXTENSIONS = [\".js\", \".jsx\", \".mjs\", \".cjs\"];\nconst IMPLICIT_EXTENSIONS = [\".ts\", \".tsx\", \".d.ts\"];\nconst OUTSIDE_NODE_MODULES = 0;\nconst NO_ROOTS = 0;\nconst MAX_NODE_MODULE_JS_DEPTH = 0;\n\nconst supportedExtensions = (options: ProgramOptions): readonly string[] => {\n if (options.allowJs) {\n return [...TS_EXTENSIONS, ...JS_EXTENSIONS, \".json\"];\n }\n return [...TS_EXTENSIONS, \".json\"];\n};\n\nconst processSourceFile = (\n build: ProgramBuild,\n request: FileRequest,\n include: IncludeSourceFile,\n): void => {\n const { fileName } = request;\n if (Str.includes(\".\")(getBaseFileName(fileName))) {\n if (fileExtensionIsOneOf(Str.toLowerCase(fileName), supportedExtensions(build.options))) {\n include(build, request);\n }\n return;\n }\n pipe(\n IMPLICIT_EXTENSIONS,\n Arr.some((extension) =>\n Option.isSome(include(build, { ...request, fileName: `${fileName}${extension}` })),\n ),\n );\n};\n\nconst processReferencedFiles = (walk: ReferenceWalk): void => {\n const directory = getDirectoryPath(walk.sourceFile.fileName);\n for (const reference of walk.sourceFile.referencedFiles) {\n const fileName = normalizePath(combinePaths(directory, reference.fileName));\n processSourceFile(\n walk.build,\n { fileName, isDefaultLib: walk.isDefaultLib, packageId: Option.none() },\n walk.include,\n );\n }\n};\n\nconst processTypeReferenceDirectives = (walk: ReferenceWalk): void => {\n const { build, sourceFile } = walk;\n const fileMode = getDefaultResolutionModeForFile(sourceFile, build.host.modeOptions);\n for (const reference of sourceFile.typeReferenceDirectives) {\n const mode = modeFromNumber(reference.resolutionMode).pipe(Option.orElse(() => fileMode));\n const lookup = { name: reference.fileName, containingFile: sourceFile.fileName, mode };\n for (const resolved of Option.toArray(build.host.resolveTypeReference(lookup))) {\n build.depth.enter(resolved.isExternalLibraryImport);\n const request = {\n fileName: resolved.resolvedFileName,\n isDefaultLib: false,\n packageId: resolved.packageId,\n };\n processSourceFile(build, request, walk.include);\n build.depth.leave(resolved.isExternalLibraryImport);\n }\n }\n};\n\nconst processLibReferenceDirectives = (walk: ReferenceWalk): void => {\n const libDirectory = getDirectoryPath(walk.build.host.defaultLibFileName);\n for (const reference of walk.sourceFile.libReferenceDirectives) {\n const fileName = combinePaths(libDirectory, `lib.${Str.toLowerCase(reference.fileName)}.d.ts`);\n processSourceFile(\n walk.build,\n { fileName, isDefaultLib: true, packageId: Option.none() },\n walk.include,\n );\n }\n};\n\nconst processReferences = (walk: ReferenceWalk): void => {\n processReferencedFiles(walk);\n processTypeReferenceDirectives(walk);\n processLibReferenceDirectives(walk);\n};\n\nconst resumeImports = (walk: ReferenceWalk): void => {\n walk.build.registry.setFlag(walk.sourceFile.fileName, \"elided\", false);\n processImportedModules(walk.build, walk.sourceFile, walk.include);\n};\n\nconst isReachedFromRoot = (walk: ReferenceWalk): boolean =>\n walk.build.registry.hasFlag(walk.sourceFile.fileName, \"foundInNodeModules\") &&\n walk.build.depth.current() === OUTSIDE_NODE_MODULES;\n\nconst canResumeElided = (walk: ReferenceWalk): boolean =>\n walk.build.registry.hasFlag(walk.sourceFile.fileName, \"elided\") &&\n walk.build.depth.current() < MAX_NODE_MODULE_JS_DEPTH;\n\nconst promoteToRoot = (walk: ReferenceWalk): void => {\n walk.build.registry.setFlag(walk.sourceFile.fileName, \"foundInNodeModules\", false);\n processReferences(walk);\n resumeImports(walk);\n};\n\nconst REVISITS: readonly (readonly [\n (walk: ReferenceWalk) => boolean,\n (walk: ReferenceWalk) => void,\n])[] = [\n [isReachedFromRoot, promoteToRoot],\n [canResumeElided, resumeImports],\n];\n\nconst revisitExisting = (walk: ReferenceWalk): void => {\n const revisit = Arr.findFirst(REVISITS, ([applies]) => applies(walk));\n for (const [, apply] of Option.toArray(revisit)) {\n apply(walk);\n }\n};\n\nconst addNewFile = (walk: ReferenceWalk, fileName: string): void => {\n const { build, sourceFile } = walk;\n const insideNodeModules = build.depth.current() > OUTSIDE_NODE_MODULES;\n build.registry.setFlag(fileName, \"foundInNodeModules\", insideNodeModules);\n setPackageJsonScope(sourceFile, build.host.packageJsonScopeFor(fileName));\n processReferences(walk);\n processImportedModules(build, sourceFile, walk.include);\n build.registry.include({ fileName, sourceFile }, walk.isDefaultLib);\n};\n\nconst recordOrReuseDuplicate = (\n build: ProgramBuild,\n request: FileRequest,\n file: Option.Option<SourceFile>,\n): Option.Option<SourceFile> => {\n const duplicate = request.packageId.pipe(\n Option.flatMap((id) => build.registry.fileForPackage(id)),\n );\n if (Option.isNone(duplicate)) {\n build.registry.record(request, file);\n return duplicate;\n }\n build.registry.record(request, duplicate);\n build.registry.include({ fileName: request.fileName, sourceFile: duplicate.value }, false);\n return duplicate;\n};\n\nconst includeSourceFile: IncludeSourceFile = (build, request) => {\n const walkOf = (sourceFile: SourceFile): ReferenceWalk => ({\n build,\n include: includeSourceFile,\n sourceFile,\n isDefaultLib: request.isDefaultLib,\n });\n const existing = build.registry.lookup(request.fileName);\n if (Option.isSome(existing)) {\n for (const sourceFile of Option.toArray(existing.value)) {\n revisitExisting(walkOf(sourceFile));\n }\n return existing.value;\n }\n const file = build.host.getSourceFile(request.fileName);\n return recordOrReuseDuplicate(build, request, file).pipe(\n Option.orElse(() => {\n for (const sourceFile of Option.toArray(file)) {\n addNewFile(walkOf(sourceFile), request.fileName);\n }\n return file;\n }),\n );\n};\n\nexport const createProgramFiles: {\n (options: ProgramOptions, host: ProgramHost): (rootNames: readonly string[]) => ProgramFiles;\n (rootNames: readonly string[], options: ProgramOptions, host: ProgramHost): ProgramFiles;\n} = Fn.dual(\n DATA_FIRST_ARITY_3,\n (rootNames: readonly string[], options: ProgramOptions, host: ProgramHost): ProgramFiles => {\n const build = createProgramBuild(host, options);\n for (const rootName of rootNames) {\n const request = {\n fileName: normalizePath(rootName),\n isDefaultLib: false,\n packageId: Option.none(),\n };\n processSourceFile(build, request, includeSourceFile);\n }\n if (rootNames.length > NO_ROOTS) {\n const request = {\n fileName: host.defaultLibFileName,\n isDefaultLib: true,\n packageId: Option.none(),\n };\n processSourceFile(build, request, includeSourceFile);\n }\n return build.registry.result();\n },\n);\n","import { MutableRef, Option, Function as Fn } from \"effect\";\n\nimport type { TypeCheckerFacade } from \"./checker.ts\";\nimport { openChecker } from \"./compiler-checker.ts\";\nimport { LIB_FILE_NAME } from \"./host-types.ts\";\nimport type { HostWrapperCore } from \"./host-types.ts\";\nimport type { ProgramFile, ProgramFiles, ProgramOptions } from \"./program-build.ts\";\nimport { createProgramFiles } from \"./program.ts\";\nimport type { MountedFileSystem } from \"./ts-api.ts\";\n\nconst DATA_FIRST_ARITY = 2;\n\nexport interface Program {\n readonly getSourceFiles: () => readonly ProgramFile[];\n readonly getTypeChecker: () => TypeCheckerFacade;\n}\n\nexport interface ProgramSite {\n readonly core: HostWrapperCore;\n readonly mounted: MountedFileSystem;\n readonly options: ProgramOptions;\n}\n\nexport interface CachedProgram {\n readonly program: Program;\n readonly resolvedModules: ProgramFiles[\"resolvedModules\"];\n readonly dispose: () => void;\n}\n\nconst buildProgramFiles = (site: ProgramSite, rootNames: readonly string[]): ProgramFiles =>\n createProgramFiles(rootNames, site.options, {\n modeOptions: site.core.modeOptions,\n defaultLibFileName: LIB_FILE_NAME,\n getSourceFile: site.core.getSourceFile,\n resolveModuleName: (request) => site.core.resolve(request).result,\n resolveTypeReference: site.core.resolveTypeReference,\n packageJsonScopeFor: site.core.packageJsonScopeFor,\n });\n\nexport const createProgram: {\n (rootNames: readonly string[]): (site: ProgramSite) => CachedProgram;\n (site: ProgramSite, rootNames: readonly string[]): CachedProgram;\n} = Fn.dual(DATA_FIRST_ARITY, (site: ProgramSite, rootNames: readonly string[]): CachedProgram => {\n const programFiles = buildProgramFiles(site, rootNames);\n const checkerSite = { core: site.core, mountRoot: site.mounted.root, options: site.options };\n const checker = MutableRef.make(Option.none<TypeCheckerFacade>());\n const openCheckerOnce = (): TypeCheckerFacade =>\n Option.getOrElse(MutableRef.get(checker), () => {\n const created = openChecker(checkerSite, programFiles.files, rootNames);\n MutableRef.set(checker, Option.some(created));\n return created;\n });\n return {\n program: { getSourceFiles: () => programFiles.files, getTypeChecker: openCheckerOnce },\n resolvedModules: programFiles.resolvedModules,\n dispose: () => {\n for (const created of Option.toArray(MutableRef.get(checker))) {\n created.dispose();\n }\n },\n };\n});\n","import { Option, String as Str, Function as Fn } from \"effect\";\n\nimport { createPackageJsonCache } from \"./package-json.ts\";\nimport { getDirectoryPath, toPath } from \"./paths.ts\";\nimport type {\n ModuleResolutionCache,\n ResolutionMode,\n ResolutionResult,\n} from \"./resolution-types.ts\";\nimport { lastIndexUpTo } from \"./text-search.ts\";\n\nconst DATA_FIRST_ARITY = 2;\n\nconst NEXT = 1;\nconst START = 0;\nconst ROOT_LENGTH = 1;\n\nexport const modeKey: {\n (mode: Option.Option<ResolutionMode>): (name: string) => string;\n (name: string, mode: Option.Option<ResolutionMode>): string;\n} = Fn.dual(\n DATA_FIRST_ARITY,\n (name: string, mode: Option.Option<ResolutionMode>): string =>\n `${Option.getOrElse(mode, () => \"\")}|${name}`,\n);\n\nconst resolvedFileNameOf = (result: ResolutionResult): Option.Option<string> =>\n result.resolvedModule.pipe(\n Option.map((module) => Option.getOrElse(module.originalPath, () => module.resolvedFileName)),\n );\n\nconst sharedLength = (left: string, right: string): number => {\n const limit = Math.min(left.length, right.length);\n let index = START;\n while (index < limit && left[index] === right[index]) {\n index += NEXT;\n }\n return index;\n};\n\nconst isWholeDirectoryShared = (\n directory: string,\n resolutionDirectory: string,\n index: number,\n): boolean =>\n index === directory.length &&\n (resolutionDirectory.length === index || resolutionDirectory[index] === \"/\");\n\nconst enclosingDirectory = (directory: string, index: number): Option.Option<string> =>\n lastIndexUpTo(directory, \"/\", index - NEXT).pipe(\n Option.map((separator) => Str.slice(START, Math.max(separator, ROOT_LENGTH))(directory)),\n );\n\nconst getCommonPrefix = (directory: string, resolution: string): Option.Option<string> => {\n const resolutionDirectory = toPath(getDirectoryPath(resolution));\n const index = sharedLength(directory, resolutionDirectory);\n if (isWholeDirectoryShared(directory, resolutionDirectory, index)) {\n return Option.some(directory);\n }\n if (index < ROOT_LENGTH) {\n return Option.none();\n }\n return enclosingDirectory(directory, index);\n};\n\nconst ancestorsToCache = (\n path: string,\n result: ResolutionResult,\n isCached: (directory: string) => boolean,\n): readonly string[] => {\n const commonPrefix = resolvedFileNameOf(result).pipe(\n Option.flatMap((fileName) => getCommonPrefix(path, fileName)),\n );\n const directories = [path];\n let current = path;\n let parent = getDirectoryPath(current);\n while (!Option.contains(commonPrefix, current) && parent !== current && !isCached(parent)) {\n directories.push(parent);\n current = parent;\n parent = getDirectoryPath(current);\n }\n return directories;\n};\n\ninterface ResultTables {\n readonly get: (outer: string, inner: string) => Option.Option<ResolutionResult>;\n readonly tableFor: (outer: string) => Map<string, ResolutionResult>;\n}\n\nconst createResultTables = (): ResultTables => {\n const tables = new Map<string, Map<string, ResolutionResult>>();\n return {\n get: (outer, inner) =>\n Option.fromNullishOr(tables.get(outer)).pipe(\n Option.flatMap((table) => Option.fromNullishOr(table.get(inner))),\n ),\n tableFor: (outer) => {\n const table = tables.get(outer) ?? new Map<string, ResolutionResult>();\n tables.set(outer, table);\n return table;\n },\n };\n};\n\nexport const createModuleResolutionCache = (): ModuleResolutionCache => {\n const perDirectory = createResultTables();\n const nonRelative = createResultTables();\n return {\n packageJson: createPackageJsonCache(),\n getFromDirectory: (key) => perDirectory.get(toPath(key.directory), modeKey(key.name, key.mode)),\n setForDirectory: (key, result) => {\n perDirectory.tableFor(toPath(key.directory)).set(modeKey(key.name, key.mode), result);\n },\n getFromNonRelative: (key) =>\n nonRelative.get(modeKey(key.name, key.mode), toPath(key.directory)),\n setForNonRelative: (key, result) => {\n const table = nonRelative.tableFor(modeKey(key.name, key.mode));\n const path = toPath(key.directory);\n if (table.has(path)) {\n return;\n }\n for (const directory of ancestorsToCache(path, result, (candidate) => table.has(candidate))) {\n table.set(directory, result);\n }\n },\n };\n};\n","import { MutableRef, Option, String as Str } from \"effect\";\n\nimport type { CachedResolution, TsPackageId, TsResolution } from \"./host-types.ts\";\nimport type { ModuleNameRequest } from \"./program-build.ts\";\nimport { createModuleResolutionCache } from \"./resolution-cache.ts\";\nimport { modeToNumber } from \"./resolution-mode-numbers.ts\";\nimport type {\n ModuleResolutionCache,\n PackageId,\n ResolutionKind,\n ResolutionMode,\n ResolutionResult,\n ResolverHost,\n TraceSink,\n} from \"./resolution-types.ts\";\nimport { resolveModuleName } from \"./resolver.ts\";\n\nexport interface ResolutionSource {\n readonly host: ResolverHost;\n readonly kind: ResolutionKind;\n readonly normalCache: ModuleResolutionCache;\n}\n\nexport interface ResolutionStore {\n readonly resolve: (request: ModuleNameRequest) => CachedResolution;\n readonly getTrace: (request: ModuleNameRequest) => Option.Option<readonly string[]>;\n}\n\nconst DEFAULT_MODE = 1;\nconst ALLOW_JS_FLAG = 0;\n\nconst modeNumber = (mode: Option.Option<ResolutionMode>): number =>\n mode.pipe(\n Option.map((value) => modeToNumber(value)),\n Option.getOrElse(() => DEFAULT_MODE),\n );\n\nconst resolutionKey = (request: ModuleNameRequest): string =>\n `${String(modeNumber(request.mode))}:${String(Number(request.noDtsResolution))}:${String(ALLOW_JS_FLAG)}:${request.moduleName}`;\n\nconst toTsPackageId = (packageId: PackageId): TsPackageId => ({\n name: packageId.name,\n subModuleName: packageId.subModuleName,\n version: packageId.version,\n peerDependencies: Option.getOrUndefined(\n Option.liftPredicate(packageId.peerDependencies, Str.isNonEmpty),\n ),\n});\n\nexport const toTsResolution = (result: ResolutionResult): TsResolution => ({\n resolvedModule: result.resolvedModule.pipe(\n Option.map((module) => ({\n resolvedFileName: module.resolvedFileName,\n originalPath: Option.getOrUndefined(module.originalPath),\n extension: module.extension,\n isExternalLibraryImport: module.isExternalLibraryImport,\n packageId: module.packageId.pipe(Option.map(toTsPackageId), Option.getOrUndefined),\n resolvedUsingTsExtension: module.resolvedUsingTsExtension,\n })),\n Option.getOrUndefined,\n ),\n});\n\nconst resolveWithTrace = (\n source: ResolutionSource,\n request: ModuleNameRequest,\n cache: ModuleResolutionCache,\n): CachedResolution => {\n const lines = MutableRef.make<readonly string[]>([]);\n const sink: TraceSink = (message) => {\n MutableRef.update(lines, (current) => [...current, message]);\n };\n const { moduleName, containingFile, mode, noDtsResolution } = request;\n const result = resolveModuleName(\n {\n moduleName,\n containingFile,\n options: { moduleResolution: source.kind, noDtsResolution },\n mode,\n },\n {\n host: source.host,\n trace: Option.some(sink),\n cache: Option.some(cache),\n },\n );\n return { result, resolution: toTsResolution(result), trace: MutableRef.get(lines) };\n};\n\nexport const createResolutionStore = (source: ResolutionSource): ResolutionStore => {\n const noDtsCache = createModuleResolutionCache();\n const byFile = new Map<string, Map<string, CachedResolution>>();\n const tableFor = (containingFile: string): Map<string, CachedResolution> => {\n const table = byFile.get(containingFile) ?? new Map<string, CachedResolution>();\n byFile.set(containingFile, table);\n return table;\n };\n const cacheFor = (request: ModuleNameRequest): ModuleResolutionCache => {\n if (request.noDtsResolution) {\n return noDtsCache;\n }\n return source.normalCache;\n };\n const lookup = (request: ModuleNameRequest): Option.Option<CachedResolution> =>\n Option.fromNullishOr(byFile.get(request.containingFile)).pipe(\n Option.flatMap((table) => Option.fromNullishOr(table.get(resolutionKey(request)))),\n );\n return {\n resolve: (request) =>\n Option.getOrElse(lookup(request), () => {\n const entry = resolveWithTrace(source, request, cacheFor(request));\n tableFor(request.containingFile).set(resolutionKey(request), entry);\n return entry;\n }),\n getTrace: (request) => lookup(request).pipe(Option.map((entry) => entry.trace)),\n };\n};\n","import { Array as Arr, Option, Function as Fn } from \"effect\";\nimport type { SourceFile } from \"typescript/ast\";\n\nimport { createProgram } from \"./compiler-program.ts\";\nimport type { CachedProgram, Program, ProgramSite } from \"./compiler-program.ts\";\nimport { toTsResolution } from \"./host-resolutions.ts\";\nimport type { ExtraOptions, HostWrapperCore, ModuleKindInfo, TsResolution } from \"./host-types.ts\";\nimport { toPath } from \"./paths.ts\";\nimport type { ProgramOptions, ResolvedModuleEntry } from \"./program-build.ts\";\nimport { modeKey } from \"./resolution-cache.ts\";\nimport { modeFromNumber } from \"./resolution-mode-numbers.ts\";\nimport type { ResolutionMode } from \"./resolution-types.ts\";\n\nconst DATA_FIRST_ARITY = 2;\n\nexport interface ModuleNameResolution {\n readonly resolution: TsResolution;\n readonly trace: readonly string[];\n}\n\nexport type ResolveModuleNameArguments = readonly [\n moduleName: string,\n containingFile: string,\n resolutionMode?: number,\n noDtsResolution?: boolean,\n];\n\nexport interface CompilerHostWrapper {\n readonly getCompilerOptions: () => Readonly<Record<string, number | boolean>>;\n readonly getSourceFile: (fileName: string) => SourceFile | undefined;\n readonly getSourceFileFromCache: (fileName: string) => SourceFile | undefined;\n readonly getModuleKindForFile: (fileName: string) => ModuleKindInfo | undefined;\n readonly resolveModuleName: (...args: ResolveModuleNameArguments) => ModuleNameResolution;\n readonly getTrace: (\n fileName: string,\n moduleSpecifier: string,\n resolutionMode: number | undefined,\n ) => readonly string[] | undefined;\n readonly createPrimaryProgram: (rootName: string) => Program;\n readonly createAuxiliaryProgram: (\n rootNames: readonly string[],\n extraOptions?: ExtraOptions,\n ) => Program;\n readonly getResolvedModule: (\n sourceFile: SourceFile,\n moduleName: string,\n resolutionMode: number | undefined,\n ) => TsResolution | undefined;\n}\n\ninterface ResolvedModuleTable {\n readonly record: (fileName: string, entries: readonly ResolvedModuleEntry[]) => void;\n readonly lookup: (\n fileName: string,\n moduleName: string,\n mode: Option.Option<ResolutionMode>,\n ) => Option.Option<TsResolution>;\n}\n\ntype ProgramLookup = (rootNames: readonly string[], options: ProgramOptions) => CachedProgram;\n\nconst PROGRAM_CACHE_SIZE = 2;\nconst PRIMARY_OPTIONS: ProgramOptions = { allowJs: false, noDtsResolution: false };\n\nconst createProgramCache = (site: Omit<ProgramSite, \"options\">): ProgramLookup => {\n const programs = new Map<string, CachedProgram>();\n return (rootNames, options) => {\n const key = Arr.join(\n [...rootNames, String(options.allowJs), String(options.noDtsResolution)],\n \"\\0\",\n );\n const program = programs.get(key) ?? createProgram({ ...site, options }, rootNames);\n programs.delete(key);\n programs.set(key, program);\n for (const [staleKey, stale] of programs) {\n if (programs.size <= PROGRAM_CACHE_SIZE) {\n break;\n }\n programs.delete(staleKey);\n stale.dispose();\n }\n return program;\n };\n};\n\nconst createResolvedModuleTable = (): ResolvedModuleTable => {\n const byFile = new Map<string, Map<string, TsResolution>>();\n return {\n record: (fileName, entries) => {\n const path = toPath(fileName);\n const own = byFile.get(path) ?? new Map<string, TsResolution>();\n byFile.set(path, own);\n for (const entry of entries) {\n own.set(modeKey(entry.moduleName, entry.mode), toTsResolution(entry.resolution));\n }\n },\n lookup: (fileName, moduleName, mode) =>\n Option.fromNullishOr(byFile.get(toPath(fileName))).pipe(\n Option.flatMap((own) => Option.fromNullishOr(own.get(modeKey(moduleName, mode)))),\n ),\n };\n};\n\nconst auxiliaryOptions = (extraOptions: ExtraOptions | undefined): ProgramOptions => {\n const extra = Option.fromNullishOr(extraOptions);\n return {\n allowJs: Option.exists(extra, (options) => options.allowJs === true),\n noDtsResolution: Option.exists(extra, (options) => options.noDtsResolution === true),\n };\n};\n\nconst resolveModuleNameWith =\n (core: HostWrapperCore) =>\n (\n ...[moduleName, containingFile, resolutionMode, noDtsResolution]: ResolveModuleNameArguments\n ): ModuleNameResolution => {\n const entry = core.resolve({\n moduleName,\n containingFile,\n mode: modeFromNumber(resolutionMode),\n noDtsResolution: noDtsResolution === true,\n });\n return { resolution: entry.resolution, trace: entry.trace };\n };\n\nexport const wrapHost: {\n (site: Omit<ProgramSite, \"core\" | \"options\">): (core: HostWrapperCore) => CompilerHostWrapper;\n (core: HostWrapperCore, site: Omit<ProgramSite, \"core\" | \"options\">): CompilerHostWrapper;\n} = Fn.dual(\n DATA_FIRST_ARITY,\n (core: HostWrapperCore, site: Omit<ProgramSite, \"core\" | \"options\">): CompilerHostWrapper => {\n const getProgram = createProgramCache({ ...site, core });\n const resolvedModules = createResolvedModuleTable();\n return {\n getCompilerOptions: () => core.compilerOptions,\n getSourceFile: (fileName) => Option.getOrUndefined(core.getSourceFile(fileName)),\n getSourceFileFromCache: (fileName) =>\n Option.getOrUndefined(core.getSourceFileFromCache(fileName)),\n getModuleKindForFile: (fileName) =>\n Option.getOrUndefined(core.getModuleKindForFile(fileName)),\n resolveModuleName: resolveModuleNameWith(core),\n getTrace: (containingFile, moduleName, resolutionMode) =>\n Option.getOrUndefined(\n core.getTrace({\n moduleName,\n containingFile,\n mode: modeFromNumber(resolutionMode),\n noDtsResolution: false,\n }),\n ),\n createPrimaryProgram: (rootName) => {\n const created = getProgram([rootName], PRIMARY_OPTIONS);\n for (const [fileName, entries] of created.resolvedModules) {\n resolvedModules.record(fileName, entries);\n }\n return created.program;\n },\n createAuxiliaryProgram: (rootNames, extraOptions) =>\n getProgram(rootNames, auxiliaryOptions(extraOptions)).program,\n getResolvedModule: (sourceFile, moduleName, resolutionMode) =>\n Option.getOrUndefined(\n resolvedModules.lookup(sourceFile.fileName, moduleName, modeFromNumber(resolutionMode)),\n ),\n };\n },\n);\n","import { Option, Predicate } from \"effect\";\nimport { ModuleKind } from \"typescript/sync\";\n\nimport { fileExtensionIsOneOf, getAnyExtensionFromPath } from \"./extensions.ts\";\nimport type { ModuleKindInfo, ModuleKindReason } from \"./host-types.ts\";\nimport { pathContainsNodeModules } from \"./node-modules-paths.ts\";\nimport { getPackageScopeForPath } from \"./package-json.ts\";\nimport { combinePaths, getDirectoryPath, getNormalizedAbsolutePath, toPath } from \"./paths.ts\";\nimport type {\n PackageJsonCache,\n PackageJsonInfo,\n ResolutionKind,\n ResolutionMode,\n ResolutionState,\n ResolverHost,\n} from \"./resolution-types.ts\";\nimport { NO_FEATURES, createOutcome } from \"./resolver-state.ts\";\nimport { resolveNestedModule } from \"./resolver.ts\";\n\nexport interface FileFormatSource {\n readonly host: ResolverHost;\n readonly kind: ResolutionKind;\n readonly packageJsonCache: PackageJsonCache;\n}\n\nexport interface FileFormats {\n readonly impliedFormat: (fileName: string) => Option.Option<ResolutionMode>;\n readonly moduleKind: (fileName: string) => Option.Option<ModuleKindInfo>;\n readonly packageJsonScopeFor: (fileName: string) => Option.Option<PackageJsonInfo>;\n}\n\nconst ESM_EXTENSIONS = [\".d.mts\", \".mts\", \".mjs\"];\nconst CJS_EXTENSIONS = [\".d.cts\", \".cts\", \".cjs\"];\nconst EXPLICIT_FORMAT_EXTENSIONS = [...ESM_EXTENSIONS, ...CJS_EXTENSIONS];\nconst LOOKUP_EXTENSIONS = [\".d.ts\", \".ts\", \".tsx\", \".js\", \".jsx\"];\nconst MODULE_SYNTAX_EXTENSIONS: ReadonlySet<string> = new Set(EXPLICIT_FORMAT_EXTENSIONS);\n\nconst DETECTED_KINDS: Readonly<Record<ResolutionMode, number>> = {\n ESNext: ModuleKind.ESNext,\n CommonJS: ModuleKind.CommonJS,\n};\n\nconst lookupState = (\n source: FileFormatSource,\n packageJsonCache: Option.Option<PackageJsonCache>,\n): ResolutionState => ({\n host: source.host,\n trace: Option.none(),\n options: { moduleResolution: source.kind, noDtsResolution: false },\n cache: Option.none(),\n packageJsonCache,\n features: NO_FEATURES,\n conditions: [],\n candidateIsFromPackageJsonField: false,\n outcome: createOutcome(),\n resolveNested: resolveNestedModule,\n});\n\nconst shouldLookupPackageJson = (kind: ResolutionKind, path: string): boolean =>\n (kind === \"Node16\" || pathContainsNodeModules(path)) &&\n fileExtensionIsOneOf(path, LOOKUP_EXTENSIONS);\n\nconst isModuleScope = (info: PackageJsonInfo): boolean =>\n info.contents.packageJsonContent[\"type\"] === \"module\";\n\nconst formatOfScope = (scope: Option.Option<PackageJsonInfo>): ResolutionMode => {\n if (Option.exists(scope, isModuleScope)) {\n return \"ESNext\";\n }\n return \"CommonJS\";\n};\n\nconst cachedScope = (source: FileFormatSource, path: string): Option.Option<PackageJsonInfo> =>\n getPackageScopeForPath(path, lookupState(source, Option.some(source.packageJsonCache)));\n\nconst impliedFormatOf = (\n source: FileFormatSource,\n fileName: string,\n): Option.Option<ResolutionMode> => {\n const path = toPath(fileName);\n if (fileExtensionIsOneOf(path, ESM_EXTENSIONS)) {\n return Option.some(\"ESNext\");\n }\n if (fileExtensionIsOneOf(path, CJS_EXTENSIONS)) {\n return Option.some(\"CommonJS\");\n }\n if (!shouldLookupPackageJson(source.kind, path)) {\n return Option.none();\n }\n const scope = cachedScope(source, getDirectoryPath(path));\n return Option.some(formatOfScope(scope));\n};\n\nconst scopeReason = (info: PackageJsonInfo): ModuleKindReason => {\n if (Predicate.isTruthy(info.contents.packageJsonContent[\"type\"])) {\n return \"type\";\n }\n return \"no:type\";\n};\n\nconst reasonFor = (\n source: FileFormatSource,\n fileName: string,\n): Pick<ModuleKindInfo, \"detectedReason\" | \"reasonFileName\"> => {\n if (MODULE_SYNTAX_EXTENSIONS.has(getAnyExtensionFromPath(fileName))) {\n return { detectedReason: \"extension\", reasonFileName: fileName };\n }\n return Option.match(cachedScope(source, fileName), {\n onNone: () => ({ detectedReason: \"no:type\", reasonFileName: fileName }),\n onSome: (info) => ({\n detectedReason: scopeReason(info),\n reasonFileName: combinePaths(info.packageDirectory, \"package.json\"),\n }),\n });\n};\n\nconst moduleKindOf = (source: FileFormatSource, fileName: string): Option.Option<ModuleKindInfo> =>\n impliedFormatOf(source, fileName).pipe(\n Option.map((format) => ({\n detectedKind: DETECTED_KINDS[format],\n ...reasonFor(source, fileName),\n })),\n );\n\nconst packageJsonScopeOf = (\n source: FileFormatSource,\n fileName: string,\n): Option.Option<PackageJsonInfo> => {\n const path = getNormalizedAbsolutePath(fileName, \"/\");\n if (\n fileExtensionIsOneOf(path, EXPLICIT_FORMAT_EXTENSIONS) ||\n !shouldLookupPackageJson(source.kind, path)\n ) {\n return Option.none();\n }\n return getPackageScopeForPath(getDirectoryPath(path), lookupState(source, Option.none()));\n};\n\nexport const createFileFormats = (source: FileFormatSource): FileFormats => ({\n impliedFormat: (fileName) => impliedFormatOf(source, fileName),\n moduleKind: (fileName) => moduleKindOf(source, fileName),\n packageJsonScopeFor: (fileName) => packageJsonScopeOf(source, fileName),\n});\n","import { Option } from \"effect\";\nimport type { SourceFile } from \"typescript/ast\";\n\nimport { toPath } from \"./paths.ts\";\nimport type { ResolutionMode } from \"./resolution-types.ts\";\nimport { attachFileInfo } from \"./source-file.ts\";\nimport { parseSourceFile } from \"./ts-api.ts\";\n\nexport interface SourceFileOrigin {\n readonly read: (fileName: string) => Option.Option<string>;\n readonly impliedFormat: (fileName: string) => Option.Option<ResolutionMode>;\n}\n\nexport interface SourceFileStore {\n readonly open: (fileName: string) => Option.Option<SourceFile>;\n readonly cached: (fileName: string) => Option.Option<SourceFile>;\n}\n\nexport const createSourceFileStore = (origin: SourceFileOrigin): SourceFileStore => {\n const sourceFiles = new Map<string, SourceFile>();\n const cached = (fileName: string): Option.Option<SourceFile> =>\n Option.fromNullishOr(sourceFiles.get(toPath(fileName)));\n const storeParsed = (fileName: string, content: string): SourceFile => {\n const parsed = parseSourceFile(fileName, content, Option.none());\n const sourceFile = attachFileInfo(parsed, origin.impliedFormat(fileName));\n sourceFiles.set(toPath(fileName), sourceFile);\n return sourceFile;\n };\n return {\n open: (fileName) =>\n Option.orElse(cached(fileName), () =>\n origin.read(fileName).pipe(Option.map((content) => storeParsed(fileName, content))),\n ),\n cached,\n };\n};\n","import { Option, Function as Fn } from \"effect\";\n\nimport type {\n Features,\n ResolutionMode,\n ResolutionState,\n ResolverHost,\n ResolverOptions,\n} from \"./resolution-types.ts\";\nimport { ALL_FEATURES, NO_FEATURES, createOutcome, getConditions } from \"./resolver-state.ts\";\nimport { resolveNestedModule } from \"./resolver.ts\";\n\nconst DATA_FIRST_ARITY = 2;\n\nexport interface TypeReferenceRequest {\n readonly name: string;\n readonly containingFile: string;\n readonly options: ResolverOptions;\n readonly mode: Option.Option<ResolutionMode>;\n}\n\nconst conditionsFor = (\n request: TypeReferenceRequest,\n exportsEnabled: boolean,\n): readonly string[] => {\n if (!exportsEnabled) {\n return [];\n }\n return getConditions(request.options, request.mode);\n};\n\nconst featuresFor = (request: TypeReferenceRequest): Features => {\n if (request.options.moduleResolution !== \"Node10\" || Option.isSome(request.mode)) {\n return ALL_FEATURES;\n }\n return NO_FEATURES;\n};\n\nexport const stateFor: {\n (host: ResolverHost): (request: TypeReferenceRequest) => ResolutionState;\n (request: TypeReferenceRequest, host: ResolverHost): ResolutionState;\n} = Fn.dual(\n DATA_FIRST_ARITY,\n (request: TypeReferenceRequest, host: ResolverHost): ResolutionState => {\n const kind = request.options.moduleResolution;\n const features = {\n ...featuresFor(request),\n esmMode: kind === \"Node16\" && Option.contains(request.mode, \"ESNext\"),\n };\n return {\n host,\n trace: Option.none(),\n options: request.options,\n cache: Option.none(),\n packageJsonCache: Option.none(),\n features,\n conditions: conditionsFor(request, features.exports),\n candidateIsFromPackageJsonField: false,\n outcome: createOutcome(),\n resolveNested: resolveNestedModule,\n };\n },\n);\n","import { Option, Function as Fn } from \"effect\";\n\nimport { extensionsOf } from \"./extensions.ts\";\nimport { pathContainsNodeModules } from \"./node-modules-paths.ts\";\nimport { mangleScopedPackageName } from \"./package-names.ts\";\nimport { combinePaths, getDirectoryPath, isExternalModuleNameRelative } from \"./paths.ts\";\nimport type { PackageId, Resolved, ResolutionState, ResolverHost } from \"./resolution-types.ts\";\nimport { loadNodeModuleFromDirectory } from \"./resolver-directory.ts\";\nimport { loadModuleFromNearestNodeModulesDirectory } from \"./resolver-node-modules.ts\";\nimport { loadRelativeModule, nodeLoadModuleByRelativeName } from \"./resolver-relative.ts\";\nimport { stateFor } from \"./type-reference-state.ts\";\nimport type { TypeReferenceRequest } from \"./type-reference-state.ts\";\n\nconst DATA_FIRST_ARITY = 2;\n\nexport interface ResolvedTypeReference {\n readonly resolvedFileName: string;\n readonly packageId: Option.Option<PackageId>;\n readonly isExternalLibraryImport: boolean;\n}\n\nconst TYPE_ROOT = \"/node_modules/@types\";\nconst DECLARATION = extensionsOf(\"Declaration\");\n\nconst primaryLookup = (\n request: TypeReferenceRequest,\n state: ResolutionState,\n): Option.Option<Resolved> => {\n const candidate = combinePaths(TYPE_ROOT, mangleScopedPackageName(request.name));\n const directoryExists = state.host.directoryExists(TYPE_ROOT);\n return loadNodeModuleFromDirectory(\n {\n extensions: DECLARATION,\n candidate,\n onlyRecordFailures: !directoryExists,\n considerPackageJson: true,\n loadRelative: nodeLoadModuleByRelativeName,\n },\n state,\n );\n};\n\nconst secondaryLookup = (\n request: TypeReferenceRequest,\n state: ResolutionState,\n): Option.Option<Resolved> => {\n const directory = getDirectoryPath(request.containingFile);\n if (!isExternalModuleNameRelative(request.name)) {\n return Option.flatten(\n loadModuleFromNearestNodeModulesDirectory(\n { extensions: DECLARATION, moduleName: request.name, directory, typesScopeOnly: false },\n state,\n ),\n );\n }\n return loadRelativeModule({ extensions: DECLARATION, moduleName: request.name, directory }, state)\n .resolved;\n};\n\nexport const resolveTypeReferenceDirective: {\n (host: ResolverHost): (request: TypeReferenceRequest) => Option.Option<ResolvedTypeReference>;\n (request: TypeReferenceRequest, host: ResolverHost): Option.Option<ResolvedTypeReference>;\n} = Fn.dual(\n DATA_FIRST_ARITY,\n (request: TypeReferenceRequest, host: ResolverHost): Option.Option<ResolvedTypeReference> => {\n const state = stateFor(request, host);\n return primaryLookup(request, state).pipe(\n Option.orElse(() => secondaryLookup(request, state)),\n Option.map((resolved) => ({\n resolvedFileName: resolved.path,\n packageId: resolved.packageId,\n isExternalLibraryImport: pathContainsNodeModules(resolved.path),\n })),\n );\n },\n);\n","import { Option } from \"effect\";\nimport { ModuleKind, ModuleResolutionKind } from \"typescript/sync\";\n\nimport { createFileFormats } from \"./host-files.ts\";\nimport { createResolutionStore } from \"./host-resolutions.ts\";\nimport { createSourceFileStore } from \"./host-sources.ts\";\nimport { LIB_FILE_NAME } from \"./host-types.ts\";\nimport type { HostWrapperCore, PackageFileSystem } from \"./host-types.ts\";\nimport type { ModeOptions } from \"./module-mode.ts\";\nimport { createModuleResolutionCache } from \"./resolution-cache.ts\";\nimport type { ResolutionKind, ResolverHost } from \"./resolution-types.ts\";\nimport { resolveTypeReferenceDirective } from \"./type-reference.ts\";\n\nexport interface HostSource {\n readonly fs: PackageFileSystem;\n readonly kind: ResolutionKind;\n readonly minimalLib: string;\n}\n\nconst TARGET_LATEST = 99;\n\nconst MODULE_KINDS: Readonly<Record<ResolutionKind, number>> = {\n Node10: ModuleKind.CommonJS,\n Node16: ModuleKind.Node16,\n Bundler: ModuleKind.ESNext,\n};\n\nconst RESOLUTION_KINDS: Readonly<Record<ResolutionKind, number>> = {\n Node10: ModuleResolutionKind.Node10,\n Node16: ModuleResolutionKind.Node16,\n Bundler: ModuleResolutionKind.Bundler,\n};\n\nconst MODE_MODULES: Readonly<Record<ResolutionKind, ModeOptions[\"module\"]>> = {\n Node10: \"CommonJS\",\n Node16: \"Node16\",\n Bundler: \"ESNext\",\n};\n\nconst resolverHostOf = (fs: PackageFileSystem): ResolverHost => ({\n fileExists: fs.fileExists.bind(fs),\n directoryExists: fs.directoryExists.bind(fs),\n readFile: (path) => Option.fromNullishOr(fs.tryReadFile(path)),\n});\n\nconst fileReader =\n (source: HostSource) =>\n (fileName: string): Option.Option<string> => {\n if (fileName === LIB_FILE_NAME) {\n return Option.some(source.minimalLib);\n }\n return Option.fromNullishOr(source.fs.tryReadFile(fileName));\n };\n\nconst compilerOptionsFor = (kind: ResolutionKind): HostWrapperCore[\"compilerOptions\"] => ({\n moduleResolution: RESOLUTION_KINDS[kind],\n module: MODULE_KINDS[kind],\n target: TARGET_LATEST,\n resolveJsonModule: true,\n traceResolution: true,\n});\n\nexport const createHostWrapper = (source: HostSource): HostWrapperCore => {\n const { kind } = source;\n const resolverHost = resolverHostOf(source.fs);\n const normalCache = createModuleResolutionCache();\n const formats = createFileFormats({\n host: resolverHost,\n kind,\n packageJsonCache: normalCache.packageJson,\n });\n const sources = createSourceFileStore({\n read: fileReader(source),\n impliedFormat: formats.impliedFormat,\n });\n const resolutions = createResolutionStore({ host: resolverHost, kind, normalCache });\n return {\n kind,\n modeOptions: { moduleResolution: kind, module: MODE_MODULES[kind] },\n resolverHost,\n compilerOptions: compilerOptionsFor(kind),\n getSourceFile: sources.open,\n getSourceFileFromCache: sources.cached,\n getModuleKindForFile: formats.moduleKind,\n resolve: resolutions.resolve,\n getTrace: resolutions.getTrace,\n packageJsonScopeFor: formats.packageJsonScopeFor,\n resolveTypeReference: ({ name, containingFile, mode }) =>\n resolveTypeReferenceDirective(\n { name, containingFile, options: { moduleResolution: kind, noDtsResolution: false }, mode },\n resolverHost,\n ),\n };\n};\n","import { Option, Predicate, Array as Arr, pipe, Function as Fn } from \"effect\";\nimport { ModuleResolutionKind } from \"typescript/sync\";\n\nimport { wrapHost } from \"./compiler-host-wrapper.ts\";\nimport type { CompilerHostWrapper } from \"./compiler-host-wrapper.ts\";\nimport { LIB_FILE_NAME } from \"./host-types.ts\";\nimport type { PackageFileSystem } from \"./host-types.ts\";\nimport { createHostWrapper } from \"./host-wrapper.ts\";\nimport type { ResolutionKind } from \"./resolution-types.ts\";\nimport { mount } from \"./ts-api.ts\";\nimport type { MountedFileSystem } from \"./ts-api.ts\";\n\nconst DATA_FIRST_ARITY = 2;\nconst DATA_FIRST_ARITY_3 = 3;\n\nexport interface CompilerHosts {\n readonly node10: CompilerHostWrapper;\n readonly node16: CompilerHostWrapper;\n readonly bundler: CompilerHostWrapper;\n readonly findHostForFiles: (files: readonly string[]) => CompilerHostWrapper | undefined;\n}\n\nconst RESOLUTION_KINDS_BY_OPTION: ReadonlyMap<number, ResolutionKind> = new Map([\n [ModuleResolutionKind.Node10, \"Node10\"],\n [ModuleResolutionKind.Node16, \"Node16\"],\n [ModuleResolutionKind.NodeNext, \"Node16\"],\n [ModuleResolutionKind.Bundler, \"Bundler\"],\n]);\n\nconst mountFileSystem = (fs: PackageFileSystem, minimalLib: string): MountedFileSystem =>\n mount({\n fileExists: (path) => path === LIB_FILE_NAME || fs.fileExists(path),\n directoryExists: (path) => fs.directoryExists(path),\n readFile: (path) => {\n if (path === LIB_FILE_NAME) {\n return Option.some(minimalLib);\n }\n return Option.fromNullishOr(fs.tryReadFile(path));\n },\n listFiles: () => [LIB_FILE_NAME, ...fs.listFiles()],\n });\n\nexport const createCompilerHostWrapperWith: {\n (moduleResolution: number, minimalLib: string): (fs: PackageFileSystem) => CompilerHostWrapper;\n (fs: PackageFileSystem, moduleResolution: number, minimalLib: string): CompilerHostWrapper;\n} = Fn.dual(\n DATA_FIRST_ARITY_3,\n (fs: PackageFileSystem, moduleResolution: number, minimalLib: string): CompilerHostWrapper => {\n const kind = RESOLUTION_KINDS_BY_OPTION.get(moduleResolution);\n if (Predicate.isUndefined(kind)) {\n throw new TypeError(`Unsupported module resolution kind: ${String(moduleResolution)}`);\n }\n return wrapHost(createHostWrapper({ fs, kind, minimalLib }), {\n mounted: mountFileSystem(fs, minimalLib),\n });\n },\n);\n\nconst holdsAll =\n (files: readonly string[]) =>\n (host: CompilerHostWrapper): boolean =>\n pipe(\n files,\n Arr.every((file) => Predicate.isNotUndefined(host.getSourceFileFromCache(file))),\n );\n\nexport const createCompilerHostsWith: {\n (minimalLib: string): (fs: PackageFileSystem) => CompilerHosts;\n (fs: PackageFileSystem, minimalLib: string): CompilerHosts;\n} = Fn.dual(DATA_FIRST_ARITY, (fs: PackageFileSystem, minimalLib: string): CompilerHosts => {\n const mounted = mountFileSystem(fs, minimalLib);\n const create = (kind: ResolutionKind): CompilerHostWrapper =>\n wrapHost(createHostWrapper({ fs, kind, minimalLib }), { mounted });\n const node10 = create(\"Node10\");\n const node16 = create(\"Node16\");\n const bundler = create(\"Bundler\");\n return {\n node10,\n node16,\n bundler,\n findHostForFiles: (files) =>\n Option.getOrUndefined(Arr.findFirst([node10, node16, bundler], holdsAll(files))),\n };\n});\n","import ts from \"typescript\";\nimport { CompilerHostWrapper } from \"./multiCompilerHost.js\";\nimport { allBuildTools, getResolutionKinds } from \"../utils.js\";\nconst extensions = new Set([\".jsx\", \".tsx\", \".js\", \".ts\", \".mjs\", \".cjs\", \".mts\", \".cjs\"]);\nfunction getEntrypoints(fs, exportsObject, options) {\n var _a;\n var _b;\n if (options === null || options === void 0 ? void 0 : options.entrypoints) {\n return options.entrypoints.map((e) => formatEntrypointString(e, fs.packageName));\n }\n if (exportsObject === undefined && fs) {\n const rootDir = `/node_modules/${fs.packageName}`;\n const proxies = getProxyDirectories(rootDir, fs);\n if (proxies.length === 0) {\n if (options === null || options === void 0 ? void 0 : options.entrypointsLegacy) {\n return fs\n .listFiles()\n .filter((f) => !ts.isDeclarationFileName(f) && extensions.has(f.slice(f.lastIndexOf(\".\"))))\n .map((f) => \".\" + f.slice(rootDir.length));\n }\n return [\".\"];\n }\n return proxies;\n }\n const detectedSubpaths = getSubpaths(exportsObject);\n if (detectedSubpaths.length === 0 && hasExportTarget(exportsObject)) {\n detectedSubpaths.push(\".\");\n }\n const included = unique([\n ...detectedSubpaths,\n ...((_b = (_a = options === null || options === void 0 ? void 0 : options.includeEntrypoints) === null || _a === void 0 ? void 0 : _a.map((e) => formatEntrypointString(e, fs.packageName))) !== null && _b !== void 0 ? _b : []),\n ]);\n if (!(options === null || options === void 0 ? void 0 : options.excludeEntrypoints)) {\n return included;\n }\n return included.filter((entrypoint) => {\n return !options.excludeEntrypoints.some((exclusion) => {\n if (typeof exclusion === \"string\") {\n return formatEntrypointString(exclusion, fs.packageName) === entrypoint;\n }\n return exclusion.test(entrypoint);\n });\n });\n}\nfunction formatEntrypointString(path, packageName) {\n return (path === \".\" || path.startsWith(\"./\")\n ? path\n : path === packageName\n ? \".\"\n : path.startsWith(`${packageName}/`)\n ? `.${path.slice(packageName.length)}`\n : `./${path}`).trim();\n}\nfunction getSubpaths(exportsObject) {\n var _a;\n if (!exportsObject || typeof exportsObject !== \"object\" || Array.isArray(exportsObject)) {\n return [];\n }\n const keys = Object.keys(exportsObject);\n if ((_a = keys[0]) === null || _a === void 0 ? void 0 : _a.startsWith(\".\")) {\n return keys.filter((key) => hasExportTarget(exportsObject[key]));\n }\n return keys.flatMap((key) => getSubpaths(exportsObject[key]));\n}\nfunction hasExportTarget(exportsObject) {\n if (exportsObject === null || exportsObject === undefined) {\n return false;\n }\n if (typeof exportsObject !== \"object\") {\n return true;\n }\n if (Array.isArray(exportsObject)) {\n return exportsObject.some(hasExportTarget);\n }\n return Object.keys(exportsObject).some((key) => hasExportTarget(exportsObject[key]));\n}\nfunction getProxyDirectories(rootDir, fs) {\n const vendorDirectories = new Set();\n const proxyDirectories = [];\n const files = fs.listFiles().sort((a, b) => a.length - b.length);\n for (const file of files) {\n if (file.startsWith(rootDir) && file.endsWith(\"/package.json\")) {\n try {\n const packageJson = JSON.parse(fs.readFile(file));\n if (packageJson.name && !packageJson.name.startsWith(fs.packageName)) {\n // Name unrelated to the root package, this is a vendored package\n const vendorDir = file.slice(0, file.lastIndexOf(\"/\"));\n vendorDirectories.add(vendorDir);\n }\n else if (\"main\" in packageJson && !isInsideVendorDirectory(file)) {\n // No name or name starting with root package name, this is intended to be an entrypoint\n const proxyDir = \".\" + file.slice(rootDir.length, file.lastIndexOf(\"/\"));\n proxyDirectories.push(proxyDir);\n }\n }\n catch { }\n }\n }\n return proxyDirectories.sort((a, b) => {\n return ts.comparePathsCaseInsensitive(a, b);\n });\n function isInsideVendorDirectory(file) {\n return !!ts.forEachAncestorDirectory(file, (dir) => {\n if (vendorDirectories.has(dir)) {\n return true;\n }\n });\n }\n}\nexport function getEntrypointInfo(packageName, fs, hosts, options) {\n const packageJson = JSON.parse(fs.readFile(`/node_modules/${packageName}/package.json`));\n let entrypoints = getEntrypoints(fs, packageJson.exports, options);\n if (fs.typesPackage) {\n const typesPackageJson = JSON.parse(fs.readFile(`/node_modules/${fs.typesPackage.packageName}/package.json`));\n const typesEntrypoints = getEntrypoints(fs, typesPackageJson.exports, options);\n entrypoints = unique([...entrypoints, ...typesEntrypoints]);\n }\n const result = {};\n for (const entrypoint of entrypoints) {\n const resolutions = {\n node10: getEntrypointResolution(packageName, hosts.node10, \"node10\", entrypoint),\n \"node16-cjs\": getEntrypointResolution(packageName, hosts.node16, \"node16-cjs\", entrypoint),\n \"node16-esm\": getEntrypointResolution(packageName, hosts.node16, \"node16-esm\", entrypoint),\n bundler: getEntrypointResolution(packageName, hosts.bundler, \"bundler\", entrypoint),\n };\n result[entrypoint] = {\n subpath: entrypoint,\n resolutions,\n hasTypes: Object.values(resolutions).some((r) => { var _a; return (_a = r.resolution) === null || _a === void 0 ? void 0 : _a.isTypeScript; }),\n isWildcard: !!resolutions.bundler.isWildcard,\n };\n }\n return result;\n}\nfunction getEntrypointResolution(packageName, host, resolutionKind, entrypoint) {\n if (entrypoint.includes(\"*\")) {\n return { name: entrypoint, resolutionKind, isWildcard: true };\n }\n const moduleSpecifier = packageName + entrypoint.substring(1); // remove leading . before slash\n const importingFileName = resolutionKind === \"node16-esm\" ? \"/index.mts\" : \"/index.ts\";\n const resolutionMode = resolutionKind === \"node16-esm\"\n ? ts.ModuleKind.ESNext\n : resolutionKind === \"node16-cjs\"\n ? ts.ModuleKind.CommonJS\n : undefined;\n const resolution = tryResolve();\n const implementationResolution = tryResolve(/*noDtsResolution*/ true);\n const files = resolution\n ? host\n .createPrimaryProgram(resolution.fileName)\n .getSourceFiles()\n .map((f) => f.fileName)\n : undefined;\n return {\n name: entrypoint,\n resolutionKind,\n resolution,\n implementationResolution,\n files,\n };\n function tryResolve(noDtsResolution) {\n var _a;\n const { resolution, trace } = host.resolveModuleName(moduleSpecifier, importingFileName, resolutionMode, noDtsResolution);\n const fileName = (_a = resolution.resolvedModule) === null || _a === void 0 ? void 0 : _a.resolvedFileName;\n if (!fileName) {\n return undefined;\n }\n return {\n fileName,\n isJson: resolution.resolvedModule.extension === ts.Extension.Json,\n isTypeScript: ts.hasTSFileExtension(resolution.resolvedModule.resolvedFileName),\n trace,\n };\n }\n}\nfunction unique(array) {\n return array.filter((value, index) => array.indexOf(value) === index);\n}\nexport function getBuildTools(packageJson) {\n if (!packageJson.devDependencies) {\n return {};\n }\n const result = {};\n for (const buildTool of allBuildTools) {\n if (buildTool in packageJson.devDependencies) {\n result[buildTool] = packageJson.devDependencies[buildTool];\n }\n }\n return result;\n}\nexport function getModuleKinds(entrypoints, resolutionOption, hosts) {\n var _a;\n const host = hosts[resolutionOption];\n const result = {};\n for (const resolutionKind of getResolutionKinds(resolutionOption)) {\n for (const entrypoint of Object.values(entrypoints)) {\n const resolution = entrypoint.resolutions[resolutionKind];\n for (const fileName of (_a = resolution.files) !== null && _a !== void 0 ? _a : []) {\n if (!result[fileName]) {\n result[fileName] = host.getModuleKindForFile(fileName);\n }\n }\n if (resolution.implementationResolution) {\n const fileName = resolution.implementationResolution.fileName;\n if (!result[fileName]) {\n result[fileName] = host.getModuleKindForFile(fileName);\n }\n }\n }\n }\n return result;\n}\n//# sourceMappingURL=getEntrypointInfo.js.map","import { init as initCjsLexer } from \"cjs-module-lexer\";\nimport checks from \"./internal/checks/index.js\";\nimport { createCompilerHosts } from \"./internal/multiCompilerHost.js\";\nimport { getResolutionOption, visitResolutions } from \"./utils.js\";\nimport { getEntrypointInfo, getModuleKinds, getBuildTools } from \"./internal/getEntrypointInfo.js\";\nexport async function checkPackage(pkg, options) {\n const types = pkg.typesPackage\n ? {\n kind: \"@types\",\n ...pkg.typesPackage,\n definitelyTypedUrl: JSON.parse(pkg.readFile(`/node_modules/${pkg.typesPackage.packageName}/package.json`))\n .homepage,\n }\n : pkg.containsTypes()\n ? { kind: \"included\" }\n : false;\n const { packageName, packageVersion } = pkg;\n if (!types) {\n return { packageName, packageVersion, types };\n }\n const hosts = createCompilerHosts(pkg);\n const entrypointResolutions = getEntrypointInfo(packageName, pkg, hosts, options);\n const programInfo = {\n node10: {},\n node16: { moduleKinds: getModuleKinds(entrypointResolutions, \"node16\", hosts) },\n bundler: {},\n };\n await initCjsLexer();\n const problems = [];\n const problemIdsToIndices = new Map();\n visitResolutions(entrypointResolutions, (analysis, info) => {\n var _a;\n for (const check of checks) {\n const context = {\n pkg,\n hosts,\n entrypoints: entrypointResolutions,\n programInfo,\n subpath: info.subpath,\n resolutionKind: analysis.resolutionKind,\n resolutionOption: getResolutionOption(analysis.resolutionKind),\n fileName: undefined,\n };\n if (check.enumerateFiles) {\n for (const fileName of (_a = analysis.files) !== null && _a !== void 0 ? _a : []) {\n runCheck(check, { ...context, fileName }, analysis);\n }\n if (analysis.implementationResolution) {\n runCheck(check, { ...context, fileName: analysis.implementationResolution.fileName }, analysis);\n }\n }\n else {\n runCheck(check, context, analysis);\n }\n }\n });\n return {\n packageName,\n packageVersion,\n types,\n buildTools: getBuildTools(JSON.parse(pkg.readFile(`/node_modules/${packageName}/package.json`))),\n entrypoints: entrypointResolutions,\n programInfo,\n problems,\n };\n function runCheck(check, context, analysis) {\n var _a, _b;\n const dependencies = check.dependencies(context);\n const id = check.name +\n JSON.stringify(dependencies, (_, value) => {\n if (typeof value === \"function\") {\n throw new Error(\"Encountered unexpected function in check dependencies\");\n }\n return value;\n });\n let indices = problemIdsToIndices.get(id);\n if (indices) {\n ((_a = analysis.visibleProblems) !== null && _a !== void 0 ? _a : (analysis.visibleProblems = [])).push(...indices);\n }\n else {\n indices = [];\n const checkProblems = check.execute(dependencies, context);\n for (const problem of Array.isArray(checkProblems) ? checkProblems : checkProblems ? [checkProblems] : []) {\n indices.push(problems.length);\n problems.push(problem);\n }\n problemIdsToIndices.set(id, indices);\n ((_b = analysis.visibleProblems) !== null && _b !== void 0 ? _b : (analysis.visibleProblems = [])).push(...indices);\n }\n }\n}\n//# sourceMappingURL=checkPackage.js.map"],"mappings":";;;;;;;;;;;;;;AAEA,MAAMA,sBAAmB;AAGzB,MAAM,UAAU;AAChB,MAAM,SAAS;AAEf,MAAM,eAAe,MAAc,UAA0B;CAC3D,IAAI,SAAA,KAAkB,UAAA,GACpB,OAAA;CAGF,OADe,OAAO,OAAO,WAAW,WAAW,QAAQ,WAAW,OAC1D,IAAI,SAAS,YAAY,KAAK,MAAM,OAAO,MAAM,GAAG,KAAK,MAAM,QAAQ,MAAM,CAAC;AAC5F;AAEA,MAAa,UAGTE,SAAG,KACLF,sBACC,OAAe,SAA0B,YAAY,OAAO,IAAI,MAAA,CACnE;AAEA,MAAa,YAGTE,SAAG,KACLF,sBACC,OAAe,SAAyB,QAAQ,OAAO,YAAY,OAAO,IAAI,CACjF;AAEA,MAAa,eAGTE,SAAG,KACLF,sBACC,OAAe,SAAyB,QAAQ,YAAY,OAAO,IAAI,CAC1E;AAEA,MAAa,gBAAgB,GAAG,UAC9BG,QAAI,OAAO,OAAA,GAAc,SAAS;;ACjCpC,MAAMC,sBAAmB;AACzB,MAAMC,wBAAqB;AAyB3B,MAAM,aAAa;AACnB,MAAM,oBAAoB;AAC1B,MAAM,oBAAoB;AAC1B,MAAM,eAAe;AAErB,MAAa,8BAA8B,SAAyB;CAClE,IAAIC,SAAI,WAAW,iBAAiB,CAAC,CAAC,IAAI,GACxC,OAAOA,SAAI,MAAM,CAAiB,CAAC,CAAC,IAAI;CAE1C,OAAO;AACT;AAEA,MAAaC,8BAA4B,SAAyB;CAChE,IAAID,SAAI,WAAW,iBAAiB,CAAC,CAAC,IAAI,GACxC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