posthtml-component 2.1.0 → 2.1.1
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/package.json +4 -4
- package/src/find-path.js +2 -4
- package/src/index.d.ts +1 -0
- package/src/index.js +3 -5
- package/src/log.js +1 -1
- package/src/process-attributes.js +0 -2
- package/src/process-props.js +0 -2
- package/src/process-script.js +2 -4
- package/src/process-slots.js +1 -3
- package/src/process-stacks.js +0 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "posthtml-component",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.1",
|
|
4
4
|
"description": "Laravel Blade-inspired components for PostHTML with slots, attributes as props, custom tags and more.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "posthtml/posthtml-components",
|
|
@@ -39,8 +39,8 @@
|
|
|
39
39
|
"style-to-object": "^1.0.6"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@biomejs/biome": "
|
|
43
|
-
"@vitest/coverage-v8": "^
|
|
42
|
+
"@biomejs/biome": "2.0.5",
|
|
43
|
+
"@vitest/coverage-v8": "^3.0.4",
|
|
44
44
|
"conventional-changelog-cli": "^5.0.0",
|
|
45
45
|
"highlight.js": "^11.6.0",
|
|
46
46
|
"markdown-it-anchor": "^9.0.1",
|
|
@@ -49,6 +49,6 @@
|
|
|
49
49
|
"posthtml-beautify": "^0.7.0",
|
|
50
50
|
"posthtml-include": "^2.0.1",
|
|
51
51
|
"posthtml-markdownit": "^3.1.0",
|
|
52
|
-
"vitest": "^
|
|
52
|
+
"vitest": "^3.0.4"
|
|
53
53
|
}
|
|
54
54
|
}
|
package/src/find-path.js
CHANGED
package/src/index.d.ts
CHANGED
package/src/index.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const {readFileSync, existsSync} = require('fs');
|
|
4
|
-
const path = require('path');
|
|
1
|
+
const {readFileSync, existsSync} = require('node:fs');
|
|
2
|
+
const path = require('node:path');
|
|
5
3
|
const {parser} = require('posthtml-parser');
|
|
6
4
|
const {match, walk} = require('posthtml/lib/api');
|
|
7
5
|
const expressions = require('posthtml-expressions');
|
|
@@ -244,7 +242,7 @@ function processTree(options) {
|
|
|
244
242
|
* 'undefined' or 'null'.
|
|
245
243
|
*/
|
|
246
244
|
walk.call(currentNode, node => {
|
|
247
|
-
if (node
|
|
245
|
+
if (node?.attrs) {
|
|
248
246
|
for (const key in node.attrs) {
|
|
249
247
|
if (node.attrs[key] === 'undefined' || node.attrs[key] === 'null') {
|
|
250
248
|
delete node.attrs[key];
|
package/src/log.js
CHANGED
package/src/process-props.js
CHANGED
package/src/process-script.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const vm = require('vm');
|
|
4
|
-
const {existsSync, readFileSync} = require('fs');
|
|
1
|
+
const vm = require('node:vm');
|
|
2
|
+
const {existsSync, readFileSync} = require('node:fs');
|
|
5
3
|
const {render} = require('posthtml-render');
|
|
6
4
|
const {match} = require('posthtml/lib/api');
|
|
7
5
|
|
package/src/process-slots.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
1
|
const {match} = require('posthtml/lib/api');
|
|
4
2
|
const {render} = require('posthtml-render');
|
|
5
3
|
const omit = require('lodash/omit');
|
|
@@ -25,7 +23,7 @@ function setFilledSlots(currentNode, filledSlots, {fill, slotSeparator, propsSlo
|
|
|
25
23
|
|
|
26
24
|
if (props) {
|
|
27
25
|
for (const key in props) {
|
|
28
|
-
if (
|
|
26
|
+
if (Object.hasOwn(props, key)) {
|
|
29
27
|
try {
|
|
30
28
|
props[key] = JSON.parse(props[key]);
|
|
31
29
|
} catch {}
|