reductive-dev-tools
Advanced tools
Comparing version 1.0.1 to 2.0.0
// Generated by BUCKLESCRIPT, PLEASE EDIT WITH CARE | ||
'use strict'; | ||
var List = require("bs-platform/lib/js/list.js"); | ||
var $$Array = require("bs-platform/lib/js/array.js"); | ||
var Curry = require("bs-platform/lib/js/curry.js"); | ||
var React = require("react"); | ||
var Js_dict = require("bs-platform/lib/js/js_dict.js"); | ||
var Reductive = require("reductive/lib/js/src/reductive.js"); | ||
var Belt_Array = require("bs-platform/lib/js/belt_Array.js"); | ||
var Caml_array = require("bs-platform/lib/js/caml_array.js"); | ||
var Belt_Option = require("bs-platform/lib/js/belt_Option.js"); | ||
var Caml_option = require("bs-platform/lib/js/caml_option.js"); | ||
var Caml_exceptions = require("bs-platform/lib/js/caml_exceptions.js"); | ||
var Caml_chrome_debugger = require("bs-platform/lib/js/caml_chrome_debugger.js"); | ||
var Extension$ReductiveDevTools = require("./extension.bs.js"); | ||
var ReduxDevtoolsExtension = require("redux-devtools-extension"); | ||
var Utilities$ReductiveDevTools = require("./utilities.bs.js"); | ||
var evalMethod = ( | ||
function evalMethod(action, obj) { | ||
if (typeof action === 'string') { | ||
return new Function('return ' + action).call(obj); | ||
function createDummyReduxJsStore(options, lockCallback, didToggle) { | ||
var composer = ReduxDevtoolsExtension.composeWithDevTools(options); | ||
var devToolsStoreEnhancer = Curry._1(composer, (function (devToolsEnhancer) { | ||
return devToolsEnhancer; | ||
})); | ||
var dummyReduxJsStoreCreator = function (reducer, initial, param) { | ||
var listeners = /* array */[]; | ||
var state = /* record */Caml_chrome_debugger.record(["contents"], [initial]); | ||
var dispatch = function (action) { | ||
if (action.type === "LOCK_CHANGES") { | ||
Curry._1(lockCallback, action.status); | ||
} else if (action.type === "TOGGLE_ACTION") { | ||
Curry._1(didToggle, /* () */0); | ||
} | ||
function interpretArg(arg) { | ||
return new Function('return ' + arg)(); | ||
}; | ||
function evalArgs(inArgs, restArgs) { | ||
var args = inArgs.map(interpretArg); | ||
if (!restArgs) return args; | ||
var rest = interpretArg(restArgs); | ||
if (Array.isArray(rest)) return args.concat.apply(args, rest); | ||
throw new Error('rest must be an array'); | ||
}; | ||
var args = evalArgs(action.args, action.rest); | ||
return new Function('...args', 'return this.' + action.name + '(...args)').apply(obj, args); | ||
} | ||
); | ||
var connections = { }; | ||
function mutateState(state, store) { | ||
return Curry._1(store[/* dispatch */0], /* `DevToolStateUpdate */Caml_chrome_debugger.polyVar("DevToolStateUpdate", [ | ||
161605709, | ||
state | ||
])); | ||
} | ||
function notifyListeners(store) { | ||
return List.iter((function (listener) { | ||
return Curry._1(listener, /* () */0); | ||
}), store[/* listeners */2]); | ||
} | ||
var PayloadNotFound = Caml_exceptions.create("Connectors-ReductiveDevTools.ConnectionHandler(Store).Exceptions.PayloadNotFound"); | ||
var StateNotFound = Caml_exceptions.create("Connectors-ReductiveDevTools.ConnectionHandler(Store).Exceptions.StateNotFound"); | ||
var ConnectionNotFound = Caml_exceptions.create("Connectors-ReductiveDevTools.ConnectionHandler(Store).Exceptions.ConnectionNotFound"); | ||
function processToogleAction(store, payload, liftedState, meta) { | ||
var skippedActions = liftedState.skippedActionIds; | ||
var stagedActions = liftedState.stagedActionIds; | ||
var computedStates = liftedState.computedStates; | ||
var actionsById = liftedState.actionsById; | ||
var id = Belt_Option.getExn(Caml_option.undefined_to_opt(payload.id)); | ||
var idx = skippedActions.indexOf(id); | ||
var start = stagedActions.indexOf(id); | ||
var skipped = idx !== -1; | ||
if (start === -1) { | ||
return liftedState; | ||
} else { | ||
var initialIdx = start - 1 | 0; | ||
while(skippedActions.includes(initialIdx)) { | ||
initialIdx = initialIdx - 1 | 0; | ||
var newState = Curry._2(reducer, state[0], action); | ||
state[0] = newState; | ||
Belt_Array.forEach(listeners, (function (listener) { | ||
return Curry._1(listener, /* () */0); | ||
})); | ||
return state[0]; | ||
}; | ||
var initialState = Caml_array.caml_array_get(computedStates, initialIdx).state; | ||
mutateState(Utilities$ReductiveDevTools.Serializer.deserializeObject(initialState), store); | ||
var preservedActionCount = meta[/* actionCount */2]; | ||
$$Array.iter((function (i) { | ||
var stagedActionKey = String(Caml_array.caml_array_get(stagedActions, i)); | ||
var targetAction = Belt_Option.getExn(Js_dict.get(actionsById, stagedActionKey)).action; | ||
Curry._1(store[/* dispatch */0], Utilities$ReductiveDevTools.Serializer.deserializeAction(targetAction)); | ||
var newState = store[/* retainedState */1]; | ||
Caml_array.caml_array_get(computedStates, i).state = Utilities$ReductiveDevTools.Serializer.serializeObject(newState); | ||
return /* () */0; | ||
}), Belt_Array.keep(Belt_Array.range(skipped ? start : start + 1 | 0, stagedActions.length - 1 | 0), (function (i) { | ||
if (i === start) { | ||
return true; | ||
} else { | ||
return skippedActions.indexOf(Caml_array.caml_array_get(stagedActions, i)) === -1; | ||
} | ||
}))); | ||
meta[/* actionCount */2] = preservedActionCount; | ||
if (liftedState.currentStateIndex !== (stagedActions.length - 1 | 0)) { | ||
var targetState = Caml_array.caml_array_get(computedStates, liftedState.currentStateIndex).state; | ||
mutateState(Utilities$ReductiveDevTools.Serializer.deserializeObject(targetState), store); | ||
} | ||
if (skipped) { | ||
skippedActions.splice(idx, 1); | ||
} else { | ||
skippedActions.push(id); | ||
} | ||
meta[/* liftedState */0] = Caml_option.some(liftedState); | ||
return liftedState; | ||
} | ||
dispatch({ | ||
type: "@@redux/INIT", | ||
status: false | ||
}); | ||
return { | ||
dispatch: dispatch, | ||
subscribe: (function (listener) { | ||
listeners.push(listener); | ||
return /* () */0; | ||
}), | ||
getState: (function (param) { | ||
return state[0]; | ||
}), | ||
replaceReducer: (function (_reducer) { | ||
return this; | ||
}) | ||
}; | ||
}; | ||
return (function (reducer, initial, _enhancer) { | ||
var reducer$1 = reducer; | ||
var initial$1 = initial; | ||
var enhancer = devToolsStoreEnhancer; | ||
if (enhancer == null) { | ||
return dummyReduxJsStoreCreator(reducer$1, initial$1, /* () */0); | ||
} else { | ||
return Curry._4(enhancer, dummyReduxJsStoreCreator, reducer$1, initial$1, /* () */0); | ||
} | ||
}); | ||
} | ||
var PayloadNotFound$1 = Caml_exceptions.create("Connectors-ReductiveDevTools.ConnectionHandler(Store).Exceptions.PayloadNotFound"); | ||
var StateNotFound$1 = Caml_exceptions.create("Connectors-ReductiveDevTools.ConnectionHandler(Store).Exceptions.StateNotFound"); | ||
function processToogleAction$1(store, payload, liftedState, meta) { | ||
var skippedActions = liftedState.skippedActionIds; | ||
var stagedActions = liftedState.stagedActionIds; | ||
var computedStates = liftedState.computedStates; | ||
var actionsById = liftedState.actionsById; | ||
var id = Belt_Option.getExn(Caml_option.undefined_to_opt(payload.id)); | ||
var idx = skippedActions.indexOf(id); | ||
var start = stagedActions.indexOf(id); | ||
var skipped = idx !== -1; | ||
if (start === -1) { | ||
return liftedState; | ||
} else { | ||
var initialIdx = start - 1 | 0; | ||
while(skippedActions.includes(initialIdx)) { | ||
initialIdx = initialIdx - 1 | 0; | ||
}; | ||
var initialState = Caml_array.caml_array_get(computedStates, initialIdx).state; | ||
store[/* state */0] = Utilities$ReductiveDevTools.Serializer.deserializeObject(initialState); | ||
var preservedActionCount = meta[/* actionCount */2]; | ||
$$Array.iter((function (i) { | ||
var stagedActionKey = String(Caml_array.caml_array_get(stagedActions, i)); | ||
var targetAction = Belt_Option.getExn(Js_dict.get(actionsById, stagedActionKey)).action; | ||
var action = Utilities$ReductiveDevTools.Serializer.deserializeAction(targetAction); | ||
Reductive.Store.dispatch(store, action); | ||
var newState = Reductive.Store.getState(store); | ||
Caml_array.caml_array_get(computedStates, i).state = Utilities$ReductiveDevTools.Serializer.serializeObject(newState); | ||
return /* () */0; | ||
}), Belt_Array.keep(Belt_Array.range(skipped ? start : start + 1 | 0, stagedActions.length - 1 | 0), (function (i) { | ||
if (i === start) { | ||
return true; | ||
} else { | ||
return skippedActions.indexOf(Caml_array.caml_array_get(stagedActions, i)) === -1; | ||
} | ||
}))); | ||
meta[/* actionCount */2] = preservedActionCount; | ||
if (liftedState.currentStateIndex !== (stagedActions.length - 1 | 0)) { | ||
var targetState = Caml_array.caml_array_get(computedStates, liftedState.currentStateIndex).state; | ||
store[/* state */0] = Utilities$ReductiveDevTools.Serializer.deserializeObject(targetState); | ||
notifyListeners(store); | ||
} | ||
if (skipped) { | ||
skippedActions.splice(idx, 1); | ||
} else { | ||
skippedActions.push(id); | ||
} | ||
meta[/* liftedState */0] = Caml_option.some(liftedState); | ||
return liftedState; | ||
} | ||
} | ||
function handle(connection, store, meta, actionCreators, param) { | ||
var initialState = Reductive.Store.getState(store); | ||
Extension$ReductiveDevTools.init(connection, Utilities$ReductiveDevTools.Serializer.serializeObject(initialState)); | ||
Extension$ReductiveDevTools.subscribe(connection, (function (action) { | ||
var match = action.type; | ||
switch (match) { | ||
case "ACTION" : | ||
var action$1 = action; | ||
var store$1 = store; | ||
var actionCreators$1 = actionCreators; | ||
var payload = Utilities$ReductiveDevTools.unwrap(Caml_option.undefined_to_opt(action$1.payload), [ | ||
PayloadNotFound$1, | ||
"action doesn't contain payload while expected" | ||
]); | ||
if (actionCreators$1 !== undefined) { | ||
var action$2 = Curry._2(evalMethod, payload, Caml_option.valFromOption(actionCreators$1)); | ||
return Reductive.Store.dispatch(store$1, action$2); | ||
} else { | ||
function createReduxJsBridgeMiddleware(options, devToolsUpdateActionCreator, actionSerializer, stateSerializer, lockCallback, unit) { | ||
var _bridgedReduxJsStore = /* record */Caml_chrome_debugger.record(["contents"], [undefined]); | ||
var _outstandingActionsCount = /* record */Caml_chrome_debugger.record(["contents"], [0]); | ||
var _extensionLocked = /* record */Caml_chrome_debugger.record(["contents"], [false]); | ||
var _justToggled = /* record */Caml_chrome_debugger.record(["contents"], [false]); | ||
var _didInit = /* record */Caml_chrome_debugger.record(["contents"], [false]); | ||
var actionSerializer$1 = Belt_Option.getWithDefault(actionSerializer, /* record */Caml_chrome_debugger.record([ | ||
"serialize", | ||
"deserialize" | ||
], [ | ||
Utilities$ReductiveDevTools.Serializer.serializeAction, | ||
Utilities$ReductiveDevTools.Serializer.deserializeAction | ||
])); | ||
var stateSerializer$1 = Belt_Option.getWithDefault(stateSerializer, /* record */Caml_chrome_debugger.record([ | ||
"serialize", | ||
"deserialize" | ||
], [ | ||
(function (obj) { | ||
return obj; | ||
}), | ||
(function (obj) { | ||
return obj; | ||
}) | ||
])); | ||
return (function (store) { | ||
var match = _bridgedReduxJsStore[0]; | ||
var reduxJsStore; | ||
if (match !== undefined) { | ||
reduxJsStore = Caml_option.valFromOption(match); | ||
} else { | ||
var bridgedStore = createDummyReduxJsStore(options, (function (locked) { | ||
_extensionLocked[0] = locked; | ||
return Curry._1(Belt_Option.getWithDefault(lockCallback, (function (param) { | ||
return /* () */0; | ||
})), locked); | ||
}), (function (param) { | ||
_justToggled[0] = true; | ||
return /* () */0; | ||
}))((function (state, action) { | ||
if (_outstandingActionsCount[0] <= 0) { | ||
if (action.type === "@@INIT" || _justToggled[0]) { | ||
_justToggled[0] = false; | ||
if (_didInit[0]) { | ||
_outstandingActionsCount[0] = _outstandingActionsCount[0] - 1 | 0; | ||
Curry._1(store[/* dispatch */1], Curry._1(devToolsUpdateActionCreator, Object.assign({ }, Curry._1(stateSerializer$1[/* deserialize */1], state)))); | ||
} else { | ||
_didInit[0] = true; | ||
} | ||
} | ||
if (action.type !== "@@INIT") { | ||
_outstandingActionsCount[0] = _outstandingActionsCount[0] - 1 | 0; | ||
Curry._1(store[/* dispatch */1], Curry._1(actionSerializer$1[/* deserialize */1], action)); | ||
} | ||
} | ||
case "DISPATCH" : | ||
var action$3 = action; | ||
var devTools = connection; | ||
var store$2 = store; | ||
var initial = initialState; | ||
var meta$1 = meta; | ||
var payload$1 = Utilities$ReductiveDevTools.unwrap(Caml_option.undefined_to_opt(action$3.payload), [ | ||
PayloadNotFound$1, | ||
"action doesn't contain payload while expected" | ||
]); | ||
var devTools$1 = devTools; | ||
var store$3 = store$2; | ||
var payload$2 = payload$1; | ||
var action$4 = action$3; | ||
var initial$1 = initial; | ||
var meta$2 = meta$1; | ||
var payloadType = payload$2.type; | ||
switch (payloadType) { | ||
case "COMMIT" : | ||
meta$2[/* actionCount */2] = 0; | ||
return Extension$ReductiveDevTools.init(devTools$1, Utilities$ReductiveDevTools.Serializer.serializeObject(Reductive.Store.getState(store$3))); | ||
case "IMPORT_STATE" : | ||
var nextLiftedState = Belt_Option.getExn(Caml_option.undefined_to_opt(payload$2.nextLiftedState)); | ||
var computedStates = nextLiftedState.computedStates; | ||
var targetState = Caml_array.caml_array_get(computedStates, computedStates.length - 1 | 0).state; | ||
store$3[/* state */0] = Utilities$ReductiveDevTools.Serializer.deserializeObject(targetState); | ||
notifyListeners(store$3); | ||
meta$2[/* actionCount */2] = nextLiftedState.nextActionId - 1 | 0; | ||
return Extension$ReductiveDevTools.send(devTools$1, null, nextLiftedState); | ||
case "JUMP_TO_ACTION" : | ||
case "JUMP_TO_STATE" : | ||
break; | ||
case "RESET" : | ||
store$3[/* state */0] = initial$1; | ||
notifyListeners(store$3); | ||
meta$2[/* actionCount */2] = 0; | ||
return Extension$ReductiveDevTools.init(devTools$1, Utilities$ReductiveDevTools.Serializer.serializeObject(Reductive.Store.getState(store$3))); | ||
case "ROLLBACK" : | ||
var stateString = Utilities$ReductiveDevTools.unwrap(Caml_option.undefined_to_opt(action$4.state), [ | ||
StateNotFound$1, | ||
"action(" + (String(payloadType) + ") doesn\'t contain state while expected") | ||
]); | ||
store$3[/* state */0] = Utilities$ReductiveDevTools.Serializer.deserializeObject(Utilities$ReductiveDevTools.parse(stateString)); | ||
notifyListeners(store$3); | ||
meta$2[/* actionCount */2] = 0; | ||
return Extension$ReductiveDevTools.init(devTools$1, Utilities$ReductiveDevTools.Serializer.serializeObject(Reductive.Store.getState(store$3))); | ||
case "LOCK_CHANGES" : | ||
case "SWEEP" : | ||
return /* () */0; | ||
case "TOGGLE_ACTION" : | ||
var stateString$1 = Utilities$ReductiveDevTools.unwrap(Caml_option.undefined_to_opt(action$4.state), [ | ||
StateNotFound$1, | ||
"action(" + (String(payloadType) + ") doesn\'t contain state while expected") | ||
]); | ||
if (Belt_Option.isSome(meta$2[/* rewindActionIdx */1]) && Belt_Option.getExn(meta$2[/* rewindActionIdx */1]) >= meta$2[/* actionCount */2] || Belt_Option.isNone(meta$2[/* rewindActionIdx */1])) { | ||
var liftedState = Utilities$ReductiveDevTools.parse(stateString$1); | ||
Extension$ReductiveDevTools.send(devTools$1, null, processToogleAction$1(store$3, payload$2, liftedState, meta$2)); | ||
return notifyListeners(store$3); | ||
} else { | ||
return 0; | ||
} | ||
default: | ||
return /* () */0; | ||
} | ||
var stateString$2 = Utilities$ReductiveDevTools.unwrap(Caml_option.undefined_to_opt(action$4.state), [ | ||
StateNotFound$1, | ||
"action(" + (String(payloadType) + ") doesn\'t contain state while expected") | ||
]); | ||
var actionId = Belt_Option.getExn(Caml_option.undefined_to_opt(payload$2.actionId)); | ||
var match$1 = actionId === meta$2[/* actionCount */2]; | ||
meta$2[/* rewindActionIdx */1] = match$1 ? undefined : actionId; | ||
var match$2 = meta$2[/* liftedState */0]; | ||
if (match$2 !== undefined) { | ||
var liftedState$1 = Caml_option.valFromOption(match$2); | ||
var actionInLiftedStateRange = actionId < liftedState$1.nextActionId; | ||
if (actionInLiftedStateRange) { | ||
var skippedActions = liftedState$1.skippedActionIds; | ||
var computedStates$1 = liftedState$1.computedStates; | ||
var nonSkippedIdx = actionId; | ||
while(skippedActions.includes(nonSkippedIdx)) { | ||
nonSkippedIdx = nonSkippedIdx - 1 | 0; | ||
}; | ||
var targetState$1 = Caml_array.caml_array_get(computedStates$1, nonSkippedIdx).state; | ||
store$3[/* state */0] = Utilities$ReductiveDevTools.Serializer.deserializeObject(targetState$1); | ||
return Curry._1(stateSerializer$1[/* serialize */0], Curry._1(store[/* getState */0], /* () */0)); | ||
}), Curry._1(stateSerializer$1[/* serialize */0], Curry._1(store[/* getState */0], /* () */0)), /* () */0); | ||
Curry._1(bridgedStore.subscribe, (function (param) { | ||
var match = !_extensionLocked[0]; | ||
if (match) { | ||
_outstandingActionsCount[0] = _outstandingActionsCount[0] - 1 | 0; | ||
if (_outstandingActionsCount[0] < 0) { | ||
return Curry._1(store[/* dispatch */1], Curry._1(devToolsUpdateActionCreator, Object.assign({ }, Curry._1(stateSerializer$1[/* deserialize */1], Curry._1(bridgedStore.getState, /* () */0))))); | ||
} else { | ||
store$3[/* state */0] = Utilities$ReductiveDevTools.Serializer.deserializeObject(Utilities$ReductiveDevTools.parse(stateString$2)); | ||
return 0; | ||
} | ||
} else { | ||
store$3[/* state */0] = Utilities$ReductiveDevTools.Serializer.deserializeObject(Utilities$ReductiveDevTools.parse(stateString$2)); | ||
return /* () */0; | ||
} | ||
return notifyListeners(store$3); | ||
case "START" : | ||
return /* () */0; | ||
default: | ||
return /* () */0; | ||
})); | ||
_bridgedReduxJsStore[0] = Caml_option.some(bridgedStore); | ||
reduxJsStore = bridgedStore; | ||
} | ||
return (function (next, action) { | ||
if (_extensionLocked[0] && _outstandingActionsCount[0] >= 0) { | ||
return /* () */0; | ||
} else { | ||
Curry._1(next, action); | ||
_outstandingActionsCount[0] = _outstandingActionsCount[0] + 1 | 0; | ||
if (_outstandingActionsCount[0] > 0) { | ||
return Curry._1(reduxJsStore.dispatch, Curry._1(actionSerializer$1[/* serialize */0], action)); | ||
} else { | ||
return 0; | ||
} | ||
} | ||
})); | ||
return /* () */0; | ||
}); | ||
}); | ||
} | ||
function defaultOptions(connectionId) { | ||
return { | ||
name: connectionId, | ||
features: { | ||
pause: true, | ||
lock: false, | ||
persist: true, | ||
export: true, | ||
import: "custom", | ||
jump: true, | ||
skip: false, | ||
reorder: false, | ||
dispatch: true | ||
} | ||
}; | ||
function enhancer(options, devToolsUpdateActionCreator, actionSerializer, stateSerializer, param, storeCreator, reducer, preloadedState, enhancer$1, param$1) { | ||
var reduxJsBridgeMiddleware = createReduxJsBridgeMiddleware(options, devToolsUpdateActionCreator, actionSerializer, stateSerializer, undefined, /* () */0); | ||
var match = window.__REDUX_DEVTOOLS_EXTENSION__ === undefined; | ||
return Curry._4(storeCreator, reducer, preloadedState, match ? enhancer$1 : Belt_Option.mapWithDefault(enhancer$1, (function (store) { | ||
var partial_arg = Reductive.Store.dispatch; | ||
return Curry._1(reduxJsBridgeMiddleware, /* record */Caml_chrome_debugger.record([ | ||
"getState", | ||
"dispatch" | ||
], [ | ||
(function (param) { | ||
return Reductive.Store.getState(store); | ||
}), | ||
(function (param) { | ||
return partial_arg(store, param); | ||
}) | ||
])); | ||
}), (function (middleware, store, next) { | ||
var partial_arg = Reductive.Store.dispatch; | ||
return Curry._2(reduxJsBridgeMiddleware, /* record */Caml_chrome_debugger.record([ | ||
"getState", | ||
"dispatch" | ||
], [ | ||
(function (param) { | ||
return Reductive.Store.getState(store); | ||
}), | ||
(function (param) { | ||
return partial_arg(store, param); | ||
}) | ||
]), Curry._2(middleware, store, next)); | ||
})), /* () */0); | ||
} | ||
function constructOptions(options, defaults) { | ||
var target = Object.assign(defaults, options); | ||
return Object.assign(target, { | ||
serialize: { | ||
symbol: true | ||
}, | ||
features: Object.assign(target["features"], { | ||
lock: false, | ||
reorder: false, | ||
export: true, | ||
import: "custom" | ||
}) | ||
}); | ||
function captureNextAction(lastAction, reducer, state, action) { | ||
lastAction[0] = Caml_option.some(action); | ||
return Curry._2(reducer, state, action); | ||
} | ||
function reductiveEnhancer(options, storeCreator, reducer, preloadedState, enhancer, param) { | ||
function useReducer(options, devToolsUpdateActionCreator, reducer, initial, actionSerializer, stateSerializer, param) { | ||
var lastAction = React.useMemo((function () { | ||
return /* record */Caml_chrome_debugger.record(["contents"], [undefined]); | ||
}), ([])); | ||
var extensionLocked = React.useMemo((function () { | ||
return /* record */Caml_chrome_debugger.record(["contents"], [false]); | ||
}), ([])); | ||
if (window.__REDUX_DEVTOOLS_EXTENSION__ === undefined) { | ||
return Curry._4(storeCreator, reducer, preloadedState, enhancer, /* () */0); | ||
return React.useReducer(Curry.__2(reducer), initial); | ||
} else { | ||
var targetOptions = constructOptions(options, defaultOptions("ReductiveDevTools")); | ||
var devTools = Extension$ReductiveDevTools.connect(Extension$ReductiveDevTools.devToolsEnhancer, targetOptions); | ||
var meta = /* record */Caml_chrome_debugger.record([ | ||
"liftedState", | ||
"rewindActionIdx", | ||
"actionCount", | ||
"lastAction", | ||
"connectionId" | ||
], [ | ||
undefined, | ||
undefined, | ||
0, | ||
undefined, | ||
targetOptions.name | ||
]); | ||
var devToolsDispatch = function (store, next, action) { | ||
var match = meta[/* rewindActionIdx */1]; | ||
if (match !== undefined && match < meta[/* actionCount */2]) { | ||
return 0; | ||
} else { | ||
var store$1 = store; | ||
var next$1 = next; | ||
var action$1 = action; | ||
if (enhancer !== undefined) { | ||
Curry._3(enhancer, store$1, next$1, action$1); | ||
} else { | ||
Curry._1(next$1, action$1); | ||
} | ||
meta[/* actionCount */2] = meta[/* actionCount */2] + 1 | 0; | ||
return Extension$ReductiveDevTools.send(devTools, Utilities$ReductiveDevTools.Serializer.serializeAction(action$1), Utilities$ReductiveDevTools.Serializer.serializeObject(Reductive.Store.getState(store$1))); | ||
} | ||
}; | ||
var store = Curry._4(storeCreator, reducer, preloadedState, devToolsDispatch, /* () */0); | ||
var actionCreators = targetOptions.actionCreators; | ||
handle(devTools, store, meta, actionCreators === undefined ? undefined : Caml_option.some(actionCreators), /* () */0); | ||
return store; | ||
} | ||
} | ||
function register(connectionId, component, options, param) { | ||
if (window.__REDUX_DEVTOOLS_EXTENSION__ === undefined || Js_dict.get(connections, connectionId) !== undefined) { | ||
return /* () */0; | ||
} else { | ||
var targetOptions = options !== undefined ? constructOptions(Caml_option.valFromOption(options), defaultOptions(connectionId)) : defaultOptions(connectionId); | ||
var devTools = Extension$ReductiveDevTools.connect(Extension$ReductiveDevTools.devToolsEnhancer, targetOptions); | ||
var actionCreators = targetOptions.actionCreators; | ||
var connectionInfo_001 = /* meta : record */Caml_chrome_debugger.record([ | ||
"liftedState", | ||
"rewindActionIdx", | ||
"actionCount", | ||
"lastAction", | ||
"connectionId" | ||
], [ | ||
undefined, | ||
undefined, | ||
0, | ||
undefined, | ||
connectionId | ||
]); | ||
var connectionInfo = /* record */Caml_chrome_debugger.record([ | ||
"connection", | ||
"meta" | ||
], [ | ||
devTools, | ||
connectionInfo_001 | ||
]); | ||
connections[connectionId] = connectionInfo; | ||
var connection = devTools; | ||
var store = component; | ||
var meta = connectionInfo_001; | ||
var actionCreators$1 = actionCreators === undefined ? undefined : Caml_option.some(actionCreators); | ||
var initialState = store[/* retainedState */1]; | ||
Extension$ReductiveDevTools.init(connection, Utilities$ReductiveDevTools.Serializer.serializeObject(initialState)); | ||
Extension$ReductiveDevTools.subscribe(connection, (function (action) { | ||
var match = action.type; | ||
switch (match) { | ||
case "ACTION" : | ||
var action$1 = action; | ||
var store$1 = store; | ||
var actionCreators$2 = actionCreators$1; | ||
var payload = Utilities$ReductiveDevTools.unwrap(Caml_option.undefined_to_opt(action$1.payload), [ | ||
PayloadNotFound, | ||
"action doesn't contain payload while expected" | ||
]); | ||
if (actionCreators$2 !== undefined) { | ||
return Curry._1(store$1[/* dispatch */0], Curry._2(evalMethod, payload, Caml_option.valFromOption(actionCreators$2))); | ||
} else { | ||
return /* () */0; | ||
} | ||
case "DISPATCH" : | ||
var action$2 = action; | ||
var devTools = connection; | ||
var store$2 = store; | ||
var initial = initialState; | ||
var meta$1 = meta; | ||
var payload$1 = Utilities$ReductiveDevTools.unwrap(Caml_option.undefined_to_opt(action$2.payload), [ | ||
PayloadNotFound, | ||
"action doesn't contain payload while expected" | ||
]); | ||
var devTools$1 = devTools; | ||
var store$3 = store$2; | ||
var payload$2 = payload$1; | ||
var action$3 = action$2; | ||
var initial$1 = initial; | ||
var meta$2 = meta$1; | ||
var payloadType = payload$2.type; | ||
switch (payloadType) { | ||
case "COMMIT" : | ||
meta$2[/* actionCount */2] = 0; | ||
return Extension$ReductiveDevTools.init(devTools$1, Utilities$ReductiveDevTools.Serializer.serializeObject(store$3[/* retainedState */1])); | ||
case "IMPORT_STATE" : | ||
var nextLiftedState = Belt_Option.getExn(Caml_option.undefined_to_opt(payload$2.nextLiftedState)); | ||
var computedStates = nextLiftedState.computedStates; | ||
var targetState = Caml_array.caml_array_get(computedStates, computedStates.length - 1 | 0).state; | ||
mutateState(Utilities$ReductiveDevTools.Serializer.deserializeObject(targetState), store$3); | ||
meta$2[/* actionCount */2] = nextLiftedState.nextActionId - 1 | 0; | ||
return Extension$ReductiveDevTools.send(devTools$1, null, nextLiftedState); | ||
case "JUMP_TO_ACTION" : | ||
case "JUMP_TO_STATE" : | ||
break; | ||
case "RESET" : | ||
mutateState(initial$1, store$3); | ||
meta$2[/* actionCount */2] = 0; | ||
return Extension$ReductiveDevTools.init(devTools$1, Utilities$ReductiveDevTools.Serializer.serializeObject(store$3[/* retainedState */1])); | ||
case "ROLLBACK" : | ||
var stateString = Utilities$ReductiveDevTools.unwrap(Caml_option.undefined_to_opt(action$3.state), [ | ||
StateNotFound, | ||
"action(" + (String(payloadType) + ") doesn\'t contain state while expected") | ||
]); | ||
mutateState(Utilities$ReductiveDevTools.Serializer.deserializeObject(Utilities$ReductiveDevTools.parse(stateString)), store$3); | ||
meta$2[/* actionCount */2] = 0; | ||
return Extension$ReductiveDevTools.init(devTools$1, Utilities$ReductiveDevTools.Serializer.serializeObject(store$3[/* retainedState */1])); | ||
case "LOCK_CHANGES" : | ||
case "SWEEP" : | ||
return /* () */0; | ||
case "TOGGLE_ACTION" : | ||
var stateString$1 = Utilities$ReductiveDevTools.unwrap(Caml_option.undefined_to_opt(action$3.state), [ | ||
StateNotFound, | ||
"action(" + (String(payloadType) + ") doesn\'t contain state while expected") | ||
]); | ||
if (Belt_Option.isSome(meta$2[/* rewindActionIdx */1]) && Belt_Option.getExn(meta$2[/* rewindActionIdx */1]) >= meta$2[/* actionCount */2] || Belt_Option.isNone(meta$2[/* rewindActionIdx */1])) { | ||
var liftedState = Utilities$ReductiveDevTools.parse(stateString$1); | ||
Extension$ReductiveDevTools.send(devTools$1, null, processToogleAction(store$3, payload$2, liftedState, meta$2)); | ||
return /* () */0; | ||
} else { | ||
return 0; | ||
} | ||
default: | ||
return /* () */0; | ||
} | ||
var stateString$2 = Utilities$ReductiveDevTools.unwrap(Caml_option.undefined_to_opt(action$3.state), [ | ||
StateNotFound, | ||
"action(" + (String(payloadType) + ") doesn\'t contain state while expected") | ||
]); | ||
var actionId = Belt_Option.getExn(Caml_option.undefined_to_opt(payload$2.actionId)); | ||
var match$1 = actionId === meta$2[/* actionCount */2]; | ||
meta$2[/* rewindActionIdx */1] = match$1 ? undefined : actionId; | ||
var match$2 = meta$2[/* liftedState */0]; | ||
if (match$2 !== undefined) { | ||
var liftedState$1 = Caml_option.valFromOption(match$2); | ||
var actionInLiftedStateRange = actionId < liftedState$1.nextActionId; | ||
if (actionInLiftedStateRange) { | ||
var skippedActions = liftedState$1.skippedActionIds; | ||
var computedStates$1 = liftedState$1.computedStates; | ||
var nonSkippedIdx = actionId; | ||
while(skippedActions.includes(nonSkippedIdx)) { | ||
nonSkippedIdx = nonSkippedIdx - 1 | 0; | ||
}; | ||
var targetState$1 = Caml_array.caml_array_get(computedStates$1, nonSkippedIdx).state; | ||
mutateState(Utilities$ReductiveDevTools.Serializer.deserializeObject(targetState$1), store$3); | ||
} else { | ||
mutateState(Utilities$ReductiveDevTools.Serializer.deserializeObject(Utilities$ReductiveDevTools.parse(stateString$2)), store$3); | ||
} | ||
} else { | ||
mutateState(Utilities$ReductiveDevTools.Serializer.deserializeObject(Utilities$ReductiveDevTools.parse(stateString$2)), store$3); | ||
} | ||
return /* () */0; | ||
case "START" : | ||
return /* () */0; | ||
default: | ||
return /* () */0; | ||
} | ||
})); | ||
return /* () */0; | ||
} | ||
} | ||
function captureAction(connectionId, reducer, state, action) { | ||
var match = Js_dict.get(connections, connectionId); | ||
if (match !== undefined) { | ||
match[/* meta */1][/* lastAction */3] = action; | ||
return Curry._2(reducer, state, action); | ||
} else { | ||
if (window.__REDUX_DEVTOOLS_EXTENSION__ !== undefined) { | ||
console.warn("reductive-dev-tools connection not found while expected"); | ||
} | ||
return Curry._2(reducer, state, action); | ||
} | ||
} | ||
function useReducer(connectionOptions, reducer, initial) { | ||
var connectionId = connectionOptions.name; | ||
var targetReducer = React.useMemo((function () { | ||
return (function (param, param$1) { | ||
var connectionId$1 = connectionId; | ||
var reducer$1 = function (param, param$1) { | ||
return captureAction(connectionId, reducer, param, param$1); | ||
}; | ||
var state = param; | ||
var action = param$1; | ||
var match = Js_dict.get(connections, connectionId$1); | ||
if (match !== undefined) { | ||
var connectionInfo = match; | ||
var match$1 = connectionInfo[/* meta */1][/* rewindActionIdx */1]; | ||
if (match$1 !== undefined) { | ||
var isDevToolsStateUpdateAction = typeof action === "number" ? false : action[0] === 161605709; | ||
if (match$1 >= connectionInfo[/* meta */1][/* actionCount */2] || isDevToolsStateUpdateAction) { | ||
return Curry._2(reducer$1, state, action); | ||
} else { | ||
return state; | ||
} | ||
var targetReducer = React.useMemo((function () { | ||
return (function (param, param$1) { | ||
var lock = extensionLocked; | ||
var reducer$1 = function (param, param$1) { | ||
return captureNextAction(lastAction, reducer, param, param$1); | ||
}; | ||
var state = param; | ||
var action = param$1; | ||
if (lock[0]) { | ||
return state; | ||
} else { | ||
return Curry._2(reducer$1, state, action); | ||
} | ||
} else { | ||
if (window.__REDUX_DEVTOOLS_EXTENSION__ !== undefined) { | ||
console.warn("reductive-dev-tools connection not found while expected"); | ||
} | ||
return Curry._2(reducer$1, state, action); | ||
} | ||
}); | ||
}), /* array */[reducer]); | ||
var match = React.useReducer(Curry.__2(targetReducer), initial); | ||
var dispatch = match[1]; | ||
var state = match[0]; | ||
var componentStore = React.useMemo((function () { | ||
return /* record */Caml_chrome_debugger.record([ | ||
"dispatch", | ||
"retainedState" | ||
}); | ||
}), /* array */[reducer]); | ||
var match = React.useReducer(Curry.__2(targetReducer), initial); | ||
var dispatch = match[1]; | ||
var state = match[0]; | ||
var reduxJsBridgeMiddleware = React.useMemo((function () { | ||
return createReduxJsBridgeMiddleware(options, devToolsUpdateActionCreator, actionSerializer, stateSerializer, (function (locked) { | ||
extensionLocked[0] = locked; | ||
return /* () */0; | ||
}), /* () */0); | ||
}), ([])); | ||
var retained = React.useMemo((function () { | ||
return /* record */Caml_chrome_debugger.record(["contents"], [initial]); | ||
}), ([])); | ||
retained[0] = state; | ||
React.useEffect((function () { | ||
var middleware = Curry._1(reduxJsBridgeMiddleware, /* record */Caml_chrome_debugger.record([ | ||
"getState", | ||
"dispatch" | ||
], [ | ||
dispatch, | ||
initial | ||
]); | ||
}), ([])); | ||
React.useEffect((function () { | ||
register(connectionId, componentStore, undefined, /* () */0); | ||
return (function (param) { | ||
var connectionId$1 = connectionId; | ||
var connectionInfo = Utilities$ReductiveDevTools.unwrap(Js_dict.get(connections, connectionId$1), [ | ||
ConnectionNotFound, | ||
"DevTool connection(id=$connectionId) not found" | ||
]); | ||
Js_dict.unsafeDeleteKey(connections, connectionId$1); | ||
return Extension$ReductiveDevTools.unsubscribe(connectionInfo[/* connection */0]); | ||
}); | ||
}), ([])); | ||
React.useEffect((function () { | ||
componentStore[/* retainedState */1] = state; | ||
var match = Js_dict.get(connections, connectionId); | ||
if (match !== undefined) { | ||
var connectionInfo = match; | ||
var match$1 = connectionInfo[/* meta */1][/* lastAction */3]; | ||
if (match$1 !== undefined) { | ||
var lastAction = match$1; | ||
var exit = 0; | ||
if (typeof lastAction === "number" || lastAction[0] !== 161605709) { | ||
exit = 1; | ||
} | ||
if (exit === 1) { | ||
connectionInfo[/* meta */1][/* actionCount */2] = connectionInfo[/* meta */1][/* actionCount */2] + 1 | 0; | ||
Extension$ReductiveDevTools.send(connectionInfo[/* connection */0], Utilities$ReductiveDevTools.Serializer.serializeAction(lastAction), Utilities$ReductiveDevTools.Serializer.serializeObject(state)); | ||
} | ||
(function (param) { | ||
return retained[0]; | ||
}), | ||
dispatch | ||
])); | ||
var match = lastAction[0]; | ||
if (match !== undefined) { | ||
Curry._2(middleware, (function (_action) { | ||
return /* () */0; | ||
}), Caml_option.valFromOption(match)); | ||
} | ||
} else if (window.__REDUX_DEVTOOLS_EXTENSION__ !== undefined) { | ||
console.warn("reductive-dev-tools connection not found while expected"); | ||
} | ||
return ; | ||
}), /* array */[state]); | ||
return /* tuple */[ | ||
state, | ||
dispatch | ||
]; | ||
return ; | ||
}), /* array */[state]); | ||
return /* tuple */[ | ||
state, | ||
dispatch | ||
]; | ||
} | ||
} | ||
exports.reductiveEnhancer = reductiveEnhancer; | ||
exports.enhancer = enhancer; | ||
exports.useReducer = useReducer; | ||
/* evalMethod Not a pure module */ | ||
/* react Not a pure module */ |
{ | ||
"name": "reductive-dev-tools", | ||
"version": "1.0.1", | ||
"version": "2.0.0", | ||
"description": "reductive and reason-react reducer component integration with Redux DevTools", | ||
@@ -5,0 +5,0 @@ "main": "lib/js/src/reductiveDevTools.bs.js", |
146
README.md
@@ -12,63 +12,55 @@ ## reductive-dev-tools | ||
## Installation | ||
via npm: | ||
```bash | ||
npm install --save-dev reductive-dev-tools | ||
``` | ||
then add `reductive-dev-tools` to your "bs-dependencies" inside `bsconfig.json`. | ||
1. with npm: | ||
```bash | ||
npm install --save-dev reductive-dev-tools | ||
``` | ||
2. add `reductive-dev-tools` to your "bs-dependencies" inside `bsconfig.json`. | ||
3. add `-bs-g` into `"bsc-flags"` of your **bsconfig.json** to have variant and record field names available inside extension. | ||
**Peer depedencies** | ||
reason-react, reductive, redux-devtools-extension, redux (redux-devtools-extension's peer dep.) should be also installed. | ||
## Caveats | ||
## Usage | ||
Utilize provided store enhancer `ReductiveDevTools.Connectors.enhancer` for **reductive** or `ReductiveDevTools.Connectors.useReducer` for **reason-react hooks** (jsx3). | ||
1. Add `-bs-g` into `"bsc-flags"` of your **bsconfig.json** to have variant and record field names available inside extension. | ||
2. Prefer variants with constructors to plain (`SomeAction(unit)` to `SomeAction`) since plain varaints do no carry debug metedata with them (represented as numbers in js) | ||
3. Extension will be locked (newly dispatched actions will be ignored) when you jump back in action history. | ||
4. Records inside variants do not carry debug metadata in bucklescript yet, if needed you can tag them manually. See [Additional Tagging](https://github.com/ambientlight/reductive-dev-tools#additional-tagging) | ||
5. Action names won't be displayed when using extensible variants. [(Extensible variant name becomes "update")](https://github.com/ambientlight/reductive-dev-tools/issues/2) | ||
You need to pass devtools extension [options](#options) as `~options` and action creator that builds action when state update is dispatched from the monitor as `~devToolsUpdateActionCreator`. Additionally you can also pass `~stateSerializer` and `~actionSerializer` to override default serialization behaviour. Take a look at [Serialization](#serialization) to see if you need it. | ||
## Supported DevTools Features | ||
#### reductive | ||
| feature | reductive | react hooks useReducer | | ||
|---------|-----------|-------------------| | ||
| pause | ✔ | ✔ | | ||
| lock | [redux-devtools-extension/#618](https://github.com/zalmoxisus/redux-devtools-extension/issues/618) | [redux-devtools-extension/#618](https://github.com/zalmoxisus/redux-devtools-extension/issues/618) | | ||
| persist | ✔ | ✔ | | ||
| export | ✔ | ✔ | | ||
| import | ✔ | ✔ | | ||
| jump | ✔ | ✔ | | ||
| skip | ✔ | ✔ | | ||
| sweep | [redux-devtools-extension/#618](https://github.com/zalmoxisus/redux-devtools-extension/issues/618) | [redux-devtools-extension/#618](https://github.com/zalmoxisus/redux-devtools-extension/issues/618) | | ||
| reorder | [redux-devtools-extension/#618](https://github.com/zalmoxisus/redux-devtools-extension/issues/618) | [redux-devtools-extension/#618](https://github.com/zalmoxisus/redux-devtools-extension/issues/618) | | ||
| dispatch| ✔ | ✔ | | ||
| test | REDUX ONLY| REDUX ONLY | | ||
| trace | REDUX ONLY| REDUX ONLY | | ||
## Usage with Reductive | ||
Utilize provided store enhancer `ReductiveDevTools.Connectors.reductiveEnhancer` | ||
```reason | ||
let storeEnhancer = | ||
ReductiveDevTools.( | ||
Connectors.reductiveEnhancer( | ||
Extension.enhancerOptions(~name="MyApp", ()), | ||
) | ||
); | ||
let storeCreator = storeEnhancer @@ Reductive.Store.create; | ||
let storeCreator = | ||
ReductiveDevTools.Connectors.enhancer( | ||
~options=ReductiveDevTools.Extension.enhancerOptions( | ||
~name=__MODULE__, | ||
~actionCreators={ | ||
"actionYouCanDispatchFromMonitor": (value: int) => `YourActionOfChoice(value) | ||
|. ReductiveDevTools.Utilities.Serializer.serializeAction | ||
}, | ||
()), | ||
~devToolsUpdateActionCreator=(devToolsState) => `DevToolsUpdate(devToolsState), | ||
() | ||
) | ||
@@ Reductive.Store.create; | ||
``` | ||
## Usage with React Hooks useReducer (jsx3) | ||
#### React Hooks useReducer (jsx3) | ||
Replace `React.useReducer` with `ReductiveDevTools.Connectors.useReducer` and pass options with **unique** component id as name. | ||
```reason | ||
let (state, send) = ReductiveDevTools.Connectors.useReducer( | ||
ReductiveDevTools.Extension.enhancerOptions(~name="MyComponent", ()), | ||
reducer, | ||
yourInitialState); | ||
~options=ReductiveDevTools.Extension.enhancerOptions( | ||
~name=__MODULE__, | ||
~actionCreators={ | ||
"actionYouCanDispatchFromMonitor": (value: int) => `YourActionOfChoice(value) | ||
|. ReductiveDevTools.Utilities.Serializer.serializeAction | ||
}, | ||
()), | ||
~devToolsUpdateActionCreator=(devToolsState) => `DevToolsUpdate(devToolsState), | ||
~reducer, | ||
~initial=yourInitialState, | ||
()); | ||
``` | ||
## Usage with ReactReason legacy reducer component (jsx2) | ||
#### Usage with ReactReason legacy reducer component (jsx2) | ||
No longer supported. Please install latest from 0.x: | ||
@@ -82,2 +74,48 @@ | ||
## Serialization | ||
### Actions | ||
[redux-devtools-extension](https://github.com/zalmoxisus/redux-devtools-extension) uses value under `type` key of action object for its name in the monitor. Most likely you are going to use [variants](https://reasonml.github.io/docs/en/variant) for actions, which need to be serialized into js objects to be usefully displayed inside the extension. Actions serialization is built-in. As an alternative, you can override default serializer by passing `~actionSerializer` like: | ||
```reason | ||
ReductiveDevTools.Connectors.enhancer( | ||
~options=ReductiveDevTools.Extension.enhancerOptions( | ||
~name=__MODULE__, | ||
()), | ||
~actionSerializer={ | ||
serialize: obj => { | ||
// your serialization logic | ||
obj | ||
}, | ||
deserialize: obj => { | ||
// your deserialization logic | ||
obj | ||
} | ||
}, | ||
()) | ||
``` | ||
There are few caveats that apply to default serialization though. | ||
1. Make sure to add `-bs-g` into `"bsc-flags"` of your **bsconfig.json** to have variant names available. | ||
2. Variants with constructors should be prefered to plain (`SomeAction(unit)` to `SomeAction`) since plain varaints do no carry debug metedata(in symbols) with them (represented as numbers in js). | ||
3. Action names won't be displayed when using [extensible variants](https://caml.inria.fr/pub/docs/manual-ocaml/manual037.html#sec269), they also do not carry debug metadata. [Extensible variant name becomes "update"](https://github.com/ambientlight/reductive-dev-tools/issues/2) | ||
4. Records inside variants do not carry debug metadata in bucklescript yet, if needed you can tag them manually. See [Additional Tagging](#additional-tagging). | ||
### State | ||
There is no serialization applied to state by default. If you are on [bs-platform 7.0](https://github.com/BuckleScript/bucklescript/releases/tag/7.0.1), most likely you do not need it, since [ocaml records are compiled to js objects](https://bucklescript.github.io/blog/2019/11/18/whats-new-in-7). For earlier versions of [bs-platform](https://www.npmjs.com/package/bs-platform), please pass the next `~stateSerializer`: | ||
```reason | ||
ReductiveDevTools.Connectors.enhancer( | ||
~options=ReductiveDevTools.Extension.enhancerOptions( | ||
~name=__MODULE__, | ||
()), | ||
~stateSerializer={ | ||
serialize: ReductiveDevTools.Utilities.Serializer.serializeObject, | ||
deserialize: ReductiveDevTools.Utilities.Serializer.deserializeObject | ||
}, | ||
()) | ||
``` | ||
## Options | ||
@@ -91,7 +129,6 @@ | ||
/* action creators functions to be available in the Dispatcher. */ | ||
~actionCreators=Js.Dict.fromList([ | ||
("increment", (.) => CounterAction(Increment)), | ||
("decrement", (.) => CounterAction(Decrement)), | ||
("complexAppend", ((first, last) => StringAction(ComplexAppend(first, last))) |> Obj.magic) | ||
]), | ||
~actionCreators={ | ||
"increment": () => `Increment(()) |. ReductiveDevTools.Utilities.Serializer.serializeAction, | ||
"decrement": () => `Decrement(()) |. ReductiveDevTools.Utilities.Serializer.serializeAction | ||
}, | ||
@@ -122,2 +159,8 @@ /* if more than one action is dispatched in the indicated interval, all new actions will be collected and sent at once */ | ||
()), | ||
/* if set to true, will include stack trace for every dispatched action, so you can see it in trace tab */ | ||
~trace=true, | ||
/* maximum stack trace frames to be stored (in case trace option was provided as true) */ | ||
~traceLimit=50 | ||
()) | ||
@@ -161,4 +204,1 @@ ``` | ||
This can also be used to override bucklescript debug metadata(if really needed). Definitions are at: [utilities.rei](https://github.com/ambientlight/reductive-dev-tools/blob/a530ea6d09d7facad2b70c061703eff52cfa80b4/src/utilities.rei#L63-L67) | ||
## Word Of Caution | ||
Current implementation depends on internal bucklescript representation of debug metadata and variants in js. Changes to it in future may silently break the extension. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
16
200
0
85402
831