(viewName: string)
| 1148 | } |
| 1149 | |
| 1150 | private computeViewVersionParam(viewName: string): string { |
| 1151 | if (process.env.NODE_ENV !== "production") { |
| 1152 | return ""; |
| 1153 | } |
| 1154 | try { |
| 1155 | const viewFile = this.lookupViewFile(viewName); |
| 1156 | const styleFile = this.lookupDistFile("style.css") ?? ""; |
| 1157 | const hash = crypto |
| 1158 | .createHash("sha256") |
| 1159 | .update(viewFile) |
| 1160 | .update("\0") |
| 1161 | .update(styleFile) |
| 1162 | .digest("hex") |
| 1163 | .slice(0, 8); |
| 1164 | return `?v=${hash}`; |
| 1165 | } catch { |
| 1166 | return ""; |
| 1167 | } |
| 1168 | } |
| 1169 | |
| 1170 | private lookupViewFile(viewName: string) { |
| 1171 | const manifest = this.readManifest(); |
no test coverage detected