@ng-native/metro
v0.29.0
Published
Metro transformer and config preset for Angular Native: Angular AOT through oxc, the linker, and the build-time CSS compiler.
Maintainers
Readme
@ng-native/metro
The build-time half of Angular Native: a Metro config preset and Babel transformer that compiles
Angular components ahead of time, turns each component's styles into the rule set
@ng-native/fabric
reads at runtime, links partially-compiled Angular libraries, and wires up hot reload with no
Angular dev server.
Alpha: APIs may change before 1.0.
Install
Most apps start from npx create-expo-app@latest my-app --template @ng-native/template, which
already has this wired into metro.config.js. Otherwise:
npm install @ng-native/metro
npm install expoExample
// metro.config.js
const { getDefaultConfig } = require('expo/metro-config');
const { withAngularNative } = require('@ng-native/metro/config.cjs');
module.exports = withAngularNative(getDefaultConfig(__dirname));No options in the common case. In a monorepo where the @ng-native/* packages live outside the
app's own node_modules, pass { workspaceRoot }:
module.exports = withAngularNative(getDefaultConfig(__dirname), {
workspaceRoot: __dirname + '/../..',
});A component library from npm has its component CSS compiled into native sheets, as the app's own is,
with nothing to configure; what native cannot express is dropped, counted in one build warning a
file, or listed with ANGULAR_NATIVE_LIBRARY_WARNINGS=all. { libraryStyles: ['@acme/ui'] }
narrows that to the packages it names, and false to none. The @ng-native/* packages are always
compiled. See
Configuration.
What's in the package
./config.cjs-withAngularNative, the Metro config preset.angular-transform.cjs(the package'smain) - the Babel/Metro transformer itself, wired in by the preset.css/*.cjs- the build-time CSS compiler, also used by@ng-native/tailwind.markdown-module.cjs- a.mdfile as a module,{ attributes, content, tokens }: its front matter parsed and its Markdown lexed bymarked, an optional peer, as the app is bundled.markdown.d.tstypes the import: add"types": ["@ng-native/metro/markdown"]to the app'stsconfig.json.polyfills/*.js- theng-dev-mode,animation-globalsandfinalization-registrypolyfills the preset installs before@angular/corefirst runs.
Docs
License
MIT
