@strifeapp/astro 1.0.10 → 1.0.12
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 +51 -39
- 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,29 @@ function storeAs(name, value) {
|
|
|
261
261
|
});
|
|
262
262
|
|
|
263
263
|
return result;
|
|
264
|
-
}`,
|
|
265
|
-
function h(
|
|
264
|
+
}`, p = "strife:store", u = "\0" + p;
|
|
265
|
+
function h(n) {
|
|
266
266
|
return {
|
|
267
267
|
name: "strife:store",
|
|
268
|
-
resolveId(
|
|
269
|
-
if (
|
|
270
|
-
return
|
|
268
|
+
resolveId(r) {
|
|
269
|
+
if (r === p)
|
|
270
|
+
return u;
|
|
271
271
|
},
|
|
272
|
-
load(
|
|
273
|
-
var
|
|
274
|
-
if (
|
|
272
|
+
load(r) {
|
|
273
|
+
var o;
|
|
274
|
+
if (r === u)
|
|
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(n.certificate)}, 'base64'),
|
|
281
|
+
password: ${l(n.password)},
|
|
282
282
|
};
|
|
283
283
|
|
|
284
284
|
const store = new DocumentStore(
|
|
285
|
-
${
|
|
286
|
-
${
|
|
285
|
+
${l(n.urls ? n.urls : [])},
|
|
286
|
+
${l(n.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": ${l(y)}}
|
|
295
295
|
|
|
296
|
-
${(
|
|
296
|
+
${(n.collections || ["Posts"]).map((e) => `this.map("${typeof e == "string" ? e : e.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
|
+
${(o = n.collections) == null ? void 0 : o.map((e) => `
|
|
311
|
+
await bulkInsert.store(${JSON.stringify(e)}, 'templates/${e.name}', { '@collection': 'Templates' });
|
|
312
312
|
`).join(`
|
|
313
313
|
`)}
|
|
314
314
|
|
|
@@ -322,33 +322,45 @@ function h(e) {
|
|
|
322
322
|
const T = {
|
|
323
323
|
type: "pfx"
|
|
324
324
|
};
|
|
325
|
-
function
|
|
326
|
-
let o,
|
|
325
|
+
function R(n, r) {
|
|
326
|
+
let o = process.env.STRIFE_DATABASE_URLS, e = process.env.STRIFE_DATABASE, a = process.env.STRIFE_CERTIFICATE, d = process.env.STRIFE_CERTIFICATE_PASSWORD;
|
|
327
|
+
if (!o || !e || !a || !d) {
|
|
328
|
+
const t = f(n, r ?? "", "");
|
|
329
|
+
o = o || t.STRIFE_DATABASE_URLS, e = e || t.STRIFE_DATABASE, a = a || t.STRIFE_CERTIFICATE, d = d || t.STRIFE_CERTIFICATE_PASSWORD;
|
|
330
|
+
}
|
|
331
|
+
return {
|
|
332
|
+
urls: o ? o.split(",").map((t) => t.trim()).filter(Boolean) : void 0,
|
|
333
|
+
database: e || void 0,
|
|
334
|
+
certificate: a || void 0,
|
|
335
|
+
password: d || void 0
|
|
336
|
+
};
|
|
337
|
+
}
|
|
338
|
+
function I(n) {
|
|
327
339
|
return {
|
|
328
340
|
name: "@strife/astro",
|
|
329
341
|
hooks: {
|
|
330
|
-
"astro:config:setup": ({ command:
|
|
331
|
-
|
|
332
|
-
o = n, t = f(o, r.vite.envDir ?? "", "");
|
|
333
|
-
const i = {
|
|
334
|
-
urls: (s = t.STRIFE_DATABASE_URLS) == null ? void 0 : s.split(","),
|
|
335
|
-
database: t.STRIFE_DATABASE,
|
|
336
|
-
certificate: t.STRIFE_CERTIFICATE,
|
|
337
|
-
password: t.STRIFE_CERTIFICATE_PASSWORD
|
|
338
|
-
}, u = Object.fromEntries(
|
|
339
|
-
Object.entries(i).filter(([R, m]) => m !== void 0)
|
|
340
|
-
), p = {
|
|
342
|
+
"astro:config:setup": ({ command: r, config: o, updateConfig: e }) => {
|
|
343
|
+
const a = o.vite.envDir || process.cwd(), d = R(r, a), t = {
|
|
341
344
|
...T,
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
...
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
345
|
+
...Object.fromEntries(
|
|
346
|
+
Object.entries(d).filter(([s, m]) => !!m)
|
|
347
|
+
),
|
|
348
|
+
...n
|
|
349
|
+
}, i = ["urls", "database", "certificate", "password"], c = i.filter(
|
|
350
|
+
(s) => !t[s] || Array.isArray(t[s]) && t[s].length === 0
|
|
351
|
+
);
|
|
352
|
+
if (c.length > 0)
|
|
353
|
+
throw new Error(
|
|
354
|
+
`[strifeIntegration] Missing required environment variables: ${c.join(", ")}.
|
|
355
|
+
Set them in your .env file (for local) or Vercel project settings (for deployment).
|
|
356
|
+
Current values:
|
|
357
|
+
` + i.map((s) => ` ${s}: ${JSON.stringify(t[s])}`).join(`
|
|
358
|
+
`)
|
|
359
|
+
);
|
|
360
|
+
e({
|
|
349
361
|
vite: {
|
|
350
362
|
plugins: [
|
|
351
|
-
h(
|
|
363
|
+
h(t)
|
|
352
364
|
]
|
|
353
365
|
}
|
|
354
366
|
});
|
|
@@ -357,5 +369,5 @@ function D(e) {
|
|
|
357
369
|
};
|
|
358
370
|
}
|
|
359
371
|
export {
|
|
360
|
-
|
|
372
|
+
I as default
|
|
361
373
|
};
|