@k37z3r/jbase 2.0.2 → 2.0.3
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 +9 -1
- package/dist/index.cjs +33 -10
- package/dist/index.cjs.map +2 -2
- package/dist/index.mjs +33 -10
- package/dist/index.mjs.map +2 -2
- package/dist/jbase.browser.js +33 -10
- package/dist/jbase.browser.js.map +2 -2
- package/dist/jbase.min.js +2 -2
- package/dist/jbase.min.js.map +3 -3
- package/dist/modules/http/get.d.ts +7 -3
- package/dist/modules/http/get.d.ts.map +1 -1
- package/dist/modules/http/index.d.ts +3 -3
- package/dist/modules/http/post.d.ts +5 -3
- package/dist/modules/http/post.d.ts.map +1 -1
- package/dist/server.js +33 -10
- package/dist/server.js.map +2 -2
- package/package.json +1 -1
package/dist/jbase.browser.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @k37z3r/jbase - A modern micro-framework for the web: jBase offers the familiar syntax of classic DOM libraries, but without their baggage. Fully typed, modular, and optimized for modern browser engines.
|
|
3
|
-
* @version 2.0.
|
|
3
|
+
* @version 2.0.3
|
|
4
4
|
* @homepage https://github.com/k37z3r/jBase-2.0
|
|
5
5
|
* @author Sven Minio (https://github.com/k37z3r/jBase-2.0)
|
|
6
6
|
* @license GPL-3.0-or-later
|
|
@@ -1675,9 +1675,16 @@
|
|
|
1675
1675
|
get: () => get,
|
|
1676
1676
|
getText: () => getText
|
|
1677
1677
|
});
|
|
1678
|
-
async function get(url) {
|
|
1678
|
+
async function get(url, option) {
|
|
1679
|
+
const fetchOptions = { ...option };
|
|
1680
|
+
if (fetchOptions.method?.toLowerCase() === "post") {
|
|
1681
|
+
fetchOptions.method = "GET";
|
|
1682
|
+
}
|
|
1683
|
+
if (!fetchOptions.signal) {
|
|
1684
|
+
fetchOptions.signal = AbortSignal.timeout(5e3);
|
|
1685
|
+
}
|
|
1679
1686
|
const response = await fetch(url, {
|
|
1680
|
-
|
|
1687
|
+
...fetchOptions
|
|
1681
1688
|
});
|
|
1682
1689
|
if (!response.ok) {
|
|
1683
1690
|
throw new Error(`HTTP Error: ${response.status}`);
|
|
@@ -1685,8 +1692,17 @@
|
|
|
1685
1692
|
const text2 = await response.text();
|
|
1686
1693
|
return text2 ? JSON.parse(text2) : {};
|
|
1687
1694
|
}
|
|
1688
|
-
async function getText(url) {
|
|
1689
|
-
const
|
|
1695
|
+
async function getText(url, option) {
|
|
1696
|
+
const fetchOptions = { ...option };
|
|
1697
|
+
if (fetchOptions.method?.toLowerCase() !== "get") {
|
|
1698
|
+
fetchOptions.method = "GET";
|
|
1699
|
+
}
|
|
1700
|
+
if (!fetchOptions.signal) {
|
|
1701
|
+
fetchOptions.signal = AbortSignal.timeout(5e3);
|
|
1702
|
+
}
|
|
1703
|
+
const response = await fetch(url, {
|
|
1704
|
+
...fetchOptions
|
|
1705
|
+
});
|
|
1690
1706
|
if (!response.ok) {
|
|
1691
1707
|
throw new Error(`HTTP Error: ${response.status}`);
|
|
1692
1708
|
}
|
|
@@ -1698,7 +1714,7 @@
|
|
|
1698
1714
|
"use strict";
|
|
1699
1715
|
/**
|
|
1700
1716
|
* @file src/modules/http/get.ts
|
|
1701
|
-
* @version 2.0.
|
|
1717
|
+
* @version 2.0.3
|
|
1702
1718
|
* @since 2.0.0
|
|
1703
1719
|
* @license GPL-3.0-or-later
|
|
1704
1720
|
* @copyright Sven Minio 2026
|
|
@@ -1717,9 +1733,16 @@
|
|
|
1717
1733
|
__export(post_exports, {
|
|
1718
1734
|
post: () => post
|
|
1719
1735
|
});
|
|
1720
|
-
async function post(url, body = {}) {
|
|
1736
|
+
async function post(url, body = {}, option) {
|
|
1737
|
+
const fetchOptions = { ...option };
|
|
1738
|
+
if (fetchOptions.method?.toLowerCase() !== "post") {
|
|
1739
|
+
fetchOptions.method = "post";
|
|
1740
|
+
}
|
|
1741
|
+
if (!fetchOptions.signal) {
|
|
1742
|
+
fetchOptions.signal = AbortSignal.timeout(5e3);
|
|
1743
|
+
}
|
|
1721
1744
|
const response = await fetch(url, {
|
|
1722
|
-
|
|
1745
|
+
...fetchOptions,
|
|
1723
1746
|
headers: { "Content-Type": "application/json" },
|
|
1724
1747
|
body: JSON.stringify(body)
|
|
1725
1748
|
});
|
|
@@ -1738,8 +1761,8 @@
|
|
|
1738
1761
|
"use strict";
|
|
1739
1762
|
/**
|
|
1740
1763
|
* @file src/modules/http/post.ts
|
|
1741
|
-
* @version 2.0.
|
|
1742
|
-
* @since 2.0.
|
|
1764
|
+
* @version 2.0.3
|
|
1765
|
+
* @since 2.0.2
|
|
1743
1766
|
* @license GPL-3.0-or-later
|
|
1744
1767
|
* @copyright Sven Minio 2026
|
|
1745
1768
|
* @author Sven Minio <https://sven-minio.de>
|