Skip to content

Commit

Permalink
chore(all): prepare release
Browse files Browse the repository at this point in the history
  • Loading branch information
EisenbergEffect committed Mar 27, 2021
1 parent 5955aab commit 0e08d28
Show file tree
Hide file tree
Showing 8 changed files with 246 additions and 98 deletions.
50 changes: 36 additions & 14 deletions dist/amd/aurelia-store.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,8 @@ define('aurelia-store', ['exports', 'rxjs', 'aurelia-dependency-injection', 'aur
this.devToolsAvailable = false;
this.actions = new Map();
this.middlewares = new Map();
this._markNames = new Set();
this._measureNames = new Set();
this.dispatchQueue = [];
this.options = options || {};
var isUndoable = this.options.history && this.options.history.undoable === true;
Expand Down Expand Up @@ -364,7 +366,7 @@ define('aurelia-store', ['exports', 'rxjs', 'aurelia-dependency-injection', 'aur
if (unregisteredAction) {
throw new UnregisteredActionError(unregisteredAction.reducer);
}
aureliaPal.PLATFORM.performance.mark("dispatch-start");
this.mark("dispatch-start");
pipedActions = actions.map(function (a) { return ({
type: _this.actions.get(a.reducer).type,
params: a.params,
Expand All @@ -385,8 +387,8 @@ define('aurelia-store', ['exports', 'rxjs', 'aurelia-dependency-injection', 'aur
case 1:
beforeMiddleswaresResult = _a.sent();
if (beforeMiddleswaresResult === false) {
aureliaPal.PLATFORM.performance.clearMarks();
aureliaPal.PLATFORM.performance.clearMeasures();
this.clearMarks();
this.clearMeasures();
return [2 /*return*/];
}
result = beforeMiddleswaresResult;
Expand All @@ -399,11 +401,11 @@ define('aurelia-store', ['exports', 'rxjs', 'aurelia-dependency-injection', 'aur
case 3:
result = _a.sent();
if (result === false) {
aureliaPal.PLATFORM.performance.clearMarks();
aureliaPal.PLATFORM.performance.clearMeasures();
this.clearMarks();
this.clearMeasures();
return [2 /*return*/];
}
aureliaPal.PLATFORM.performance.mark("dispatch-after-reducer-" + action.type);
this.mark("dispatch-after-reducer-" + action.type);
if (!result && typeof result !== "object") {
throw new Error("The reducer has to return a new state");
}
Expand All @@ -415,8 +417,8 @@ define('aurelia-store', ['exports', 'rxjs', 'aurelia-dependency-injection', 'aur
case 6:
resultingState = _a.sent();
if (resultingState === false) {
aureliaPal.PLATFORM.performance.clearMarks();
aureliaPal.PLATFORM.performance.clearMeasures();
this.clearMarks();
this.clearMeasures();
return [2 /*return*/];
}
if (isStateHistory(resultingState) &&
Expand All @@ -425,19 +427,19 @@ define('aurelia-store', ['exports', 'rxjs', 'aurelia-dependency-injection', 'aur
resultingState = applyLimits(resultingState, this.options.history.limit);
}
this._state.next(resultingState);
aureliaPal.PLATFORM.performance.mark("dispatch-end");
this.mark("dispatch-end");
if (this.options.measurePerformance === exports.PerformanceMeasurement.StartEnd) {
aureliaPal.PLATFORM.performance.measure("startEndDispatchDuration", "dispatch-start", "dispatch-end");
measures = aureliaPal.PLATFORM.performance.getEntriesByName("startEndDispatchDuration");
this.measure("startEndDispatchDuration", "dispatch-start", "dispatch-end");
measures = aureliaPal.PLATFORM.performance.getEntriesByName("startEndDispatchDuration", "measure");
this.logger[getLogType(this.options, "performanceLog", exports.LogLevel.info)]("Total duration " + measures[0].duration + " of dispatched action " + callingAction.name + ":", measures);
}
else if (this.options.measurePerformance === exports.PerformanceMeasurement.All) {
marks = aureliaPal.PLATFORM.performance.getEntriesByType("mark");
totalDuration = marks[marks.length - 1].startTime - marks[0].startTime;
this.logger[getLogType(this.options, "performanceLog", exports.LogLevel.info)]("Total duration " + totalDuration + " of dispatched action " + callingAction.name + ":", marks);
}
aureliaPal.PLATFORM.performance.clearMarks();
aureliaPal.PLATFORM.performance.clearMeasures();
this.clearMarks();
this.clearMeasures();
this.updateDevToolsState({ type: callingAction.name, params: callingAction.params }, resultingState);
return [2 /*return*/];
}
Expand Down Expand Up @@ -479,7 +481,7 @@ define('aurelia-store', ['exports', 'rxjs', 'aurelia-dependency-injection', 'aur
return [4 /*yield*/, prev];
case 6: return [2 /*return*/, _d.sent()];
case 7:
aureliaPal.PLATFORM.performance.mark("dispatch-" + placement + "-" + curr[0].name);
this.mark("dispatch-" + placement + "-" + curr[0].name);
return [7 /*endfinally*/];
case 8: return [2 /*return*/];
}
Expand Down Expand Up @@ -541,6 +543,26 @@ define('aurelia-store', ['exports', 'rxjs', 'aurelia-dependency-injection', 'aur
Store.prototype.registerHistoryMethods = function () {
this.registerAction("jump", jump);
};
Store.prototype.mark = function (markName) {
this._markNames.add(markName);
aureliaPal.PLATFORM.performance.mark(markName);
};
Store.prototype.clearMarks = function () {
this._markNames.forEach(function (markName) {
return aureliaPal.PLATFORM.performance.clearMarks(markName);
});
this._markNames.clear();
};
Store.prototype.measure = function (measureName, startMarkName, endMarkName) {
this._measureNames.add(measureName);
aureliaPal.PLATFORM.performance.measure(measureName, startMarkName, endMarkName);
};
Store.prototype.clearMeasures = function () {
this._measureNames.forEach(function (measureName) {
return aureliaPal.PLATFORM.performance.clearMeasures(measureName);
});
this._measureNames.clear();
};
return Store;
}());
function dispatchify(action) {
Expand Down
6 changes: 6 additions & 0 deletions dist/aurelia-store.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,8 @@ export declare class Store<T> {
private middlewares;
private _state;
private options;
private _markNames;
private _measureNames;
private dispatchQueue;
constructor(initialState: T, options?: Partial<StoreOptions>);
registerMiddleware<S extends undefined>(reducer: Middleware<T, undefined>, placement: MiddlewarePlacement): void;
Expand All @@ -272,6 +274,10 @@ export declare class Store<T> {
private setupDevTools;
private updateDevToolsState;
private registerHistoryMethods;
private mark;
private clearMarks;
private measure;
private clearMeasures;
}
export declare function dispatchify<T, P extends any[]>(action: Reducer<T, P> | string): (...params: P) => Promise<void>;
export declare type StepFn<T> = (res: T) => void;
Expand Down
50 changes: 36 additions & 14 deletions dist/commonjs/aurelia-store.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,8 @@ var Store = /** @class */ (function () {
this.devToolsAvailable = false;
this.actions = new Map();
this.middlewares = new Map();
this._markNames = new Set();
this._measureNames = new Set();
this.dispatchQueue = [];
this.options = options || {};
var isUndoable = this.options.history && this.options.history.undoable === true;
Expand Down Expand Up @@ -372,7 +374,7 @@ var Store = /** @class */ (function () {
if (unregisteredAction) {
throw new UnregisteredActionError(unregisteredAction.reducer);
}
aureliaPal.PLATFORM.performance.mark("dispatch-start");
this.mark("dispatch-start");
pipedActions = actions.map(function (a) { return ({
type: _this.actions.get(a.reducer).type,
params: a.params,
Expand All @@ -393,8 +395,8 @@ var Store = /** @class */ (function () {
case 1:
beforeMiddleswaresResult = _a.sent();
if (beforeMiddleswaresResult === false) {
aureliaPal.PLATFORM.performance.clearMarks();
aureliaPal.PLATFORM.performance.clearMeasures();
this.clearMarks();
this.clearMeasures();
return [2 /*return*/];
}
result = beforeMiddleswaresResult;
Expand All @@ -407,11 +409,11 @@ var Store = /** @class */ (function () {
case 3:
result = _a.sent();
if (result === false) {
aureliaPal.PLATFORM.performance.clearMarks();
aureliaPal.PLATFORM.performance.clearMeasures();
this.clearMarks();
this.clearMeasures();
return [2 /*return*/];
}
aureliaPal.PLATFORM.performance.mark("dispatch-after-reducer-" + action.type);
this.mark("dispatch-after-reducer-" + action.type);
if (!result && typeof result !== "object") {
throw new Error("The reducer has to return a new state");
}
Expand All @@ -423,8 +425,8 @@ var Store = /** @class */ (function () {
case 6:
resultingState = _a.sent();
if (resultingState === false) {
aureliaPal.PLATFORM.performance.clearMarks();
aureliaPal.PLATFORM.performance.clearMeasures();
this.clearMarks();
this.clearMeasures();
return [2 /*return*/];
}
if (isStateHistory(resultingState) &&
Expand All @@ -433,19 +435,19 @@ var Store = /** @class */ (function () {
resultingState = applyLimits(resultingState, this.options.history.limit);
}
this._state.next(resultingState);
aureliaPal.PLATFORM.performance.mark("dispatch-end");
this.mark("dispatch-end");
if (this.options.measurePerformance === exports.PerformanceMeasurement.StartEnd) {
aureliaPal.PLATFORM.performance.measure("startEndDispatchDuration", "dispatch-start", "dispatch-end");
measures = aureliaPal.PLATFORM.performance.getEntriesByName("startEndDispatchDuration");
this.measure("startEndDispatchDuration", "dispatch-start", "dispatch-end");
measures = aureliaPal.PLATFORM.performance.getEntriesByName("startEndDispatchDuration", "measure");
this.logger[getLogType(this.options, "performanceLog", exports.LogLevel.info)]("Total duration " + measures[0].duration + " of dispatched action " + callingAction.name + ":", measures);
}
else if (this.options.measurePerformance === exports.PerformanceMeasurement.All) {
marks = aureliaPal.PLATFORM.performance.getEntriesByType("mark");
totalDuration = marks[marks.length - 1].startTime - marks[0].startTime;
this.logger[getLogType(this.options, "performanceLog", exports.LogLevel.info)]("Total duration " + totalDuration + " of dispatched action " + callingAction.name + ":", marks);
}
aureliaPal.PLATFORM.performance.clearMarks();
aureliaPal.PLATFORM.performance.clearMeasures();
this.clearMarks();
this.clearMeasures();
this.updateDevToolsState({ type: callingAction.name, params: callingAction.params }, resultingState);
return [2 /*return*/];
}
Expand Down Expand Up @@ -487,7 +489,7 @@ var Store = /** @class */ (function () {
return [4 /*yield*/, prev];
case 6: return [2 /*return*/, _d.sent()];
case 7:
aureliaPal.PLATFORM.performance.mark("dispatch-" + placement + "-" + curr[0].name);
this.mark("dispatch-" + placement + "-" + curr[0].name);
return [7 /*endfinally*/];
case 8: return [2 /*return*/];
}
Expand Down Expand Up @@ -549,6 +551,26 @@ var Store = /** @class */ (function () {
Store.prototype.registerHistoryMethods = function () {
this.registerAction("jump", jump);
};
Store.prototype.mark = function (markName) {
this._markNames.add(markName);
aureliaPal.PLATFORM.performance.mark(markName);
};
Store.prototype.clearMarks = function () {
this._markNames.forEach(function (markName) {
return aureliaPal.PLATFORM.performance.clearMarks(markName);
});
this._markNames.clear();
};
Store.prototype.measure = function (measureName, startMarkName, endMarkName) {
this._measureNames.add(measureName);
aureliaPal.PLATFORM.performance.measure(measureName, startMarkName, endMarkName);
};
Store.prototype.clearMeasures = function () {
this._measureNames.forEach(function (measureName) {
return aureliaPal.PLATFORM.performance.clearMeasures(measureName);
});
this._measureNames.clear();
};
return Store;
}());
function dispatchify(action) {
Expand Down
46 changes: 32 additions & 14 deletions dist/es2015/aurelia-store.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,8 @@ class Store {
this.devToolsAvailable = false;
this.actions = new Map();
this.middlewares = new Map();
this._markNames = new Set();
this._measureNames = new Set();
this.dispatchQueue = [];
this.options = options || {};
const isUndoable = this.options.history && this.options.history.undoable === true;
Expand Down Expand Up @@ -276,7 +278,7 @@ class Store {
if (unregisteredAction) {
throw new UnregisteredActionError(unregisteredAction.reducer);
}
PLATFORM.performance.mark("dispatch-start");
this.mark("dispatch-start");
const pipedActions = actions.map((a) => ({
type: this.actions.get(a.reducer).type,
params: a.params,
Expand All @@ -295,27 +297,27 @@ class Store {
}
const beforeMiddleswaresResult = yield this.executeMiddlewares(this._state.getValue(), MiddlewarePlacement.Before, callingAction);
if (beforeMiddleswaresResult === false) {
PLATFORM.performance.clearMarks();
PLATFORM.performance.clearMeasures();
this.clearMarks();
this.clearMeasures();
return;
}
let result = beforeMiddleswaresResult;
for (const action of pipedActions) {
result = yield action.reducer(result, ...action.params);
if (result === false) {
PLATFORM.performance.clearMarks();
PLATFORM.performance.clearMeasures();
this.clearMarks();
this.clearMeasures();
return;
}
PLATFORM.performance.mark("dispatch-after-reducer-" + action.type);
this.mark("dispatch-after-reducer-" + action.type);
if (!result && typeof result !== "object") {
throw new Error("The reducer has to return a new state");
}
}
let resultingState = yield this.executeMiddlewares(result, MiddlewarePlacement.After, callingAction);
if (resultingState === false) {
PLATFORM.performance.clearMarks();
PLATFORM.performance.clearMeasures();
this.clearMarks();
this.clearMeasures();
return;
}
if (isStateHistory(resultingState) &&
Expand All @@ -324,19 +326,19 @@ class Store {
resultingState = applyLimits(resultingState, this.options.history.limit);
}
this._state.next(resultingState);
PLATFORM.performance.mark("dispatch-end");
this.mark("dispatch-end");
if (this.options.measurePerformance === PerformanceMeasurement.StartEnd) {
PLATFORM.performance.measure("startEndDispatchDuration", "dispatch-start", "dispatch-end");
const measures = PLATFORM.performance.getEntriesByName("startEndDispatchDuration");
this.measure("startEndDispatchDuration", "dispatch-start", "dispatch-end");
const measures = PLATFORM.performance.getEntriesByName("startEndDispatchDuration", "measure");
this.logger[getLogType(this.options, "performanceLog", LogLevel.info)](`Total duration ${measures[0].duration} of dispatched action ${callingAction.name}:`, measures);
}
else if (this.options.measurePerformance === PerformanceMeasurement.All) {
const marks = PLATFORM.performance.getEntriesByType("mark");
const totalDuration = marks[marks.length - 1].startTime - marks[0].startTime;
this.logger[getLogType(this.options, "performanceLog", LogLevel.info)](`Total duration ${totalDuration} of dispatched action ${callingAction.name}:`, marks);
}
PLATFORM.performance.clearMarks();
PLATFORM.performance.clearMeasures();
this.clearMarks();
this.clearMeasures();
this.updateDevToolsState({ type: callingAction.name, params: callingAction.params }, resultingState);
});
}
Expand All @@ -360,7 +362,7 @@ class Store {
return yield prev;
}
finally {
PLATFORM.performance.mark(`dispatch-${placement}-${curr[0].name}`);
this.mark(`dispatch-${placement}-${curr[0].name}`);
}
}), state);
}
Expand Down Expand Up @@ -417,6 +419,22 @@ class Store {
registerHistoryMethods() {
this.registerAction("jump", jump);
}
mark(markName) {
this._markNames.add(markName);
PLATFORM.performance.mark(markName);
}
clearMarks() {
this._markNames.forEach((markName) => PLATFORM.performance.clearMarks(markName));
this._markNames.clear();
}
measure(measureName, startMarkName, endMarkName) {
this._measureNames.add(measureName);
PLATFORM.performance.measure(measureName, startMarkName, endMarkName);
}
clearMeasures() {
this._measureNames.forEach((measureName) => PLATFORM.performance.clearMeasures(measureName));
this._measureNames.clear();
}
}
function dispatchify(action) {
const store = Container.instance.get(Store);
Expand Down
Loading

0 comments on commit 0e08d28

Please sign in to comment.