@tsmodule/tsmodule 33.1.1 → 33.1.2
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/create/index.js +1 -1
- package/dist/constants.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +2 -1
@@ -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&&!vt?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(vt)Gn(`taskkill /t /f /pid ${n.pid}`);else return process.kill(-n.pid,o);return!0}}};import ut from"node:process";import Hr from"node:process";var Wr=pe(Pr(),1),$r=pe(Gr(),1);import po from"node:process";var _o=(0,Wr.default)(()=>{(0,$r.default)(()=>{po.stderr.write("\x1B[?25h")},{alwaysLast:!0})}),Yr=_o;var Ye=!1,ae={};ae.show=(e=Hr.stderr)=>{!e.isTTY||(Ye=!1,e.write("\x1B[?25h"))};ae.hide=(e=Hr.stderr)=>{!e.isTTY||(Yr(),Ye=!0,e.write("\x1B[?25l"))};ae.toggle=(e,t)=>{e!==void 0&&(Ye=e),Ye?ae.show(t):ae.hide(t)};var Tt=ae;var De=pe(Zr(),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 Ot({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 At(e){if(typeof e!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);return e.replace(Ot(),"")}var _n=pe(oi(),1);function Bt({stream:e=process.stdout}={}){return Boolean(e&&e.isTTY&&process.env.TERM!=="dumb"&&!("CI"in process.env))}var pn=pe(dn(),1);import N from"node:process";import Tl from"node:readline";var Ol=3,ar=class{#r=0;#u=new pn.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 ht,gn=class{#r=0;#u=!1;#n=0;#i=0;#e;#s;#t;#h;#c;#l;#a;#f;#d;#o;color;constructor(t){ht||(ht=new ar),typeof t=="string"&&(t={text:t}),this.#e={color:"cyan",stream:ut.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:Bt({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,ut.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 At(" ".repeat(this.#f)+r+"--"+this.#d).split(`
|
15
15
|
`))this.#n+=Math.max(1,Math.ceil((0,_n.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&&Tt.hide(this.#t),this.#e.discardStdin&&ut.stdin.isTTY&&(this.#u=!0,ht.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&&Tt.show(this.#t),this.#e.discardStdin&&ut.stdin.isTTY&&this.#u&&(ht.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 fr(e){return new gn(e)}import{dirname as Al,resolve as Cl}from"path";import{fileURLToPath as Bl}from"url";var bn={default:[],react:["@tsmodule/react","react","react-dom"]},ur={default:["@types/node"],react:["next","@types/node","@types/react","@types/react-dom","
|
17
|
+
`),this}};function fr(e){return new gn(e)}import{dirname as Al,resolve as Cl}from"path";import{fileURLToPath as Bl}from"url";var bn={default:[],react:["@tsmodule/react","react","react-dom"]},ur={default:["@types/node","@typescript-eslint/eslint-plugin"],react:["next","@types/node","@types/react","@types/react-dom","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 hr=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=fr(`Creating new module ${A.blueBright(e)}.`).start();await hr("default",e),t&&await hr("react",e),await vn(e),i.succeed("Project created."),process.chdir(e);let n=[],o=["@tsmodule/tsmodule"];t?(n.push(...bn.react),o.push(...ur.react)):o.push(...ur.default),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"),await r.run("git stage --all"),await r.run("git commit -m 'chore: initial commit'"),i.succeed("Set up as Git repository.")};export{yf as create};
|
18
18
|
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
package/dist/constants.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
1
|
|
2
2
|
await(async()=>{let{dirname:e}=await import("path"),{fileURLToPath:i}=await import("url");if(typeof globalThis.__filename>"u"&&(globalThis.__filename=i(import.meta.url)),typeof globalThis.__dirname>"u"&&(globalThis.__dirname=e(globalThis.__filename)),typeof globalThis.require>"u"){let{default:a}=await import("module");globalThis.require=a.createRequire(import.meta.url)}})();
|
3
3
|
|
4
|
-
import{readFile as o}from"fs/promises";import{dirname as s,resolve as e}from"path";import{fileURLToPath as r}from"url";var i={default:[],react:["@tsmodule/react","react","react-dom"]},l={default:["@types/node"],react:["next","@types/node","@types/react","@types/react-dom","
|
4
|
+
import{readFile as o}from"fs/promises";import{dirname as s,resolve as e}from"path";import{fileURLToPath as r}from"url";var i={default:[],react:["@tsmodule/react","react","react-dom"]},l={default:["@types/node","@typescript-eslint/eslint-plugin"],react:["next","@types/node","@types/react","@types/react-dom","eslint","eslint-config-next","tailwindcss","autoprefixer","cssnano","postcss","postcss-import"]},n=e(s(r(import.meta.url)),".."),d=async()=>{let t=await o(e(n,"package.json"),"utf-8");return JSON.parse(t)};export{n as PACKAGE_ROOT,i as dependencies,l as devDependencies,d as localPackageJson};
|
package/dist/index.js
CHANGED
@@ -48,7 +48,7 @@ import ReactDOM from "react-dom";
|
|
48
48
|
|
49
49
|
${a}`,u=Tn(t);await fh(u,c);let f=[i,s,o,`-i ${u}`,"-o",e];await ye({log:!1,stdio:"ignore"}).run(f.join(" "))},Fb=`
|
50
50
|
await(async()=>{let{dirname:e}=await import("path"),{fileURLToPath:i}=await import("url");if(typeof globalThis.__filename>"u"&&(globalThis.__filename=i(import.meta.url)),typeof globalThis.__dirname>"u"&&(globalThis.__dirname=e(globalThis.__filename)),typeof globalThis.require>"u"){let{default:a}=await import("module");globalThis.require=a.createRequire(import.meta.url)}})();
|
51
|
-
`,jt=async({input:t="src/**/*",styles:e="src/components/index.css",target:r="esnext",dev:n=!1,bundle:i=!1,runtimeOnly:s=n,noWrite:o=!1,noStandardStyles:a=!1,stdin:l=void 0,stdinFile:c=void 0})=>{oh.NODE_ENV=n?"development":"production";let u=Se(jt);n&&(s=!0);let{cwd:f,srcDir:h,outDir:E}=eo(),m=await eh(),y=JSON.parse(m),S={treeShaking:i,target:r,minify:!n,jsx:"transform",jsxFactory:"React.createElement",format:"esm",charset:"utf8",logLevel:n?"warning":"error",define:{"process.env.NODE_ENV":n?JSON.stringify("development"):JSON.stringify("production")}},x={...S,bundle:i,absWorkingDir:f,outbase:"src",outdir:"dist",assetNames:"[name].js",format:"esm",target:"esnext",platform:y?.platform??"node",write:!o,external:i?["esbuild"]:void 0,banner:i?{js:Fb}:void 0},M="";if(l){u.log("Building file from stdin",{stdin:l,stdinFile:c,noWrite:o}),c||(we(C.red("ERROR: --stdin-file must be specified to emulate a file location when using stdin.")),process.exit(1)),typeof l=="string"&&l.length?M=l:M=await no();let w={...S,sourcefile:c,loader:"tsx",banner:void 0,footer:void 0};if(o)return(await Nb(M,w)).code;{let p=lh(M,c,"tsx");await io({...x,...p}),we(C.green("Successfully built stdin file to dist/.")),we(C.grey("Use --no-write to print to stdout instead."));return}}u.log("Building",{files:t,dev:n,runtimeOnly:s}),ah(`${C.bold("TS Module")} [${oh.NODE_ENV}]`);let N=so.default.sync(t,{cwd:f}).filter(w=>Lb(w)!==".d.ts").map(w=>Ln(w));if(Mb(t)){N.length||N.push(t);let w=t.replace(h,E).replace(qt,".js").replace(_t,".js");u.log("Cleaning emitted file:",{outfile:w}),await sh(w,{force:!0})}else u.log("Cleaning old output:",{outDir:E}),await sh(E,{force:!0,recursive:!0});let z=N.filter(w=>_t.test(w));u.log("Compiling TSX files:",{tsxJsxInput:z});let T=z.filter(w=>!w.endsWith(".d.ts"));await Promise.all(T.map(async w=>{let p=await oo(w,"utf-8"),H=Bb+p,$=lh(H,w,"tsx");await io({...x,...$})})),fe("Built TSX files.").succeed();let q=N.filter(w=>qt.test(w)).filter(w=>!_t.test(w));u.log("Compiling TS files:",{tsJsInput:q}),await io({...x,entryPoints:q.filter(w=>!w.endsWith(".d.ts"))}),fe("Built TS files.").succeed();let P=N.filter(w=>!zf.test(w));u.log("Copying non-JS/TS files.",{allFiles:N,nonTsJsInput:P});for(let w of P){let p=Tn(w);u.log("Copying non-source file:",{file:w,emittedFile:p}),await Db(hh(p),{recursive:!0}),await Pb(w,p,Tb.COPYFILE_FICLONE)}if(!process.env.NO_REWRITES){let w=t.replace(h,E).replace(/^(\.\/)?src\//,"dist/").replace(qt,".js").replace(_t,".js");u.log("Normalizing import specifiers in emitted JS.",{emittedJs:w}),await pr(w.endsWith(".js")?w:`${w}.js`),fe("Normalized import specifiers.").succeed()}if(await Ib()&&fe('Forced "type": "module" in output.').succeed(),s)return;if(ch(kb(e))){u.log("Building styles for production.");let{style:w="./dist/bundle.css"}=y;if(u.log("Building style bundle.",{bundleInput:e,bundleOutput:w,dev:n,noStandardStyles:a}),await uh(e,w,n,a),i){u.log("Bundling all styles.");let p=so.default.sync("dist/**/*.css"),H=fe("Bundled emitted styles.").start();await Promise.all(p.map(async $=>await uh($,$,n,a))),H.succeed()}fe(`Bundled all styles to ${C.bold(w)}.`).succeed()}else we(C.grey("Bundle styles not found for this projected. Checked:"),{styles:e});ah("Running post-build setup.");let F=fe("Generating type declarations.").start();await to(),F.succeed(`Generated delcarations for ${N.length} files.`),we(C.green("Build complete."))};import{readFile as $b}from"fs/promises";import{dirname as Hb,resolve as ph}from"path";import{fileURLToPath as qb}from"url";var dh={default:[],react:["@tsmodule/react","react","react-dom"]},ao={default:["@types/node"],react:["next","@types/node","@types/react","@types/react-dom","
|
51
|
+
`,jt=async({input:t="src/**/*",styles:e="src/components/index.css",target:r="esnext",dev:n=!1,bundle:i=!1,runtimeOnly:s=n,noWrite:o=!1,noStandardStyles:a=!1,stdin:l=void 0,stdinFile:c=void 0})=>{oh.NODE_ENV=n?"development":"production";let u=Se(jt);n&&(s=!0);let{cwd:f,srcDir:h,outDir:E}=eo(),m=await eh(),y=JSON.parse(m),S={treeShaking:i,target:r,minify:!n,jsx:"transform",jsxFactory:"React.createElement",format:"esm",charset:"utf8",logLevel:n?"warning":"error",define:{"process.env.NODE_ENV":n?JSON.stringify("development"):JSON.stringify("production")}},x={...S,bundle:i,absWorkingDir:f,outbase:"src",outdir:"dist",assetNames:"[name].js",format:"esm",target:"esnext",platform:y?.platform??"node",write:!o,external:i?["esbuild"]:void 0,banner:i?{js:Fb}:void 0},M="";if(l){u.log("Building file from stdin",{stdin:l,stdinFile:c,noWrite:o}),c||(we(C.red("ERROR: --stdin-file must be specified to emulate a file location when using stdin.")),process.exit(1)),typeof l=="string"&&l.length?M=l:M=await no();let w={...S,sourcefile:c,loader:"tsx",banner:void 0,footer:void 0};if(o)return(await Nb(M,w)).code;{let p=lh(M,c,"tsx");await io({...x,...p}),we(C.green("Successfully built stdin file to dist/.")),we(C.grey("Use --no-write to print to stdout instead."));return}}u.log("Building",{files:t,dev:n,runtimeOnly:s}),ah(`${C.bold("TS Module")} [${oh.NODE_ENV}]`);let N=so.default.sync(t,{cwd:f}).filter(w=>Lb(w)!==".d.ts").map(w=>Ln(w));if(Mb(t)){N.length||N.push(t);let w=t.replace(h,E).replace(qt,".js").replace(_t,".js");u.log("Cleaning emitted file:",{outfile:w}),await sh(w,{force:!0})}else u.log("Cleaning old output:",{outDir:E}),await sh(E,{force:!0,recursive:!0});let z=N.filter(w=>_t.test(w));u.log("Compiling TSX files:",{tsxJsxInput:z});let T=z.filter(w=>!w.endsWith(".d.ts"));await Promise.all(T.map(async w=>{let p=await oo(w,"utf-8"),H=Bb+p,$=lh(H,w,"tsx");await io({...x,...$})})),fe("Built TSX files.").succeed();let q=N.filter(w=>qt.test(w)).filter(w=>!_t.test(w));u.log("Compiling TS files:",{tsJsInput:q}),await io({...x,entryPoints:q.filter(w=>!w.endsWith(".d.ts"))}),fe("Built TS files.").succeed();let P=N.filter(w=>!zf.test(w));u.log("Copying non-JS/TS files.",{allFiles:N,nonTsJsInput:P});for(let w of P){let p=Tn(w);u.log("Copying non-source file:",{file:w,emittedFile:p}),await Db(hh(p),{recursive:!0}),await Pb(w,p,Tb.COPYFILE_FICLONE)}if(!process.env.NO_REWRITES){let w=t.replace(h,E).replace(/^(\.\/)?src\//,"dist/").replace(qt,".js").replace(_t,".js");u.log("Normalizing import specifiers in emitted JS.",{emittedJs:w}),await pr(w.endsWith(".js")?w:`${w}.js`),fe("Normalized import specifiers.").succeed()}if(await Ib()&&fe('Forced "type": "module" in output.').succeed(),s)return;if(ch(kb(e))){u.log("Building styles for production.");let{style:w="./dist/bundle.css"}=y;if(u.log("Building style bundle.",{bundleInput:e,bundleOutput:w,dev:n,noStandardStyles:a}),await uh(e,w,n,a),i){u.log("Bundling all styles.");let p=so.default.sync("dist/**/*.css"),H=fe("Bundled emitted styles.").start();await Promise.all(p.map(async $=>await uh($,$,n,a))),H.succeed()}fe(`Bundled all styles to ${C.bold(w)}.`).succeed()}else we(C.grey("Bundle styles not found for this projected. Checked:"),{styles:e});ah("Running post-build setup.");let F=fe("Generating type declarations.").start();await to(),F.succeed(`Generated delcarations for ${N.length} files.`),we(C.green("Build complete."))};import{readFile as $b}from"fs/promises";import{dirname as Hb,resolve as ph}from"path";import{fileURLToPath as qb}from"url";var dh={default:[],react:["@tsmodule/react","react","react-dom"]},ao={default:["@types/node","@typescript-eslint/eslint-plugin"],react:["next","@types/node","@types/react","@types/react-dom","eslint","eslint-config-next","tailwindcss","autoprefixer","cssnano","postcss","postcss-import"]},dr=ph(Hb(qb(import.meta.url)),".."),gh=async()=>{let t=await $b(ph(dr,"package.json"),"utf-8");return JSON.parse(t)};import{mkdir as jb}from"fs/promises";import{resolve as _h}from"path";var lo=async(t,e)=>{let r=ye(),n=_h(dr,`./templates/${t}`),i=_h(e);await jb(i,{recursive:!0}),await r.run({posix:`cp -rf ${n}/. ${i}`,win32:`xcopy /E /I /Q /Y ${n}\\ ${i}\\`})};import mh from"fs/promises";import{resolve as Ub}from"path";var yh=async t=>{let e=Ub(process.cwd(),t,"package.json"),r=await mh.readFile(e,"utf-8"),n=JSON.parse(r);n.name=t,await mh.writeFile(e,JSON.stringify(n,null,2))};globalThis.SHELL_OPTIONS={stdio:["ignore","ignore","inherit"]};var bh=async(t,{react:e=!1})=>{let r=ye(),n=fe(`Creating new module ${C.blueBright(t)}.`).start();await lo("default",t),e&&await lo("react",t),await yh(t),n.succeed("Project created."),process.chdir(t);let i=[],s=["@tsmodule/tsmodule"];e?(i.push(...dh.react),s.push(...ao.react)):s.push(...ao.default),i.length&&await r.run(`yarn add ${i.join(" ")}`),s.length&&await r.run(`yarn add -D ${s.join(" ")}`),n.succeed("Dependencies installed."),await r.run("git init"),await r.run("git stage --all"),await r.run("git commit -m 'chore: initial commit'"),n.succeed("Set up as Git repository.")};import{relative as iv,resolve as sv}from"path";import{existsSync as ov}from"fs";import{lstat as av}from"fs/promises";var Hh=Be(Ih(),1);var Fh=()=>{console.clear()},$h=t=>{we(`
|
52
52
|
`,C.gray(`Built ${C.bold(t)}.`),`
|
53
53
|
`,C.blue(new Date().toLocaleString()))},qh=async()=>{let t=process.cwd(),e=ye();process.platform!=="win32"&&await e.run("clear"),Fh(),await jt({dev:!0}),$h("src/**/*"),(0,Hh.default)(sv(t,"src"),{recursive:!0}).on("change",async(r,n)=>{if(!ov(n)||(await av(n)).isDirectory())return;Fh();let a=Date.now();await jt({dev:!0,input:n});let l=Date.now()-a;fe(C.blueBright(`Dev refresh finished in ${C.bold(`${l}ms`)}.`)).succeed(),$h(iv(t,n))})};import{pathToFileURL as lv}from"url";import{resolve as uv}from"path";var jh=async()=>{let t=uv(dr,"dist/loader/index.js"),e=["--no-warnings","--loader",lv(t).href,...process.argv.slice(2)];await ye().run(`node ${e.join(" ")}`)};var{version:cv}=await gh(),mt=new Jo;mt.name(C.white(C.bold("tsmodule"))).usage(C.white(C.bold("<file | command> [options]"))).description(C.blueBright(`A tool for building TypeScript modules.
|
54
54
|
|
package/package.json
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
"name": "@tsmodule/tsmodule",
|
3
3
|
"platform": "node",
|
4
4
|
"type": "module",
|
5
|
-
"version": "33.1.
|
5
|
+
"version": "33.1.2",
|
6
6
|
"repository": "tsmodule/tsmodule",
|
7
7
|
"description": "TypeScript Module loader and compiler",
|
8
8
|
"license": "MIT",
|
@@ -40,6 +40,7 @@
|
|
40
40
|
"release": "release-it"
|
41
41
|
},
|
42
42
|
"dependencies": {
|
43
|
+
"@tsmodule/react": "^5.0.0",
|
43
44
|
"esbuild": "^0.14.25",
|
44
45
|
"typescript": "^4.6.3"
|
45
46
|
},
|