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

@badrap/preload

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@badrap/preload - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

2

dist/index.js

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

function r(){}var t={functional:!0,props:["status","error"],render:function(r,t){return r("div",{},[t.props.status+" "+t.props.error.message])}},n=Symbol(),e=Symbol();function o(r,t){return void 0===r&&(r=404),void 0===t&&(t="Not found"),{$type:n,status:r,error:t instanceof Error?t:{message:t}}}function u(r){return{$type:e,to:r}}module.exports=function(i,c){void 0===c&&(c={});var a=c.context;void 0===a&&(a={});var s=c.beforePreload;void 0===s&&(s=r);var f=c.afterPreload;void 0===f&&(f=r);var l=c.errorComponent;void 0===l&&(l=t);var d=null,h=Symbol();function p(r){return new Promise(function(t,i){var c,p,v=function(r){return function(t){try{return f(),r&&r.call(this,t)}catch(r){return i(r)}}.bind(this)}.bind(this);c=null,p={},s();var m=function(){try{if(c){if(c.$type!==n)return c.$type===e?t(c.to):i(new Error("unknown action"));d={render:function(r){return r(l,{props:{status:c.status,error:c.error}})}}}else d={provide:function(){var r;return(r={})[h]=p,r},render:function(r){return r("router-view",{attrs:this.$attrs})}};return t()}catch(r){return i(r)}},y=function(r){try{throw r}catch(r){return v(i)(r)}};try{var b,$;function P(){var r=$();return g.bind(this,r[0],r[1])}function g(t,i){var s,f,l,d;return $=function(){return[t,i]},!(i[1]=i[0].next()).done&&(t=i[1].value,1)?(s=t.meta[h])?s().then(function(t){var i;try{return f=(i=t).key,(l=i.preload)?l(Object.assign({},{route:r,redirect:u,error:o},a)).then(function(r){try{return!(d=r)||d.$type!==e&&d.$type!==n?(p[f]=d,P):(c=d,[1])}catch(r){return y(r)}},y):P}catch(r){return y(r)}},y):P:[1]}return(b=function(r){for(;r;){if(r.then)return void r.then(b,y);try{if(r.pop){if(r.length)return r.pop()?w.call(this):r;r=P}else r=r.call(this)}catch(r){return y(r)}}}.bind(this))(g.bind(this,void 0,[r.matched[Symbol.iterator]()]));function w(){return v(m)()}}catch(r){y(r)}})}return[{path:"",component:{beforeRouteEnter:function(r,t,n){p(r).then(n,n)},beforeRouteUpdate:function(r,t,n){p(r).then(n,n)},render:function(r){return r(d,{key:this.$route.fullPath,attrs:this.$attrs})}},children:function r(t,n){return t.map(function(t){return n(Object.assign({},t,{children:t.children&&r(t.children,n)}))})}(i,function(r){var t,n=function(){return new Promise(function(t,n){var e,o,u;return(u=r.component,"function"!=typeof u?Promise.resolve(u):new Promise(function(r,t){Promise.resolve(u(r,t)).then(r,t)})).then(function(r){try{return(e=r).preload?(o=Symbol(),t({key:o,preload:e.preload,component:{extends:e,inject:{$preload:h},data:function(){return Object.assign({},this.$preload[o])}}})):t({key:null,preload:null,component:e})}catch(r){return n(r)}},n)})},e=null,o=function(){return e||(e=n()),e};return Object.assign({},r,{meta:Object.assign({},r.meta,(t={},t[h]=o,t)),component:function(){return new Promise(function(r,t){return o().then(function(n){try{return r(n.component)}catch(r){return t(r)}},t)})}})})}]};
function r(){}var t={functional:!0,props:["status","error"],render:function(r,t){return r("div",{},[t.props.status+" "+t.props.error.message])}},n=Symbol(),e=Symbol();function o(r,t){return void 0===r&&(r=404),void 0===t&&(t="Not found"),{$type:n,status:r,error:t instanceof Error?t:{message:t}}}function u(r){return{$type:e,to:r}}module.exports=function(i,c){void 0===c&&(c={});var a=c.context;void 0===a&&(a={});var s=c.beforePreload;void 0===s&&(s=r);var f=c.afterPreload;void 0===f&&(f=r);var l=c.errorComponent;void 0===l&&(l=t);var d=null,h=Symbol();function p(r){return new Promise(function(t,i){var c,p,v=function(r){return function(t){try{return f(),r&&r.call(this,t)}catch(r){return i(r)}}.bind(this)}.bind(this);c=null,p={},s();var m=function(){try{if(c){if(c.$type!==n)return c.$type===e?t(c.to):i(new Error("unknown action"));d={render:function(r){return r(l,{props:{status:c.status,error:c.error}})}}}else d={provide:function(){var r;return(r={})[h]=p,r},render:function(r){return r("router-view",{attrs:this.$attrs})}};return t()}catch(r){return i(r)}},y=function(r){try{throw r}catch(r){return v(i)(r)}};try{var b,$;function P(){var r=$();return g.bind(this,r[0],r[1])}function g(t,i){var s,f,l,d;return $=function(){return[t,i]},!(i[1]=i[0].next()).done&&(t=i[1].value,1)?(s=t.meta[h])?s().then(function(t){var i;try{return f=(i=t).key,(l=i.preload)?Promise.resolve(l(Object.assign({},{route:r,redirect:u,error:o},a))).then(function(r){try{return!(d=r)||d.$type!==e&&d.$type!==n?(p[f]=d,P):(c=d,[1])}catch(r){return y(r)}},y):P}catch(r){return y(r)}},y):P:[1]}return(b=function(r){for(;r;){if(r.then)return void r.then(b,y);try{if(r.pop){if(r.length)return r.pop()?w.call(this):r;r=P}else r=r.call(this)}catch(r){return y(r)}}}.bind(this))(g.bind(this,void 0,[r.matched[Symbol.iterator]()]));function w(){return v(m)()}}catch(r){y(r)}})}return[{path:"",component:{beforeRouteEnter:function(r,t,n){p(r).then(n,n)},beforeRouteUpdate:function(r,t,n){p(r).then(n,n)},render:function(r){return r(d,{key:this.$route.fullPath,attrs:this.$attrs})}},children:function r(t,n){return t.map(function(t){return n(Object.assign({},t,{children:t.children&&r(t.children,n)}))})}(i,function(r){var t,n=function(){return new Promise(function(t,n){var e,o,u;return(u=r.component,"function"!=typeof u?Promise.resolve(u):new Promise(function(r,t){Promise.resolve(u(r,t)).then(r,t)})).then(function(r){try{return(e=r).preload?(o=Symbol(),t({key:o,preload:e.preload,component:{extends:e,inject:{$preload:h},data:function(){return Object.assign({},this.$preload[o])}}})):t({key:null,preload:null,component:e})}catch(r){return n(r)}},n)})},e=null,o=function(){return e||(e=n()),e};return Object.assign({},r,{meta:Object.assign({},r.meta,(t={},t[h]=o,t)),component:function(){return new Promise(function(r,t){return o().then(function(n){try{return r(n.component)}catch(r){return t(r)}},t)})}})})}]};
//# sourceMappingURL=index.js.map
{
"name": "@badrap/preload",
"version": "0.0.2",
"version": "0.0.3",
"description": "Data preloading for vue-router, similar to Sapper's preload or Nuxt.js's asyncData",

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

@@ -119,3 +119,5 @@ function mapRoutes(routes, func) {

}
const data = await preload({ route: to, redirect, error, ...context });
const data = await Promise.resolve(
preload({ route: to, redirect, error, ...context })
);
if (

@@ -122,0 +124,0 @@ data &&

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