@lwrjs/core 0.12.0-alpha.3 → 0.12.0-alpha.5

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.
@@ -55,7 +55,8 @@ function createAssetMiddleware(context) {
55
55
  const asset = await (0, import_instrumentation.getTracer)().trace({
56
56
  name: import_instrumentation.RequestHandlerSpan.GetAsset,
57
57
  attributes: {
58
- specifier: assetId.specifier
58
+ specifier: assetId.specifier,
59
+ url: req.originalUrl
59
60
  }
60
61
  }, () => {
61
62
  return assetRegistry.getAsset({...assetId, signature}, runtimeEnvironment, req.isSiteGeneration());
@@ -53,6 +53,11 @@ function createBundleMiddleware(context) {
53
53
  res.send(import_diagnostics.descriptions.UNRESOLVABLE.INVALID_JSON().message);
54
54
  return;
55
55
  }
56
+ if (!req.validateApiVersion(appConfig)) {
57
+ res.status(400);
58
+ res.send(import_diagnostics.descriptions.UNRESOLVABLE.INVALID_API_VERSION(req.params.apiVersion, appConfig.apiVersion).message);
59
+ return;
60
+ }
56
61
  const {runtimeEnvironment, runtimeParams} = req.getRuntimeContext(defaultRuntimeEnvironment);
57
62
  const importer = req.query.importer ? await (0, import_request.getRequestImporter)(req, moduleRegistry, runtimeParams) : void 0;
58
63
  const {moduleId, signature} = (0, import_identity.getModuleIdentity)(req, importer);
@@ -64,7 +69,8 @@ function createBundleMiddleware(context) {
64
69
  const bundleDefinition = await (0, import_instrumentation.getTracer)().trace({
65
70
  name: import_instrumentation.RequestHandlerSpan.GetBundle,
66
71
  attributes: {
67
- specifier: moduleId.specifier
72
+ specifier: moduleId.specifier,
73
+ url: req.originalUrl
68
74
  }
69
75
  }, () => {
70
76
  return moduleBundler.getModuleBundle(moduleId, {...runtimeEnvironment, bundle: true, sourceMapUrl}, runtimeParams);
@@ -47,7 +47,10 @@ function createMappingMiddleware(context) {
47
47
  const {runtimeEnvironment, runtimeParams} = req.getRuntimeContext(defaultRuntimeEnvironment);
48
48
  const {moduleIds} = (0, import_identity.getMappingIdentity)(req);
49
49
  const importMetadata = await (0, import_instrumentation.getTracer)().trace({
50
- name: import_instrumentation.RequestHandlerSpan.GetMapping
50
+ name: import_instrumentation.RequestHandlerSpan.GetMapping,
51
+ attributes: {
52
+ url: req.originalUrl
53
+ }
51
54
  }, () => {
52
55
  return (0, import_shared_utils.getImportMetadataMappings)(moduleIds, runtimeEnvironment, runtimeParams, moduleRegistry, moduleBundler);
53
56
  });
@@ -47,6 +47,11 @@ function createModuleMiddleware(context) {
47
47
  res.send(import_diagnostics.descriptions.UNRESOLVABLE.INVALID_JSON().message);
48
48
  return;
49
49
  }
50
+ if (!req.validateApiVersion(appConfig)) {
51
+ res.status(400);
52
+ res.send(import_diagnostics.descriptions.UNRESOLVABLE.INVALID_API_VERSION(req.params.apiVersion, appConfig.apiVersion).message);
53
+ return;
54
+ }
50
55
  const {runtimeEnvironment, runtimeParams} = req.getRuntimeContext(defaultRuntimeEnvironment);
51
56
  const importer = req.query.importer ? await (0, import_request.getRequestImporter)(req, moduleRegistry, runtimeParams) : void 0;
52
57
  const {moduleId, signature} = (0, import_identity.getModuleIdentity)(req, importer);
@@ -57,7 +62,8 @@ function createModuleMiddleware(context) {
57
62
  const moduleDefinition = await (0, import_instrumentation.getTracer)().trace({
58
63
  name: import_instrumentation.RequestHandlerSpan.GetModule,
59
64
  attributes: {
60
- specifier: moduleId.specifier
65
+ specifier: moduleId.specifier,
66
+ url: req.originalUrl
61
67
  }
62
68
  }, () => {
63
69
  return moduleRegistry.getLinkedModule(moduleId, {...runtimeEnvironment, bundle: false}, runtimeParams);
@@ -75,7 +75,7 @@ function getResourceIdentity(req) {
75
75
  }
76
76
  function getAssetIdentity(req) {
77
77
  const {signature, immutable, assetType: type} = req.params;
78
- const specifier = type ? "/" + req.params[0] : req.originalUrl.split("?")[0];
78
+ const specifier = type ? process.platform === "win32" ? req.params[0] : "/" + req.params[0] : req.originalUrl.split("?")[0];
79
79
  if (validateSpecifier(specifier) === false) {
80
80
  throw (0, import_diagnostics.createSingleDiagnosticError)({
81
81
  description: import_diagnostics.descriptions.UNRESOLVABLE.INVALID_SPECIFIER(specifier)
@@ -70,7 +70,8 @@ function createViewMiddleware(route, errorRoutes, context, viewHandler) {
70
70
  viewResponse = await (0, import_instrumentation.getTracer)().trace({
71
71
  name: import_instrumentation.RequestHandlerSpan.GetView,
72
72
  attributes: {
73
- view: route.id
73
+ view: route.id,
74
+ url: req.originalUrl
74
75
  }
75
76
  }, () => {
76
77
  return resolve.call(viewHandler, viewRequest, route, runtimeEnvironment, runtimeParams);
@@ -26,6 +26,7 @@ function createAssetMiddleware(context) {
26
26
  name: RequestHandlerSpan.GetAsset,
27
27
  attributes: {
28
28
  specifier: assetId.specifier,
29
+ url: req.originalUrl,
29
30
  },
30
31
  }, () => {
31
32
  return assetRegistry.getAsset({ ...assetId, signature }, runtimeEnvironment, req.isSiteGeneration());
@@ -20,6 +20,12 @@ function createBundleMiddleware(context) {
20
20
  res.send(descriptions.UNRESOLVABLE.INVALID_JSON().message);
21
21
  return;
22
22
  }
23
+ if (!req.validateApiVersion(appConfig)) {
24
+ res.status(400);
25
+ res.send(descriptions.UNRESOLVABLE.INVALID_API_VERSION(req.params.apiVersion, appConfig.apiVersion)
26
+ .message);
27
+ return;
28
+ }
23
29
  const { runtimeEnvironment, runtimeParams } = req.getRuntimeContext(defaultRuntimeEnvironment);
24
30
  const importer = req.query.importer
25
31
  ? await getRequestImporter(req, moduleRegistry, runtimeParams)
@@ -34,6 +40,7 @@ function createBundleMiddleware(context) {
34
40
  name: RequestHandlerSpan.GetBundle,
35
41
  attributes: {
36
42
  specifier: moduleId.specifier,
43
+ url: req.originalUrl,
37
44
  },
38
45
  }, () => {
39
46
  return moduleBundler.getModuleBundle(moduleId,
@@ -15,6 +15,9 @@ function createMappingMiddleware(context) {
15
15
  const { moduleIds } = getMappingIdentity(req);
16
16
  const importMetadata = await getTracer().trace({
17
17
  name: RequestHandlerSpan.GetMapping,
18
+ attributes: {
19
+ url: req.originalUrl,
20
+ },
18
21
  }, () => {
19
22
  return getImportMetadataMappings(moduleIds, runtimeEnvironment, runtimeParams, moduleRegistry, moduleBundler);
20
23
  });
@@ -19,6 +19,12 @@ function createModuleMiddleware(context) {
19
19
  res.send(descriptions.UNRESOLVABLE.INVALID_JSON().message);
20
20
  return;
21
21
  }
22
+ if (!req.validateApiVersion(appConfig)) {
23
+ res.status(400);
24
+ res.send(descriptions.UNRESOLVABLE.INVALID_API_VERSION(req.params.apiVersion, appConfig.apiVersion)
25
+ .message);
26
+ return;
27
+ }
22
28
  const { runtimeEnvironment, runtimeParams } = req.getRuntimeContext(defaultRuntimeEnvironment);
23
29
  const importer = req.query.importer
24
30
  ? await getRequestImporter(req, moduleRegistry, runtimeParams)
@@ -32,6 +38,7 @@ function createModuleMiddleware(context) {
32
38
  name: RequestHandlerSpan.GetModule,
33
39
  attributes: {
34
40
  specifier: moduleId.specifier,
41
+ url: req.originalUrl,
35
42
  },
36
43
  }, () => {
37
44
  return moduleRegistry.getLinkedModule(moduleId,
@@ -44,7 +44,11 @@ export function getResourceIdentity(req) {
44
44
  }
45
45
  export function getAssetIdentity(req) {
46
46
  const { signature, immutable, assetType: type } = req.params;
47
- const specifier = type ? '/' + req.params[0] : req.originalUrl.split('?')[0];
47
+ const specifier = type
48
+ ? process.platform === 'win32'
49
+ ? req.params[0]
50
+ : '/' + req.params[0]
51
+ : req.originalUrl.split('?')[0];
48
52
  if (validateSpecifier(specifier) === false) {
49
53
  throw createSingleDiagnosticError({
50
54
  description: descriptions.UNRESOLVABLE.INVALID_SPECIFIER(specifier),
@@ -45,6 +45,7 @@ function createViewMiddleware(route, errorRoutes, context, viewHandler) {
45
45
  name: RequestHandlerSpan.GetView,
46
46
  attributes: {
47
47
  view: route.id,
48
+ url: req.originalUrl,
48
49
  },
49
50
  }, () => {
50
51
  return resolve.call(viewHandler, viewRequest, route, runtimeEnvironment, runtimeParams);
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
- "version": "0.12.0-alpha.3",
7
+ "version": "0.12.0-alpha.5",
8
8
  "homepage": "https://developer.salesforce.com/docs/platform/lwr/overview",
9
9
  "repository": {
10
10
  "type": "git",
@@ -39,33 +39,34 @@
39
39
  "build": "tsc -b"
40
40
  },
41
41
  "dependencies": {
42
- "@lwrjs/app-service": "0.12.0-alpha.3",
43
- "@lwrjs/asset-registry": "0.12.0-alpha.3",
44
- "@lwrjs/asset-transformer": "0.12.0-alpha.3",
45
- "@lwrjs/base-view-provider": "0.12.0-alpha.3",
46
- "@lwrjs/base-view-transformer": "0.12.0-alpha.3",
47
- "@lwrjs/client-modules": "0.12.0-alpha.3",
48
- "@lwrjs/config": "0.12.0-alpha.3",
49
- "@lwrjs/diagnostics": "0.12.0-alpha.3",
50
- "@lwrjs/esbuild": "0.12.0-alpha.3",
51
- "@lwrjs/fs-asset-provider": "0.12.0-alpha.3",
52
- "@lwrjs/fs-watch": "0.12.0-alpha.3",
53
- "@lwrjs/html-view-provider": "0.12.0-alpha.3",
54
- "@lwrjs/instrumentation": "0.12.0-alpha.3",
55
- "@lwrjs/loader": "0.12.0-alpha.3",
56
- "@lwrjs/lwc-module-provider": "0.12.0-alpha.3",
57
- "@lwrjs/markdown-view-provider": "0.12.0-alpha.3",
58
- "@lwrjs/module-bundler": "0.12.0-alpha.3",
59
- "@lwrjs/module-registry": "0.12.0-alpha.3",
60
- "@lwrjs/npm-module-provider": "0.12.0-alpha.3",
61
- "@lwrjs/nunjucks-view-provider": "0.12.0-alpha.3",
62
- "@lwrjs/o11y": "0.12.0-alpha.3",
63
- "@lwrjs/resource-registry": "0.12.0-alpha.3",
64
- "@lwrjs/router": "0.12.0-alpha.3",
65
- "@lwrjs/server": "0.12.0-alpha.3",
66
- "@lwrjs/shared-utils": "0.12.0-alpha.3",
67
- "@lwrjs/static": "0.12.0-alpha.3",
68
- "@lwrjs/view-registry": "0.12.0-alpha.3",
42
+ "@lwrjs/app-service": "0.12.0-alpha.5",
43
+ "@lwrjs/asset-registry": "0.12.0-alpha.5",
44
+ "@lwrjs/asset-transformer": "0.12.0-alpha.5",
45
+ "@lwrjs/base-view-provider": "0.12.0-alpha.5",
46
+ "@lwrjs/base-view-transformer": "0.12.0-alpha.5",
47
+ "@lwrjs/client-modules": "0.12.0-alpha.5",
48
+ "@lwrjs/config": "0.12.0-alpha.5",
49
+ "@lwrjs/diagnostics": "0.12.0-alpha.5",
50
+ "@lwrjs/esbuild": "0.12.0-alpha.5",
51
+ "@lwrjs/fs-asset-provider": "0.12.0-alpha.5",
52
+ "@lwrjs/fs-watch": "0.12.0-alpha.5",
53
+ "@lwrjs/html-view-provider": "0.12.0-alpha.5",
54
+ "@lwrjs/instrumentation": "0.12.0-alpha.5",
55
+ "@lwrjs/loader": "0.12.0-alpha.5",
56
+ "@lwrjs/lwc-module-provider": "0.12.0-alpha.5",
57
+ "@lwrjs/lwc-ssr": "0.12.0-alpha.5",
58
+ "@lwrjs/markdown-view-provider": "0.12.0-alpha.5",
59
+ "@lwrjs/module-bundler": "0.12.0-alpha.5",
60
+ "@lwrjs/module-registry": "0.12.0-alpha.5",
61
+ "@lwrjs/npm-module-provider": "0.12.0-alpha.5",
62
+ "@lwrjs/nunjucks-view-provider": "0.12.0-alpha.5",
63
+ "@lwrjs/o11y": "0.12.0-alpha.5",
64
+ "@lwrjs/resource-registry": "0.12.0-alpha.5",
65
+ "@lwrjs/router": "0.12.0-alpha.5",
66
+ "@lwrjs/server": "0.12.0-alpha.5",
67
+ "@lwrjs/shared-utils": "0.12.0-alpha.5",
68
+ "@lwrjs/static": "0.12.0-alpha.5",
69
+ "@lwrjs/view-registry": "0.12.0-alpha.5",
69
70
  "chokidar": "^3.5.3",
70
71
  "esbuild": "^0.9.7",
71
72
  "fs-extra": "^11.1.1",
@@ -75,7 +76,7 @@
75
76
  "ws": "^8.8.1"
76
77
  },
77
78
  "devDependencies": {
78
- "@lwrjs/types": "0.12.0-alpha.3",
79
+ "@lwrjs/types": "0.12.0-alpha.5",
79
80
  "@types/ws": "^8.5.3"
80
81
  },
81
82
  "peerDependencies": {
@@ -87,5 +88,5 @@
87
88
  "volta": {
88
89
  "extends": "../../../package.json"
89
90
  },
90
- "gitHead": "48f97b40cbacce6cd6a6faee9206a465832c6774"
91
+ "gitHead": "cee1db278fe57d5221b0c9f6b3c8f6244cf94ae6"
91
92
  }