Skip to content

Conversation

@webJose
Copy link
Contributor

@webJose webJose commented Sep 14, 2025

Fixes #42.

@webJose webJose requested a review from Copilot September 14, 2025 03:09
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Adds support for extension packages to the routing library by introducing new abstractions and refactoring the Location implementation architecture.

  • Exposes the core initialization function (initCore) for extension packages to use
  • Extracts History API interactions into separate HistoryApi implementations for better modularity
  • Refactors Location classes to use composition with HistoryApi instances instead of direct browser API integration

Reviewed Changes

Copilot reviewed 21 out of 21 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/testing/test-utils.ts Adds RoutingUniverse type definition, removes popstate triggering from setUrl, adds triggerHashChange utility
src/lib/types.ts Adds HistoryApi and FullModeHistoryApi interfaces, extends Location interface with history navigation methods
src/lib/init.ts Extracts initCore function for extension package use, updates routing options handling
src/lib/index.test.ts Updates expected exports to include initCore
src/lib/core/options.ts Adds setRoutingOptions function for programmatic configuration
src/lib/core/index.ts Exports new Location and HistoryApi classes for extension package consumption
src/lib/core/index.test.ts Updates expected exports list for new classes
src/lib/core/StockHistoryApi.svelte.ts New standard HistoryApi implementation using browser APIs
src/lib/core/StockHistoryApi.svelte.test.ts Comprehensive tests for StockHistoryApi functionality
src/lib/core/RouterEngine.svelte.ts Improves type annotations for state properties
src/lib/core/RouterEngine.svelte.test.ts Formatting improvements and removes unused import
src/lib/core/LocationState.svelte.ts Enhances base class with flexible initialization and state normalization
src/lib/core/LocationState.svelte.test.ts Updates tests for new constructor parameters and normalization behavior
src/lib/core/LocationLite.svelte.ts Refactors to use HistoryApi composition instead of direct browser integration
src/lib/core/LocationLite.svelte.test.ts Simplifies tests to focus on HistoryApi delegation
src/lib/core/LocationFull.ts Refactors to use FullModeHistoryApi composition
src/lib/core/LocationFull.test.ts Updates tests for new composition-based architecture
src/lib/core/InterceptedHistoryApi.svelte.ts New HistoryApi implementation with navigation event interception
src/lib/core/InterceptedHistoryApi.svelte.test.ts Comprehensive tests for navigation interception functionality
README.md Updates line count and mentions extension package support
AGENTS.md Documents new extension package architecture and testing conventions
Comments suppressed due to low confidence (1)

src/lib/core/LocationState.svelte.test.ts:1

  • The test expects a specific warning message, but the implementation now generates different messages based on context ('Using known valid state.' vs 'Resetting to clean state.'). This assertion should be updated to match the actual behavior or made more flexible.
import { describe, test, expect, beforeEach, vi } from 'vitest';

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@webJose webJose merged commit 5a9ebc4 into main Sep 14, 2025
1 check passed
@webJose webJose deleted the JP/extensions branch September 14, 2025 03:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Set up infrastructure to allow the creation of extension packages

2 participants