@usefragments/core 1.9.0 → 1.10.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/{chunk-DGHZQTLH.js → chunk-XN3LSDPY.js} +3 -2
- package/dist/chunk-XN3LSDPY.js.map +1 -0
- package/dist/codes/index.js +1 -1
- package/dist/compiled-types/index.d.ts +1 -1
- package/dist/generate/index.d.ts +1 -1
- package/dist/{governance-eEzCyfes.d.ts → governance-B5WWcmFY.d.ts} +19 -3
- package/dist/index.d.ts +11 -3
- package/dist/index.js +110 -53
- package/dist/index.js.map +1 -1
- package/dist/react-types.d.ts +1 -1
- package/dist/schemas/index.js +1 -1
- package/dist/test-utils.d.ts +1 -1
- package/package.json +1 -1
- package/src/governance-integrity.test.ts +93 -2
- package/src/governance-integrity.ts +46 -2
- package/src/governance.ts +15 -3
- package/src/rules/a11y-required-accessible-name.ts +45 -2
- package/src/rules/index.ts +4 -0
- package/src/rules/rules.test.ts +72 -0
- package/dist/chunk-DGHZQTLH.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -4,9 +4,9 @@ export { b as AGENT_FORMAT_SCHEMA_VERSION, c as AgentErrorEnvelope, d as AgentOu
|
|
|
4
4
|
import { Severity } from './severity.js';
|
|
5
5
|
export { SEVERITIES, SEVERITY_RANK, SEVERITY_WEIGHTS, SeverityLevel, compareSeverity, maxSeverity, severityLevel, severitySchema, sortBySeverity } from './severity.js';
|
|
6
6
|
export { BridgeViolationInput, CODES, CodeCategory, CodeLifecycle, EXPLAIN_URL_BASE, FuiCode, bridgeSourceViolation, bridgeSourceViolations, byCode, byRuleId, explainUrlForCode } from './codes/index.js';
|
|
7
|
-
import { c as ContractDomain, d as ContractCatalogInput, G as GovernanceSeverity, b as CompiledFragment, e as GovernedFragmentDefinition, R as ResolvedGovernedFragmentDefinition, f as GovernanceConfig, g as FragmentsConfig, T as TokenConfig, h as FragmentComponent, B as BlockDefinition, C as CompiledBlock, F as FragmentDefinition, a as FragmentDefinitionV2, S as StorybookFilterConfig, i as FigmaStringMapping, j as FigmaBooleanMapping, k as FigmaEnumMapping, l as FigmaInstanceMapping, m as FigmaChildrenMapping, n as FigmaTextContentMapping, o as RelationshipType, V as VariantRenderOptions, p as VariantLoader, q as CanonicalSource, r as CanonicalBridgeV1, s as ContractCanonicalMappingInput } from './governance-
|
|
8
|
-
export { A as AIMetadata, t as AccessibilityGovernanceBuilder, u as AppConfig, v as BaselineInfo, w as BoundingBox, x as CONTRACT_DOMAINS, y as CONTRACT_PREIMAGE_CAPABILITY_HEADER, z as CONTRACT_PREIMAGE_SCHEMA, D as CanonicalMappingStatus, E as CompiledFragmentsFile, H as CompiledFragmentsFileValidationError, I as CompiledRecipe, J as CompiledTokenData, K as CompiledTokenEntry, L as ComponentGovernanceBuilder, M as ComponentGovernanceRecord, N as ComponentRef, O as ComponentRelation, P as CompositionMetadata, Q as ContractComponentInput, U as ContractIdentityPin, W as ContractPolicyInput, X as ContractPreimage, Y as ContractPropMappingInput, Z as ContractTokenInput, _ as ContractWaiverInput, $ as ControlType, a0 as DesignSystemConfig, a1 as DiffResult, a2 as FigmaPropMapping, a3 as FragmentContract, a4 as FragmentExample, a5 as FragmentGenerated, a6 as FragmentGuidance, a7 as FragmentMeta, a8 as FragmentProvenance, a9 as FragmentUsage, aa as FragmentVariant, ab as GlobalGovernanceRecord, ac as GlobalJsxGovernanceRecord, ad as GlobalStyleGovernanceRecord, ae as GovernancePropValue, af as InspectConfig, ag as LocalCanonicalDeclaration, ah as LocalCanonicalResolveRule, ai as Manifest, aj as ObservedComponentUsage, ak as ObservedUsageProp, al as PlayFunction, am as PlayFunctionContext, an as PropDefinition, ao as PropGovernanceBuilder, ap as PropGovernanceOptions, aq as PropKey, ar as PropType, as as RecipeDefinition, at as RegistryOptions, au as RepoRelativePath, av as ScaleGovernanceRecord, aw as Screenshot, ax as ScreenshotConfig, ay as ScreenshotMetadata, az as ServiceConfig, aA as SnapshotConfig, aB as SnippetPolicyConfig, aC as Theme, aD as ThemeSeeds, aE as TokenSourceConfig, aF as TokenSourceFormat, aG as VerifyRequest, aH as VerifyResult, aI as Viewport, aJ as canonicalBridgeV1Schema, aK as componentGovernanceRecordSchema, aL as componentGovernanceRecordsSchema, aM as contractComponentsFromFragments, aN as contractPolicyFromGovernanceConfig, aO as diffContractDomains, aP as g, aQ as globalGovernanceRecordSchema, aR as globalJsxGovernanceRecordSchema, aS as globalStyleGovernanceRecordSchema, aT as governanceConfigSchema, aU as governanceConfigWithLocalCanonical, aV as governanceSeveritySchema, aW as isPresetSourcedRule, aX as localCanonicalContractMappings, aY as markPresetSourcedRules, aZ as normalizeGovernanceConfig, a_ as parseCompiledFragmentsFile, a$ as projectContractPreimage, b0 as scaleGovernanceRecordSchema, b1 as verifiedContractPreimageFromPin } from './governance-
|
|
9
|
-
import { z } from 'zod';
|
|
7
|
+
import { c as ContractDomain, d as ContractCatalogInput, G as GovernanceSeverity, b as CompiledFragment, e as GovernedFragmentDefinition, R as ResolvedGovernedFragmentDefinition, f as GovernanceConfig, g as FragmentsConfig, T as TokenConfig, h as FragmentComponent, B as BlockDefinition, C as CompiledBlock, F as FragmentDefinition, a as FragmentDefinitionV2, S as StorybookFilterConfig, i as FigmaStringMapping, j as FigmaBooleanMapping, k as FigmaEnumMapping, l as FigmaInstanceMapping, m as FigmaChildrenMapping, n as FigmaTextContentMapping, o as RelationshipType, V as VariantRenderOptions, p as VariantLoader, q as CanonicalSource, r as CanonicalBridgeV1, s as ContractCanonicalMappingInput } from './governance-B5WWcmFY.js';
|
|
8
|
+
export { A as AIMetadata, t as AccessibilityGovernanceBuilder, u as AppConfig, v as BaselineInfo, w as BoundingBox, x as CONTRACT_DOMAINS, y as CONTRACT_PREIMAGE_CAPABILITY_HEADER, z as CONTRACT_PREIMAGE_SCHEMA, D as CanonicalMappingStatus, E as CompiledFragmentsFile, H as CompiledFragmentsFileValidationError, I as CompiledRecipe, J as CompiledTokenData, K as CompiledTokenEntry, L as ComponentGovernanceBuilder, M as ComponentGovernanceRecord, N as ComponentRef, O as ComponentRelation, P as CompositionMetadata, Q as ContractComponentInput, U as ContractIdentityPin, W as ContractPolicyInput, X as ContractPreimage, Y as ContractPropMappingInput, Z as ContractTokenInput, _ as ContractWaiverInput, $ as ControlType, a0 as DesignSystemConfig, a1 as DiffResult, a2 as FigmaPropMapping, a3 as FragmentContract, a4 as FragmentExample, a5 as FragmentGenerated, a6 as FragmentGuidance, a7 as FragmentMeta, a8 as FragmentProvenance, a9 as FragmentUsage, aa as FragmentVariant, ab as GlobalGovernanceRecord, ac as GlobalJsxGovernanceRecord, ad as GlobalStyleGovernanceRecord, ae as GovernancePropValue, af as InspectConfig, ag as LocalCanonicalDeclaration, ah as LocalCanonicalResolveRule, ai as Manifest, aj as ObservedComponentUsage, ak as ObservedUsageProp, al as PlayFunction, am as PlayFunctionContext, an as PropDefinition, ao as PropGovernanceBuilder, ap as PropGovernanceOptions, aq as PropKey, ar as PropType, as as RecipeDefinition, at as RegistryOptions, au as RepoRelativePath, av as ScaleGovernanceRecord, aw as Screenshot, ax as ScreenshotConfig, ay as ScreenshotMetadata, az as ServiceConfig, aA as SnapshotConfig, aB as SnippetPolicyConfig, aC as Theme, aD as ThemeSeeds, aE as TokenSourceConfig, aF as TokenSourceFormat, aG as VerifyRequest, aH as VerifyResult, aI as Viewport, aJ as canonicalBridgeV1Schema, aK as componentGovernanceRecordSchema, aL as componentGovernanceRecordsSchema, aM as contractComponentsFromFragments, aN as contractPolicyFromGovernanceConfig, aO as diffContractDomains, aP as g, aQ as globalGovernanceRecordSchema, aR as globalJsxGovernanceRecordSchema, aS as globalStyleGovernanceRecordSchema, aT as governanceConfigSchema, aU as governanceConfigWithLocalCanonical, aV as governanceSeveritySchema, aW as isPresetSourcedRule, aX as localCanonicalContractMappings, aY as markPresetSourcedRules, aZ as normalizeGovernanceConfig, a_ as parseCompiledFragmentsFile, a$ as projectContractPreimage, b0 as scaleGovernanceRecordSchema, b1 as verifiedContractPreimageFromPin } from './governance-B5WWcmFY.js';
|
|
9
|
+
import { z, ZodTypeAny } from 'zod';
|
|
10
10
|
import { RegistryArtifact, RegistryDependency, RegistryInstallReceipt } from './registry.js';
|
|
11
11
|
export { REGISTRY_ARTIFACT_SCHEMA_VERSION, REGISTRY_INSTALL_RECEIPT_SCHEMA_VERSION, REGISTRY_MANIFEST_SCHEMA_VERSION, RegistryArtifactInput, RegistryComponent, RegistryComponentExport, RegistryDependencyType, RegistryEntrypoint, RegistryFile, RegistryFileContent, RegistryFileInput, RegistryFileRole, RegistryInstallProfile, RegistryInstallReceiptComponent, RegistryInstallReceiptFile, RegistryManifest, RegistryManifestDraft, RegistrySource, assertValidRegistryArtifact, buildRegistryArtifact, buildRegistryFile, computeRegistryHash, finalizeRegistryManifest, hashRegistryFileContent, registryArtifactDigest, registryArtifactSchema, registryComponentExportSchema, registryComponentSchema, registryDependencySchema, registryDependencyTypeSchema, registryEntrypointSchema, registryFileContentSchema, registryFileRoleSchema, registryFileSchema, registryFileSize, registryInstallProfileSchema, registryInstallReceiptComponentSchema, registryInstallReceiptFileSchema, registryInstallReceiptSchema, registryManifestCanonicalPreimage, registryManifestDraftSchema, registryManifestSchema, registrySourceSchema } from './registry.js';
|
|
12
12
|
import { ReactNode, ComponentType } from 'react';
|
|
@@ -7108,12 +7108,15 @@ declare const fragmentsConfigSchema: z.ZodObject<{
|
|
|
7108
7108
|
ci: z.ZodOptional<z.ZodObject<{
|
|
7109
7109
|
failOnWarnings: z.ZodOptional<z.ZodBoolean>;
|
|
7110
7110
|
failOnInert: z.ZodOptional<z.ZodBoolean>;
|
|
7111
|
+
failOnAdoptionRegression: z.ZodOptional<z.ZodBoolean>;
|
|
7111
7112
|
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
7112
7113
|
failOnWarnings: z.ZodOptional<z.ZodBoolean>;
|
|
7113
7114
|
failOnInert: z.ZodOptional<z.ZodBoolean>;
|
|
7115
|
+
failOnAdoptionRegression: z.ZodOptional<z.ZodBoolean>;
|
|
7114
7116
|
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
7115
7117
|
failOnWarnings: z.ZodOptional<z.ZodBoolean>;
|
|
7116
7118
|
failOnInert: z.ZodOptional<z.ZodBoolean>;
|
|
7119
|
+
failOnAdoptionRegression: z.ZodOptional<z.ZodBoolean>;
|
|
7117
7120
|
}, z.ZodTypeAny, "passthrough">>>;
|
|
7118
7121
|
}, "strict", z.ZodTypeAny, {
|
|
7119
7122
|
components?: Record<string, {
|
|
@@ -7341,6 +7344,7 @@ declare const fragmentsConfigSchema: z.ZodObject<{
|
|
|
7341
7344
|
ci?: z.objectOutputType<{
|
|
7342
7345
|
failOnWarnings: z.ZodOptional<z.ZodBoolean>;
|
|
7343
7346
|
failOnInert: z.ZodOptional<z.ZodBoolean>;
|
|
7347
|
+
failOnAdoptionRegression: z.ZodOptional<z.ZodBoolean>;
|
|
7344
7348
|
}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
7345
7349
|
}, {
|
|
7346
7350
|
components?: Record<string, {
|
|
@@ -7568,6 +7572,7 @@ declare const fragmentsConfigSchema: z.ZodObject<{
|
|
|
7568
7572
|
ci?: z.objectInputType<{
|
|
7569
7573
|
failOnWarnings: z.ZodOptional<z.ZodBoolean>;
|
|
7570
7574
|
failOnInert: z.ZodOptional<z.ZodBoolean>;
|
|
7575
|
+
failOnAdoptionRegression: z.ZodOptional<z.ZodBoolean>;
|
|
7571
7576
|
}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
7572
7577
|
}>>;
|
|
7573
7578
|
inspect: z.ZodOptional<z.ZodObject<{
|
|
@@ -7885,6 +7890,7 @@ declare const fragmentsConfigSchema: z.ZodObject<{
|
|
|
7885
7890
|
ci?: z.objectOutputType<{
|
|
7886
7891
|
failOnWarnings: z.ZodOptional<z.ZodBoolean>;
|
|
7887
7892
|
failOnInert: z.ZodOptional<z.ZodBoolean>;
|
|
7893
|
+
failOnAdoptionRegression: z.ZodOptional<z.ZodBoolean>;
|
|
7888
7894
|
}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
7889
7895
|
} | undefined;
|
|
7890
7896
|
components?: string[] | undefined;
|
|
@@ -8220,6 +8226,7 @@ declare const fragmentsConfigSchema: z.ZodObject<{
|
|
|
8220
8226
|
ci?: z.objectInputType<{
|
|
8221
8227
|
failOnWarnings: z.ZodOptional<z.ZodBoolean>;
|
|
8222
8228
|
failOnInert: z.ZodOptional<z.ZodBoolean>;
|
|
8229
|
+
failOnAdoptionRegression: z.ZodOptional<z.ZodBoolean>;
|
|
8223
8230
|
}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
8224
8231
|
} | undefined;
|
|
8225
8232
|
components?: string[] | undefined;
|
|
@@ -12413,6 +12420,7 @@ interface Rule {
|
|
|
12413
12420
|
id: string;
|
|
12414
12421
|
version: string;
|
|
12415
12422
|
run: RuleFn;
|
|
12423
|
+
optionsSchema?: ZodTypeAny;
|
|
12416
12424
|
}
|
|
12417
12425
|
declare const RULES: readonly Rule[];
|
|
12418
12426
|
/**
|
package/dist/index.js
CHANGED
|
@@ -1,54 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
CompiledFragmentsFileValidationError,
|
|
3
|
-
parseCompiledFragmentsFile
|
|
4
|
-
} from "./chunk-RANPUC6C.js";
|
|
5
1
|
import {
|
|
6
2
|
generateContext
|
|
7
3
|
} from "./chunk-X34IA4LR.js";
|
|
8
4
|
import {
|
|
9
5
|
ComponentGraphEngine
|
|
10
6
|
} from "./chunk-SH4KPIYH.js";
|
|
11
|
-
import {
|
|
12
|
-
resolveArea
|
|
13
|
-
} from "./chunk-3LLRNCPX.js";
|
|
14
|
-
import {
|
|
15
|
-
GOVERNANCE_TELEMETRY_FIELDS,
|
|
16
|
-
GOVERNANCE_TELEMETRY_SOURCE_DISCLOSURE,
|
|
17
|
-
GOVERNANCE_TELEMETRY_TOP_LEVEL_FIELDS
|
|
18
|
-
} from "./chunk-MZ4SW3TP.js";
|
|
19
|
-
import {
|
|
20
|
-
REGISTRY_ARTIFACT_SCHEMA_VERSION,
|
|
21
|
-
REGISTRY_INSTALL_RECEIPT_SCHEMA_VERSION,
|
|
22
|
-
REGISTRY_MANIFEST_SCHEMA_VERSION,
|
|
23
|
-
assertValidRegistryArtifact,
|
|
24
|
-
buildRegistryArtifact,
|
|
25
|
-
buildRegistryFile,
|
|
26
|
-
canonicalPreimage,
|
|
27
|
-
computeRegistryHash,
|
|
28
|
-
contractHash,
|
|
29
|
-
finalizeRegistryManifest,
|
|
30
|
-
hashRegistryFileContent,
|
|
31
|
-
registryArtifactDigest,
|
|
32
|
-
registryArtifactSchema,
|
|
33
|
-
registryComponentExportSchema,
|
|
34
|
-
registryComponentSchema,
|
|
35
|
-
registryDependencySchema,
|
|
36
|
-
registryDependencyTypeSchema,
|
|
37
|
-
registryEntrypointSchema,
|
|
38
|
-
registryFileContentSchema,
|
|
39
|
-
registryFileRoleSchema,
|
|
40
|
-
registryFileSchema,
|
|
41
|
-
registryFileSize,
|
|
42
|
-
registryInstallProfileSchema,
|
|
43
|
-
registryInstallReceiptComponentSchema,
|
|
44
|
-
registryInstallReceiptFileSchema,
|
|
45
|
-
registryInstallReceiptSchema,
|
|
46
|
-
registryManifestCanonicalPreimage,
|
|
47
|
-
registryManifestDraftSchema,
|
|
48
|
-
registryManifestSchema,
|
|
49
|
-
registrySourceSchema,
|
|
50
|
-
sha256Hex
|
|
51
|
-
} from "./chunk-YF65VYRY.js";
|
|
52
7
|
import {
|
|
53
8
|
AGENT_FORMAT_SCHEMA_VERSION,
|
|
54
9
|
CODES,
|
|
@@ -159,7 +114,15 @@ import {
|
|
|
159
114
|
suppressionDirectiveSchema,
|
|
160
115
|
validatorResultSchema,
|
|
161
116
|
violationSchema
|
|
162
|
-
} from "./chunk-
|
|
117
|
+
} from "./chunk-XN3LSDPY.js";
|
|
118
|
+
import {
|
|
119
|
+
resolveArea
|
|
120
|
+
} from "./chunk-3LLRNCPX.js";
|
|
121
|
+
import {
|
|
122
|
+
GOVERNANCE_TELEMETRY_FIELDS,
|
|
123
|
+
GOVERNANCE_TELEMETRY_SOURCE_DISCLOSURE,
|
|
124
|
+
GOVERNANCE_TELEMETRY_TOP_LEVEL_FIELDS
|
|
125
|
+
} from "./chunk-MZ4SW3TP.js";
|
|
163
126
|
import {
|
|
164
127
|
OWNED_PACKAGE_IDENTITY_EPOCH,
|
|
165
128
|
OWNED_PACKAGE_IDENTITY_SOURCE_SHA256,
|
|
@@ -171,6 +134,39 @@ import {
|
|
|
171
134
|
projectV1OwnedImportIdentity,
|
|
172
135
|
resolveOwnedPackageImport
|
|
173
136
|
} from "./chunk-JNBFJ34I.js";
|
|
137
|
+
import {
|
|
138
|
+
REGISTRY_ARTIFACT_SCHEMA_VERSION,
|
|
139
|
+
REGISTRY_INSTALL_RECEIPT_SCHEMA_VERSION,
|
|
140
|
+
REGISTRY_MANIFEST_SCHEMA_VERSION,
|
|
141
|
+
assertValidRegistryArtifact,
|
|
142
|
+
buildRegistryArtifact,
|
|
143
|
+
buildRegistryFile,
|
|
144
|
+
canonicalPreimage,
|
|
145
|
+
computeRegistryHash,
|
|
146
|
+
contractHash,
|
|
147
|
+
finalizeRegistryManifest,
|
|
148
|
+
hashRegistryFileContent,
|
|
149
|
+
registryArtifactDigest,
|
|
150
|
+
registryArtifactSchema,
|
|
151
|
+
registryComponentExportSchema,
|
|
152
|
+
registryComponentSchema,
|
|
153
|
+
registryDependencySchema,
|
|
154
|
+
registryDependencyTypeSchema,
|
|
155
|
+
registryEntrypointSchema,
|
|
156
|
+
registryFileContentSchema,
|
|
157
|
+
registryFileRoleSchema,
|
|
158
|
+
registryFileSchema,
|
|
159
|
+
registryFileSize,
|
|
160
|
+
registryInstallProfileSchema,
|
|
161
|
+
registryInstallReceiptComponentSchema,
|
|
162
|
+
registryInstallReceiptFileSchema,
|
|
163
|
+
registryInstallReceiptSchema,
|
|
164
|
+
registryManifestCanonicalPreimage,
|
|
165
|
+
registryManifestDraftSchema,
|
|
166
|
+
registryManifestSchema,
|
|
167
|
+
registrySourceSchema,
|
|
168
|
+
sha256Hex
|
|
169
|
+
} from "./chunk-YF65VYRY.js";
|
|
174
170
|
import {
|
|
175
171
|
isPortableRepoPath,
|
|
176
172
|
normalizeConfigPath,
|
|
@@ -189,6 +185,10 @@ import {
|
|
|
189
185
|
severitySchema,
|
|
190
186
|
sortBySeverity
|
|
191
187
|
} from "./chunk-V4VQB57N.js";
|
|
188
|
+
import {
|
|
189
|
+
CompiledFragmentsFileValidationError,
|
|
190
|
+
parseCompiledFragmentsFile
|
|
191
|
+
} from "./chunk-RANPUC6C.js";
|
|
192
192
|
|
|
193
193
|
// src/constants.ts
|
|
194
194
|
var BRAND = {
|
|
@@ -1249,14 +1249,14 @@ function rgbToLab(rgb) {
|
|
|
1249
1249
|
b = b > 0.04045 ? Math.pow((b + 0.055) / 1.055, 2.4) : b / 12.92;
|
|
1250
1250
|
let x = (r * 0.4124564 + g2 * 0.3575761 + b * 0.1804375) / 0.95047;
|
|
1251
1251
|
let y = r * 0.2126729 + g2 * 0.7151522 + b * 0.072175;
|
|
1252
|
-
let
|
|
1252
|
+
let z8 = (r * 0.0193339 + g2 * 0.119192 + b * 0.9503041) / 1.08883;
|
|
1253
1253
|
x = x > 8856e-6 ? Math.pow(x, 1 / 3) : 7.787 * x + 16 / 116;
|
|
1254
1254
|
y = y > 8856e-6 ? Math.pow(y, 1 / 3) : 7.787 * y + 16 / 116;
|
|
1255
|
-
|
|
1255
|
+
z8 = z8 > 8856e-6 ? Math.pow(z8, 1 / 3) : 7.787 * z8 + 16 / 116;
|
|
1256
1256
|
return {
|
|
1257
1257
|
l: 116 * y - 16,
|
|
1258
1258
|
a: 500 * (x - y),
|
|
1259
|
-
b: 200 * (y -
|
|
1259
|
+
b: 200 * (y - z8)
|
|
1260
1260
|
};
|
|
1261
1261
|
}
|
|
1262
1262
|
|
|
@@ -4674,6 +4674,9 @@ function discoverComponents(moduleExports, options) {
|
|
|
4674
4674
|
return names.sort();
|
|
4675
4675
|
}
|
|
4676
4676
|
|
|
4677
|
+
// src/rules/a11y-required-accessible-name.ts
|
|
4678
|
+
import { z as z7 } from "zod";
|
|
4679
|
+
|
|
4677
4680
|
// src/rules/a11y-utils.ts
|
|
4678
4681
|
function isAriaHidden(props) {
|
|
4679
4682
|
const prop = props.find((candidate) => candidate.prop === "aria-hidden");
|
|
@@ -5148,7 +5151,11 @@ function isApplicableTokenReference(referenceFormat) {
|
|
|
5148
5151
|
|
|
5149
5152
|
// src/rules/a11y-required-accessible-name.ts
|
|
5150
5153
|
var RULE_ID = "a11y/required-accessible-name";
|
|
5151
|
-
var RULE_VERSION = "
|
|
5154
|
+
var RULE_VERSION = "3";
|
|
5155
|
+
var a11yRequiredAccessibleNameOptionsSchema = z7.object({
|
|
5156
|
+
ignoreParents: z7.array(z7.string().min(1)).optional(),
|
|
5157
|
+
ignoreSpread: z7.boolean().optional()
|
|
5158
|
+
});
|
|
5152
5159
|
var NAME_SOURCE_PROPS = /* @__PURE__ */ new Set(["aria-label", "aria-labelledby", "title"]);
|
|
5153
5160
|
var COMPONENT_NAME_SOURCE_PROPS = /* @__PURE__ */ new Set([...NAME_SOURCE_PROPS, "label"]);
|
|
5154
5161
|
var NAME_REQUIRED_TAGS = /* @__PURE__ */ new Set(["button", "input", "select", "textarea"]);
|
|
@@ -5172,7 +5179,10 @@ function ruleA11yRequiredAccessibleName(ix) {
|
|
|
5172
5179
|
ix.byKind("usage_child_content").map((content) => [content.nodeId, content])
|
|
5173
5180
|
);
|
|
5174
5181
|
const globalPolicy = ix.policy.ruleConfig(RULE_ID);
|
|
5182
|
+
const parsedOptions = a11yRequiredAccessibleNameOptionsSchema.safeParse(globalPolicy?.options);
|
|
5183
|
+
const options = parsedOptions.success ? parsedOptions.data : {};
|
|
5175
5184
|
const usageByNode = new Map(ix.byKind("usage_component").map((usage) => [usage.nodeId, usage]));
|
|
5185
|
+
const usageNodes = ix.byKind("usage_node");
|
|
5176
5186
|
const definitions = new Map(
|
|
5177
5187
|
ix.byKind("component_definition").map((definition) => [definition.componentKey, definition])
|
|
5178
5188
|
);
|
|
@@ -5183,6 +5193,7 @@ function ruleA11yRequiredAccessibleName(ix) {
|
|
|
5183
5193
|
if (isAriaHidden(props)) continue;
|
|
5184
5194
|
const genericControl = globalPolicy?.enabled === true && requiresAccessibleName(node, usageComponent, definitions, props);
|
|
5185
5195
|
if (!componentPolicy && !genericControl) continue;
|
|
5196
|
+
if (isInsideIgnoredAttributeParent(node, usageNodes, options.ignoreParents)) continue;
|
|
5186
5197
|
if (hasAccessibleName(
|
|
5187
5198
|
props,
|
|
5188
5199
|
textByNode.get(node.id) ?? [],
|
|
@@ -5192,11 +5203,13 @@ function ruleA11yRequiredAccessibleName(ix) {
|
|
|
5192
5203
|
)) {
|
|
5193
5204
|
continue;
|
|
5194
5205
|
}
|
|
5206
|
+
const hasSpreadProps = props.some((prop) => prop.resolution === "spread");
|
|
5207
|
+
if (hasSpreadProps && options.ignoreSpread === true) continue;
|
|
5195
5208
|
findings.push(
|
|
5196
5209
|
makeFinding({
|
|
5197
5210
|
ruleId: RULE_ID,
|
|
5198
5211
|
ruleVersion: RULE_VERSION,
|
|
5199
|
-
severity: componentPolicy?.severity ?? globalPolicy?.severity ?? "warn",
|
|
5212
|
+
severity: hasSpreadProps ? "minor" : componentPolicy?.severity ?? globalPolicy?.severity ?? "warn",
|
|
5200
5213
|
message: `<${node.element}> has no accessible name. ${componentPolicy?.because ?? "Add visible text, aria-label, aria-labelledby, or a component label."}`.trim(),
|
|
5201
5214
|
location: node.location,
|
|
5202
5215
|
evidence: ix.evidence([
|
|
@@ -5220,6 +5233,20 @@ function ruleA11yRequiredAccessibleName(ix) {
|
|
|
5220
5233
|
}
|
|
5221
5234
|
return findings;
|
|
5222
5235
|
}
|
|
5236
|
+
function isInsideIgnoredAttributeParent(node, usageNodes, ignoreParents) {
|
|
5237
|
+
if (!ignoreParents?.length || !node.nodePath.includes("/attr:")) return false;
|
|
5238
|
+
const ignored = new Set(ignoreParents);
|
|
5239
|
+
const segments = node.nodePath.split("/");
|
|
5240
|
+
const ancestorPaths = /* @__PURE__ */ new Set();
|
|
5241
|
+
for (let index = 1; index < segments.length; index += 1) {
|
|
5242
|
+
if (segments[index].startsWith("attr:")) {
|
|
5243
|
+
ancestorPaths.add(segments.slice(0, index).join("/"));
|
|
5244
|
+
}
|
|
5245
|
+
}
|
|
5246
|
+
return usageNodes.some(
|
|
5247
|
+
(candidate) => candidate.file === node.file && ancestorPaths.has(candidate.nodePath) && ignored.has(candidate.element)
|
|
5248
|
+
);
|
|
5249
|
+
}
|
|
5223
5250
|
function hasAccessibleName(props, textChildren, childContent, componentControl, nameFromContent) {
|
|
5224
5251
|
const sourceProps = componentControl ? COMPONENT_NAME_SOURCE_PROPS : NAME_SOURCE_PROPS;
|
|
5225
5252
|
if (nameFromContent) {
|
|
@@ -9168,7 +9195,8 @@ var RULES = [
|
|
|
9168
9195
|
{
|
|
9169
9196
|
id: "a11y/required-accessible-name",
|
|
9170
9197
|
version: RULE_VERSION,
|
|
9171
|
-
run: ruleA11yRequiredAccessibleName
|
|
9198
|
+
run: ruleA11yRequiredAccessibleName,
|
|
9199
|
+
optionsSchema: a11yRequiredAccessibleNameOptionsSchema
|
|
9172
9200
|
},
|
|
9173
9201
|
{
|
|
9174
9202
|
id: "a11y/standard",
|
|
@@ -9202,6 +9230,7 @@ function sortFindings(findings) {
|
|
|
9202
9230
|
}
|
|
9203
9231
|
|
|
9204
9232
|
// src/governance-integrity.ts
|
|
9233
|
+
import { ZodObject } from "zod";
|
|
9205
9234
|
function isEffectiveCanonicalSource(source) {
|
|
9206
9235
|
return source.include !== void 0 ? source.include.length > 0 : source.kind === "directory";
|
|
9207
9236
|
}
|
|
@@ -9240,6 +9269,16 @@ function dedupe(values) {
|
|
|
9240
9269
|
}
|
|
9241
9270
|
var CONSUMED_RULE_IDS = new Set(Object.keys(RULE_TIER));
|
|
9242
9271
|
var RECOGNIZED_RULE_IDS = /* @__PURE__ */ new Set([...CONSUMED_RULE_IDS, ...RULE_FAMILY_IDS]);
|
|
9272
|
+
var RULE_OPTIONS_SCHEMAS = new Map(
|
|
9273
|
+
RULES.flatMap(
|
|
9274
|
+
(rule) => rule.optionsSchema ? [
|
|
9275
|
+
[
|
|
9276
|
+
rule.id,
|
|
9277
|
+
rule.optionsSchema instanceof ZodObject ? rule.optionsSchema.strict() : rule.optionsSchema
|
|
9278
|
+
]
|
|
9279
|
+
] : []
|
|
9280
|
+
)
|
|
9281
|
+
);
|
|
9243
9282
|
var RULE_CONFIG_KEYS = /* @__PURE__ */ new Set(["enabled", "severity", "options", "exclude"]);
|
|
9244
9283
|
var PASSTHROUGH_KEYS = [
|
|
9245
9284
|
{
|
|
@@ -9279,7 +9318,7 @@ var PASSTHROUGH_KEYS = [
|
|
|
9279
9318
|
},
|
|
9280
9319
|
{
|
|
9281
9320
|
path: ["govern", "ci"],
|
|
9282
|
-
keys: ["failOnWarnings", "failOnInert"]
|
|
9321
|
+
keys: ["failOnWarnings", "failOnInert", "failOnAdoptionRegression"]
|
|
9283
9322
|
}
|
|
9284
9323
|
];
|
|
9285
9324
|
function objectRecord(value) {
|
|
@@ -9485,6 +9524,24 @@ function collectRuleConfigKeys(authored, path, diagnostics) {
|
|
|
9485
9524
|
diagnostics.push(unconsumedKeyDiagnostic([...path, ruleId, key]));
|
|
9486
9525
|
}
|
|
9487
9526
|
}
|
|
9527
|
+
if (config["options"] === void 0) continue;
|
|
9528
|
+
const invalidOptions = ruleFamilyMembers(ruleId).flatMap((memberRuleId) => {
|
|
9529
|
+
const schema = RULE_OPTIONS_SCHEMAS.get(memberRuleId);
|
|
9530
|
+
if (!schema) return [];
|
|
9531
|
+
const parsed = schema.safeParse(config["options"]);
|
|
9532
|
+
if (parsed.success) return [];
|
|
9533
|
+
const problem = parsed.error.errors.map((issue) => `${issue.path.join(".") || "options"}: ${issue.message}`).join("; ");
|
|
9534
|
+
return [memberRuleId === ruleId ? problem : `${memberRuleId}: ${problem}`];
|
|
9535
|
+
});
|
|
9536
|
+
if (invalidOptions.length === 0) continue;
|
|
9537
|
+
const diagnosticPath = configPath([...path, ruleId, "options"]);
|
|
9538
|
+
diagnostics.push({
|
|
9539
|
+
code: "FUI9004",
|
|
9540
|
+
kind: "unconsumed-key",
|
|
9541
|
+
severity: "warn",
|
|
9542
|
+
path: diagnosticPath,
|
|
9543
|
+
message: `${diagnosticPath} is invalid for rule \`${ruleId}\`: ${invalidOptions.join("; ")}. Fix the option values or remove the options block.`
|
|
9544
|
+
});
|
|
9488
9545
|
}
|
|
9489
9546
|
}
|
|
9490
9547
|
function collectPassthroughRecordValues(authored, path, allowed, diagnostics) {
|