diff options
| author | (quasar) nebula <qznebula@protonmail.com> | 2025-10-23 18:13:05 -0300 |
|---|---|---|
| committer | (quasar) nebula <qznebula@protonmail.com> | 2025-10-23 18:19:16 -0300 |
| commit | 91214d3e8482e3128f1c7a2d6da240ef0413a59d (patch) | |
| tree | 05f904e761ec42e9b40f3068a563f9f0d75bc8c3 /src/content-function.js | |
| parent | f41f72314b32fd62d940631a310b573d41fd346f (diff) | |
html, infra: html.inside(), html.findInside()
Ooooo
Diffstat (limited to 'src/content-function.js')
| -rw-r--r-- | src/content-function.js | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/content-function.js b/src/content-function.js index e141a686..04f2ce90 100644 --- a/src/content-function.js +++ b/src/content-function.js @@ -2,7 +2,7 @@ import {inspect as nodeInspect} from 'node:util'; import {decorateError} from '#aggregate'; import {colors, decorateTime, ENABLE_COLOR} from '#cli'; -import {Template} from '#html'; +import {Tag, Template} from '#html'; import {empty} from '#sugar'; function inspect(value, opts = {}) { @@ -103,6 +103,20 @@ function prepareWorkingGenerateFunction(spec, boundExtraDependencies) { } }; + generate = (baseGenerate => (...args) => { + const result = baseGenerate(...args); + + if (result instanceof Template || result instanceof Tag) { + if (Object.hasOwn(result, Symbol.for('hsmusic.content.via'))) { + result[Symbol.for('hsmusic.contentFunction.via')].push(dependency); + } else { + result[Symbol.for('hsmusic.contentFunction.via')] = [dependency]; + } + } + + return result; + })(generate); + generate = optionalDecorateTime(`generate`, dependency, generate); if (spec.slots) { |