@tsmodule/tsmodule 33.1.0 → 33.1.3

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.
@@ -28,7 +28,7 @@ $ ${o} ${a.join(" ")}
28
28
  import ReactDOM from "react-dom";
29
29
  `,ic=e=>{let t=` ${e} `;Ie(j.bgBlue(j.bold(j.white(t))))},Hm=async()=>{let e;if(ac("dist/package.json")?e=JSON.parse(await Ds("dist/package.json","utf-8")):e={},e?.module==="module")return!0;e.type="module",await lc("dist/package.json",JSON.stringify(e,null,2))},sc=(e,t,r)=>{t=gn(t);let n=dn(t);return{stdin:{contents:e,sourcefile:t,resolveDir:uc(t),loader:r},outdir:void 0,outfile:n}},oc=async(e,t,r,n)=>{e=gn(e),t=gn(t);let i="npx tailwindcss",s=r?"":"-m",o="--postcss postcss.config.js",a=await Ds(e,"utf-8"),f=n?a:`@import "@tsmodule/react";
30
30
 
31
- ${a}`,u=dn(e);await lc(u,f);let h=[i,s,o,`-i ${u}`,"-o",t];await hn({log:!1,stdio:"ignore"}).run(h.join(" "))},Gm=`
31
+ ${a}`,u=dn(e);await lc(u,f);let h=[i,s,o,`-i ${u}`,"-o",t],c=hn({log:!1,stdio:"ignore"}),{code:v,stderr:y}=await c.run(h.join(" "));if(v!==0)throw new Error(`Error building CSS bundle: ${y}`)},Gm=`
32
32
  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)}})();
