@tsmodule/tsmodule 40.0.15 → 40.0.16

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 (58) hide show
  1. package/dist/bin.js +87 -5
  2. package/dist/commands/build/index.js +62 -6
  3. package/dist/commands/build/lib/emitTsDeclarations.js +18 -1
  4. package/dist/commands/convert/index.js +51 -1
  5. package/dist/commands/create/index.js +51 -1
  6. package/dist/commands/create/lib/templates.js +51 -1
  7. package/dist/commands/dev/index.js +66 -3
  8. package/dist/commands/execute/index.js +10 -1
  9. package/dist/commands/index.js +66 -1
  10. package/dist/commands/normalize/index.js +47 -1
  11. package/dist/commands/normalize/lib/typescriptApi.js +14 -1
  12. package/dist/constants.js +4 -1
  13. package/dist/index.js +66 -1
  14. package/dist/loader/index.js +12 -1
  15. package/dist/loader/types.js +3 -0
  16. package/dist/specification/index.js +4 -1
  17. package/dist/specification/types.js +3 -0
  18. package/dist/templates/default/.eslintrc +52 -0
  19. package/dist/templates/default/.github/workflows/ci.yml +30 -0
  20. package/dist/templates/default/.gitignore +10 -0
  21. package/dist/templates/default/LICENSE +16 -0
  22. package/dist/templates/default/README.md +35 -0
  23. package/dist/templates/default/package.json +5 -0
  24. package/dist/templates/default/src/index.ts +4 -0
  25. package/dist/templates/default/test/example.test.ts +7 -0
  26. package/dist/templates/default/tsconfig.json +40 -0
  27. package/dist/templates/react/.eslintrc +54 -0
  28. package/dist/templates/react/.gitignore +11 -0
  29. package/dist/templates/react/LICENSE +16 -0
  30. package/dist/templates/react/README.md +48 -0
  31. package/dist/templates/react/next-env.d.ts +5 -0
  32. package/dist/templates/react/next.config.js +18 -0
  33. package/dist/templates/react/package.json +5 -0
  34. package/dist/templates/react/postcss.config.js +11 -0
  35. package/dist/templates/react/public/vercel.svg +4 -0
  36. package/dist/templates/react/src/components/Card/index.css +18 -0
  37. package/dist/templates/react/src/components/Card/index.tsx +13 -0
  38. package/dist/templates/react/src/components/CardGrid/index.tsx +29 -0
  39. package/dist/templates/react/src/components/Footer/index.tsx +19 -0
  40. package/dist/templates/react/src/components/GetStarted/index.tsx +8 -0
  41. package/dist/templates/react/src/components/Welcome/index.tsx +7 -0
  42. package/dist/templates/react/src/components/index.css +19 -0
  43. package/dist/templates/react/src/components/index.ts +4 -0
  44. package/dist/templates/react/src/index.css +20 -0
  45. package/dist/templates/react/src/index.ts +1 -0
  46. package/dist/templates/react/src/pages/_app.tsx +14 -0
  47. package/dist/templates/react/src/pages/api/hello.ts +13 -0
  48. package/dist/templates/react/src/pages/index.tsx +26 -0
  49. package/dist/templates/react/tailwind.config.js +19 -0
  50. package/dist/types/index.js +66 -1
  51. package/dist/utils/cwd.js +8 -1
  52. package/dist/utils/packageJson.js +4 -1
  53. package/dist/utils/programCatch.js +46 -1
  54. package/dist/utils/require.js +4 -1
  55. package/dist/utils/resolve.js +4 -1
  56. package/dist/utils/showProgress.js +12 -1
  57. package/dist/utils/stdin.js +12 -1
  58. package/package.json +1 -2
