Skip to content

Conversation

@ps2-controller
Copy link
Owner

snyk-top-banner

Snyk has created this PR to upgrade chess.js from 1.0.0-alpha.0 to 1.0.0.

ℹ️ Keep your dependencies up-to-date. This makes it easier to fix existing vulnerabilities and to more quickly identify and fix newly disclosed vulnerabilities when they affect your project.


  • The recommended version is 11 versions ahead of your current version.

  • The recommended version was released 23 days ago.

Release notes
Package name: chess.js
  • 1.0.0 - 2025-01-11

    v1.0.0

    A big thank you to all the contributors that helped make this release possible! This is a major version update and there are many new features and breaking changes. Please read below for more info.

    Typescript

    chess.js has been rewritten in TypeScript. Exported types are as follows:

    • Chess class
    • Move class
    • Piece
    • Color
    • Square
    • PieceSymbol

    New Methods

    • attackers(square, color) - returns a list of squares occupied by pieces of color that are attacking the given square
    • getCastlingRights(color) - returns { k: boolean, q: boolean } indicating castling rights for color
    • setCastlingRights(color, rights)
    • isAttacked(square, color) - returns true if square is attacked by color
    • isDrawByFiftyMoves()
    • moveNumber()
    • setHeader(key, value), removeHeader(key), getHeaders()
    • removeComment(), removeComments()

    Breaking Changes

    Exceptions instead of null

    The following functions no longer return null when an error occurs. Instead, they now throw exceptions to provide the user with more detailed error information.

    • .load()
    • .loadPgn()
    • .move()
    • Chess() constructor

    Function Names

    The functions below have been converted to camel-case:

    • game_over -> isGameOver
    • in_check -> isCheck
    • in_checkmate -> isCheckmate
    • in_draw -> isDraw
    • is_stalemate -> isStalemate
    • in_threefold_repetition -> isThreefoldRepetition
    • insufficient_material -> isInsufficientMaterial
    • load_pgn -> loadPgn
    • set_comment -> setComment
    • get_comment -> getComment
    • get_comments -> getComments
    • delete_comment -> deleteComment
    • delete_comments -> deleteComments
    • validate_fen -> validateFen

    Function Arguments and Return Values

    The arguments and return values for the following functions have changed:

    • load_pgn(pgn, { sloppy: true }) becomes loadPgn(pgn) (strict defaults to false)
    • move('Nb7', { sloppy: true }) becomes moves('Nb7')
    • clear(true) should now be written as clear({ preserveHeader: true })
    • load(fen, true) should now be written as load(fen, { preserveHeader: true })
    • validateFen(fen) now returns { ok: boolean, error?: string }

    Deprecations

    • The flags field in the Move object is deprecated. Use the new helper methods below to determine the move type:
      • .isCapture() - is the move a regular capture? NOTE: this is false for an en-passant
      • .isEnPassant() - is the move an en-passant capture?
      • .isBigPawn() - is the move a 2-rank pawn move?
      • .isPromotion() - is the move a pawn promotion?
      • .isKingsideCastle() - is the move a kingside castle?
      • .isQueensideCastle() - is the move a queenside castle?
    • The header function has been deprecated in favor of setHeader and getHeaders
    • The deleteComment and deleteComments functions have deprecated in favor of removeComment and removeComments

    Improvements

    Bug Fixes

  • 1.0.0-beta.9 - 2025-01-11

    1.0.0-beta.9

  • 1.0.0-beta.8 - 2024-02-24

    1.0.0-beta.8

  • 1.0.0-beta.7 - 2023-12-17

    Breaking Changes

    These two changes only impact users that retain PGN headers when calling .clear or .load.

    • clear(true) should now be written as clear({ preserveHeader: true })
    • load(myFen, true) should now be written as load(myFen, { preserveHeader: true })

    Enhancements

    Bug Fixes

    • Fix README shield links (@ JamJomJim - #416)
    • Fix three-fold repetition to only return true if the immediate position has been repeated 3 times (@ gavin-lb - #144)
    • Update internal king cache when overwriting the king via put() (@ Manukyanq #426)
    • Always clear Setup and FEN when calling .clear() (@ jhlywa - be03fe0)
  • 1.0.0-beta.6 - 2023-05-16

    Enhancements

  • 1.0.0-beta.5 - 2023-04-18

    Enhancements

    Bug Fixes

    • Revert module type to CommonJS (@ jhlywa)
  • 1.0.0-beta.4 - 2023-03-18

    Enhancements

    • Add before and after FEN to Move object (@ jhlywa)

    Bug Fixes

  • 1.0.0-beta.3 - 2023-02-03

    Bug Fixes

  • 1.0.0-beta.2 - 2023-01-19

    Bug Fixes

  • 1.0.0-beta.1 - 2023-01-15

    Bug Fixes

    • Remove postinstall script
    • Add "types": "dist/chess.d.ts" entry to package.json
  • 1.0.0-beta.0 - 2023-01-14
  • 1.0.0-alpha.0 - 2022-09-05
from chess.js GitHub release notes

Important

  • Check the changes in this PR to ensure they won't cause issues with your project.
  • This PR was automatically created by Snyk using the credentials of a real user.

Note: You are seeing this because you or someone else with access to this repository has authorized Snyk to open upgrade PRs.

For more information:

Snyk has created this PR to upgrade chess.js from 1.0.0-alpha.0 to 1.0.0.

See this package in npm:
chess.js

See this project in Snyk:
https://app.snyk.io/org/ps2-controller/project/a6c1530c-985a-466f-929d-287d13198dae?utm_source=github&utm_medium=referral&page=upgrade-pr
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.

3 participants