@strifeapp/astro 1.0.13 → 1.0.14

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 -40
  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)
275
- return `
274
+ if (l === p)
275
+ return console.log("[vitePluginStrifeStore] Generating virtual module code with config:", JSON.stringify(e, null, 2)), `
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,12 @@ function h(n) {
302
302
  }
303
303
 
304
304
  console.log('Deploying index...');
305
-
306
305
  await IndexCreation.createIndexes([new Content_ByUrl()], store);
307
306
 
308
307
  const bulkInsert = store.bulkInsert();
309
308
 
310
- ${(o = n.collections) == null ? void 0 : o.map((e) => `
311
- await bulkInsert.store(${JSON.stringify(e)}, 'templates/${e.name}', { '@collection': 'Templates' });
309
+ ${(o = e.collections) == null ? void 0 : o.map((t) => `
310
+ await bulkInsert.store(${JSON.stringify(t)}, 'templates/${t.name}', { '@collection': 'Templates' });
312
311
  `).join(`
313
312
  `)}
314
313
 
@@ -322,45 +321,51 @@ function h(n) {
322
321
  const T = {
323
322
  type: "pfx"
324
323
  };
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;
324
+ function g(e, l) {
325
+ let o = process.env.STRIFE_DATABASE_URLS, t = process.env.STRIFE_DATABASE, r = process.env.STRIFE_CERTIFICATE, a = process.env.STRIFE_CERTIFICATE_PASSWORD;
326
+ if (!o || !t || !r || !a) {
327
+ const n = f(e, l ?? "", "");
328
+ o = o || n.STRIFE_DATABASE_URLS, t = t || n.STRIFE_DATABASE, r = r || n.STRIFE_CERTIFICATE, a = a || n.STRIFE_CERTIFICATE_PASSWORD;
330
329
  }
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,
330
+ 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]"}`), {
331
+ urls: o ? o.split(",").map((n) => n.trim()).filter(Boolean) : void 0,
332
+ database: t || void 0,
334
333
  certificate: r || void 0,
335
- password: s || void 0
334
+ password: a || void 0
336
335
  };
337
336
  }
338
- function I(n) {
337
+ function E(e) {
339
338
  return {
340
339
  name: "@strife/astro",
341
340
  hooks: {
342
- "astro:config:setup": ({ command: a, config: o, updateConfig: e }) => {
343
- const r = o.vite.envDir || process.cwd(), s = R(a, r), t = {
341
+ "astro:config:setup": ({ command: l, config: o, updateConfig: t }) => {
342
+ const r = o.vite.envDir || process.cwd(), a = g(l, r);
343
+ 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.");
344
+ const n = {
344
345
  ...T,
345
346
  ...Object.fromEntries(
346
- Object.entries(s).filter(([l, m]) => !!m)
347
+ Object.entries(a).filter(([s, i]) => !!i)
347
348
  ),
348
- ...n
349
- }, i = ["urls", "database", "certificate", "password"], c = i.filter(
350
- (l) => !t[l] || Array.isArray(t[l]) && t[l].length === 0
349
+ ...e ? Object.fromEntries(
350
+ Object.entries(e).filter(([s, i]) => !!i)
351
+ ) : {}
352
+ };
353
+ console.log("[strifeIntegration] Final mergedOptions:", JSON.stringify(n, null, 2));
354
+ const c = ["urls", "database", "certificate", "password"], u = c.filter(
355
+ (s) => !n[s] || Array.isArray(n[s]) && n[s].length === 0
351
356
  );
352
- if (c.length > 0)
357
+ if (u.length > 0)
353
358
  throw new Error(
354
- `[strifeIntegration] Missing required environment variables: ${c.join(", ")}.
359
+ `[strifeIntegration] Missing required environment variables: ${u.join(", ")}.
355
360
  Set them in your .env file (for local) or Vercel project settings (for deployment).
356
361
  Current values:
357
- ` + i.map((l) => ` ${l}: ${JSON.stringify(t[l])}`).join(`
362
+ ` + c.map((s) => ` ${s}: ${JSON.stringify(n[s])}`).join(`
358
363
  `)
359
364
  );
360
- e({
365
+ t({
361
366
  vite: {
362
367
  plugins: [
363
- h(t)
368
+ h(n)
364
369
  ]
365
370
  }
366
371
  });
@@ -369,5 +374,5 @@ Current values:
369
374
  };
370
375
  }
371
376
  export {
372
- I as default
377
+ E as default
373
378
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strifeapp/astro",
3
- "version": "1.0.13",
3
+ "version": "1.0.14",
4
4
  "description": "Official Strife Astro integration",
5
5
  "keywords": [
6
6
  "astro-integration",