@lwrjs/static 0.22.1 → 0.22.2
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/es/providers/static-asset-provider.js +1 -6
- package/build/es/providers/static-bundle-provider.js +1 -7
- package/build/es/providers/static-module-provider.js +1 -6
- package/build/es/providers/static-resource-provider.js +1 -4
- package/build/es/site-metadata.js +0 -8
- package/build/es/utils/decision-tree.js +5 -6
- package/package.json +6 -6
|
@@ -3,13 +3,8 @@ import { hashContent, joinUrlPath, mimeLookup, normalizeResourcePath } from '@lw
|
|
|
3
3
|
import path from 'path';
|
|
4
4
|
import fs from 'fs-extra';
|
|
5
5
|
export default class StaticAssetProvider {
|
|
6
|
-
name = 'static-asset-provider';
|
|
7
|
-
siteAssets;
|
|
8
|
-
resourcePaths;
|
|
9
|
-
siteRootDir;
|
|
10
|
-
basePath;
|
|
11
|
-
assetsOnLambda;
|
|
12
6
|
constructor(_config, context) {
|
|
7
|
+
this.name = 'static-asset-provider';
|
|
13
8
|
if (!context.siteMetadata) {
|
|
14
9
|
throw new Error(`[${this.name}] Site metadata was not found`);
|
|
15
10
|
}
|
|
@@ -8,14 +8,8 @@ import { cacheCountStore } from '@lwrjs/instrumentation';
|
|
|
8
8
|
import { getTracer, BundleSpan } from '@lwrjs/instrumentation';
|
|
9
9
|
const BUNDLE_SOURCE_NOT_FOUND = 'Bundle Source Path Not Found';
|
|
10
10
|
export default class StaticBundleProvider {
|
|
11
|
-
name = 'static-bundle-provider';
|
|
12
|
-
codeCache;
|
|
13
|
-
siteRootDir;
|
|
14
|
-
bundleConfig;
|
|
15
|
-
i18n;
|
|
16
|
-
siteMetadata;
|
|
17
|
-
bundleCacheSize;
|
|
18
11
|
constructor(config, context) {
|
|
12
|
+
this.name = 'static-bundle-provider';
|
|
19
13
|
if (!context.siteMetadata) {
|
|
20
14
|
throw new Error(`[${this.name}] Site metadata was not found`);
|
|
21
15
|
}
|
|
@@ -2,13 +2,8 @@ import { logger } from '@lwrjs/diagnostics';
|
|
|
2
2
|
import { VERSION_SIGIL, explodeSpecifier, getSpecifier, isLambdaEnv, joinUrlPath } from '@lwrjs/shared-utils';
|
|
3
3
|
import { getSiteBundleId, parseSiteId, resolveStaticBundleVersion } from '../site-metadata.js';
|
|
4
4
|
export default class StaticModuleProvider {
|
|
5
|
-
name = 'static-module-provider';
|
|
6
|
-
siteRootDir;
|
|
7
|
-
externals;
|
|
8
|
-
fingerprintIndex;
|
|
9
|
-
i18n;
|
|
10
|
-
siteMetadata;
|
|
11
5
|
constructor(_config, context) {
|
|
6
|
+
this.name = 'static-module-provider';
|
|
12
7
|
if (!context.siteMetadata) {
|
|
13
8
|
throw new Error(`[${this.name}] Site metadata was not found`);
|
|
14
9
|
}
|
|
@@ -4,11 +4,8 @@ import path from 'path';
|
|
|
4
4
|
import fs from 'fs-extra';
|
|
5
5
|
import { getSiteResourceId } from '../site-metadata.js';
|
|
6
6
|
export default class StaticResourceProvider {
|
|
7
|
-
name = 'static-resource-provider';
|
|
8
|
-
siteRootDir;
|
|
9
|
-
siteMetadata;
|
|
10
|
-
resourceRegistry;
|
|
11
7
|
constructor(_config, context) {
|
|
8
|
+
this.name = 'static-resource-provider';
|
|
12
9
|
if (!context.siteMetadata) {
|
|
13
10
|
throw new Error(`[${this.name}] Site metadata was not found`);
|
|
14
11
|
}
|
|
@@ -13,14 +13,6 @@ export const SITE_VERSION_PREFIX = `|${VERSION_SIGIL}/`;
|
|
|
13
13
|
export const SITE_LOCALE_PREFIX = `|${LOCALE_SIGIL}/`;
|
|
14
14
|
export const SITE_SSR_PREFIX = `|${SSR_SIGIL}`;
|
|
15
15
|
export class SiteMetadataImpl {
|
|
16
|
-
options;
|
|
17
|
-
siteBundles;
|
|
18
|
-
debugSiteBundles;
|
|
19
|
-
siteResources;
|
|
20
|
-
debugSiteResources;
|
|
21
|
-
siteAssets;
|
|
22
|
-
bundleDecisionTree;
|
|
23
|
-
resourceDecisionTree;
|
|
24
16
|
constructor(options) {
|
|
25
17
|
this.options = options;
|
|
26
18
|
this.siteBundles = this.readStaticBundleMetadata(options.rootDir, STATIC_BUNDLE_METADATA_PATH);
|
|
@@ -33,7 +33,9 @@ const CHOICE_PROD = 'prod';
|
|
|
33
33
|
const CHOICE_DEBUG = 'debug';
|
|
34
34
|
// Tree of decisions to lead you to the right artifact
|
|
35
35
|
export default class DecisionTreeImpl {
|
|
36
|
-
|
|
36
|
+
constructor() {
|
|
37
|
+
this.root = new TreeNode(); // Root node does not hold any decision value
|
|
38
|
+
}
|
|
37
39
|
// Insert an artifact into the tree based on a path of decisions
|
|
38
40
|
insert(siteArtifactId, artifact, debug, localeFallbacks) {
|
|
39
41
|
// The decision path is the set of choices needed to get to the right metadata
|
|
@@ -178,12 +180,9 @@ export default class DecisionTreeImpl {
|
|
|
178
180
|
* It maintains the rank of all choices at this node, allowing a later node with a higher rank to replace the current one as the best option.
|
|
179
181
|
*/
|
|
180
182
|
class TreeNode {
|
|
181
|
-
decisionValue; // The decision value at this node (version ['1_0' or WILDCARD etc], localeId ['en-MX' or WILDCARD etc], etc.)
|
|
182
|
-
children = new Map(); // Maps a decision key to the next TreeNode
|
|
183
|
-
artifact = undefined; // Final artifact at a leaf node
|
|
184
|
-
parentPath; // parent path (i.e. foo/bar|DEBUG|1_0|WILD_CARD) just used for debugging
|
|
185
|
-
rank; // choice rank to prioritize lower ranked choices
|
|
186
183
|
constructor(value = '', parentPath = '') {
|
|
184
|
+
this.children = new Map(); // Maps a decision key to the next TreeNode
|
|
185
|
+
this.artifact = undefined; // Final artifact at a leaf node
|
|
187
186
|
this.decisionValue = value;
|
|
188
187
|
this.parentPath = parentPath;
|
|
189
188
|
}
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
|
-
"version": "0.22.
|
|
7
|
+
"version": "0.22.2",
|
|
8
8
|
"homepage": "https://developer.salesforce.com/docs/platform/lwr/overview",
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
@@ -56,13 +56,13 @@
|
|
|
56
56
|
"build/**/*.d.ts"
|
|
57
57
|
],
|
|
58
58
|
"dependencies": {
|
|
59
|
-
"@lwrjs/diagnostics": "0.22.
|
|
60
|
-
"@lwrjs/instrumentation": "0.22.
|
|
61
|
-
"@lwrjs/shared-utils": "0.22.
|
|
59
|
+
"@lwrjs/diagnostics": "0.22.2",
|
|
60
|
+
"@lwrjs/instrumentation": "0.22.2",
|
|
61
|
+
"@lwrjs/shared-utils": "0.22.2",
|
|
62
62
|
"lru-cache": "^10.4.3"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
|
-
"@lwrjs/types": "0.22.
|
|
65
|
+
"@lwrjs/types": "0.22.2",
|
|
66
66
|
"@types/express": "^4.17.21",
|
|
67
67
|
"jest": "29.7.0",
|
|
68
68
|
"jest-express": "^1.12.0",
|
|
@@ -76,5 +76,5 @@
|
|
|
76
76
|
"volta": {
|
|
77
77
|
"extends": "../../../package.json"
|
|
78
78
|
},
|
|
79
|
-
"gitHead": "
|
|
79
|
+
"gitHead": "30870e466e15e6691d238e75836e9266a45203e3"
|
|
80
80
|
}
|