@coreframe/vite 0.2.28 → 0.2.29

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/client.d.ts CHANGED
@@ -10,31 +10,3 @@ interface ImportMetaEnv {
10
10
  interface ImportMeta {
11
11
  readonly env: ImportMetaEnv
12
12
  }
13
-
14
- declare module "virtual:coreframe-shell" {
15
- export const shell: import("@coreframe/lib/shell").CoreframeShell
16
- export const DocumentScrollLock: typeof import("@coreframe/lib/document-scroll-lock").DocumentScrollLock
17
- export const ShellHost: (props: Record<string, never>) => import("react").ReactNode
18
- export const NativeRouteLink: (
19
- props: import("@coreframe/lib/shell").NativeRouteLinkProps,
20
- ) => import("react").ReactNode
21
- export type NativeSurfaceProps<SurfaceId extends string = string> =
22
- import("@coreframe/flutter-js/composition").NativeSurfaceProps<SurfaceId>
23
- export const NativeSurface: (
24
- props: import("@coreframe/flutter-js/composition").NativeSurfacePropsForRegistry,
25
- ) => import("react").ReactNode
26
- export function configureShellClient(): void
27
- }
28
-
29
- declare module "virtual:coreframe-shell/auth" {
30
- export function createAuthenticatedFetch(
31
- options: import("@coreframe/lib/auth-transport").AuthenticatedFetchOptions,
32
- ): import("@coreframe/lib/auth-transport").AuthenticatedFetch
33
- export function createAuthClient(
34
- options: import("@coreframe/lib/auth-transport").AuthClientOptions,
35
- ): import("@coreframe/lib/auth-transport").AuthClient
36
- }
37
-
38
- declare module "virtual:coreframe-router" {
39
- export * from "@coreframe/flutter-js/router"
40
- }
@@ -1,4 +1,4 @@
1
- import{existsSync as e}from"node:fs";import{readFile as t}from"node:fs/promises";import{dirname as n,isAbsolute as r,resolve as i}from"node:path";import{readProjectConfig as a}from"@coreframe/config";import{composeDashboardManifest as o,composeDashboardPluginTarget as s,discoverDashboardPages as c,renderDashboardPluginTargetModule as l,resolveDashboardModuleReference as u,resolveDashboardRouteModules as d}from"@coreframe/dashboard/build";import{createDashboardRequestHandler as f}from"@coreframe/dashboard/server";import{createServer as p,loadConfigFromFile as m,normalizePath as h}from"vite";const g=`/__dashboard`,_=`virtual:coreframe-dashboard-worker-plugins`,v=`\0${_}`,y=`virtual:coreframe-dashboard-manifest`,b=`\0${y}`,x=`virtual:coreframe-dashboard-routes`,S=`\0${x}`,C=`virtual:coreframe-dashboard-document`,w=`\0${C}`,T=`virtual:coreframe-dashboard-styles`,E=`\0${T}`;function D({dashboardConfig:e=`dashboard/dashboard.config.ts`,dashboardOrigin:t=process.env.COREFRAME_DASHBOARD_ORIGIN??`http://127.0.0.1:5174`,env:r=process.env,projectRoot:a=process.cwd()}={}){let o,c,u=()=>c??=M(a,e,o);return{name:`coreframe:dashboard`,async config(e,n){return o=n,{define:{__COREFRAME_DASHBOARD_BUILD__:JSON.stringify(await L(a,r))},server:{proxy:{[g]:{target:t}}}}},resolveId(e){if(e===_)return v},async load(e){if(e===v)return l(s(await u(),`deployed`))},configureServer(e){return()=>{let t=e.printUrls.bind(e);e.printUrls=()=>{t();let n=e.resolvedUrls?.local[0];n&&e.config.logger.info(` ➜ Dashboard: ${new URL(g,n)}`)}}},configurePreviewServer:{order:`pre`,async handler(t){let r=await p({appType:`custom`,configFile:!1,envFile:!1,logLevel:`silent`,mode:t.config.mode,resolve:{alias:t.config.resolve.alias,dedupe:t.config.resolve.dedupe,tsconfigPaths:t.config.resolve.tsconfigPaths},root:a,server:{hmr:!1,middlewareMode:!0,watch:null}}),o;try{let s=await F(r.ssrLoadModule.bind(r),await u(),n(N(a,e))),c=t.config.environments.client.build.outDir;o=f({clientDist:i(t.config.root,c,g.slice(1)),plugins:s,projectRoot:a})}catch(e){throw await r.close(),e}t.middlewares.use(async(e,t,n)=>{if(!e.url||!P(e.url)){n();return}await o.handle(e,t)});let s,c=()=>s??=Promise.all([o.dispose(),r.close()]).then(()=>void 0),l=t.close.bind(t);return t.close=async()=>{await Promise.all([c(),l()])},t.httpServer.once(`close`,()=>{c()}),()=>{let e=t.printUrls.bind(t);t.printUrls=()=>{e();let n=t.resolvedUrls?.local[0];n&&t.config.logger.info(` ➜ Dashboard: ${new URL(g,n)}`)}}}}}}function O({dashboardDirectory:e=process.cwd(),environment:t=process.env.DEPLOY_ENV?`deployed`:`local`,projectRoot:n=i(e,`..`)}={}){let r,a,s,l=i(e,`dashboard.config.ts`),u=()=>a??=M(n,l,r);return{name:`coreframe:dashboard-app`,config(e,t){return r=t,{ssr:{noExternal:[`@coreframe/dashboard`]}}},resolveId(e){if(e===y)return b;if(e===x)return S;if(e===C)return w;if(e===T)return E},async load(r){if(r===E)return A(e);if(r===w)return k((await u()).document,e,n);if(r!==b&&r!==S)return;let[i,a]=await Promise.all([u(),c({dashboardDirectory:e})]),s=o(i,a,{environment:t});if(r===S){let t=d(s,{dashboardDirectory:e,projectRoot:n});return`export const dashboardRoutePages = ${JSON.stringify(t)}\n`}return`export const dashboardManifest = ${JSON.stringify(s)}\n`},async configureServer(t){s=f({plugins:await F(t.ssrLoadModule.bind(t),await u(),e),projectRoot:n}),t.middlewares.use(async(e,t,n)=>{if(!e.url||!e.url.startsWith(`${g}/api/plugins/`)){n();return}await s.handle(e,t)}),t.httpServer?.once(`close`,()=>{s?.dispose()})}}}function k(e,t,n){if(!e)return[`export const Layout = undefined`,`export const links = undefined`,`export const meta = undefined`,`export default undefined`,``].join(`
1
+ import{existsSync as e}from"node:fs";import{readFile as t}from"node:fs/promises";import{dirname as n,isAbsolute as r,resolve as i}from"node:path";import{readProjectConfig as a}from"@coreframe/config";import{composeDashboardManifest as o,composeDashboardPluginTarget as s,discoverDashboardPages as c,renderDashboardPluginTargetModule as l,resolveDashboardModuleReference as u,resolveDashboardRouteModules as d}from"@coreframe/dashboard/build";import{createDashboardRequestHandler as f}from"@coreframe/dashboard/server";import{createServer as p,loadConfigFromFile as m,normalizePath as h}from"vite";const g=`/__dashboard`,_=`virtual:coreframe-internal/dashboard/worker-plugins`,v=`\0${_}`,y=`virtual:coreframe-internal/dashboard/manifest`,b=`\0${y}`,x=`virtual:coreframe-internal/dashboard/routes`,S=`\0${x}`,C=`virtual:coreframe-internal/dashboard/document`,w=`\0${C}`,T=`virtual:coreframe-internal/dashboard/styles`,E=`\0${T}`;function D({dashboardConfig:e=`dashboard/dashboard.config.ts`,dashboardOrigin:t=process.env.COREFRAME_DASHBOARD_ORIGIN??`http://127.0.0.1:5174`,env:r=process.env,projectRoot:a=process.cwd()}={}){let o,c,u=()=>c??=M(a,e,o);return{name:`coreframe:dashboard`,async config(e,n){return o=n,{define:{__COREFRAME_DASHBOARD_BUILD__:JSON.stringify(await L(a,r))},server:{proxy:{[g]:{target:t}}}}},resolveId(e){if(e===_)return v},async load(e){if(e===v)return l(s(await u(),`deployed`))},configureServer(e){return()=>{let t=e.printUrls.bind(e);e.printUrls=()=>{t();let n=e.resolvedUrls?.local[0];n&&e.config.logger.info(` ➜ Dashboard: ${new URL(g,n)}`)}}},configurePreviewServer:{order:`pre`,async handler(t){let r=await p({appType:`custom`,configFile:!1,envFile:!1,logLevel:`silent`,mode:t.config.mode,resolve:{alias:t.config.resolve.alias,dedupe:t.config.resolve.dedupe,tsconfigPaths:t.config.resolve.tsconfigPaths},root:a,server:{hmr:!1,middlewareMode:!0,watch:null}}),o;try{let s=await F(r.ssrLoadModule.bind(r),await u(),n(N(a,e))),c=t.config.environments.client.build.outDir;o=f({clientDist:i(t.config.root,c,g.slice(1)),plugins:s,projectRoot:a})}catch(e){throw await r.close(),e}t.middlewares.use(async(e,t,n)=>{if(!e.url||!P(e.url)){n();return}await o.handle(e,t)});let s,c=()=>s??=Promise.all([o.dispose(),r.close()]).then(()=>void 0),l=t.close.bind(t);return t.close=async()=>{await Promise.all([c(),l()])},t.httpServer.once(`close`,()=>{c()}),()=>{let e=t.printUrls.bind(t);t.printUrls=()=>{e();let n=t.resolvedUrls?.local[0];n&&t.config.logger.info(` ➜ Dashboard: ${new URL(g,n)}`)}}}}}}function O({dashboardDirectory:e=process.cwd(),environment:t=process.env.DEPLOY_ENV?`deployed`:`local`,projectRoot:n=i(e,`..`)}={}){let r,a,s,l=i(e,`dashboard.config.ts`),u=()=>a??=M(n,l,r);return{name:`coreframe:dashboard-app`,config(e,t){return r=t,{ssr:{noExternal:[`@coreframe/dashboard`]}}},resolveId(e){if(e===y)return b;if(e===x)return S;if(e===C)return w;if(e===T)return E},async load(r){if(r===E)return A(e);if(r===w)return k((await u()).document,e,n);if(r!==b&&r!==S)return;let[i,a]=await Promise.all([u(),c({dashboardDirectory:e})]),s=o(i,a,{environment:t});if(r===S){let t=d(s,{dashboardDirectory:e,projectRoot:n});return`export const dashboardRoutePages = ${JSON.stringify(t)}\n`}return`export const dashboardManifest = ${JSON.stringify(s)}\n`},async configureServer(t){s=f({plugins:await F(t.ssrLoadModule.bind(t),await u(),e),projectRoot:n}),t.middlewares.use(async(e,t,n)=>{if(!e.url||!e.url.startsWith(`${g}/api/plugins/`)){n();return}await s.handle(e,t)}),t.httpServer?.once(`close`,()=>{s?.dispose()})}}}function k(e,t,n){if(!e)return[`export const Layout = undefined`,`export const links = undefined`,`export const meta = undefined`,`export default undefined`,``].join(`
2
2
  `);let r=j(u(e,{dashboardDirectory:t,projectRoot:n}));return[`import * as document from ${JSON.stringify(r)}`,`export const Layout = document.Layout`,`export const links = document.links`,`export const meta = document.meta`,`export default document.default`,``].join(`
3
3
  `)}function A(t){let n=[`import ${JSON.stringify(`@coreframe/dashboard/shell.css`)}`];for(let r of[`styles.css`,`styled-system/styles.css`]){let a=i(t,r);e(a)&&n.push(`import ${JSON.stringify(j(a))}`)}return`${n.join(`
4
4
  `)}\n`}function j(e){return`/@fs/${h(e)}`}async function M(e,t,n){let r=N(e,t),i=await m(n,r,e,void 0,void 0,`runner`);if(!i)throw Error(`Could not load dashboard configuration at ${r}.`);return i.config}function N(e,t){return r(t)?t:i(e,t)}function P(e){let[t]=e.split(`?`,1);return t===g||t.startsWith(`${g}/`)}async function F(e,t,n){let r=s(t,`local`);return Promise.all(r.map(async t=>{let[r,i]=await Promise.all([e(I(t.apiModule,n)),e(I(t.implementationModule,n))]);return{api:r.api,createImplementation:i.createImplementation}}))}function I(e,t){return e.startsWith(`.`)?`/@fs/${h(i(n(i(t,`dashboard.config.ts`)),e))}`:e}async function L(e,n){let[r,o]=await Promise.all([t(i(e,`package.json`),`utf8`),a({cwd:e})]),s=JSON.parse(r),c=Object.entries(o.worker?.environment??{}).flatMap(([e,t])=>t.kind===`generated`?[]:[{description:t.description,kind:t.kind,name:e,requiredIn:t.requiredIn??[]}]);return{applicationName:s.name??`Coreframe application`,applicationVersion:s.version,commit:n.GITHUB_SHA,configuration:c,coreframeVersion:s.engines?.coreframe,deployUrls:{production:o.deploy?.environments?.production?.url,staging:o.deploy?.environments?.staging?.url}}}export{O as coreframeDashboardAppPlugin,D as coreframeDashboardPlugin};
@@ -1 +1 @@
1
- import{resolveCoreframeHost as e,resolveCoreframePlatform as t}from"./index.js";import{realpathSync as n}from"node:fs";import{extname as r,isAbsolute as i,relative as a,resolve as o,sep as s}from"node:path";import{parseSync as c}from"vite";const l=`virtual:coreframe-shell`,u=`\0${l}`,d=`virtual:coreframe-shell/composition`,f=`virtual:coreframe-shell/auth`,p=`\0${f}`,m=`virtual:coreframe-shell/auth-composition`,h=`virtual:coreframe-router`,g=`\0${h}`,_=`virtual:coreframe-router/composition`,v={browser:{auth:`@coreframe/lib/auth-transport/browser`,router:`@coreframe/lib/router`,shell:`@coreframe/lib/shell/dom`},flutter:{auth:`@coreframe/lib/auth-transport/browser`,router:`@coreframe/flutter-js/router`,shell:`@coreframe/flutter-js/composition`}};function y(){let n=t(),r=n===`ios`||n===`android`?n:void 0,i=e(process.env,n),a=v[i],s=b(a.shell),y=process.cwd();return{name:`coreframe:shell`,enforce:`pre`,config(){return{define:{"import.meta.env.MOBILE_PLATFORM":r===void 0?`undefined`:JSON.stringify(r),"import.meta.env.PLATFORM":JSON.stringify(n)},ssr:{noExternal:[s]}}},configResolved(e){y=e.root},transform(e,t){let n=x(t);if(i!==`flutter`||!w(t,y)||n===void 0)return;let{module:r}=c(t,e,{lang:n});(r.staticImports.some(({moduleRequest:e})=>e.value===`react-router`)||r.staticExports.some(({entries:e})=>e.some(({moduleRequest:e})=>e?.value===`react-router`))||r.dynamicImports.some(({moduleRequest:t})=>S(e.slice(t.start,t.end))))&&C()},resolveId(e){if(e===l)return u;if(e===f)return p;if(e===h)return g;if(e===d)return this.resolve(a.shell,o(y,`vite.config.ts`),{skipSelf:!0});if(e===m)return this.resolve(a.auth,o(y,`vite.config.ts`),{skipSelf:!0});if(e===_)return this.resolve(a.router,o(y,`vite.config.ts`),{skipSelf:!0});if(e===`virtual:coreframe-flutter/application`)return this.resolve(o(y,`src/web/app/flutter-shell/application.ts`),void 0,{skipSelf:!0});if(e===`virtual:coreframe-flutter/native-bridge`)return this.resolve(o(y,`src/web/app/flutter-shell/generated/native-bridge.ts`),void 0,{skipSelf:!0});if(e===`virtual:coreframe-flutter/native-pages`)return this.resolve(o(y,`src/web/app/flutter-shell/generated/native-pages.ts`),void 0,{skipSelf:!0});if(e===`virtual:coreframe-flutter/native-surfaces`)return this.resolve(o(y,`src/web/app/flutter-shell/generated/native-surfaces.ts`),void 0,{skipSelf:!0})},load(e){if(e===u)return`export * from ${JSON.stringify(d)};`;if(e===p)return`export { createAuthenticatedFetch, createAuthClient } from ${JSON.stringify(m)};`;if(e===g)return`export * from ${JSON.stringify(_)};`}}}function b(e){let t=e.split(`/`);return e.startsWith(`@`)?t.slice(0,2).join(`/`):t[0]}function x(e){let t=r(e.split(`?`,1)[0]);if(t===`.jsx`)return`jsx`;if(t===`.ts`||t===`.mts`||t===`.cts`)return`ts`;if(t===`.tsx`)return`tsx`;if(t===`.js`||t===`.mjs`||t===`.cjs`)return`js`}function S(e){return e===`"react-router"`||e===`'react-router'`||e==="`react-router`"}function C(){throw Error(`Flutter application modules must import React Router APIs from ${JSON.stringify(h)}; direct ${JSON.stringify(`react-router`)} imports bypass the native navigation contract. Importing ${JSON.stringify(`react-router/dom`)} remains supported.`)}function w(e,t){let r=e.split(`?`,1)[0];if(!i(r))return!1;let o=a(n(t),n(r)),c=o.split(s);return o!==``&&o!==`..`&&!o.startsWith(`..${s}`)&&!i(o)&&!c.includes(`node_modules`)&&c[0]!==`.react-router`}export{y as coreframeShellPlugin};
1
+ import{resolveCoreframeHost as e,resolveCoreframePlatform as t}from"./index.js";import{realpathSync as n}from"node:fs";import{extname as r,isAbsolute as i,relative as a,resolve as o,sep as s}from"node:path";import{parseSync as c}from"vite";const l={browser:{router:`@coreframe/lib/router`,shell:`@coreframe/lib/shell/dom`},flutter:{router:`@coreframe/flutter-js/router`,shell:`@coreframe/flutter-js/composition`}};function u(){let n=t(),r=n===`ios`||n===`android`?n:void 0,i=e(process.env,n),a=l[i],s=d(a.shell),u=process.cwd();return{name:`coreframe:shell`,enforce:`pre`,config(){return{define:{"import.meta.env.MOBILE_PLATFORM":r===void 0?`undefined`:JSON.stringify(r),"import.meta.env.PLATFORM":JSON.stringify(n)},resolve:{dedupe:[`react`,`react-dom`,`react-router`]},ssr:{noExternal:[`@coreframe/app`,s]}}},configResolved(e){u=e.root},transform(e,t){let n=f(t);if(!_(t,u)||n===void 0)return;let{module:r}=c(t,e,{lang:n});(r.staticImports.some(({moduleRequest:e})=>m(e.value))||r.staticExports.some(({entries:e})=>e.some(({moduleRequest:e})=>m(e?.value)))||r.dynamicImports.some(({moduleRequest:t})=>m(e.slice(t.start,t.end))))&&h(),i===`flutter`&&(r.staticImports.some(({moduleRequest:e})=>e.value===`react-router`)||r.staticExports.some(({entries:e})=>e.some(({moduleRequest:e})=>e?.value===`react-router`))||r.dynamicImports.some(({moduleRequest:t})=>p(e.slice(t.start,t.end))))&&g()},resolveId(e){if(e===`virtual:coreframe-internal/shell`)return this.resolve(a.shell,o(u,`vite.config.ts`),{skipSelf:!0});if(e===`virtual:coreframe-internal/router`)return this.resolve(a.router,o(u,`vite.config.ts`),{skipSelf:!0});if(e===`virtual:coreframe-internal/flutter/application`)return this.resolve(o(u,`src/web/app/flutter-shell/application.ts`),void 0,{skipSelf:!0});if(e===`virtual:coreframe-internal/flutter/native-bridge`)return this.resolve(o(u,`src/web/app/flutter-shell/generated/native-bridge.ts`),void 0,{skipSelf:!0});if(e===`virtual:coreframe-internal/flutter/native-pages`)return this.resolve(o(u,`src/web/app/flutter-shell/generated/native-pages.ts`),void 0,{skipSelf:!0});if(e===`virtual:coreframe-internal/flutter/native-surfaces`)return this.resolve(o(u,`src/web/app/flutter-shell/generated/native-surfaces.ts`),void 0,{skipSelf:!0})}}}function d(e){let t=e.split(`/`);return e.startsWith(`@`)?t.slice(0,2).join(`/`):t[0]}function f(e){let t=r(e.split(`?`,1)[0]);if(t===`.jsx`)return`jsx`;if(t===`.ts`||t===`.mts`||t===`.cts`)return`ts`;if(t===`.tsx`)return`tsx`;if(t===`.js`||t===`.mjs`||t===`.cjs`)return`js`}function p(e){return e===`"react-router"`||e===`'react-router'`||e==="`react-router`"}function m(e){return e!==void 0&&/^["'`]?virtual:coreframe/u.test(e)}function h(){throw Error(`Application modules must import Coreframe runtime APIs from "@coreframe/app" package entry points; "virtual:coreframe*" modules are framework-internal.`)}function g(){throw Error(`Flutter application modules must import React Router APIs from ${JSON.stringify(`@coreframe/app/router`)}; direct ${JSON.stringify(`react-router`)} imports bypass the native navigation contract. Importing ${JSON.stringify(`react-router/dom`)} remains supported.`)}function _(e,t){let r=e.split(`?`,1)[0];if(!i(r))return!1;let o=a(n(t),n(r)),c=o.split(s);return o!==``&&o!==`..`&&!o.startsWith(`..${s}`)&&!i(o)&&!c.includes(`node_modules`)&&c[0]!==`.react-router`}export{u as coreframeShellPlugin};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coreframe/vite",
3
- "version": "0.2.28",
3
+ "version": "0.2.29",
4
4
  "description": "Vite plugins and build integrations for Coreframe apps",
5
5
  "repository": {
6
6
  "type": "git",
@@ -59,12 +59,12 @@
59
59
  "vite-plugin-hashed-favicons": "^2.1.1",
60
60
  "@coreframe/config": "^0.1.11",
61
61
  "@coreframe/assets": "^0.1.14",
62
- "@coreframe/dashboard": "^0.3.13",
63
- "@coreframe/dev": "^0.1.18",
62
+ "@coreframe/dashboard": "^0.3.14",
64
63
  "@coreframe/dev-contracts": "^0.1.8",
65
- "@coreframe/flutter-js": "^0.1.25",
66
- "@coreframe/flutter-tools": "^0.1.20",
67
- "@coreframe/lib": "^0.2.13"
64
+ "@coreframe/flutter-js": "^0.1.26",
65
+ "@coreframe/flutter-tools": "^0.1.21",
66
+ "@coreframe/lib": "^0.2.14",
67
+ "@coreframe/dev": "^0.1.18"
68
68
  },
69
69
  "devDependencies": {
70
70
  "@tsdown/css": "0.22.3",