@resolid/dev 0.5.0 → 0.5.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.
|
@@ -13,7 +13,7 @@ interface VitePluginOptions {
|
|
|
13
13
|
devExclude?: (string | RegExp)[];
|
|
14
14
|
}
|
|
15
15
|
type ReactRouterConfig = Simplify<Omit<Config, "appDirectory" | "ssr" | "serverModuleFormat" | "future"> & {
|
|
16
|
-
future?: Omit<Config["future"], "v8_middleware" | "v8_splitRouteModules" | "v8_viteEnvironmentApi">;
|
|
16
|
+
future?: Omit<Config["future"], "v8_middleware" | "v8_splitRouteModules" | "v8_viteEnvironmentApi" | "v8_passThroughRequests" | "v8_trailingSlashAwareDataRequests">;
|
|
17
17
|
}>;
|
|
18
18
|
type DevConfigOptions = Simplify<Partial<VitePluginOptions> & {
|
|
19
19
|
appDirectory?: string;
|
package/dist/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as defineDevConfig, i as VitePluginOptions, n as DevConfigOptions, r as ReactRouterConfig, t as DevConfig } from "./index-
|
|
1
|
+
import { a as defineDevConfig, i as VitePluginOptions, n as DevConfigOptions, r as ReactRouterConfig, t as DevConfig } from "./index-CvMCdeds.mjs";
|
|
2
2
|
export { DevConfig, DevConfigOptions, ReactRouterConfig, VitePluginOptions, defineDevConfig };
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{cp as e,mkdir as t,readFile as n,readdir as r,realpath as i,rm as a,stat as o,symlink as s,writeFile as c}from"node:fs/promises";import{basename as l,dirname as u,join as d,relative as f}from"node:path";import p from"fast-glob";import{existsSync as m}from"node:fs";import{build as h}from"rolldown";import{esmExternalRequirePlugin as g}from"rolldown/plugins";import{searchForWorkspaceRoot as _}from"vite";var v=`@resolid/dev`,y=`0.5.
|
|
1
|
+
import{cp as e,mkdir as t,readFile as n,readdir as r,realpath as i,rm as a,stat as o,symlink as s,writeFile as c}from"node:fs/promises";import{basename as l,dirname as u,join as d,relative as f}from"node:path";import p from"fast-glob";import{existsSync as m}from"node:fs";import{build as h}from"rolldown";import{esmExternalRequirePlugin as g}from"rolldown/plugins";import{searchForWorkspaceRoot as _}from"vite";var v=`@resolid/dev`,y=`0.5.1`;async function b({includeFiles:t=[],nodeVersion:r,buildManifest:i,reactRouterConfig:o,viteConfig:s,buildStart:c,buildBundleEnd:l}){let m=s.root,{assetsDir:_}=s.build,v=JSON.parse(await n(d(m,`package.json`),`utf8`)),y=x(v.dependencies??{},s.ssr.external),b=d(o.buildDirectory,`server`),C=i?.serverBundles??{site:{id:`site`,file:f(m,d(b,o.serverBuildFile))}},w=t.length>0?await p(t,{cwd:m}):[],T=await c();await Promise.all(Object.entries(C).map(async([,t])=>{let n=t.id,i=d(m,t.file),o=u(i);await S(d(o,`package.json`),v,y,r),console.log(`Bundle file for ${n}...`);let s=d(o,`server.mjs`);await h({input:i,output:{file:s,codeSplitting:!1,minify:`dce-only`,comments:{legal:!1}},platform:`node`,transform:{define:{"process.env.NODE_ENV":JSON.stringify(`production`),"import.meta.env.NODE_ENV":JSON.stringify(`production`)},target:`node${r}`},external:[`vite`,...Object.keys(y)],plugins:[g({external:[`vite`,...Object.keys(y)],skipDuplicateCheck:!0})]}),await a(d(o,_),{force:!0,recursive:!0}),await a(i,{force:!0}),await Promise.all(w.map(t=>e(t,d(b,t),{recursive:!0}))),await l?.(T,o,n,s,y)}))}function x(e,t){let n=Array.isArray(t)?t.filter(e=>![`react-router`,`react-router-dom`,`@react-router/architect`,`@react-router/cloudflare`,`@react-router/dev`,`@react-router/express`,`@react-router/node`,`@react-router/serve`].includes(e)):t;return Object.keys(e).filter(e=>n===void 0?!1:n===!0?!0:n.includes(e)).reduce((t,n)=>(t[n]=e[n]??``,t),{})}async function S(e,t,n,r){let i={name:t.name,type:t.type,version:t.version,scripts:{postinstall:t.scripts?.postinstall??``},dependencies:n,engines:{node:`${r}.x`}};await c(e,JSON.stringify(i,null,2),`utf8`)}async function C(e,n=!1){let r=d(...e);return n&&await a(r,{recursive:!0,force:!0}),await t(r,{recursive:!0}),r}function w(e){if(e?.routeIdToServerBundleId){let t=Object.values(e.routes).filter(e=>e.id!=`root`).map(t=>{let n=[...T(e.routes,t.parentId),t.path].join(`/`);return{id:t.id,path:`/${n}`}}),n={};for(let[r,i]of Object.entries(e.routeIdToServerBundleId)){n[i]??=[];for(let e of t)e.id==r&&n[i].push(e.path)}let r={};for(let[e,t]of Object.entries(n)){t.sort((e,t)=>e.length<t.length?-1:1);for(let n of t)!r[n]&&!Object.keys(r).find(t=>r[t].bundleId==e&&n.startsWith(r[t].path))&&(r[n]={path:n,bundleId:e})}let i=Object.values(r).map(e=>({path:e.path.endsWith(`/`)?e.path.slice(0,-1):e.path,bundleId:e.bundleId}));return i.sort((e,t)=>e.path.length>t.path.length?-1:1),i}return[{path:``,bundleId:`site`}]}function T(e,t){if(t==null)return[];let n=[],r=t=>{let i=e[t];i.parentId&&r(i.parentId),i.path&&n.push(i.path)};return r(t),n}async function E(n,a,c){let p=_(n),{nodeFileTrace:h}=await import(`@vercel/nft`),g=await h([n],{base:p,cache:c}),v=Array.from(g.fileList).map(e=>d(p,e)),y=u(v[0]);for(let e of v.slice(1))for(;!e.startsWith(y);)y=u(y);return await Promise.all(v.map(async c=>{let p=d(a,f(y,c)),h=await i(c),g=h!==c,_=(await o(c)).isDirectory();if(await t(u(p),{recursive:!0}),c==n){let t=u(n),i=u(p);await Promise.all((await r(t)).filter(e=>e!==l(n)).map(n=>e(d(t,n),d(i,n),{recursive:!0})))}g?m(p)||await s(f(u(p),d(a,f(y,h))),p,_?`dir`:`file`):_||await e(c,p)})),f(y,n)}function D({nodeVersion:e,includeFiles:t}){return{name:`@resolid/react-router-hono-netlify-preset`,reactRouterConfig(){return{async buildEnd({buildManifest:n,reactRouterConfig:r,viteConfig:i}){await b({includeFiles:t,nodeVersion:e,buildManifest:n,reactRouterConfig:r,viteConfig:i,async buildStart(){let e=await C([i.root,`.netlify`,`v1`],!0);return await O(i.build.assetsDir,d(e,`config.json`)),{netlifyRoot:e,netlifyFunctionDir:await C([e,`functions`]),serverRoutes:w(n),nftCache:{}}},async buildBundleEnd(t,n,r,i){console.log(`Coping Netlify function files for ${r}...`);let a=await E(i,await C([t.netlifyFunctionDir,r],!0),t.nftCache),o=t.serverRoutes.find(e=>e.bundleId==r)?.path,s=o?[o,`${o}/*`]:`/*`;await c(d(t.netlifyFunctionDir,`${r}.mjs`),`export { default } from "./${d(r,a)}";
|
|
2
2
|
|
|
3
3
|
export const config = {
|
|
4
4
|
path: ${Array.isArray(s)?JSON.stringify(s):`"${s}"`},
|
|
@@ -7,4 +7,4 @@ export const config = {
|
|
|
7
7
|
preferStatic: true,
|
|
8
8
|
nodeVersion: ${e}
|
|
9
9
|
};
|
|
10
|
-
`,`utf8`)}})}}}}}async function O(e,t){console.log(`Writing Netlify config file...`);let n={headers:[]};n.headers.push({for:`^/${e}/.*`,values:{"Cache-Control":`public, max-age=31536000, immutable`}}),await c(t,JSON.stringify(n,null,2),`utf8`)}function k({nodeVersion:e,includeFiles:t}){return{name:`@resolid/react-router-hono-node-preset`,reactRouterConfig(){return{async buildEnd({buildManifest:n,reactRouterConfig:r,viteConfig:i}){await b({includeFiles:t,nodeVersion:e,buildManifest:n,reactRouterConfig:r,viteConfig:i,buildStart(){console.log(`Bundle Node Server for production...`)}})}}}}}function A({nodeVersion:e,includeFiles:t}){return{name:`@resolid/react-router-hono-vercel-preset`,reactRouterConfig(){return{buildEnd:async({buildManifest:n,reactRouterConfig:r,viteConfig:i})=>{await b({includeFiles:t,nodeVersion:e,buildManifest:n,reactRouterConfig:r,viteConfig:i,async buildStart(){let e=await C([i.root,`.vercel`,`output`],!0);return await j(d(r.buildDirectory,`client`),e),await M(i.build.assetsDir,n,d(e,`config.json`)),{vercelOutput:e,nftCache:{}}},async buildBundleEnd(t,n,r,i){console.log(`Coping Vercel function files for ${r}...`);let a=await C([t.vercelOutput,`functions`,`_${r}.func`],!0),o=await E(i,a,t.nftCache);await c(d(a,`.vc-config.json`),JSON.stringify({handler:o,runtime:`nodejs${e}.x`,launcherType:`Nodejs`,supportsResponseStreaming:!0},null,2),`utf8`)}})}}}}}async function j(t,n){console.log(`Copying assets...`);let r=await C([n,`static`]);await e(t,r,{recursive:!0,force:!0}),await a(d(r,`.vite`),{recursive:!0,force:!0})}async function M(e,t,n){console.log(`Writing Vercel config file...`);let r={version:3,routes:[],framework:{slug:`vite`}};r.routes.push({src:`^/${e}/.*`,headers:{"Cache-Control":`public, max-age=31536000, immutable`},continue:!0}),r.routes.push({handle:`filesystem`});let i=w(t);for(let e of i)e.path.length>0?r.routes.push({src:`^${e.path}(?:/.*)?$`,dest:`_${e.bundleId}`}):r.routes.push({src:`^/.*$`,dest:`_${e.bundleId}`});await c(n,JSON.stringify(r,null,2),`utf8`)}const N=({platform:e=`node`,nodeVersion:t=24,entryFile:n=`server.ts`,appDirectory:r=`src`,includeFiles:i=[],reactRouterConfig:a={},devExclude:o})=>{let s=(e==`netlify`?D:e==`vercel`?A:k)({nodeVersion:t,includeFiles:i}),{future:c,presets:l,...u}=a;return{vitePluginOptions:{platform:e,nodeVersion:t,entryFile:n,devExclude:o},reactRouterConfig:{...u,appDirectory:r,ssr:!0,serverModuleFormat:`esm`,presets:l?[...l,s]:[s],future:{
|
|
10
|
+
`,`utf8`)}})}}}}}async function O(e,t){console.log(`Writing Netlify config file...`);let n={headers:[]};n.headers.push({for:`^/${e}/.*`,values:{"Cache-Control":`public, max-age=31536000, immutable`}}),await c(t,JSON.stringify(n,null,2),`utf8`)}function k({nodeVersion:e,includeFiles:t}){return{name:`@resolid/react-router-hono-node-preset`,reactRouterConfig(){return{async buildEnd({buildManifest:n,reactRouterConfig:r,viteConfig:i}){await b({includeFiles:t,nodeVersion:e,buildManifest:n,reactRouterConfig:r,viteConfig:i,buildStart(){console.log(`Bundle Node Server for production...`)}})}}}}}function A({nodeVersion:e,includeFiles:t}){return{name:`@resolid/react-router-hono-vercel-preset`,reactRouterConfig(){return{buildEnd:async({buildManifest:n,reactRouterConfig:r,viteConfig:i})=>{await b({includeFiles:t,nodeVersion:e,buildManifest:n,reactRouterConfig:r,viteConfig:i,async buildStart(){let e=await C([i.root,`.vercel`,`output`],!0);return await j(d(r.buildDirectory,`client`),e),await M(i.build.assetsDir,n,d(e,`config.json`)),{vercelOutput:e,nftCache:{}}},async buildBundleEnd(t,n,r,i){console.log(`Coping Vercel function files for ${r}...`);let a=await C([t.vercelOutput,`functions`,`_${r}.func`],!0),o=await E(i,a,t.nftCache);await c(d(a,`.vc-config.json`),JSON.stringify({handler:o,runtime:`nodejs${e}.x`,launcherType:`Nodejs`,supportsResponseStreaming:!0},null,2),`utf8`)}})}}}}}async function j(t,n){console.log(`Copying assets...`);let r=await C([n,`static`]);await e(t,r,{recursive:!0,force:!0}),await a(d(r,`.vite`),{recursive:!0,force:!0})}async function M(e,t,n){console.log(`Writing Vercel config file...`);let r={version:3,routes:[],framework:{slug:`vite`}};r.routes.push({src:`^/${e}/.*`,headers:{"Cache-Control":`public, max-age=31536000, immutable`},continue:!0}),r.routes.push({handle:`filesystem`});let i=w(t);for(let e of i)e.path.length>0?r.routes.push({src:`^${e.path}(?:/.*)?$`,dest:`_${e.bundleId}`}):r.routes.push({src:`^/.*$`,dest:`_${e.bundleId}`});await c(n,JSON.stringify(r,null,2),`utf8`)}const N=({platform:e=`node`,nodeVersion:t=24,entryFile:n=`server.ts`,appDirectory:r=`src`,includeFiles:i=[],reactRouterConfig:a={},devExclude:o})=>{let s=(e==`netlify`?D:e==`vercel`?A:k)({nodeVersion:t,includeFiles:i}),{future:c,presets:l,...u}=a;return{vitePluginOptions:{platform:e,nodeVersion:t,entryFile:n,devExclude:o},reactRouterConfig:{...u,appDirectory:r,ssr:!0,serverModuleFormat:`esm`,presets:l?[...l,s]:[s],future:{v8_middleware:!0,v8_splitRouteModules:!0,v8_viteEnvironmentApi:!0,v8_passThroughRequests:!0,v8_trailingSlashAwareDataRequests:!0,...c}}}};export{N as defineDevConfig};
|
package/dist/vite.d.mts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@resolid/dev",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Development utils for Resolid applications",
|
|
6
6
|
"keywords": [
|
|
@@ -60,31 +60,31 @@
|
|
|
60
60
|
"provenance": true
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
|
-
"@hono/node-server": "^2.0.
|
|
64
|
-
"@resolid/utils": "^1.
|
|
65
|
-
"@vercel/nft": "^1.
|
|
63
|
+
"@hono/node-server": "^2.0.4",
|
|
64
|
+
"@resolid/utils": "^1.5.0",
|
|
65
|
+
"@vercel/nft": "^1.10.2",
|
|
66
66
|
"fast-glob": "^3.3.3",
|
|
67
|
-
"hono": "^4.12.
|
|
67
|
+
"hono": "^4.12.23",
|
|
68
68
|
"minimatch": "^10.2.5",
|
|
69
|
-
"rolldown": "
|
|
69
|
+
"rolldown": "^1.0.3"
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
|
-
"@react-router/dev": "^7.
|
|
73
|
-
"@types/react": "^19.2.
|
|
72
|
+
"@react-router/dev": "^7.16.0",
|
|
73
|
+
"@types/react": "^19.2.16",
|
|
74
74
|
"@types/react-dom": "^19.2.3",
|
|
75
|
-
"react": "^19.2.
|
|
76
|
-
"react-dom": "^19.2.
|
|
77
|
-
"tsdown": "^0.
|
|
75
|
+
"react": "^19.2.7",
|
|
76
|
+
"react-dom": "^19.2.7",
|
|
77
|
+
"tsdown": "^0.22.1"
|
|
78
78
|
},
|
|
79
79
|
"peerDependencies": {
|
|
80
80
|
"@netlify/types": "^2.6.0",
|
|
81
|
-
"@react-router/dev": "^7.
|
|
82
|
-
"@react-router/node": "^7.
|
|
81
|
+
"@react-router/dev": "^7.16.0",
|
|
82
|
+
"@react-router/node": "^7.16.0",
|
|
83
83
|
"isbot": "^5.1.40",
|
|
84
|
-
"react": "^19.2.
|
|
85
|
-
"react-dom": "^19.2.
|
|
86
|
-
"react-router": "^7.
|
|
87
|
-
"vite": "^8.0.
|
|
84
|
+
"react": "^19.2.7",
|
|
85
|
+
"react-dom": "^19.2.7",
|
|
86
|
+
"react-router": "^7.16.0",
|
|
87
|
+
"vite": "^8.0.16"
|
|
88
88
|
},
|
|
89
89
|
"engines": {
|
|
90
90
|
"node": "^22.13.0 || >=24"
|