From 46da2c4ed6a2d7b4bc5e3165a372de11d9f0cc00 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 28 Dec 2021 15:37:12 +0000 Subject: [PATCH] Version Packages --- .changeset/breezy-needles-burn.md | 32 ---------------- .changeset/chilled-dryers-dream.md | 14 ------- .changeset/famous-dryers-build.md | 5 --- .changeset/gentle-meals-teach.md | 5 --- .changeset/green-carpets-report.md | 8 ---- .changeset/perfect-paws-explode.md | 5 --- .changeset/tame-ants-eat.md | 5 --- packages/core/CHANGELOG.md | 57 +++++++++++++++++++--------- packages/core/package.json | 2 +- packages/xstate-fsm/CHANGELOG.md | 6 +++ packages/xstate-fsm/package.json | 2 +- packages/xstate-inspect/CHANGELOG.md | 35 +++++++++++++++++ packages/xstate-inspect/package.json | 2 +- packages/xstate-scxml/package.json | 2 +- 14 files changed, 85 insertions(+), 95 deletions(-) delete mode 100644 .changeset/breezy-needles-burn.md delete mode 100644 .changeset/chilled-dryers-dream.md delete mode 100644 .changeset/famous-dryers-build.md delete mode 100644 .changeset/gentle-meals-teach.md delete mode 100644 .changeset/green-carpets-report.md delete mode 100644 .changeset/perfect-paws-explode.md delete mode 100644 .changeset/tame-ants-eat.md diff --git a/.changeset/breezy-needles-burn.md b/.changeset/breezy-needles-burn.md deleted file mode 100644 index e95eb569d8..0000000000 --- a/.changeset/breezy-needles-burn.md +++ /dev/null @@ -1,32 +0,0 @@ ---- -'@xstate/inspect': minor ---- - -A serializer can now be specified as an option for `inspect(...)` in the `.serialize` property. It should be a [replacer function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#the_replacer_parameter): - -```js -// ... - -inspect({ - // ... - serialize: (key, value) => { - if (value instanceof Map) { - return 'map'; - } - - return value; - } -}); - -// ... - -// Will be inspected as: -// { -// type: 'EVENT_WITH_MAP', -// map: 'map' -// } -someService.send({ - type: 'EVENT_WITH_MAP', - map: new Map() -}); -``` diff --git a/.changeset/chilled-dryers-dream.md b/.changeset/chilled-dryers-dream.md deleted file mode 100644 index f0099c5cab..0000000000 --- a/.changeset/chilled-dryers-dream.md +++ /dev/null @@ -1,14 +0,0 @@ ---- -'xstate': minor ---- - -The `sendTo(actorRef, event)` action creator has been introduced. It allows you to specify the recipient actor ref of an event first, so that the event can be strongly typed against the events allowed to be received by the actor ref: - -```ts -// ... -entry: sendTo( - (ctx) => ctx.someActorRef, - { type: 'EVENT_FOR_ACTOR' } -), -// ... -``` diff --git a/.changeset/famous-dryers-build.md b/.changeset/famous-dryers-build.md deleted file mode 100644 index d5d29ef4c5..0000000000 --- a/.changeset/famous-dryers-build.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'xstate': patch ---- - -The `state.can(...)` method no longer unnecessarily executes `assign()` actions and instead determines if a given event will change the state by reading transition data before evaluating actions. diff --git a/.changeset/gentle-meals-teach.md b/.changeset/gentle-meals-teach.md deleted file mode 100644 index e3e56a6a31..0000000000 --- a/.changeset/gentle-meals-teach.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'xstate': patch ---- - -Fixed an issue with stopped children sometimes starting their own child actors. This could happen when the child was stopped synchronously (for example by its parent) when transitioning to an invoking state. diff --git a/.changeset/green-carpets-report.md b/.changeset/green-carpets-report.md deleted file mode 100644 index 6fb1b5a4aa..0000000000 --- a/.changeset/green-carpets-report.md +++ /dev/null @@ -1,8 +0,0 @@ ---- -'@xstate/fsm': patch ---- - -author: @annaghi -pr: #2474 - -Use CommonJS files as `package.json#main` (instead of UMD files) as this plays better with native ESM loader in node (and by extension fixes compatibility issues with projects like [SvelteKit](https://kit.svelte.dev/)). diff --git a/.changeset/perfect-paws-explode.md b/.changeset/perfect-paws-explode.md deleted file mode 100644 index 20de83c6a6..0000000000 --- a/.changeset/perfect-paws-explode.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'xstate': patch ---- - -Fixed an issue with some exit handlers being executed more than once when stopping a machine. diff --git a/.changeset/tame-ants-eat.md b/.changeset/tame-ants-eat.md deleted file mode 100644 index eeb3f30825..0000000000 --- a/.changeset/tame-ants-eat.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@xstate/inspect': minor ---- - -The package has been upgraded to be compatible with `ws@8.x`. The WS server created server-side has to be of a compatible version now. diff --git a/packages/core/CHANGELOG.md b/packages/core/CHANGELOG.md index 7800b342e5..144b2d2758 100644 --- a/packages/core/CHANGELOG.md +++ b/packages/core/CHANGELOG.md @@ -1,5 +1,28 @@ # xstate +## 4.27.0 + +### Minor Changes + +- [#2800](https://github.com/statelyai/xstate/pull/2800) [`759a90155`](https://github.com/statelyai/xstate/commit/759a9015512bbf532d7044afe6a889c04dc7edf6) Thanks [@davidkpiano](https://github.com/davidkpiano)! - The `sendTo(actorRef, event)` action creator has been introduced. It allows you to specify the recipient actor ref of an event first, so that the event can be strongly typed against the events allowed to be received by the actor ref: + + ```ts + // ... + entry: sendTo( + (ctx) => ctx.someActorRef, + { type: 'EVENT_FOR_ACTOR' } + ), + // ... + ``` + +### Patch Changes + +- [#2804](https://github.com/statelyai/xstate/pull/2804) [`f3caecf5a`](https://github.com/statelyai/xstate/commit/f3caecf5ad384cfe2a843c26333aaa46a77ece68) Thanks [@davidkpiano](https://github.com/davidkpiano)! - The `state.can(...)` method no longer unnecessarily executes `assign()` actions and instead determines if a given event will change the state by reading transition data before evaluating actions. + +* [#2856](https://github.com/statelyai/xstate/pull/2856) [`49c2e9094`](https://github.com/statelyai/xstate/commit/49c2e90945d369e2dfb2e4fc376b3f46714dce09) Thanks [@Andarist](https://github.com/Andarist)! - Fixed an issue with stopped children sometimes starting their own child actors. This could happen when the child was stopped synchronously (for example by its parent) when transitioning to an invoking state. + +- [#2895](https://github.com/statelyai/xstate/pull/2895) [`df5ffce14`](https://github.com/statelyai/xstate/commit/df5ffce14908d0aa8056a56001039dfd260be1a4) Thanks [@Andarist](https://github.com/Andarist)! - Fixed an issue with some exit handlers being executed more than once when stopping a machine. + ## 4.26.1 ### Patch Changes @@ -106,10 +129,10 @@ model.createMachine({ // `ctx` was of type `any` - entry: (ctx) => {}, + entry: ctx => {}, exit: assign({ // `ctx` was of type `unknown` - foo: (ctx) => 42 + foo: ctx => 42 }) }); ``` @@ -285,11 +308,11 @@ const machine = createMachine({ context: { count: 0 }, entry: [ - (ctx) => console.log(ctx.count), // 0 - assign({ count: (ctx) => ctx.count + 1 }), - (ctx) => console.log(ctx.count), // 1 - assign({ count: (ctx) => ctx.count + 1 }), - (ctx) => console.log(ctx.count) // 2 + ctx => console.log(ctx.count), // 0 + assign({ count: ctx => ctx.count + 1 }), + ctx => console.log(ctx.count), // 1 + assign({ count: ctx => ctx.count + 1 }), + ctx => console.log(ctx.count) // 2 ], preserveActionOrder: true }); @@ -298,11 +321,11 @@ const machine = createMachine({ context: { count: 0 }, entry: [ - (ctx) => console.log(ctx.count), // 2 - assign({ count: (ctx) => ctx.count + 1 }), - (ctx) => console.log(ctx.count), // 2 - assign({ count: (ctx) => ctx.count + 1 }), - (ctx) => console.log(ctx.count) // 2 + ctx => console.log(ctx.count), // 2 + assign({ count: ctx => ctx.count + 1 }), + ctx => console.log(ctx.count), // 2 + assign({ count: ctx => ctx.count + 1 }), + ctx => console.log(ctx.count) // 2 ] // preserveActionOrder: false }); @@ -501,7 +524,7 @@ }); const service = interpret(machine) - .onTransition((state) => { + .onTransition(state => { // Read promise value synchronously const resolvedValue = state.context.promiseRef?.getSnapshot(); // => undefined (if promise not resolved yet) @@ -581,7 +604,7 @@ context: { value: 42 }, on: { INC: { - actions: assign({ value: (ctx) => ctx.value + 1 }) + actions: assign({ value: ctx => ctx.value + 1 }) } } }); @@ -841,7 +864,7 @@ ```js // ... - actions: stop((context) => context.someActor); + actions: stop(context => context.someActor); ``` ### Patch Changes @@ -1079,10 +1102,10 @@ ```js entry: [ choose([ - { cond: (ctx) => ctx > 100, actions: raise('TOGGLE') }, + { cond: ctx => ctx > 100, actions: raise('TOGGLE') }, { cond: 'hasMagicBottle', - actions: [assign((ctx) => ({ counter: ctx.counter + 1 }))] + actions: [assign(ctx => ({ counter: ctx.counter + 1 }))] }, { actions: ['fallbackAction'] } ]) diff --git a/packages/core/package.json b/packages/core/package.json index db00797953..64964a9c98 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "xstate", - "version": "4.26.1", + "version": "4.27.0", "description": "Finite State Machines and Statecharts for the Modern Web.", "main": "lib/index.js", "module": "es/index.js", diff --git a/packages/xstate-fsm/CHANGELOG.md b/packages/xstate-fsm/CHANGELOG.md index f5af40cdce..dff4826882 100644 --- a/packages/xstate-fsm/CHANGELOG.md +++ b/packages/xstate-fsm/CHANGELOG.md @@ -1,5 +1,11 @@ # @xstate/fsm +## 1.6.3 + +### Patch Changes + +- [#2474](https://github.com/davidkpiano/xstate/pull/2474) Thanks [@annaghi](https://github.com/annaghi)! - Use CommonJS files as `package.json#main` (instead of UMD files) as this plays better with native ESM loader in node (and by extension fixes compatibility issues with projects like [SvelteKit](https://kit.svelte.dev/)). + ## 1.6.2 ### Patch Changes diff --git a/packages/xstate-fsm/package.json b/packages/xstate-fsm/package.json index 0325c86b71..83d8cefb7e 100644 --- a/packages/xstate-fsm/package.json +++ b/packages/xstate-fsm/package.json @@ -1,6 +1,6 @@ { "name": "@xstate/fsm", - "version": "1.6.2", + "version": "1.6.3", "description": "XState for finite state machines", "keywords": [ "state", diff --git a/packages/xstate-inspect/CHANGELOG.md b/packages/xstate-inspect/CHANGELOG.md index cc083e56d1..43e6cb65e9 100644 --- a/packages/xstate-inspect/CHANGELOG.md +++ b/packages/xstate-inspect/CHANGELOG.md @@ -1,5 +1,40 @@ # @xstate/inspect +## 0.6.0 + +### Minor Changes + +- [#2640](https://github.com/statelyai/xstate/pull/2640) [`c73dfd655`](https://github.com/statelyai/xstate/commit/c73dfd655525546e59f00d0be88b80ab71239427) Thanks [@davidkpiano](https://github.com/davidkpiano)! - A serializer can now be specified as an option for `inspect(...)` in the `.serialize` property. It should be a [replacer function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#the_replacer_parameter): + + ```js + // ... + + inspect({ + // ... + serialize: (key, value) => { + if (value instanceof Map) { + return 'map'; + } + + return value; + } + }); + + // ... + + // Will be inspected as: + // { + // type: 'EVENT_WITH_MAP', + // map: 'map' + // } + someService.send({ + type: 'EVENT_WITH_MAP', + map: new Map() + }); + ``` + +* [#2894](https://github.com/statelyai/xstate/pull/2894) [`8435c5b84`](https://github.com/statelyai/xstate/commit/8435c5b841e318c5d35dfea65242246dfb4b34f8) Thanks [@Andarist](https://github.com/Andarist)! - The package has been upgraded to be compatible with `ws@8.x`. The WS server created server-side has to be of a compatible version now. + ## 0.5.2 ### Patch Changes diff --git a/packages/xstate-inspect/package.json b/packages/xstate-inspect/package.json index 2425e3b5b1..5ddc626553 100644 --- a/packages/xstate-inspect/package.json +++ b/packages/xstate-inspect/package.json @@ -1,6 +1,6 @@ { "name": "@xstate/inspect", - "version": "0.5.2", + "version": "0.6.0", "description": "XState inspection utilities", "keywords": [ "state", diff --git a/packages/xstate-scxml/package.json b/packages/xstate-scxml/package.json index 0ff1fef755..b769c5e9b0 100644 --- a/packages/xstate-scxml/package.json +++ b/packages/xstate-scxml/package.json @@ -35,7 +35,7 @@ }, "dependencies": { "xml-js": "^1.6.11", - "xstate": "^4.26.1" + "xstate": "^4.27.0" }, "devDependencies": { "@scion-scxml/test-framework": "^2.0.15",