@ufira/vibma 1.1.0 → 1.1.1

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.
Files changed (3) hide show
  1. package/dist/mcp.cjs +96 -79
  2. package/dist/mcp.js +96 -79
  3. package/package.json +1 -1
package/dist/mcp.cjs CHANGED
@@ -3058,6 +3058,89 @@ var require_fetch_npm_node = __commonJS({
3058
3058
  }
3059
3059
  });
3060
3060
 
3061
+ // ../../node_modules/pexels/dist/main.module.js
3062
+ var main_module_exports = {};
3063
+ __export(main_module_exports, {
3064
+ createClient: () => c
3065
+ });
3066
+ function r(r2, e2) {
3067
+ var n2 = { method: "GET", headers: { Accept: "application/json", "Content-Type": "application/json", "User-Agent": "Pexels/JavaScript", Authorization: r2 } }, o2 = t[e2];
3068
+ return function(t2, r3) {
3069
+ return fetch("" + o2 + t2 + "?" + (function(t3) {
3070
+ return Object.keys(t3).map(function(r4) {
3071
+ return r4 + "=" + t3[r4];
3072
+ }).join("&");
3073
+ })(r3 || {}), n2).then(function(t3) {
3074
+ if (!t3.ok) throw new Error(t3.statusText);
3075
+ return t3.json();
3076
+ });
3077
+ };
3078
+ }
3079
+ function e(t2) {
3080
+ var e2 = r(t2, "collections");
3081
+ return { all: function(t3) {
3082
+ return void 0 === t3 && (t3 = {}), e2("", t3);
3083
+ }, media: function(t3) {
3084
+ var r2 = t3.id, n2 = (function(t4, r3) {
3085
+ if (null == t4) return {};
3086
+ var e3, n3, o2 = {}, i2 = Object.keys(t4);
3087
+ for (n3 = 0; n3 < i2.length; n3++) r3.indexOf(e3 = i2[n3]) >= 0 || (o2[e3] = t4[e3]);
3088
+ return o2;
3089
+ })(t3, ["id"]);
3090
+ return e2("" + r2, n2);
3091
+ }, featured: function(t3) {
3092
+ return void 0 === t3 && (t3 = {}), e2("featured", t3);
3093
+ } };
3094
+ }
3095
+ function n(t2) {
3096
+ return !(!t2 || !t2.photos);
3097
+ }
3098
+ function i(t2) {
3099
+ var e2 = r(t2, "photo");
3100
+ return { search: function(t3) {
3101
+ return e2("/search", t3);
3102
+ }, curated: function(t3) {
3103
+ return void 0 === t3 && (t3 = {}), e2("/curated", t3);
3104
+ }, show: function(t3) {
3105
+ return e2("/photos/" + t3.id);
3106
+ }, random: function() {
3107
+ try {
3108
+ var t3 = Math.floor(1e3 * Math.random());
3109
+ return Promise.resolve(this.curated({ page: t3, per_page: 1 })).then(function(t4) {
3110
+ return n(t4) ? t4.photos[0] : t4;
3111
+ });
3112
+ } catch (t4) {
3113
+ return Promise.reject(t4);
3114
+ }
3115
+ } };
3116
+ }
3117
+ function u(t2) {
3118
+ var e2 = r(t2, "video");
3119
+ return { search: function(t3) {
3120
+ return e2("/search", t3);
3121
+ }, popular: function(t3) {
3122
+ return void 0 === t3 && (t3 = {}), e2("/popular", t3);
3123
+ }, show: function(t3) {
3124
+ return e2("/videos/" + t3.id);
3125
+ } };
3126
+ }
3127
+ function c(t2) {
3128
+ if (!t2 || "string" != typeof t2) throw new TypeError("An ApiKey must be provided when initiating the Pexel's client.");
3129
+ return { typeCheckers: o, photos: i(t2), videos: u(t2), collections: e(t2) };
3130
+ }
3131
+ var t, o;
3132
+ var init_main_module = __esm({
3133
+ "../../node_modules/pexels/dist/main.module.js"() {
3134
+ t = { photo: "https://api.pexels.com/v1/", video: "https://api.pexels.com/videos/", collections: "https://api.pexels.com/v1/collections/" };
3135
+ o = { __proto__: null, isPhotos: n, isVideos: function(t2) {
3136
+ return !(!t2 || !t2.videos);
3137
+ }, isError: function(t2) {
3138
+ return !!t2.error;
3139
+ } };
3140
+ require_fetch_npm_node();
3141
+ }
3142
+ });
3143
+
3061
3144
  // src/mcp.ts
