@vertesia/create-plugin 0.60.0 → 0.62.0
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/lib/Package.d.ts +1 -2
- package/lib/Package.d.ts.map +1 -1
- package/lib/TemplateInit.d.ts +28 -0
- package/lib/TemplateInit.d.ts.map +1 -0
- package/lib/TemplateInit.js +48 -0
- package/lib/TemplateInit.js.map +1 -0
- package/lib/ToolTemplateInit.d.ts +10 -0
- package/lib/ToolTemplateInit.d.ts.map +1 -0
- package/lib/ToolTemplateInit.js +45 -0
- package/lib/ToolTemplateInit.js.map +1 -0
- package/lib/WebTemplateInit.d.ts +10 -0
- package/lib/WebTemplateInit.d.ts.map +1 -0
- package/lib/WebTemplateInit.js +72 -0
- package/lib/WebTemplateInit.js.map +1 -0
- package/lib/deps.d.ts +2 -1
- package/lib/deps.d.ts.map +1 -1
- package/lib/deps.js +2 -31
- package/lib/deps.js.map +1 -1
- package/lib/init.d.ts.map +1 -1
- package/lib/init.js +19 -87
- package/lib/init.js.map +1 -1
- package/package.json +1 -1
- package/templates/tool/src/index.ts +6 -0
- package/templates/tool/src/server.ts +14 -0
- package/templates/tool/src/tools/WeatherTool.ts +20 -0
- package/templates/tool/tsconfig.json +14 -0
- package/templates/tool/vite.config.js +18 -0
- package/templates/web/tsconfig.app.json +10 -6
- package/templates/web/tsconfig.node.json +8 -6
- package/templates/web/vite.config.ts +1 -1
package/lib/Package.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
interface PackageJson {
|
|
1
|
+
export interface PackageJson {
|
|
2
2
|
name: string;
|
|
3
3
|
version: string;
|
|
4
4
|
description: string;
|
|
@@ -39,5 +39,4 @@ export declare class Package {
|
|
|
39
39
|
saveTo(file: string): void;
|
|
40
40
|
toJson(): PackageJson;
|
|
41
41
|
}
|
|
42
|
-
export {};
|
|
43
42
|
//# sourceMappingURL=Package.d.ts.map
|
package/lib/Package.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Package.d.ts","sourceRoot":"","sources":["../src/Package.ts"],"names":[],"mappings":"AAEA,
|
|
1
|
+
{"version":3,"file":"Package.d.ts","sourceRoot":"","sources":["../src/Package.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,WAAW;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACzC,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC1C,oBAAoB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9C,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B,MAAM,CAAC,EAAE;QACL,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;QACnB,MAAM,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,YAAY,GAAG,QAAQ,CAAC;KACxD,CAAC;CACL;AAGD,qBAAa,OAAO;IACG,IAAI,EAAE,WAAW;IAAS,IAAI,CAAC,EAAE,MAAM;gBAAvC,IAAI,EAAE,WAAW,EAAS,IAAI,CAAC,EAAE,MAAM,YAAA;IAE1D,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM;IAK5B,IAAI,IAAI,IAIO,MAAM,CAFpB;IAED,IAAI,IAAI,CAAC,IAAI,EAAE,MAAM,EAEpB;IAED,IAAI,OAAO,IAIU,MAAM,CAF1B;IAED,IAAI,OAAO,CAAC,OAAO,EAAE,MAAM,EAE1B;IAED,IAAI,WAAW,IAIc,MAAM,CAFlC;IAED,IAAI,WAAW,CAAC,WAAW,EAAE,MAAM,EAElC;IAED,IAAI,OAAO,IAKU,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAF1C;IAED,IAAI,OAAO,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAE1C;IAED,IAAI;IAMJ,MAAM,CAAC,IAAI,EAAE,MAAM;IAKnB,MAAM,IAAI,WAAW;CAGxB"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { PackageJson } from "./Package.js";
|
|
2
|
+
export interface UserOptions {
|
|
3
|
+
pm: "npm" | "pnpm";
|
|
4
|
+
plugin_name: string;
|
|
5
|
+
plugin_version: string;
|
|
6
|
+
plugin_description?: string;
|
|
7
|
+
template: string;
|
|
8
|
+
}
|
|
9
|
+
export declare abstract class TemplateInit {
|
|
10
|
+
options: UserOptions;
|
|
11
|
+
pluginName: PluginName;
|
|
12
|
+
constructor(options: UserOptions);
|
|
13
|
+
abstract getPackageJson(): PackageJson;
|
|
14
|
+
abstract getDevDependencies(): string[];
|
|
15
|
+
abstract getRuntimeDependencies(): string[];
|
|
16
|
+
abstract getVars(): Record<string, any>;
|
|
17
|
+
installDeps(): void;
|
|
18
|
+
}
|
|
19
|
+
export declare class PluginName {
|
|
20
|
+
value: string;
|
|
21
|
+
scope?: string;
|
|
22
|
+
name: string;
|
|
23
|
+
_title?: string;
|
|
24
|
+
constructor(value: string);
|
|
25
|
+
get title(): string;
|
|
26
|
+
get pascalCase(): string;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=TemplateInit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TemplateInit.d.ts","sourceRoot":"","sources":["../src/TemplateInit.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,MAAM,WAAW,WAAW;IACxB,EAAE,EAAE,KAAK,GAAG,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,EAAE,MAAM,CAAC;CACpB;AAED,8BAAsB,YAAY;IAEX,OAAO,EAAE,WAAW;IADvC,UAAU,EAAE,UAAU,CAAC;gBACJ,OAAO,EAAE,WAAW;IAGvC,QAAQ,CAAC,cAAc,IAAI,WAAW;IAEtC,QAAQ,CAAC,kBAAkB,IAAI,MAAM,EAAE;IAEvC,QAAQ,CAAC,sBAAsB,IAAI,MAAM,EAAE;IAE3C,QAAQ,CAAC,OAAO,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAEvC,WAAW;CAMd;AAED,qBAAa,UAAU;IAIA,KAAK,EAAE,MAAM;IAHhC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;gBACG,KAAK,EAAE,MAAM;IAchC,IAAI,KAAK,WAKR;IACD,IAAI,UAAU,WAEb;CACJ"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { addDevDependencies, addRuntimeDependencies } from "./deps.js";
|
|
2
|
+
export class TemplateInit {
|
|
3
|
+
options;
|
|
4
|
+
pluginName;
|
|
5
|
+
constructor(options) {
|
|
6
|
+
this.options = options;
|
|
7
|
+
this.pluginName = new PluginName(options.plugin_name);
|
|
8
|
+
}
|
|
9
|
+
installDeps() {
|
|
10
|
+
const pm = this.options.pm;
|
|
11
|
+
console.log("Installing dependencies");
|
|
12
|
+
addDevDependencies(pm, this.getDevDependencies());
|
|
13
|
+
addRuntimeDependencies(pm, this.getRuntimeDependencies());
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
export class PluginName {
|
|
17
|
+
value;
|
|
18
|
+
scope;
|
|
19
|
+
name;
|
|
20
|
+
_title;
|
|
21
|
+
constructor(value) {
|
|
22
|
+
this.value = value;
|
|
23
|
+
if (value.startsWith('@')) {
|
|
24
|
+
const index = value.indexOf('/');
|
|
25
|
+
if (index > -1) {
|
|
26
|
+
this.name = value.substring(index + 1);
|
|
27
|
+
this.scope = value.substring(1, index);
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
throw new Error("Invalid plugin name");
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
this.name = value;
|
|
35
|
+
this.scope = undefined;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
get title() {
|
|
39
|
+
if (!this._title) {
|
|
40
|
+
this._title = this.name.split('-').map(word => word.charAt(0).toUpperCase() + word.slice(1)).join(' ');
|
|
41
|
+
}
|
|
42
|
+
return this._title;
|
|
43
|
+
}
|
|
44
|
+
get pascalCase() {
|
|
45
|
+
return this.name.split('-').map(word => word.charAt(0).toUpperCase() + word.slice(1)).join('');
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=TemplateInit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TemplateInit.js","sourceRoot":"","sources":["../src/TemplateInit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AAWvE,MAAM,OAAgB,YAAY;IAEX;IADnB,UAAU,CAAa;IACvB,YAAmB,OAAoB;QAApB,YAAO,GAAP,OAAO,CAAa;QACnC,IAAI,CAAC,UAAU,GAAG,IAAI,UAAU,CAAC,OAA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AC,CAAC,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC3G,CAAC;QACD,OAAO,IAAI,CAAC,MAAM,CAAC;IACvB,CAAC;IACD,IAAI,UAAU;QACV,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACnG,CAAC;CACJ"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { PackageJson } from "./Package.js";
|
|
2
|
+
import { TemplateInit, UserOptions } from "./TemplateInit.js";
|
|
3
|
+
export declare class ToolTemplateInit extends TemplateInit {
|
|
4
|
+
constructor(options: UserOptions);
|
|
5
|
+
getVars(): Record<string, any>;
|
|
6
|
+
getPackageJson(): PackageJson;
|
|
7
|
+
getDevDependencies(): string[];
|
|
8
|
+
getRuntimeDependencies(): string[];
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=ToolTemplateInit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToolTemplateInit.d.ts","sourceRoot":"","sources":["../src/ToolTemplateInit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAG9D,qBAAa,gBAAiB,SAAQ,YAAY;gBAClC,OAAO,EAAE,WAAW;IAIhC,OAAO,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAM9B,cAAc,IAAI,WAAW;IAmB7B,kBAAkB,IAAI,MAAM,EAAE;IAU9B,sBAAsB,IAAI,MAAM,EAAE;CASrC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { TemplateInit } from "./TemplateInit.js";
|
|
2
|
+
export class ToolTemplateInit extends TemplateInit {
|
|
3
|
+
constructor(options) {
|
|
4
|
+
super(options);
|
|
5
|
+
}
|
|
6
|
+
getVars() {
|
|
7
|
+
return {};
|
|
8
|
+
}
|
|
9
|
+
getPackageJson() {
|
|
10
|
+
const answer = this.options;
|
|
11
|
+
return {
|
|
12
|
+
name: answer.plugin_name,
|
|
13
|
+
version: answer.plugin_version || '1.0.0',
|
|
14
|
+
description: answer.plugin_description || '',
|
|
15
|
+
type: 'module',
|
|
16
|
+
main: `lib/esm/index.js`,
|
|
17
|
+
types: "lib/types/index.d.ts",
|
|
18
|
+
files: [
|
|
19
|
+
"lib"
|
|
20
|
+
],
|
|
21
|
+
scripts: {
|
|
22
|
+
"dev": "vite",
|
|
23
|
+
"build": "tsc",
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
getDevDependencies() {
|
|
28
|
+
return [
|
|
29
|
+
"@types/node",
|
|
30
|
+
"esbuild",
|
|
31
|
+
"typescript",
|
|
32
|
+
"vite",
|
|
33
|
+
"vite-plugin-node",
|
|
34
|
+
];
|
|
35
|
+
}
|
|
36
|
+
getRuntimeDependencies() {
|
|
37
|
+
return [
|
|
38
|
+
"@vertesia/agent-sdk",
|
|
39
|
+
"@vertesia/client",
|
|
40
|
+
"@vertesia/common",
|
|
41
|
+
"hono"
|
|
42
|
+
];
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=ToolTemplateInit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToolTemplateInit.js","sourceRoot":"","sources":["../src/ToolTemplateInit.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAe,MAAM,mBAAmB,CAAC;AAG9D,MAAM,OAAO,gBAAiB,SAAQ,YAAY;IAC9C,YAAY,OAAoB;QAC5B,KAAK,CAAC,OAAO,CAAC,CAAC;IACnB,CAAC;IAED,OAAO;QACH,OAAO,EAEN,CAAA;IACL,CAAC;IAED,cAAc;QACV,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC;QAC5B,OAAO;YACH,IAAI,EAAE,MAAM,CAAC,WAAW;YACxB,OAAO,EAAE,MAAM,CAAC,cAAc,IAAI,OAAO;YACzC,WAAW,EAAE,MAAM,CAAC,kBAAkB,IAAI,EAAE;YAC5C,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,kBAAkB;YACxB,KAAK,EAAE,sBAAsB;YAC7B,KAAK,EAAE;gBACH,KAAK;aACR;YACD,OAAO,EAAE;gBACL,KAAK,EAAE,MAAM;gBACb,OAAO,EAAE,KAAK;aACjB;SACJ,CAAC;IACN,CAAC;IAED,kBAAkB;QACd,OAAO;YACH,aAAa;YACb,SAAS;YACT,YAAY;YACZ,MAAM;YACN,kBAAkB;SACrB,CAAA;IACL,CAAC;IAED,sBAAsB;QAClB,OAAO;YACH,qBAAqB;YACrB,kBAAkB;YAClB,kBAAkB;YAClB,MAAM;SACT,CAAA;IACL,CAAC;CAEJ"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { PackageJson } from "./Package.js";
|
|
2
|
+
import { TemplateInit, UserOptions } from "./TemplateInit.js";
|
|
3
|
+
export declare class WebTemplateInit extends TemplateInit {
|
|
4
|
+
constructor(options: UserOptions);
|
|
5
|
+
getVars(): Record<string, any>;
|
|
6
|
+
getPackageJson(): PackageJson;
|
|
7
|
+
getDevDependencies(): string[];
|
|
8
|
+
getRuntimeDependencies(): string[];
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=WebTemplateInit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WebTemplateInit.d.ts","sourceRoot":"","sources":["../src/WebTemplateInit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAG9D,qBAAa,eAAgB,SAAQ,YAAY;gBACjC,OAAO,EAAE,WAAW;IAIhC,OAAO,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAO9B,cAAc,IAAI,WAAW;IAgC7B,kBAAkB,IAAI,MAAM,EAAE;IAuB9B,sBAAsB,IAAI,MAAM,EAAE;CAOrC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { TemplateInit } from "./TemplateInit.js";
|
|
2
|
+
export class WebTemplateInit extends TemplateInit {
|
|
3
|
+
constructor(options) {
|
|
4
|
+
super(options);
|
|
5
|
+
}
|
|
6
|
+
getVars() {
|
|
7
|
+
return {
|
|
8
|
+
plugin_title: this.pluginName.title,
|
|
9
|
+
PluginComponent: this.pluginName.pascalCase + "Plugin",
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
getPackageJson() {
|
|
13
|
+
const answer = this.options;
|
|
14
|
+
return {
|
|
15
|
+
name: answer.plugin_name,
|
|
16
|
+
version: answer.plugin_version || '1.0.0',
|
|
17
|
+
description: answer.plugin_description || '',
|
|
18
|
+
type: 'module',
|
|
19
|
+
main: `dist/${answer.plugin_name}.js`,
|
|
20
|
+
module: `dist/${answer.plugin_name}.js`,
|
|
21
|
+
types: "dist/index.d.ts",
|
|
22
|
+
files: [
|
|
23
|
+
"dist"
|
|
24
|
+
],
|
|
25
|
+
scripts: {
|
|
26
|
+
"dev": "vite",
|
|
27
|
+
"build": "vite build",
|
|
28
|
+
"lint": "eslint .",
|
|
29
|
+
"preview": "vite preview"
|
|
30
|
+
},
|
|
31
|
+
peerDependencies: {
|
|
32
|
+
"react": "^19.0.0",
|
|
33
|
+
"react-dom": "^19.0.0"
|
|
34
|
+
},
|
|
35
|
+
plugin: {
|
|
36
|
+
title: this.pluginName.title,
|
|
37
|
+
publisher: this.pluginName.scope || "vertesia",
|
|
38
|
+
external: false,
|
|
39
|
+
status: "beta",
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
getDevDependencies() {
|
|
44
|
+
return [
|
|
45
|
+
"@vertesia/plugin-builder",
|
|
46
|
+
"@eslint/js",
|
|
47
|
+
"@tailwindcss/vite",
|
|
48
|
+
"@types/node",
|
|
49
|
+
"@types/react",
|
|
50
|
+
"@types/react-dom",
|
|
51
|
+
"@vitejs/plugin-react",
|
|
52
|
+
"eslint",
|
|
53
|
+
"eslint-plugin-react-hooks",
|
|
54
|
+
"eslint-plugin-react-refresh",
|
|
55
|
+
"globals",
|
|
56
|
+
"react",
|
|
57
|
+
"react-dom",
|
|
58
|
+
"tailwindcss",
|
|
59
|
+
"typescript",
|
|
60
|
+
"typescript-eslint",
|
|
61
|
+
"vite",
|
|
62
|
+
"vite-plugin-dts",
|
|
63
|
+
];
|
|
64
|
+
}
|
|
65
|
+
getRuntimeDependencies() {
|
|
66
|
+
return [
|
|
67
|
+
"@vertesia/common",
|
|
68
|
+
"@vertesia/ui",
|
|
69
|
+
];
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=WebTemplateInit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WebTemplateInit.js","sourceRoot":"","sources":["../src/WebTemplateInit.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAe,MAAM,mBAAmB,CAAC;AAG9D,MAAM,OAAO,eAAgB,SAAQ,YAAY;IAC7C,YAAY,OAAoB;QAC5B,KAAK,CAAC,OAAO,CAAC,CAAC;IACnB,CAAC;IAED,OAAO;QACH,OAAO;YACH,YAAY,EAAE,IAAI,CAAC,UAAU,CAAC,KAAK;YACnC,eAAe,EAAE,IAAI,CAAC,UAAU,CAAC,UAAU,GAAG,QAAQ;SACzD,CAAA;IACL,CAAC;IAED,cAAc;QACV,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC;QAC5B,OAAO;YACH,IAAI,EAAE,MAAM,CAAC,WAAW;YACxB,OAAO,EAAE,MAAM,CAAC,cAAc,IAAI,OAAO;YACzC,WAAW,EAAE,MAAM,CAAC,kBAAkB,IAAI,EAAE;YAC5C,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,QAAQ,MAAM,CAAC,WAAW,KAAK;YACrC,MAAM,EAAE,QAAQ,MAAM,CAAC,WAAW,KAAK;YACvC,KAAK,EAAE,iBAAiB;YACxB,KAAK,EAAE;gBACH,MAAM;aACT;YACD,OAAO,EAAE;gBACL,KAAK,EAAE,MAAM;gBACb,OAAO,EAAE,YAAY;gBACrB,MAAM,EAAE,UAAU;gBAClB,SAAS,EAAE,cAAc;aAC5B;YACD,gBAAgB,EAAE;gBACd,OAAO,EAAE,SAAS;gBAClB,WAAW,EAAE,SAAS;aACzB;YACD,MAAM,EAAE;gBACJ,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,KAAK;gBAC5B,SAAS,EAAE,IAAI,CAAC,UAAU,CAAC,KAAK,IAAI,UAAU;gBAC9C,QAAQ,EAAE,KAAK;gBACf,MAAM,EAAE,MAAM;aACjB;SACJ,CAAC;IACN,CAAC;IAED,kBAAkB;QACd,OAAO;YACH,0BAA0B;YAC1B,YAAY;YACZ,mBAAmB;YACnB,aAAa;YACb,cAAc;YACd,kBAAkB;YAClB,sBAAsB;YACtB,QAAQ;YACR,2BAA2B;YAC3B,6BAA6B;YAC7B,SAAS;YACT,OAAO;YACP,WAAW;YACX,aAAa;YACb,YAAY;YACZ,mBAAmB;YACnB,MAAM;YACN,iBAAiB;SACpB,CAAA;IACL,CAAC;IAED,sBAAsB;QAClB,OAAO;YACH,kBAAkB;YAClB,cAAc;SACjB,CAAA;IACL,CAAC;CAEJ"}
|
package/lib/deps.d.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
export declare function
|
|
1
|
+
export declare function addDevDependencies(pm: "npm" | "pnpm", deps: string[]): void;
|
|
2
|
+
export declare function addRuntimeDependencies(pm: "npm" | "pnpm", deps: string[]): void;
|
|
2
3
|
//# sourceMappingURL=deps.d.ts.map
|
package/lib/deps.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deps.d.ts","sourceRoot":"","sources":["../src/deps.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"deps.d.ts","sourceRoot":"","sources":["../src/deps.ts"],"names":[],"mappings":"AAEA,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,KAAK,GAAG,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,QAEpE;AACD,wBAAgB,sBAAsB,CAAC,EAAE,EAAE,KAAK,GAAG,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,QAExE"}
|
package/lib/deps.js
CHANGED
|
@@ -1,32 +1,8 @@
|
|
|
1
1
|
import { runCommand } from "./utils.js";
|
|
2
|
-
|
|
3
|
-
"@vertesia/plugin-builder",
|
|
4
|
-
"@vertesia/ui",
|
|
5
|
-
"@eslint/js",
|
|
6
|
-
"@tailwindcss/vite",
|
|
7
|
-
"@types/node",
|
|
8
|
-
"@types/react",
|
|
9
|
-
"@types/react-dom",
|
|
10
|
-
"@vitejs/plugin-react",
|
|
11
|
-
"eslint",
|
|
12
|
-
"eslint-plugin-react-hooks",
|
|
13
|
-
"eslint-plugin-react-refresh",
|
|
14
|
-
"globals",
|
|
15
|
-
"react",
|
|
16
|
-
"react-dom",
|
|
17
|
-
"tailwindcss",
|
|
18
|
-
"typescript",
|
|
19
|
-
"typescript-eslint",
|
|
20
|
-
"vite",
|
|
21
|
-
"vite-plugin-dts",
|
|
22
|
-
];
|
|
23
|
-
const RUNTIME_DEPS = [
|
|
24
|
-
"@vertesia/ui",
|
|
25
|
-
];
|
|
26
|
-
function addDevDependencies(pm, deps) {
|
|
2
|
+
export function addDevDependencies(pm, deps) {
|
|
27
3
|
_addDependencies(pm, deps, "dev");
|
|
28
4
|
}
|
|
29
|
-
function addRuntimeDependencies(pm, deps) {
|
|
5
|
+
export function addRuntimeDependencies(pm, deps) {
|
|
30
6
|
_addDependencies(pm, deps, "runtime");
|
|
31
7
|
}
|
|
32
8
|
function _addDependencies(pm, deps, type = "runtime") {
|
|
@@ -41,9 +17,4 @@ function _addDependencies(pm, deps, type = "runtime") {
|
|
|
41
17
|
}
|
|
42
18
|
runCommand(pm, args);
|
|
43
19
|
}
|
|
44
|
-
export function installDeps(pm) {
|
|
45
|
-
console.log("Installing dependencies");
|
|
46
|
-
addDevDependencies(pm, DEV_DEPS);
|
|
47
|
-
addRuntimeDependencies(pm, RUNTIME_DEPS);
|
|
48
|
-
}
|
|
49
20
|
//# sourceMappingURL=deps.js.map
|
package/lib/deps.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deps.js","sourceRoot":"","sources":["../src/deps.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAExC,MAAM,
|
|
1
|
+
{"version":3,"file":"deps.js","sourceRoot":"","sources":["../src/deps.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAExC,MAAM,UAAU,kBAAkB,CAAC,EAAkB,EAAE,IAAc;IACjE,gBAAgB,CAAC,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;AACtC,CAAC;AACD,MAAM,UAAU,sBAAsB,CAAC,EAAkB,EAAE,IAAc;IACrE,gBAAgB,CAAC,EAAE,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC;AAC1C,CAAC;AACD,SAAS,gBAAgB,CAAC,EAAkB,EAAE,IAAc,EAAE,OAA0B,SAAS;IAC7F,MAAM,IAAI,GAAG;QACT,EAAE,KAAK,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS;KACpC,CAAC;IACF,IAAI,IAAI,KAAK,KAAK,EAAE,CAAC;QACjB,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACpB,CAAC;IACD,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACrB,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IAClB,CAAC;IACD,UAAU,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;AACzB,CAAC"}
|
package/lib/init.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":"AAcA,wBAAsB,IAAI,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,iBAoFtD"}
|
package/lib/init.js
CHANGED
|
@@ -4,9 +4,10 @@ import { join, resolve } from "node:path";
|
|
|
4
4
|
import { chdir } from "node:process";
|
|
5
5
|
import { fileURLToPath } from "node:url";
|
|
6
6
|
import { copyTree } from "./copy.js";
|
|
7
|
-
import { installDeps } from "./deps.js";
|
|
8
7
|
import { hasBin } from "./hasBin.js";
|
|
9
8
|
import { Package } from "./Package.js";
|
|
9
|
+
import { ToolTemplateInit } from "./ToolTemplateInit.js";
|
|
10
|
+
import { WebTemplateInit } from "./WebTemplateInit.js";
|
|
10
11
|
const { prompt } = enquirer;
|
|
11
12
|
export async function init(dirName) {
|
|
12
13
|
let initialPm = "npm";
|
|
@@ -47,26 +48,21 @@ export async function init(dirName) {
|
|
|
47
48
|
message: "Package description",
|
|
48
49
|
initial: '',
|
|
49
50
|
},
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
]);
|
|
63
|
-
//TODO remove this
|
|
64
|
-
answer.template = 'web';
|
|
65
|
-
const cmd = answer.pm;
|
|
66
|
-
const pluginName = new PluginName(answer.plugin_name);
|
|
51
|
+
{
|
|
52
|
+
name: 'template',
|
|
53
|
+
type: 'select',
|
|
54
|
+
message: "Template to use",
|
|
55
|
+
initial: 0,
|
|
56
|
+
choices: [
|
|
57
|
+
{ message: 'Web plugin', name: 'web' },
|
|
58
|
+
{ message: 'Agent tool', name: 'tool' },
|
|
59
|
+
]
|
|
60
|
+
},]);
|
|
61
|
+
const templateInit = answer.template === 'web' ? new WebTemplateInit(answer) : new ToolTemplateInit(answer);
|
|
62
|
+
const pluginName = templateInit.pluginName;
|
|
67
63
|
let dir;
|
|
68
64
|
if (!dirName) {
|
|
69
|
-
dirName =
|
|
65
|
+
dirName = pluginName.name;
|
|
70
66
|
dir = join(process.cwd(), dirName);
|
|
71
67
|
}
|
|
72
68
|
else {
|
|
@@ -74,13 +70,9 @@ export async function init(dirName) {
|
|
|
74
70
|
}
|
|
75
71
|
mkdirSync(dir, { recursive: true });
|
|
76
72
|
chdir(dir);
|
|
77
|
-
const PluginComponent = pluginName.pascalCase + "Plugin";
|
|
78
73
|
const templateProps = {
|
|
79
74
|
suffix: '.tmpl',
|
|
80
|
-
context:
|
|
81
|
-
plugin_title: pluginName.title,
|
|
82
|
-
PluginComponent,
|
|
83
|
-
}
|
|
75
|
+
context: templateInit.getVars()
|
|
84
76
|
};
|
|
85
77
|
// copy template to current directory and process template files
|
|
86
78
|
const templsDir = resolve(fileURLToPath(import.meta.url), '../../templates');
|
|
@@ -88,74 +80,14 @@ export async function init(dirName) {
|
|
|
88
80
|
await copyTree(join(templsDir, "web"), dir, templateProps);
|
|
89
81
|
}
|
|
90
82
|
else if (answer.template === 'tool') {
|
|
91
|
-
|
|
92
|
-
else if (answer.template === 'activity') {
|
|
83
|
+
await copyTree(join(templsDir, "tool"), dir, templateProps);
|
|
93
84
|
}
|
|
94
85
|
else {
|
|
95
86
|
throw new Error("Invalid template type");
|
|
96
87
|
}
|
|
97
88
|
console.log("Generating package.json");
|
|
98
|
-
const pkg = new Package(
|
|
99
|
-
name: answer.plugin_name,
|
|
100
|
-
version: answer.plugion_version || '1.0.0',
|
|
101
|
-
description: answer.description || '',
|
|
102
|
-
type: 'module',
|
|
103
|
-
main: `dist/${answer.plugin_name}.js`,
|
|
104
|
-
module: `dist/${answer.plugin_name}.js`,
|
|
105
|
-
types: "dist/index.d.ts",
|
|
106
|
-
files: [
|
|
107
|
-
"dist"
|
|
108
|
-
],
|
|
109
|
-
scripts: {
|
|
110
|
-
"dev": "vite",
|
|
111
|
-
"build": "vite build",
|
|
112
|
-
"lint": "eslint .",
|
|
113
|
-
"preview": "vite preview"
|
|
114
|
-
},
|
|
115
|
-
peerDependencies: {
|
|
116
|
-
"react": "^19.0.0",
|
|
117
|
-
"react-dom": "^19.0.0"
|
|
118
|
-
},
|
|
119
|
-
plugin: {
|
|
120
|
-
title: pluginName.title,
|
|
121
|
-
publisher: pluginName.scope || "vertesia",
|
|
122
|
-
external: false,
|
|
123
|
-
status: "beta",
|
|
124
|
-
}
|
|
125
|
-
});
|
|
89
|
+
const pkg = new Package(templateInit.getPackageJson());
|
|
126
90
|
pkg.saveTo(`${dir}/package.json`);
|
|
127
|
-
installDeps(
|
|
128
|
-
}
|
|
129
|
-
class PluginName {
|
|
130
|
-
value;
|
|
131
|
-
scope;
|
|
132
|
-
name;
|
|
133
|
-
_title;
|
|
134
|
-
constructor(value) {
|
|
135
|
-
this.value = value;
|
|
136
|
-
if (value.startsWith('@')) {
|
|
137
|
-
const index = value.indexOf('/');
|
|
138
|
-
if (index > -1) {
|
|
139
|
-
this.name = value.substring(index + 1);
|
|
140
|
-
this.scope = value.substring(1, index);
|
|
141
|
-
}
|
|
142
|
-
else {
|
|
143
|
-
throw new Error("Invalid plugin name");
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
else {
|
|
147
|
-
this.name = value;
|
|
148
|
-
this.scope = undefined;
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
get title() {
|
|
152
|
-
if (!this._title) {
|
|
153
|
-
this._title = this.name.split('-').map(word => word.charAt(0).toUpperCase() + word.slice(1)).join(' ');
|
|
154
|
-
}
|
|
155
|
-
return this._title;
|
|
156
|
-
}
|
|
157
|
-
get pascalCase() {
|
|
158
|
-
return this.name.split('-').map(word => word.charAt(0).toUpperCase() + word.slice(1)).join('');
|
|
159
|
-
}
|
|
91
|
+
templateInit.installDeps();
|
|
160
92
|
}
|
|
161
93
|
//# sourceMappingURL=init.js.map
|
package/lib/init.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.js","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,MAAM,EAA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,CAAC,QAAQ,KAAK,KAAK,EAAE,CAAC;QAC5B,MAAM,QAAQ,CAAC,IAAI,CAAC,SAAS,EAAE,KAAK,CAAC,EAAE,GAAG,EAAE,aAAa,CAAC,CAAC;IAC/D,CAAC;SAAM,IAAI,MAAM,CAAC,QAAQ,KAAK,MAAM,EAAE,CAAC;QACpC,MAAM,QAAQ,CAAC,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,EAAE,GAAG,EAAE,aAAa,CAAC,CAAC;IAChE,CAAC;SAAM,CAAC;QACJ,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;IAC7C,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAC;IACvC,MAAM,GAAG,GAAG,IAAI,OAAO,CAAC,YAAY,CAAC,cAAc,EAAE,CAAC,CAAC;IAEvD,GAAG,CAAC,MAAM,CAAC,GAAG,GAAG,eAAe,CAAC,CAAC;IAElC,YAAY,CAAC,WAAW,EAAE,CAAC;AAC/B,CAAC"}
|
package/package.json
CHANGED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Hono } from 'hono';
|
|
2
|
+
import { registry } from "./index.js";
|
|
3
|
+
|
|
4
|
+
const app = new Hono();
|
|
5
|
+
|
|
6
|
+
app.post('/', async (c) => {
|
|
7
|
+
const data = await c.req.json();
|
|
8
|
+
const r = await registry.execute(c.req.body())
|
|
9
|
+
return c.json({
|
|
10
|
+
response: r
|
|
11
|
+
})
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
export { app }
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Tool, ToolFunctionParams } from "@vertesia/agent-sdk";
|
|
2
|
+
export const WeatherTool = {
|
|
3
|
+
name: "weather",
|
|
4
|
+
description: "Get the current weather for a given location.",
|
|
5
|
+
parameters: {
|
|
6
|
+
type: "object",
|
|
7
|
+
properties: {
|
|
8
|
+
location: {
|
|
9
|
+
type: "string",
|
|
10
|
+
description: "The location to get the weather for, e.g., 'New York, NY'."
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
required: ["location"]
|
|
14
|
+
},
|
|
15
|
+
run: async (params: ToolFunctionParams) => {
|
|
16
|
+
const { location } = params;
|
|
17
|
+
// Simulate fetching weather data
|
|
18
|
+
return `The current weather in ${location} is sunny with a temperature of 75°F.`;
|
|
19
|
+
}
|
|
20
|
+
} satisfies Tool;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { defineConfig } from 'vite'
|
|
2
|
+
import { VitePluginNode } from 'vite-plugin-node'
|
|
3
|
+
|
|
4
|
+
export default defineConfig({
|
|
5
|
+
plugins: [
|
|
6
|
+
VitePluginNode({
|
|
7
|
+
adapter: 'hono',
|
|
8
|
+
appPath: './src/server.ts',
|
|
9
|
+
exportName: 'app', // default is 'app', you can also export your app as "app" instead of calling listen()
|
|
10
|
+
tsCompiler: 'esbuild',
|
|
11
|
+
}),
|
|
12
|
+
],
|
|
13
|
+
server: {
|
|
14
|
+
watch: {
|
|
15
|
+
usePolling: true,
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
})
|
|
@@ -3,10 +3,13 @@
|
|
|
3
3
|
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
|
|
4
4
|
"target": "ES2020",
|
|
5
5
|
"useDefineForClassFields": true,
|
|
6
|
-
"lib": [
|
|
6
|
+
"lib": [
|
|
7
|
+
"ES2020",
|
|
8
|
+
"DOM",
|
|
9
|
+
"DOM.Iterable"
|
|
10
|
+
],
|
|
7
11
|
"module": "ESNext",
|
|
8
12
|
"skipLibCheck": true,
|
|
9
|
-
|
|
10
13
|
/* Bundler mode */
|
|
11
14
|
"moduleResolution": "bundler",
|
|
12
15
|
"allowImportingTsExtensions": true,
|
|
@@ -14,14 +17,15 @@
|
|
|
14
17
|
"moduleDetection": "force",
|
|
15
18
|
"noEmit": true,
|
|
16
19
|
"jsx": "react-jsx",
|
|
17
|
-
|
|
18
20
|
/* Linting */
|
|
19
21
|
"strict": true,
|
|
20
22
|
"noUnusedLocals": true,
|
|
21
23
|
"noUnusedParameters": true,
|
|
22
|
-
"erasableSyntaxOnly":
|
|
24
|
+
"erasableSyntaxOnly": false,
|
|
23
25
|
"noFallthroughCasesInSwitch": true,
|
|
24
26
|
"noUncheckedSideEffectImports": true
|
|
25
27
|
},
|
|
26
|
-
"include": [
|
|
27
|
-
|
|
28
|
+
"include": [
|
|
29
|
+
"src"
|
|
30
|
+
]
|
|
31
|
+
}
|
|
@@ -2,24 +2,26 @@
|
|
|
2
2
|
"compilerOptions": {
|
|
3
3
|
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
|
|
4
4
|
"target": "ES2022",
|
|
5
|
-
"lib": [
|
|
5
|
+
"lib": [
|
|
6
|
+
"ES2023"
|
|
7
|
+
],
|
|
6
8
|
"module": "ESNext",
|
|
7
9
|
"skipLibCheck": true,
|
|
8
|
-
|
|
9
10
|
/* Bundler mode */
|
|
10
11
|
"moduleResolution": "bundler",
|
|
11
12
|
"allowImportingTsExtensions": true,
|
|
12
13
|
"verbatimModuleSyntax": true,
|
|
13
14
|
"moduleDetection": "force",
|
|
14
15
|
"noEmit": true,
|
|
15
|
-
|
|
16
16
|
/* Linting */
|
|
17
17
|
"strict": true,
|
|
18
18
|
"noUnusedLocals": true,
|
|
19
19
|
"noUnusedParameters": true,
|
|
20
|
-
"erasableSyntaxOnly":
|
|
20
|
+
"erasableSyntaxOnly": false,
|
|
21
21
|
"noFallthroughCasesInSwitch": true,
|
|
22
22
|
"noUncheckedSideEffectImports": true
|
|
23
23
|
},
|
|
24
|
-
"include": [
|
|
25
|
-
|
|
24
|
+
"include": [
|
|
25
|
+
"vite.config.ts"
|
|
26
|
+
]
|
|
27
|
+
}
|
|
@@ -10,6 +10,7 @@ const EXTERNALS = [
|
|
|
10
10
|
'react/jsx-runtime',
|
|
11
11
|
'react-dom/client',
|
|
12
12
|
'@vertesia/ui',
|
|
13
|
+
/^@vertesia\/ui\/.*/,
|
|
13
14
|
// add any other external dependencies here
|
|
14
15
|
];
|
|
15
16
|
|
|
@@ -30,7 +31,6 @@ export default defineConfig(({ command }) => {
|
|
|
30
31
|
vertesiaPluginBuilder(),
|
|
31
32
|
],
|
|
32
33
|
optimizeDeps: isBuildMode ? {
|
|
33
|
-
exclude: EXTERNALS
|
|
34
34
|
} : undefined,
|
|
35
35
|
build: {
|
|
36
36
|
lib: isBuildMode ? {
|