vike 0.4.233-commit-e534fd6 → 0.4.233

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.
@@ -165,26 +165,9 @@ async function getHtmlTags(pageContext, streamFromReactStreamingPackage, injectF
165
165
  }
166
166
  function mergeScriptEntries(pageAssets, viteDevScript) {
167
167
  const scriptEntries = pageAssets.filter((pageAsset) => pageAsset.isEntry && pageAsset.assetType === 'script');
168
- let scriptEntry = `${viteDevScript}${scriptEntries.map((asset) => (0, inferHtmlTags_js_1.inferAssetTag)(asset)).join('')}`;
169
- // We merge scripts to avoid the infamous HMR preamble error.
170
- // - Infamous HMR preamble error:
171
- // ```browser-console
172
- // usePageContext.tsx:10 Uncaught (in promise) Error: @vitejs/plugin-react can't detect preamble. Something is wrong.
173
- // at usePageContext.tsx:10:10
174
- // ```
175
- // - Note the following race condition. Maybe making the second script non-async ensures execution order?
176
- // ```html
177
- // <script type="module">console.log("I can be printed *after* the other log")</script>
178
- // <script src="entry.js" type="module" async></script>
179
- // ```
180
- // ```js
181
- // // entry.js
182
- // console.log("I can be printed *before* the other log")
183
- // ```
184
- // - Maybe an alternative would be to make Vike's client runtime entry <script> tag non-async. Would that work? Would it be a performance issue?
185
- // - The entry <script> shouldn't be `<script defer>` upon HTML streaming, otherwise progressive hydration while SSR streaming won't work.
186
- scriptEntry = (0, mergeScriptTags_js_1.mergeScriptTags)(scriptEntry);
187
- return scriptEntry;
168
+ const scriptTagsHtml = `${viteDevScript}${scriptEntries.map((asset) => (0, inferHtmlTags_js_1.inferAssetTag)(asset)).join('')}`;
169
+ const scriptTag = (0, mergeScriptTags_js_1.mergeScriptTags)(scriptTagsHtml);
170
+ return scriptTag;
188
171
  }
