Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

atomic-router

Package Overview
Dependencies
Maintainers
1
Versions
60
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

atomic-router - npm Package Compare versions

Comparing version 0.4.2 to 0.4.3

6

dist/atomic-router.cjs.development.js

@@ -968,2 +968,6 @@ 'use strict';

var getPathname = function getPathname(path) {
return new URL("http://_" + path).pathname;
};
function buildPath(_ref) {

@@ -981,3 +985,3 @@ var pathCreator = _ref.pathCreator,

actualPath = _ref2.actualPath;
var matches = pathToRegexp.match(pathCreator)(actualPath);
var matches = pathToRegexp.match(pathCreator)(getPathname(actualPath));

@@ -984,0 +988,0 @@ if (matches) {

2

dist/atomic-router.cjs.production.min.js

@@ -1,2 +0,2 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("effector"),r=require("path-to-regexp");function e(t,r,e,n,o,a,i){try{var u=t[a](i),c=u.value}catch(t){return void e(t)}u.done?r(c):Promise.resolve(c).then(n,o)}function n(t){return function(){var r=this,n=arguments;return new Promise((function(o,a){var i=t.apply(r,n);function u(t){e(i,o,a,u,c,"next",t)}function c(t){e(i,o,a,u,c,"throw",t)}u(void 0)}))}}function o(){return(o=Object.assign||function(t){for(var r=1;r<arguments.length;r++){var e=arguments[r];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])}return t}).apply(this,arguments)}function a(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=new Array(r);e<r;e++)n[e]=t[e];return n}function i(t,r){var e="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(e)return(e=e.call(t)).next.bind(e);if(Array.isArray(t)||(e=function(t,r){if(t){if("string"==typeof t)return a(t,void 0);var e=Object.prototype.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?a(t,void 0):void 0}}(t))||r&&t&&"number"==typeof t.length){e&&(t=e);var n=0;return function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var u,c=(function(t){var r=function(t){var r=Object.prototype,e=r.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",a=n.asyncIterator||"@@asyncIterator",i=n.toStringTag||"@@toStringTag";function u(t,r,e){return Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}),t[r]}try{u({},"")}catch(t){u=function(t,r,e){return t[r]=e}}function c(t,r,e,n){var o=Object.create((r&&r.prototype instanceof h?r:h).prototype),a=new L(n||[]);return o._invoke=function(t,r,e){var n="suspendedStart";return function(o,a){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw a;return{value:void 0,done:!0}}for(e.method=o,e.arg=a;;){var i=e.delegate;if(i){var u=b(i,e);if(u){if(u===f)continue;return u}}if("next"===e.method)e.sent=e._sent=e.arg;else if("throw"===e.method){if("suspendedStart"===n)throw n="completed",e.arg;e.dispatchException(e.arg)}else"return"===e.method&&e.abrupt("return",e.arg);n="executing";var c=s(t,r,e);if("normal"===c.type){if(n=e.done?"completed":"suspendedYield",c.arg===f)continue;return{value:c.arg,done:e.done}}"throw"===c.type&&(n="completed",e.method="throw",e.arg=c.arg)}}}(t,e,a),o}function s(t,r,e){try{return{type:"normal",arg:t.call(r,e)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var f={};function h(){}function p(){}function l(){}var d={};u(d,o,(function(){return this}));var y=Object.getPrototypeOf,v=y&&y(y(k([])));v&&v!==r&&e.call(v,o)&&(d=v);var m=l.prototype=h.prototype=Object.create(d);function g(t){["next","throw","return"].forEach((function(r){u(t,r,(function(t){return this._invoke(r,t)}))}))}function w(t,r){var n;this._invoke=function(o,a){function i(){return new r((function(n,i){!function n(o,a,i,u){var c=s(t[o],t,a);if("throw"!==c.type){var f=c.arg,h=f.value;return h&&"object"==typeof h&&e.call(h,"__await")?r.resolve(h.__await).then((function(t){n("next",t,i,u)}),(function(t){n("throw",t,i,u)})):r.resolve(h).then((function(t){f.value=t,i(f)}),(function(t){return n("throw",t,i,u)}))}u(c.arg)}(o,a,n,i)}))}return n=n?n.then(i,i):i()}}function b(t,r){var e=t.iterator[r.method];if(void 0===e){if(r.delegate=null,"throw"===r.method){if(t.iterator.return&&(r.method="return",r.arg=void 0,b(t,r),"throw"===r.method))return f;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var n=s(e,t.iterator,r.arg);if("throw"===n.type)return r.method="throw",r.arg=n.arg,r.delegate=null,f;var o=n.arg;return o?o.done?(r[t.resultName]=o.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=void 0),r.delegate=null,f):o:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,f)}function x(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]),2 in t&&(r.finallyLoc=t[2],r.afterLoc=t[3]),this.tryEntries.push(r)}function E(t){var r=t.completion||{};r.type="normal",delete r.arg,t.completion=r}function L(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(x,this),this.reset(!0)}function k(t){if(t){var r=t[o];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,a=function r(){for(;++n<t.length;)if(e.call(t,n))return r.value=t[n],r.done=!1,r;return r.value=void 0,r.done=!0,r};return a.next=a}}return{next:O}}function O(){return{value:void 0,done:!0}}return p.prototype=l,u(m,"constructor",l),u(l,"constructor",p),p.displayName=u(l,i,"GeneratorFunction"),t.isGeneratorFunction=function(t){var r="function"==typeof t&&t.constructor;return!!r&&(r===p||"GeneratorFunction"===(r.displayName||r.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,l):(t.__proto__=l,u(t,i,"GeneratorFunction")),t.prototype=Object.create(m),t},t.awrap=function(t){return{__await:t}},g(w.prototype),u(w.prototype,a,(function(){return this})),t.AsyncIterator=w,t.async=function(r,e,n,o,a){void 0===a&&(a=Promise);var i=new w(c(r,e,n,o),a);return t.isGeneratorFunction(e)?i:i.next().then((function(t){return t.done?t.value:i.next()}))},g(m),u(m,i,"Generator"),u(m,o,(function(){return this})),u(m,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var r=[];for(var e in t)r.push(e);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},t.values=k,L.prototype={constructor:L,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(E),!t)for(var r in this)"t"===r.charAt(0)&&e.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function n(e,n){return i.type="throw",i.arg=t,r.next=e,n&&(r.method="next",r.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],i=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var u=e.call(a,"catchLoc"),c=e.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(t,r){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&e.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===t||"continue"===t)&&a.tryLoc<=r&&r<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=t,i.arg=r,a?(this.method="next",this.next=a.finallyLoc,f):this.complete(i)},complete:function(t,r){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&r&&(this.next=r),f},finish:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),E(e),f}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.tryLoc===t){var n=e.completion;if("throw"===n.type){var o=n.arg;E(e)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,e){return this.delegate={iterator:k(t),resultName:r,nextLoc:e},"next"===this.method&&(this.arg=void 0),f}},t}(t.exports);try{regeneratorRuntime=r}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=r:Function("r","regeneratorRuntime = r")(r)}}(u={exports:{}}),u.exports);function s(t){var e=t.params,n=t.query;return r.compile(t.pathCreator)(e)+(Object.keys(n).length?"?"+new URLSearchParams(n):"")}function f(t){var e=t.actualPath,n=r.match(t.pathCreator)(e);return n?{matches:!0,params:n.params}:{matches:!1}}var h=t.createEffect((function(t){if(!t.history)throw new Error("[Routing] No history provided");return t.history[t.method](t.path,{}),t}),{name:"historyPushFx",sid:"sn2691"});exports.buildPath=s,exports.createHistoryRouter=function(r){var e=function(t){for(var r,e=[],n=function(){var t=r.value;Array.isArray(t.route)?e.push.apply(e,t.route.map((function(r){return o({},t,{route:r})}))):e.push(t)},a=i(t);!(r=a()).done;)n();return e}(r.routes),a=t.createEvent({name:"setHistory",sid:"-d2vpek"}),u=t.createEvent({name:"routeNotFound",sid:"-y4sqp2"}),p=t.createStore({},{name:"$query",sid:"hnxt1l"}),l=t.createStore("",{name:"$path",sid:"-sa8poc"}),d=t.createStore([],{name:"$activeRoutes",sid:"62zlkr"}),y=t.createStore(null,{and:{serialize:"ignore"},name:"$history",sid:"-8w64dv"}).on(a,(function(t,r){return r})),v=t.attach({and:{source:{history:y},effect:h,mapParams:function(t,r){return o({history:r.history},t)}},or:{name:"pushFx",sid:"cnhqec"}}),m=t.createEffect((function(t){var r=t.params,e=t.query;return{path:s({pathCreator:t.route.path,params:r,query:e}),params:r,query:e,method:"push"}}),{name:"enteredFx",sid:"a3ftbh"}),g=t.createEffect((function(t){for(var r,n=t.path,o=t.query,a=[],u=[],c=i(e);!(r=c()).done;){var s=r.value,h=f({pathCreator:s.path,actualPath:n});(h.matches?a:u).push({route:s,params:h.params,query:o})}return{entered:a,left:u}}),{name:"recalculateFx",sid:"-9sft4b"});l.on(g.done,(function(t,r){return r.params.path})),p.on(g.done,(function(t,r){return r.params.query})),d.on(g.doneData,(function(t,r){return r.entered.map((function(t){return t.route.route}))})),t.sample({and:[{clock:m.doneData,target:v}],or:{sid:"7b58a0"}}),t.sample({and:[{clock:v.doneData,target:g}],or:{sid:"7dceng"}}),t.guard({and:[{clock:g.doneData,filter:function(t){return 0===t.entered.length},target:u}],or:{sid:"7rn22u"}});for(var w,b=g.doneData.map((function(t){return t.entered})),x=g.doneData.map((function(t){return t.left})),E=function(){var r=w.value;t.sample({and:[{clock:r.route.navigate.doneData,fn:function(t){return{route:r,params:t.params,query:t.query}},target:m}],or:{sid:"-k06gpv"}}),t.guard({and:[{clock:b.filterMap((function(t){return t.find((function(t){return t.route===r}))})),filter:r.route.$isOpened.map((function(t){return t})),target:r.route.updated}],or:{sid:"-jj4ubo"}}),t.guard({and:[{clock:b.filterMap((function(t){return t.find((function(t){return t.route===r}))})),filter:r.route.$isOpened.map((function(t){return!t})),target:r.route.opened}],or:{sid:"-j36t47"}}),t.guard({and:[{clock:x.filterMap((function(t){return t.find((function(t){return t.route===r}))})),filter:r.route.$isOpened,target:r.route.left}],or:{sid:"-iysgdb"}})},L=i(e);!(w=L()).done;)E();var k,O=t.attach({and:{source:{history:y},effect:(k=n(c.mark((function t(r){var e,n;return c.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=[(e=r.history).location.pathname,Object.fromEntries(new URLSearchParams(e.location.search))],t.abrupt("return",{path:n[0],query:n[1]});case 3:case"end":return t.stop()}}),t)}))),function(t){return k.apply(this,arguments)})},or:{name:"recheckFx",sid:"vv2de1"}});t.sample({and:[{source:O.doneData,target:g}],or:{sid:"-hlaz29"}});var j,q=t.attach({and:{source:{history:y},effect:(j=n(c.mark((function r(e){var n,o;return c.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:n=e.history,o=O;try{o=t.scopeBind(O)}catch(t){}return n.listen((function(){o()})),r.abrupt("return",!0);case 5:case"end":return r.stop()}}),r)}))),function(t){return j.apply(this,arguments)})},or:{name:"subscribeHistoryFx",sid:"-xa0ymt"}});return r.hydrate||t.sample({and:[{clock:q.doneData,target:O}],or:{sid:"-g8x2r1"}}),t.sample({and:[{clock:y,target:q}],or:{sid:"-g663vo"}}),{$path:l,$query:p,$activeRoutes:d,$history:y,setHistory:a,push:v,routes:e,routeNotFound:u}},exports.createRoute=function(){var r=t.createEffect(function(){var t=n(c.mark((function t(r){return c.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",{params:r.params||{},query:r.query||{}});case 2:case"end":return t.stop()}}),t)})));return function(r){return t.apply(this,arguments)}}(),{name:"navigateFx",sid:"-b6kut4"}),e=t.attach({and:{effect:r,mapParams:function(t){return{params:t||{},query:{}}}},or:{name:"openFx",sid:"68re1x"}}),o=t.createStore(!1,{name:"$isOpened",sid:"5rn6x4"}),a=t.createStore({},{name:"$params",sid:"-kl1vo"}),i=t.createStore({},{name:"$query",sid:"-14b2z9"}),u=t.createEvent({name:"opened",sid:"-r2wl2p"}),s=t.createEvent({name:"updated",sid:"grv23u"}),f=t.createEvent({name:"left",sid:"mn0sj1"});return o.on(u,(function(){return!0})).on(f,(function(){return!1})),a.on(u,(function(t,r){return r.params})).on(s,(function(t,r){return r.params})),i.on(u,(function(t,r){return r.query})).on(s,(function(t,r){return r.query})),t.sample({and:[{clock:r.doneData,target:u}],or:{sid:"-xlbo7d"}}),{$isOpened:o,$params:a,$query:i,opened:u,updated:s,left:f,navigate:r,open:e}},exports.matchPath=f;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("effector"),r=require("path-to-regexp");function e(t,r,e,n,o,a,i){try{var u=t[a](i),c=u.value}catch(t){return void e(t)}u.done?r(c):Promise.resolve(c).then(n,o)}function n(t){return function(){var r=this,n=arguments;return new Promise((function(o,a){var i=t.apply(r,n);function u(t){e(i,o,a,u,c,"next",t)}function c(t){e(i,o,a,u,c,"throw",t)}u(void 0)}))}}function o(){return(o=Object.assign||function(t){for(var r=1;r<arguments.length;r++){var e=arguments[r];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])}return t}).apply(this,arguments)}function a(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=new Array(r);e<r;e++)n[e]=t[e];return n}function i(t,r){var e="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(e)return(e=e.call(t)).next.bind(e);if(Array.isArray(t)||(e=function(t,r){if(t){if("string"==typeof t)return a(t,void 0);var e=Object.prototype.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?a(t,void 0):void 0}}(t))||r&&t&&"number"==typeof t.length){e&&(t=e);var n=0;return function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var u,c=(function(t){var r=function(t){var r=Object.prototype,e=r.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",a=n.asyncIterator||"@@asyncIterator",i=n.toStringTag||"@@toStringTag";function u(t,r,e){return Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}),t[r]}try{u({},"")}catch(t){u=function(t,r,e){return t[r]=e}}function c(t,r,e,n){var o=Object.create((r&&r.prototype instanceof h?r:h).prototype),a=new L(n||[]);return o._invoke=function(t,r,e){var n="suspendedStart";return function(o,a){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw a;return{value:void 0,done:!0}}for(e.method=o,e.arg=a;;){var i=e.delegate;if(i){var u=b(i,e);if(u){if(u===f)continue;return u}}if("next"===e.method)e.sent=e._sent=e.arg;else if("throw"===e.method){if("suspendedStart"===n)throw n="completed",e.arg;e.dispatchException(e.arg)}else"return"===e.method&&e.abrupt("return",e.arg);n="executing";var c=s(t,r,e);if("normal"===c.type){if(n=e.done?"completed":"suspendedYield",c.arg===f)continue;return{value:c.arg,done:e.done}}"throw"===c.type&&(n="completed",e.method="throw",e.arg=c.arg)}}}(t,e,a),o}function s(t,r,e){try{return{type:"normal",arg:t.call(r,e)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var f={};function h(){}function p(){}function l(){}var d={};u(d,o,(function(){return this}));var y=Object.getPrototypeOf,v=y&&y(y(k([])));v&&v!==r&&e.call(v,o)&&(d=v);var m=l.prototype=h.prototype=Object.create(d);function g(t){["next","throw","return"].forEach((function(r){u(t,r,(function(t){return this._invoke(r,t)}))}))}function w(t,r){var n;this._invoke=function(o,a){function i(){return new r((function(n,i){!function n(o,a,i,u){var c=s(t[o],t,a);if("throw"!==c.type){var f=c.arg,h=f.value;return h&&"object"==typeof h&&e.call(h,"__await")?r.resolve(h.__await).then((function(t){n("next",t,i,u)}),(function(t){n("throw",t,i,u)})):r.resolve(h).then((function(t){f.value=t,i(f)}),(function(t){return n("throw",t,i,u)}))}u(c.arg)}(o,a,n,i)}))}return n=n?n.then(i,i):i()}}function b(t,r){var e=t.iterator[r.method];if(void 0===e){if(r.delegate=null,"throw"===r.method){if(t.iterator.return&&(r.method="return",r.arg=void 0,b(t,r),"throw"===r.method))return f;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var n=s(e,t.iterator,r.arg);if("throw"===n.type)return r.method="throw",r.arg=n.arg,r.delegate=null,f;var o=n.arg;return o?o.done?(r[t.resultName]=o.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=void 0),r.delegate=null,f):o:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,f)}function x(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]),2 in t&&(r.finallyLoc=t[2],r.afterLoc=t[3]),this.tryEntries.push(r)}function E(t){var r=t.completion||{};r.type="normal",delete r.arg,t.completion=r}function L(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(x,this),this.reset(!0)}function k(t){if(t){var r=t[o];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,a=function r(){for(;++n<t.length;)if(e.call(t,n))return r.value=t[n],r.done=!1,r;return r.value=void 0,r.done=!0,r};return a.next=a}}return{next:O}}function O(){return{value:void 0,done:!0}}return p.prototype=l,u(m,"constructor",l),u(l,"constructor",p),p.displayName=u(l,i,"GeneratorFunction"),t.isGeneratorFunction=function(t){var r="function"==typeof t&&t.constructor;return!!r&&(r===p||"GeneratorFunction"===(r.displayName||r.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,l):(t.__proto__=l,u(t,i,"GeneratorFunction")),t.prototype=Object.create(m),t},t.awrap=function(t){return{__await:t}},g(w.prototype),u(w.prototype,a,(function(){return this})),t.AsyncIterator=w,t.async=function(r,e,n,o,a){void 0===a&&(a=Promise);var i=new w(c(r,e,n,o),a);return t.isGeneratorFunction(e)?i:i.next().then((function(t){return t.done?t.value:i.next()}))},g(m),u(m,i,"Generator"),u(m,o,(function(){return this})),u(m,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var r=[];for(var e in t)r.push(e);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},t.values=k,L.prototype={constructor:L,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(E),!t)for(var r in this)"t"===r.charAt(0)&&e.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function n(e,n){return i.type="throw",i.arg=t,r.next=e,n&&(r.method="next",r.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],i=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var u=e.call(a,"catchLoc"),c=e.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(t,r){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&e.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===t||"continue"===t)&&a.tryLoc<=r&&r<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=t,i.arg=r,a?(this.method="next",this.next=a.finallyLoc,f):this.complete(i)},complete:function(t,r){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&r&&(this.next=r),f},finish:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),E(e),f}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.tryLoc===t){var n=e.completion;if("throw"===n.type){var o=n.arg;E(e)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,e){return this.delegate={iterator:k(t),resultName:r,nextLoc:e},"next"===this.method&&(this.arg=void 0),f}},t}(t.exports);try{regeneratorRuntime=r}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=r:Function("r","regeneratorRuntime = r")(r)}}(u={exports:{}}),u.exports);function s(t){var e=t.params,n=t.query;return r.compile(t.pathCreator)(e)+(Object.keys(n).length?"?"+new URLSearchParams(n):"")}function f(t){var e=t.actualPath,n=r.match(t.pathCreator)(new URL("http://_"+e).pathname);return n?{matches:!0,params:n.params}:{matches:!1}}var h=t.createEffect((function(t){if(!t.history)throw new Error("[Routing] No history provided");return t.history[t.method](t.path,{}),t}),{name:"historyPushFx",sid:"sn2691"});exports.buildPath=s,exports.createHistoryRouter=function(r){var e=function(t){for(var r,e=[],n=function(){var t=r.value;Array.isArray(t.route)?e.push.apply(e,t.route.map((function(r){return o({},t,{route:r})}))):e.push(t)},a=i(t);!(r=a()).done;)n();return e}(r.routes),a=t.createEvent({name:"setHistory",sid:"-d2vpek"}),u=t.createEvent({name:"routeNotFound",sid:"-y4sqp2"}),p=t.createStore({},{name:"$query",sid:"hnxt1l"}),l=t.createStore("",{name:"$path",sid:"-sa8poc"}),d=t.createStore([],{name:"$activeRoutes",sid:"62zlkr"}),y=t.createStore(null,{and:{serialize:"ignore"},name:"$history",sid:"-8w64dv"}).on(a,(function(t,r){return r})),v=t.attach({and:{source:{history:y},effect:h,mapParams:function(t,r){return o({history:r.history},t)}},or:{name:"pushFx",sid:"cnhqec"}}),m=t.createEffect((function(t){var r=t.params,e=t.query;return{path:s({pathCreator:t.route.path,params:r,query:e}),params:r,query:e,method:"push"}}),{name:"enteredFx",sid:"a3ftbh"}),g=t.createEffect((function(t){for(var r,n=t.path,o=t.query,a=[],u=[],c=i(e);!(r=c()).done;){var s=r.value,h=f({pathCreator:s.path,actualPath:n});(h.matches?a:u).push({route:s,params:h.params,query:o})}return{entered:a,left:u}}),{name:"recalculateFx",sid:"-9sft4b"});l.on(g.done,(function(t,r){return r.params.path})),p.on(g.done,(function(t,r){return r.params.query})),d.on(g.doneData,(function(t,r){return r.entered.map((function(t){return t.route.route}))})),t.sample({and:[{clock:m.doneData,target:v}],or:{sid:"7b58a0"}}),t.sample({and:[{clock:v.doneData,target:g}],or:{sid:"7dceng"}}),t.guard({and:[{clock:g.doneData,filter:function(t){return 0===t.entered.length},target:u}],or:{sid:"7rn22u"}});for(var w,b=g.doneData.map((function(t){return t.entered})),x=g.doneData.map((function(t){return t.left})),E=function(){var r=w.value;t.sample({and:[{clock:r.route.navigate.doneData,fn:function(t){return{route:r,params:t.params,query:t.query}},target:m}],or:{sid:"-k06gpv"}}),t.guard({and:[{clock:b.filterMap((function(t){return t.find((function(t){return t.route===r}))})),filter:r.route.$isOpened.map((function(t){return t})),target:r.route.updated}],or:{sid:"-jj4ubo"}}),t.guard({and:[{clock:b.filterMap((function(t){return t.find((function(t){return t.route===r}))})),filter:r.route.$isOpened.map((function(t){return!t})),target:r.route.opened}],or:{sid:"-j36t47"}}),t.guard({and:[{clock:x.filterMap((function(t){return t.find((function(t){return t.route===r}))})),filter:r.route.$isOpened,target:r.route.left}],or:{sid:"-iysgdb"}})},L=i(e);!(w=L()).done;)E();var k,O=t.attach({and:{source:{history:y},effect:(k=n(c.mark((function t(r){var e,n;return c.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=[(e=r.history).location.pathname,Object.fromEntries(new URLSearchParams(e.location.search))],t.abrupt("return",{path:n[0],query:n[1]});case 3:case"end":return t.stop()}}),t)}))),function(t){return k.apply(this,arguments)})},or:{name:"recheckFx",sid:"vv2de1"}});t.sample({and:[{source:O.doneData,target:g}],or:{sid:"-hlaz29"}});var j,q=t.attach({and:{source:{history:y},effect:(j=n(c.mark((function r(e){var n,o;return c.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:n=e.history,o=O;try{o=t.scopeBind(O)}catch(t){}return n.listen((function(){o()})),r.abrupt("return",!0);case 5:case"end":return r.stop()}}),r)}))),function(t){return j.apply(this,arguments)})},or:{name:"subscribeHistoryFx",sid:"-xa0ymt"}});return r.hydrate||t.sample({and:[{clock:q.doneData,target:O}],or:{sid:"-g8x2r1"}}),t.sample({and:[{clock:y,target:q}],or:{sid:"-g663vo"}}),{$path:l,$query:p,$activeRoutes:d,$history:y,setHistory:a,push:v,routes:e,routeNotFound:u}},exports.createRoute=function(){var r=t.createEffect(function(){var t=n(c.mark((function t(r){return c.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",{params:r.params||{},query:r.query||{}});case 2:case"end":return t.stop()}}),t)})));return function(r){return t.apply(this,arguments)}}(),{name:"navigateFx",sid:"-b6kut4"}),e=t.attach({and:{effect:r,mapParams:function(t){return{params:t||{},query:{}}}},or:{name:"openFx",sid:"68re1x"}}),o=t.createStore(!1,{name:"$isOpened",sid:"5rn6x4"}),a=t.createStore({},{name:"$params",sid:"-kl1vo"}),i=t.createStore({},{name:"$query",sid:"-14b2z9"}),u=t.createEvent({name:"opened",sid:"-r2wl2p"}),s=t.createEvent({name:"updated",sid:"grv23u"}),f=t.createEvent({name:"left",sid:"mn0sj1"});return o.on(u,(function(){return!0})).on(f,(function(){return!1})),a.on(u,(function(t,r){return r.params})).on(s,(function(t,r){return r.params})),i.on(u,(function(t,r){return r.query})).on(s,(function(t,r){return r.query})),t.sample({and:[{clock:r.doneData,target:u}],or:{sid:"-xlbo7d"}}),{$isOpened:o,$params:a,$query:i,opened:u,updated:s,left:f,navigate:r,open:e}},exports.matchPath=f;
//# sourceMappingURL=atomic-router.cjs.production.min.js.map

@@ -964,2 +964,6 @@ import { createEffect, attach, createStore, createEvent, sample, guard, scopeBind } from 'effector';

var getPathname = function getPathname(path) {
return new URL("http://_" + path).pathname;
};
function buildPath(_ref) {

@@ -977,3 +981,3 @@ var pathCreator = _ref.pathCreator,

actualPath = _ref2.actualPath;
var matches = match(pathCreator)(actualPath);
var matches = match(pathCreator)(getPathname(actualPath));

@@ -980,0 +984,0 @@ if (matches) {

{
"version": "0.4.2",
"version": "0.4.3",
"license": "MIT",

@@ -4,0 +4,0 @@ "main": "dist/index.js",

@@ -5,2 +5,4 @@ import { match, compile } from 'path-to-regexp';

const getPathname = (path: string) => new URL(`http://_${path}`).pathname;
type BuildPathParams<Params extends RouteParams> = {

@@ -32,3 +34,3 @@ pathCreator: PathCreator<Params>;

}: MatchPathParams<Params>) {
const matches = match(pathCreator)(actualPath);
const matches = match(pathCreator)(getPathname(actualPath));
if (matches) {

@@ -35,0 +37,0 @@ return { matches: true, params: matches.params } as const;

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc