@picked/vite-plugin-picked 0.0.50-next.1 → 0.0.50-next.3

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/cjs/index.js CHANGED
@@ -858,4 +858,4 @@
858
858
  </html>`])),r,t)}function w(e){return e.replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;")}function S(e){return e.replaceAll("&","&amp;").replaceAll('"',"&quot;").replaceAll("<","&lt;").replaceAll(">","&gt;")}const E="picked",L="\x1B[0m";function O(){const e=process.env.NO_COLOR;return e==="1"||e==="true"}function c(e){return t=>O()?t:`${e}${t}${L}`}const x=["debug","info","warn","error","silent"],v={debug:{color:c("\x1B[2m"),log:console.debug,enabled:!1},info:{color:c("\x1B[36m"),log:console.log,enabled:!0},warn:{color:c("\x1B[33m"),log:console.warn,enabled:!0},error:{color:c("\x1B[31m"),log:console.error,enabled:!0},silent:{log:()=>{},enabled:!1}};function H(e,t){const r=new Date().toLocaleTimeString(),n=t?`${E}:${t}`:E;return`${r} [${n}] ${e}`}function g(e,t,r,n){if(!e.enabled)return;const o=H(t,n);e.log(e.color?e.color(o):o),r!==void 0&&e.log(r)}function p(e){const t=v[e],r=new Set;return Object.assign((n,o,i)=>{g(t,n,o,i)},{once(n,o,i){!t.enabled||r.has(n)||(r.add(n),g(t,n,o,i))}})}function $(e){const t=x.indexOf(e);if(t===-1){g(v.error,`invalid log level: ${e}`);return}for(const[r,n]of x.entries())v[n].enabled=r>=t}const s=c("\x1B[34m"),_=c("\x1B[36m");function C(){const e=[` ${s("_")} ${_("_")} _ _ _`,`${s("(_)")} ${_("(_)")} _ __(_)__| |_____ __| |`,` ${s("_")} ${s("_")} | '_ \\ / _| / / -_) _\` |`,`${s("(_)")} ${s("(_)")} | .__/_\\__|_\\_\\___\\__,_|`,` |_|
859
859
  `];console.log(e.join(`
860
860
  `))}const l={banner:C,debug:p("debug"),info:p("info"),warn:p("warn"),error:p("error"),setLevel:$};function Y(e){return(t,r,n)=>{if(t.method!=="GET"){n();return}const i=(t.url??"").split("?")[0];if(i!=="/"&&i!=="/index.html"){n();return}const a=e();r.setHeader("Content-Type","text/html"),r.statusCode=200,r.end(a)}}function B(e){if(e.length===0)return;const t=Math.max(4,...e.map(a=>a.name.length)),r=Math.max(2,...e.map(a=>a.id.length)),n=` ${"Name".padEnd(t)} ${"ID".padEnd(r)} Status Weight Ver`,o=` ${"─".repeat(t)} ${"─".repeat(r)} ──────── ────── ───`,i=e.map(a=>{const d=a.enabled?"\x1B[32m enabled\x1B[0m":"\x1B[2mdisabled\x1B[0m",u=`${a.weight.toString()}%`.padStart(6),f=`v${a.version.toString()}`;return` ${a.name.padEnd(t)} ${a.id.padEnd(r)} ${d} ${u} ${f}`});console.log([""," Features:","",n,o,...i,""].join(`
