@lwrjs/shared-utils 0.13.0-alpha.14 → 0.13.0-alpha.16
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/fs.cjs +5 -0
- package/build/es/fs.d.ts +4 -0
- package/build/es/fs.js +7 -0
- package/package.json +5 -5
package/build/cjs/fs.cjs
CHANGED
|
@@ -28,6 +28,7 @@ __export(exports, {
|
|
|
28
28
|
PROTOCOL_HTTP: () => PROTOCOL_HTTP,
|
|
29
29
|
PROTOCOL_HTTPS: () => PROTOCOL_HTTPS,
|
|
30
30
|
canResolveView: () => canResolveView,
|
|
31
|
+
createIntegrityHash: () => createIntegrityHash,
|
|
31
32
|
filterProtocolEntries: () => filterProtocolEntries,
|
|
32
33
|
getViewSourceFromFile: () => getViewSourceFromFile,
|
|
33
34
|
hashContent: () => hashContent,
|
|
@@ -60,6 +61,10 @@ var PROTOCOL_FILE = "file://";
|
|
|
60
61
|
function hashContent(source) {
|
|
61
62
|
return import_crypto.default.createHash("md5").update(source).digest("hex");
|
|
62
63
|
}
|
|
64
|
+
function createIntegrityHash(source) {
|
|
65
|
+
const hash = import_crypto.default.createHash("sha256").update(source).digest("base64");
|
|
66
|
+
return `sha256-${hash}`;
|
|
67
|
+
}
|
|
63
68
|
function readFile(filePath) {
|
|
64
69
|
logMetrics(filePath);
|
|
65
70
|
return import_fs_extra.default.readFileSync(filePath, "utf8");
|
package/build/es/fs.d.ts
CHANGED
|
@@ -11,6 +11,10 @@ export declare const PROTOCOL_FILE = "file://";
|
|
|
11
11
|
* @param source
|
|
12
12
|
*/
|
|
13
13
|
export declare function hashContent(source: string | Buffer): string;
|
|
14
|
+
/**
|
|
15
|
+
* Create a Sub-resource Integrity Hash https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity
|
|
16
|
+
*/
|
|
17
|
+
export declare function createIntegrityHash(source: string | Buffer): string;
|
|
14
18
|
/**
|
|
15
19
|
* Read in the contents of the file path
|
|
16
20
|
* @param filePath
|
package/build/es/fs.js
CHANGED
|
@@ -20,6 +20,13 @@ export const PROTOCOL_FILE = 'file://';
|
|
|
20
20
|
export function hashContent(source) {
|
|
21
21
|
return crypto.createHash('md5').update(source).digest('hex');
|
|
22
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* Create a Sub-resource Integrity Hash https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity
|
|
25
|
+
*/
|
|
26
|
+
export function createIntegrityHash(source) {
|
|
27
|
+
const hash = crypto.createHash('sha256').update(source).digest('base64');
|
|
28
|
+
return `sha256-${hash}`;
|
|
29
|
+
}
|
|
23
30
|
/**
|
|
24
31
|
* Read in the contents of the file path
|
|
25
32
|
* @param filePath
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
|
-
"version": "0.13.0-alpha.
|
|
7
|
+
"version": "0.13.0-alpha.16",
|
|
8
8
|
"homepage": "https://developer.salesforce.com/docs/platform/lwr/overview",
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
"build/**/*.d.ts"
|
|
38
38
|
],
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@lwrjs/diagnostics": "0.13.0-alpha.
|
|
41
|
-
"es-module-lexer": "^1.5.
|
|
40
|
+
"@lwrjs/diagnostics": "0.13.0-alpha.16",
|
|
41
|
+
"es-module-lexer": "^1.5.3",
|
|
42
42
|
"fast-json-stable-stringify": "^2.1.0",
|
|
43
43
|
"magic-string": "^0.30.9",
|
|
44
44
|
"mime-types": "^2.1.33",
|
|
@@ -50,12 +50,12 @@
|
|
|
50
50
|
"slugify": "^1.4.5"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"@lwrjs/types": "0.13.0-alpha.
|
|
53
|
+
"@lwrjs/types": "0.13.0-alpha.16",
|
|
54
54
|
"@types/mime-types": "2.1.4",
|
|
55
55
|
"@types/path-to-regexp": "^1.7.0"
|
|
56
56
|
},
|
|
57
57
|
"engines": {
|
|
58
58
|
"node": ">=18.0.0"
|
|
59
59
|
},
|
|
60
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "5aabb958d70a4a962b207da21e852d7a801d7d44"
|
|
61
61
|
}
|