@modern-js/runtime 2.48.3 → 2.48.4

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,12 +165,9 @@ const documentPlugin = () => ({
165
165
  ].join("");
166
166
  const metas = [
167
167
  templateParameters.meta,
168
- htmlWebpackPlugin.tags.headTags.filter((item) => item.tagName !== "script" && item.tagName !== "link").join("")
169
- ].join("");
170
- const titles = [
171
- templateParameters.title,
172
- htmlWebpackPlugin.tags.headTags.filter((item) => item.tagName === "title").join("")
168
+ htmlWebpackPlugin.tags.headTags.filter((item) => item.tagName !== "script" && item.tagName !== "link" && item.tagName !== "title").join("")
173
169
  ].join("");
170
+ const titles = htmlWebpackPlugin.tags.headTags.filter((item) => item.tagName === "title").join("").replace("<title>", "").replace("</title>", "") || templateParameters.title;
174
171
  if (html.includes(import_constants.DOCUMENT_SCRIPT_PLACEHOLDER_START) && html.includes(import_constants.DOCUMENT_SCRIPT_PLACEHOLDER_END)) {
175
172
  const { nonce } = config.security;
176
173
  const nonceAttr = nonce ? `nonce=${nonce}` : "";
@@ -66,7 +66,7 @@ const ssr = (config) => ({
66
66
  const { ssrContext } = hydrateContext;
67
67
  const currentPathname = (0, import_url.normalizePathname)(window.location.pathname);
68
68
  const initialPathname = (0, import_url.normalizePathname)(ssrContext.request.pathname);
69
- if (initialPathname !== currentPathname) {
69
+ if (initialPathname !== currentPathname && context.router) {
70
70
  const errorMsg = `The initial URL ${initialPathname} and the URL ${currentPathname} to be hydrated do not match, reload.`;
71
71
  console.error(errorMsg);
72
72
  window.location.reload();
@@ -182,15 +182,12 @@ var documentPlugin = function() {
182
182
  metas = [
183
183
  templateParameters.meta,
184
184
  htmlWebpackPlugin.tags.headTags.filter(function(item) {
185
- return item.tagName !== "script" && item.tagName !== "link";
186
- }).join("")
187
- ].join("");
188
- titles = [
189
- templateParameters.title,
190
- htmlWebpackPlugin.tags.headTags.filter(function(item) {
191
- return item.tagName === "title";
185
+ return item.tagName !== "script" && item.tagName !== "link" && item.tagName !== "title";
192
186
  }).join("")
193
187
  ].join("");
188
+ titles = htmlWebpackPlugin.tags.headTags.filter(function(item) {
189
+ return item.tagName === "title";
190
+ }).join("").replace("<title>", "").replace("</title>", "") || templateParameters.title;
194
191
  if (html.includes(DOCUMENT_SCRIPT_PLACEHOLDER_START) && html.includes(DOCUMENT_SCRIPT_PLACEHOLDER_END)) {
195
192
  nonce = config.security.nonce;
196
193
  nonceAttr = nonce ? "nonce=".concat(nonce) : "";
@@ -91,7 +91,7 @@ var ssr = function(config) {
91
91
  ssrContext = hydrateContext.ssrContext;
92
92
  currentPathname = normalizePathname(window.location.pathname);
93
93
  initialPathname = normalizePathname(ssrContext.request.pathname);
94
- if (initialPathname !== currentPathname) {
94
+ if (initialPathname !== currentPathname && context.router) {
95
95
  errorMsg = "The initial URL ".concat(initialPathname, " and the URL ").concat(currentPathname, " to be hydrated do not match, reload.");
96
96
  console.error(errorMsg);
97
97
  window.location.reload();
@@ -130,12 +130,9 @@ const documentPlugin = () => ({
130
130
  ].join("");
131
131
  const metas = [
132
132
  templateParameters.meta,
133
- htmlWebpackPlugin.tags.headTags.filter((item) => item.tagName !== "script" && item.tagName !== "link").join("")
134
- ].join("");
135
- const titles = [
136
- templateParameters.title,
137
- htmlWebpackPlugin.tags.headTags.filter((item) => item.tagName === "title").join("")
133
+ htmlWebpackPlugin.tags.headTags.filter((item) => item.tagName !== "script" && item.tagName !== "link" && item.tagName !== "title").join("")
138
134
  ].join("");
135
+ const titles = htmlWebpackPlugin.tags.headTags.filter((item) => item.tagName === "title").join("").replace("<title>", "").replace("</title>", "") || templateParameters.title;
139
136
  if (html.includes(DOCUMENT_SCRIPT_PLACEHOLDER_START) && html.includes(DOCUMENT_SCRIPT_PLACEHOLDER_END)) {
140
137
  const { nonce } = config.security;
141
138
  const nonceAttr = nonce ? `nonce=${nonce}` : "";
@@ -30,7 +30,7 @@ const ssr = (config) => ({
30
30
  const { ssrContext } = hydrateContext;
31
31
  const currentPathname = normalizePathname(window.location.pathname);
32
32
  const initialPathname = normalizePathname(ssrContext.request.pathname);
33
- if (initialPathname !== currentPathname) {
33
+ if (initialPathname !== currentPathname && context.router) {
34
34
  const errorMsg = `The initial URL ${initialPathname} and the URL ${currentPathname} to be hydrated do not match, reload.`;
35
35
  console.error(errorMsg);
36
36
  window.location.reload();
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "2.48.3",
18
+ "version": "2.48.4",
19
19
  "engines": {
20
20
  "node": ">=14.17.6"
21
21
  },
@@ -171,10 +171,10 @@
171
171
  "react-side-effect": "^2.1.1",
172
172
  "styled-components": "^5.3.1",
173
173
  "@swc/helpers": "0.5.3",
174
- "@modern-js/plugin": "2.48.3",
175
- "@modern-js/utils": "2.48.3",
176
- "@modern-js/types": "2.48.3",
177
- "@modern-js/runtime-utils": "2.48.3"
174
+ "@modern-js/plugin": "2.48.4",
175
+ "@modern-js/types": "2.48.4",
176
+ "@modern-js/utils": "2.48.4",
177
+ "@modern-js/runtime-utils": "2.48.4"
178
178
  },
179
179
  "peerDependencies": {
180
180
  "react": ">=17",
@@ -194,12 +194,12 @@
194
194
  "react-dom": "^18",
195
195
  "ts-jest": "^29.1.0",
196
196
  "typescript": "^5",
197
- "webpack": "^5.89.0",
198
- "@scripts/build": "2.48.3",
199
- "@modern-js/server-core": "2.48.3",
200
- "@modern-js/core": "2.48.3",
201
- "@modern-js/app-tools": "2.48.3",
202
- "@scripts/jest-config": "2.48.3"
197
+ "webpack": "^5.91.0",
198
+ "@modern-js/server-core": "2.48.4",
199
+ "@modern-js/core": "2.48.4",
200
+ "@scripts/build": "2.48.4",
201
+ "@modern-js/app-tools": "2.48.4",
202
+ "@scripts/jest-config": "2.48.4"
203
203
  },
204
204
  "sideEffects": false,
205
205
  "publishConfig": {