@absolutejs/absolute 0.2.5 → 0.3.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.
- package/dist/index.js +3 -3
- package/dist/src/core/build.d.ts +5 -1
- package/package.json +8 -5
- package/src/core/build.ts +10 -1
- package/src/plugins/networkingPlugin.ts +1 -0
- package/tailwind.config.ts +1 -4
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
var
|
|
3
|
-
`,`hydrateRoot(document, <${
|
|
4
|
-
`);return
|
|
2
|
+
var pt=60,C=1000,O=60000,It=60,mt=24,Et=86400000,x=2,h=3000;import{rm as P,mkdir as A,writeFile as tt}from"fs/promises";import{join as n,basename as ot}from"path";import{cwd as rt,exit as nt}from"process";var{$:D,build:st,Glob:v}=globalThis.Bun;import{readFile as Z,writeFile as k}from"fs/promises";var{Glob:F}=globalThis.Bun;var H=async(o,s)=>{let r=new F("*.html"),t=[];for await(let c of r.scan({cwd:s,absolute:!0}))t.push(c);for(let c of t){let a=await Z(c,"utf8");for(let[I,_]of Object.entries(o)){let N=I.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),d=new RegExp(`(<script[^>]+src=["'])(/?(?:.*\\/)?${N})(?:\\.[^."'/]+)?(\\.js)(["'][^>]*>)`,"g");a=a.replace(d,(u,i,g,m,S)=>{return`${i}${_}${S}`})}await k(c,a,"utf8")}};var Mt=async({buildDir:o="build",assetsDir:s,reactIndexDir:r,javascriptDir:t,typeScriptDir:c,reactPagesDir:a,htmlDir:I,htmxDir:_,tailwind:N})=>{let d=performance.now(),u=rt(),i=n(u,o),g=s&&n(u,s),m=r&&n(u,r),S=t&&n(u,t),b=c&&n(u,c),U=a&&n(u,a),l=I&&n(u,I),R=_&&n(u,_);await P(i,{force:!0,recursive:!0}),await A(i),U&&m&&await it(U,m);let G=m&&await y(m,"*.tsx"),J=S&&await y(S,"*.js"),K=b&&await y(b,"*.ts"),T=[...G??[],...J??[],...K??[]];if(T.length===0)return console.warn("No entry points found, skipping build"),null;let{logs:Q,outputs:V}=await st({entrypoints:T,format:"esm",naming:"[dir]/[name].[hash].[ext]",outdir:i,target:"bun"}).catch((e)=>{console.error("Build failed:",e),nt(1)});if(Q.forEach((e)=>{if(e.level==="error")console.error(e);else if(e.level==="warning")console.warn(e);else if(e.level==="info"||e.level==="debug")console.info(e)}),g&&await D`cp -R ${g} ${i}`,l)await A(n(i,"html")),await D`cp -R ${l} ${n(i)}`;if(R)await A(n(i,"htmx")),await D`cp -R ${R} ${n(i)}`;if(N)await D`tailwindcss -i ${N.input} -o ${n(i,N.output)}`;let j=V.reduce((e,B)=>{let p=B.path;if(p.startsWith(i))p=p.slice(i.length);p=p.replace(/^\/+/,"");let w=p.split("/").pop();if(!w)return e;let M=`.${B.hash}.`;if(!w.includes(M))throw new Error(`Expected hash delimiter ${M} in ${w}`);let[X]=w.split(M);return e[X]="/"+p,e},{});l&&await H(j,l);let E=performance.now()-d,f;if(E<C)f=`${E.toFixed(x)}ms`;else if(E<O)f=`${(E/C).toFixed(x)}s`;else f=`${(E/O).toFixed(x)}m`;return console.log(`Build completed in ${f}`),j},it=async(o,s)=>{await P(s,{force:!0,recursive:!0}),await A(s);let r=new v("*.*"),t=[];for await(let a of r.scan({cwd:o}))t.push(a);let c=t.map(async(a)=>{let I=ot(a),[_]=I.split("."),N=["import { hydrateRoot } from 'react-dom/client';",`import { ${_} } from '../pages/${_}';
|
|
3
|
+
`,`hydrateRoot(document, <${_} />);`].join(`
|
|
4
|
+
`);return tt(n(s,`${_}Index.tsx`),N)});await Promise.all(c)},y=async(o,s)=>{let r=[],t=new v(s);for await(let c of t.scan({absolute:!0,cwd:o}))r.push(c);return r};import{createElement as et}from"react";import{renderToReadableStream as ct}from"react-dom/server.browser";var bt=async(o,s)=>{let r=et(o),t=await ct(r,{bootstrapModules:[s]});return new Response(t,{headers:{"Content-Type":"text/html"}})},Ut=(o)=>Bun.file(o);import{argv as _t}from"process";var{env:W}=globalThis.Bun;import at from"os";var Y=()=>{let o=at.networkInterfaces(),r=Object.values(o).flat().filter((t)=>t!==void 0).find((t)=>t.family==="IPv4"&&!t.internal);if(r)return r.address;return console.warn("No IP address found, falling back to localhost"),"localhost"};var L=W.HOST??"localhost",$=W.PORT??h,q,ut=_t,z=ut.includes("--host");if(z)q=Y(),L="0.0.0.0";var qt=(o)=>o.listen({hostname:L,port:$},()=>{if(z)console.log(`Server started on http://localhost:${$}`),console.log(`Server started on network: http://${q}:${$}`);else console.log(`Server started on http://${L}:${$}`)});export{H as updateScriptTags,qt as networkingPlugin,bt as handleReactPageRequest,Ut as handleHTMLPageRequest,Y as getLocalIPAddress,Mt as build,x as TIME_PRECISION,pt as SECONDS_IN_A_MINUTE,It as MINUTES_IN_AN_HOUR,C as MILLISECONDS_IN_A_SECOND,O as MILLISECONDS_IN_A_MINUTE,Et as MILLISECONDS_IN_A_DAY,mt as HOURS_IN_A_DAY,h as DEFAULT_PORT};
|
package/dist/src/core/build.d.ts
CHANGED
|
@@ -7,6 +7,10 @@ type BuildConfig = {
|
|
|
7
7
|
reactPagesDir?: string;
|
|
8
8
|
htmlDir?: string;
|
|
9
9
|
htmxDir?: string;
|
|
10
|
+
tailwind?: {
|
|
11
|
+
input: string;
|
|
12
|
+
output: string;
|
|
13
|
+
};
|
|
10
14
|
};
|
|
11
|
-
export declare const build: ({ buildDir, assetsDir, reactIndexDir, javascriptDir, typeScriptDir, reactPagesDir, htmlDir, htmxDir }: BuildConfig) => Promise<Record<string, string> | null>;
|
|
15
|
+
export declare const build: ({ buildDir, assetsDir, reactIndexDir, javascriptDir, typeScriptDir, reactPagesDir, htmlDir, htmxDir, tailwind }: BuildConfig) => Promise<Record<string, string> | null>;
|
|
12
16
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@absolutejs/absolute",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "A fullstack meta-framework for building web applications with TypeScript",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -18,9 +18,9 @@
|
|
|
18
18
|
"release": "bun run format && bun run build && bun publish"
|
|
19
19
|
},
|
|
20
20
|
"peerDependencies": {
|
|
21
|
-
"elysia": "1.2.
|
|
22
|
-
"react": "19.1.0",
|
|
23
|
-
"react-dom": "19.1.0"
|
|
21
|
+
"elysia": ">= 1.2.0",
|
|
22
|
+
"react": ">= 19.1.0",
|
|
23
|
+
"react-dom": ">= 19.1.0"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@elysiajs/static": "1.0.2",
|
|
@@ -31,6 +31,9 @@
|
|
|
31
31
|
"typescript": "5.7.2",
|
|
32
32
|
"react": "19.1.0",
|
|
33
33
|
"svelte": "4.2.15",
|
|
34
|
-
"vue": "3.4.26"
|
|
34
|
+
"vue": "3.4.26",
|
|
35
|
+
"postcss": "8.4.49",
|
|
36
|
+
"autoprefixer": "10.4.20",
|
|
37
|
+
"tailwindcss": "3.4.17"
|
|
35
38
|
}
|
|
36
39
|
}
|
package/src/core/build.ts
CHANGED
|
@@ -18,6 +18,10 @@ type BuildConfig = {
|
|
|
18
18
|
reactPagesDir?: string;
|
|
19
19
|
htmlDir?: string;
|
|
20
20
|
htmxDir?: string;
|
|
21
|
+
tailwind?: {
|
|
22
|
+
input: string;
|
|
23
|
+
output: string;
|
|
24
|
+
};
|
|
21
25
|
};
|
|
22
26
|
|
|
23
27
|
export const build = async ({
|
|
@@ -28,7 +32,8 @@ export const build = async ({
|
|
|
28
32
|
typeScriptDir,
|
|
29
33
|
reactPagesDir,
|
|
30
34
|
htmlDir,
|
|
31
|
-
htmxDir
|
|
35
|
+
htmxDir,
|
|
36
|
+
tailwind
|
|
32
37
|
}: BuildConfig) => {
|
|
33
38
|
const start = performance.now();
|
|
34
39
|
|
|
@@ -108,6 +113,10 @@ export const build = async ({
|
|
|
108
113
|
await $`cp -R ${htmxDirAbsolute} ${join(buildDirAbsolute)}`;
|
|
109
114
|
}
|
|
110
115
|
|
|
116
|
+
if (tailwind) {
|
|
117
|
+
await $`tailwindcss -i ${tailwind.input} -o ${join(buildDirAbsolute, tailwind.output)}`;
|
|
118
|
+
}
|
|
119
|
+
|
|
111
120
|
const manifest = outputs.reduce<Record<string, string>>((acc, artifact) => {
|
|
112
121
|
let relativePath = artifact.path;
|
|
113
122
|
|
package/tailwind.config.ts
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import type { Config } from "tailwindcss";
|
|
2
|
-
import flowbite from "flowbite/plugin";
|
|
3
|
-
import tailwindForms from "@tailwindcss/forms";
|
|
4
2
|
|
|
5
3
|
const config: Config = {
|
|
6
|
-
content: ["./src/frontend/**/*.{js,ts,jsx,tsx,mdx}"]
|
|
7
|
-
plugins: [flowbite, tailwindForms]
|
|
4
|
+
content: ["./src/frontend/**/*.{js,ts,jsx,tsx,mdx}"]
|
|
8
5
|
};
|
|
9
6
|
|
|
10
7
|
export default config;
|