@lensjs/express 1.3.1 → 1.3.3

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/dist/adapter.cjs CHANGED
@@ -85,18 +85,20 @@ var ExpressAdapter = class extends import_core.LensAdapter {
85
85
  });
86
86
  }
87
87
  serveUI(uiPath, spaRoute, _dataToInject) {
88
- this.app.use(this.normalizePath(spaRoute), import_express.default.static(uiPath));
88
+ this.app.use(
89
+ this.normalizePath(spaRoute),
90
+ import_express.default.static(uiPath, { fallthrough: true })
91
+ );
89
92
  this.app.get(
90
93
  this.normalizePath(`${spaRoute}/favicon.ico`),
91
- (_, res) => res.sendFile(path.join(uiPath, "favicon.ico"))
94
+ (_, res) => res.sendFile("favicon.ico", { root: uiPath })
92
95
  );
93
96
  this.app.get(new RegExp(`^/${spaRoute}(?!/api)(/.*)?$`), (req, res) => {
94
97
  if (import_core.lensUtils.isStaticFile(req.path.split("/"))) {
95
- return res.download(
96
- path.join(uiPath, import_core.lensUtils.stripBeforeAssetsPath(req.path))
97
- );
98
+ const staticFile = import_core.lensUtils.stripBeforeAssetsPath(req.path).split(path.sep)[1];
99
+ return res.sendFile(staticFile, { root: path.join(uiPath, "assets") });
98
100
  }
99
- return res.sendFile(path.join(uiPath, "index.html"));
101
+ return res.sendFile("index.html", { root: uiPath });
100
102
  });
101
103
  }
102
104
  async watchCache(watcher) {
package/dist/adapter.js CHANGED
@@ -57,18 +57,20 @@ var ExpressAdapter = class extends LensAdapter {
57
57
  });
58
58
  }
59
59
  serveUI(uiPath, spaRoute, _dataToInject) {
60
- this.app.use(this.normalizePath(spaRoute), express.static(uiPath));
60
+ this.app.use(
61
+ this.normalizePath(spaRoute),
62
+ express.static(uiPath, { fallthrough: true })
63
+ );
61
64
  this.app.get(
62
65
  this.normalizePath(`${spaRoute}/favicon.ico`),
63
- (_, res) => res.sendFile(path.join(uiPath, "favicon.ico"))
66
+ (_, res) => res.sendFile("favicon.ico", { root: uiPath })
64
67
  );
65
68
  this.app.get(new RegExp(`^/${spaRoute}(?!/api)(/.*)?$`), (req, res) => {
66
69
  if (lensUtils.isStaticFile(req.path.split("/"))) {
67
- return res.download(
68
- path.join(uiPath, lensUtils.stripBeforeAssetsPath(req.path))
69
- );
70
+ const staticFile = lensUtils.stripBeforeAssetsPath(req.path).split(path.sep)[1];
71
+ return res.sendFile(staticFile, { root: path.join(uiPath, "assets") });
70
72
  }
71
- return res.sendFile(path.join(uiPath, "index.html"));
73
+ return res.sendFile("index.html", { root: uiPath });
72
74
  });
73
75
  }
74
76
  async watchCache(watcher) {
package/dist/index.cjs CHANGED
@@ -90,18 +90,20 @@ var ExpressAdapter = class extends import_core.LensAdapter {
90
90
  });
91
91
  }
92
92
  serveUI(uiPath, spaRoute, _dataToInject) {
93
- this.app.use(this.normalizePath(spaRoute), import_express.default.static(uiPath));
93
+ this.app.use(
94
+ this.normalizePath(spaRoute),
95
+ import_express.default.static(uiPath, { fallthrough: true })
96
+ );
94
97
  this.app.get(
95
98
  this.normalizePath(`${spaRoute}/favicon.ico`),
96
- (_, res) => res.sendFile(path.join(uiPath, "favicon.ico"))
99
+ (_, res) => res.sendFile("favicon.ico", { root: uiPath })
97
100
  );
98
101
  this.app.get(new RegExp(`^/${spaRoute}(?!/api)(/.*)?$`), (req, res) => {
99
102
  if (import_core.lensUtils.isStaticFile(req.path.split("/"))) {
100
- return res.download(
101
- path.join(uiPath, import_core.lensUtils.stripBeforeAssetsPath(req.path))
102
- );
103
+ const staticFile = import_core.lensUtils.stripBeforeAssetsPath(req.path).split(path.sep)[1];
104
+ return res.sendFile(staticFile, { root: path.join(uiPath, "assets") });
103
105
  }
104
- return res.sendFile(path.join(uiPath, "index.html"));
106
+ return res.sendFile("index.html", { root: uiPath });
105
107
  });
106
108
  }
107
109
  async watchCache(watcher) {
package/dist/index.js CHANGED
@@ -67,18 +67,20 @@ var ExpressAdapter = class extends LensAdapter {
67
67
  });
68
68
  }
69
69
  serveUI(uiPath, spaRoute, _dataToInject) {
70
- this.app.use(this.normalizePath(spaRoute), express.static(uiPath));
70
+ this.app.use(
71
+ this.normalizePath(spaRoute),
72
+ express.static(uiPath, { fallthrough: true })
73
+ );
71
74
  this.app.get(
72
75
  this.normalizePath(`${spaRoute}/favicon.ico`),
73
- (_, res) => res.sendFile(path.join(uiPath, "favicon.ico"))
76
+ (_, res) => res.sendFile("favicon.ico", { root: uiPath })
74
77
  );
75
78
  this.app.get(new RegExp(`^/${spaRoute}(?!/api)(/.*)?$`), (req, res) => {
76
79
  if (lensUtils.isStaticFile(req.path.split("/"))) {
77
- return res.download(
78
- path.join(uiPath, lensUtils.stripBeforeAssetsPath(req.path))
79
- );
80
+ const staticFile = lensUtils.stripBeforeAssetsPath(req.path).split(path.sep)[1];
81
+ return res.sendFile(staticFile, { root: path.join(uiPath, "assets") });
80
82
  }
81
- return res.sendFile(path.join(uiPath, "index.html"));
83
+ return res.sendFile("index.html", { root: uiPath });
82
84
  });
83
85
  }
84
86
  async watchCache(watcher) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lensjs/express",
3
- "version": "1.3.1",
3
+ "version": "1.3.3",
4
4
  "description": "Express adapter for LensJs",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -39,10 +39,10 @@
39
39
  ],
40
40
  "dependencies": {
41
41
  "express": "^5.1.0",
42
- "@lensjs/typescript-config": "1.0.12",
43
- "@lensjs/core": "2.2.1",
42
+ "@lensjs/core": "2.2.2",
44
43
  "@lensjs/date": "1.0.12",
45
- "@lensjs/watchers": "1.0.17"
44
+ "@lensjs/typescript-config": "1.0.12",
45
+ "@lensjs/watchers": "1.0.18"
46
46
  },
47
47
  "devDependencies": {
48
48
  "@types/express": "^5.0.3",