Socket
Socket
Sign inDemoInstall

mithril-render-loader

Package Overview
Dependencies
Maintainers
3
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mithril-render-loader - npm Package Compare versions

Comparing version 0.7.0 to 0.8.0

test/app/index-one.view.js

32

index.js

@@ -6,2 +6,4 @@ /* eslint no-invalid-this: 0 */

const render = require("mithril-node-render");
// const fs = require("fs");
// const path = require("path");

@@ -13,9 +15,15 @@

// this promise is used to ensure no multiple renderings are done in parallel (which may mess up component states)
let whenFinishedRendering = Promise.resolve();
function mithrilRenderLoader(view) {
// prevents some(!) messed up states - the loader is currently fast enough enough
function mithrilRenderLoader() {
whenFinishedRendering = whenFinishedRendering
.then(renderView.bind(this, this.async()));
}
function renderView(done) {
// console.log("NODE RENDER MITHRIL", this.resourcePath);
const timeStart = Date.now();
// the render-mithril operation is async
var done = this.async();
// options

@@ -76,3 +84,4 @@ const o = Object.assign({

const dependenciesBefore = Object.keys(require.cache);
view = require(this.resourcePath);
delete require.cache[this.resourcePath];
const view = require(this.resourcePath);
let timeResolve;

@@ -95,3 +104,3 @@

// fetch the required data and render the component
render(m(view, o.model), renderOptions)
return render(m(view, Object.assign({ UID: this.resourcePath }, o.model), renderOptions))
.then((html) => {

@@ -126,7 +135,4 @@ timeResolve = Date.now();

o.profile && logTime(`resolve webpack requires ${this.resource}`, timeResolve, Date.now());
results.forEach((data) => {
console.log("insert", data.source);
// console.log("insert", data.source);
html = html.replace(data.id, data.source);

@@ -140,2 +146,8 @@ });

// console.log("WRITE FILE", `debug-${this.resourcePath.split("/").pop()}.html`);
// fs.writeFileSync(
// path.join(process.cwd(), `debug-${this.resourcePath.split("/").pop()}.html`),
// html
// );
if (o.export) { // if no html loader

@@ -142,0 +154,0 @@ return done(null, `module.exports = ${JSON.stringify(html)}`);

{
"name": "mithril-render-loader",
"version": "0.7.0",
"version": "0.8.0",
"description": "",

@@ -29,2 +29,2 @@ "main": "index.js",

}
}
}
const m = require("mithril");
const Item = require("./item.view");

@@ -6,3 +7,5 @@

view(vnode) {
return m("ul.testpage-list",
console.log("LIST", vnode.attrs.UID);
const result = m("ul.testpage-list",
{

@@ -14,5 +17,7 @@ oninit(vul) {

},
vnode.attrs.items.map((message) => m("li", message))
vnode.attrs.items.map((message) => m(Item, { STATE: vnode.attrs.STATE, UID: vnode.attrs.UID }, message))
);
console.log("FROM LIST", vnode.attrs.STATE.items.length);
}
};

@@ -11,3 +11,4 @@ const path = require("path");

entry: [
"./test/app/index.view.js"
"./test/app/index-one.view.js",
"./test/app/index-two.view.js"
],

@@ -23,3 +24,3 @@

path: path.join(__dirname, "build"),
filename: "[name]-[chunkhash].js",
filename: "[name].js",
chunkFilename: "[id].js",

@@ -35,3 +36,4 @@ pathinfo: USE_SOURCEMAPS,

test: [
path.join(__dirname, "test", "app", "index.view.js")
path.join(__dirname, "test", "app", "index-one.view.js"),
path.join(__dirname, "test", "app", "index-two.view.js")
],

@@ -54,2 +56,3 @@ use: [

options: {
cacheable: false,
model: {

@@ -56,0 +59,0 @@ title: "mithril-render-loader testpage",

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