Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
vue-server
Advanced tools
Vue.js server-side version
This is not an offical Vue.js version and it has no straight relation to it and its author.
The module is developed for specific needs of its authors and has some restrictions compared to Vue.js.
var vueServer = require('vue-server');
var Vue = new vueServer.renderer();
// For $root instance you should pass 'template' option instead of 'el'.
var vm = new Vue({
template: '<common-module></common-module>',
components: {
commonModule: {
template: '<div>Hello world!</div>'
}
}
});
vm.$on('vueServer.htmlReady', function(html) {
console.log(html); // '<div>Hello world!</div>'
});
VueServer.js | Vue.js |
---|---|
0.4.x-0.6.x | 1.0.0-migration |
VueServer.js is designed for static HTML rendering. It has no real reactivity.
Also, the module is not running original Vue.js on server. It has its own implementation.
It means VueServer.js is just trying to perfectly reproduce the same result as Vue.js does.
Because of the reasons listed above some of Vue.js functionality is not available.
VueServer.js does not share hooks with Vue.js. It has its own ones, partially equal to Vue.js'
Note: readyBe
is a bit experimental and its behaviour may be not correct.
VueServer.js | Vue.js |
---|---|
createdBe | created |
-- | beforeCompile |
compiledBe | compiled |
activateBe | activate |
readyBe | ready |
-- | attached |
-- | detached |
-- | beforeDestroy |
-- | destroyed |
vm.$watch
vm.$delete
vm.$eval
vm.$interpolate
vm.$appendTo
vm.$before
vm.$after
vm.$remove
vm.$mount
vm.$destroy
vm.$addChild
v-on
v-el
Because of using an extra light DOM version it's not possible to use custom directives too.
Well, actually, everything else is (maybe I forgot something).
It means you can use v-if
, filters
, partials
, async components
, wait-for
(or activate hook), events
etc.
Overall, it is possible to use the beloved complex component building system like in orignal Vue.js
It is recommended to precompile templates for faster rendering
var vueServer = require('vue-server');
var VueCompile = new vueServer.compiler();
var serverTemplate = VueCompile('<div>Hello world!</div>');
We've got a gulp.js plugin for that purpose. Soon it will be published too.
var vueServer = require('vue-server');
var Vue = new vueServer.renderer();
// Original Vue.js options. Can be used with VueServer.js too:
Vue.config.replace = false;
Vue.config.debug = true;
Vue.config.silent = false;
Vue.config.strict = false;
// VueServer.js options.
// On warnings and errors you can pass additional information about your VM;
Vue.config.onLogMessage = function (vm) {
if (vm.name) {
return vm.name;
} else {
return '';
}
};
renderServer
- accepts compiled template (a function from require('vue-server').compiler();
)FAQs
Vue.js server side version
The npm package vue-server receives a total of 4 weekly downloads. As such, vue-server popularity was classified as not popular.
We found that vue-server demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.