@frontmcp/uipack 0.12.1 → 1.0.0-beta.1

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.
Files changed (298) hide show
  1. package/CLAUDE.md +56 -154
  2. package/README.md +367 -62
  3. package/adapters/base-template.d.ts +30 -0
  4. package/adapters/base-template.d.ts.map +1 -0
  5. package/adapters/cdn-info.d.ts +34 -0
  6. package/adapters/cdn-info.d.ts.map +1 -0
  7. package/adapters/constants.d.ts +18 -0
  8. package/adapters/constants.d.ts.map +1 -0
  9. package/adapters/content-detector.d.ts +19 -0
  10. package/adapters/content-detector.d.ts.map +1 -0
  11. package/adapters/content-renderers.d.ts +27 -0
  12. package/adapters/content-renderers.d.ts.map +1 -0
  13. package/adapters/index.d.ts +14 -7
  14. package/adapters/index.d.ts.map +1 -1
  15. package/adapters/index.js +2343 -426
  16. package/adapters/render-failure.d.ts +18 -0
  17. package/adapters/render-failure.d.ts.map +1 -0
  18. package/adapters/response-builder.d.ts +34 -104
  19. package/adapters/response-builder.d.ts.map +1 -1
  20. package/adapters/serving-mode.d.ts +28 -91
  21. package/adapters/serving-mode.d.ts.map +1 -1
  22. package/adapters/template-renderer.d.ts +50 -0
  23. package/adapters/template-renderer.d.ts.map +1 -0
  24. package/adapters/type-detector.d.ts +18 -0
  25. package/adapters/type-detector.d.ts.map +1 -0
  26. package/bridge-runtime/index.js +1 -1
  27. package/component/index.d.ts +14 -0
  28. package/component/index.d.ts.map +1 -0
  29. package/component/index.js +2043 -0
  30. package/component/loader.d.ts +36 -0
  31. package/component/loader.d.ts.map +1 -0
  32. package/component/renderer.d.ts +30 -0
  33. package/component/renderer.d.ts.map +1 -0
  34. package/component/transpiler.d.ts +49 -0
  35. package/component/transpiler.d.ts.map +1 -0
  36. package/component/types.d.ts +82 -0
  37. package/component/types.d.ts.map +1 -0
  38. package/esm/adapters/index.mjs +2337 -422
  39. package/esm/bridge-runtime/index.mjs +1 -1
  40. package/esm/component/index.mjs +2013 -0
  41. package/esm/index.mjs +3446 -13935
  42. package/esm/package.json +3 -12
  43. package/esm/resolver/index.mjs +661 -0
  44. package/esm/shell/index.mjs +1406 -0
  45. package/esm/types/index.mjs +11 -11
  46. package/esm/utils/index.mjs +53 -8
  47. package/index.d.ts +12 -40
  48. package/index.d.ts.map +1 -1
  49. package/index.js +3579 -14218
  50. package/package.json +3 -12
  51. package/resolver/cdn-registry.d.ts +39 -0
  52. package/resolver/cdn-registry.d.ts.map +1 -0
  53. package/resolver/esm-sh.resolver.d.ts +54 -0
  54. package/resolver/esm-sh.resolver.d.ts.map +1 -0
  55. package/resolver/import-map.d.ts +47 -0
  56. package/resolver/import-map.d.ts.map +1 -0
  57. package/resolver/import-parser.d.ts +28 -0
  58. package/resolver/import-parser.d.ts.map +1 -0
  59. package/resolver/import-rewriter.d.ts +29 -0
  60. package/resolver/import-rewriter.d.ts.map +1 -0
  61. package/resolver/index.d.ts +15 -0
  62. package/resolver/index.d.ts.map +1 -0
  63. package/resolver/index.js +708 -0
  64. package/resolver/types.d.ts +191 -0
  65. package/resolver/types.d.ts.map +1 -0
  66. package/shell/builder.d.ts +31 -0
  67. package/shell/builder.d.ts.map +1 -0
  68. package/shell/csp.d.ts +37 -0
  69. package/shell/csp.d.ts.map +1 -0
  70. package/shell/custom-shell-applier.d.ts +33 -0
  71. package/shell/custom-shell-applier.d.ts.map +1 -0
  72. package/shell/custom-shell-resolver.d.ts +47 -0
  73. package/shell/custom-shell-resolver.d.ts.map +1 -0
  74. package/shell/custom-shell-types.d.ts +75 -0
  75. package/shell/custom-shell-types.d.ts.map +1 -0
  76. package/shell/custom-shell-validator.d.ts +26 -0
  77. package/shell/custom-shell-validator.d.ts.map +1 -0
  78. package/shell/data-injector.d.ts +40 -0
  79. package/shell/data-injector.d.ts.map +1 -0
  80. package/shell/index.d.ts +19 -0
  81. package/shell/index.d.ts.map +1 -0
  82. package/shell/index.js +1453 -0
  83. package/shell/types.d.ts +54 -0
  84. package/shell/types.d.ts.map +1 -0
  85. package/types/index.d.ts +1 -3
  86. package/types/index.d.ts.map +1 -1
  87. package/types/index.js +11 -11
  88. package/types/ui-config.d.ts +50 -11
  89. package/types/ui-config.d.ts.map +1 -1
  90. package/types/ui-runtime.d.ts +8 -82
  91. package/types/ui-runtime.d.ts.map +1 -1
  92. package/utils/index.d.ts +9 -3
  93. package/utils/index.d.ts.map +1 -1
  94. package/utils/index.js +59 -7
  95. package/adapters/platform-meta.constants.d.ts +0 -26
  96. package/adapters/platform-meta.constants.d.ts.map +0 -1
  97. package/adapters/platform-meta.d.ts +0 -234
  98. package/adapters/platform-meta.d.ts.map +0 -1
  99. package/base-template/bridge.d.ts +0 -90
  100. package/base-template/bridge.d.ts.map +0 -1
  101. package/base-template/default-base-template.d.ts +0 -91
  102. package/base-template/default-base-template.d.ts.map +0 -1
  103. package/base-template/index.d.ts +0 -15
  104. package/base-template/index.d.ts.map +0 -1
  105. package/base-template/index.js +0 -1393
  106. package/base-template/polyfills.d.ts +0 -31
  107. package/base-template/polyfills.d.ts.map +0 -1
  108. package/base-template/theme-styles.d.ts +0 -74
  109. package/base-template/theme-styles.d.ts.map +0 -1
  110. package/build/builders/base-builder.d.ts +0 -124
  111. package/build/builders/base-builder.d.ts.map +0 -1
  112. package/build/builders/esbuild-config.d.ts +0 -94
  113. package/build/builders/esbuild-config.d.ts.map +0 -1
  114. package/build/builders/hybrid-builder.d.ts +0 -93
  115. package/build/builders/hybrid-builder.d.ts.map +0 -1
  116. package/build/builders/index.d.ts +0 -17
  117. package/build/builders/index.d.ts.map +0 -1
  118. package/build/builders/inline-builder.d.ts +0 -83
  119. package/build/builders/inline-builder.d.ts.map +0 -1
  120. package/build/builders/static-builder.d.ts +0 -78
  121. package/build/builders/static-builder.d.ts.map +0 -1
  122. package/build/builders/types.d.ts +0 -341
  123. package/build/builders/types.d.ts.map +0 -1
  124. package/build/cdn-resources.d.ts +0 -244
  125. package/build/cdn-resources.d.ts.map +0 -1
  126. package/build/hybrid-data.d.ts +0 -127
  127. package/build/hybrid-data.d.ts.map +0 -1
  128. package/build/index.d.ts +0 -299
  129. package/build/index.d.ts.map +0 -1
  130. package/build/index.js +0 -8699
  131. package/build/ui-components-browser.d.ts +0 -64
  132. package/build/ui-components-browser.d.ts.map +0 -1
  133. package/build/widget-manifest.d.ts +0 -362
  134. package/build/widget-manifest.d.ts.map +0 -1
  135. package/bundler/cache.d.ts +0 -173
  136. package/bundler/cache.d.ts.map +0 -1
  137. package/bundler/file-cache/component-builder.d.ts +0 -167
  138. package/bundler/file-cache/component-builder.d.ts.map +0 -1
  139. package/bundler/file-cache/hash-calculator.d.ts +0 -155
  140. package/bundler/file-cache/hash-calculator.d.ts.map +0 -1
  141. package/bundler/file-cache/index.d.ts +0 -12
  142. package/bundler/file-cache/index.d.ts.map +0 -1
  143. package/bundler/file-cache/storage/filesystem.d.ts +0 -149
  144. package/bundler/file-cache/storage/filesystem.d.ts.map +0 -1
  145. package/bundler/file-cache/storage/index.d.ts +0 -11
  146. package/bundler/file-cache/storage/index.d.ts.map +0 -1
  147. package/bundler/file-cache/storage/interface.d.ts +0 -152
  148. package/bundler/file-cache/storage/interface.d.ts.map +0 -1
  149. package/bundler/file-cache/storage/redis.d.ts +0 -139
  150. package/bundler/file-cache/storage/redis.d.ts.map +0 -1
  151. package/bundler/index.d.ts +0 -35
  152. package/bundler/index.d.ts.map +0 -1
  153. package/bundler/index.js +0 -2953
  154. package/bundler/sandbox/enclave-adapter.d.ts +0 -121
  155. package/bundler/sandbox/enclave-adapter.d.ts.map +0 -1
  156. package/bundler/sandbox/executor.d.ts +0 -14
  157. package/bundler/sandbox/executor.d.ts.map +0 -1
  158. package/bundler/sandbox/policy.d.ts +0 -62
  159. package/bundler/sandbox/policy.d.ts.map +0 -1
  160. package/bundler/types.d.ts +0 -702
  161. package/bundler/types.d.ts.map +0 -1
  162. package/dependency/cdn-registry.d.ts +0 -98
  163. package/dependency/cdn-registry.d.ts.map +0 -1
  164. package/dependency/import-map.d.ts +0 -186
  165. package/dependency/import-map.d.ts.map +0 -1
  166. package/dependency/import-parser.d.ts +0 -82
  167. package/dependency/import-parser.d.ts.map +0 -1
  168. package/dependency/index.d.ts +0 -17
  169. package/dependency/index.d.ts.map +0 -1
  170. package/dependency/index.js +0 -3180
  171. package/dependency/resolver.d.ts +0 -164
  172. package/dependency/resolver.d.ts.map +0 -1
  173. package/dependency/schemas.d.ts +0 -486
  174. package/dependency/schemas.d.ts.map +0 -1
  175. package/dependency/template-loader.d.ts +0 -204
  176. package/dependency/template-loader.d.ts.map +0 -1
  177. package/dependency/template-processor.d.ts +0 -118
  178. package/dependency/template-processor.d.ts.map +0 -1
  179. package/dependency/types.d.ts +0 -739
  180. package/dependency/types.d.ts.map +0 -1
  181. package/esm/base-template/index.mjs +0 -1359
  182. package/esm/build/index.mjs +0 -8601
  183. package/esm/bundler/index.mjs +0 -2895
  184. package/esm/dependency/index.mjs +0 -3068
  185. package/esm/handlebars/index.mjs +0 -587
  186. package/esm/registry/index.mjs +0 -6305
  187. package/esm/renderers/index.mjs +0 -1557
  188. package/esm/runtime/index.mjs +0 -5361
  189. package/esm/styles/index.mjs +0 -171
  190. package/esm/theme/index.mjs +0 -756
  191. package/esm/tool-template/index.mjs +0 -3652
  192. package/esm/validation/index.mjs +0 -542
  193. package/handlebars/expression-extractor.d.ts +0 -147
  194. package/handlebars/expression-extractor.d.ts.map +0 -1
  195. package/handlebars/helpers.d.ts +0 -339
  196. package/handlebars/helpers.d.ts.map +0 -1
  197. package/handlebars/index.d.ts +0 -195
  198. package/handlebars/index.d.ts.map +0 -1
  199. package/handlebars/index.js +0 -659
  200. package/preview/claude-preview.d.ts +0 -67
  201. package/preview/claude-preview.d.ts.map +0 -1
  202. package/preview/generic-preview.d.ts +0 -66
  203. package/preview/generic-preview.d.ts.map +0 -1
  204. package/preview/index.d.ts +0 -36
  205. package/preview/index.d.ts.map +0 -1
  206. package/preview/openai-preview.d.ts +0 -70
  207. package/preview/openai-preview.d.ts.map +0 -1
  208. package/preview/types.d.ts +0 -199
  209. package/preview/types.d.ts.map +0 -1
  210. package/registry/index.d.ts +0 -46
  211. package/registry/index.d.ts.map +0 -1
  212. package/registry/index.js +0 -6342
  213. package/registry/render-template.d.ts +0 -91
  214. package/registry/render-template.d.ts.map +0 -1
  215. package/registry/tool-ui.registry.d.ts +0 -294
  216. package/registry/tool-ui.registry.d.ts.map +0 -1
  217. package/registry/uri-utils.d.ts +0 -56
  218. package/registry/uri-utils.d.ts.map +0 -1
  219. package/renderers/cache.d.ts +0 -145
  220. package/renderers/cache.d.ts.map +0 -1
  221. package/renderers/html.renderer.d.ts +0 -123
  222. package/renderers/html.renderer.d.ts.map +0 -1
  223. package/renderers/index.d.ts +0 -36
  224. package/renderers/index.d.ts.map +0 -1
  225. package/renderers/index.js +0 -1603
  226. package/renderers/mdx-client.renderer.d.ts +0 -124
  227. package/renderers/mdx-client.renderer.d.ts.map +0 -1
  228. package/renderers/registry.d.ts +0 -133
  229. package/renderers/registry.d.ts.map +0 -1
  230. package/renderers/types.d.ts +0 -343
  231. package/renderers/types.d.ts.map +0 -1
  232. package/renderers/utils/detect.d.ts +0 -107
  233. package/renderers/utils/detect.d.ts.map +0 -1
  234. package/renderers/utils/hash.d.ts +0 -40
  235. package/renderers/utils/hash.d.ts.map +0 -1
  236. package/renderers/utils/index.d.ts +0 -9
  237. package/renderers/utils/index.d.ts.map +0 -1
  238. package/renderers/utils/transpiler.d.ts +0 -70
  239. package/renderers/utils/transpiler.d.ts.map +0 -1
  240. package/runtime/adapters/html.adapter.d.ts +0 -59
  241. package/runtime/adapters/html.adapter.d.ts.map +0 -1
  242. package/runtime/adapters/index.d.ts +0 -26
  243. package/runtime/adapters/index.d.ts.map +0 -1
  244. package/runtime/adapters/mdx.adapter.d.ts +0 -73
  245. package/runtime/adapters/mdx.adapter.d.ts.map +0 -1
  246. package/runtime/adapters/types.d.ts +0 -95
  247. package/runtime/adapters/types.d.ts.map +0 -1
  248. package/runtime/csp.d.ts +0 -48
  249. package/runtime/csp.d.ts.map +0 -1
  250. package/runtime/index.d.ts +0 -17
  251. package/runtime/index.d.ts.map +0 -1
  252. package/runtime/index.js +0 -5432
  253. package/runtime/mcp-bridge.d.ts +0 -101
  254. package/runtime/mcp-bridge.d.ts.map +0 -1
  255. package/runtime/renderer-runtime.d.ts +0 -133
  256. package/runtime/renderer-runtime.d.ts.map +0 -1
  257. package/runtime/sanitizer.d.ts +0 -180
  258. package/runtime/sanitizer.d.ts.map +0 -1
  259. package/runtime/types.d.ts +0 -415
  260. package/runtime/types.d.ts.map +0 -1
  261. package/runtime/wrapper.d.ts +0 -421
  262. package/runtime/wrapper.d.ts.map +0 -1
  263. package/styles/index.d.ts +0 -8
  264. package/styles/index.d.ts.map +0 -1
  265. package/styles/index.js +0 -222
  266. package/styles/variants.d.ts +0 -51
  267. package/styles/variants.d.ts.map +0 -1
  268. package/theme/cdn.d.ts +0 -195
  269. package/theme/cdn.d.ts.map +0 -1
  270. package/theme/css-to-theme.d.ts +0 -64
  271. package/theme/css-to-theme.d.ts.map +0 -1
  272. package/theme/index.d.ts +0 -19
  273. package/theme/index.d.ts.map +0 -1
  274. package/theme/index.js +0 -814
  275. package/theme/platforms.d.ts +0 -102
  276. package/theme/platforms.d.ts.map +0 -1
  277. package/theme/presets/github-openai.d.ts +0 -50
  278. package/theme/presets/github-openai.d.ts.map +0 -1
  279. package/theme/presets/index.d.ts +0 -11
  280. package/theme/presets/index.d.ts.map +0 -1
  281. package/theme/theme.d.ts +0 -396
  282. package/theme/theme.d.ts.map +0 -1
  283. package/tool-template/builder.d.ts +0 -213
  284. package/tool-template/builder.d.ts.map +0 -1
  285. package/tool-template/index.d.ts +0 -16
  286. package/tool-template/index.d.ts.map +0 -1
  287. package/tool-template/index.js +0 -3690
  288. package/validation/error-box.d.ts +0 -56
  289. package/validation/error-box.d.ts.map +0 -1
  290. package/validation/index.d.ts +0 -13
  291. package/validation/index.d.ts.map +0 -1
  292. package/validation/index.js +0 -576
  293. package/validation/schema-paths.d.ts +0 -118
  294. package/validation/schema-paths.d.ts.map +0 -1
  295. package/validation/template-validator.d.ts +0 -143
  296. package/validation/template-validator.d.ts.map +0 -1
  297. package/validation/wrapper.d.ts +0 -97
  298. package/validation/wrapper.d.ts.map +0 -1