861
- `))}function F(e){try{const t=new URL(e).hostname;return t==="localhost"||t==="127.0.0.1"||t==="::1"}catch{return!1}}function P(e){return new Promise(t=>{setTimeout(t,e)})}async function z(e,t,r){const n=await m.fetchProject(e,t,{headers:r});if(n||!F(e))return n;for(let o=1;o<=T;o++){l.info(`local API not ready, retrying in ${(k/1e3).toString()}s (${o.toString()}/${T.toString()})`),await P(k);const i=await m.fetchProject(e,t,{headers:r});if(i)return i}return null}function N(){return"0.0.50-next.1"}const A="https://api.picked.app",j="__PICKED_PROJECT_CONFIG__",T=5,k=2e3;function G(e){const t=e.apiUrl??A;let r=[];return{name:"picked",config:async()=>{l.banner(),l.info(`fetching project config for "${e.projectId}"`),t!==A&&l.warn(`using custom API URL: ${t}`);const n=m.createClientHeaders("vite-plugin",N()),o=performance.now(),i=await z(t,e.projectId,n),a=(performance.now()-o).toFixed(0);if(!i){l.warn(`failed to fetch project config for "${e.projectId}" (${a}ms)`);return}r=i.features;const d=i.features.length,u=i.features.filter(U=>U.enabled).length,f=JSON.stringify(i).length;return l.info(`fetched ${d.toString()} features (${u.toString()} enabled) for "${e.projectId}" in ${a}ms`),B(i.features),l.debug(`config size: ${f.toString()} bytes`),{define:{[j]:JSON.stringify(i)}}},configureServer(n){if(e.disableLauncher)return;n.middlewares.use(Y(()=>b(r)));const o=n.printUrls.bind(n);n.printUrls=()=>{const i=n.resolvedUrls?.local[0];if(i){const a=i.replace(/:(?<port>\d+)\//,(d,u)=>`:\x1B[1m${u}\x1B[22m/`);console.log(` \x1B[32m➜\x1B[0m \x1B[1mPicked\x1B[22m: \x1B[36m${a}\x1B[0m`)}o()}},generateBundle(){e.disableLauncher||this.emitFile({type:"asset",fileName:"index.html",source:b(r)})}}}exports.picked=G;
861
+ `))}function F(e){try{const t=new URL(e).hostname;return t==="localhost"||t==="127.0.0.1"||t==="::1"}catch{return!1}}function P(e){return new Promise(t=>{setTimeout(t,e)})}async function z(e,t,r){const n=await m.fetchProject(e,t,{headers:r});if(n||!F(e))return n;for(let o=1;o<=T;o++){l.info(`local API not ready, retrying in ${(k/1e3).toString()}s (${o.toString()}/${T.toString()})`),await P(k);const i=await m.fetchProject(e,t,{headers:r});if(i)return i}return null}function N(){return"0.0.50-next.3"}const A="https://api.picked.app",j="__PICKED_PROJECT_CONFIG__",T=5,k=2e3;function G(e){const t=e.apiUrl??A;let r=[];return{name:"picked",config:async()=>{l.banner(),l.info(`fetching project config for "${e.projectId}"`),t!==A&&l.warn(`using custom API URL: ${t}`);const n=m.createClientHeaders("vite-plugin",N()),o=performance.now(),i=await z(t,e.projectId,n),a=(performance.now()-o).toFixed(0);if(!i){l.warn(`failed to fetch project config for "${e.projectId}" (${a}ms)`);return}r=i.features;const d=i.features.length,u=i.features.filter(U=>U.enabled).length,f=JSON.stringify(i).length;return l.info(`fetched ${d.toString()} features (${u.toString()} enabled) for "${e.projectId}" in ${a}ms`),B(i.features),l.debug(`config size: ${f.toString()} bytes`),{define:{[j]:JSON.stringify(i)}}},configureServer(n){if(e.disableLauncher)return;n.middlewares.use(Y(()=>b(r)));const o=n.printUrls.bind(n);n.printUrls=()=>{const i=n.resolvedUrls?.local[0];if(i){const a=i.replace(/:(?<port>\d+)\//,(d,u)=>`:\x1B[1m${u}\x1B[22m/`);console.log(` \x1B[32m➜\x1B[0m \x1B[1mPicked\x1B[22m: \x1B[36m${a}\x1B[0m`)}o()}},generateBundle(){e.disableLauncher||this.emitFile({type:"asset",fileName:"index.html",source:b(r)})}}}exports.picked=G;
package/dist/esm/index.js CHANGED
@@ -1010,7 +1010,7 @@ async function N(e, t, r) {
1010
1010
  return null;
1011
1011
  }
1012
1012
  function G() {
1013
- return "0.0.50-next.1";
1013
+ return "0.0.50-next.3";
1014
1014
  }
1015
1015
  const A = "https://api.picked.app", K = "__PICKED_PROJECT_CONFIG__", T = 5, k = 2e3;
1016
1016
  function q(e) {
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@picked/vite-plugin-picked",
3
3
  "description": "Vite plugin for build-time config injection",
4
- "version": "0.0.50-next.1",
4
+ "version": "0.0.50-next.3",
5
5
  "dependencies": {
6
- "@picked/client": "0.0.50-next.1"
6
+ "@picked/client": "0.0.50-next.3"
7
7
  },
8
8
  "devDependencies": {
9
9
  "@repo/eslint-config": "workspace:*",
@@ -32,7 +32,7 @@
32
32
  "knip",
33
33
  "jscpd",
34
34
  "eslint",
35
- "tsc",
35
+ "tsgo",
36
36
  "attw"
37
37
  ],
38
38
  "ignoreDependencies": [
@@ -64,7 +64,7 @@
64
64
  "test:coverage": "vitest run --coverage",
65
65
  "test:packaged-types": "attw --pack",
66
66
  "test:watch": "vitest",
67
- "type-check": "tsc -p . --noEmit"
67
+ "type-check": "tsgo -p . --noEmit"
68
68
  },
69
69
  "type": "module",
70
70
  "types": "./dist/types/index.d.ts"