@npaw/forge-web 10.0.4 → 10.1.0
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/forge_kernel_wasm.d.ts +733 -41
- package/dist/forge_kernel_wasm.js +162 -562
- package/dist/forge_kernel_wasm_bg.wasm +0 -0
- package/dist/index.cjs +71 -24
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +0 -14
- package/dist/index.d.ts +0 -14
- package/dist/index.global.js +122 -24
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +71 -24
- package/dist/index.js.map +1 -1
- package/dist/npaw-forge-web.iife.js +265 -513
- package/dist/npaw-forge-web.iife.js.map +1 -1
- package/dist/npaw-forge-web.iife.min.js +3 -0
- package/dist/npaw-forge-web.iife.min.js.map +1 -0
- package/package.json +2 -1
- package/dist/forge_kernel_wasm_bg.wasm.d.ts +0 -15
|
Binary file
|
package/dist/index.cjs
CHANGED
|
@@ -378,6 +378,20 @@ var ResourceTimingCorrelator = class {
|
|
|
378
378
|
}
|
|
379
379
|
};
|
|
380
380
|
|
|
381
|
+
// src/global.ts
|
|
382
|
+
function getGlobalObject() {
|
|
383
|
+
if (typeof globalThis !== "undefined") {
|
|
384
|
+
return globalThis;
|
|
385
|
+
}
|
|
386
|
+
if (typeof self !== "undefined") {
|
|
387
|
+
return self;
|
|
388
|
+
}
|
|
389
|
+
if (typeof window !== "undefined") {
|
|
390
|
+
return window;
|
|
391
|
+
}
|
|
392
|
+
throw new Error("no global object available");
|
|
393
|
+
}
|
|
394
|
+
|
|
381
395
|
// src/sections-capture.ts
|
|
382
396
|
var DEFAULT_VISIBILITY_THRESHOLD_PCT = 50;
|
|
383
397
|
var DEFAULT_IMPRESSION_MIN_VISIBLE_MS = 1e3;
|
|
@@ -1271,7 +1285,7 @@ function resolveIntersectionObserverFactory(environment) {
|
|
|
1271
1285
|
if (environment.intersectionObserverFactory) {
|
|
1272
1286
|
return environment.intersectionObserverFactory;
|
|
1273
1287
|
}
|
|
1274
|
-
const ctor =
|
|
1288
|
+
const ctor = getGlobalObject().IntersectionObserver;
|
|
1275
1289
|
if (typeof ctor !== "function") {
|
|
1276
1290
|
return void 0;
|
|
1277
1291
|
}
|
|
@@ -1281,7 +1295,7 @@ function resolveMutationObserverFactory(environment) {
|
|
|
1281
1295
|
if (environment.mutationObserverFactory) {
|
|
1282
1296
|
return environment.mutationObserverFactory;
|
|
1283
1297
|
}
|
|
1284
|
-
const ctor =
|
|
1298
|
+
const ctor = getGlobalObject().MutationObserver;
|
|
1285
1299
|
if (typeof ctor !== "function") {
|
|
1286
1300
|
return void 0;
|
|
1287
1301
|
}
|
|
@@ -3412,7 +3426,7 @@ function persistentDeviceUuid() {
|
|
|
3412
3426
|
}
|
|
3413
3427
|
const generated = randomUuid();
|
|
3414
3428
|
try {
|
|
3415
|
-
(_a =
|
|
3429
|
+
(_a = getGlobalObject().localStorage) == null ? void 0 : _a.setItem(DEVICE_UUID_STORAGE_KEY, generated);
|
|
3416
3430
|
} catch (e) {
|
|
3417
3431
|
}
|
|
3418
3432
|
return generated;
|
|
@@ -3420,14 +3434,14 @@ function persistentDeviceUuid() {
|
|
|
3420
3434
|
function readStoredUuid() {
|
|
3421
3435
|
var _a;
|
|
3422
3436
|
try {
|
|
3423
|
-
const value = (_a =
|
|
3437
|
+
const value = (_a = getGlobalObject().localStorage) == null ? void 0 : _a.getItem(DEVICE_UUID_STORAGE_KEY);
|
|
3424
3438
|
return value && value.trim().length > 0 ? value : void 0;
|
|
3425
3439
|
} catch (e) {
|
|
3426
3440
|
return void 0;
|
|
3427
3441
|
}
|
|
3428
3442
|
}
|
|
3429
3443
|
function randomUuid() {
|
|
3430
|
-
const cryptoRef =
|
|
3444
|
+
const cryptoRef = getGlobalObject().crypto;
|
|
3431
3445
|
if (typeof (cryptoRef == null ? void 0 : cryptoRef.randomUUID) === "function") {
|
|
3432
3446
|
return cryptoRef.randomUUID();
|
|
3433
3447
|
}
|
|
@@ -3561,11 +3575,11 @@ function readDownlinkKbps(environment) {
|
|
|
3561
3575
|
}
|
|
3562
3576
|
function readBrowserDeviceInsightsEnvironment() {
|
|
3563
3577
|
const environment = {};
|
|
3564
|
-
const performanceRef =
|
|
3578
|
+
const performanceRef = getGlobalObject().performance;
|
|
3565
3579
|
if (performanceRef && typeof performanceRef.memory === "object" && performanceRef.memory !== null) {
|
|
3566
3580
|
environment.memory = () => performanceRef.memory;
|
|
3567
3581
|
}
|
|
3568
|
-
const navigatorRef =
|
|
3582
|
+
const navigatorRef = getGlobalObject().navigator;
|
|
3569
3583
|
if (navigatorRef && typeof navigatorRef.getBattery === "function") {
|
|
3570
3584
|
environment.getBattery = () => navigatorRef.getBattery();
|
|
3571
3585
|
}
|
|
@@ -3656,6 +3670,13 @@ function diagnosticFromError(error, code) {
|
|
|
3656
3670
|
function isPromiseLike(value) {
|
|
3657
3671
|
return Boolean(value && typeof value.then === "function");
|
|
3658
3672
|
}
|
|
3673
|
+
function fromEntries(entries) {
|
|
3674
|
+
const result = {};
|
|
3675
|
+
for (const entry of entries) {
|
|
3676
|
+
result[entry[0]] = entry[1];
|
|
3677
|
+
}
|
|
3678
|
+
return result;
|
|
3679
|
+
}
|
|
3659
3680
|
|
|
3660
3681
|
// src/effects.ts
|
|
3661
3682
|
var BrowserEffectExecutor = class {
|
|
@@ -3955,13 +3976,14 @@ function createBrowserStorage() {
|
|
|
3955
3976
|
}
|
|
3956
3977
|
function safeLocalStorage() {
|
|
3957
3978
|
try {
|
|
3958
|
-
|
|
3979
|
+
const host = getGlobalObject();
|
|
3980
|
+
if (typeof host.localStorage === "undefined") {
|
|
3959
3981
|
return null;
|
|
3960
3982
|
}
|
|
3961
3983
|
const probe = "__npaw_forge_storage_probe__";
|
|
3962
|
-
|
|
3963
|
-
|
|
3964
|
-
return
|
|
3984
|
+
host.localStorage.setItem(probe, "1");
|
|
3985
|
+
host.localStorage.removeItem(probe);
|
|
3986
|
+
return host.localStorage;
|
|
3965
3987
|
} catch (e) {
|
|
3966
3988
|
return null;
|
|
3967
3989
|
}
|
|
@@ -3970,10 +3992,11 @@ function safeLocalStorage() {
|
|
|
3970
3992
|
// src/transport.ts
|
|
3971
3993
|
var BrowserForgeTransport = class {
|
|
3972
3994
|
async send(request) {
|
|
3973
|
-
|
|
3995
|
+
const host = getGlobalObject();
|
|
3996
|
+
if (typeof host.fetch === "function") {
|
|
3974
3997
|
return sendWithFetch(request);
|
|
3975
3998
|
}
|
|
3976
|
-
if (typeof
|
|
3999
|
+
if (typeof host.XMLHttpRequest === "function") {
|
|
3977
4000
|
return sendWithXhr(request);
|
|
3978
4001
|
}
|
|
3979
4002
|
throw new Error("fetch and XMLHttpRequest are unavailable");
|
|
@@ -3988,7 +4011,7 @@ async function sendWithFetch(request) {
|
|
|
3988
4011
|
if (body !== void 0) {
|
|
3989
4012
|
init.body = body;
|
|
3990
4013
|
}
|
|
3991
|
-
const response = await withoutNetworkCapture(() =>
|
|
4014
|
+
const response = await withoutNetworkCapture(() => getGlobalObject().fetch(requestUrl(request), init));
|
|
3992
4015
|
const headers = {};
|
|
3993
4016
|
response.headers.forEach((value, key) => {
|
|
3994
4017
|
headers[key] = value;
|
|
@@ -4041,8 +4064,9 @@ function requestUrl(request) {
|
|
|
4041
4064
|
return base.toString();
|
|
4042
4065
|
}
|
|
4043
4066
|
function browserBaseUrl() {
|
|
4044
|
-
|
|
4045
|
-
|
|
4067
|
+
const host = getGlobalObject();
|
|
4068
|
+
if (typeof host.location !== "undefined" && host.location.href) {
|
|
4069
|
+
return host.location.href;
|
|
4046
4070
|
}
|
|
4047
4071
|
return "https://localhost/";
|
|
4048
4072
|
}
|
|
@@ -4130,6 +4154,9 @@ function assertRuntimeSupport() {
|
|
|
4130
4154
|
if (typeof ArrayBuffer === "undefined" || typeof Uint8Array === "undefined") {
|
|
4131
4155
|
throw new Error("typed arrays are unavailable");
|
|
4132
4156
|
}
|
|
4157
|
+
if (typeof TextEncoder === "undefined" || typeof TextDecoder === "undefined") {
|
|
4158
|
+
throw new Error("TextEncoder/TextDecoder are unavailable");
|
|
4159
|
+
}
|
|
4133
4160
|
}
|
|
4134
4161
|
|
|
4135
4162
|
// src/runtime.ts
|
|
@@ -4168,7 +4195,20 @@ var ForgeRuntimeBridge = class _ForgeRuntimeBridge {
|
|
|
4168
4195
|
attributes: {}
|
|
4169
4196
|
});
|
|
4170
4197
|
}
|
|
4171
|
-
|
|
4198
|
+
let module2;
|
|
4199
|
+
try {
|
|
4200
|
+
module2 = await normalizeWasmLoader(options.wasm).load();
|
|
4201
|
+
} catch (error) {
|
|
4202
|
+
if (error instanceof ForgeCreateError) {
|
|
4203
|
+
throw error;
|
|
4204
|
+
}
|
|
4205
|
+
throw new ForgeCreateError({
|
|
4206
|
+
code: "wasm_instantiate_failed",
|
|
4207
|
+
message: describeWasmLoadError(error),
|
|
4208
|
+
recoverable: false,
|
|
4209
|
+
attributes: {}
|
|
4210
|
+
});
|
|
4211
|
+
}
|
|
4172
4212
|
const response = module2.forgeRuntimeCreate(runtimeConfig(options));
|
|
4173
4213
|
if (!response.ok || !response.value) {
|
|
4174
4214
|
throw new ForgeCreateError(boundaryDiagnostic(response.error));
|
|
@@ -4452,6 +4492,13 @@ function errorBatchFromBoundary(error) {
|
|
|
4452
4492
|
const diagnostic = boundaryDiagnostic(error);
|
|
4453
4493
|
return errorBatch(diagnostic.code, diagnostic.message);
|
|
4454
4494
|
}
|
|
4495
|
+
function describeWasmLoadError(error) {
|
|
4496
|
+
if (error instanceof Error) {
|
|
4497
|
+
const name = error.name && error.name !== "Error" ? `${error.name}: ` : "";
|
|
4498
|
+
return `WASM kernel failed to load: ${name}${error.message}`;
|
|
4499
|
+
}
|
|
4500
|
+
return `WASM kernel failed to load: ${String(error)}`;
|
|
4501
|
+
}
|
|
4455
4502
|
function boundaryDiagnostic(error) {
|
|
4456
4503
|
if (!error) {
|
|
4457
4504
|
return {
|
|
@@ -4542,7 +4589,7 @@ var ForgeConnectionTypeObserver = class {
|
|
|
4542
4589
|
}
|
|
4543
4590
|
};
|
|
4544
4591
|
function readNavigatorConnection() {
|
|
4545
|
-
const navigatorRef =
|
|
4592
|
+
const navigatorRef = getGlobalObject().navigator;
|
|
4546
4593
|
return navigatorRef == null ? void 0 : navigatorRef.connection;
|
|
4547
4594
|
}
|
|
4548
4595
|
|
|
@@ -4607,7 +4654,7 @@ function fixFromPosition(position) {
|
|
|
4607
4654
|
};
|
|
4608
4655
|
}
|
|
4609
4656
|
function readGeolocationEnvironment() {
|
|
4610
|
-
const navigatorRef =
|
|
4657
|
+
const navigatorRef = getGlobalObject().navigator;
|
|
4611
4658
|
const geolocation = navigatorRef == null ? void 0 : navigatorRef.geolocation;
|
|
4612
4659
|
const permissions = navigatorRef == null ? void 0 : navigatorRef.permissions;
|
|
4613
4660
|
if (!geolocation || !(permissions == null ? void 0 : permissions.query)) {
|
|
@@ -11674,7 +11721,7 @@ var MediaTailorAdsAdapter = class extends BaseWebAdAdapter {
|
|
|
11674
11721
|
if (this.fetchAttempts >= maxFetchRetries) {
|
|
11675
11722
|
return;
|
|
11676
11723
|
}
|
|
11677
|
-
const fetchFn = (_d = (_c = this.options) == null ? void 0 : _c.fetch) != null ? _d :
|
|
11724
|
+
const fetchFn = (_d = (_c = this.options) == null ? void 0 : _c.fetch) != null ? _d : getGlobalObject().fetch;
|
|
11678
11725
|
if (typeof fetchFn !== "function") {
|
|
11679
11726
|
return;
|
|
11680
11727
|
}
|
|
@@ -13206,7 +13253,7 @@ function freewheelEvents() {
|
|
|
13206
13253
|
ERROR_VAST_XML_PARSING: "ERROR_VAST_XML_PARSING",
|
|
13207
13254
|
ERROR_PARSE: "ERROR_PARSE"
|
|
13208
13255
|
};
|
|
13209
|
-
return
|
|
13256
|
+
return fromEntries(
|
|
13210
13257
|
Object.entries(fallback).map(([key, value]) => {
|
|
13211
13258
|
var _a;
|
|
13212
13259
|
return [key, (_a = stringValue(read(sdk, key))) != null ? _a : value];
|
|
@@ -13344,7 +13391,7 @@ function bitmovinEvents(player) {
|
|
|
13344
13391
|
StallStarted: "StallStarted",
|
|
13345
13392
|
StallEnded: "StallEnded"
|
|
13346
13393
|
};
|
|
13347
|
-
return
|
|
13394
|
+
return fromEntries(
|
|
13348
13395
|
Object.entries(fallback).map(([key, value]) => {
|
|
13349
13396
|
var _a;
|
|
13350
13397
|
return [key, (_a = stringValue(read(events, key))) != null ? _a : value];
|
|
@@ -13705,7 +13752,7 @@ function storedFastDataPingTimeSeconds(value) {
|
|
|
13705
13752
|
}
|
|
13706
13753
|
}
|
|
13707
13754
|
function cleanObject(value) {
|
|
13708
|
-
return
|
|
13755
|
+
return fromEntries(
|
|
13709
13756
|
Object.entries(value).filter((entry) => entry[1] !== void 0)
|
|
13710
13757
|
);
|
|
13711
13758
|
}
|
|
@@ -13790,7 +13837,7 @@ function stripQuery(value) {
|
|
|
13790
13837
|
return value == null ? void 0 : value.split("?")[0];
|
|
13791
13838
|
}
|
|
13792
13839
|
function globalRecord(name) {
|
|
13793
|
-
return memberRecord(
|
|
13840
|
+
return memberRecord(getGlobalObject()[name]);
|
|
13794
13841
|
}
|
|
13795
13842
|
function realmOf(candidate) {
|
|
13796
13843
|
var _a;
|