How embroider-build/embroider works
Main Components
• Core Build & Translation Engine: Start with packages like “packages/core” and “packages/compat”. These are the heart of the translation layer that processes Ember apps and addons.
• Integration Adapters: Include components that bridge the core logic with different bundlers or runtimes. For example, “packages/vite”, “packages/webpack”, and “packages/babel-loader-9”. They demonstrate how Embroider plugs into modern build tooling.
• Addon Support & Compatibility: Represent modules like “packages/addon-dev”, “packages/addon-shim”, and “packages/macros”. These provide support specifically for transforming addon code, handling macros, and managing addon dependencies.
• Utilities & Shared Internals: There are packages like “packages/shared-internals” and “packages/util” that supply helper functions, caching, and file system operations which are used by many parts of the system.
• Other Supporting Tools: Don’t forget ancillary tooling (like “packages/hbs-loader”, “packages/reverse-exports”, and “packages/config-meta-loader”) that handle specific responsibilities (template pre-compiling, module re-exporting, and configuration metadata).
Representing Relationships and Interactions
– Show that the addon-support packages and macros plug into the core engine as well as interact with each other. For instance, “addon-dev” and “addon-shim” are for transforming addon code in a manner that is consistent with the v2 addon format.
• Modules within the monorepo are highly interdependent. Indicate the reliance of multiple packages on shared utilities from “shared-internals” and “util”.
Architectural Patterns and Design Principles
• Plugin-based Architecture: Emphasize that the design relies on a plug-and-play approach. The core transformation logic delegates tasks to various plugins and integrations (Vite, Webpack, Babel, etc.) with clearly defined interfaces.
• Layered Architecture: Show the separation between the core/resolver logic and the build-system-specific adapters. This makes the architecture extensible and modular.
• Environment Flexibility: Indicate that options and environment variables (like EMBROIDER_WORKING_DIRECTORY) provide configuration at build time that can affect how these layers interact.
Technologies, Frameworks, and Libraries
• That Ember itself is the base target. The system integrates modern bundlers like Vite and Webpack.
• Babel-related components and testing infrastructure (like Jest and QUnit support indicated by various configuration files) that are part of the development ecosystem.
• Use of GitHub actions and CI configuration files shows that the repository is set up for continuous integration and automated testing.