@ohos-ports/codemod.com-workflow 0.0.31-beta.0 → 0.0.31-beta.1

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.
Files changed (2) hide show
  1. package/dist/index.mjs +1 -1
  2. package/package.json +2 -2
package/dist/index.mjs CHANGED
@@ -9,7 +9,7 @@ var ns=Object.defineProperty;var De=(t=>typeof require<"u"?require:typeof Proxy<
9
9
  */var T={blueBright:t=>ye.blue_bt(t),green:t=>ye.green(t),red:t=>ye.red(t),yellow:t=>ye.yellow(t)};var W=t=>(console.info(`${T.blueBright("RUN ")} ${t}`),{success:e=>console.info(`${T.green("SUCC")} ${t}${e?`
10
10
  ${e.split(`
11
11
  `).map(r=>`
12
- ${r}`).join("").trim()}`:""}`),fail:e=>console.error(`${T.red("ERR ")} ${t} - ${e}`),warn:e=>console.warn(`${T.yellow("WARN")} ${t} - ${e}`)});var K=(t,e=/[\n,; ]/)=>typeof t=="string"?t.split(e).map(r=>r.trim()).filter(_t):Ye(t.map(r=>r.split(e).map(o=>o.trim()))).filter(_t),Mt=t=>t();var Xo=new Map,Q=(t,e)=>(Xo.set(t,e),e),Zo=new V,Ef=()=>Zo.getStore()??Mt,we=Q("git",new V),be=Q("astGrepNodeContext",new V),tn=Q("describeContext",new V),Lf=Q("migrateContext",new V),G=Q("cwdContext",new V),_e=Q("parentCwdContext",new V),pt=Q("fileContext",new V),X=Q("repositoryContext",new V),en=Q("repositoriesContext",new V),If=()=>[...Xo.entries()].map(([t,e])=>[t,e.getStore()]).filter(([,t])=>typeof t<"u"),L=()=>{let t=be.getStore();return Bt(t,"No ast-grep node context found"),t},v=()=>G.getStore()??{cwd:process.cwd()},Qe=()=>_e.getStore()??{cwd:process.cwd()},b=()=>{let t=pt.getStore();return Bt(t,"No file context found"),t},zt=()=>{let t=we.getStore();return t||new wt({repository:"",id:""})},Xe=()=>{let t=X.getStore();return Bt(t,"No repository context found"),t},Of=()=>{let t=en.getStore();return Bt(t,"No repositories context found"),t},kf=()=>{let t=tn.getStore();return Bt(t,"No describe context found"),t};import{AsyncLocalStorage as rr}from"node:async_hooks";import{createHash as jf}from"node:crypto";var ft=class extends Promise{#e;#t;constructor(e){super(r=>{r()}),this.#e=e}static from(e){return new ft(r=>{r(e())})}static resolve(e){return new ft(r=>{r(e)})}static reject(e){return new ft((r,o)=>{o(e)})}then(e,r){return this.#t??=new Promise(this.#e),this.#t.then(e,r)}catch(e){return this.#t=this.#t||new Promise(this.#e),this.#t.catch(e)}};function Df(t){let e=jf("sha1");return e.update(JSON.stringify(t)),e.digest("hex")}var er=class{name;hash;arguments;children;constructor(e,r,o){this.name=e,this.arguments=o.map(n=>String(n)),this.hash=Df({name:e,fn:r.toString(),args:o}),this.children=[]}},rn=new rr,Ae=new rr,tr=new rr,on={children:[]},nn=()=>on;function m(t,e){return(...r)=>{let o=Ae.getStore(),n=new er(t,e.toString(),r);return o?o.children.push(n):on.children.push(n),rn.run(n,e,...r)}}var c=class{constructor(e){this.name=e;this._context=rn.getStore(),this._parentWrapper=tr.getStore()??Mt}_init;_helpers;_return;_context;_copyHelpersToPromise=!0;_executor;_parentWrapper;_callback;_arguments;_done;parentArgs=[];childArgs=[];initiated=!1;setParentArgs(...e){return this.parentArgs=e,this}getChildArgs(){return this.childArgs}getChildArg(e){return this.childArgs.find(r=>typeof r[e]<"u")?.[e]}doNotCopyHelpersToPromise(){return this._copyHelpersToPromise=!1,this}init(e){return e&&(this._init=D(e)),this}done(e){return this._done=e,this}arguments(e){return this._arguments=e,this}getArguments(){return this._arguments?.(this)}helpers(e){return this._helpers=e,this}callback(e){return this._callback=e,this}wrappedHelpers(){return gt(typeof this._helpers=="function"?this._helpers(this):this._helpers,e=>(...r)=>Ae.run(this._context,()=>tr.run(this.context(),()=>e(...r))))}wrapHelpers(e){return gt(e,r=>(...o)=>Ae.run(this._context,()=>tr.run(this.context(),()=>r(...o))))}context(){return(e,...r)=>(this.childArgs=r,this._parentWrapper(()=>(this._executor??Mt)(async()=>(this._init&&!this.initiated&&(this.initiated=!0,await this._init(this)),this._callback&&await Ae.run(this._context,this._callback,this),e?.()),this),...this.parentArgs))}return(e){return this._return=e,this}executor(e){return this._executor=e,this}run(){let e=new ft((r,o)=>{(async()=>{let n,s=!1;return await this.context()(async()=>{n=await this._return?.(this),s=!0}),s||(n=await this._return?.(this)),n})().then(r).catch(o)});if(this._copyHelpersToPromise){let r=this.wrappedHelpers();for(let o in r)e[o]=r[o]}return e}};import*as sn from"node:child_process";import*as an from"node:fs";import or from"tree-kill";var rt=(t,e,r={})=>{let o=r.cwd??process.cwd();return an.existsSync(o)?new Promise((n,s)=>{let{doNotThrowError:i,printOutput:a,printNewline:p,watch:f,doNotKill:l,filterEnv:u,...d}=r,h=Ve({...process.env,...d?.env,FORCE_COLOR:""},(R,j)=>u?.(j,R)??!0),g=sn.spawn(t,e,{...d,cwd:o,env:h}),y=g.pid,C=[],H=[],w,P=!1,E=l?()=>{P=!0,or(y,"SIGKILL"),g.stdin.end(),g.stdout.destroy(),g.stderr.destroy()}:Ge;g.stdout.on("data",R=>{let j=R.toString();if(H.push(j),j.includes("Proceed")&&g.stdin.write(`y
12
+ ${r}`).join("").trim()}`:""}`),fail:e=>console.error(`${T.red("ERR ")} ${t} - ${e}`),warn:e=>console.warn(`${T.yellow("WARN")} ${t} - ${e}`)});var K=(t,e=/[\n,; ]/)=>typeof t=="string"?t.split(e).map(r=>r.trim()).filter(_t):Ye(t.map(r=>r.split(e).map(o=>o.trim()))).filter(_t),Mt=t=>t();var Xo=new Map,Q=(t,e)=>(Xo.set(t,e),e),Zo=new V,Ef=()=>Zo.getStore()??Mt,we=Q("git",new V),be=Q("astGrepNodeContext",new V),tn=Q("describeContext",new V),Lf=Q("migrateContext",new V),G=Q("cwdContext",new V),_e=Q("parentCwdContext",new V),pt=Q("fileContext",new V),X=Q("repositoryContext",new V),en=Q("repositoriesContext",new V),If=()=>[...Xo.entries()].map(([t,e])=>[t,e.getStore()]).filter(([,t])=>typeof t<"u"),L=()=>{let t=be.getStore();return Bt(t,"No ast-grep node context found"),t},v=()=>G.getStore()??{cwd:process.cwd()},Qe=()=>_e.getStore()??{cwd:process.cwd()},b=()=>{let t=pt.getStore();return Bt(t,"No file context found"),t},zt=()=>{let t=we.getStore();return t||new wt({repository:"",id:""})},Xe=()=>{let t=X.getStore();return Bt(t,"No repository context found"),t},Of=()=>{let t=en.getStore();return Bt(t,"No repositories context found"),t},kf=()=>{let t=tn.getStore();return Bt(t,"No describe context found"),t};import{AsyncLocalStorage as rr}from"node:async_hooks";import{createHash as jf}from"node:crypto";var ft=class extends Promise{#e;#t;constructor(e){super(r=>{r()}),this.#e=e}static from(e){return new ft(r=>{r(e())})}static resolve(e){return new ft(r=>{r(e)})}static reject(e){return new ft((r,o)=>{o(e)})}then(e,r){return this.#t??=new Promise(this.#e),this.#t.then(e,r)}catch(e){return this.#t=this.#t||new Promise(this.#e),this.#t.catch(e)}};function Df(t){let e=jf("sha1");return e.update(JSON.stringify(t)),e.digest("hex")}var er=class{name;hash;arguments;children;constructor(e,r,o){this.name=e,this.arguments=o.map(n=>String(n)),this.hash=Df({name:e,fn:r.toString(),args:o}),this.children=[]}},rn=new rr,Ae=new rr,tr=new rr,on={children:[]},nn=()=>on;function m(t,e){return(...r)=>{let o=Ae.getStore(),n=new er(t,e.toString(),r);return o?o.children.push(n):on.children.push(n),rn.run(n,e,...r)}}var c=class{constructor(e){this.name=e;this._context=rn.getStore(),this._parentWrapper=tr.getStore()??Mt}_init;_helpers;_return;_context;_copyHelpersToPromise=!0;_executor;_parentWrapper;_callback;_arguments;_done;parentArgs=[];childArgs=[];initiated=!1;setParentArgs(...e){return this.parentArgs=e,this}getChildArgs(){return this.childArgs}getChildArg(e){return this.childArgs.find(r=>typeof r[e]<"u")?.[e]}doNotCopyHelpersToPromise(){return this._copyHelpersToPromise=!1,this}init(e){return e&&(this._init=D(e)),this}done(e){return this._done=e,this}arguments(e){return this._arguments=e,this}getArguments(){return this._arguments?.(this)}helpers(e){return this._helpers=e,this}callback(e){return this._callback=e,this}wrappedHelpers(){return gt(typeof this._helpers=="function"?this._helpers(this):this._helpers,e=>(...r)=>Ae.run(this._context,()=>tr.run(this.context(),()=>e(...r))))}wrapHelpers(e){return gt(e,r=>(...o)=>Ae.run(this._context,()=>tr.run(this.context(),()=>r(...o))))}context(){return(e,...r)=>(this.childArgs=r,this._parentWrapper(()=>(this._executor??Mt)(async()=>(this._init&&!this.initiated&&(this.initiated=!0,await this._init(this)),this._callback&&await Ae.run(this._context,this._callback,this),e?.()),this),...this.parentArgs))}return(e){return this._return=e,this}executor(e){return this._executor=e,this}run(){let e=new ft((r,o)=>{(async()=>{let n,s=!1;return await this.context()(async()=>{n=await this._return?.(this),s=!0}),s||(n=await this._return?.(this)),n})().then(r).catch(o)});if(this._copyHelpersToPromise){let r=this.wrappedHelpers();for(let o in r)e[o]=r[o]}return e}};import*as sn from"node:child_process";import*as an from"node:fs";import or from"@ohos-ports/tree-kill";var rt=(t,e,r={})=>{let o=r.cwd??process.cwd();return an.existsSync(o)?new Promise((n,s)=>{let{doNotThrowError:i,printOutput:a,printNewline:p,watch:f,doNotKill:l,filterEnv:u,...d}=r,h=Ve({...process.env,...d?.env,FORCE_COLOR:""},(R,j)=>u?.(j,R)??!0),g=sn.spawn(t,e,{...d,cwd:o,env:h}),y=g.pid,C=[],H=[],w,P=!1,E=l?()=>{P=!0,or(y,"SIGKILL"),g.stdin.end(),g.stdout.destroy(),g.stderr.destroy()}:Ge;g.stdout.on("data",R=>{let j=R.toString();if(H.push(j),j.includes("Proceed")&&g.stdin.write(`y
13
13
  `),f&&j.includes(f)){l||(P=!0,or(y,"SIGKILL"),g.stdin.end(),g.stdout.destroy(),g.stderr.destroy()),n({stdout:H,stderr:C,error:w,kill:E});return}P||(a&&process.stdout.write(j),p&&g.stdin.write(`
14
14
  `))}),g.stderr.on("data",R=>{let j=R.toString();if(C.push(j),f&&j.includes(f)){l||(P=!0,or(y,"SIGKILL"),g.stdin.end(),g.stdout.destroy(),g.stderr.destroy()),n({stdout:H,stderr:C,error:w,kill:E});return}P||(a&&process.stdout.write(j),p&&g.stdin.write(`
15
15
  `))}),g.on("error",R=>{w=R}),g.on("close",R=>{if(!i){if(w){s(new Error(`Failed to execute command "${t} ${e.join(" ")}" with error ${w.toString()}`));return}if(R){console.error(H.join(`
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@ohos-ports/codemod.com-workflow",
3
3
  "author": "Codemod, Inc.",
4
4
  "type": "module",
5
- "version": "0.0.31-beta.0",
5
+ "version": "0.0.31-beta.1",
6
6
  "description": "Workflow Engine for Codemod",
7
7
  "main": "./dist/index.mjs",
8
8
  "types": "./dist/index.d.ts",
@@ -40,7 +40,7 @@
40
40
  "openai": "4.23.0",
41
41
  "prettier": "^3.2.5",
42
42
  "simple-git": "^3.24.0",
43
- "tree-kill": "^1.2.2",
43
+ "@ohos-ports/tree-kill": "^1.2.2-beta.0",
44
44
  "ts-invariant": "^0.10.3",
45
45
  "yaml": "^2.4.5",
46
46
  "inquirer": "^9.2.16",