@@ -1 +1,12 @@
1
- import{extname as m,isAbsolute as U,join as F,normalize as w,resolve as E}from"path";import{posix as H}from"path";import{win32 as S}from"path";import{fileURLToPath as M,pathToFileURL as h,URL as L}from"url";import{readFile as T}from"fs/promises";import{transform as v}from"esbuild";import{createDebugLogger as c}from"debug-logging";import{checkExtensions as x,checkTsExtensions as D,fileExists as b,isJs as C,isTs as G,MODULE_LOADERS as R}from"../utils/resolve.js";const y=async(o,r,t)=>{const{parentURL:s}=r,e=c(y);if(e.log("Resolving specifier:",{importedFromURL:s,specifier:o}),!o.startsWith(".")&&!U(o))return e.log("Using defaultResolve for named module:",{specifier:o}),t(o,r,t);const{href:l}=h(process.cwd()),{href:i}=new L(s||l);e.log("Finding import URL for",{specifier:o,baseURL:i});let n=o;o.startsWith("file://")||(U(o)?(e.log("Setting import URL to absolute specifier."),n=h(E(w(o))).href):(e.log("Setting import URL relative to baseURL."),n=new L(o,i).href),e.log("Resolved import URL:",{importedFileURL:n,importedFromURL:s}));const u=m(s??"").toLowerCase(),f=m(n).toLowerCase();if(e.log("Rewriting file extension:",{parentExtension:u,specifierExtension:f}),f){const a=n.substring(0,n.lastIndexOf(f));if(e.log("Re-resolving specifier:",{unresolvedSpecifier:a}),C.test(f)&&G.test(u)){const p=D(a);if(p)return e.log("Found JS import in TS:",{unresolvedSpecifier:a,resolvedTsSourceFile:p}),{url:p,shortCircuit:!0}}return b(a)?(e.log("Found file at unresolved specifier:",{unresolvedSpecifier:a}),{url:a,shortCircuit:!0}):t(o,r,t)}e.log("Resolving incomplete URL import to file:",{specifier:o});const d=x(n);if(d)return e.log("Resolved import URL to file:",{resolvedFile:d}),{url:d,shortCircuit:!0};const k=new L(F(n,"index")).href,g=x(k);return g?(e.log("Resolved import URL to index file:",{resolvedIndexFile:g}),{url:g,shortCircuit:!0}):t(o,r,t)},N=async(o,r,t)=>{const s=c(N);if(s.log("Loading source file:",{url:o}),!o.includes(S.sep)&&!o.includes(H.sep))return s.log("Using defaultLoad for named module:",{url:o}),t(o,r,t);const e=m(o),l=R[e];if(!l)return s.log("No loader found, using defaultLoad:",{url:o}),t(o,r,t);const i=M(o),n=await T(i,"utf8"),u=await v(n.toString(),{...l,sourcefile:i,format:"esm"});return{format:"module",source:u.code,shortCircuit:!0}},B=async(o,r,t)=>{const s=c(B);s.log("Getting format for source file:",{url:o});const e=m(o);return R[e]?{format:"module"}:(s.log("No loader found, using default format:",{url:o}),t(o,r,t))},O=async(o,r,t)=>{const s=c(O);s.log("Transforming source from context:",{context:r});const{url:e}=r,l=m(e),i=R[l];return i?{source:(await v(o.toString(),{...i,logLevel:"info",charset:"utf8",target:"esnext",sourcefile:r.url,format:r.format==="module"?"esm":"cjs"})).code}:(s.log("No loader found, using default transformer:",{url:e}),t(o,r,t))};export{B as getFormat,N as load,y as resolve,O as transformSource};
1
+
2
+ typeof document>"u"&&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
+
4
+ import{extname as R,isAbsolute as ee,join as Re,normalize as Te,resolve as Ce}from"path";import{posix as ve}from"path";import{win32 as ye}from"path";import{fileURLToPath as Le,pathToFileURL as oe,URL as j}from"url";import{readFile as Me}from"fs/promises";import{transform as te}from"esbuild";var D={NODE_ENV:"production"};try{let{env:e}=await import("process");e.NODE_ENV&&(D.NODE_ENV=e.NODE_ENV)}catch{}var C=typeof window>"u"&&D.NODE_ENV==="development";import{Console as be}from"console";var k=(e=0)=>o=>`\x1B[${o+e}m`,P=(e=0)=>o=>`\x1B[${38+e};5;${o}m`,G=(e=0)=>(o,t,r)=>`\x1B[${38+e};2;${o};${t};${r}m`;function ne(){let e=new Map,o={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};o.color.gray=o.color.blackBright,o.bgColor.bgGray=o.bgColor.bgBlackBright,o.color.grey=o.color.blackBright,o.bgColor.bgGrey=o.bgColor.bgBlackBright;for(let[t,r]of Object.entries(o)){for(let[n,s]of Object.entries(r))o[n]={open:`\x1B[${s[0]}m`,close:`\x1B[${s[1]}m`},r[n]=o[n],e.set(s[0],s[1]);Object.defineProperty(o,t,{value:r,enumerable:!1})}return Object.defineProperty(o,"codes",{value:e,enumerable:!1}),o.color.close="\x1B[39m",o.bgColor.close="\x1B[49m",o.color.ansi=k(),o.color.ansi256=P(),o.color.ansi16m=G(),o.bgColor.ansi=k(10),o.bgColor.ansi256=P(10),o.bgColor.ansi16m=G(10),Object.defineProperties(o,{rgbToAnsi256:{value:(t,r,n)=>t===r&&r===n?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(r/255*5)+Math.round(n/255*5),enumerable:!1},hexToRgb:{value:t=>{let r=/(?<colorString>[a-f\d]{6}|[a-f\d]{3})/i.exec(t.toString(16));if(!r)return[0,0,0];let{colorString:n}=r.groups;n.length===3&&(n=[...n].map(i=>i+i).join(""));let s=Number.parseInt(n,16);return[s>>16&255,s>>8&255,s&255]},enumerable:!1},hexToAnsi256:{value:t=>o.rgbToAnsi256(...o.hexToRgb(t)),enumerable:!1},ansi256ToAnsi:{value:t=>{if(t<8)return 30+t;if(t<16)return 90+(t-8);let r,n,s;if(t>=232)r=((t-232)*10+8)/255,n=r,s=r;else{t-=16;let f=t%36;r=Math.floor(t/36)/5,n=Math.floor(f/6)/5,s=f%6/5}let i=Math.max(r,n,s)*2;if(i===0)return 30;let c=30+(Math.round(s)<<2|Math.round(n)<<1|Math.round(r));return i===2&&(c+=60),c},enumerable:!1},rgbToAnsi:{value:(t,r,n)=>o.ansi256ToAnsi(o.rgbToAnsi256(t,r,n)),enumerable:!1},hexToAnsi:{value:t=>o.ansi256ToAnsi(o.hexToAnsi256(t)),enumerable:!1}}),o}var se=ne(),a=se;import B from"node:process";import ie from"node:os";import $ from"node:tty";function u(e,o=B.argv){let t=e.startsWith("-")?"":e.length===1?"-":"--",r=o.indexOf(t+e),n=o.indexOf("--");return r!==-1&&(n===-1||r<n)}var{env:l}=B,v;u("no-color")||u("no-colors")||u("color=false")||u("color=never")?v=0:(u("color")||u("colors")||u("color=true")||u("color=always"))&&(v=1);function le(){if("FORCE_COLOR"in l)return l.FORCE_COLOR==="true"?1:l.FORCE_COLOR==="false"?0:l.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(l.FORCE_COLOR,10),3)}function ce(e){return e===0?!1:{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function ue(e,{streamIsTTY:o,sniffFlags:t=!0}={}){let r=le();r!==void 0&&(v=r);let n=t?v:r;if(n===0)return 0;if(t){if(u("color=16m")||u("color=full")||u("color=truecolor"))return 3;if(u("color=256"))return 2}if(e&&!o&&n===void 0)return 0;let s=n||0;if(l.TERM==="dumb")return s;if(B.platform==="win32"){let i=ie.release().split(".");return Number(i[0])>=10&&Number(i[2])>=10586?Number(i[2])>=14931?3:2:1}if("CI"in l)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE","DRONE"].some(i=>i in l)||l.CI_NAME==="codeship"?1:s;if("TEAMCITY_VERSION"in l)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(l.TEAMCITY_VERSION)?1:0;if("TF_BUILD"in l&&"AGENT_NAME"in l)return 1;if(l.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in l){let i=Number.parseInt((l.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(l.TERM_PROGRAM){case"iTerm.app":return i>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(l.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(l.TERM)||"COLORTERM"in l?1:s}function V(e,o={}){let t=ue(e,{streamIsTTY:e&&e.isTTY,...o});return ce(t)}var ae={stdout:V({isTTY:$.isatty(1)}),stderr:V({isTTY:$.isatty(2)})},H=ae;function Y(e,o,t){let r=e.indexOf(o);if(r===-1)return e;let n=o.length,s=0,i="";do i+=e.substr(s,r-s)+o+t,s=r+n,r=e.indexOf(o,s);while(r!==-1);return i+=e.slice(s),i}function J(e,o,t,r){let n=0,s="";do{let i=e[r-1]==="\r";s+=e.substr(n,(i?r-1:r)-n)+o+(i?`\r
5
+ `:`
6
+ `)+t,n=r+1,r=e.indexOf(`
7
+ `,n)}while(r!==-1);return s+=e.slice(n),s}var{stdout:W,stderr:K}=H,A=Symbol("GENERATOR"),m=Symbol("STYLER"),E=Symbol("IS_EMPTY"),z=["ansi","ansi","ansi256","ansi16m"],d=Object.create(null),fe=(e,o={})=>{if(o.level&&!(Number.isInteger(o.level)&&o.level>=0&&o.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");let t=W?W.level:0;e.level=o.level===void 0?t:o.level};var ge=e=>{let o=(...t)=>t.join(" ");return fe(o,e),Object.setPrototypeOf(o,x.prototype),o};function x(e){return ge(e)}Object.setPrototypeOf(x.prototype,Function.prototype);for(let[e,o]of Object.entries(a))d[e]={get(){let t=y(this,F(o.open,o.close,this[m]),this[E]);return Object.defineProperty(this,e,{value:t}),t}};d.visible={get(){let e=y(this,this[m],!0);return Object.defineProperty(this,"visible",{value:e}),e}};var S=(e,o,t,...r)=>e==="rgb"?o==="ansi16m"?a[t].ansi16m(...r):o==="ansi256"?a[t].ansi256(a.rgbToAnsi256(...r)):a[t].ansi(a.rgbToAnsi(...r)):e==="hex"?S("rgb",o,t,...a.hexToRgb(...r)):a[t][e](...r),pe=["rgb","hex","ansi256"];for(let e of pe){d[e]={get(){let{level:t}=this;return function(...r){let n=F(S(e,z[t],"color",...r),a.color.close,this[m]);return y(this,n,this[E])}}};let o="bg"+e[0].toUpperCase()+e.slice(1);d[o]={get(){let{level:t}=this;return function(...r){let n=F(S(e,z[t],"bgColor",...r),a.bgColor.close,this[m]);return y(this,n,this[E])}}}}var me=Object.defineProperties(()=>{},{...d,level:{enumerable:!0,get(){return this[A].level},set(e){this[A].level=e}}}),F=(e,o,t)=>{let r,n;return t===void 0?(r=e,n=o):(r=t.openAll+e,n=o+t.closeAll),{open:e,close:o,openAll:r,closeAll:n,parent:t}},y=(e,o,t)=>{let r=(...n)=>de(r,n.length===1?""+n[0]:n.join(" "));return Object.setPrototypeOf(r,me),r[A]=e,r[m]=o,r[E]=t,r},de=(e,o)=>{if(e.level<=0||!o)return e[E]?"":o;let t=e[m];if(t===void 0)return o;let{openAll:r,closeAll:n}=t;if(o.includes("\x1B"))for(;t!==void 0;)o=Y(o,t.close,t.open),t=t.parent;let s=o.indexOf(`
8
+ `);return s!==-1&&(o=J(o,n,r,s)),r+o+n};Object.defineProperties(x.prototype,d);var he=x(),$e=x({level:K?K.level:0});var w=he;var g=new be({stdout:process.stdout,stderr:process.stderr,groupIndentation:4}),h=e=>{if(C){let{name:o}=e;return{log(...t){let r=w.bgBlue.white(` [${o}] `);g.log(`${r}`,`
9
+
10
+ `,...t),g.log()},group(){g.log();let t=w.bgBlue.white(` [${o}] `);g.group(t),g.log()},groupEnd(){g.log(`
11
+ `,"-".repeat(20),`
12
+ `),g.groupEnd()}}}else return{log(){},group(){},groupEnd(){}}};import{existsSync as Ee}from"fs";import{fileURLToPath as xe}from"url";var X=/\.[mc]?tsx?(?=\?|$)/,q=/\.([mc])?js$/;var b={format:"esm",charset:"utf8",sourcemap:"inline",target:"node16",minify:!1},O={".mts":{...b,loader:"ts"},".jsx":{...b,loader:"jsx"},".tsx":{...b,loader:"tsx"},".cts":{...b,loader:"ts"},".ts":{...b,loader:"ts"},".json":{...b,loader:"json"}},Q=Object.keys(O);var I=e=>{let o=xe(e);if(Ee(o))return e},Z=e=>{for(let o of e)if(I(o))return o},U=e=>{let o=Q.filter(t=>t.includes("ts")).concat([".js"]);return Z(o.map(t=>e+t))},Oe=e=>{let o=Q.filter(t=>t.includes("js")).concat([".js"]);return Z(o.map(t=>e+t))},_=e=>{let o=Oe(e);if(o)return o;let t=U(e);if(t)return t};var Ne=async(e,o,t)=>{let{parentURL:r}=o,n=h(Ne);if(n.log("Resolving specifier:",{importedFromURL:r,specifier:e}),!e.startsWith(".")&&!ee(e))return n.log("Using defaultResolve for named module:",{specifier:e}),t(e,o,t);let{href:s}=oe(process.cwd()),{href:i}=new j(r||s);n.log("Finding import URL for",{specifier:e,baseURL:i});let c=e;e.startsWith("file://")||(ee(e)?(n.log("Setting import URL to absolute specifier."),c=oe(Ce(Te(e))).href):(n.log("Setting import URL relative to baseURL."),c=new j(e,i).href),n.log("Resolved import URL:",{importedFileURL:c,importedFromURL:r}));let f=R(r??"").toLowerCase(),T=R(c).toLowerCase();if(n.log("Rewriting file extension:",{parentExtension:f,specifierExtension:T}),T){let p=c.substring(0,c.lastIndexOf(T));if(n.log("Re-resolving specifier:",{unresolvedSpecifier:p}),q.test(T)&&X.test(f)){let N=U(p);if(N)return n.log("Found JS import in TS:",{unresolvedSpecifier:p,resolvedTsSourceFile:N}),{url:N,shortCircuit:!0}}return I(p)?(n.log("Found file at unresolved specifier:",{unresolvedSpecifier:p}),{url:p,shortCircuit:!0}):t(e,o,t)}n.log("Resolving incomplete URL import to file:",{specifier:e});let L=_(c);if(L)return n.log("Resolved import URL to file:",{resolvedFile:L}),{url:L,shortCircuit:!0};let re=new j(Re(c,"index")).href,M=_(re);return M?(n.log("Resolved import URL to index file:",{resolvedIndexFile:M}),{url:M,shortCircuit:!0}):t(e,o,t)},Be=async(e,o,t)=>{let r=h(Be);if(r.log("Loading source file:",{url:e}),!e.includes(ye.sep)&&!e.includes(ve.sep))return r.log("Using defaultLoad for named module:",{url:e}),t(e,o,t);let n=R(e),s=O[n];if(!s)return r.log("No loader found, using defaultLoad:",{url:e}),t(e,o,t);let i=Le(e),c=await Me(i,"utf8"),f=await te(c.toString(),{...s,sourcefile:i,format:"esm"});return{format:"module",source:f.code,shortCircuit:!0}},Ae=async(e,o,t)=>{let r=h(Ae);r.log("Getting format for source file:",{url:e});let n=R(e);return O[n]?{format:"module"}:(r.log("No loader found, using default format:",{url:e}),t(e,o,t))},Se=async(e,o,t)=>{let r=h(Se);r.log("Transforming source from context:",{context:o});let{url:n}=o,s=R(n),i=O[s];return i?{source:(await te(e.toString(),{...i,logLevel:"info",charset:"utf8",target:"esnext",sourcefile:o.url,format:o.format==="module"?"esm":"cjs"})).code}:(r.log("No loader found, using default transformer:",{url:n}),t(e,o,t))};export{Ae as getFormat,Be as load,Ne as resolve,Se as transformSource};
@@ -0,0 +1,3 @@
1
+
2
+ typeof document>"u"&&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
+
@@ -1 +1,4 @@
1
- const e={"./package.json":"./package.json",".":"./dist/index.js","./*":"./dist/*/index.js"},t={packageJson:{type:"module",platform:"node",types:"dist/index.d.ts",files:["dist"],exports:e,scripts:{dev:"tsmodule dev",build:"tsmodule build",test:"ava",pretest:"tsmodule build",prepublishOnly:"yarn test",lint:"eslint src --fix"},ava:{timeout:"10m",files:["test/**/*.test.ts"],extensions:{ts:"module"},nodeArguments:["--no-warnings","--loader=@tsmodule/tsmodule/loader"]}},files:["tsconfig.json",".eslintrc"],dependencies:[],devDependencies:["@types/node","@tsmodule/tsmodule","@typescript-eslint/eslint-plugin","@typescript-eslint/parser","ava","eslint","typescript"]},o={default:t,react:{packageJson:{platform:"browser",style:"dist/bundle.css",exports:{...e,"./*":"./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"},resolutions:{"@types/react":"^17.0.38","@types/react-dom":"^17.0.11"}},files:[".eslintrc","next-env.d.ts","next.config.js","postcss.config.js","tailwind.config.js"],dependencies:["react@^17.0.2","react-dom@^17.0.2"],devDependencies:[...t.devDependencies,"@types/react@^17.0.39","@types/react-dom@^17.0.11","eslint-config-next","@tsmodule/react","next","tailwindcss","autoprefixer","cssnano","postcss","postcss-import"]}};export*from"./types.js";export{o as specification};
1
+
2
+ typeof document>"u"&&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
+
4
+ var t={"./package.json":"./package.json",".":"./dist/index.js","./*":"./dist/*/index.js"},e={packageJson:{type:"module",platform:"node",types:"dist/index.d.ts",files:["dist"],exports:t,scripts:{dev:"tsmodule dev",build:"tsmodule build",test:"ava",pretest:"tsmodule build",prepublishOnly:"yarn test",lint:"eslint src --fix"},ava:{timeout:"10m",files:["test/**/*.test.ts"],extensions:{ts:"module"},nodeArguments:["--no-warnings","--loader=@tsmodule/tsmodule/loader"]}},files:["tsconfig.json",".eslintrc"],dependencies:[],devDependencies:["@types/node","@tsmodule/tsmodule","@typescript-eslint/eslint-plugin","@typescript-eslint/parser","ava","eslint","typescript"]},s={default:e,react:{packageJson:{platform:"browser",style:"dist/bundle.css",exports:{...t,"./*":"./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"},resolutions:{"@types/react":"^17.0.38","@types/react-dom":"^17.0.11"}},files:[".eslintrc","next-env.d.ts","next.config.js","postcss.config.js","tailwind.config.js"],dependencies:["react@^17.0.2","react-dom@^17.0.2"],devDependencies:[...e.devDependencies,"@types/react@^17.0.39","@types/react-dom@^17.0.11","eslint-config-next","@tsmodule/react","next","tailwindcss","autoprefixer","cssnano","postcss","postcss-import"]}};export{s as specification};
@@ -0,0 +1,3 @@
1
+
2
+ typeof document>"u"&&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
+
@@ -0,0 +1,52 @@
1
+ {
2
+ "extends": [
3
+ "plugin:@typescript-eslint/recommended"
4
+ ],
5
+ "parser": "@typescript-eslint/parser",
6
+ "plugins": ["@typescript-eslint"],
7
+ "rules": {
8
+
9
+ "no-console": "error",
10
+ "no-trailing-spaces": "error",
11
+ "max-len": [1, 80, 2, {
12
+ "ignorePattern": "^import\\s.+\\sfrom\\s.+;$",
13
+ "ignoreUrls": true,
14
+ "ignoreStrings": true,
15
+ "ignoreTemplateLiterals": true,
16
+ "ignoreRegExpLiterals": true
17
+ }],
18
+
19
+ "@typescript-eslint/type-annotation-spacing": ["error"],
20
+
21
+ "@typescript-eslint/ban-ts-comment": [
22
+ "error",
23
+ {
24
+ "ts-nocheck": "allow-with-description",
25
+ "ts-ignore": "allow-with-description"
26
+ }
27
+ ],
28
+
29
+ "indent": "off",
30
+ "@typescript-eslint/indent": ["error", 2],
31
+
32
+ "semi": "off",
33
+ "@typescript-eslint/semi": ["error", "always"],
34
+
35
+ "quotes": "off",
36
+ "@typescript-eslint/quotes": ["error", "double"],
37
+
38
+ "object-curly-spacing": "off",
39
+ "@typescript-eslint/object-curly-spacing": ["error", "always"],
40
+
41
+ "sort-imports": [
42
+ "warn",
43
+ {
44
+ "ignoreCase": false,
45
+ "ignoreDeclarationSort": false,
46
+ "ignoreMemberSort": true,
47
+ "memberSyntaxSortOrder": ["none", "all", "multiple", "single"],
48
+ "allowSeparatedGroups": true
49
+ }
50
+ ]
51
+ }
52
+ }
@@ -0,0 +1,30 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - '**'
7
+ pull_request:
8
+ branches:
9
+ - '**'
10
+
11
+ jobs:
12
+ test:
13
+ name: Node ${{ matrix.nodejs }} on ${{ matrix.os }}
14
+ runs-on: ${{ matrix.os }}
15
+ timeout-minutes: 10
16
+ strategy:
17
+ matrix:
18
+ nodejs: [14, 16, "lts/*"]
19
+ os: [ubuntu-latest, windows-latest, macos-latest]
20
+ steps:
21
+ - uses: actions/checkout@v2
22
+ - uses: actions/setup-node@v2
23
+ with:
24
+ node-version: ${{ matrix.nodejs }}
25
+
26
+ - name: Install and link
27
+ run: yarn install --frozen-lockfile && yarn build
28
+
29
+ - name: Test
30
+ run: yarn test
@@ -0,0 +1,10 @@
1
+ node_modules
2
+
3
+ # Potential Firebase / GCP credentials.
4
+ service-account.json
5
+
6
+ # Emitted output.
7
+ dist/
8
+
9
+ # Incremental TS build info.
10
+ *.tsbuildinfo
@@ -0,0 +1,16 @@
1
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
2
+ this software and associated documentation files (the "Software"), to deal in
3
+ the Software without restriction, including without limitation the rights to
4
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
5
+ the Software, and to permit persons to whom the Software is furnished to do so,
6
+ subject to the following conditions:
7
+
8
+ The above copyright notice and this permission notice shall be included in all
9
+ copies or substantial portions of the Software.
10
+
11
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
13
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
14
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
15
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
16
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,35 @@
1
+ # `tsmodule` library
2
+
3
+ This is a [`tsmodule`](https://github.com/tsmodule/tsmodule) library. By
4
+ default, it is assumed to be a Node program, but this can be adjusted via the
5
+ `platform` field in package.json.
6
+
7
+ ### Develop
8
+
9
+ Rebuild on changes with `tsmodule dev` or the `yarn dev` script:
10
+
11
+ ```bash
12
+ yarn dev
13
+ # calls `tsmodule dev`
14
+ ```
15
+
16
+ ### Export and publish
17
+
18
+ To export your component library, use `tsmodule build` or the `yarn build`
19
+ script:
20
+
21
+ ```bash
22
+ yarn build
23
+ # calls `tsmodule build`
24
+ ```
25
+
26
+ You can then publish to NPM:
27
+
28
+ ```bash
29
+ yarn publish
30
+ ```
31
+
32
+ #### Importing from your library
33
+
34
+ All index exports, e.g. `src/example/index.tsx` will be available downstream
35
+ via `import ... from "my-library/example"`.
@@ -0,0 +1,5 @@
1
+ {
2
+ "name": "template",
3
+ "version": "0.0.1",
4
+ "license": "MIT"
5
+ }
@@ -0,0 +1,4 @@
1
+ export const helloWorld = () => {
2
+ // eslint-disable-next-line no-console
3
+ console.log("Hello World!");
4
+ };
@@ -0,0 +1,7 @@
1
+ import test from "ava";
2
+
3
+ test("two plus two should equal four", (t) => {
4
+ if (2 + 2 === 4) {
5
+ t.pass();
6
+ }
7
+ });
@@ -0,0 +1,40 @@
1
+ {
2
+ "include": [
3
+ "*env.d.ts",
4
+ "src/**/*"
5
+ ],
6
+ "exclude": [
7
+ "node_modules",
8
+ "test/**"
9
+ ],
10
+ "compilerOptions": {
11
+ "moduleResolution": "Node",
12
+ "target": "ESNext",
13
+ "module": "ESNext",
14
+ "lib": [
15
+ "ESNext",
16
+ "DOM"
17
+ ],
18
+ "jsx": "preserve",
19
+ "rootDir": "src",
20
+ "outDir": "dist",
21
+ "allowJs": true,
22
+ "importHelpers": true,
23
+ "esModuleInterop": true,
24
+ "allowSyntheticDefaultImports": true,
25
+ "strict": true,
26
+ "noUnusedLocals": true,
27
+ "noUnusedParameters": true,
28
+ "noImplicitReturns": true,
29
+ "noFallthroughCasesInSwitch": true,
30
+ "skipLibCheck": true,
31
+ "resolveJsonModule": true,
32
+ "declaration": true,
33
+ "sourceMap": true,
34
+ "checkJs": true,
35
+ "noEmit": false,
36
+ "forceConsistentCasingInFileNames": true,
37
+ "isolatedModules": true,
38
+ "incremental": false
39
+ }
40
+ }
@@ -0,0 +1,54 @@
1
+ {
2
+ "extends": [
3
+ "plugin:@typescript-eslint/recommended",
4
+ "next",
5
+ "next/core-web-vitals"
6
+ ],
7
+ "parser": "@typescript-eslint/parser",
8
+ "plugins": ["@typescript-eslint"],
9
+ "rules": {
10
+
11
+ "no-console": "error",
12
+ "no-trailing-spaces": "error",
13
+ "max-len": [1, 80, 2, {
14
+ "ignorePattern": "^import\\s.+\\sfrom\\s.+;$",
15
+ "ignoreUrls": true,
16
+ "ignoreStrings": true,
17
+ "ignoreTemplateLiterals": true,
18
+ "ignoreRegExpLiterals": true
19
+ }],
20
+
21
+ "@typescript-eslint/type-annotation-spacing": ["error"],
22
+
23
+ "@typescript-eslint/ban-ts-comment": [
24
+ "error",
25
+ {
26
+ "ts-nocheck": "allow-with-description",
27
+ "ts-ignore": "allow-with-description"
28
+ }
29
+ ],
30
+
31
+ "indent": "off",
32
+ "@typescript-eslint/indent": ["error", 2],
33
+
34
+ "semi": "off",
35
+ "@typescript-eslint/semi": ["error", "always"],
36
+
37
+ "quotes": "off",
38
+ "@typescript-eslint/quotes": ["error", "double"],
39
+
40
+ "object-curly-spacing": "off",
41
+ "@typescript-eslint/object-curly-spacing": ["error", "always"],
42
+
43
+ "sort-imports": [
44
+ "warn",
45
+ {
46
+ "ignoreCase": false,
47
+ "ignoreDeclarationSort": false,
48
+ "ignoreMemberSort": true,
49
+ "memberSyntaxSortOrder": ["none", "all", "multiple", "single"],
50
+ "allowSeparatedGroups": true
51
+ }
52
+ ]
53
+ }
54
+ }
@@ -0,0 +1,11 @@
1
+ node_modules
2
+
3
+ # Potential Firebase / GCP credentials.
4
+ service-account.json
5
+
6
+ # Emitted output.
7
+ dist/
8
+ .next/
9
+
10
+ # Incremental TS build info.
11
+ *.tsbuildinfo
@@ -0,0 +1,16 @@
1
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
2
+ this software and associated documentation files (the "Software"), to deal in
3
+ the Software without restriction, including without limitation the rights to
4
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
5
+ the Software, and to permit persons to whom the Software is furnished to do so,
6
+ subject to the following conditions:
7
+
8
+ The above copyright notice and this permission notice shall be included in all
9
+ copies or substantial portions of the Software.
10
+
11
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
13
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
14
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
15
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
16
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,48 @@
1
+ # `tsmodule` component library
2
+
3
+ This is a [`tsmodule`](https://github.com/tsmodule/tsmodule) component library
4
+ developed and previewed with Next.js.
5
+
6
+ ### Develop
7
+
8
+ To start the Next server and develop your components, use `next dev` or the
9
+ `yarn dev` script:
10
+
11
+ ```bash
12
+ yarn dev
13
+ # calls `next dev`
14
+ ```
15
+
16
+ ### Export and publish
17
+
18
+ To export your component library, use `tsmodule build` or the `yarn export`
19
+ script:
20
+
21
+ ```bash
22
+ yarn export
23
+ # calls `tsmodule build`
24
+ ```
25
+
26
+ You can then publish to NPM:
27
+
28
+ ```bash
29
+ yarn publish
30
+ ```
31
+
32
+ #### Importing from your component library
33
+
34
+ To reuse your components:
35
+
36
+ 1. Import your component styles via `import "my-library/styles"`.
37
+ 2. Import your component and render it via `import { MyComponent } from
38
+ "my-library/MyComponent`.
39
+
40
+ #### Footnotes
41
+
42
+ Styles are exported in `dist/`, and are also bundled to `dist/bundle.css` from
43
+ the entrypoint given in the `style` package.json.
44
+
45
+ The default behavior is to export all component styles, i.e.
46
+ `src/styles/components/index.css ➞ dist/bundle.css`. This can be overridden
47
+ with tsmodule's `--styles` flag, i.e. `tsmodule build --styles
48
+ src/styles/index.css` (which would include all styles in emitted bundle).
@@ -0,0 +1,5 @@
1
+ /// <reference types="next" />
2
+ /// <reference types="next/image-types/global" />
3
+
4
+ // NOTE: This file should not be edited
5
+ // see https://nextjs.org/docs/basic-features/typescript for more information.
@@ -0,0 +1,18 @@
1
+ module.exports = {
2
+ reactStrictMode: true,
3
+ webpack: (config) => {
4
+ // config.experiments = { topLevelAwait: true };
5
+ // config.resolve.fallback = {
6
+ // assert: false,
7
+ // process: false,
8
+ // events: false,
9
+ // fs: false,
10
+ // util: false,
11
+ // path: false,
12
+ // stream: false,
13
+ // constants: false,
14
+ // os: false,
15
+ // };
16
+ return config;
17
+ },
18
+ };
@@ -0,0 +1,5 @@
1
+ {
2
+ "name": "template",
3
+ "version": "0.0.1",
4
+ "license": "MIT"
5
+ }
@@ -0,0 +1,11 @@
1
+ module.exports = {
2
+ plugins: {
3
+ /**
4
+ * PostCSS import resolution must come first.
5
+ */
6
+ "postcss-import": {},
7
+ tailwindcss: {},
8
+ autoprefixer: {},
9
+ ...(process.env.NODE_ENV === "production" ? { cssnano: {} } : {})
10
+ },
11
+ };
@@ -0,0 +1,4 @@
1
+ <svg width="283" height="64" viewBox="0 0 283 64" fill="none"
2
+ xmlns="http://www.w3.org/2000/svg">
3
+ <path d="M141.04 16c-11.04 0-19 7.2-19 18s8.96 18 20 18c6.67 0 12.55-2.64 16.19-7.09l-7.65-4.42c-2.02 2.21-5.09 3.5-8.54 3.5-4.79 0-8.86-2.5-10.37-6.5h28.02c.22-1.12.35-2.28.35-3.5 0-10.79-7.96-17.99-19-17.99zm-9.46 14.5c1.25-3.99 4.67-6.5 9.45-6.5 4.79 0 8.21 2.51 9.45 6.5h-18.9zM248.72 16c-11.04 0-19 7.2-19 18s8.96 18 20 18c6.67 0 12.55-2.64 16.19-7.09l-7.65-4.42c-2.02 2.21-5.09 3.5-8.54 3.5-4.79 0-8.86-2.5-10.37-6.5h28.02c.22-1.12.35-2.28.35-3.5 0-10.79-7.96-17.99-19-17.99zm-9.45 14.5c1.25-3.99 4.67-6.5 9.45-6.5 4.79 0 8.21 2.51 9.45 6.5h-18.9zM200.24 34c0 6 3.92 10 10 10 4.12 0 7.21-1.87 8.8-4.92l7.68 4.43c-3.18 5.3-9.14 8.49-16.48 8.49-11.05 0-19-7.2-19-18s7.96-18 19-18c7.34 0 13.29 3.19 16.48 8.49l-7.68 4.43c-1.59-3.05-4.68-4.92-8.8-4.92-6.07 0-10 4-10 10zm82.48-29v46h-9V5h9zM36.95 0L73.9 64H0L36.95 0zm92.38 5l-27.71 48L73.91 5H84.3l17.32 30 17.32-30h10.39zm58.91 12v9.69c-1-.29-2.06-.49-3.2-.49-5.81 0-10 4-10 10V51h-9V17h9v9.2c0-5.08 5.91-9.2 13.2-9.2z" fill="#000"/>
4
+ </svg>
@@ -0,0 +1,18 @@
1
+ .card {
2
+ @apply p-6 text-left rounded-lg;
3
+ @apply max-w-[20rem];
4
+ text-decoration: none;
5
+ border: 1px solid #eaeaea;
6
+ transition: color 0.15s ease, border-color 0.15s ease;
7
+ }
8
+
9
+ .card:hover,
10
+ .card:focus,
11
+ .card:active {
12
+ color: #0070f3;
13
+ border-color: #0070f3;
14
+ }
15
+
16
+ .card > p {
17
+ @apply text-gray-700;
18
+ }
@@ -0,0 +1,13 @@
1
+ import { FC } from "react";
2
+
3
+ interface CardProps {
4
+ href: string;
5
+ }
6
+
7
+ export const Card: FC<CardProps> = ({ href, children }) => {
8
+ return (
9
+ <a href={href} className="card">
10
+ {children}
11
+ </a>
12
+ );
13
+ };
@@ -0,0 +1,29 @@
1
+ import { Card } from "../Card";
2
+
3
+ export const CardGrid = () => {
4
+ return (
5
+ <div className="px-4 grid md:grid-cols-2 gap-8">
6
+ <Card href="https://nextjs.org/learn">
7
+ <h4>Documentation &rarr;</h4>
8
+ <p>Find in-depth information about Next.js features and API.</p>
9
+ </Card>
10
+
11
+ <Card href="https://nextjs.org/learn">
12
+ <h4>Learn &rarr;</h4>
13
+ <p>Learn about Next.js in an interactive course with quizzes!</p>
14
+ </Card>
15
+
16
+ <Card href="https://github.com/vercel/next.js/tree/master/examples">
17
+ <h4>Examples &rarr;</h4>
18
+ <p>Discover and deploy boilerplate example Next.js projects.</p>
19
+ </Card>
20
+
21
+ <Card href="https://vercel.com/new?utm_source=create-next-app&utm_medium=default-template&utm_campaign=create-next-app">
22
+ <h4>Deploy &rarr;</h4>
23
+ <p>
24
+ Instantly deploy your Next.js site to a public URL with Vercel.
25
+ </p>
26
+ </Card>
27
+ </div>
28
+ );
29
+ };
@@ -0,0 +1,19 @@
1
+ import Image from "next/image";
2
+
3
+ export const Footer = () => {
4
+ return (
5
+ <footer>
6
+ <a
7
+ className="flex-center"
8
+ href="https://vercel.com?utm_source=create-next-app&utm_medium=default-template&utm_campaign=create-next-app"
9
+ target="_blank"
10
+ rel="noopener noreferrer"
11
+ >
12
+ Powered by{" "}
13
+ <span className="h-4 ml-2 flex-center">
14
+ <Image src="/vercel.svg" alt="Vercel Logo" width={72} height={16} />
15
+ </span>
16
+ </a>
17
+ </footer>
18
+ );
19
+ };
@@ -0,0 +1,8 @@
1
+ export const GetStarted = () => {
2
+ return (
3
+ <p className="text-gray-700 text-center font-size-3">
4
+ Get started by editing{" "}
5
+ <code className="code">pages/index.js</code>.
6
+ </p>
7
+ );
8
+ };
@@ -0,0 +1,7 @@
1
+ export const Welcome = () => {
2
+ return (
3
+ <h1 className="text-center">
4
+ Welcome to <a href="https://nextjs.org">Next.js!</a>
5
+ </h1>
6
+ );
7
+ };
@@ -0,0 +1,19 @@
1
+ /**
2
+ * @fileoverview
3
+ * COMPONENT STYLES
4
+ *
5
+ * This file loads all styles needed to render any of the module components, and
6
+ * does not include, e.g., the standardized viewport styles (which would alter
7
+ * the sizing of html, body, ... in any layouts that relied it).
8
+ */
9
+
10
+ /**
11
+ * ❌ DO NOT CHANGE: Load standardized styles that may be relied on by component
12
+ * styles.
13
+ */
14
+ @import "@tsmodule/react";
15
+
16
+ /**
17
+ * 📝 EXPORT COMPONENT STYLES: Load your component style exports here as needed.
18
+ */
19
+ @import "./Card/index.css";
@@ -0,0 +1,4 @@
1
+ export * from "./Card";
2
+ export * from "./CardGrid";
3
+ export * from "./GetStarted";
4
+ export * from "./Welcome";
@@ -0,0 +1,20 @@
1
+ /**
2
+ * @fileoverview
3
+ * APPLICATION STYLES
4
+ *
5
+ * This stylesheet includes all styles needed to render the entire viewport,
6
+ * namely Tailwind utilities, standardized viewport styles, and all component
7
+ * styles.
8
+ */
9
+
10
+ /**
11
+ * Load Tailwind utilities.
12
+ */
13
+ @import "tailwindcss/base";
14
+ @import "tailwindcss/utilities";
15
+ @import "tailwindcss/components";
16
+
17
+ /**
18
+ * Load this module's component styles.
19
+ */
20
+ @import "./components/index.css";
@@ -0,0 +1 @@
1
+ export * from "./components";
@@ -0,0 +1,14 @@
1
+ import "../index.css";
2
+
3
+ import type { AppProps } from "next/app";
4
+ import { StrictMode } from "react";
5
+
6
+ function App({ Component, pageProps }: AppProps) {
7
+ return (
8
+ <StrictMode>
9
+ <Component {...pageProps} />
10
+ </StrictMode>
11
+ );
12
+ }
13
+
14
+ export default App;