MCPcopy Create free account
hub / github.com/arktypeio/arktype / buildEnd

Function buildEnd

ark/aot/unplugin.ts:1716–1797  ·  view source on GitHub ↗
(error?: Error)

Source from the content-addressed store, hash-verified

1714 buildStart: startBuild,
1715 // a build that won't rerun releases its worker
1716 async buildEnd(error?: Error) {
1717 rewritesCached = false
1718 const native = this.getNativeBuildContext?.()
1719 const isWatching =
1720 native && "compiler" in native ?
1721 native.compiler.watchMode
1722 : (this as { meta?: { watchMode?: boolean } }).meta?.watchMode
1723 try {
1724 if (!error && !isServing && "getModuleIds" in this) {
1725 await checkBundledExternals(
1726 rollupBundleOf(this as never),
1727 undefined,
1728 noExternalOptionOf((this as ViteBuildContext).environment)
1729 )
1730 }
1731 if (
1732 !error &&
1733 !isServing &&
1734 foldedHelpersById.size &&
1735 "getModuleIds" in this
1736 ) {
1737 const problem = unfoldedCallProblemOf(
1738 foldedHelpersById,
1739 rollupImportsOf(this as never, id => id),
1740 isTransformedId,
1741 realCwd()
1742 )
1743 if (problem) throwBuildError(problem)
1744 }
1745 for (const warning of pendingScans.get(buildOf(this))?.warnings ?? [])
1746 if (!error) warnOnce(this as never, warning)
1747 const scan = scansByBuild.get(buildOf(this))
1748 // a read it didn't see may need what it left out, or a copy of a
1749 // unit it declares in one function
1750 if ((scan?.verifies || scan?.replaced.size) && !error) {
1751 const problem = await rollupUnseenOf(
1752 this as never,
1753 scan,
1754 othersByBuild.get(buildOf(this)),
1755 isTransformedId,
1756 (program, isBuilt) =>
1757 requestResolving(
1758 bundlerResolveOf(this, isTransformedId),
1759 "unseen",
1760 program,
1761 isBuilt ? "the plugins after it" : undefined
1762 ) as Promise<string | UnseenBuilt | undefined>,
1763 realCwd()
1764 )
1765 // fails before the bundle is written
1766 if (problem) {
1767 throwBuildError(
1768 typeof problem === "string" ? problem : (
1769 writeLaterTransformMessage(problem)
1770 )
1771 )
1772 }
1773 }

Callers

nothing calls this directly

Calls 15

unfoldedCallProblemOfFunction · 0.90
throwBuildErrorFunction · 0.90
throwErrorFunction · 0.90
checkBundledExternalsFunction · 0.85
rollupBundleOfFunction · 0.85
noExternalOptionOfFunction · 0.85
rollupImportsOfFunction · 0.85
realCwdFunction · 0.85
buildOfFunction · 0.85
rollupUnseenOfFunction · 0.85
requestResolvingFunction · 0.85

Tested by

no test coverage detected