@tsmodule/tsmodule 28.8.0 → 30.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import{dirname as R,extname as K,isAbsolute as U,resolve as F,resolve as v}from"path";import{build as h,transform as q}from"esbuild";import{existsSync as _,mkdirSync as H,readFileSync as j,rmSync as $,writeFileSync as L}from"fs";import c from"chalk";import{env as M}from"process";import Q from"fast-glob";import m from"ora";import{createDebugLogger as Y,log as y}from"create-debug-logger";import{isJsOrTs as A,isTs as S,isTsxOrJsx as p}from"../../utils/resolve.js";import{createShell as Z}from"await-shell";import{emitTsDeclarations as ee}from"./lib/emitTsDeclarations.js";import{normalizeImportSpecifiers as te}from"../normalize/index.js";import{getPackageJsonFile as oe}from"../../utils/pkgJson.js";import{getWorkingDirs as G}from"../../utils/cwd.js";import{readStdin as se}from"../../utils/stdin.js";const ie=`import React from "react";
1
+ import{dirname as R,extname as K,isAbsolute as U,resolve as F,resolve as v}from"path";import{build as j,transform as q}from"esbuild";import{existsSync as A,mkdirSync as H,readFileSync as h,rmSync as _,writeFileSync as $}from"fs";import l from"chalk";import{env as L}from"process";import Q from"fast-glob";import m from"ora";import{createDebugLogger as Y,log as g}from"create-debug-logger";import{isJsOrTs as M,isTs as y,isTsxOrJsx as f}from"../../utils/resolve.js";import{createShell as Z}from"await-shell";import{emitTsDeclarations as ee}from"./lib/emitTsDeclarations.js";import{normalizeImportSpecifiers as te}from"../normalize/index.js";import{getPackageJsonFile as oe}from"../../utils/pkgJson.js";import{getWorkingDirs as W}from"../../utils/cwd.js";import{readStdin as se}from"../../utils/stdin.js";const ie=`import React from "react";
2
2
  import ReactDOM from "react-dom";
