@modern-js/utils 0.0.0-next-1685282810521 → 0.0.0-next-1685343732023
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
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
# @modern-js/utils
|
|
2
2
|
|
|
3
|
-
## 0.0.0-next-
|
|
3
|
+
## 0.0.0-next-1685343732023
|
|
4
4
|
|
|
5
5
|
### Patch Changes
|
|
6
6
|
|
|
7
|
-
-
|
|
7
|
+
- 3d48836b30: chore(deps): fix all missing peer dependencies
|
|
8
8
|
|
|
9
9
|
chore(deps): 修复缺少的 peer dependencies
|
|
10
10
|
|
|
11
|
+
- 5050e8e6b5: fix: browser should get last element that server insert to html for baseUrl
|
|
12
|
+
fix: 浏览器需要获取最后一个 Server 注入 HTML 的 baseUrl 数据
|
|
13
|
+
|
|
11
14
|
## 2.21.1
|
|
12
15
|
|
|
13
16
|
## 2.21.0
|
|
@@ -7,7 +7,11 @@ Object.defineProperty(exports, "parsedJSONFromElement", {
|
|
|
7
7
|
get: () => parsedJSONFromElement
|
|
8
8
|
});
|
|
9
9
|
const parsedJSONFromElement = (id) => {
|
|
10
|
-
const
|
|
10
|
+
const elements = document.querySelectorAll(`#${id}`);
|
|
11
|
+
if (elements.length === 0) {
|
|
12
|
+
return void 0;
|
|
13
|
+
}
|
|
14
|
+
const element = elements[elements.length - 1];
|
|
11
15
|
if (element) {
|
|
12
16
|
try {
|
|
13
17
|
const parsed = JSON.parse((element === null || element === void 0 ? void 0 : element.textContent) || "");
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
export const parsedJSONFromElement = (id) => {
|
|
2
|
-
const
|
|
2
|
+
const elements = document.querySelectorAll(`#${id}`);
|
|
3
|
+
if (elements.length === 0) {
|
|
4
|
+
return void 0;
|
|
5
|
+
}
|
|
6
|
+
const element = elements[elements.length - 1];
|
|
3
7
|
if (element) {
|
|
4
8
|
try {
|
|
5
9
|
const parsed = JSON.parse((element === null || element === void 0 ? void 0 : element.textContent) || "");
|
package/package.json
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"modern",
|
|
16
16
|
"modern.js"
|
|
17
17
|
],
|
|
18
|
-
"version": "0.0.0-next-
|
|
18
|
+
"version": "0.0.0-next-1685343732023",
|
|
19
19
|
"jsnext:source": "./src/index.ts",
|
|
20
20
|
"types": "./dist/types/index.d.ts",
|
|
21
21
|
"main": "./dist/cjs/index.js",
|
|
@@ -231,9 +231,9 @@
|
|
|
231
231
|
"typescript": "^5",
|
|
232
232
|
"webpack": "^5.82.1",
|
|
233
233
|
"@types/serialize-javascript": "^5.0.1",
|
|
234
|
-
"@modern-js/types": "0.0.0-next-
|
|
235
|
-
"@scripts/jest-config": "0.0.0-next-
|
|
236
|
-
"@scripts/build": "0.0.0-next-
|
|
234
|
+
"@modern-js/types": "0.0.0-next-1685343732023",
|
|
235
|
+
"@scripts/jest-config": "0.0.0-next-1685343732023",
|
|
236
|
+
"@scripts/build": "0.0.0-next-1685343732023"
|
|
237
237
|
},
|
|
238
238
|
"sideEffects": false,
|
|
239
239
|
"scripts": {
|