@lwrjs/core 0.8.0-alpha.6 → 0.8.0-alpha.9
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.
|
@@ -342,7 +342,7 @@ function apiMiddleware(app, context) {
|
|
|
342
342
|
const specifier = req.params[0] ? `/${req.params[0]}` : req.originalUrl;
|
|
343
343
|
const basePathSpecifier = `${basePath}${specifier}`;
|
|
344
344
|
try {
|
|
345
|
-
const assetObj = await context.assetRegistry.getAsset({specifier: basePathSpecifier, signature, type}, runtimeEnvironment
|
|
345
|
+
const assetObj = await context.assetRegistry.getAsset({specifier: basePathSpecifier, signature, type}, runtimeEnvironment);
|
|
346
346
|
if (immutable) {
|
|
347
347
|
}
|
|
348
348
|
if (assetObj.mime) {
|
|
@@ -117,7 +117,7 @@ var SiteGenerator = class {
|
|
|
117
117
|
if (resourceType === "route") {
|
|
118
118
|
await this.handleHtmlResource(url, context, siteConfig, dispatcher);
|
|
119
119
|
} else if (resourceType === "asset" || resourceType === "resource") {
|
|
120
|
-
await this.handleAssetOrResource(url, context, siteConfig
|
|
120
|
+
await this.handleAssetOrResource(url, context, siteConfig);
|
|
121
121
|
} else if (resourceType == "mapping") {
|
|
122
122
|
await this.handleMappingResource(url, context, siteConfig, dispatcher);
|
|
123
123
|
} else if (resourceType === "js") {
|
|
@@ -274,16 +274,9 @@ var SiteGenerator = class {
|
|
|
274
274
|
}
|
|
275
275
|
}
|
|
276
276
|
}
|
|
277
|
-
async handleAssetOrResource(url, context, siteConfig
|
|
278
|
-
const metadata = context.fs?.metadata;
|
|
277
|
+
async handleAssetOrResource(url, context, siteConfig) {
|
|
279
278
|
const fullPath = this.getResourcePathFromUrl(siteConfig, url);
|
|
280
279
|
await (0, import_stream.writeResponse)(context, fullPath);
|
|
281
|
-
const assetReferences = metadata?.asset?.metadata?.assetReferences || [];
|
|
282
|
-
const dispatchRequests = [];
|
|
283
|
-
for (const ref of assetReferences) {
|
|
284
|
-
dispatchRequests.push(this.dispatchResourceRecursive(ref.override?.uri || ref.url, dispatcher, {resourceType: "asset", asset: metadata?.asset}, siteConfig));
|
|
285
|
-
}
|
|
286
|
-
return Promise.all(dispatchRequests);
|
|
287
280
|
}
|
|
288
281
|
getResourcePathFromUrl(siteConfig, url) {
|
|
289
282
|
const {outputDir} = siteConfig;
|
|
@@ -390,7 +390,7 @@ export default function apiMiddleware(app, context) {
|
|
|
390
390
|
const specifier = req.params[0] ? `/${req.params[0]}` : req.originalUrl;
|
|
391
391
|
const basePathSpecifier = `${basePath}${specifier}`;
|
|
392
392
|
try {
|
|
393
|
-
const assetObj = await context.assetRegistry.getAsset({ specifier: basePathSpecifier, signature, type: type }, runtimeEnvironment
|
|
393
|
+
const assetObj = await context.assetRegistry.getAsset({ specifier: basePathSpecifier, signature, type: type }, runtimeEnvironment);
|
|
394
394
|
if (immutable) {
|
|
395
395
|
// WIP: ?
|
|
396
396
|
}
|
|
@@ -129,7 +129,7 @@ export default class SiteGenerator {
|
|
|
129
129
|
// -- Process Assets (css, images, ...) && Resources (lwr-loader-shim ...)
|
|
130
130
|
}
|
|
131
131
|
else if (resourceType === 'asset' || resourceType === 'resource') {
|
|
132
|
-
await this.handleAssetOrResource(url, context, siteConfig
|
|
132
|
+
await this.handleAssetOrResource(url, context, siteConfig);
|
|
133
133
|
// -- Import Metadata Mappings
|
|
134
134
|
}
|
|
135
135
|
else if (resourceType == 'mapping') {
|
|
@@ -394,17 +394,9 @@ export default class SiteGenerator {
|
|
|
394
394
|
* @param context - Response Context
|
|
395
395
|
* @param siteConfig - Global metadata about the site
|
|
396
396
|
*/
|
|
397
|
-
async handleAssetOrResource(url, context, siteConfig
|
|
398
|
-
const metadata = context.fs?.metadata;
|
|
397
|
+
async handleAssetOrResource(url, context, siteConfig) {
|
|
399
398
|
const fullPath = this.getResourcePathFromUrl(siteConfig, url);
|
|
400
399
|
await writeResponse(context, fullPath);
|
|
401
|
-
// Call and referenced assets...
|
|
402
|
-
const assetReferences = metadata?.asset?.metadata?.assetReferences || [];
|
|
403
|
-
const dispatchRequests = [];
|
|
404
|
-
for (const ref of assetReferences) {
|
|
405
|
-
dispatchRequests.push(this.dispatchResourceRecursive(ref.override?.uri || ref.url, dispatcher, { resourceType: 'asset', asset: metadata?.asset }, siteConfig));
|
|
406
|
-
}
|
|
407
|
-
return Promise.all(dispatchRequests);
|
|
408
400
|
}
|
|
409
401
|
getResourcePathFromUrl(siteConfig, url) {
|
|
410
402
|
const { outputDir } = siteConfig;
|
|
@@ -8,7 +8,7 @@ export interface RouteResourceOpts extends BaseResourceContextOpts {
|
|
|
8
8
|
}
|
|
9
9
|
export interface AssetResourceOpts extends BaseResourceContextOpts {
|
|
10
10
|
resourceType: 'asset';
|
|
11
|
-
asset
|
|
11
|
+
asset: RenderedAssetReference;
|
|
12
12
|
}
|
|
13
13
|
export interface JsResourceOpts extends BaseResourceContextOpts {
|
|
14
14
|
resourceType: 'js';
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
|
-
"version": "0.8.0-alpha.
|
|
7
|
+
"version": "0.8.0-alpha.9",
|
|
8
8
|
"homepage": "https://developer.salesforce.com/docs/platform/lwr/overview",
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
@@ -32,39 +32,39 @@
|
|
|
32
32
|
"package.cjs"
|
|
33
33
|
],
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@lwrjs/app-service": "0.8.0-alpha.
|
|
36
|
-
"@lwrjs/asset-registry": "0.8.0-alpha.
|
|
37
|
-
"@lwrjs/asset-transformer": "0.8.0-alpha.
|
|
38
|
-
"@lwrjs/base-template-engine": "0.8.0-alpha.
|
|
39
|
-
"@lwrjs/base-view-provider": "0.8.0-alpha.
|
|
40
|
-
"@lwrjs/base-view-transformer": "0.8.0-alpha.
|
|
41
|
-
"@lwrjs/client-modules": "0.8.0-alpha.
|
|
42
|
-
"@lwrjs/compiler": "0.8.0-alpha.
|
|
43
|
-
"@lwrjs/config": "0.8.0-alpha.
|
|
44
|
-
"@lwrjs/diagnostics": "0.8.0-alpha.
|
|
45
|
-
"@lwrjs/fs-asset-provider": "0.8.0-alpha.
|
|
46
|
-
"@lwrjs/html-view-provider": "0.8.0-alpha.
|
|
47
|
-
"@lwrjs/loader": "0.8.0-alpha.
|
|
48
|
-
"@lwrjs/lwc-module-provider": "0.8.0-alpha.
|
|
49
|
-
"@lwrjs/lwc-ssr": "0.8.0-alpha.
|
|
50
|
-
"@lwrjs/markdown-view-provider": "0.8.0-alpha.
|
|
51
|
-
"@lwrjs/module-bundler": "0.8.0-alpha.
|
|
52
|
-
"@lwrjs/module-registry": "0.8.0-alpha.
|
|
53
|
-
"@lwrjs/npm-module-provider": "0.8.0-alpha.
|
|
54
|
-
"@lwrjs/nunjucks-view-provider": "0.8.0-alpha.
|
|
55
|
-
"@lwrjs/o11y": "0.8.0-alpha.
|
|
56
|
-
"@lwrjs/resource-registry": "0.8.0-alpha.
|
|
57
|
-
"@lwrjs/router": "0.8.0-alpha.
|
|
58
|
-
"@lwrjs/server": "0.8.0-alpha.
|
|
59
|
-
"@lwrjs/shared-utils": "0.8.0-alpha.
|
|
60
|
-
"@lwrjs/view-registry": "0.8.0-alpha.
|
|
35
|
+
"@lwrjs/app-service": "0.8.0-alpha.9",
|
|
36
|
+
"@lwrjs/asset-registry": "0.8.0-alpha.9",
|
|
37
|
+
"@lwrjs/asset-transformer": "0.8.0-alpha.9",
|
|
38
|
+
"@lwrjs/base-template-engine": "0.8.0-alpha.9",
|
|
39
|
+
"@lwrjs/base-view-provider": "0.8.0-alpha.9",
|
|
40
|
+
"@lwrjs/base-view-transformer": "0.8.0-alpha.9",
|
|
41
|
+
"@lwrjs/client-modules": "0.8.0-alpha.9",
|
|
42
|
+
"@lwrjs/compiler": "0.8.0-alpha.9",
|
|
43
|
+
"@lwrjs/config": "0.8.0-alpha.9",
|
|
44
|
+
"@lwrjs/diagnostics": "0.8.0-alpha.9",
|
|
45
|
+
"@lwrjs/fs-asset-provider": "0.8.0-alpha.9",
|
|
46
|
+
"@lwrjs/html-view-provider": "0.8.0-alpha.9",
|
|
47
|
+
"@lwrjs/loader": "0.8.0-alpha.9",
|
|
48
|
+
"@lwrjs/lwc-module-provider": "0.8.0-alpha.9",
|
|
49
|
+
"@lwrjs/lwc-ssr": "0.8.0-alpha.9",
|
|
50
|
+
"@lwrjs/markdown-view-provider": "0.8.0-alpha.9",
|
|
51
|
+
"@lwrjs/module-bundler": "0.8.0-alpha.9",
|
|
52
|
+
"@lwrjs/module-registry": "0.8.0-alpha.9",
|
|
53
|
+
"@lwrjs/npm-module-provider": "0.8.0-alpha.9",
|
|
54
|
+
"@lwrjs/nunjucks-view-provider": "0.8.0-alpha.9",
|
|
55
|
+
"@lwrjs/o11y": "0.8.0-alpha.9",
|
|
56
|
+
"@lwrjs/resource-registry": "0.8.0-alpha.9",
|
|
57
|
+
"@lwrjs/router": "0.8.0-alpha.9",
|
|
58
|
+
"@lwrjs/server": "0.8.0-alpha.9",
|
|
59
|
+
"@lwrjs/shared-utils": "0.8.0-alpha.9",
|
|
60
|
+
"@lwrjs/view-registry": "0.8.0-alpha.9",
|
|
61
61
|
"fs-extra": "^10.1.0",
|
|
62
62
|
"ms": "^2.1.3",
|
|
63
63
|
"path-to-regexp": "^6.2.0",
|
|
64
64
|
"qs": "^6.9.4"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
|
-
"@lwrjs/types": "0.8.0-alpha.
|
|
67
|
+
"@lwrjs/types": "0.8.0-alpha.9"
|
|
68
68
|
},
|
|
69
69
|
"peerDependencies": {
|
|
70
70
|
"lwc": ">= 1.x <= 2.x"
|
|
@@ -72,5 +72,5 @@
|
|
|
72
72
|
"engines": {
|
|
73
73
|
"node": ">=14.15.4 <19"
|
|
74
74
|
},
|
|
75
|
-
"gitHead": "
|
|
75
|
+
"gitHead": "037c471903c6753fc6866ef598571b0df83e58f9"
|
|
76
76
|
}
|