@doubao-apps/kit 0.0.29-rc.0 → 0.0.29
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/288.js +1 -1
- package/dist/cli/index.js +1 -1
- package/package.json +1 -1
package/dist/288.js
CHANGED
|
@@ -54,7 +54,7 @@ ${a}
|
|
|
54
54
|
${aa("Doubao Apps Server Info")}
|
|
55
55
|
|
|
56
56
|
Debug Server is not running.`})(s,o));for(let _ of x.consumeDevServerMessages())console.warn(_);_2.instance.addListener(x=>{let _={r:async()=>{let x=await ax();x?await _8(x).catch(x=>(S.error(`Reload app failed: ${x.message}`),!1))?(await new Promise(x=>{setTimeout(x,5e3)}),a)?ac(s,o,n.pages,n.widgets,a,e):S.error("Debug Driver is not Ready."):setTimeout(()=>{S.info(`'Please insure the app has been launched!'
|
|
57
|
-
`)},1e3):S.info("Try to push applet to Android, but no devices detected.\n")}}[x.slice(0,-1).toLowerCase()];return!!_&&(process.stdout.write(J.eraseLines(2)),_(),!0)},"devCommands",-1),a?ac(s,o,n.pages,n.widgets,a,e):S.info("Try to push app to Android, but no devices detected.\n")}let af=async(_={})=>{let{hdt:a,deviceId:e}=_;if(!x){let _=e??await ax();x=a?new ao:new a_(_??"")}return x},ad=h("crypto");class ab{constructor(x,_,a){this._content=_,this._hashCode=a,this.source=x}get content(){return this._content}get hashCode(){var x;return this._hashCode||(x=this.content,ad.default.createHash("sha256").update(x).digest("hex").substring(0,8))}}class aE extends ab{constructor(x,_){super(x,_),this._manifest={applet:{pages:[],tools:[]},widgets:[]};try{this._manifest=O(this._manifest,JSON.parse(_))}catch(x){}this.destination=x}get manifest(){return this._manifest}get content(){return JSON.stringify({manifestVersion:this._manifest.manifestVersion,packageName:this._manifest.packageName,appId:this._manifest.appId,scmVersion:this._manifest.scmVersion,versionCode:this._manifest.versionCode,runtimeVersion:this._manifest.runtimeVersion,sourceType:this._manifest.sourceType,permissions:this._manifest.permissions,applet:this._manifest.applet,widgets:this._manifest.widgets},null,2)}setManifestVersion(x){this._manifest.manifestVersion=x}setRuntimeVersion(x){this._manifest.runtimeVersion=x}setPackageName(x){this._manifest.packageName=x}setVersionName(x){this._manifest.versionName=x}assignBasicManifest(x){Object.assign(this._manifest,x)}mergeBasicManifest(x){O(this._manifest,x)}setSCMVersion(x){this._manifest.scmVersion=x}setVersionCode(x){this._manifest.versionCode=x}setAppletManifest(x){this._manifest.applet=x}mergeAppletManifest(x){O(this._manifest.applet,x)}setRenderType(x=xr.REACT_LYNX){this._manifest.renderType=x}appendWidget(x){this._manifest.widgets||(this._manifest.widgets=[]),this._manifest.widgets.push(x)}appendPage(x){this._manifest.applet.pages||(this._manifest.applet.pages=[]),this._manifest.applet.pages.push(x)}toString(){return JSON.stringify(this._manifest,null,2)}}class am{constructor(){this.assets={}}addAsset(x,_){this.assets[x]=_}deleteAsset(x){delete this.assets[x]}getAsset(x){return this.assets[x]}getAssets(){return this.assets}getManifestAsset(x){return this.getAsset(x)||(this.assets[x]=new aE(x,JSON.stringify({}))),this.getAsset(x)}}class au{options;constructor(x){this.options=x}apply(x){let _,{pluginSystem:a}=this.options;x.hooks.thisCompilation.tap({name:au.name,stage:x.rspack.Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE},e=>{e.hooks.processAssets.tapPromise({name:au.name,stage:x.rspack.Compilation.PROCESS_ASSETS_STAGE_REPORT},async()=>{_=new am;let{entrypoints:t}=e,r={};t.forEach((x,
|
|
57
|
+
`)},1e3):S.info("Try to push applet to Android, but no devices detected.\n")}}[x.slice(0,-1).toLowerCase()];return!!_&&(process.stdout.write(J.eraseLines(2)),_(),!0)},"devCommands",-1),a?ac(s,o,n.pages,n.widgets,a,e):S.info("Try to push app to Android, but no devices detected.\n")}let af=async(_={})=>{let{hdt:a,deviceId:e}=_;if(!x){let _=e??await ax();x=a?new ao:new a_(_??"")}return x},ad=h("crypto");class ab{constructor(x,_,a){this._content=_,this._hashCode=a,this.source=x}get content(){return this._content}get hashCode(){var x;return this._hashCode||(x=this.content,ad.default.createHash("sha256").update(x).digest("hex").substring(0,8))}}class aE extends ab{constructor(x,_){super(x,_),this._manifest={applet:{pages:[],tools:[]},widgets:[]};try{this._manifest=O(this._manifest,JSON.parse(_))}catch(x){}this.destination=x}get manifest(){return this._manifest}get content(){return JSON.stringify({manifestVersion:this._manifest.manifestVersion,packageName:this._manifest.packageName,appId:this._manifest.appId,scmVersion:this._manifest.scmVersion,versionCode:this._manifest.versionCode,runtimeVersion:this._manifest.runtimeVersion,sourceType:this._manifest.sourceType,permissions:this._manifest.permissions,applet:this._manifest.applet,widgets:this._manifest.widgets},null,2)}setManifestVersion(x){this._manifest.manifestVersion=x}setRuntimeVersion(x){this._manifest.runtimeVersion=x}setPackageName(x){this._manifest.packageName=x}setVersionName(x){this._manifest.versionName=x}assignBasicManifest(x){Object.assign(this._manifest,x)}mergeBasicManifest(x){O(this._manifest,x)}setSCMVersion(x){this._manifest.scmVersion=x}setVersionCode(x){this._manifest.versionCode=x}setAppletManifest(x){this._manifest.applet=x}mergeAppletManifest(x){O(this._manifest.applet,x)}setRenderType(x=xr.REACT_LYNX){this._manifest.renderType=x}appendWidget(x){this._manifest.widgets||(this._manifest.widgets=[]),this._manifest.widgets.push(x)}appendPage(x){this._manifest.applet.pages||(this._manifest.applet.pages=[]),this._manifest.applet.pages.push(x)}toString(){return JSON.stringify(this._manifest,null,2)}}class am{constructor(){this.assets={}}addAsset(x,_){this.assets[x]=_}deleteAsset(x){delete this.assets[x]}getAsset(x){return this.assets[x]}getAssets(){return this.assets}getManifestAsset(x){return this.getAsset(x)||(this.assets[x]=new aE(x,JSON.stringify({}))),this.getAsset(x)}}class au{options;constructor(x){this.options=x}apply(x){let _,{pluginSystem:a}=this.options;x.hooks.thisCompilation.tap({name:au.name,stage:x.rspack.Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE},e=>{e.hooks.processAssets.tapPromise({name:au.name,stage:x.rspack.Compilation.PROCESS_ASSETS_STAGE_REPORT},async()=>{_=new am,e.getAssets().forEach(x=>{let a=new ab(x.name,x.source.source(),x.info.contenthash?.[0]);_.addAsset(x.name,a)});let{entrypoints:t}=e,r={};t.forEach((x,a)=>{r[a]=x.getFiles().map(x=>{let a=_.getAsset(x);if(!a)throw Error(`Asset ${x} not found`);return new ab(a.source,a.content,a.hashCode)})});let A=this.options.context.appId;A&&x$.default.mkdirSync(xs.default.join(this.options.context.rootPath,A),{recursive:!0}),await a.callAssetsHooks("beforeEmit",{assets:_,chunks:r}),Object.keys(_.getAssets()).forEach(a=>{let t=_.getAsset(a);if(!t)return;let{source:r,destination:A}=t;if(!r||!A)return;e.getAsset(r)?e.renameAsset(r,A):e.emitAsset(A,new x.rspack.sources.RawSource(t.content));let n=e.getAsset(`${r}.map`);n&&e.renameAsset(n.name,`${A}.map`)}),await a.callAssetsHooks("afterEmit",{assets:{..._.getAssets()}})})})}}class ah{options;constructor(x){this.options=x}apply(x){x.hooks.make.tapPromise(ah.name,async()=>{await this.options.pluginSystem.callViewHooks("collectMetaData",{collector:this.options.context.metadata})}),x.hooks.thisCompilation.tap(ah.name,x=>{x.hooks.optimizeTree.tapPromise(ah.name,async _=>{await this.options.pluginSystem.callViewHooks("build",{metadata:this.options.context.metadata,fileDependencies:x.fileDependencies})})}),x.hooks.done.tapPromise(ah.name,async x=>{await this.options.pluginSystem.callViewHooks("afterBuild",{stats:x})})}}let ap="/doubao-apps-framework.template.js",aj="/doubao-apps-api.template.js";function aS(x,_,a){return{libraryName:a,url:x,background:{sectionPath:_},mainThread:{sectionPath:`${_}__main-thread`},async:!1}}let ag=x=>({"@byted-doubao-apps/bridge-base":aS(aj,"api"),"@byted-doubao-apps/open-api":aS(aj,"api"),...Object.fromEntries(Object.entries(xu).map(([_,a])=>[_,aS(x?"/doubao-apps-react-dev.template.js":"/doubao-apps-react.template.js","reactLynx",["reactLynx",a])])),[`${xJ}/api`]:aS(aj,"api"),[`${xH}/api`]:aS(aj,"api"),[xJ]:aS(ap,"framework"),[xH]:aS(ap,"framework"),"@byted-doubao-apps/components":aS(ap,"components"),[xM(xJ)]:aS(ap,"components"),[xM(xH)]:aS(ap,"components")}),ay=L(import.meta.url);function aN(x,_){for(let a of x)try{return ay.resolve(a,{paths:_})}catch{}throw Error(`Cannot resolve package from candidates: ${x.join(", ")}`)}class aI{pluginSystem;constructor(x){this.pluginSystem=x}async createEntry(){let{entry:x}=await this.pluginSystem.callViewHooks("modifyEntryOption",{entry:{}});return x}async createConfig({config:x}){var _,a,e,t;let{appDirectory:r,command:A,metadata:s,rootPath:c}=x.context,i=x.context.environment;await this.pluginSystem.callViewHooks("modifyEnvironment",{environment:i}),x.context.setEnvironment(i);let o=await this.createEntry(),v=xQ(r),l=[r,xs.default.dirname(n(import.meta.url))],f=$({mode:A===_v.DEV?"development":"production",tools:{rspack:{module:{rules:[{enforce:"pre",test:/\.(t|j)sx$/,loader:aN(v===xH?["@doubao-apps/kit/components-loader","@byted-doubao-apps/kit/components-loader"]:["@byted-doubao-apps/kit/components-loader","@doubao-apps/kit/components-loader"],l)}]}}},source:{entry:Object.fromEntries(Object.entries(o).map(([x,_])=>[x,[xi,`${v}/components-style`,_.filename]])),include:x.options.source?.include,exclude:x.options.source?.exclude,decorators:x.options.source?.decorators,define:{...x.options.source?.define,__MAIN_PROCESS__:JSON.stringify(!1),__LEPUS__:JSON.stringify(!1),__LYNXVIEW__:JSON.stringify(!0),"process.env":"({})"}},server:{host:_Q()},dev:{writeToDisk:_O(),hmr:A===_v.DEV},output:{distPath:{js:"base/common",root:c||"dist"},cleanDistPath:!1,filename:{bundle:"[name]/template.js"},dataUriLimit:5120},resolve:{alias:{...x.options.source?.alias,...x.options.resolve?.alias}},performance:{printFileSize:_O(),..._J()?{chunkSplit:{strategy:"split-by-experience"}}:{}},plugins:[{name:"replace-lynx-react-alias",setup(x){q({LAYERS:X,lazy:!1,rootPath:aN(v===xH?[`${xH}/package.json`,`${xJ}/package.json`]:[`${xJ}/package.json`,`${xH}/package.json`],l)}).setup(x)}},{name:"set-server.printUrls-false",setup(x){x.modifyRsbuildConfig((x,{mergeRsbuildConfig:_})=>_(x,{server:{printUrls:!1}}))}},K({compat:{componentsPkg:[],newRuntimePkg:v,oldRuntimePkg:[]},enableCSSInheritance:!0,shake:{pkgName:[...xV]}}),function(x,_){let{compilerOptionsKeys:a=_I.compilerOptionsKeys,configKeys:e=_I.configKeys,validate:t=_K,dslPluginName2PkgName:r=_Z,upgradeRspeedyLink:A="https://www.npmjs.com/package/upgrade-rspeedy"}=(void 0)??{};return t(x),{name:"lynx:config",async setup(_){_.expose(Symbol.for("lynx.config"),{config:x}),_.modifyBundlerChain(t=>{let n=_.useExposed(Symbol.for("LynxTemplatePlugin"));if(!n){let x="Rspeedy and plugins";throw Object.entries(r).forEach(([a,e])=>{_.isPluginExists(a)&&(x=e)}),Error(`\
|
|
58
58
|
[pluginLynxConfig] No \`LynxTemplatePlugin\` exposed to ${_w("the plugin API","https://rsbuild.rs/plugins/dev/core#apiexpose")}.
|
|
59
59
|
|
|
60
60
|
Please upgrade ${x} to latest version.
|
package/dist/cli/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"node:module";import{program as e}from"commander";import{logger as o,chalk_0 as r}from"../288.js";import{dev as a,login as t,build as i,analyze as n}from"../29.js";function c(){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.29
|
|
1
|
+
import"node:module";import{program as e}from"commander";import{logger as o,chalk_0 as r}from"../288.js";import{dev as a,login as t,build as i,analyze as n}from"../29.js";function c(){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.29")}function s(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(c=process.cwd(),d={},l="0.0.29"){var m;e.name("doubao").usage("<command> [options]").version(l),s(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)}}),((m=e.command("login")).option("--login-browser <browser>","browser for interactive login: system Chrome/Edge first, optional Playwright Chromium fallback (auto/chrome/msedge/chromium)","auto").option("--login-browser-path <path>","custom Chromium-based browser executable path for login"),m).description("login to Doubao Apps").action(async e=>{try{await t(e),o.info(r.green("Login succeeded."))}catch(e){o.error(r.red("Failed to login")),o.error(e),process.exit(1)}}),s(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 i(e)}catch(e){o.error("Failed to build"),o.error(e),process.exit(1)}}),s(e.command("analyze")).description("analyze the applet package").action(async e=>{try{await n(e)}catch(e){o.error(r.red("Failed to analyze")),o.error(e),process.exit(1)}}),e.parse()}export{c as prepareCli,p as runCli};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|