Problem
Gradient currently imports expo-linear-gradient directly:
import { LinearGradient } from 'expo-linear-gradient';
and ZORA also exports Gradient from the root package:
export { Gradient } from './components/gradient';
That means consumers that broadly import from @ankhorage/zora can cause the Gradient module graph to be evaluated, even when they do not intentionally use Gradient.
For native Expo consumers, this makes expo-linear-gradient effectively required even though it is declared as an optional peer dependency.
Desired direction
Make Gradient truly optional by moving the runtime/native dependency behind a dedicated subpath export:
import { Gradient } from '@ankhorage/zora/gradient';
The package root should avoid importing or re-exporting modules that require optional native dependencies.
Proposed design
- Add an export subpath:
{
"exports": {
".": { ... },
"./gradient": {
"react-native": "./src/components/gradient/index.ts",
"browser": "./src/components/gradient/index.ts",
"types": "./dist/components/gradient/index.d.ts",
"import": "./dist/components/gradient/index.js",
"default": "./dist/components/gradient/index.js"
}
}
}
-
Remove Gradient value export from root src/index.ts, or keep only type-level exports if TypeScript/build output can guarantee no runtime import.
-
Update docs/examples to import Gradient from:
import { Gradient } from '@ankhorage/zora/gradient';
-
Keep expo-linear-gradient as an optional peer dependency, but document that it is required for the @ankhorage/zora/gradient subpath.
-
Consider adding metadata for optional-native components so app generators can install native packages only when a manifest/component actually uses the component.
Acceptance criteria
- Importing from
@ankhorage/zora root does not evaluate/import expo-linear-gradient.
Gradient remains available from @ankhorage/zora/gradient.
- Apps that do not import/use
Gradient do not need expo-linear-gradient installed.
- Apps that do import/use
@ankhorage/zora/gradient get a clear peer dependency requirement.
- Typecheck/build/tests pass.
Notes
This is the architectural ZORA-side fix. The immediate generated-app unblock is tracked separately in ankhorage4, where generated apps should include expo-linear-gradient as long as root ZORA imports still make it effectively required.
Problem
Gradientcurrently importsexpo-linear-gradientdirectly:and ZORA also exports
Gradientfrom the root package:That means consumers that broadly import from
@ankhorage/zoracan cause theGradientmodule graph to be evaluated, even when they do not intentionally useGradient.For native Expo consumers, this makes
expo-linear-gradienteffectively required even though it is declared as an optional peer dependency.Desired direction
Make
Gradienttruly optional by moving the runtime/native dependency behind a dedicated subpath export:The package root should avoid importing or re-exporting modules that require optional native dependencies.
Proposed design
{ "exports": { ".": { ... }, "./gradient": { "react-native": "./src/components/gradient/index.ts", "browser": "./src/components/gradient/index.ts", "types": "./dist/components/gradient/index.d.ts", "import": "./dist/components/gradient/index.js", "default": "./dist/components/gradient/index.js" } } }Remove
Gradientvalue export from rootsrc/index.ts, or keep only type-level exports if TypeScript/build output can guarantee no runtime import.Update docs/examples to import Gradient from:
Keep
expo-linear-gradientas an optional peer dependency, but document that it is required for the@ankhorage/zora/gradientsubpath.Consider adding metadata for optional-native components so app generators can install native packages only when a manifest/component actually uses the component.
Acceptance criteria
@ankhorage/zoraroot does not evaluate/importexpo-linear-gradient.Gradientremains available from@ankhorage/zora/gradient.Gradientdo not needexpo-linear-gradientinstalled.@ankhorage/zora/gradientget a clear peer dependency requirement.Notes
This is the architectural ZORA-side fix. The immediate generated-app unblock is tracked separately in
ankhorage4, where generated apps should includeexpo-linear-gradientas long as root ZORA imports still make it effectively required.