(...names: string[])
| 937 | } & unknown |
| 938 | > |
| 939 | export(...names: string[]): SchemaModule { |
| 940 | if (!this._exports) { |
| 941 | const mark = $ark.reached?.mark() |
| 942 | // an alias resolving can export again, which returns what's exported so far |
| 943 | this._exports = {} |
| 944 | try { |
| 945 | for (const name of this.exportedNames) { |
| 946 | const def = this.aliases[name] |
| 947 | this._exports[name] = |
| 948 | this._lazy ? this._lazy[name] |
| 949 | : hasArkKind(def, "module") ? bindModule(def, this) |
| 950 | : this.maybeResolve(name)! |
| 951 | } |
| 952 | // a private alias nothing exported references is checked as an |
| 953 | // exported one is, rather than only where a reference reaches it |
| 954 | for (const name in this.aliases) { |
| 955 | if ( |
| 956 | !hasOwn(this._exports, name) && |
| 957 | !hasArkKind(this.aliases[name], "module") |
| 958 | ) |
| 959 | this.maybeResolve(name) |
| 960 | } |
| 961 | this._exported = resolutionsOfModule(this, this._exports) |
| 962 | |
| 963 | Object.assign(this.res, this._exported) |
| 964 | |
| 965 | if (!this._lazy) { |
| 966 | // every alias's resolution is now final, so compiling reads each once |
| 967 | this.resolved = true |
| 968 | const hasAlias = Object.values(this._exported).some( |
| 969 | resolution => isNode(resolution) && resolution.hasAlias |
| 970 | ) |
| 971 | // resolves each alias they reach, which can throw |
| 972 | let uncompiled = |
| 973 | hasAlias || bindPrecompiledUnits ? this.references : [] |
| 974 | if (bindPrecompiledUnits) { |
| 975 | // inline-compiled branches bind on their own |
| 976 | bindPrecompiledUnits(uncompiled) |
| 977 | uncompiled = uncompiled.filter(node => !node.unitFn) |
| 978 | } |
| 979 | if (canJit(this.cfg)) { |
| 980 | // resolving aliases can throw, so they compile on export |
| 981 | if (uncompiled.some(node => node.hasAlias)) |
| 982 | this.unitFn = tryJit(() => precompile(uncompiled, this)) |
| 983 | else { |
| 984 | for (const name in this._exported) { |
| 985 | const resolution = this._exported[name] |
| 986 | if (hasArkKind(resolution, "root") && !resolution.unitFn) |
| 987 | resolution.deferJit() |
| 988 | } |
| 989 | } |
| 990 | } |
| 991 | } |
| 992 | } catch (e) { |
| 993 | // so a later call throws the same error, and nothing resolved since |
| 994 | // is kept as if every alias had |
| 995 | this._exports = undefined |
| 996 | if (!this._lazy) this.resolved = false |
nothing calls this directly
no test coverage detected