@frontmcp/uipack 0.6.2 → 0.6.3
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/build/builders/base-builder.d.ts +2 -0
- package/build/builders/base-builder.d.ts.map +1 -1
- package/build/index.js +20 -6
- package/bundler/file-cache/component-builder.d.ts.map +1 -1
- package/bundler/index.js +5 -2
- package/esm/build/index.mjs +20 -6
- package/esm/bundler/index.mjs +6 -3
- package/esm/index.mjs +29 -10
- package/esm/package.json +14 -16
- package/esm/registry/index.mjs +4 -1
- package/esm/renderers/index.mjs +4 -1
- package/index.js +29 -10
- package/package.json +1 -1
- package/registry/index.js +4 -1
- package/renderers/index.js +4 -1
- package/renderers/utils/transpiler.d.ts.map +1 -1
|
@@ -46,10 +46,12 @@ export declare abstract class BaseBuilder {
|
|
|
46
46
|
protected detectTemplate<In = unknown, Out = unknown>(template: UITemplateConfig<In, Out>['template']): TemplateDetection;
|
|
47
47
|
/**
|
|
48
48
|
* Transpile a component using esbuild.
|
|
49
|
+
* Uses dynamic import to avoid loading esbuild at module load time.
|
|
49
50
|
*
|
|
50
51
|
* @param source - Source code to transpile
|
|
51
52
|
* @param options - Transpile options
|
|
52
53
|
* @returns Transpile result
|
|
54
|
+
* @throws Error if esbuild is not installed and transpilation is attempted
|
|
53
55
|
*/
|
|
54
56
|
protected transpile(source: string, options?: TranspileOptions): Promise<TranspileResult>;
|
|
55
57
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-builder.d.ts","sourceRoot":"","sources":["../../../src/build/builders/base-builder.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;
|
|
1
|
+
{"version":3,"file":"base-builder.d.ts","sourceRoot":"","sources":["../../../src/build/builders/base-builder.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EACV,cAAc,EACd,OAAO,EACP,iBAAiB,EACjB,gBAAgB,EAChB,eAAe,EAChB,MAAM,SA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AE,MAAM,CAAC;KACvB,GAAG,MAAM;IAsDV;;;;;OAKG;IACH,SAAS,CAAC,wBAAwB,CAAC,OAAO,EAAE;QAC1C,QAAQ,EAAE,MAAM,CAAC;QACjB,KAAK,CAAC,EAAE,OAAO,CAAC;QAChB,MAAM,CAAC,EAAE,OAAO,CAAC;QACjB,eAAe,CAAC,EAAE,OAAO,CAAC;KAC3B,GAAG,MAAM;IAwBV;;;;;OAKG;IACH,SAAS,CAAC,kBAAkB,CAAC,OAAO,EAAE;QACpC,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,GAAG,MAAM;IAgBV;;;;;OAKG;cACa,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAmB/D;;;;;OAKG;IACH,SAAS,CAAC,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;IAKnD;;;;;;OAMG;IACH,SAAS,CAAC,aAAa,CAAC,EAAE,GAAG,OAAO,EAAE,GAAG,GAAG,OAAO,EACjD,KAAK,EAAE,EAAE,EACT,MAAM,EAAE,GAAG,GACV,eAAe,CAAC,EAAE,EAAE,GAAG,CAAC;CAgC5B"}
|
package/build/index.js
CHANGED
|
@@ -2541,7 +2541,7 @@ var init_component_builder = __esm({
|
|
|
2541
2541
|
} = options;
|
|
2542
2542
|
const absoluteEntryPath = (0, import_path4.resolve)(entryPath);
|
|
2543
2543
|
if (!(0, import_fs4.existsSync)(absoluteEntryPath)) {
|
|
2544
|
-
throw new Error(`Entry file not found: ${absoluteEntryPath}`);
|
|
2544
|
+
throw new Error(`Entry file not found: ${(0, import_path4.basename)(absoluteEntryPath)}`);
|
|
2545
2545
|
}
|
|
2546
2546
|
const hashResult = await calculateComponentHash({
|
|
2547
2547
|
entryPath: absoluteEntryPath,
|
|
@@ -2715,7 +2715,10 @@ var init_component_builder = __esm({
|
|
|
2715
2715
|
bundlerVersion: this.esbuild.version
|
|
2716
2716
|
};
|
|
2717
2717
|
} catch (error) {
|
|
2718
|
-
|
|
2718
|
+
const fileName = (0, import_path4.basename)(entryPath);
|
|
2719
|
+
const rawMessage = error instanceof Error ? error.message : String(error);
|
|
2720
|
+
const sanitizedMessage = rawMessage.replace(/(?:\/[\w./-]+|[A-Z]:\\[\w.\\-]+)/g, (match) => (0, import_path4.basename)(match));
|
|
2721
|
+
throw new Error(`Bundle failed for ${fileName}: ${sanitizedMessage}`);
|
|
2719
2722
|
}
|
|
2720
2723
|
}
|
|
2721
2724
|
/**
|
|
@@ -7196,9 +7199,6 @@ function minifyScript(script) {
|
|
|
7196
7199
|
return script.replace(/\/\*[\s\S]*?\*\//g, "").replace(/^\s*\/\/[^\n]*$/gm, "").replace(/\n\s*\n/g, "\n").replace(/^\s+/gm, "").trim();
|
|
7197
7200
|
}
|
|
7198
7201
|
|
|
7199
|
-
// libs/uipack/src/build/builders/base-builder.ts
|
|
7200
|
-
var import_esbuild = require("esbuild");
|
|
7201
|
-
|
|
7202
7202
|
// libs/uipack/src/build/builders/esbuild-config.ts
|
|
7203
7203
|
var DEFAULT_EXTERNALS = [
|
|
7204
7204
|
"react",
|
|
@@ -7393,15 +7393,29 @@ var BaseBuilder = class {
|
|
|
7393
7393
|
// ============================================
|
|
7394
7394
|
/**
|
|
7395
7395
|
* Transpile a component using esbuild.
|
|
7396
|
+
* Uses dynamic import to avoid loading esbuild at module load time.
|
|
7396
7397
|
*
|
|
7397
7398
|
* @param source - Source code to transpile
|
|
7398
7399
|
* @param options - Transpile options
|
|
7399
7400
|
* @returns Transpile result
|
|
7401
|
+
* @throws Error if esbuild is not installed and transpilation is attempted
|
|
7400
7402
|
*/
|
|
7401
7403
|
async transpile(source, options = {}) {
|
|
7404
|
+
let transform;
|
|
7405
|
+
try {
|
|
7406
|
+
const esbuild = await import(
|
|
7407
|
+
/* webpackIgnore: true */
|
|
7408
|
+
"esbuild"
|
|
7409
|
+
);
|
|
7410
|
+
transform = esbuild.transform;
|
|
7411
|
+
} catch {
|
|
7412
|
+
throw new Error(
|
|
7413
|
+
"esbuild is required for UI component transpilation but is not installed. If you are not using UI components, you can ignore this error. To fix, install esbuild: npm install esbuild"
|
|
7414
|
+
);
|
|
7415
|
+
}
|
|
7402
7416
|
const externals = options.externals || DEFAULT_EXTERNALS;
|
|
7403
7417
|
const config = options.externals ? createExternalizedConfig(options) : createTransformConfig(options);
|
|
7404
|
-
const result = await
|
|
7418
|
+
const result = await transform(source, config);
|
|
7405
7419
|
return {
|
|
7406
7420
|
code: result.code,
|
|
7407
7421
|
map: result.map,
|
|
@@ -1 +1 @@
|
|
|
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,EAEhB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAa7D;;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;
|
|
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,EAEhB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAa7D;;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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AI,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;IAkD7B;;OAEG;YACW,SAAS;CA0DxB;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"}
|
package/bundler/index.js
CHANGED
|
@@ -2681,7 +2681,7 @@ var ComponentBuilder = class {
|
|
|
2681
2681
|
} = options;
|
|
2682
2682
|
const absoluteEntryPath = (0, import_path3.resolve)(entryPath);
|
|
2683
2683
|
if (!(0, import_fs3.existsSync)(absoluteEntryPath)) {
|
|
2684
|
-
throw new Error(`Entry file not found: ${absoluteEntryPath}`);
|
|
2684
|
+
throw new Error(`Entry file not found: ${(0, import_path3.basename)(absoluteEntryPath)}`);
|
|
2685
2685
|
}
|
|
2686
2686
|
const hashResult = await calculateComponentHash({
|
|
2687
2687
|
entryPath: absoluteEntryPath,
|
|
@@ -2855,7 +2855,10 @@ var ComponentBuilder = class {
|
|
|
2855
2855
|
bundlerVersion: this.esbuild.version
|
|
2856
2856
|
};
|
|
2857
2857
|
} catch (error) {
|
|
2858
|
-
|
|
2858
|
+
const fileName = (0, import_path3.basename)(entryPath);
|
|
2859
|
+
const rawMessage = error instanceof Error ? error.message : String(error);
|
|
2860
|
+
const sanitizedMessage = rawMessage.replace(/(?:\/[\w./-]+|[A-Z]:\\[\w.\\-]+)/g, (match) => (0, import_path3.basename)(match));
|
|
2861
|
+
throw new Error(`Bundle failed for ${fileName}: ${sanitizedMessage}`);
|
|
2859
2862
|
}
|
|
2860
2863
|
}
|
|
2861
2864
|
/**
|
package/esm/build/index.mjs
CHANGED
|
@@ -2469,7 +2469,7 @@ __export(component_builder_exports, {
|
|
|
2469
2469
|
});
|
|
2470
2470
|
import { readFile as readFile3 } from "fs/promises";
|
|
2471
2471
|
import { existsSync as existsSync3 } from "fs";
|
|
2472
|
-
import { resolve as resolve2, extname } from "path";
|
|
2472
|
+
import { resolve as resolve2, extname, basename } from "path";
|
|
2473
2473
|
import { randomUUID } from "crypto";
|
|
2474
2474
|
async function createFilesystemBuilder(cacheDir = ".frontmcp-cache/builds") {
|
|
2475
2475
|
const { FilesystemStorage: FilesystemStorage2 } = await Promise.resolve().then(() => (init_filesystem(), filesystem_exports));
|
|
@@ -2518,7 +2518,7 @@ var init_component_builder = __esm({
|
|
|
2518
2518
|
} = options;
|
|
2519
2519
|
const absoluteEntryPath = resolve2(entryPath);
|
|
2520
2520
|
if (!existsSync3(absoluteEntryPath)) {
|
|
2521
|
-
throw new Error(`Entry file not found: ${absoluteEntryPath}`);
|
|
2521
|
+
throw new Error(`Entry file not found: ${basename(absoluteEntryPath)}`);
|
|
2522
2522
|
}
|
|
2523
2523
|
const hashResult = await calculateComponentHash({
|
|
2524
2524
|
entryPath: absoluteEntryPath,
|
|
@@ -2692,7 +2692,10 @@ var init_component_builder = __esm({
|
|
|
2692
2692
|
bundlerVersion: this.esbuild.version
|
|
2693
2693
|
};
|
|
2694
2694
|
} catch (error) {
|
|
2695
|
-
|
|
2695
|
+
const fileName = basename(entryPath);
|
|
2696
|
+
const rawMessage = error instanceof Error ? error.message : String(error);
|
|
2697
|
+
const sanitizedMessage = rawMessage.replace(/(?:\/[\w./-]+|[A-Z]:\\[\w.\\-]+)/g, (match) => basename(match));
|
|
2698
|
+
throw new Error(`Bundle failed for ${fileName}: ${sanitizedMessage}`);
|
|
2696
2699
|
}
|
|
2697
2700
|
}
|
|
2698
2701
|
/**
|
|
@@ -7093,9 +7096,6 @@ function minifyScript(script) {
|
|
|
7093
7096
|
return script.replace(/\/\*[\s\S]*?\*\//g, "").replace(/^\s*\/\/[^\n]*$/gm, "").replace(/\n\s*\n/g, "\n").replace(/^\s+/gm, "").trim();
|
|
7094
7097
|
}
|
|
7095
7098
|
|
|
7096
|
-
// libs/uipack/src/build/builders/base-builder.ts
|
|
7097
|
-
import { transform } from "esbuild";
|
|
7098
|
-
|
|
7099
7099
|
// libs/uipack/src/build/builders/esbuild-config.ts
|
|
7100
7100
|
var DEFAULT_EXTERNALS = [
|
|
7101
7101
|
"react",
|
|
@@ -7290,12 +7290,26 @@ var BaseBuilder = class {
|
|
|
7290
7290
|
// ============================================
|
|
7291
7291
|
/**
|
|
7292
7292
|
* Transpile a component using esbuild.
|
|
7293
|
+
* Uses dynamic import to avoid loading esbuild at module load time.
|
|
7293
7294
|
*
|
|
7294
7295
|
* @param source - Source code to transpile
|
|
7295
7296
|
* @param options - Transpile options
|
|
7296
7297
|
* @returns Transpile result
|
|
7298
|
+
* @throws Error if esbuild is not installed and transpilation is attempted
|
|
7297
7299
|
*/
|
|
7298
7300
|
async transpile(source, options = {}) {
|
|
7301
|
+
let transform;
|
|
7302
|
+
try {
|
|
7303
|
+
const esbuild = await import(
|
|
7304
|
+
/* webpackIgnore: true */
|
|
7305
|
+
"esbuild"
|
|
7306
|
+
);
|
|
7307
|
+
transform = esbuild.transform;
|
|
7308
|
+
} catch {
|
|
7309
|
+
throw new Error(
|
|
7310
|
+
"esbuild is required for UI component transpilation but is not installed. If you are not using UI components, you can ignore this error. To fix, install esbuild: npm install esbuild"
|
|
7311
|
+
);
|
|
7312
|
+
}
|
|
7299
7313
|
const externals = options.externals || DEFAULT_EXTERNALS;
|
|
7300
7314
|
const config = options.externals ? createExternalizedConfig(options) : createTransformConfig(options);
|
|
7301
7315
|
const result = await transform(source, config);
|
package/esm/bundler/index.mjs
CHANGED
|
@@ -1546,7 +1546,7 @@ function buildIdFromHash(hash) {
|
|
|
1546
1546
|
// libs/uipack/src/bundler/file-cache/component-builder.ts
|
|
1547
1547
|
import { readFile as readFile3 } from "fs/promises";
|
|
1548
1548
|
import { existsSync as existsSync3 } from "fs";
|
|
1549
|
-
import { resolve as resolve2, extname } from "path";
|
|
1549
|
+
import { resolve as resolve2, extname, basename } from "path";
|
|
1550
1550
|
import { randomUUID } from "crypto";
|
|
1551
1551
|
|
|
1552
1552
|
// libs/uipack/src/dependency/cdn-registry.ts
|
|
@@ -2617,7 +2617,7 @@ var ComponentBuilder = class {
|
|
|
2617
2617
|
} = options;
|
|
2618
2618
|
const absoluteEntryPath = resolve2(entryPath);
|
|
2619
2619
|
if (!existsSync3(absoluteEntryPath)) {
|
|
2620
|
-
throw new Error(`Entry file not found: ${absoluteEntryPath}`);
|
|
2620
|
+
throw new Error(`Entry file not found: ${basename(absoluteEntryPath)}`);
|
|
2621
2621
|
}
|
|
2622
2622
|
const hashResult = await calculateComponentHash({
|
|
2623
2623
|
entryPath: absoluteEntryPath,
|
|
@@ -2791,7 +2791,10 @@ var ComponentBuilder = class {
|
|
|
2791
2791
|
bundlerVersion: this.esbuild.version
|
|
2792
2792
|
};
|
|
2793
2793
|
} catch (error) {
|
|
2794
|
-
|
|
2794
|
+
const fileName = basename(entryPath);
|
|
2795
|
+
const rawMessage = error instanceof Error ? error.message : String(error);
|
|
2796
|
+
const sanitizedMessage = rawMessage.replace(/(?:\/[\w./-]+|[A-Z]:\\[\w.\\-]+)/g, (match) => basename(match));
|
|
2797
|
+
throw new Error(`Bundle failed for ${fileName}: ${sanitizedMessage}`);
|
|
2795
2798
|
}
|
|
2796
2799
|
}
|
|
2797
2800
|
/**
|
package/esm/index.mjs
CHANGED
|
@@ -2283,7 +2283,10 @@ async function loadSwcTransform() {
|
|
|
2283
2283
|
return swcTransform;
|
|
2284
2284
|
}
|
|
2285
2285
|
try {
|
|
2286
|
-
const swc = await import(
|
|
2286
|
+
const swc = await import(
|
|
2287
|
+
/* webpackIgnore: true */
|
|
2288
|
+
"@swc/core"
|
|
2289
|
+
);
|
|
2287
2290
|
swcTransform = swc.transform;
|
|
2288
2291
|
return swcTransform;
|
|
2289
2292
|
} catch {
|
|
@@ -2299,8 +2302,8 @@ async function transpileJsx(source, options = {}) {
|
|
|
2299
2302
|
if (cached) {
|
|
2300
2303
|
return { ...cached, cached: true };
|
|
2301
2304
|
}
|
|
2302
|
-
const
|
|
2303
|
-
if (!
|
|
2305
|
+
const transform = await loadSwcTransform();
|
|
2306
|
+
if (!transform) {
|
|
2304
2307
|
throw new Error(
|
|
2305
2308
|
"Runtime JSX transpilation requires @swc/core. Either install @swc/core or use pre-compiled React components."
|
|
2306
2309
|
);
|
|
@@ -2325,7 +2328,7 @@ async function transpileJsx(source, options = {}) {
|
|
|
2325
2328
|
type: "commonjs"
|
|
2326
2329
|
}
|
|
2327
2330
|
};
|
|
2328
|
-
const result = await
|
|
2331
|
+
const result = await transform(source, swcOptions);
|
|
2329
2332
|
const transpileResult = {
|
|
2330
2333
|
code: result.code,
|
|
2331
2334
|
hash,
|
|
@@ -2335,8 +2338,8 @@ async function transpileJsx(source, options = {}) {
|
|
|
2335
2338
|
return transpileResult;
|
|
2336
2339
|
}
|
|
2337
2340
|
async function isSwcAvailable() {
|
|
2338
|
-
const
|
|
2339
|
-
return
|
|
2341
|
+
const transform = await loadSwcTransform();
|
|
2342
|
+
return transform !== null;
|
|
2340
2343
|
}
|
|
2341
2344
|
async function executeTranspiledCode(_code, _context = {}) {
|
|
2342
2345
|
throw new Error(
|
|
@@ -4291,7 +4294,7 @@ var init_redis = __esm({
|
|
|
4291
4294
|
// libs/uipack/src/bundler/file-cache/component-builder.ts
|
|
4292
4295
|
import { readFile as readFile3 } from "fs/promises";
|
|
4293
4296
|
import { existsSync as existsSync3 } from "fs";
|
|
4294
|
-
import { resolve as resolve2, extname } from "path";
|
|
4297
|
+
import { resolve as resolve2, extname, basename } from "path";
|
|
4295
4298
|
import { randomUUID } from "crypto";
|
|
4296
4299
|
async function createFilesystemBuilder(cacheDir = ".frontmcp-cache/builds") {
|
|
4297
4300
|
const { FilesystemStorage: FilesystemStorage2 } = await Promise.resolve().then(() => (init_filesystem(), filesystem_exports));
|
|
@@ -4340,7 +4343,7 @@ var init_component_builder = __esm({
|
|
|
4340
4343
|
} = options;
|
|
4341
4344
|
const absoluteEntryPath = resolve2(entryPath);
|
|
4342
4345
|
if (!existsSync3(absoluteEntryPath)) {
|
|
4343
|
-
throw new Error(`Entry file not found: ${absoluteEntryPath}`);
|
|
4346
|
+
throw new Error(`Entry file not found: ${basename(absoluteEntryPath)}`);
|
|
4344
4347
|
}
|
|
4345
4348
|
const hashResult = await calculateComponentHash({
|
|
4346
4349
|
entryPath: absoluteEntryPath,
|
|
@@ -4514,7 +4517,10 @@ var init_component_builder = __esm({
|
|
|
4514
4517
|
bundlerVersion: this.esbuild.version
|
|
4515
4518
|
};
|
|
4516
4519
|
} catch (error) {
|
|
4517
|
-
|
|
4520
|
+
const fileName = basename(entryPath);
|
|
4521
|
+
const rawMessage = error instanceof Error ? error.message : String(error);
|
|
4522
|
+
const sanitizedMessage = rawMessage.replace(/(?:\/[\w./-]+|[A-Z]:\\[\w.\\-]+)/g, (match) => basename(match));
|
|
4523
|
+
throw new Error(`Bundle failed for ${fileName}: ${sanitizedMessage}`);
|
|
4518
4524
|
}
|
|
4519
4525
|
}
|
|
4520
4526
|
/**
|
|
@@ -9472,7 +9478,6 @@ function cn(...classes) {
|
|
|
9472
9478
|
|
|
9473
9479
|
// libs/uipack/src/build/builders/base-builder.ts
|
|
9474
9480
|
init_theme2();
|
|
9475
|
-
import { transform } from "esbuild";
|
|
9476
9481
|
|
|
9477
9482
|
// libs/uipack/src/build/builders/esbuild-config.ts
|
|
9478
9483
|
var DEFAULT_EXTERNALS = [
|
|
@@ -9661,12 +9666,26 @@ var BaseBuilder = class {
|
|
|
9661
9666
|
// ============================================
|
|
9662
9667
|
/**
|
|
9663
9668
|
* Transpile a component using esbuild.
|
|
9669
|
+
* Uses dynamic import to avoid loading esbuild at module load time.
|
|
9664
9670
|
*
|
|
9665
9671
|
* @param source - Source code to transpile
|
|
9666
9672
|
* @param options - Transpile options
|
|
9667
9673
|
* @returns Transpile result
|
|
9674
|
+
* @throws Error if esbuild is not installed and transpilation is attempted
|
|
9668
9675
|
*/
|
|
9669
9676
|
async transpile(source, options = {}) {
|
|
9677
|
+
let transform;
|
|
9678
|
+
try {
|
|
9679
|
+
const esbuild = await import(
|
|
9680
|
+
/* webpackIgnore: true */
|
|
9681
|
+
"esbuild"
|
|
9682
|
+
);
|
|
9683
|
+
transform = esbuild.transform;
|
|
9684
|
+
} catch {
|
|
9685
|
+
throw new Error(
|
|
9686
|
+
"esbuild is required for UI component transpilation but is not installed. If you are not using UI components, you can ignore this error. To fix, install esbuild: npm install esbuild"
|
|
9687
|
+
);
|
|
9688
|
+
}
|
|
9670
9689
|
const externals = options.externals || DEFAULT_EXTERNALS;
|
|
9671
9690
|
const config = options.externals ? createExternalizedConfig(options) : createTransformConfig(options);
|
|
9672
9691
|
const result = await transform(source, config);
|
package/esm/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@frontmcp/uipack",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.3",
|
|
4
4
|
"description": "FrontMCP UIpack - Bundling, build tools, and platform adapters for MCP UI development (React-free core)",
|
|
5
5
|
"author": "AgentFront <info@agentfront.dev>",
|
|
6
6
|
"homepage": "https://docs.agentfront.dev",
|
|
@@ -25,33 +25,31 @@
|
|
|
25
25
|
"bugs": {
|
|
26
26
|
"url": "https://github.com/agentfront/frontmcp/issues"
|
|
27
27
|
},
|
|
28
|
-
"type": "
|
|
29
|
-
"main": "
|
|
30
|
-
"module": "./
|
|
31
|
-
"types": "
|
|
28
|
+
"type": "module",
|
|
29
|
+
"main": "../index.js",
|
|
30
|
+
"module": "./index.mjs",
|
|
31
|
+
"types": "../index.d.ts",
|
|
32
32
|
"sideEffects": false,
|
|
33
33
|
"exports": {
|
|
34
|
-
"./package.json": "
|
|
34
|
+
"./package.json": "../package.json",
|
|
35
35
|
".": {
|
|
36
|
-
"development": "./src/index.ts",
|
|
37
36
|
"require": {
|
|
38
|
-
"types": "
|
|
39
|
-
"default": "
|
|
37
|
+
"types": "../index.d.ts",
|
|
38
|
+
"default": "../index.js"
|
|
40
39
|
},
|
|
41
40
|
"import": {
|
|
42
|
-
"types": "
|
|
43
|
-
"default": "./
|
|
41
|
+
"types": "../index.d.ts",
|
|
42
|
+
"default": "./index.mjs"
|
|
44
43
|
}
|
|
45
44
|
},
|
|
46
45
|
"./*": {
|
|
47
|
-
"development": "./src/*/index.ts",
|
|
48
46
|
"require": {
|
|
49
|
-
"types": "
|
|
50
|
-
"default": "
|
|
47
|
+
"types": "../*/index.d.ts",
|
|
48
|
+
"default": "../*/index.js"
|
|
51
49
|
},
|
|
52
50
|
"import": {
|
|
53
|
-
"types": "
|
|
54
|
-
"default": "
|
|
51
|
+
"types": "../*/index.d.ts",
|
|
52
|
+
"default": "./*/index.mjs"
|
|
55
53
|
}
|
|
56
54
|
},
|
|
57
55
|
"./esm": null
|
package/esm/registry/index.mjs
CHANGED
|
@@ -2009,7 +2009,10 @@ async function loadSwcTransform() {
|
|
|
2009
2009
|
return swcTransform;
|
|
2010
2010
|
}
|
|
2011
2011
|
try {
|
|
2012
|
-
const swc = await import(
|
|
2012
|
+
const swc = await import(
|
|
2013
|
+
/* webpackIgnore: true */
|
|
2014
|
+
"@swc/core"
|
|
2015
|
+
);
|
|
2013
2016
|
swcTransform = swc.transform;
|
|
2014
2017
|
return swcTransform;
|
|
2015
2018
|
} catch {
|
package/esm/renderers/index.mjs
CHANGED
|
@@ -1468,7 +1468,10 @@ async function loadSwcTransform() {
|
|
|
1468
1468
|
return swcTransform;
|
|
1469
1469
|
}
|
|
1470
1470
|
try {
|
|
1471
|
-
const swc = await import(
|
|
1471
|
+
const swc = await import(
|
|
1472
|
+
/* webpackIgnore: true */
|
|
1473
|
+
"@swc/core"
|
|
1474
|
+
);
|
|
1472
1475
|
swcTransform = swc.transform;
|
|
1473
1476
|
return swcTransform;
|
|
1474
1477
|
} catch {
|
package/index.js
CHANGED
|
@@ -2305,7 +2305,10 @@ async function loadSwcTransform() {
|
|
|
2305
2305
|
return swcTransform;
|
|
2306
2306
|
}
|
|
2307
2307
|
try {
|
|
2308
|
-
const swc = await import(
|
|
2308
|
+
const swc = await import(
|
|
2309
|
+
/* webpackIgnore: true */
|
|
2310
|
+
"@swc/core"
|
|
2311
|
+
);
|
|
2309
2312
|
swcTransform = swc.transform;
|
|
2310
2313
|
return swcTransform;
|
|
2311
2314
|
} catch {
|
|
@@ -2321,8 +2324,8 @@ async function transpileJsx(source, options = {}) {
|
|
|
2321
2324
|
if (cached) {
|
|
2322
2325
|
return { ...cached, cached: true };
|
|
2323
2326
|
}
|
|
2324
|
-
const
|
|
2325
|
-
if (!
|
|
2327
|
+
const transform = await loadSwcTransform();
|
|
2328
|
+
if (!transform) {
|
|
2326
2329
|
throw new Error(
|
|
2327
2330
|
"Runtime JSX transpilation requires @swc/core. Either install @swc/core or use pre-compiled React components."
|
|
2328
2331
|
);
|
|
@@ -2347,7 +2350,7 @@ async function transpileJsx(source, options = {}) {
|
|
|
2347
2350
|
type: "commonjs"
|
|
2348
2351
|
}
|
|
2349
2352
|
};
|
|
2350
|
-
const result = await
|
|
2353
|
+
const result = await transform(source, swcOptions);
|
|
2351
2354
|
const transpileResult = {
|
|
2352
2355
|
code: result.code,
|
|
2353
2356
|
hash,
|
|
@@ -2357,8 +2360,8 @@ async function transpileJsx(source, options = {}) {
|
|
|
2357
2360
|
return transpileResult;
|
|
2358
2361
|
}
|
|
2359
2362
|
async function isSwcAvailable() {
|
|
2360
|
-
const
|
|
2361
|
-
return
|
|
2363
|
+
const transform = await loadSwcTransform();
|
|
2364
|
+
return transform !== null;
|
|
2362
2365
|
}
|
|
2363
2366
|
async function executeTranspiledCode(_code, _context = {}) {
|
|
2364
2367
|
throw new Error(
|
|
@@ -4363,7 +4366,7 @@ var init_component_builder = __esm({
|
|
|
4363
4366
|
} = options;
|
|
4364
4367
|
const absoluteEntryPath = (0, import_path4.resolve)(entryPath);
|
|
4365
4368
|
if (!(0, import_fs4.existsSync)(absoluteEntryPath)) {
|
|
4366
|
-
throw new Error(`Entry file not found: ${absoluteEntryPath}`);
|
|
4369
|
+
throw new Error(`Entry file not found: ${(0, import_path4.basename)(absoluteEntryPath)}`);
|
|
4367
4370
|
}
|
|
4368
4371
|
const hashResult = await calculateComponentHash({
|
|
4369
4372
|
entryPath: absoluteEntryPath,
|
|
@@ -4537,7 +4540,10 @@ var init_component_builder = __esm({
|
|
|
4537
4540
|
bundlerVersion: this.esbuild.version
|
|
4538
4541
|
};
|
|
4539
4542
|
} catch (error) {
|
|
4540
|
-
|
|
4543
|
+
const fileName = (0, import_path4.basename)(entryPath);
|
|
4544
|
+
const rawMessage = error instanceof Error ? error.message : String(error);
|
|
4545
|
+
const sanitizedMessage = rawMessage.replace(/(?:\/[\w./-]+|[A-Z]:\\[\w.\\-]+)/g, (match) => (0, import_path4.basename)(match));
|
|
4546
|
+
throw new Error(`Bundle failed for ${fileName}: ${sanitizedMessage}`);
|
|
4541
4547
|
}
|
|
4542
4548
|
}
|
|
4543
4549
|
/**
|
|
@@ -9743,7 +9749,6 @@ function cn(...classes) {
|
|
|
9743
9749
|
}
|
|
9744
9750
|
|
|
9745
9751
|
// libs/uipack/src/build/builders/base-builder.ts
|
|
9746
|
-
var import_esbuild = require("esbuild");
|
|
9747
9752
|
init_theme2();
|
|
9748
9753
|
|
|
9749
9754
|
// libs/uipack/src/build/builders/esbuild-config.ts
|
|
@@ -9933,15 +9938,29 @@ var BaseBuilder = class {
|
|
|
9933
9938
|
// ============================================
|
|
9934
9939
|
/**
|
|
9935
9940
|
* Transpile a component using esbuild.
|
|
9941
|
+
* Uses dynamic import to avoid loading esbuild at module load time.
|
|
9936
9942
|
*
|
|
9937
9943
|
* @param source - Source code to transpile
|
|
9938
9944
|
* @param options - Transpile options
|
|
9939
9945
|
* @returns Transpile result
|
|
9946
|
+
* @throws Error if esbuild is not installed and transpilation is attempted
|
|
9940
9947
|
*/
|
|
9941
9948
|
async transpile(source, options = {}) {
|
|
9949
|
+
let transform;
|
|
9950
|
+
try {
|
|
9951
|
+
const esbuild = await import(
|
|
9952
|
+
/* webpackIgnore: true */
|
|
9953
|
+
"esbuild"
|
|
9954
|
+
);
|
|
9955
|
+
transform = esbuild.transform;
|
|
9956
|
+
} catch {
|
|
9957
|
+
throw new Error(
|
|
9958
|
+
"esbuild is required for UI component transpilation but is not installed. If you are not using UI components, you can ignore this error. To fix, install esbuild: npm install esbuild"
|
|
9959
|
+
);
|
|
9960
|
+
}
|
|
9942
9961
|
const externals = options.externals || DEFAULT_EXTERNALS;
|
|
9943
9962
|
const config = options.externals ? createExternalizedConfig(options) : createTransformConfig(options);
|
|
9944
|
-
const result = await
|
|
9963
|
+
const result = await transform(source, config);
|
|
9945
9964
|
return {
|
|
9946
9965
|
code: result.code,
|
|
9947
9966
|
map: result.map,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@frontmcp/uipack",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.3",
|
|
4
4
|
"description": "FrontMCP UIpack - Bundling, build tools, and platform adapters for MCP UI development (React-free core)",
|
|
5
5
|
"author": "AgentFront <info@agentfront.dev>",
|
|
6
6
|
"homepage": "https://docs.agentfront.dev",
|
package/registry/index.js
CHANGED
|
@@ -2031,7 +2031,10 @@ async function loadSwcTransform() {
|
|
|
2031
2031
|
return swcTransform;
|
|
2032
2032
|
}
|
|
2033
2033
|
try {
|
|
2034
|
-
const swc = await import(
|
|
2034
|
+
const swc = await import(
|
|
2035
|
+
/* webpackIgnore: true */
|
|
2036
|
+
"@swc/core"
|
|
2037
|
+
);
|
|
2035
2038
|
swcTransform = swc.transform;
|
|
2036
2039
|
return swcTransform;
|
|
2037
2040
|
} catch {
|
package/renderers/index.js
CHANGED
|
@@ -1519,7 +1519,10 @@ async function loadSwcTransform() {
|
|
|
1519
1519
|
return swcTransform;
|
|
1520
1520
|
}
|
|
1521
1521
|
try {
|
|
1522
|
-
const swc = await import(
|
|
1522
|
+
const swc = await import(
|
|
1523
|
+
/* webpackIgnore: true */
|
|
1524
|
+
"@swc/core"
|
|
1525
|
+
);
|
|
1523
1526
|
swcTransform = swc.transform;
|
|
1524
1527
|
return swcTransform;
|
|
1525
1528
|
} catch {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transpiler.d.ts","sourceRoot":"","sources":["../../../src/renderers/utils/transpiler.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAEhD;;GAEG;AACH,UAAU,mBAAmB;IAC3B,+BAA+B;IAC/B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,wBAAwB;IACxB,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,wEAAwE;IACxE,UAAU,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;IACrC,sDAAsD;IACtD,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;
|
|
1
|
+
{"version":3,"file":"transpiler.d.ts","sourceRoot":"","sources":["../../../src/renderers/utils/transpiler.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAEhD;;GAEG;AACH,UAAU,mBAAmB;IAC3B,+BAA+B;IAC/B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,wBAAwB;IACxB,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,wEAAwE;IACxE,UAAU,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;IACrC,sDAAsD;IACtD,WAAW,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