@vertesia/build-tools 1.2.0 → 1.3.0-dev.20260620.091720Z
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 +3 -3
- package/lib/bin/build.d.ts +35 -0
- package/lib/bin/build.d.ts.map +1 -0
- package/lib/bin/build.js +79 -0
- package/lib/bin/build.js.map +1 -0
- package/lib/bin/config.d.ts +24 -0
- package/lib/bin/config.d.ts.map +1 -0
- package/lib/bin/config.js +91 -0
- package/lib/bin/config.js.map +1 -0
- package/lib/core/compilers/widget.d.ts +27 -0
- package/lib/core/compilers/widget.d.ts.map +1 -0
- package/lib/core/compilers/widget.js +37 -0
- package/lib/core/compilers/widget.js.map +1 -0
- package/lib/{types → core}/parsers/frontmatter.d.ts +1 -4
- package/lib/core/parsers/frontmatter.d.ts.map +1 -0
- package/lib/core/parsers/frontmatter.js +26 -0
- package/lib/core/parsers/frontmatter.js.map +1 -0
- package/lib/core/transformers/index.d.ts +10 -0
- package/lib/core/transformers/index.d.ts.map +1 -0
- package/lib/core/transformers/index.js +10 -0
- package/lib/core/transformers/index.js.map +1 -0
- package/lib/{types/presets → core/transformers}/prompt.d.ts +7 -21
- package/lib/core/transformers/prompt.d.ts.map +1 -0
- package/lib/{esm/presets → core/transformers}/prompt.js +17 -14
- package/lib/core/transformers/prompt.js.map +1 -0
- package/lib/core/transformers/raw.d.ts.map +1 -0
- package/lib/{esm/presets → core/transformers}/raw.js +2 -2
- package/lib/core/transformers/raw.js.map +1 -0
- package/lib/core/transformers/skill-collection.d.ts.map +1 -0
- package/lib/{esm/presets → core/transformers}/skill-collection.js +5 -12
- package/lib/core/transformers/skill-collection.js.map +1 -0
- package/lib/core/transformers/skill.d.ts +111 -0
- package/lib/core/transformers/skill.d.ts.map +1 -0
- package/lib/{esm/presets → core/transformers}/skill.js +70 -51
- package/lib/core/transformers/skill.js.map +1 -0
- package/lib/core/transformers/template-collection.d.ts.map +1 -0
- package/lib/{esm/presets → core/transformers}/template-collection.js +5 -12
- package/lib/core/transformers/template-collection.js.map +1 -0
- package/lib/{types/presets → core/transformers}/template.d.ts +7 -22
- package/lib/core/transformers/template.d.ts.map +1 -0
- package/lib/{esm/presets → core/transformers}/template.js +16 -11
- package/lib/core/transformers/template.js.map +1 -0
- package/lib/{types → core}/types.d.ts +5 -61
- package/lib/core/types.d.ts.map +1 -0
- package/lib/core/types.js +6 -0
- package/lib/{cjs → core}/types.js.map +1 -1
- package/lib/core/utils/asset-copy.d.ts.map +1 -0
- package/lib/core/utils/asset-copy.js.map +1 -0
- package/lib/core/utils/asset-discovery.d.ts.map +1 -0
- package/lib/{esm → core}/utils/asset-discovery.js +4 -4
- package/lib/core/utils/asset-discovery.js.map +1 -0
- package/lib/core/utils/template-asset-discovery.d.ts.map +1 -0
- package/lib/{esm → core}/utils/template-asset-discovery.js +3 -7
- package/lib/core/utils/template-asset-discovery.js.map +1 -0
- package/lib/import-transform/builtins.d.ts +21 -0
- package/lib/import-transform/builtins.d.ts.map +1 -0
- package/lib/import-transform/builtins.js +50 -0
- package/lib/import-transform/builtins.js.map +1 -0
- package/lib/import-transform/chunk-emitter.d.ts +24 -0
- package/lib/import-transform/chunk-emitter.d.ts.map +1 -0
- package/lib/import-transform/chunk-emitter.js +35 -0
- package/lib/import-transform/chunk-emitter.js.map +1 -0
- package/lib/import-transform/detector.d.ts +24 -0
- package/lib/import-transform/detector.d.ts.map +1 -0
- package/lib/import-transform/detector.js +34 -0
- package/lib/import-transform/detector.js.map +1 -0
- package/lib/import-transform/index.d.ts +47 -0
- package/lib/import-transform/index.d.ts.map +1 -0
- package/lib/import-transform/index.js +115 -0
- package/lib/import-transform/index.js.map +1 -0
- package/lib/import-transform/patterns.d.ts +25 -0
- package/lib/import-transform/patterns.d.ts.map +1 -0
- package/lib/import-transform/patterns.js +27 -0
- package/lib/import-transform/patterns.js.map +1 -0
- package/lib/import-transform/resolver.d.ts +23 -0
- package/lib/import-transform/resolver.d.ts.map +1 -0
- package/lib/import-transform/resolver.js +30 -0
- package/lib/import-transform/resolver.js.map +1 -0
- package/lib/import-transform/rewriter.d.ts +21 -0
- package/lib/import-transform/rewriter.d.ts.map +1 -0
- package/lib/import-transform/rewriter.js +30 -0
- package/lib/import-transform/rewriter.js.map +1 -0
- package/lib/import-transform/scanner.d.ts +17 -0
- package/lib/import-transform/scanner.d.ts.map +1 -0
- package/lib/import-transform/scanner.js +46 -0
- package/lib/import-transform/scanner.js.map +1 -0
- package/lib/index.d.ts +39 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +43 -0
- package/lib/index.js.map +1 -0
- package/lib/vite/api-server.d.ts +54 -0
- package/lib/vite/api-server.d.ts.map +1 -0
- package/lib/vite/api-server.js +94 -0
- package/lib/vite/api-server.js.map +1 -0
- package/lib/vite/dev-server.d.ts +42 -0
- package/lib/vite/dev-server.d.ts.map +1 -0
- package/lib/vite/dev-server.js +111 -0
- package/lib/vite/dev-server.js.map +1 -0
- package/lib/vite/index.d.ts +15 -0
- package/lib/vite/index.d.ts.map +1 -0
- package/lib/vite/index.js +15 -0
- package/lib/vite/index.js.map +1 -0
- package/package.json +41 -29
- package/src/bin/build.ts +83 -0
- package/src/bin/config.ts +113 -0
- package/src/core/compilers/widget.ts +69 -0
- package/src/core/parsers/frontmatter.ts +41 -0
- package/src/core/transformers/index.ts +27 -0
- package/src/{presets → core/transformers}/prompt.ts +35 -32
- package/src/{presets → core/transformers}/raw.ts +2 -2
- package/src/{presets → core/transformers}/skill-collection.ts +5 -12
- package/src/{presets → core/transformers}/skill.ts +119 -99
- package/src/{presets → core/transformers}/template-collection.ts +76 -83
- package/src/{presets → core/transformers}/template.ts +121 -116
- package/src/core/types.ts +71 -0
- package/src/{utils → core/utils}/asset-copy.ts +3 -2
- package/src/{utils → core/utils}/asset-discovery.ts +5 -5
- package/src/{utils → core/utils}/template-asset-discovery.ts +70 -77
- package/src/import-transform/builtins.ts +56 -0
- package/src/import-transform/chunk-emitter.ts +60 -0
- package/src/import-transform/detector.ts +56 -0
- package/src/import-transform/index.ts +171 -0
- package/src/import-transform/patterns.ts +34 -0
- package/src/import-transform/resolver.ts +57 -0
- package/src/import-transform/rewriter.ts +48 -0
- package/src/import-transform/scanner.ts +55 -0
- package/src/index.ts +67 -42
- package/src/vite/api-server.ts +142 -0
- package/src/vite/dev-server.ts +128 -0
- package/src/vite/index.ts +15 -0
- package/lib/build-tools.js +0 -2031
- package/lib/build-tools.js.map +0 -1
- package/lib/cjs/index.js +0 -43
- package/lib/cjs/index.js.map +0 -1
- package/lib/cjs/package.json +0 -3
- package/lib/cjs/parsers/frontmatter.js +0 -25
- package/lib/cjs/parsers/frontmatter.js.map +0 -1
- package/lib/cjs/plugin.js +0 -150
- package/lib/cjs/plugin.js.map +0 -1
- package/lib/cjs/presets/index.js +0 -25
- package/lib/cjs/presets/index.js.map +0 -1
- package/lib/cjs/presets/prompt.js +0 -185
- package/lib/cjs/presets/prompt.js.map +0 -1
- package/lib/cjs/presets/raw.js +0 -25
- package/lib/cjs/presets/raw.js.map +0 -1
- package/lib/cjs/presets/skill-collection.js +0 -83
- package/lib/cjs/presets/skill-collection.js.map +0 -1
- package/lib/cjs/presets/skill.js +0 -272
- package/lib/cjs/presets/skill.js.map +0 -1
- package/lib/cjs/presets/template-collection.js +0 -80
- package/lib/cjs/presets/template-collection.js.map +0 -1
- package/lib/cjs/presets/template.js +0 -105
- package/lib/cjs/presets/template.js.map +0 -1
- package/lib/cjs/types.js +0 -6
- package/lib/cjs/utils/asset-copy.js +0 -61
- package/lib/cjs/utils/asset-copy.js.map +0 -1
- package/lib/cjs/utils/asset-discovery.js +0 -100
- package/lib/cjs/utils/asset-discovery.js.map +0 -1
- package/lib/cjs/utils/template-asset-discovery.js +0 -63
- package/lib/cjs/utils/template-asset-discovery.js.map +0 -1
- package/lib/cjs/utils/widget-compiler.js +0 -115
- package/lib/cjs/utils/widget-compiler.js.map +0 -1
- package/lib/cjs/vite.js +0 -45
- package/lib/cjs/vite.js.map +0 -1
- package/lib/esm/index.js +0 -26
- package/lib/esm/index.js.map +0 -1
- package/lib/esm/parsers/frontmatter.js +0 -19
- package/lib/esm/parsers/frontmatter.js.map +0 -1
- package/lib/esm/plugin.js +0 -144
- package/lib/esm/plugin.js.map +0 -1
- package/lib/esm/presets/index.js +0 -10
- package/lib/esm/presets/index.js.map +0 -1
- package/lib/esm/presets/prompt.js.map +0 -1
- package/lib/esm/presets/raw.js.map +0 -1
- package/lib/esm/presets/skill-collection.js.map +0 -1
- package/lib/esm/presets/skill.js.map +0 -1
- package/lib/esm/presets/template-collection.js.map +0 -1
- package/lib/esm/presets/template.js.map +0 -1
- package/lib/esm/types.js +0 -5
- package/lib/esm/types.js.map +0 -1
- package/lib/esm/utils/asset-copy.js.map +0 -1
- package/lib/esm/utils/asset-discovery.js.map +0 -1
- package/lib/esm/utils/template-asset-discovery.js.map +0 -1
- package/lib/esm/utils/widget-compiler.js +0 -76
- package/lib/esm/utils/widget-compiler.js.map +0 -1
- package/lib/esm/vite.js +0 -42
- package/lib/esm/vite.js.map +0 -1
- package/lib/types/index.d.ts +0 -24
- package/lib/types/index.d.ts.map +0 -1
- package/lib/types/parsers/frontmatter.d.ts.map +0 -1
- package/lib/types/plugin.d.ts +0 -10
- package/lib/types/plugin.d.ts.map +0 -1
- package/lib/types/presets/index.d.ts +0 -10
- package/lib/types/presets/index.d.ts.map +0 -1
- package/lib/types/presets/prompt.d.ts.map +0 -1
- package/lib/types/presets/raw.d.ts.map +0 -1
- package/lib/types/presets/skill-collection.d.ts.map +0 -1
- package/lib/types/presets/skill.d.ts +0 -361
- package/lib/types/presets/skill.d.ts.map +0 -1
- package/lib/types/presets/template-collection.d.ts.map +0 -1
- package/lib/types/presets/template.d.ts.map +0 -1
- package/lib/types/types.d.ts.map +0 -1
- package/lib/types/utils/asset-copy.d.ts.map +0 -1
- package/lib/types/utils/asset-discovery.d.ts.map +0 -1
- package/lib/types/utils/template-asset-discovery.d.ts.map +0 -1
- package/lib/types/utils/widget-compiler.d.ts +0 -15
- package/lib/types/utils/widget-compiler.d.ts.map +0 -1
- package/lib/types/vite.d.ts +0 -32
- package/lib/types/vite.d.ts.map +0 -1
- package/src/parsers/frontmatter.ts +0 -32
- package/src/plugin.ts +0 -166
- package/src/presets/index.ts +0 -10
- package/src/types.ts +0 -140
- package/src/utils/widget-compiler.ts +0 -98
- package/src/vite.ts +0 -45
- /package/lib/{types/presets → core/transformers}/raw.d.ts +0 -0
- /package/lib/{types/presets → core/transformers}/skill-collection.d.ts +0 -0
- /package/lib/{types/presets → core/transformers}/template-collection.d.ts +0 -0
- /package/lib/{types → core}/utils/asset-copy.d.ts +0 -0
- /package/lib/{esm → core}/utils/asset-copy.js +0 -0
- /package/lib/{types → core}/utils/asset-discovery.d.ts +0 -0
- /package/lib/{types → core}/utils/template-asset-discovery.d.ts +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Type definitions
|
|
2
|
+
* Type definitions shared across the Vertesia build-tools pipeline:
|
|
3
|
+
* transformers, transformer results, and asset metadata produced by them.
|
|
3
4
|
*/
|
|
4
|
-
import type { Plugin } from 'rollup';
|
|
5
5
|
import type { z } from 'zod';
|
|
6
6
|
/**
|
|
7
7
|
* Asset file to be copied during build
|
|
@@ -45,71 +45,15 @@ export interface TransformerRule {
|
|
|
45
45
|
/** Transform function to convert file content */
|
|
46
46
|
transform: TransformFunction;
|
|
47
47
|
/** Optional: Zod schema for validation */
|
|
48
|
-
schema?: z.ZodType<
|
|
48
|
+
schema?: z.ZodType<unknown>;
|
|
49
49
|
/** Optional: If true, the transformer generates virtual modules (no file to read) */
|
|
50
50
|
virtual?: boolean;
|
|
51
51
|
/** Optional: additional options for this transformer */
|
|
52
52
|
options?: Record<string, unknown>;
|
|
53
53
|
}
|
|
54
54
|
/**
|
|
55
|
-
*
|
|
56
|
-
|
|
57
|
-
export interface WidgetConfig {
|
|
58
|
-
/**
|
|
59
|
-
* External dependencies that should not be bundled
|
|
60
|
-
* Default: ['react', 'react-dom', 'react/jsx-runtime']
|
|
61
|
-
*/
|
|
62
|
-
external?: string[];
|
|
63
|
-
/**
|
|
64
|
-
* Path to tsconfig.json for widget compilation
|
|
65
|
-
* Default: './tsconfig.json'
|
|
66
|
-
*/
|
|
67
|
-
tsconfig?: string;
|
|
68
|
-
/**
|
|
69
|
-
* Additional options to pass to @rollup/plugin-typescript
|
|
70
|
-
*/
|
|
71
|
-
typescript?: Record<string, unknown>;
|
|
72
|
-
/**
|
|
73
|
-
* Minify widget output
|
|
74
|
-
* Default: false
|
|
75
|
-
*/
|
|
76
|
-
minify?: boolean;
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* Plugin configuration
|
|
80
|
-
*/
|
|
81
|
-
export interface PluginConfig {
|
|
82
|
-
/** Array of transformer rules to apply */
|
|
83
|
-
transformers: TransformerRule[];
|
|
84
|
-
/**
|
|
85
|
-
* Root directory for asset output (scripts, widgets, etc.)
|
|
86
|
-
* - If specified: assets will be copied to this directory
|
|
87
|
-
* - If false: asset copying is disabled
|
|
88
|
-
* - Default: './dist'
|
|
89
|
-
*/
|
|
90
|
-
assetsDir?: string | false;
|
|
91
|
-
/**
|
|
92
|
-
* Directory for script files relative to assetsDir
|
|
93
|
-
* Default: 'scripts'
|
|
94
|
-
*/
|
|
95
|
-
scriptsDir?: string;
|
|
96
|
-
/**
|
|
97
|
-
* Directory for widget files relative to assetsDir
|
|
98
|
-
* Default: 'widgets'
|
|
99
|
-
*/
|
|
100
|
-
widgetsDir?: string;
|
|
101
|
-
/**
|
|
102
|
-
* Widget compilation configuration
|
|
103
|
-
* If provided, discovered widgets will be automatically compiled
|
|
104
|
-
*/
|
|
105
|
-
widgetConfig?: WidgetConfig;
|
|
106
|
-
}
|
|
107
|
-
/**
|
|
108
|
-
* Type for transformer presets
|
|
55
|
+
* Type for transformer presets — alias for `TransformerRule` used by the
|
|
56
|
+
* built-in preset modules (skill, raw, prompt, template, …).
|
|
109
57
|
*/
|
|
110
58
|
export type TransformerPreset = TransformerRule;
|
|
111
|
-
/**
|
|
112
|
-
* Plugin factory return type
|
|
113
|
-
*/
|
|
114
|
-
export type VertesiaImportPlugin = (config: PluginConfig) => Plugin;
|
|
115
59
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/core/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAE7B;;GAEG;AACH,MAAM,WAAW,SAAS;IACtB,kCAAkC;IAClC,UAAU,EAAE,MAAM,CAAC;IAEnB,wDAAwD;IACxD,QAAQ,EAAE,MAAM,CAAC;IAEjB,oCAAoC;IACpC,IAAI,EAAE,QAAQ,GAAG,UAAU,CAAC;CAC/B;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC5B,sDAAsD;IACtD,IAAI,EAAE,OAAO,CAAC;IAEd,gFAAgF;IAChF,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IAEnB,uEAAuE;IACvE,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,+CAA+C;IAC/C,MAAM,CAAC,EAAE,SAAS,EAAE,CAAC;IAErB,gDAAgD;IAChD,OAAO,CAAC,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACnD;AAED;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;AAElH;;GAEG;AACH,MAAM,WAAW,eAAe;IAC5B,uEAAuE;IACvE,OAAO,EAAE,MAAM,CAAC;IAEhB,iDAAiD;IACjD,SAAS,EAAE,iBAAiB,CAAC;IAE7B,0CAA0C;IAC1C,MAAM,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAE5B,qFAAqF;IACrF,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB,wDAAwD;IACxD,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACrC;AAED;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG,eAAe,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/core/types.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"asset-copy.d.ts","sourceRoot":"","sources":["../../../src/core/utils/asset-copy.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAgB7C;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI,CAiBxE;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,SAAS,EAAE,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAS1E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"asset-copy.js","sourceRoot":"","sources":["../../../src/core/utils/asset-copy.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAClD,OAAO,IAAI,MAAM,WAAW,CAAC;AAG7B;;GAEG;AACH,SAAS,eAAe,CAAC,OAAe;IACpC,IAAI,CAAC;QACD,SAAS,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC5C,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACb,qCAAqC;QACrC,IA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2C;IAC3C,IAAI,EAAE,MAAM,CAAC;IAEb,mCAAmC;IACnC,IAAI,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC7B,oDAAoD;IACpD,OAAO,EAAE,MAAM,EAAE,CAAC;IAElB,iDAAiD;IACjD,OAAO,EAAE,MAAM,EAAE,CAAC;IAElB,sCAAsC;IACtC,cAAc,EAAE,cAAc,EAAE,CAAC;IAEjC,+BAA+B;IAC/B,UAAU,EAAE,SAAS,EAAE,CAAC;CAC3B;AAgDD;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAC/B,aAAa,EAAE,MAAM,EACrB,OAAO,GAAE;IACL,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;CAClB,GACP,gBAAgB,CA0ClB"}
|
|
@@ -19,7 +19,7 @@ function isFile(filePath) {
|
|
|
19
19
|
*/
|
|
20
20
|
function getFilesInDirectory(dirPath) {
|
|
21
21
|
try {
|
|
22
|
-
return readdirSync(dirPath).filter(file => {
|
|
22
|
+
return readdirSync(dirPath).filter((file) => {
|
|
23
23
|
const fullPath = path.join(dirPath, file);
|
|
24
24
|
return isFile(fullPath);
|
|
25
25
|
});
|
|
@@ -69,7 +69,7 @@ export function discoverSkillAssets(skillFilePath, options = {}) {
|
|
|
69
69
|
assetFiles.push({
|
|
70
70
|
sourcePath: fullPath,
|
|
71
71
|
destPath: path.join(scriptsDir, file),
|
|
72
|
-
type: 'script'
|
|
72
|
+
type: 'script',
|
|
73
73
|
});
|
|
74
74
|
}
|
|
75
75
|
else if (isWidgetFile(file)) {
|
|
@@ -78,7 +78,7 @@ export function discoverSkillAssets(skillFilePath, options = {}) {
|
|
|
78
78
|
widgets.push(widgetName);
|
|
79
79
|
widgetMetadata.push({
|
|
80
80
|
name: widgetName,
|
|
81
|
-
path: fullPath
|
|
81
|
+
path: fullPath,
|
|
82
82
|
});
|
|
83
83
|
// Note: We don't add widget .tsx files to assetFiles
|
|
84
84
|
// Widgets are compiled by the plugin if widgetConfig is provided
|
|
@@ -88,7 +88,7 @@ export function discoverSkillAssets(skillFilePath, options = {}) {
|
|
|
88
88
|
scripts,
|
|
89
89
|
widgets,
|
|
90
90
|
widgetMetadata,
|
|
91
|
-
assetFiles
|
|
91
|
+
assetFiles,
|
|
92
92
|
};
|
|
93
93
|
}
|
|
94
94
|
//# sourceMappingURL=asset-discovery.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"asset-discovery.js","sourceRoot":"","sources":["../../../src/core/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,CAAC,IAAI,EAAE,EAAE;YACxC,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;AACH,SAAS,YAAY,CAAC,QAAgB;IAClC,OAAO,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AACvC,CAAC;AAED;;GAEG;AACH,SAAS,YAAY,CAAC,QAAgB;IAClC,OAAO,QAAQ,CA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AChB,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 @@
|
|
|
1
|
+
{"version":3,"file":"template-asset-discovery.d.ts","sourceRoot":"","sources":["../../../src/core/utils/template-asset-discovery.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACrC,kDAAkD;IAClD,SAAS,EAAE,MAAM,EAAE,CAAC;IAEpB,+BAA+B;IAC/B,UAAU,EAAE,SAAS,EAAE,CAAC;CAC3B;AAYD;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CAAC,gBAAgB,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,wBAAwB,CAgC/G"}
|
|
@@ -7,13 +7,9 @@ import path from 'node:path';
|
|
|
7
7
|
* Files to exclude from template asset discovery
|
|
8
8
|
* (source files and the template definition itself)
|
|
9
9
|
*/
|
|
10
|
-
const EXCLUDED_PATTERNS = [
|
|
11
|
-
/^TEMPLATE\.md$/,
|
|
12
|
-
/\.ts$/,
|
|
13
|
-
/\.js$/,
|
|
14
|
-
];
|
|
10
|
+
const EXCLUDED_PATTERNS = [/^TEMPLATE\.md$/, /\.ts$/, /\.js$/];
|
|
15
11
|
function isExcluded(fileName) {
|
|
16
|
-
return EXCLUDED_PATTERNS.some(p => p.test(fileName));
|
|
12
|
+
return EXCLUDED_PATTERNS.some((p) => p.test(fileName));
|
|
17
13
|
}
|
|
18
14
|
/**
|
|
19
15
|
* Discover asset files in a template directory.
|
|
@@ -29,7 +25,7 @@ export function discoverTemplateAssets(templateFilePath, templatePath) {
|
|
|
29
25
|
const assetFiles = [];
|
|
30
26
|
let files;
|
|
31
27
|
try {
|
|
32
|
-
files = readdirSync(templateDir).filter(file => {
|
|
28
|
+
files = readdirSync(templateDir).filter((file) => {
|
|
33
29
|
try {
|
|
34
30
|
return statSync(path.join(templateDir, file)).isFile();
|
|
35
31
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"template-asset-discovery.js","sourceRoot":"","sources":["../../../src/core/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,CAAC,gBAAgB,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;AAE/D,SAAS,UAAU,CAAC,QAAgB;IAChC,OAAO,iBAAiB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;AAC3D,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,sBAAsB,CAAC,gBAAwB,EAAE,YAAoB;IACjF,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,CAAC,IAAI,EAAE,EAAE;YAC7C,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,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI-friendly name registry for the built-in transformers.
|
|
3
|
+
*
|
|
4
|
+
* Names mirror the query-suffix convention used in source code:
|
|
5
|
+
* `?skill` → 'skill'
|
|
6
|
+
* `?skills` → 'skills' (collection)
|
|
7
|
+
* `?template`→ 'template'
|
|
8
|
+
* `?templates`→ 'templates' (collection)
|
|
9
|
+
* `?prompt` → 'prompt'
|
|
10
|
+
* `?raw` → 'raw'
|
|
11
|
+
*/
|
|
12
|
+
import type { TransformerRule } from '../core/types.js';
|
|
13
|
+
export declare const BUILTIN_TRANSFORMERS: Readonly<Record<string, TransformerRule>>;
|
|
14
|
+
/** Names of all registered transformers, in stable order. */
|
|
15
|
+
export declare const BUILTIN_TRANSFORMER_NAMES: readonly string[];
|
|
16
|
+
/**
|
|
17
|
+
* Resolve a list of transformer names to their concrete `TransformerRule`
|
|
18
|
+
* instances. Throws if any name is unknown.
|
|
19
|
+
*/
|
|
20
|
+
export declare function resolveTransformerNames(names: readonly string[]): TransformerRule[];
|
|
21
|
+
//# sourceMappingURL=builtins.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builtins.d.ts","sourceRoot":"","sources":["../../src/import-transform/builtins.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAQH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAExD,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAOzE,CAAC;AAEH,6DAA6D;AAC7D,eAAO,MAAM,yBAAyB,EAAE,SAAS,MAAM,EAAqD,CAAC;AAE7G;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,eAAe,EAAE,CAmBnF"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI-friendly name registry for the built-in transformers.
|
|
3
|
+
*
|
|
4
|
+
* Names mirror the query-suffix convention used in source code:
|
|
5
|
+
* `?skill` → 'skill'
|
|
6
|
+
* `?skills` → 'skills' (collection)
|
|
7
|
+
* `?template`→ 'template'
|
|
8
|
+
* `?templates`→ 'templates' (collection)
|
|
9
|
+
* `?prompt` → 'prompt'
|
|
10
|
+
* `?raw` → 'raw'
|
|
11
|
+
*/
|
|
12
|
+
import { promptTransformer } from '../core/transformers/prompt.js';
|
|
13
|
+
import { rawTransformer } from '../core/transformers/raw.js';
|
|
14
|
+
import { skillTransformer } from '../core/transformers/skill.js';
|
|
15
|
+
import { skillCollectionTransformer } from '../core/transformers/skill-collection.js';
|
|
16
|
+
import { templateTransformer } from '../core/transformers/template.js';
|
|
17
|
+
import { templateCollectionTransformer } from '../core/transformers/template-collection.js';
|
|
18
|
+
export const BUILTIN_TRANSFORMERS = Object.freeze({
|
|
19
|
+
skill: skillTransformer,
|
|
20
|
+
skills: skillCollectionTransformer,
|
|
21
|
+
template: templateTransformer,
|
|
22
|
+
templates: templateCollectionTransformer,
|
|
23
|
+
prompt: promptTransformer,
|
|
24
|
+
raw: rawTransformer,
|
|
25
|
+
});
|
|
26
|
+
/** Names of all registered transformers, in stable order. */
|
|
27
|
+
export const BUILTIN_TRANSFORMER_NAMES = Object.freeze(Object.keys(BUILTIN_TRANSFORMERS));
|
|
28
|
+
/**
|
|
29
|
+
* Resolve a list of transformer names to their concrete `TransformerRule`
|
|
30
|
+
* instances. Throws if any name is unknown.
|
|
31
|
+
*/
|
|
32
|
+
export function resolveTransformerNames(names) {
|
|
33
|
+
const resolved = [];
|
|
34
|
+
const unknown = [];
|
|
35
|
+
for (const name of names) {
|
|
36
|
+
const rule = BUILTIN_TRANSFORMERS[name];
|
|
37
|
+
if (rule) {
|
|
38
|
+
resolved.push(rule);
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
unknown.push(name);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
if (unknown.length > 0) {
|
|
45
|
+
const known = BUILTIN_TRANSFORMER_NAMES.join(', ');
|
|
46
|
+
throw new Error(`Unknown transformer name(s): ${unknown.join(', ')}. Known transformers: ${known}.`);
|
|
47
|
+
}
|
|
48
|
+
return resolved;
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=builtins.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builtins.js","sourceRoot":"","sources":["../../src/import-transform/builtins.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,0BAA0B,EAAE,MAAM,0CAA0C,CAAC;AACtF,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AACvE,OAAO,EAAE,6BAA6B,EAAE,MAAM,6CAA6C,CAAC;AAG5F,MAAM,CAAC,MAAM,oBAAoB,GAA8C,MAAM,CAAC,MAAM,CAAC;IACzF,KAAK,EAAE,gBAAgB;IACvB,MAAM,EAAE,0BAA0B;IAClC,QAAQ,EAAE,mBAAmB;IAC7B,SAAS,EAAE,6BAA6B;IACxC,MAAM,EAAE,iBAAiB;IACzB,GAAG,EAAE,cAAc;CACtB,CAAC,CAAC;AAEH,6DAA6D;AAC7D,MAAM,CAAC,MAAM,yBAAyB,GAAsB,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC,CAAC;AAE7G;;;GAGG;AACH,MAAM,UAAU,uBAAuB,CAAC,KAAwB;IAC5D,MAAM,QAAQ,GAAsB,EAAE,CAAC;IACvC,MAAM,OAAO,GAAa,EAAE,CAAC;IAE7B,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACvB,MAAM,IAAI,GAAG,oBAAoB,CAAC,IAAI,CAAC,CAAC;QACxC,IAAI,IAAI,EAAE,CAAC;YACP,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACxB,CAAC;aAAM,CAAC;YACJ,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACvB,CAAC;IACL,CAAC;IAED,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACrB,MAAM,KAAK,GAAG,yBAAyB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACnD,MAAM,IAAI,KAAK,CAAC,gCAAgC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,yBAAyB,KAAK,GAAG,CAAC,CAAC;IACzG,CAAC;IAED,OAAO,QAAQ,CAAC;AACpB,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runs a transformer against a source file and writes the resulting module
|
|
3
|
+
* as a standalone `.js` chunk inside the lib output.
|
|
4
|
+
*
|
|
5
|
+
* The generated module mirrors the historical code produced by the legacy
|
|
6
|
+
* rollup `load()` hook — it supports `imports`, `code`, and default
|
|
7
|
+
* `export default <data>` payloads — so the runtime behavior of
|
|
8
|
+
* import-transformed builds matches the legacy rollup-based pipeline
|
|
9
|
+
* byte-for-byte.
|
|
10
|
+
*/
|
|
11
|
+
import type { AssetFile, TransformerRule } from '../core/types.js';
|
|
12
|
+
import type { WidgetMetadata } from '../core/utils/asset-discovery.js';
|
|
13
|
+
export interface EmittedChunk {
|
|
14
|
+
/** Absolute path of the written chunk. */
|
|
15
|
+
chunkPath: string;
|
|
16
|
+
/** Generated module source (the same bytes written to `chunkPath`). */
|
|
17
|
+
content: string;
|
|
18
|
+
/** Assets returned by the transformer that should be copied. */
|
|
19
|
+
assets: AssetFile[];
|
|
20
|
+
/** Widget entries returned by the transformer that should be bundled. */
|
|
21
|
+
widgets: WidgetMetadata[];
|
|
22
|
+
}
|
|
23
|
+
export declare function emitChunk(srcPath: string, chunkPath: string, transformer: TransformerRule): Promise<EmittedChunk>;
|
|
24
|
+
//# sourceMappingURL=chunk-emitter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chunk-emitter.d.ts","sourceRoot":"","sources":["../../src/import-transform/chunk-emitter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAEvE,MAAM,WAAW,YAAY;IACzB,0CAA0C;IAC1C,SAAS,EAAE,MAAM,CAAC;IAElB,uEAAuE;IACvE,OAAO,EAAE,MAAM,CAAC;IAEhB,gEAAgE;IAChE,MAAM,EAAE,SAAS,EAAE,CAAC;IAEpB,yEAAyE;IACzE,OAAO,EAAE,cAAc,EAAE,CAAC;CAC7B;AAED,wBAAsB,SAAS,CAC3B,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,eAAe,GAC7B,OAAO,CAAC,YAAY,CAAC,CAyBvB"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runs a transformer against a source file and writes the resulting module
|
|
3
|
+
* as a standalone `.js` chunk inside the lib output.
|
|
4
|
+
*
|
|
5
|
+
* The generated module mirrors the historical code produced by the legacy
|
|
6
|
+
* rollup `load()` hook — it supports `imports`, `code`, and default
|
|
7
|
+
* `export default <data>` payloads — so the runtime behavior of
|
|
8
|
+
* import-transformed builds matches the legacy rollup-based pipeline
|
|
9
|
+
* byte-for-byte.
|
|
10
|
+
*/
|
|
11
|
+
import { mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
12
|
+
import path from 'node:path';
|
|
13
|
+
export async function emitChunk(srcPath, chunkPath, transformer) {
|
|
14
|
+
const content = transformer.virtual ? '' : readFileSync(srcPath, 'utf-8');
|
|
15
|
+
const result = await transformer.transform(content, srcPath);
|
|
16
|
+
if (transformer.schema) {
|
|
17
|
+
const validation = transformer.schema.safeParse(result.data);
|
|
18
|
+
if (!validation.success) {
|
|
19
|
+
const errors = validation.error.issues.map((err) => ` - ${err.path.join('.')}: ${err.message}`).join('\n');
|
|
20
|
+
throw new Error(`Validation failed for ${srcPath}:\n${errors}`);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
const importsBlock = result.imports && result.imports.length > 0 ? `${result.imports.join('\n')}\n\n` : '';
|
|
24
|
+
const body = result.code ?? `export default ${JSON.stringify(result.data, null, 2)};`;
|
|
25
|
+
const moduleCode = importsBlock + body;
|
|
26
|
+
mkdirSync(path.dirname(chunkPath), { recursive: true });
|
|
27
|
+
writeFileSync(chunkPath, moduleCode, 'utf-8');
|
|
28
|
+
return {
|
|
29
|
+
chunkPath,
|
|
30
|
+
content: moduleCode,
|
|
31
|
+
assets: result.assets ?? [],
|
|
32
|
+
widgets: result.widgets ?? [],
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=chunk-emitter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chunk-emitter.js","sourceRoot":"","sources":["../../src/import-transform/chunk-emitter.ts"],"names":[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I,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC;IACtF,MAAM,UAAU,GAAG,YAAY,GAAG,IAAI,CAAC;IAEvC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACxD,aAAa,CAAC,SAAS,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;IAE9C,OAAO;QACH,SAAS;QACT,OAAO,EAAE,UAAU;QACnB,MAAM,EAAE,MAAM,CAAC,MAAM,IAAI,EAAE;QAC3B,OAAO,EAAE,MAAM,CAAC,OAAO,IAAI,EAAE;KAChC,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Finds Vertesia query-style import specifiers inside a JavaScript source
|
|
3
|
+
* file and maps each one to the transformer that should handle it.
|
|
4
|
+
*
|
|
5
|
+
* The detector is regex-based and works on `tsc` output where import
|
|
6
|
+
* specifiers are preserved literally. It identifies any string literal that
|
|
7
|
+
* contains a known marker (`?skill`, `?raw`, …, or `/SKILL.md`) and then
|
|
8
|
+
* matches the specifier against the configured transformer patterns.
|
|
9
|
+
*/
|
|
10
|
+
import type { TransformerRule } from '../core/types.js';
|
|
11
|
+
export interface ImportOccurrence {
|
|
12
|
+
/** The transformer whose pattern matched the specifier. */
|
|
13
|
+
transformer: TransformerRule;
|
|
14
|
+
/** The original specifier text (the value between the quotes). */
|
|
15
|
+
specifier: string;
|
|
16
|
+
/** Offset in the source where the opening quote begins. */
|
|
17
|
+
quoteStart: number;
|
|
18
|
+
/** Offset in the source where the closing quote ends (exclusive). */
|
|
19
|
+
quoteEnd: number;
|
|
20
|
+
/** The quote character used in the source. */
|
|
21
|
+
quote: "'" | '"' | '`';
|
|
22
|
+
}
|
|
23
|
+
export declare function detectQueryImports(content: string, transformers: TransformerRule[]): ImportOccurrence[];
|
|
24
|
+
//# sourceMappingURL=detector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"detector.d.ts","sourceRoot":"","sources":["../../src/import-transform/detector.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAGxD,MAAM,WAAW,gBAAgB;IAC7B,2DAA2D;IAC3D,WAAW,EAAE,eAAe,CAAC;IAE7B,kEAAkE;IAClE,SAAS,EAAE,MAAM,CAAC;IAElB,2DAA2D;IAC3D,UAAU,EAAE,MAAM,CAAC;IAEnB,qEAAqE;IACrE,QAAQ,EAAE,MAAM,CAAC;IAEjB,8CAA8C;IAC9C,KAAK,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;CAC1B;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,eAAe,EAAE,GAAG,gBAAgB,EAAE,CAyBvG"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Finds Vertesia query-style import specifiers inside a JavaScript source
|
|
3
|
+
* file and maps each one to the transformer that should handle it.
|
|
4
|
+
*
|
|
5
|
+
* The detector is regex-based and works on `tsc` output where import
|
|
6
|
+
* specifiers are preserved literally. It identifies any string literal that
|
|
7
|
+
* contains a known marker (`?skill`, `?raw`, …, or `/SKILL.md`) and then
|
|
8
|
+
* matches the specifier against the configured transformer patterns.
|
|
9
|
+
*/
|
|
10
|
+
import { QUERY_STRING_LITERAL } from './patterns.js';
|
|
11
|
+
export function detectQueryImports(content, transformers) {
|
|
12
|
+
const occurrences = [];
|
|
13
|
+
QUERY_STRING_LITERAL.lastIndex = 0;
|
|
14
|
+
let match;
|
|
15
|
+
// biome-ignore lint/suspicious/noAssignInExpressions: standard regex.exec loop
|
|
16
|
+
while ((match = QUERY_STRING_LITERAL.exec(content)) !== null) {
|
|
17
|
+
const quote = match[1];
|
|
18
|
+
const specifier = match[2];
|
|
19
|
+
for (const transformer of transformers) {
|
|
20
|
+
if (transformer.pattern.test(specifier)) {
|
|
21
|
+
occurrences.push({
|
|
22
|
+
transformer,
|
|
23
|
+
specifier,
|
|
24
|
+
quoteStart: match.index,
|
|
25
|
+
quoteEnd: match.index + match[0].length,
|
|
26
|
+
quote,
|
|
27
|
+
});
|
|
28
|
+
break;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return occurrences;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=detector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"detector.js","sourceRoot":"","sources":["../../src/import-transform/detector.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAmBrD,MAAM,UAAU,kBAAkB,CAAC,OAAe,EAAE,YAA+B;IAC/E,MAAM,WAAW,GAAuB,EAAE,CAAC;IAC3C,oBAAoB,CAAC,SAAS,GAAG,CAAC,CAAC;IAEnC,IAAI,KAA6B,CAAC;IAClC,+EAA+E;IAC/E,OAAO,CAAC,KAAK,GAAG,oBAAoB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;QAC3D,MAAM,KAAK,GAAG,KAAK,CAAC,CAAC,CAAoB,CAAC;QAC1C,MAAM,SAAS,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QAE3B,KAAK,MAAM,WAAW,IAAI,YAAY,EAAE,CAAC;YACrC,IAAI,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC;gBACtC,WAAW,CAAC,IAAI,CAAC;oBACb,WAAW;oBACX,SAAS;oBACT,UAAU,EAAE,KAAK,CAAC,KAAK;oBACvB,QAAQ,EAAE,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM;oBACvC,KAAK;iBACR,CAAC,CAAC;gBACH,MAAM;YACV,CAAC;QACL,CAAC;IACL,CAAC;IAED,OAAO,WAAW,CAAC;AACvB,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Standalone import transformer for Vertesia query-style imports.
|
|
3
|
+
*
|
|
4
|
+
* Operates directly on the JavaScript output of `tsc`:
|
|
5
|
+
*
|
|
6
|
+
* 1. Walk `libDir` for `.js` files containing query imports.
|
|
7
|
+
* 2. For each occurrence, resolve back to the corresponding source asset
|
|
8
|
+
* under `srcDir`, run the transformer, and write the generated module
|
|
9
|
+
* as a sibling chunk in `libDir`.
|
|
10
|
+
* 3. Rewrite the importing file in place so the original `?skill` /
|
|
11
|
+
* `SKILL.md` specifier points at the new chunk.
|
|
12
|
+
* 4. Copy any transformer-declared assets (scripts, handlebars, …) and
|
|
13
|
+
* bundle any discovered widget `.tsx` siblings via esbuild.
|
|
14
|
+
*
|
|
15
|
+
* Emitted chunks are re-scanned for nested query imports (e.g. a `?skills`
|
|
16
|
+
* collection chunk that imports `SKILL.md` siblings), so the pipeline
|
|
17
|
+
* matches rollup's recursive resolveId/load behavior.
|
|
18
|
+
*/
|
|
19
|
+
import { type WidgetCompilerConfig } from '../core/compilers/widget.js';
|
|
20
|
+
import type { TransformerRule } from '../core/types.js';
|
|
21
|
+
export interface TransformImportsOptions {
|
|
22
|
+
/** Root of the compiled JavaScript output (e.g. `./lib`). */
|
|
23
|
+
libDir: string;
|
|
24
|
+
/** Root of the original sources, mirroring `libDir` (e.g. `./src`). */
|
|
25
|
+
srcDir: string;
|
|
26
|
+
/** Transformers to apply. */
|
|
27
|
+
transformers: TransformerRule[];
|
|
28
|
+
/**
|
|
29
|
+
* Root directory where script assets are copied and widgets are written.
|
|
30
|
+
* - String: assets and widgets are emitted under this directory.
|
|
31
|
+
* - `false`: asset copying and widget compilation are skipped.
|
|
32
|
+
* - Default: `libDir` (so widgets land in `lib/<widgetsDir>/`).
|
|
33
|
+
*/
|
|
34
|
+
assetsDir?: string | false;
|
|
35
|
+
/** Sub-directory under `assetsDir` for widget bundles. Default: 'widgets'. */
|
|
36
|
+
widgetsDir?: string;
|
|
37
|
+
/** Configuration forwarded to the esbuild widget bundler. */
|
|
38
|
+
widgetConfig?: WidgetCompilerConfig;
|
|
39
|
+
}
|
|
40
|
+
export interface TransformImportsResult {
|
|
41
|
+
filesProcessed: number;
|
|
42
|
+
chunksEmitted: number;
|
|
43
|
+
assetsCopied: number;
|
|
44
|
+
widgetsCompiled: number;
|
|
45
|
+
}
|
|
46
|
+
export declare function transformImports(opts: TransformImportsOptions): Promise<TransformImportsResult>;
|
|
47
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/import-transform/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAGH,OAAO,EAAkB,KAAK,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACxF,OAAO,KAAK,EAAa,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAUnE,MAAM,WAAW,uBAAuB;IACpC,6DAA6D;IAC7D,MAAM,EAAE,MAAM,CAAC;IAEf,uEAAuE;IACvE,MAAM,EAAE,MAAM,CAAC;IAEf,6BAA6B;IAC7B,YAAY,EAAE,eAAe,EAAE,CAAC;IAEhC;;;;;OAKG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;IAE3B,8EAA8E;IAC9E,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,6DAA6D;IAC7D,YAAY,CAAC,EAAE,oBAAoB,CAAC;CACvC;AAED,MAAM,WAAW,sBAAsB;IACnC,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;CAC3B;AAOD,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,uBAAuB,GAAG,OAAO,CAAC,sBAAsB,CAAC,CA2FrG"}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Standalone import transformer for Vertesia query-style imports.
|
|
3
|
+
*
|
|
4
|
+
* Operates directly on the JavaScript output of `tsc`:
|
|
5
|
+
*
|
|
6
|
+
* 1. Walk `libDir` for `.js` files containing query imports.
|
|
7
|
+
* 2. For each occurrence, resolve back to the corresponding source asset
|
|
8
|
+
* under `srcDir`, run the transformer, and write the generated module
|
|
9
|
+
* as a sibling chunk in `libDir`.
|
|
10
|
+
* 3. Rewrite the importing file in place so the original `?skill` /
|
|
11
|
+
* `SKILL.md` specifier points at the new chunk.
|
|
12
|
+
* 4. Copy any transformer-declared assets (scripts, handlebars, …) and
|
|
13
|
+
* bundle any discovered widget `.tsx` siblings via esbuild.
|
|
14
|
+
*
|
|
15
|
+
* Emitted chunks are re-scanned for nested query imports (e.g. a `?skills`
|
|
16
|
+
* collection chunk that imports `SKILL.md` siblings), so the pipeline
|
|
17
|
+
* matches rollup's recursive resolveId/load behavior.
|
|
18
|
+
*/
|
|
19
|
+
import path from 'node:path';
|
|
20
|
+
import { compileWidgets } from '../core/compilers/widget.js';
|
|
21
|
+
import { copyAssets } from '../core/utils/asset-copy.js';
|
|
22
|
+
import { emitChunk } from './chunk-emitter.js';
|
|
23
|
+
import { detectQueryImports } from './detector.js';
|
|
24
|
+
import { SNIFF_PATTERN } from './patterns.js';
|
|
25
|
+
import { resolveImport } from './resolver.js';
|
|
26
|
+
import { writeRewrittenFile } from './rewriter.js';
|
|
27
|
+
import { scanLibForQueryImports } from './scanner.js';
|
|
28
|
+
export async function transformImports(opts) {
|
|
29
|
+
const { libDir, srcDir, transformers, widgetsDir = 'widgets', widgetConfig } = opts;
|
|
30
|
+
const assetsDir = opts.assetsDir === undefined ? libDir : opts.assetsDir;
|
|
31
|
+
const shouldCopyAssets = assetsDir !== false;
|
|
32
|
+
const shouldCompileWidgets = assetsDir !== false;
|
|
33
|
+
if (!transformers || transformers.length === 0) {
|
|
34
|
+
throw new Error('transformImports: At least one transformer must be configured');
|
|
35
|
+
}
|
|
36
|
+
const seenFiles = new Set();
|
|
37
|
+
const workQueue = [];
|
|
38
|
+
for (const file of scanLibForQueryImports(libDir)) {
|
|
39
|
+
if (!seenFiles.has(file.path)) {
|
|
40
|
+
seenFiles.add(file.path);
|
|
41
|
+
workQueue.push(file);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
const emittedChunks = new Set();
|
|
45
|
+
const seenWidgets = new Map();
|
|
46
|
+
const assetsToCopy = [];
|
|
47
|
+
let chunksEmitted = 0;
|
|
48
|
+
let filesProcessed = 0;
|
|
49
|
+
while (workQueue.length > 0) {
|
|
50
|
+
const file = workQueue.shift();
|
|
51
|
+
const occurrences = detectQueryImports(file.content, transformers);
|
|
52
|
+
if (occurrences.length === 0) {
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
const replacements = [];
|
|
56
|
+
for (const occ of occurrences) {
|
|
57
|
+
const resolved = resolveImport(file.path, occ.specifier, libDir, srcDir);
|
|
58
|
+
if (!emittedChunks.has(resolved.chunkLibPath)) {
|
|
59
|
+
const emitted = await emitChunk(resolved.resolvedSrcPath, resolved.chunkLibPath, occ.transformer);
|
|
60
|
+
emittedChunks.add(resolved.chunkLibPath);
|
|
61
|
+
chunksEmitted++;
|
|
62
|
+
if (emitted.assets.length > 0 && shouldCopyAssets) {
|
|
63
|
+
assetsToCopy.push(...emitted.assets);
|
|
64
|
+
}
|
|
65
|
+
if (emitted.widgets.length > 0 && shouldCompileWidgets) {
|
|
66
|
+
for (const widget of emitted.widgets) {
|
|
67
|
+
if (!seenWidgets.has(widget.path)) {
|
|
68
|
+
seenWidgets.set(widget.path, widget);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
// Chunks may themselves contain query imports (e.g. ?skills
|
|
73
|
+
// collection chunks emit `import './foo/SKILL.md'` lines).
|
|
74
|
+
if (SNIFF_PATTERN.test(emitted.content) && !seenFiles.has(resolved.chunkLibPath)) {
|
|
75
|
+
seenFiles.add(resolved.chunkLibPath);
|
|
76
|
+
workQueue.push({ path: resolved.chunkLibPath, content: emitted.content });
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
replacements.push({
|
|
80
|
+
quoteStart: occ.quoteStart,
|
|
81
|
+
quoteEnd: occ.quoteEnd,
|
|
82
|
+
quote: occ.quote,
|
|
83
|
+
newSpecifier: resolved.chunkSpecifier,
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
if (writeRewrittenFile(file.path, file.content, replacements)) {
|
|
87
|
+
filesProcessed++;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
let assetsCopied = 0;
|
|
91
|
+
if (shouldCopyAssets && assetsToCopy.length > 0) {
|
|
92
|
+
assetsCopied = copyAssets(assetsToCopy, assetsDir);
|
|
93
|
+
}
|
|
94
|
+
let widgetsCompiled = 0;
|
|
95
|
+
if (shouldCompileWidgets && seenWidgets.size > 0) {
|
|
96
|
+
const widgetInputs = Array.from(seenWidgets.values()).map((widget) => ({
|
|
97
|
+
name: widget.name,
|
|
98
|
+
entry: mapSrcWidgetToLib(widget.path, srcDir, libDir),
|
|
99
|
+
}));
|
|
100
|
+
const widgetOutput = path.join(assetsDir, widgetsDir);
|
|
101
|
+
widgetsCompiled = await compileWidgets(widgetInputs, widgetOutput, widgetConfig);
|
|
102
|
+
}
|
|
103
|
+
return { filesProcessed, chunksEmitted, assetsCopied, widgetsCompiled };
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Map a widget `.tsx` source path to its tsc-compiled `.js` counterpart in lib/.
|
|
107
|
+
*/
|
|
108
|
+
function mapSrcWidgetToLib(srcTsxPath, srcDir, libDir) {
|
|
109
|
+
const srcRoot = path.resolve(srcDir);
|
|
110
|
+
const libRoot = path.resolve(libDir);
|
|
111
|
+
const rel = path.relative(srcRoot, srcTsxPath);
|
|
112
|
+
const libRel = rel.replace(/\.tsx$/, '.js');
|
|
113
|
+
return path.join(libRoot,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AAO,EAAE,MAAM,CAAC,CAAC;AACtC,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared regex fragments used by the scanner, detector, and orchestrator to
|
|
3
|
+
* identify Vertesia query-style imports. Keep these in sync with the
|
|
4
|
+
* `pattern` field of each transformer in `core/transformers/`.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Suffix tokens for `?xxx` query imports.
|
|
8
|
+
*/
|
|
9
|
+
export declare const QUERY_SUFFIXES: readonly ["skill", "raw", "prompt", "template", "skills", "templates"];
|
|
10
|
+
/**
|
|
11
|
+
* Bare filename tokens that mark an import as a transform target without a
|
|
12
|
+
* `?query` suffix (e.g. `import skill from './my-skill/SKILL.md'`).
|
|
13
|
+
*/
|
|
14
|
+
export declare const BARE_FILENAMES: readonly ["SKILL.md", "TEMPLATE.md"];
|
|
15
|
+
/**
|
|
16
|
+
* Coarse sniff for whether a file body could contain any query-style imports.
|
|
17
|
+
* Cheap regex check before invoking the more expensive detector.
|
|
18
|
+
*/
|
|
19
|
+
export declare const SNIFF_PATTERN: RegExp;
|
|
20
|
+
/**
|
|
21
|
+
* Matches a quoted string literal whose contents end with a query marker.
|
|
22
|
+
* Capture group 1 is the quote character; capture group 2 is the specifier.
|
|
23
|
+
*/
|
|
24
|
+
export declare const QUERY_STRING_LITERAL: RegExp;
|
|
25
|
+
//# sourceMappingURL=patterns.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"patterns.d.ts","sourceRoot":"","sources":["../../src/import-transform/patterns.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,eAAO,MAAM,cAAc,wEAAyE,CAAC;AAErG;;;GAGG;AACH,eAAO,MAAM,cAAc,sCAAuC,CAAC;AAKnE;;;GAGG;AACH,eAAO,MAAM,aAAa,QAA8D,CAAC;AAEzF;;;GAGG;AACH,eAAO,MAAM,oBAAoB,QAGhC,CAAC"}
|