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

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.6.0 to 0.7.0

14

index.js

@@ -15,3 +15,2 @@ /* eslint no-invalid-this: 0 */

// prevents some(!) messed up states - the loader is currently fast enough enough
this.cacheable(false);

@@ -26,4 +25,5 @@ const timeStart = Date.now();

"export": false, // use module.exports or return result as string (html-loader)
cacheable: true, // deactivate cache, forcing a rebuild each time
// mithril-render-node options @see https://github.com/MithrilJS/mithril-node-render#options
escapeAttributeValue: false, // either a boolean or a function (value) => value to parse attributes
escapeAttributes: false, // either a boolean or a function (value) => value to parse attributes
escapeString: true, // A filter function for string nodes

@@ -38,2 +38,6 @@ strict: false // true for xml/xhtml

if (o.cacheable === false) {
this.cacheable(false);
}
// pass a uid to mithril component

@@ -79,6 +83,6 @@ o.model.ID = `${this.resourcePath}${Date.now()}${Math.random()}`;

const renderOptions = { strict: o.strict };
if (o.escapeAttributeValue === false) {
if (o.escapeAttributes === false) {
renderOptions.escapeAttributeValue = (value) => value;
} else if (typeof o.escapeAttributeValue === "function") {
renderOptions.escapeAttributeValue = o.escapeAttributeValue;
} else if (typeof o.escapeAttributes === "function") {
renderOptions.escapeAttributeValue = o.escapeAttributes;
}

@@ -85,0 +89,0 @@ if (o.escapeString === false) {

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

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

}
}
}
# mithril-render-loader
> First shot at a [webpack-Loader](https://webpack.js.org/) to render a [mithril](https://mithril.js.org/) [component](https://mithril.js.org/components.html) to html
> [webpack-Loader](https://webpack.js.org/) to render a [mithril](https://mithril.js.org/) [component](https://mithril.js.org/components.html) to html
**install** `npm install mithril-render-loader`
**install** `npm install mithril-render-loader --save-dev`

@@ -10,4 +10,29 @@ **requirements** `node v6+`

## Usage
## Options
| option | type | default | description |
| ----------------- |:-----------------:| ----------|-------------------------------------------------------------- |
| model | Mixed | {} | required data for component. Pass as vnode.attrs |
| export | Boolean | false | export using `module.exports` or return a string (html-loader)|
| cacheable | Boolean | true | deactivate cache, forcing a complete rebuild each time |
| profile | Boolean | false | log render times to console |
| escapeAttributes | Function|Boolean | false | Escape HTML-Attributes. You may pass a function(value):value |
| escapeString | Function|Boolean | false | Escape HTML-TextNodes. You may pass a function(value):value |
| strict | Boolean | false | Render the html as xml/xhtml
## Usage Example
The `index.view.js`
```js
const m = require("mithril");
const View = {
view(vnode) {
const data = vnode.attrs.model;
return m("Hello User");
}
}
```
The webpack-config might look something along theese lines:

@@ -18,14 +43,9 @@

entry: [
"./test/app/index.view.js"
],
entry: "./test/app/index.view.js",
resolve: {
modules: [".", "node_modules"]
},
output: {
path: path.join(__dirname, "build")
},
module: {

@@ -53,3 +73,3 @@ rules: [

minifyCSS: false, // bugged
root: __dirname,
root: __dirname
}

@@ -75,1 +95,3 @@ },

```
If the _html-loader_ is omitted and mithril-render-loader should export a string, add the option `export: true`
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