@orbit-work/oem-sdk 0.1.8 → 0.1.9
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/audit-brand.js +188 -15
- package/dist/audit-brand.js.map +1 -1
- package/dist/audit.d.ts +37 -1
- package/dist/audit.js +188 -15
- package/dist/audit.js.map +1 -1
- package/dist/{chunk-KFDD7FES.js → chunk-I3RBZK2G.js} +129 -18
- package/dist/chunk-I3RBZK2G.js.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/manifest.d.ts +63 -3
- package/dist/manifest.js +1 -1
- package/dist/runtime.d.ts +2 -2
- package/dist/runtime.js +1 -1
- package/package.json +2 -2
- package/schema/orbit-brand.schema.json +113 -14
- package/dist/chunk-KFDD7FES.js.map +0 -1
package/dist/audit.js
CHANGED
|
@@ -1,14 +1,33 @@
|
|
|
1
1
|
import { realpath, readFile, stat } from 'fs/promises';
|
|
2
2
|
import { resolve, extname, sep, dirname } from 'path';
|
|
3
|
-
import { gzipSync } from 'zlib';
|
|
3
|
+
import { gzipSync, inflateSync } from 'zlib';
|
|
4
4
|
import { init, parse } from 'es-module-lexer';
|
|
5
5
|
import { transform } from 'esbuild';
|
|
6
6
|
import { validateDictionary } from '@orbit-work/ui/locale';
|
|
7
|
-
import { UNIFIED_NEUTRAL_TOKENS, BRAND_ACTION_TOKENS, isOrbitworkFontScale, ORBITWORK_FONT_SCALES
|
|
7
|
+
import { UNIFIED_NEUTRAL_TOKENS, BRAND_ACTION_TOKENS, ds2ContrastRatio, checkOemPrimary, isOrbitworkFontScale, ORBITWORK_FONT_SCALES } from '@orbit-work/ui/appearance';
|
|
8
8
|
import { WORKBENCH_SLOT_DECLARATIONS, WORKBENCH_KEYED_SLOT_KEYS } from '@orbit-work/ui/slot/core';
|
|
9
9
|
|
|
10
10
|
// src/audit-brand.ts
|
|
11
11
|
var BRAND_MANIFEST_SCHEMA = "@orbit-work/oem-sdk/manifest@1";
|
|
12
|
+
var TRAY_VARIANT_PATHS = {
|
|
13
|
+
macos: { "1x": "./macos/trayTemplate.png", "2x": "./macos/trayTemplate@2x.png" },
|
|
14
|
+
windows: {
|
|
15
|
+
"16": "./windows/tray-16.png",
|
|
16
|
+
"20": "./windows/tray-20.png",
|
|
17
|
+
"24": "./windows/tray-24.png",
|
|
18
|
+
"32": "./windows/tray-32.png"
|
|
19
|
+
},
|
|
20
|
+
linux: {
|
|
21
|
+
"16": "./linux/tray-16.png",
|
|
22
|
+
"22": "./linux/tray-22.png",
|
|
23
|
+
"24": "./linux/tray-24.png",
|
|
24
|
+
"32": "./linux/tray-32.png",
|
|
25
|
+
"48": "./linux/tray-48.png",
|
|
26
|
+
"64": "./linux/tray-64.png",
|
|
27
|
+
"128": "./linux/tray-128.png"
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
var TRAY_SOURCE_PATH = "./assets/tray-source.png";
|
|
12
31
|
var ROOT_KEYS = /* @__PURE__ */ new Set([
|
|
13
32
|
"$schema",
|
|
14
33
|
"id",
|
|
@@ -18,6 +37,7 @@ var ROOT_KEYS = /* @__PURE__ */ new Set([
|
|
|
18
37
|
"permissions",
|
|
19
38
|
"entry",
|
|
20
39
|
"identity",
|
|
40
|
+
"theme",
|
|
21
41
|
"tokens",
|
|
22
42
|
"typography",
|
|
23
43
|
"fontScale",
|
|
@@ -29,14 +49,17 @@ var ROOT_KEYS = /* @__PURE__ */ new Set([
|
|
|
29
49
|
"contributes"
|
|
30
50
|
]);
|
|
31
51
|
var IDENTITY_KEYS = /* @__PURE__ */ new Set(["productName", "appId", "versionChannel", "protocolScheme", "userDataNamespace"]);
|
|
32
|
-
var ASSET_KEYS = /* @__PURE__ */ new Set(["appIcon", "tray", "logo", "loginKV"]);
|
|
52
|
+
var ASSET_KEYS = /* @__PURE__ */ new Set(["appIcon", "tray", "trayVariants", "logo", "loginKV"]);
|
|
33
53
|
var MODE_KEYS = /* @__PURE__ */ new Set(["light", "dark"]);
|
|
54
|
+
var THEME_KEYS = /* @__PURE__ */ new Set(["primary", "signal", "allowDangerHue"]);
|
|
55
|
+
var HEX6 = /^#[0-9a-f]{6}$/i;
|
|
34
56
|
var CONTRIBUTES_KEYS = /* @__PURE__ */ new Set(["slots"]);
|
|
35
57
|
var NETWORK_KEYS = /* @__PURE__ */ new Set(["allowedOrigins"]);
|
|
36
58
|
var PERMISSIONS_KEYS = /* @__PURE__ */ new Set(["microphoneUsage"]);
|
|
37
59
|
var TYPOGRAPHY_KEYS = /* @__PURE__ */ new Set(["fontSans", "fontMono"]);
|
|
38
|
-
var APPEARANCE_KEYS = /* @__PURE__ */ new Set(["homeBackdrop"]);
|
|
39
|
-
var
|
|
60
|
+
var APPEARANCE_KEYS = /* @__PURE__ */ new Set(["homeBackdrop", "login"]);
|
|
61
|
+
var LOGIN_APPEARANCE_KEYS = /* @__PURE__ */ new Set(["claimColor", "claimNoteColor", "accentColor", "scrim"]);
|
|
62
|
+
var BRANDING_KEYS = /* @__PURE__ */ new Set(["productName", "companyName", "claim", "claimHighlight", "claimNote", "slogan"]);
|
|
40
63
|
var SLOT_COMMON_KEYS = /* @__PURE__ */ new Set(["name"]);
|
|
41
64
|
var BRAND_TOKEN_NAMES = /* @__PURE__ */ new Set([...UNIFIED_NEUTRAL_TOKENS, ...BRAND_ACTION_TOKENS]);
|
|
42
65
|
var SLOT_DECLARATIONS = WORKBENCH_SLOT_DECLARATIONS;
|
|
@@ -46,7 +69,13 @@ var APP_ID = /^[a-zA-Z][a-zA-Z0-9]*(?:\.[a-zA-Z0-9][a-zA-Z0-9-]*){2,}$/;
|
|
|
46
69
|
var PROTOCOL_SCHEME = /^[a-z][a-z0-9+.-]*$/;
|
|
47
70
|
var SOURCE_ENTRY = /^\.\/src\/.+\.(?:[cm]?js|[jt]sx?)$/;
|
|
48
71
|
var WINDOWS_DEVICE_NAME = /^(?:con|prn|aux|nul|com[1-9]|lpt[1-9])(?:\..*)?$/i;
|
|
49
|
-
var
|
|
72
|
+
var RESERVED_APP_IDS = /* @__PURE__ */ new Set([
|
|
73
|
+
"com.orbitwork.desktop",
|
|
74
|
+
"com.orbitwork.desktop-debug",
|
|
75
|
+
"com.orbitwork.desktop-oem-devhost",
|
|
76
|
+
"com.orbitwork.desktop-oem-devhost.sandbox",
|
|
77
|
+
"com.orbitwork.desktop-oem-devhost.workbench"
|
|
78
|
+
]);
|
|
50
79
|
var OFFICIAL_PRODUCT_NAMES = /* @__PURE__ */ new Set(["orbitwork"]);
|
|
51
80
|
var RESERVED_VERSION_CHANNELS = /* @__PURE__ */ new Set(["stable", "debug", "latest", "desktop", "macos", "windows", "linux"]);
|
|
52
81
|
var RESERVED_PROTOCOL_SCHEMES = /* @__PURE__ */ new Set([
|
|
@@ -134,7 +163,7 @@ function parseIdentity(value, id, platform) {
|
|
|
134
163
|
if (!platform && OFFICIAL_PRODUCT_NAMES.has(productName.toLowerCase())) {
|
|
135
164
|
throw new Error(`identity.productName is reserved for the official application: ${productName}`);
|
|
136
165
|
}
|
|
137
|
-
if (!platform && appId
|
|
166
|
+
if (!platform && RESERVED_APP_IDS.has(appId)) {
|
|
138
167
|
throw new Error(`identity.appId is reserved for the official application: ${appId}`);
|
|
139
168
|
}
|
|
140
169
|
if (!platform && productNameNamespace(productName) !== id) {
|
|
@@ -146,9 +175,6 @@ function parseIdentity(value, id, platform) {
|
|
|
146
175
|
if (!platform && protocolScheme !== id) {
|
|
147
176
|
throw new Error("identity.protocolScheme must equal manifest id to keep OEM deep links namespaced");
|
|
148
177
|
}
|
|
149
|
-
if (!platform && !appId.endsWith(`.oem.${id}`)) {
|
|
150
|
-
throw new Error("identity.appId must end with .oem.<manifest id> to isolate installation and user data");
|
|
151
|
-
}
|
|
152
178
|
if (!platform && value.userDataNamespace !== void 0 && !KEBAB_ID.test(text(value.userDataNamespace, "identity.userDataNamespace", 64))) {
|
|
153
179
|
throw new Error("identity.userDataNamespace must be lowercase kebab-case");
|
|
154
180
|
}
|
|
@@ -163,21 +189,67 @@ function parseAssets(value) {
|
|
|
163
189
|
if (!isRecord(value)) throw new Error("assets must be an object");
|
|
164
190
|
assertKnownKeys(value, ASSET_KEYS, "assets");
|
|
165
191
|
const tray = value.tray === void 0 ? void 0 : relativePath(value.tray, "assets.tray");
|
|
192
|
+
const trayVariants = value.trayVariants === void 0 ? void 0 : parseTrayVariants(value.trayVariants);
|
|
193
|
+
if (trayVariants && tray !== TRAY_SOURCE_PATH) {
|
|
194
|
+
throw new Error(`assets.tray must equal ${TRAY_SOURCE_PATH} when assets.trayVariants is present`);
|
|
195
|
+
}
|
|
166
196
|
const loginKV = value.loginKV === void 0 ? void 0 : relativePath(value.loginKV, "assets.loginKV");
|
|
167
197
|
return {
|
|
168
198
|
appIcon: relativePath(value.appIcon, "assets.appIcon"),
|
|
169
199
|
...tray ? { tray } : {},
|
|
200
|
+
...trayVariants ? { trayVariants } : {},
|
|
170
201
|
logo: relativePath(value.logo, "assets.logo"),
|
|
171
202
|
...loginKV ? { loginKV } : {}
|
|
172
203
|
};
|
|
173
204
|
}
|
|
205
|
+
function parseTrayVariants(value) {
|
|
206
|
+
if (!isRecord(value)) throw new Error("assets.trayVariants must be an object");
|
|
207
|
+
assertKnownKeys(value, new Set(Object.keys(TRAY_VARIANT_PATHS)), "assets.trayVariants");
|
|
208
|
+
const result = {};
|
|
209
|
+
for (const [platform, expected] of Object.entries(TRAY_VARIANT_PATHS)) {
|
|
210
|
+
const variants = value[platform];
|
|
211
|
+
if (!isRecord(variants)) throw new Error(`assets.trayVariants.${platform} must be an object`);
|
|
212
|
+
assertKnownKeys(variants, new Set(Object.keys(expected)), `assets.trayVariants.${platform}`);
|
|
213
|
+
const parsed = {};
|
|
214
|
+
for (const [size, expectedPath] of Object.entries(expected)) {
|
|
215
|
+
const actual = relativePath(variants[size], `assets.trayVariants.${platform}.${size}`);
|
|
216
|
+
if (actual !== expectedPath) {
|
|
217
|
+
throw new Error(`assets.trayVariants.${platform}.${size} must equal ${expectedPath}`);
|
|
218
|
+
}
|
|
219
|
+
parsed[size] = actual;
|
|
220
|
+
}
|
|
221
|
+
result[platform] = parsed;
|
|
222
|
+
}
|
|
223
|
+
return result;
|
|
224
|
+
}
|
|
174
225
|
function parseAppearance(value) {
|
|
175
226
|
if (value === void 0) return void 0;
|
|
176
227
|
if (!isRecord(value)) throw new Error("appearance must be an object");
|
|
177
228
|
assertKnownKeys(value, APPEARANCE_KEYS, "appearance");
|
|
178
229
|
if (value.homeBackdrop !== void 0 && typeof value.homeBackdrop !== "boolean")
|
|
179
230
|
throw new Error("appearance.homeBackdrop must be a boolean");
|
|
180
|
-
|
|
231
|
+
let login;
|
|
232
|
+
if (value.login !== void 0) {
|
|
233
|
+
if (!isRecord(value.login)) throw new Error("appearance.login must be an object");
|
|
234
|
+
assertKnownKeys(value.login, LOGIN_APPEARANCE_KEYS, "appearance.login");
|
|
235
|
+
login = {};
|
|
236
|
+
for (const key of ["claimColor", "claimNoteColor", "accentColor"]) {
|
|
237
|
+
const color = value.login[key];
|
|
238
|
+
if (color !== void 0) {
|
|
239
|
+
if (typeof color !== "string" || color.length !== 7 || !HEX6.test(color))
|
|
240
|
+
throw new Error(`appearance.login.${key} must be an opaque #RRGGBB color`);
|
|
241
|
+
login[key] = color.toLowerCase();
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
if (value.login.scrim !== void 0) {
|
|
245
|
+
if (typeof value.login.scrim !== "boolean") throw new Error("appearance.login.scrim must be a boolean");
|
|
246
|
+
login.scrim = value.login.scrim;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
return {
|
|
250
|
+
...value.homeBackdrop !== void 0 ? { homeBackdrop: value.homeBackdrop } : {},
|
|
251
|
+
...login ? { login } : {}
|
|
252
|
+
};
|
|
181
253
|
}
|
|
182
254
|
function parseBrandCopy(value, path) {
|
|
183
255
|
if (!isRecord(value)) throw new Error(`${path} must be an object`);
|
|
@@ -188,11 +260,14 @@ function parseBrandCopy(value, path) {
|
|
|
188
260
|
};
|
|
189
261
|
for (const [key, limit] of [
|
|
190
262
|
["claim", 40],
|
|
263
|
+
["claimHighlight", 40],
|
|
191
264
|
["claimNote", 48],
|
|
192
265
|
["slogan", 68]
|
|
193
266
|
]) {
|
|
194
267
|
if (value[key] !== void 0) result[key] = text(value[key], `${path}.${key}`, limit);
|
|
195
268
|
}
|
|
269
|
+
if (result.claimHighlight && !result.claim?.includes(result.claimHighlight))
|
|
270
|
+
throw new Error(`${path}.claimHighlight must be an exact substring of claim`);
|
|
196
271
|
return result;
|
|
197
272
|
}
|
|
198
273
|
function parseBranding(value) {
|
|
@@ -316,6 +391,27 @@ function parseModeTokens(value, path) {
|
|
|
316
391
|
}
|
|
317
392
|
return result;
|
|
318
393
|
}
|
|
394
|
+
function parseTheme(value) {
|
|
395
|
+
if (value === void 0) return void 0;
|
|
396
|
+
if (!isRecord(value)) throw new Error("theme must be an object");
|
|
397
|
+
assertKnownKeys(value, THEME_KEYS, "theme");
|
|
398
|
+
if (typeof value.primary !== "string" || !HEX6.test(value.primary)) throw new Error("theme.primary must be #RRGGBB");
|
|
399
|
+
const primary = value.primary.toLowerCase();
|
|
400
|
+
let signal;
|
|
401
|
+
if (value.signal !== void 0) {
|
|
402
|
+
if (typeof value.signal !== "string" || !HEX6.test(value.signal)) throw new Error("theme.signal must be #RRGGBB");
|
|
403
|
+
signal = value.signal.toLowerCase();
|
|
404
|
+
const ratio = ds2ContrastRatio(signal, "#fafafb");
|
|
405
|
+
if (ratio < 3) throw new Error(`theme.signal contrast on #FAFAFB is ${ratio.toFixed(2)}:1; expected >= 3:1`);
|
|
406
|
+
}
|
|
407
|
+
if (value.allowDangerHue !== void 0 && typeof value.allowDangerHue !== "boolean") {
|
|
408
|
+
throw new Error("theme.allowDangerHue must be a boolean");
|
|
409
|
+
}
|
|
410
|
+
const allowDangerHue = value.allowDangerHue === true;
|
|
411
|
+
const check = checkOemPrimary(primary);
|
|
412
|
+
if (check.errors.length && !allowDangerHue) throw new Error(`theme.primary: ${check.errors.join("; ")}`);
|
|
413
|
+
return { primary, ...signal ? { signal } : {}, ...allowDangerHue ? { allowDangerHue } : {} };
|
|
414
|
+
}
|
|
319
415
|
function parseTokens(value) {
|
|
320
416
|
if (value === void 0) return void 0;
|
|
321
417
|
if (!isRecord(value)) throw new Error("tokens must be an object");
|
|
@@ -404,6 +500,7 @@ function parseBrandManifest(input, options) {
|
|
|
404
500
|
const contributes = parseContributes(input.contributes);
|
|
405
501
|
if ((contributes?.slots.length ?? 0) > 0 && !entry)
|
|
406
502
|
throw new Error("entry is required when contributes.slots is not empty");
|
|
503
|
+
const theme = parseTheme(input.theme);
|
|
407
504
|
const tokens = parseTokens(input.tokens);
|
|
408
505
|
const typography = parseTypography(input.typography);
|
|
409
506
|
const fontScale = parseFontScale(input.fontScale);
|
|
@@ -420,9 +517,6 @@ function parseBrandManifest(input, options) {
|
|
|
420
517
|
if (!platform && identity.protocolScheme !== id) {
|
|
421
518
|
throw new Error("identity.protocolScheme must equal manifest id to keep OEM deep links namespaced");
|
|
422
519
|
}
|
|
423
|
-
if (!platform && !identity.appId.endsWith(`.oem.${id}`)) {
|
|
424
|
-
throw new Error("identity.appId must end with .oem.<manifest id> to isolate installation and user data");
|
|
425
|
-
}
|
|
426
520
|
return {
|
|
427
521
|
ok: true,
|
|
428
522
|
manifest: {
|
|
@@ -434,6 +528,7 @@ function parseBrandManifest(input, options) {
|
|
|
434
528
|
...input.permissions !== void 0 ? { permissions: parsePermissions(input.permissions) } : {},
|
|
435
529
|
...entry ? { entry } : {},
|
|
436
530
|
identity,
|
|
531
|
+
...theme ? { theme } : {},
|
|
437
532
|
...tokens ? { tokens } : {},
|
|
438
533
|
...typography ? { typography } : {},
|
|
439
534
|
...fontScale ? { fontScale } : {},
|
|
@@ -551,6 +646,80 @@ async function assertAsset(packageRoot, relative, kind) {
|
|
|
551
646
|
}
|
|
552
647
|
return file;
|
|
553
648
|
}
|
|
649
|
+
var PNG_CRC_TABLE = (() => {
|
|
650
|
+
const table = new Uint32Array(256);
|
|
651
|
+
for (let index = 0; index < table.length; index += 1) {
|
|
652
|
+
let value = index;
|
|
653
|
+
for (let bit = 0; bit < 8; bit += 1) value = value & 1 ? 3988292384 ^ value >>> 1 : value >>> 1;
|
|
654
|
+
table[index] = value >>> 0;
|
|
655
|
+
}
|
|
656
|
+
return table;
|
|
657
|
+
})();
|
|
658
|
+
function pngCrc32(bytes) {
|
|
659
|
+
let crc = 4294967295;
|
|
660
|
+
for (const byte of bytes) crc = PNG_CRC_TABLE[(crc ^ byte) & 255] ^ crc >>> 8;
|
|
661
|
+
return (crc ^ 4294967295) >>> 0;
|
|
662
|
+
}
|
|
663
|
+
function strictPngDimensions(bytes) {
|
|
664
|
+
if (bytes.length < 45 || bytes.toString("hex", 0, 8) !== "89504e470d0a1a0a") return null;
|
|
665
|
+
let offset = 8;
|
|
666
|
+
let dimensions = null;
|
|
667
|
+
const idat = [];
|
|
668
|
+
while (offset + 12 <= bytes.length) {
|
|
669
|
+
const length = bytes.readUInt32BE(offset);
|
|
670
|
+
const end = offset + 12 + length;
|
|
671
|
+
if (end > bytes.length) return null;
|
|
672
|
+
const kind = bytes.toString("ascii", offset + 4, offset + 8);
|
|
673
|
+
if (pngCrc32(bytes.subarray(offset + 4, offset + 8 + length)) !== bytes.readUInt32BE(offset + 8 + length)) return null;
|
|
674
|
+
if (!dimensions) {
|
|
675
|
+
if (kind !== "IHDR" || length !== 13) return null;
|
|
676
|
+
const width = bytes.readUInt32BE(offset + 8);
|
|
677
|
+
const height = bytes.readUInt32BE(offset + 12);
|
|
678
|
+
if (!width || !height || bytes[offset + 18] !== 0 || bytes[offset + 19] !== 0 || bytes[offset + 20] > 1) return null;
|
|
679
|
+
dimensions = { width, height };
|
|
680
|
+
} else if (kind === "IDAT") {
|
|
681
|
+
idat.push(bytes.subarray(offset + 8, offset + 8 + length));
|
|
682
|
+
} else if (kind === "IEND") {
|
|
683
|
+
if (length !== 0 || idat.length === 0 || end !== bytes.length) return null;
|
|
684
|
+
try {
|
|
685
|
+
if (inflateSync(Buffer.concat(idat)).length === 0) return null;
|
|
686
|
+
} catch {
|
|
687
|
+
return null;
|
|
688
|
+
}
|
|
689
|
+
return dimensions;
|
|
690
|
+
}
|
|
691
|
+
offset = end;
|
|
692
|
+
}
|
|
693
|
+
return null;
|
|
694
|
+
}
|
|
695
|
+
async function assertTrayVariants(packageRoot, variants) {
|
|
696
|
+
const checked = [];
|
|
697
|
+
for (const [platform, expected] of Object.entries(TRAY_VARIANT_PATHS)) {
|
|
698
|
+
for (const [label, expectedPath] of Object.entries(expected)) {
|
|
699
|
+
const relative = variants[platform][label];
|
|
700
|
+
const field = `assets.trayVariants.${platform}.${label}`;
|
|
701
|
+
if (relative !== expectedPath) throw new Error(`${field} must equal ${expectedPath}`);
|
|
702
|
+
let file;
|
|
703
|
+
try {
|
|
704
|
+
file = await resolvePackageFile(packageRoot, relative, field);
|
|
705
|
+
} catch (error) {
|
|
706
|
+
if (error instanceof Error && "code" in error && error.code === "ENOENT") throw new Error(`${field} file is missing: ${relative}`);
|
|
707
|
+
throw error;
|
|
708
|
+
}
|
|
709
|
+
const info = await stat(file);
|
|
710
|
+
if (!info.isFile()) throw new Error(`${field} must point to a file`);
|
|
711
|
+
if (info.size > ASSET_BUDGET) throw new Error(`${field} exceeds 5 MiB`);
|
|
712
|
+
const dimensions = strictPngDimensions(await readFile(file));
|
|
713
|
+
const size = platform === "macos" ? label === "1x" ? 16 : 32 : Number(label);
|
|
714
|
+
if (!dimensions) throw new Error(`${field} must be a valid PNG`);
|
|
715
|
+
if (dimensions.width !== size || dimensions.height !== size) {
|
|
716
|
+
throw new Error(`${field} must be ${size}x${size}, got ${dimensions.width}x${dimensions.height}`);
|
|
717
|
+
}
|
|
718
|
+
checked.push(relative);
|
|
719
|
+
}
|
|
720
|
+
}
|
|
721
|
+
return checked;
|
|
722
|
+
}
|
|
554
723
|
function pngDimensions(bytes) {
|
|
555
724
|
if (bytes.length < 24 || bytes.toString("hex", 0, 8) !== "89504e470d0a1a0a") return null;
|
|
556
725
|
return { width: bytes.readUInt32BE(16), height: bytes.readUInt32BE(20) };
|
|
@@ -726,10 +895,14 @@ async function auditBrandPackage(manifestFile, options = {}) {
|
|
|
726
895
|
if (!parsed.ok) throw new Error(`manifest contract failed: ${parsed.error}`);
|
|
727
896
|
const manifest = parsed.manifest;
|
|
728
897
|
const checkedAssets = [];
|
|
729
|
-
|
|
898
|
+
const assetEntries = Object.entries(manifest.assets).filter(([kind]) => kind !== "trayVariants");
|
|
899
|
+
for (const [kind, relative] of assetEntries) {
|
|
730
900
|
await assertAsset(packageRoot, relative, kind);
|
|
731
901
|
checkedAssets.push(relative);
|
|
732
902
|
}
|
|
903
|
+
if (manifest.assets.trayVariants) {
|
|
904
|
+
checkedAssets.push(...await assertTrayVariants(packageRoot, manifest.assets.trayVariants));
|
|
905
|
+
}
|
|
733
906
|
let entryGzipBytes = 0;
|
|
734
907
|
let checkedModules = [];
|
|
735
908
|
const checkedLocales = manifest.locales ? await auditLocaleDictionaries(packageRoot, manifest.locales) : [];
|