3
- `,I=t=>{const o=` ${t} `;y(c.bgBlue(c.bold(c.white(o))))},ne=()=>{let t;if(_("dist/package.json")?t=JSON.parse(j("dist/package.json","utf-8")):t={},t?.module==="module")return!0;t.type="module",L("dist/package.json",JSON.stringify(t,null,2))},V=(t,o,f)=>{const{srcDir:i,outDir:O}=G();return o=v(o),{stdin:{contents:t,sourcefile:o,resolveDir:R(o),loader:f},outdir:void 0,outfile:o.replace(A,".js").replace(i,O)}},re=async({files:t="src/**/*",styles:o="src/styles/components/index.css",bundle:f=!1,dev:i=!1,target:O="esnext",runtimeOnly:w=!1,noWrite:d=!1,stdin:l="",stdinFile:u=""})=>{M.NODE_ENV=i?"development":"production";const s=Y(re),W=Z(),{cwd:b,srcDir:T,outDir:a}=G(),C=await oe(),J=JSON.parse(C),k={treeShaking:f,target:O,minify:!i,format:"esm",charset:"utf8",logLevel:i?"warning":"error",define:{PACKAGE_JSON:C,"process.env.NODE_ENV":i?JSON.stringify("development"):JSON.stringify("production")}},x={...k,bundle:f,absWorkingDir:b,outbase:"src",outdir:"dist",assetNames:"[name].js",format:"esm",target:"esnext",platform:J?.platform??"node",write:!d};let g="";if(l){s.log("Building file from stdin",{stdin:l,stdinFile:u,noWrite:d}),!d&&!u&&(y(c.red("ERROR: --stdin-file must be specified when using stdin in write mode.")),process.exit(1)),typeof l=="string"&&l.length?g=l:g=await se();const e={...k,sourcefile:u,loader:"tsx",banner:void 0,footer:void 0};if(d)return(await q(g,e)).code;{const n=V(g,u,"tsx");return await h({...x,...n})}}s.log("Building",{files:t,dev:i,runtimeOnly:w}),I(`${c.bold("TS Module")} [${M.NODE_ENV}]`);const r=Q.sync(t,{cwd:b}).filter(e=>K(e)!==".d.ts").map(e=>v(e));if(U(t)){r.length||r.push(t);const e=t.replace(T,a).replace(S,".js").replace(p,".js");s.log("Cleaning emitted file:",{outfile:e}),$(e,{force:!0})}else s.log("Cleaning old output:",{outDir:a}),$(a,{force:!0,recursive:!0});console.log();const D=r.filter(e=>S.test(e)).filter(e=>!p.test(e));s.log("Compiling TS files:",{tsFiles:D}),await h({...x,entryPoints:D.filter(e=>!e.endsWith(".d.ts"))}),m("Built TS files.").succeed();const N=r.filter(e=>p.test(e));s.log("Compiling TSX files:",{tsxFiles:N});const z=N.filter(e=>!e.endsWith(".d.ts"));await Promise.all(z.map(async e=>{const n=j(e,"utf-8"),B=ie+n,P=V(B,e,"tsx");await h({...x,...P,jsxFactory:"React.createElement"})})),m("Built TSX files.").succeed();const E=r.filter(e=>!A.test(e));if(s.log("Copying non-JS/TS files.",{allFiles:r,nonJsTsFiles:E}),await Promise.all(E.map(async e=>{const n=F(b,e).replace(T,a).replace(S,".js").replace(p,".js");s.log("Copying non-source file:",{file:e,outfile:n}),H(R(n),{recursive:!0}),L(n,j(e),{encoding:"binary",flag:"w"})})),!process.env.NO_REWRITES){const e=t.replace(T,a).replace(/^(\.\/)?src\//,"dist/").replace(S,".js").replace(p,".js");await te(e.endsWith(".js")?e:`${e}.js`),m("Normalized import specifiers.").succeed()}if(ne()&&m('Forced "type": "module" in output.').succeed(),console.log(),!(i||w)){if(_(F(o))){s.log("Building styles for production.");const{style:e="./dist/styles.css"}=J,X=["npx tailwindcss",i?"":"-m","--postcss postcss.config.js",`-i ${o}`,"-o",e];await W.run(X.join(" "))}else s.log("Styles not found.",{styles:o});I("Running post-build setup."),y(`Generating type declarations.
4
- This might take a moment.`),ee(r),m(`Generated delcarations for ${r.length} files.`).succeed(),y(c.green("Build complete."))}};export{I as bannerLog,re as build};
3
+ `,G=t=>{const o=` ${t} `;g(l.bgBlue(l.bold(l.white(o))))},ne=()=>{let t;if(A("dist/package.json")?t=JSON.parse(h("dist/package.json","utf-8")):t={},t?.module==="module")return!0;t.type="module",$("dist/package.json",JSON.stringify(t,null,2))},I=(t,o,p)=>{const{srcDir:i,outDir:S}=W();return o=v(o),{stdin:{contents:t,sourcefile:o,resolveDir:R(o),loader:p},outdir:void 0,outfile:o.replace(M,".js").replace(i,S)}},re=async({files:t="src/**/*",styles:o="src/components/index.css",bundle:p=!1,dev:i=!1,target:S="esnext",runtimeOnly:b=!1,noWrite:O=!1,stdin:c,stdinFile:d})=>{L.NODE_ENV=i?"development":"production";const s=Y(re),V=Z(),{cwd:w,srcDir:x,outDir:a}=W(),C=await oe(),J=JSON.parse(C),k={treeShaking:p,target:S,minify:!i,jsx:"transform",jsxFactory:"React.createElement",format:"esm",charset:"utf8",logLevel:i?"warning":"error",define:{PACKAGE_JSON:C,"process.env.NODE_ENV":i?JSON.stringify("development"):JSON.stringify("production")}},T={...k,bundle:p,absWorkingDir:w,outbase:"src",outdir:"dist",assetNames:"[name].js",format:"esm",target:"esnext",platform:J?.platform??"node",write:!O};let u="";if(c){s.log("Building file from stdin",{stdin:c,stdinFile:d,noWrite:O}),d||(g(l.red("ERROR: --stdin-file must be specified to emulate a file location when using stdin.")),process.exit(1)),typeof c=="string"&&c.length?u=c:u=await se();const e={...k,sourcefile:d,loader:"tsx",banner:void 0,footer:void 0};if(O)return(await q(u,e)).code;{const n=I(u,d,"tsx");return await j({...T,...n})}}s.log("Building",{files:t,dev:i,runtimeOnly:b}),G(`${l.bold("TS Module")} [${L.NODE_ENV}]`);const r=Q.sync(t,{cwd:w}).filter(e=>K(e)!==".d.ts").map(e=>v(e));if(U(t)){r.length||r.push(t);const e=t.replace(x,a).replace(y,".js").replace(f,".js");s.log("Cleaning emitted file:",{outfile:e}),_(e,{force:!0})}else s.log("Cleaning old output:",{outDir:a}),_(a,{force:!0,recursive:!0});console.log();const D=r.filter(e=>f.test(e));s.log("Compiling TSX files:",{tsxFiles:D});const z=D.filter(e=>!e.endsWith(".d.ts"));await Promise.all(z.map(async e=>{const n=h(e,"utf-8"),E=ie+n,P=I(E,e,"tsx");await j({...T,...P})})),m("Built TSX files.").succeed();const N=r.filter(e=>y.test(e)).filter(e=>!f.test(e));s.log("Compiling TS files:",{tsFiles:N}),await j({...T,entryPoints:N.filter(e=>!e.endsWith(".d.ts"))}),m("Built TS files.").succeed();const B=r.filter(e=>!M.test(e));if(s.log("Copying non-JS/TS files.",{allFiles:r,nonJsTsFiles:B}),await Promise.all(B.map(async e=>{const n=F(w,e).replace(x,a).replace(y,".js").replace(f,".js");s.log("Copying non-source file:",{file:e,outfile:n}),H(R(n),{recursive:!0}),$(n,h(e),{encoding:"binary",flag:"w"})})),!process.env.NO_REWRITES){const e=t.replace(x,a).replace(/^(\.\/)?src\//,"dist/").replace(y,".js").replace(f,".js");await te(e.endsWith(".js")?e:`${e}.js`),m("Normalized import specifiers.").succeed()}if(ne()&&m('Forced "type": "module" in output.').succeed(),console.log(),!(i||b)){if(A(F(o))){s.log("Building styles for production.");const{style:e="./dist/bundle.css"}=J,X=["npx tailwindcss",i?"":"-m","--postcss postcss.config.js",`-i ${o}`,"-o",e];await V.run(X.join(" "))}else s.log("Styles not found.",{styles:o});G("Running post-build setup."),g(`Generating type declarations.
4
+ This might take a moment.`),ee(r),m(`Generated delcarations for ${r.length} files.`).succeed(),g(l.green("Build complete."))}};export{G as bannerLog,re as build};
@@ -1 +1 @@
1
- import a from"chalk";import{createShell as c}from"await-shell";import d from"ora";import{copyTemplate as n}from"./lib/createTemplate.js";import{rewritePkgJson as l}from"./lib/rewritePkgJson.js";globalThis.SHELL_OPTIONS={stdio:["ignore","ignore","inherit"]};const w=async(e,{react:o=!1})=>{const i=c(),s=d(`Creating new module ${a.blueBright(e)}.`).start();await n("default",e),o&&await n("react",e),await l(e),s.succeed("Project created."),process.chdir(e);const r=[],t=["@tsmodule/tsmodule"];o?(r.push("react","react-dom"),t.push("@types/react","@types/react-dom","next","eslint","eslint-config-next","tailwindcss","postcss","postcss-import","autoprefixer")):t.push("@types/node"),r.length&&await i.run(`yarn add ${r.join(" ")}`),t.length&&await i.run(`yarn add -D ${t.join(" ")}`),s.succeed("Dependencies installed."),await i.run("git init"),s.succeed("Git initialized.")};export{w as create};
1
+ import c from"chalk";import{createShell as l}from"await-shell";import d from"ora";import{dependencies as p,devDependencies as n}from"../../constants.js";import{copyTemplate as a}from"./lib/createTemplate.js";import{rewritePkgJson as u}from"./lib/rewritePkgJson.js";globalThis.SHELL_OPTIONS={stdio:["ignore","ignore","inherit"]};const D=async(e,{react:o=!1})=>{const i=l(),r=d(`Creating new module ${c.blueBright(e)}.`).start();await a("default",e),o&&await a("react",e),await u(e),r.succeed("Project created."),process.chdir(e);const s=[],t=["@tsmodule/tsmodule"];o?(s.push(...p.react),t.push(...n.react)):t.push(...n.default),s.length&&await i.run(`yarn add ${s.join(" ")}`),t.length&&await i.run(`yarn add -D ${t.join(" ")}`),r.succeed("Dependencies installed."),await i.run("git init"),r.succeed("Git initialized.")};export{D as create};
@@ -0,0 +1 @@
1
+ const t={default:[],react:["@tsmodule/react","react","react-dom"]},s={default:["@types/node"],react:["next","@types/react","@types/react-dom","eslint","eslint-config-next","tailwindcss","autoprefixer","cssnano","postcss","postcss-import"]};export{t as dependencies,s as devDependencies};
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
- var r="@tsmodule/tsmodule",s="node",a="module",d="28.8.0",m="tsmodule/tsmodule",l="TypeScript Module loader and compiler",p="MIT",c={tsmodule:"dist/index.js"},u={".":"./dist/loader/index.js","./*":"./dist/*/index.js","./package.json":"./package.json"},f="dist/types/index.d.ts",g=[{name:"C. Lewis",email:"ctj.lewis@icloud.com",url:"https://ctjlewis.com"}],b=["dist/","templates/"],y={node:">=14"},h={bootstrap:"node bootstrap.js",bootload:"node --no-warnings --loader ./dist/loader/index.js src/index.ts build -r",prebuild:"yarn bootstrap && yarn bootload && yarn link -f",build:"tsmodule build",dev:"tsmodule dev",lint:"eslint --fix src",prepare:"yarn build -r",prepublishOnly:"yarn build && yarn test",pretest:"yarn build -r",test:"ava --no-worker-threads",retest:"SKIP_TEST_SETUP=1 yarn test"},v={"@types/glob":"^7.2.0","@types/node":"^17.0.21","@typescript-eslint/eslint-plugin":"^5.14.0","@typescript-eslint/parser":"^5.14.0",ava:"^4.1.0","await-shell":"^32.0.0",chalk:"^5.0.1",commander:"^9.0.0","create-debug-logger":"^3.0.0",esbuild:"^0.14.25",eslint:"^8.11.0","fast-glob":"^3.2.10","fs-extra":"^10.0.1",glob:"^7.2.0","node-watch":"^0.7.3",ora:"^6.1.0",path:"^0.12.7",typescript:"^4.6.2"},w=["esm","loader","typescript","loader hook","require hook","experimental-loader"],S={timeout:"10 minutes",files:["test/**/*.test.ts"],extensions:{ts:"module"},nodeArguments:["--no-warnings","--loader=@tsmodule/tsmodule"]},R={"@types/fs-extra":"^9.0.13"},n={name:r,platform:s,type:a,version:d,repository:m,description:l,license:p,bin:c,exports:u,types:f,contributors:g,files:b,engines:y,scripts:h,dependencies:v,keywords:w,ava:S,devDependencies:R};import t from"chalk";import{Command as x}from"commander";import{build as B}from"./commands/build/index.js";import{create as C}from"./commands/create/index.js";import{dev as E}from"./commands/dev/index.js";import{execute as T}from"./commands/execute/index.js";import{normalizeImportSpecifiers as A}from"./commands/normalize/index.js";const{version:j}=n,o=new x;o.name(t.white(t.bold("tsmodule"))).usage(t.white(t.bold("<file | command> [options]"))).description(t.blueBright(`A tool for building TypeScript modules.
2
+ var r="@tsmodule/tsmodule",s="node",a="module",d="30.0.1",m="tsmodule/tsmodule",l="TypeScript Module loader and compiler",p="MIT",c="dist/types/index.d.ts",u={tsmodule:"dist/index.js"},f={".":"./dist/loader/index.js","./*":"./dist/*/index.js","./package.json":"./package.json"},g=["dist/","templates/"],b={node:">=14"},y={bootstrap:"node bootstrap.js",bootload:"node --no-warnings --loader ./dist/loader/index.js src/index.ts build -r",prebuild:"yarn bootstrap && yarn bootload && yarn link -f",build:"tsmodule build",dev:"tsmodule dev",lint:"eslint --fix src",prepare:"yarn build -r",prepublishOnly:"yarn build && yarn test",pretest:"yarn build -r",test:"ava --no-worker-threads",retest:"SKIP_TEST_SETUP=1 yarn test"},h={"@types/glob":"^7.2.0","@types/node":"^17.0.21","@typescript-eslint/eslint-plugin":"^5.14.0","@typescript-eslint/parser":"^5.14.0",ava:"^4.1.0","await-shell":"^32.0.0",chalk:"^5.0.1",commander:"^9.0.0","create-debug-logger":"^3.0.0",esbuild:"^0.14.25",eslint:"^8.11.0","fast-glob":"^3.2.10","fs-extra":"^10.0.1",glob:"^7.2.0","node-watch":"^0.7.3",ora:"^6.1.0",path:"^0.12.7",typescript:"^4.6.2"},v={"@types/fs-extra":"^9.0.13","eslint-config-next":"^12.1.0"},w={timeout:"10 minutes",files:["test/**/*.test.ts"],extensions:{ts:"module"},nodeArguments:["--no-warnings","--loader=@tsmodule/tsmodule"]},S=["esm","loader","typescript","loader hook","require hook","experimental-loader"],R=[{name:"C. Lewis",email:"ctj.lewis@icloud.com",url:"https://ctjlewis.com"}],n={name:r,platform:s,type:a,version:d,repository:m,description:l,license:p,types:c,bin:u,exports:f,files:g,engines:b,scripts:y,dependencies:h,devDependencies:v,ava:w,keywords:S,contributors:R};import t from"chalk";import{Command as x}from"commander";import{build as B}from"./commands/build/index.js";import{create as C}from"./commands/create/index.js";import{dev as E}from"./commands/dev/index.js";import{execute as T}from"./commands/execute/index.js";import{normalizeImportSpecifiers as A}from"./commands/normalize/index.js";const{version:j}=n,o=new x;o.name(t.white(t.bold("tsmodule"))).usage(t.white(t.bold("<file | command> [options]"))).description(t.blueBright(`A tool for building TypeScript modules.
3
3
 
4
4
  Run TS directly: ${t.bold("tsmodule src/index.ts")}
5
- Use a command: ${t.bold("tsmodule build")}`)).version(String(j)),o.command("dev").description("Build and watch for changes.").action(E),o.command("build").option("--files <files>","Entrypoints to compile.\r","src/**/*").option("--styles <styles>","Specify stylesheet entrypoint.\r","src/styles/components/index.css").option("-t, --target <target>","ECMAScript featureset to target.\r","esnext").option("-b, --bundle","Bundle dependencies into entrypoints.\r",!1).option("-d, --dev","Build development runtime.\r",!1).option("-r, --runtime-only","Do not emit type declarations, only build JS runtime.\r",!1).option("--stdin [source]","Read from a string or stdin.").option("--stdin-file [file]","File path to mock for stdin.").option("--no-write",`Return code from build() rather than write to disk.
6
- For programmatic use alongside { stdin: ... }.`).description("Builds TS files to output in dist/.").action(async i=>{await B(i)}),o.command("create <name>").option("--react","Create React component library with Next.js").description("Create a new project.").action(C),o.command("normalize [files]").description(`Rewrites import specifiers in files to ESM-compliant paths.
5
+ Use a command: ${t.bold("tsmodule build")}`)).version(String(j)),o.command("dev").description("Build and watch for changes.").action(E),o.command("build").description("Builds TS files to output in dist/.").option("--files <files>","Entrypoints to compile.","src/**/*").option("--styles <styles>","Specify stylesheet entrypoint.","src/components/index.css").option("-t, --target <target>","ECMAScript featureset to target.","esnext").option("-b, --bundle","Bundle dependencies into entrypoints.",!1).option("-d, --dev","Build development runtime.",!1).option("-r, --runtime-only","Do not emit type declarations, only build JS runtime.",!1).option("--stdin [source]","Read from a string or stdin.").option("--stdin-file [file]","File path to mock for stdin.").option("--no-write",`Return code from build() rather than write to disk.
6
+ For programmatic use alongside { stdin: ... }.`,!1).action(async i=>{await B(i)}),o.command("create <name>").option("--react","Create React component library with Next.js").description("Create a new project.").action(C),o.command("normalize [files]").description(`Rewrites import specifiers in files to ESM-compliant paths.
7
7
  (default: dist/**/*.js)`).action(async({files:i})=>{await A(i)}),o.command("run",{isDefault:!0}).argument("<file>","The file to run.").option("--d, --dev","Enable development mode").description("Run the given TS program, analogous to `node <file>`.").action(T),o.parse(process.argv);
package/package.json CHANGED
@@ -2,10 +2,11 @@
2
2
  "name": "@tsmodule/tsmodule",
3
3
  "platform": "node",
4
4
  "type": "module",
5
- "version": "28.8.0",
5
+ "version": "30.0.1",
6
6
  "repository": "tsmodule/tsmodule",
7
7
  "description": "TypeScript Module loader and compiler",
8
8
  "license": "MIT",
9
+ "types": "dist/types/index.d.ts",
9
10
  "bin": {
10
11
  "tsmodule": "dist/index.js"
11
12
  },
@@ -14,14 +15,6 @@
14
15
  "./*": "./dist/*/index.js",
15
16
  "./package.json": "./package.json"
16
17
  },
17
- "types": "dist/types/index.d.ts",
18
- "contributors": [
19
- {
20
- "name": "C. Lewis",
21
- "email": "ctj.lewis@icloud.com",
22
- "url": "https://ctjlewis.com"
23
- }
24
- ],
25
18
  "files": [
26
19
  "dist/",
27
20
  "templates/"
@@ -62,14 +55,10 @@
62
55
  "path": "^0.12.7",
63
56
  "typescript": "^4.6.2"
64
57
  },
65
- "keywords": [
66
- "esm",
67
- "loader",
68
- "typescript",
69
- "loader hook",
70
- "require hook",
71
- "experimental-loader"
72
- ],
58
+ "devDependencies": {
59
+ "@types/fs-extra": "^9.0.13",
60
+ "eslint-config-next": "^12.1.0"
61
+ },
73
62
  "ava": {
74
63
  "timeout": "10 minutes",
75
64
  "files": [
@@ -83,7 +72,19 @@
83
72
  "--loader=@tsmodule/tsmodule"
84
73
  ]
85
74
  },
86
- "devDependencies": {
87
- "@types/fs-extra": "^9.0.13"
88
- }
75
+ "keywords": [
76
+ "esm",
77
+ "loader",
78
+ "typescript",
79
+ "loader hook",
80
+ "require hook",
81
+ "experimental-loader"
82
+ ],
83
+ "contributors": [
84
+ {
85
+ "name": "C. Lewis",
86
+ "email": "ctj.lewis@icloud.com",
87
+ "url": "https://ctjlewis.com"
88
+ }
89
+ ]
89
90
  }
