@strifeapp/astro 1.0.13 → 1.0.15

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 (2) hide show
  1. package/dist/index.js +45 -38
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -261,31 +261,31 @@ function storeAs(name, value) {
261
261
  });
262
262
 
263
263
  return result;
264
- }`, p = "strife:store", u = "\0" + p;
265
- function h(n) {
266
- return {
264
+ }`, m = "strife:store", p = "\0" + m;
265
+ function h(e) {
266
+ return console.log("[vitePluginStrifeStore] Config received:", JSON.stringify(e, null, 2)), {
267
267
  name: "strife:store",
268
- resolveId(a) {
269
- if (a === p)
270
- return u;
268
+ resolveId(l) {
269
+ if (l === m)
270
+ return p;
271
271
  },
272
- load(a) {
272
+ load(l) {
273
273
  var o;
274
- if (a === u)
274
+ if (l === p)
275
275
  return `
276
276
  import { DocumentStore, AbstractJavaScriptMultiMapIndexCreationTask, IndexCreation } from "ravendb";
277
277
 
278
278
  const authOptions = {
279
279
  type: 'pfx',
280
- certificate: Buffer.from(${d(n.certificate)}, 'base64'),
281
- password: ${d(n.password)},
280
+ certificate: Buffer.from(${d(e.certificate)}, 'base64'),
281
+ password: ${d(e.password)},
282
282
  };
283
283
 
284
284
  const store = new DocumentStore(
285
- ${d(n.urls ? n.urls : [])},
286
- ${d(n.database || "")},
285
+ ${d(e.urls ? e.urls : [])},
286
+ ${d(e.database || "")},
287
287
  authOptions
288
- ).initialize()
288
+ ).initialize();
289
289
 
290
290
  class Content_ByUrl extends AbstractJavaScriptMultiMapIndexCreationTask {
291
291
  constructor() {
@@ -293,7 +293,7 @@ function h(n) {
293
293
 
294
294
  this.additionalSources = {"Helper": ${d(y)}}
295
295
 
296
- ${(n.collections || ["Posts"]).map((e) => `this.map("${typeof e == "string" ? e : e.name}", (doc) => { return mapDocument(doc) });`).join(`
296
+ ${(e.collections || ["Posts"]).map((t) => `this.map("${typeof t == "string" ? t : t.name}", (doc) => { return mapDocument(doc) });`).join(`
297
297
  `)}
298
298
 
299
299
  this.deploymentMode = 'Rolling';
@@ -302,13 +302,14 @@ function h(n) {
302
302
  }
303
303
 
304
304
  console.log('Deploying index...');
305
+ console.log('[vitePluginStrifeStore] Generating virtual module code with config:', ${JSON.stringify(e, null, 2)});
305
306
 
306
307
  await IndexCreation.createIndexes([new Content_ByUrl()], store);
307
308
 
308
309
  const bulkInsert = store.bulkInsert();
309
310
 
310
- ${(o = n.collections) == null ? void 0 : o.map((e) => `
311
- await bulkInsert.store(${JSON.stringify(e)}, 'templates/${e.name}', { '@collection': 'Templates' });
311
+ ${(o = e.collections) == null ? void 0 : o.map((t) => `
312
+ await bulkInsert.store(${JSON.stringify(t)}, 'templates/${t.name}', { '@collection': 'Templates' });
312
313
  `).join(`
313
314
  `)}
314
315
 
@@ -322,45 +323,51 @@ function h(n) {
322
323
  const T = {
323
324
  type: "pfx"
324
325
  };
325
- function R(n, a) {
326
- let o = process.env.STRIFE_DATABASE_URLS, e = process.env.STRIFE_DATABASE, r = process.env.STRIFE_CERTIFICATE, s = process.env.STRIFE_CERTIFICATE_PASSWORD;
327
- if (!o || !e || !r || !s) {
328
- const t = f(n, a ?? "", "");
329
- o = o || t.STRIFE_DATABASE_URLS, e = e || t.STRIFE_DATABASE, r = r || t.STRIFE_CERTIFICATE, s = s || t.STRIFE_CERTIFICATE_PASSWORD;
326
+ function g(e, l) {
327
+ let o = process.env.STRIFE_DATABASE_URLS, t = process.env.STRIFE_DATABASE, r = process.env.STRIFE_CERTIFICATE, a = process.env.STRIFE_CERTIFICATE_PASSWORD;
328
+ if (!o || !t || !r || !a) {
329
+ const n = f(e, l ?? "", "");
330
+ o = o || n.STRIFE_DATABASE_URLS, t = t || n.STRIFE_DATABASE, r = r || n.STRIFE_CERTIFICATE, a = a || n.STRIFE_CERTIFICATE_PASSWORD;
330
331
  }
331
- return console.log("[strifeIntegration] Loaded environment variables:"), console.log(` STRIFE_DATABASE_URLS: ${o ? "[SET]" : "[NOT SET]"}`), console.log(` STRIFE_DATABASE: ${e || "[NOT SET]"}`), console.log(` STRIFE_CERTIFICATE: ${r ? `[SET, length=${r.length}]` : "[NOT SET]"}`), console.log(` STRIFE_CERTIFICATE_PASSWORD: ${s ? "[SET]" : "[NOT SET]"}`), {
332
- urls: o ? o.split(",").map((t) => t.trim()).filter(Boolean) : void 0,
333
- database: e || void 0,
332
+ return console.log("[strifeIntegration] Loaded environment variables:"), console.log(` STRIFE_DATABASE_URLS: ${o ? "[SET]" : "[NOT SET]"}`), console.log(` STRIFE_DATABASE: ${t || "[NOT SET]"}`), console.log(` STRIFE_CERTIFICATE: ${r ? `[SET, length=${r.length}]` : "[NOT SET]"}`), console.log(` STRIFE_CERTIFICATE_PASSWORD: ${a ? "[SET]" : "[NOT SET]"}`), {
333
+ urls: o ? o.split(",").map((n) => n.trim()).filter(Boolean) : void 0,
334
+ database: t || void 0,
334
335
  certificate: r || void 0,
335
- password: s || void 0
336
+ password: a || void 0
336
337
  };
337
338
  }
338
- function I(n) {
339
+ function E(e) {
339
340
  return {
340
341
  name: "@strife/astro",
341
342
  hooks: {
342
- "astro:config:setup": ({ command: a, config: o, updateConfig: e }) => {
343
- const r = o.vite.envDir || process.cwd(), s = R(a, r), t = {
343
+ "astro:config:setup": ({ command: l, config: o, updateConfig: t }) => {
344
+ const r = o.vite.envDir || process.cwd(), a = g(l, r);
345
+ console.log("[strifeIntegration] envOptions:", JSON.stringify(a, null, 2)), e ? console.log("[strifeIntegration] options passed by user:", JSON.stringify(e, null, 2)) : console.log("[strifeIntegration] No options explicitly passed.");
346
+ const n = {
344
347
  ...T,
345
348
  ...Object.fromEntries(
346
- Object.entries(s).filter(([l, m]) => !!m)
349
+ Object.entries(a).filter(([s, i]) => !!i)
347
350
  ),
348
- ...n
349
- }, i = ["urls", "database", "certificate", "password"], c = i.filter(
350
- (l) => !t[l] || Array.isArray(t[l]) && t[l].length === 0
351
+ ...e ? Object.fromEntries(
352
+ Object.entries(e).filter(([s, i]) => !!i)
353
+ ) : {}
354
+ };
355
+ console.log("[strifeIntegration] Final mergedOptions:", JSON.stringify(n, null, 2));
356
+ const c = ["urls", "database", "certificate", "password"], u = c.filter(
357
+ (s) => !n[s] || Array.isArray(n[s]) && n[s].length === 0
351
358
  );
352
- if (c.length > 0)
359
+ if (u.length > 0)
353
360
  throw new Error(
354
- `[strifeIntegration] Missing required environment variables: ${c.join(", ")}.
361
+ `[strifeIntegration] Missing required environment variables: ${u.join(", ")}.
355
362
  Set them in your .env file (for local) or Vercel project settings (for deployment).
356
363
  Current values:
357
- ` + i.map((l) => ` ${l}: ${JSON.stringify(t[l])}`).join(`
364
+ ` + c.map((s) => ` ${s}: ${JSON.stringify(n[s])}`).join(`
358
365
  `)
359
366
  );
360
- e({
367
+ t({
361
368
  vite: {
362
369
  plugins: [
363
- h(t)
370
+ h(n)
364
371
  ]
365
372
  }
366
373
  });
@@ -369,5 +376,5 @@ Current values:
369
376
  };
370
377
  }
371
378
  export {
372
- I as default
379
+ E as default
373
380
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strifeapp/astro",
3
- "version": "1.0.13",
3
+ "version": "1.0.15",
4
4
  "description": "Official Strife Astro integration",
5
5
  "keywords": [
6
6
  "astro-integration",