@strifeapp/astro 1.0.6 → 1.0.8
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.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { AstroIntegration } from 'astro';
|
|
2
|
+
import { IAuthOptions } from 'ravendb';
|
|
3
|
+
export interface IntegrationOptions extends IAuthOptions {
|
|
4
|
+
certificate?: string;
|
|
5
|
+
password?: string;
|
|
6
|
+
urls?: string[];
|
|
7
|
+
database?: string;
|
|
8
|
+
collections?: Collection[];
|
|
9
|
+
}
|
|
10
|
+
export interface Collection {
|
|
11
|
+
name: string;
|
|
12
|
+
[key: string]: any;
|
|
13
|
+
}
|
|
14
|
+
export default function strifeIntegration(options?: IntegrationOptions): AstroIntegration;
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { loadEnv as f } from "vite";
|
|
2
|
-
import
|
|
2
|
+
import a 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
|
|
@@ -7,242 +7,293 @@ const y = `/**
|
|
|
7
7
|
* @returns a new object to index and store
|
|
8
8
|
*/
|
|
9
9
|
function storeAs(name, value) {
|
|
10
|
-
|
|
10
|
+
return {
|
|
11
11
|
$value: value,
|
|
12
12
|
$name: name,
|
|
13
|
-
$options: { storage: true }
|
|
14
|
-
|
|
15
|
-
}
|
|
13
|
+
$options: { storage: true },
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
16
|
|
|
17
|
-
/**
|
|
18
|
-
* Create an indexed item without storing value in the index.
|
|
19
|
-
* @param {string} name - Name of the property to index
|
|
20
|
-
* @param {any} value - The value to index
|
|
21
|
-
* @returns a new object to index (no store)
|
|
22
|
-
*/
|
|
23
|
-
function indexAs(name, value) {
|
|
24
|
-
|
|
17
|
+
/**
|
|
18
|
+
* Create an indexed item without storing value in the index.
|
|
19
|
+
* @param {string} name - Name of the property to index
|
|
20
|
+
* @param {any} value - The value to index
|
|
21
|
+
* @returns a new object to index (no store)
|
|
22
|
+
*/
|
|
23
|
+
function indexAs(name, value) {
|
|
24
|
+
return {
|
|
25
25
|
$value: value,
|
|
26
26
|
$name: name,
|
|
27
|
-
$options: { storage: false }
|
|
28
|
-
|
|
29
|
-
}
|
|
27
|
+
$options: { storage: false },
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
30
|
|
|
31
|
-
/**
|
|
32
|
-
* Loads the documents referenced by reference objects in the array
|
|
33
|
-
* @param {any} references - Array of document references: { id, collection }
|
|
34
|
-
* @returns The list of loaded documents.
|
|
35
|
-
*/
|
|
36
|
-
function loadRelatedDocuments(references) {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
.filter(item => typeof item.id ===
|
|
40
|
-
.map(item => load(item.id, 'Labels'))
|
|
31
|
+
/**
|
|
32
|
+
* Loads the documents referenced by reference objects in the array
|
|
33
|
+
* @param {any} references - Array of document references: { id, collection }
|
|
34
|
+
* @returns The list of loaded documents.
|
|
35
|
+
*/
|
|
36
|
+
function loadRelatedDocuments(references) {
|
|
37
|
+
if (references == null) return null;
|
|
38
|
+
return references
|
|
39
|
+
.filter((item) => typeof item.id === 'string') // Ensure each ID is a string
|
|
40
|
+
.map((item) => load(item.id, 'Labels'))
|
|
41
41
|
.filter(Boolean); // Filter out any null/undefined values
|
|
42
|
-
}
|
|
43
|
-
|
|
42
|
+
}
|
|
44
43
|
|
|
45
|
-
/**
|
|
46
|
-
* Builds an url for a document by traversing its ancestor origins
|
|
47
|
-
* @param {*} doc - The leaf document
|
|
48
|
-
* @returns The full url of the document
|
|
49
|
-
*/
|
|
50
|
-
function buildUrl(doc) {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
44
|
+
/**
|
|
45
|
+
* Builds an url for a document by traversing its ancestor origins
|
|
46
|
+
* @param {*} doc - The leaf document
|
|
47
|
+
* @returns The full url of the document
|
|
48
|
+
*/
|
|
49
|
+
function buildUrl(doc) {
|
|
50
|
+
const visited = {};
|
|
51
|
+
const slugs = [];
|
|
52
|
+
let c = doc;
|
|
54
53
|
|
|
55
|
-
|
|
54
|
+
do {
|
|
56
55
|
if (c.slug) {
|
|
57
|
-
|
|
56
|
+
slugs.unshift(c.slug);
|
|
58
57
|
}
|
|
59
58
|
if (!c.origin || visited[c.origin.id]) break;
|
|
60
59
|
visited[c.origin.id] = true;
|
|
61
60
|
c = load(c.origin.id, c.origin.collection);
|
|
62
|
-
|
|
61
|
+
} while (c);
|
|
63
62
|
|
|
64
|
-
|
|
65
|
-
}
|
|
63
|
+
return slugs.shift() + slugs.join('/');
|
|
64
|
+
}
|
|
66
65
|
|
|
67
|
-
/**
|
|
68
|
-
* Editor types that contains {collection, id} references that we want to load
|
|
69
|
-
*/
|
|
70
|
-
const RELATION_EDITORS = [
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* Loads the template document of the specified document
|
|
74
|
-
* @param {any} document - The document to index
|
|
75
|
-
* @returns The document's template, loaded
|
|
76
|
-
*/
|
|
77
|
-
function loadTemplate(document) {
|
|
78
|
-
const collection = document['@metadata']['@collection'];
|
|
79
|
-
const template = load('templates/' + collection, 'templates');
|
|
80
|
-
return template;
|
|
81
|
-
}
|
|
66
|
+
/**
|
|
67
|
+
* Editor types that contains {collection, id} references that we want to load
|
|
68
|
+
*/
|
|
69
|
+
const RELATION_EDITORS = ['related', 'references'];
|
|
82
70
|
|
|
83
|
-
/**
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
71
|
+
/**
|
|
72
|
+
* Loads the template document of the specified document
|
|
73
|
+
* @param {any} document - The document to index
|
|
74
|
+
* @returns The document's template, loaded
|
|
75
|
+
*/
|
|
76
|
+
function loadTemplate(document) {
|
|
77
|
+
const collection = document['@metadata']['@collection'];
|
|
78
|
+
const template = load('templates/' + collection, 'templates');
|
|
79
|
+
return template;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Loads the metadata template
|
|
84
|
+
* @returns The metadata template
|
|
85
|
+
*/
|
|
86
|
+
function loadMetadataTemplate() {
|
|
87
|
+
const template = load('templates/metadata', 'templates');
|
|
88
|
+
return template;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Iterates the template's editors and copies the respective values to the
|
|
93
|
+
* result object. Properties containing references are resolved recursively.
|
|
94
|
+
* Mutually recursive with \`loadRelatedDocumentsRecurse\`.
|
|
95
|
+
* @param {*} document - The document to extract values from
|
|
96
|
+
* @param {*} template - The document's template
|
|
97
|
+
* @param {*} metadataTemplate - The metadata template
|
|
98
|
+
* @param {*} result - The populated result
|
|
99
|
+
*/
|
|
100
|
+
function populateValuesByEditor(document, template, metadataTemplate, result, loadedDocs) {
|
|
101
|
+
const aggregatedEditors = template.editors.concat(metadataTemplate.editors);
|
|
102
|
+
// Add dynamic fields and handle "related" type
|
|
103
|
+
aggregatedEditors.forEach((editor) => {
|
|
94
104
|
if (editor.editor && editor.editor.propertyName) {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
105
|
+
const propertyName = editor.editor.propertyName;
|
|
106
|
+
|
|
107
|
+
if (RELATION_EDITORS.includes(editor.editor.type) && Array.isArray(document[propertyName])) {
|
|
108
|
+
// Load related documents in the array of document references
|
|
109
|
+
const relatedDocs = loadRelatedDocumentsRecurse(document[propertyName], metadataTemplate, loadedDocs);
|
|
110
|
+
result[propertyName] = relatedDocs;
|
|
111
|
+
} else if (editor.editor.type === 'content-template') {
|
|
112
|
+
const content = document[propertyName];
|
|
113
|
+
if (content) {
|
|
114
|
+
const contentTemplate = load(editor.editor.attributes.templateId, 'templates');
|
|
115
|
+
const docResult = {};
|
|
116
|
+
populateValuesByEditor(content, contentTemplate, metadataTemplate, docResult, loadedDocs);
|
|
117
|
+
result[propertyName] = docResult;
|
|
104
118
|
}
|
|
119
|
+
} else if (editor.editor.type === 'chapters') {
|
|
120
|
+
const chapters = document[propertyName];
|
|
121
|
+
if (chapters && Array.isArray(chapters)) {
|
|
122
|
+
const docResults = [];
|
|
123
|
+
chapters.forEach((chapter) => {
|
|
124
|
+
if (chapter['@strife'] && chapter['@strife'].templateId) {
|
|
125
|
+
const docResult = {};
|
|
126
|
+
const chaptersTemplate = load(chapter['@strife'].templateId, 'templates');
|
|
127
|
+
populateValuesByEditor(chapter, chaptersTemplate, metadataTemplate, docResult, loadedDocs);
|
|
128
|
+
docResults.push(docResult);
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
result[propertyName] = docResults;
|
|
132
|
+
}
|
|
133
|
+
} else if (document[propertyName] !== undefined) {
|
|
134
|
+
// For other types, index the field value directly
|
|
135
|
+
result[propertyName] = document[propertyName];
|
|
136
|
+
}
|
|
105
137
|
}
|
|
106
|
-
|
|
107
|
-
|
|
138
|
+
});
|
|
139
|
+
if (document['@strife']) {
|
|
108
140
|
result['@strife'] = document['@strife'];
|
|
141
|
+
}
|
|
109
142
|
}
|
|
110
|
-
}
|
|
111
143
|
|
|
112
|
-
/**
|
|
113
|
-
* Loads the documents referenced by the array of references. Mutually recursive
|
|
114
|
-
* with \`populateValuesByEditor\`.
|
|
115
|
-
* @param {*} references - List of references to load.
|
|
116
|
-
* @returns
|
|
117
|
-
*/
|
|
118
|
-
function loadRelatedDocumentsRecurse(references) {
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
.map(id =>
|
|
123
|
-
|
|
144
|
+
/**
|
|
145
|
+
* Loads the documents referenced by the array of references. Mutually recursive
|
|
146
|
+
* with \`populateValuesByEditor\`.
|
|
147
|
+
* @param {*} references - List of references to load.
|
|
148
|
+
* @returns
|
|
149
|
+
*/
|
|
150
|
+
function loadRelatedDocumentsRecurse(references, metadataTemplate, loadedDocs) {
|
|
151
|
+
if (references == null) return null;
|
|
152
|
+
const documents = references
|
|
153
|
+
.map((id) => (typeof id === 'string' ? id : id.id))
|
|
154
|
+
.map((id) => {
|
|
155
|
+
if (loadedDocs.has(id)) return null;
|
|
156
|
+
|
|
157
|
+
const aDoc = load(id, '@all_docs');
|
|
158
|
+
|
|
159
|
+
if (aDoc) {
|
|
160
|
+
loadedDocs.add(id);
|
|
161
|
+
}
|
|
162
|
+
return aDoc;
|
|
163
|
+
})
|
|
124
164
|
.filter(Boolean); // Filter out any null/undefined values
|
|
125
165
|
|
|
126
|
-
|
|
127
|
-
|
|
166
|
+
const docResults = [];
|
|
167
|
+
documents.forEach((doc) => {
|
|
128
168
|
const template = loadTemplate(doc);
|
|
129
169
|
const docResult = {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
170
|
+
id: Id(doc),
|
|
171
|
+
url: buildUrl(doc),
|
|
172
|
+
collection: doc['@metadata']['@collection'],
|
|
173
|
+
labels: loadRelatedDocuments(
|
|
174
|
+
doc.labels.map((l) => {
|
|
175
|
+
return { id: l, collection: 'Labels' };
|
|
176
|
+
}),
|
|
177
|
+
),
|
|
135
178
|
};
|
|
136
|
-
populateValuesByEditor(doc, template, docResult);
|
|
137
|
-
docResults.push(docResult)
|
|
138
|
-
|
|
179
|
+
populateValuesByEditor(doc, template, metadataTemplate, docResult, loadedDocs);
|
|
180
|
+
docResults.push(docResult);
|
|
181
|
+
});
|
|
139
182
|
|
|
140
|
-
|
|
141
|
-
}
|
|
183
|
+
return docResults;
|
|
184
|
+
}
|
|
142
185
|
|
|
143
|
-
/**
|
|
144
|
-
* Maps a document to an index entry for Strife's content index
|
|
145
|
-
* @param {any} document - The document to index
|
|
146
|
-
* @returns An object to be indexed by RavenDB
|
|
147
|
-
*/
|
|
148
|
-
function mapDocument(document) {
|
|
149
|
-
|
|
150
|
-
|
|
186
|
+
/**
|
|
187
|
+
* Maps a document to an index entry for Strife's content index
|
|
188
|
+
* @param {any} document - The document to index
|
|
189
|
+
* @returns An object to be indexed by RavenDB
|
|
190
|
+
*/
|
|
191
|
+
function mapDocument(document) {
|
|
192
|
+
const collection = document['@metadata']['@collection'];
|
|
193
|
+
const template = load('templates/' + collection, 'templates');
|
|
151
194
|
|
|
152
|
-
|
|
195
|
+
if (!template || !template.editors || document.deleted || document.archived) {
|
|
153
196
|
return null;
|
|
154
|
-
|
|
197
|
+
}
|
|
155
198
|
|
|
156
|
-
|
|
157
|
-
|
|
199
|
+
const metadataTemplate = loadMetadataTemplate();
|
|
200
|
+
|
|
201
|
+
// Initialize result with static fields
|
|
202
|
+
const result = {
|
|
158
203
|
id: Id(document),
|
|
159
204
|
displayName: document.displayName,
|
|
160
205
|
url: storeAs('url', buildUrl(document)),
|
|
161
206
|
origin: document.origin,
|
|
162
207
|
collection: storeAs('collection', collection),
|
|
163
|
-
publishedDate: document.publishedDate,
|
|
164
|
-
createdAt: document.createdAt,
|
|
165
|
-
|
|
166
|
-
|
|
208
|
+
publishedDate: storeAs('publishedAt', document.publishedDate),
|
|
209
|
+
createdAt: storeAs('createdAt', document.createdAt),
|
|
210
|
+
changedAt: storeAs('changedAt', document.changedAt),
|
|
211
|
+
labels: storeAs(
|
|
212
|
+
'labels',
|
|
213
|
+
loadRelatedDocuments(
|
|
214
|
+
document.labels.map((l) => {
|
|
215
|
+
return { id: l, collection: 'Labels' };
|
|
216
|
+
}),
|
|
217
|
+
),
|
|
218
|
+
),
|
|
167
219
|
deleted: document.deleted,
|
|
168
|
-
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
// Keep tabs of loaded documents to avoid infinite recursion
|
|
223
|
+
const loadedDocuments = new Set(result.id);
|
|
169
224
|
|
|
170
|
-
|
|
171
|
-
|
|
225
|
+
// Add dynamic fields and handle "related" type
|
|
226
|
+
template.editors.forEach((editor) => {
|
|
172
227
|
if (editor.editor && editor.editor.propertyName) {
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
}
|
|
187
|
-
} else if (editor.editor.type === 'chapters') {
|
|
188
|
-
const chapters = document[propertyName];
|
|
189
|
-
if (chapters && Array.isArray(chapters)) {
|
|
190
|
-
const docResults = [];
|
|
191
|
-
chapters.forEach(chapter => {
|
|
192
|
-
if (chapter['@strife'] && chapter['@strife'].templateId) {
|
|
193
|
-
const docResult = {};
|
|
194
|
-
const template = load(chapter['@strife'].templateId, 'templates');
|
|
195
|
-
populateValuesByEditor(chapter, template, docResult);
|
|
196
|
-
docResults.push(docResult);
|
|
197
|
-
}
|
|
198
|
-
});
|
|
199
|
-
result[propertyName] = storeAs(propertyName, docResults);
|
|
200
|
-
}
|
|
228
|
+
const propertyName = editor.editor.propertyName;
|
|
229
|
+
|
|
230
|
+
if (RELATION_EDITORS.includes(editor.editor.type) && Array.isArray(document[propertyName])) {
|
|
231
|
+
// Load related documents in the array of document references
|
|
232
|
+
const relatedDocs = loadRelatedDocumentsRecurse(document[propertyName], metadataTemplate, loadedDocuments);
|
|
233
|
+
result[propertyName] = storeAs(propertyName, relatedDocs);
|
|
234
|
+
} else if (editor.editor.type === 'content-template') {
|
|
235
|
+
const content = document[propertyName];
|
|
236
|
+
if (content) {
|
|
237
|
+
const template = load(editor.editor.attributes.templateId, 'templates');
|
|
238
|
+
const docResult = {};
|
|
239
|
+
populateValuesByEditor(content, template, metadataTemplate, docResult, loadedDocuments);
|
|
240
|
+
result[propertyName] = storeAs(propertyName, docResult);
|
|
201
241
|
}
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
242
|
+
} else if (editor.editor.type === 'chapters') {
|
|
243
|
+
const chapters = document[propertyName];
|
|
244
|
+
if (chapters && Array.isArray(chapters)) {
|
|
245
|
+
const docResults = [];
|
|
246
|
+
chapters.forEach((chapter) => {
|
|
247
|
+
if (chapter['@strife'] && chapter['@strife'].templateId) {
|
|
248
|
+
const docResult = {};
|
|
249
|
+
const template = load(chapter['@strife'].templateId, 'templates');
|
|
250
|
+
populateValuesByEditor(chapter, template, metadataTemplate, docResult, loadedDocuments);
|
|
251
|
+
docResults.push(docResult);
|
|
252
|
+
}
|
|
253
|
+
});
|
|
254
|
+
result[propertyName] = storeAs(propertyName, docResults);
|
|
205
255
|
}
|
|
256
|
+
} else if (document[propertyName] !== undefined) {
|
|
257
|
+
// For other types, index the field value directly
|
|
258
|
+
result[propertyName] = indexAs(propertyName, document[propertyName]);
|
|
259
|
+
}
|
|
206
260
|
}
|
|
207
|
-
|
|
261
|
+
});
|
|
208
262
|
|
|
209
|
-
|
|
210
|
-
}
|
|
211
|
-
`, d = "strife:store", s = "\0" + d;
|
|
263
|
+
return result;
|
|
264
|
+
}`, l = "strife:store", d = "\0" + l;
|
|
212
265
|
function h(e) {
|
|
213
266
|
return {
|
|
214
267
|
name: "strife:store",
|
|
215
|
-
resolveId(
|
|
216
|
-
if (
|
|
217
|
-
return
|
|
268
|
+
resolveId(o) {
|
|
269
|
+
if (o === l)
|
|
270
|
+
return d;
|
|
218
271
|
},
|
|
219
|
-
load(
|
|
272
|
+
load(o) {
|
|
220
273
|
var t;
|
|
221
|
-
if (
|
|
274
|
+
if (o === d)
|
|
222
275
|
return `
|
|
223
276
|
import { DocumentStore, AbstractJavaScriptMultiMapIndexCreationTask, IndexCreation } from "ravendb";
|
|
224
277
|
|
|
225
278
|
const authOptions = {
|
|
226
279
|
type: 'pfx',
|
|
227
|
-
certificate: Buffer.from(${
|
|
228
|
-
password: ${
|
|
280
|
+
certificate: Buffer.from(${a(e.certificate)}, 'base64'),
|
|
281
|
+
password: ${a(e.password)},
|
|
229
282
|
};
|
|
230
283
|
|
|
231
284
|
const store = new DocumentStore(
|
|
232
|
-
${
|
|
233
|
-
${
|
|
285
|
+
${a(e.urls ? e.urls : [])},
|
|
286
|
+
${a(e.database || "")},
|
|
234
287
|
authOptions
|
|
235
288
|
).initialize()
|
|
236
289
|
|
|
237
|
-
class
|
|
290
|
+
class Content_ByUrl extends AbstractJavaScriptMultiMapIndexCreationTask {
|
|
238
291
|
constructor() {
|
|
239
292
|
super();
|
|
240
293
|
|
|
241
|
-
this.additionalSources = {"Helper": ${
|
|
294
|
+
this.additionalSources = {"Helper": ${a(y)}}
|
|
242
295
|
|
|
243
|
-
${(e.collections || ["Posts"]).map(
|
|
244
|
-
(o) => `this.map("${o.name}", (doc) => mapDocument(doc));`
|
|
245
|
-
).join(`
|
|
296
|
+
${(e.collections || ["Posts"]).map((n) => `this.map("${typeof n == "string" ? n : n.name}", (doc) => mapDocument(doc));`).join(`
|
|
246
297
|
`)}
|
|
247
298
|
|
|
248
299
|
this.deploymentMode = 'Rolling';
|
|
@@ -251,12 +302,13 @@ function h(e) {
|
|
|
251
302
|
}
|
|
252
303
|
|
|
253
304
|
console.log('Deploying index...');
|
|
254
|
-
|
|
305
|
+
|
|
306
|
+
await IndexCreation.createIndexes([new Content_ByUrl()], store);
|
|
255
307
|
|
|
256
308
|
const bulkInsert = store.bulkInsert();
|
|
257
309
|
|
|
258
|
-
${(t = e.collections) == null ? void 0 : t.map((
|
|
259
|
-
bulkInsert.store(${
|
|
310
|
+
${(t = e.collections) == null ? void 0 : t.map((n) => `
|
|
311
|
+
await bulkInsert.store(${JSON.stringify(n)}, 'templates/${n.name}', { '@collection': 'Templates' });
|
|
260
312
|
`).join(`
|
|
261
313
|
`)}
|
|
262
314
|
|
|
@@ -267,33 +319,33 @@ function h(e) {
|
|
|
267
319
|
}
|
|
268
320
|
};
|
|
269
321
|
}
|
|
270
|
-
const
|
|
322
|
+
const T = {
|
|
271
323
|
type: "pfx"
|
|
272
324
|
};
|
|
273
|
-
function
|
|
274
|
-
let
|
|
325
|
+
function D(e) {
|
|
326
|
+
let o, t;
|
|
275
327
|
return {
|
|
276
328
|
name: "@strife/astro",
|
|
277
329
|
hooks: {
|
|
278
|
-
"astro:config:setup": ({ command:
|
|
279
|
-
var
|
|
280
|
-
|
|
281
|
-
const
|
|
282
|
-
urls: (
|
|
330
|
+
"astro:config:setup": ({ command: n, config: r, updateConfig: c }) => {
|
|
331
|
+
var s;
|
|
332
|
+
o = n, t = f(o, r.vite.envDir ?? "", "");
|
|
333
|
+
const i = {
|
|
334
|
+
urls: (s = t.STRIFE_DATABASE_URLS) == null ? void 0 : s.split(","),
|
|
283
335
|
database: t.STRIFE_DATABASE,
|
|
284
336
|
certificate: t.STRIFE_CERTIFICATE,
|
|
285
337
|
password: t.STRIFE_CERTIFICATE_PASSWORD
|
|
286
338
|
}, u = Object.fromEntries(
|
|
287
|
-
Object.entries(
|
|
339
|
+
Object.entries(i).filter(([R, m]) => m !== void 0)
|
|
288
340
|
), p = {
|
|
289
|
-
...
|
|
341
|
+
...T,
|
|
290
342
|
// Base defaults
|
|
291
343
|
...u,
|
|
292
344
|
// Environment variables override defaults
|
|
293
345
|
...e
|
|
294
346
|
// Explicit options override everything
|
|
295
347
|
};
|
|
296
|
-
|
|
348
|
+
c({
|
|
297
349
|
vite: {
|
|
298
350
|
plugins: [
|
|
299
351
|
h(p)
|
|
@@ -305,5 +357,5 @@ function A(e = {}) {
|
|
|
305
357
|
};
|
|
306
358
|
}
|
|
307
359
|
export {
|
|
308
|
-
|
|
360
|
+
D as default
|
|
309
361
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './vite-plugin-strife-store';
|
package/package.json
CHANGED
|
@@ -1,20 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@strifeapp/astro",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.8",
|
|
4
4
|
"description": "Official Strife Astro integration",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"astro-integration",
|
|
7
7
|
"withastro",
|
|
8
8
|
"strife"
|
|
9
9
|
],
|
|
10
|
-
"main": "dist/index.js",
|
|
11
|
-
"
|
|
10
|
+
"main": "./dist/index.js",
|
|
11
|
+
"module": "./dist/index.js",
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
12
13
|
"type": "module",
|
|
13
14
|
"scripts": {
|
|
14
|
-
"
|
|
15
|
+
"clean": "rm -rf dist",
|
|
16
|
+
"build": "npm run clean && vite build",
|
|
17
|
+
"prepublishOnly": "npm run build"
|
|
15
18
|
},
|
|
16
19
|
"exports": {
|
|
17
|
-
".":
|
|
20
|
+
".": {
|
|
21
|
+
"import": "./dist/index.js",
|
|
22
|
+
"types": "./dist/index.d.ts"
|
|
23
|
+
},
|
|
18
24
|
"./vite-plugin-strife-store": "./dist/vite-plugin-strife-store-entry.js",
|
|
19
25
|
"./module": "./module.d.ts"
|
|
20
26
|
},
|
|
@@ -29,6 +35,7 @@
|
|
|
29
35
|
},
|
|
30
36
|
"devDependencies": {
|
|
31
37
|
"@types/dotenv": "^8.2.0",
|
|
38
|
+
"rimraf": "^6.0.1",
|
|
32
39
|
"typescript": "^5.7.3",
|
|
33
40
|
"vite": "^6.2.1",
|
|
34
41
|
"vite-plugin-dts": "^4.5.3"
|
|
@@ -36,5 +43,10 @@
|
|
|
36
43
|
"peerDependencies": {
|
|
37
44
|
"astro": "^4.0.0 || ^5.0.0",
|
|
38
45
|
"ravendb": "^6.0.0"
|
|
46
|
+
},
|
|
47
|
+
"compilerOptions": {
|
|
48
|
+
"declaration": true,
|
|
49
|
+
"emitDeclarationOnly": false,
|
|
50
|
+
"outDir": "dist"
|
|
39
51
|
}
|
|
40
52
|
}
|