@lwrjs/fs-asset-provider 0.10.0-alpha.8 → 0.10.0
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 +5 -4
- package/build/es/index.js +3 -2
- package/package.json +6 -5
package/build/cjs/index.cjs
CHANGED
|
@@ -26,11 +26,11 @@ __markAsModule(exports);
|
|
|
26
26
|
__export(exports, {
|
|
27
27
|
default: () => src_default
|
|
28
28
|
});
|
|
29
|
-
var
|
|
29
|
+
var import_fs_extra = __toModule(require("fs-extra"));
|
|
30
30
|
var import_path = __toModule(require("path"));
|
|
31
31
|
var import_shared_utils = __toModule(require("@lwrjs/shared-utils"));
|
|
32
32
|
function hash(filePath) {
|
|
33
|
-
const result =
|
|
33
|
+
const result = import_fs_extra.default.statSync(filePath);
|
|
34
34
|
return (result.mtimeMs * 1e4).toString();
|
|
35
35
|
}
|
|
36
36
|
var FsAssetProvider = class {
|
|
@@ -76,7 +76,7 @@ var FsAssetProvider = class {
|
|
|
76
76
|
if (!this.cachedAssets.has(fullAssetPath)) {
|
|
77
77
|
const [assetPath2] = fullAssetPath.split("?");
|
|
78
78
|
const ext = (0, import_path.extname)(`x.${assetPath2}`).toLowerCase().substring(1);
|
|
79
|
-
if (ext &&
|
|
79
|
+
if (ext && import_fs_extra.default.existsSync(assetPath2)) {
|
|
80
80
|
const ownHash = hash(assetPath2);
|
|
81
81
|
const mimeType = (0, import_shared_utils.mimeLookup)(assetPath2);
|
|
82
82
|
const assetDef = {
|
|
@@ -86,7 +86,7 @@ var FsAssetProvider = class {
|
|
|
86
86
|
ownHash,
|
|
87
87
|
content: (passedEncoding) => {
|
|
88
88
|
const encoding = passedEncoding || (mimeType && mimeType.startsWith("text/") ? "utf-8" : null);
|
|
89
|
-
return
|
|
89
|
+
return import_fs_extra.default.readFileSync(assetPath2, {encoding});
|
|
90
90
|
}
|
|
91
91
|
};
|
|
92
92
|
this.cachedAssets.set(fullAssetPath, assetDef);
|
|
@@ -94,6 +94,7 @@ var FsAssetProvider = class {
|
|
|
94
94
|
this.watcher.add(assetPath2);
|
|
95
95
|
}
|
|
96
96
|
} else {
|
|
97
|
+
import_shared_utils.logger.debug(`[${this.name}] Asset ${fullAssetPath} did not exist on filesystem at ${assetPath2}`);
|
|
97
98
|
return void 0;
|
|
98
99
|
}
|
|
99
100
|
}
|
package/build/es/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import fs from 'fs';
|
|
1
|
+
import fs from 'fs-extra';
|
|
2
2
|
import { extname } from 'path';
|
|
3
|
-
import { mimeLookup, normalizeAssetSpecifier } from '@lwrjs/shared-utils';
|
|
3
|
+
import { logger, mimeLookup, normalizeAssetSpecifier } from '@lwrjs/shared-utils';
|
|
4
4
|
function hash(filePath) {
|
|
5
5
|
const result = fs.statSync(filePath);
|
|
6
6
|
return (result.mtimeMs * 10000).toString();
|
|
@@ -73,6 +73,7 @@ export default class FsAssetProvider {
|
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
75
|
else {
|
|
76
|
+
logger.debug(`[${this.name}] Asset ${fullAssetPath} did not exist on filesystem at ${assetPath}`);
|
|
76
77
|
// returned undefined move on to next provider
|
|
77
78
|
return undefined;
|
|
78
79
|
}
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
|
-
"version": "0.10.0
|
|
7
|
+
"version": "0.10.0",
|
|
8
8
|
"homepage": "https://developer.salesforce.com/docs/platform/lwr/overview",
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
@@ -30,13 +30,14 @@
|
|
|
30
30
|
"build/**/*.d.ts"
|
|
31
31
|
],
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@lwrjs/shared-utils": "0.10.0
|
|
33
|
+
"@lwrjs/shared-utils": "0.10.0",
|
|
34
|
+
"fs-extra": "^11.1.1"
|
|
34
35
|
},
|
|
35
36
|
"devDependencies": {
|
|
36
|
-
"@lwrjs/types": "0.10.0
|
|
37
|
+
"@lwrjs/types": "0.10.0"
|
|
37
38
|
},
|
|
38
39
|
"engines": {
|
|
39
|
-
"node": ">=16.0.0
|
|
40
|
+
"node": ">=16.0.0"
|
|
40
41
|
},
|
|
41
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "e6deaeef3db8aa079acefed508897eca19b3218a"
|
|
42
43
|
}
|