malinajs 0.6.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +58 -0
- package/LICENSE +21 -0
- package/compile.js +6115 -0
- package/malina-esbuild.js +121 -0
- package/malina-rollup.js +44 -0
- package/malina.js +6094 -0
- package/package.json +43 -0
- package/plugins/sass.js +26 -0
- package/readme.md +58 -0
- package/runtime.js +954 -0
package/package.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "malinajs",
|
|
3
|
+
"version": "0.6.43",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"prepare": "npm run build",
|
|
7
|
+
"build": "npm run build_runtime && rollup -c",
|
|
8
|
+
"build_runtime": "rollup -c ./rollup.config.runtime.js",
|
|
9
|
+
"build_app": "NODE_PATH=.. rollup -c rollup.config.app.js && uglifyjs ./example/public/app.js -o ./example/public/app.min.js -m -c",
|
|
10
|
+
"terser": "terser ./example/public/app.js -o ./example/public/app.min2.js -m -c",
|
|
11
|
+
"build_app_es5": "NODE_PATH=.. babel ./example/public/app.js -o ./example/public/app.es5.js --presets babel-preset-es2015 && uglifyjs ./example/public/app.es5.js -o ./example/public/app.es5.min.js -m -c",
|
|
12
|
+
"web": "http-server ./example/public",
|
|
13
|
+
"test": "NODE_PATH=.. node ./node_modules/.bin/mocha ./test/run.js",
|
|
14
|
+
"test-debug": "NODE_PATH=.. node --inspect-brk ./node_modules/.bin/mocha ./test/run.js",
|
|
15
|
+
"brotli": "brotli --input /app/malinajs/example/public/app.min.js --output /app/malinajs/example/public/app.min.js.br; brotli --input /app/malinajs/example/public/app.min2.js --output /app/malinajs/example/public/app.min2.js.br"
|
|
16
|
+
},
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"acorn": "^7.3.1",
|
|
19
|
+
"astring": "^1.4.3",
|
|
20
|
+
"css-tree": "^1.0.0-alpha.39"
|
|
21
|
+
},
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"@rollup/plugin-commonjs": "^13.0.2",
|
|
24
|
+
"babel-cli": "^6.26.0",
|
|
25
|
+
"babel-preset-es2015": "^6.24.1",
|
|
26
|
+
"http-server": "^0.12.3",
|
|
27
|
+
"jsdom": "^16.4.0",
|
|
28
|
+
"mocha": "^8.2.1",
|
|
29
|
+
"rollup": "^2.17.1",
|
|
30
|
+
"rollup-plugin-css-only": "^3.1.0",
|
|
31
|
+
"terser": "^5.4.0",
|
|
32
|
+
"uglify-js": "^3.13.7"
|
|
33
|
+
},
|
|
34
|
+
"main": "malina",
|
|
35
|
+
"files": [
|
|
36
|
+
"malina.js",
|
|
37
|
+
"compile.js",
|
|
38
|
+
"runtime.js",
|
|
39
|
+
"malina-rollup.js",
|
|
40
|
+
"malina-esbuild.js",
|
|
41
|
+
"plugins/sass.js"
|
|
42
|
+
]
|
|
43
|
+
}
|
package/plugins/sass.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
|
|
2
|
+
module.exports = function sassPlugin() {
|
|
3
|
+
return {
|
|
4
|
+
name: 'sass',
|
|
5
|
+
dom: async ctx => {
|
|
6
|
+
for(let node of ctx.DOM.body) {
|
|
7
|
+
if(node.type != 'style') continue;
|
|
8
|
+
let type = node.attributes.filter(a => a.name == 'type' || a.name == 'lang')[0];
|
|
9
|
+
if(!type || type.value != 'sass' && type.value != 'scss') continue;
|
|
10
|
+
|
|
11
|
+
const sass = require('sass');
|
|
12
|
+
node.content = await (new Promise((resolve, reject) => {
|
|
13
|
+
sass.render({
|
|
14
|
+
file: ctx.config.path,
|
|
15
|
+
data: node.content,
|
|
16
|
+
indentedSyntax: type.value == 'sass'
|
|
17
|
+
}, function(e, result) {
|
|
18
|
+
if(e) return reject(e);
|
|
19
|
+
resolve(result.css.toString());
|
|
20
|
+
type.value = 'css';
|
|
21
|
+
});
|
|
22
|
+
}));
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
};
|
package/readme.md
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
|
|
2
|
+
## Malina.js
|
|
3
|
+
|
|
4
|
+
<img align="right" width="200" height="200" src="malinajs2.png" />
|
|
5
|
+
|
|
6
|
+
Malina.js builds your web-application to use it **without framework on frontend side**. Therefore your web-app becomes thinner and faster, and the application itself consist of **vanilla JavaScript**, look at [examples](https://malinajs.github.io/repl/). [TodoMVC example](https://malina-todomvc.surge.sh) **2.7kb** (gzipped) and [source code](https://github.com/malinajs/todomvc)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
* [Docs](https://malinajs.github.io/docs/)
|
|
10
|
+
* [Syntax Highlighter for VS-Code](https://marketplace.visualstudio.com/items?itemName=AlexxNB.malina-js-highlight)
|
|
11
|
+
* **[Try Malina.js online (REPL)](https://malinajs.github.io/repl/)**
|
|
12
|
+
|
|
13
|
+
#### Articles
|
|
14
|
+
* [Comparision with Svelte.js](https://medium.com/@lega911/svelte-js-and-malina-js-b33c55253271)
|
|
15
|
+
* [Comparision with Vue 3](https://medium.com/@lega911/vue-3-vs-malina-js-abd97025ba81)
|
|
16
|
+
* [Passing CSS classes to child components](https://medium.com/@lega911/how-a-popular-feature-declined-by-svelte-went-live-in-malina-js-1a08fdb9dbc4)
|
|
17
|
+
* [Using fragments](https://medium.com/@lega911/how-fragments-can-help-in-your-web-development-5efc4d10f9da)
|
|
18
|
+
|
|
19
|
+
#### Example
|
|
20
|
+
```html
|
|
21
|
+
<script>
|
|
22
|
+
let name = 'world';
|
|
23
|
+
|
|
24
|
+
function rename() {
|
|
25
|
+
name = 'user';
|
|
26
|
+
}
|
|
27
|
+
</script>
|
|
28
|
+
|
|
29
|
+
<h1>Hello {name.toUpperCase()}!</h1>
|
|
30
|
+
<button @click={rename}>Rename</button>
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
#### Run dev environment:
|
|
34
|
+
```
|
|
35
|
+
npx create-malina myapp
|
|
36
|
+
cd myapp
|
|
37
|
+
npm run dev
|
|
38
|
+
# open http://localhost:7000/
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
#### Run dev environment via docker:
|
|
43
|
+
```
|
|
44
|
+
docker run --rm -it --user ${UID} -p 7000:7000 -v `pwd`:/app/src lega911/malina
|
|
45
|
+
# open http://localhost:7000/
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
Build compiler
|
|
50
|
+
```
|
|
51
|
+
npm install
|
|
52
|
+
npm run build
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
## License
|
|
57
|
+
|
|
58
|
+
[MIT](LICENSE)
|