Socket
Socket
Sign inDemoInstall

@stackflow/plugin-history-sync

Package Overview
Dependencies
13
Maintainers
3
Versions
110
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.4.0 to 1.5.0

5

dist/index.js

@@ -340,2 +340,5 @@ "use strict";

const fallbackActivityPath = fallbackActivityRoute == null ? void 0 : fallbackActivityRoute.path;
const fallbackActivityParams = urlSearchParamsToMap(
pathToUrl(currentPath).searchParams
);
return [

@@ -345,3 +348,3 @@ (0, import_core.makeEvent)("Pushed", {

activityName: fallbackActivityName,
activityParams: {},
activityParams: __spreadValues({}, fallbackActivityParams),
eventDate: new Date().getTime() - MINUTE,

@@ -348,0 +351,0 @@ activityContext: {

4

dist/makeTemplate.d.ts
import type { Route } from "./RouteLike";
export declare function pathToUrl(path: string): URL;
export declare function urlSearchParamsToMap(urlSearchParams: URLSearchParams): {
[key: string]: any;
};
/**

@@ -3,0 +7,0 @@ * import { UrlPatternOptions } from "url-pattern"

{
"name": "@stackflow/plugin-history-sync",
"version": "1.4.0",
"version": "1.5.0",
"repository": {
"type": "git",
"url": "https://github.com/daangn/stackflow.git",
"directory": "extensions/plugin-history-sync"
},
"license": "MIT",

@@ -5,0 +10,0 @@ "exports": {

@@ -1296,2 +1296,33 @@ import type {

});
test("historySyncPlugin - search param이 붙은 채로 fallback activity로 이동하는 경우 activity params로 만들어줍니다", async () => {
history = createMemoryHistory({
initialEntries: ["/not/found/route/?foo=1&bar=2"],
});
const coreStore = stackflow({
activityNames: ["Home", "Article"],
plugins: [
historySyncPlugin({
history,
routes: {
Home: "/home",
Article: "/articles/:articleId",
},
fallbackActivity: () => "Home",
}),
],
});
actions = makeActionsProxy({
actions: coreStore.actions,
});
const stack = await actions.getStack();
expect(activeActivity(stack)?.name).toEqual("Home");
expect(activeActivity(stack)?.params.foo).toEqual("1");
expect(activeActivity(stack)?.params.bar).toEqual("2");
expect(path(history.location)).toEqual("/home/?foo=1&bar=2");
});
});

@@ -5,7 +5,7 @@ import UrlPattern from "url-pattern";

function pathToUrl(path: string) {
export function pathToUrl(path: string) {
return new URL(path, "file://");
}
function urlSearchParamsToMap(urlSearchParams: URLSearchParams) {
export function urlSearchParamsToMap(urlSearchParams: URLSearchParams) {
const map: { [key: string]: any } = {};

@@ -12,0 +12,0 @@

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

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc