elit 3.4.1 → 3.4.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/dist/cli.js +6 -4
- package/dist/hmr.d.ts.map +1 -1
- package/dist/hmr.js +3 -0
- package/dist/hmr.js.map +1 -1
- package/dist/hmr.mjs +3 -0
- package/dist/hmr.mjs.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3 -0
- package/dist/index.mjs.map +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +5 -3
- package/dist/server.js.map +1 -1
- package/dist/server.mjs +5 -3
- package/dist/server.mjs.map +1 -1
- package/package.json +1 -1
- package/src/hmr.ts +5 -0
- package/src/server.ts +4 -2
package/package.json
CHANGED
package/src/hmr.ts
CHANGED
package/src/server.ts
CHANGED
|
@@ -1678,7 +1678,8 @@ export default css;
|
|
|
1678
1678
|
|
|
1679
1679
|
// Inject import map and SSR styles into <head>
|
|
1680
1680
|
const elitImportMap = await createElitImportMap(client.root, basePath, client.mode);
|
|
1681
|
-
const
|
|
1681
|
+
const modeScript = config.mode === 'preview' ? '<script>window.__ELIT_MODE__=\'preview\';</script>' : '';
|
|
1682
|
+
const headInjection = `${modeScript}${ssrStyles ? '\n' + ssrStyles : ''}\n${elitImportMap}`;
|
|
1682
1683
|
html = html.includes('</head>') ? html.replace('</head>', `${headInjection}</head>`) : html;
|
|
1683
1684
|
html = html.includes('</body>') ? html.replace('</body>', `${hmrScript}</body>`) : html + hmrScript;
|
|
1684
1685
|
content = Buffer.from(html);
|
|
@@ -1756,7 +1757,8 @@ export default css;
|
|
|
1756
1757
|
|
|
1757
1758
|
// Inject import map in head, HMR script in body
|
|
1758
1759
|
const elitImportMap = await createElitImportMap(client.root, basePath, client.mode);
|
|
1759
|
-
|
|
1760
|
+
const modeScript = config.mode === 'preview' ? '<script>window.__ELIT_MODE__=\'preview\';</script>\n' : '';
|
|
1761
|
+
html = html.includes('</head>') ? html.replace('</head>', `${modeScript}${elitImportMap}</head>`) : html;
|
|
1760
1762
|
html = html.includes('</body>') ? html.replace('</body>', `${hmrScript}</body>`) : html + hmrScript;
|
|
1761
1763
|
|
|
1762
1764
|
res.writeHead(200, {
|