How hamachi25/pixiv-infinite-scroll works
Main Components
• Content Script Injection:
• “content” entry point (src/entrypoints/content). This part is responsible for modifying or extending the Pixiv pages. It includes components for various features like following lists, grid illustrations, novels, and profile popups.
• Options Page:
• “options” entry point (src/entrypoints/options) that provides users a settings interface. Note the components that handle tag/user mute sections and UI elements like Add, Delete, Import/Export buttons.
• Popup Interface:
• Main World Injection:
• “main-world.content” component (src/entrypoints/main-world.content) which potentially enables running scripts in the same execution context as the page.
• Supporting Modules:
• Shared utilities and libraries (e.g., messaging, storage, data fetching in “fetch” folders, and utility functions for URL generation and style injection).
• “locales” folder—marked for translation support—and “types” folder for type definitions.
• Build and Deployment:
• Build and CI/CD configuration components, such as GitHub workflows (.github directory), Husky pre-commit hooks, linting configurations (eslint, commitlint), and package management files (package.json, pnpm-lock.yaml).
Relationships and Interactions
• Data Flow:
• Messaging or communication flows between the different entry points (content scripts may communicate with the popup or options page if needed).
• Configuration and Build:
• That the build process (using pnpm with commands for dev, build, and zip) compiles/transpiles and bundles the various entry points separately.
• Localization:
• A block for “locales” to indicate that the UI is internationalized.
Architectural Patterns and Design Principles
• The project follows a modular structure by separating different functionalities into distinct entry points.
• The UI layer is component-based (React) with clear separation of concerns (UI components, feature pages, utilities).
• There is an emphasis on maintainability with isolated concerns for fetching, data transformation, and messaging.
• The integration with browser extension APIs (as seen from the extension’s installation instructions and build outputs, such as the .output folder) is a core design element.