@lwrjs/fs-asset-provider 0.6.0 → 0.7.0-alpha.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.
@@ -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 ext = (0, import_path.extname)(`x.${fullAssetPath}`).toLowerCase().substr(1);
66
- if (ext && import_fs.default.existsSync(fullAssetPath)) {
67
- const ownHash = hash(fullAssetPath);
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: fullAssetPath,
70
+ entry: assetPath,
70
71
  ext,
71
- mime: (0, import_shared_utils.mimeLookup)(fullAssetPath),
72
+ mime: (0, import_shared_utils.mimeLookup)(assetPath),
72
73
  ownHash,
73
- content: (encoding) => import_fs.default.readFileSync(fullAssetPath, encoding)
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(fullAssetPath);
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.${fullAssetPath}`).toLowerCase().substr(1);
38
- if (ext && fs.existsSync(fullAssetPath)) {
39
- const ownHash = hash(fullAssetPath);
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: fullAssetPath,
42
+ entry: assetPath,
42
43
  ext: ext,
43
- mime: mimeLookup(fullAssetPath),
44
+ mime: mimeLookup(assetPath),
44
45
  ownHash,
45
- content: (encoding) => fs.readFileSync(fullAssetPath, encoding),
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(fullAssetPath);
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.0",
7
+ "version": "0.7.0-alpha.0",
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.0"
33
+ "@lwrjs/shared-utils": "0.7.0-alpha.0"
34
34
  },
35
35
  "devDependencies": {
36
- "@lwrjs/types": "0.6.0"
36
+ "@lwrjs/types": "0.7.0-alpha.0"
37
37
  },
38
38
  "engines": {
39
39
  "node": ">=14.15.4 <17"
40
40
  },
41
- "gitHead": "31769655f0155ad7e54cf37bccdf72d0baaf44ab"
41
+ "gitHead": "4ed70d0bb9fd53feb629468b558b882adade0967"
42
42
  }