vanilla-jet 1.6.1 → 1.6.2
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/CHANGELOG.md +15 -0
- package/package.json +1 -1
- package/scripts/compile_html.js +20 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,21 @@ All notable project changes are documented in this file.
|
|
|
4
4
|
|
|
5
5
|
The format follows a structure inspired by Keep a Changelog and semantic versioning.
|
|
6
6
|
|
|
7
|
+
## [1.6.2] - 2026-06-30
|
|
8
|
+
|
|
9
|
+
### Fixed
|
|
10
|
+
|
|
11
|
+
- **Template externalization now self-cleans:** disabling `externalize_templates` (or never enabling it)
|
|
12
|
+
removes any previously generated `public/scripts/templates.js` (+ `.gz`/`.br`), so toggling the flag
|
|
13
|
+
never leaves a stale 749 KB file behind (which the service worker would otherwise precache).
|
|
14
|
+
|
|
15
|
+
### Notes
|
|
16
|
+
|
|
17
|
+
- **`externalize_templates` caveat (WebView):** it shrinks the initial HTML for web browsers, but it injects
|
|
18
|
+
all templates via one synchronous `innerHTML`. On slower JS engines (native WebViews — WKWebView /
|
|
19
|
+
Android WebView) that block can stall the boot. **Prefer it OFF for apps loaded primarily inside a
|
|
20
|
+
WebView**; keep it ON only for pure-web apps that benefit from a smaller first byte.
|
|
21
|
+
|
|
7
22
|
## [1.6.1] - 2026-06-29
|
|
8
23
|
|
|
9
24
|
### Security
|
package/package.json
CHANGED
package/scripts/compile_html.js
CHANGED
|
@@ -201,6 +201,10 @@ async function createHTMLFile(content, filePath) {
|
|
|
201
201
|
// bundle (defer + document order), so views still find their templates in the DOM at boot.
|
|
202
202
|
if (opts.externalize_templates) {
|
|
203
203
|
minified = externalizeTemplates(minified);
|
|
204
|
+
} else {
|
|
205
|
+
// Feature off: remove any previously generated templates.js so a stale 749KB file
|
|
206
|
+
// isn't left behind (and isn't precached by the service worker).
|
|
207
|
+
removeStaleTemplatesFile();
|
|
204
208
|
}
|
|
205
209
|
|
|
206
210
|
const publicPath = path.join(processCwd(), '/public/pages');
|
|
@@ -218,6 +222,22 @@ async function createHTMLFile(content, filePath) {
|
|
|
218
222
|
console.log(chalk.green(`Created gzipped version at: ${absolutePath}.gz`));
|
|
219
223
|
}
|
|
220
224
|
|
|
225
|
+
// -- Remove a previously generated public/scripts/templates.js (+ compressed siblings)
|
|
226
|
+
// when externalization is disabled, so toggling the flag never leaves a stale file behind.
|
|
227
|
+
function removeStaleTemplatesFile() {
|
|
228
|
+
const base = path.join(processCwd(), 'public', 'scripts', 'templates.js');
|
|
229
|
+
['', '.gz', '.br'].forEach((ext) => {
|
|
230
|
+
try {
|
|
231
|
+
if (fs.existsSync(base + ext)) {
|
|
232
|
+
fs.unlinkSync(base + ext);
|
|
233
|
+
console.log(chalk.green(`VanillaJet - removed stale public/scripts/templates.js${ext}`));
|
|
234
|
+
}
|
|
235
|
+
} catch (err) {
|
|
236
|
+
// Non-fatal: never fail the build over cleanup.
|
|
237
|
+
}
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
|
|
221
241
|
// -- Move all <script type="text/template"> blocks out of the page into
|
|
222
242
|
// public/scripts/templates.js (a tiny injector that adds them to the DOM). Returns the
|
|
223
243
|
// page HTML with those blocks replaced by a single deferred <script> tag (placed where the
|