@frontmcp/ui 0.6.1 → 0.6.2
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/bridge/core/bridge-factory.d.ts +1 -0
- package/bridge/core/bridge-factory.d.ts.map +1 -1
- package/bridge/index.d.ts +1 -1
- package/bridge/index.d.ts.map +1 -1
- package/bridge/index.js +39 -881
- package/bundler/browser-components.d.ts +42 -0
- package/bundler/browser-components.d.ts.map +1 -0
- package/bundler/bundler.d.ts +78 -4
- package/bundler/bundler.d.ts.map +1 -1
- package/bundler/index.d.ts +8 -8
- package/bundler/index.d.ts.map +1 -1
- package/bundler/index.js +1315 -1854
- package/bundler/types.d.ts +188 -7
- package/bundler/types.d.ts.map +1 -1
- package/esm/bridge/{index.js → index.mjs} +40 -877
- package/esm/bundler/{index.js → index.mjs} +1391 -1895
- package/esm/{index.js → index.mjs} +215 -3091
- package/esm/layouts/{index.js → index.mjs} +3 -3
- package/esm/package.json +9 -8
- package/esm/react/index.mjs +1183 -0
- package/esm/renderers/index.mjs +611 -0
- package/esm/universal/{index.js → index.mjs} +266 -70
- package/index.d.ts +1 -4
- package/index.d.ts.map +1 -1
- package/index.js +208 -3113
- package/layouts/base.d.ts.map +1 -1
- package/layouts/index.js +3 -3
- package/layouts/presets.d.ts.map +1 -1
- package/package.json +9 -8
- package/react/Badge.d.ts.map +1 -1
- package/react/hooks/context.d.ts.map +1 -1
- package/react/index.d.ts +0 -1
- package/react/index.d.ts.map +1 -1
- package/react/index.js +57 -2001
- package/react/types.d.ts.map +1 -1
- package/renderers/index.d.ts +9 -4
- package/renderers/index.d.ts.map +1 -1
- package/renderers/index.js +328 -88
- package/renderers/mdx.renderer.d.ts +99 -0
- package/renderers/mdx.renderer.d.ts.map +1 -0
- package/renderers/react.renderer.d.ts +22 -13
- package/renderers/react.renderer.d.ts.map +1 -1
- package/renderers/transpiler.d.ts +49 -0
- package/renderers/transpiler.d.ts.map +1 -0
- package/universal/cached-runtime.d.ts +25 -1
- package/universal/cached-runtime.d.ts.map +1 -1
- package/universal/index.js +266 -70
- package/universal/runtime-builder.d.ts.map +1 -1
- package/universal/types.d.ts.map +1 -1
- package/web-components/elements/fmcp-input.d.ts.map +1 -1
- package/web-components/elements/fmcp-select.d.ts.map +1 -1
- package/web-components/index.d.ts +0 -1
- package/web-components/index.d.ts.map +1 -1
- package/bundler/cache.d.ts +0 -173
- package/bundler/cache.d.ts.map +0 -1
- package/bundler/file-cache/component-builder.d.ts +0 -167
- package/bundler/file-cache/component-builder.d.ts.map +0 -1
- package/bundler/file-cache/hash-calculator.d.ts +0 -155
- package/bundler/file-cache/hash-calculator.d.ts.map +0 -1
- package/bundler/file-cache/index.d.ts +0 -12
- package/bundler/file-cache/index.d.ts.map +0 -1
- package/bundler/file-cache/storage/filesystem.d.ts +0 -149
- package/bundler/file-cache/storage/filesystem.d.ts.map +0 -1
- package/bundler/file-cache/storage/index.d.ts +0 -11
- package/bundler/file-cache/storage/index.d.ts.map +0 -1
- package/bundler/file-cache/storage/interface.d.ts +0 -152
- package/bundler/file-cache/storage/interface.d.ts.map +0 -1
- package/bundler/file-cache/storage/redis.d.ts +0 -139
- package/bundler/file-cache/storage/redis.d.ts.map +0 -1
- package/bundler/sandbox/enclave-adapter.d.ts +0 -121
- package/bundler/sandbox/enclave-adapter.d.ts.map +0 -1
- package/bundler/sandbox/executor.d.ts +0 -14
- package/bundler/sandbox/executor.d.ts.map +0 -1
- package/bundler/sandbox/policy.d.ts +0 -62
- package/bundler/sandbox/policy.d.ts.map +0 -1
- package/esm/bridge/adapters/base-adapter.d.ts +0 -104
- package/esm/bridge/adapters/base-adapter.d.ts.map +0 -1
- package/esm/bridge/adapters/claude.adapter.d.ts +0 -67
- package/esm/bridge/adapters/claude.adapter.d.ts.map +0 -1
- package/esm/bridge/adapters/ext-apps.adapter.d.ts +0 -143
- package/esm/bridge/adapters/ext-apps.adapter.d.ts.map +0 -1
- package/esm/bridge/adapters/gemini.adapter.d.ts +0 -64
- package/esm/bridge/adapters/gemini.adapter.d.ts.map +0 -1
- package/esm/bridge/adapters/generic.adapter.d.ts +0 -56
- package/esm/bridge/adapters/generic.adapter.d.ts.map +0 -1
- package/esm/bridge/adapters/index.d.ts +0 -26
- package/esm/bridge/adapters/index.d.ts.map +0 -1
- package/esm/bridge/adapters/openai.adapter.d.ts +0 -65
- package/esm/bridge/adapters/openai.adapter.d.ts.map +0 -1
- package/esm/bridge/core/adapter-registry.d.ts +0 -122
- package/esm/bridge/core/adapter-registry.d.ts.map +0 -1
- package/esm/bridge/core/bridge-factory.d.ts +0 -199
- package/esm/bridge/core/bridge-factory.d.ts.map +0 -1
- package/esm/bridge/core/index.d.ts +0 -10
- package/esm/bridge/core/index.d.ts.map +0 -1
- package/esm/bridge/index.d.ts +0 -62
- package/esm/bridge/index.d.ts.map +0 -1
- package/esm/bridge/runtime/iife-generator.d.ts +0 -62
- package/esm/bridge/runtime/iife-generator.d.ts.map +0 -1
- package/esm/bridge/runtime/index.d.ts +0 -10
- package/esm/bridge/runtime/index.d.ts.map +0 -1
- package/esm/bridge/types.d.ts +0 -386
- package/esm/bridge/types.d.ts.map +0 -1
- package/esm/bundler/bundler.d.ts +0 -208
- package/esm/bundler/bundler.d.ts.map +0 -1
- package/esm/bundler/cache.d.ts +0 -173
- package/esm/bundler/cache.d.ts.map +0 -1
- package/esm/bundler/file-cache/component-builder.d.ts +0 -167
- package/esm/bundler/file-cache/component-builder.d.ts.map +0 -1
- package/esm/bundler/file-cache/hash-calculator.d.ts +0 -155
- package/esm/bundler/file-cache/hash-calculator.d.ts.map +0 -1
- package/esm/bundler/file-cache/index.d.ts +0 -12
- package/esm/bundler/file-cache/index.d.ts.map +0 -1
- package/esm/bundler/file-cache/storage/filesystem.d.ts +0 -149
- package/esm/bundler/file-cache/storage/filesystem.d.ts.map +0 -1
- package/esm/bundler/file-cache/storage/index.d.ts +0 -11
- package/esm/bundler/file-cache/storage/index.d.ts.map +0 -1
- package/esm/bundler/file-cache/storage/interface.d.ts +0 -152
- package/esm/bundler/file-cache/storage/interface.d.ts.map +0 -1
- package/esm/bundler/file-cache/storage/redis.d.ts +0 -139
- package/esm/bundler/file-cache/storage/redis.d.ts.map +0 -1
- package/esm/bundler/index.d.ts +0 -43
- package/esm/bundler/index.d.ts.map +0 -1
- package/esm/bundler/sandbox/enclave-adapter.d.ts +0 -121
- package/esm/bundler/sandbox/enclave-adapter.d.ts.map +0 -1
- package/esm/bundler/sandbox/executor.d.ts +0 -14
- package/esm/bundler/sandbox/executor.d.ts.map +0 -1
- package/esm/bundler/sandbox/policy.d.ts +0 -62
- package/esm/bundler/sandbox/policy.d.ts.map +0 -1
- package/esm/bundler/types.d.ts +0 -702
- package/esm/bundler/types.d.ts.map +0 -1
- package/esm/components/alert.d.ts +0 -66
- package/esm/components/alert.d.ts.map +0 -1
- package/esm/components/alert.schema.d.ts +0 -98
- package/esm/components/alert.schema.d.ts.map +0 -1
- package/esm/components/avatar.d.ts +0 -77
- package/esm/components/avatar.d.ts.map +0 -1
- package/esm/components/avatar.schema.d.ts +0 -170
- package/esm/components/avatar.schema.d.ts.map +0 -1
- package/esm/components/badge.d.ts +0 -64
- package/esm/components/badge.d.ts.map +0 -1
- package/esm/components/badge.schema.d.ts +0 -91
- package/esm/components/badge.schema.d.ts.map +0 -1
- package/esm/components/button.d.ts +0 -100
- package/esm/components/button.d.ts.map +0 -1
- package/esm/components/button.schema.d.ts +0 -120
- package/esm/components/button.schema.d.ts.map +0 -1
- package/esm/components/card.d.ts +0 -53
- package/esm/components/card.d.ts.map +0 -1
- package/esm/components/card.schema.d.ts +0 -93
- package/esm/components/card.schema.d.ts.map +0 -1
- package/esm/components/form.d.ts +0 -212
- package/esm/components/form.d.ts.map +0 -1
- package/esm/components/form.schema.d.ts +0 -365
- package/esm/components/form.schema.d.ts.map +0 -1
- package/esm/components/index.d.ts +0 -29
- package/esm/components/index.d.ts.map +0 -1
- package/esm/components/list.d.ts +0 -121
- package/esm/components/list.d.ts.map +0 -1
- package/esm/components/list.schema.d.ts +0 -129
- package/esm/components/list.schema.d.ts.map +0 -1
- package/esm/components/modal.d.ts +0 -100
- package/esm/components/modal.d.ts.map +0 -1
- package/esm/components/modal.schema.d.ts +0 -151
- package/esm/components/modal.schema.d.ts.map +0 -1
- package/esm/components/table.d.ts +0 -91
- package/esm/components/table.d.ts.map +0 -1
- package/esm/components/table.schema.d.ts +0 -123
- package/esm/components/table.schema.d.ts.map +0 -1
- package/esm/index.d.ts +0 -40
- package/esm/index.d.ts.map +0 -1
- package/esm/layouts/base.d.ts +0 -86
- package/esm/layouts/base.d.ts.map +0 -1
- package/esm/layouts/index.d.ts +0 -8
- package/esm/layouts/index.d.ts.map +0 -1
- package/esm/layouts/presets.d.ts +0 -134
- package/esm/layouts/presets.d.ts.map +0 -1
- package/esm/pages/consent.d.ts +0 -117
- package/esm/pages/consent.d.ts.map +0 -1
- package/esm/pages/error.d.ts +0 -101
- package/esm/pages/error.d.ts.map +0 -1
- package/esm/pages/index.d.ts +0 -9
- package/esm/pages/index.d.ts.map +0 -1
- package/esm/pages/index.js +0 -1036
- package/esm/react/Alert.d.ts +0 -101
- package/esm/react/Alert.d.ts.map +0 -1
- package/esm/react/Badge.d.ts +0 -100
- package/esm/react/Badge.d.ts.map +0 -1
- package/esm/react/Button.d.ts +0 -108
- package/esm/react/Button.d.ts.map +0 -1
- package/esm/react/Card.d.ts +0 -103
- package/esm/react/Card.d.ts.map +0 -1
- package/esm/react/hooks/context.d.ts +0 -179
- package/esm/react/hooks/context.d.ts.map +0 -1
- package/esm/react/hooks/index.d.ts +0 -42
- package/esm/react/hooks/index.d.ts.map +0 -1
- package/esm/react/hooks/tools.d.ts +0 -284
- package/esm/react/hooks/tools.d.ts.map +0 -1
- package/esm/react/index.d.ts +0 -80
- package/esm/react/index.d.ts.map +0 -1
- package/esm/react/index.js +0 -3124
- package/esm/react/types.d.ts +0 -105
- package/esm/react/types.d.ts.map +0 -1
- package/esm/react/utils.d.ts +0 -43
- package/esm/react/utils.d.ts.map +0 -1
- package/esm/render/index.d.ts +0 -8
- package/esm/render/index.d.ts.map +0 -1
- package/esm/render/prerender.d.ts +0 -57
- package/esm/render/prerender.d.ts.map +0 -1
- package/esm/renderers/index.d.ts +0 -21
- package/esm/renderers/index.d.ts.map +0 -1
- package/esm/renderers/index.js +0 -381
- package/esm/renderers/react.adapter.d.ts +0 -70
- package/esm/renderers/react.adapter.d.ts.map +0 -1
- package/esm/renderers/react.renderer.d.ts +0 -96
- package/esm/renderers/react.renderer.d.ts.map +0 -1
- package/esm/universal/UniversalApp.d.ts +0 -108
- package/esm/universal/UniversalApp.d.ts.map +0 -1
- package/esm/universal/cached-runtime.d.ts +0 -115
- package/esm/universal/cached-runtime.d.ts.map +0 -1
- package/esm/universal/context.d.ts +0 -122
- package/esm/universal/context.d.ts.map +0 -1
- package/esm/universal/index.d.ts +0 -57
- package/esm/universal/index.d.ts.map +0 -1
- package/esm/universal/renderers/html.renderer.d.ts +0 -37
- package/esm/universal/renderers/html.renderer.d.ts.map +0 -1
- package/esm/universal/renderers/index.d.ts +0 -112
- package/esm/universal/renderers/index.d.ts.map +0 -1
- package/esm/universal/renderers/markdown.renderer.d.ts +0 -33
- package/esm/universal/renderers/markdown.renderer.d.ts.map +0 -1
- package/esm/universal/renderers/mdx.renderer.d.ts +0 -38
- package/esm/universal/renderers/mdx.renderer.d.ts.map +0 -1
- package/esm/universal/renderers/react.renderer.d.ts +0 -46
- package/esm/universal/renderers/react.renderer.d.ts.map +0 -1
- package/esm/universal/runtime-builder.d.ts +0 -33
- package/esm/universal/runtime-builder.d.ts.map +0 -1
- package/esm/universal/store.d.ts +0 -135
- package/esm/universal/store.d.ts.map +0 -1
- package/esm/universal/types.d.ts +0 -199
- package/esm/universal/types.d.ts.map +0 -1
- package/esm/web-components/core/attribute-parser.d.ts +0 -82
- package/esm/web-components/core/attribute-parser.d.ts.map +0 -1
- package/esm/web-components/core/base-element.d.ts +0 -197
- package/esm/web-components/core/base-element.d.ts.map +0 -1
- package/esm/web-components/core/index.d.ts +0 -9
- package/esm/web-components/core/index.d.ts.map +0 -1
- package/esm/web-components/elements/fmcp-alert.d.ts +0 -46
- package/esm/web-components/elements/fmcp-alert.d.ts.map +0 -1
- package/esm/web-components/elements/fmcp-badge.d.ts +0 -47
- package/esm/web-components/elements/fmcp-badge.d.ts.map +0 -1
- package/esm/web-components/elements/fmcp-button.d.ts +0 -117
- package/esm/web-components/elements/fmcp-button.d.ts.map +0 -1
- package/esm/web-components/elements/fmcp-card.d.ts +0 -53
- package/esm/web-components/elements/fmcp-card.d.ts.map +0 -1
- package/esm/web-components/elements/fmcp-input.d.ts +0 -96
- package/esm/web-components/elements/fmcp-input.d.ts.map +0 -1
- package/esm/web-components/elements/fmcp-select.d.ts +0 -100
- package/esm/web-components/elements/fmcp-select.d.ts.map +0 -1
- package/esm/web-components/elements/index.d.ts +0 -13
- package/esm/web-components/elements/index.d.ts.map +0 -1
- package/esm/web-components/index.d.ts +0 -50
- package/esm/web-components/index.d.ts.map +0 -1
- package/esm/web-components/register.d.ts +0 -57
- package/esm/web-components/register.d.ts.map +0 -1
- package/esm/web-components/types.d.ts +0 -122
- package/esm/web-components/types.d.ts.map +0 -1
- package/esm/widgets/index.d.ts +0 -8
- package/esm/widgets/index.d.ts.map +0 -1
- package/esm/widgets/index.js +0 -883
- package/esm/widgets/progress.d.ts +0 -133
- package/esm/widgets/progress.d.ts.map +0 -1
- package/esm/widgets/resource.d.ts +0 -163
- package/esm/widgets/resource.d.ts.map +0 -1
- package/pages/consent.d.ts +0 -117
- package/pages/consent.d.ts.map +0 -1
- package/pages/error.d.ts +0 -101
- package/pages/error.d.ts.map +0 -1
- package/pages/index.d.ts +0 -9
- package/pages/index.d.ts.map +0 -1
- package/pages/index.js +0 -1065
- package/react/utils.d.ts +0 -43
- package/react/utils.d.ts.map +0 -1
- package/widgets/index.d.ts +0 -8
- package/widgets/index.d.ts.map +0 -1
- package/widgets/index.js +0 -910
- package/widgets/progress.d.ts +0 -133
- package/widgets/progress.d.ts.map +0 -1
- package/widgets/resource.d.ts +0 -163
- package/widgets/resource.d.ts.map +0 -1
- /package/esm/components/{index.js → index.mjs} +0 -0
- /package/esm/render/{index.js → index.mjs} +0 -0
- /package/esm/web-components/{index.js → index.mjs} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/web-components/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AAGH,OAAO,EACL,WAAW,EACX,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,EAC1B,mBAAmB,EACnB,YAAY,EACZ,YAAY,EACZ,+BAA+B,EAC/B,yBAAyB,EACzB,KAAK,eAAe,GACrB,MAAM,QAAQ,CAAC;AAGhB,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAG/F,OAAO,EACL,qBAAqB,EACrB,kBAAkB,EAClB,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,YAAY,CAAC;AAGpB,YAAY,EACV,eAAe,EACf,aAAa,EACb,cAAc,EACd,cAAc,EACd,cAAc,EACd,eAAe,GAChB,MAAM,SAAS,CAAC
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/web-components/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AAGH,OAAO,EACL,WAAW,EACX,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,EAC1B,mBAAmB,EACnB,YAAY,EACZ,YAAY,EACZ,+BAA+B,EAC/B,yBAAyB,EACzB,KAAK,eAAe,GACrB,MAAM,QAAQ,CAAC;AAGhB,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAG/F,OAAO,EACL,qBAAqB,EACrB,kBAAkB,EAClB,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,YAAY,CAAC;AAGpB,YAAY,EACV,eAAe,EACf,aAAa,EACb,cAAc,EACd,cAAc,EACd,cAAc,EACd,eAAe,GAChB,MAAM,SAAS,CAAC"}
|
package/bundler/cache.d.ts
DELETED
|
@@ -1,173 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Bundler Cache
|
|
3
|
-
*
|
|
4
|
-
* LRU cache implementation for bundled results.
|
|
5
|
-
* Provides content-addressable caching with TTL expiration.
|
|
6
|
-
*
|
|
7
|
-
* @packageDocumentation
|
|
8
|
-
*/
|
|
9
|
-
import type { BundleResult } from './types';
|
|
10
|
-
/**
|
|
11
|
-
* Cache configuration options.
|
|
12
|
-
*/
|
|
13
|
-
export interface CacheOptions {
|
|
14
|
-
/**
|
|
15
|
-
* Maximum number of entries in the cache.
|
|
16
|
-
* @default 100
|
|
17
|
-
*/
|
|
18
|
-
maxSize: number;
|
|
19
|
-
/**
|
|
20
|
-
* Time-to-live for cache entries in milliseconds.
|
|
21
|
-
* @default 300000 (5 minutes)
|
|
22
|
-
*/
|
|
23
|
-
ttl: number;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Cache statistics.
|
|
27
|
-
*/
|
|
28
|
-
export interface CacheStats {
|
|
29
|
-
/**
|
|
30
|
-
* Number of entries in the cache.
|
|
31
|
-
*/
|
|
32
|
-
size: number;
|
|
33
|
-
/**
|
|
34
|
-
* Number of cache hits.
|
|
35
|
-
*/
|
|
36
|
-
hits: number;
|
|
37
|
-
/**
|
|
38
|
-
* Number of cache misses.
|
|
39
|
-
*/
|
|
40
|
-
misses: number;
|
|
41
|
-
/**
|
|
42
|
-
* Hit rate (0-1).
|
|
43
|
-
*/
|
|
44
|
-
hitRate: number;
|
|
45
|
-
/**
|
|
46
|
-
* Number of expired entries removed.
|
|
47
|
-
*/
|
|
48
|
-
evictions: number;
|
|
49
|
-
/**
|
|
50
|
-
* Total memory used by cache (approximate).
|
|
51
|
-
*/
|
|
52
|
-
memoryUsage: number;
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* LRU cache for bundled results.
|
|
56
|
-
*
|
|
57
|
-
* Features:
|
|
58
|
-
* - Content-addressable by hash
|
|
59
|
-
* - TTL-based expiration
|
|
60
|
-
* - LRU eviction when at capacity
|
|
61
|
-
* - Statistics tracking
|
|
62
|
-
*
|
|
63
|
-
* @example
|
|
64
|
-
* ```typescript
|
|
65
|
-
* const cache = new BundlerCache({ maxSize: 100, ttl: 300000 });
|
|
66
|
-
*
|
|
67
|
-
* // Store a result
|
|
68
|
-
* cache.set('abc123', bundleResult);
|
|
69
|
-
*
|
|
70
|
-
* // Retrieve a result
|
|
71
|
-
* const cached = cache.get('abc123');
|
|
72
|
-
* if (cached) {
|
|
73
|
-
* console.log('Cache hit!', cached);
|
|
74
|
-
* }
|
|
75
|
-
*
|
|
76
|
-
* // Get statistics
|
|
77
|
-
* console.log(cache.getStats());
|
|
78
|
-
* ```
|
|
79
|
-
*/
|
|
80
|
-
export declare class BundlerCache {
|
|
81
|
-
private readonly cache;
|
|
82
|
-
private readonly options;
|
|
83
|
-
private stats;
|
|
84
|
-
constructor(options?: Partial<CacheOptions>);
|
|
85
|
-
/**
|
|
86
|
-
* Get a cached bundle result.
|
|
87
|
-
*
|
|
88
|
-
* @param key - Cache key (typically content hash)
|
|
89
|
-
* @returns Cached result or undefined if not found/expired
|
|
90
|
-
*/
|
|
91
|
-
get(key: string): BundleResult | undefined;
|
|
92
|
-
/**
|
|
93
|
-
* Store a bundle result in the cache.
|
|
94
|
-
*
|
|
95
|
-
* @param key - Cache key (typically content hash)
|
|
96
|
-
* @param result - Bundle result to cache
|
|
97
|
-
*/
|
|
98
|
-
set(key: string, result: BundleResult): void;
|
|
99
|
-
/**
|
|
100
|
-
* Check if a key exists in the cache (and is not expired).
|
|
101
|
-
*
|
|
102
|
-
* @param key - Cache key to check
|
|
103
|
-
* @returns true if key exists and is not expired
|
|
104
|
-
*/
|
|
105
|
-
has(key: string): boolean;
|
|
106
|
-
/**
|
|
107
|
-
* Delete a specific entry from the cache.
|
|
108
|
-
*
|
|
109
|
-
* @param key - Cache key to delete
|
|
110
|
-
* @returns true if the key was found and deleted
|
|
111
|
-
*/
|
|
112
|
-
delete(key: string): boolean;
|
|
113
|
-
/**
|
|
114
|
-
* Clear all entries from the cache.
|
|
115
|
-
*/
|
|
116
|
-
clear(): void;
|
|
117
|
-
/**
|
|
118
|
-
* Get cache statistics.
|
|
119
|
-
*
|
|
120
|
-
* @returns Current cache statistics
|
|
121
|
-
*/
|
|
122
|
-
getStats(): CacheStats;
|
|
123
|
-
/**
|
|
124
|
-
* Remove expired entries from the cache.
|
|
125
|
-
*
|
|
126
|
-
* @returns Number of entries removed
|
|
127
|
-
*/
|
|
128
|
-
cleanup(): number;
|
|
129
|
-
/**
|
|
130
|
-
* Get all cache keys.
|
|
131
|
-
*
|
|
132
|
-
* @returns Array of cache keys
|
|
133
|
-
*/
|
|
134
|
-
keys(): string[];
|
|
135
|
-
/**
|
|
136
|
-
* Get the number of entries in the cache.
|
|
137
|
-
*/
|
|
138
|
-
get size(): number;
|
|
139
|
-
/**
|
|
140
|
-
* Check if an entry is expired.
|
|
141
|
-
*/
|
|
142
|
-
private isExpired;
|
|
143
|
-
/**
|
|
144
|
-
* Evict the oldest (least recently used) entry.
|
|
145
|
-
*/
|
|
146
|
-
private evictOldest;
|
|
147
|
-
}
|
|
148
|
-
/**
|
|
149
|
-
* Create a hash from source content.
|
|
150
|
-
*
|
|
151
|
-
* Uses a simple but fast hashing algorithm suitable for cache keys.
|
|
152
|
-
*
|
|
153
|
-
* @param content - Content to hash
|
|
154
|
-
* @returns Hash string
|
|
155
|
-
*/
|
|
156
|
-
export declare function hashContent(content: string): string;
|
|
157
|
-
/**
|
|
158
|
-
* Create a hash from bundle options.
|
|
159
|
-
*
|
|
160
|
-
* Used to differentiate bundles of the same source with different options.
|
|
161
|
-
*
|
|
162
|
-
* @param source - Source content
|
|
163
|
-
* @param options - Bundle options that affect output
|
|
164
|
-
* @returns Combined hash string
|
|
165
|
-
*/
|
|
166
|
-
export declare function createCacheKey(source: string, options: {
|
|
167
|
-
sourceType?: string;
|
|
168
|
-
format?: string;
|
|
169
|
-
minify?: boolean;
|
|
170
|
-
externals?: string[];
|
|
171
|
-
target?: string;
|
|
172
|
-
}): string;
|
|
173
|
-
//# sourceMappingURL=cache.d.ts.map
|
package/bundler/cache.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../src/bundler/cache.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAc,MAAM,SAAS,CAAC;AAExD;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B;;;OAGG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;;OAGG;IACH,GAAG,EAAE,MAAM,CAAC;CACb;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAiC;IACvD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAe;IACvC,OAAO,CAAC,KAAK,CAIX;gBAEU,OAAO,GAAE,OAAO,CAAC,YAAY,CAAM;IAO/C;;;;;OAKG;IACH,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS;IA4B1C;;;;;OAKG;IACH,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,GAAG,IAAI;IAiB5C;;;;;OAKG;IACH,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAWzB;;;;;OAKG;IACH,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAI5B;;OAEG;IACH,KAAK,IAAI,IAAI;IASb;;;;OAIG;IACH,QAAQ,IAAI,UAAU;IAsBtB;;;;OAIG;IACH,OAAO,IAAI,MAAM;IAcjB;;;;OAIG;IACH,IAAI,IAAI,MAAM,EAAE;IAIhB;;OAEG;IACH,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED;;OAEG;IACH,OAAO,CAAC,SAAS;IAIjB;;OAEG;IACH,OAAO,CAAC,WAAW;CAQpB;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAUnD;AAED;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,MAAM,EACd,OAAO,EAAE;IACP,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,GACA,MAAM,CAaR"}
|
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Component Builder
|
|
3
|
-
*
|
|
4
|
-
* Builds file-based UI components with caching and CDN dependency resolution.
|
|
5
|
-
* Handles the complete build pipeline from source to cached manifest.
|
|
6
|
-
*
|
|
7
|
-
* @packageDocumentation
|
|
8
|
-
*/
|
|
9
|
-
import type { ComponentBuildManifest, FileBundleOptions, CDNDependency, CDNPlatformType } from '@frontmcp/uipack/dependency';
|
|
10
|
-
import type { BuildCacheStorage } from './storage/interface';
|
|
11
|
-
/**
|
|
12
|
-
* Options for building a component.
|
|
13
|
-
*/
|
|
14
|
-
export interface ComponentBuildOptions {
|
|
15
|
-
/**
|
|
16
|
-
* Entry file path.
|
|
17
|
-
*/
|
|
18
|
-
entryPath: string;
|
|
19
|
-
/**
|
|
20
|
-
* Tool name for the component.
|
|
21
|
-
*/
|
|
22
|
-
toolName: string;
|
|
23
|
-
/**
|
|
24
|
-
* Packages to load from CDN.
|
|
25
|
-
*/
|
|
26
|
-
externals?: string[];
|
|
27
|
-
/**
|
|
28
|
-
* Explicit CDN dependency overrides.
|
|
29
|
-
*/
|
|
30
|
-
dependencies?: Record<string, CDNDependency>;
|
|
31
|
-
/**
|
|
32
|
-
* Bundle options.
|
|
33
|
-
*/
|
|
34
|
-
bundleOptions?: FileBundleOptions;
|
|
35
|
-
/**
|
|
36
|
-
* Target platform for CDN selection.
|
|
37
|
-
* @default 'unknown'
|
|
38
|
-
*/
|
|
39
|
-
platform?: CDNPlatformType;
|
|
40
|
-
/**
|
|
41
|
-
* Whether to skip cache lookup.
|
|
42
|
-
* @default false
|
|
43
|
-
*/
|
|
44
|
-
skipCache?: boolean;
|
|
45
|
-
/**
|
|
46
|
-
* Whether to perform SSR.
|
|
47
|
-
* @default false
|
|
48
|
-
*/
|
|
49
|
-
ssr?: boolean;
|
|
50
|
-
/**
|
|
51
|
-
* SSR context data.
|
|
52
|
-
*/
|
|
53
|
-
ssrContext?: Record<string, unknown>;
|
|
54
|
-
/**
|
|
55
|
-
* Custom code execution function for SSR.
|
|
56
|
-
* Allows different strategies for Node.js vs browser environments.
|
|
57
|
-
* If not provided, uses `new Function()` which works in both environments.
|
|
58
|
-
*
|
|
59
|
-
* @example
|
|
60
|
-
* ```typescript
|
|
61
|
-
* // Custom execution with vm module
|
|
62
|
-
* import { createContext, runInContext } from 'vm';
|
|
63
|
-
*
|
|
64
|
-
* const options = {
|
|
65
|
-
* executeCode: (code, exports, module, React) => {
|
|
66
|
-
* const context = createContext({ exports, module, React });
|
|
67
|
-
* runInContext(code, context);
|
|
68
|
-
* }
|
|
69
|
-
* };
|
|
70
|
-
* ```
|
|
71
|
-
*/
|
|
72
|
-
executeCode?: (code: string, exports: Record<string, unknown>, module: {
|
|
73
|
-
exports: Record<string, unknown>;
|
|
74
|
-
}, React: unknown) => void;
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Result of a build operation.
|
|
78
|
-
*/
|
|
79
|
-
export interface ComponentBuildResult {
|
|
80
|
-
/**
|
|
81
|
-
* The build manifest.
|
|
82
|
-
*/
|
|
83
|
-
manifest: ComponentBuildManifest;
|
|
84
|
-
/**
|
|
85
|
-
* Whether the result came from cache.
|
|
86
|
-
*/
|
|
87
|
-
cached: boolean;
|
|
88
|
-
/**
|
|
89
|
-
* Build time in milliseconds.
|
|
90
|
-
*/
|
|
91
|
-
buildTimeMs: number;
|
|
92
|
-
}
|
|
93
|
-
/**
|
|
94
|
-
* Component builder for file-based UI templates.
|
|
95
|
-
*
|
|
96
|
-
* Handles the complete build pipeline:
|
|
97
|
-
* 1. Check cache for existing build
|
|
98
|
-
* 2. Parse entry file for imports
|
|
99
|
-
* 3. Resolve external dependencies to CDN URLs
|
|
100
|
-
* 4. Bundle the component with esbuild
|
|
101
|
-
* 5. Generate import map for CDN dependencies
|
|
102
|
-
* 6. Store result in cache
|
|
103
|
-
*
|
|
104
|
-
* @example
|
|
105
|
-
* ```typescript
|
|
106
|
-
* const storage = new FilesystemStorage({ cacheDir: '.cache' });
|
|
107
|
-
* await storage.initialize();
|
|
108
|
-
*
|
|
109
|
-
* const builder = new ComponentBuilder(storage);
|
|
110
|
-
*
|
|
111
|
-
* const result = await builder.build({
|
|
112
|
-
* entryPath: './widgets/chart.tsx',
|
|
113
|
-
* toolName: 'chart_display',
|
|
114
|
-
* externals: ['chart.js', 'react'],
|
|
115
|
-
* platform: 'claude',
|
|
116
|
-
* });
|
|
117
|
-
*
|
|
118
|
-
* console.log(result.manifest.outputs.code);
|
|
119
|
-
* console.log(result.manifest.importMap);
|
|
120
|
-
* ```
|
|
121
|
-
*/
|
|
122
|
-
export declare class ComponentBuilder {
|
|
123
|
-
private readonly storage;
|
|
124
|
-
private esbuild;
|
|
125
|
-
constructor(storage: BuildCacheStorage);
|
|
126
|
-
/**
|
|
127
|
-
* Build a component from a file path.
|
|
128
|
-
*/
|
|
129
|
-
build(options: ComponentBuildOptions): Promise<ComponentBuildResult>;
|
|
130
|
-
/**
|
|
131
|
-
* Build multiple components.
|
|
132
|
-
*/
|
|
133
|
-
buildMany(options: ComponentBuildOptions[]): Promise<ComponentBuildResult[]>;
|
|
134
|
-
/**
|
|
135
|
-
* Check if a component needs rebuilding.
|
|
136
|
-
*/
|
|
137
|
-
needsRebuild(options: Pick<ComponentBuildOptions, 'entryPath' | 'externals' | 'dependencies' | 'bundleOptions'>): Promise<boolean>;
|
|
138
|
-
/**
|
|
139
|
-
* Get a cached build if it exists.
|
|
140
|
-
*/
|
|
141
|
-
getCached(options: Pick<ComponentBuildOptions, 'entryPath' | 'externals' | 'dependencies' | 'bundleOptions'>): Promise<ComponentBuildManifest | undefined>;
|
|
142
|
-
/**
|
|
143
|
-
* Invalidate a cached build.
|
|
144
|
-
*/
|
|
145
|
-
invalidate(contentHash: string): Promise<boolean>;
|
|
146
|
-
/**
|
|
147
|
-
* Generate complete HTML for a built component.
|
|
148
|
-
*/
|
|
149
|
-
generateHTML(manifest: ComponentBuildManifest, minify?: boolean): string;
|
|
150
|
-
/**
|
|
151
|
-
* Bundle a component using esbuild.
|
|
152
|
-
*/
|
|
153
|
-
private bundleComponent;
|
|
154
|
-
/**
|
|
155
|
-
* Perform server-side rendering.
|
|
156
|
-
*/
|
|
157
|
-
private renderSSR;
|
|
158
|
-
}
|
|
159
|
-
/**
|
|
160
|
-
* Create a component builder with filesystem storage.
|
|
161
|
-
*/
|
|
162
|
-
export declare function createFilesystemBuilder(cacheDir?: string): Promise<ComponentBuilder>;
|
|
163
|
-
/**
|
|
164
|
-
* Create a component builder with Redis storage.
|
|
165
|
-
*/
|
|
166
|
-
export declare function createRedisBuilder(redisClient: import('./storage/redis.js').RedisClient, keyPrefix?: string): Promise<ComponentBuilder>;
|
|
167
|
-
//# sourceMappingURL=component-builder.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"component-builder.d.ts","sourceRoot":"","sources":["../../../src/bundler/file-cache/component-builder.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAOH,OAAO,KAAK,EACV,sBAAsB,EACtB,iBAAiB,EACjB,aAAa,EACb,eAAe,EAGhB,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAQ7D;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IAErB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IAE7C;;OAEG;IACH,aAAa,CAAC,EAAE,iBAAiB,CAAC;IAElC;;;OAGG;IACH,QAAQ,CAAC,EAAE,eAAe,CAAC;IAE3B;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;;OAGG;IACH,GAAG,CAAC,EAAE,OAAO,CAAC;IAEd;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAErC;;;;;;;;;;;;;;;;;OAiBG;IACH,WAAW,CAAC,EAAE,CACZ,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,MAAM,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,EAC5C,KAAK,EAAE,OAAO,KACX,IAAI,CAAC;CACX;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC;;OAEG;IACH,QAAQ,EAAE,sBAAsB,CAAC;IAEjC;;OAEG;IACH,MAAM,EAAE,OAAO,CAAC;IAEhB;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;CACrB;AAMD;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAoB;IAC5C,OAAO,CAAC,OAAO,CAAyC;gBAE5C,OAAO,EAAE,iBAAiB;IAItC;;OAEG;IACG,KAAK,CAAC,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAyI1E;;OAEG;IACG,SAAS,CAAC,OAAO,EAAE,qBAAqB,EAAE,GAAG,OAAO,CAAC,oBAAoB,EAAE,CAAC;IAIlF;;OAEG;IACG,YAAY,CAChB,OAAO,EAAE,IAAI,CAAC,qBAAqB,EAAE,WAAW,GAAG,WAAW,GAAG,cAAc,GAAG,eAAe,CAAC,GACjG,OAAO,CAAC,OAAO,CAAC;IAcnB;;OAEG;IACG,SAAS,CACb,OAAO,EAAE,IAAI,CAAC,qBAAqB,EAAE,WAAW,GAAG,WAAW,GAAG,cAAc,GAAG,eAAe,CAAC,GACjG,OAAO,CAAC,sBAAsB,GAAG,SAAS,CAAC;IAa9C;;OAEG;IACG,UAAU,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAIvD;;OAEG;IACH,YAAY,CAAC,QAAQ,EAAE,sBAAsB,EAAE,MAAM,UAAQ,GAAG,MAAM;IAatE;;OAEG;YACW,eAAe;IA4C7B;;OAEG;YACW,SAAS;CAqDxB;AAMD;;GAEG;AACH,wBAAsB,uBAAuB,CAAC,QAAQ,SAA2B,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAK5G;AAED;;GAEG;AACH,wBAAsB,kBAAkB,CACtC,WAAW,EAAE,OAAO,oBAAoB,EAAE,WAAW,EACrD,SAAS,SAAuB,GAC/B,OAAO,CAAC,gBAAgB,CAAC,CAQ3B"}
|
|
@@ -1,155 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Hash Calculator
|
|
3
|
-
*
|
|
4
|
-
* SHA-256 based hash calculation for cache keys.
|
|
5
|
-
* Combines file contents, dependencies, and build options
|
|
6
|
-
* to create deterministic cache keys for incremental builds.
|
|
7
|
-
*
|
|
8
|
-
* @packageDocumentation
|
|
9
|
-
*/
|
|
10
|
-
import type { FileBundleOptions, CDNDependency } from '@frontmcp/uipack/dependency';
|
|
11
|
-
/**
|
|
12
|
-
* Calculate SHA-256 hash of a string.
|
|
13
|
-
*
|
|
14
|
-
* @param content - Content to hash
|
|
15
|
-
* @returns Hex-encoded SHA-256 hash
|
|
16
|
-
*/
|
|
17
|
-
export declare function sha256(content: string): string;
|
|
18
|
-
/**
|
|
19
|
-
* Calculate SHA-256 hash of a buffer.
|
|
20
|
-
*
|
|
21
|
-
* @param buffer - Buffer to hash
|
|
22
|
-
* @returns Hex-encoded SHA-256 hash
|
|
23
|
-
*/
|
|
24
|
-
export declare function sha256Buffer(buffer: Buffer): string;
|
|
25
|
-
/**
|
|
26
|
-
* Calculate hash of a file's contents.
|
|
27
|
-
*
|
|
28
|
-
* @param filePath - Path to the file
|
|
29
|
-
* @returns SHA-256 hash or undefined if file doesn't exist
|
|
30
|
-
*/
|
|
31
|
-
export declare function hashFile(filePath: string): Promise<string | undefined>;
|
|
32
|
-
/**
|
|
33
|
-
* Calculate combined hash of multiple files.
|
|
34
|
-
*
|
|
35
|
-
* @param filePaths - Paths to files
|
|
36
|
-
* @returns Combined SHA-256 hash
|
|
37
|
-
*/
|
|
38
|
-
export declare function hashFiles(filePaths: string[]): Promise<string>;
|
|
39
|
-
/**
|
|
40
|
-
* Options for calculating a component hash.
|
|
41
|
-
*/
|
|
42
|
-
export interface ComponentHashOptions {
|
|
43
|
-
/**
|
|
44
|
-
* Entry file path.
|
|
45
|
-
*/
|
|
46
|
-
entryPath: string;
|
|
47
|
-
/**
|
|
48
|
-
* Base directory for resolving relative imports.
|
|
49
|
-
* @default dirname(entryPath)
|
|
50
|
-
*/
|
|
51
|
-
baseDir?: string;
|
|
52
|
-
/**
|
|
53
|
-
* External packages (excluded from hash).
|
|
54
|
-
*/
|
|
55
|
-
externals?: string[];
|
|
56
|
-
/**
|
|
57
|
-
* Explicit CDN dependencies.
|
|
58
|
-
*/
|
|
59
|
-
dependencies?: Record<string, CDNDependency>;
|
|
60
|
-
/**
|
|
61
|
-
* Bundle options.
|
|
62
|
-
*/
|
|
63
|
-
bundleOptions?: FileBundleOptions;
|
|
64
|
-
/**
|
|
65
|
-
* Maximum depth for following imports.
|
|
66
|
-
* @default 10
|
|
67
|
-
*/
|
|
68
|
-
maxDepth?: number;
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Result of component hash calculation.
|
|
72
|
-
*/
|
|
73
|
-
export interface ComponentHashResult {
|
|
74
|
-
/**
|
|
75
|
-
* Combined SHA-256 hash.
|
|
76
|
-
*/
|
|
77
|
-
hash: string;
|
|
78
|
-
/**
|
|
79
|
-
* Entry file hash.
|
|
80
|
-
*/
|
|
81
|
-
entryHash: string;
|
|
82
|
-
/**
|
|
83
|
-
* All files included in the hash.
|
|
84
|
-
*/
|
|
85
|
-
files: string[];
|
|
86
|
-
/**
|
|
87
|
-
* Individual file hashes.
|
|
88
|
-
*/
|
|
89
|
-
fileHashes: Record<string, string>;
|
|
90
|
-
/**
|
|
91
|
-
* Hash of build options.
|
|
92
|
-
*/
|
|
93
|
-
optionsHash: string;
|
|
94
|
-
/**
|
|
95
|
-
* Hash of external dependencies configuration.
|
|
96
|
-
*/
|
|
97
|
-
dependenciesHash: string;
|
|
98
|
-
}
|
|
99
|
-
/**
|
|
100
|
-
* Calculate a deterministic hash for a file-based component.
|
|
101
|
-
*
|
|
102
|
-
* The hash includes:
|
|
103
|
-
* - Entry file content
|
|
104
|
-
* - All local dependencies (relative imports)
|
|
105
|
-
* - Bundle options
|
|
106
|
-
* - External dependency configurations
|
|
107
|
-
*
|
|
108
|
-
* External npm packages are NOT included in the hash since they're
|
|
109
|
-
* loaded from CDN and versioned separately.
|
|
110
|
-
*
|
|
111
|
-
* @param options - Hash calculation options
|
|
112
|
-
* @returns Hash result with details
|
|
113
|
-
*
|
|
114
|
-
* @example
|
|
115
|
-
* ```typescript
|
|
116
|
-
* const result = await calculateComponentHash({
|
|
117
|
-
* entryPath: './src/widgets/chart.tsx',
|
|
118
|
-
* externals: ['chart.js', 'react'],
|
|
119
|
-
* bundleOptions: { minify: true },
|
|
120
|
-
* });
|
|
121
|
-
*
|
|
122
|
-
* console.log(result.hash); // '3a7bd...'
|
|
123
|
-
* console.log(result.files); // ['./src/widgets/chart.tsx', './src/widgets/utils.ts']
|
|
124
|
-
* ```
|
|
125
|
-
*/
|
|
126
|
-
export declare function calculateComponentHash(options: ComponentHashOptions): Promise<ComponentHashResult>;
|
|
127
|
-
/**
|
|
128
|
-
* Calculate a quick hash for cache lookup (entry file only).
|
|
129
|
-
*
|
|
130
|
-
* This is faster than full component hash but may miss dependency changes.
|
|
131
|
-
* Use for quick cache existence checks, then verify with full hash.
|
|
132
|
-
*
|
|
133
|
-
* @param entryPath - Entry file path
|
|
134
|
-
* @param bundleOptions - Bundle options
|
|
135
|
-
* @returns Quick hash string
|
|
136
|
-
*/
|
|
137
|
-
export declare function calculateQuickHash(entryPath: string, bundleOptions?: FileBundleOptions): Promise<string>;
|
|
138
|
-
/**
|
|
139
|
-
* Generate a unique build ID.
|
|
140
|
-
*
|
|
141
|
-
* Combines timestamp and random component for uniqueness.
|
|
142
|
-
*
|
|
143
|
-
* @returns UUID-like build ID
|
|
144
|
-
*/
|
|
145
|
-
export declare function generateBuildId(): string;
|
|
146
|
-
/**
|
|
147
|
-
* Generate a build ID from a content hash.
|
|
148
|
-
*
|
|
149
|
-
* Creates a shorter, more readable ID while maintaining uniqueness.
|
|
150
|
-
*
|
|
151
|
-
* @param hash - Content hash
|
|
152
|
-
* @returns Shortened build ID
|
|
153
|
-
*/
|
|
154
|
-
export declare function buildIdFromHash(hash: string): string;
|
|
155
|
-
//# sourceMappingURL=hash-calculator.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hash-calculator.d.ts","sourceRoot":"","sources":["../../../src/bundler/file-cache/hash-calculator.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAOH,OAAO,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAMpF;;;;;GAKG;AACH,wBAAgB,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAE9C;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEnD;AAED;;;;;GAKG;AACH,wBAAsB,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAO5E;AAED;;;;;GAKG;AACH,wBAAsB,SAAS,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAWpE;AAMD;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IAErB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IAE7C;;OAEG;IACH,aAAa,CAAC,EAAE,iBAAiB,CAAC;IAElC;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,KAAK,EAAE,MAAM,EAAE,CAAC;IAEhB;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAEnC;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAsB,sBAAsB,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAmDxG;AAED;;;;;;;;;GASG;AACH,wBAAsB,kBAAkB,CAAC,SAAS,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,MAAM,CAAC,CAO9G;AA6HD;;;;;;GAMG;AACH,wBAAgB,eAAe,IAAI,MAAM,CAIxC;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAGpD"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* File-Based Component Caching
|
|
3
|
-
*
|
|
4
|
-
* SHA-based caching system for file-based UI component builds.
|
|
5
|
-
* Supports filesystem (development) and Redis (production) storage.
|
|
6
|
-
*
|
|
7
|
-
* @packageDocumentation
|
|
8
|
-
*/
|
|
9
|
-
export { type BuildCacheStorage, type StorageOptions, type CacheEntry, type CacheEntryMetadata, DEFAULT_STORAGE_OPTIONS, calculateManifestSize, FilesystemStorage, createFilesystemStorage, type FilesystemStorageOptions, RedisStorage, createRedisStorage, type RedisStorageOptions, type RedisClient, } from './storage';
|
|
10
|
-
export { sha256, sha256Buffer, hashFile, hashFiles, calculateComponentHash, calculateQuickHash, generateBuildId, buildIdFromHash, type ComponentHashOptions, type ComponentHashResult, } from './hash-calculator';
|
|
11
|
-
export { ComponentBuilder, createFilesystemBuilder, createRedisBuilder, type ComponentBuildOptions, type ComponentBuildResult, } from './component-builder';
|
|
12
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/bundler/file-cache/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAEL,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACnB,KAAK,UAAU,EACf,KAAK,kBAAkB,EACvB,uBAAuB,EACvB,qBAAqB,EAErB,iBAAiB,EACjB,uBAAuB,EACvB,KAAK,wBAAwB,EAE7B,YAAY,EACZ,kBAAkB,EAClB,KAAK,mBAAmB,EACxB,KAAK,WAAW,GACjB,MAAM,WAAW,CAAC;AAGnB,OAAO,EACL,MAAM,EACN,YAAY,EACZ,QAAQ,EACR,SAAS,EACT,sBAAsB,EACtB,kBAAkB,EAClB,eAAe,EACf,eAAe,EACf,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,GACzB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EACL,gBAAgB,EAChB,uBAAuB,EACvB,kBAAkB,EAClB,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,GAC1B,MAAM,qBAAqB,CAAC"}
|
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Filesystem Build Cache Storage
|
|
3
|
-
*
|
|
4
|
-
* File-based cache storage for development environments.
|
|
5
|
-
* Uses LRU eviction and stores manifests as JSON files.
|
|
6
|
-
*
|
|
7
|
-
* @packageDocumentation
|
|
8
|
-
*/
|
|
9
|
-
import type { ComponentBuildManifest, CacheStats } from '@frontmcp/uipack/dependency';
|
|
10
|
-
import type { BuildCacheStorage, StorageOptions } from './interface';
|
|
11
|
-
/**
|
|
12
|
-
* Error thrown when cache storage fails to initialize.
|
|
13
|
-
*/
|
|
14
|
-
export declare class CacheInitializationError extends Error {
|
|
15
|
-
readonly cause?: unknown;
|
|
16
|
-
constructor(message: string, cause?: unknown);
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Error thrown when a cache operation fails.
|
|
20
|
-
*/
|
|
21
|
-
export declare class CacheOperationError extends Error {
|
|
22
|
-
readonly cause?: unknown;
|
|
23
|
-
constructor(message: string, cause?: unknown);
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Error thrown when storage is accessed before initialization.
|
|
27
|
-
*/
|
|
28
|
-
export declare class StorageNotInitializedError extends Error {
|
|
29
|
-
constructor();
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Options specific to filesystem storage.
|
|
33
|
-
*/
|
|
34
|
-
export interface FilesystemStorageOptions extends StorageOptions {
|
|
35
|
-
/**
|
|
36
|
-
* Base directory for cache files.
|
|
37
|
-
* @default '.frontmcp-cache/builds'
|
|
38
|
-
*/
|
|
39
|
-
cacheDir?: string;
|
|
40
|
-
/**
|
|
41
|
-
* File extension for cache files.
|
|
42
|
-
* @default '.json'
|
|
43
|
-
*/
|
|
44
|
-
extension?: string;
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Filesystem-based build cache storage.
|
|
48
|
-
*
|
|
49
|
-
* Stores each build manifest as a JSON file in the cache directory.
|
|
50
|
-
* Uses LRU eviction based on last access time when size limits are exceeded.
|
|
51
|
-
*
|
|
52
|
-
* Directory structure:
|
|
53
|
-
* ```
|
|
54
|
-
* .frontmcp-cache/builds/
|
|
55
|
-
* ├── {hash1}.json
|
|
56
|
-
* ├── {hash2}.json
|
|
57
|
-
* └── ...
|
|
58
|
-
* ```
|
|
59
|
-
*
|
|
60
|
-
* @example
|
|
61
|
-
* ```typescript
|
|
62
|
-
* const storage = new FilesystemStorage({
|
|
63
|
-
* cacheDir: '.cache/ui-builds',
|
|
64
|
-
* maxSize: 50 * 1024 * 1024, // 50MB
|
|
65
|
-
* });
|
|
66
|
-
*
|
|
67
|
-
* await storage.initialize();
|
|
68
|
-
* await storage.set('abc123', manifest);
|
|
69
|
-
* const cached = await storage.get('abc123');
|
|
70
|
-
* ```
|
|
71
|
-
*/
|
|
72
|
-
export declare class FilesystemStorage implements BuildCacheStorage {
|
|
73
|
-
readonly type = "filesystem";
|
|
74
|
-
private readonly options;
|
|
75
|
-
private initialized;
|
|
76
|
-
private stats;
|
|
77
|
-
constructor(options?: FilesystemStorageOptions);
|
|
78
|
-
/**
|
|
79
|
-
* Initialize the storage directory.
|
|
80
|
-
*/
|
|
81
|
-
initialize(): Promise<void>;
|
|
82
|
-
/**
|
|
83
|
-
* Get a cached manifest.
|
|
84
|
-
*/
|
|
85
|
-
get(key: string): Promise<ComponentBuildManifest | undefined>;
|
|
86
|
-
/**
|
|
87
|
-
* Store a manifest in cache.
|
|
88
|
-
*/
|
|
89
|
-
set(key: string, manifest: ComponentBuildManifest, ttl?: number): Promise<void>;
|
|
90
|
-
/**
|
|
91
|
-
* Check if a key exists.
|
|
92
|
-
*/
|
|
93
|
-
has(key: string): Promise<boolean>;
|
|
94
|
-
/**
|
|
95
|
-
* Delete a cached entry.
|
|
96
|
-
*/
|
|
97
|
-
delete(key: string): Promise<boolean>;
|
|
98
|
-
/**
|
|
99
|
-
* Clear all cached entries.
|
|
100
|
-
*/
|
|
101
|
-
clear(): Promise<void>;
|
|
102
|
-
/**
|
|
103
|
-
* Get cache statistics.
|
|
104
|
-
*/
|
|
105
|
-
getStats(): Promise<CacheStats>;
|
|
106
|
-
/**
|
|
107
|
-
* Clean up expired entries.
|
|
108
|
-
*/
|
|
109
|
-
cleanup(): Promise<number>;
|
|
110
|
-
/**
|
|
111
|
-
* Close the storage (no-op for filesystem).
|
|
112
|
-
*/
|
|
113
|
-
close(): Promise<void>;
|
|
114
|
-
/**
|
|
115
|
-
* Get the file path for a cache key.
|
|
116
|
-
* Uses SHA-256 hash to avoid collisions from key sanitization.
|
|
117
|
-
*/
|
|
118
|
-
private getFilePath;
|
|
119
|
-
/**
|
|
120
|
-
* Write a cache entry to disk.
|
|
121
|
-
*/
|
|
122
|
-
private writeEntry;
|
|
123
|
-
/**
|
|
124
|
-
* Ensure the storage is initialized.
|
|
125
|
-
*/
|
|
126
|
-
private ensureInitialized;
|
|
127
|
-
/**
|
|
128
|
-
* Load stats from existing cache files.
|
|
129
|
-
* Reads entry metadata to get accurate manifest sizes.
|
|
130
|
-
*/
|
|
131
|
-
private loadStats;
|
|
132
|
-
/**
|
|
133
|
-
* Ensure there's capacity for a new entry.
|
|
134
|
-
*/
|
|
135
|
-
private ensureCapacity;
|
|
136
|
-
/**
|
|
137
|
-
* Evict the least recently used entry.
|
|
138
|
-
*/
|
|
139
|
-
private evictLRU;
|
|
140
|
-
/**
|
|
141
|
-
* Update hit rate statistic.
|
|
142
|
-
*/
|
|
143
|
-
private updateHitRate;
|
|
144
|
-
}
|
|
145
|
-
/**
|
|
146
|
-
* Create a filesystem storage instance.
|
|
147
|
-
*/
|
|
148
|
-
export declare function createFilesystemStorage(options?: FilesystemStorageOptions): FilesystemStorage;
|
|
149
|
-
//# sourceMappingURL=filesystem.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"filesystem.d.ts","sourceRoot":"","sources":["../../../../src/bundler/file-cache/storage/filesystem.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAOH,OAAO,KAAK,EAAE,sBAAsB,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACtF,OAAO,KAAK,EAAE,iBAAiB,EAAE,cAAc,EAAc,MAAM,aAAa,CAAC;AAOjF;;GAEG;AACH,qBAAa,wBAAyB,SAAQ,KAAK;IACjD,SAAkB,KAAK,CAAC,EAAE,OAAO,CAAC;gBAEtB,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO;CAK7C;AAED;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,KAAK;IAC5C,SAAkB,KAAK,CAAC,EAAE,OAAO,CAAC;gBAEtB,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO;CAK7C;AAED;;GAEG;AACH,qBAAa,0BAA2B,SAAQ,KAAK;;CAKpD;AAED;;GAEG;AACH,MAAM,WAAW,wBAAyB,SAAQ,cAAc;IAC9D;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAWD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,qBAAa,iBAAkB,YAAW,iBAAiB;IACzD,QAAQ,CAAC,IAAI,gBAAgB;IAE7B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAqC;IAC7D,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,KAAK,CAMX;gBAEU,OAAO,GAAE,wBAA6B;IAOlD;;OAEG;IACG,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAYjC;;OAEG;IACG,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,sBAAsB,GAAG,SAAS,CAAC;IA6CnE;;OAEG;IACG,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,sBAAsB,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IA4BrF;;OAEG;IACG,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAuBxC;;OAEG;IACG,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAuB3C;;OAEG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAmB5B;;OAEG;IACG,QAAQ,IAAI,OAAO,CAAC,UAAU,CAAC;IAIrC;;OAEG;IACG,OAAO,IAAI,OAAO,CAAC,MAAM,CAAC;IAoChC;;OAEG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAI5B;;;OAGG;IACH,OAAO,CAAC,WAAW;IAMnB;;OAEG;YACW,UAAU;IAKxB;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAMzB;;;OAGG;YACW,SAAS;IA4BvB;;OAEG;YACW,cAAc;IAa5B;;OAEG;YACW,QAAQ;IAgDtB;;OAEG;IACH,OAAO,CAAC,aAAa;CAItB;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,CAAC,EAAE,wBAAwB,GAAG,iBAAiB,CAE7F"}
|