@usefragments/core 1.0.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/LICENSE +21 -0
- package/dist/chunk-243QYRUF.js +2145 -0
- package/dist/chunk-243QYRUF.js.map +1 -0
- package/dist/chunk-3LLRNCPX.js +111 -0
- package/dist/chunk-3LLRNCPX.js.map +1 -0
- package/dist/chunk-EIYNNS77.js +48 -0
- package/dist/chunk-EIYNNS77.js.map +1 -0
- package/dist/chunk-JNBFJ34I.js +326 -0
- package/dist/chunk-JNBFJ34I.js.map +1 -0
- package/dist/chunk-R3X7UBHU.js +228 -0
- package/dist/chunk-R3X7UBHU.js.map +1 -0
- package/dist/chunk-SH4KPIYH.js +393 -0
- package/dist/chunk-SH4KPIYH.js.map +1 -0
- package/dist/chunk-V4VQB57N.js +56 -0
- package/dist/chunk-V4VQB57N.js.map +1 -0
- package/dist/chunk-X34IA4LR.js +319 -0
- package/dist/chunk-X34IA4LR.js.map +1 -0
- package/dist/chunk-YF65VYRY.js +493 -0
- package/dist/chunk-YF65VYRY.js.map +1 -0
- package/dist/codes/index.d.ts +40 -0
- package/dist/codes/index.js +23 -0
- package/dist/codes/index.js.map +1 -0
- package/dist/compiled-types/index.d.ts +5 -0
- package/dist/compiled-types/index.js +1 -0
- package/dist/compiled-types/index.js.map +1 -0
- package/dist/generate/index.d.ts +47 -0
- package/dist/generate/index.js +11 -0
- package/dist/generate/index.js.map +1 -0
- package/dist/governance-BOa3KyiJ.d.ts +3279 -0
- package/dist/graph/index.d.ts +66 -0
- package/dist/graph/index.js +17 -0
- package/dist/graph/index.js.map +1 -0
- package/dist/index.d.ts +11388 -0
- package/dist/index.js +8711 -0
- package/dist/index.js.map +1 -0
- package/dist/package-identity.d.ts +42 -0
- package/dist/package-identity.js +23 -0
- package/dist/package-identity.js.map +1 -0
- package/dist/preview/index.d.ts +484 -0
- package/dist/preview/index.js +1129 -0
- package/dist/preview/index.js.map +1 -0
- package/dist/react-types.d.ts +22 -0
- package/dist/react-types.js +1 -0
- package/dist/react-types.js.map +1 -0
- package/dist/registry.d.ts +2367 -0
- package/dist/registry.js +62 -0
- package/dist/registry.js.map +1 -0
- package/dist/schemas/index.d.ts +2584 -0
- package/dist/schemas/index.js +55 -0
- package/dist/schemas/index.js.map +1 -0
- package/dist/severity.d.ts +18 -0
- package/dist/severity.js +27 -0
- package/dist/severity.js.map +1 -0
- package/dist/test-utils.d.ts +14 -0
- package/dist/test-utils.js +63 -0
- package/dist/test-utils.js.map +1 -0
- package/dist/topology/index.d.ts +48 -0
- package/dist/topology/index.js +7 -0
- package/dist/topology/index.js.map +1 -0
- package/dist/types-xJ2xyp_G.d.ts +119 -0
- package/package.json +120 -0
- package/src/__tests__/contract-parser.test.ts +614 -0
- package/src/__tests__/dtcg-generators.test.ts +439 -0
- package/src/__tests__/dtcg-parser.test.ts +884 -0
- package/src/__tests__/preview-runtime.test.tsx +111 -0
- package/src/__tests__/schema.test.ts +31 -0
- package/src/__tests__/severity.test.ts +34 -0
- package/src/__tests__/style-comparison.test.ts +662 -0
- package/src/__tests__/tokens-compat.test.ts +51 -0
- package/src/agent-format.test.ts +105 -0
- package/src/agent-format.ts +141 -0
- package/src/bundle.ts +149 -0
- package/src/codes/__tests__/codes.test.ts +73 -0
- package/src/codes/codes.ts +463 -0
- package/src/codes/index.ts +7 -0
- package/src/codes/source-finding-bridge.ts +113 -0
- package/src/compiled-types/index.ts +293 -0
- package/src/component-contract.ts +231 -0
- package/src/component-discovery.ts +80 -0
- package/src/composition.test.ts +262 -0
- package/src/composition.ts +318 -0
- package/src/config-paths.test.ts +78 -0
- package/src/config-paths.ts +47 -0
- package/src/config.ts +18 -0
- package/src/conform-prove.test.ts +274 -0
- package/src/conform-prove.ts +326 -0
- package/src/conform.ts +160 -0
- package/src/constants.ts +114 -0
- package/src/context.ts +2 -0
- package/src/contract/fixture.ts +110 -0
- package/src/contract/hash.test.ts +86 -0
- package/src/contract/hash.ts +195 -0
- package/src/contract/index.ts +43 -0
- package/src/contract/preimage.test.ts +254 -0
- package/src/contract/preimage.ts +365 -0
- package/src/contract/stamp.test.ts +100 -0
- package/src/contract/stamp.ts +105 -0
- package/src/contract-parser.ts +141 -0
- package/src/defineFragment.test.ts +257 -0
- package/src/defineFragment.ts +293 -0
- package/src/dtcg-generators.ts +324 -0
- package/src/dtcg-parser.ts +1 -0
- package/src/dtcg.ts +237 -0
- package/src/facts/__snapshots__/facts.test.ts.snap +124 -0
- package/src/facts/builders.ts +835 -0
- package/src/facts/compile.ts +422 -0
- package/src/facts/fact-index.ts +394 -0
- package/src/facts/facts.test.ts +494 -0
- package/src/facts/ids.ts +125 -0
- package/src/facts/index.ts +119 -0
- package/src/facts/types.ts +614 -0
- package/src/figma.ts +263 -0
- package/src/fragment-types.ts +214 -0
- package/src/generate/generate.test.ts +594 -0
- package/src/generate/index.ts +438 -0
- package/src/governance-integrity.test.ts +186 -0
- package/src/governance-integrity.ts +282 -0
- package/src/governance.test.ts +300 -0
- package/src/governance.ts +605 -0
- package/src/governance.type-test.ts +75 -0
- package/src/graph/engine.ts +446 -0
- package/src/graph/graph.test.ts +746 -0
- package/src/graph/index.ts +32 -0
- package/src/graph/serialization.ts +55 -0
- package/src/graph/types.ts +178 -0
- package/src/index.ts +891 -0
- package/src/local-canonical.ts +102 -0
- package/src/mcp-snapshot.ts +222 -0
- package/src/package-identity-match.ts +33 -0
- package/src/package-identity.generated.ts +233 -0
- package/src/package-identity.test.ts +99 -0
- package/src/package-identity.ts +157 -0
- package/src/performance-presets.ts +142 -0
- package/src/preview/comparison-artifact.test.ts +228 -0
- package/src/preview/comparison-artifact.ts +181 -0
- package/src/preview/comparison-context.ts +93 -0
- package/src/preview/comparison-evidence.ts +112 -0
- package/src/preview/comparison-format.ts +21 -0
- package/src/preview/comparison-presentation.ts +187 -0
- package/src/preview/comparison-references.test.ts +430 -0
- package/src/preview/comparison-references.ts +72 -0
- package/src/preview/comparison-score.ts +59 -0
- package/src/preview/comparison-styles.ts +197 -0
- package/src/preview/comparison.test.ts +559 -0
- package/src/preview/comparison.ts +488 -0
- package/src/preview/index.ts +10 -0
- package/src/preview/types.ts +309 -0
- package/src/preview/validation.test.ts +290 -0
- package/src/preview/validation.ts +356 -0
- package/src/preview-runtime.tsx +144 -0
- package/src/raw-html-canonical.test.ts +41 -0
- package/src/raw-html-canonical.ts +179 -0
- package/src/react-types.ts +21 -0
- package/src/registry-install-plan.ts +344 -0
- package/src/registry.test.ts +245 -0
- package/src/registry.ts +369 -0
- package/src/rules/a11y-required-accessible-name.ts +93 -0
- package/src/rules/color-math.test.ts +72 -0
- package/src/rules/color-math.ts +192 -0
- package/src/rules/components-forbidden-prop-value.ts +108 -0
- package/src/rules/components-prefer-library.ts +943 -0
- package/src/rules/components-unknown-prop.ts +94 -0
- package/src/rules/composition-pattern-schema.ts +125 -0
- package/src/rules/composition-pattern.test.ts +320 -0
- package/src/rules/composition-pattern.ts +271 -0
- package/src/rules/emit-gate.test.ts +42 -0
- package/src/rules/emit-gate.ts +60 -0
- package/src/rules/finding.ts +54 -0
- package/src/rules/index.ts +235 -0
- package/src/rules/jsx-preferred-component.ts +68 -0
- package/src/rules/jsx-preferred-import-path.ts +67 -0
- package/src/rules/presets.ts +57 -0
- package/src/rules/props-invalid-value.ts +115 -0
- package/src/rules/rules.test.ts +3636 -0
- package/src/rules/spacing-resolution.ts +184 -0
- package/src/rules/styles-no-raw-color.ts +329 -0
- package/src/rules/styles-no-raw-dimensions.ts +357 -0
- package/src/rules/styles-no-raw-spacing.ts +236 -0
- package/src/rules/styles-no-raw-typography.ts +237 -0
- package/src/rules/tailwind-arbitrary-color.test.ts +128 -0
- package/src/rules/tailwind-arbitrary-color.ts +93 -0
- package/src/rules/tailwind-arbitrary-spacing.test.ts +157 -0
- package/src/rules/tailwind-arbitrary-spacing.ts +120 -0
- package/src/rules/tailwind-forbidden-palette.test.ts +116 -0
- package/src/rules/tailwind-forbidden-palette.ts +107 -0
- package/src/rules/tailwind-off-scale-spacing-token.test.ts +100 -0
- package/src/rules/tailwind-off-scale-spacing-token.ts +108 -0
- package/src/rules/tailwind-raw-color-via-token.test.ts +108 -0
- package/src/rules/tailwind-raw-color-via-token.ts +82 -0
- package/src/rules/tailwind-rule-utils.ts +106 -0
- package/src/rules/tailwind-unknown-class.test.ts +157 -0
- package/src/rules/tailwind-unknown-class.ts +121 -0
- package/src/rules/taxonomy.test.ts +238 -0
- package/src/rules/theme-no-theme-coupled-literal.ts +132 -0
- package/src/rules/tiers.ts +111 -0
- package/src/rules/tokens-css-vars-must-be-defined.test.ts +244 -0
- package/src/rules/tokens-css-vars-must-be-defined.ts +156 -0
- package/src/rules/tokens-require-dual-fallback.ts +78 -0
- package/src/rules/types.ts +27 -0
- package/src/rules/utils.test.ts +110 -0
- package/src/rules/utils.ts +599 -0
- package/src/schema.ts +427 -0
- package/src/schemas/index.ts +275 -0
- package/src/schemas/schemas.test.ts +124 -0
- package/src/severity.ts +54 -0
- package/src/storyAdapter.test.ts +571 -0
- package/src/storyAdapter.ts +761 -0
- package/src/storyFilters.test.ts +350 -0
- package/src/storyFilters.ts +253 -0
- package/src/storybook-csf.ts +11 -0
- package/src/style-comparison.ts +423 -0
- package/src/test-utils.ts +68 -0
- package/src/token-parser.ts +2 -0
- package/src/token-types.ts +287 -0
- package/src/tokens/categories.ts +131 -0
- package/src/tokens/color.ts +193 -0
- package/src/tokens/design-token-parser.test.ts +159 -0
- package/src/tokens/design-token-parser.ts +402 -0
- package/src/tokens/dtcg.ts +428 -0
- package/src/tokens/index.ts +130 -0
- package/src/tokens/lookup.ts +19 -0
- package/src/tokens/scss.ts +171 -0
- package/src/tokens/tailwind-v4.ts +187 -0
- package/src/tokens/types.ts +43 -0
- package/src/topology/index.ts +9 -0
- package/src/topology/resolve-area.test.ts +174 -0
- package/src/topology/resolve-area.ts +215 -0
- package/src/types.ts +1057 -0
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import type { ContractCanonicalMappingInput } from "./contract/index.js";
|
|
2
|
+
import type { GovernanceConfig } from "./governance.js";
|
|
3
|
+
|
|
4
|
+
export interface LocalCanonicalResolveRule {
|
|
5
|
+
tag: string;
|
|
6
|
+
role?: string;
|
|
7
|
+
inputType?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface LocalCanonicalDeclaration {
|
|
11
|
+
importPath: string;
|
|
12
|
+
resolves: readonly LocalCanonicalResolveRule[];
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface InspectConfig {
|
|
16
|
+
localCanonical?: Readonly<Record<string, LocalCanonicalDeclaration>>;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
interface PreferLibraryRuleConfig {
|
|
20
|
+
enabled?: boolean;
|
|
21
|
+
severity?: "error" | "warn" | "info";
|
|
22
|
+
options?: {
|
|
23
|
+
canonicalMappings?: unknown[];
|
|
24
|
+
[key: string]: unknown;
|
|
25
|
+
};
|
|
26
|
+
[key: string]: unknown;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function localCanonicalContractMappings(
|
|
30
|
+
inspect: InspectConfig | null | undefined
|
|
31
|
+
): ContractCanonicalMappingInput[] {
|
|
32
|
+
return localCanonicalRuleMappings(inspect).map((mapping) => ({
|
|
33
|
+
component: mapping.htmlEquivalent,
|
|
34
|
+
canonical: mapping.name,
|
|
35
|
+
status: "confirmed",
|
|
36
|
+
importPath: mapping.importPath,
|
|
37
|
+
resolves: [
|
|
38
|
+
{
|
|
39
|
+
tag: mapping.htmlEquivalent,
|
|
40
|
+
...(mapping.ariaRole ? { role: mapping.ariaRole } : {}),
|
|
41
|
+
...(mapping.htmlType ? { inputType: mapping.htmlType } : {}),
|
|
42
|
+
},
|
|
43
|
+
],
|
|
44
|
+
}));
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export function governanceConfigWithLocalCanonical(
|
|
48
|
+
config: GovernanceConfig | undefined,
|
|
49
|
+
inspect: InspectConfig | null | undefined
|
|
50
|
+
): GovernanceConfig | undefined {
|
|
51
|
+
const localMappings = localCanonicalRuleMappings(inspect);
|
|
52
|
+
if (localMappings.length === 0) return config;
|
|
53
|
+
|
|
54
|
+
const existingRule = readPreferLibraryRule(config);
|
|
55
|
+
const existingOptions = existingRule.options ?? {};
|
|
56
|
+
return {
|
|
57
|
+
...(config ?? {}),
|
|
58
|
+
rules: {
|
|
59
|
+
...(config?.rules ?? {}),
|
|
60
|
+
"components/prefer-library": {
|
|
61
|
+
...existingRule,
|
|
62
|
+
enabled: existingRule.enabled ?? true,
|
|
63
|
+
severity: existingRule.severity ?? "error",
|
|
64
|
+
options: {
|
|
65
|
+
...existingOptions,
|
|
66
|
+
canonicalMappings: [
|
|
67
|
+
...(Array.isArray(existingOptions.canonicalMappings)
|
|
68
|
+
? existingOptions.canonicalMappings
|
|
69
|
+
: []),
|
|
70
|
+
...localMappings,
|
|
71
|
+
],
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function localCanonicalRuleMappings(inspect: InspectConfig | null | undefined) {
|
|
79
|
+
return Object.entries(inspect?.localCanonical ?? {}).flatMap(([name, declaration]) =>
|
|
80
|
+
declaration.resolves.map((rule) => ({
|
|
81
|
+
name,
|
|
82
|
+
canonical: name,
|
|
83
|
+
htmlEquivalent: rule.tag,
|
|
84
|
+
...(rule.role ? { ariaRole: rule.role } : {}),
|
|
85
|
+
...(rule.inputType ? { htmlType: rule.inputType } : {}),
|
|
86
|
+
importPath: declaration.importPath,
|
|
87
|
+
confidence: 1,
|
|
88
|
+
// Provenance: the user explicitly declared this tag → component mapping
|
|
89
|
+
// (not an inferred htmlEquivalent), so prefer-library may enforce a
|
|
90
|
+
// specific interactive tag against this exact (possibly non-Fragments)
|
|
91
|
+
// component name. See isEnforceableHtmlEquivalent(explicit).
|
|
92
|
+
declaredHtmlEquivalent: true,
|
|
93
|
+
}))
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function readPreferLibraryRule(config: GovernanceConfig | undefined): PreferLibraryRuleConfig {
|
|
98
|
+
const raw = config?.rules?.["components/prefer-library"];
|
|
99
|
+
return raw && typeof raw === "object" && !Array.isArray(raw)
|
|
100
|
+
? (raw as PreferLibraryRuleConfig)
|
|
101
|
+
: {};
|
|
102
|
+
}
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
export const mcpSnapshotSchemaVersionSchema = z.literal(1);
|
|
4
|
+
|
|
5
|
+
export const mcpSourceTypeSchema = z.enum([
|
|
6
|
+
'fragments-json',
|
|
7
|
+
'cloud',
|
|
8
|
+
'auto-extract',
|
|
9
|
+
'custom-json',
|
|
10
|
+
'bundle',
|
|
11
|
+
]);
|
|
12
|
+
|
|
13
|
+
export const mcpCapabilitySchema = z.enum([
|
|
14
|
+
'components',
|
|
15
|
+
'tokens',
|
|
16
|
+
'blocks',
|
|
17
|
+
'graph',
|
|
18
|
+
'performance',
|
|
19
|
+
]);
|
|
20
|
+
|
|
21
|
+
export const mcpPerformanceImportSchema = z.object({
|
|
22
|
+
path: z.string().min(1),
|
|
23
|
+
bytes: z.number().nonnegative(),
|
|
24
|
+
percent: z.number().nonnegative(),
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
export const mcpPerformanceDataSchema = z.object({
|
|
28
|
+
bundleSize: z.number().nonnegative(),
|
|
29
|
+
rawSize: z.number().nonnegative(),
|
|
30
|
+
complexity: z.enum(['lightweight', 'moderate', 'heavy']),
|
|
31
|
+
budgetPercent: z.number().nonnegative(),
|
|
32
|
+
overBudget: z.boolean(),
|
|
33
|
+
measuredAt: z.string().datetime(),
|
|
34
|
+
imports: z.array(mcpPerformanceImportSchema).optional(),
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
export const mcpPerformanceSummarySchema = z.object({
|
|
38
|
+
preset: z.string().min(1),
|
|
39
|
+
budget: z.number().nonnegative(),
|
|
40
|
+
total: z.number().int().nonnegative(),
|
|
41
|
+
overBudget: z.number().int().nonnegative(),
|
|
42
|
+
tiers: z.record(
|
|
43
|
+
z.enum(['lightweight', 'moderate', 'heavy']),
|
|
44
|
+
z.number().int().nonnegative(),
|
|
45
|
+
),
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
export const mcpComponentPropSchema = z.object({
|
|
49
|
+
type: z.string().min(1),
|
|
50
|
+
description: z.string().default(''),
|
|
51
|
+
required: z.boolean().default(false),
|
|
52
|
+
default: z.unknown().optional(),
|
|
53
|
+
values: z.array(z.string()).optional(),
|
|
54
|
+
constraints: z.array(z.string()).optional(),
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
export const mcpComponentExampleSchema = z.object({
|
|
58
|
+
name: z.string().min(1),
|
|
59
|
+
description: z.string().optional(),
|
|
60
|
+
code: z.string().optional(),
|
|
61
|
+
kind: z.string().optional(),
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
export const mcpComponentRelationSchema = z.object({
|
|
65
|
+
componentName: z.string().min(1),
|
|
66
|
+
componentId: z.string().optional(),
|
|
67
|
+
relationship: z.string().min(1),
|
|
68
|
+
note: z.string().optional(),
|
|
69
|
+
description: z.string().optional(),
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
export const mcpCompoundChildSchema = z.object({
|
|
73
|
+
name: z.string().min(1),
|
|
74
|
+
componentId: z.string().optional(),
|
|
75
|
+
description: z.string().optional(),
|
|
76
|
+
required: z.boolean().optional(),
|
|
77
|
+
accepts: z.array(z.string()).optional(),
|
|
78
|
+
visibility: z.enum(['public', 'internal']).optional(),
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
export const mcpGuidancePatternSchema = z.object({
|
|
82
|
+
name: z.string().min(1),
|
|
83
|
+
description: z.string().optional(),
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
export const mcpComponentGuidanceSchema = z.object({
|
|
87
|
+
when: z.array(z.string()).default([]),
|
|
88
|
+
whenNot: z.array(z.string()).default([]),
|
|
89
|
+
guidelines: z.array(z.string()).default([]),
|
|
90
|
+
accessibility: z.array(z.string()).default([]),
|
|
91
|
+
usageGuidance: z.string().optional(),
|
|
92
|
+
dos: z.array(z.string()).default([]),
|
|
93
|
+
donts: z.array(z.string()).default([]),
|
|
94
|
+
patterns: z.array(mcpGuidancePatternSchema).default([]),
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
export const mcpComponentMetadataSchema = z.object({
|
|
98
|
+
a11yRules: z.array(z.string()).default([]),
|
|
99
|
+
scenarioTags: z.array(z.string()).default([]),
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
export const mcpComponentSchema = z.object({
|
|
103
|
+
id: z.string().min(1),
|
|
104
|
+
name: z.string().min(1),
|
|
105
|
+
description: z.string().default(''),
|
|
106
|
+
category: z.string().default('uncategorized'),
|
|
107
|
+
status: z.string().default('stable'),
|
|
108
|
+
tags: z.array(z.string()).default([]),
|
|
109
|
+
props: z.record(z.string(), mcpComponentPropSchema).default({}),
|
|
110
|
+
propsSummary: z.array(z.string()).default([]),
|
|
111
|
+
examples: z.array(mcpComponentExampleSchema).default([]),
|
|
112
|
+
relations: z.array(mcpComponentRelationSchema).default([]),
|
|
113
|
+
compoundChildren: z.array(mcpCompoundChildSchema).default([]),
|
|
114
|
+
guidance: mcpComponentGuidanceSchema.default({
|
|
115
|
+
when: [],
|
|
116
|
+
whenNot: [],
|
|
117
|
+
guidelines: [],
|
|
118
|
+
accessibility: [],
|
|
119
|
+
dos: [],
|
|
120
|
+
donts: [],
|
|
121
|
+
patterns: [],
|
|
122
|
+
}),
|
|
123
|
+
sourceType: mcpSourceTypeSchema,
|
|
124
|
+
sourcePath: z.string().optional(),
|
|
125
|
+
sourceRepoFullName: z.string().optional(),
|
|
126
|
+
packageName: z.string().optional(),
|
|
127
|
+
importPath: z.string().optional(),
|
|
128
|
+
publicRef: z.string().optional(),
|
|
129
|
+
publicSlug: z.string().nullable().optional(),
|
|
130
|
+
isCanonical: z.boolean().optional(),
|
|
131
|
+
tier: z.string().optional(),
|
|
132
|
+
parentComponentId: z.string().optional(),
|
|
133
|
+
parentComponentName: z.string().optional(),
|
|
134
|
+
performance: mcpPerformanceDataSchema.optional(),
|
|
135
|
+
metadata: mcpComponentMetadataSchema.default({
|
|
136
|
+
a11yRules: [],
|
|
137
|
+
scenarioTags: [],
|
|
138
|
+
}),
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
export const mcpBlockSchema = z.object({
|
|
142
|
+
id: z.string().min(1),
|
|
143
|
+
name: z.string().min(1),
|
|
144
|
+
description: z.string().default(''),
|
|
145
|
+
category: z.string().default('uncategorized'),
|
|
146
|
+
components: z.array(z.string()).default([]),
|
|
147
|
+
tags: z.array(z.string()).default([]),
|
|
148
|
+
code: z.string().default(''),
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
export const mcpTokenSchema = z.object({
|
|
152
|
+
name: z.string().min(1),
|
|
153
|
+
category: z.string().min(1),
|
|
154
|
+
value: z.string().optional(),
|
|
155
|
+
description: z.string().optional(),
|
|
156
|
+
path: z.array(z.string()).optional(),
|
|
157
|
+
type: z.string().optional(),
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
export const mcpTokenDataSchema = z.object({
|
|
161
|
+
prefix: z.string(),
|
|
162
|
+
total: z.number().int().nonnegative(),
|
|
163
|
+
categories: z.record(z.string(), z.array(mcpTokenSchema)),
|
|
164
|
+
flat: z.array(mcpTokenSchema).default([]),
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
export const mcpSnapshotMetadataSchema = z.object({
|
|
168
|
+
designSystemName: z.string().optional(),
|
|
169
|
+
packageName: z.string().optional(),
|
|
170
|
+
importPath: z.string().optional(),
|
|
171
|
+
revision: z.string().optional(),
|
|
172
|
+
updatedAt: z.string().optional(),
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
export const mcpSnapshotSchema = z.object({
|
|
176
|
+
schemaVersion: mcpSnapshotSchemaVersionSchema,
|
|
177
|
+
sourceType: mcpSourceTypeSchema,
|
|
178
|
+
sourceLabel: z.string().min(1),
|
|
179
|
+
capabilities: z.array(mcpCapabilitySchema),
|
|
180
|
+
metadata: mcpSnapshotMetadataSchema.default({}),
|
|
181
|
+
components: z.record(z.string(), mcpComponentSchema),
|
|
182
|
+
blocks: z.record(z.string(), mcpBlockSchema).optional(),
|
|
183
|
+
tokens: mcpTokenDataSchema.optional(),
|
|
184
|
+
graph: z.unknown().optional(),
|
|
185
|
+
performanceSummary: mcpPerformanceSummarySchema.optional(),
|
|
186
|
+
packageMap: z.record(z.string(), z.string()).default({}),
|
|
187
|
+
defaultPackageName: z.string().optional(),
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
export type McpSnapshotSchemaVersion = z.infer<
|
|
191
|
+
typeof mcpSnapshotSchemaVersionSchema
|
|
192
|
+
>;
|
|
193
|
+
export type McpSourceType = z.infer<typeof mcpSourceTypeSchema>;
|
|
194
|
+
export type McpCapability = z.infer<typeof mcpCapabilitySchema>;
|
|
195
|
+
export type McpPerformanceImport = z.infer<
|
|
196
|
+
typeof mcpPerformanceImportSchema
|
|
197
|
+
>;
|
|
198
|
+
export type McpPerformanceData = z.infer<typeof mcpPerformanceDataSchema>;
|
|
199
|
+
export type McpPerformanceSummary = z.infer<
|
|
200
|
+
typeof mcpPerformanceSummarySchema
|
|
201
|
+
>;
|
|
202
|
+
export type McpComponentProp = z.infer<typeof mcpComponentPropSchema>;
|
|
203
|
+
export type McpComponentExample = z.infer<typeof mcpComponentExampleSchema>;
|
|
204
|
+
export type McpComponentRelation = z.infer<
|
|
205
|
+
typeof mcpComponentRelationSchema
|
|
206
|
+
>;
|
|
207
|
+
export type McpCompoundChild = z.infer<typeof mcpCompoundChildSchema>;
|
|
208
|
+
export type McpGuidancePattern = z.infer<typeof mcpGuidancePatternSchema>;
|
|
209
|
+
export type McpComponentGuidance = z.infer<
|
|
210
|
+
typeof mcpComponentGuidanceSchema
|
|
211
|
+
>;
|
|
212
|
+
export type McpComponentMetadata = z.infer<
|
|
213
|
+
typeof mcpComponentMetadataSchema
|
|
214
|
+
>;
|
|
215
|
+
export type McpComponent = z.infer<typeof mcpComponentSchema>;
|
|
216
|
+
export type McpBlock = z.infer<typeof mcpBlockSchema>;
|
|
217
|
+
export type McpToken = z.infer<typeof mcpTokenSchema>;
|
|
218
|
+
export type McpTokenData = z.infer<typeof mcpTokenDataSchema>;
|
|
219
|
+
export type McpSnapshotMetadata = z.infer<
|
|
220
|
+
typeof mcpSnapshotMetadataSchema
|
|
221
|
+
>;
|
|
222
|
+
export type McpSnapshot = z.infer<typeof mcpSnapshotSchema>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import {
|
|
2
|
+
canonicalizeOwnedComponentId,
|
|
3
|
+
canonicalizeOwnedImport,
|
|
4
|
+
ownedImportEquivalents,
|
|
5
|
+
} from "./package-identity.js";
|
|
6
|
+
|
|
7
|
+
/** Equality for typed npm import fields; arbitrary strings remain exact. */
|
|
8
|
+
export function ownedImportsEqual(left: string, right: string): boolean {
|
|
9
|
+
if (left === right) return true;
|
|
10
|
+
if (ownedImportEquivalents(left).includes(right)) return true;
|
|
11
|
+
return canonicalizeOwnedImport(left) === canonicalizeOwnedImport(right);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Match an import against a configured package root/subpath while accepting
|
|
16
|
+
* every signed legacy/current spelling of that root.
|
|
17
|
+
*/
|
|
18
|
+
export function ownedImportMatchesRoot(imported: string, configuredRoot: string): boolean {
|
|
19
|
+
for (const equivalent of ownedImportEquivalents(configuredRoot)) {
|
|
20
|
+
if (imported === equivalent || imported.startsWith(`${equivalent}/`)) {
|
|
21
|
+
return true;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const canonicalImported = canonicalizeOwnedImport(imported);
|
|
26
|
+
const canonicalRoot = canonicalizeOwnedImport(configuredRoot);
|
|
27
|
+
return canonicalImported === canonicalRoot || canonicalImported.startsWith(`${canonicalRoot}/`);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** Equality for the package-name half of typed `package#Component` ids. */
|
|
31
|
+
export function ownedComponentIdsEqual(left: string, right: string): boolean {
|
|
32
|
+
return canonicalizeOwnedComponentId(left) === canonicalizeOwnedComponentId(right);
|
|
33
|
+
}
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
// This file is generated by scripts/generate-owned-package-identity-module.mjs.
|
|
2
|
+
// Edit owned-package-identities.json, then regenerate. Do not edit by hand.
|
|
3
|
+
|
|
4
|
+
export const OWNED_PACKAGE_AUTHORING_EPOCH = "current" as const;
|
|
5
|
+
export const OWNED_PACKAGE_IDENTITY_SOURCE_SHA256 =
|
|
6
|
+
"e1777bd86647150762a454d021343627fc8d4ef73067c9bf5e61095866635baf" as const;
|
|
7
|
+
|
|
8
|
+
export const OWNED_PACKAGE_ROOT_POLICIES = [
|
|
9
|
+
{
|
|
10
|
+
id: "core",
|
|
11
|
+
status: "retained",
|
|
12
|
+
legacyRoot: "@fragments-sdk/core",
|
|
13
|
+
currentRoot: "@usefragments/core",
|
|
14
|
+
targetSpecifier: "@usefragments/core",
|
|
15
|
+
authoring: {
|
|
16
|
+
legacy: "@fragments-sdk/core",
|
|
17
|
+
current: "@usefragments/core",
|
|
18
|
+
},
|
|
19
|
+
v1Projection: "@fragments-sdk/core",
|
|
20
|
+
readEquivalents: ["@fragments-sdk/core", "@usefragments/core"],
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
id: "ui",
|
|
24
|
+
status: "retained",
|
|
25
|
+
legacyRoot: "@fragments-sdk/ui",
|
|
26
|
+
currentRoot: "@usefragments/ui",
|
|
27
|
+
targetSpecifier: "@usefragments/ui",
|
|
28
|
+
authoring: {
|
|
29
|
+
legacy: "@fragments-sdk/ui",
|
|
30
|
+
current: "@usefragments/ui",
|
|
31
|
+
},
|
|
32
|
+
v1Projection: "@fragments-sdk/ui",
|
|
33
|
+
readEquivalents: ["@fragments-sdk/ui", "@usefragments/ui"],
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
id: "cli",
|
|
37
|
+
status: "retained",
|
|
38
|
+
legacyRoot: "@fragments-sdk/cli",
|
|
39
|
+
currentRoot: "@usefragments/cli",
|
|
40
|
+
targetSpecifier: "@usefragments/cli",
|
|
41
|
+
authoring: {
|
|
42
|
+
legacy: "@fragments-sdk/cli",
|
|
43
|
+
current: "@usefragments/cli",
|
|
44
|
+
},
|
|
45
|
+
v1Projection: "@fragments-sdk/cli",
|
|
46
|
+
readEquivalents: ["@fragments-sdk/cli", "@usefragments/cli"],
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
id: "preview",
|
|
50
|
+
status: "moved",
|
|
51
|
+
legacyRoot: "@fragments-sdk/preview",
|
|
52
|
+
currentRoot: null,
|
|
53
|
+
targetSpecifier: "@usefragments/core/preview",
|
|
54
|
+
authoring: {
|
|
55
|
+
legacy: "@fragments-sdk/preview",
|
|
56
|
+
current: "@usefragments/core/preview",
|
|
57
|
+
},
|
|
58
|
+
v1Projection: "@fragments-sdk/preview",
|
|
59
|
+
readEquivalents: ["@fragments-sdk/preview", "@usefragments/core/preview"],
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
id: "extract",
|
|
63
|
+
status: "retired",
|
|
64
|
+
legacyRoot: "@fragments-sdk/extract",
|
|
65
|
+
currentRoot: null,
|
|
66
|
+
targetSpecifier: null,
|
|
67
|
+
authoring: {
|
|
68
|
+
legacy: "@fragments-sdk/extract",
|
|
69
|
+
current: null,
|
|
70
|
+
},
|
|
71
|
+
v1Projection: "@fragments-sdk/extract",
|
|
72
|
+
readEquivalents: ["@fragments-sdk/extract"],
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
id: "context",
|
|
76
|
+
status: "retired",
|
|
77
|
+
legacyRoot: "@fragments-sdk/context",
|
|
78
|
+
currentRoot: null,
|
|
79
|
+
targetSpecifier: null,
|
|
80
|
+
authoring: {
|
|
81
|
+
legacy: "@fragments-sdk/context",
|
|
82
|
+
current: null,
|
|
83
|
+
},
|
|
84
|
+
v1Projection: "@fragments-sdk/context",
|
|
85
|
+
readEquivalents: ["@fragments-sdk/context"],
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
id: "compiler",
|
|
89
|
+
status: "retired",
|
|
90
|
+
legacyRoot: "@fragments-sdk/compiler",
|
|
91
|
+
currentRoot: null,
|
|
92
|
+
targetSpecifier: null,
|
|
93
|
+
authoring: {
|
|
94
|
+
legacy: "@fragments-sdk/compiler",
|
|
95
|
+
current: null,
|
|
96
|
+
},
|
|
97
|
+
v1Projection: "@fragments-sdk/compiler",
|
|
98
|
+
readEquivalents: ["@fragments-sdk/compiler"],
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
id: "classifier",
|
|
102
|
+
status: "retired",
|
|
103
|
+
legacyRoot: "@fragments-sdk/classifier",
|
|
104
|
+
currentRoot: null,
|
|
105
|
+
targetSpecifier: null,
|
|
106
|
+
authoring: {
|
|
107
|
+
legacy: "@fragments-sdk/classifier",
|
|
108
|
+
current: null,
|
|
109
|
+
},
|
|
110
|
+
v1Projection: "@fragments-sdk/classifier",
|
|
111
|
+
readEquivalents: ["@fragments-sdk/classifier"],
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
id: "viewer",
|
|
115
|
+
status: "retired",
|
|
116
|
+
legacyRoot: "@fragments-sdk/viewer",
|
|
117
|
+
currentRoot: null,
|
|
118
|
+
targetSpecifier: null,
|
|
119
|
+
authoring: {
|
|
120
|
+
legacy: "@fragments-sdk/viewer",
|
|
121
|
+
current: null,
|
|
122
|
+
},
|
|
123
|
+
v1Projection: "@fragments-sdk/viewer",
|
|
124
|
+
readEquivalents: ["@fragments-sdk/viewer"],
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
id: "mcp",
|
|
128
|
+
status: "retired",
|
|
129
|
+
legacyRoot: "@fragments-sdk/mcp",
|
|
130
|
+
currentRoot: null,
|
|
131
|
+
targetSpecifier: null,
|
|
132
|
+
authoring: {
|
|
133
|
+
legacy: "@fragments-sdk/mcp",
|
|
134
|
+
current: null,
|
|
135
|
+
},
|
|
136
|
+
v1Projection: "@fragments-sdk/mcp",
|
|
137
|
+
readEquivalents: ["@fragments-sdk/mcp"],
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
id: "lsp",
|
|
141
|
+
status: "retired",
|
|
142
|
+
legacyRoot: "@fragments-sdk/lsp",
|
|
143
|
+
currentRoot: null,
|
|
144
|
+
targetSpecifier: null,
|
|
145
|
+
authoring: {
|
|
146
|
+
legacy: "@fragments-sdk/lsp",
|
|
147
|
+
current: null,
|
|
148
|
+
},
|
|
149
|
+
v1Projection: "@fragments-sdk/lsp",
|
|
150
|
+
readEquivalents: ["@fragments-sdk/lsp"],
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
id: "bench",
|
|
154
|
+
status: "retired",
|
|
155
|
+
legacyRoot: "@fragments-sdk/bench",
|
|
156
|
+
currentRoot: null,
|
|
157
|
+
targetSpecifier: null,
|
|
158
|
+
authoring: {
|
|
159
|
+
legacy: "@fragments-sdk/bench",
|
|
160
|
+
current: null,
|
|
161
|
+
},
|
|
162
|
+
v1Projection: "@fragments-sdk/bench",
|
|
163
|
+
readEquivalents: ["@fragments-sdk/bench"],
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
id: "govern",
|
|
167
|
+
status: "retired",
|
|
168
|
+
legacyRoot: "@fragments-sdk/govern",
|
|
169
|
+
currentRoot: null,
|
|
170
|
+
targetSpecifier: null,
|
|
171
|
+
authoring: {
|
|
172
|
+
legacy: "@fragments-sdk/govern",
|
|
173
|
+
current: null,
|
|
174
|
+
},
|
|
175
|
+
v1Projection: "@fragments-sdk/govern",
|
|
176
|
+
readEquivalents: ["@fragments-sdk/govern"],
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
id: "webmcp",
|
|
180
|
+
status: "retired",
|
|
181
|
+
legacyRoot: "@fragments-sdk/webmcp",
|
|
182
|
+
currentRoot: null,
|
|
183
|
+
targetSpecifier: null,
|
|
184
|
+
authoring: {
|
|
185
|
+
legacy: "@fragments-sdk/webmcp",
|
|
186
|
+
current: null,
|
|
187
|
+
},
|
|
188
|
+
v1Projection: "@fragments-sdk/webmcp",
|
|
189
|
+
readEquivalents: ["@fragments-sdk/webmcp"],
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
id: "skills",
|
|
193
|
+
status: "retired",
|
|
194
|
+
legacyRoot: "@fragments-sdk/skills",
|
|
195
|
+
currentRoot: null,
|
|
196
|
+
targetSpecifier: null,
|
|
197
|
+
authoring: {
|
|
198
|
+
legacy: "@fragments-sdk/skills",
|
|
199
|
+
current: null,
|
|
200
|
+
},
|
|
201
|
+
v1Projection: "@fragments-sdk/skills",
|
|
202
|
+
readEquivalents: ["@fragments-sdk/skills"],
|
|
203
|
+
},
|
|
204
|
+
] as const;
|
|
205
|
+
|
|
206
|
+
export const OWNED_PACKAGE_EXPLICIT_POLICIES = [
|
|
207
|
+
{
|
|
208
|
+
id: "cli/core",
|
|
209
|
+
status: "moved",
|
|
210
|
+
legacySpecifier: "@fragments-sdk/cli/core",
|
|
211
|
+
currentSpecifier: "@usefragments/core",
|
|
212
|
+
authoring: {
|
|
213
|
+
legacy: "@fragments-sdk/core",
|
|
214
|
+
current: "@usefragments/core",
|
|
215
|
+
},
|
|
216
|
+
v1Projection: "@fragments-sdk/cli/core",
|
|
217
|
+
readEquivalents: ["@fragments-sdk/cli/core", "@fragments-sdk/core", "@usefragments/core"],
|
|
218
|
+
matchCurrentForV1: false,
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
id: "preview",
|
|
222
|
+
status: "moved",
|
|
223
|
+
legacySpecifier: "@fragments-sdk/preview",
|
|
224
|
+
currentSpecifier: "@usefragments/core/preview",
|
|
225
|
+
authoring: {
|
|
226
|
+
legacy: "@fragments-sdk/preview",
|
|
227
|
+
current: "@usefragments/core/preview",
|
|
228
|
+
},
|
|
229
|
+
v1Projection: "@fragments-sdk/preview",
|
|
230
|
+
readEquivalents: ["@fragments-sdk/preview", "@usefragments/core/preview"],
|
|
231
|
+
matchCurrentForV1: true,
|
|
232
|
+
},
|
|
233
|
+
] as const;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
OWNED_PACKAGE_IDENTITY_EPOCH,
|
|
5
|
+
authorOwnedImport,
|
|
6
|
+
canonicalizeOwnedComponentId,
|
|
7
|
+
canonicalizeOwnedImport,
|
|
8
|
+
ownedImportEquivalents,
|
|
9
|
+
projectV1OwnedComponentId,
|
|
10
|
+
projectV1OwnedImportIdentity,
|
|
11
|
+
resolveOwnedPackageImport,
|
|
12
|
+
} from "./package-identity.js";
|
|
13
|
+
|
|
14
|
+
describe("owned package import identity", () => {
|
|
15
|
+
it("canonicalizes retained roots and their subpaths to the current scope", () => {
|
|
16
|
+
expect(canonicalizeOwnedImport("@fragments-sdk/ui")).toBe("@usefragments/ui");
|
|
17
|
+
expect(canonicalizeOwnedImport("@fragments-sdk/ui/styles")).toBe("@usefragments/ui/styles");
|
|
18
|
+
expect(canonicalizeOwnedImport("@usefragments/ui/data-table")).toBe(
|
|
19
|
+
"@usefragments/ui/data-table"
|
|
20
|
+
);
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
it("resolves approved moves without exposing private implementation packages", () => {
|
|
24
|
+
expect(canonicalizeOwnedImport("@fragments-sdk/preview")).toBe("@usefragments/core/preview");
|
|
25
|
+
expect(canonicalizeOwnedImport("@fragments-sdk/cli/core")).toBe("@usefragments/core");
|
|
26
|
+
|
|
27
|
+
const retired = resolveOwnedPackageImport("@fragments-sdk/extract");
|
|
28
|
+
expect(retired).toMatchObject({ owned: true, status: "retired" });
|
|
29
|
+
expect(retired.canonicalSpecifier).toBeUndefined();
|
|
30
|
+
expect(canonicalizeOwnedImport("@fragments-sdk/extract")).toBe("@fragments-sdk/extract");
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
it("enumerates supported equivalents without collapsing historical CLI/core", () => {
|
|
34
|
+
expect(ownedImportEquivalents("@fragments-sdk/ui/styles")).toEqual([
|
|
35
|
+
"@fragments-sdk/ui/styles",
|
|
36
|
+
"@usefragments/ui/styles",
|
|
37
|
+
]);
|
|
38
|
+
expect(ownedImportEquivalents("@fragments-sdk/cli/core")).toEqual([
|
|
39
|
+
"@fragments-sdk/cli/core",
|
|
40
|
+
"@fragments-sdk/core",
|
|
41
|
+
"@usefragments/core",
|
|
42
|
+
]);
|
|
43
|
+
expect(ownedImportEquivalents("@usefragments/core")).toEqual([
|
|
44
|
+
"@fragments-sdk/core",
|
|
45
|
+
"@usefragments/core",
|
|
46
|
+
]);
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
it("never treats arbitrary or third-party strings as owned imports", () => {
|
|
50
|
+
for (const value of [
|
|
51
|
+
"@acme/ui",
|
|
52
|
+
"@fragments-sdkish/ui",
|
|
53
|
+
"prefix:@fragments-sdk/ui",
|
|
54
|
+
"https://github.com/fragments-sdk/fragments",
|
|
55
|
+
]) {
|
|
56
|
+
expect(resolveOwnedPackageImport(value)).toEqual({
|
|
57
|
+
input: value,
|
|
58
|
+
owned: false,
|
|
59
|
+
v1Specifier: value,
|
|
60
|
+
});
|
|
61
|
+
expect(canonicalizeOwnedImport(value)).toBe(value);
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
it("authors only current public identities after the coordinated cutover", () => {
|
|
66
|
+
expect(OWNED_PACKAGE_IDENTITY_EPOCH).toBe("current");
|
|
67
|
+
expect(authorOwnedImport("@fragments-sdk/ui/styles")).toBe("@usefragments/ui/styles");
|
|
68
|
+
expect(authorOwnedImport("@fragments-sdk/preview")).toBe("@usefragments/core/preview");
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
describe("fcid-preimage:v1 owned identity projection", () => {
|
|
73
|
+
it("projects retained and moved old/new spellings to their historical bytes", () => {
|
|
74
|
+
expect(projectV1OwnedImportIdentity("@usefragments/ui/styles")).toBe(
|
|
75
|
+
"@fragments-sdk/ui/styles"
|
|
76
|
+
);
|
|
77
|
+
expect(projectV1OwnedImportIdentity("@usefragments/core/preview")).toBe(
|
|
78
|
+
"@fragments-sdk/preview"
|
|
79
|
+
);
|
|
80
|
+
expect(projectV1OwnedImportIdentity("@fragments-sdk/preview")).toBe("@fragments-sdk/preview");
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
it("keeps historical CLI/core distinct from the Core root", () => {
|
|
84
|
+
expect(projectV1OwnedImportIdentity("@fragments-sdk/cli/core")).toBe("@fragments-sdk/cli/core");
|
|
85
|
+
expect(projectV1OwnedImportIdentity("@usefragments/core")).toBe("@fragments-sdk/core");
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
it("projects component package identities but preserves their component names", () => {
|
|
89
|
+
expect(canonicalizeOwnedComponentId("@fragments-sdk/ui#Card.Header")).toBe(
|
|
90
|
+
"@usefragments/ui#Card.Header"
|
|
91
|
+
);
|
|
92
|
+
expect(projectV1OwnedComponentId("@usefragments/ui#Card.Header")).toBe(
|
|
93
|
+
"@fragments-sdk/ui#Card.Header"
|
|
94
|
+
);
|
|
95
|
+
expect(projectV1OwnedComponentId("local-design-system#Button")).toBe(
|
|
96
|
+
"local-design-system#Button"
|
|
97
|
+
);
|
|
98
|
+
});
|
|
99
|
+
});
|