@npaw/forge-web 10.0.3 → 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
package/dist/index.js
CHANGED
|
@@ -248,6 +248,20 @@ var ResourceTimingCorrelator = class {
|
|
|
248
248
|
}
|
|
249
249
|
};
|
|
250
250
|
|
|
251
|
+
// src/global.ts
|
|
252
|
+
function getGlobalObject() {
|
|
253
|
+
if (typeof globalThis !== "undefined") {
|
|
254
|
+
return globalThis;
|
|
255
|
+
}
|
|
256
|
+
if (typeof self !== "undefined") {
|
|
257
|
+
return self;
|
|
258
|
+
}
|
|
259
|
+
if (typeof window !== "undefined") {
|
|
260
|
+
return window;
|
|
261
|
+
}
|
|
262
|
+
throw new Error("no global object available");
|
|
263
|
+
}
|
|
264
|
+
|
|
251
265
|
// src/sections-capture.ts
|
|
252
266
|
var DEFAULT_VISIBILITY_THRESHOLD_PCT = 50;
|
|
253
267
|
var DEFAULT_IMPRESSION_MIN_VISIBLE_MS = 1e3;
|
|
@@ -1141,7 +1155,7 @@ function resolveIntersectionObserverFactory(environment) {
|
|
|
1141
1155
|
if (environment.intersectionObserverFactory) {
|
|
1142
1156
|
return environment.intersectionObserverFactory;
|
|
1143
1157
|
}
|
|
1144
|
-
const ctor =
|
|
1158
|
+
const ctor = getGlobalObject().IntersectionObserver;
|
|
1145
1159
|
if (typeof ctor !== "function") {
|
|
1146
1160
|
return void 0;
|
|
1147
1161
|
}
|
|
@@ -1151,7 +1165,7 @@ function resolveMutationObserverFactory(environment) {
|
|
|
1151
1165
|
if (environment.mutationObserverFactory) {
|
|
1152
1166
|
return environment.mutationObserverFactory;
|
|
1153
1167
|
}
|
|
1154
|
-
const ctor =
|
|
1168
|
+
const ctor = getGlobalObject().MutationObserver;
|
|
1155
1169
|
if (typeof ctor !== "function") {
|
|
1156
1170
|
return void 0;
|
|
1157
1171
|
}
|
|
@@ -3282,7 +3296,7 @@ function persistentDeviceUuid() {
|
|
|
3282
3296
|
}
|
|
3283
3297
|
const generated = randomUuid();
|
|
3284
3298
|
try {
|
|
3285
|
-
(_a =
|
|
3299
|
+
(_a = getGlobalObject().localStorage) == null ? void 0 : _a.setItem(DEVICE_UUID_STORAGE_KEY, generated);
|
|
3286
3300
|
} catch (e) {
|
|
3287
3301
|
}
|
|
3288
3302
|
return generated;
|
|
@@ -3290,14 +3304,14 @@ function persistentDeviceUuid() {
|
|
|
3290
3304
|
function readStoredUuid() {
|
|
3291
3305
|
var _a;
|
|
3292
3306
|
try {
|
|
3293
|
-
const value = (_a =
|
|
3307
|
+
const value = (_a = getGlobalObject().localStorage) == null ? void 0 : _a.getItem(DEVICE_UUID_STORAGE_KEY);
|
|
3294
3308
|
return value && value.trim().length > 0 ? value : void 0;
|
|
3295
3309
|
} catch (e) {
|
|
3296
3310
|
return void 0;
|
|
3297
3311
|
}
|
|
3298
3312
|
}
|
|
3299
3313
|
function randomUuid() {
|
|
3300
|
-
const cryptoRef =
|
|
3314
|
+
const cryptoRef = getGlobalObject().crypto;
|
|
3301
3315
|
if (typeof (cryptoRef == null ? void 0 : cryptoRef.randomUUID) === "function") {
|
|
3302
3316
|
return cryptoRef.randomUUID();
|
|
3303
3317
|
}
|
|
@@ -3431,11 +3445,11 @@ function readDownlinkKbps(environment) {
|
|
|
3431
3445
|
}
|
|
3432
3446
|
function readBrowserDeviceInsightsEnvironment() {
|
|
3433
3447
|
const environment = {};
|
|
3434
|
-
const performanceRef =
|
|
3448
|
+
const performanceRef = getGlobalObject().performance;
|
|
3435
3449
|
if (performanceRef && typeof performanceRef.memory === "object" && performanceRef.memory !== null) {
|
|
3436
3450
|
environment.memory = () => performanceRef.memory;
|
|
3437
3451
|
}
|
|
3438
|
-
const navigatorRef =
|
|
3452
|
+
const navigatorRef = getGlobalObject().navigator;
|
|
3439
3453
|
if (navigatorRef && typeof navigatorRef.getBattery === "function") {
|
|
3440
3454
|
environment.getBattery = () => navigatorRef.getBattery();
|
|
3441
3455
|
}
|
|
@@ -3526,6 +3540,13 @@ function diagnosticFromError(error, code) {
|
|
|
3526
3540
|
function isPromiseLike(value) {
|
|
3527
3541
|
return Boolean(value && typeof value.then === "function");
|
|
3528
3542
|
}
|
|
3543
|
+
function fromEntries(entries) {
|
|
3544
|
+
const result = {};
|
|
3545
|
+
for (const entry of entries) {
|
|
3546
|
+
result[entry[0]] = entry[1];
|
|
3547
|
+
}
|
|
3548
|
+
return result;
|
|
3549
|
+
}
|
|
3529
3550
|
|
|
3530
3551
|
// src/effects.ts
|
|
3531
3552
|
var BrowserEffectExecutor = class {
|
|
@@ -3825,13 +3846,14 @@ function createBrowserStorage() {
|
|
|
3825
3846
|
}
|
|
3826
3847
|
function safeLocalStorage() {
|
|
3827
3848
|
try {
|
|
3828
|
-
|
|
3849
|
+
const host = getGlobalObject();
|
|
3850
|
+
if (typeof host.localStorage === "undefined") {
|
|
3829
3851
|
return null;
|
|
3830
3852
|
}
|
|
3831
3853
|
const probe = "__npaw_forge_storage_probe__";
|
|
3832
|
-
|
|
3833
|
-
|
|
3834
|
-
return
|
|
3854
|
+
host.localStorage.setItem(probe, "1");
|
|
3855
|
+
host.localStorage.removeItem(probe);
|
|
3856
|
+
return host.localStorage;
|
|
3835
3857
|
} catch (e) {
|
|
3836
3858
|
return null;
|
|
3837
3859
|
}
|
|
@@ -3840,10 +3862,11 @@ function safeLocalStorage() {
|
|
|
3840
3862
|
// src/transport.ts
|
|
3841
3863
|
var BrowserForgeTransport = class {
|
|
3842
3864
|
async send(request) {
|
|
3843
|
-
|
|
3865
|
+
const host = getGlobalObject();
|
|
3866
|
+
if (typeof host.fetch === "function") {
|
|
3844
3867
|
return sendWithFetch(request);
|
|
3845
3868
|
}
|
|
3846
|
-
if (typeof
|
|
3869
|
+
if (typeof host.XMLHttpRequest === "function") {
|
|
3847
3870
|
return sendWithXhr(request);
|
|
3848
3871
|
}
|
|
3849
3872
|
throw new Error("fetch and XMLHttpRequest are unavailable");
|
|
@@ -3858,7 +3881,7 @@ async function sendWithFetch(request) {
|
|
|
3858
3881
|
if (body !== void 0) {
|
|
3859
3882
|
init.body = body;
|
|
3860
3883
|
}
|
|
3861
|
-
const response = await withoutNetworkCapture(() =>
|
|
3884
|
+
const response = await withoutNetworkCapture(() => getGlobalObject().fetch(requestUrl(request), init));
|
|
3862
3885
|
const headers = {};
|
|
3863
3886
|
response.headers.forEach((value, key) => {
|
|
3864
3887
|
headers[key] = value;
|
|
@@ -3911,8 +3934,9 @@ function requestUrl(request) {
|
|
|
3911
3934
|
return base.toString();
|
|
3912
3935
|
}
|
|
3913
3936
|
function browserBaseUrl() {
|
|
3914
|
-
|
|
3915
|
-
|
|
3937
|
+
const host = getGlobalObject();
|
|
3938
|
+
if (typeof host.location !== "undefined" && host.location.href) {
|
|
3939
|
+
return host.location.href;
|
|
3916
3940
|
}
|
|
3917
3941
|
return "https://localhost/";
|
|
3918
3942
|
}
|
|
@@ -4000,6 +4024,9 @@ function assertRuntimeSupport() {
|
|
|
4000
4024
|
if (typeof ArrayBuffer === "undefined" || typeof Uint8Array === "undefined") {
|
|
4001
4025
|
throw new Error("typed arrays are unavailable");
|
|
4002
4026
|
}
|
|
4027
|
+
if (typeof TextEncoder === "undefined" || typeof TextDecoder === "undefined") {
|
|
4028
|
+
throw new Error("TextEncoder/TextDecoder are unavailable");
|
|
4029
|
+
}
|
|
4003
4030
|
}
|
|
4004
4031
|
|
|
4005
4032
|
// src/runtime.ts
|
|
@@ -4038,7 +4065,20 @@ var ForgeRuntimeBridge = class _ForgeRuntimeBridge {
|
|
|
4038
4065
|
attributes: {}
|
|
4039
4066
|
});
|
|
4040
4067
|
}
|
|
4041
|
-
|
|
4068
|
+
let module;
|
|
4069
|
+
try {
|
|
4070
|
+
module = await normalizeWasmLoader(options.wasm).load();
|
|
4071
|
+
} catch (error) {
|
|
4072
|
+
if (error instanceof ForgeCreateError) {
|
|
4073
|
+
throw error;
|
|
4074
|
+
}
|
|
4075
|
+
throw new ForgeCreateError({
|
|
4076
|
+
code: "wasm_instantiate_failed",
|
|
4077
|
+
message: describeWasmLoadError(error),
|
|
4078
|
+
recoverable: false,
|
|
4079
|
+
attributes: {}
|
|
4080
|
+
});
|
|
4081
|
+
}
|
|
4042
4082
|
const response = module.forgeRuntimeCreate(runtimeConfig(options));
|
|
4043
4083
|
if (!response.ok || !response.value) {
|
|
4044
4084
|
throw new ForgeCreateError(boundaryDiagnostic(response.error));
|
|
@@ -4322,6 +4362,13 @@ function errorBatchFromBoundary(error) {
|
|
|
4322
4362
|
const diagnostic = boundaryDiagnostic(error);
|
|
4323
4363
|
return errorBatch(diagnostic.code, diagnostic.message);
|
|
4324
4364
|
}
|
|
4365
|
+
function describeWasmLoadError(error) {
|
|
4366
|
+
if (error instanceof Error) {
|
|
4367
|
+
const name = error.name && error.name !== "Error" ? `${error.name}: ` : "";
|
|
4368
|
+
return `WASM kernel failed to load: ${name}${error.message}`;
|
|
4369
|
+
}
|
|
4370
|
+
return `WASM kernel failed to load: ${String(error)}`;
|
|
4371
|
+
}
|
|
4325
4372
|
function boundaryDiagnostic(error) {
|
|
4326
4373
|
if (!error) {
|
|
4327
4374
|
return {
|
|
@@ -4412,7 +4459,7 @@ var ForgeConnectionTypeObserver = class {
|
|
|
4412
4459
|
}
|
|
4413
4460
|
};
|
|
4414
4461
|
function readNavigatorConnection() {
|
|
4415
|
-
const navigatorRef =
|
|
4462
|
+
const navigatorRef = getGlobalObject().navigator;
|
|
4416
4463
|
return navigatorRef == null ? void 0 : navigatorRef.connection;
|
|
4417
4464
|
}
|
|
4418
4465
|
|
|
@@ -4477,7 +4524,7 @@ function fixFromPosition(position) {
|
|
|
4477
4524
|
};
|
|
4478
4525
|
}
|
|
4479
4526
|
function readGeolocationEnvironment() {
|
|
4480
|
-
const navigatorRef =
|
|
4527
|
+
const navigatorRef = getGlobalObject().navigator;
|
|
4481
4528
|
const geolocation = navigatorRef == null ? void 0 : navigatorRef.geolocation;
|
|
4482
4529
|
const permissions = navigatorRef == null ? void 0 : navigatorRef.permissions;
|
|
4483
4530
|
if (!geolocation || !(permissions == null ? void 0 : permissions.query)) {
|
|
@@ -11544,7 +11591,7 @@ var MediaTailorAdsAdapter = class extends BaseWebAdAdapter {
|
|
|
11544
11591
|
if (this.fetchAttempts >= maxFetchRetries) {
|
|
11545
11592
|
return;
|
|
11546
11593
|
}
|
|
11547
|
-
const fetchFn = (_d = (_c = this.options) == null ? void 0 : _c.fetch) != null ? _d :
|
|
11594
|
+
const fetchFn = (_d = (_c = this.options) == null ? void 0 : _c.fetch) != null ? _d : getGlobalObject().fetch;
|
|
11548
11595
|
if (typeof fetchFn !== "function") {
|
|
11549
11596
|
return;
|
|
11550
11597
|
}
|
|
@@ -13076,7 +13123,7 @@ function freewheelEvents() {
|
|
|
13076
13123
|
ERROR_VAST_XML_PARSING: "ERROR_VAST_XML_PARSING",
|
|
13077
13124
|
ERROR_PARSE: "ERROR_PARSE"
|
|
13078
13125
|
};
|
|
13079
|
-
return
|
|
13126
|
+
return fromEntries(
|
|
13080
13127
|
Object.entries(fallback).map(([key, value]) => {
|
|
13081
13128
|
var _a;
|
|
13082
13129
|
return [key, (_a = stringValue(read(sdk, key))) != null ? _a : value];
|
|
@@ -13214,7 +13261,7 @@ function bitmovinEvents(player) {
|
|
|
13214
13261
|
StallStarted: "StallStarted",
|
|
13215
13262
|
StallEnded: "StallEnded"
|
|
13216
13263
|
};
|
|
13217
|
-
return
|
|
13264
|
+
return fromEntries(
|
|
13218
13265
|
Object.entries(fallback).map(([key, value]) => {
|
|
13219
13266
|
var _a;
|
|
13220
13267
|
return [key, (_a = stringValue(read(events, key))) != null ? _a : value];
|
|
@@ -13575,7 +13622,7 @@ function storedFastDataPingTimeSeconds(value) {
|
|
|
13575
13622
|
}
|
|
13576
13623
|
}
|
|
13577
13624
|
function cleanObject(value) {
|
|
13578
|
-
return
|
|
13625
|
+
return fromEntries(
|
|
13579
13626
|
Object.entries(value).filter((entry) => entry[1] !== void 0)
|
|
13580
13627
|
);
|
|
13581
13628
|
}
|
|
@@ -13660,7 +13707,7 @@ function stripQuery(value) {
|
|
|
13660
13707
|
return value == null ? void 0 : value.split("?")[0];
|
|
13661
13708
|
}
|
|
13662
13709
|
function globalRecord(name) {
|
|
13663
|
-
return memberRecord(
|
|
13710
|
+
return memberRecord(getGlobalObject()[name]);
|
|
13664
13711
|
}
|
|
13665
13712
|
function realmOf(candidate) {
|
|
13666
13713
|
var _a;
|