posthtml-component 2.1.1 → 2.2.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.
Files changed (2) hide show
  1. package/package.json +2 -2
  2. package/src/index.js +10 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "posthtml-component",
3
- "version": "2.1.1",
3
+ "version": "2.2.0",
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,7 +39,7 @@
39
39
  "style-to-object": "^1.0.6"
40
40
  },
41
41
  "devDependencies": {
42
- "@biomejs/biome": "2.0.5",
42
+ "@biomejs/biome": "2.1.1",
43
43
  "@vitest/coverage-v8": "^3.0.4",
44
44
  "conventional-changelog-cli": "^5.0.0",
45
45
  "highlight.js": "^11.6.0",
package/src/index.js CHANGED
@@ -147,7 +147,7 @@ module.exports = (options = {}) => tree => {
147
147
  return processStacks(
148
148
  processPushes(
149
149
  processTree(options)(
150
- expressions(options.expressions)(tree)
150
+ expressions(options.expressions)(tree), tree.messages
151
151
  ),
152
152
  pushedContent,
153
153
  options.push
@@ -168,7 +168,7 @@ let processCounter = 0;
168
168
  function processTree(options) {
169
169
  const filledSlots = {};
170
170
 
171
- return tree => {
171
+ return (tree, messages) => {
172
172
  log(`Processing tree number ${processCounter}..`, 'processTree');
173
173
 
174
174
  if (options.plugins.length > 0) {
@@ -184,6 +184,13 @@ function processTree(options) {
184
184
 
185
185
  const componentPath = getComponentPath(currentNode, options);
186
186
 
187
+ if (messages) {
188
+ messages.push({
189
+ type: 'dependency',
190
+ file: componentPath
191
+ });
192
+ }
193
+
187
194
  if (!componentPath) {
188
195
  return currentNode;
189
196
  }
@@ -222,7 +229,7 @@ function processTree(options) {
222
229
  return currentNode.content || nextNode.content;
223
230
  });
224
231
 
225
- nextNode = processTree(options)(nextNode);
232
+ nextNode = processTree(options)(nextNode, messages);
226
233
 
227
234
  // Process <fill> tags
228
235
  processFillContent(nextNode, filledSlots, options);