@vertesia/build-tools 1.0.0-dev.20260203.130115Z → 1.0.0-dev.20260225.024852Z
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 +1798 -0
- package/lib/build-tools.js.map +1 -0
- package/lib/cjs/index.js +40 -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 +20 -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/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/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 +8 -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/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/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 +8 -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/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/widget-compiler.d.ts +15 -0
- package/lib/types/utils/widget-compiler.d.ts.map +1 -0
- package/package.json +3 -3
- package/src/index.ts +1 -0
- package/src/presets/index.ts +1 -1
- package/src/presets/skill.ts +51 -3
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Widget compilation utility using Rollup
|
|
3
|
+
*/
|
|
4
|
+
import type { WidgetConfig } from '../types.js';
|
|
5
|
+
import type { WidgetMetadata } from './asset-discovery.js';
|
|
6
|
+
/**
|
|
7
|
+
* Compile widgets using Rollup
|
|
8
|
+
*
|
|
9
|
+
* @param widgets - Array of widget metadata to compile
|
|
10
|
+
* @param outputDir - Directory to write compiled widgets
|
|
11
|
+
* @param config - Widget compilation configuration
|
|
12
|
+
* @returns Number of widgets compiled
|
|
13
|
+
*/
|
|
14
|
+
export declare function compileWidgets(widgets: WidgetMetadata[], outputDir: string, config?: WidgetConfig): Promise<number>;
|
|
15
|
+
//# sourceMappingURL=widget-compiler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"widget-compiler.d.ts","sourceRoot":"","sources":["../../../src/utils/widget-compiler.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAa3D;;;;;;;GAOG;AACH,wBAAsB,cAAc,CAChC,OAAO,EAAE,cAAc,EAAE,EACzB,SAAS,EAAE,MAAM,EACjB,MAAM,GAAE,YAAiB,GAC1B,OAAO,CAAC,MAAM,CAAC,CAiEjB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vertesia/build-tools",
|
|
3
|
-
"version": "1.0.0-dev.
|
|
3
|
+
"version": "1.0.0-dev.20260225.024852Z",
|
|
4
4
|
"description": "Build tools for Vertesia projects - Rollup and Vite plugins for transforming imports, bundling skills, and compiling widgets",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./lib/esm/index.js",
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"gray-matter": "^4.0.3",
|
|
31
31
|
"zod": "^3.24.1",
|
|
32
|
-
"@llumiverse/common": "1.0.0-dev.
|
|
33
|
-
"@vertesia/common": "1.0.0-dev.
|
|
32
|
+
"@llumiverse/common": "1.0.0-dev.20260224.234313Z",
|
|
33
|
+
"@vertesia/common": "1.0.0-dev.20260225.024852Z"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
36
|
"rollup": "^4.0.0"
|
package/src/index.ts
CHANGED
package/src/presets/index.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Preset transformers for common use cases
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
export { skillTransformer, SkillDefinitionSchema, type SkillDefinition, type SkillContentType } from './skill.js';
|
|
5
|
+
export { skillTransformer, SkillDefinitionSchema, SkillPropertiesSchema, type SkillDefinition, type SkillContentType } from './skill.js';
|
|
6
6
|
export { skillCollectionTransformer } from './skill-collection.js';
|
|
7
7
|
export { rawTransformer } from './raw.js';
|
|
8
8
|
export { promptTransformer, PromptDefinitionSchema, type PromptDefinition, type PromptContentType, PromptRole, TemplateType } from './prompt.js';
|
package/src/presets/skill.ts
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
* Skill transformer preset for markdown files with frontmatter
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
+
import path from 'node:path';
|
|
6
|
+
import { existsSync } from 'node:fs';
|
|
5
7
|
import { z } from 'zod';
|
|
6
8
|
import type { TransformerPreset } from '../types.js';
|
|
7
9
|
import { parseFrontmatter } from '../parsers/frontmatter.js';
|
|
@@ -92,6 +94,9 @@ const SkillFrontmatterSchema = z.object({
|
|
|
92
94
|
* Zod schema for skill definition
|
|
93
95
|
* This validates the structure of skill objects generated from markdown
|
|
94
96
|
* Matches the SkillDefinition interface from @vertesia/tools-sdk
|
|
97
|
+
*
|
|
98
|
+
* Note: The isEnabled property is not included in this schema because Zod cannot
|
|
99
|
+
* properly validate function signatures. It will be type-checked by TypeScript instead.
|
|
95
100
|
*/
|
|
96
101
|
export const SkillDefinitionSchema = z.object({
|
|
97
102
|
name: z.string().min(1, 'Skill name is required'),
|
|
@@ -109,7 +114,17 @@ export const SkillDefinitionSchema = z.object({
|
|
|
109
114
|
related_tools: z.array(z.string()).optional(),
|
|
110
115
|
scripts: z.array(z.string()).optional(),
|
|
111
116
|
widgets: z.array(z.string()).optional()
|
|
112
|
-
});
|
|
117
|
+
}).passthrough();
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Schema for validating properties exported from properties.ts
|
|
121
|
+
* This is a partial schema - allows any subset of SkillDefinition fields
|
|
122
|
+
*
|
|
123
|
+
* Note: Function properties like isEnabled cannot be validated by Zod for their signatures.
|
|
124
|
+
* Zod will only check that they are functions, not their specific parameter/return types.
|
|
125
|
+
* Use TypeScript for proper type checking of function signatures.
|
|
126
|
+
*/
|
|
127
|
+
export const SkillPropertiesSchema = SkillDefinitionSchema.partial().passthrough();
|
|
113
128
|
|
|
114
129
|
/**
|
|
115
130
|
* TypeScript type inferred from the Zod schema
|
|
@@ -220,6 +235,11 @@ function buildSkillDefinition(
|
|
|
220
235
|
* - Files with ?skill suffix: ./my-skill.md?skill
|
|
221
236
|
* - SKILL.md files: ./my-skill/SKILL.md
|
|
222
237
|
*
|
|
238
|
+
* Runtime Properties:
|
|
239
|
+
* - Supports properties.ts file in skill directory for runtime properties (functions, overrides)
|
|
240
|
+
* - Properties from properties.ts override those from frontmatter
|
|
241
|
+
* - See README.md for detailed usage examples
|
|
242
|
+
*
|
|
223
243
|
* @example
|
|
224
244
|
* ```typescript
|
|
225
245
|
* import skill1 from './my-skill.md?skill';
|
|
@@ -238,8 +258,8 @@ export const skillTransformer: TransformerPreset = {
|
|
|
238
258
|
if (!frontmatterValidation.success) {
|
|
239
259
|
const errors = frontmatterValidation.error.errors
|
|
240
260
|
.map((err) => {
|
|
241
|
-
const
|
|
242
|
-
return ` - ${
|
|
261
|
+
const pathStr = err.path.length > 0 ? err.path.join('.') : 'frontmatter';
|
|
262
|
+
return ` - ${pathStr}: ${err.message}`;
|
|
243
263
|
})
|
|
244
264
|
.join('\n');
|
|
245
265
|
throw new Error(
|
|
@@ -262,6 +282,34 @@ export const skillTransformer: TransformerPreset = {
|
|
|
262
282
|
assets.scripts
|
|
263
283
|
);
|
|
264
284
|
|
|
285
|
+
// Check if properties.ts exists in the skill directory
|
|
286
|
+
const skillDir = path.dirname(filePath);
|
|
287
|
+
const propertiesPath = path.join(skillDir, 'properties.ts');
|
|
288
|
+
const hasProperties = existsSync(propertiesPath);
|
|
289
|
+
|
|
290
|
+
// If properties.ts exists, generate custom code with import and merge
|
|
291
|
+
// Rollup will handle transpiling properties.ts to properties.js
|
|
292
|
+
if (hasProperties) {
|
|
293
|
+
const skillDataJson = JSON.stringify(skillData, null, 2);
|
|
294
|
+
const code = `import properties from './properties.js';
|
|
295
|
+
|
|
296
|
+
// Runtime validation for function properties
|
|
297
|
+
if ('isEnabled' in properties && typeof properties.isEnabled !== 'function') {
|
|
298
|
+
throw new Error('properties.isEnabled must be a function, got ' + typeof properties.isEnabled);
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
const skill = ${skillDataJson};
|
|
302
|
+
|
|
303
|
+
export default { ...skill, ...properties };
|
|
304
|
+
`;
|
|
305
|
+
return {
|
|
306
|
+
data: skillData,
|
|
307
|
+
assets: assets.assetFiles,
|
|
308
|
+
widgets: assets.widgetMetadata,
|
|
309
|
+
code
|
|
310
|
+
};
|
|
311
|
+
}
|
|
312
|
+
|
|
265
313
|
return {
|
|
266
314
|
data: skillData,
|
|
267
315
|
assets: assets.assetFiles,
|