|
|
@@ -1,58 +0,0 @@
|
|
|
-# Requirements Document
|
|
|
-
|
|
|
-## Introduction
|
|
|
-
|
|
|
-The GROWI presentation feature (`@growi/presentation` package) statically imports `@marp-team/marp-core` (~524KB) and `@marp-team/marpit` (~372KB) whenever any slide component loads, even when Marp rendering is not needed. This is because both `MarpSlides` and `GrowiSlides` components statically import `growi-marpit.ts`, which instantiates Marp objects at module scope.
|
|
|
-
|
|
|
-The goal is to decouple heavy Marp dependencies so they are only loaded when a page explicitly uses `marp: true` in its frontmatter, reducing the async chunk size for the common non-Marp slide rendering path and improving overall bundle efficiency.
|
|
|
-
|
|
|
-## Requirements
|
|
|
-
|
|
|
-### Requirement 1: Decouple GrowiSlides from Marp Runtime Dependencies
|
|
|
-
|
|
|
-**Objective:** As a developer, I want GrowiSlides to render without loading `@marp-team/marp-core` or `@marp-team/marpit`, so that non-Marp slide pages do not incur unnecessary module loading overhead.
|
|
|
-
|
|
|
-#### Acceptance Criteria
|
|
|
-1. The `@growi/presentation` build output for GrowiSlides shall not contain import references to `@marp-team/marp-core` or `@marp-team/marpit`.
|
|
|
-2. When a slide page without `marp: true` is rendered, the Presentation module shall render GrowiSlides without loading `@marp-team/marp-core` or `@marp-team/marpit` modules.
|
|
|
-3. The Presentation module shall provide the Marp base CSS (previously generated by `marpit.render('')`) as pre-extracted static string constants, so that GrowiSlides can apply Marp container styling without a runtime Marp dependency.
|
|
|
-4. The `MARP_CONTAINER_CLASS_NAME` constant shall be defined in a shared constants module, not in `growi-marpit.ts`, to avoid transitive Marp imports.
|
|
|
-
|
|
|
-### Requirement 2: Dynamic Loading of MarpSlides
|
|
|
-
|
|
|
-**Objective:** As a developer, I want MarpSlides to be loaded dynamically (on demand), so that the Marp rendering engine is only fetched when a page actually uses Marp.
|
|
|
-
|
|
|
-#### Acceptance Criteria
|
|
|
-1. When a slide page with `marp: true` is rendered, the Presentation module shall dynamically load MarpSlides and render Marp content correctly.
|
|
|
-2. While MarpSlides is loading, the Presentation module shall display a loading indicator (Suspense fallback).
|
|
|
-3. When a slide page without `marp: true` is rendered, the Presentation module shall not trigger the dynamic import of MarpSlides.
|
|
|
-
|
|
|
-### Requirement 3: Build-Time CSS Extraction
|
|
|
-
|
|
|
-**Objective:** As a developer, I want the Marp base CSS to be extracted at build time via an automated script, so that the pre-extracted CSS stays synchronized with the installed `@marp-team/marp-core` version.
|
|
|
-
|
|
|
-#### Acceptance Criteria
|
|
|
-1. The `@growi/presentation` package shall include a build-time script that generates Marp base CSS constants by invoking `slideMarpit.render('')` and `presentationMarpit.render('')`.
|
|
|
-2. When `pnpm run build` is executed for `@growi/presentation`, the build pipeline shall regenerate the CSS constants before compiling source files.
|
|
|
-3. The generated CSS constants file shall be committed to the repository so that `dev` mode works without running the extraction script first.
|
|
|
-
|
|
|
-### Requirement 4: Functional Equivalence
|
|
|
-
|
|
|
-**Objective:** As a user, I want the presentation feature to behave identically after optimization, so that existing Marp and non-Marp presentations continue to work without regression.
|
|
|
-
|
|
|
-#### Acceptance Criteria
|
|
|
-1. When a page with `marp: true` frontmatter is viewed inline, the Presentation module shall render Marp slides with correct styling.
|
|
|
-2. When a page with `slide: true` frontmatter (without `marp: true`) is viewed inline, the Presentation module shall render GrowiSlides with correct styling.
|
|
|
-3. When the presentation modal is opened for a Marp page, the Presentation module shall render Marp slides in the modal with correct fullscreen behavior.
|
|
|
-4. When the presentation modal is opened for a non-Marp slide page, the Presentation module shall render GrowiSlides in the modal with correct fullscreen behavior.
|
|
|
-5. When a non-slide page is viewed, the Presentation module shall not load any slide rendering components (existing lazy-loading behavior preserved).
|
|
|
-
|
|
|
-### Requirement 5: Build Verification
|
|
|
-
|
|
|
-**Objective:** As a developer, I want to verify that the optimization achieves its goal, so that Marp module separation can be confirmed in CI and during development.
|
|
|
-
|
|
|
-#### Acceptance Criteria
|
|
|
-1. The `@growi/presentation` package shall build successfully with `pnpm run build`.
|
|
|
-2. The `@growi/app` package shall build successfully with `turbo run build --filter @growi/app`.
|
|
|
-3. The built `GrowiSlides.js` output shall contain no references to `@marp-team/marp-core` or `@marp-team/marpit`.
|
|
|
-4. The built `Slides.js` output shall contain a dynamic `import()` expression for `MarpSlides`.
|