File tree Expand file tree Collapse file tree 1 file changed +21
-2
lines changed Expand file tree Collapse file tree 1 file changed +21
-2
lines changed Original file line number Diff line number Diff line change 1
1
#if canImport(Leaf)
2
2
import Leaf
3
+ import Vapor
3
4
4
5
enum ViteTagError : Error {
5
6
case invalidResourceParameter
@@ -37,12 +38,30 @@ struct ViteTag: UnsafeUnescapedLeafTag {
37
38
}
38
39
39
40
private extension LeafContext {
41
+ // This is to work around this bug in Leaf:
42
+ // https://github.com/vapor/leaf/pull/235
43
+ private var _application : Application ? {
44
+ guard let value = userInfo [ " application " ] else {
45
+ return nil
46
+ }
47
+
48
+ if let app = value as? Application {
49
+ return app
50
+ }
51
+
52
+ if let leaf = value as? Application . Leaf {
53
+ return leaf. application
54
+ }
55
+
56
+ return nil
57
+ }
58
+
40
59
var viteManifest : ViteManifest {
41
- return application ? . vite. withManifest ( { $0 } ) ?? [ : ]
60
+ return _application ? . vite. withManifest ( { $0 } ) ?? [ : ]
42
61
}
43
62
44
63
var viteEnvironment : Vite . Environment {
45
- return application ? . environment == . production
64
+ return _application ? . environment == . production
46
65
? . production
47
66
: . development
48
67
}
You can’t perform that action at this time.
0 commit comments