@lwrjs/view-registry 0.10.0-alpha.19 → 0.10.0-alpha.20
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/build/cjs/index.cjs +8 -1
- package/build/cjs/view-handler.cjs +9 -2
- package/build/es/index.js +8 -1
- package/build/es/view-handler.js +10 -2
- package/package.json +7 -6
package/build/cjs/index.cjs
CHANGED
|
@@ -28,6 +28,7 @@ __export(exports, {
|
|
|
28
28
|
LwrViewRegistry: () => LwrViewRegistry
|
|
29
29
|
});
|
|
30
30
|
var import_shared_utils = __toModule(require("@lwrjs/shared-utils"));
|
|
31
|
+
var import_instrumentation = __toModule(require("@lwrjs/instrumentation"));
|
|
31
32
|
var import_utils = __toModule(require("./utils.cjs"));
|
|
32
33
|
var import_link_lwr_resources = __toModule(require("./linkers/link-lwr-resources.cjs"));
|
|
33
34
|
var import_lru_cache = __toModule(require("lru-cache"));
|
|
@@ -177,7 +178,13 @@ var LwrViewRegistry = class {
|
|
|
177
178
|
}
|
|
178
179
|
}
|
|
179
180
|
const pendingViewDefCacheKey = viewDefCacheKey + viewParamKey;
|
|
180
|
-
const viewDefinition = await this.pendingViewDefinitions.execute(pendingViewDefCacheKey, () =>
|
|
181
|
+
const viewDefinition = await this.pendingViewDefinitions.execute(pendingViewDefCacheKey, () => (0, import_instrumentation.getTracer)().trace({
|
|
182
|
+
name: import_instrumentation.ViewSpan.Render,
|
|
183
|
+
attributes: {
|
|
184
|
+
view: view.id,
|
|
185
|
+
ssr: view.bootstrap?.ssr === true
|
|
186
|
+
}
|
|
187
|
+
}, () => this.renderView(view, viewParams, runtimeEnvironment, runtimeParams, renderOptions)));
|
|
181
188
|
if (cacheDisabled === false) {
|
|
182
189
|
const route = this.globalConfig.routes.find((r) => r.id === view.id);
|
|
183
190
|
const ttl = (0, import_shared_utils.shortestTtl)(viewDefinition.cache?.ttl, route?.cache?.ttl);
|
|
@@ -26,9 +26,10 @@ __markAsModule(exports);
|
|
|
26
26
|
__export(exports, {
|
|
27
27
|
LwrViewHandler: () => LwrViewHandler
|
|
28
28
|
});
|
|
29
|
+
var import_path = __toModule(require("path"));
|
|
29
30
|
var import_shared_utils = __toModule(require("@lwrjs/shared-utils"));
|
|
31
|
+
var import_instrumentation = __toModule(require("@lwrjs/instrumentation"));
|
|
30
32
|
var import_utils = __toModule(require("./utils.cjs"));
|
|
31
|
-
var import_path = __toModule(require("path"));
|
|
32
33
|
var LwrViewHandler = class {
|
|
33
34
|
constructor(context, globalConfig) {
|
|
34
35
|
this.globalConfig = globalConfig;
|
|
@@ -135,7 +136,13 @@ var LwrViewHandler = class {
|
|
|
135
136
|
const paths = {rootDir, assets, contentDir, layoutsDir};
|
|
136
137
|
const locale = runtimeParams.locale;
|
|
137
138
|
const viewApi = this.getBoundApi(viewRequest, route, runtimeEnvironment, runtimeParams);
|
|
138
|
-
const response = await
|
|
139
|
+
const response = await (0, import_instrumentation.getTracer)().trace({
|
|
140
|
+
name: import_instrumentation.ViewSpan.ExecuteRouteHandler,
|
|
141
|
+
attributes: {
|
|
142
|
+
view: route.id,
|
|
143
|
+
route: viewRequest.requestPath
|
|
144
|
+
}
|
|
145
|
+
}, async () => routeHandlerFn({...viewRequest, locale}, {route, viewApi, ...paths}, routeHandlerOptions));
|
|
139
146
|
return response;
|
|
140
147
|
}
|
|
141
148
|
getBoundApi(viewRequest, route, runtimeEnvironment, runtimeParams) {
|
package/build/es/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { InflightTasks, createStringBuilder, extractMetadataFromHtml, getCacheKeyFromJson, getSpecifier, normalizeResourcePath, shortestTtl, } from '@lwrjs/shared-utils';
|
|
2
|
+
import { getTracer, ViewSpan } from '@lwrjs/instrumentation';
|
|
2
3
|
import { normalizeRenderOptions, normalizeRenderedResult, reduceSourceAssetReferences } from './utils.js';
|
|
3
4
|
import { linkLwrResources } from './linkers/link-lwr-resources.js';
|
|
4
5
|
import { LRUCache } from 'lru-cache';
|
|
@@ -177,7 +178,13 @@ export class LwrViewRegistry {
|
|
|
177
178
|
}
|
|
178
179
|
}
|
|
179
180
|
const pendingViewDefCacheKey = viewDefCacheKey + viewParamKey;
|
|
180
|
-
const viewDefinition = await this.pendingViewDefinitions.execute(pendingViewDefCacheKey, () =>
|
|
181
|
+
const viewDefinition = await this.pendingViewDefinitions.execute(pendingViewDefCacheKey, () => getTracer().trace({
|
|
182
|
+
name: ViewSpan.Render,
|
|
183
|
+
attributes: {
|
|
184
|
+
view: view.id,
|
|
185
|
+
ssr: view.bootstrap?.ssr === true,
|
|
186
|
+
},
|
|
187
|
+
}, () => this.renderView(view, viewParams, runtimeEnvironment, runtimeParams, renderOptions)));
|
|
181
188
|
if (cacheDisabled === false) {
|
|
182
189
|
const route = this.globalConfig.routes.find((r) => r.id === view.id);
|
|
183
190
|
const ttl = shortestTtl(viewDefinition.cache?.ttl, route?.cache?.ttl);
|
package/build/es/view-handler.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { resolve } from 'path';
|
|
1
2
|
import { normalizeResourcePath, shortestTtl } from '@lwrjs/shared-utils';
|
|
3
|
+
import { getTracer, ViewSpan } from '@lwrjs/instrumentation';
|
|
2
4
|
import { generateHtmlTag, generatePageContext, isViewResponse, toJsonFormat } from './utils.js';
|
|
3
|
-
import { resolve } from 'path';
|
|
4
5
|
export class LwrViewHandler {
|
|
5
6
|
constructor(context, globalConfig) {
|
|
6
7
|
this.globalConfig = globalConfig;
|
|
@@ -151,7 +152,14 @@ export class LwrViewHandler {
|
|
|
151
152
|
const paths = { rootDir, assets, contentDir, layoutsDir };
|
|
152
153
|
const locale = runtimeParams.locale;
|
|
153
154
|
const viewApi = this.getBoundApi(viewRequest, route, runtimeEnvironment, runtimeParams);
|
|
154
|
-
|
|
155
|
+
// TODO: add trace attributes
|
|
156
|
+
const response = await getTracer().trace({
|
|
157
|
+
name: ViewSpan.ExecuteRouteHandler,
|
|
158
|
+
attributes: {
|
|
159
|
+
view: route.id,
|
|
160
|
+
route: viewRequest.requestPath,
|
|
161
|
+
},
|
|
162
|
+
}, async () => routeHandlerFn({ ...viewRequest, locale }, { route: route, viewApi, ...paths }, routeHandlerOptions));
|
|
155
163
|
return response;
|
|
156
164
|
}
|
|
157
165
|
/*
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
|
-
"version": "0.10.0-alpha.
|
|
7
|
+
"version": "0.10.0-alpha.20",
|
|
8
8
|
"homepage": "https://developer.salesforce.com/docs/platform/lwr/overview",
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
@@ -30,16 +30,17 @@
|
|
|
30
30
|
"build/**/*.d.ts"
|
|
31
31
|
],
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@lwrjs/app-service": "0.10.0-alpha.
|
|
34
|
-
"@lwrjs/diagnostics": "0.10.0-alpha.
|
|
35
|
-
"@lwrjs/
|
|
33
|
+
"@lwrjs/app-service": "0.10.0-alpha.20",
|
|
34
|
+
"@lwrjs/diagnostics": "0.10.0-alpha.20",
|
|
35
|
+
"@lwrjs/instrumentation": "0.10.0-alpha.20",
|
|
36
|
+
"@lwrjs/shared-utils": "0.10.0-alpha.20",
|
|
36
37
|
"lru-cache": "^10.0.0"
|
|
37
38
|
},
|
|
38
39
|
"devDependencies": {
|
|
39
|
-
"@lwrjs/types": "0.10.0-alpha.
|
|
40
|
+
"@lwrjs/types": "0.10.0-alpha.20"
|
|
40
41
|
},
|
|
41
42
|
"engines": {
|
|
42
43
|
"node": ">=16.0.0"
|
|
43
44
|
},
|
|
44
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "45a867fc54e98f77dd442ccd5f668e23027b9246"
|
|
45
46
|
}
|