@strifeapp/astro 1.0.15 → 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 +49 -40
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { loadEnv as f } from "vite";
|
|
2
|
-
import
|
|
2
|
+
import l from "serialize-javascript";
|
|
3
3
|
const y = `/**
|
|
4
4
|
* Creates an indexed item that will be stored in the index.
|
|
5
5
|
* @param {string} name - Name of property to index
|
|
@@ -261,29 +261,38 @@ 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
|
|
|
278
283
|
const authOptions = {
|
|
279
284
|
type: 'pfx',
|
|
280
|
-
certificate: Buffer.from(${
|
|
281
|
-
password: ${
|
|
285
|
+
certificate: Buffer.from(${l(e.certificate)}, 'base64'),
|
|
286
|
+
password: ${l(e.password)},
|
|
282
287
|
};
|
|
283
288
|
|
|
289
|
+
console.log('[vitePluginStrifeStore] Will attempt to connect to URLs:', ${l(e.urls)});
|
|
290
|
+
console.log('[vitePluginStrifeStore] Using database:', ${l(e.database)});
|
|
291
|
+
console.log('[vitePluginStrifeStore] Certificate length:', ${e.certificate ? e.certificate.length : 0});
|
|
292
|
+
|
|
284
293
|
const store = new DocumentStore(
|
|
285
|
-
${
|
|
286
|
-
${
|
|
294
|
+
${l(e.urls ? e.urls : [])},
|
|
295
|
+
${l(e.database || "")},
|
|
287
296
|
authOptions
|
|
288
297
|
).initialize();
|
|
289
298
|
|
|
@@ -291,9 +300,9 @@ function h(e) {
|
|
|
291
300
|
constructor() {
|
|
292
301
|
super();
|
|
293
302
|
|
|
294
|
-
this.additionalSources = {"Helper": ${
|
|
303
|
+
this.additionalSources = {"Helper": ${l(y)}}
|
|
295
304
|
|
|
296
|
-
${(e.collections || ["Posts"]).map((
|
|
305
|
+
${(e.collections || ["Posts"]).map((n) => `this.map("${typeof n == "string" ? n : n.name}", (doc) => { return mapDocument(doc) });`).join(`
|
|
297
306
|
`)}
|
|
298
307
|
|
|
299
308
|
this.deploymentMode = 'Rolling';
|
|
@@ -308,8 +317,8 @@ function h(e) {
|
|
|
308
317
|
|
|
309
318
|
const bulkInsert = store.bulkInsert();
|
|
310
319
|
|
|
311
|
-
${(
|
|
312
|
-
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' });
|
|
313
322
|
`).join(`
|
|
314
323
|
`)}
|
|
315
324
|
|
|
@@ -320,54 +329,54 @@ function h(e) {
|
|
|
320
329
|
}
|
|
321
330
|
};
|
|
322
331
|
}
|
|
323
|
-
const
|
|
332
|
+
const g = {
|
|
324
333
|
type: "pfx"
|
|
325
334
|
};
|
|
326
|
-
function
|
|
327
|
-
let
|
|
328
|
-
if (!
|
|
329
|
-
const
|
|
330
|
-
|
|
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;
|
|
331
340
|
}
|
|
332
|
-
return console.log("[strifeIntegration] Loaded environment variables:"), console.log(` STRIFE_DATABASE_URLS: ${
|
|
333
|
-
urls:
|
|
334
|
-
database:
|
|
335
|
-
certificate:
|
|
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,
|
|
343
|
+
database: r || void 0,
|
|
344
|
+
certificate: n || void 0,
|
|
336
345
|
password: a || void 0
|
|
337
346
|
};
|
|
338
347
|
}
|
|
339
|
-
function
|
|
348
|
+
function A(e) {
|
|
340
349
|
return {
|
|
341
350
|
name: "@strife/astro",
|
|
342
351
|
hooks: {
|
|
343
|
-
"astro:config:setup": ({ command:
|
|
344
|
-
const
|
|
352
|
+
"astro:config:setup": ({ command: i, config: t, updateConfig: r }) => {
|
|
353
|
+
const n = t.vite.envDir || process.cwd(), a = R(i, n);
|
|
345
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.");
|
|
346
|
-
const
|
|
347
|
-
...
|
|
355
|
+
const o = {
|
|
356
|
+
...g,
|
|
348
357
|
...Object.fromEntries(
|
|
349
|
-
Object.entries(a).filter(([s,
|
|
358
|
+
Object.entries(a).filter(([s, d]) => !!d)
|
|
350
359
|
),
|
|
351
360
|
...e ? Object.fromEntries(
|
|
352
|
-
Object.entries(e).filter(([s,
|
|
361
|
+
Object.entries(e).filter(([s, d]) => !!d)
|
|
353
362
|
) : {}
|
|
354
363
|
};
|
|
355
|
-
console.log("[strifeIntegration] Final mergedOptions:", JSON.stringify(
|
|
364
|
+
console.log("[strifeIntegration] Final mergedOptions:", JSON.stringify(o, null, 2));
|
|
356
365
|
const c = ["urls", "database", "certificate", "password"], u = c.filter(
|
|
357
|
-
(s) => !
|
|
366
|
+
(s) => !o[s] || Array.isArray(o[s]) && o[s].length === 0
|
|
358
367
|
);
|
|
359
368
|
if (u.length > 0)
|
|
360
369
|
throw new Error(
|
|
361
370
|
`[strifeIntegration] Missing required environment variables: ${u.join(", ")}.
|
|
362
371
|
Set them in your .env file (for local) or Vercel project settings (for deployment).
|
|
363
372
|
Current values:
|
|
364
|
-
` + c.map((s) => ` ${s}: ${JSON.stringify(
|
|
373
|
+
` + c.map((s) => ` ${s}: ${JSON.stringify(o[s])}`).join(`
|
|
365
374
|
`)
|
|
366
375
|
);
|
|
367
|
-
|
|
376
|
+
r({
|
|
368
377
|
vite: {
|
|
369
378
|
plugins: [
|
|
370
|
-
|
|
379
|
+
T(o)
|
|
371
380
|
]
|
|
372
381
|
}
|
|
373
382
|
});
|
|
@@ -376,5 +385,5 @@ Current values:
|
|
|
376
385
|
};
|
|
377
386
|
}
|
|
378
387
|
export {
|
|
379
|
-
|
|
388
|
+
A as default
|
|
380
389
|
};
|