@strifeapp/astro 1.0.15 → 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 +37 -27
- 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 (
|
|
272
|
+
load(i) {
|
|
273
|
+
var o, r;
|
|
274
|
+
if (i === 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(${
|
|
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
|
`)}
|
|
@@ -308,7 +318,7 @@ function h(e) {
|
|
|
308
318
|
|
|
309
319
|
const bulkInsert = store.bulkInsert();
|
|
310
320
|
|
|
311
|
-
${(
|
|
321
|
+
${(r = e.collections) == null ? void 0 : r.map((t) => `
|
|
312
322
|
await bulkInsert.store(${JSON.stringify(t)}, 'templates/${t.name}', { '@collection': 'Templates' });
|
|
313
323
|
`).join(`
|
|
314
324
|
`)}
|
|
@@ -323,33 +333,33 @@ function h(e) {
|
|
|
323
333
|
const T = {
|
|
324
334
|
type: "pfx"
|
|
325
335
|
};
|
|
326
|
-
function g(e,
|
|
327
|
-
let o = process.env.STRIFE_DATABASE_URLS,
|
|
328
|
-
if (!o || !
|
|
329
|
-
const n = f(e,
|
|
330
|
-
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;
|
|
331
341
|
}
|
|
332
|
-
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]"}`), {
|
|
333
343
|
urls: o ? o.split(",").map((n) => n.trim()).filter(Boolean) : void 0,
|
|
334
|
-
database:
|
|
335
|
-
certificate:
|
|
344
|
+
database: r || void 0,
|
|
345
|
+
certificate: t || void 0,
|
|
336
346
|
password: a || void 0
|
|
337
347
|
};
|
|
338
348
|
}
|
|
339
|
-
function
|
|
349
|
+
function A(e) {
|
|
340
350
|
return {
|
|
341
351
|
name: "@strife/astro",
|
|
342
352
|
hooks: {
|
|
343
|
-
"astro:config:setup": ({ command:
|
|
344
|
-
const
|
|
353
|
+
"astro:config:setup": ({ command: i, config: o, updateConfig: r }) => {
|
|
354
|
+
const t = o.vite.envDir || process.cwd(), a = g(i, t);
|
|
345
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.");
|
|
346
356
|
const n = {
|
|
347
357
|
...T,
|
|
348
358
|
...Object.fromEntries(
|
|
349
|
-
Object.entries(a).filter(([s,
|
|
359
|
+
Object.entries(a).filter(([s, d]) => !!d)
|
|
350
360
|
),
|
|
351
361
|
...e ? Object.fromEntries(
|
|
352
|
-
Object.entries(e).filter(([s,
|
|
362
|
+
Object.entries(e).filter(([s, d]) => !!d)
|
|
353
363
|
) : {}
|
|
354
364
|
};
|
|
355
365
|
console.log("[strifeIntegration] Final mergedOptions:", JSON.stringify(n, null, 2));
|
|
@@ -364,7 +374,7 @@ Current values:
|
|
|
364
374
|
` + c.map((s) => ` ${s}: ${JSON.stringify(n[s])}`).join(`
|
|
365
375
|
`)
|
|
366
376
|
);
|
|
367
|
-
|
|
377
|
+
r({
|
|
368
378
|
vite: {
|
|
369
379
|
plugins: [
|
|
370
380
|
h(n)
|
|
@@ -376,5 +386,5 @@ Current values:
|
|
|
376
386
|
};
|
|
377
387
|
}
|
|
378
388
|
export {
|
|
379
|
-
|
|
389
|
+
A as default
|
|
380
390
|
};
|