@lwrjs/fs-asset-provider 0.6.0-alpha.8 → 0.6.1
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/index.cjs +8 -7
- package/build/es/index.js +8 -7
- package/package.json +4 -4
package/build/cjs/index.cjs
CHANGED
|
@@ -62,19 +62,20 @@ var FsAssetProvider = class {
|
|
|
62
62
|
async getAsset(fullAssetPath) {
|
|
63
63
|
fullAssetPath = decodeURI(fullAssetPath);
|
|
64
64
|
if (!this.cachedAssets.has(fullAssetPath)) {
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
|
|
65
|
+
const [assetPath] = fullAssetPath.split("?");
|
|
66
|
+
const ext = (0, import_path.extname)(`x.${assetPath}`).toLowerCase().substr(1);
|
|
67
|
+
if (ext && import_fs.default.existsSync(assetPath)) {
|
|
68
|
+
const ownHash = hash(assetPath);
|
|
68
69
|
const assetDef = {
|
|
69
|
-
entry:
|
|
70
|
+
entry: assetPath,
|
|
70
71
|
ext,
|
|
71
|
-
mime: (0, import_shared_utils.mimeLookup)(
|
|
72
|
+
mime: (0, import_shared_utils.mimeLookup)(assetPath),
|
|
72
73
|
ownHash,
|
|
73
|
-
content: (encoding) => import_fs.default.readFileSync(
|
|
74
|
+
content: (encoding) => import_fs.default.readFileSync(assetPath, encoding)
|
|
74
75
|
};
|
|
75
76
|
this.cachedAssets.set(fullAssetPath, assetDef);
|
|
76
77
|
if (this.watcher) {
|
|
77
|
-
this.watcher.add(
|
|
78
|
+
this.watcher.add(assetPath);
|
|
78
79
|
}
|
|
79
80
|
}
|
|
80
81
|
}
|
package/build/es/index.js
CHANGED
|
@@ -33,20 +33,21 @@ export default class FsAssetProvider {
|
|
|
33
33
|
async getAsset(fullAssetPath) {
|
|
34
34
|
fullAssetPath = decodeURI(fullAssetPath); // decodeURIComponent decodes too many things (eg: /)
|
|
35
35
|
if (!this.cachedAssets.has(fullAssetPath)) {
|
|
36
|
+
const [assetPath] = fullAssetPath.split('?'); // remove query params
|
|
36
37
|
// Clever normalization to avoid corner cases
|
|
37
|
-
const ext = extname(`x.${
|
|
38
|
-
if (ext && fs.existsSync(
|
|
39
|
-
const ownHash = hash(
|
|
38
|
+
const ext = extname(`x.${assetPath}`).toLowerCase().substr(1);
|
|
39
|
+
if (ext && fs.existsSync(assetPath)) {
|
|
40
|
+
const ownHash = hash(assetPath);
|
|
40
41
|
const assetDef = {
|
|
41
|
-
entry:
|
|
42
|
+
entry: assetPath,
|
|
42
43
|
ext: ext,
|
|
43
|
-
mime: mimeLookup(
|
|
44
|
+
mime: mimeLookup(assetPath),
|
|
44
45
|
ownHash,
|
|
45
|
-
content: (encoding) => fs.readFileSync(
|
|
46
|
+
content: (encoding) => fs.readFileSync(assetPath, encoding),
|
|
46
47
|
};
|
|
47
48
|
this.cachedAssets.set(fullAssetPath, assetDef);
|
|
48
49
|
if (this.watcher) {
|
|
49
|
-
this.watcher.add(
|
|
50
|
+
this.watcher.add(assetPath);
|
|
50
51
|
}
|
|
51
52
|
}
|
|
52
53
|
}
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
|
-
"version": "0.6.
|
|
7
|
+
"version": "0.6.1",
|
|
8
8
|
"homepage": "https://developer.salesforce.com/docs/platform/lwr/overview",
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
@@ -30,13 +30,13 @@
|
|
|
30
30
|
"build/**/*.d.ts"
|
|
31
31
|
],
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@lwrjs/shared-utils": "0.6.
|
|
33
|
+
"@lwrjs/shared-utils": "0.6.1"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@lwrjs/types": "0.6.
|
|
36
|
+
"@lwrjs/types": "0.6.1"
|
|
37
37
|
},
|
|
38
38
|
"engines": {
|
|
39
39
|
"node": ">=14.15.4 <17"
|
|
40
40
|
},
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "4d7c44dfae958fe24ef1c94b0f60aa2b15e12f24"
|
|
42
42
|
}
|