http-vue-loader
Advanced tools
Comparing version 1.3.0 to 1.3.1
{ | ||
"name": "http-vue-loader", | ||
"version": "1.3.0", | ||
"version": "1.3.1", | ||
"description": "Load .vue files directly from your html/js. No node.js environment, no build step.", | ||
@@ -5,0 +5,0 @@ "main": "./src/httpVueLoader.js", |
122
README.md
@@ -9,3 +9,3 @@ # http-vue-loader | ||
<template> | ||
<div class="hello">Hello {{who}}</div> | ||
<div class="hello">Hello {{who}}</div> | ||
</template> | ||
@@ -15,7 +15,7 @@ | ||
module.exports = { | ||
data: function() { | ||
return { | ||
who: 'world' | ||
} | ||
} | ||
data: function() { | ||
return { | ||
who: 'world' | ||
} | ||
} | ||
} | ||
@@ -26,3 +26,3 @@ </script> | ||
.hello { | ||
background-color: #ffe; | ||
background-color: #ffe; | ||
} | ||
@@ -40,7 +40,7 @@ </style> | ||
new Vue({ | ||
components: { | ||
'my-component': httpVueLoader('my-component.vue') | ||
}, | ||
... | ||
new Vue({ | ||
components: { | ||
'my-component': httpVueLoader('my-component.vue') | ||
}, | ||
... | ||
``` | ||
@@ -54,9 +54,9 @@ | ||
httpVueLoaderRegister(Vue, 'my-component.vue'); | ||
httpVueLoaderRegister(Vue, 'my-component.vue'); | ||
new Vue({ | ||
components: [ | ||
'my-component' | ||
}, | ||
... | ||
new Vue({ | ||
components: [ | ||
'my-component' | ||
}, | ||
... | ||
``` | ||
@@ -70,9 +70,9 @@ | ||
Vue.use(httpVueLoader); | ||
Vue.use(httpVueLoader); | ||
new Vue({ | ||
components: { | ||
'my-component': 'url:my-component.vue' | ||
}, | ||
... | ||
new Vue({ | ||
components: { | ||
'my-component': 'url:my-component.vue' | ||
}, | ||
... | ||
``` | ||
@@ -82,7 +82,7 @@ | ||
``` | ||
new Vue({ | ||
components: [ | ||
'url:my-component.vue' | ||
}, | ||
... | ||
new Vue({ | ||
components: [ | ||
'url:my-component.vue' | ||
}, | ||
... | ||
``` | ||
@@ -130,12 +130,12 @@ | ||
httpVueLoader.httpRequest = function(url) { | ||
return axios.get(url) | ||
.then(function(res) { | ||
return res.data; | ||
}) | ||
.catch(function(err) { | ||
return Promise.reject(err.status); | ||
}); | ||
return axios.get(url) | ||
.then(function(res) { | ||
return res.data; | ||
}) | ||
.catch(function(err) { | ||
return Promise.reject(err.status); | ||
}); | ||
} | ||
@@ -159,3 +159,3 @@ ``` | ||
return window.CoffeeScript.compile(scriptText, {bare: true}); | ||
return window.CoffeeScript.compile(scriptText, {bare: true}); | ||
} | ||
@@ -173,8 +173,8 @@ | ||
module.exports = | ||
components: {} | ||
data: -> | ||
{} | ||
computed: {} | ||
methods: {} | ||
components: {} | ||
data: -> | ||
{} | ||
computed: {} | ||
methods: {} | ||
</script> | ||
@@ -196,10 +196,10 @@ ... | ||
return new Promise(function(resolve, reject) { | ||
stylus.render(stylusText, {}, function(err, css) { | ||
return new Promise(function(resolve, reject) { | ||
stylus.render(stylusText, {}, function(err, css) { | ||
if (err) reject(err); | ||
resolve(css); | ||
}); | ||
}) | ||
if (err) reject(err); | ||
resolve(css); | ||
}); | ||
}) | ||
} | ||
@@ -214,11 +214,11 @@ | ||
border-radius() | ||
-webkit-border-radius: arguments | ||
-moz-border-radius: arguments | ||
border-radius: arguments | ||
border-radius() | ||
-webkit-border-radius: arguments | ||
-moz-border-radius: arguments | ||
border-radius: arguments | ||
form input | ||
padding: 5px | ||
border: 1px solid | ||
border-radius: 5px | ||
form input | ||
padding: 5px | ||
border: 1px solid | ||
border-radius: 5px | ||
@@ -225,0 +225,0 @@ </style> |
@@ -24,3 +24,3 @@ 'use strict'; | ||
if ( this.component.baseURI ) | ||
if ( tmpBaseElt ) | ||
this.component.getHead().removeChild(tmpBaseElt); | ||
@@ -91,3 +91,3 @@ }, | ||
// no template, no scopable style | ||
// no template, no scopable style needed | ||
if ( !hasTemplate ) | ||
@@ -145,5 +145,10 @@ return; | ||
compile: function(module) { | ||
var childModuleRequire = function(childUrl) { | ||
return httpVueLoader.require((childUrl.substr(0,2) === './' || childUrl.substr(0,3) === '../' ? this.component.baseURI : '') + childUrl); | ||
}.bind(this); | ||
try { | ||
Function('exports', 'require', 'module', this.getContent()).call(this.module.exports, this.module.exports, httpVueLoader.require, this.module); | ||
Function('exports', 'require', 'module', this.getContent()).call(this.module.exports, this.module.exports, childModuleRequire, this.module); | ||
} catch(ex) { | ||
@@ -270,3 +275,3 @@ | ||
if ( eltCx.elt.hasAttribute('lang') ) { | ||
if ( eltCx !== null && eltCx.elt.hasAttribute('lang') ) { | ||
@@ -302,4 +307,4 @@ var lang = eltCx.elt.getAttribute('lang'); | ||
return Promise.all(Array.prototype.concat( | ||
this.template.compile(), | ||
this.script.compile(), | ||
this.template && this.template.compile(), | ||
this.script && this.script.compile(), | ||
this.styles.map(function(style) { return style.compile() }) | ||
@@ -348,3 +353,3 @@ )) | ||
var exports = component.script.module.exports; | ||
var exports = component.script !== null ? component.script.module.exports : {}; | ||
@@ -420,3 +425,3 @@ if ( component.template !== null ) | ||
} | ||
httpVueLoader.langProcessor = {}; | ||
@@ -423,0 +428,0 @@ |
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
17977
291
0