Skip to content

Version 1.1.0#1

Merged
JosunLP merged 21 commits intomainfrom
development
Jan 23, 2026
Merged

Version 1.1.0#1
JosunLP merged 21 commits intomainfrom
development

Conversation

@JosunLP
Copy link
Copy Markdown
Collaborator

@JosunLP JosunLP commented Jan 23, 2026

This pull request introduces a minor update to bQuery.js, adding new features, improving security, and updating documentation and workflows to reflect the expanded modular architecture. The most important changes include new core and reactive APIs, enhanced component lifecycle hooks, significant security improvements, and updates to documentation and build/deploy workflows.

Feature Additions and API Changes

  • Added new core DOM methods: delegate, wrap, unwrap, replaceWith, scrollTo, serialize, and serializeString for improved DOM manipulation and event handling.
  • Introduced new reactive primitives: watch, readonly, untrack, type guards isSignal/isComputed, and ReadonlySignal<T> type for more robust reactivity and immutability.
  • Enhanced component system with new lifecycle hooks (beforeMount, beforeUpdate, onError) and prop validation via the validator property.

Security Improvements

  • Extended HTML sanitizer to block new XSS vectors (SVG, MathML, template), added DOM clobbering protection, zero-width Unicode stripping in URLs, and fixed prototype pollution in utils.merge().
  • Updated documentation and examples to highlight these security features and usage patterns.

Documentation and Architecture Updates

  • Added .github/copilot-instructions.md with a comprehensive project overview, architecture, module structure, conventions, and common pitfalls.
  • Updated documentation files (README.md, docs/definition.md, docs/guide/agents.md) to reflect new APIs, security practices, and modular import paths (@bquery/bquery/...). [1] [2]

Build, Testing, and Deployment

  • Updated VitePress config to support dynamic base URLs and added new navigation links for modular docs. [1] [2]
  • Enhanced GitHub Actions workflow: added jobs for building docs and deploying to GitHub Pages, with artifact upload and environment configuration. [1] [2]

Changelog and Versioning

  • Updated CHANGELOG.md for version 1.1.0, detailing all new features, changes, and security fixes.

- Added optional `validator` function to prop definitions for value validation.
- Introduced lifecycle hooks: `beforeMount`, `beforeUpdate`, and `onError` for better component management.
- Updated documentation to reflect new prop validation and lifecycle features.

feat: extend reactive module with watch and readonly utilities

- Implemented `watch` function to observe signal changes with access to old values.
- Added `readonly` function to create read-only views of signals.
- Enhanced utility functions with type guards for signals and computed values.

fix: improve security measures in sanitize function

- Added checks to remove dangerous tags even if explicitly allowed.
- Implemented protections against DOM clobbering via reserved IDs and names.
- Enhanced URL normalization to prevent bypass attempts using Unicode characters.

feat: introduce new methods in BQueryElement for DOM manipulation

- Added `wrap`, `unwrap`, `replaceWith`, and `scrollTo` methods for easier element manipulation.
- Implemented `delegate` method for efficient event handling on child elements.

test: add comprehensive tests for new features and security enhancements

- Created tests for new methods in BQueryElement.
- Added tests for `watch` and `readonly` functionalities in the reactive module.
- Implemented tests for security improvements in the sanitize function and prototype pollution prevention in utils.
@JosunLP JosunLP added this to the 1.1.0 milestone Jan 23, 2026
@JosunLP JosunLP self-assigned this Jan 23, 2026
Copilot AI review requested due to automatic review settings January 23, 2026 18:14
Copy link
Copy Markdown
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

This pull request introduces version 1.1.0 of bQuery.js, a minor version update that adds new DOM manipulation methods, enhanced reactive primitives, extended component lifecycle hooks, and significant security improvements. The changes also include comprehensive documentation updates and GitHub Actions workflow enhancements for automated documentation deployment.

