reshow-runtime

raw JSON →
0.17.15 verified Sat Apr 25 auth: no javascript

Babel runtime alternative designed to replace @babel/runtime in projects using the Reshow ecosystem. Current stable version: 0.17.15. Release cadence: irregular; major breaking changes in v0.16.0 (switched to createReducer for all stores) and v0.13-beta (moved urlDispatch/UrlReturn to reshow-url). Key differentiators: lighter footprint, supports optional chaining (?.) and nullish coalescing (??), and provides helper functions for React/Redux-like patterns. Not recommended for projects outside the Reshow framework.

error Error: Cannot find module 'reshow-runtime'
cause Package not installed or not in node_modules.
fix
Run npm install reshow-runtime or yarn add reshow-runtime.
error TypeError: createReducer is not a function
cause Importing createReducer incorrectly, likely as default export.
fix
Use import { createReducer } from 'reshow-runtime';
error SyntaxError: Unexpected identifier
cause Using CommonJS require() in ESM-only version (v0.16.0+).
fix
Switch to import { ... } from 'reshow-runtime';
breaking In v0.16.0, all stores must now use createReducer. Old store patterns (e.g., createStore with handlers) are removed.
fix Migrate store definitions to use createReducer with handler maps.
breaking In v0.13-beta, urlDispatch and UrlReturn moved from reshow-runtime to reshow-url.
fix Install reshow-url and import urlDispatch/UrlReturn from there instead.
deprecated CommonJS require() is no longer supported; package is ESM-only from v0.16.0.
fix Use import syntax. If using Node.js, ensure "type": "module" or use .mjs extension.
npm install reshow-runtime
yarn add reshow-runtime
pnpm add reshow-runtime

Demonstrates use of createReducer and toMap from reshow-runtime with a simple counter reducer.

import { createReducer, toMap } from 'reshow-runtime';

const initialState = { count: 0 };
const reducer = createReducer({
  increment: (state) => ({ count: state.count + 1 }),
  decrement: (state) => ({ count: state.count - 1 }),
}, initialState);

const state = { count: 0 };
const newState = reducer(state, { type: 'increment' });
console.log(newState); // { count: 1 }

const immutableObject = { a: { b: 1 } };
const jsObject = toMap(immutableObject);
console.log(jsObject.a.b); // 1 (JS object instead of immutable Map)