@vertesia/build-tools 1.0.0-dev.20260203.130115Z → 1.0.0-dev.20260227.104700Z
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 +39 -0
- package/lib/build-tools.js +2020 -0
- package/lib/build-tools.js.map +1 -0
- package/lib/cjs/index.js +43 -0
- package/lib/cjs/index.js.map +1 -0
- package/lib/cjs/package.json +3 -0
- package/lib/cjs/parsers/frontmatter.js +25 -0
- package/lib/cjs/parsers/frontmatter.js.map +1 -0
- package/lib/cjs/plugin.js +150 -0
- package/lib/cjs/plugin.js.map +1 -0
- package/lib/cjs/presets/index.js +25 -0
- package/lib/cjs/presets/index.js.map +1 -0
- package/lib/cjs/presets/prompt.js +185 -0
- package/lib/cjs/presets/prompt.js.map +1 -0
- package/lib/cjs/presets/raw.js +25 -0
- package/lib/cjs/presets/raw.js.map +1 -0
- package/lib/cjs/presets/skill-collection.js +83 -0
- package/lib/cjs/presets/skill-collection.js.map +1 -0
- package/lib/cjs/presets/skill.js +272 -0
- package/lib/cjs/presets/skill.js.map +1 -0
- package/lib/cjs/presets/template-collection.js +80 -0
- package/lib/cjs/presets/template-collection.js.map +1 -0
- package/lib/cjs/presets/template.js +105 -0
- package/lib/cjs/presets/template.js.map +1 -0
- package/lib/cjs/types.js +6 -0
- package/lib/cjs/types.js.map +1 -0
- package/lib/cjs/utils/asset-copy.js +61 -0
- package/lib/cjs/utils/asset-copy.js.map +1 -0
- package/lib/cjs/utils/asset-discovery.js +100 -0
- package/lib/cjs/utils/asset-discovery.js.map +1 -0
- package/lib/cjs/utils/template-asset-discovery.js +63 -0
- package/lib/cjs/utils/template-asset-discovery.js.map +1 -0
- package/lib/cjs/utils/widget-compiler.js +115 -0
- package/lib/cjs/utils/widget-compiler.js.map +1 -0
- package/lib/esm/index.js +26 -0
- package/lib/esm/index.js.map +1 -0
- package/lib/esm/parsers/frontmatter.js +19 -0
- package/lib/esm/parsers/frontmatter.js.map +1 -0
- package/lib/esm/plugin.js +144 -0
- package/lib/esm/plugin.js.map +1 -0
- package/lib/esm/presets/index.js +10 -0
- package/lib/esm/presets/index.js.map +1 -0
- package/lib/esm/presets/prompt.js +181 -0
- package/lib/esm/presets/prompt.js.map +1 -0
- package/lib/esm/presets/raw.js +22 -0
- package/lib/esm/presets/raw.js.map +1 -0
- package/lib/esm/presets/skill-collection.js +77 -0
- package/lib/esm/presets/skill-collection.js.map +1 -0
- package/lib/esm/presets/skill.js +266 -0
- package/lib/esm/presets/skill.js.map +1 -0
- package/lib/esm/presets/template-collection.js +74 -0
- package/lib/esm/presets/template-collection.js.map +1 -0
- package/lib/esm/presets/template.js +99 -0
- package/lib/esm/presets/template.js.map +1 -0
- package/lib/esm/types.js +5 -0
- package/lib/esm/types.js.map +1 -0
- package/lib/esm/utils/asset-copy.js +54 -0
- package/lib/esm/utils/asset-copy.js.map +1 -0
- package/lib/esm/utils/asset-discovery.js +94 -0
- package/lib/esm/utils/asset-discovery.js.map +1 -0
- package/lib/esm/utils/template-asset-discovery.js +57 -0
- package/lib/esm/utils/template-asset-discovery.js.map +1 -0
- package/lib/esm/utils/widget-compiler.js +76 -0
- package/lib/esm/utils/widget-compiler.js.map +1 -0
- package/lib/types/index.d.ts +24 -0
- package/lib/types/index.d.ts.map +1 -0
- package/lib/types/parsers/frontmatter.d.ts +19 -0
- package/lib/types/parsers/frontmatter.d.ts.map +1 -0
- package/lib/types/plugin.d.ts +10 -0
- package/lib/types/plugin.d.ts.map +1 -0
- package/lib/types/presets/index.d.ts +10 -0
- package/lib/types/presets/index.d.ts.map +1 -0
- package/lib/types/presets/prompt.d.ts +63 -0
- package/lib/types/presets/prompt.d.ts.map +1 -0
- package/lib/types/presets/raw.d.ts +16 -0
- package/lib/types/presets/raw.d.ts.map +1 -0
- package/lib/types/presets/skill-collection.d.ts +26 -0
- package/lib/types/presets/skill-collection.d.ts.map +1 -0
- package/lib/types/presets/skill.d.ts +361 -0
- package/lib/types/presets/skill.d.ts.map +1 -0
- package/lib/types/presets/template-collection.d.ts +25 -0
- package/lib/types/presets/template-collection.d.ts.map +1 -0
- package/lib/types/presets/template.d.ts +58 -0
- package/lib/types/presets/template.d.ts.map +1 -0
- package/lib/types/types.d.ts +115 -0
- package/lib/types/types.d.ts.map +1 -0
- package/lib/types/utils/asset-copy.d.ts +20 -0
- package/lib/types/utils/asset-copy.d.ts.map +1 -0
- package/lib/types/utils/asset-discovery.d.ts +38 -0
- package/lib/types/utils/asset-discovery.d.ts.map +1 -0
- package/lib/types/utils/template-asset-discovery.d.ts +23 -0
- package/lib/types/utils/template-asset-discovery.d.ts.map +1 -0
- package/lib/types/utils/widget-compiler.d.ts +15 -0
- package/lib/types/utils/widget-compiler.d.ts.map +1 -0
- package/package.json +6 -6
- package/src/index.ts +5 -0
- package/src/presets/index.ts +3 -1
- package/src/presets/skill.ts +51 -3
- package/src/presets/template-collection.ts +83 -0
- package/src/presets/template.ts +116 -0
- package/src/types.ts +1 -1
- package/src/utils/template-asset-discovery.ts +77 -0
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utilities for discovering asset files (scripts, widgets) in skill directories
|
|
3
|
+
*/
|
|
4
|
+
import { readdirSync, statSync } from 'node:fs';
|
|
5
|
+
import path from 'node:path';
|
|
6
|
+
/**
|
|
7
|
+
* Check if a file exists and is a regular file
|
|
8
|
+
*/
|
|
9
|
+
function isFile(filePath) {
|
|
10
|
+
try {
|
|
11
|
+
return statSync(filePath).isFile();
|
|
12
|
+
}
|
|
13
|
+
catch {
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Get all files in a directory (non-recursive)
|
|
19
|
+
*/
|
|
20
|
+
function getFilesInDirectory(dirPath) {
|
|
21
|
+
try {
|
|
22
|
+
return readdirSync(dirPath).filter(file => {
|
|
23
|
+
const fullPath = path.join(dirPath, file);
|
|
24
|
+
return isFile(fullPath);
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
catch {
|
|
28
|
+
return [];
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Check if a file is a script file (.js or .py)
|
|
33
|
+
*/
|
|
34
|
+
function isScriptFile(fileName) {
|
|
35
|
+
return /\.(js|py)$/.test(fileName);
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Check if a file is a widget file (.tsx)
|
|
39
|
+
*/
|
|
40
|
+
function isWidgetFile(fileName) {
|
|
41
|
+
return /\.tsx$/.test(fileName);
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Extract widget name from .tsx file (remove extension)
|
|
45
|
+
*/
|
|
46
|
+
function getWidgetName(fileName) {
|
|
47
|
+
return fileName.replace(/\.tsx$/, '');
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Discover assets (scripts and widgets) in a skill directory
|
|
51
|
+
*
|
|
52
|
+
* @param skillFilePath - Absolute path to the skill.md file
|
|
53
|
+
* @param options - Asset discovery options
|
|
54
|
+
* @returns Discovered assets and metadata
|
|
55
|
+
*/
|
|
56
|
+
export function discoverSkillAssets(skillFilePath, options = {}) {
|
|
57
|
+
const skillDir = path.dirname(skillFilePath);
|
|
58
|
+
const files = getFilesInDirectory(skillDir);
|
|
59
|
+
const scripts = [];
|
|
60
|
+
const widgets = [];
|
|
61
|
+
const widgetMetadata = [];
|
|
62
|
+
const assetFiles = [];
|
|
63
|
+
const scriptsDir = options.scriptsDir || 'scripts';
|
|
64
|
+
for (const file of files) {
|
|
65
|
+
const fullPath = path.join(skillDir, file);
|
|
66
|
+
if (isScriptFile(file)) {
|
|
67
|
+
// Script file (.js or .py)
|
|
68
|
+
scripts.push(file);
|
|
69
|
+
assetFiles.push({
|
|
70
|
+
sourcePath: fullPath,
|
|
71
|
+
destPath: path.join(scriptsDir, file),
|
|
72
|
+
type: 'script'
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
else if (isWidgetFile(file)) {
|
|
76
|
+
// Widget file (.tsx)
|
|
77
|
+
const widgetName = getWidgetName(file);
|
|
78
|
+
widgets.push(widgetName);
|
|
79
|
+
widgetMetadata.push({
|
|
80
|
+
name: widgetName,
|
|
81
|
+
path: fullPath
|
|
82
|
+
});
|
|
83
|
+
// Note: We don't add widget .tsx files to assetFiles
|
|
84
|
+
// Widgets are compiled by the plugin if widgetConfig is provided
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return {
|
|
88
|
+
scripts,
|
|
89
|
+
widgets,
|
|
90
|
+
widgetMetadata,
|
|
91
|
+
assetFiles
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=asset-discovery.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"asset-discovery.js","sourceRoot":"","sources":["../../../src/utils/asset-discovery.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,IAAI,MAAM,WAAW,CAAC;AA+B7B;;GAEG;AACH,SAAS,MAAM,CAAC,QAAgB;IAC5B,IAAI,CAAC;QACD,OAAO,QAAQ,CAAC,QAAQ,CAAC,CAAC,MAAM,EAAE,CAAC;IACvC,CAAC;IAAC,MAAM,CAAC;QACL,OAAO,KAAK,CAAC;IACjB,CAAC;AACL,CAAC;AAED;;GAEG;AACH,SAAS,mBAAmB,CAAC,OAAe;IACxC,IAAI,CAAC;QACD,OAAO,WAAW,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE;YACtC,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;YAC1C,OAAO,MAAM,CAAC,QAAQ,CAAC,CAAC;QAC5B,CAAC,CAAC,CAAC;IACP,CAAC;IAAC,MAAM,CAAC;QACL,OAAO,EAAE,CAAC;IACd,CAAC;AACL,CAAC;AAED;;GAEG;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;YACrB,MAAM,UAAU,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC;YACvC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;YACzB,cAAc,CAAC,IAAI,CAAC;gBAChB,IAAI,EAAE,UAAU;gBAChB,IAAI,EAAE,QAAQ;aACjB,CAAC,CAAC;YAEH,qDAAqD;YACrD,iEAAiE;QACrE,CAAC;IACL,CAAC;IAED,OAAO;QACH,OAAO;QACP,OAAO;QACP,cAAc;QACd,UAAU;KACb,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utilities for discovering asset files in template directories
|
|
3
|
+
*/
|
|
4
|
+
import { readdirSync, statSync } from 'node:fs';
|
|
5
|
+
import path from 'node:path';
|
|
6
|
+
/**
|
|
7
|
+
* Files to exclude from template asset discovery
|
|
8
|
+
* (source files and the template definition itself)
|
|
9
|
+
*/
|
|
10
|
+
const EXCLUDED_PATTERNS = [
|
|
11
|
+
/^TEMPLATE\.md$/,
|
|
12
|
+
/\.ts$/,
|
|
13
|
+
/\.js$/,
|
|
14
|
+
];
|
|
15
|
+
function isExcluded(fileName) {
|
|
16
|
+
return EXCLUDED_PATTERNS.some(p => p.test(fileName));
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Discover asset files in a template directory.
|
|
20
|
+
* All files except TEMPLATE.md, *.ts, and *.js are considered assets.
|
|
21
|
+
*
|
|
22
|
+
* @param templateFilePath - Absolute path to the TEMPLATE.md file
|
|
23
|
+
* @param templatePath - The template path segment (e.g., "examples/report")
|
|
24
|
+
* @returns Discovered assets and metadata
|
|
25
|
+
*/
|
|
26
|
+
export function discoverTemplateAssets(templateFilePath, templatePath) {
|
|
27
|
+
const templateDir = path.dirname(templateFilePath);
|
|
28
|
+
const fileNames = [];
|
|
29
|
+
const assetFiles = [];
|
|
30
|
+
let files;
|
|
31
|
+
try {
|
|
32
|
+
files = readdirSync(templateDir).filter(file => {
|
|
33
|
+
try {
|
|
34
|
+
return statSync(path.join(templateDir, file)).isFile();
|
|
35
|
+
}
|
|
36
|
+
catch {
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
catch {
|
|
42
|
+
files = [];
|
|
43
|
+
}
|
|
44
|
+
for (const file of files) {
|
|
45
|
+
if (isExcluded(file)) {
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
48
|
+
fileNames.push(file);
|
|
49
|
+
assetFiles.push({
|
|
50
|
+
sourcePath: path.join(templateDir, file),
|
|
51
|
+
destPath: path.join('templates', templatePath, file),
|
|
52
|
+
type: 'template',
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
return { fileNames, assetFiles };
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=template-asset-discovery.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"template-asset-discovery.js","sourceRoot":"","sources":["../../../src/utils/template-asset-discovery.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,IAAI,MAAM,WAAW,CAAC;AAc7B;;;GAGG;AACH,MAAM,iBAAiB,GAAG;IACtB,gBAAgB;IAChB,OAAO;IACP,OAAO;CACV,CAAC;AAEF,SAAS,UAAU,CAAC,QAAgB;IAChC,OAAO,iBAAiB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;AACzD,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,sBAAsB,CAClC,gBAAwB,EACxB,YAAoB;IAEpB,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC;IACnD,MAAM,SAAS,GAAa,EAAE,CAAC;IAC/B,MAAM,UAAU,GAAgB,EAAE,CAAC;IAEnC,IAAI,KAAe,CAAC;IACpB,IAAI,CAAC;QACD,KAAK,GAAG,WAAW,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE;YAC3C,IAAI,CAAC;gBACD,OAAO,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;YAC3D,CAAC;YAAC,MAAM,CAAC;gBACL,OAAO,KAAK,CAAC;YACjB,CAAC;QACL,CAAC,CAAC,CAAC;IACP,CAAC;IAAC,MAAM,CAAC;QACL,KAAK,GAAG,EAAE,CAAC;IACf,CAAC;IAED,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACvB,IAAI,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;YACnB,SAAS;QACb,CAAC;QAED,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACrB,UAAU,CAAC,IAAI,CAAC;YACZ,UAAU,EAAE,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC;YACxC,QAAQ,EAAE,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,YAAY,EAAE,IAAI,CAAC;YACpD,IAAI,EAAE,UAAU;SACnB,CAAC,CAAC;IACP,CAAC;IAED,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC;AACrC,CAAC"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Widget compilation utility using Rollup
|
|
3
|
+
*/
|
|
4
|
+
import { rollup } from 'rollup';
|
|
5
|
+
import path from 'node:path';
|
|
6
|
+
/**
|
|
7
|
+
* Default external dependencies for widgets
|
|
8
|
+
*/
|
|
9
|
+
const DEFAULT_EXTERNALS = [
|
|
10
|
+
'react',
|
|
11
|
+
'react-dom',
|
|
12
|
+
'react/jsx-runtime',
|
|
13
|
+
'react/jsx-dev-runtime',
|
|
14
|
+
'react-dom/client'
|
|
15
|
+
];
|
|
16
|
+
/**
|
|
17
|
+
* Compile widgets using Rollup
|
|
18
|
+
*
|
|
19
|
+
* @param widgets - Array of widget metadata to compile
|
|
20
|
+
* @param outputDir - Directory to write compiled widgets
|
|
21
|
+
* @param config - Widget compilation configuration
|
|
22
|
+
* @returns Number of widgets compiled
|
|
23
|
+
*/
|
|
24
|
+
export async function compileWidgets(widgets, outputDir, config = {}) {
|
|
25
|
+
if (widgets.length === 0) {
|
|
26
|
+
return 0;
|
|
27
|
+
}
|
|
28
|
+
const { external = DEFAULT_EXTERNALS, tsconfig = './tsconfig.json', typescript: typescriptOptions = {}, minify = false } = config;
|
|
29
|
+
// Build each widget separately to get individual bundles
|
|
30
|
+
const buildPromises = widgets.map(async (widget) => {
|
|
31
|
+
// Dynamically import plugins - use any to bypass TypeScript module resolution issues
|
|
32
|
+
const typescript = (await import('@rollup/plugin-typescript')).default;
|
|
33
|
+
const nodeResolve = (await import('@rollup/plugin-node-resolve')).default;
|
|
34
|
+
const commonjs = (await import('@rollup/plugin-commonjs')).default;
|
|
35
|
+
const plugins = [
|
|
36
|
+
typescript({
|
|
37
|
+
tsconfig,
|
|
38
|
+
declaration: false,
|
|
39
|
+
sourceMap: true,
|
|
40
|
+
...typescriptOptions
|
|
41
|
+
}),
|
|
42
|
+
nodeResolve({
|
|
43
|
+
browser: true,
|
|
44
|
+
preferBuiltins: false,
|
|
45
|
+
extensions: ['.tsx', '.ts', '.jsx', '.js']
|
|
46
|
+
}),
|
|
47
|
+
commonjs()
|
|
48
|
+
];
|
|
49
|
+
// Add minification if requested
|
|
50
|
+
if (minify) {
|
|
51
|
+
const { terser } = await import('rollup-plugin-terser');
|
|
52
|
+
plugins.push(terser({
|
|
53
|
+
compress: {
|
|
54
|
+
drop_console: false
|
|
55
|
+
}
|
|
56
|
+
}));
|
|
57
|
+
}
|
|
58
|
+
const rollupConfig = {
|
|
59
|
+
input: widget.path,
|
|
60
|
+
output: {
|
|
61
|
+
file: path.join(outputDir, `${widget.name}.js`),
|
|
62
|
+
format: 'es',
|
|
63
|
+
sourcemap: true,
|
|
64
|
+
inlineDynamicImports: true
|
|
65
|
+
},
|
|
66
|
+
external,
|
|
67
|
+
plugins
|
|
68
|
+
};
|
|
69
|
+
const bundle = await rollup(rollupConfig);
|
|
70
|
+
await bundle.write(rollupConfig.output);
|
|
71
|
+
await bundle.close();
|
|
72
|
+
});
|
|
73
|
+
await Promise.all(buildPromises);
|
|
74
|
+
return widgets.length;
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=widget-compiler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"widget-compiler.js","sourceRoot":"","sources":["../../../src/utils/widget-compiler.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAmC,MAAM,QAAQ,CAAC;AACjE,OAAO,IAAI,MAAM,WAAW,CAAC;AAI7B;;GAEG;AACH,MAAM,iBAAiB,GAAG;IACtB,OAAO;IACP,WAAW;IACX,mBAAmB;IACnB,uBAAuB;IACvB,kBAAkB;CACrB,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAChC,OAAyB,EACzB,SAAiB,EACjB,SAAuB,EAAE;IAEzB,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvB,OAAO,CAAC,CAAC;IACb,CAAC;IAED,MAAM,EACF,QAAQ,GAAG,iBAAiB,EAC5B,QAAQ,GAAG,iBAAiB,EAC5B,UAAU,EAAE,iBAAiB,GAAG,EAAE,EAClC,MAAM,GAAG,KAAK,EACjB,GAAG,MAAM,CAAC;IAEX,yDAAyD;IACzD,MAAM,aAAa,GAAG,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE;QAC/C,qFAAqF;QACrF,MAAM,UAAU,GAAG,CAAC,MAAM,MAAM,CAAC,2BAAkC,CAAC,CAAC,CAAC,OAAc,CAAC;QACrF,MAAM,WAAW,GAAG,CAAC,MAAM,MAAM,CAAC,6BAAoC,CAAC,CAAC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MAAM,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vertesia Rollup Import Plugin
|
|
3
|
+
*
|
|
4
|
+
* A flexible Rollup plugin for transforming imports with custom compilers and validation.
|
|
5
|
+
* Supports preset transformers for common use cases (skills, raw files) and custom transformers.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* import { vertesiaImportPlugin, skillTransformer, rawTransformer } from '@vertesia/build-tools';
|
|
10
|
+
*
|
|
11
|
+
* export default {
|
|
12
|
+
* plugins: [
|
|
13
|
+
* vertesiaImportPlugin({
|
|
14
|
+
* transformers: [skillTransformer, rawTransformer]
|
|
15
|
+
* })
|
|
16
|
+
* ]
|
|
17
|
+
* };
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export { vertesiaImportPlugin } from './plugin.js';
|
|
21
|
+
export type { PluginConfig, TransformerRule, TransformerPreset, TransformFunction, TransformResult, AssetFile, WidgetConfig } from './types.js';
|
|
22
|
+
export { skillTransformer, rawTransformer, skillCollectionTransformer, templateTransformer, templateCollectionTransformer, promptTransformer, SkillDefinitionSchema, SkillPropertiesSchema, RenderingTemplateDefinitionSchema, PromptDefinitionSchema, type SkillDefinition, type SkillContentType, type RenderingTemplateDefinition, type PromptDefinition, type PromptContentType, PromptRole, TemplateType } from './presets/index.js';
|
|
23
|
+
export { parseFrontmatter, type FrontmatterResult } from './parsers/frontmatter.js';
|
|
24
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAGnD,YAAY,EACR,YAAY,EACZ,eAAe,EACf,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,EACf,SAAS,EACT,YAAY,EACf,MAAM,YAAY,CAAC;AAGpB,OAAO,EACH,gBAAgB,EAChB,cAAc,EACd,0BAA0B,EAC1B,mBAAmB,EACnB,6BAA6B,EAC7B,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,EACrB,iCAAiC,EACjC,sBAAsB,EACtB,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,2BAA2B,EAChC,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,UAAU,EACV,YAAY,EACf,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EAAE,gBAAgB,EAAE,KAAK,iBAAiB,EAAE,MAAM,0BAA0B,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Frontmatter parser utility using gray-matter
|
|
3
|
+
*/
|
|
4
|
+
export interface FrontmatterResult {
|
|
5
|
+
/** Parsed frontmatter data */
|
|
6
|
+
frontmatter: Record<string, any>;
|
|
7
|
+
/** Content without frontmatter */
|
|
8
|
+
content: string;
|
|
9
|
+
/** Original full content */
|
|
10
|
+
original: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Parse YAML frontmatter from markdown content
|
|
14
|
+
*
|
|
15
|
+
* @param content - Raw markdown content with optional frontmatter
|
|
16
|
+
* @returns Parsed frontmatter and content
|
|
17
|
+
*/
|
|
18
|
+
export declare function parseFrontmatter(content: string): FrontmatterResult;
|
|
19
|
+
//# sourceMappingURL=frontmatter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"frontmatter.d.ts","sourceRoot":"","sources":["../../../src/parsers/frontmatter.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,MAAM,WAAW,iBAAiB;IAC9B,8BAA8B;IAC9B,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAEjC,kCAAkC;IAClC,OAAO,EAAE,MAAM,CAAC;IAEhB,4BAA4B;IAC5B,QAAQ,EAAE,MAAM,CAAC;CACpB;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,iBAAiB,CAQnE"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core Rollup plugin implementation for transforming imports
|
|
3
|
+
*/
|
|
4
|
+
import type { Plugin } from 'rollup';
|
|
5
|
+
import type { PluginConfig } from './types.js';
|
|
6
|
+
/**
|
|
7
|
+
* Creates a Rollup plugin that transforms imports based on configured rules
|
|
8
|
+
*/
|
|
9
|
+
export declare function vertesiaImportPlugin(config: PluginConfig): Plugin;
|
|
10
|
+
//# sourceMappingURL=plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../src/plugin.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAGrC,OAAO,KAAK,EAAE,YAAY,EAA8B,MAAM,YAAY,CAAC;AAK3E;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,CAsJjE"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Preset transformers for common use cases
|
|
3
|
+
*/
|
|
4
|
+
export { skillTransformer, SkillDefinitionSchema, SkillPropertiesSchema, type SkillDefinition, type SkillContentType } from './skill.js';
|
|
5
|
+
export { skillCollectionTransformer } from './skill-collection.js';
|
|
6
|
+
export { templateTransformer, RenderingTemplateDefinitionSchema, type RenderingTemplateDefinition } from './template.js';
|
|
7
|
+
export { templateCollectionTransformer } from './template-collection.js';
|
|
8
|
+
export { rawTransformer } from './raw.js';
|
|
9
|
+
export { promptTransformer, PromptDefinitionSchema, type PromptDefinition, type PromptContentType, PromptRole, TemplateType } from './prompt.js';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/presets/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,KAAK,eAAe,EAAE,KAAK,gBAAgB,EAAE,MAAM,YAAY,CAAC;AACzI,OAAO,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,EAAE,mBAAmB,EAAE,iCAAiC,EAAE,KAAK,2BAA2B,EAAE,MAAM,eAAe,CAAC;AACzH,OAAO,EAAE,6BAA6B,EAAE,MAAM,0BAA0B,CAAC;AACzE,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,KAAK,gBAAgB,EAAE,KAAK,iBAAiB,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Prompt transformer preset for template files with frontmatter
|
|
3
|
+
* Supports .jst, .hbs, and plain text files
|
|
4
|
+
*/
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
import type { TransformerPreset } from '../types.js';
|
|
7
|
+
import { TemplateType } from '@vertesia/common';
|
|
8
|
+
import { PromptRole } from '@llumiverse/common';
|
|
9
|
+
/**
|
|
10
|
+
* Re-export types for backwards compatibility
|
|
11
|
+
*/
|
|
12
|
+
export { TemplateType, PromptRole };
|
|
13
|
+
/**
|
|
14
|
+
* Template type alias
|
|
15
|
+
*/
|
|
16
|
+
export type PromptContentType = TemplateType;
|
|
17
|
+
/**
|
|
18
|
+
* MUST be kept in sync with @vertesia/common InCodePrompt
|
|
19
|
+
* Zod schema for prompt definition
|
|
20
|
+
*/
|
|
21
|
+
export declare const PromptDefinitionSchema: z.ZodObject<{
|
|
22
|
+
role: z.ZodNativeEnum<typeof PromptRole>;
|
|
23
|
+
content: z.ZodString;
|
|
24
|
+
content_type: z.ZodNativeEnum<typeof TemplateType>;
|
|
25
|
+
schema: z.ZodOptional<z.ZodAny>;
|
|
26
|
+
name: z.ZodOptional<z.ZodString>;
|
|
27
|
+
externalId: z.ZodOptional<z.ZodString>;
|
|
28
|
+
}, "strip", z.ZodTypeAny, {
|
|
29
|
+
content_type: TemplateType;
|
|
30
|
+
content: string;
|
|
31
|
+
role: PromptRole;
|
|
32
|
+
schema?: any;
|
|
33
|
+
name?: string | undefined;
|
|
34
|
+
externalId?: string | undefined;
|
|
35
|
+
}, {
|
|
36
|
+
content_type: TemplateType;
|
|
37
|
+
content: string;
|
|
38
|
+
role: PromptRole;
|
|
39
|
+
schema?: any;
|
|
40
|
+
name?: string | undefined;
|
|
41
|
+
externalId?: string | undefined;
|
|
42
|
+
}>;
|
|
43
|
+
/**
|
|
44
|
+
* TypeScript type inferred from the Zod schema
|
|
45
|
+
*/
|
|
46
|
+
export type PromptDefinition = z.infer<typeof PromptDefinitionSchema>;
|
|
47
|
+
/**
|
|
48
|
+
* Prompt transformer preset
|
|
49
|
+
* Transforms template files with ?prompt suffix into prompt definition objects
|
|
50
|
+
*
|
|
51
|
+
* Supported file types:
|
|
52
|
+
* - .jst (JavaScript template literals) → content_type: 'jst'
|
|
53
|
+
* - .hbs (Handlebars templates) → content_type: 'handlebars'
|
|
54
|
+
* - .txt or other → content_type: 'text'
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* ```typescript
|
|
58
|
+
* import PROMPT from './prompt.hbs?prompt';
|
|
59
|
+
* // PROMPT is an InCodePrompt object
|
|
60
|
+
* ```
|
|
61
|
+
*/
|
|
62
|
+
export declare const promptTransformer: TransformerPreset;
|
|
63
|
+
//# sourceMappingURL=prompt.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../../../src/presets/prompt.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAGrD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD;;GAEG;AACH,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,CAAC;AAEpC;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,YAAY,CAAC;AAkB7C;;;GAGG;AACH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;EAOjC,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAiGtE;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,iBAAiB,EAAE,iBA4D/B,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Raw transformer preset for importing file content as strings
|
|
3
|
+
*/
|
|
4
|
+
import type { TransformerPreset } from '../types.js';
|
|
5
|
+
/**
|
|
6
|
+
* Raw transformer preset
|
|
7
|
+
* Transforms any file with ?raw suffix into a string export
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* import template from './template.html?raw';
|
|
12
|
+
* // template is a string containing the file content
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export declare const rawTransformer: TransformerPreset;
|
|
16
|
+
//# sourceMappingURL=raw.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"raw.d.ts","sourceRoot":"","sources":["../../../src/presets/raw.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErD;;;;;;;;;GASG;AACH,eAAO,MAAM,cAAc,EAAE,iBAO5B,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Skill collection transformer for directory-based skill imports
|
|
3
|
+
* Scans a directory for subdirectories containing SKILL.md files
|
|
4
|
+
*/
|
|
5
|
+
import type { TransformerPreset } from '../types.js';
|
|
6
|
+
/**
|
|
7
|
+
* Skill collection transformer preset
|
|
8
|
+
* Transforms directory imports with ?skills suffix into an array of skill imports
|
|
9
|
+
*
|
|
10
|
+
* Matches:
|
|
11
|
+
* - ./all?skills (recommended - generates all.js in the directory)
|
|
12
|
+
* - ./_skills?skills (generates _skills.js in the directory)
|
|
13
|
+
* - Any path ending with a filename and ?skills
|
|
14
|
+
*
|
|
15
|
+
* NOTE: A filename before ?skills is REQUIRED to avoid naming conflicts.
|
|
16
|
+
* The filename becomes the output module name.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```typescript
|
|
20
|
+
* import skills from './all?skills';
|
|
21
|
+
* // Scans current directory for subdirectories with SKILL.md
|
|
22
|
+
* // Generates all.js containing array of all skills
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export declare const skillCollectionTransformer: TransformerPreset;
|
|
26
|
+
//# sourceMappingURL=skill-collection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skill-collection.d.ts","sourceRoot":"","sources":["../../../src/presets/skill-collection.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErD;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,0BAA0B,EAAE,iBAyDxC,CAAC"}
|