Changes:

  • Added 7 new DOM manipulation methods (delegate, wrap, unwrap, replaceWith, scrollTo, serialize, serializeString) to core API
  • Introduced 5 new reactive primitives (watch, readonly, untrack, isSignal, isComputed) with TypeScript type support
  • Extended component system with 3 new lifecycle hooks (beforeMount, beforeUpdate, onError) and prop validation
  • Enhanced HTML sanitizer with protection against SVG/MathML XSS, DOM clobbering, and Unicode bypass attacks
  • Updated documentation across all modules to reflect new APIs and modular import paths
  • Added GitHub Pages deployment workflow and VitePress configuration for dynamic base URLs

Reviewed changes

Copilot reviewed 29 out of 32 changed files in this pull request and generated 11 comments.

Show a summary per file
File Description
src/reactive/signal.ts Implemented watch, readonly, untrack primitives; optimized observer stack to O(1) operations; added type guards
src/core/element.ts Added wrap, unwrap, replaceWith, scrollTo, delegate, serialize, serializeString methods for enhanced DOM manipulation
src/core/collection.ts Added delegate method for event delegation across element collections
src/component/index.ts Added beforeMount, beforeUpdate, onError lifecycle hooks and validator property for prop validation
src/security/sanitize.ts Extended dangerous tags list, added DOM clobbering protection, enhanced URL normalization with Unicode bypass prevention
src/core/utils.ts Added prototype pollution protection to merge() with isPrototypePollutionKey check
tests/*.test.ts Added comprehensive test suites for new security features, reactive primitives, and DOM methods
docs/guide/*.md Updated all documentation to reflect new features, security enhancements, and corrected import paths
package.json Version bump to 1.1.0 and dependency updates for 2026
.github/workflows/npm-publish.yml Added docs build and GitHub Pages deployment jobs
CHANGELOG.md Documented all new features, changes, and security fixes for 1.1.0

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

JosunLP and others added 13 commits January 23, 2026 19:33
This workflow automatically marks stale issues and pull requests based on inactivity, helping to manage repository maintenance.
Add stale.yml workflow for managing inactive issues and PRs
Add GitHub Actions workflow to summarize new issues
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Add CodeQL analysis workflow configuration
- Updated `beforeUpdate` to accept props for better control during updates.
- Added support for `beforeMount` lifecycle hook.
- Implemented prop validation in component definition.
- Introduced delegated event handling in BQueryElement with `delegate` and `undelegate` methods.
- Expanded security measures by adding more dangerous tags and reserved IDs in sanitizer.
- Added tests for lifecycle hooks and prop validation to ensure correct behavior.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
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

Copilot reviewed 33 out of 37 changed files in this pull request and generated 4 comments.

Comments suppressed due to low confidence (1)

README.md:194

  • This user-card example interpolates props.username directly into an html template that will end up in innerHTML, but html does not escape or sanitize its values. If username ever contains attacker-controlled HTML, following this example will render that payload verbatim in the DOM and allow XSS (e.g., <script> or event-handler attributes). Consider updating the docs to show the safeHtml/sanitizeHtml usage for untrusted props (or otherwise emphasize that html must not be used with raw user input) so component templates are safe-by-default.
import { component, html } from '@bquery/bquery/component';

component('user-card', {
  props: {
    username: { type: String, required: true },
    age: { type: Number, validator: (v) => v >= 0 && v <= 150 },
  },
  // Extended lifecycle hooks
  beforeMount() {
    console.log('About to mount');
  },
  connected() {
    console.log('Mounted');
  },
  beforeUpdate(props) {
    // Return false to prevent update
    return props.username !== '';
  },
  onError(error) {
    console.error('Component error:', error);
  },
  render({ props }) {
    return html`<div>Hello ${props.username}</div>`;
  },

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

JosunLP and others added 2 commits January 23, 2026 20:43
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@JosunLP JosunLP merged commit b27dbaf into main Jan 23, 2026
8 checks passed
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.

2 participants