189
172
  function getPageContextJsonScriptTag(pageContext) {
190
173
  const pageContextClientSerialized = (0, sanitizeJson_js_1.sanitizeJson)((0, serializeContext_js_1.getPageContextClientSerialized)(pageContext));
@@ -21,13 +21,7 @@ function mergeScriptTags(scriptTagsHtml) {
21
21
  const hasInnerHtml = !!innerHtml.trim();
22
22
  if (src) {
23
23
  (0, utils_js_1.assert)(!hasInnerHtml);
24
- // - We don't use a static import because static imports are hoisted => React's HMR preamble can be executed after user land code => triggering this error:
25
- // ```
26
- // [22:28:57.885][/test-dev.test.ts][pnpm run dev][Browser Error] Error: @vitejs/plugin-react-swc can't detect preamble. Something is wrong.
27
- // at http://localhost:3000/@fs/home/rom/code/docpress/src/renderer/usePageContext.tsx:9:11
28
- // ```
29
- // - We don't use `await` the dynamic import() to avoid waterfall
30
- contents.push(`import(${JSON.stringify(src)});`);
24
+ contents.push(`import ${JSON.stringify(src)};`);
31
25
  }
32
26
  else if (hasInnerHtml) {
33
27
  innerHtml = innerHtml.split('\n').filter(Boolean).join('\n');
@@ -2,4 +2,4 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PROJECT_VERSION = void 0;
4
4
  // Automatically updated by @brillout/release-me
5
- exports.PROJECT_VERSION = '0.4.233-commit-e534fd6';
5
+ exports.PROJECT_VERSION = '0.4.233';
@@ -156,7 +156,7 @@ declare function getPageContextBegin(isForErrorPage: boolean, { urlOriginal, isB
156
156
  declare global {
157
157
  var _vike: {
158
158
  fullyRenderedUrl?: string;
159
- } | undefined;
159
+ };
160
160
  }
161
161
  declare function disableClientRouting(err: unknown, log: boolean): void;
162
162
  declare function getRenderCount(): number;
@@ -160,26 +160,9 @@ async function getHtmlTags(pageContext, streamFromReactStreamingPackage, injectF
160
160
  }
161
161
  function mergeScriptEntries(pageAssets, viteDevScript) {
162
162
  const scriptEntries = pageAssets.filter((pageAsset) => pageAsset.isEntry && pageAsset.assetType === 'script');
163
- let scriptEntry = `${viteDevScript}${scriptEntries.map((asset) => inferAssetTag(asset)).join('')}`;
164
- // We merge scripts to avoid the infamous HMR preamble error.
165
- // - Infamous HMR preamble error:
166
- // ```browser-console
167
- // usePageContext.tsx:10 Uncaught (in promise) Error: @vitejs/plugin-react can't detect preamble. Something is wrong.
168
- // at usePageContext.tsx:10:10
169
- // ```
170
- // - Note the following race condition. Maybe making the second script non-async ensures execution order?
171
- // ```html
172
- // <script type="module">console.log("I can be printed *after* the other log")</script>
173
- // <script src="entry.js" type="module" async></script>
174
- // ```
175
- // ```js
176
- // // entry.js
177
- // console.log("I can be printed *before* the other log")
178
- // ```
179
- // - Maybe an alternative would be to make Vike's client runtime entry <script> tag non-async. Would that work? Would it be a performance issue?
180
- // - The entry <script> shouldn't be `<script defer>` upon HTML streaming, otherwise progressive hydration while SSR streaming won't work.
181
- scriptEntry = mergeScriptTags(scriptEntry);
182
- return scriptEntry;
163
+ const scriptTagsHtml = `${viteDevScript}${scriptEntries.map((asset) => inferAssetTag(asset)).join('')}`;
164
+ const scriptTag = mergeScriptTags(scriptTagsHtml);
165
+ return scriptTag;
183
166
  }
184
167
  function getPageContextJsonScriptTag(pageContext) {
185
168
  const pageContextClientSerialized = sanitizeJson(getPageContextClientSerialized(pageContext));
@@ -19,13 +19,7 @@ function mergeScriptTags(scriptTagsHtml) {
19
19
  const hasInnerHtml = !!innerHtml.trim();
20
20
  if (src) {
21
21
  assert(!hasInnerHtml);
22
- // - We don't use a static import because static imports are hoisted => React's HMR preamble can be executed after user land code => triggering this error:
23
- // ```
24
- // [22:28:57.885][/test-dev.test.ts][pnpm run dev][Browser Error] Error: @vitejs/plugin-react-swc can't detect preamble. Something is wrong.
25
- // at http://localhost:3000/@fs/home/rom/code/docpress/src/renderer/usePageContext.tsx:9:11
26
- // ```
27
- // - We don't use `await` the dynamic import() to avoid waterfall
28
- contents.push(`import(${JSON.stringify(src)});`);
22
+ contents.push(`import ${JSON.stringify(src)};`);
29
23
  }
30
24
  else if (hasInnerHtml) {
31
25
  innerHtml = innerHtml.split('\n').filter(Boolean).join('\n');
@@ -1 +1 @@
1
- export declare const PROJECT_VERSION: "0.4.233-commit-e534fd6";
1
+ export declare const PROJECT_VERSION: "0.4.233";
@@ -1,2 +1,2 @@
1
1
  // Automatically updated by @brillout/release-me
2
- export const PROJECT_VERSION = '0.4.233-commit-e534fd6';
2
+ export const PROJECT_VERSION = '0.4.233';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vike",
3
- "version": "0.4.233-commit-e534fd6",
3
+ "version": "0.4.233",
4
4
  "repository": "https://github.com/vikejs/vike",
5
5
  "exports": {
6
6
  "./server": {