@strifeapp/astro 1.0.10 → 1.0.11
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 +38 -36
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { loadEnv as
|
|
2
|
-
import
|
|
3
|
-
const
|
|
1
|
+
import { loadEnv as h } from "vite";
|
|
2
|
+
import r from "serialize-javascript";
|
|
3
|
+
const T = `/**
|
|
4
4
|
* Creates an indexed item that will be stored in the index.
|
|
5
5
|
* @param {string} name - Name of property to index
|
|
6
6
|
* @param {any} value - Value to index and store
|
|
@@ -261,29 +261,29 @@ function storeAs(name, value) {
|
|
|
261
261
|
});
|
|
262
262
|
|
|
263
263
|
return result;
|
|
264
|
-
}`,
|
|
265
|
-
function
|
|
264
|
+
}`, u = "strife:store", i = "\0" + u;
|
|
265
|
+
function R(e) {
|
|
266
266
|
return {
|
|
267
267
|
name: "strife:store",
|
|
268
268
|
resolveId(o) {
|
|
269
|
-
if (o ===
|
|
270
|
-
return
|
|
269
|
+
if (o === u)
|
|
270
|
+
return i;
|
|
271
271
|
},
|
|
272
272
|
load(o) {
|
|
273
|
-
var
|
|
274
|
-
if (o ===
|
|
273
|
+
var s;
|
|
274
|
+
if (o === i)
|
|
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(${r(e.certificate)}, 'base64'),
|
|
281
|
+
password: ${r(e.password)},
|
|
282
282
|
};
|
|
283
283
|
|
|
284
284
|
const store = new DocumentStore(
|
|
285
|
-
${
|
|
286
|
-
${
|
|
285
|
+
${r(e.urls ? e.urls : [])},
|
|
286
|
+
${r(e.database || "")},
|
|
287
287
|
authOptions
|
|
288
288
|
).initialize()
|
|
289
289
|
|
|
@@ -291,9 +291,9 @@ function h(e) {
|
|
|
291
291
|
constructor() {
|
|
292
292
|
super();
|
|
293
293
|
|
|
294
|
-
this.additionalSources = {"Helper": ${
|
|
294
|
+
this.additionalSources = {"Helper": ${r(T)}}
|
|
295
295
|
|
|
296
|
-
${(e.collections || ["Posts"]).map((
|
|
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';
|
|
@@ -307,8 +307,8 @@ function h(e) {
|
|
|
307
307
|
|
|
308
308
|
const bulkInsert = store.bulkInsert();
|
|
309
309
|
|
|
310
|
-
${(
|
|
311
|
-
await bulkInsert.store(${JSON.stringify(
|
|
310
|
+
${(s = e.collections) == null ? void 0 : s.map((t) => `
|
|
311
|
+
await bulkInsert.store(${JSON.stringify(t)}, 'templates/${t.name}', { '@collection': 'Templates' });
|
|
312
312
|
`).join(`
|
|
313
313
|
`)}
|
|
314
314
|
|
|
@@ -319,36 +319,38 @@ function h(e) {
|
|
|
319
319
|
}
|
|
320
320
|
};
|
|
321
321
|
}
|
|
322
|
-
const
|
|
322
|
+
const A = {
|
|
323
323
|
type: "pfx"
|
|
324
324
|
};
|
|
325
|
-
function
|
|
326
|
-
let o, t;
|
|
325
|
+
function E(e) {
|
|
327
326
|
return {
|
|
328
327
|
name: "@strife/astro",
|
|
329
328
|
hooks: {
|
|
330
|
-
"astro:config:setup": ({ command:
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
329
|
+
"astro:config:setup": ({ command: o, config: s, updateConfig: t }) => {
|
|
330
|
+
let n = process.env.STRIFE_DATABASE_URLS, d = process.env.STRIFE_DATABASE, l = process.env.STRIFE_CERTIFICATE, c = process.env.STRIFE_CERTIFICATE_PASSWORD;
|
|
331
|
+
if (!n || !d || !l || !c) {
|
|
332
|
+
const a = h(o, s.vite.envDir ?? "", "");
|
|
333
|
+
n = n || a.STRIFE_DATABASE_URLS, d = d || a.STRIFE_DATABASE, l = l || a.STRIFE_CERTIFICATE, c = c || a.STRIFE_CERTIFICATE_PASSWORD;
|
|
334
|
+
}
|
|
335
|
+
const p = {
|
|
336
|
+
urls: n == null ? void 0 : n.split(","),
|
|
337
|
+
database: d,
|
|
338
|
+
certificate: l,
|
|
339
|
+
password: c
|
|
340
|
+
}, m = Object.fromEntries(
|
|
341
|
+
Object.entries(p).filter(([a, y]) => y !== void 0)
|
|
342
|
+
), f = {
|
|
343
|
+
...A,
|
|
342
344
|
// Base defaults
|
|
343
|
-
...
|
|
345
|
+
...m,
|
|
344
346
|
// Environment variables override defaults
|
|
345
347
|
...e
|
|
346
348
|
// Explicit options override everything
|
|
347
349
|
};
|
|
348
|
-
|
|
350
|
+
t({
|
|
349
351
|
vite: {
|
|
350
352
|
plugins: [
|
|
351
|
-
|
|
353
|
+
R(f)
|
|
352
354
|
]
|
|
353
355
|
}
|
|
354
356
|
});
|
|
@@ -357,5 +359,5 @@ function D(e) {
|
|
|
357
359
|
};
|
|
358
360
|
}
|
|
359
361
|
export {
|
|
360
|
-
|
|
362
|
+
E as default
|
|
361
363
|
};
|