@@ -39,10 +39,10 @@ To reuse your components:
39
39
 
40
40
  #### Footnotes
41
41
 
42
- Styles are exported in `dist/`, and are also bundled to `dist/styles.css` from
42
+ Styles are exported in `dist/`, and are also bundled to `dist/bundle.css` from
43
43
  the entrypoint given in the `style` package.json.
44
44
 
45
45
  The default behavior is to export all component styles, i.e.
46
- `src/styles/components/index.css ➞ dist/styles.css`. This can be overridden
46
+ `src/styles/components/index.css ➞ dist/bundle.css`. This can be overridden
47
47
  with tsmodule's `--styles` flag, i.e. `tsmodule build --styles
48
48
  src/styles/index.css` (which would include all styles in emitted bundle).
@@ -4,14 +4,14 @@
4
4
  "version": "0.0.1",
5
5
  "license": "MIT",
6
6
  "types": "dist/index.d.ts",
7
- "style": "dist/styles.css",
7
+ "style": "dist/bundle.css",
8
8
  "files": [
9
9
  "dist"
10
10
  ],
11
11
  "exports": {
12
12
  ".": "./dist/index.js",
13
- "./styles": "./dist/styles/index.css",
14
- "./styles/*": "./dist/styles/*/index.css",
13
+ "./styles": "./dist/bundle.css",
14
+ "./styles/*": "./dist/components/*/index.css",
15
15
  "./package.json": "./package.json",
16
16
  "./*": "./dist/components/*/index.js"
17
17
  },
@@ -1,7 +1,11 @@
1
1
  module.exports = {
2
2
  plugins: {
3
+ /**
4
+ * PostCSS import resolution must come first.
5
+ */
3
6
  "postcss-import": {},
4
7
  tailwindcss: {},
5
8
  autoprefixer: {},
9
+ ...(process.env.NODE_ENV === "production" ? { cssnano: {} } : {})
6
10
  },
7
- }
11
+ };
@@ -15,4 +15,8 @@
15
15
 
16
16
  .card > p {
17
17
  @apply text-gray-700;
18
+ }
19
+
20
+ .test {
21
+ @apply flex-pure;
18
22
  }
@@ -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,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";
@@ -1,8 +1,9 @@
1
- import "../styles/index.css";
1
+ import "../index.css";
2
+
2
3
  import type { AppProps } from "next/app";
3
4
  import { StrictMode } from "react";
4
5
 
5
- function MyApp({ Component, pageProps }: AppProps) {
6
+ function App({ Component, pageProps }: AppProps) {
6
7
  return (
7
8
  <StrictMode>
8
9
  <Component {...pageProps} />
@@ -10,4 +11,4 @@ function MyApp({ Component, pageProps }: AppProps) {
10
11
  );
11
12
  }
12
13
 
13
- export default MyApp;
14
+ export default App;
@@ -10,8 +10,6 @@ module.exports = {
10
10
  "gradient-radial": "radial-gradient(var(--tw-gradient-stops))"
11
11
  },
12
12
  border : [ "hover"],
13
-
14
-
15
13
  },
16
14
  },
17
15
  variants: {
@@ -1 +0,0 @@
1
- @import './card/index.css';
@@ -1,266 +0,0 @@
1
- /* FONTS: Customize */
2
- /* Style your serif font here. */
3
- .serif {
4
- font-family: serif;
5
- }
6
-
7
- /* Style your sans font here. */
8
- .sans-serif {
9
- font-family: sans-serif;
10
- }
11
-
12
- /* Style your display font here. */
13
- .display {}
14
-
15
- /* Style your interface font here. */
16
- .interface {
17
- font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen,
18
- Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif;
19
- }
20
-
21
- /* LINKS */
22
- a {
23
- @apply underline;
24
- color: inherit;
25
- text-decoration: none;
26
- }
27
-
28
- h1 a,
29
- h2 a,
30
- h3 a,
31
- h4 a,
32
- h5 a,
33
- h6 a {
34
- color: #0070f3;
35
- }
36
-
37
- /* If the user can hover, transition in by default. */
38
- @media (hover: hover) {
39
- a {
40
- transition: 300ms;
41
- text-decoration: underline;
42
- text-decoration-color: transparent;
43
- }
44
-
45
- a:hover {
46
- text-decoration-color: inherit;
47
- }
48
- }
49
-
50
- /* FONT SIZES */
51
- @media (min-width: 769px) {
52
- html {
53
- font-size: 1.25em;
54
- }
55
- }
56
-
57
- @media (min-width: 1081px) {
58
- html {
59
- font-size: 1.5em;
60
- }
61
- }
62
-
63
- @media (min-width: 1921px) {
64
- html {
65
- font-size: 2.5em;
66
- }
67
- }
68
-
69
- /* HEADINGS */
70
-
71
- h1, .h1,
72
- h2, .h2,
73
- h3, .h3,
74
- h4, .h4,
75
- h5, .h5,
76
- h6, .h6 {
77
- @apply font-bold display;
78
- @apply pb-2 leading-snug;
79
- }
80
-
81
- h1, .h1 {
82
- @apply text-4xl;
83
- }
84
-
85
- h2, .h2 {
86
- @apply text-2xl;
87
- }
88
-
89
- h3, .h3 {
90
- @apply text-xl;
91
- }
92
-
93
- h4, .h4 {
94
- @apply text-lg;
95
- }
96
-
97
- h5, .h5 {
98
- @apply text-base;
99
- }
100
-
101
- h6, .h6 {
102
- @apply text-sm;
103
- }
104
-
105
- p {
106
- @apply text-base;
107
- }
108
-
109
- .title {
110
- @apply mt-2 display font-bold;
111
- }
112
-
113
- .title p {
114
- @apply p-0 m-0;
115
- }
116
-
117
- /* FLEX */
118
-
119
- /**
120
- * A container that expands to fill its parent.
121
- */
122
- .expanded {
123
- @apply h-full w-full;
124
- }
125
- /**
126
- * A flex container that is filled by its content.
127
- */
128
- .filled {
129
- @apply flex flex-1 items-stretch;
130
- }
131
- /**
132
- * A pure-flex container will be display: flex.
133
- */
134
- .pure-flex {
135
- @apply flex;
136
- }
137
- /**
138
- * And its immediate children will have zero padding and margin.
139
- */
140
- .pure-flex > * {
141
- @apply m-0 p-0;
142
- }
143
- /*
144
- * A flex container centered along both axes.
145
- */
146
- .flex-center {
147
- @apply flex justify-center items-center;
148
- }
149
- /**
150
- * Center flex and text.
151
- */
152
- .center {
153
- @apply flex-center text-center;
154
- }
155
-
156
- /* CONTENT */
157
-
158
- code {}
159
-
160
- main {
161
- @apply flex-center flex-col space-y-8 md:space-y-16;
162
- @apply min-h-full w-full;
163
- @apply px-4 py-16;
164
- }
165
-
166
- header {
167
- z-index: 9999;
168
- }
169
-
170
- footer {
171
- @apply flex-center py-4 border-t-2 border-gray-200;
172
- }
173
-
174
- article {
175
- @apply text-lg serif mx-auto;
176
- @apply max-w-screen-sm lg:max-w-screen-lg 2xl:max-w-screen-2xl 4xl:max-w-screen-4xl;
177
- }
178
-
179
- /* FORMS */
180
-
181
- button, .button {
182
- @apply cursor-pointer;
183
- @apply pure-flex flex-center;
184
- @apply px-8 py-4;
185
- @apply rounded-lg border-2;
186
- @apply bg-blue-500 text-white font-bold;
187
-
188
- text-decoration: none !important;
189
- }
190
-
191
- label {
192
- @apply p-4 font-light;
193
- }
194
-
195
- input {
196
- @apply border-2 border-gray-300 rounded-lg;
197
- @apply p-2;
198
- }
199
-
200
- select {
201
- @apply bg-white;
202
- @apply border-2 border-gray-300 rounded-lg;
203
- @apply p-2;
204
- }
205
-
206
- /* Buttons already signal that the user can interact by touching. */
207
- button, .button {
208
- text-decoration: none !important;
209
- @apply cursor-pointer;
210
- @apply pure-flex flex-center;
211
- @apply px-8 py-4;
212
- @apply rounded-lg border-2;
213
- @apply bg-blue-500 text-white font-bold;
214
- }
215
-
216
- /* TABLES */
217
-
218
- table {
219
- @apply mx-auto w-full;
220
- }
221
-
222
- table tr, table tr div {
223
- @apply truncate;
224
- }
225
-
226
- table tr:nth-child(even) {
227
- /* @apply bg-gray-400; */
228
- }
229
-
230
-
231
- .squish {
232
- animation-name: squish;
233
- animation-timing-function: ease;
234
- animation-duration: 2s;
235
- animation-iteration-count: 1;
236
- }
237
-
238
- @keyframes squish {
239
- 0% {
240
- transform: scale(1, 1);
241
- }
242
-
243
- 10% {
244
- transform: scale(1.1, 0.9);
245
- }
246
-
247
- 30% {
248
- transform: scale(0.9, 1.1);
249
- }
250
-
251
- 50% {
252
- transform: scale(1.05, 0.95);
253
- }
254
-
255
- 57% {
256
- transform: scale(1, 1);
257
- }
258
-
259
- 64% {
260
- transform: scale(1, 1);
261
- }
262
-
263
- 100% {
264
- transform: scale(1, 1);
265
- }
266
- }
@@ -1,2 +0,0 @@
1
- @import './viewport/index.css';
2
- @import './elements/index.css';
@@ -1,11 +0,0 @@
1
- /*
2
- * Ensure the page fills the viewport. Prevent purgecss from removing this
3
- * styling, which it likes to do for the #__next selector.
4
- */
5
- /* purgecss start ignore */
6
- html, body, #__next {
7
- @apply m-0 p-0 box-border;
8
- @apply min-h-screen;
9
- @apply w-full h-full;
10
- }
11
- /* purgecss end ignore */
@@ -1,6 +0,0 @@
1
- @import 'tailwindcss/base';
2
- @import 'tailwindcss/utilities';
3
- @import 'tailwindcss/components';
4
-
5
- @import './global/index.css';
6
- @import './components/index.css';
@@ -1 +0,0 @@
1
- export const PRODUCTION = process.env.NODE_ENV === 'production';