boxwood 0.72.1 → 0.73.0
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/index.js +13 -1
- package/package.json +5 -5
package/index.js
CHANGED
|
@@ -531,7 +531,7 @@ i18n.load = function () {
|
|
|
531
531
|
}
|
|
532
532
|
}
|
|
533
533
|
|
|
534
|
-
function component(fn, { styles, i18n } = {}) {
|
|
534
|
+
function component(fn, { styles, i18n, code } = {}) {
|
|
535
535
|
function execute(a, b) {
|
|
536
536
|
if (typeof a === "string" || typeof a === "number" || Array.isArray(a)) {
|
|
537
537
|
return fn({}, a)
|
|
@@ -563,12 +563,24 @@ function component(fn, { styles, i18n } = {}) {
|
|
|
563
563
|
}
|
|
564
564
|
return function (a, b) {
|
|
565
565
|
const tree = execute(a, b)
|
|
566
|
+
if (styles && code) {
|
|
567
|
+
if (Array.isArray(tree)) {
|
|
568
|
+
return tree.concat(styles.css, code.js)
|
|
569
|
+
}
|
|
570
|
+
return [tree, styles.css, code.js]
|
|
571
|
+
}
|
|
566
572
|
if (styles) {
|
|
567
573
|
if (Array.isArray(tree)) {
|
|
568
574
|
return tree.concat(styles.css)
|
|
569
575
|
}
|
|
570
576
|
return [tree, styles.css]
|
|
571
577
|
}
|
|
578
|
+
if (code) {
|
|
579
|
+
if (Array.isArray(tree)) {
|
|
580
|
+
return tree.concat(code.js)
|
|
581
|
+
}
|
|
582
|
+
return [tree, code.js]
|
|
583
|
+
}
|
|
572
584
|
return tree
|
|
573
585
|
}
|
|
574
586
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "boxwood",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.73.0",
|
|
4
4
|
"description": "Compile HTML templates into JS",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -45,11 +45,11 @@
|
|
|
45
45
|
},
|
|
46
46
|
"homepage": "https://github.com/buxlabs/boxwood#readme",
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"ava": "^5.
|
|
48
|
+
"ava": "^5.3.1",
|
|
49
49
|
"benchmark": "2.1.4",
|
|
50
50
|
"express": "^4.18.2",
|
|
51
|
-
"handlebars": "^4.7.
|
|
52
|
-
"jsdom": "^
|
|
51
|
+
"handlebars": "^4.7.8",
|
|
52
|
+
"jsdom": "^22.1.0",
|
|
53
53
|
"lodash.template": "4.5.0",
|
|
54
54
|
"mustache": "^4.2.0",
|
|
55
55
|
"nyc": "15.1.0",
|
|
@@ -65,6 +65,6 @@
|
|
|
65
65
|
"dependencies": {
|
|
66
66
|
"css-tree": "^2.3.1",
|
|
67
67
|
"string-hash": "^1.1.3",
|
|
68
|
-
"yaml": "^2.2
|
|
68
|
+
"yaml": "^2.3.2"
|
|
69
69
|
}
|
|
70
70
|
}
|