3062
3145
  var import_mcp = require("@modelcontextprotocol/sdk/server/mcp.js");
3063
3146
  var import_stdio = require("@modelcontextprotocol/sdk/server/stdio.js");
@@ -6269,86 +6352,19 @@ async function listCollections(query, category, limit) {
6269
6352
  }
6270
6353
  }
6271
6354
 
6272
- // ../../node_modules/pexels/dist/main.module.js
6273
- var t = { photo: "https://api.pexels.com/v1/", video: "https://api.pexels.com/videos/", collections: "https://api.pexels.com/v1/collections/" };
6274
- function r(r2, e2) {
6275
- var n2 = { method: "GET", headers: { Accept: "application/json", "Content-Type": "application/json", "User-Agent": "Pexels/JavaScript", Authorization: r2 } }, o2 = t[e2];
6276
- return function(t2, r3) {
6277
- return fetch("" + o2 + t2 + "?" + (function(t3) {
6278
- return Object.keys(t3).map(function(r4) {
6279
- return r4 + "=" + t3[r4];
6280
- }).join("&");
6281
- })(r3 || {}), n2).then(function(t3) {
6282
- if (!t3.ok) throw new Error(t3.statusText);
6283
- return t3.json();
6284
- });
6285
- };
6286
- }
6287
- function e(t2) {
6288
- var e2 = r(t2, "collections");
6289
- return { all: function(t3) {
6290
- return void 0 === t3 && (t3 = {}), e2("", t3);
6291
- }, media: function(t3) {
6292
- var r2 = t3.id, n2 = (function(t4, r3) {
6293
- if (null == t4) return {};
6294
- var e3, n3, o2 = {}, i2 = Object.keys(t4);
6295
- for (n3 = 0; n3 < i2.length; n3++) r3.indexOf(e3 = i2[n3]) >= 0 || (o2[e3] = t4[e3]);
6296
- return o2;
6297
- })(t3, ["id"]);
6298
- return e2("" + r2, n2);
6299
- }, featured: function(t3) {
6300
- return void 0 === t3 && (t3 = {}), e2("featured", t3);
6301
- } };
6302
- }
6303
- function n(t2) {
6304
- return !(!t2 || !t2.photos);
6305
- }
6306
- var o = { __proto__: null, isPhotos: n, isVideos: function(t2) {
6307
- return !(!t2 || !t2.videos);
6308
- }, isError: function(t2) {
6309
- return !!t2.error;
6310
- } };
6311
- function i(t2) {
6312
- var e2 = r(t2, "photo");
6313
- return { search: function(t3) {
6314
- return e2("/search", t3);
6315
- }, curated: function(t3) {
6316
- return void 0 === t3 && (t3 = {}), e2("/curated", t3);
6317
- }, show: function(t3) {
6318
- return e2("/photos/" + t3.id);
6319
- }, random: function() {
6320
- try {
6321
- var t3 = Math.floor(1e3 * Math.random());
6322
- return Promise.resolve(this.curated({ page: t3, per_page: 1 })).then(function(t4) {
6323
- return n(t4) ? t4.photos[0] : t4;
6324
- });
6325
- } catch (t4) {
6326
- return Promise.reject(t4);
6327
- }
6328
- } };
6329
- }
6330
- function u(t2) {
6331
- var e2 = r(t2, "video");
6332
- return { search: function(t3) {
6333
- return e2("/search", t3);
6334
- }, popular: function(t3) {
6335
- return void 0 === t3 && (t3 = {}), e2("/popular", t3);
6336
- }, show: function(t3) {
6337
- return e2("/videos/" + t3.id);
6338
- } };
6339
- }
6340
- function c(t2) {
6341
- if (!t2 || "string" != typeof t2) throw new TypeError("An ApiKey must be provided when initiating the Pexel's client.");
6342
- return { typeCheckers: o, photos: i(t2), videos: u(t2), collections: e(t2) };
6343
- }
6344
- require_fetch_npm_node();
6345
-
6346
6355
  // src/tools/pexels.ts
6347
6356
  var import_promises = require("fs/promises");
6348
6357
  var import_node_path = require("path");
6349
6358
  var import_node_os = require("os");
6359
+ var _module = null;
6350
6360
  var _client = null;
