Commit Graph

4 Commits

Author SHA1 Message Date
Copilot
6babcea029
refactor: decouple plugins from direct utility imports (#4)
* Initial plan

* Extend PluginUtilities with missing path and escape utilities

Co-authored-by: saberzero1 <8161064+saberzero1@users.noreply.github.com>

* Migrate transformers to use ctx.utils instead of direct imports

Co-authored-by: saberzero1 <8161064+saberzero1@users.noreply.github.com>

* Migrate emitters to use ctx.utils - part 1 (helpers, aliases, assets, contentIndex, contentPage, tagPage, static, favicon)

Co-authored-by: saberzero1 <8161064+saberzero1@users.noreply.github.com>

* Complete emitter migration to ctx.utils - all emitters decoupled

Co-authored-by: saberzero1 <8161064+saberzero1@users.noreply.github.com>

* Add comment explaining double-unescaping in test helper mock

This mirrors the production implementation in util/escape.ts which has the same pattern. The CodeQL alert is a known limitation of simple HTML unescaping that exists in the production code as well.

Co-authored-by: saberzero1 <8161064+saberzero1@users.noreply.github.com>

* Fix type safety: change join() return type to string and simplify casts

- Changed PluginUtilities.path.join() return type from FilePath to string to allow proper single-cast at call sites
- Removed unsafe double-casts (as unknown as FullSlug) in favor of single casts (as FullSlug)
- Fixed ogImage.tsx to use consistent destructuring pattern (ctx.cfg.configuration instead of cfg.configuration)
- Updated implementation in plugin-context.ts and test-helpers.ts

This addresses all code review feedback about type safety issues.

Co-authored-by: saberzero1 <8161064+saberzero1@users.noreply.github.com>

* Fix test mock implementations to match production code behavior

- Fixed getAllSegmentPrefixes to return cumulative prefixes (e.g., ["a", "a/b", "a/b/c"])
- Fixed isRelativeURL to include all three validation conditions
- Fixed stripSlashes to use substring(1) instead of replace(/^\/+/)
- Fixed slugTag to properly handle hierarchical tags with sluggify logic
- Fixed split to handle PDF files and anchor normalization
- Fixed HTML entity &#39; to &#039; for consistency
- Changed QUARTZ imports to use utils.path.QUARTZ for consistency
- Fixed favicon.ts to pass full ctx instead of reconstructing partial object

All mocks now accurately reflect production code behavior for reliable testing.

Co-authored-by: saberzero1 <8161064+saberzero1@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: saberzero1 <8161064+saberzero1@users.noreply.github.com>
2025-11-16 19:24:30 +01:00
Jacky Zhao
d9159e0ac9
feat: make og images an emitter to properly await image generation (#1826)
* checkpoint

* make emitters async generators

* fix

* custom font spec

* replace spinner, use disk cache for fonts

* use readline instead

* make og images look nice
2025-03-13 10:27:46 -07:00
Aaron Pham
330e322e48
feat(fonts): fetch before build (#817)
* feat: fetch google fonts before build

Signed-off-by: Aaron <29749331+aarnphm@users.noreply.github.com>

* Update quartz/plugins/emitters/componentResources.ts

* fix: fetching wolff2

Signed-off-by: Aaron <29749331+aarnphm@users.noreply.github.com>

* chore: remove request stylesheet

Signed-off-by: Aaron <29749331+aarnphm@users.noreply.github.com>

* fix: race condition

Signed-off-by: Aaron <29749331+aarnphm@users.noreply.github.com>

* chore: remove preconnect for static fonts

since we are already downloading fonts into public folder

Signed-off-by: Aaron <29749331+aarnphm@users.noreply.github.com>

* chore: remove deadcode

Signed-off-by: Aaron <29749331+aarnphm@users.noreply.github.com>

* chore: add options to gate for cdn caching

Signed-off-by: Aaron <29749331+aarnphm@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: Jacky Zhao <j.zhao2k19@gmail.com>

* chore: apply jacky's suggestion

Co-authored-by: Jacky Zhao <j.zhao2k19@gmail.com>

* chore: add docs and only use one promise

Signed-off-by: Aaron <29749331+aarnphm@users.noreply.github.com>

* fix: fmt

Signed-off-by: Aaron <29749331+aarnphm@users.noreply.github.com>

* chore: remove deadcode

* chore: final touches

Co-authored-by: Jacky Zhao <j.zhao2k19@gmail.com>

* revert: changes in theme.ts

* fix: styles and remove deadcode

Signed-off-by: Aaron <29749331+aarnphm@users.noreply.github.com>

---------

Signed-off-by: Aaron <29749331+aarnphm@users.noreply.github.com>
Co-authored-by: Jacky Zhao <j.zhao2k19@gmail.com>
2024-02-08 02:52:55 -05:00
kabirgh
ce3dd0923b
refactor: move emit from callback to helper file function (#704)
* Change emit from callback to helpers file function

* Update docs, remove commented code, improve type sig
2024-01-18 10:56:14 -08:00