@strifeapp/astro 1.0.29 → 1.0.30-beta.0
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/README.md +1 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -20
- package/dist/vite-plugin-strife-store-DkxIFvv2.js +89 -0
- package/dist/vite-plugin-strife-store-entry.js +1 -1
- package/dist/vite-plugin-strife-store.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/vite-plugin-strife-store-HEEze8Mw.js +0 -73
package/README.md
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
# @strifeapp/astro
|
|
2
|
-
|
|
3
|
-
This source code was recovered from the compiled distribution package v1.0.27.
|
|
1
|
+
# @strifeapp/astro
|
|
4
2
|
|
|
5
3
|
## ⚠️ Important Notes
|
|
6
4
|
|
|
7
|
-
1. **ImageService**: The `src/services/ImageService.ts` file only had type definitions in the compiled version. The actual implementation needs to be filled in based on your requirements.
|
|
8
|
-
|
|
9
5
|
2. **indexMapping.js**: This file should NOT be converted to TypeScript as it runs inside RavenDB's JavaScript indexing engine. Keep it as plain JavaScript.
|
|
10
6
|
|
|
11
7
|
3. **Module References**: The vite plugin reads `indexMapping.js` at build time using `readFileSync`, so make sure the path resolution in `vite-plugin-strife-store.ts` is correct for your build setup.
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAG5C,MAAM,WAAW,kBAAmB,SAAQ,YAAY;IACtD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,UAAU,EAAE,CAAC;CAC5B;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAMD,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,OAAO,CAAC,EAAE,kBAAkB,GAAG,gBAAgB,CAwBxF"}
|
package/dist/index.js
CHANGED
|
@@ -1,30 +1,21 @@
|
|
|
1
|
-
import { v as
|
|
2
|
-
|
|
3
|
-
const a = {
|
|
1
|
+
import { v as n } from "./vite-plugin-strife-store-DkxIFvv2.js";
|
|
2
|
+
const o = {
|
|
4
3
|
type: "pfx"
|
|
5
4
|
};
|
|
6
|
-
function
|
|
5
|
+
function s(t) {
|
|
7
6
|
return {
|
|
8
7
|
name: "@strife/astro",
|
|
9
8
|
hooks: {
|
|
10
|
-
"astro:config:setup": ({
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
...
|
|
14
|
-
|
|
15
|
-
password: T ?? (e == null ? void 0 : e.password),
|
|
16
|
-
urls: r ? r.split(",") : (e == null ? void 0 : e.urls) ?? [],
|
|
17
|
-
database: S ?? (e == null ? void 0 : e.database)
|
|
18
|
-
};
|
|
19
|
-
const A = {
|
|
20
|
-
...a,
|
|
21
|
-
...e ? Object.fromEntries(
|
|
22
|
-
Object.entries(e).filter(([u, I]) => !!I)
|
|
9
|
+
"astro:config:setup": ({ updateConfig: i }) => {
|
|
10
|
+
const r = {
|
|
11
|
+
...o,
|
|
12
|
+
...t ? Object.fromEntries(
|
|
13
|
+
Object.entries(t).filter(([, e]) => e != null)
|
|
23
14
|
) : {}
|
|
24
15
|
};
|
|
25
|
-
|
|
16
|
+
i({
|
|
26
17
|
vite: {
|
|
27
|
-
plugins: [
|
|
18
|
+
plugins: [n(r)]
|
|
28
19
|
}
|
|
29
20
|
});
|
|
30
21
|
}
|
|
@@ -32,5 +23,5 @@ function d(e) {
|
|
|
32
23
|
};
|
|
33
24
|
}
|
|
34
25
|
export {
|
|
35
|
-
|
|
26
|
+
s as default
|
|
36
27
|
};
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { readFileSync as a } from "fs";
|
|
2
|
+
import { dirname as l, resolve as f } from "path";
|
|
3
|
+
import { fileURLToPath as u } from "url";
|
|
4
|
+
import t from "serialize-javascript";
|
|
5
|
+
const n = "strife:store", o = "\0" + n;
|
|
6
|
+
function g(i) {
|
|
7
|
+
const s = u(import.meta.url), c = l(s), r = a(
|
|
8
|
+
f(c, "./localized-content-index.js"),
|
|
9
|
+
"utf-8"
|
|
10
|
+
);
|
|
11
|
+
return {
|
|
12
|
+
name: "strife:store",
|
|
13
|
+
resolveId(e) {
|
|
14
|
+
if (e === n)
|
|
15
|
+
return o;
|
|
16
|
+
},
|
|
17
|
+
load(e) {
|
|
18
|
+
if (e === o)
|
|
19
|
+
return `
|
|
20
|
+
import { DocumentStore, AbstractJavaScriptMultiMapIndexCreationTask } from "ravendb";
|
|
21
|
+
|
|
22
|
+
const indexMappingSource = ${t(r)};
|
|
23
|
+
const defaultConfig = ${t(i)};
|
|
24
|
+
|
|
25
|
+
const urls = process.env.STRIFE_DATABASE_URLS
|
|
26
|
+
? process.env.STRIFE_DATABASE_URLS.split(',')
|
|
27
|
+
: (defaultConfig.urls || []);
|
|
28
|
+
|
|
29
|
+
const database = process.env.STRIFE_DATABASE || defaultConfig.database || '';
|
|
30
|
+
|
|
31
|
+
const certificate = process.env.STRIFE_CERTIFICATE || defaultConfig.certificate;
|
|
32
|
+
const password = process.env.STRIFE_CERTIFICATE_PASSWORD || defaultConfig.password;
|
|
33
|
+
|
|
34
|
+
const hasAuth = certificate && password;
|
|
35
|
+
|
|
36
|
+
const authOptions = hasAuth ? {
|
|
37
|
+
type: defaultConfig.type || 'pfx',
|
|
38
|
+
certificate: Buffer.from(certificate, 'base64'),
|
|
39
|
+
password,
|
|
40
|
+
} : null;
|
|
41
|
+
|
|
42
|
+
const store = new DocumentStore(
|
|
43
|
+
urls,
|
|
44
|
+
database,
|
|
45
|
+
authOptions || undefined,
|
|
46
|
+
).initialize();
|
|
47
|
+
|
|
48
|
+
class Content_ByUrl extends AbstractJavaScriptMultiMapIndexCreationTask {
|
|
49
|
+
constructor() {
|
|
50
|
+
super();
|
|
51
|
+
|
|
52
|
+
this.additionalSources = {"Helper": indexMappingSource};
|
|
53
|
+
|
|
54
|
+
const collections = (defaultConfig.collections && defaultConfig.collections.length)
|
|
55
|
+
? defaultConfig.collections
|
|
56
|
+
: ['Posts'];
|
|
57
|
+
|
|
58
|
+
for (const collection of collections) {
|
|
59
|
+
const name = typeof collection === 'string' ? collection : collection.name;
|
|
60
|
+
this.map(name, function (doc) { return mapDocument(doc); });
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
this.deploymentMode = 'Rolling';
|
|
64
|
+
this.searchEngineType = 'Lucene';
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
console.log('Deploying index...');
|
|
69
|
+
|
|
70
|
+
await store.executeIndex(new Content_ByUrl());
|
|
71
|
+
|
|
72
|
+
const bulkInsert = store.bulkInsert();
|
|
73
|
+
|
|
74
|
+
if (defaultConfig.collections && defaultConfig.collections.length) {
|
|
75
|
+
for (const collection of defaultConfig.collections) {
|
|
76
|
+
await bulkInsert.store(collection, 'templates/' + collection.name, { '@collection': 'Templates' });
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
await bulkInsert.finish();
|
|
81
|
+
|
|
82
|
+
export { store };
|
|
83
|
+
`;
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
export {
|
|
88
|
+
g as v
|
|
89
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite-plugin-strife-store.d.ts","sourceRoot":"","sources":["../src/vite-plugin-strife-store.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,MAAM,CAAC;AAEzC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAKlD,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,kBAAkB,GAAG,YAAY,
|
|
1
|
+
{"version":3,"file":"vite-plugin-strife-store.d.ts","sourceRoot":"","sources":["../src/vite-plugin-strife-store.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,MAAM,CAAC;AAEzC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAKlD,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,kBAAkB,GAAG,YAAY,CAsF9E"}
|
package/package.json
CHANGED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { readFileSync as c } from "fs";
|
|
2
|
-
import { dirname as m, resolve as u } from "path";
|
|
3
|
-
import { fileURLToPath as d } from "url";
|
|
4
|
-
import r from "serialize-javascript";
|
|
5
|
-
const n = "strife:store", o = "\0" + n;
|
|
6
|
-
function S(e) {
|
|
7
|
-
const i = d(import.meta.url), p = m(i), l = c(
|
|
8
|
-
u(p, "./localized-content-index.js"),
|
|
9
|
-
"utf-8"
|
|
10
|
-
);
|
|
11
|
-
return {
|
|
12
|
-
name: "strife:store",
|
|
13
|
-
resolveId(s) {
|
|
14
|
-
if (s === n)
|
|
15
|
-
return o;
|
|
16
|
-
},
|
|
17
|
-
load(s) {
|
|
18
|
-
var a;
|
|
19
|
-
if (s === o)
|
|
20
|
-
return `
|
|
21
|
-
import { DocumentStore, AbstractJavaScriptMultiMapIndexCreationTask } from "ravendb";
|
|
22
|
-
|
|
23
|
-
${e.certificate && e.password ? `
|
|
24
|
-
const authOptions = {
|
|
25
|
-
type: 'pfx',
|
|
26
|
-
certificate: Buffer.from(${r(e.certificate)}, 'base64'),
|
|
27
|
-
password: ${r(e.password)},
|
|
28
|
-
};
|
|
29
|
-
` : ""}
|
|
30
|
-
|
|
31
|
-
const store = new DocumentStore(
|
|
32
|
-
${r(e.urls ? e.urls : [])},
|
|
33
|
-
${r(e.database || "")}${e.certificate && e.password ? `,
|
|
34
|
-
authOptions` : ""}
|
|
35
|
-
).initialize()
|
|
36
|
-
|
|
37
|
-
class Content_ByUrl extends AbstractJavaScriptMultiMapIndexCreationTask {
|
|
38
|
-
constructor() {
|
|
39
|
-
super();
|
|
40
|
-
|
|
41
|
-
this.additionalSources = {"Helper": ${r(l)}}
|
|
42
|
-
|
|
43
|
-
${(e.collections || ["Posts"]).map(
|
|
44
|
-
(t) => `this.map("${typeof t == "string" ? t : t.name}", (doc) => { return mapDocument(doc) });`
|
|
45
|
-
).join(`
|
|
46
|
-
`)}
|
|
47
|
-
|
|
48
|
-
this.deploymentMode = 'Rolling';
|
|
49
|
-
this.searchEngineType = 'Lucene';
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
console.log('Deploying index...');
|
|
54
|
-
|
|
55
|
-
await store.executeIndex(new Content_ByUrl());
|
|
56
|
-
|
|
57
|
-
const bulkInsert = store.bulkInsert();
|
|
58
|
-
|
|
59
|
-
${(a = e.collections) == null ? void 0 : a.map((t) => `
|
|
60
|
-
await bulkInsert.store(${JSON.stringify(t)}, 'templates/${t.name}', { '@collection': 'Templates' });
|
|
61
|
-
`).join(`
|
|
62
|
-
`)}
|
|
63
|
-
|
|
64
|
-
await bulkInsert.finish();
|
|
65
|
-
|
|
66
|
-
export { store };
|
|
67
|
-
`;
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
export {
|
|
72
|
-
S as v
|
|
73
|
-
};
|