@tsmodule/tsmodule 41.16.0 → 41.17.0

Sign up to get free protection for your applications and to get access to all the features.
package/dist/bin.js CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  if(typeof process<"u"){let{dirname:e}=await import("path"),{fileURLToPath:i}=await import("url");globalThis.__filename=i(import.meta.url),globalThis.__dirname=e(globalThis.__filename);let{default:a}=await import("module");globalThis.require=a.createRequire(import.meta.url)}
4
4
 
5
- import{a as L,b as R,d as B,f as U,h as J,i as G,j as K,k as z,l as Y}from"./chunk-A4YD4WCS.js";import{a as w,b,c as fe,d}from"./chunk-UCISWLJO.js";var E=b(H=>{var y=class extends Error{constructor(e,t,i){super(i),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}},V=class extends y{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};H.CommanderError=y;H.InvalidArgumentError=V});var S=b(F=>{var{InvalidArgumentError:ge}=E(),k=class{constructor(e,t){switch(this.description=t||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case"<":this.required=!0,this._name=e.slice(1,-1);break;case"[":this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e;break}this._name.length>3&&this._name.slice(-3)==="..."&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_concatValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:t.concat(e)}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(t,i)=>{if(!this.argChoices.includes(t))throw new ge(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(t,i):t},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function _e(h){let e=h.name()+(h.variadic===!0?"...":"");return h.required?"<"+e+">":"["+e+"]"}F.Argument=k;F.humanReadableArgName=_e});var N=b(Q=>{var{humanReadableArgName:Oe}=S(),D=class{constructor(){this.helpWidth=void 0,this.sortSubcommands=!1,this.sortOptions=!1}visibleCommands(e){let t=e.commands.filter(i=>!i._hidden);if(e._hasImplicitHelpCommand()){let[,i,n]=e._helpCommandnameAndArgs.match(/([^ ]+) *(.*)/),s=e.createCommand(i).helpOption(!1);s.description(e._helpCommandDescription),n&&s.arguments(n),t.push(s)}return this.sortSubcommands&&t.sort((i,n)=>i.name().localeCompare(n.name())),t}visibleOptions(e){let t=e.options.filter(s=>!s.hidden),i=e._hasHelpOption&&e._helpShortFlag&&!e._findOption(e._helpShortFlag),n=e._hasHelpOption&&!e._findOption(e._helpLongFlag);if(i||n){let s;i?n?s=e.createOption(e._helpFlags,e._helpDescription):s=e.createOption(e._helpShortFlag,e._helpDescription):s=e.createOption(e._helpLongFlag,e._helpDescription),t.push(s)}if(this.sortOptions){let s=r=>r.short?r.short.replace(/^-/,""):r.long.replace(/^--/,"");t.sort((r,a)=>s(r).localeCompare(s(a)))}return t}visibleArguments(e){return e._argsDescription&&e._args.forEach(t=>{t.description=t.description||e._argsDescription[t.name()]||""}),e._args.find(t=>t.description)?e._args:[]}subcommandTerm(e){let t=e._args.map(i=>Oe(i)).join(" ");return e._name+(e._aliases[0]?"|"+e._aliases[0]:"")+(e.options.length?" [options]":"")+(t?" "+t:"")}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,t){return t.visibleCommands(e).reduce((i,n)=>Math.max(i,t.subcommandTerm(n).length),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((i,n)=>Math.max(i,t.optionTerm(n).length),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((i,n)=>Math.max(i,t.argumentTerm(n).length),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+"|"+e._aliases[0]);let i="";for(let n=e.parent;n;n=n.parent)i=n.name()+" "+i;return i+t+" "+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let t=[];return e.argChoices&&t.push(`choices: ${e.argChoices.map(i=>JSON.stringify(i)).join(", ")}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue=="boolean")&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&t.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&t.push(`env: ${e.envVar}`),t.length>0?`${e.description} (${t.join(", ")})`:e.description}argumentDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(i=>JSON.stringify(i)).join(", ")}`),e.defaultValue!==void 0&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){let i=`(${t.join(", ")})`;return e.description?`${e.description} ${i}`:i}return e.description}formatHelp(e,t){let i=t.padWidth(e,t),n=t.helpWidth||80,s=2,r=2;function a(m,W){if(W){let de=`${m.padEnd(i+r)}${W}`;return t.wrap(de,n-s,i+r)}return m}function o(m){return m.join(`
5
+ import{a as L,b as R,d as B,f as U,h as J,i as G,j as K,k as z,l as Y}from"./chunk-ZS6BSZAB.js";import{a as w,b,c as fe,d}from"./chunk-UCISWLJO.js";var E=b(H=>{var y=class extends Error{constructor(e,t,i){super(i),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}},V=class extends y{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};H.CommanderError=y;H.InvalidArgumentError=V});var S=b(F=>{var{InvalidArgumentError:ge}=E(),k=class{constructor(e,t){switch(this.description=t||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case"<":this.required=!0,this._name=e.slice(1,-1);break;case"[":this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e;break}this._name.length>3&&this._name.slice(-3)==="..."&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_concatValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:t.concat(e)}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(t,i)=>{if(!this.argChoices.includes(t))throw new ge(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(t,i):t},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function _e(h){let e=h.name()+(h.variadic===!0?"...":"");return h.required?"<"+e+">":"["+e+"]"}F.Argument=k;F.humanReadableArgName=_e});var N=b(Q=>{var{humanReadableArgName:Oe}=S(),D=class{constructor(){this.helpWidth=void 0,this.sortSubcommands=!1,this.sortOptions=!1}visibleCommands(e){let t=e.commands.filter(i=>!i._hidden);if(e._hasImplicitHelpCommand()){let[,i,n]=e._helpCommandnameAndArgs.match(/([^ ]+) *(.*)/),s=e.createCommand(i).helpOption(!1);s.description(e._helpCommandDescription),n&&s.arguments(n),t.push(s)}return this.sortSubcommands&&t.sort((i,n)=>i.name().localeCompare(n.name())),t}visibleOptions(e){let t=e.options.filter(s=>!s.hidden),i=e._hasHelpOption&&e._helpShortFlag&&!e._findOption(e._helpShortFlag),n=e._hasHelpOption&&!e._findOption(e._helpLongFlag);if(i||n){let s;i?n?s=e.createOption(e._helpFlags,e._helpDescription):s=e.createOption(e._helpShortFlag,e._helpDescription):s=e.createOption(e._helpLongFlag,e._helpDescription),t.push(s)}if(this.sortOptions){let s=r=>r.short?r.short.replace(/^-/,""):r.long.replace(/^--/,"");t.sort((r,a)=>s(r).localeCompare(s(a)))}return t}visibleArguments(e){return e._argsDescription&&e._args.forEach(t=>{t.description=t.description||e._argsDescription[t.name()]||""}),e._args.find(t=>t.description)?e._args:[]}subcommandTerm(e){let t=e._args.map(i=>Oe(i)).join(" ");return e._name+(e._aliases[0]?"|"+e._aliases[0]:"")+(e.options.length?" [options]":"")+(t?" "+t:"")}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,t){return t.visibleCommands(e).reduce((i,n)=>Math.max(i,t.subcommandTerm(n).length),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((i,n)=>Math.max(i,t.optionTerm(n).length),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((i,n)=>Math.max(i,t.argumentTerm(n).length),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+"|"+e._aliases[0]);let i="";for(let n=e.parent;n;n=n.parent)i=n.name()+" "+i;return i+t+" "+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let t=[];return e.argChoices&&t.push(`choices: ${e.argChoices.map(i=>JSON.stringify(i)).join(", ")}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue=="boolean")&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&t.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&t.push(`env: ${e.envVar}`),t.length>0?`${e.description} (${t.join(", ")})`:e.description}argumentDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(i=>JSON.stringify(i)).join(", ")}`),e.defaultValue!==void 0&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){let i=`(${t.join(", ")})`;return e.description?`${e.description} ${i}`:i}return e.description}formatHelp(e,t){let i=t.padWidth(e,t),n=t.helpWidth||80,s=2,r=2;function a(m,W){if(W){let de=`${m.padEnd(i+r)}${W}`;return t.wrap(de,n-s,i+r)}return m}function o(m){return m.join(`
6
6
  `).replace(/^/gm," ".repeat(s))}let l=[`Usage: ${t.commandUsage(e)}`,""],u=t.commandDescription(e);u.length>0&&(l=l.concat([u,""]));let c=t.visibleArguments(e).map(m=>a(t.argumentTerm(m),t.argumentDescription(m)));c.length>0&&(l=l.concat(["Arguments:",o(c),""]));let f=t.visibleOptions(e).map(m=>a(t.optionTerm(m),t.optionDescription(m)));f.length>0&&(l=l.concat(["Options:",o(f),""]));let A=t.visibleCommands(e).map(m=>a(t.subcommandTerm(m),t.subcommandDescription(m)));return A.length>0&&(l=l.concat(["Commands:",o(A),""])),l.join(`
7
7
  `)}padWidth(e,t){return Math.max(t.longestOptionTermLength(e,t),t.longestSubcommandTermLength(e,t),t.longestArgumentTermLength(e,t))}wrap(e,t,i,n=40){if(e.match(/[\n]\s+/))return e;let s=t-i;if(s<n)return e;let r=e.slice(0,i),a=e.slice(i),o=" ".repeat(i),l=new RegExp(".{1,"+(s-1)+"}([\\s​]|$)|[^\\s​]+?([\\s​]|$)","g"),u=a.match(l)||[];return r+u.map((c,f)=>(c.slice(-1)===`
8
8
  `&&(c=c.slice(0,c.length-1)),(f>0?o:"")+c.trimRight())).join(`
@@ -19,7 +19,7 @@ import ReactDOM from "react-dom";
19
19
  \rTried running: ${u}.
20
20
  \rError: ${l+h}`)},f0=`
21
21
  if(typeof process<"u"){let{dirname:e}=await import("path"),{fileURLToPath:i}=await import("url");globalThis.__filename=i(import.meta.url),globalThis.__dirname=e(globalThis.__filename);let{default:a}=await import("module");globalThis.require=a.createRequire(import.meta.url)}
22
- `,ur=async({input:e="src/**/*",styles:t="src/components/index.css",target:r="esnext",format:i="esm",dev:n=!1,bundle:s=!1,standalone:o=!1,runtimeOnly:a=!1,jsOnly:u=!1,noWrite:f=!1,stdin:l=void 0,stdinFile:h=void 0,external:A=[]}={})=>{hc.NODE_ENV=n?"development":"production";let y=ue(ur);n&&(a=!0),o&&(s=!0);let{cwd:_,srcDir:E,outDir:v}=uo(),b=await co(),k=JSON.parse(b),N={treeShaking:s,target:r,minify:!n,jsx:"transform",jsxFactory:"React.createElement",format:i,charset:"utf8",logLevel:n?"warning":"error",define:{"process.env.NODE_ENV":n?JSON.stringify("development"):JSON.stringify("production")}},ee=["esbuild","*.png"],x=Pt(_,"tsconfig.export.json"),j=ar(x),Q=[];o||Q.push(cc);let B={...N,tsconfig:j?x:void 0,bundle:s,splitting:i==="esm"&&s&&!l,absWorkingDir:_,outbase:"src",outdir:"dist",assetNames:"[name].js",format:i,target:"esnext",platform:k?.platform??"node",write:!f,external:s?[...ee,...A]:void 0,banner:s?{js:f0}:void 0,plugins:Q};y.log("Build options",B);let L="";if(l){y.log("Building file from stdin",{stdin:l,stdinFile:h,noWrite:f}),h||(Ae(D.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 Ao();let c={...N,sourcefile:h,loader:"tsx",banner:void 0,footer:void 0};if(f)return(await a0(L,c)).code;{let p=dc(L,h,"tsx");await Me(async()=>await ho({...B,...p}),{start:"Building stdin to dist/.",success:"Built stdin to dist/.",error:"Error building stdin to dist/."}),Ae(D.grey("Use --no-write to print to stdout instead."));return}}y.log("Building",{files:e,dev:n,runtimeOnly:a}),pc(`${D.bold("TS Module")} [${hc.NODE_ENV}]`);let $=po.default.sync(e,{cwd:_}).filter(c=>n0(c)!==".d.ts").map(c=>Pt(c));if(s0(e)){$.length||$.push(e);let c=e.replace(E,v).replace(ht,".js").replace(Ze,".js");y.log("Cleaning emitted file:",{outfile:c}),await Ac(c,{force:!0})}else y.log("Cleaning old output:",{outDir:v}),await Ac(v,{force:!0,recursive:!0});let g=$.filter(c=>Ze.test(c));y.log("Compiling TSX files:",{tsxJsxInput:g});let H=g.filter(c=>!c.endsWith(".d.ts"));await Me(async()=>await Promise.all(H.map(async c=>{let p=await Ec(c,"utf-8"),X=u0+p,O=dc(X,c,"tsx");await ho({...B,...O})})),{start:"Compiling TSX files.",success:"Compiled TSX files.",error:"Failed to compile TSX files."});let F=$.filter(c=>ht.test(c)).filter(c=>!Ze.test(c));y.log("Compiling TS files:",{tsJsInput:F}),await Me(async()=>await ho({...B,entryPoints:F.filter(c=>!c.endsWith(".d.ts"))}),{start:"Compiling TS/JS files.",success:"Compiled TS/JS files.",error:"Failed to compile TS/JS files."});let Ce=$.filter(c=>!So.test(c));if(await Me(async()=>{for(let c of Ce){let p=lo(c);y.log("Copying non-source file:",{file:c,emittedFile:p}),await _c(mc(p),{recursive:!0}),await r0(c,p,t0.COPYFILE_FICLONE)}},{start:"Copying non-source files to dist/.",success:"Copied non-source files to dist/.",error:"Failed to copy non-source files to dist/."}),!process.env.NO_REWRITES){let c=e.replace(E,v).replace(/^(\.\/)?src\//,"dist/").replace(ht,".js").replace(Ze,".js");y.log("Normalizing import specifiers in emitted JS.",{emittedJs:c}),await Me(async()=>await Jr(c.endsWith(".js")?c:`${c}.js`),{start:"Normalizing import specifiers.",success:"Normalized import specifiers.",error:"Failed to normalize import specifiers."}),await Jr(c.endsWith(".js")?c:`${c}.js`)}if(i==="esm"&&await l0()&&Fe('Forced "type": "module" in output.').succeed(),!a){if(!u)if(ar(o0(t))){y.log("Building styles for production.");let{style:c="./dist/bundle.css"}=k;if(y.log("Building style bundle.",{bundleInput:t,bundleOutput:c,dev:n}),await Me(async()=>await gc(t,c,n),{start:"Bundling styles with Tailwind.",success:"Bundled styles with Tailwind.",error:"Failed to bundle styles."}),s){y.log("Bundling all styles.");let p=po.default.sync("dist/**/*.css");await Me(async()=>await Promise.all(p.map(async X=>await gc(X,X,n))),{start:"Bundling emitted styles",success:`Bundled all styles to ${D.bold(c)}.`,error:"Failed to bundle styles."})}}else Ae(D.grey(`Bundle styles not found for this project.
22
+ `,ur=async({input:e="src/**/*",styles:t="src/components/index.css",target:r="esnext",format:i="esm",dev:n=!1,bundle:s=!1,standalone:o=!1,runtimeOnly:a=!1,jsOnly:u=!1,noWrite:f=!1,stdin:l=void 0,stdinFile:h=void 0,external:A=[]}={})=>{hc.NODE_ENV=n?"development":"production";let y=ue(ur);n&&(a=!0),o&&(s=!0);let{cwd:_,srcDir:E,outDir:v}=uo(),b=await co(),k=JSON.parse(b),N={treeShaking:s,target:r,minify:!n,jsx:"transform",jsxFactory:"React.createElement",format:i,charset:"utf8",logLevel:n?"warning":"error",define:{"process.env.NODE_ENV":n?JSON.stringify("development"):JSON.stringify("production")}},ee=["esbuild","*.png"],x=Pt(_,"tsconfig.export.json"),j=ar(x),Q=[];o||Q.push(cc);let B={...N,tsconfig:j?x:void 0,bundle:s,splitting:i==="esm"&&s&&!l,absWorkingDir:_,outbase:"src",outdir:"dist",assetNames:"[name].js",format:i,target:"esnext",platform:k?.platform??"node",write:!f,external:s?[...ee,...A]:void 0,banner:s&&i=="esm"?{js:f0}:void 0,plugins:Q};y.log("Build options",B);let L="";if(l){y.log("Building file from stdin",{stdin:l,stdinFile:h,noWrite:f}),h||(Ae(D.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 Ao();let c={...N,sourcefile:h,loader:"tsx",banner:void 0,footer:void 0};if(f)return(await a0(L,c)).code;{let p=dc(L,h,"tsx");await Me(async()=>await ho({...B,...p}),{start:"Building stdin to dist/.",success:"Built stdin to dist/.",error:"Error building stdin to dist/."}),Ae(D.grey("Use --no-write to print to stdout instead."));return}}y.log("Building",{files:e,dev:n,runtimeOnly:a}),pc(`${D.bold("TS Module")} [${hc.NODE_ENV}]`);let $=po.default.sync(e,{cwd:_}).filter(c=>n0(c)!==".d.ts").map(c=>Pt(c));if(s0(e)){$.length||$.push(e);let c=e.replace(E,v).replace(ht,".js").replace(Ze,".js");y.log("Cleaning emitted file:",{outfile:c}),await Ac(c,{force:!0})}else y.log("Cleaning old output:",{outDir:v}),await Ac(v,{force:!0,recursive:!0});let g=$.filter(c=>Ze.test(c));y.log("Compiling TSX files:",{tsxJsxInput:g});let H=g.filter(c=>!c.endsWith(".d.ts"));await Me(async()=>await Promise.all(H.map(async c=>{let p=await Ec(c,"utf-8"),X=u0+p,O=dc(X,c,"tsx");await ho({...B,...O})})),{start:"Compiling TSX files.",success:"Compiled TSX files.",error:"Failed to compile TSX files."});let F=$.filter(c=>ht.test(c)).filter(c=>!Ze.test(c));y.log("Compiling TS files:",{tsJsInput:F}),await Me(async()=>await ho({...B,entryPoints:F.filter(c=>!c.endsWith(".d.ts"))}),{start:"Compiling TS/JS files.",success:"Compiled TS/JS files.",error:"Failed to compile TS/JS files."});let Ce=$.filter(c=>!So.test(c));if(await Me(async()=>{for(let c of Ce){let p=lo(c);y.log("Copying non-source file:",{file:c,emittedFile:p}),await _c(mc(p),{recursive:!0}),await r0(c,p,t0.COPYFILE_FICLONE)}},{start:"Copying non-source files to dist/.",success:"Copied non-source files to dist/.",error:"Failed to copy non-source files to dist/."}),!process.env.NO_REWRITES){let c=e.replace(E,v).replace(/^(\.\/)?src\//,"dist/").replace(ht,".js").replace(Ze,".js");y.log("Normalizing import specifiers in emitted JS.",{emittedJs:c}),await Me(async()=>await Jr(c.endsWith(".js")?c:`${c}.js`),{start:"Normalizing import specifiers.",success:"Normalized import specifiers.",error:"Failed to normalize import specifiers."}),await Jr(c.endsWith(".js")?c:`${c}.js`)}if(i==="esm"&&await l0()&&Fe('Forced "type": "module" in output.').succeed(),!a){if(!u)if(ar(o0(t))){y.log("Building styles for production.");let{style:c="./dist/bundle.css"}=k;if(y.log("Building style bundle.",{bundleInput:t,bundleOutput:c,dev:n}),await Me(async()=>await gc(t,c,n),{start:"Bundling styles with Tailwind.",success:"Bundled styles with Tailwind.",error:"Failed to bundle styles."}),s){y.log("Bundling all styles.");let p=po.default.sync("dist/**/*.css");await Me(async()=>await Promise.all(p.map(async X=>await gc(X,X,n))),{start:"Bundling emitted styles",success:`Bundled all styles to ${D.bold(c)}.`,error:"Failed to bundle styles."})}}else Ae(D.grey(`Bundle styles not found for this project.
23
23
  \rChecked: `+D.bold(t)));pc("Running post-build setup."),await Me(async()=>await fo(),{start:"Generating type declarations.",success:`Generated declarations for ${$.length} files.`,error:"Failed to generate type declarations."}),Ae(D.green("Build complete."))}},_b=async(e,t)=>await ur({input:e,...t});var Cc={"./package.json":"./package.json",".":"./dist/index.js","./*":"./dist/*/index.js"},yc={packageJson:{type:"module",platform:"node",engines:{node:">=14"},types:"dist/index.d.ts",files:["dist"],exports:Cc,scripts:{dev:"tsmodule dev",build:"tsmodule build",test:"ava",pretest:"yarn build",prepublishOnly:"yarn test",lint:"eslint src --fix"}},files:[".github/**",".eslintrc",".gitignore","tsconfig.json","tsconfig.export.json","LICENSE","ava.config.mjs"],dependencies:[],devDependencies:["@types/node","@tsmodule/tsmodule","@typescript-eslint/eslint-plugin","@typescript-eslint/parser","ava","eslint","typescript"]},At={default:yc,react:{packageJson:{platform:"browser",style:"dist/bundle.css",exports:{...Cc,"./*":"./dist/components/*/index.js","./styles":"./dist/bundle.css","./styles/*":"./dist/components/*/index.css"},scripts:{export:"tsmodule build",dev:"next dev",build:"next build",start:"next start",lint:"next lint --fix",pretest:"tsmodule build --runtime-only",test:"ava",prepublishOnly:"yarn export && yarn test"}},files:[".github/**",".gitignore","next-env.d.ts","next.config.js","postcss.config.js","tailwind.config.js"],dependencies:["react@^18.2.0","react-dom@^18.2.0"],devDependencies:[...yc.devDependencies,"@types/react@^18.0.23","@types/react-dom@^18.0.7","eslint-config-next","@tsmodule/react","next","tailwindcss","autoprefixer","cssnano","postcss","postcss-import"]}};import{dirname as c0,resolve as bc}from"path";import{fileURLToPath as A0}from"url";import{readFile as h0}from"fs/promises";var lr=bc(c0(A0(import.meta.url)),".."),Bb=async()=>{let e=await h0(bc(lr,"package.json"),"utf-8");return JSON.parse(e)};import{resolve as wc}from"path";var vc=ke(Gr(),1);import{copyFile as p0,mkdir as go}from"fs/promises";import{dirname as d0,resolve as Nt}from"path";var Bc=e=>Nt(lr,`./templates/${e}`),Eo=async({template:e,targetDir:t=process.cwd()})=>{let r=ce(),i=Bc(e),n=Nt(t);await go(n,{recursive:!0}),await r.run({posix:`cp -rf ${i}/. ${n}`,win32:`xcopy /E /I /Q /Y ${i}\\ ${n}\\`})},_o=async({template:e,targetDir:t=process.cwd()})=>{let r=ue(_o);r.log("Copying template files",{template:e,targetDir:t});let i=Bc(e),n=Nt(t);await go(n,{recursive:!0});let s=await(0,vc.default)(At[e].files,{cwd:i,dot:!0});if(s.length)for(let o of s){let a=Nt(i,o),u=Nt(n,o);r.log({sourcePath:a,replacementPath:u}),await go(d0(u),{recursive:!0}),await p0(a,u)}},fr=async({template:e,targetDir:t=process.cwd()})=>{let r=Nt(t),i=At[e].packageJson;return await Bi(r,i)},wi=async({template:e,targetDir:t=process.cwd()})=>{let r=ce({cwd:t}),i=[...At.default.dependencies],n=[...At.default.devDependencies];switch(e){case"react":i.push(...At.react.dependencies),n.push(...At.react.devDependencies);break}i.length&&await r.run(`yarn add ${i.join(" ")}`),n.length&&await r.run(`yarn add -D ${n.join(" ")}`)},Lb=async({template:e,targetDir:t=process.cwd()})=>{let r={template:"default",targetDir:t};if(await _o(r),await fr(r),e!=="default"){let i={template:e,targetDir:t};await _o(i),await fr(i)}await wi({template:e,targetDir:t})};var Kb=async(e,{react:t=!1})=>{let r=Fe(`Creating new module ${D.blueBright(e)}.`).start(),i={template:"default",targetDir:e};if(await Eo(i),await fr(i),t){let s={template:"react",targetDir:e};await Eo(s),await fr(s)}await Bi(wc(process.cwd(),e),{name:e}),r.succeed("Project created."),await wi({template:"default",targetDir:e}),t&&await wi({template:"react",targetDir:e}),r.succeed("Dependencies installed."),await ce({cwd:wc(e),stdio:["ignore","ignore","inherit"]}).run("git init"),r.succeed("Set up as Git repository.")};import{relative as I0,resolve as T0}from"path";import{existsSync as D0}from"fs";import{lstat as k0}from"fs/promises";var Gc=ke(Kc(),1);var Uc=()=>{console.clear()},$c=e=>{Ae(`
24
24
  `,D.gray(`Built ${D.bold(e)}.`),`
25
25
  `,D.blue(new Date().toLocaleString()))},rv=async({format:e="esm"})=>{let t=process.cwd(),r=ce();process.platform!=="win32"&&await r.run("clear"),Uc(),await ur({format:e,dev:!0}),$c("src/**/*"),(0,Gc.default)(T0(t,"src"),{recursive:!0}).on("change",async(i,n)=>{if(!D0(n)||(await k0(n)).isDirectory())return;Uc();let u=Date.now();try{await ur({dev:!0,runtimeOnly:!0,input:n})}catch(l){Ae("ERROR:",l)}let f=Date.now()-u;Fe(D.blueBright(`Dev refresh finished in ${D.bold(`${f}ms`)}.`)).succeed(),$c(I0(t,n))})};import{pathToFileURL as L0}from"url";import{resolve as O0}from"path";var uv=async()=>{let e=O0(lr,"dist/loader/index.js"),t=["--no-warnings","--loader",L0(e).href,...process.argv.slice(2)],r=ce({stdio:"inherit"}),{code:i}=await r.run(`node ${t.join(" ")}`);process.exit(i??0)};export{ZE as a,Jr as b,pc as c,gb as d,ur as e,_b as f,At as g,Bb as h,Lb as i,Kb as j,rv as k,uv as l};
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
1
 
2
2
  if(typeof process<"u"){let{dirname:e}=await import("path"),{fileURLToPath:i}=await import("url");globalThis.__filename=i(import.meta.url),globalThis.__dirname=e(globalThis.__filename);let{default:a}=await import("module");globalThis.require=a.createRequire(import.meta.url)}
3
3
 
4
- import{b as o,c as r,d as e,e as f,f as m,g as p,j as t,k as x,l as a}from"./chunk-A4YD4WCS.js";import"./chunk-UCISWLJO.js";export{e as bannerError,r as bannerLog,f as build,m as buildCommand,t as create,x as dev,a as execute,o as normalizeImportSpecifiers,p as specification};
4
+ import{b as o,c as r,d as e,e as f,f as m,g as p,j as t,k as x,l as a}from"./chunk-ZS6BSZAB.js";import"./chunk-UCISWLJO.js";export{e as bannerError,r as bannerLog,f as build,m as buildCommand,t as create,x as dev,a as execute,o as normalizeImportSpecifiers,p as specification};
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@tsmodule/tsmodule",
3
3
  "platform": "node",
4
4
  "type": "module",
5
- "version": "41.16.0",
5
+ "version": "41.17.0",
6
6
  "repository": "tsmodule/tsmodule",
7
7
  "description": "TypeScript Module loader and compiler",
8
8
  "license": "MIT",