@bridge-ds/core 0.13.0 → 0.16.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/README.md +25 -1
- package/bridge.config.schema.json +22 -0
- package/dist/audit/index.js +3 -3
- package/dist/component-scan.d.ts +158 -0
- package/dist/config.d.ts +22 -0
- package/dist/contrast-model.d.ts +43 -0
- package/dist/github-client.d.ts +166 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +1446 -355
- package/dist/index.js.map +1 -1
- package/dist/node/fs-source.d.ts +5 -0
- package/dist/node/index.d.ts +1 -0
- package/dist/node/index.js +53 -4
- package/dist/node/index.js.map +1 -1
- package/dist/{prod-branch-6ftQWwdu.js → prod-branch-CSM0c2OF.js} +148 -134
- package/dist/prod-branch-CSM0c2OF.js.map +1 -0
- package/dist/repo-access.d.ts +66 -0
- package/dist/repo-model.d.ts +176 -0
- package/dist/{suggestion-apply-bH6-gZrE.js → repo-source-73kARDJv.js} +478 -204
- package/dist/repo-source-73kARDJv.js.map +1 -0
- package/dist/repo-source-github.d.ts +43 -0
- package/dist/repo-source.d.ts +38 -0
- package/dist/{report-BeWNSjPk.js → report-DbE6yJCw.js} +2 -2
- package/dist/{report-BeWNSjPk.js.map → report-DbE6yJCw.js.map} +1 -1
- package/dist/snapshot.d.ts +137 -0
- package/dist/token-rows.d.ts +122 -0
- package/dist/try-in-product.d.ts +4 -1
- package/package.json +1 -1
- package/dist/prod-branch-6ftQWwdu.js.map +0 -1
- package/dist/suggestion-apply-bH6-gZrE.js.map +0 -1
|
@@ -1209,7 +1209,7 @@ const DEFAULT_GOVERNANCE = {
|
|
|
1209
1209
|
owners: { design: [], tech: [] }
|
|
1210
1210
|
};
|
|
1211
1211
|
const FLAT_TOKEN_KEYS = ["primitives", "brands", "semantic", "base", "density", "components", "contrastChecks"];
|
|
1212
|
-
const CANONICAL_TOKEN_KEYS = ["root", "include", "exclude", "tiers", "layers"];
|
|
1212
|
+
const CANONICAL_TOKEN_KEYS = ["root", "include", "exclude", "tiers", "layers", "usage"];
|
|
1213
1213
|
const FLAT_MODE_KEYS = ["brands", "themes", "densities", "defaults"];
|
|
1214
1214
|
const AXIS_OF = { brands: "brand", themes: "theme", densities: "density" };
|
|
1215
1215
|
class ConfigError extends Error {
|
|
@@ -1297,7 +1297,7 @@ function defineConfig(input) {
|
|
|
1297
1297
|
const contrastFile = contrastPath ?? [root === "." ? "" : root, paths.contrastChecks].filter(Boolean).join("/");
|
|
1298
1298
|
return {
|
|
1299
1299
|
repo: parseRepoInput(input.repo, input.branch),
|
|
1300
|
-
tokens: { ...paths, include: input.tokens?.include ?? ["**/*.tokens.json"], exclude: input.tokens?.exclude ?? [], tiers, layers },
|
|
1300
|
+
tokens: { ...paths, include: input.tokens?.include ?? ["**/*.tokens.json"], exclude: input.tokens?.exclude ?? [], tiers, layers, ...t.usage ? { usage: trimSlashes(t.usage) } : {} },
|
|
1301
1301
|
axes,
|
|
1302
1302
|
modes,
|
|
1303
1303
|
contrast: { path: contrastFile, modes: input.contrast?.modes },
|
|
@@ -1307,7 +1307,8 @@ function defineConfig(input) {
|
|
|
1307
1307
|
styleSuffix: input.components.styleSuffix ?? ".module.css",
|
|
1308
1308
|
reference: input.components.reference,
|
|
1309
1309
|
index: input.components.index,
|
|
1310
|
-
specs: input.components.specs
|
|
1310
|
+
specs: input.components.specs,
|
|
1311
|
+
...input.components.styles ? { styles: input.components.styles.map(trimSlashes) } : {}
|
|
1311
1312
|
} : void 0,
|
|
1312
1313
|
docs: { ...input.docs },
|
|
1313
1314
|
changesets: pkg ? { dir: trimSlashes(input.changesets?.dir ?? ".changeset"), package: pkg } : void 0,
|
|
@@ -1332,6 +1333,7 @@ function defineConfig(input) {
|
|
|
1332
1333
|
products: input.products?.length ? input.products.map((p) => ({ ...p })) : DEFAULT_PRODUCTS.map((p) => ({ ...p })),
|
|
1333
1334
|
changes: input.changes === "direct" ? "direct" : DEFAULT_CHANGES_MODE,
|
|
1334
1335
|
...input.storybook?.url ? { storybook: { url: input.storybook.url.trim().replace(/\/+$/, "") } } : {},
|
|
1336
|
+
...input.library?.public === true ? { library: { public: true } } : {},
|
|
1335
1337
|
...input.audit ? { audit: { ...input.audit } } : {},
|
|
1336
1338
|
...input.visualImpact ? { visualImpact: { mode: input.visualImpact.mode === "on-demand" ? "on-demand" : "auto" } } : {},
|
|
1337
1339
|
...input.integrations ? { integrations: { ...input.integrations } } : {},
|
|
@@ -1376,7 +1378,7 @@ function loadConfig(source) {
|
|
|
1376
1378
|
if (!isObj(tokens)) problems.push('"tokens" must be an object');
|
|
1377
1379
|
else
|
|
1378
1380
|
for (const [k, v] of Object.entries(tokens)) {
|
|
1379
|
-
if (FLAT_TOKEN_KEYS.includes(k) || k === "root") {
|
|
1381
|
+
if (FLAT_TOKEN_KEYS.includes(k) || k === "root" || k === "usage") {
|
|
1380
1382
|
if (!isStr(v)) problems.push(`"tokens.${k}" must be a non-empty string`);
|
|
1381
1383
|
} else if (k === "include" || k === "exclude") {
|
|
1382
1384
|
if (!isStrList(v)) problems.push(`"tokens.${k}" must be a list of globs`);
|
|
@@ -1430,6 +1432,7 @@ function loadConfig(source) {
|
|
|
1430
1432
|
problems.push('"contrast" must be { "path", "modes"? }');
|
|
1431
1433
|
const comps = d.components;
|
|
1432
1434
|
if (comps !== void 0 && (!isObj(comps) || !isStr(comps.dir))) problems.push('"components.dir" must be a non-empty string');
|
|
1435
|
+
if (isObj(comps) && comps.styles !== void 0 && !isStrList(comps.styles)) problems.push('"components.styles" must be a list of globs');
|
|
1433
1436
|
const cs = d.changeset;
|
|
1434
1437
|
if (cs !== void 0 && (!isObj(cs) || !isStr(cs.package))) problems.push('"changeset.package" must be a non-empty string');
|
|
1435
1438
|
const css = d.changesets;
|
|
@@ -1462,6 +1465,14 @@ function loadConfig(source) {
|
|
|
1462
1465
|
else if (!/^https:\/\/[^\s/]+/.test(sb.url.trim())) problems.push('"storybook.url" must start with https://, for example https://storybook.example.com');
|
|
1463
1466
|
else for (const k of Object.keys(sb)) if (k !== "url") problems.push(`"storybook.${k}" is not a known key`);
|
|
1464
1467
|
}
|
|
1468
|
+
const lib = d.library;
|
|
1469
|
+
if (lib !== void 0) {
|
|
1470
|
+
if (!isObj(lib)) problems.push('"library" must be an object, for example { "public": true }');
|
|
1471
|
+
else {
|
|
1472
|
+
if (lib.public !== void 0 && typeof lib.public !== "boolean") problems.push('"library.public" must be true or false');
|
|
1473
|
+
for (const k of Object.keys(lib)) if (k !== "public") problems.push(`"library.${k}" is not a known key`);
|
|
1474
|
+
}
|
|
1475
|
+
}
|
|
1465
1476
|
problems.push(...productProblems(d.products));
|
|
1466
1477
|
const audit = d.audit;
|
|
1467
1478
|
if (audit !== void 0) {
|
|
@@ -1501,12 +1512,13 @@ function storybookUrl(config) {
|
|
|
1501
1512
|
const prod = config?.previews?.production?.storybook?.trim();
|
|
1502
1513
|
return prod && /^https:\/\//.test(prod) && !/\{\w+\}/.test(prod) ? prod.replace(/\/+$/, "") : void 0;
|
|
1503
1514
|
}
|
|
1515
|
+
const libraryIsPublic = (config) => config?.library?.public === true;
|
|
1504
1516
|
function toConfigJson(config, schema = "./packages/core/bridge.config.schema.json") {
|
|
1505
1517
|
return {
|
|
1506
1518
|
$schema: schema,
|
|
1507
1519
|
version: 1,
|
|
1508
1520
|
...config.repo ? { repo: config.repo } : {},
|
|
1509
|
-
tokens: { root: config.tokens.root, include: config.tokens.include, ...config.tokens.exclude.length ? { exclude: config.tokens.exclude } : {}, tiers: config.tokens.tiers, layers: config.tokens.layers.map((l) => l.optional ? l : { files: l.files }) },
|
|
1521
|
+
tokens: { root: config.tokens.root, include: config.tokens.include, ...config.tokens.exclude.length ? { exclude: config.tokens.exclude } : {}, tiers: config.tokens.tiers, layers: config.tokens.layers.map((l) => l.optional ? l : { files: l.files }), ...config.tokens.usage ? { usage: config.tokens.usage } : {} },
|
|
1510
1522
|
modes: Object.fromEntries(Object.entries(config.axes).map(([k, a]) => [k, a.parity ? a : { values: a.values, default: a.default }])),
|
|
1511
1523
|
...config.contrast ? { contrast: config.contrast.modes ? config.contrast : { path: config.contrast.path } } : {},
|
|
1512
1524
|
...config.components ? { components: Object.fromEntries(Object.entries(config.components).filter(([, v]) => v !== void 0)) } : {},
|
|
@@ -1519,6 +1531,7 @@ function toConfigJson(config, schema = "./packages/core/bridge.config.schema.jso
|
|
|
1519
1531
|
...config.visualImpact ? { visualImpact: config.visualImpact } : {},
|
|
1520
1532
|
changes: changesMode(config),
|
|
1521
1533
|
...config.storybook ? { storybook: config.storybook } : {},
|
|
1534
|
+
...config.library ? { library: config.library } : {},
|
|
1522
1535
|
...config.products && !sameProducts(config.products, DEFAULT_PRODUCTS) ? { products: config.products } : {}
|
|
1523
1536
|
};
|
|
1524
1537
|
}
|
|
@@ -2939,7 +2952,7 @@ export {
|
|
|
2939
2952
|
previewsSettled as Z,
|
|
2940
2953
|
DEFAULT_TOKEN_PATHS as _,
|
|
2941
2954
|
proposedTokenPath as a,
|
|
2942
|
-
|
|
2955
|
+
composePrBody as a$,
|
|
2943
2956
|
buildTokenSet as a0,
|
|
2944
2957
|
readPreviewComment as a1,
|
|
2945
2958
|
linkStatus as a2,
|
|
@@ -2950,110 +2963,110 @@ export {
|
|
|
2950
2963
|
withNeededBy as a7,
|
|
2951
2964
|
withLink as a8,
|
|
2952
2965
|
withPiecesRecord as a9,
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
2966
|
+
PRIMITIVE_MODE as aA,
|
|
2967
|
+
PRODUCT_LABEL_PREFIX as aB,
|
|
2968
|
+
RIGHTS as aC,
|
|
2969
|
+
RIGHT_LABEL as aD,
|
|
2970
|
+
RISK_TIER as aE,
|
|
2971
|
+
TIER_ORDER as aF,
|
|
2972
|
+
TeamDirectory as aG,
|
|
2973
|
+
VISUAL_CHECK_LABEL as aH,
|
|
2974
|
+
affectedContrast as aI,
|
|
2975
|
+
aliasOf as aJ,
|
|
2976
|
+
appForProject as aK,
|
|
2977
|
+
appUrl as aL,
|
|
2978
|
+
approverEntries as aM,
|
|
2979
|
+
approverLists as aN,
|
|
2980
|
+
baseBranchOf as aO,
|
|
2981
|
+
branchName as aP,
|
|
2982
|
+
branchSlug as aQ,
|
|
2983
|
+
canShip as aR,
|
|
2984
|
+
changeKind as aS,
|
|
2985
|
+
changedModes as aT,
|
|
2986
|
+
changesMode as aU,
|
|
2987
|
+
clearRawDeep as aV,
|
|
2988
|
+
colorToCss as aW,
|
|
2989
|
+
colorsEqual as aX,
|
|
2990
|
+
comboKey as aY,
|
|
2991
|
+
commitMessage as aZ,
|
|
2992
|
+
compactJson as a_,
|
|
2980
2993
|
productBranchSentence as aa,
|
|
2981
2994
|
mergePiecesRecord as ab,
|
|
2982
2995
|
productOfBranch as ac,
|
|
2983
2996
|
defaultProduct as ad,
|
|
2984
2997
|
slugify as ae,
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
2998
|
+
defineConfig as af,
|
|
2999
|
+
globToRegExp as ag,
|
|
3000
|
+
ConfigError as ah,
|
|
3001
|
+
DEFAULT_CHANGES_MODE as ai,
|
|
3002
|
+
DEFAULT_OVERRIDE as aj,
|
|
3003
|
+
DEFAULT_PRODUCTS as ak,
|
|
3004
|
+
AAA_MIN as al,
|
|
3005
|
+
AA_MIN as am,
|
|
3006
|
+
CHANGES_MODES as an,
|
|
3007
|
+
CONTRAST_CELL_MAX as ao,
|
|
3008
|
+
CONTRAST_CHECKS_FILE as ap,
|
|
3009
|
+
DEFAULT_GOVERNANCE as aq,
|
|
3010
|
+
DEFAULT_RIGHTS as ar,
|
|
3011
|
+
DEFAULT_VISUAL_IMPACT as as,
|
|
3012
|
+
DTCG_TYPES as at,
|
|
3013
|
+
JsonParseError as au,
|
|
3014
|
+
LINK_STATUS_TONE as av,
|
|
3015
|
+
OWNER_GROUPS as aw,
|
|
3016
|
+
PREVIEW_APP_LABELS as ax,
|
|
3017
|
+
PREVIEW_COMMENT_MARKER as ay,
|
|
3018
|
+
PREVIEW_PLACEHOLDERS as az,
|
|
3006
3019
|
modesOf as b,
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
|
|
3024
|
-
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
|
|
3020
|
+
rightsProblems as b$,
|
|
3021
|
+
composite as b0,
|
|
3022
|
+
contextFor as b1,
|
|
3023
|
+
contrastLevel as b2,
|
|
3024
|
+
contrastPair as b3,
|
|
3025
|
+
contrastRatio as b4,
|
|
3026
|
+
defaultContext as b5,
|
|
3027
|
+
defaultTitle as b6,
|
|
3028
|
+
detectLayout as b7,
|
|
3029
|
+
entriesFor as b8,
|
|
3030
|
+
entryLabel as b9,
|
|
3031
|
+
luminance as bA,
|
|
3032
|
+
nearestQuestion as bB,
|
|
3033
|
+
neededBySection as bC,
|
|
3034
|
+
nodesEqual as bD,
|
|
3035
|
+
normalizeRights as bE,
|
|
3036
|
+
overrideKey as bF,
|
|
3037
|
+
ownerEntryProblems as bG,
|
|
3038
|
+
pairKey as bH,
|
|
3039
|
+
parseDimension as bI,
|
|
3040
|
+
parseJson as bJ,
|
|
3041
|
+
parseNeededBy as bK,
|
|
3042
|
+
parseOwnerEntry as bL,
|
|
3043
|
+
parseVercelComment as bM,
|
|
3044
|
+
piecesSection as bN,
|
|
3045
|
+
plainEqual as bO,
|
|
3046
|
+
previewComment as bP,
|
|
3047
|
+
previewLinksOf as bQ,
|
|
3048
|
+
previewUrl as bR,
|
|
3049
|
+
productForPlace as bS,
|
|
3050
|
+
productLabel as bT,
|
|
3051
|
+
productMarks as bU,
|
|
3052
|
+
productProblems as bV,
|
|
3053
|
+
productsOf as bW,
|
|
3054
|
+
projectOfLabel as bX,
|
|
3055
|
+
protectedBranchesOf as bY,
|
|
3056
|
+
renderedColor as bZ,
|
|
3057
|
+
rgbaToDtcg as b_,
|
|
3058
|
+
expandEntries as ba,
|
|
3059
|
+
expandOwners as bb,
|
|
3060
|
+
fieldChanges as bc,
|
|
3061
|
+
findProduct as bd,
|
|
3062
|
+
findToken as be,
|
|
3063
|
+
findVercelComment as bf,
|
|
3064
|
+
flattenLayerFile as bg,
|
|
3065
|
+
formatNumber as bh,
|
|
3066
|
+
formatOwnerEntry as bi,
|
|
3067
|
+
fromPlain as bj,
|
|
3068
|
+
getChild as bk,
|
|
3069
|
+
getEntry as bl,
|
|
3057
3070
|
groupsPhrase as bm,
|
|
3058
3071
|
hexToRgba as bn,
|
|
3059
3072
|
holdersOf as bo,
|
|
@@ -3067,36 +3080,37 @@ export {
|
|
|
3067
3080
|
isVercelComment as bw,
|
|
3068
3081
|
kindForMin as bx,
|
|
3069
3082
|
layeredParityIssues as by,
|
|
3070
|
-
|
|
3083
|
+
libraryIsPublic as bz,
|
|
3071
3084
|
TIER_AXIS as c,
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3085
|
+
sameProducts as c0,
|
|
3086
|
+
sameToken as c1,
|
|
3087
|
+
serializeJson as c2,
|
|
3088
|
+
shipPolicy as c3,
|
|
3089
|
+
snapshotUrl as c4,
|
|
3090
|
+
soloApprover as c5,
|
|
3091
|
+
soloOwnerOf as c6,
|
|
3092
|
+
soloOwnerSentence as c7,
|
|
3093
|
+
storybookUrl as c8,
|
|
3094
|
+
suggestNearestComment as c9,
|
|
3095
|
+
summarizeTokenChange as ca,
|
|
3096
|
+
tarballAssetName as cb,
|
|
3097
|
+
tarballUrl as cc,
|
|
3098
|
+
teamKey as cd,
|
|
3099
|
+
teamKeyOf as ce,
|
|
3100
|
+
teamUnreadableMessage as cf,
|
|
3101
|
+
teamsIn as cg,
|
|
3102
|
+
toAlias as ch,
|
|
3103
|
+
toMap as ci,
|
|
3104
|
+
toPlain as cj,
|
|
3105
|
+
tokenBump as ck,
|
|
3106
|
+
tokenNode as cl,
|
|
3107
|
+
unreadableShipTeams as cm,
|
|
3108
|
+
unreadableTeams as cn,
|
|
3109
|
+
valueIn as co,
|
|
3110
|
+
valueToCss as cp,
|
|
3111
|
+
visualImpactProblems as cq,
|
|
3112
|
+
whoCanShipSentence as cr,
|
|
3113
|
+
whyItExists as cs,
|
|
3100
3114
|
collectRefs as d,
|
|
3101
3115
|
evaluatePairs as e,
|
|
3102
3116
|
findReferenceProblems as f,
|
|
@@ -3121,4 +3135,4 @@ export {
|
|
|
3121
3135
|
parseColor as y,
|
|
3122
3136
|
rgbaToHex as z
|
|
3123
3137
|
};
|
|
3124
|
-
//# sourceMappingURL=prod-branch-
|
|
3138
|
+
//# sourceMappingURL=prod-branch-CSM0c2OF.js.map
|