@picked/vite-plugin-picked 0.0.51-next.7 → 0.0.51-next.8

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 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require
858
858
  </html>`]),o,r)}function i(e){return e.replaceAll(`&`,`&amp;`).replaceAll(`<`,`&lt;`).replaceAll(`>`,`&gt;`).replaceAll(`"`,`&quot;`)}function a(e){return e.replaceAll(`&`,`&amp;`).replaceAll(`"`,`&quot;`).replaceAll(`<`,`&lt;`).replaceAll(`>`,`&gt;`)}var o=`picked`,s=`\x1B[0m`;function c(){let e=process.env.NO_COLOR;return e===`1`||e===`true`}function l(e){return t=>c()?t:`${e}${t}${s}`}var u=[`debug`,`info`,`warn`,`error`,`silent`],d={debug:{color:l(`\x1B[2m`),log:console.debug,enabled:!1},info:{color:l(`\x1B[36m`),log:console.log,enabled:!0},warn:{color:l(`\x1B[33m`),log:console.warn,enabled:!0},error:{color:l(`\x1B[31m`),log:console.error,enabled:!0},silent:{log:()=>{},enabled:!1}};function f(e,t){return`${new Date().toLocaleTimeString()} [${t?`${o}:${t}`:o}] ${e}`}function p(e,t,n,r){if(!e.enabled)return;let i=f(t,r);e.log(e.color?e.color(i):i),n!==void 0&&e.log(n)}function m(e){let t=d[e],n=new Set;return Object.assign((e,n,r)=>{p(t,e,n,r)},{once(e,r,i){!t.enabled||n.has(e)||(n.add(e),p(t,e,r,i))}})}function h(e){let t=u.indexOf(e);if(t===-1){p(d.error,`invalid log level: ${e}`);return}for(let[e,n]of u.entries())d[n].enabled=e>=t}var g=l(`\x1B[34m`),_=l(`\x1B[36m`);function v(){let e=[` ${g(`_`)} ${_(`_`)} _ _ _`,`${g(`(_)`)} ${_(`(_)`)} _ __(_)__| |_____ __| |`,` ${g(`_`)} ${g(`_`)} | '_ \\ / _| / / -_) _\` |`,`${g(`(_)`)} ${g(`(_)`)} | .__/_\\__|_\\_\\___\\__,_|`,` |_|
859
859
  `];console.log(e.join(`
860
860
  `))}var y={banner:v,debug:m(`debug`),info:m(`info`),warn:m(`warn`),error:m(`error`),setLevel:h};function b(e){return(t,n,r)=>{if(t.method!==`GET`){r();return}let i=(t.url??``).split(`?`)[0];if(i!==`/`&&i!==`/index.html`){r();return}let a=e();n.setHeader(`Content-Type`,`text/html`),n.statusCode=200,n.end(a)}}function x(e){if(e.length===0)return;let t=Math.max(4,...e.map(e=>e.name.length)),n=Math.max(2,...e.map(e=>e.id.length)),r=` ${`Name`.padEnd(t)} ${`ID`.padEnd(n)} Status Weight Ver`,i=` ${`─`.repeat(t)} ${`─`.repeat(n)} ──────── ────── ───`,a=e.map(e=>{let r=e.enabled?`\x1B[32m enabled\x1B[0m`:`\x1B[2mdisabled\x1B[0m`,i=`${e.weight.toString()}%`.padStart(6),a=`v${e.version.toString()}`;return` ${e.name.padEnd(t)} ${e.id.padEnd(n)} ${r} ${i} ${a}`});console.log([``,` Features:`,``,r,i,...a,``].join(`
861
- `))}function S(e){try{let t=new URL(e).hostname;return t===`localhost`||t===`127.0.0.1`||t===`::1`}catch{return!1}}function C(e){return new Promise(t=>{setTimeout(t,e)})}async function w(t,n,r){let i=await(0,e.fetchProject)(t,n,{headers:r});if(i||!S(t))return i;for(let i=1;i<=O;i++){y.info(`local API not ready, retrying in ${(k/1e3).toString()}s (${i.toString()}/${O.toString()})`),await C(k);let a=await(0,e.fetchProject)(t,n,{headers:r});if(a)return a}return null}function T(){return`0.0.51-next.7`}var E=`https://api.picked.app`,D=`__PICKED_PROJECT_CONFIG__`,O=5,k=2e3;function A(t){let n=t.apiUrl??E,i=[];return{name:`picked`,config:async()=>{y.banner(),y.info(`fetching project config for "${t.projectId}"`),n!==E&&y.warn(`using custom API URL: ${n}`);let r=(0,e.createClientHeaders)(`vite-plugin`,T()),a=performance.now(),o=await w(n,t.projectId,r),s=(performance.now()-a).toFixed(0);if(!o){y.warn(`failed to fetch project config for "${t.projectId}" (${s}ms)`);return}i=o.features;let c=o.features.length,l=o.features.filter(e=>e.enabled).length,u=JSON.stringify(o).length;return y.info(`fetched ${c.toString()} features (${l.toString()} enabled) for "${t.projectId}" in ${s}ms`),x(o.features),y.debug(`config size: ${u.toString()} bytes`),{define:{[D]:JSON.stringify(o)}}},configureServer(e){if(t.disableLauncher)return;e.middlewares.use(b(()=>r(i)));let n=e.printUrls.bind(e);e.printUrls=()=>{let t=e.resolvedUrls?.local[0];if(t){let e=t.replace(/:(?<port>\d+)\//,(e,t)=>`:\x1b[1m${t}\x1b[22m/`);console.log(` \x1b[32m➜\x1b[0m \x1b[1mPicked\x1b[22m: \x1b[36m${e}\x1b[0m`)}n()}},generateBundle(){t.disableLauncher||this.emitFile({type:`asset`,fileName:`index.html`,source:r(i)})}}}exports.picked=A;
861
+ `))}function S(e){try{let t=new URL(e).hostname;return t===`localhost`||t===`127.0.0.1`||t===`::1`}catch{return!1}}function C(e){return new Promise(t=>{setTimeout(t,e)})}async function w(t,n,r){let i=await(0,e.fetchProject)(t,n,{headers:r});if(i||!S(t))return i;for(let i=1;i<=O;i++){y.info(`local API not ready, retrying in ${(k/1e3).toString()}s (${i.toString()}/${O.toString()})`),await C(k);let a=await(0,e.fetchProject)(t,n,{headers:r});if(a)return a}return null}function T(){return`0.0.51-next.8`}var E=`https://api.picked.app`,D=`__PICKED_PROJECT_CONFIG__`,O=5,k=2e3;function A(t){let n=t.apiUrl??E,i=[];return{name:`picked`,config:async()=>{y.banner(),y.info(`fetching project config for "${t.projectId}"`),n!==E&&y.warn(`using custom API URL: ${n}`);let r=(0,e.createClientHeaders)(`vite-plugin`,T()),a=performance.now(),o=await w(n,t.projectId,r),s=(performance.now()-a).toFixed(0);if(!o){y.warn(`failed to fetch project config for "${t.projectId}" (${s}ms)`);return}i=o.features;let c=o.features.length,l=o.features.filter(e=>e.enabled).length,u=JSON.stringify(o).length;return y.info(`fetched ${c.toString()} features (${l.toString()} enabled) for "${t.projectId}" in ${s}ms`),x(o.features),y.debug(`config size: ${u.toString()} bytes`),{define:{[D]:JSON.stringify(o)}}},configureServer(e){if(t.disableLauncher)return;e.middlewares.use(b(()=>r(i)));let n=e.printUrls.bind(e);e.printUrls=()=>{let t=e.resolvedUrls?.local[0];if(t){let e=t.replace(/:(?<port>\d+)\//,(e,t)=>`:\x1b[1m${t}\x1b[22m/`);console.log(` \x1b[32m➜\x1b[0m \x1b[1mPicked\x1b[22m: \x1b[36m${e}\x1b[0m`)}n()}},generateBundle(){t.disableLauncher||this.emitFile({type:`asset`,fileName:`index.html`,source:r(i)})}}}exports.picked=A;
package/dist/esm/index.js CHANGED
@@ -179,7 +179,7 @@ async function T(e, n, r) {
179
179
  return null;
180
180
  }
181
181
  function E() {
182
- return "0.0.51-next.7";
182
+ return "0.0.51-next.8";
183
183
  }
184
184
  var D = "https://api.picked.app", O = "__PICKED_PROJECT_CONFIG__", k = 5, A = 2e3;
185
185
  function j(t) {
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.51-next.7",
4
+ "version": "0.0.51-next.8",
5
5
  "dependencies": {
6
- "@picked/client": "0.0.51-next.7"
6
+ "@picked/client": "0.0.51-next.8"
7
7
  },
8
8
  "devDependencies": {
9
9
  "@repo/eslint-config": "workspace:*",