@lwrjs/core 0.4.5 → 0.5.1
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/LICENSE
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
MIT LICENSE
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020, Salesforce.com, Inc.
|
|
4
|
+
All rights reserved.
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
7
|
+
|
|
8
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
9
|
+
|
|
10
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -55,8 +55,9 @@ function apiMiddleware(app, context) {
|
|
|
55
55
|
res.status(400).send({error: `Environment "${targetEnvironment}" is not supported`});
|
|
56
56
|
return;
|
|
57
57
|
}
|
|
58
|
-
|
|
58
|
+
let moduleId, signature;
|
|
59
59
|
try {
|
|
60
|
+
({moduleId, signature} = (0, import_shared_utils.getModuleIdentity)(req));
|
|
60
61
|
const sourceMapUrl = req.path.replace("/bundle/", "/sourcemaps/bundle/");
|
|
61
62
|
const sourceMapRuntimeContext = {...runtimeEnvironment, sourceMapUrl};
|
|
62
63
|
const importerSpecifier = req.query.importer;
|
|
@@ -101,7 +102,7 @@ function apiMiddleware(app, context) {
|
|
|
101
102
|
res.type("application/javascript").send(bundleDef.code);
|
|
102
103
|
} catch (e) {
|
|
103
104
|
console.log(e);
|
|
104
|
-
const error = (0, import_utils.createReturnStatus)(`bundle for "${moduleId.specifier}"`, e);
|
|
105
|
+
const error = (0, import_utils.createReturnStatus)(`bundle for "${moduleId?.specifier || req.params?.specifier}"`, e);
|
|
105
106
|
res.status(error.status).send(error.message);
|
|
106
107
|
}
|
|
107
108
|
});
|
|
@@ -117,9 +118,9 @@ function apiMiddleware(app, context) {
|
|
|
117
118
|
res.status(400).send({error: `Environment "${targetEnvironment}" is not supported`});
|
|
118
119
|
return;
|
|
119
120
|
}
|
|
120
|
-
|
|
121
|
-
let moduleId = id.moduleId;
|
|
121
|
+
let moduleId;
|
|
122
122
|
try {
|
|
123
|
+
({moduleId} = (0, import_shared_utils.getModuleIdentity)(req));
|
|
123
124
|
const importerSpecifier = req.query.importer;
|
|
124
125
|
if (importerSpecifier) {
|
|
125
126
|
const importerModuleId = (0, import_shared_utils.explodeSpecifier)(importerSpecifier);
|
|
@@ -142,7 +143,7 @@ function apiMiddleware(app, context) {
|
|
|
142
143
|
}
|
|
143
144
|
} catch (e) {
|
|
144
145
|
console.log(e);
|
|
145
|
-
const error = (0, import_utils.createReturnStatus)(`bundle for "${moduleId.specifier}"`, e);
|
|
146
|
+
const error = (0, import_utils.createReturnStatus)(`bundle for "${moduleId?.specifier || req.params?.specifier}"`, e);
|
|
146
147
|
res.status(error.status).send(error.message);
|
|
147
148
|
}
|
|
148
149
|
});
|
|
@@ -163,8 +164,9 @@ function apiMiddleware(app, context) {
|
|
|
163
164
|
res.status(400).send({error: `Environment "${targetEnvironment}" is not supported`});
|
|
164
165
|
return;
|
|
165
166
|
}
|
|
166
|
-
|
|
167
|
+
let moduleId, signature;
|
|
167
168
|
try {
|
|
169
|
+
({moduleId, signature} = (0, import_shared_utils.getModuleIdentity)(req));
|
|
168
170
|
const bundleDef = await moduleBundler.getModuleBundle(moduleId, runtimeEnvironment);
|
|
169
171
|
if (signature !== import_shared_utils.LATEST_SIGNATURE) {
|
|
170
172
|
res.setHeader("Cache-control", "public, max-age=31536000, immutable");
|
|
@@ -172,7 +174,7 @@ function apiMiddleware(app, context) {
|
|
|
172
174
|
res.type("application/json").send(bundleDef.map);
|
|
173
175
|
} catch (e) {
|
|
174
176
|
console.log(e);
|
|
175
|
-
const error = (0, import_utils.createReturnStatus)(`bundle sourcemap for "${moduleId.specifier}"`, e);
|
|
177
|
+
const error = (0, import_utils.createReturnStatus)(`bundle sourcemap for "${moduleId?.specifier || req.params?.specifier}"`, e);
|
|
176
178
|
res.status(error.status).send(error.message);
|
|
177
179
|
}
|
|
178
180
|
});
|
|
@@ -192,8 +194,9 @@ function apiMiddleware(app, context) {
|
|
|
192
194
|
res.status(400).send({error: `Environment "${targetEnvironment}" is not supported`});
|
|
193
195
|
return;
|
|
194
196
|
}
|
|
195
|
-
|
|
197
|
+
let moduleId, signature;
|
|
196
198
|
try {
|
|
199
|
+
({moduleId, signature} = (0, import_shared_utils.getModuleIdentity)(req));
|
|
197
200
|
if (!req.validateJsonRequest()) {
|
|
198
201
|
throw (0, import_diagnostics.createSingleDiagnosticError)({description: errors.INVALID_JSON()}, import_diagnostics.LwrUnresolvableError);
|
|
199
202
|
}
|
|
@@ -213,7 +216,7 @@ function apiMiddleware(app, context) {
|
|
|
213
216
|
}
|
|
214
217
|
} catch (e) {
|
|
215
218
|
console.log(e);
|
|
216
|
-
const error = (0, import_utils.createReturnStatus)(`module "${moduleId.specifier}"`, e);
|
|
219
|
+
const error = (0, import_utils.createReturnStatus)(`module "${moduleId?.specifier || req.params?.specifier}"`, e);
|
|
217
220
|
res.status(error.status).send(error.message);
|
|
218
221
|
}
|
|
219
222
|
});
|
|
@@ -229,9 +232,9 @@ function apiMiddleware(app, context) {
|
|
|
229
232
|
res.status(400).send({error: `Environment "${targetEnvironment}" is not supported`});
|
|
230
233
|
return;
|
|
231
234
|
}
|
|
232
|
-
|
|
233
|
-
let moduleId = id.moduleId;
|
|
235
|
+
let moduleId;
|
|
234
236
|
try {
|
|
237
|
+
({moduleId} = (0, import_shared_utils.getModuleIdentity)(req));
|
|
235
238
|
const importerSpecifier = req.query.importer;
|
|
236
239
|
if (importerSpecifier) {
|
|
237
240
|
const importerModuleId = (0, import_shared_utils.explodeSpecifier)(importerSpecifier);
|
|
@@ -254,7 +257,7 @@ function apiMiddleware(app, context) {
|
|
|
254
257
|
}
|
|
255
258
|
} catch (e) {
|
|
256
259
|
console.log(e);
|
|
257
|
-
const error = (0, import_utils.createReturnStatus)(`module "${moduleId.specifier}"`, e);
|
|
260
|
+
const error = (0, import_utils.createReturnStatus)(`module "${moduleId?.specifier || req.params?.specifier}"`, e);
|
|
258
261
|
res.status(error.status).send(error.message);
|
|
259
262
|
}
|
|
260
263
|
});
|
|
@@ -270,14 +273,15 @@ function apiMiddleware(app, context) {
|
|
|
270
273
|
res.status(400).send({error: `Environment "${targetEnvironment}" is not supported`});
|
|
271
274
|
return;
|
|
272
275
|
}
|
|
273
|
-
|
|
276
|
+
let moduleIds;
|
|
274
277
|
try {
|
|
278
|
+
({moduleIds} = (0, import_shared_utils.getMappingIdentity)(req));
|
|
275
279
|
const {runtimeEnvironment, runtimeParams} = requestContext;
|
|
276
280
|
const importMetadata = await (0, import_shared_utils.getImportMetadataMappings)(moduleIds, runtimeEnvironment, runtimeParams, moduleRegistry, moduleBundler);
|
|
277
281
|
res.type("application/json").send(importMetadata);
|
|
278
282
|
} catch (e) {
|
|
279
283
|
console.log(e);
|
|
280
|
-
const error = (0, import_utils.createReturnStatus)(`mappings for "${JSON.stringify(moduleIds)}"`, e);
|
|
284
|
+
const error = (0, import_utils.createReturnStatus)(`mappings for "${JSON.stringify(moduleIds || req.params?.specifiers)}"`, e);
|
|
281
285
|
res.status(error.status).send(error.message);
|
|
282
286
|
}
|
|
283
287
|
});
|
|
@@ -293,8 +297,9 @@ function apiMiddleware(app, context) {
|
|
|
293
297
|
res.status(400).send({error: `Environment "${targetEnvironment}" is not supported`});
|
|
294
298
|
return;
|
|
295
299
|
}
|
|
296
|
-
|
|
300
|
+
let resourceId;
|
|
297
301
|
try {
|
|
302
|
+
({resourceId} = (0, import_shared_utils.getResourceIdentity)(req));
|
|
298
303
|
const resource = await resourceRegistry.getResource(resourceId, runtimeEnvironment, runtimeParams);
|
|
299
304
|
if (resource && resource.content) {
|
|
300
305
|
const type = resource.type === "text/css" ? resource.type : "application/javascript";
|
|
@@ -307,7 +312,7 @@ function apiMiddleware(app, context) {
|
|
|
307
312
|
res.setMetadata({resource});
|
|
308
313
|
} catch (e) {
|
|
309
314
|
console.log(e);
|
|
310
|
-
const error = (0, import_utils.createReturnStatus)(`resource "${resourceId.specifier}"`, e);
|
|
315
|
+
const error = (0, import_utils.createReturnStatus)(`resource "${resourceId?.specifier || req.params?.specifier}"`, e);
|
|
311
316
|
res.status(error.status).send(error.message);
|
|
312
317
|
}
|
|
313
318
|
});
|
|
@@ -10,6 +10,7 @@ function normalizeRoutesBootstrap({ routes, errorRoutes }) {
|
|
|
10
10
|
}
|
|
11
11
|
export async function runConfigurationsHook(hookPlugins, lwrConfig, dataConfig, runtimeConfig) {
|
|
12
12
|
for (const hookPlugin of hookPlugins) {
|
|
13
|
+
// eslint-disable-next-line no-await-in-loop
|
|
13
14
|
await hookPlugin.initConfigs(lwrConfig, dataConfig, runtimeConfig);
|
|
14
15
|
}
|
|
15
16
|
validateLwrAppConfig(JSON.stringify(lwrConfig), 'post');
|
|
@@ -27,8 +27,9 @@ export default function apiMiddleware(app, context) {
|
|
|
27
27
|
res.status(400).send({ error: `Environment "${targetEnvironment}" is not supported` });
|
|
28
28
|
return;
|
|
29
29
|
}
|
|
30
|
-
|
|
30
|
+
let moduleId, signature;
|
|
31
31
|
try {
|
|
32
|
+
({ moduleId, signature } = getModuleIdentity(req));
|
|
32
33
|
const sourceMapUrl = req.path.replace('/bundle/', '/sourcemaps/bundle/');
|
|
33
34
|
const sourceMapRuntimeContext = { ...runtimeEnvironment, sourceMapUrl };
|
|
34
35
|
// Redirect module requests to the concrete URL when requested with an importer
|
|
@@ -62,7 +63,9 @@ export default function apiMiddleware(app, context) {
|
|
|
62
63
|
if (bundleDef.bundleRecord.imports) {
|
|
63
64
|
for (let index = 0; index < bundleDef.bundleRecord.imports.length; index++) {
|
|
64
65
|
const theImport = bundleDef.bundleRecord.imports[index];
|
|
66
|
+
// eslint-disable-next-line no-await-in-loop
|
|
65
67
|
const id = await getVersionedModuleId(theImport.specifier, moduleRegistry);
|
|
68
|
+
// eslint-disable-next-line no-await-in-loop
|
|
66
69
|
const uri = await moduleRegistry.resolveModuleUri(id, runtimeEnvironment, runtimeParams);
|
|
67
70
|
resolvedUris.push(uri);
|
|
68
71
|
}
|
|
@@ -70,7 +73,9 @@ export default function apiMiddleware(app, context) {
|
|
|
70
73
|
if (bundleDef.bundleRecord.dynamicImports) {
|
|
71
74
|
for (let index = 0; index < bundleDef.bundleRecord.dynamicImports.length; index++) {
|
|
72
75
|
const theImport = bundleDef.bundleRecord.dynamicImports[index];
|
|
76
|
+
// eslint-disable-next-line no-await-in-loop
|
|
73
77
|
const id = await getVersionedModuleId(theImport.specifier, moduleRegistry);
|
|
78
|
+
// eslint-disable-next-line no-await-in-loop
|
|
74
79
|
const uri = await moduleRegistry.resolveModuleUri(id, runtimeEnvironment, runtimeParams);
|
|
75
80
|
resolvedUris.push(uri);
|
|
76
81
|
}
|
|
@@ -81,7 +86,7 @@ export default function apiMiddleware(app, context) {
|
|
|
81
86
|
}
|
|
82
87
|
catch (e) {
|
|
83
88
|
console.log(e);
|
|
84
|
-
const error = createReturnStatus(`bundle for "${moduleId.specifier}"`, e);
|
|
89
|
+
const error = createReturnStatus(`bundle for "${moduleId?.specifier || req.params?.specifier}"`, e);
|
|
85
90
|
res.status(error.status).send(error.message);
|
|
86
91
|
}
|
|
87
92
|
});
|
|
@@ -102,9 +107,9 @@ export default function apiMiddleware(app, context) {
|
|
|
102
107
|
res.status(400).send({ error: `Environment "${targetEnvironment}" is not supported` });
|
|
103
108
|
return;
|
|
104
109
|
}
|
|
105
|
-
|
|
106
|
-
let moduleId = id.moduleId;
|
|
110
|
+
let moduleId;
|
|
107
111
|
try {
|
|
112
|
+
({ moduleId } = getModuleIdentity(req));
|
|
108
113
|
// Get the importer's specifier via the "importer" query param
|
|
109
114
|
const importerSpecifier = req.query.importer;
|
|
110
115
|
if (importerSpecifier) {
|
|
@@ -133,7 +138,7 @@ export default function apiMiddleware(app, context) {
|
|
|
133
138
|
}
|
|
134
139
|
catch (e) {
|
|
135
140
|
console.log(e);
|
|
136
|
-
const error = createReturnStatus(`bundle for "${moduleId.specifier}"`, e);
|
|
141
|
+
const error = createReturnStatus(`bundle for "${moduleId?.specifier || req.params?.specifier}"`, e);
|
|
137
142
|
res.status(error.status).send(error.message);
|
|
138
143
|
}
|
|
139
144
|
});
|
|
@@ -159,8 +164,9 @@ export default function apiMiddleware(app, context) {
|
|
|
159
164
|
res.status(400).send({ error: `Environment "${targetEnvironment}" is not supported` });
|
|
160
165
|
return;
|
|
161
166
|
}
|
|
162
|
-
|
|
167
|
+
let moduleId, signature;
|
|
163
168
|
try {
|
|
169
|
+
({ moduleId, signature } = getModuleIdentity(req));
|
|
164
170
|
const bundleDef = await moduleBundler.getModuleBundle(moduleId, runtimeEnvironment);
|
|
165
171
|
if (signature !== LATEST_SIGNATURE) {
|
|
166
172
|
res.setHeader('Cache-control', 'public, max-age=31536000, immutable');
|
|
@@ -169,7 +175,7 @@ export default function apiMiddleware(app, context) {
|
|
|
169
175
|
}
|
|
170
176
|
catch (e) {
|
|
171
177
|
console.log(e);
|
|
172
|
-
const error = createReturnStatus(`bundle sourcemap for "${moduleId.specifier}"`, e);
|
|
178
|
+
const error = createReturnStatus(`bundle sourcemap for "${moduleId?.specifier || req.params?.specifier}"`, e);
|
|
173
179
|
res.status(error.status).send(error.message);
|
|
174
180
|
}
|
|
175
181
|
});
|
|
@@ -195,8 +201,9 @@ export default function apiMiddleware(app, context) {
|
|
|
195
201
|
res.status(400).send({ error: `Environment "${targetEnvironment}" is not supported` });
|
|
196
202
|
return;
|
|
197
203
|
}
|
|
198
|
-
|
|
204
|
+
let moduleId, signature;
|
|
199
205
|
try {
|
|
206
|
+
({ moduleId, signature } = getModuleIdentity(req));
|
|
200
207
|
if (!req.validateJsonRequest()) {
|
|
201
208
|
throw createDiagnostic({ description: errors.INVALID_JSON() }, LwrUnresolvableError);
|
|
202
209
|
}
|
|
@@ -221,7 +228,7 @@ export default function apiMiddleware(app, context) {
|
|
|
221
228
|
}
|
|
222
229
|
catch (e) {
|
|
223
230
|
console.log(e);
|
|
224
|
-
const error = createReturnStatus(`module "${moduleId.specifier}"`, e);
|
|
231
|
+
const error = createReturnStatus(`module "${moduleId?.specifier || req.params?.specifier}"`, e);
|
|
225
232
|
res.status(error.status).send(error.message);
|
|
226
233
|
}
|
|
227
234
|
});
|
|
@@ -242,9 +249,9 @@ export default function apiMiddleware(app, context) {
|
|
|
242
249
|
res.status(400).send({ error: `Environment "${targetEnvironment}" is not supported` });
|
|
243
250
|
return;
|
|
244
251
|
}
|
|
245
|
-
|
|
246
|
-
let moduleId = id.moduleId;
|
|
252
|
+
let moduleId;
|
|
247
253
|
try {
|
|
254
|
+
({ moduleId } = getModuleIdentity(req));
|
|
248
255
|
// Get the importer's specifier via the "importer" query param
|
|
249
256
|
const importerSpecifier = req.query.importer;
|
|
250
257
|
if (importerSpecifier) {
|
|
@@ -273,7 +280,7 @@ export default function apiMiddleware(app, context) {
|
|
|
273
280
|
}
|
|
274
281
|
catch (e) {
|
|
275
282
|
console.log(e);
|
|
276
|
-
const error = createReturnStatus(`module "${moduleId.specifier}"`, e);
|
|
283
|
+
const error = createReturnStatus(`module "${moduleId?.specifier || req.params?.specifier}"`, e);
|
|
277
284
|
res.status(error.status).send(error.message);
|
|
278
285
|
}
|
|
279
286
|
});
|
|
@@ -295,15 +302,16 @@ export default function apiMiddleware(app, context) {
|
|
|
295
302
|
res.status(400).send({ error: `Environment "${targetEnvironment}" is not supported` });
|
|
296
303
|
return;
|
|
297
304
|
}
|
|
298
|
-
|
|
305
|
+
let moduleIds;
|
|
299
306
|
try {
|
|
307
|
+
({ moduleIds } = getMappingIdentity(req));
|
|
300
308
|
const { runtimeEnvironment, runtimeParams } = requestContext;
|
|
301
309
|
const importMetadata = await getImportMetadataMappings(moduleIds, runtimeEnvironment, runtimeParams, moduleRegistry, moduleBundler);
|
|
302
310
|
res.type('application/json').send(importMetadata);
|
|
303
311
|
}
|
|
304
312
|
catch (e) {
|
|
305
313
|
console.log(e);
|
|
306
|
-
const error = createReturnStatus(`mappings for "${JSON.stringify(moduleIds)}"`, e);
|
|
314
|
+
const error = createReturnStatus(`mappings for "${JSON.stringify(moduleIds || req.params?.specifiers)}"`, e);
|
|
307
315
|
res.status(error.status).send(error.message);
|
|
308
316
|
}
|
|
309
317
|
});
|
|
@@ -324,8 +332,9 @@ export default function apiMiddleware(app, context) {
|
|
|
324
332
|
res.status(400).send({ error: `Environment "${targetEnvironment}" is not supported` });
|
|
325
333
|
return;
|
|
326
334
|
}
|
|
327
|
-
|
|
335
|
+
let resourceId;
|
|
328
336
|
try {
|
|
337
|
+
({ resourceId } = getResourceIdentity(req));
|
|
329
338
|
const resource = await resourceRegistry.getResource(resourceId, runtimeEnvironment, runtimeParams);
|
|
330
339
|
if (resource && resource.content) {
|
|
331
340
|
// Static resource
|
|
@@ -343,7 +352,7 @@ export default function apiMiddleware(app, context) {
|
|
|
343
352
|
}
|
|
344
353
|
catch (e) {
|
|
345
354
|
console.log(e);
|
|
346
|
-
const error = createReturnStatus(`resource "${resourceId.specifier}"`, e);
|
|
355
|
+
const error = createReturnStatus(`resource "${resourceId?.specifier || req.params?.specifier}"`, e);
|
|
347
356
|
res.status(error.status).send(error.message);
|
|
348
357
|
}
|
|
349
358
|
});
|
|
@@ -43,6 +43,7 @@ export default class SiteGenerator {
|
|
|
43
43
|
const assetUrl = asset.override?.uri || asset.url;
|
|
44
44
|
// skip empty asset urls / data urls (i.e. <img src="" /> <img src="data:image/png;base64, iVBORw0..." />)
|
|
45
45
|
if (assetUrl && !assetUrl.startsWith('data:')) {
|
|
46
|
+
// eslint-disable-next-line no-await-in-loop
|
|
46
47
|
await this.dispatchResourceRecursive(assetUrl, dispatcher, { resourceType: 'asset', asset }, siteConfig);
|
|
47
48
|
}
|
|
48
49
|
}
|
|
@@ -51,6 +52,7 @@ export default class SiteGenerator {
|
|
|
51
52
|
for (const customElement of customElements) {
|
|
52
53
|
const jsUris = Object.values(customElement.flatGraph.uriMap);
|
|
53
54
|
for (const jsUri of jsUris) {
|
|
55
|
+
// eslint-disable-next-line no-await-in-loop
|
|
54
56
|
await this.dispatchResourceRecursive(jsUri, dispatcher, { resourceType: 'js' }, siteConfig);
|
|
55
57
|
}
|
|
56
58
|
}
|
|
@@ -59,6 +61,7 @@ export default class SiteGenerator {
|
|
|
59
61
|
const boot = viewDefinition.viewRecord.bootstrapModule;
|
|
60
62
|
const jsUris = Object.values(boot.flatGraph.uriMap);
|
|
61
63
|
for (const jsUri of jsUris) {
|
|
64
|
+
// eslint-disable-next-line no-await-in-loop
|
|
62
65
|
await this.dispatchResourceRecursive(jsUri, dispatcher, { resourceType: 'js' }, siteConfig);
|
|
63
66
|
}
|
|
64
67
|
}
|
|
@@ -69,6 +72,7 @@ export default class SiteGenerator {
|
|
|
69
72
|
if (!resource.inline) {
|
|
70
73
|
const resourceUri = resource.src || resource.specifier;
|
|
71
74
|
if (resourceUri) {
|
|
75
|
+
// eslint-disable-next-line no-await-in-loop
|
|
72
76
|
await this.dispatchResourceRecursive(resourceUri, dispatcher, { resourceType: 'resource' }, siteConfig);
|
|
73
77
|
}
|
|
74
78
|
else {
|
|
@@ -81,6 +85,7 @@ export default class SiteGenerator {
|
|
|
81
85
|
for (const resource of resources) {
|
|
82
86
|
const resourceUri = resource.src || resource.specifier || '';
|
|
83
87
|
if (resourceUri.startsWith('/')) {
|
|
88
|
+
// eslint-disable-next-line no-await-in-loop
|
|
84
89
|
await this.dispatchResourceRecursive(resourceUri, dispatcher, { resourceType: 'resource' }, siteConfig);
|
|
85
90
|
}
|
|
86
91
|
else {
|
|
@@ -124,6 +129,7 @@ export default class SiteGenerator {
|
|
|
124
129
|
for (const importModule of imports) {
|
|
125
130
|
const jsUri = importModule.specifier;
|
|
126
131
|
if (jsUri.startsWith('/')) {
|
|
132
|
+
// eslint-disable-next-line no-await-in-loop
|
|
127
133
|
await this.dispatchResourceRecursive(jsUri, dispatcher, { resourceType: 'js' }, siteConfig);
|
|
128
134
|
}
|
|
129
135
|
else {
|
|
@@ -138,6 +144,7 @@ export default class SiteGenerator {
|
|
|
138
144
|
for (const importModule of dynamicImports) {
|
|
139
145
|
const jsUri = importModule.specifier;
|
|
140
146
|
if (jsUri.startsWith('/')) {
|
|
147
|
+
// eslint-disable-next-line no-await-in-loop
|
|
141
148
|
await this.dispatchResourceRecursive(jsUri, dispatcher, { resourceType: 'js' }, siteConfig);
|
|
142
149
|
}
|
|
143
150
|
else {
|
|
@@ -148,6 +155,7 @@ export default class SiteGenerator {
|
|
|
148
155
|
// Bundles with unresolved module uris
|
|
149
156
|
const uris = context.fs?.metadata.resolvedUris || [];
|
|
150
157
|
for (const jsUri of uris) {
|
|
158
|
+
// eslint-disable-next-line no-await-in-loop
|
|
151
159
|
await this.dispatchResourceRecursive(jsUri, dispatcher, { resourceType: 'js' }, siteConfig);
|
|
152
160
|
}
|
|
153
161
|
}
|
|
@@ -184,11 +192,13 @@ export default class SiteGenerator {
|
|
|
184
192
|
const visitedUrls = new Set();
|
|
185
193
|
// Generate all the routes
|
|
186
194
|
for (const route of routes) {
|
|
195
|
+
// eslint-disable-next-line no-await-in-loop
|
|
187
196
|
await this.dispatchResourceRecursive(route.path, dispatcher, { resourceType: 'route' }, { outputDir, visitedUrls, locale, urlRewriteMap });
|
|
188
197
|
}
|
|
189
198
|
// Generate any additional urls
|
|
190
199
|
if (staticSiteGenerator._additionalRoutePaths) {
|
|
191
200
|
for (const uri of staticSiteGenerator._additionalRoutePaths) {
|
|
201
|
+
// eslint-disable-next-line no-await-in-loop
|
|
192
202
|
await this.dispatchResourceRecursive(uri, dispatcher, { resourceType: 'route' }, { outputDir, visitedUrls, locale, urlRewriteMap });
|
|
193
203
|
}
|
|
194
204
|
}
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
|
-
"version": "0.
|
|
7
|
+
"version": "0.5.1",
|
|
8
8
|
"homepage": "https://lwr.dev/",
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
@@ -33,27 +33,27 @@
|
|
|
33
33
|
"package.cjs"
|
|
34
34
|
],
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@lwrjs/app-service": "0.
|
|
37
|
-
"@lwrjs/asset-registry": "0.
|
|
38
|
-
"@lwrjs/base-template-engine": "0.
|
|
39
|
-
"@lwrjs/base-view-provider": "0.
|
|
40
|
-
"@lwrjs/client-modules": "0.
|
|
41
|
-
"@lwrjs/compiler": "0.
|
|
42
|
-
"@lwrjs/diagnostics": "0.
|
|
43
|
-
"@lwrjs/fs-asset-provider": "0.
|
|
44
|
-
"@lwrjs/html-view-provider": "0.
|
|
45
|
-
"@lwrjs/loader": "0.
|
|
46
|
-
"@lwrjs/lwc-module-provider": "0.
|
|
47
|
-
"@lwrjs/markdown-view-provider": "0.
|
|
48
|
-
"@lwrjs/module-bundler": "0.
|
|
49
|
-
"@lwrjs/module-registry": "0.
|
|
50
|
-
"@lwrjs/npm-module-provider": "0.
|
|
51
|
-
"@lwrjs/nunjucks-view-provider": "0.
|
|
52
|
-
"@lwrjs/resource-registry": "0.
|
|
53
|
-
"@lwrjs/router": "0.
|
|
54
|
-
"@lwrjs/server": "0.
|
|
55
|
-
"@lwrjs/shared-utils": "0.
|
|
56
|
-
"@lwrjs/view-registry": "0.
|
|
36
|
+
"@lwrjs/app-service": "0.5.1",
|
|
37
|
+
"@lwrjs/asset-registry": "0.5.1",
|
|
38
|
+
"@lwrjs/base-template-engine": "0.5.1",
|
|
39
|
+
"@lwrjs/base-view-provider": "0.5.1",
|
|
40
|
+
"@lwrjs/client-modules": "0.5.1",
|
|
41
|
+
"@lwrjs/compiler": "0.5.1",
|
|
42
|
+
"@lwrjs/diagnostics": "0.5.1",
|
|
43
|
+
"@lwrjs/fs-asset-provider": "0.5.1",
|
|
44
|
+
"@lwrjs/html-view-provider": "0.5.1",
|
|
45
|
+
"@lwrjs/loader": "0.5.1",
|
|
46
|
+
"@lwrjs/lwc-module-provider": "0.5.1",
|
|
47
|
+
"@lwrjs/markdown-view-provider": "0.5.1",
|
|
48
|
+
"@lwrjs/module-bundler": "0.5.1",
|
|
49
|
+
"@lwrjs/module-registry": "0.5.1",
|
|
50
|
+
"@lwrjs/npm-module-provider": "0.5.1",
|
|
51
|
+
"@lwrjs/nunjucks-view-provider": "0.5.1",
|
|
52
|
+
"@lwrjs/resource-registry": "0.5.1",
|
|
53
|
+
"@lwrjs/router": "0.5.1",
|
|
54
|
+
"@lwrjs/server": "0.5.1",
|
|
55
|
+
"@lwrjs/shared-utils": "0.5.1",
|
|
56
|
+
"@lwrjs/view-registry": "0.5.1",
|
|
57
57
|
"dompurify": "^2.3.0",
|
|
58
58
|
"fs-extra": "^10.0.0",
|
|
59
59
|
"jsdom": "^16.7.0",
|
|
@@ -63,12 +63,13 @@
|
|
|
63
63
|
"qs": "^6.9.4"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
|
-
"@lwrjs/types": "0.
|
|
66
|
+
"@lwrjs/types": "0.5.1"
|
|
67
67
|
},
|
|
68
68
|
"peerDependencies": {
|
|
69
69
|
"lwc": ">= 1.x <= 2.x"
|
|
70
70
|
},
|
|
71
71
|
"engines": {
|
|
72
72
|
"node": ">=14.15.4 <15"
|
|
73
|
-
}
|
|
73
|
+
},
|
|
74
|
+
"gitHead": "007da758483711eb4f3422c3c94f7a816d20c71d"
|
|
74
75
|
}
|