@strifeapp/astro 1.0.14 → 1.0.16
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 +40 -28
- 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
|
|
@@ -265,25 +265,35 @@ function storeAs(name, value) {
|
|
|
265
265
|
function h(e) {
|
|
266
266
|
return console.log("[vitePluginStrifeStore] Config received:", JSON.stringify(e, null, 2)), {
|
|
267
267
|
name: "strife:store",
|
|
268
|
-
resolveId(
|
|
269
|
-
if (
|
|
268
|
+
resolveId(i) {
|
|
269
|
+
if (i === m)
|
|
270
270
|
return p;
|
|
271
271
|
},
|
|
272
|
-
load(
|
|
273
|
-
var o;
|
|
274
|
-
if (
|
|
275
|
-
return
|
|
272
|
+
load(i) {
|
|
273
|
+
var o, r;
|
|
274
|
+
if (i === p)
|
|
275
|
+
return `
|
|
276
276
|
import { DocumentStore, AbstractJavaScriptMultiMapIndexCreationTask, IndexCreation } from "ravendb";
|
|
277
277
|
|
|
278
278
|
const authOptions = {
|
|
279
279
|
type: 'pfx',
|
|
280
|
-
certificate: Buffer.from(${
|
|
281
|
-
password: ${
|
|
280
|
+
certificate: Buffer.from(${l(e.certificate)}, 'base64'),
|
|
281
|
+
password: ${l(e.password)},
|
|
282
282
|
};
|
|
283
283
|
|
|
284
|
+
console.log('[vitePluginStrifeStore] Will attempt to connect to URLs:', ${l(e.urls)});
|
|
285
|
+
console.log('[vitePluginStrifeStore] Using database:', ${l(e.database)});
|
|
286
|
+
console.log('[vitePluginStrifeStore] Certificate length:', ${e.certificate ? e.certificate.length : 0});
|
|
287
|
+
|
|
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
|
+
|
|
284
294
|
const store = new DocumentStore(
|
|
285
|
-
${
|
|
286
|
-
${
|
|
295
|
+
${l(e.urls ? e.urls : [])},
|
|
296
|
+
${l(e.database || "")},
|
|
287
297
|
authOptions
|
|
288
298
|
).initialize();
|
|
289
299
|
|
|
@@ -291,7 +301,7 @@ function h(e) {
|
|
|
291
301
|
constructor() {
|
|
292
302
|
super();
|
|
293
303
|
|
|
294
|
-
this.additionalSources = {"Helper": ${
|
|
304
|
+
this.additionalSources = {"Helper": ${l(y)}}
|
|
295
305
|
|
|
296
306
|
${(e.collections || ["Posts"]).map((t) => `this.map("${typeof t == "string" ? t : t.name}", (doc) => { return mapDocument(doc) });`).join(`
|
|
297
307
|
`)}
|
|
@@ -302,11 +312,13 @@ function h(e) {
|
|
|
302
312
|
}
|
|
303
313
|
|
|
304
314
|
console.log('Deploying index...');
|
|
315
|
+
console.log('[vitePluginStrifeStore] Generating virtual module code with config:', ${JSON.stringify(e, null, 2)});
|
|
316
|
+
|
|
305
317
|
await IndexCreation.createIndexes([new Content_ByUrl()], store);
|
|
306
318
|
|
|
307
319
|
const bulkInsert = store.bulkInsert();
|
|
308
320
|
|
|
309
|
-
${(
|
|
321
|
+
${(r = e.collections) == null ? void 0 : r.map((t) => `
|
|
310
322
|
await bulkInsert.store(${JSON.stringify(t)}, 'templates/${t.name}', { '@collection': 'Templates' });
|
|
311
323
|
`).join(`
|
|
312
324
|
`)}
|
|
@@ -321,33 +333,33 @@ function h(e) {
|
|
|
321
333
|
const T = {
|
|
322
334
|
type: "pfx"
|
|
323
335
|
};
|
|
324
|
-
function g(e,
|
|
325
|
-
let o = process.env.STRIFE_DATABASE_URLS,
|
|
326
|
-
if (!o || !
|
|
327
|
-
const n = f(e,
|
|
328
|
-
o = o || n.STRIFE_DATABASE_URLS,
|
|
336
|
+
function g(e, i) {
|
|
337
|
+
let o = process.env.STRIFE_DATABASE_URLS, r = process.env.STRIFE_DATABASE, t = process.env.STRIFE_CERTIFICATE, a = process.env.STRIFE_CERTIFICATE_PASSWORD;
|
|
338
|
+
if (!o || !r || !t || !a) {
|
|
339
|
+
const n = f(e, i ?? "", "");
|
|
340
|
+
o = o || n.STRIFE_DATABASE_URLS, r = r || n.STRIFE_DATABASE, t = t || n.STRIFE_CERTIFICATE, a = a || n.STRIFE_CERTIFICATE_PASSWORD;
|
|
329
341
|
}
|
|
330
|
-
return console.log("[strifeIntegration] Loaded environment variables:"), console.log(` STRIFE_DATABASE_URLS: ${o ? "[SET]" : "[NOT SET]"}`), console.log(` STRIFE_DATABASE: ${
|
|
342
|
+
return console.log("[strifeIntegration] Loaded environment variables:"), console.log(` STRIFE_DATABASE_URLS: ${o ? "[SET]" : "[NOT SET]"}`), console.log(` STRIFE_DATABASE: ${r || "[NOT SET]"}`), console.log(` STRIFE_CERTIFICATE: ${t ? `[SET, length=${t.length}]` : "[NOT SET]"}`), console.log(` STRIFE_CERTIFICATE_PASSWORD: ${a ? "[SET]" : "[NOT SET]"}`), {
|
|
331
343
|
urls: o ? o.split(",").map((n) => n.trim()).filter(Boolean) : void 0,
|
|
332
|
-
database:
|
|
333
|
-
certificate:
|
|
344
|
+
database: r || void 0,
|
|
345
|
+
certificate: t || void 0,
|
|
334
346
|
password: a || void 0
|
|
335
347
|
};
|
|
336
348
|
}
|
|
337
|
-
function
|
|
349
|
+
function A(e) {
|
|
338
350
|
return {
|
|
339
351
|
name: "@strife/astro",
|
|
340
352
|
hooks: {
|
|
341
|
-
"astro:config:setup": ({ command:
|
|
342
|
-
const
|
|
353
|
+
"astro:config:setup": ({ command: i, config: o, updateConfig: r }) => {
|
|
354
|
+
const t = o.vite.envDir || process.cwd(), a = g(i, t);
|
|
343
355
|
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
356
|
const n = {
|
|
345
357
|
...T,
|
|
346
358
|
...Object.fromEntries(
|
|
347
|
-
Object.entries(a).filter(([s,
|
|
359
|
+
Object.entries(a).filter(([s, d]) => !!d)
|
|
348
360
|
),
|
|
349
361
|
...e ? Object.fromEntries(
|
|
350
|
-
Object.entries(e).filter(([s,
|
|
362
|
+
Object.entries(e).filter(([s, d]) => !!d)
|
|
351
363
|
) : {}
|
|
352
364
|
};
|
|
353
365
|
console.log("[strifeIntegration] Final mergedOptions:", JSON.stringify(n, null, 2));
|
|
@@ -362,7 +374,7 @@ Current values:
|
|
|
362
374
|
` + c.map((s) => ` ${s}: ${JSON.stringify(n[s])}`).join(`
|
|
363
375
|
`)
|
|
364
376
|
);
|
|
365
|
-
|
|
377
|
+
r({
|
|
366
378
|
vite: {
|
|
367
379
|
plugins: [
|
|
368
380
|
h(n)
|
|
@@ -374,5 +386,5 @@ Current values:
|
|
|
374
386
|
};
|
|
375
387
|
}
|
|
376
388
|
export {
|
|
377
|
-
|
|
389
|
+
A as default
|
|
378
390
|
};
|