boxwood 0.72.1 → 0.74.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 +24 -4
- package/package.json +5 -5
package/index.js
CHANGED
|
@@ -31,10 +31,18 @@ async function compile(path) {
|
|
|
31
31
|
}
|
|
32
32
|
if (node.name === "script") {
|
|
33
33
|
const js = node.children
|
|
34
|
-
if (
|
|
35
|
-
|
|
34
|
+
if (
|
|
35
|
+
node.attributes &&
|
|
36
|
+
(node.attributes.type === "application/json" ||
|
|
37
|
+
node.attributes.type === "application/ld+json")
|
|
38
|
+
) {
|
|
39
|
+
node.ignore = false
|
|
40
|
+
} else {
|
|
41
|
+
if (js && !scripts.includes(js)) {
|
|
42
|
+
scripts.push(js)
|
|
43
|
+
}
|
|
44
|
+
node.ignore = true
|
|
36
45
|
}
|
|
37
|
-
node.ignore = true
|
|
38
46
|
}
|
|
39
47
|
if (Array.isArray(node)) {
|
|
40
48
|
node.forEach(walk)
|
|
@@ -531,7 +539,7 @@ i18n.load = function () {
|
|
|
531
539
|
}
|
|
532
540
|
}
|
|
533
541
|
|
|
534
|
-
function component(fn, { styles, i18n } = {}) {
|
|
542
|
+
function component(fn, { styles, i18n, code } = {}) {
|
|
535
543
|
function execute(a, b) {
|
|
536
544
|
if (typeof a === "string" || typeof a === "number" || Array.isArray(a)) {
|
|
537
545
|
return fn({}, a)
|
|
@@ -563,12 +571,24 @@ function component(fn, { styles, i18n } = {}) {
|
|
|
563
571
|
}
|
|
564
572
|
return function (a, b) {
|
|
565
573
|
const tree = execute(a, b)
|
|
574
|
+
if (styles && code) {
|
|
575
|
+
if (Array.isArray(tree)) {
|
|
576
|
+
return tree.concat(styles.css, code.js)
|
|
577
|
+
}
|
|
578
|
+
return [tree, styles.css, code.js]
|
|
579
|
+
}
|
|
566
580
|
if (styles) {
|
|
567
581
|
if (Array.isArray(tree)) {
|
|
568
582
|
return tree.concat(styles.css)
|
|
569
583
|
}
|
|
570
584
|
return [tree, styles.css]
|
|
571
585
|
}
|
|
586
|
+
if (code) {
|
|
587
|
+
if (Array.isArray(tree)) {
|
|
588
|
+
return tree.concat(code.js)
|
|
589
|
+
}
|
|
590
|
+
return [tree, code.js]
|
|
591
|
+
}
|
|
572
592
|
return tree
|
|
573
593
|
}
|
|
574
594
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "boxwood",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.74.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
|
}
|