@coreframe/vite 0.2.21 → 0.2.22

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.
@@ -2,7 +2,7 @@ import { ConfigEnv, PluginOption } from "vite";
2
2
  import { ShellPlatform } from "@coreframe/lib/shell";
3
3
 
4
4
  //#region plugins/index.d.ts
5
- type CoreframeHost = "browser" | "flutter" | "tauri";
5
+ type CoreframeHost = "browser" | "flutter";
6
6
  type CoreframePlatform = ShellPlatform;
7
7
  type CoreframeRunner = "vite" | "vitest" | "react-router-prerender";
8
8
  type CoreframeConfigEnv = ConfigEnv & {
@@ -1 +1 @@
1
- function e(e,i=process.env){let a=r(i);return{...e,host:t(i,a),platform:a,runner:n(i)}}function t(e=process.env,t=r(e)){return e.TAURI_ENV_PLATFORM===void 0?t===`web`?`browser`:`flutter`:`tauri`}function n(e=process.env){return e.VITEST===`true`?`vitest`:e.IS_RR_BUILD_REQUEST===`yes`?`react-router-prerender`:`vite`}function r(e=process.env){let t=e.COREFRAME_PLATFORM??e.TAURI_ENV_PLATFORM??`web`,n=t===`darwin`?`macos`:t===`win32`?`windows`:t;if(n!==`web`&&n!==`ios`&&n!==`android`&&n!==`macos`&&n!==`windows`&&n!==`linux`)throw Error(`Unsupported Coreframe platform: ${JSON.stringify(t)}.`);return n}function i(e,t){return t.map(t=>u(e,t))}function a(e,t){return n=>e(n)?u(n,t):null}function o(e){return a(e=>e.command===`build`,e)}function s(e){return a(e=>e.command===`serve`,e)}function c(e,t){return a(t=>d(e,t.runner),t)}function l(e,t){return a(t=>!d(e,t.runner),t)}function u(e,t){return typeof t==`function`?t(e):t}function d(e,t){return(typeof e==`string`?[e]:e).includes(t)}export{a as apply,o as buildOnly,s as devOnly,l as exceptRunner,e as extendConfigEnv,t as resolveCoreframeHost,r as resolveCoreframePlatform,n as resolveCoreframeRunner,c as runnerOnly,i as selectPlugins};
1
+ function e(e,i=process.env){let a=r(i);return{...e,host:t(i,a),platform:a,runner:n(i)}}function t(e=process.env,t=r(e)){return t===`web`?`browser`:`flutter`}function n(e=process.env){return e.VITEST===`true`?`vitest`:e.IS_RR_BUILD_REQUEST===`yes`?`react-router-prerender`:`vite`}function r(e=process.env){let t=e.COREFRAME_PLATFORM??`web`,n=t===`darwin`?`macos`:t===`win32`?`windows`:t;if(n!==`web`&&n!==`ios`&&n!==`android`&&n!==`macos`&&n!==`windows`&&n!==`linux`)throw Error(`Unsupported Coreframe platform: ${JSON.stringify(t)}.`);return n}function i(e,t){return t.map(t=>u(e,t))}function a(e,t){return n=>e(n)?u(n,t):null}function o(e){return a(e=>e.command===`build`,e)}function s(e){return a(e=>e.command===`serve`,e)}function c(e,t){return a(t=>d(e,t.runner),t)}function l(e,t){return a(t=>!d(e,t.runner),t)}function u(e,t){return typeof t==`function`?t(e):t}function d(e,t){return(typeof e==`string`?[e]:e).includes(t)}export{a as apply,o as buildOnly,s as devOnly,l as exceptRunner,e as extendConfigEnv,t as resolveCoreframeHost,r as resolveCoreframePlatform,n as resolveCoreframeRunner,c as runnerOnly,i as selectPlugins};
@@ -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:`react-router`,shell:`@coreframe/lib/shell/dom`},flutter:{auth:`@coreframe/flutter-js/client`,router:`@coreframe/flutter-js/router`,shell:`@coreframe/flutter-js/composition`},tauri:{auth:`./src/api/client/tauri-auth.ts`,router:`react-router`,shell:`@coreframe/lib/shell/dom`}};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=`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:`react-router`,shell:`@coreframe/lib/shell/dom`},flutter:{auth:`@coreframe/flutter-js/client`,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};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coreframe/vite",
3
- "version": "0.2.21",
3
+ "version": "0.2.22",
4
4
  "description": "Vite plugins and build integrations for Coreframe apps",
5
5
  "repository": {
6
6
  "type": "git",
@@ -61,14 +61,14 @@
61
61
  "obug": "^2.1.3",
62
62
  "unplugin": "^2.3.11",
63
63
  "vite-plugin-hashed-favicons": "^2.1.1",
64
- "@coreframe/dashboard": "^0.3.8",
65
- "@coreframe/dev": "^0.1.11",
66
- "@coreframe/assets": "^0.1.10",
67
- "@coreframe/config": "^0.1.7",
64
+ "@coreframe/config": "^0.1.8",
65
+ "@coreframe/dashboard": "^0.3.9",
66
+ "@coreframe/assets": "^0.1.11",
67
+ "@coreframe/dev": "^0.1.12",
68
68
  "@coreframe/dev-contracts": "^0.1.5",
69
- "@coreframe/flutter-tools": "^0.1.14",
70
- "@coreframe/lib": "^0.2.9",
71
- "@coreframe/flutter-js": "^0.1.19"
69
+ "@coreframe/flutter-js": "^0.1.20",
70
+ "@coreframe/flutter-tools": "^0.1.15",
71
+ "@coreframe/lib": "^0.2.9"
72
72
  },
73
73
  "devDependencies": {
74
74
  "@tsdown/css": "0.22.3",