@doubao-apps/kit 0.0.20 → 0.0.21
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/dist/971.js +2 -2
- package/dist/cli/index.js +1 -1
- package/dist/types.d.ts +79 -10
- package/package.json +4 -2
package/dist/971.js
CHANGED
|
@@ -100,7 +100,7 @@ root.render(<FC />);
|
|
|
100
100
|
if (import.meta.webpackHot) {
|
|
101
101
|
import.meta.webpackHot.accept()
|
|
102
102
|
}
|
|
103
|
-
`:""),{[s]:c})}).map(([x,_])=>[`${xv}/${x}`,_]),...Object.entries({...em(t.viewEntries,_,A)}).map(([x,_])=>[`${xv}/${x}`,_])]))}})}},eU={name:"AppletManifestPlugin",setup:async x=>{x.assets.hooks.beforeEmit.tapPromise({name:"AppletManifestPlugin",stage:x.assets.BEFORE_EMIT_STAGE_PROCESS_MANIFEST_ASSETS},async({assets:_})=>{let{signingEncryptionOptions:a}=x.context,{signing:e}=a||{};if(e?.enabled){let a=_.getManifestAsset(x.context.manifestAssetPath),r=a.getManifest(),{buffer:t,status:A,error_msg:n}=await (0,aY.signData)(Buffer.from(a.content),{key_path:e.key_path,key_id:e.key_id,extra_config:{app_id:r.packageName,bundle_id:"manifest"},output_mode:"sign_block"});if(0!==A)throw Error(n);let s=new a3(xB,t.toString());s.destination=xB,_.addAsset(xB,s)}})}},eQ={name:"AppletViewEntryPlugin",async setup(x){let{srcDirectory:_}=x.context,{pages:a,widgets:e,mcpUI:r}=await eR(_);x.context.setViewEntries({pages:a,widgets:e}),x.context.setMcpUIApi(r)}},ez=()=>[eH,eQ,eD,eV,eM,eU];class eY{allowDevServerLog=!1;deploy={};_userConfig={};_command;_metadata;_versionTag;_environment={useLynx:!1,useMcpUI:!1};_srcDirectory="";_virtualEntryDir="";_appDirectory=process.cwd();_rootPath="";_mainThreadAssetPath="";_mainThreadMapAssetPath="";_manifestPath="";_manifest;_widgets={};_app="";_tools={};_pages={};_mcpUI={viewEntries:{},apiEntries:{}};_viewEntriesByType={};_signingEncryptionOptions;_dek=Buffer.from("");get userConfig(){return this._userConfig}get isDev(){return this._command===_l.DEV}get command(){return this._command}get metadata(){return this._metadata}get manifestPath(){return this._manifestPath}get appDirectory(){return this._appDirectory}get virtualEntryDir(){return this._virtualEntryDir}get srcDirectory(){return this._srcDirectory}get rootPath(){return this._rootPath}get manifest(){if(this._manifest)return{...this._manifest};try{return this._manifest=JSON.parse(L.readFileSync(this._manifestPath,"utf-8")),{...this._manifest}}catch(x){return{}}}get useLynx(){return this._environment.useLynx}get useMcpUI(){return this._environment.useMcpUI}get manifestAssetPath(){return xI}get mainThreadAssetPath(){return this._mainThreadAssetPath}get mainThreadMapAssetPath(){return this._mainThreadMapAssetPath}get environment(){return this._environment}get widgets(){return this._widgets}get pages(){return this._pages}get mcpUI(){return this._mcpUI}get viewEntriesByType(){return this._viewEntriesByType}get app(){return this._app}get tools(){return this._tools}get signingEncryptionOptions(){if(this._signingEncryptionOptions)return{...this._signingEncryptionOptions,encryption:{...this._signingEncryptionOptions?.encryption,dek:this.dek}}}get dek(){return this._dek}get isSignedEncryption(){return this.signingEncryptionOptions?.signing.enabled||this.signingEncryptionOptions?.encryption.enabled}setViewEntries({pages:x,widgets:_}){this.setPages(x),this.setWidgets(_)}setPages(x){this._pages=x}setWidgets(x){this._widgets=x}appendPages(x){Object.assign(this._pages,x)}appendWidgets(x){Object.assign(this._widgets,x)}getViewEntriesByType(x){return this._viewEntriesByType[x]??{pages:{},widgets:{}}}setViewEntriesByType(x,_){this._viewEntriesByType[x]=_}setMainThreadAssetPath(x){this._mainThreadAssetPath=x}setMainThreadMapAssetPath(x){this._mainThreadMapAssetPath=x}setManifest(x){this._manifest=x}setMcpUIApi(x){this._mcpUI=x}setSigningEncryptionOptions(x){this._signingEncryptionOptions=x}get versionTag(){return this._versionTag}async bootstrap({srcDirectory:x,appDirectory:_,rootPath:a,userConfig:e,command:r,metadata:t,signingEncryptionOptions:A,versionTag:s}){this._srcDirectory=x,this._appDirectory=_,this._virtualEntryDir=n.resolve(_,xi),this._rootPath=a,this._manifestPath=n.resolve(`${a}/${xI}`),this._userConfig=e,this._command=r,this._metadata=t,this._versionTag=s,this._signingEncryptionOptions=await ed(A,r),this._signingEncryptionOptions?.encryption.enabled&&(this._dek=(0,aY.generateDEK)(),aI()&&console.log("DEK base64:",Buffer.from(this.dek.buffer,this.dek.byteOffset,this.dek.byteLength).toString("base64")));let{app:c,tools:i}=await eZ(x);c&&(this._app=c),this._tools=i}}class eW{pluginSystem;rootPath=xl;context;appDirectory;_userConfig;constructor(x=process.cwd()){this.appDirectory=x}get manifest(){return this.context.manifest}async prepare(x,_={},a,e=ez()){Date.now();let r=await this.getUserConfig(_);this.rootPath=aI()?xc.default.resolve(this.appDirectory,xl):function({appKey:x,appDirectory:_=process.cwd()}={}){let a=n.basename(n.resolve(_))||"temp";return`${x_.tmpdir()}/${_w}/${x||a}`}({appDirectory:this.appDirectory}),L.existsSync(xc.default.resolve(this.rootPath))&&L.rmSync(xc.default.resolve(this.rootPath),{recursive:!0,force:!0}),this.context=new eY;let t=xc.default.resolve(this.appDirectory,xS);await this.context.bootstrap({srcDirectory:t,appDirectory:this.appDirectory,rootPath:this.rootPath,userConfig:r,command:x,metadata:new xX,signingEncryptionOptions:_.signingEncryptionOptions,versionTag:_.versionTag}),this.pluginSystem=new xM(this.context,[...e,...r.experiments?.taro?[function({name:x,
|
|
103
|
+
`:""),{[s]:c})}).map(([x,_])=>[`${xv}/${x}`,_]),...Object.entries({...em(t.viewEntries,_,A)}).map(([x,_])=>[`${xv}/${x}`,_])]))}})}},eU={name:"AppletManifestPlugin",setup:async x=>{x.assets.hooks.beforeEmit.tapPromise({name:"AppletManifestPlugin",stage:x.assets.BEFORE_EMIT_STAGE_PROCESS_MANIFEST_ASSETS},async({assets:_})=>{let{signingEncryptionOptions:a}=x.context,{signing:e}=a||{};if(e?.enabled){let a=_.getManifestAsset(x.context.manifestAssetPath),r=a.getManifest(),{buffer:t,status:A,error_msg:n}=await (0,aY.signData)(Buffer.from(a.content),{key_path:e.key_path,key_id:e.key_id,extra_config:{app_id:r.packageName,bundle_id:"manifest"},output_mode:"sign_block"});if(0!==A)throw Error(n);let s=new a3(xB,t.toString());s.destination=xB,_.addAsset(xB,s)}})}},eQ={name:"AppletViewEntryPlugin",async setup(x){let{srcDirectory:_}=x.context,{pages:a,widgets:e,mcpUI:r}=await eR(_);x.context.setViewEntries({pages:a,widgets:e}),x.context.setMcpUIApi(r)}},ez=()=>[eH,eQ,eD,eV,eM,eU];class eY{allowDevServerLog=!1;deploy={};_userConfig={};_command;_metadata;_versionTag;_environment={useLynx:!1,useMcpUI:!1};_srcDirectory="";_virtualEntryDir="";_appDirectory=process.cwd();_rootPath="";_mainThreadAssetPath="";_mainThreadMapAssetPath="";_manifestPath="";_manifest;_widgets={};_app="";_tools={};_pages={};_mcpUI={viewEntries:{},apiEntries:{}};_viewEntriesByType={};_signingEncryptionOptions;_dek=Buffer.from("");get userConfig(){return this._userConfig}get isDev(){return this._command===_l.DEV}get command(){return this._command}get metadata(){return this._metadata}get manifestPath(){return this._manifestPath}get appDirectory(){return this._appDirectory}get virtualEntryDir(){return this._virtualEntryDir}get srcDirectory(){return this._srcDirectory}get rootPath(){return this._rootPath}get manifest(){if(this._manifest)return{...this._manifest};try{return this._manifest=JSON.parse(L.readFileSync(this._manifestPath,"utf-8")),{...this._manifest}}catch(x){return{}}}get useLynx(){return this._environment.useLynx}get useMcpUI(){return this._environment.useMcpUI}get manifestAssetPath(){return xI}get mainThreadAssetPath(){return this._mainThreadAssetPath}get mainThreadMapAssetPath(){return this._mainThreadMapAssetPath}get environment(){return this._environment}get widgets(){return this._widgets}get pages(){return this._pages}get mcpUI(){return this._mcpUI}get viewEntriesByType(){return this._viewEntriesByType}get app(){return this._app}get tools(){return this._tools}get signingEncryptionOptions(){if(this._signingEncryptionOptions)return{...this._signingEncryptionOptions,encryption:{...this._signingEncryptionOptions?.encryption,dek:this.dek}}}get dek(){return this._dek}get isSignedEncryption(){return this.signingEncryptionOptions?.signing.enabled||this.signingEncryptionOptions?.encryption.enabled}setViewEntries({pages:x,widgets:_}){this.setPages(x),this.setWidgets(_)}setPages(x){this._pages=x}setWidgets(x){this._widgets=x}appendPages(x){Object.assign(this._pages,x)}appendWidgets(x){Object.assign(this._widgets,x)}getViewEntriesByType(x){return this._viewEntriesByType[x]??{pages:{},widgets:{}}}setViewEntriesByType(x,_){this._viewEntriesByType[x]=_}setMainThreadAssetPath(x){this._mainThreadAssetPath=x}setMainThreadMapAssetPath(x){this._mainThreadMapAssetPath=x}setManifest(x){this._manifest=x}setMcpUIApi(x){this._mcpUI=x}setSigningEncryptionOptions(x){this._signingEncryptionOptions=x}get versionTag(){return this._versionTag}async bootstrap({srcDirectory:x,appDirectory:_,rootPath:a,userConfig:e,command:r,metadata:t,signingEncryptionOptions:A,versionTag:s}){this._srcDirectory=x,this._appDirectory=_,this._virtualEntryDir=n.resolve(_,xi),this._rootPath=a,this._manifestPath=n.resolve(`${a}/${xI}`),this._userConfig=e,this._command=r,this._metadata=t,this._versionTag=s,this._signingEncryptionOptions=await ed(A,r),this._signingEncryptionOptions?.encryption.enabled&&(this._dek=(0,aY.generateDEK)(),aI()&&console.log("DEK base64:",Buffer.from(this.dek.buffer,this.dek.byteOffset,this.dek.byteLength).toString("base64")));let{app:c,tools:i}=await eZ(x);c&&(this._app=c),this._tools=i}}class eW{pluginSystem;rootPath=xl;context;appDirectory;_userConfig;constructor(x=process.cwd()){this.appDirectory=x}get manifest(){return this.context.manifest}async prepare(x,_={},a,e=ez()){Date.now();let r=await this.getUserConfig(_);this.rootPath=aI()?xc.default.resolve(this.appDirectory,xl):function({appKey:x,appDirectory:_=process.cwd()}={}){let a=n.basename(n.resolve(_))||"temp";return`${x_.tmpdir()}/${_w}/${x||a}`}({appDirectory:this.appDirectory}),L.existsSync(xc.default.resolve(this.rootPath))&&L.rmSync(xc.default.resolve(this.rootPath),{recursive:!0,force:!0}),this.context=new eY;let t=xc.default.resolve(this.appDirectory,xS);await this.context.bootstrap({srcDirectory:t,appDirectory:this.appDirectory,rootPath:this.rootPath,userConfig:r,command:x,metadata:new xX,signingEncryptionOptions:_.signingEncryptionOptions,versionTag:_.versionTag}),this.pluginSystem=new xM(this.context,[...e,...r.experiments?.taro?[function({name:x,appId:_,widgets:a}){return{name:__,setup:e=>{let r=w(import.meta.url),{appDirectory:t,isDev:A,pages:s,widgets:c}=e.context;e.view.hooks.modifyEntryOption.tapPromise({name:__,stage:e.view.MODIFY_ENTRY_OPTION_STAGE_PROCESS_ENTRY},async({entry:x})=>{let _=_x(s,t,!1,A),a=_x(c,t,!0,A);return{entry:x=Object.assign(x,Object.fromEntries([...Object.entries(_).map(([x,_])=>[`${xv}/${x}`,_]),...Object.entries(a).map(([x,_])=>[`${xv}/${x}`,_])]))}}),e.view.hooks.beforeBuild.tapPromise({name:__,stage:e.view.BEFORE_BUILD_STAGE_MODIFY_BUNDLE_CONFIG},async({buildConfig:x})=>{x0(x,{resolve:{alias:{"@tarojs/components":r.resolve("@doubao-apps/taro-runtime/components",{paths:[t]}),"@tarojs/taro":(0,xc.dirname)(r.resolve("@doubao-apps/taro-runtime/package.json",{paths:[t]}))}}})}),e.worker.hooks.modifyEntryOption.tapPromise({name:__,stage:-1},async()=>{let a={},{app:r}=e.context;return r&&(a.app=function(x,_,a,e,r=!1){var t;let A=`${xi}${n.sep}${xF}.js`,s=(t=x1(n.dirname(A),x)).startsWith(".")?t:`./${t}`,c=x8(_);return new x9(A,`
|
|
104
104
|
import { Applet } from "${c}";
|
|
105
105
|
import { defineApp } from '${c}';
|
|
106
106
|
import { APP_ID, getLifecycle } from '@doubao-apps/taro-runtime/internal';
|
|
@@ -140,5 +140,5 @@ if (import.meta.webpackHot) {
|
|
|
140
140
|
import.meta.webpackHot.accept()
|
|
141
141
|
}
|
|
142
142
|
`:""}
|
|
143
|
-
`)}(
|
|
143
|
+
`)}(r,t,x,_,A)),{entry:a}}),e.worker.hooks.beforeBuild.tapPromise({name:__,stage:e.worker.BEFORE_BUILD_STAGE_MODIFY_BUILD_CONFIG},async({buildConfig:x})=>{x0(x,{resolve:{alias:{"@tarojs/taro":r.resolve("@doubao-apps/taro-runtime/app",{paths:[t]})}}})}),e.worker.hooks.collectMetaData.tapPromise(__,async({collector:a})=>{a.addAppMeta({name:x,package:_})}),e.view.hooks.collectMetaData.tapPromise(__,async({collector:x})=>{Object.entries(s).forEach(([_,a])=>{let{folderName:e}=a;x.addPageMeta(_,{id:e})}),Object.entries(c).forEach(([_,e])=>{let{folderName:r}=e;x.addWidgetMeta(_,{...a?.[r]??a?.[_]??{},id:r})})})}}}({name:r.experiments.taro.name,appId:r.experiments.taro.appId,widgets:r.experiments.taro.widgets})]:[]]),Array.isArray(r.plugins)&&this.pluginSystem.addPlugins(r.plugins),await this.pluginSystem.bootstrap();let A=await ev({options:r,commandType:x,context:this.context,rsbuildPlugins:a},this.pluginSystem);return{userConfig:r,builder:A}}async dev(x){let{builder:_}=await this.prepare(_l.DEV,x,x.rsbuildPlugins),a=await _.startDevServer(),e=async()=>{console.log("Shutting down..."),await a.server.close(),console.log("dev server closed")};return{host:ah(a.port),closeServer:e}}async build(x){let{builder:_}=await this.prepare(_l.BUILD,x,x.rsbuildPlugins);try{await _.build()}finally{if(x.skipCleanupRootPath||aI()||aB()){if(x.archive&&x.channel){let{channel:_}=x;await xz({channelName:_,manifest:this.manifest,rootPath:this.rootPath})}}else L.rmSync(this.rootPath,{recursive:!0,force:!0})}}async analyze(x){let{builder:_}=await this.prepare(_l.ANALYZE,x);await _.build()}async perf(x){let{builder:_}=await this.prepare(_l.PERF,x);await _.build()}async deploy(x){let{builder:_}=await this.prepare(_l.DEPLOY,x);x.build&&await _.build();let a=x.deployType||xW.SELF_BUILT_ONLY;if(await this.pluginSystem.callDeployHooks("beforeDeploy",{config:this.context.deploy}),0===Object.keys(this.context.deploy).length)return void console.error("Please use deploy plugin in doubao.config.ts");this.context.deploy={...this.context.deploy,versionCode:x.versionCode,packageName:x.packageName};try{await this.pluginSystem.callDeployHooks("deploy",{deployType:a})}finally{await this.pluginSystem.callDeployHooks("afterDeploy",{})}}async run(x,_){switch(x){case _f.DEV:return await this.dev(_);case _f.BUILD:return await this.build(_);case _f.ANALYZE:return await this.analyze(_);case _f.PERF:return await this.perf(_);case _f.DEPLOY:return await this.deploy(_)}}async getUserConfig(x){if(!this._userConfig){let _=g({cwd:this.appDirectory,mode:x.envMode}),a=await eE({cwd:this.appDirectory,customConfigFile:x.config});a.source||={},a.source.define={..._.publicVars,...a.source.define},a.hdt=x.hdt,this._userConfig=a}return this._userConfig}}function e0(x=eW){return async function({cliOptions:_={},appDirectory:a=process.cwd(),command:e}){let r=new x(a);await r.run(e,_)}}export{_g as AI_MANIFEST,_S as AI_MANIFEST_ATTRIBUTE,_Z as AI_META_JSON_FILENAME,_R as AI_META_JSON_FILENAME_4_RTS,_X as APPLET_CONFIG_NAME,_0 as APPLET_DOCTOR_URL,_I as APPLET_EXTERNAL_MODULE_NAME,_B as APPLET_EXTERNAL_SCRIPT_NAME,xg as APPLET_FOLDER,xd as APPLET_OUTPUT_FOLDER,_q as APPLET_TOOLS_PLUGIN_NAME,_1 as APP_PACKAGE_NAME,eD as AppletLynxPlugin,eV as AppletMainEntryCheckPlugin,eH as AppletMainPlugin,xN as BASE_FOLDER,eY as BuildContext,_K as CONFIG_FILE_EXTENSIONS,_u as CONVENTIONAL_DIR_NAME_MCP_UI,_E as CONVENTIONAL_DIR_NAME_PAGE,_h as CONVENTIONAL_DIR_NAME_TOOLS,_m as CONVENTIONAL_DIR_NAME_WIDGET,_b as CONVENTIONAL_FILE_NAME_APP,_d as CONVENTIONAL_FILE_NAME_APP_4_RTS,_j as CONVENTIONAL_FILE_NAME_LOGIN,_p as CONVENTIONAL_FILE_NAME_PRIVACY,_f as Command,_F as DEVELOPMENT_BROWSER_LIST,_W as DOCUMENT_URL,_w as DOUBAO_APPS_SDK_TEMPLATE_FOLDER,xE as DOUBAO_APP_OUTPUT_FOLDER,az as DevServerLogPlugin,_N as ENTRY_FILE_TS,_y as ENTRY_FILE_TSX,xb as GECKO,_O as INJECT_GLOBAL_VARIABLES_CONTENT,x2 as INTERNAL_FRAMEWORK_PACKAGE,_T as LOGIN,_V as LYNX_APP_SERVICE_JS,_J as LYNX_GLOBAL,_H as LYNX_JS_CODE_INJECT_PLACEHOLDER,_M as LYNX_JS_RENDER_TYPE,_U as LYNX_PROCESSOR_LEPUS,eW as Launcher,_z as MAIN_THREAD_COMPILER_NAME,_Y as MAIN_THREAD_COMPILER_NAME_4_RTS,xF as MAIN_THREAD_ENTRY_KEY,_D as MAIN_THREAD_VIRTUAL_ENTRY_KEY,_$ as MANIFEST_DEFAULT_VERSION,xI as MANIFEST_FILE,xj as PAGES,xy as PLUGINS_FOLDER,_k as PRIVACY,_P as PRODUCTION_BROWSER_LIST,x3 as PUBLIC_FRAMEWORK_PACKAGE,_C as RUNTIME_DEFAULT_VERSION,xu as SCM_GECKO_FOLDER,xh as SCM_SELF_BUILT_FOLDER,xf as SELF_BUILT,xS as SOURCE_DIRECTORY,xm as TRANSFORM_FOLDER,_Q as VIEW_COMPILER_NAME,_L as VIEW_THREAD_VIRTUAL_ENTRY_KEY,eA as ViewConfigCreator,xp as WIDGETS,ei as WorkerConfigCreator,eZ as analyzeMainThreadConvention,eG as analyzeMcpUIEntries,eq as analyzeToolEntries,eR as analyzeViewConvention,eC as analyzeViewEntries,xz as archivePackage,F as chalk_1,eF as collectProperties,ew as collectViewAIMeta,eJ as collectWorkerMetadata,_G as MANIFEST_DEFAULT_APPLET_ICON,xl as ROOT_PATH,ev as createBuilder,e0 as createLaunch,ek as createMainCode,eT as createMainEntryObject,em as createReactLynxEntries,aQ as getDebugDriver,aR as executeDebugScene,A as fileURLToPath,eK as getAppEntry,ah as getAppletLocalAreaNetworkUrl,aK as getDebugScenes,e_ as getExternalBundleExternals,x5 as getFrameworkApiPackage,er as getFrameworkPackageJSONRequests,eB as getKeyName,am as getLocalAreaNetworkAddress,el as getPPEEnvironmentHeader,au as getPreferredLanAddress,eX as getViewEntries,aw as isAppTemplateJsDisabled,eg as isArrayExpression,ej as isBooleanLiteral,ey as isCallExpression,aI as isDebugMode,aF as isExternalBundleDisabled,x6 as isFrameworkPackage,eu as isIdentifier,eN as isKeyValueProperty,ep as isNumericLiteral,eS as isObjectExpression,aN as isProd,aB as isRspeedyDebugMode,aP as isSigningEncryptionDisabled,eI as isSpreadElement,eh as isStringLiteral,y as logger,L as node_fs,n as node_path,D as promises,et as resolveComponentsLoader,x8 as resolveFrameworkPackage,ee as resolveRequest,_l as ECommand};
|
|
144
144
|
//# sourceMappingURL=971.js.map
|
package/dist/cli/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"node:module";import{program as e}from"commander";import"../131.js";import{logger as o,chalk_1 as r}from"../971.js";import{dev as a,build as t,analyze as i}from"../938.js";function n(){if(!process.env.NODE_ENV){let e=process.argv[2];process.env.NODE_ENV=["build","package","deploy","analyze","perf"].includes(e)?"production":"development"}o.greet("Doubao Apps SDK v0.0.
|
|
1
|
+
import"node:module";import{program as e}from"commander";import"../131.js";import{logger as o,chalk_1 as r}from"../971.js";import{dev as a,build as t,analyze as i}from"../938.js";function n(){if(!process.env.NODE_ENV){let e=process.argv[2];process.env.NODE_ENV=["build","package","deploy","analyze","perf"].includes(e)?"production":"development"}o.greet("Doubao Apps SDK v0.0.21")}function c(e){return e.option("-c --config <config>","specify the configuration file, can be a relative or absolute path").option("--env-mode <mode>","specify the env mode to load the `.env.[mode]` file"),e}function p(n=process.cwd(),d={},s="0.0.21"){e.name("doubao").usage("<command> [options]").version(s),c(e.command("dev")).description("starting the dev server...").action(async e=>{try{await a(e)}catch(e){o.error("Failed to dev"),o.error(e),process.exit(1)}}),c(e.command("build")).description("starting build the applet").option("-a --archive","Archive all package",!1).option("-ch --channel <string>","Need channel name").action(async e=>{try{await t(e)}catch(e){o.error("Failed to build"),o.error(e),process.exit(1)}}),c(e.command("analyze")).description("analyze the applet package").action(async e=>{try{await i(e)}catch(e){o.error(r.red("Failed to analyze")),o.error(e),process.exit(1)}}),e.parse()}export{n as prepareCli,p as runCli};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/types.d.ts
CHANGED
|
@@ -1,6 +1,50 @@
|
|
|
1
|
+
import type { JSONSchema7 } from 'json-schema';
|
|
1
2
|
import type { PluginTypeCheckerOptions } from '@rsbuild/plugin-type-check';
|
|
2
3
|
import type { ResolveConfig } from '@rsbuild/core';
|
|
3
4
|
import type { SourceConfig } from '@rsbuild/core';
|
|
5
|
+
import type { ZodType } from 'zod';
|
|
6
|
+
|
|
7
|
+
declare type AIWidgetMetadata = FunctionalToolIODefinition & {
|
|
8
|
+
/**
|
|
9
|
+
* The widget unique identifier
|
|
10
|
+
*/
|
|
11
|
+
id: string;
|
|
12
|
+
/**
|
|
13
|
+
* widget name
|
|
14
|
+
*/
|
|
15
|
+
name?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Describe the characteristics of widget
|
|
18
|
+
*/
|
|
19
|
+
description?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Widget box type in Chat UI
|
|
22
|
+
*/
|
|
23
|
+
boxType?: 'inbox' | 'full_box';
|
|
24
|
+
/**
|
|
25
|
+
* Whether add widget border
|
|
26
|
+
*/
|
|
27
|
+
border?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Keywords of things
|
|
30
|
+
*/
|
|
31
|
+
keywords?: string[];
|
|
32
|
+
/**
|
|
33
|
+
* Icons
|
|
34
|
+
*/
|
|
35
|
+
icons?: string | Record<'1x' | '2x' | '3x', string>;
|
|
36
|
+
/**
|
|
37
|
+
* Set extra widget properties
|
|
38
|
+
*/
|
|
39
|
+
prop?: string;
|
|
40
|
+
/**
|
|
41
|
+
* Widget title type
|
|
42
|
+
* - none: 默认,无标题
|
|
43
|
+
* - normal: 常规标题
|
|
44
|
+
* - float: 浮动标题
|
|
45
|
+
*/
|
|
46
|
+
titleType?: 'none' | 'normal' | 'float';
|
|
47
|
+
};
|
|
4
48
|
|
|
5
49
|
export declare const defineConfig: (config: DoubaoAppsBuildConfig) => DoubaoAppsBuildConfig;
|
|
6
50
|
|
|
@@ -20,17 +64,42 @@ export declare interface DoubaoAppsBuildConfig {
|
|
|
20
64
|
/**
|
|
21
65
|
* taro experiment config
|
|
22
66
|
*/
|
|
23
|
-
taro?:
|
|
24
|
-
/**
|
|
25
|
-
* doubao app name
|
|
26
|
-
*/
|
|
27
|
-
name: string;
|
|
28
|
-
/**
|
|
29
|
-
* doubao app package name
|
|
30
|
-
*/
|
|
31
|
-
packageName: string;
|
|
32
|
-
};
|
|
67
|
+
taro?: TaroPluginOptions;
|
|
33
68
|
};
|
|
34
69
|
}
|
|
35
70
|
|
|
71
|
+
/**
|
|
72
|
+
*
|
|
73
|
+
* 拥有 Input 和 Output 的模块有 page、widget、tool
|
|
74
|
+
*/
|
|
75
|
+
declare interface FunctionalToolIODefinition {
|
|
76
|
+
/**
|
|
77
|
+
* The tool's input params
|
|
78
|
+
*/
|
|
79
|
+
input?: SchemaType;
|
|
80
|
+
/**
|
|
81
|
+
* The tool's output
|
|
82
|
+
*/
|
|
83
|
+
output?: SchemaType;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
declare type SchemaType = JSONSchema7 | ZodType;
|
|
87
|
+
|
|
88
|
+
export declare interface TaroPluginOptions {
|
|
89
|
+
/**
|
|
90
|
+
* doubao app name
|
|
91
|
+
*/
|
|
92
|
+
name: string;
|
|
93
|
+
/**
|
|
94
|
+
* doubao app id
|
|
95
|
+
*/
|
|
96
|
+
appId: string;
|
|
97
|
+
/**
|
|
98
|
+
* widget metadata config
|
|
99
|
+
*/
|
|
100
|
+
widgets?: Record<string, TaroWidgetOptions>;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
declare type TaroWidgetOptions = Omit<AIWidgetMetadata, 'id'>;
|
|
104
|
+
|
|
36
105
|
export { }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@doubao-apps/kit",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.21",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"types": "./dist/types.d.ts",
|
|
6
6
|
"bin": {
|
|
@@ -54,6 +54,7 @@
|
|
|
54
54
|
"@rsbuild/plugin-svgr": "1.2.0",
|
|
55
55
|
"@rsbuild/plugin-type-check": "1.2.1",
|
|
56
56
|
"@swc/core": "1.15.11",
|
|
57
|
+
"@types/json-schema": "7.0.15",
|
|
57
58
|
"ansi-escapes": "7.2.0",
|
|
58
59
|
"archiver": "7.0.1",
|
|
59
60
|
"axios": "1.13.6",
|
|
@@ -75,7 +76,8 @@
|
|
|
75
76
|
"swc-walk": "1.0.1",
|
|
76
77
|
"tapable": "2.2.1",
|
|
77
78
|
"tmp": "0.2.5",
|
|
78
|
-
"uqr": "0.1.2"
|
|
79
|
+
"uqr": "0.1.2",
|
|
80
|
+
"zod": "3.23.8"
|
|
79
81
|
},
|
|
80
82
|
"publishConfig": {
|
|
81
83
|
"access": "public",
|