@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.
- package/dist/index.js +45 -38
- 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
|
-
}`,
|
|
265
|
-
function h(
|
|
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(
|
|
269
|
-
if (
|
|
270
|
-
return
|
|
268
|
+
resolveId(l) {
|
|
269
|
+
if (l === m)
|
|
270
|
+
return p;
|
|
271
271
|
},
|
|
272
|
-
load(
|
|
272
|
+
load(l) {
|
|
273
273
|
var o;
|
|
274
|
-
if (
|
|
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(
|
|
281
|
-
password: ${d(
|
|
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(
|
|
286
|
-
${d(
|
|
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
|
-
${(
|
|
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 =
|
|
311
|
-
await bulkInsert.store(${JSON.stringify(
|
|
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
|
|
326
|
-
let o = process.env.STRIFE_DATABASE_URLS,
|
|
327
|
-
if (!o || !
|
|
328
|
-
const
|
|
329
|
-
o = o ||
|
|
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: ${
|
|
332
|
-
urls: o ? o.split(",").map((
|
|
333
|
-
database:
|
|
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:
|
|
336
|
+
password: a || void 0
|
|
336
337
|
};
|
|
337
338
|
}
|
|
338
|
-
function
|
|
339
|
+
function E(e) {
|
|
339
340
|
return {
|
|
340
341
|
name: "@strife/astro",
|
|
341
342
|
hooks: {
|
|
342
|
-
"astro:config:setup": ({ command:
|
|
343
|
-
const r = o.vite.envDir || process.cwd(),
|
|
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(
|
|
349
|
+
Object.entries(a).filter(([s, i]) => !!i)
|
|
347
350
|
),
|
|
348
|
-
...
|
|
349
|
-
|
|
350
|
-
|
|
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 (
|
|
359
|
+
if (u.length > 0)
|
|
353
360
|
throw new Error(
|
|
354
|
-
`[strifeIntegration] Missing required environment variables: ${
|
|
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
|
-
` +
|
|
364
|
+
` + c.map((s) => ` ${s}: ${JSON.stringify(n[s])}`).join(`
|
|
358
365
|
`)
|
|
359
366
|
);
|
|
360
|
-
|
|
367
|
+
t({
|
|
361
368
|
vite: {
|
|
362
369
|
plugins: [
|
|
363
|
-
h(
|
|
370
|
+
h(n)
|
|
364
371
|
]
|
|
365
372
|
}
|
|
366
373
|
});
|
|
@@ -369,5 +376,5 @@ Current values:
|
|
|
369
376
|
};
|
|
370
377
|
}
|
|
371
378
|
export {
|
|
372
|
-
|
|
379
|
+
E as default
|
|
373
380
|
};
|