Merged
Conversation
* Füge Logo zur Konfiguration und Kopfzeile der VitePress-Dokumentation hinzu * Add tests for router, store, and view modules; update Vite config for new modules - Created `router.test.ts` to test router module exports and functionality. - Created `store.test.ts` to test store creation, state management, actions, and persistence. - Created `view.test.ts` to test view rendering, directives, and template creation. - Updated `vite.config.ts` to include new router, store, and view modules for bundling. * Update changelog and README to document new Router, Store, and View modules; bump version to 1.2.0 * Fix regex in bq-for directive to prevent ReDoS by requiring non-whitespace start * feat(router): enhance query parameter handling and add multi-value support - Updated the query parameter structure to support multi-value keys, allowing duplicate query parameters to be stored as arrays. - Enhanced the `parseQuery` function to correctly handle and return multi-value query parameters. - Added tests to verify the correct parsing of single and multiple query parameters, including edge cases with duplicates. feat(signal): add peek method to Computed class - Introduced a `peek` method in the `Computed` class to read the current computed value without tracking dependencies. - This method allows access to the cached value while avoiding unnecessary reactivity. feat(store): implement state proxy for lazy signal reading - Created a state proxy using `Proxy` to lazily read signal values, improving performance by avoiding unnecessary object creation. - Updated the `getCurrentState` method to return a shallow copy of the state for subscriber notifications. fix(view): add security warnings for dynamic expression evaluation - Added security considerations to the view module regarding the use of `new Function()` for evaluating expressions. - Emphasized the importance of using trusted sources for expressions to mitigate security risks. test(router): implement comprehensive router tests with mocked history - Developed a suite of tests for the router module, including route matching, parameter extraction, query string parsing, and navigation functionality. - Mocked the History API to facilitate testing in environments without full browser support. test(store): update store tests to skip localStorage tests if not available - Modified store tests to conditionally skip tests that require localStorage when it is not available, improving test reliability across environments. * fix(router): escape backslashes in path regex to ensure proper processing * docs(store): clarify shallow reactivity and update state mutation examples test(signal): add tests for peek functionality in computed signals
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces version 1.2.0 of bQuery.js, adding three major new modules to the library: Router, Store, and View. These additions transform bQuery into a more comprehensive framework for building modern single-page applications.
Changes:
- Added Router module for SPA client-side routing with History API support, navigation guards, route parameters, and query string parsing
- Added Store module for signal-based state management with getters, actions, subscriptions, and localStorage persistence
- Added View module for declarative DOM bindings using Vue/Alpine-style directives without requiring a compiler
- Added
peek()method to Computed class for reading values without tracking dependencies - Updated build configuration, package exports, documentation, and comprehensive test coverage for all new modules
Reviewed changes
Copilot reviewed 19 out of 19 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| package.json | Version bumped to 1.2.0, added exports for router, store, and view modules |
| vite.config.ts | Added build configuration entries for three new modules |
| src/router/index.ts | New SPA routing module with History API, navigation guards, and route matching |
| src/store/index.ts | New state management module with signal-based reactive stores and persistence |
| src/view/index.ts | New declarative DOM binding module with directive-based templates |
| src/reactive/signal.ts | Added peek() method to Computed class for non-tracking value access |
| src/index.ts, src/full.ts | Updated to export new modules |
| tests/setup.ts | Added mocks for History API, Location, and localStorage for testing |
| tests/router.test.ts | Comprehensive router tests (1093 lines) |
| tests/store.test.ts | Comprehensive store tests (352 lines) |
| tests/view.test.ts | Comprehensive view tests (380 lines) |
| tests/signal.test.ts | Added tests for peek() functionality |
| docs/guide/router.md | Complete documentation for Router module |
| docs/guide/store.md | Complete documentation for Store module with shallow reactivity warnings |
| docs/guide/view.md | Complete documentation for View module with security warnings |
| docs/.vitepress/config.ts | Added logo and navigation entries for new modules |
| README.md | Updated with examples and documentation links for new modules |
| CHANGELOG.md | Detailed changelog entry for version 1.2.0 |
…eichen korrekt zu escapen und die Handhabung von Platzhaltern zu optimieren. Füge umfassende Tests hinzu, um die Funktionalität zu überprüfen.
… der Bibliothek widerzuspiegeln.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…glichen und verbessere die Dokumentation für die Router- und View-Module mit Beispielen zur Schlüssel-Rekonsiliation.
…zu und verbessere die Fehlerbehandlung in den Tests für die View-Module
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Füge Logo zur Konfiguration und Kopfzeile der VitePress-Dokumentation hinzu
Add tests for router, store, and view modules; update Vite config for new modules
router.test.tsto test router module exports and functionality.store.test.tsto test store creation, state management, actions, and persistence.view.test.tsto test view rendering, directives, and template creation.vite.config.tsto include new router, store, and view modules for bundling.Update changelog and README to document new Router, Store, and View modules; bump version to 1.2.0
Fix regex in bq-for directive to prevent ReDoS by requiring non-whitespace start
feat(router): enhance query parameter handling and add multi-value support
parseQueryfunction to correctly handle and return multi-value query parameters.feat(signal): add peek method to Computed class
peekmethod in theComputedclass to read the current computed value without tracking dependencies.feat(store): implement state proxy for lazy signal reading
Proxyto lazily read signal values, improving performance by avoiding unnecessary object creation.getCurrentStatemethod to return a shallow copy of the state for subscriber notifications.fix(view): add security warnings for dynamic expression evaluation
new Function()for evaluating expressions.test(router): implement comprehensive router tests with mocked history
test(store): update store tests to skip localStorage tests if not available
fix(router): escape backslashes in path regex to ensure proper processing
docs(store): clarify shallow reactivity and update state mutation examples
test(signal): add tests for peek functionality in computed signals