coralite 0.28.1 → 0.28.3
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/bin/coralite.js +23 -1
- package/dist/lib/coralite.d.ts +15 -6
- package/dist/lib/coralite.d.ts.map +1 -1
- package/dist/lib/index.js +250 -214
- package/dist/lib/index.js.map +4 -4
- package/dist/plugins/define-component.js +2 -2
- package/dist/plugins/index.d.ts +1 -0
- package/dist/plugins/index.js +1 -0
- package/dist/plugins/static-assets.d.ts +4 -0
- package/dist/plugins/static-assets.d.ts.map +1 -0
- package/dist/plugins/static-assets.js +26 -0
- package/dist/types/core.d.ts +18 -0
- package/dist/types/core.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/module.d.ts +2 -3
- package/dist/types/module.d.ts.map +1 -1
- package/dist/types/script.d.ts +6 -0
- package/dist/types/script.d.ts.map +1 -1
- package/package.json +2 -2
package/bin/coralite.js
CHANGED
|
@@ -24,6 +24,7 @@ program
|
|
|
24
24
|
.option('-s, --skip-render-attribute <key...>', 'Parse elements but exclude them from final render output', [])
|
|
25
25
|
.option('-d, --dry-run', 'Run in dry-run mode')
|
|
26
26
|
.option('--standalone <path>', 'Output directory for standalone client-side web components')
|
|
27
|
+
.option('-a, --assets <mapping...>', 'Static assets to copy. Format: pkg:path:dest (or pkg:path)')
|
|
27
28
|
|
|
28
29
|
program.parse(process.argv)
|
|
29
30
|
program.on('error', (err) => {
|
|
@@ -46,6 +47,25 @@ const options = program.opts()
|
|
|
46
47
|
const pages = options.pages
|
|
47
48
|
const output = options.output
|
|
48
49
|
const ignoreByAttribute = []
|
|
50
|
+
let assets
|
|
51
|
+
|
|
52
|
+
if (options.assets) {
|
|
53
|
+
assets = []
|
|
54
|
+
for (const assetStr of options.assets) {
|
|
55
|
+
const parts = assetStr.split(':')
|
|
56
|
+
if (parts.length < 2) {
|
|
57
|
+
console.error('Failed to parse asset:', assetStr)
|
|
58
|
+
console.error('Invalid format. Expected pkg:path:dest or pkg:path')
|
|
59
|
+
process.exit(1)
|
|
60
|
+
}
|
|
61
|
+
const [pkg, path, dest] = parts
|
|
62
|
+
assets.push({
|
|
63
|
+
pkg,
|
|
64
|
+
path,
|
|
65
|
+
dest: dest || path
|
|
66
|
+
})
|
|
67
|
+
}
|
|
68
|
+
}
|
|
49
69
|
|
|
50
70
|
const coraliteOptions = {
|
|
51
71
|
components: options.components,
|
|
@@ -54,6 +74,8 @@ const coraliteOptions = {
|
|
|
54
74
|
skipRenderByAttribute: options.skipRenderAttribute,
|
|
55
75
|
mode: options.mode,
|
|
56
76
|
standaloneOutput: options.standalone,
|
|
77
|
+
output,
|
|
78
|
+
assets,
|
|
57
79
|
plugins: []
|
|
58
80
|
}
|
|
59
81
|
|
|
@@ -101,5 +123,5 @@ if (options.dryRun) {
|
|
|
101
123
|
}
|
|
102
124
|
} else {
|
|
103
125
|
// save the generated documents to output directory
|
|
104
|
-
await coralite.save(
|
|
126
|
+
await coralite.save()
|
|
105
127
|
}
|
package/dist/lib/coralite.d.ts
CHANGED
|
@@ -26,9 +26,11 @@
|
|
|
26
26
|
* @param {CoralitePluginInstance[]} [options.plugins=[]]
|
|
27
27
|
* @param {string} options.pages - The path to the directory containing pages that will be rendered using the provided components.
|
|
28
28
|
* @param {string} [options.mode='production'] - Build mode: "development" or "production"
|
|
29
|
+
* @param {import('../types/core.js').CoraliteStaticAsset[]} [options.assets] - Static assets to copy during build
|
|
29
30
|
* @param {Array<string | Attribute>} [options.ignoreByAttribute] - Elements to ignore with attribute name value pair
|
|
30
31
|
* @param {Array<string | Attribute>} [options.skipRenderByAttribute] - Element attributes to parse but exclude from final render output
|
|
31
32
|
* @param {string} [options.standaloneOutput] - Output directory for standalone client-side web components
|
|
33
|
+
* @param {string} [options.output] - Output directory for build artifacts
|
|
32
34
|
* @example
|
|
33
35
|
* const coralite = new Coralite({
|
|
34
36
|
* components: './path/to/components',
|
|
@@ -39,14 +41,16 @@
|
|
|
39
41
|
* skipRenderByAttribute: ['data-skip-render']
|
|
40
42
|
* });
|
|
41
43
|
*/
|
|
42
|
-
export function Coralite({ components, pages, plugins, ignoreByAttribute, skipRenderByAttribute, mode, standaloneOutput }: {
|
|
44
|
+
export function Coralite({ components, pages, plugins, assets, ignoreByAttribute, skipRenderByAttribute, mode, standaloneOutput, output }: {
|
|
43
45
|
components: string;
|
|
44
46
|
plugins?: CoralitePluginInstance[];
|
|
45
47
|
pages: string;
|
|
46
48
|
mode?: string;
|
|
49
|
+
assets?: import("../types/core.js").CoraliteStaticAsset[];
|
|
47
50
|
ignoreByAttribute?: Array<string | Attribute>;
|
|
48
51
|
skipRenderByAttribute?: Array<string | Attribute>;
|
|
49
52
|
standaloneOutput?: string;
|
|
53
|
+
output?: string;
|
|
50
54
|
}): void;
|
|
51
55
|
export class Coralite {
|
|
52
56
|
/**
|
|
@@ -77,9 +81,11 @@ export class Coralite {
|
|
|
77
81
|
* @param {CoralitePluginInstance[]} [options.plugins=[]]
|
|
78
82
|
* @param {string} options.pages - The path to the directory containing pages that will be rendered using the provided components.
|
|
79
83
|
* @param {string} [options.mode='production'] - Build mode: "development" or "production"
|
|
84
|
+
* @param {import('../types/core.js').CoraliteStaticAsset[]} [options.assets] - Static assets to copy during build
|
|
80
85
|
* @param {Array<string | Attribute>} [options.ignoreByAttribute] - Elements to ignore with attribute name value pair
|
|
81
86
|
* @param {Array<string | Attribute>} [options.skipRenderByAttribute] - Element attributes to parse but exclude from final render output
|
|
82
87
|
* @param {string} [options.standaloneOutput] - Output directory for standalone client-side web components
|
|
88
|
+
* @param {string} [options.output] - Output directory for build artifacts
|
|
83
89
|
* @example
|
|
84
90
|
* const coralite = new Coralite({
|
|
85
91
|
* components: './path/to/components',
|
|
@@ -90,19 +96,22 @@ export class Coralite {
|
|
|
90
96
|
* skipRenderByAttribute: ['data-skip-render']
|
|
91
97
|
* });
|
|
92
98
|
*/
|
|
93
|
-
constructor({ components, pages, plugins, ignoreByAttribute, skipRenderByAttribute, mode, standaloneOutput }: {
|
|
99
|
+
constructor({ components, pages, plugins, assets, ignoreByAttribute, skipRenderByAttribute, mode, standaloneOutput, output }: {
|
|
94
100
|
components: string;
|
|
95
101
|
plugins?: CoralitePluginInstance[];
|
|
96
102
|
pages: string;
|
|
97
103
|
mode?: string;
|
|
104
|
+
assets?: import("../types/core.js").CoraliteStaticAsset[];
|
|
98
105
|
ignoreByAttribute?: Array<string | Attribute>;
|
|
99
106
|
skipRenderByAttribute?: Array<string | Attribute>;
|
|
100
107
|
standaloneOutput?: string;
|
|
108
|
+
output?: string;
|
|
101
109
|
});
|
|
102
110
|
options: {
|
|
103
111
|
components: string;
|
|
104
112
|
pages: string;
|
|
105
113
|
plugins: CoralitePluginInstance[];
|
|
114
|
+
assets: import("../types/core.js").CoraliteStaticAsset[];
|
|
106
115
|
ignoreByAttribute: (string | import("../types/document.js").Attribute)[];
|
|
107
116
|
skipRenderByAttribute: (string | import("../types/document.js").Attribute)[];
|
|
108
117
|
mode: string;
|
|
@@ -111,6 +120,7 @@ export class Coralite {
|
|
|
111
120
|
components: string;
|
|
112
121
|
pages: string;
|
|
113
122
|
};
|
|
123
|
+
output: string;
|
|
114
124
|
};
|
|
115
125
|
/** @type {Map<string, CoraliteCollectionItem[]>} */
|
|
116
126
|
_renderQueues: Map<string, CoraliteCollectionItem[]>;
|
|
@@ -426,7 +436,6 @@ export class Coralite {
|
|
|
426
436
|
/**
|
|
427
437
|
* Compiles and saves pages to disk
|
|
428
438
|
*
|
|
429
|
-
* @param {string} output - Output directory path
|
|
430
439
|
* @param {string | string[]} [path] - Optional page path(s) to build
|
|
431
440
|
* @param {Object} [options] - Build configuration
|
|
432
441
|
* @param {number} [options.maxConcurrent=10] - Max concurrent file writes (min 1, max 100)
|
|
@@ -434,12 +443,12 @@ export class Coralite {
|
|
|
434
443
|
* @returns {Promise<{ path: string, duration: number }[]>} Array of saved file paths
|
|
435
444
|
* @example
|
|
436
445
|
* // Build entire site with default concurrency (10 files)
|
|
437
|
-
* await coralite.
|
|
446
|
+
* await coralite.save()
|
|
438
447
|
*
|
|
439
448
|
* // Build specific pages with custom concurrency
|
|
440
|
-
* await coralite.
|
|
449
|
+
* await coralite.save(['blog/*'], { maxConcurrent: 5 })
|
|
441
450
|
*/
|
|
442
|
-
save(
|
|
451
|
+
save(path?: string | string[], options?: {
|
|
443
452
|
maxConcurrent?: number;
|
|
444
453
|
signal?: AbortSignal;
|
|
445
454
|
}): Promise<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coralite.d.ts","sourceRoot":"","sources":["../../lib/coralite.js"],"names":[],"mappings":"AAoBA;;;;;;;;;;;;;;;;;GAiBG;AAEH;;GAEG;AAEH
|
|
1
|
+
{"version":3,"file":"coralite.d.ts","sourceRoot":"","sources":["../../lib/coralite.js"],"names":[],"mappings":"AAoBA;;;;;;;;;;;;;;;;;GAiBG;AAEH;;GAEG;AAEH;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,2IAnBG;IAAwB,UAAU,EAA1B,MAAM;IAC6B,OAAO,GAA1C,sBAAsB,EAAE;IACR,KAAK,EAArB,MAAM;IACW,IAAI,GAArB,MAAM;IACqD,MAAM,GAAjE,OAAO,kBAAkB,EAAE,mBAAmB,EAAE;IACZ,iBAAiB,GAArD,KAAK,CAAC,MAAM,GAAG,SAAS,CAAC;IACW,qBAAqB,GAAzD,KAAK,CAAC,MAAM,GAAG,SAAS,CAAC;IACR,gBAAgB,GAAjC,MAAM;IACW,MAAM,GAAvB,MAAM;CACd,QAyLF;;IA5ND;;;;;;;;;;;;;;;;;OAiBG;IAEH;;OAEG;IAEH;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,8HAnBG;QAAwB,UAAU,EAA1B,MAAM;QAC6B,OAAO,GAA1C,sBAAsB,EAAE;QACR,KAAK,EAArB,MAAM;QACW,IAAI,GAArB,MAAM;QACqD,MAAM,GAAjE,OAAO,kBAAkB,EAAE,mBAAmB,EA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