coralite 0.11.2 → 0.11.4

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/README.md CHANGED
@@ -3,15 +3,18 @@
3
3
  coralite is a static site generator library built around the emerging [HTML modules proposal](https://github.com/WICG/webcomponents/blob/gh-pages/proposals/html-modules-explainer.md).
4
4
 
5
5
  <p style="text-align:center;">
6
- <img src="https://codeberg.org/tjdavid/coralite/media/branch/main/docs/images/logo.png" alt="Coralite logo" style="max-width: 100%; width: auto;filter: drop-shadow(rgba(0,0,0,0.2) 0px 0px 0.75rem)">
6
+ <a href="https://youtu.be/wUWwH9QZUTs" target="_blank">
7
+ <img src="https://codeberg.org/tjdavid/coralite/media/branch/main/docs/images/intro.gif" alt="How to build a website using Coralite" style="max-width: 100%; width: auto;filter: drop-shadow(rgba(0,0,0,0.2) 0px 0px 0.75rem)">
8
+ </a>
9
+ <div>Watch the full video on <a href="https://youtu.be/wUWwH9QZUTs" target="_blank">how to build a website using Coralite.</a></div>
7
10
  </p>
8
11
 
9
12
  - Getting started
10
- - [Basic templating](./docs/basic-templating.md)
13
+ - [Basic templating](https://codeberg.org/tjdavid/coralite/src/branch/main/docs/basic-templating.md)
11
14
  - Reference
12
- - [Coralite CLI](./docs/coralite-cli.md)
13
- - [Coralite](./docs/coralite.md)
14
- - [Types](./docs/types.md)
15
+ - [Coralite CLI](https://codeberg.org/tjdavid/coralite/src/branch/main/docs/coralite-cli.md)
16
+ - [Coralite](https://codeberg.org/tjdavid/coralite/src/branch/main/docs/coralite.md)
17
+ - [Types](https://codeberg.org/tjdavid/coralite/src/branch/main/docs/types.md)
15
18
 
16
19
  ## Installation
17
20
 
@@ -43,6 +46,8 @@ Coralite is executed using the following command:
43
46
  coralite [options]
44
47
  ```
45
48
 
49
+ For more information about the
50
+
46
51
  Replace `[options]` with the desired flags and arguments.
47
52
 
48
53
  ## Required Options
@@ -78,10 +83,10 @@ Coralite uses **ECMAScript Modules** and **Import meta resolve** which requires
78
83
  node --experimental-vm-modules --experimental-import-meta-resolve node_modules/coralite/bin/coralite.js [options]
79
84
  ```
80
85
 
81
- If you require your templates to import
86
+ If you require your templates to import
82
87
 
83
88
  or using NODE_OPTIONS
84
89
 
85
90
  ```bash
86
91
  NODE_OPTIONS="--experimental-vm-modules --experimental-import-meta-resolve" coralite [options]
87
- ```
92
+ ```
package/bin/coralite.js CHANGED
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env node --experimental-vm-modules --experimental-import-meta-resolve
1
+ #!/usr/bin/env -S node --experimental-vm-modules --experimental-import-meta-resolve
2
2
 
3
3
  import { getPkg, Coralite } from '#lib'
4
4
  import { Command } from 'commander'
package/changelog.md CHANGED
@@ -1,11 +1,28 @@
1
1
  # 🎁 Complete Release History
2
2
 
3
+ ## Release: `v0.11.3`
4
+
5
+ ### Changes from `v0.11.2` to `v0.11.3`
6
+
7
+ - fb96747 (tag: v0.11.3) chore: version bump - ([Thomas David](https://codeberg.org/tjdavid))
8
+ - 2eee736 types: update type for excludeByAttribute property - ([Thomas David](https://codeberg.org/tjdavid))
9
+ - 4a37c35 docs: createPlugin detailed JSDoc descriptions - ([Thomas David](https://codeberg.org/tjdavid))
10
+ - 6de2fd6 docs: Update documentation links to use absolute URLs - ([Thomas David](https://codeberg.org/tjdavid))
11
+ - c38f9c4 build: use -S flag with node in shebang for experimental features - ([Thomas David](https://codeberg.org/tjdavid))
12
+
13
+ ### Metadata
14
+ ```
15
+ This version -------- v0.11.3
16
+ Previous version ---- v0.11.2
17
+ Total commits ------- 5
18
+ ```
19
+
3
20
  ## Release: `v0.11.2`
4
21
 
5
22
  ### Changes from `v0.11.1` to `v0.11.2`
6
23
 
7
- - b9d8c37 (HEAD -> main, tag: v0.11.2) chore: bump version - ([Thomas David](https://codeberg.org/tjdavid))
8
- - e427d7d (origin/main) style: update comment formatting consistency - ([Thomas David](https://codeberg.org/tjdavid))
24
+ - b9d8c37 (tag: v0.11.2) chore: bump version - ([Thomas David](https://codeberg.org/tjdavid))
25
+ - e427d7d style: update comment formatting consistency - ([Thomas David](https://codeberg.org/tjdavid))
9
26
  - 707c462 types: add ts-ignore for script.namespace.default - ([Thomas David](https://codeberg.org/tjdavid))
10
27
  - 3e4df9a fix: correctly skip directive nodes in replaceToken function - ([Thomas David](https://codeberg.org/tjdavid))
11
28
  - bed8aa6 docs: update parameter names and type annotations - ([Thomas David](https://codeberg.org/tjdavid))
@@ -55,7 +72,7 @@ Total commits ------- 8
55
72
  - e03b4e1 style: fix trailing comma in jsconfig.json moduleResolution - ([Thomas David](https://codeberg.org/tjdavid))
56
73
  - a0c66cc refactor(fixtures): replace values with tokens and attributes in component definitions - ([Thomas David](https://codeberg.org/tjdavid))
57
74
  - 5405757 refactor(define-component): rename options.values to options.tokens - ([Thomas David](https://codeberg.org/tjdavid))
58
- The parameter name in the defineComponent plugin's options object has been changed from `values` to `tokens` to more accurately reflect its purpose of representing computed tokens available in templates.
75
+ The parameter name in the defineComponent plugins options object has been changed from `values` to `tokens` to more accurately reflect its purpose of representing computed tokens available in templates.
59
76
 
60
77
  BREAKING CHANGE: Users must update their code to use `options.tokens` instead of `options.values` when defining components.
61
78
 
@@ -82,7 +99,7 @@ Total commits ------- 11
82
99
  - b0d0705 fix: resolve template identifier - ([Thomas David](https://codeberg.org/tjdavid))
83
100
  - 7179b8e fix: extract onFileSet handler to handle unset updates - ([Thomas David](https://codeberg.org/tjdavid))
84
101
  - a81f38e fix: ensure existing values are preserved when merging custom element attribs - ([Thomas David](https://codeberg.org/tjdavid))
85
- - 0dd0caa fix: restrict documentValue.type assignment to 'page' or 'template' types - ([Thomas David](https://codeberg.org/tjdavid))
102
+ - 0dd0caa fix: restrict documentValue.type assignment to page or template types - ([Thomas David](https://codeberg.org/tjdavid))
86
103
  - 0426edb chore: update version and repository information - ([Thomas David](https://codeberg.org/tjdavid))
87
104
  - 25696d5 types: add types configuration for plugins and types directory - ([Thomas David](https://codeberg.org/tjdavid))
88
105
  - d83d39c types: add values to HTMLData and remove page/pageName from FilePath - ([Thomas David](https://codeberg.org/tjdavid))
@@ -106,10 +123,10 @@ Total commits ------- 11
106
123
 
107
124
  - ee8bc43 refactor: update Coralite onFileSet handler to use data parameter and add metadata fields - ([Thomas David](https://codeberg.org/tjdavid))
108
125
  - 032b934 feat: add metadata extraction to parseHTML - ([Thomas David](https://codeberg.org/tjdavid))
109
- Extracts metadata from HTML into a new 'meta' field in the return value.
126
+ Extracts metadata from HTML into a new meta field in the return value.
110
127
  Removed the separate parseHTMLMeta function.
111
128
 
112
- BREAKING CHANGE: The parseHTMLMeta function has been removed. Use the 'meta'
129
+ BREAKING CHANGE: The parseHTMLMeta function has been removed. Use the meta
113
130
  property in the parseHTML return value instead.
114
131
 
115
132
  - 3531662 feat(core): Introduce context ID for scoped component value management - ([Thomas David](https://codeberg.org/tjdavid))
@@ -125,11 +142,11 @@ Total commits ------- 11
125
142
  absolute path resolution for module imports.
126
143
 
127
144
  - 470c799 docs: remove aggregation and collection types from reference - ([Thomas David](https://codeberg.org/tjdavid))
128
- - d2b26cf docs: update cli path examples to use relative paths without leading './' - ([Thomas David](https://codeberg.org/tjdavid))
145
+ - d2b26cf docs: update cli path examples to use relative paths without leading ’./' - ([Thomas David](https://codeberg.org/tjdavid))
129
146
  - 1cb3fd7 fix: use recursive directory creation in output path handling - ([Thomas David](https://codeberg.org/tjdavid))
130
147
  - ac5d34c fix: prevent TypeError when template is undefined - ([Thomas David](https://codeberg.org/tjdavid))
131
148
  - 52e6def chore: add script to generate changelog from git history - ([Thomas David](https://codeberg.org/tjdavid))
132
- - 865611d chore: add 'scripts' directory to .npmignore - ([Thomas David](https://codeberg.org/tjdavid))
149
+ - 865611d chore: add scripts directory to .npmignore - ([Thomas David](https://codeberg.org/tjdavid))
133
150
  - 1c02905 chore: update repository and bug tracker URLs in package.json - ([Thomas David](https://codeberg.org/tjdavid))
134
151
 
135
152
  ### Metadata
@@ -155,7 +172,7 @@ Total commits ------- 31
155
172
  - 9e05433 docs: update type reference page - ([Thomas David](https://codeberg.org/tjdavid))
156
173
  - 812e3a7 docs: simplify CLI command example by removing unnecessary node flag - ([Thomas David](https://codeberg.org/tjdavid))
157
174
  - d70d77a docs: Update documentation link and Node.js flags - ([Thomas David](https://codeberg.org/tjdavid))
158
- - Changed full documentation link to Codeberg's main branch URL
175
+ - Changed full documentation link to Codebergs main branch URL
159
176
  - Added --experimental-import-meta-resolve flag to Node.js requirements
160
177
 
161
178
  - d5bf40d docs: enhance Coralite constructor documentation with plugin usage example - ([Thomas David](https://codeberg.org/tjdavid))
@@ -186,13 +203,13 @@ Total commits ------- 31
186
203
  BREAKING CHANGE: Users relying on `parseHTMLDocument` will need to use `parseHTML` directly for similar functionality.
187
204
 
188
205
  - 1cf47c9 feat: add document type option to getHtmlFiles - ([Thomas David](https://codeberg.org/tjdavid))
189
- Allow specifying 'page' or 'template' as document type when retrieving HTML files. Adds 'type' parameter to function options and stores it in each item's metadata.
206
+ Allow specifying page or template as document type when retrieving HTML files. Adds type parameter to function options and stores it in each items metadata.
190
207
 
191
208
  - 10f83fe feat: Add support for setting document type from hook result - ([Thomas David](https://codeberg.org/tjdavid))
192
- - 5606870 types: add 'type' field to HTMLData and event result types - ([Thomas David](https://codeberg.org/tjdavid))
193
- Add a 'type' property ('page' | 'template') to distinguish between main pages and reusable templates in HTMLData. Update CoraliteCollectionCallbackResult and CoraliteCollectionEventResult to include optional 'type' for document categorization. Improve JSDoc descriptions for path-related properties in CoraliteFilePath.
209
+ - 5606870 types: add type field to HTMLData and event result types - ([Thomas David](https://codeberg.org/tjdavid))
210
+ Add a type property (page | template) to distinguish between main pages and reusable templates in HTMLData. Update CoraliteCollectionCallbackResult and CoraliteCollectionEventResult to include optional type for document categorization. Improve JSDoc descriptions for path-related properties in CoraliteFilePath.
194
211
 
195
- BREAKING CHANGE: Existing code expecting HTMLData without a 'type' field may need adjustments to handle the new optional property.
212
+ BREAKING CHANGE: Existing code expecting HTMLData without a type field may need adjustments to handle the new optional property.
196
213
 
197
214
  - 2f08966 refactor: remove unused documents array declaration - ([Thomas David](https://codeberg.org/tjdavid))
198
215
  - 69becec docs: add @private JSDoc tags to Coralite methods - ([Thomas David](https://codeberg.org/tjdavid))
@@ -211,10 +228,10 @@ Total commits ------- 31
211
228
 
212
229
  - 9cc36bb types: Rename CoraliteDocumentCollectionItem to CoraliteCollectionItem - ([Thomas David](https://codeberg.org/tjdavid))
213
230
  - 3406e6b feat: add type field to templates and pages configuration - ([Thomas David](https://codeberg.org/tjdavid))
214
- Add 'type' property to distinguish between template and page files in the configuration objects.
231
+ Add type property to distinguish between template and page files in the configuration objects.
215
232
 
216
233
  - fca20e0 fix: trim pages prefix from path when compiling - ([Thomas David](https://codeberg.org/tjdavid))
217
- When processing paths during compilation, trim the 'pages' directory prefix if present to ensure accurate lookups in getListByPath.
234
+ When processing paths during compilation, trim the pages directory prefix if present to ensure accurate lookups in getListByPath.
218
235
 
219
236
  - 1115fc8 fix(components): Fix component path resolution in createComponent and _evaluate - ([Thomas David](https://codeberg.org/tjdavid))
220
237
  - 05c4a75 refactor(coralite): remove path duplication in Coralite constructor - ([Thomas David](https://codeberg.org/tjdavid))
@@ -230,7 +247,7 @@ Total commits ------- 31
230
247
  file updates separately.
231
248
 
232
249
  - 69f3cbb docs: remove @template T from getHTML function - ([Thomas David](https://codeberg.org/tjdavid))
233
- - 07cd45c refactor: update parameter name from 'filename' to 'pathname' in getHtmlFile - ([Thomas David](https://codeberg.org/tjdavid))
250
+ - 07cd45c refactor: update parameter name from filename to pathname in getHtmlFile - ([Thomas David](https://codeberg.org/tjdavid))
234
251
  - 29bfd15 refactor(html): update to use CoraliteCollection with event-based file handling - ([Thomas David](https://codeberg.org/tjdavid))
235
252
  Replace Documents class with CoraliteCollection and introduce event-driven callbacks
236
253
  (onFileSet, onFileUpdate, onFileDelete) for managing HTML files. This changes the API
@@ -252,11 +269,11 @@ Total commits ------- 31
252
269
  computedValue[i] would process individual characters instead of the full string,
253
270
  leading to unexpected behavior.
254
271
 
255
- - ec5e429 refactor: Remove unused 'values' parameter from replaceCustomElementWithTemplate - ([Thomas David](https://codeberg.org/tjdavid))
256
- The 'values' parameter was removed from the function signature and call-sites since it was never used.
272
+ - ec5e429 refactor: Remove unused values parameter from replaceCustomElementWithTemplate - ([Thomas David](https://codeberg.org/tjdavid))
273
+ The values parameter was removed from the function signature and call-sites since it was never used.
257
274
 
258
275
  - a421f4f refactor(types): rename document-related types to collection-based equivalents - ([Thomas David](https://codeberg.org/tjdavid))
259
- Refactor type definitions and callback interfaces to use 'collection' terminology instead of 'document' to align with updated data handling patterns.
276
+ Refactor type definitions and callback interfaces to use collection terminology instead of document to align with updated data handling patterns.
260
277
 
261
278
  - Renamed CoraliteDocumentCallbackResult → CoraliteCollectionCallbackResult
262
279
  - Updated CoraliteDocumentSetCallback → CoraliteCollectionEventSet
@@ -272,7 +289,7 @@ Total commits ------- 31
272
289
  to be updated to use the new event-based system.
273
290
 
274
291
  - bd0174a refactor: update replaceCustomElementWithTemplate to use component instance directly - ([Thomas David](https://codeberg.org/tjdavid))
275
- - a0280b6 Merge pull request 'plugin-system' (#1) from plugin-system into main - ([Thomas David](https://codeberg.org/tjdavid))
292
+ - a0280b6 Merge pull request plugin-system (#1) from plugin-system into main - ([Thomas David](https://codeberg.org/tjdavid))
276
293
  Reviewed-on: https://codeberg.org/tjdavid/coralite/pulls/1
277
294
 
278
295
  - b80c1ba (origin/plugin-system, plugin-system) fix: correct usage of aggregation function in posts component - ([Thomas David](https://codeberg.org/tjdavid))
@@ -301,8 +318,8 @@ Total commits ------- 31
301
318
  storing metadata/variable information rather than raw tokens.
302
319
 
303
320
  BREAKING CHANGE: Any references to CoraliteDocumentTokens or
304
- the 'tokens' property in module definitions must be updated to
305
- CoraliteDocumentValues and 'values' respectively.
321
+ the tokens property in module definitions must be updated to
322
+ CoraliteDocumentValues and values respectively.
306
323
 
307
324
  - fca9de9 feat: Integrate config-based plugins using Coralite class API - ([Thomas David](https://codeberg.org/tjdavid))
308
325
  Update coralite.js to use the Coralite class constructor and compile method,
@@ -316,12 +333,12 @@ Total commits ------- 31
316
333
 
317
334
  - 7b51352 feat: add export for aggregation plugin - ([Thomas David](https://codeberg.org/tjdavid))
318
335
  - 2a29bdc refactor: rename coralite import and adjust export paths - ([Thomas David](https://codeberg.org/tjdavid))
319
- Update import statement to use PascalCase 'Coralite' and modify export paths to include new modules while removing deprecated ones.
336
+ Update import statement to use PascalCase Coralite and modify export paths to include new modules while removing deprecated ones.
320
337
 
321
338
  - 6b1df93 refactor: remove unused imports and dependencies from parse.js - ([Thomas David](https://codeberg.org/tjdavid))
322
339
  Simplify the file by eliminating redundant import statements and type references that are no longer required. This reduces complexity and improves maintainability without altering functionality.
323
340
 
324
- - Removed imports from 'html-module.js', 'node:vm', 'type-helper.js', 'node:path', and 'utils.js'
341
+ - Removed imports from html-module.js’, node:vm’, type-helper.js’, node:path’, and utils.js
325
342
  - Updated JSDoc type references to remove obsolete types
326
343
 
327
344
  - 350e28b refactor: remove legacy component parsing and token replacement logic - ([Thomas David](https://codeberg.org/tjdavid))
@@ -345,7 +362,7 @@ Total commits ------- 31
345
362
 
346
363
  - 7fee5f3 feat(coralite.config.js): add aggregation plugin to Coralite config - ([Thomas David](https://codeberg.org/tjdavid))
347
364
  - 744d9ea feat: add isCoralitePageItem type check function - ([Thomas David](https://codeberg.org/tjdavid))
348
- Add a helper function to determine if an object is a CoralitePageItem by checking for the presence of 'path' and string content properties.
365
+ Add a helper function to determine if an object is a CoralitePageItem by checking for the presence of path and string content properties.
349
366
 
350
367
  - d666a83 refactor(html): move to synchronous file handling and introduce Documents class - ([Thomas David](https://codeberg.org/tjdavid))
351
368
  Refactor HTML file loading logic to use synchronous methods (readdirSync, readFileSync)
@@ -372,7 +389,7 @@ Total commits ------- 31
372
389
  plugin method is a function before returning the plugin structure.
373
390
 
374
391
  - 203e7ae feat: Add config loader for coralite.config.js - ([Thomas David](https://codeberg.org/tjdavid))
375
- This commit introduces a function to load configuration from coralite.config.js in the current working directory. The function checks if the file exists, imports it asynchronously, and returns its default export. If the file isn't found or fails to load, it returns null or throws an error respectively.
392
+ This commit introduces a function to load configuration from coralite.config.js in the current working directory. The function checks if the file exists, imports it asynchronously, and returns its default export. If the file isnt found or fails to load, it returns null or throws an error respectively.
376
393
 
377
394
  - 3a62f69 refactor: Replace document rendering with component-based creation and token replacement - ([Thomas David](https://codeberg.org/tjdavid))
378
395
  Refactor core rendering logic to use a component-based approach with dynamic value substitution and slot handling. Introduce `createComponent` for modular processing, `_evaluate` for script execution, and `replaceToken` for attribute/text node replacements.
@@ -420,7 +437,7 @@ Total commits ------- 31
420
437
 
421
438
  - 239e77b docs: add return type annotation to parseHTML function - ([Thomas David](https://codeberg.org/tjdavid))
422
439
  - 6046562 feat: add page path metadata to values in aggregate function - ([Thomas David](https://codeberg.org/tjdavid))
423
- Enhance context available for rendering by including $pathname, $filename, and $dirname from current page's path metadata.
440
+ Enhance context available for rendering by including $pathname, $filename, and $dirname from current pages path metadata.
424
441
 
425
442
  - 4a1aef3 fix(parse): update computed tokens promise check for thenable objects - ([Thomas David](https://codeberg.org/tjdavid))
426
443
 
@@ -491,7 +508,7 @@ Total commits ------- 12
491
508
  Fixes edge case where offset was not properly converted from string to number.
492
509
 
493
510
  - 4d2fe56 feat(aggregate): Add metadata-based page filtering using options.filter - ([Thomas David](https://codeberg.org/tjdavid))
494
- Allow filtering pages by checking metadata against the provided function in options.filter. Processes each page's metadata and applies the filter to determine inclusion.
511
+ Allow filtering pages by checking metadata against the provided function in options.filter. Processes each pages metadata and applies the filter to determine inclusion.
495
512
 
496
513
  - 176c7f3 feat(lib/html-module): add support for custom sort function in aggregate - ([Thomas David](https://codeberg.org/tjdavid))
497
514
  - 3acfb99 feat(lib/html-module): add pagination support with token validation - ([Thomas David](https://codeberg.org/tjdavid))
@@ -505,14 +522,14 @@ Total commits ------- 12
505
522
  Refactor the main rendering logic into a modular `renderDocument` function with improved parameters for handling recursive rendering of head sections and accumulating results.
506
523
 
507
524
  - c81786e types: add pagination configuration to CoraliteAggregate - ([Thomas David](https://codeberg.org/tjdavid))
508
- - c8ddec4 feat(metadata): Update metadata token prefix to '$' - ([Thomas David](https://codeberg.org/tjdavid))
525
+ - c8ddec4 feat(metadata): Update metadata token prefix to ’$' - ([Thomas David](https://codeberg.org/tjdavid))
509
526
  BREAKING CHANGE: This change is a breaking change for existing configurations relying on the previous `'meta_'` prefix. All references to metadata tokens must be updated to use the new `$` prefix to maintain compatibility with this version.
510
527
 
511
528
  - ee57e18 feat: add parsePagination function for handling pagination templates - ([Thomas David](https://codeberg.org/tjdavid))
512
529
  Implement a function to parse HTML content into a structured document, allowing customization of pagination elements through template and attribute configurations.
513
530
 
514
531
  - 4471482 types: add Aggregation typedef and update imports - ([Thomas David](https://codeberg.org/tjdavid))
515
- Introduce a new Aggregation type definition with nodes and documents properties, and update import statements to include additional types from '#types'.
532
+ Introduce a new Aggregation type definition with nodes and documents properties, and update import statements to include additional types from ’#types’.
516
533
 
517
534
  - 2772969 docs: Improve JSDoc clarity for parseHTMLDocument function - ([Thomas David](https://codeberg.org/tjdavid))
518
535
  - 37e79db refactor: restructure html file path properties - ([Thomas David](https://codeberg.org/tjdavid))
@@ -557,7 +574,7 @@ Total commits ------- 12
557
574
  document rendering.
558
575
 
559
576
  - 885fd6c refactor(parseModule): remove html parameter and introduce lineOffset property - ([Thomas David](https://codeberg.org/tjdavid))
560
- BREAKING CHANGE: The 'html' option has been removed from parseModule's parameters. Consumers relying on this should update their code accordingly.
577
+ BREAKING CHANGE: The html option has been removed from parseModules parameters. Consumers relying on this should update their code accordingly.
561
578
 
562
579
  - 84c8a74 types: allow string or CoraliteToken[] as meta value types - ([Thomas David](https://codeberg.org/tjdavid))
563
580
  Update `parseHTMLMeta` to accept both string and CoraliteToken[] values for metadata entries instead of only arrays.
@@ -576,7 +593,7 @@ Total commits ------- 12
576
593
  and update sort parameters to accept CoraliteToken arrays.
577
594
 
578
595
  - 2205c1a types: Refactor types to introduce CoraliteFilePath and improve module interface definitions - ([Thomas David](https://codeberg.org/tjdavid))
579
- Update HTMLData and CoraliteModule interfaces to use CoraliteFilePath, add new properties for better structure, and enhance documentation. Modify CoraliteDocument's path to combine CoralitePath with CoraliteFilePath.
596
+ Update HTMLData and CoraliteModule interfaces to use CoraliteFilePath, add new properties for better structure, and enhance documentation. Modify CoraliteDocuments path to combine CoralitePath with CoraliteFilePath.
580
597
 
581
598
  - c37fa7c docs: add CoraliteComponent import - ([Thomas David](https://codeberg.org/tjdavid))
582
599
  - 281e07e refactor: rename getHTML to getHtmlFiles and add getHtmlFile function - ([Thomas David](https://codeberg.org/tjdavid))
@@ -589,7 +606,7 @@ Total commits ------- 12
589
606
 
590
607
  - d6fab1e refactor: use cleanKeys for consistent naming conventions - ([Thomas David](https://codeberg.org/tjdavid))
591
608
  Use cleanKeys to convert object keys to camel case format when processing
592
- component values and custom attributes. Introduces 'head' parameter to control
609
+ component values and custom attributes. Introduces head parameter to control
593
610
  cleaning behavior during recursion.
594
611
 
595
612
  BREAKING CHANGE: All templates using kebab-case tokens (e.g., `my-token`) must now use camelCase equivalents (e.g., `myToken`). Existing templates with kebab-case will no longer work as expected and require migration.
@@ -958,7 +975,7 @@ Total commits ------- 28
958
975
  - 1c77286 (origin/default-slots, default-slots) types: add jsdoc documentation for the element option in parseModule function - ([Thomas David](https://codeberg.org/tjdavid))
959
976
  - 5d19343 types: remove unused types - ([Thomas David](https://codeberg.org/tjdavid))
960
977
  - a523568 feat: refactor component initialization naming - ([Thomas David](https://codeberg.org/tjdavid))
961
- Refactor: Renamed 'components' to 'coraliteModules' for better naming consistency.
978
+ Refactor: Renamed components to coraliteModules for better naming consistency.
962
979
 
963
980
  - 2a116c1 Fix: correct attribute handling in component parsing - ([Thomas David](https://codeberg.org/tjdavid))
964
981
  - ebe6299 refactor: update parseModule function signature with new element parameter replacing customElementSlots - ([Thomas David](https://codeberg.org/tjdavid))
@@ -1011,11 +1028,11 @@ Total commits ------- 7
1011
1028
  ### Overview of Changes:
1012
1029
 
1013
1030
  1. **Switch to HTML Parsing:**
1014
- - The decision to replace regex with HTML parsing provides a more robust and compatible approach for processing structured data. This change is expected to enhance the library's ability to handle complex document formats effectively.
1031
+ - The decision to replace regex with HTML parsing provides a more robust and compatible approach for processing structured data. This change is expected to enhance the librarys ability to handle complex document formats effectively.
1015
1032
 
1016
1033
  2. **New Features and Improvements:**
1017
1034
  - **getHTML Functionality:** Enhanced to support non-recursive requests, improving its utility in various web scraping scenarios.
1018
- - **Page Aggregation:** Introduction of a new feature to aggregate data from multiple pages, expanding the library's analytical capabilities.
1035
+ - **Page Aggregation:** Introduction of a new feature to aggregate data from multiple pages, expanding the librarys analytical capabilities.
1019
1036
  - **Improved Module Parsing:** Significant rework of module parsing and component creation for better handling of complex components.
1020
1037
 
1021
1038
  3. **Code Improvements:**
@@ -1025,13 +1042,13 @@ Total commits ------- 7
1025
1042
  - Several older features and unused files (e.g., `remove unused files` commit) are being deprecated or removed as part of this refactor.
1026
1043
 
1027
1044
  - 90df901 (origin/slots, slots) docs: revert readme - ([Thomas David](https://codeberg.org/tjdavid))
1028
- - b7b2b1c Merge branch 'main' into slots - ([Thomas David](https://codeberg.org/tjdavid))
1045
+ - b7b2b1c Merge branch main into slots - ([Thomas David](https://codeberg.org/tjdavid))
1029
1046
  - 427bb48 types: add parse root and directives - ([Thomas David](https://codeberg.org/tjdavid))
1030
1047
  - ea4fd35 test: update coralite-posts attribute - ([Thomas David](https://codeberg.org/tjdavid))
1031
1048
  - 272581c test: add slots to fixtures - ([Thomas David](https://codeberg.org/tjdavid))
1032
1049
  - 6e2cdba fix: remove unused code - ([Thomas David](https://codeberg.org/tjdavid))
1033
1050
  - 6943970 feat: parse html directives - ([Thomas David](https://codeberg.org/tjdavid))
1034
- - a4c6790 fix: createTextNode type to 'text' - ([Thomas David](https://codeberg.org/tjdavid))
1051
+ - a4c6790 fix: createTextNode type to text - ([Thomas David](https://codeberg.org/tjdavid))
1035
1052
  - 861c932 refactor: move html module functions to html-modules.js - ([Thomas David](https://codeberg.org/tjdavid))
1036
1053
  - fbf58d6 feat: placeholder html module coralite exports - ([Thomas David](https://codeberg.org/tjdavid))
1037
1054
  - b91d020 types: Update JSDoc comments for Coralite types - ([Thomas David](https://codeberg.org/tjdavid))
@@ -1179,6 +1196,6 @@ Total commits ------- 86
1179
1196
 
1180
1197
  ## Summary
1181
1198
  ```
1182
- Total releases ------ 27
1183
- Total commits ------- 474
1199
+ Total releases ------ 28
1200
+ Total commits ------- 479
1184
1201
  ```
package/lib/coralite.js CHANGED
@@ -885,7 +885,12 @@ function replaceToken ({
885
885
  ) {
886
886
  node.attribs[attribute] = node.attribs[attribute].replace(content, value)
887
887
  } else if (node.type === 'text') {
888
- if (Array.isArray(value)) {
888
+ if (typeof value === 'object') {
889
+ if (!Array.isArray(value)) {
890
+ // handle single nodes
891
+ value = [value]
892
+ }
893
+
889
894
  // inject nodes
890
895
  const textSplit = node.data.split(content)
891
896
  const childIndex = node.parent.children.indexOf(node)
package/lib/plugin.js CHANGED
@@ -1,23 +1,37 @@
1
1
  /**
2
2
  * @import Coralite from './coralite.js'
3
- * @import { CoralitePlugin } from '#types'
3
+ * @import { CoralitePlugin, CoralitePluginInstance } from '#types'
4
4
  */
5
5
 
6
6
  import { basename, dirname } from 'path'
7
7
  import { getHtmlFile } from './html.js'
8
8
 
9
9
  /**
10
- * @param {CoralitePlugin & ThisType<Coralite>} options
10
+ * Creates a new Coralite plugin instance based on provided configuration options.
11
+ *
12
+ * @param {CoralitePlugin & ThisType<Coralite>} options - Plugin configuration object
13
+ * @returns {CoralitePluginInstance} A plugin instance with processed templates and method
14
+ *
15
+ * @example
16
+ * const myPlugin = createPlugin({
17
+ * name: 'my-plugin',
18
+ * method: (options, context) => {
19
+ * // Plugin logic implementation
20
+ * },
21
+ * templates: ['src/components/header.html', 'src/components/footer.html']
22
+ * })
11
23
  */
12
24
  export function createPlugin ({
13
25
  name,
14
26
  method,
15
27
  templates = []
16
28
  }) {
29
+ // validate that the plugin method is a function
17
30
  if (typeof method !== 'function') {
18
31
  throw Error('Coralite plugins method expects a function')
19
32
  }
20
33
 
34
+ // process template files and store metadata
21
35
  const templateResults = []
22
36
  for (let i = 0; i < templates.length; i++) {
23
37
  const path = templates[i]
@@ -33,6 +47,7 @@ export function createPlugin ({
33
47
  })
34
48
  }
35
49
 
50
+ // return the plugin object with all configured properties
36
51
  return {
37
52
  name,
38
53
  method,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "coralite",
3
- "version": "0.11.2",
3
+ "version": "0.11.4",
4
4
  "description": "HTML modules static site generator",
5
5
  "main": "./lib/coralite.js",
6
6
  "type": "module",
package/types/index.js CHANGED
@@ -217,7 +217,7 @@
217
217
  * @property {CoraliteModule} module - The module context the plugin is operating within (contains template/script)
218
218
  * @property {CoraliteElement} element - The specific HTML element the plugin is applied to (if applicable)
219
219
  * @property {Object} path - File path information for the current document/module being processed
220
- * @property {[string, string][]} excludeByAttribute - List of attribute name-value pairs to ignore during processing by element type
220
+ * @property {IgnoreByAttribute[]} excludeByAttribute - List of attribute name-value pairs to ignore during processing by element type
221
221
  * @property {string} id - Unique identifier for the value context.
222
222
  */
223
223