@lwrjs/static 0.11.4 → 0.11.6

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.
@@ -57,7 +57,10 @@ var StaticAssetProvider = class {
57
57
  const metadata = this.siteAssets.assets[fileAssetPath];
58
58
  if (!metadata) {
59
59
  if (import_path.default.dirname(fileAssetPath) !== (this.basePath ? this.basePath : "/")) {
60
- import_diagnostics.logger.warn(`[${this.name}] Did not find requested specifier ${fileAssetPath}`);
60
+ import_diagnostics.logger.warn({
61
+ label: `${this.name}`,
62
+ message: `Did not find requested specifier ${fileAssetPath}`
63
+ });
61
64
  }
62
65
  return void 0;
63
66
  }
@@ -71,7 +74,7 @@ var StaticAssetProvider = class {
71
74
  throw Error(`[${this.name}] Asset is not on lambda ${siteAssetPath}`);
72
75
  };
73
76
  const uri = this.assetsOnLambda ? fileAssetPath : import_path.default.join(this.siteRootDir, fileAssetPath);
74
- import_diagnostics.logger.debug(`[${this.name}] uri ${assetIdentifier.specifier} -> ${uri}`);
77
+ import_diagnostics.logger.debug({label: `${this.name}`, message: `uri ${assetIdentifier.specifier} -> ${uri}`});
75
78
  return {
76
79
  entry: siteAssetPath,
77
80
  ext,
@@ -87,7 +90,10 @@ var StaticAssetProvider = class {
87
90
  const {specifier} = assetId;
88
91
  let normalizedSpecifier = specifier;
89
92
  if (normalizedSpecifier.includes("?")) {
90
- import_diagnostics.logger.debug(`[${this.name}] Removed query param from asset specifier: ${specifier}`);
93
+ import_diagnostics.logger.debug({
94
+ label: `${this.name}`,
95
+ message: `Removed query param from asset specifier: ${specifier}`
96
+ });
91
97
  normalizedSpecifier = normalizedSpecifier.split("?")[0];
92
98
  }
93
99
  if (normalizedSpecifier[0] === "$") {
@@ -55,7 +55,10 @@ var StaticBundleProvider = class {
55
55
  const metadata = await (0, import_static_utils.getLocalizedBundle)(specifier, siteBundles, localeId, this.i18n);
56
56
  if (!metadata) {
57
57
  if (!specifier.startsWith(LWR_SSR_BUNDLE_PREFIX)) {
58
- import_diagnostics.logger.warn(`[${this.name}] did not find requested specifier ${specifier}`);
58
+ import_diagnostics.logger.warn({
59
+ label: `${this.name}`,
60
+ message: `did not find requested specifier ${specifier}`
61
+ });
59
62
  }
60
63
  return void 0;
61
64
  }
@@ -47,7 +47,10 @@ var StaticModuleProvider = class {
47
47
  const localeId = runtimeParams?.locale || this.i18n.defaultLocale;
48
48
  const metadata = await (0, import_static_utils.getLocalizedBundle)(specifier, this.siteBundles, localeId, this.i18n);
49
49
  if (metadata) {
50
- import_diagnostics.logger.warn(`[${this.name}] We should not be asking for module source we have in our site metadata ${moduleId.specifier}`);
50
+ import_diagnostics.logger.warn({
51
+ label: `${this.name}`,
52
+ message: `We should not be asking for module source we have in our site metadata ${moduleId.specifier}`
53
+ });
51
54
  return void 0;
52
55
  }
53
56
  return void 0;
@@ -57,7 +60,10 @@ var StaticModuleProvider = class {
57
60
  const localeId = runtimeParams?.locale || this.i18n.defaultLocale;
58
61
  const metadata = await (0, import_static_utils.getLocalizedBundle)(specifier, this.siteBundles, localeId, this.i18n);
59
62
  if (metadata) {
60
- import_diagnostics.logger.info(`[${this.name}] Module Entry request for static bundle ${specifier}`);
63
+ import_diagnostics.logger.info({
64
+ label: `${this.name}`,
65
+ message: `Module Entry request for static bundle ${specifier}`
66
+ });
61
67
  const bundlePath = import_path.default.join(this.siteRootDir, metadata.path);
62
68
  const resolvedVersion = (0, import_static_utils.resolveStaticBundleVersion)(metadata.version, version);
63
69
  return {
@@ -45,7 +45,10 @@ var StaticResourceProvider = class {
45
45
  const {debug} = runtimeEnvironment;
46
46
  const metadata = debug && this.debugSiteResources ? this.debugSiteResources.resources[resourceIdentity.specifier] : this.siteResources.resources[resourceIdentity.specifier];
47
47
  if (!metadata) {
48
- import_diagnostics.logger.warn(`[${this.name}] Did not find requested specifier ${resourceIdentity.specifier}`);
48
+ import_diagnostics.logger.warn({
49
+ label: `${this.name}`,
50
+ message: `Did not find requested specifier ${resourceIdentity.specifier}`
51
+ });
49
52
  return void 0;
50
53
  }
51
54
  const resourcePath = import_path.default.join(this.siteRootDir, metadata.path);
@@ -53,7 +56,10 @@ var StaticResourceProvider = class {
53
56
  return {
54
57
  type,
55
58
  stream: () => {
56
- import_diagnostics.logger.info(`[${this.name}] Resource read from lambda ${resourceIdentity.specifier}`);
59
+ import_diagnostics.logger.info({
60
+ label: `${this.name}`,
61
+ message: `Resource read from lambda ${resourceIdentity.specifier}`
62
+ });
57
63
  return import_fs_extra.default.createReadStream(resourcePath);
58
64
  },
59
65
  src: resourcePath,
@@ -92,7 +92,10 @@ var SiteMetadataImpl = class {
92
92
  siteBundles = savedMetadata;
93
93
  } catch (error) {
94
94
  if (error.code === "ENOENT") {
95
- import_diagnostics.logger.debug(`[SiteMetadata] Failed to load Static Bundle Metadata: ${bundleMetadataPath}`);
95
+ import_diagnostics.logger.debug({
96
+ label: `SiteMetadata`,
97
+ message: `Failed to load Static Bundle Metadata: ${bundleMetadataPath}`
98
+ });
96
99
  } else {
97
100
  throw error;
98
101
  }
@@ -108,7 +111,10 @@ var SiteMetadataImpl = class {
108
111
  siteResources = savedMetadata;
109
112
  } catch (error) {
110
113
  if (error.code === "ENOENT") {
111
- import_diagnostics.logger.debug(`[SiteMetadata] Failed to load Static Resource Metadata: ${resourceMetadataPath}`);
114
+ import_diagnostics.logger.debug({
115
+ label: `SiteMetadata`,
116
+ message: `Failed to load Static Resource Metadata: ${resourceMetadataPath}`
117
+ });
112
118
  } else {
113
119
  throw error;
114
120
  }
@@ -125,7 +131,10 @@ var SiteMetadataImpl = class {
125
131
  siteAssets = import_fs_extra.default.readJSONSync(assetMetadataPath);
126
132
  } catch (error) {
127
133
  if (error.code === "ENOENT") {
128
- import_diagnostics.logger.debug(`[SiteMetadata] Failed to load Static Resource Metadata: ${assetMetadataPath}`);
134
+ import_diagnostics.logger.debug({
135
+ label: `SiteMetadata`,
136
+ message: `Failed to load Static Resource Metadata: ${assetMetadataPath}`
137
+ });
129
138
  } else {
130
139
  throw error;
131
140
  }
@@ -33,7 +33,10 @@ export default class StaticAssetProvider {
33
33
  if (!metadata) {
34
34
  // Ignore root asset misses (may be views)
35
35
  if (path.dirname(fileAssetPath) !== (this.basePath ? this.basePath : '/')) {
36
- logger.warn(`[${this.name}] Did not find requested specifier ${fileAssetPath}`);
36
+ logger.warn({
37
+ label: `${this.name}`,
38
+ message: `Did not find requested specifier ${fileAssetPath}`,
39
+ });
37
40
  }
38
41
  return undefined;
39
42
  }
@@ -53,7 +56,7 @@ export default class StaticAssetProvider {
53
56
  throw Error(`[${this.name}] Asset is not on lambda ${siteAssetPath}`);
54
57
  };
55
58
  const uri = this.assetsOnLambda ? fileAssetPath : path.join(this.siteRootDir, fileAssetPath);
56
- logger.debug(`[${this.name}] uri ${assetIdentifier.specifier} -> ${uri}`);
59
+ logger.debug({ label: `${this.name}`, message: `uri ${assetIdentifier.specifier} -> ${uri}` });
57
60
  return {
58
61
  entry: siteAssetPath,
59
62
  ext,
@@ -74,7 +77,10 @@ export default class StaticAssetProvider {
74
77
  // Remove query params from specifiers (i.e. /assets/styles/styles.css?e368d71b59)
75
78
  let normalizedSpecifier = specifier;
76
79
  if (normalizedSpecifier.includes('?')) {
77
- logger.debug(`[${this.name}] Removed query param from asset specifier: ${specifier}`);
80
+ logger.debug({
81
+ label: `${this.name}`,
82
+ message: `Removed query param from asset specifier: ${specifier}`,
83
+ });
78
84
  normalizedSpecifier = normalizedSpecifier.split('?')[0];
79
85
  }
80
86
  if (normalizedSpecifier[0] === '$') {
@@ -25,7 +25,10 @@ export default class StaticBundleProvider {
25
25
  if (!metadata) {
26
26
  // ignore ssr module requests
27
27
  if (!specifier.startsWith(LWR_SSR_BUNDLE_PREFIX)) {
28
- logger.warn(`[${this.name}] did not find requested specifier ${specifier}`);
28
+ logger.warn({
29
+ label: `${this.name}`,
30
+ message: `did not find requested specifier ${specifier}`,
31
+ });
29
32
  }
30
33
  return undefined;
31
34
  }
@@ -20,7 +20,10 @@ export default class StaticModuleProvider {
20
20
  const localeId = (runtimeParams?.locale || this.i18n.defaultLocale);
21
21
  const metadata = await getLocalizedBundle(specifier, this.siteBundles, localeId, this.i18n);
22
22
  if (metadata) {
23
- logger.warn(`[${this.name}] We should not be asking for module source we have in our site metadata ${moduleId.specifier}`);
23
+ logger.warn({
24
+ label: `${this.name}`,
25
+ message: `We should not be asking for module source we have in our site metadata ${moduleId.specifier}`,
26
+ });
24
27
  // proceed to next provider
25
28
  return undefined;
26
29
  }
@@ -33,7 +36,10 @@ export default class StaticModuleProvider {
33
36
  const localeId = (runtimeParams?.locale || this.i18n.defaultLocale);
34
37
  const metadata = await getLocalizedBundle(specifier, this.siteBundles, localeId, this.i18n);
35
38
  if (metadata) {
36
- logger.info(`[${this.name}] Module Entry request for static bundle ${specifier}`);
39
+ logger.info({
40
+ label: `${this.name}`,
41
+ message: `Module Entry request for static bundle ${specifier}`,
42
+ });
37
43
  // Have to make the bundle code available for SSR
38
44
  const bundlePath = path.join(this.siteRootDir, metadata.path);
39
45
  const resolvedVersion = resolveStaticBundleVersion(metadata.version, version);
@@ -19,7 +19,10 @@ export default class StaticResourceProvider {
19
19
  ? this.debugSiteResources.resources[resourceIdentity.specifier]
20
20
  : this.siteResources.resources[resourceIdentity.specifier];
21
21
  if (!metadata) {
22
- logger.warn(`[${this.name}] Did not find requested specifier ${resourceIdentity.specifier}`);
22
+ logger.warn({
23
+ label: `${this.name}`,
24
+ message: `Did not find requested specifier ${resourceIdentity.specifier}`,
25
+ });
23
26
  return undefined;
24
27
  }
25
28
  const resourcePath = path.join(this.siteRootDir, metadata.path);
@@ -29,7 +32,10 @@ export default class StaticResourceProvider {
29
32
  type,
30
33
  // Have to make the loader shim code available for SSR
31
34
  stream: () => {
32
- logger.info(`[${this.name}] Resource read from lambda ${resourceIdentity.specifier}`);
35
+ logger.info({
36
+ label: `${this.name}`,
37
+ message: `Resource read from lambda ${resourceIdentity.specifier}`,
38
+ });
33
39
  return fs.createReadStream(resourcePath);
34
40
  },
35
41
  src: resourcePath,
@@ -72,7 +72,10 @@ export class SiteMetadataImpl {
72
72
  }
73
73
  catch (error) {
74
74
  if (error.code === 'ENOENT') {
75
- logger.debug(`[SiteMetadata] Failed to load Static Bundle Metadata: ${bundleMetadataPath}`);
75
+ logger.debug({
76
+ label: `SiteMetadata`,
77
+ message: `Failed to load Static Bundle Metadata: ${bundleMetadataPath}`,
78
+ });
76
79
  }
77
80
  else {
78
81
  throw error;
@@ -93,7 +96,10 @@ export class SiteMetadataImpl {
93
96
  }
94
97
  catch (error) {
95
98
  if (error.code === 'ENOENT') {
96
- logger.debug(`[SiteMetadata] Failed to load Static Resource Metadata: ${resourceMetadataPath}`);
99
+ logger.debug({
100
+ label: `SiteMetadata`,
101
+ message: `Failed to load Static Resource Metadata: ${resourceMetadataPath}`,
102
+ });
97
103
  }
98
104
  else {
99
105
  throw error;
@@ -115,7 +121,10 @@ export class SiteMetadataImpl {
115
121
  }
116
122
  catch (error) {
117
123
  if (error.code === 'ENOENT') {
118
- logger.debug(`[SiteMetadata] Failed to load Static Resource Metadata: ${assetMetadataPath}`);
124
+ logger.debug({
125
+ label: `SiteMetadata`,
126
+ message: `Failed to load Static Resource Metadata: ${assetMetadataPath}`,
127
+ });
119
128
  }
120
129
  else {
121
130
  throw error;
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
- "version": "0.11.4",
7
+ "version": "0.11.6",
8
8
  "homepage": "https://developer.salesforce.com/docs/platform/lwr/overview",
9
9
  "repository": {
10
10
  "type": "git",
@@ -48,11 +48,11 @@
48
48
  "build/**/*.d.ts"
49
49
  ],
50
50
  "dependencies": {
51
- "@lwrjs/diagnostics": "0.11.4",
52
- "@lwrjs/shared-utils": "0.11.4"
51
+ "@lwrjs/diagnostics": "0.11.6",
52
+ "@lwrjs/shared-utils": "0.11.6"
53
53
  },
54
54
  "devDependencies": {
55
- "@lwrjs/types": "0.11.4",
55
+ "@lwrjs/types": "0.11.6",
56
56
  "@types/express": "^4.17.17",
57
57
  "jest": "^26.6.3",
58
58
  "jest-express": "^1.12.0",
@@ -65,5 +65,5 @@
65
65
  "volta": {
66
66
  "extends": "../../../package.json"
67
67
  },
68
- "gitHead": "5528cfc12174d4800ff42db1691d14c5d194f7d6"
68
+ "gitHead": "415e25c05b4b1a0356fb89801f1242e8f73143e3"
69
69
  }