@olenbetong/appframe-core 2.15.1 → 2.15.2
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/esm/af.common.js +31 -6
- package/dist/esm/af.common.legacy.js +27 -2
- package/dist/esm/af.common.legacy.min.js +3 -3
- package/dist/esm/af.common.legacy.min.js.map +1 -1
- package/dist/esm/af.common.min.js +3 -3
- package/dist/esm/af.common.min.js.map +1 -1
- package/dist/iife/af.common.js +31 -6
- package/dist/iife/af.common.legacy.js +27 -2
- package/dist/iife/af.common.legacy.min.js +3 -3
- package/dist/iife/af.common.legacy.min.js.map +1 -1
- package/dist/iife/af.common.min.js +3 -3
- package/dist/iife/af.common.min.js.map +1 -1
- package/es/index.js +1 -1
- package/es/log.js +32 -0
- package/package.json +2 -2
- package/src/log.ts +34 -0
package/es/index.js
CHANGED
|
@@ -19,4 +19,4 @@ export { UserSession };
|
|
|
19
19
|
export { alert, ConfirmButtons, confirm, openAlertDialog, waitForDialog } from "./alert.js";
|
|
20
20
|
export { getSettings, saveSettings } from "./settings.js";
|
|
21
21
|
// oxlint-disable-next-line no-use-before-define -- this is injected build time
|
|
22
|
-
export const version = "2.15.
|
|
22
|
+
export const version = "2.15.2";
|
package/es/log.js
CHANGED
|
@@ -86,6 +86,37 @@ export async function logError(error) {
|
|
|
86
86
|
function getSessionId() {
|
|
87
87
|
return crypto.randomUUID?.();
|
|
88
88
|
}
|
|
89
|
+
/** The version in the first URL served under `/lib/@olenbetong/<name>/<version>/`. */
|
|
90
|
+
function libVersion(name, urls) {
|
|
91
|
+
let pattern = new RegExp(`/lib/@olenbetong/${name}/([^/]+)/`);
|
|
92
|
+
for (let url of urls) {
|
|
93
|
+
let match = typeof url === "string" ? pattern.exec(url) : null;
|
|
94
|
+
if (match)
|
|
95
|
+
return match[1];
|
|
96
|
+
}
|
|
97
|
+
return undefined;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* The synergi-chrome and synergi-platform versions the page loads on the 2026 site templates,
|
|
101
|
+
* read from the chrome's script tag and the platform import map rather than from the chrome
|
|
102
|
+
* itself, so they are known even when the chrome failed to start. Empty on other pages.
|
|
103
|
+
*/
|
|
104
|
+
function getPlatformVersions() {
|
|
105
|
+
let versions = {};
|
|
106
|
+
try {
|
|
107
|
+
let importMap = document.querySelector('script[type="importmap"]');
|
|
108
|
+
let platform = importMap
|
|
109
|
+
? libVersion("synergi-platform", Object.values(JSON.parse(importMap.textContent ?? "{}").imports ?? {}))
|
|
110
|
+
: undefined;
|
|
111
|
+
if (platform)
|
|
112
|
+
versions["synergi-platform"] = platform;
|
|
113
|
+
}
|
|
114
|
+
catch { }
|
|
115
|
+
let chrome = libVersion("synergi-chrome", Array.from(document.scripts, (script) => script.src)) ?? globalThis.ob?.chrome?.version;
|
|
116
|
+
if (chrome)
|
|
117
|
+
versions["synergi-chrome"] = chrome;
|
|
118
|
+
return versions;
|
|
119
|
+
}
|
|
89
120
|
let sessionStart = Date.now();
|
|
90
121
|
let sessionId = getSessionId();
|
|
91
122
|
let deviceId = "";
|
|
@@ -95,6 +126,7 @@ if ("document" in globalThis) {
|
|
|
95
126
|
"appframe-core": globalThis.af?.common?.version,
|
|
96
127
|
"appframe-data": globalThis.af?.data?.version,
|
|
97
128
|
"app-version": globalThis.af?.article?.version,
|
|
129
|
+
...getPlatformVersions(),
|
|
98
130
|
});
|
|
99
131
|
document.addEventListener("DOMContentLoaded", () => {
|
|
100
132
|
deviceId = localStorage.getItem("_afDeviceId");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@olenbetong/appframe-core",
|
|
3
|
-
"version": "2.15.
|
|
3
|
+
"version": "2.15.2",
|
|
4
4
|
"description": "Javascript libraries to utilize the Appframe framework",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": [
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@happy-dom/global-registrator": "20.14.5",
|
|
44
44
|
"@types/bun": "^1.4.2",
|
|
45
|
-
"chalk": "^6.0.
|
|
45
|
+
"chalk": "^6.0.1"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {},
|
|
48
48
|
"optionalDependencies": {},
|
package/src/log.ts
CHANGED
|
@@ -97,6 +97,39 @@ function getSessionId() {
|
|
|
97
97
|
return crypto.randomUUID?.();
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
+
/** The version in the first URL served under `/lib/@olenbetong/<name>/<version>/`. */
|
|
101
|
+
function libVersion(name: string, urls: Iterable<unknown>) {
|
|
102
|
+
let pattern = new RegExp(`/lib/@olenbetong/${name}/([^/]+)/`);
|
|
103
|
+
for (let url of urls) {
|
|
104
|
+
let match = typeof url === "string" ? pattern.exec(url) : null;
|
|
105
|
+
if (match) return match[1];
|
|
106
|
+
}
|
|
107
|
+
return undefined;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* The synergi-chrome and synergi-platform versions the page loads on the 2026 site templates,
|
|
112
|
+
* read from the chrome's script tag and the platform import map rather than from the chrome
|
|
113
|
+
* itself, so they are known even when the chrome failed to start. Empty on other pages.
|
|
114
|
+
*/
|
|
115
|
+
function getPlatformVersions() {
|
|
116
|
+
let versions: Record<string, string> = {};
|
|
117
|
+
try {
|
|
118
|
+
let importMap = document.querySelector('script[type="importmap"]');
|
|
119
|
+
let platform = importMap
|
|
120
|
+
? libVersion("synergi-platform", Object.values(JSON.parse(importMap.textContent ?? "{}").imports ?? {}))
|
|
121
|
+
: undefined;
|
|
122
|
+
if (platform) versions["synergi-platform"] = platform;
|
|
123
|
+
} catch {}
|
|
124
|
+
let chrome =
|
|
125
|
+
libVersion(
|
|
126
|
+
"synergi-chrome",
|
|
127
|
+
Array.from(document.scripts, (script) => script.src),
|
|
128
|
+
) ?? (globalThis as any).ob?.chrome?.version;
|
|
129
|
+
if (chrome) versions["synergi-chrome"] = chrome;
|
|
130
|
+
return versions;
|
|
131
|
+
}
|
|
132
|
+
|
|
100
133
|
let sessionStart = Date.now();
|
|
101
134
|
let sessionId = getSessionId();
|
|
102
135
|
let deviceId: string | null = "";
|
|
@@ -108,6 +141,7 @@ if ("document" in globalThis) {
|
|
|
108
141
|
"appframe-core": globalThis.af?.common?.version,
|
|
109
142
|
"appframe-data": (globalThis.af as any)?.data?.version,
|
|
110
143
|
"app-version": globalThis.af?.article?.version,
|
|
144
|
+
...getPlatformVersions(),
|
|
111
145
|
});
|
|
112
146
|
|
|
113
147
|
document.addEventListener("DOMContentLoaded", () => {
|