poops 1.0.9 → 1.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/example/dist/css/styles.css +1 -1
- package/example/dist/css/styles.min.css +1 -1
- package/example/dist/js/scripts.js +1 -1
- package/example/dist/js/scripts.js.map +2 -2
- package/example/dist/js/scripts.min.js +1 -1
- package/example/src/js/main.ts +0 -1
- package/example/src/scss/index.scss +1 -1
- package/index.html +1 -1
- package/lib/markups.js +10 -6
- package/lib/scripts.js +39 -35
- package/lib/styles.js +5 -4
- package/package.json +1 -1
- package/poops.js +4 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* poops v1.0.
|
|
1
|
+
/* poops v1.0.10 | https://github.com/stamat/poops | MIT License */
|
|
2
2
|
@charset "UTF-8";
|
|
3
3
|
/*! Sulphuris 🜍 1.0.4 */.border,.border-b,.border-l,.border-r,.border-t,.border-x,.border-y{border:1px solid}.border-t{border-bottom:none}.border-b,.border-t{border-left:none;border-right:none}.border-b{border-top:none}.border-l{border-right:none}.border-l,.border-r{border-bottom:none;border-top:none}.border-r{border-left:none}.border-x{border-bottom:none;border-top:none}.border-y{border-left:none;border-right:none}.border-2{border-width:2px}.border-3{border-width:3px}.border-4{border-width:4px}.border-6{border-width:6px}.border-8{border-width:8px}@media only screen and (min-width:421px){.border-sm-2{border-width:2px}.border-sm-3{border-width:3px}.border-sm-4{border-width:4px}.border-sm-6{border-width:6px}.border-sm-8{border-width:8px}}@media only screen and (min-width:768px){.border-md-2{border-width:2px}.border-md-3{border-width:3px}.border-md-4{border-width:4px}.border-md-6{border-width:6px}.border-md-8{border-width:8px}}@media only screen and (min-width:1024px){.border-lg-2{border-width:2px}.border-lg-3{border-width:3px}.border-lg-4{border-width:4px}.border-lg-6{border-width:6px}.border-lg-8{border-width:8px}}@media only screen and (min-width:1366px){.border-xl-2{border-width:2px}.border-xl-3{border-width:3px}.border-xl-4{border-width:4px}.border-xl-6{border-width:6px}.border-xl-8{border-width:8px}}@media only screen and (min-width:1680px){.border-xxl-2{border-width:2px}.border-xxl-3{border-width:3px}.border-xxl-4{border-width:4px}.border-xxl-6{border-width:6px}.border-xxl-8{border-width:8px}}.border-solid{border-style:solid}.border-dashed{border-style:dashed}.border-dotted{border-style:dotted}.border-0{border:0}.border-t-0{border-top:0}.border-r-0{border-right:0}.border-b-0{border-bottom:0}.border-l-0,.border-x-0{border-left:0}.border-x-0{border-right:0}.border-y-0{border-bottom:0;border-top:0}@media only screen and (min-width:421px){.border-sm-0{border:0}.border-t-sm-0{border-top:0}.border-r-sm-0{border-right:0}.border-b-sm-0{border-bottom:0}.border-l-sm-0{border-left:0}.border-x-sm-0{border-left:0;border-right:0}.border-y-sm-0{border-bottom:0;border-top:0}}@media only screen and (min-width:768px){.border-md-0{border:0}.border-t-md-0{border-top:0}.border-r-md-0{border-right:0}.border-b-md-0{border-bottom:0}.border-l-md-0{border-left:0}.border-x-md-0{border-left:0;border-right:0}.border-y-md-0{border-bottom:0;border-top:0}}@media only screen and (min-width:1024px){.border-lg-0{border:0}.border-t-lg-0{border-top:0}.border-r-lg-0{border-right:0}.border-b-lg-0{border-bottom:0}.border-l-lg-0{border-left:0}.border-x-lg-0{border-left:0;border-right:0}.border-y-lg-0{border-bottom:0;border-top:0}}@media only screen and (min-width:1366px){.border-xl-0{border:0}.border-t-xl-0{border-top:0}.border-r-xl-0{border-right:0}.border-b-xl-0{border-bottom:0}.border-l-xl-0{border-left:0}.border-x-xl-0{border-left:0;border-right:0}.border-y-xl-0{border-bottom:0;border-top:0}}@media only screen and (min-width:1680px){.border-xxl-0{border:0}.border-t-xxl-0{border-top:0}.border-r-xxl-0{border-right:0}.border-b-xxl-0{border-bottom:0}.border-l-xxl-0{border-left:0}.border-x-xxl-0{border-left:0;border-right:0}.border-y-xxl-0{border-bottom:0;border-top:0}}.round{border-radius:50%}.round,[class*=rounded-]{overflow:hidden}.rounded-fix{-webkit-mask-image:-webkit-radial-gradient(#fff,#000)}.rounded-0{border-radius:0}.rounded-4{border-radius:4px}.rounded-6{border-radius:6px}.rounded-8{border-radius:8px}.rounded-16{border-radius:16px}.rounded-24{border-radius:24px}.rounded-32{border-radius:32px}.rounded-tl-0{border-top-left-radius:0}.rounded-t-0,.rounded-tr-0{border-top-right-radius:0}.rounded-t-0{border-top-left-radius:0}.rounded-r-0{border-bottom-right-radius:0;border-top-right-radius:0}.rounded-bl-0{border-bottom-left-radius:0}.rounded-b-0,.rounded-br-0{border-bottom-right-radius:0}.rounded-b-0,.rounded-l-0{border-bottom-left-radius:0}.rounded-l-0{border-top-left-radius:0}.btn,button.reset{align-items:center;-webkit-appearance:none;-moz-appearance:none;appearance:none;background:none;border:0;color:inherit;margin:0;padding:0;text-decoration:none}.btn{background-color:#f6c026;border-radius:4px;color:#fff;cursor:pointer;display:inline-flex;justify-content:center;min-height:56px;padding:16px 32px;transition:color .25s cubic-bezier(.86,0,.07,1),background .25s cubic-bezier(.86,0,.07,1)}@media only screen and (min-width:1024px){.btn:hover{background-color:#1a1a1d}}.btn-inverted{background-color:#1a1a1d}@media only screen and (min-width:1024px){.btn-inverted:hover{background-color:#f6c026}}.btn-outline{background:transparent;border:2px solid #1a1a1d;color:#1a1a1d}@media only screen and (min-width:1024px){.btn-outline:hover{background-color:#1a1a1d;color:#fff}}.btn-outline.btn-inverted{border-color:#fff;color:#fff}@media only screen and (min-width:1024px){.btn-outline.btn-inverted:hover{background-color:#fff;color:#1a1a1d}}.text-black{color:#1a1a1d}.text-white{color:#fff}.text-primary{color:#f6c026}.text-gray-900{color:#323237}.text-gray-800{color:#494952}.text-gray-700{color:#61616c}.text-gray-600{color:#797986}.text-gray-500{color:#93939e}.text-gray-400{color:#adadb6}.text-gray-300{color:#c8c8cd}.text-gray-200{color:#e2e2e5}.text-gray-100{color:#fcfcfd}.text-transparent{color:transparent}.bg-black{background-color:#1a1a1d}.bg-white{background-color:#fff}.bg-primary{background-color:#f6c026}.bg-gray-900{background-color:#323237}.bg-gray-800{background-color:#494952}.bg-gray-700{background-color:#61616c}.bg-gray-600{background-color:#797986}.bg-gray-500{background-color:#93939e}.bg-gray-400{background-color:#adadb6}.bg-gray-300{background-color:#c8c8cd}.bg-gray-200{background-color:#e2e2e5}.bg-gray-100{background-color:#fcfcfd}.border-black{border-color:#1a1a1d}.border-white{border-color:#fff}.border-primary{border-color:#f6c026}.border-gray-900{border-color:#323237}.border-gray-800{border-color:#494952}.border-gray-700{border-color:#61616c}.border-gray-600{border-color:#797986}.border-gray-500{border-color:#93939e}.border-gray-400{border-color:#adadb6}.border-gray-300{border-color:#c8c8cd}.border-gray-200{border-color:#e2e2e5}.border-gray-100{border-color:#fcfcfd}ol.reset,ul.reset{list-style:none;margin:0;padding:0;text-indent:0}html{font-size:16px;line-height:1.2}body{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;color:#1a1a1d;font-family:Nunito,sans-serif}.h1,h1{font-size:4rem;font-weight:700;letter-spacing:-.03125rem;line-height:1}@media only screen and (min-width:1024px){.h1,h1{font-size:6rem;font-weight:700;letter-spacing:-.09375rem;line-height:1}}.h2,h2{font-size:3rem;font-weight:700;letter-spacing:0;line-height:1}@media only screen and (min-width:1024px){.h2,h2{font-size:4rem;font-weight:700;letter-spacing:-.03125rem;line-height:1}}.h3,h3{font-size:2rem;font-weight:700;letter-spacing:.015625rem;line-height:1}@media only screen and (min-width:1024px){.h3,h3{font-size:3rem;font-weight:700;letter-spacing:0;line-height:1}}.h4,h4{font-size:1.5rem;font-weight:700;letter-spacing:0;line-height:1}@media only screen and (min-width:1024px){.h4,h4{font-size:2rem;font-weight:700;letter-spacing:.015625rem;line-height:1}}.h5,h5{font-size:1.25rem;font-weight:700;letter-spacing:.009375rem;line-height:1}@media only screen and (min-width:1024px){.h5,h5{font-size:1.5rem;font-weight:700;letter-spacing:0;line-height:1}}.h6,h6{font-size:1rem;font-weight:700;letter-spacing:.009375rem;line-height:1}@media only screen and (min-width:1024px){.h6,h6{font-size:1.25rem;font-weight:700;letter-spacing:.009375rem;line-height:1}}.p1{font-size:1.5rem;letter-spacing:.01875rem;line-height:1.5}.p2{font-size:1.25rem}.p2,p{letter-spacing:.0125rem;line-height:1.5}p{font-size:1rem}.p3,figcaption{font-size:.875rem;letter-spacing:.025rem;line-height:1.5}.p4,small{font-size:.75rem;letter-spacing:.0375rem;line-height:1.5}.supertitle{font-size:.875rem;font-weight:500;letter-spacing:.125rem;line-height:1.5;text-transform:uppercase}h1,h2,h3,h4,h5,h6{font-family:Roboto,sans-serif}.font-paragraph{font-family:Nunito,sans-serif!important}.font-heading{font-family:Roboto,sans-serif!important}.font-mono{font-family:monospace!important}.text-thin{font-weight:100!important}.text-ultra-light{font-weight:200!important}.text-light{font-weight:300!important}.text-normal{font-weight:400!important}.text-bold{font-weight:700!important}.text-bolder{font-weight:bolder!important}.text-lighter{font-weight:lighter!important}.text-medium{font-weight:500!important}.text-semi-bold{font-weight:600!important}.text-ultra-bold{font-weight:800!important}.text-heavy{font-weight:900!important}.text-left{text-align:left}.text-right{text-align:right}.text-center{text-align:center}@media only screen and (min-width:421px){.text-sm-left{text-align:left}.text-sm-right{text-align:right}.text-sm-center{text-align:center}}@media only screen and (min-width:768px){.text-md-left{text-align:left}.text-md-right{text-align:right}.text-md-center{text-align:center}}@media only screen and (min-width:1024px){.text-lg-left{text-align:left}.text-lg-right{text-align:right}.text-lg-center{text-align:center}}@media only screen and (min-width:1366px){.text-xl-left{text-align:left}.text-xl-right{text-align:right}.text-xl-center{text-align:center}}@media only screen and (min-width:1680px){.text-xxl-left{text-align:left}.text-xxl-right{text-align:right}.text-xxl-center{text-align:center}}.text-italic{font-style:italic}.text-underline{text-decoration:underline}.text-overline{text-decoration:overline}.text-line-through{text-decoration:line-through}.text-none{text-decoration:none}@media only screen and (min-width:421px){.text-sm-underline{text-decoration:underline}.text-sm-overline{text-decoration:overline}.text-sm-line-through{text-decoration:line-through}.text-sm-none{text-decoration:none}}@media only screen and (min-width:768px){.text-md-underline{text-decoration:underline}.text-md-overline{text-decoration:overline}.text-md-line-through{text-decoration:line-through}.text-md-none{text-decoration:none}}@media only screen and (min-width:1024px){.text-lg-underline{text-decoration:underline}.text-lg-overline{text-decoration:overline}.text-lg-line-through{text-decoration:line-through}.text-lg-none{text-decoration:none}}@media only screen and (min-width:1366px){.text-xl-underline{text-decoration:underline}.text-xl-overline{text-decoration:overline}.text-xl-line-through{text-decoration:line-through}.text-xl-none{text-decoration:none}}@media only screen and (min-width:1680px){.text-xxl-underline{text-decoration:underline}.text-xxl-overline{text-decoration:overline}.text-xxl-line-through{text-decoration:line-through}.text-xxl-none{text-decoration:none}}.text-uppercase{text-transform:uppercase}.text-lowercase{text-transform:lowercase}.text-capitalize{text-transform:capitalize}.text-full-width{text-transform:full-width}@media only screen and (min-width:421px){.text-sm-uppercase{text-transform:uppercase}.text-sm-lowercase{text-transform:lowercase}.text-sm-capitalize{text-transform:capitalize}.text-sm-full-width{text-transform:full-width}}@media only screen and (min-width:768px){.text-md-uppercase{text-transform:uppercase}.text-md-lowercase{text-transform:lowercase}.text-md-capitalize{text-transform:capitalize}.text-md-full-width{text-transform:full-width}}@media only screen and (min-width:1024px){.text-lg-uppercase{text-transform:uppercase}.text-lg-lowercase{text-transform:lowercase}.text-lg-capitalize{text-transform:capitalize}.text-lg-full-width{text-transform:full-width}}@media only screen and (min-width:1366px){.text-xl-uppercase{text-transform:uppercase}.text-xl-lowercase{text-transform:lowercase}.text-xl-capitalize{text-transform:capitalize}.text-xl-full-width{text-transform:full-width}}@media only screen and (min-width:1680px){.text-xxl-uppercase{text-transform:uppercase}.text-xxl-lowercase{text-transform:lowercase}.text-xxl-capitalize{text-transform:capitalize}.text-xxl-full-width{text-transform:full-width}}h1{margin-bottom:.33em}h2{margin-bottom:.42em}h3{margin-bottom:.5em}h4{margin-bottom:.65em}h5{margin-bottom:.8em}h6{margin-bottom:1em}.text-nowrap{white-space:nowrap}*{box-sizing:border-box}.content-box{box-sizing:content-box}@media screen and (prefers-reduced-motion:no-preference){html{scroll-behavior:smooth}}[hidden]{display:none!important}.smooth-touch{-webkit-overflow-scrolling:touch}.cover{height:100%;left:0;top:0;width:100%}.absolute-center,.self-center{transform:translate3d(-50%,-50%,0)}.self-center-vertical{transform:translateY(-50%)}.self-center-horizontal{transform:translateX(-50%)}.absolute-center{left:50%;position:absolute;top:50%}.bg-cover{background-size:cover}.bg-contain,.bg-cover{background-position:50%;background-repeat:no-repeat}.bg-contain{background-size:contain}.object-contain{-o-object-fit:contain;object-fit:contain}.object-cover{-o-object-fit:cover;object-fit:cover}.hide-native-scrollbar{-ms-overflow-style:none;scrollbar-width:none}.hide-native-scrollbar::-webkit-scrollbar{display:none}.spacer{display:block;height:auto!important;visibility:hidden;width:100%!important}.events-none,.spacer{pointer-events:none}
|
|
4
4
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/js/scripts/utils.ts", "../../src/js/main.ts"],
|
|
4
|
-
"sourcesContent": ["// Sample TypeScript code rendered by ChatGPT-3\n\nexport function capitalize(str: string): string {\n return str.charAt(0).toUpperCase() + str.slice(1);\n}\n\nexport function calculateSum(numbers: number[]): number {\n return numbers.reduce((acc, num) => acc + num, 0);\n}\n\nexport function formatDate(date: Date): string {\n const year = date.getFullYear();\n const month = `${date.getMonth() + 1}`.padStart(2, '0');\n const day = `${date.getDate()}`.padStart(2, '0');\n return `${year}-${month}-${day}`;\n}\n", "import { capitalize, calculateSum, formatDate } from './scripts/utils'\n\n// Sample TypeScript code rendered by ChatGPT-3\
|
|
5
|
-
"mappings": ";;;;AAEO,WAAS,WAAW,KAAqB;AAC9C,WAAO,IAAI,OAAO,CAAC,EAAE,YAAY,IAAI,IAAI,MAAM,CAAC;AAAA,EAClD;AAEO,WAAS,aAAa,SAA2B;AACtD,WAAO,QAAQ,OAAO,CAAC,KAAK,QAAQ,MAAM,KAAK,CAAC;AAAA,EAClD;AAEO,WAAS,WAAW,MAAoB;AAC7C,UAAM,OAAO,KAAK,YAAY;AAC9B,UAAM,QAAQ,GAAG,KAAK,SAAS,IAAI,CAAC,GAAG,SAAS,GAAG,GAAG;AACtD,UAAM,MAAM,GAAG,KAAK,QAAQ,CAAC,GAAG,SAAS,GAAG,GAAG;AAC/C,WAAO,GAAG,IAAI,IAAI,KAAK,IAAI,GAAG;AAAA,EAChC;;;
|
|
4
|
+
"sourcesContent": ["// Sample TypeScript code rendered by ChatGPT-3\n\nexport function capitalize(str: string): string {\n return str.charAt(0).toUpperCase() + str.slice(1);\n}\n\nexport function calculateSum(numbers: number[]): number {\n return numbers.reduce((acc, num) => acc + num, 0);\n}\n\nexport function formatDate(date: Date): string {\n const year = date.getFullYear();\n const month = `${date.getMonth() + 1}`.padStart(2, '0');\n const day = `${date.getDate()}`.padStart(2, '0');\n return `${year}-${month}-${day}`;\n}\n", "import { capitalize, calculateSum, formatDate } from './scripts/utils'\n\n// Sample TypeScript code rendered by ChatGPT-3\nclass Person {\n private name: string;\n private age: number;\n\n constructor(name: string, age: number) {\n this.name = name;\n this.age = age;\n }\n\n greet(): void {\n console.log(`Hello, my name is ${this.name} and I am ${this.age} years old.`);\n }\n}\n\n// Creating an instance of the Person class\nconst person = new Person(\"Stamat\", new Date().getFullYear() - 1988);\n\n// Accessing properties and calling methods\nperson.greet();\n\nconsole.log(capitalize('hello')); // Output: Hello\nconsole.log(calculateSum([1, 2, 3, 4, 5])); // Output: 15\n\nconst today = new Date();\nconsole.log(formatDate(today)); // Output: YYYY-MM-DD\n"],
|
|
5
|
+
"mappings": ";;;;AAEO,WAAS,WAAW,KAAqB;AAC9C,WAAO,IAAI,OAAO,CAAC,EAAE,YAAY,IAAI,IAAI,MAAM,CAAC;AAAA,EAClD;AAEO,WAAS,aAAa,SAA2B;AACtD,WAAO,QAAQ,OAAO,CAAC,KAAK,QAAQ,MAAM,KAAK,CAAC;AAAA,EAClD;AAEO,WAAS,WAAW,MAAoB;AAC7C,UAAM,OAAO,KAAK,YAAY;AAC9B,UAAM,QAAQ,GAAG,KAAK,SAAS,IAAI,CAAC,GAAG,SAAS,GAAG,GAAG;AACtD,UAAM,MAAM,GAAG,KAAK,QAAQ,CAAC,GAAG,SAAS,GAAG,GAAG;AAC/C,WAAO,GAAG,IAAI,IAAI,KAAK,IAAI,GAAG;AAAA,EAChC;;;ACZA,MAAM,SAAN,MAAa;AAAA,IAIX,YAAY,MAAc,KAAa;AACrC,WAAK,OAAO;AACZ,WAAK,MAAM;AAAA,IACb;AAAA,IAEA,QAAc;AACZ,cAAQ,IAAI,qBAAqB,KAAK,IAAI,aAAa,KAAK,GAAG,aAAa;AAAA,IAC9E;AAAA,EACF;AAGA,MAAM,SAAS,IAAI,OAAO,WAAU,oBAAI,KAAK,GAAE,YAAY,IAAI,IAAI;AAGnE,SAAO,MAAM;AAEb,UAAQ,IAAI,WAAW,OAAO,CAAC;AAC/B,UAAQ,IAAI,aAAa,CAAC,GAAG,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC;AAEzC,MAAM,QAAQ,oBAAI,KAAK;AACvB,UAAQ,IAAI,WAAW,KAAK,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* poops v1.0.
|
|
1
|
+
/* poops v1.0.10 | https://github.com/stamat/poops | MIT License */
|
|
2
2
|
"use strict";(()=>{var e;new class{constructor(e,t){this.name=e,this.age=t}greet(){console.log(`Hello, my name is ${this.name} and I am ${this.age} years old.`)}}("Stamat",(new Date).getFullYear()-1988).greet(),console.log((e="hello").charAt(0).toUpperCase()+e.slice(1)),console.log([1,2,3,4,5].reduce(((e,t)=>e+t),0));var t,a=new Date;console.log(`${(t=a).getFullYear()}-${`${t.getMonth()+1}`.padStart(2,"0")}-${`${t.getDate()}`.padStart(2,"0")}`)})();
|
package/example/src/js/main.ts
CHANGED
package/index.html
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
<body>
|
|
18
18
|
|
|
19
19
|
<header class="mt-32 container text-center">
|
|
20
|
-
<h1><span id="poop"><img src="poop.png" alt="💩" width="160" height="160" class="d-block"></span><br>POOPS v1.0.
|
|
20
|
+
<h1><span id="poop"><img src="poop.png" alt="💩" width="160" height="160" class="d-block"></span><br>POOPS v1.0.10</h1>
|
|
21
21
|
<a href="https://www.npmjs.com/package/poops"><img src="https://img.shields.io/badge/npm-CB3837.svg?style=for-the-badge&logo=npm&logoColor=white" alt="npm"></a> <a href="https://github.com/stamat/poops"><img src="https://img.shields.io/badge/GitHub-181717.svg?style=for-the-badge&logo=GitHub&logoColor=white" alt="github"></a>
|
|
22
22
|
<p class="p2">Straightforward, no-bullshit bundler for the web.</p>
|
|
23
23
|
|
package/lib/markups.js
CHANGED
|
@@ -178,14 +178,18 @@ module.exports = class Markups {
|
|
|
178
178
|
compilePromises.push(compilePromise)
|
|
179
179
|
})
|
|
180
180
|
|
|
181
|
-
Promise
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
181
|
+
return new Promise((resolve, reject) => {
|
|
182
|
+
Promise.all(compilePromises).then(() => {
|
|
183
|
+
console.log(`${pstyle.cyanBright + pstyle.bold}[markup]${pstyle.reset} ${pstyle.dim}Compiled: ${pstyle.reset}${markupFiles.length} file${markupFiles.length > 1 ? 's' : ''} into ${pstyle.italic + pstyle.underline}${this.config.markup.out}${pstyle.reset}`)
|
|
184
|
+
resolve()
|
|
185
|
+
}).catch((err) => {
|
|
186
|
+
console.log(`${pstyle.cyanBright + pstyle.bold}[markup]${pstyle.reset} ${pstyle.redBright + pstyle.bold}[error]${pstyle.reset} ${pstyle.dim}Failed compiling${pstyle.reset + pstyle.bell}`)
|
|
187
|
+
console.log(err)
|
|
188
|
+
reject(err)
|
|
189
|
+
})
|
|
186
190
|
})
|
|
187
191
|
} else {
|
|
188
|
-
this.compileEntry(markupIn, this.pkg).then((result) => {
|
|
192
|
+
return this.compileEntry(markupIn, this.pkg).then((result) => {
|
|
189
193
|
fs.writeFileSync(path.join(process.cwd(), this.config.markup.out, path.basename(markupIn)), result)
|
|
190
194
|
console.log(`${pstyle.cyanBright + pstyle.bold}[markup]${pstyle.reset} ${pstyle.dim}Compiled:${pstyle.reset} ${pstyle.italic + pstyle.underline}${path.relative(process.cwd(), path.join(process.cwd(), this.config.markup.out, path.basename(markupIn)))}${pstyle.reset}`)
|
|
191
195
|
}).catch((err) => {
|
package/lib/scripts.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const {
|
|
1
|
+
const { buildSync } = require('esbuild')
|
|
2
2
|
const deepmerge = require('deepmerge')
|
|
3
3
|
const helpers = require('./utils/helpers.js')
|
|
4
4
|
const fs = require('node:fs')
|
|
@@ -24,18 +24,18 @@ module.exports = class Scripts {
|
|
|
24
24
|
this.banner = fillBannerTemplate(config.banner, config.pkg)
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
compile() {
|
|
27
|
+
async compile() {
|
|
28
28
|
if (!this.config.scripts) return
|
|
29
29
|
this.config.scripts = Array.isArray(this.config.scripts) ? this.config.scripts : [this.config.scripts]
|
|
30
30
|
for (const scriptEntry of this.config.scripts) {
|
|
31
31
|
if (scriptEntry.in && scriptEntry.out && pathExists(scriptEntry.in)) {
|
|
32
32
|
mkPath(scriptEntry.out)
|
|
33
|
-
this.compileEntry(scriptEntry.in, scriptEntry.out, scriptEntry.options)
|
|
33
|
+
await this.compileEntry(scriptEntry.in, scriptEntry.out, scriptEntry.options)
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
compileEntry(infilePath, outfilePath, options = {}) {
|
|
38
|
+
async compileEntry(infilePath, outfilePath, options = {}) {
|
|
39
39
|
if (!Array.isArray(infilePath)) infilePath = [infilePath]
|
|
40
40
|
|
|
41
41
|
const opts = {
|
|
@@ -82,43 +82,47 @@ module.exports = class Scripts {
|
|
|
82
82
|
delete optionsClone.minify
|
|
83
83
|
delete optionsClone.mangle
|
|
84
84
|
|
|
85
|
+
// TODO: Use my own implementation of deepmerge to reduce dependencies, and also my own deepclone
|
|
85
86
|
deepmerge(opts, optionsClone) // ability to pass other esbuild options `node_modules/esbuild/lib/main.d.ts`
|
|
86
87
|
|
|
87
88
|
// TODO: Actually loop the build process for each entry point!!!
|
|
88
89
|
const esbuildStart = performance.now()
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
fs.unlinkSync(newOutFilePath)
|
|
114
|
-
}
|
|
90
|
+
try {
|
|
91
|
+
buildSync(opts)
|
|
92
|
+
} catch (err) {
|
|
93
|
+
console.log(`${pstyle.yellowBright + pstyle.bold}[script]${pstyle.reset} ${pstyle.redBright}[error]${pstyle.reset} ${pstyle.dim}Failed compiling:${pstyle.reset} ${pstyle.italic + pstyle.underline}${outfilePath}${pstyle.reset + pstyle.bell}`)
|
|
94
|
+
console.log(err)
|
|
95
|
+
}
|
|
96
|
+
const esbuildEnd = performance.now()
|
|
97
|
+
|
|
98
|
+
for (const entry of infilePath) {
|
|
99
|
+
const newOutFilePath = buildScriptOutputFilePath(entry, outfilePath)
|
|
100
|
+
const minPath = insertMinSuffix(newOutFilePath)
|
|
101
|
+
|
|
102
|
+
if (!options.justMinified) console.log(`${pstyle.yellowBright + pstyle.bold}[script]${pstyle.reset} ${pstyle.dim}Compiled:${pstyle.reset} ${pstyle.italic + pstyle.underline}${newOutFilePath}${pstyle.reset} ${pstyle.greenBright}${fileSize(newOutFilePath)}${pstyle.reset} ${pstyle.green}(${buildTime(esbuildStart, esbuildEnd)})${pstyle.reset}`)
|
|
103
|
+
if (options.sourcemap) console.log(`${pstyle.yellowBright + pstyle.bold}[script]${pstyle.reset} ${pstyle.dim}Compiled:${pstyle.reset} ${pstyle.italic + pstyle.underline}${newOutFilePath}.map${pstyle.reset}`)
|
|
104
|
+
|
|
105
|
+
if (options.minify) {
|
|
106
|
+
// TODO: Use esbuild transformSync instead of Terser here. Make sync things great again!
|
|
107
|
+
const terserStart = performance.now()
|
|
108
|
+
const minifyResult = await Terser.minify(fs.readFileSync(newOutFilePath, 'utf-8'), terserOpts)
|
|
109
|
+
const terserEnd = performance.now()
|
|
110
|
+
|
|
111
|
+
if (minifyResult.error) {
|
|
112
|
+
console.log(`${pstyle.yellowBright + pstyle.bold}[script]${pstyle.reset} ${pstyle.redBright}[error]${pstyle.reset} ${pstyle.dim}Failed compiling:${pstyle.reset} ${pstyle.italic + pstyle.underline}${minPath}${pstyle.reset + pstyle.bell}`)
|
|
113
|
+
console.log(minifyResult.error)
|
|
115
114
|
} else {
|
|
116
|
-
|
|
115
|
+
if (this.banner) minifyResult.code = this.banner + '\n' + minifyResult.code
|
|
116
|
+
fs.writeFileSync(minPath, minifyResult.code)
|
|
117
|
+
console.log(`${pstyle.yellowBright + pstyle.bold}[script]${pstyle.reset} ${pstyle.dim}Compiled:${pstyle.reset} ${pstyle.italic + pstyle.underline}${minPath}${pstyle.reset} ${pstyle.greenBright}${fileSize(minPath)}${pstyle.reset} ${pstyle.green}(${buildTime(terserStart, terserEnd)})${pstyle.reset}`)
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
if (options.justMinified) {
|
|
121
|
+
fs.unlinkSync(newOutFilePath)
|
|
117
122
|
}
|
|
123
|
+
} else {
|
|
124
|
+
fs.unlinkSync(minPath)
|
|
118
125
|
}
|
|
119
|
-
}
|
|
120
|
-
console.log(`${pstyle.yellowBright + pstyle.bold}[script]${pstyle.reset} ${pstyle.redBright}[error]${pstyle.reset} ${pstyle.dim}Failed compiling:${pstyle.reset} ${pstyle.italic + pstyle.underline}${outfilePath}${pstyle.reset + pstyle.bell}`)
|
|
121
|
-
console.log(err)
|
|
122
|
-
})
|
|
126
|
+
}
|
|
123
127
|
}
|
|
124
128
|
}
|
package/lib/styles.js
CHANGED
|
@@ -71,18 +71,18 @@ module.exports = class Styles {
|
|
|
71
71
|
this.banner = config.banner ? fillBannerTemplate(config.banner) : null
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
compile() {
|
|
74
|
+
async compile() {
|
|
75
75
|
if (!this.config.styles) return
|
|
76
76
|
this.config.styles = Array.isArray(this.config.styles) ? this.config.styles : [this.config.styles]
|
|
77
77
|
for (const styleEntry of this.config.styles) {
|
|
78
78
|
if (styleEntry.in && styleEntry.out && pathExists(styleEntry.in)) {
|
|
79
79
|
mkPath(styleEntry.out)
|
|
80
|
-
this.compileEntry(styleEntry.in, styleEntry.out, styleEntry.options)
|
|
80
|
+
await this.compileEntry(styleEntry.in, styleEntry.out, styleEntry.options)
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
-
compileEntry(infilePath, outfilePath, options = {}) {
|
|
85
|
+
async compileEntry(infilePath, outfilePath, options = {}) {
|
|
86
86
|
const includePaths = this.config.includePaths || []
|
|
87
87
|
|
|
88
88
|
const opts = {
|
|
@@ -130,7 +130,8 @@ module.exports = class Styles {
|
|
|
130
130
|
const cssMinStart = performance.now()
|
|
131
131
|
const minPath = insertMinSuffix(outfilePath)
|
|
132
132
|
if (options.minify) {
|
|
133
|
-
postcss
|
|
133
|
+
// TODO: Consider dropping postcss in favor of esbuild.transformSync. We don't need autoprefixer, let's prefix on our own.
|
|
134
|
+
await postcss([autoprefixer, cssnano]).process(compiledSass.css, {
|
|
134
135
|
from: outfilePath,
|
|
135
136
|
to: minPath
|
|
136
137
|
}).then(result => {
|
package/package.json
CHANGED
package/poops.js
CHANGED
|
@@ -25,7 +25,7 @@ let configPath = path.join(cwd, defaultConfigPath)
|
|
|
25
25
|
if (!args.length && !pathExists(configPath)) configPath = path.join(cwd, '💩.json')
|
|
26
26
|
|
|
27
27
|
// Main function 💩
|
|
28
|
-
function poops() {
|
|
28
|
+
async function poops() {
|
|
29
29
|
const styles = new Styles(config)
|
|
30
30
|
const scripts = new Scripts(config)
|
|
31
31
|
const markups = new Markups(config)
|
|
@@ -53,9 +53,9 @@ function poops() {
|
|
|
53
53
|
lrserver.watch(cwd)
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
styles.compile()
|
|
57
|
-
scripts.compile()
|
|
58
|
-
markups.compile()
|
|
56
|
+
await styles.compile()
|
|
57
|
+
await scripts.compile()
|
|
58
|
+
await markups.compile()
|
|
59
59
|
|
|
60
60
|
if (config.watch) {
|
|
61
61
|
// TODO: think about watching the updates of the config file itself, we can reload the config and recompile everything.
|