@tsmodule/tsmodule 39.0.1 → 40.0.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.
- package/dist/commands/build/index.d.ts +2 -1
- package/dist/commands/build/index.js +15 -15
- package/dist/commands/create/index.js +1 -1
- package/dist/commands/dev/index.js +19 -19
- package/dist/commands/index.js +21 -21
- package/dist/commands/normalize/index.js +4 -4
- package/dist/commands/normalize/lib/typescriptApi.js +8 -8
- package/dist/constants.js +1 -1
- package/dist/index.js +30 -30
- package/dist/types/index.js +21 -21
- package/package.json +14 -14
- package/templates/react/package.json +3 -0
@@ -14,5 +14,5 @@ $ ${s} ${l.join(" ")}
|
|
14
14
|
`)),await new Promise((a,f)=>{n=Un(s,l,i);let c="",d="";if(!n)throw new Error("Child process was not set.");let y=m=>{n=null;let S={code:m,stdout:c,stderr:d};m===0||m===1&&!wt?a(S):f(S)};n.stdout?.on("data",m=>{c+=m.toString()}),n.stderr?.on("data",m=>{d+=m.toString()}),n.on("close",y),n.on("exit",y),n.on("error",y),n.stdout?.pipe(process.stdout),n.stderr?.pipe(process.stderr)})},kill(o="SIGKILL"){if(n?.pid)if(wt)Gn(`taskkill /t /f /pid ${n.pid}`);else return process.kill(-n.pid,o);return!0}}};import ht from"node:process";import Kr from"node:process";var Yr=pe(jr(),1),Hr=pe($r(),1);import po from"node:process";var _o=(0,Yr.default)(()=>{(0,Hr.default)(()=>{po.stderr.write("\x1B[?25h")},{alwaysLast:!0})}),Vr=_o;var Ye=!1,ae={};ae.show=(e=Kr.stderr)=>{!e.isTTY||(Ye=!1,e.write("\x1B[?25h"))};ae.hide=(e=Kr.stderr)=>{!e.isTTY||(Vr(),Ye=!0,e.write("\x1B[?25l"))};ae.toggle=(e,t)=>{e!==void 0&&(Ye=e),Ye?ae.show(t):ae.hide(t)};var Ot=ae;var De=pe(Xr(),1);import q from"node:process";function me(){return q.platform!=="win32"?q.env.TERM!=="linux":Boolean(q.env.CI)||Boolean(q.env.WT_SESSION)||q.env.ConEmuTask==="{cmd::Cmder}"||q.env.TERM_PROGRAM==="vscode"||q.env.TERM==="xterm-256color"||q.env.TERM==="alacritty"||q.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var bo={info:A.blue("ℹ"),success:A.green("✔"),warning:A.yellow("⚠"),error:A.red("✖")},yo={info:A.blue("i"),success:A.green("√"),warning:A.yellow("‼"),error:A.red("×")},xo=me()?bo:yo,ve=xo;function At({onlyFirst:e=!1}={}){let t=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|");return new RegExp(t,e?void 0:"g")}function Ct(e){if(typeof e!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);return e.replace(At(),"")}var bn=pe(li(),1);function Mt({stream:e=process.stdout}={}){return Boolean(e&&e.isTTY&&process.env.TERM!=="dumb"&&!("CI"in process.env))}var gn=pe(_n(),1);import N from"node:process";import Tl from"node:readline";var Ol=3,ut=class{#r=0;#u=new gn.BufferListStream;#n;#i;constructor(){this.#u.pipe(N.stdout);let t=this;this.#n=function(r,i,...n){let{stdin:o}=N;if(t.#r>0||o.emit===t.#n){if(r==="keypress")return;r==="data"&&i.includes(Ol)&&N.emit("SIGINT"),Reflect.apply(t.#n,this,[r,i,...n])}else Reflect.apply(N.stdin.emit,this,[r,i,...n])}}start(){this.#r++,this.#r===1&&this._realStart()}stop(){if(this.#r<=0)throw new Error("`stop` called more times than `start`");this.#r--,this.#r===0&&this._realStop()}_realStart(){N.platform!=="win32"&&(this.#i=Tl.createInterface({input:N.stdin,output:this.#u}),this.#i.on("SIGINT",()=>{N.listenerCount("SIGINT")===0?N.emit("SIGINT"):(this.#i.close(),N.kill(N.pid,"SIGINT"))}))}_realStop(){N.platform!=="win32"&&(this.#i.close(),this.#i=void 0)}};var ct,fr=class{#r=0;#u=!1;#n=0;#i=0;#e;#s;#t;#h;#c;#l;#a;#f;#d;#o;color;constructor(t){ct||(ct=new ut),typeof t=="string"&&(t={text:t}),this.#e={color:"cyan",stream:ht.stderr,discardStdin:!0,hideCursor:!0,...t},this.color=this.#e.color,this.spinner=this.#e.spinner,this.#c=this.#e.interval,this.#t=this.#e.stream,this.#l=typeof this.#e.isEnabled=="boolean"?this.#e.isEnabled:Mt({stream:this.#t}),this.#a=typeof this.#e.isSilent=="boolean"?this.#e.isSilent:!1,this.text=this.#e.text,this.prefixText=this.#e.prefixText,this.indent=this.#e.indent,ht.env.NODE_ENV==="test"&&(this._stream=this.#t,this._isEnabled=this.#l,Object.defineProperty(this,"_linesToClear",{get(){return this.#r},set(r){this.#r=r}}),Object.defineProperty(this,"_frameIndex",{get(){return this.#i}}),Object.defineProperty(this,"_lineCount",{get(){return this.#n}}))}get indent(){return this.#f}set indent(t=0){if(!(t>=0&&Number.isInteger(t)))throw new Error("The `indent` option must be an integer from 0 and up");this.#f=t,this.updateLineCount()}get interval(){return this.#c||this.#s.interval||100}get spinner(){return this.#s}set spinner(t){if(this.#i=0,this.#c=void 0,typeof t=="object"){if(t.frames===void 0)throw new Error("The given spinner must have a `frames` property");this.#s=t}else if(!me())this.#s=De.default.line;else if(t===void 0)this.#s=De.default.dots;else if(t!=="default"&&De.default[t])this.#s=De.default[t];else throw new Error(`There is no built-in spinner named '${t}'. See https://github.com/sindresorhus/cli-spinners/blob/main/spinners.json for a full list.`)}get text(){return this.#d}set text(t){this.#d=t||"",this.updateLineCount()}get prefixText(){return this.#o}set prefixText(t){this.#o=t||"",this.updateLineCount()}get isSpinning(){return this.#h!==void 0}getFullPrefixText(t=this.#o,r=" "){return typeof t=="string"&&t!==""?t+r:typeof t=="function"?t()+r:""}updateLineCount(){let t=this.#t.columns||80,r=this.getFullPrefixText(this.#o,"-");this.#n=0;for(let i of Ct(" ".repeat(this.#f)+r+"--"+this.#d).split(`
|
15
15
|
`))this.#n+=Math.max(1,Math.ceil((0,bn.default)(i)/t))}get isEnabled(){return this.#l&&!this.#a}set isEnabled(t){if(typeof t!="boolean")throw new TypeError("The `isEnabled` option must be a boolean");this.#l=t}get isSilent(){return this.#a}set isSilent(t){if(typeof t!="boolean")throw new TypeError("The `isSilent` option must be a boolean");this.#a=t}frame(){let{frames:t}=this.#s,r=t[this.#i];this.color&&(r=A[this.color](r)),this.#i=++this.#i%t.length;let i=typeof this.#o=="string"&&this.#o!==""?this.#o+" ":"",n=typeof this.text=="string"?" "+this.text:"";return i+r+n}clear(){if(!this.#l||!this.#t.isTTY)return this;this.#t.cursorTo(0);for(let t=0;t<this.#r;t++)t>0&&this.#t.moveCursor(0,-1),this.#t.clearLine(1);return(this.#f||this.lastIndent!==this.#f)&&this.#t.cursorTo(this.#f),this.lastIndent=this.#f,this.#r=0,this}render(){return this.#a?this:(this.clear(),this.#t.write(this.frame()),this.#r=this.#n,this)}start(t){return t&&(this.text=t),this.#a?this:this.#l?this.isSpinning?this:(this.#e.hideCursor&&Ot.hide(this.#t),this.#e.discardStdin&&ht.stdin.isTTY&&(this.#u=!0,ct.start()),this.render(),this.#h=setInterval(this.render.bind(this),this.interval),this):(this.text&&this.#t.write(`- ${this.text}
|
16
16
|
`),this)}stop(){return this.#l?(clearInterval(this.#h),this.#h=void 0,this.#i=0,this.clear(),this.#e.hideCursor&&Ot.show(this.#t),this.#e.discardStdin&&ht.stdin.isTTY&&this.#u&&(ct.stop(),this.#u=!1),this):this}succeed(t){return this.stopAndPersist({symbol:ve.success,text:t})}fail(t){return this.stopAndPersist({symbol:ve.error,text:t})}warn(t){return this.stopAndPersist({symbol:ve.warning,text:t})}info(t){return this.stopAndPersist({symbol:ve.info,text:t})}stopAndPersist(t={}){if(this.#a)return this;let r=t.prefixText||this.#o,i=t.text||this.text,n=typeof i=="string"?" "+i:"";return this.stop(),this.#t.write(`${this.getFullPrefixText(r," ")}${t.symbol||" "}${n}
|
17
|
-
`),this}};function ur(e){return new fr(e)}import{dirname as Al,resolve as Cl}from"path";import{fileURLToPath as Bl}from"url";var hr={default:[],react:["@tsmodule/react","react","react-dom"]},cr={default:["@types/node","ava","eslint","@typescript-eslint/eslint-plugin","@typescript-eslint/parser"],react:["next","@types/
|
17
|
+
`),this}};function ur(e){return new fr(e)}import{dirname as Al,resolve as Cl}from"path";import{fileURLToPath as Bl}from"url";var hr={default:[],react:["@tsmodule/react","react@^17.0.2","react-dom@^17.0.2"]},cr={default:["@types/node","ava","eslint","typescript","@typescript-eslint/eslint-plugin","@typescript-eslint/parser"],react:["next","@types/react@^17.0.39","@types/react-dom@^17.0.11","eslint","eslint-config-next","tailwindcss","autoprefixer","cssnano","postcss","postcss-import"]},yn=Cl(Al(Bl(import.meta.url)),"..");import{mkdir as Ml}from"fs/promises";import{resolve as xn}from"path";var dr=async(e,t)=>{let r=je(),i=xn(yn,`./templates/${e}`),n=xn(t);await Ml(n,{recursive:!0}),await r.run({posix:`cp -rf ${i}/. ${n}`,win32:`xcopy /E /I /Q /Y ${i}\\ ${n}\\`})};import mn from"fs/promises";import{resolve as Il}from"path";var vn=async e=>{let t=Il(process.cwd(),e,"package.json"),r=await mn.readFile(t,"utf-8"),i=JSON.parse(r);i.name=e,await mn.writeFile(t,JSON.stringify(i,null,2))};globalThis.SHELL_OPTIONS={stdio:["ignore","ignore","inherit"]};var yf=async(e,{react:t=!1})=>{let r=je(),i=ur(`Creating new module ${A.blueBright(e)}.`).start();await dr("default",e),t&&await dr("react",e),await vn(e),i.succeed("Project created."),process.chdir(e);let n=[...hr.default],o=[...cr.default];t&&(n.push(...hr.react),o.push(...cr.react)),n.length&&await r.run(`yarn add ${n.join(" ")}`),o.length&&await r.run(`yarn add -D ${o.join(" ")}`),i.succeed("Dependencies installed."),await r.run("git init"),i.succeed("Set up as Git repository.")};export{yf as create};
|
18
18
|
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|