33
33
  `,Um=async({input:e="src/**/*",styles:t="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:f=void 0})=>{nc.NODE_ENV=n?"development":"production";let u=ye(Um);n&&(s=!0);let{cwd:h,srcDir:c,outDir:v}=As(),y=await Jf(),m=JSON.parse(y),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")}},E={...S,bundle:i,absWorkingDir:h,outbase:"src",outdir:"dist",assetNames:"[name].js",format:"esm",target:"esnext",platform:m?.platform??"node",write:!o,external:i?["esbuild"]:void 0,banner:i?{js:Gm}:void 0},L="";if(l){u.log("Building file from stdin",{stdin:l,stdinFile:f,noWrite:o}),f||(Ie(j.red("ERROR: --stdin-file must be specified to emulate a file location when using stdin.")),process.exit(1)),typeof l=="string"&&l.length?L=l:L=await Ps();let R={...S,sourcefile:f,loader:"tsx",banner:void 0,footer:void 0};if(o)return(await jm(L,R)).code;{let d=sc(L,f,"tsx");await Ls({...E,...d}),Ie(j.green("Successfully built stdin file to dist/.")),Ie(j.grey("Use --no-write to print to stdout instead."));return}}u.log("Building",{files:e,dev:n,runtimeOnly:s}),ic(`${j.bold("TS Module")} [${nc.NODE_ENV}]`);let B=Ms.default.sync(e,{cwd:h}).filter(R=>km(R)!==".d.ts").map(R=>gn(R));if(Fm(e)){B.length||B.push(e);let R=e.replace(c,v).replace(Bt,".js").replace(ft,".js");u.log("Cleaning emitted file:",{outfile:R}),await rc(R,{force:!0})}else u.log("Cleaning old output:",{outDir:v}),await rc(v,{force:!0,recursive:!0});let J=B.filter(R=>ft.test(R));u.log("Compiling TSX files:",{tsxJsxInput:J});let T=J.filter(R=>!R.endsWith(".d.ts"));await Promise.all(T.map(async R=>{let d=await Ds(R,"utf-8"),q=$m+d,F=sc(q,R,"tsx");await Ls({...E,...F})})),Be("Built TSX files.").succeed();let $=B.filter(R=>Bt.test(R)).filter(R=>!ft.test(R));u.log("Compiling TS files:",{tsJsInput:$}),await Ls({...E,entryPoints:$.filter(R=>!R.endsWith(".d.ts"))}),Be("Built TS files.").succeed();let C=B.filter(R=>!Xf.test(R));u.log("Copying non-JS/TS files.",{allFiles:B,nonTsJsInput:C});for(let R of C){let d=dn(R);u.log("Copying non-source file:",{file:R,emittedFile:d}),await Nm(uc(d),{recursive:!0}),await Im(R,d,Bm.COPYFILE_FICLONE)}if(!process.env.NO_REWRITES){let R=e.replace(c,v).replace(/^(\.\/)?src\//,"dist/").replace(Bt,".js").replace(ft,".js");u.log("Normalizing import specifiers in emitted JS.",{emittedJs:R}),await Os(R.endsWith(".js")?R:`${R}.js`),Be("Normalized import specifiers.").succeed()}if(await Hm()&&Be('Forced "type": "module" in output.').succeed(),s)return;if(ac(qm(t))){u.log("Building styles for production.");let{style:R="./dist/bundle.css"}=m;if(u.log("Building style bundle.",{bundleInput:t,bundleOutput:R,dev:n,noStandardStyles:a}),await oc(t,R,n,a),i){u.log("Bundling all styles.");let d=Ms.default.sync("dist/**/*.css"),q=Be("Bundled emitted styles.").start();await Promise.all(d.map(async F=>await oc(F,F,n,a))),q.succeed()}Be(`Bundled all styles to ${j.bold(R)}.`).succeed()}else Ie(j.grey("Bundle styles not found for this projected. Checked:"),{styles:t});ic("Running post-build setup.");let k=Be("Generating type declarations.").start();await Ts(),k.succeed(`Generated delcarations for ${B.length} files.`),Ie(j.green("Build complete."))};export{ic as bannerLog,Um as build};
34
34
  /*!
@@ -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","@typescript-eslint/eslint-plugin","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"),i.succeed("Git initialized.")};export{yf as create};
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> */
@@ -28,7 +28,7 @@ $ ${o} ${a.join(" ")}
28
28
  import ReactDOM from "react-dom";
29
29
  `,qc=e=>{let t=` ${e} `;ye(N.bgBlue(N.bold(N.white(t))))},jy=async()=>{let e;if(Hc("dist/package.json")?e=JSON.parse(await Xs("dist/package.json","utf-8")):e={},e?.module==="module")return!0;e.type="module",await Uc("dist/package.json",JSON.stringify(e,null,2))},jc=(e,t,r)=>{t=Rn(t);let n=En(t);return{stdin:{contents:e,sourcefile:t,resolveDir:Gc(t),loader:r},outdir:void 0,outfile:n}},$c=async(e,t,r,n)=>{e=Rn(e),t=Rn(t);let i="npx tailwindcss",s=r?"":"-m",o="--postcss postcss.config.js",a=await Xs(e,"utf-8"),f=n?a:`@import "@tsmodule/react";
30
30
 
31
- ${a}`,l=En(e);await Uc(l,f);let h=[i,s,o,`-i ${l}`,"-o",t];await mt({log:!1,stdio:"ignore"}).run(h.join(" "))},$y=`
31
+ ${a}`,l=En(e);await Uc(l,f);let h=[i,s,o,`-i ${l}`,"-o",t],c=mt({log:!1,stdio:"ignore"}),{code:x,stderr:y}=await c.run(h.join(" "));if(x!==0)throw new Error(`Error building CSS bundle: ${y}`)},$y=`
32
32
  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)}})();
33
33
  `,wn=async({input:e="src/**/*",styles:t="src/components/index.css",target:r="esnext",dev:n=!1,bundle:i=!1,runtimeOnly:s=n,noWrite:o=!1,noStandardStyles:a=!1,stdin:u=void 0,stdinFile:f=void 0})=>{Fc.NODE_ENV=n?"development":"production";let l=me(wn);n&&(s=!0);let{cwd:h,srcDir:c,outDir:x}=Us(),y=await Mc(),m=JSON.parse(y),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")}},E={...S,bundle:i,absWorkingDir:h,outbase:"src",outdir:"dist",assetNames:"[name].js",format:"esm",target:"esnext",platform:m?.platform??"node",write:!o,external:i?["esbuild"]:void 0,banner:i?{js:$y}:void 0},M="";if(u){l.log("Building file from stdin",{stdin:u,stdinFile:f,noWrite:o}),f||(ye(N.red("ERROR: --stdin-file must be specified to emulate a file location when using stdin.")),process.exit(1)),typeof u=="string"&&u.length?M=u:M=await Ys();let R={...S,sourcefile:f,loader:"tsx",banner:void 0,footer:void 0};if(o)return(await Fy(M,R)).code;{let d=jc(M,f,"tsx");await Ks({...E,...d}),ye(N.green("Successfully built stdin file to dist/.")),ye(N.grey("Use --no-write to print to stdout instead."));return}}l.log("Building",{files:e,dev:n,runtimeOnly:s}),qc(`${N.bold("TS Module")} [${Fc.NODE_ENV}]`);let B=Qs.default.sync(e,{cwd:h}).filter(R=>Ny(R)!==".d.ts").map(R=>Rn(R));if(Iy(e)){B.length||B.push(e);let R=e.replace(c,x).replace(kt,".js").replace(ht,".js");l.log("Cleaning emitted file:",{outfile:R}),await kc(R,{force:!0})}else l.log("Cleaning old output:",{outDir:x}),await kc(x,{force:!0,recursive:!0});let Z=B.filter(R=>ht.test(R));l.log("Compiling TSX files:",{tsxJsxInput:Z});let C=Z.filter(R=>!R.endsWith(".d.ts"));await Promise.all(C.map(async R=>{let d=await Xs(R,"utf-8"),j=qy+d,q=jc(j,R,"tsx");await Ks({...E,...q})})),Ee("Built TSX files.").succeed();let $=B.filter(R=>kt.test(R)).filter(R=>!ht.test(R));l.log("Compiling TS files:",{tsJsInput:$}),await Ks({...E,entryPoints:$.filter(R=>!R.endsWith(".d.ts"))}),Ee("Built TS files.").succeed();let O=B.filter(R=>!Lc.test(R));l.log("Copying non-JS/TS files.",{allFiles:B,nonTsJsInput:O});for(let R of O){let d=En(R);l.log("Copying non-source file:",{file:R,emittedFile:d}),await By(Gc(d),{recursive:!0}),await Dy(R,d,My.COPYFILE_FICLONE)}if(!process.env.NO_REWRITES){let R=e.replace(c,x).replace(/^(\.\/)?src\//,"dist/").replace(kt,".js").replace(ht,".js");l.log("Normalizing import specifiers in emitted JS.",{emittedJs:R}),await Vs(R.endsWith(".js")?R:`${R}.js`),Ee("Normalized import specifiers.").succeed()}if(await jy()&&Ee('Forced "type": "module" in output.').succeed(),s)return;if(Hc(ky(t))){l.log("Building styles for production.");let{style:R="./dist/bundle.css"}=m;if(l.log("Building style bundle.",{bundleInput:t,bundleOutput:R,dev:n,noStandardStyles:a}),await $c(t,R,n,a),i){l.log("Bundling all styles.");let d=Qs.default.sync("dist/**/*.css"),j=Ee("Bundled emitted styles.").start();await Promise.all(d.map(async q=>await $c(q,q,n,a))),j.succeed()}Ee(`Bundled all styles to ${N.bold(R)}.`).succeed()}else ye(N.grey("Bundle styles not found for this projected. Checked:"),{styles:t});qc("Running post-build setup.");let F=Ee("Generating type declarations.").start();await Gs(),F.succeed(`Generated delcarations for ${B.length} files.`),ye(N.green("Build complete."))};var Wc=()=>{console.clear()},Vc=e=>{ye(`
34
34
  `,N.gray(`Built ${N.bold(e)}.`),`
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","@typescript-eslint/eslint-plugin","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};
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};