saloe 0.0.87 → 0.0.89
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/html.cjs.js +2 -1
- package/dist/html.es.js +3 -2
- package/dist/listener.cjs.js +1 -0
- package/dist/listener.es.js +1 -0
- package/package.json +1 -1
- package/src/html.js +4 -2
- package/src/listener.js +1 -0
package/dist/html.cjs.js
CHANGED
|
@@ -38,7 +38,8 @@ const stream = ({ head, body, scripts, env, status, args }) => {
|
|
|
38
38
|
];
|
|
39
39
|
return worker.stream({ callbacks, headers, status });
|
|
40
40
|
};
|
|
41
|
-
const awaitHtml = async ({ id, pending, success, error }) => {
|
|
41
|
+
const awaitHtml = async ({ env, id, pending, success, error }) => {
|
|
42
|
+
if (!util.isServiceWorker({ env: env ?? (self == null ? void 0 : self.env) })) return success();
|
|
42
43
|
id = id ?? Math.floor(Math.random() * 1e9);
|
|
43
44
|
const pendingId = `pending_${id}`;
|
|
44
45
|
const pendingRoutePathname = `/~/components/${pendingId}`;
|
package/dist/html.es.js
CHANGED
|
@@ -4,7 +4,7 @@ var __template = (cooked, raw) => __freeze(__defProp(cooked, "raw", { value: __f
|
|
|
4
4
|
var _a;
|
|
5
5
|
import { stream as stream$1 } from "./worker.es.js";
|
|
6
6
|
import { addRoute } from "./router.es.js";
|
|
7
|
-
import { getScope, getEnv } from "./util.es.js";
|
|
7
|
+
import { isServiceWorker, getScope, getEnv } from "./util.es.js";
|
|
8
8
|
const html = (s, ...args) => {
|
|
9
9
|
var _a2;
|
|
10
10
|
return (_a2 = s == null ? void 0 : s.map((ss, i) => `${ss}${(args == null ? void 0 : args.at(i)) ?? ""}`)) == null ? void 0 : _a2.join("");
|
|
@@ -36,7 +36,8 @@ const stream = ({ head, body, scripts, env, status, args }) => {
|
|
|
36
36
|
];
|
|
37
37
|
return stream$1({ callbacks, headers, status });
|
|
38
38
|
};
|
|
39
|
-
const awaitHtml = async ({ id, pending, success, error }) => {
|
|
39
|
+
const awaitHtml = async ({ env, id, pending, success, error }) => {
|
|
40
|
+
if (!isServiceWorker({ env: env ?? (self == null ? void 0 : self.env) })) return success();
|
|
40
41
|
id = id ?? Math.floor(Math.random() * 1e9);
|
|
41
42
|
const pendingId = `pending_${id}`;
|
|
42
43
|
const pendingRoutePathname = `/~/components/${pendingId}`;
|
package/dist/listener.cjs.js
CHANGED
|
@@ -78,6 +78,7 @@ const listener = ({
|
|
|
78
78
|
const script = document == null ? void 0 : document.createElement("script");
|
|
79
79
|
(_a = Object.keys(attrs)) == null ? void 0 : _a.forEach((attrKey) => script == null ? void 0 : script.setAttribute(attrKey, attrs[attrKey]));
|
|
80
80
|
script.id = id;
|
|
81
|
+
script.type = "module";
|
|
81
82
|
if (content) script == null ? void 0 : script.insertAdjacentHTML("beforeend", content);
|
|
82
83
|
return new Promise((resolve, reject) => {
|
|
83
84
|
var _a2, _b;
|
package/dist/listener.es.js
CHANGED
|
@@ -76,6 +76,7 @@ const listener = ({
|
|
|
76
76
|
const script = document == null ? void 0 : document.createElement("script");
|
|
77
77
|
(_a = Object.keys(attrs)) == null ? void 0 : _a.forEach((attrKey) => script == null ? void 0 : script.setAttribute(attrKey, attrs[attrKey]));
|
|
78
78
|
script.id = id;
|
|
79
|
+
script.type = "module";
|
|
79
80
|
if (content) script == null ? void 0 : script.insertAdjacentHTML("beforeend", content);
|
|
80
81
|
return new Promise((resolve, reject) => {
|
|
81
82
|
var _a2, _b;
|
package/package.json
CHANGED
package/src/html.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { stream as streamAsWorker } from './worker'
|
|
2
2
|
import { addRoute, removeRoute } from './router'
|
|
3
|
-
import { getScope, getEnv } from './util'
|
|
3
|
+
import { getScope, getEnv, isServiceWorker } from './util'
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
const html = (s, ...args) => {
|
|
@@ -37,7 +37,9 @@ const stream = ({ head, body, scripts, env, status, args }) => {
|
|
|
37
37
|
return streamAsWorker({ callbacks, headers, status })
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
const awaitHtml = async ({ id, pending, success, error }) => {
|
|
40
|
+
const awaitHtml = async ({ env, id, pending, success, error }) => {
|
|
41
|
+
if (!isServiceWorker({ env: env ?? self?.env })) return success()
|
|
42
|
+
|
|
41
43
|
id = id ?? Math.floor(Math.random() * 1_000_000_000)
|
|
42
44
|
|
|
43
45
|
const pendingId = `pending_${id}`
|