@lwrjs/shared-utils 0.9.0-alpha.17 → 0.9.0-alpha.19

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.
@@ -66,23 +66,11 @@ var SiteMetadataImpl = class {
66
66
  }
67
67
  readStaticBundleMetadata(staticRoot) {
68
68
  let bundleMetadataPath;
69
- let siteBundles = {
70
- bundles: {},
71
- environment: {
72
- format: this.options.runtimeEnvironment.format,
73
- ...this.options.runtimeEnvironment.featureFlags?.LEGACY_LOADER && {
74
- featureFlags: {LEGACY_LOADER: true}
75
- }
76
- }
77
- };
69
+ let siteBundles = {bundles: {}};
78
70
  try {
79
71
  bundleMetadataPath = import_path.default.join(staticRoot, STATIC_BUNDLE_METADATA_PATH);
80
72
  const savedMetadata = import_fs_extra.default.readJSONSync(bundleMetadataPath);
81
- if (this.options.runtimeEnvironment.format !== savedMetadata.environment?.format || this.options.runtimeEnvironment.featureFlags?.LEGACY_LOADER != savedMetadata.environment?.featureFlags?.LEGACY_LOADER) {
82
- import_logger.logger.warn("[SiteMetadata] Saved bundles do not match the current runtime. They will not be used.", {expected: savedMetadata.environment, actual: this.options.runtimeEnvironment});
83
- } else {
84
- siteBundles = savedMetadata;
85
- }
73
+ siteBundles = savedMetadata;
86
74
  } catch (error) {
87
75
  if (error.code === "ENOENT") {
88
76
  import_logger.logger.debug(`[SiteMetadata] Failed to load Static Bundle Metadata: ${bundleMetadataPath}`);
@@ -94,23 +82,11 @@ var SiteMetadataImpl = class {
94
82
  }
95
83
  readStaticResourceMetadata(staticRoot) {
96
84
  let resourceMetadataPath;
97
- let siteResources = {
98
- resources: {},
99
- environment: {
100
- format: this.options.runtimeEnvironment.format,
101
- ...this.options.runtimeEnvironment.featureFlags?.LEGACY_LOADER && {
102
- featureFlags: {LEGACY_LOADER: true}
103
- }
104
- }
105
- };
85
+ let siteResources = {resources: {}};
106
86
  try {
107
87
  resourceMetadataPath = import_path.default.join(staticRoot, STATIC_RESOURCE_METADATA_PATH);
108
88
  const savedMetadata = import_fs_extra.default.readJSONSync(resourceMetadataPath);
109
- if (this.options.runtimeEnvironment.format !== savedMetadata.environment?.format || this.options.runtimeEnvironment.featureFlags?.LEGACY_LOADER != savedMetadata.environment?.featureFlags?.LEGACY_LOADER) {
110
- import_logger.logger.warn("[SiteMetadata] Saved resources do not match the current runtime. They will not be used.", {expected: savedMetadata.environment, actual: this.options.runtimeEnvironment});
111
- } else {
112
- siteResources = savedMetadata;
113
- }
89
+ siteResources = savedMetadata;
114
90
  } catch (error) {
115
91
  if (error.code === "ENOENT") {
116
92
  import_logger.logger.debug(`[SiteMetadata] Failed to load Static Resource Metadata: ${resourceMetadataPath}`);
@@ -1,7 +1,6 @@
1
- import type { RuntimeEnvironment, SiteAssets, SiteBundles, SiteMetadata, SiteResources } from '@lwrjs/types';
1
+ import type { SiteAssets, SiteBundles, SiteMetadata, SiteResources } from '@lwrjs/types';
2
2
  declare type Options = {
3
3
  rootDir: string;
4
- runtimeEnvironment: RuntimeEnvironment;
5
4
  };
6
5
  export declare class SiteMetadataImpl implements SiteMetadata {
7
6
  private options;
@@ -42,28 +42,11 @@ export class SiteMetadataImpl {
42
42
  }
43
43
  readStaticBundleMetadata(staticRoot) {
44
44
  let bundleMetadataPath;
45
- // Default metadata based on the current runtime environment
46
- let siteBundles = {
47
- bundles: {},
48
- environment: {
49
- format: this.options.runtimeEnvironment.format,
50
- ...(this.options.runtimeEnvironment.featureFlags?.LEGACY_LOADER && {
51
- featureFlags: { LEGACY_LOADER: true },
52
- }),
53
- },
54
- };
45
+ let siteBundles = { bundles: {} };
55
46
  try {
56
47
  bundleMetadataPath = path.join(staticRoot, STATIC_BUNDLE_METADATA_PATH);
57
48
  const savedMetadata = fs.readJSONSync(bundleMetadataPath);
58
- // Make sure the saved metadata runtime environment match the current runtime environment
59
- if (this.options.runtimeEnvironment.format !== savedMetadata.environment?.format ||
60
- this.options.runtimeEnvironment.featureFlags?.LEGACY_LOADER !=
61
- savedMetadata.environment?.featureFlags?.LEGACY_LOADER) {
62
- logger.warn('[SiteMetadata] Saved bundles do not match the current runtime. They will not be used.', { expected: savedMetadata.environment, actual: this.options.runtimeEnvironment });
63
- }
64
- else {
65
- siteBundles = savedMetadata;
66
- }
49
+ siteBundles = savedMetadata;
67
50
  }
68
51
  catch (error) {
69
52
  if (error.code === 'ENOENT') {
@@ -80,28 +63,11 @@ export class SiteMetadataImpl {
80
63
  */
81
64
  readStaticResourceMetadata(staticRoot) {
82
65
  let resourceMetadataPath;
83
- // Default metadata based on the current runtime environment
84
- let siteResources = {
85
- resources: {},
86
- environment: {
87
- format: this.options.runtimeEnvironment.format,
88
- ...(this.options.runtimeEnvironment.featureFlags?.LEGACY_LOADER && {
89
- featureFlags: { LEGACY_LOADER: true },
90
- }),
91
- },
92
- };
66
+ let siteResources = { resources: {} };
93
67
  try {
94
68
  resourceMetadataPath = path.join(staticRoot, STATIC_RESOURCE_METADATA_PATH);
95
69
  const savedMetadata = fs.readJSONSync(resourceMetadataPath);
96
- // Make sure the savedMetaadta runtime environment match the current runtime environment
97
- if (this.options.runtimeEnvironment.format !== savedMetadata.environment?.format ||
98
- this.options.runtimeEnvironment.featureFlags?.LEGACY_LOADER !=
99
- savedMetadata.environment?.featureFlags?.LEGACY_LOADER) {
100
- logger.warn('[SiteMetadata] Saved resources do not match the current runtime. They will not be used.', { expected: savedMetadata.environment, actual: this.options.runtimeEnvironment });
101
- }
102
- else {
103
- siteResources = savedMetadata;
104
- }
70
+ siteResources = savedMetadata;
105
71
  }
106
72
  catch (error) {
107
73
  if (error.code === 'ENOENT') {
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
- "version": "0.9.0-alpha.17",
7
+ "version": "0.9.0-alpha.19",
8
8
  "homepage": "https://developer.salesforce.com/docs/platform/lwr/overview",
9
9
  "repository": {
10
10
  "type": "git",
@@ -61,13 +61,13 @@
61
61
  "rollup": "~2.45.2"
62
62
  },
63
63
  "devDependencies": {
64
- "@lwrjs/diagnostics": "0.9.0-alpha.17",
65
- "@lwrjs/types": "0.9.0-alpha.17",
64
+ "@lwrjs/diagnostics": "0.9.0-alpha.19",
65
+ "@lwrjs/types": "0.9.0-alpha.19",
66
66
  "@types/mime-types": "2.1.1",
67
67
  "@types/path-to-regexp": "^1.7.0"
68
68
  },
69
69
  "engines": {
70
70
  "node": ">=14.15.4 <19"
71
71
  },
72
- "gitHead": "447417ff091802927b25cfc1bcb01da02264f41b"
72
+ "gitHead": "65623ff6f03a217321d7d342df391fb05c90eb19"
73
73
  }