@strifeapp/astro 1.0.16 → 1.0.17
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/index.js +33 -34
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -261,17 +261,22 @@ function storeAs(name, value) {
|
|
|
261
261
|
});
|
|
262
262
|
|
|
263
263
|
return result;
|
|
264
|
-
}`, m = "strife:store", p = "\0" + m;
|
|
265
|
-
function
|
|
266
|
-
|
|
264
|
+
}`, h = {}, m = "strife:store", p = "\0" + m;
|
|
265
|
+
function T(e) {
|
|
266
|
+
var i;
|
|
267
|
+
return console.log("[vitePluginStrifeStore] Config received:", JSON.stringify(e, null, 2)), h.get(((i = e.urls) == null ? void 0 : i[0]) || "", (t) => {
|
|
268
|
+
console.log("Test SSR fetch to RavenDB:", t.statusCode);
|
|
269
|
+
}).on("error", (t) => {
|
|
270
|
+
console.error("SSR network error to RavenDB:", t);
|
|
271
|
+
}), {
|
|
267
272
|
name: "strife:store",
|
|
268
|
-
resolveId(
|
|
269
|
-
if (
|
|
273
|
+
resolveId(t) {
|
|
274
|
+
if (t === m)
|
|
270
275
|
return p;
|
|
271
276
|
},
|
|
272
|
-
load(
|
|
273
|
-
var
|
|
274
|
-
if (
|
|
277
|
+
load(t) {
|
|
278
|
+
var r;
|
|
279
|
+
if (t === p)
|
|
275
280
|
return `
|
|
276
281
|
import { DocumentStore, AbstractJavaScriptMultiMapIndexCreationTask, IndexCreation } from "ravendb";
|
|
277
282
|
|
|
@@ -285,12 +290,6 @@ function h(e) {
|
|
|
285
290
|
console.log('[vitePluginStrifeStore] Using database:', ${l(e.database)});
|
|
286
291
|
console.log('[vitePluginStrifeStore] Certificate length:', ${e.certificate ? e.certificate.length : 0});
|
|
287
292
|
|
|
288
|
-
https.get(${l(((o = e.urls) == null ? void 0 : o[0]) || "")}, (res) => {
|
|
289
|
-
console.log('Test fetch to RavenDB:', res.statusCode);
|
|
290
|
-
}).on('error', (e) => {
|
|
291
|
-
console.error('Network error to RavenDB:', e);
|
|
292
|
-
});
|
|
293
|
-
|
|
294
293
|
const store = new DocumentStore(
|
|
295
294
|
${l(e.urls ? e.urls : [])},
|
|
296
295
|
${l(e.database || "")},
|
|
@@ -303,7 +302,7 @@ function h(e) {
|
|
|
303
302
|
|
|
304
303
|
this.additionalSources = {"Helper": ${l(y)}}
|
|
305
304
|
|
|
306
|
-
${(e.collections || ["Posts"]).map((
|
|
305
|
+
${(e.collections || ["Posts"]).map((n) => `this.map("${typeof n == "string" ? n : n.name}", (doc) => { return mapDocument(doc) });`).join(`
|
|
307
306
|
`)}
|
|
308
307
|
|
|
309
308
|
this.deploymentMode = 'Rolling';
|
|
@@ -318,8 +317,8 @@ function h(e) {
|
|
|
318
317
|
|
|
319
318
|
const bulkInsert = store.bulkInsert();
|
|
320
319
|
|
|
321
|
-
${(r = e.collections) == null ? void 0 : r.map((
|
|
322
|
-
await bulkInsert.store(${JSON.stringify(
|
|
320
|
+
${(r = e.collections) == null ? void 0 : r.map((n) => `
|
|
321
|
+
await bulkInsert.store(${JSON.stringify(n)}, 'templates/${n.name}', { '@collection': 'Templates' });
|
|
323
322
|
`).join(`
|
|
324
323
|
`)}
|
|
325
324
|
|
|
@@ -330,19 +329,19 @@ function h(e) {
|
|
|
330
329
|
}
|
|
331
330
|
};
|
|
332
331
|
}
|
|
333
|
-
const
|
|
332
|
+
const g = {
|
|
334
333
|
type: "pfx"
|
|
335
334
|
};
|
|
336
|
-
function
|
|
337
|
-
let
|
|
338
|
-
if (!
|
|
339
|
-
const
|
|
340
|
-
|
|
335
|
+
function R(e, i) {
|
|
336
|
+
let t = process.env.STRIFE_DATABASE_URLS, r = process.env.STRIFE_DATABASE, n = process.env.STRIFE_CERTIFICATE, a = process.env.STRIFE_CERTIFICATE_PASSWORD;
|
|
337
|
+
if (!t || !r || !n || !a) {
|
|
338
|
+
const o = f(e, i ?? "", "");
|
|
339
|
+
t = t || o.STRIFE_DATABASE_URLS, r = r || o.STRIFE_DATABASE, n = n || o.STRIFE_CERTIFICATE, a = a || o.STRIFE_CERTIFICATE_PASSWORD;
|
|
341
340
|
}
|
|
342
|
-
return console.log("[strifeIntegration] Loaded environment variables:"), console.log(` STRIFE_DATABASE_URLS: ${
|
|
343
|
-
urls:
|
|
341
|
+
return console.log("[strifeIntegration] Loaded environment variables:"), console.log(` STRIFE_DATABASE_URLS: ${t ? "[SET]" : "[NOT SET]"}`), console.log(` STRIFE_DATABASE: ${r || "[NOT SET]"}`), console.log(` STRIFE_CERTIFICATE: ${n ? `[SET, length=${n.length}]` : "[NOT SET]"}`), console.log(` STRIFE_CERTIFICATE_PASSWORD: ${a ? "[SET]" : "[NOT SET]"}`), {
|
|
342
|
+
urls: t ? t.split(",").map((o) => o.trim()).filter(Boolean) : void 0,
|
|
344
343
|
database: r || void 0,
|
|
345
|
-
certificate:
|
|
344
|
+
certificate: n || void 0,
|
|
346
345
|
password: a || void 0
|
|
347
346
|
};
|
|
348
347
|
}
|
|
@@ -350,11 +349,11 @@ function A(e) {
|
|
|
350
349
|
return {
|
|
351
350
|
name: "@strife/astro",
|
|
352
351
|
hooks: {
|
|
353
|
-
"astro:config:setup": ({ command: i, config:
|
|
354
|
-
const
|
|
352
|
+
"astro:config:setup": ({ command: i, config: t, updateConfig: r }) => {
|
|
353
|
+
const n = t.vite.envDir || process.cwd(), a = R(i, n);
|
|
355
354
|
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.");
|
|
356
|
-
const
|
|
357
|
-
...
|
|
355
|
+
const o = {
|
|
356
|
+
...g,
|
|
358
357
|
...Object.fromEntries(
|
|
359
358
|
Object.entries(a).filter(([s, d]) => !!d)
|
|
360
359
|
),
|
|
@@ -362,22 +361,22 @@ function A(e) {
|
|
|
362
361
|
Object.entries(e).filter(([s, d]) => !!d)
|
|
363
362
|
) : {}
|
|
364
363
|
};
|
|
365
|
-
console.log("[strifeIntegration] Final mergedOptions:", JSON.stringify(
|
|
364
|
+
console.log("[strifeIntegration] Final mergedOptions:", JSON.stringify(o, null, 2));
|
|
366
365
|
const c = ["urls", "database", "certificate", "password"], u = c.filter(
|
|
367
|
-
(s) => !
|
|
366
|
+
(s) => !o[s] || Array.isArray(o[s]) && o[s].length === 0
|
|
368
367
|
);
|
|
369
368
|
if (u.length > 0)
|
|
370
369
|
throw new Error(
|
|
371
370
|
`[strifeIntegration] Missing required environment variables: ${u.join(", ")}.
|
|
372
371
|
Set them in your .env file (for local) or Vercel project settings (for deployment).
|
|
373
372
|
Current values:
|
|
374
|
-
` + c.map((s) => ` ${s}: ${JSON.stringify(
|
|
373
|
+
` + c.map((s) => ` ${s}: ${JSON.stringify(o[s])}`).join(`
|
|
375
374
|
`)
|
|
376
375
|
);
|
|
377
376
|
r({
|
|
378
377
|
vite: {
|
|
379
378
|
plugins: [
|
|
380
|
-
|
|
379
|
+
T(o)
|
|
381
380
|
]
|
|
382
381
|
}
|
|
383
382
|
});
|