coralite 0.21.0 → 0.22.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.
@@ -15,7 +15,9 @@
15
15
  * CoraliteValues,
16
16
  * CoraliteScriptContent,
17
17
  * InstanceContext} from '../types/index.js'
18
- * @import CoraliteCollection from './collection.js'
18
+ */
19
+ /**
20
+ * @import {DomSerializerOptions} from 'dom-serializer'
19
21
  */
20
22
  /**
21
23
  * @constructor
@@ -56,7 +58,9 @@ export class Coralite {
56
58
  * CoraliteValues,
57
59
  * CoraliteScriptContent,
58
60
  * InstanceContext} from '../types/index.js'
59
- * @import CoraliteCollection from './collection.js'
61
+ */
62
+ /**
63
+ * @import {DomSerializerOptions} from 'dom-serializer'
60
64
  */
61
65
  /**
62
66
  * @constructor
@@ -89,10 +93,8 @@ export class Coralite {
89
93
  pages: string;
90
94
  };
91
95
  };
92
- /** @type {Object.<string, CoraliteModuleValues>} */
93
- values: {
94
- [x: string]: CoraliteModuleValues;
95
- };
96
+ /** @type {Map<string, CoraliteCollectionItem[]>} */
97
+ _renderQueues: Map<string, CoraliteCollectionItem[]>;
96
98
  _plugins: {
97
99
  templates: any[];
98
100
  hooks: {
@@ -106,9 +108,6 @@ export class Coralite {
106
108
  };
107
109
  _scriptManager: ScriptManager;
108
110
  _source: {
109
- currentContextId: string;
110
- currentSourceContextId: string;
111
- contextInstances: {};
112
111
  contextModules: {
113
112
  parseHTML: typeof parseHTML;
114
113
  parseModule: typeof parseModule;
@@ -116,6 +115,7 @@ export class Coralite {
116
115
  getHtmlFile: typeof getHtmlFile;
117
116
  createElement: typeof createElement;
118
117
  createTextNode: typeof createTextNode;
118
+ transform: (root: CoraliteDocumentRoot | CoraliteAnyNode | CoraliteAnyNode[], options?: DomSerializerOptions) => string;
119
119
  };
120
120
  context: {
121
121
  plugins: {};
@@ -128,22 +128,6 @@ export class Coralite {
128
128
  pages: CoraliteCollection;
129
129
  };
130
130
  };
131
- _scripts: {
132
- /**
133
- * @param {string} id
134
- * @param {CoraliteScriptContent} item
135
- */
136
- add(id: string, item: CoraliteScriptContent): void;
137
- restore(): void;
138
- /** @type {Object.<string, Object.<string, CoraliteScriptContent>>} */
139
- content: {
140
- [x: string]: {
141
- [x: string]: CoraliteScriptContent;
142
- };
143
- };
144
- };
145
- /** @type {CoraliteCollectionItem[]} */
146
- _currentRenderQueue: CoraliteCollectionItem[];
147
131
  /**
148
132
  * Initialises the Coralite instance.
149
133
  * @returns {Promise<void>}
@@ -162,8 +146,14 @@ export class Coralite {
162
146
  _childCustomElements: {
163
147
  [x: string]: string;
164
148
  };
165
- /** @type {CoraliteCollection} */
166
149
  pages: CoraliteCollection;
150
+ /**
151
+ * Creates a render context for the build process.
152
+ * @internal
153
+ * @param {string} [buildId] - The unique identifier for the build process.
154
+ * @returns {Object}
155
+ */
156
+ _createRenderContext(buildId?: string): any;
167
157
  /**
168
158
  * Compiles specified page(s) by rendering their document content and measuring render time.
169
159
  * Processes pages based on provided path(s), replacing custom elements with components,
@@ -172,9 +162,10 @@ export class Coralite {
172
162
  * @internal
173
163
  *
174
164
  * @param {string | string[]} [path] - Path to a single page or array of page paths relative to the pages directory. If omitted, compiles all pages.
165
+ * @param {Object} [values] - Values to be passed to the page
175
166
  * @return {AsyncGenerator<CoraliteResult>}
176
167
  */
177
- _generatePages(path?: string | string[]): AsyncGenerator<CoraliteResult>;
168
+ _generatePages(path?: string | string[], values?: any): AsyncGenerator<CoraliteResult>;
178
169
  /**
179
170
  * Compiles pages and collects the results with controlled concurrency.
180
171
  * Can optionally transform each result via a callback before collecting.
@@ -192,6 +183,7 @@ export class Coralite {
192
183
  * @param {Object} [options] - Configuration options for the build process.
193
184
  * @param {number} [options.maxConcurrent=availableParallelism] - The maximum number of concurrent file write operations.
194
185
  * @param {AbortSignal} [options.signal] - An AbortSignal to cancel the build operation.
186
+ * @param {Object} [options.variables] - Local variables for the page
195
187
  * @returns {Promise<CoraliteResult[]>} A Promise that resolves to an array of build results.
196
188
  *
197
189
  * @overload
@@ -235,6 +227,7 @@ export class Coralite {
235
227
  * @param {Object} [options] - Configuration options for the build process.
236
228
  * @param {number} [options.maxConcurrent=availableParallelism] - The maximum number of concurrent file write operations.
237
229
  * @param {AbortSignal} [options.signal] - An AbortSignal to cancel the build operation.
230
+ * @param {Object} [options.variables] - Local variables for the page
238
231
  * @returns {Promise<CoraliteResult[]>} A Promise that resolves to an array of build results.
239
232
  *
240
233
  * @overload
@@ -278,6 +271,7 @@ export class Coralite {
278
271
  * @param {Object} [options] - Configuration options for the build process.
279
272
  * @param {number} [options.maxConcurrent=availableParallelism] - The maximum number of concurrent file write operations.
280
273
  * @param {AbortSignal} [options.signal] - An AbortSignal to cancel the build operation.
274
+ * @param {Object} [options.variables] - Local variables for the page
281
275
  * @returns {Promise<CoraliteResult[]>} A Promise that resolves to an array of build results.
282
276
  *
283
277
  * @overload
@@ -306,6 +300,7 @@ export class Coralite {
306
300
  build(path?: string | string[], options?: {
307
301
  maxConcurrent?: number;
308
302
  signal?: AbortSignal;
303
+ variables?: any;
309
304
  }): Promise<CoraliteResult[]>;
310
305
  /**
311
306
  * Compiles pages and collects the results with controlled concurrency.
@@ -324,6 +319,7 @@ export class Coralite {
324
319
  * @param {Object} [options] - Configuration options for the build process.
325
320
  * @param {number} [options.maxConcurrent=availableParallelism] - The maximum number of concurrent file write operations.
326
321
  * @param {AbortSignal} [options.signal] - An AbortSignal to cancel the build operation.
322
+ * @param {Object} [options.variables] - Local variables for the page
327
323
  * @returns {Promise<CoraliteResult[]>} A Promise that resolves to an array of build results.
328
324
  *
329
325
  * @overload
@@ -367,6 +363,7 @@ export class Coralite {
367
363
  * @param {Object} [options] - Configuration options for the build process.
368
364
  * @param {number} [options.maxConcurrent=availableParallelism] - The maximum number of concurrent file write operations.
369
365
  * @param {AbortSignal} [options.signal] - An AbortSignal to cancel the build operation.
366
+ * @param {Object} [options.variables] - Local variables for the page
370
367
  * @returns {Promise<CoraliteResult[]>} A Promise that resolves to an array of build results.
371
368
  *
372
369
  * @overload
@@ -423,9 +420,16 @@ export class Coralite {
423
420
  * Renders the provided node or array of nodes using the render function.
424
421
  *
425
422
  * @param {CoraliteDocumentRoot | CoraliteAnyNode | CoraliteAnyNode[]} root - The node(s) to be rendered.
423
+ * @param {DomSerializerOptions} [options] - Changes serialization behavior
426
424
  * @returns {string} returns raw HTML
427
425
  */
428
- transform(root: CoraliteDocumentRoot | CoraliteAnyNode | CoraliteAnyNode[]): string;
426
+ transform(root: CoraliteDocumentRoot | CoraliteAnyNode | CoraliteAnyNode[], options?: DomSerializerOptions): string;
427
+ /**
428
+ * Adds a page to the current render queue.
429
+ * @param {string|CoraliteCollectionItem} value - The path to a page or a CoraliteCollectionItem to add to the render queue.
430
+ * @param {string} buildId - The unique identifier for the current build process.
431
+ */
432
+ addRenderQueue(value: string | CoraliteCollectionItem, buildId: string): Promise<void>;
429
433
  /**
430
434
  * Retrieves page paths associated with a custom element template.
431
435
  *
@@ -433,11 +437,6 @@ export class Coralite {
433
437
  * @returns {string[]} An array of page paths linked to the custom element template.
434
438
  */
435
439
  getPagePathsUsingCustomElement(path: string): string[];
436
- /**
437
- * Adds a page to the current render queue.
438
- * @param {string|CoraliteCollectionItem} value - The path to a page or a CoraliteCollectionItem to add to the render queue.
439
- */
440
- addRenderQueue(value: string | CoraliteCollectionItem): Promise<void>;
441
440
  /**
442
441
  * @param {Object} options
443
442
  * @param {string} options.id - id - Unique identifier for the component
@@ -446,6 +445,7 @@ export class Coralite {
446
445
  * @param {CoraliteDocument} options.document - Current document being processed
447
446
  * @param {string} [options.contextId] - Context Id
448
447
  * @param {number} [options.index] - Context index
448
+ * @param {Object} [options.renderContext] - Render Context
449
449
  * @param {boolean} [head=true] - Indicates if the current function call is for the head of the recursion
450
450
  * @returns {Promise<CoraliteElement | void>}
451
451
  *
@@ -469,13 +469,14 @@ export class Coralite {
469
469
  * })
470
470
  * ```
471
471
  */
472
- createComponent({ id, values, element, document, contextId, index }: {
472
+ createComponent({ id, values, element, document, contextId, index, renderContext }: {
473
473
  id: string;
474
474
  values?: CoraliteModuleValues;
475
475
  element?: CoraliteElement;
476
476
  document: CoraliteDocument;
477
477
  contextId?: string;
478
478
  index?: number;
479
+ renderContext?: any;
479
480
  }, head?: boolean): Promise<CoraliteElement | void>;
480
481
  /**
481
482
  * Parses a Coralite module script and compiles it into JavaScript using esbuild.
@@ -487,15 +488,17 @@ export class Coralite {
487
488
  * @param {CoraliteElement} data.element - The Coralite module to parse
488
489
  * @param {CoraliteDocument} data.document - The document context in which the module is being processed
489
490
  * @param {string} data.contextId - Context Id
491
+ * @param {Object} data.renderContext - Render Context
490
492
  *
491
493
  * @returns {Promise<CoraliteModuleValues>}
492
494
  */
493
- _evaluate({ module, values, element, document, contextId }: {
495
+ _evaluate({ module, values, element, document, contextId, renderContext }: {
494
496
  module: CoraliteModule;
495
497
  values: CoraliteModuleValues;
496
498
  element: CoraliteElement;
497
499
  document: CoraliteDocument;
498
500
  contextId: string;
501
+ renderContext: any;
499
502
  }): Promise<CoraliteModuleValues>;
500
503
  /**
501
504
  * @template {Object} T
@@ -523,20 +526,20 @@ export default Coralite;
523
526
  export type BuildPageHandler = (result: CoraliteResult) => Promise<any> | any;
524
527
  import type { CoralitePluginInstance } from '../types/index.js';
525
528
  import type { IgnoreByAttribute } from '../types/index.js';
526
- import type { CoraliteModuleValues } from '../types/index.js';
527
- import { ScriptManager } from '#lib';
528
- import { parseHTML } from '#lib';
529
- import { parseModule } from '#lib';
530
- import { getHtmlFiles } from '#lib';
531
- import { getHtmlFile } from '#lib';
532
- import { createElement } from '#lib';
533
- import { createTextNode } from '#lib';
534
- import type CoraliteCollection from './collection.js';
535
- import type { CoraliteScriptContent } from '../types/index.js';
536
529
  import type { CoraliteCollectionItem } from '../types/index.js';
537
- import type { CoraliteResult } from '../types/index.js';
530
+ import { ScriptManager } from './script-manager.js';
531
+ import { parseHTML } from './parse.js';
532
+ import { parseModule } from './parse.js';
533
+ import { getHtmlFiles } from './html.js';
534
+ import { getHtmlFile } from './html.js';
535
+ import { createElement } from './parse.js';
536
+ import { createTextNode } from './parse.js';
538
537
  import type { CoraliteDocumentRoot } from '../types/index.js';
539
538
  import type { CoraliteAnyNode } from '../types/index.js';
539
+ import type { DomSerializerOptions } from 'dom-serializer';
540
+ import CoraliteCollection from './collection.js';
541
+ import type { CoraliteResult } from '../types/index.js';
542
+ import type { CoraliteModuleValues } from '../types/index.js';
540
543
  import type { CoraliteElement } from '../types/index.js';
541
544
  import type { CoraliteDocument } from '../types/index.js';
542
545
  import type { CoraliteModule } from '../types/index.js';
@@ -1 +1 @@
1
- {"version":3,"file":"coralite.d.ts","sourceRoot":"","sources":["../../lib/coralite.js"],"names":[],"mappings":"AAaA;;;;;;;;;;;;;;;;;;GAkBG;AAEH;;;;;;;;;;;;;;GAcG;AACH,2EAZG;IAAwB,SAAS,EAAzB,MAAM;IAC6B,OAAO,GAA1C,sBAAsB,EAAE;IACR,KAAK,EAArB,MAAM;IACwB,iBAAiB,GAA/C,iBAAiB,EAAE;CAC3B,QAoLF;;IA/MD;;;;;;;;;;;;;;;;;;OAkBG;IAEH;;;;;;;;;;;;;;OAcG;IACH,8DAZG;QAAwB,SAAS,EAAzB,MAAM;QAC6B,OAAO,GAA1C,sBAAsB,EAAE;QACR,KAAK,EAArB,MAAM;QACwB,iBAAiB,GAA/C,iBAAiB,EAAE;KAC3B,EAoLF;IAnJC;;;;;;;;;MAMC;IAED,oDAAoD;IACpD;;MAAgB;IAGhB;;;;;;;;;;MAUC;IAGD,8BAAyC;IAGzC;;;;;;;;;;;;;;;;;;;;;;MAmBC;IAED;QACE;;;WAGG;gBAFQ,MAAM,QACN,qBAAqB;;QAahC,sEAAsE;;;;;;MAEvE;IACD,uCAAuC;IACvC,qBADW,sBAAsB,EAAE,CACN;IAgF/B;;;OAGG;IACH,cAFa,OAAO,CAAC,IAAI,CAAC,CA+OzB;IA5OC,8BAwCE;IAaF;;OAEG;IACH;;MAA6C;IAC7C;;O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ionEventUpdate,
5
5
  * CoraliteCollectionEventDelete } from '../types/index.js'
@@ -14,6 +14,7 @@
14
14
  * @param {CoraliteCollectionEventSet} [options.onFileSet]
15
15
  * @param {CoraliteCollectionEventUpdate} [options.onFileUpdate]
16
16
  * @param {CoraliteCollectionEventDelete} [options.onFileDelete]
17
+ * @param {CoraliteCollection} [options.collection] - Optional collection instance to populate
17
18
  * @returns {Promise<CoraliteCollection>} Array of HTML file data including parent path, name, and content
18
19
  *
19
20
  * @example
@@ -24,7 +25,7 @@
24
25
  * exclude: ['index.html', 'subdir/file2.html']
25
26
  * })
26
27
  */
27
- export function getHtmlFiles({ path, type, recursive, exclude, onFileSet, onFileUpdate, onFileDelete }: {
28
+ export function getHtmlFiles({ path, type, recursive, exclude, onFileSet, onFileUpdate, onFileDelete, collection }: {
28
29
  path: string;
29
30
  type: "page" | "template";
30
31
  recursive?: boolean;
@@ -32,6 +33,7 @@ export function getHtmlFiles({ path, type, recursive, exclude, onFileSet, onFile
32
33
  onFileSet?: CoraliteCollectionEventSet;
33
34
  onFileUpdate?: CoraliteCollectionEventUpdate;
34
35
  onFileDelete?: CoraliteCollectionEventDelete;
36
+ collection?: CoraliteCollection;
35
37
  }): Promise<CoraliteCollection>;
36
38
  /**
37
39
  * Reads an HTML file and returns its content as a string.
@@ -1 +1 @@
1
- {"version":3,"file":"html.d.ts","sourceRoot":"","sources":["../../lib/html.js"],"names":[],"mappings":"AAKA;;;;;GAKG;AAEH;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wGAjBG;IAAwB,IAAI,EAApB,MAAM;IACuB,IAAI,EAAjC,MAAM,GAAG,UAAU;IACD,SAAS,GAA3B,OAAO;IACY,OAAO,GAA1B,MAAM,EAAE;IAC6B,SAAS,GAA9C,0BAA0B;IACc,YAAY,GAApD,6BAA6B;IACW,YAAY,GAApD,6BAA6B;CACrC,GAAU,OAAO,CAAC,kBAAkB,CAAC,CAiGvC;AAED;;;;GAIG;AACH,0CAHW,MAAM,UAehB;AAED;;;;GAIG;AACH,sCAHW,MAAM,mBAehB;gDApJwC,mBAAmB;mDAAnB,mBAAmB;mDAAnB,mBAAmB;+BAN7B,iBAAiB"}
1
+ {"version":3,"file":"html.d.ts","sourceRoot":"","sources":["../../lib/html.js"],"names":[],"mappings":"AAKA;;;;;GAKG;AAEH;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,oHAlBG;IAAwB,IAAI,EAApB,MAAM;IACuB,IAAI,EAAjC,MAAM,GAAG,UAAU;IACD,SAAS,GAA3B,OAAO;IACY,OAAO,GAA1B,MAAM,EAAE;IAC6B,SAAS,GAA9C,0BAA0B;IACc,YAAY,GAApD,6BAA6B;IACW,YAAY,GAApD,6BAA6B;IACA,UAAU,GAAvC,kBAAkB;CAC1B,GAAU,OAAO,CAAC,kBAAkB,CAAC,CAoGvC;AAED;;;;GAIG;AACH,0CAHW,MAAM,UAehB;AAED;;;;GAIG;AACH,sCAHW,MAAM,mBAehB;gDAxJwC,mBAAmB;mDAAnB,mBAAmB;mDAAnB,mBAAmB;+BAN7B,iBAAiB"}