@coreframe/vite 0.2.22 → 0.2.23

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.
@@ -0,0 +1,23 @@
1
+ import { Plugin } from "vite";
2
+
3
+ //#region plugins/dev-jobs.d.ts
4
+ type DevJobsResponse = {
5
+ body: string;
6
+ statusCode: number;
7
+ };
8
+ type CoreframeDevJobsPluginOptions = {
9
+ env?: NodeJS.ProcessEnv;
10
+ post?: (input: {
11
+ port: number;
12
+ secure: boolean;
13
+ token: string;
14
+ }) => Promise<DevJobsResponse>;
15
+ wait?: (milliseconds: number) => Promise<void>;
16
+ };
17
+ declare function coreframeDevJobsPlugin({
18
+ env,
19
+ post,
20
+ wait
21
+ }?: CoreframeDevJobsPluginOptions): Plugin;
22
+ //#endregion
23
+ export { CoreframeDevJobsPluginOptions, coreframeDevJobsPlugin };
@@ -0,0 +1 @@
1
+ import{request as e}from"node:http";import{request as t}from"node:https";import{devJobsEnv as n,devJobsPath as r,devJobsTokenHeader as i}from"@coreframe/dev-contracts/dev-jobs";function a({env:e=process.env,post:t=s,wait:r=c}={}){let i=e[n];return{apply:`serve`,name:`coreframe:dev-jobs`,configureServer(e){if(!i)return;let n=!1;e.httpServer?.once(`listening`,()=>{let a=e.httpServer?.address();if(!a||typeof a==`string`){e.config.logger.warn(`Coreframe dev jobs could not determine the Vite server port.`);return}o({logger:e.config.logger,port:a.port,post:t,secure:!!e.config.server.https,token:i,wait:r,isClosed:()=>n})}),e.httpServer?.once(`close`,()=>{n=!0})}}}async function o({isClosed:e,logger:t,port:n,post:r,secure:i,token:a,wait:o}){for(let s=1;s<=20;s+=1){if(e())return;try{let e=await r({port:n,secure:i,token:a});if(e.statusCode>=200&&e.statusCode<300){t.info(`Coreframe development jobs checked.`);return}if(e.statusCode!==404&&e.statusCode!==502&&e.statusCode!==503){t.warn(`Coreframe development jobs failed with HTTP ${e.statusCode}.`);return}}catch(e){if(s===20){let n=e instanceof Error?e.message:String(e);t.warn(`Coreframe development jobs could not start: ${n}`);return}}await o(250)}t.warn(`Coreframe development jobs did not become available.`)}function s({port:n,secure:a,token:o}){return new Promise((s,c)=>{let l=(a?t:e)({hostname:`127.0.0.1`,method:`POST`,path:r,port:n,...a?{rejectUnauthorized:!1}:void 0,headers:{[i]:o,"content-length":`0`}},e=>{let t=``;e.setEncoding(`utf8`),e.on(`data`,e=>{t+=e}),e.on(`end`,()=>{s({body:t,statusCode:e.statusCode??500})})});l.on(`error`,c),l.end()})}function c(e){return new Promise(t=>setTimeout(t,e))}export{a as coreframeDevJobsPlugin};
@@ -1 +1 @@
1
- import{coreframeAssetsPlugin as e}from"./assets.js";import{coreframeCodexTaskPlugin as t}from"./codex-task.js";import{coreframeDashboardPlugin as n}from"./dashboard.js";import{coreframeDevelopmentControlsPlugin as r}from"./development-controls.js";import{coreframeFaviconPlugin as i}from"./favicon.js";import{t as a}from"../icons-vb_lG-av.js";import{coreframeManagedDevPlugin as o}from"./managed-dev.js";import{coreframePreviewPlugin as s}from"./preview.js";import{coreframeStartupTimingPlugin as c}from"./startup-timing.js";import{t as l}from"../worktree-head-BZrhW1-Q.js";function u(u={}){return[c(),s(u.config??{}),e(),...a(),r(),o(),t(),l(),n(),...i(u.webManifest===void 0?void 0:{webManifest:u.webManifest})]}export{u as coreframeVitePreset};
1
+ import{coreframeAssetsPlugin as e}from"./assets.js";import{coreframeCodexTaskPlugin as t}from"./codex-task.js";import{coreframeDashboardPlugin as n}from"./dashboard.js";import{coreframeDevJobsPlugin as r}from"./dev-jobs.js";import{coreframeDevelopmentControlsPlugin as i}from"./development-controls.js";import{coreframeFaviconPlugin as a}from"./favicon.js";import{t as o}from"../icons-vb_lG-av.js";import{coreframeManagedDevPlugin as s}from"./managed-dev.js";import{coreframePreviewPlugin as c}from"./preview.js";import{coreframeStartupTimingPlugin as l}from"./startup-timing.js";import{t as u}from"../worktree-head-BZrhW1-Q.js";function d(d={}){return[l(),c(d.config??{}),e(),...o(),i(),r(),s(),t(),u(),n(),...a(d.webManifest===void 0?void 0:{webManifest:d.webManifest})]}export{d as coreframeVitePreset};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coreframe/vite",
3
- "version": "0.2.22",
3
+ "version": "0.2.23",
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/config": "^0.1.8",
65
- "@coreframe/dashboard": "^0.3.9",
66
- "@coreframe/assets": "^0.1.11",
67
- "@coreframe/dev": "^0.1.12",
68
- "@coreframe/dev-contracts": "^0.1.5",
69
- "@coreframe/flutter-js": "^0.1.20",
70
- "@coreframe/flutter-tools": "^0.1.15",
71
- "@coreframe/lib": "^0.2.9"
64
+ "@coreframe/assets": "^0.1.12",
65
+ "@coreframe/dashboard": "^0.3.10",
66
+ "@coreframe/dev": "^0.1.13",
67
+ "@coreframe/dev-contracts": "^0.1.6",
68
+ "@coreframe/flutter-js": "^0.1.21",
69
+ "@coreframe/flutter-tools": "^0.1.16",
70
+ "@coreframe/config": "^0.1.9",
71
+ "@coreframe/lib": "^0.2.10"
72
72
  },
73
73
  "devDependencies": {
74
74
  "@tsdown/css": "0.22.3",