@doubao-apps/kit 0.0.21 → 0.0.23

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.
@@ -1,3 +1,3 @@
1
- import"node:module";import e from"magic-string";import{parseSync as o,simple as t}from"../../../131.js";let r={button:"DoubaoButton",map:"DoubaoMap","map-marker":"DoubaoMapMarker","movable-area":"DoubaoMovableArea","movable-view":"DoubaoMovableView",popup:"DoubaoPopup",radio:"DoubaoRadio","radio-group":"DoubaoRadioGroup",slider:"DoubaoSlider",switch:"DoubaoSwitch",swiper:"DoubaoSwiper","swiper-item":"DoubaoSwiperItem","picker-column":"DoubaoPickerColumn","picker-view":"DoubaoPickerView","web-view":"DoubaoWebView",image:"DoubaoImage",input:"DoubaoInput",list:"DoubaoList","scroll-view":"DoubaoScrollView",svg:"DoubaoSvg",text:"DoubaoText",textarea:"DoubaoTextArea",view:"DoubaoView"};function a(e){return"Identifier"===e.type&&e.value in r?e.value:null}function i(e,o,t,r,a){if("Identifier"!==o.type)return;let i=a(o.span.start-r),n=a(o.span.end-r);e.overwrite(i,n,t)}export default function(n){let u=this.async();try{let l=new e(n),p=o(n,{syntax:"typescript",tsx:!0,decorators:!0}),b=p.span.start,s=function(e){let o=new Map([[0,0]]),t=0,r=0;for(let a of e)t+=Buffer.byteLength(a),r+=a.length,o.set(t,r);return e=>{let t=o.get(e);if(void 0===t)throw Error(`Unable to map byte offset ${e} to string index`);return t}}(n),m=new Set;if(t(p,{JSXOpeningElement(e){let o=a(e.name);if(!o)return;let t=r[o];i(l,e.name,t,b,s),m.add(t)},JSXClosingElement(e){let o=a(e.name);if(!o)return;let t=r[o];i(l,e.name,t,b,s),m.add(t)}}),m.size>0){let e=Array.from(m).map(e=>{let o=e.replace("Doubao","");return`${o} as ${e}`}).join(", "),o=`import { ${e} } from '@byted-doubao-apps/framework/components';
2
- `;l.prepend(o)}if(l.hasChanged()){let e=l.toString(),o=l.generateMap({includeContent:!0,hires:!0,source:this.resourcePath,file:this.resourcePath});u(null,e,o)}else u(null,n)}catch(e){u(null,n)}};
1
+ import"node:module";import e from"magic-string";import{parseSync as o,simple as t}from"../../../131.js";let r={button:"DoubaoButton",map:"DoubaoMap","map-marker":"DoubaoMapMarker","movable-area":"DoubaoMovableArea","movable-view":"DoubaoMovableView",popup:"DoubaoPopup",radio:"DoubaoRadio","radio-group":"DoubaoRadioGroup",slider:"DoubaoSlider",switch:"DoubaoSwitch",swiper:"DoubaoSwiper","swiper-item":"DoubaoSwiperItem","picker-column":"DoubaoPickerColumn","picker-view":"DoubaoPickerView","web-view":"DoubaoWebView",image:"DoubaoImage",input:"DoubaoInput",list:"DoubaoList","scroll-view":"DoubaoScrollView",svg:"DoubaoSvg",text:"DoubaoText",textarea:"DoubaoTextArea",view:"DoubaoView"};function a(e){return"Identifier"===e.type&&e.value in r?e.value:null}function n(e,o,t,r,a){if("Identifier"!==o.type)return;let n=a(o.span.start-r),i=a(o.span.end-r);e.overwrite(n,i,t)}export default function(i){let u=this.async();try{let l=new e(i),p=o(i,{syntax:"typescript",tsx:!0,decorators:!0}),b=function(e){let o=0;for(;o<e.length;){let t=e[o];if(" "===t||" "===t||"\n"===t||"\r"===t||"\f"===t){o+=1;continue}if("/"===t&&"/"===e[o+1]){for(o+=2;o<e.length&&"\n"!==e[o];)o+=1;continue}if("/"===t&&"*"===e[o+1]){for(o+=2;o<e.length&&("*"!==e[o]||"/"!==e[o+1]);)o+=1;o<e.length&&(o+=2);continue}break}return Buffer.byteLength(e.slice(0,o))}(i),s=Math.max(0,p.span.start-b),f=function(e){let o=new Map([[0,0]]),t=0,r=0;for(let a of e)t+=Buffer.byteLength(a),r+=a.length,o.set(t,r);return e=>{let t=o.get(e);if(void 0===t)throw Error(`Unable to map byte offset ${e} to string index`);return t}}(i),m=new Set;if(t(p,{JSXOpeningElement(e){let o=a(e.name);if(!o)return;let t=r[o];n(l,e.name,t,s,f),m.add(t)},JSXClosingElement(e){let o=a(e.name);if(!o)return;let t=r[o];n(l,e.name,t,s,f),m.add(t)}}),m.size>0){let e=Array.from(m).map(e=>{let o=e.replace("Doubao","");return`${o} as ${e}`}).join(", "),o=`import { ${e} } from '@byted-doubao-apps/framework/components';
2
+ `;l.prepend(o)}if(l.hasChanged()){let e=l.toString(),o=l.generateMap({includeContent:!0,hires:!0,source:this.resourcePath,file:this.resourcePath});u(null,e,o)}else u(null,i)}catch(e){u(null,i)}};
3
3
  //# sourceMappingURL=index.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.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};
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.23")}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.23"){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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@doubao-apps/kit",
3
- "version": "0.0.21",
3
+ "version": "0.0.23",
4
4
  "type": "module",
5
5
  "types": "./dist/types.d.ts",
6
6
  "bin": {