6351
- function getClient() {
6361
+ function loadPexels() {
6362
+ if (!_module) {
6363
+ _module = Promise.resolve().then(() => (init_main_module(), main_module_exports));
6364
+ }
6365
+ return _module;
6366
+ }
6367
+ async function getClient() {
6352
6368
  if (_client) return _client;
6353
6369
  const key = process.env.PEXELS_API_KEY;
6354
6370
  if (!key) {
@@ -6356,7 +6372,8 @@ function getClient() {
6356
6372
  "PEXELS_API_KEY environment variable is not set. Get a free API key at https://www.pexels.com/api/new/ and set it in your environment."
6357
6373
  );
6358
6374
  }
6359
- _client = c(key);
6375
+ const { createClient } = await loadPexels();
6376
+ _client = createClient(key);
6360
6377
  return _client;
6361
6378
  }
6362
6379
  var photoCache = /* @__PURE__ */ new Map();
@@ -6375,7 +6392,7 @@ function cacheAndSlim(p) {
6375
6392
  }
6376
6393
  async function searchPhotos(params) {
6377
6394
  try {
6378
- const client = getClient();
6395
+ const client = await getClient();
6379
6396
  const res = await client.photos.search(params);
6380
6397
  if (isError(res)) return { error: res.error };
6381
6398
  const data = res;
@@ -6393,7 +6410,7 @@ async function getPhoto(id) {
6393
6410
  const cached = photoCache.get(id);
6394
6411
  if (cached) return cached;
6395
6412
  try {
6396
- const client = getClient();
6413
+ const client = await getClient();
6397
6414
  const res = await client.photos.show({ id });
6398
6415
  if (isError(res)) return { error: `Pexels photo ${id} not found: ${res.error}` };
6399
6416
  const photo = res;
@@ -6411,7 +6428,7 @@ async function resolvePexelRef(ref) {
6411
6428
  let photo = photoCache.get(id);
6412
6429
  if (!photo) {
6413
6430
  try {
6414
- const client = getClient();
6431
+ const client = await getClient();
6415
6432
  const res = await client.photos.show({ id });
6416
6433
  if (isError(res)) return { error: `Pexels photo ${id} not found: ${res.error}` };
6417
6434
  photo = res;
package/dist/mcp.js CHANGED
@@ -3064,6 +3064,89 @@ var require_fetch_npm_node = __commonJS({
3064
3064
  }
3065
3065
  });
3066
3066
 
3067
+ // ../../node_modules/pexels/dist/main.module.js
3068
+ var main_module_exports = {};
3069
+ __export(main_module_exports, {
3070
+ createClient: () => c
3071
+ });
3072
+ function r(r2, e2) {
3073
+ var n2 = { method: "GET", headers: { Accept: "application/json", "Content-Type": "application/json", "User-Agent": "Pexels/JavaScript", Authorization: r2 } }, o2 = t[e2];
3074
+ return function(t2, r3) {
3075
+ return fetch("" + o2 + t2 + "?" + (function(t3) {
3076
+ return Object.keys(t3).map(function(r4) {
3077
+ return r4 + "=" + t3[r4];
3078
+ }).join("&");
3079
+ })(r3 || {}), n2).then(function(t3) {
3080
+ if (!t3.ok) throw new Error(t3.statusText);
3081
+ return t3.json();
3082
+ });
3083
+ };
3084
+ }
3085
+ function e(t2) {
3086
+ var e2 = r(t2, "collections");
3087
+ return { all: function(t3) {
3088
+ return void 0 === t3 && (t3 = {}), e2("", t3);
3089
+ }, media: function(t3) {
3090
+ var r2 = t3.id, n2 = (function(t4, r3) {
3091
+ if (null == t4) return {};
3092
+ var e3, n3, o2 = {}, i2 = Object.keys(t4);
3093
+ for (n3 = 0; n3 < i2.length; n3++) r3.indexOf(e3 = i2[n3]) >= 0 || (o2[e3] = t4[e3]);
3094
+ return o2;
3095
+ })(t3, ["id"]);
3096
+ return e2("" + r2, n2);
3097
+ }, featured: function(t3) {
3098
+ return void 0 === t3 && (t3 = {}), e2("featured", t3);
3099
+ } };
3100
+ }
3101
+ function n(t2) {
3102
+ return !(!t2 || !t2.photos);
3103
+ }
3104
+ function i(t2) {
3105
+ var e2 = r(t2, "photo");
3106
+ return { search: function(t3) {
3107
+ return e2("/search", t3);
3108
+ }, curated: function(t3) {
3109
+ return void 0 === t3 && (t3 = {}), e2("/curated", t3);
3110
+ }, show: function(t3) {
3111
+ return e2("/photos/" + t3.id);
3112
+ }, random: function() {
3113
+ try {
3114
+ var t3 = Math.floor(1e3 * Math.random());
3115
+ return Promise.resolve(this.curated({ page: t3, per_page: 1 })).then(function(t4) {
3116
+ return n(t4) ? t4.photos[0] : t4;
3117
+ });
3118
+ } catch (t4) {
3119
+ return Promise.reject(t4);
3120
+ }
3121
+ } };
3122
+ }
3123
+ function u(t2) {
3124
+ var e2 = r(t2, "video");
3125
+ return { search: function(t3) {
3126
+ return e2("/search", t3);
3127
+ }, popular: function(t3) {
3128
+ return void 0 === t3 && (t3 = {}), e2("/popular", t3);
3129
+ }, show: function(t3) {
3130
+ return e2("/videos/" + t3.id);
3131
+ } };
3132
+ }
3133
+ function c(t2) {
3134
+ if (!t2 || "string" != typeof t2) throw new TypeError("An ApiKey must be provided when initiating the Pexel's client.");
3135
+ return { typeCheckers: o, photos: i(t2), videos: u(t2), collections: e(t2) };
3136
+ }
3137
+ var t, o;
3138
+ var init_main_module = __esm({
3139
+ "../../node_modules/pexels/dist/main.module.js"() {
3140
+ t = { photo: "https://api.pexels.com/v1/", video: "https://api.pexels.com/videos/", collections: "https://api.pexels.com/v1/collections/" };
3141
+ o = { __proto__: null, isPhotos: n, isVideos: function(t2) {
3142
+ return !(!t2 || !t2.videos);
3143
+ }, isError: function(t2) {
3144
+ return !!t2.error;
3145
+ } };
3146
+ require_fetch_npm_node();
3147
+ }
3148
+ });
3149
+
3067
3150
  // src/mcp.ts
3068
3151
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
3069
3152
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
@@ -6275,86 +6358,19 @@ async function listCollections(query, category, limit) {
6275
6358
  }
6276
6359
  }
6277
6360
 
6278
- // ../../node_modules/pexels/dist/main.module.js
6279
- var t = { photo: "https://api.pexels.com/v1/", video: "https://api.pexels.com/videos/", collections: "https://api.pexels.com/v1/collections/" };
6280
- function r(r2, e2) {
6281
- var n2 = { method: "GET", headers: { Accept: "application/json", "Content-Type": "application/json", "User-Agent": "Pexels/JavaScript", Authorization: r2 } }, o2 = t[e2];
6282
- return function(t2, r3) {
6283
- return fetch("" + o2 + t2 + "?" + (function(t3) {
6284
- return Object.keys(t3).map(function(r4) {
6285
- return r4 + "=" + t3[r4];
6286
- }).join("&");
6287
- })(r3 || {}), n2).then(function(t3) {
6288
- if (!t3.ok) throw new Error(t3.statusText);
6289
- return t3.json();
6290
- });
6291
- };
6292
- }
6293
- function e(t2) {
6294
- var e2 = r(t2, "collections");
6295
- return { all: function(t3) {
6296
- return void 0 === t3 && (t3 = {}), e2("", t3);
6297
- }, media: function(t3) {
6298
- var r2 = t3.id, n2 = (function(t4, r3) {
6299
- if (null == t4) return {};
6300
- var e3, n3, o2 = {}, i2 = Object.keys(t4);
6301
- for (n3 = 0; n3 < i2.length; n3++) r3.indexOf(e3 = i2[n3]) >= 0 || (o2[e3] = t4[e3]);
6302
- return o2;
6303
- })(t3, ["id"]);
6304
- return e2("" + r2, n2);
6305
- }, featured: function(t3) {
6306
- return void 0 === t3 && (t3 = {}), e2("featured", t3);
6307
- } };
6308
- }
6309
- function n(t2) {
6310
- return !(!t2 || !t2.photos);
6311
- }
6312
- var o = { __proto__: null, isPhotos: n, isVideos: function(t2) {
6313
- return !(!t2 || !t2.videos);
6314
- }, isError: function(t2) {
6315
- return !!t2.error;
6316
- } };
6317
- function i(t2) {
6318
- var e2 = r(t2, "photo");
6319
- return { search: function(t3) {
6320
- return e2("/search", t3);
6321
- }, curated: function(t3) {
6322
- return void 0 === t3 && (t3 = {}), e2("/curated", t3);
6323
- }, show: function(t3) {
6324
- return e2("/photos/" + t3.id);
6325
- }, random: function() {
6326
- try {
6327
- var t3 = Math.floor(1e3 * Math.random());
6328
- return Promise.resolve(this.curated({ page: t3, per_page: 1 })).then(function(t4) {
6329
- return n(t4) ? t4.photos[0] : t4;
6330
- });
6331
- } catch (t4) {
6332
- return Promise.reject(t4);
6333
- }
6334
- } };
6335
- }
6336
- function u(t2) {
6337
- var e2 = r(t2, "video");
6338
- return { search: function(t3) {
6339
- return e2("/search", t3);
6340
- }, popular: function(t3) {
6341
- return void 0 === t3 && (t3 = {}), e2("/popular", t3);
6342
- }, show: function(t3) {
6343
- return e2("/videos/" + t3.id);
6344
- } };
6345
- }
6346
- function c(t2) {
6347
- if (!t2 || "string" != typeof t2) throw new TypeError("An ApiKey must be provided when initiating the Pexel's client.");
6348
- return { typeCheckers: o, photos: i(t2), videos: u(t2), collections: e(t2) };
6349
- }
6350
- require_fetch_npm_node();
6351
-
6352
6361
  // src/tools/pexels.ts
6353
6362
  import { readFile } from "fs/promises";
6354
6363
  import { resolve, extname } from "path";
6355
6364
  import { homedir } from "os";
6365
+ var _module = null;
6356
6366
  var _client = null;
6357
- function getClient() {
6367
+ function loadPexels() {
6368
+ if (!_module) {
6369
+ _module = Promise.resolve().then(() => (init_main_module(), main_module_exports));
6370
+ }
6371
+ return _module;
6372
+ }
6373
+ async function getClient() {
6358
6374
  if (_client) return _client;
6359
6375
  const key = process.env.PEXELS_API_KEY;
6360
6376
  if (!key) {
@@ -6362,7 +6378,8 @@ function getClient() {
6362
6378
  "PEXELS_API_KEY environment variable is not set. Get a free API key at https://www.pexels.com/api/new/ and set it in your environment."
6363
6379
  );
6364
6380
  }
6365
- _client = c(key);
6381
+ const { createClient } = await loadPexels();
6382
+ _client = createClient(key);
6366
6383
  return _client;
6367
6384
  }
6368
6385
  var photoCache = /* @__PURE__ */ new Map();
@@ -6381,7 +6398,7 @@ function cacheAndSlim(p) {
6381
6398
  }
6382
6399
  async function searchPhotos(params) {
6383
6400
  try {
6384
- const client = getClient();
6401
+ const client = await getClient();
6385
6402
  const res = await client.photos.search(params);
6386
6403
  if (isError(res)) return { error: res.error };
6387
6404
  const data = res;
@@ -6399,7 +6416,7 @@ async function getPhoto(id) {
6399
6416
  const cached = photoCache.get(id);
6400
6417
  if (cached) return cached;
6401
6418
  try {
6402
- const client = getClient();
6419
+ const client = await getClient();
6403
6420
  const res = await client.photos.show({ id });
6404
6421
  if (isError(res)) return { error: `Pexels photo ${id} not found: ${res.error}` };
6405
6422
  const photo = res;
@@ -6417,7 +6434,7 @@ async function resolvePexelRef(ref) {
6417
6434
  let photo = photoCache.get(id);
6418
6435
  if (!photo) {
6419
6436
  try {
6420
- const client = getClient();
6437
+ const client = await getClient();
6421
6438
  const res = await client.photos.show({ id });
6422
6439
  if (isError(res)) return { error: `Pexels photo ${id} not found: ${res.error}` };
6423
6440
  photo = res;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ufira/vibma",
3
3
  "description": "Vibma — Vibe Design meets Figma. AI-powered MCP bridge for designing in Figma.",
4
- "version": "1.1.0",
4
+ "version": "1.1.1",
5
5
  "license": "MIT",
6
6
  "author": "ufira <https://github.com/ufira-ai>",
7
7
  "homepage": "https://github.com/ufira-ai/vibma",