@@ -0,0 +1,191 @@
1
+ /**
2
+ * Pluggable Import Resolver Types
3
+ *
4
+ * Defines the interface for resolving bare import specifiers to URLs
5
+ * or other loadable expressions. Users can implement custom resolvers
6
+ * or use the built-in esm.sh resolver.
7
+ *
8
+ * @packageDocumentation
9
+ */
10
+ /**
11
+ * Context provided to the resolver for platform/version-aware resolution.
12
+ */
13
+ export interface ResolveContext {
14
+ /** Target platform (affects CDN selection) */
15
+ platform?: string;
16
+ /** Requested package version */
17
+ version?: string;
18
+ }
19
+ /**
20
+ * Result of resolving an import specifier.
21
+ */
22
+ export interface ResolvedImport {
23
+ /** The resolved URL or expression */
24
+ value: string;
25
+ /** How to load: 'url' = ESM import URL, 'global' = window.X, 'function' = resolver fn call */
26
+ type: 'url' | 'global' | 'function';
27
+ /** Optional integrity hash (SRI) */
28
+ integrity?: string;
29
+ }
30
+ /**
31
+ * Pluggable import resolver interface.
32
+ *
33
+ * Implement this to control how bare import specifiers are resolved.
34
+ * The default implementation uses esm.sh CDN.
35
+ *
36
+ * @example
37
+ * ```typescript
38
+ * const myResolver: ImportResolver = {
39
+ * resolve(specifier) {
40
+ * if (specifier === 'react') {
41
+ * return { value: 'https://cdn.example.com/react.js', type: 'url' };
42
+ * }
43
+ * return null; // fall through to default
44
+ * }
45
+ * };
46
+ * ```
47
+ */
48
+ export interface ImportResolver {
49
+ /** Resolve a bare import specifier to a URL or expression. Return null to skip. */
50
+ resolve(specifier: string, context?: ResolveContext): ResolvedImport | null;
51
+ }
52
+ /**
53
+ * Options for configuring import resolution behavior.
54
+ */
55
+ export interface ResolverOptions {
56
+ /** Custom resolver (overrides default esm.sh) */
57
+ resolver?: ImportResolver;
58
+ /** Packages to skip (keep as bare imports) */
59
+ skipPackages?: string[];
60
+ /** Per-package URL overrides */
61
+ overrides?: Record<string, string>;
62
+ }
63
+ /**
64
+ * Supported CDN providers for external library hosting.
65
+ */
66
+ export type CDNProvider = 'cloudflare' | 'jsdelivr' | 'unpkg' | 'esm.sh' | 'skypack' | 'custom';
67
+ /**
68
+ * Configuration for a single CDN dependency.
69
+ */
70
+ export interface CDNDependency {
71
+ /** CDN URL for the library (MUST be HTTPS) */
72
+ url: string;
73
+ /** Subresource Integrity hash */
74
+ integrity?: string;
75
+ /** Global variable name (for UMD builds) */
76
+ global?: string;
77
+ /** Named exports */
78
+ exports?: string[];
79
+ /** Whether this is an ES module */
80
+ esm?: boolean;
81
+ /** Cross-origin attribute */
82
+ crossorigin?: 'anonymous' | 'use-credentials';
83
+ /** Peer dependencies (npm package names) */
84
+ peerDependencies?: string[];
85
+ }
86
+ /**
87
+ * CDN configuration per provider for a package.
88
+ */
89
+ export type CDNProviderConfig = Partial<Record<CDNProvider, CDNDependency>>;
90
+ /**
91
+ * Entry in the CDN registry for a known package.
92
+ */
93
+ export interface CDNRegistryEntry {
94
+ /** NPM package name */
95
+ packageName: string;
96
+ /** Default/recommended version */
97
+ defaultVersion: string;
98
+ /** CDN configurations per provider */
99
+ providers: CDNProviderConfig;
100
+ /** Preferred CDN provider order */
101
+ preferredProviders?: CDNProvider[];
102
+ /** Package metadata */
103
+ metadata?: {
104
+ description?: string;
105
+ homepage?: string;
106
+ license?: string;
107
+ };
108
+ }
109
+ /**
110
+ * Full CDN registry mapping package names to their CDN configurations.
111
+ */
112
+ export type CDNRegistry = Record<string, CDNRegistryEntry>;
113
+ /**
114
+ * Browser import map structure.
115
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script/type/importmap
116
+ */
117
+ export interface ImportMap {
118
+ /** Module specifier to URL mappings */
119
+ imports: Record<string, string>;
120
+ /** Scoped mappings for specific paths */
121
+ scopes?: Record<string, Record<string, string>>;
122
+ /** Integrity hashes for imported modules */
123
+ integrity?: Record<string, string>;
124
+ }
125
+ /**
126
+ * Entry for a resolved dependency.
127
+ */
128
+ export interface ResolvedDependency {
129
+ /** NPM package name */
130
+ packageName: string;
131
+ /** Resolved version string */
132
+ version: string;
133
+ /** CDN URL for the package */
134
+ cdnUrl: string;
135
+ /** SRI integrity hash */
136
+ integrity?: string;
137
+ /** Global variable name (for UMD) */
138
+ global?: string;
139
+ /** Whether this is an ES module */
140
+ esm: boolean;
141
+ /** CDN provider used */
142
+ provider: CDNProvider;
143
+ }
144
+ /**
145
+ * A parsed import statement from source code.
146
+ */
147
+ export interface ParsedImport {
148
+ /** Full import statement as it appears in source */
149
+ statement: string;
150
+ /** Module specifier (package name or path) */
151
+ specifier: string;
152
+ /** Import type */
153
+ type: 'named' | 'default' | 'namespace' | 'side-effect' | 'dynamic';
154
+ /** Named imports */
155
+ namedImports?: string[];
156
+ /** Default import name */
157
+ defaultImport?: string;
158
+ /** Namespace import name */
159
+ namespaceImport?: string;
160
+ /** Line number in source (1-indexed) */
161
+ line: number;
162
+ /** Column number in source (0-indexed) */
163
+ column: number;
164
+ }
165
+ /**
166
+ * Result of parsing imports from a source file.
167
+ */
168
+ export interface ParsedImportResult {
169
+ /** All parsed imports */
170
+ imports: ParsedImport[];
171
+ /** External package imports (npm packages) */
172
+ externalImports: ParsedImport[];
173
+ /** Relative imports (local files) */
174
+ relativeImports: ParsedImport[];
175
+ /** Unique external package names */
176
+ externalPackages: string[];
177
+ }
178
+ /**
179
+ * Result of rewriting imports.
180
+ */
181
+ export interface RewriteImportsResult {
182
+ /** Rewritten source code */
183
+ code: string;
184
+ /** Number of imports rewritten */
185
+ rewrittenCount: number;
186
+ /** Map of original specifiers to resolved URLs */
187
+ rewrites: Map<string, string>;
188
+ /** Packages that used fallback resolution */
189
+ fallbackPackages: string[];
190
+ }
191
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/resolver/types.ts"],"names":[],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AAqC;IACrC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,mCAAmC;IACnC,GAAG,EAAE,OAAO,CAAC;IACb,wBAAwB;IACxB,QAAQ,EAAE,WAAW,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,oDAAoD;IACpD,SAAS,EAAE,MAAM,CAAC;IAClB,8CAA8C;IAC9C,SAAS,EAAE,MAAM,CAAC;IAClB,kBAAkB;IAClB,IAAI,EAAE,OAAO,GAAG,SAAS,GAAG,WAAW,GAAG,aAAa,GAAG,SAAS,CAAC;IACpE,oBAAoB;IACpB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,0BAA0B;IAC1B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,4BAA4B;IAC5B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,wCAAwC;IACxC,IAAI,EAAE,MAAM,CAAC;IACb,0CAA0C;IAC1C,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,yBAAyB;IACzB,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB,8CAA8C;IAC9C,eAAe,EAAE,YAAY,EAAE,CAAC;IAChC,qCAAqC;IACrC,eAAe,EAAE,YAAY,EAAE,CAAC;IAChC,oCAAoC;IACpC,gBAAgB,EAAE,MAAM,EAAE,CAAC;CAC5B;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,4BAA4B;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,kCAAkC;IAClC,cAAc,EAAE,MAAM,CAAC;IACvB,kDAAkD;IAClD,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9B,6CAA6C;IAC7C,gBAAgB,EAAE,MAAM,EAAE,CAAC;CAC5B"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Shell Builder
3
+ *
4
+ * Generates HTML documents (shells) that wrap UI widget content
5
+ * with CSP, data injection, and optional bridge runtime.
6
+ *
7
+ * @packageDocumentation
8
+ */
9
+ import type { ShellConfig, ShellResult } from './types';
10
+ /**
11
+ * Build an HTML shell wrapping the provided content.
12
+ *
13
+ * When `withShell: false`, returns just the content with data injection prepended.
14
+ * When `withShell: true` (default), returns a full HTML document.
15
+ *
16
+ * @example
17
+ * ```typescript
18
+ * const result = buildShell('<div id="root">Hello</div>', {
19
+ * toolName: 'my_tool',
20
+ * output: { message: 'Hello World' },
21
+ * });
22
+ *
23
+ * // result.html is a complete HTML document with:
24
+ * // - CSP meta tag
25
+ * // - Data injection script
26
+ * // - Bridge runtime
27
+ * // - The content in <body>
28
+ * ```
29
+ */
30
+ export declare function buildShell(content: string, config: ShellConfig): ShellResult;
31
+ //# sourceMappingURL=builder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"builder.d.ts","sourceRoot":"","sources":["../../src/shell/builder.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAQxD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,GAAG,WAAW,CAkE5E"}
package/shell/csp.d.ts ADDED
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Content Security Policy Builder
3
+ *
4
+ * Generates CSP meta tags for sandboxed UI templates.
5
+ *
6
+ * @packageDocumentation
7
+ */
8
+ import type { CSPConfig } from './types';
9
+ /**
10
+ * Default CDN domains used by FrontMCP UI templates.
11
+ */
12
+ export declare const DEFAULT_CDN_DOMAINS: readonly ["https://cdn.jsdelivr.net", "https://cdnjs.cloudflare.com", "https://fonts.googleapis.com", "https://fonts.gstatic.com", "https://esm.sh"];
13
+ /**
14
+ * Default CSP when no custom policy is provided.
15
+ */
16
+ export declare const DEFAULT_CSP_DIRECTIVES: readonly ["default-src 'none'", `script-src 'self' 'unsafe-inline' ${string}`, `style-src 'self' 'unsafe-inline' ${string}`, `img-src 'self' data: ${string}`, `font-src 'self' data: ${string}`, `connect-src ${string}`, "object-src 'self' data:"];
17
+ /**
18
+ * Restrictive CSP for sandboxed environments with no external resources.
19
+ */
20
+ export declare const RESTRICTIVE_CSP_DIRECTIVES: readonly ["default-src 'none'", "script-src 'self' 'unsafe-inline'", "style-src 'self' 'unsafe-inline'", "img-src 'self' data:", "font-src 'self' data:", "connect-src 'none'", "object-src 'self' data:"];
21
+ /**
22
+ * Build CSP directives from a CSPConfig configuration.
23
+ */
24
+ export declare function buildCSPDirectives(csp?: CSPConfig): string[];
25
+ /**
26
+ * Build a CSP meta tag from config.
27
+ */
28
+ export declare function buildCSPMetaTag(csp?: CSPConfig): string;
29
+ /**
30
+ * Validate CSP domain format.
31
+ */
32
+ export declare function validateCSPDomain(domain: string): boolean;
33
+ /**
34
+ * Filter and warn about invalid CSP domains.
35
+ */
36
+ export declare function sanitizeCSPDomains(domains: string[] | undefined): string[];
37
+ //# sourceMappingURL=csp.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"csp.d.ts","sourceRoot":"","sources":["../../src/shell/csp.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEzC;;GAEG;AACH,eAAO,MAAM,mBAAmB,sJAMtB,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,sBAAsB,uPAQzB,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,0BAA0B,4MAQ7B,CAAC;AAEX;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,CAAC,EAAE,SAAS,GAAG,MAAM,EAAE,CA+B5D;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,GAAG,CAAC,EAAE,SAAS,GAAG,MAAM,CAIvD;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAYzD;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,SAAS,GAAG,MAAM,EAAE,CAa1E"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Custom Shell Template Applier
3
+ *
4
+ * Replaces placeholder tokens in a custom shell template with
5
+ * the generated fragment values (CSP, data script, bridge, content, title).
6
+ *
7
+ * Uses sequential `replaceAll` — injected content is NOT re-scanned,
8
+ * so `{{CSP}}` inside user content is safe.
9
+ *
10
+ * @packageDocumentation
11
+ */
12
+ import type { ShellPlaceholderValues } from './custom-shell-types';
13
+ /**
14
+ * Apply placeholder values to a custom shell template.
15
+ *
16
+ * Each `{{PLACEHOLDER}}` token is replaced with the corresponding value.
17
+ * Replacement is single-pass per token — values injected for one placeholder
18
+ * are not re-scanned for other placeholders.
19
+ *
20
+ * @param template - The shell template with `{{PLACEHOLDER}}` tokens
21
+ * @param values - The values to inject for each placeholder
22
+ * @returns The final HTML string with all placeholders replaced
23
+ *
24
+ * @example
25
+ * ```typescript
26
+ * const html = applyShellTemplate(
27
+ * '<html><head>{{CSP}}{{DATA}}</head><body>{{CONTENT}}</body></html>',
28
+ * { csp: '<meta ...>', data: '<script>...</script>', bridge: '', content: '<div>Hi</div>', title: 'My Tool' },
29
+ * );
30
+ * ```
31
+ */
32
+ export declare function applyShellTemplate(template: string, values: ShellPlaceholderValues): string;
33
+ //# sourceMappingURL=custom-shell-applier.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"custom-shell-applier.d.ts","sourceRoot":"","sources":["../../src/shell/custom-shell-applier.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAEnE;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,sBAAsB,GAAG,MAAM,CAU3F"}
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Custom Shell Template Resolver
3
+ *
4
+ * Resolves custom shell template sources (inline, URL, npm) to
5
+ * validated `ResolvedShellTemplate` objects. URL and npm sources
6
+ * are cached in-memory to avoid redundant fetches.
7
+ *
8
+ * @packageDocumentation
9
+ */
10
+ import type { CustomShellSource, ResolvedShellTemplate } from './custom-shell-types';
11
+ import type { ImportResolver } from '../resolver/types';
12
+ /** Options for resolving shell templates */
13
+ export interface ResolveShellOptions {
14
+ /** Custom import resolver (for npm sources) */
15
+ resolver?: ImportResolver;
16
+ /** Skip cache lookup and storage */
17
+ noCache?: boolean;
18
+ }
19
+ /**
20
+ * Resolve a custom shell source to a validated template.
21
+ *
22
+ * - **Inline:** validates immediately and returns
23
+ * - **URL:** fetches with timeout, validates, caches by URL
24
+ * - **NPM:** resolves specifier via ImportResolver → CDN URL, fetches, extracts template string, validates, caches
25
+ *
26
+ * @throws {Error} If the template is missing required placeholders
27
+ * @throws {Error} If the URL fetch fails or times out
28
+ * @throws {Error} If npm resolution fails or template extraction fails
29
+ *
30
+ * @example
31
+ * ```typescript
32
+ * // Inline
33
+ * const resolved = await resolveShellTemplate({ inline: '<html>{{CONTENT}}</html>' });
34
+ *
35
+ * // URL
36
+ * const resolved = await resolveShellTemplate({ url: 'https://example.com/shell.html' });
37
+ *
38
+ * // NPM
39
+ * const resolved = await resolveShellTemplate({ npm: 'my-shell-package' });
40
+ * ```
41
+ */
42
+ export declare function resolveShellTemplate(source: CustomShellSource, options?: ResolveShellOptions): Promise<ResolvedShellTemplate>;
43
+ /**
44
+ * Clear the in-memory shell template cache.
45
+ */
46
+ export declare function clearShellTemplateCache(): void;
47
+ //# sourceMappingURL=custom-shell-resolver.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"custom-shell-resolver.d.ts","sourceRoot":"","sources":["../../src/shell/custom-shell-resolver.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,qBAAqB,EAAkB,MAAM,sBAAsB,CAAC;AAGrG,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAQxD,4CAA4C;AAC5C,MAAM,WAAW,mBAAmB;IAClC,+CAA+C;IAC/C,QAAQ,CAAC,EAAE,cAAc,CAAC;IAC1B,oCAAoC;IACpC,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,iBAAiB,EACzB,OAAO,CAAC,EAAE,mBAAmB,GAC5B,OAAO,CAAC,qBAAqB,CAAC,CA2ChC;AAED;;GAEG;AACH,wBAAgB,uBAAuB,IAAI,IAAI,CAE9C"}
@@ -0,0 +1,75 @@
1
+ /**
2
+ * Custom Shell Template Types
3
+ *
4
+ * Types, constants, and type guards for custom HTML shell templates
5
+ * with placeholder-based injection.
6
+ *
7
+ * @packageDocumentation
8
+ */
9
+ /** All supported placeholder names */
10
+ export declare const SHELL_PLACEHOLDER_NAMES: readonly ["CSP", "DATA", "BRIDGE", "CONTENT", "TITLE"];
11
+ /** Placeholder name type */
12
+ export type ShellPlaceholderName = (typeof SHELL_PLACEHOLDER_NAMES)[number];
13
+ /** Placeholder tokens as they appear in templates (e.g., `{{CSP}}`) */
14
+ export declare const SHELL_PLACEHOLDERS: Record<ShellPlaceholderName, string>;
15
+ /** Placeholders that MUST be present in a custom shell template */
16
+ export declare const REQUIRED_PLACEHOLDERS: readonly ShellPlaceholderName[];
17
+ /** Placeholders that are optional (omitted silently if absent) */
18
+ export declare const OPTIONAL_PLACEHOLDERS: readonly ShellPlaceholderName[];
19
+ /** Mode 1: Inline HTML string */
20
+ export interface InlineShellSource {
21
+ inline: string;
22
+ }
23
+ /** Mode 2: Fetch from URL */
24
+ export interface UrlShellSource {
25
+ url: string;
26
+ /** Fetch timeout in milliseconds (default: 10000) */
27
+ timeout?: number;
28
+ }
29
+ /** Mode 3: Load from npm package */
30
+ export interface NpmShellSource {
31
+ npm: string;
32
+ /** Named export to use (default: 'default') */
33
+ exportName?: string;
34
+ /** Package version */
35
+ version?: string;
36
+ }
37
+ /** Union of all custom shell source types */
38
+ export type CustomShellSource = InlineShellSource | UrlShellSource | NpmShellSource;
39
+ export declare function isInlineShellSource(source: CustomShellSource): source is InlineShellSource;
40
+ export declare function isUrlShellSource(source: CustomShellSource): source is UrlShellSource;
41
+ export declare function isNpmShellSource(source: CustomShellSource): source is NpmShellSource;
42
+ /** Result of validating a shell template for placeholder presence */
43
+ export interface ShellTemplateValidation {
44
+ /** Whether all required placeholders are present */
45
+ valid: boolean;
46
+ /** Map of placeholder name → whether it was found in the template */
47
+ found: Record<ShellPlaceholderName, boolean>;
48
+ /** Required placeholders that are missing */
49
+ missingRequired: ShellPlaceholderName[];
50
+ /** Optional placeholders that are missing */
51
+ missingOptional: ShellPlaceholderName[];
52
+ }
53
+ /** A resolved and validated shell template ready for use */
54
+ export interface ResolvedShellTemplate {
55
+ /** The raw template string with placeholders */
56
+ template: string;
57
+ /** How the template was sourced */
58
+ sourceType: 'inline' | 'url' | 'npm';
59
+ /** Validation result */
60
+ validation: ShellTemplateValidation;
61
+ }
62
+ /** Values to inject into shell template placeholders */
63
+ export interface ShellPlaceholderValues {
64
+ /** CSP meta tag HTML */
65
+ csp: string;
66
+ /** Data injection script HTML */
67
+ data: string;
68
+ /** Bridge runtime script HTML */
69
+ bridge: string;
70
+ /** Widget content HTML */
71
+ content: string;
72
+ /** Page title */
73
+ title: string;
74
+ }
75
+ //# sourceMappingURL=custom-shell-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"custom-shell-types.d.ts","sourceRoot":"","sources":["../../src/shell/custom-shell-types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAMH,sCAAsC;AACtC,eAAO,MAAM,uBAAuB,wDAAyD,CAAC;AAE9F,4BAA4B;AAC5B,MAAM,MAAM,oBAAoB,GAAG,CAAC,OAAO,uBAAuB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE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DAA4D;AAC5D,MAAM,WAAW,qBAAqB;IACpC,gDAAgD;IAChD,QAAQ,EAAE,MAAM,CAAC;IACjB,mCAAmC;IACnC,UAAU,EAAE,QAAQ,GAAG,KAAK,GAAG,KAAK,CAAC;IACrC,wBAAwB;IACxB,UAAU,EAAE,uBAAuB,CAAC;CACrC;AAMD,wDAAwD;AACxD,MAAM,WAAW,sBAAsB;IACrC,wBAAwB;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,iCAAiC;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,iCAAiC;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,0BAA0B;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,iBAAiB;IACjB,KAAK,EAAE,MAAM,CAAC;CACf"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Custom Shell Template Validator
3
+ *
4
+ * Validates that a shell template contains the required placeholders
5
+ * and reports which optional placeholders are missing.
6
+ *
7
+ * @packageDocumentation
8
+ */
9
+ import type { ShellTemplateValidation } from './custom-shell-types';
10
+ /**
11
+ * Validate a shell template string for placeholder presence.
12
+ *
13
+ * Scans for all known placeholders (`{{CSP}}`, `{{DATA}}`, `{{BRIDGE}}`,
14
+ * `{{CONTENT}}`, `{{TITLE}}`) and reports which are found/missing.
15
+ *
16
+ * @returns Validation result with `valid: true` only if all required placeholders are present
17
+ *
18
+ * @example
19
+ * ```typescript
20
+ * const v = validateShellTemplate('<html>{{CSP}}{{CONTENT}}</html>');
21
+ * // v.valid === true (CONTENT is present)
22
+ * // v.missingOptional === ['DATA', 'BRIDGE', 'TITLE']
23
+ * ```
24
+ */
25
+ export declare function validateShellTemplate(template: string): ShellTemplateValidation;
26
+ //# sourceMappingURL=custom-shell-validator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"custom-shell-validator.d.ts","sourceRoot":"","sources":["../../src/shell/custom-shell-validator.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAQH,OAAO,KAAK,EAAwB,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAE1F;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,GAAG,uBAAuB,CAgB/E"}
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Data Injector
3
+ *
4
+ * Injects tool data (input, output, metadata) into HTML as window globals.
5
+ * Provides template helper functions for safe HTML rendering.
6
+ *
7
+ * @packageDocumentation
8
+ */
9
+ /**
10
+ * Generate a script tag that injects tool data as window globals.
11
+ *
12
+ * Sets `window.__mcpToolName`, `window.__mcpToolInput`,
13
+ * `window.__mcpToolOutput`, and `window.__mcpStructuredContent`.
14
+ */
15
+ export declare function buildDataInjectionScript(options: {
16
+ toolName: string;
17
+ input?: unknown;
18
+ output?: unknown;
19
+ structuredContent?: unknown;
20
+ }): string;
21
+ /**
22
+ * Template helper functions for safe rendering.
23
+ */
24
+ export interface TemplateHelpers {
25
+ /** Escape HTML special characters to prevent XSS */
26
+ escapeHtml: (str: unknown) => string;
27
+ /** Format a date for display */
28
+ formatDate: (date: Date | string, format?: string) => string;
29
+ /** Format a number as currency */
30
+ formatCurrency: (amount: number, currency?: string) => string;
31
+ /** Generate a unique ID for DOM elements */
32
+ uniqueId: (prefix?: string) => string;
33
+ /** Safely embed JSON data in HTML */
34
+ jsonEmbed: (data: unknown) => string;
35
+ }
36
+ /**
37
+ * Create template helper functions.
38
+ */
39
+ export declare function createTemplateHelpers(): TemplateHelpers;
40
+ //# sourceMappingURL=data-injector.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data-injector.d.ts","sourceRoot":"","sources":["../../src/shell/data-injector.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE;IAChD,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B,GAAG,MAAM,CAWT;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,oDAAoD;IACpD,UAAU,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,MAAM,CAAC;IACrC,gCAAgC;IAChC,UAAU,EAAE,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;IAC7D,kCAAkC;IAClC,cAAc,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;IAC9D,4CAA4C;IAC5C,QAAQ,EAAE,CAAC,MAAM,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;IACtC,qCAAqC;IACrC,SAAS,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,MAAM,CAAC;CACtC;AAID;;GAEG;AACH,wBAAgB,qBAAqB,IAAI,eAAe,CA6BvD"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Shell Module
3
+ *
4
+ * HTML shell builder for wrapping UI widget content with
5
+ * CSP, data injection, and bridge runtime.
6
+ *
7
+ * @packageDocumentation
8
+ */
9
+ export type { ShellConfig, ShellResult, CSPConfig } from './types';
10
+ export { buildShell } from './builder';
11
+ export { DEFAULT_CDN_DOMAINS, DEFAULT_CSP_DIRECTIVES, RESTRICTIVE_CSP_DIRECTIVES, buildCSPDirectives, buildCSPMetaTag, validateCSPDomain, sanitizeCSPDomains, } from './csp';
12
+ export { buildDataInjectionScript, createTemplateHelpers, type TemplateHelpers } from './data-injector';
13
+ export type { ShellPlaceholderName, InlineShellSource, UrlShellSource, NpmShellSource, CustomShellSource, ShellTemplateValidation, ResolvedShellTemplate, ShellPlaceholderValues, } from './custom-shell-types';
14
+ export { SHELL_PLACEHOLDER_NAMES, SHELL_PLACEHOLDERS, REQUIRED_PLACEHOLDERS, OPTIONAL_PLACEHOLDERS, isInlineShellSource, isUrlShellSource, isNpmShellSource, } from './custom-shell-types';
15
+ export { validateShellTemplate } from './custom-shell-validator';
16
+ export { applyShellTemplate } from './custom-shell-applier';
17
+ export { resolveShellTemplate, clearShellTemplateCache } from './custom-shell-resolver';
18
+ export type { ResolveShellOptions } from './custom-shell-resolver';
19
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/shell/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAGnE,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAGvC,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EACtB,0BAA0B,EAC1B,kBAAkB,EAClB,eAAe,EACf,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,OAAO,CAAC;AAGf,OAAO,EAAE,wBAAwB,EAAE,qBAAqB,EAAE,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAGxG,YAAY,EACV,oBAAoB,EACpB,iBAAiB,EACjB,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,uBAAuB,EACvB,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,uBAAuB,EACvB,kBAAkB,EAClB,qBAAqB,EACrB,qBAAqB,EACrB,mBAAmB,EACnB,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAGjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAG5D,OAAO,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AACxF,YAAY,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC"}