@strifeapp/astro 1.0.12 → 1.0.13
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 +23 -23
- 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 d 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,25 @@ function storeAs(name, value) {
|
|
|
265
265
|
function h(n) {
|
|
266
266
|
return {
|
|
267
267
|
name: "strife:store",
|
|
268
|
-
resolveId(
|
|
269
|
-
if (
|
|
268
|
+
resolveId(a) {
|
|
269
|
+
if (a === p)
|
|
270
270
|
return u;
|
|
271
271
|
},
|
|
272
|
-
load(
|
|
272
|
+
load(a) {
|
|
273
273
|
var o;
|
|
274
|
-
if (
|
|
274
|
+
if (a === 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(${d(n.certificate)}, 'base64'),
|
|
281
|
+
password: ${d(n.password)},
|
|
282
282
|
};
|
|
283
283
|
|
|
284
284
|
const store = new DocumentStore(
|
|
285
|
-
${
|
|
286
|
-
${
|
|
285
|
+
${d(n.urls ? n.urls : [])},
|
|
286
|
+
${d(n.database || "")},
|
|
287
287
|
authOptions
|
|
288
288
|
).initialize()
|
|
289
289
|
|
|
@@ -291,7 +291,7 @@ function h(n) {
|
|
|
291
291
|
constructor() {
|
|
292
292
|
super();
|
|
293
293
|
|
|
294
|
-
this.additionalSources = {"Helper": ${
|
|
294
|
+
this.additionalSources = {"Helper": ${d(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
|
`)}
|
|
@@ -322,39 +322,39 @@ function h(n) {
|
|
|
322
322
|
const T = {
|
|
323
323
|
type: "pfx"
|
|
324
324
|
};
|
|
325
|
-
function R(n,
|
|
326
|
-
let o = process.env.STRIFE_DATABASE_URLS, e = process.env.STRIFE_DATABASE,
|
|
327
|
-
if (!o || !e || !
|
|
328
|
-
const t = f(n,
|
|
329
|
-
o = o || t.STRIFE_DATABASE_URLS, e = e || t.STRIFE_DATABASE,
|
|
325
|
+
function R(n, a) {
|
|
326
|
+
let o = process.env.STRIFE_DATABASE_URLS, e = process.env.STRIFE_DATABASE, r = process.env.STRIFE_CERTIFICATE, s = process.env.STRIFE_CERTIFICATE_PASSWORD;
|
|
327
|
+
if (!o || !e || !r || !s) {
|
|
328
|
+
const t = f(n, a ?? "", "");
|
|
329
|
+
o = o || t.STRIFE_DATABASE_URLS, e = e || t.STRIFE_DATABASE, r = r || t.STRIFE_CERTIFICATE, s = s || t.STRIFE_CERTIFICATE_PASSWORD;
|
|
330
330
|
}
|
|
331
|
-
return {
|
|
331
|
+
return console.log("[strifeIntegration] Loaded environment variables:"), console.log(` STRIFE_DATABASE_URLS: ${o ? "[SET]" : "[NOT SET]"}`), console.log(` STRIFE_DATABASE: ${e || "[NOT SET]"}`), console.log(` STRIFE_CERTIFICATE: ${r ? `[SET, length=${r.length}]` : "[NOT SET]"}`), console.log(` STRIFE_CERTIFICATE_PASSWORD: ${s ? "[SET]" : "[NOT SET]"}`), {
|
|
332
332
|
urls: o ? o.split(",").map((t) => t.trim()).filter(Boolean) : void 0,
|
|
333
333
|
database: e || void 0,
|
|
334
|
-
certificate:
|
|
335
|
-
password:
|
|
334
|
+
certificate: r || void 0,
|
|
335
|
+
password: s || void 0
|
|
336
336
|
};
|
|
337
337
|
}
|
|
338
338
|
function I(n) {
|
|
339
339
|
return {
|
|
340
340
|
name: "@strife/astro",
|
|
341
341
|
hooks: {
|
|
342
|
-
"astro:config:setup": ({ command:
|
|
343
|
-
const
|
|
342
|
+
"astro:config:setup": ({ command: a, config: o, updateConfig: e }) => {
|
|
343
|
+
const r = o.vite.envDir || process.cwd(), s = R(a, r), t = {
|
|
344
344
|
...T,
|
|
345
345
|
...Object.fromEntries(
|
|
346
|
-
Object.entries(
|
|
346
|
+
Object.entries(s).filter(([l, m]) => !!m)
|
|
347
347
|
),
|
|
348
348
|
...n
|
|
349
349
|
}, i = ["urls", "database", "certificate", "password"], c = i.filter(
|
|
350
|
-
(
|
|
350
|
+
(l) => !t[l] || Array.isArray(t[l]) && t[l].length === 0
|
|
351
351
|
);
|
|
352
352
|
if (c.length > 0)
|
|
353
353
|
throw new Error(
|
|
354
354
|
`[strifeIntegration] Missing required environment variables: ${c.join(", ")}.
|
|
355
355
|
Set them in your .env file (for local) or Vercel project settings (for deployment).
|
|
356
356
|
Current values:
|
|
357
|
-
` + i.map((
|
|
357
|
+
` + i.map((l) => ` ${l}: ${JSON.stringify(t[l])}`).join(`
|
|
358
358
|
`)
|
|
359
359
|
);
|
|
360
360
|
e({
|