@canonical/summon-core 0.36.0 → 0.38.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/esm/index.js +4 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/layer/componentLayer.js +84 -0
- package/dist/esm/layer/componentLayer.js.map +1 -0
- package/dist/esm/layer/index.js +2 -0
- package/dist/esm/layer/index.js.map +1 -0
- package/dist/esm/testing/conformance/fixtures.js +33 -1
- package/dist/esm/testing/conformance/fixtures.js.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/layer/componentLayer.d.ts +43 -0
- package/dist/types/layer/componentLayer.d.ts.map +1 -0
- package/dist/types/layer/index.d.ts +2 -0
- package/dist/types/layer/index.d.ts.map +1 -0
- package/dist/types/testing/conformance/fixtures.d.ts +1 -1
- package/dist/types/testing/conformance/fixtures.d.ts.map +1 -1
- package/package.json +13 -10
package/dist/esm/index.js
CHANGED
|
@@ -7,6 +7,10 @@
|
|
|
7
7
|
*
|
|
8
8
|
* @packageDocumentation
|
|
9
9
|
*/
|
|
10
|
+
// =============================================================================
|
|
11
|
+
// Cascade layers (which component tier a package's stylesheets sit in)
|
|
12
|
+
// =============================================================================
|
|
13
|
+
export { COMPONENT_TIER_LAYERS, componentLayerFor, GLOBAL_COMPONENT_LAYER, isSubTierLayer, } from "./layer/index.js";
|
|
10
14
|
export { applyStamp, createGeneratorStamp, createStampOnEffectStart, runTaskWithStamp, } from "./stamp/index.js";
|
|
11
15
|
export { CONFIRM_ANSWER_KEY, collectAnswers, execute, GENERATOR_CANCELLED, GENERATOR_INVALID_ANSWER, invalidAnswersError, isInvalidAnswersError, validateAnswers, } from "./execute/index.js";
|
|
12
16
|
export { answerPromptWithDefaults, autoPrompt, inkPrompt, MISSING_REQUIRED_ANSWER, mcpPrompt, missingRequiredError, } from "./prompt/index.js";
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAgBH,gFAAgF;AAChF,uEAAuE;AACvE,gFAAgF;AAEhF,OAAO,EACL,qBAAqB,EACrB,iBAAiB,EACjB,sBAAsB,EACtB,cAAc,GACf,MAAM,kBAAkB,CAAC;AAO1B,OAAO,EACL,UAAU,EACV,oBAAoB,EACpB,wBAAwB,EACxB,gBAAgB,GACjB,MAAM,kBAAkB,CAAC;AAW1B,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,OAAO,EACP,mBAAmB,EACnB,wBAAwB,EACxB,mBAAmB,EACnB,qBAAqB,EACrB,eAAe,GAChB,MAAM,oBAAoB,CAAC;AAmB5B,OAAO,EACL,wBAAwB,EACxB,UAAU,EACV,SAAS,EACT,uBAAuB,EACvB,SAAS,EACT,oBAAoB,GACrB,MAAM,mBAAmB,CAAC;AAE3B,gFAAgF;AAChF,iDAAiD;AACjD,gFAAgF;AAEhF,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,oBAAoB,EACpB,gBAAgB,EAChB,uBAAuB,EACvB,aAAa,EACb,aAAa,EACb,iBAAiB,EACjB,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EAChB,eAAe,EACf,kBAAkB,GACnB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAalD,OAAO,EACL,SAAS,EACT,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,YAAY,EACZ,gBAAgB,EAChB,YAAY,EACZ,OAAO,EACP,UAAU,EACV,YAAY,EACZ,iBAAiB,EACjB,QAAQ,EACR,WAAW,EACX,eAAe,EACf,WAAW,GACZ,MAAM,qBAAqB,CAAC;AAE7B,gFAAgF;AAChF,+CAA+C;AAC/C,gFAAgF;AAEhF,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AACxF,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which cascade layer a package's component stylesheets sit in.
|
|
3
|
+
*
|
|
4
|
+
* `@canonical/styles` orders the component tiers in one statement, and the
|
|
5
|
+
* order follows the design system's own tier tree, flat: `ds.components.global`
|
|
6
|
+
* below `ds.components.sites`, `documentation`, `stores` and `apps`, and a
|
|
7
|
+
* sub-tier package — one product's own components — in a layer of its own named
|
|
8
|
+
* after it, `ds.components.apps-lxd`. Flat rather than nested because a nested
|
|
9
|
+
* layer sorts inside its parent, so `ds.components.apps.lxd` would sit below
|
|
10
|
+
* every rule written directly in `ds.components.apps`, which is the opposite of
|
|
11
|
+
* what a product tier needs.
|
|
12
|
+
*
|
|
13
|
+
* The mapping is by package name because that is the one identifier a generator
|
|
14
|
+
* always has, and because it is the name the tier tree is keyed on. Getting it
|
|
15
|
+
* from the package rather than from the author is the point: a wrong layer is
|
|
16
|
+
* silent, and reintroduces the source-order race the layers exist to end.
|
|
17
|
+
*
|
|
18
|
+
* Owner ruling 2026-09-06 (VC.31). `ds.components.app` is retired.
|
|
19
|
+
*/
|
|
20
|
+
/** The root of the component tiers; the layer a tierless package falls back to. */
|
|
21
|
+
export const GLOBAL_COMPONENT_LAYER = "ds.components.global";
|
|
22
|
+
/**
|
|
23
|
+
* The second level of the tier tree, as pragma's order statement names it, and
|
|
24
|
+
* the package-name stems that map to each. `global` has no sub-tiers: a
|
|
25
|
+
* `ds-global-*` package is another slice of the global tier, not a product.
|
|
26
|
+
*/
|
|
27
|
+
const TIERS = [
|
|
28
|
+
{ tier: "global", stems: ["ds-global"], subTiers: false },
|
|
29
|
+
{ tier: "sites", stems: ["ds-sites", "ds-site"], subTiers: true },
|
|
30
|
+
{
|
|
31
|
+
tier: "documentation",
|
|
32
|
+
stems: ["ds-documentation", "ds-docs"],
|
|
33
|
+
subTiers: true,
|
|
34
|
+
},
|
|
35
|
+
{ tier: "stores", stems: ["ds-stores", "ds-store"], subTiers: true },
|
|
36
|
+
{ tier: "apps", stems: ["ds-apps", "ds-app"], subTiers: true },
|
|
37
|
+
];
|
|
38
|
+
/** Every second-level layer name, in the order pragma's statement names them. */
|
|
39
|
+
export const COMPONENT_TIER_LAYERS = TIERS.map(({ tier }) => `ds.components.${tier}`);
|
|
40
|
+
/**
|
|
41
|
+
* The layer for a package's component stylesheets, from its name.
|
|
42
|
+
*
|
|
43
|
+
* The stem may be the whole name after the scope and framework prefix
|
|
44
|
+
* (`@canonical/react-ds-app` → `ds.components.apps`) or carry a product suffix
|
|
45
|
+
* (`@canonical/react-ds-app-lxd` → `ds.components.apps-lxd`). A name that
|
|
46
|
+
* matches no tier is global, which is both the safe default and what the
|
|
47
|
+
* untiered packages are.
|
|
48
|
+
*
|
|
49
|
+
* Pure.
|
|
50
|
+
*/
|
|
51
|
+
export function componentLayerFor(packageName) {
|
|
52
|
+
if (!packageName)
|
|
53
|
+
return GLOBAL_COMPONENT_LAYER;
|
|
54
|
+
// The stem starts at the first `ds-`; anything before it is the scope and the
|
|
55
|
+
// framework (`@canonical/react-`, `@canonical/svelte-`).
|
|
56
|
+
const match = /(?:^|[@/-])(ds-[a-z0-9-]*)$/.exec(packageName);
|
|
57
|
+
if (!match)
|
|
58
|
+
return GLOBAL_COMPONENT_LAYER;
|
|
59
|
+
const stem = match[1];
|
|
60
|
+
for (const { tier, stems, subTiers } of TIERS) {
|
|
61
|
+
for (const s of stems) {
|
|
62
|
+
if (stem === s)
|
|
63
|
+
return `ds.components.${tier}`;
|
|
64
|
+
if (subTiers && stem.startsWith(`${s}-`)) {
|
|
65
|
+
return `ds.components.${tier}-${stem.slice(s.length + 1)}`;
|
|
66
|
+
}
|
|
67
|
+
// A tier without sub-tiers absorbs its suffixed packages: ds-global-form
|
|
68
|
+
// is more of the global tier, not a product of its own.
|
|
69
|
+
if (!subTiers && stem.startsWith(`${s}-`))
|
|
70
|
+
return `ds.components.${tier}`;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return GLOBAL_COMPONENT_LAYER;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* True when the layer is a sub-tier — one product's own — rather than one of
|
|
77
|
+
* the five the styles package's order statement already names. A sub-tier
|
|
78
|
+
* package declares its own layer, first in its CSS entry, because no statement
|
|
79
|
+
* upstream of it can know the name.
|
|
80
|
+
*/
|
|
81
|
+
export function isSubTierLayer(layer) {
|
|
82
|
+
return !COMPONENT_TIER_LAYERS.includes(layer);
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=componentLayer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"componentLayer.js","sourceRoot":"","sources":["../../../src/layer/componentLayer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,mFAAmF;AACnF,MAAM,CAAC,MAAM,sBAAsB,GAAG,sBAAsB,CAAC;AAE7D;;;;GAIG;AACH,MAAM,KAAK,GAAG;IACZ,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,WAAW,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE;IACzD,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,UAAU,EAAE,SAAS,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE;IACjE;QACE,IAAI,EAAE,eAAe;QACrB,KAAK,EAAE,CAAC,kBAAkB,EAAE,SAAS,CAAC;QACtC,QAAQ,EAAE,IAAI;KACf;IACD,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,WAAW,EAAE,UAAU,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE;IACpE,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,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C,qBAAqB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AAChD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/layer/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,iBAAiB,EACjB,sBAAsB,EACtB,cAAc,GACf,MAAM,qBAAqB,CAAC"}
|
|
@@ -20,7 +20,7 @@ const COMPONENT_ANSWERS = {
|
|
|
20
20
|
withSsrTests: false,
|
|
21
21
|
};
|
|
22
22
|
/**
|
|
23
|
-
* The design-system generator fixtures — the
|
|
23
|
+
* The design-system generator fixtures — the seven trees pragma's `create` verbs
|
|
24
24
|
* and summon's `execute` must agree on byte for byte.
|
|
25
25
|
*/
|
|
26
26
|
export const CONFORMANCE_FIXTURES = [
|
|
@@ -63,6 +63,38 @@ export const CONFORMANCE_FIXTURES = [
|
|
|
63
63
|
runInstall: false,
|
|
64
64
|
},
|
|
65
65
|
},
|
|
66
|
+
{
|
|
67
|
+
// The SPA arm. Nothing else in CI produces a client-only tree, so without
|
|
68
|
+
// this fixture `--rendering spa` would be exercised only by hand: here
|
|
69
|
+
// three independent producers build it and diff it byte for byte.
|
|
70
|
+
name: "application-spa",
|
|
71
|
+
generator: "application",
|
|
72
|
+
answers: {
|
|
73
|
+
appPath: "my-app",
|
|
74
|
+
forms: true,
|
|
75
|
+
intl: false,
|
|
76
|
+
relay: false,
|
|
77
|
+
rendering: "spa",
|
|
78
|
+
runInstall: false,
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
// The SPA arm with every feature on. The bare fixture above renders none
|
|
83
|
+
// of the combination-only gates — `relay && spa` (an environment with no
|
|
84
|
+
// payloads to seed), `intl && spa` (negotiation with no server to have
|
|
85
|
+
// done it), the four-way provider stack in the client entry, and the
|
|
86
|
+
// nested intl/spa gates in the e2e template. This one renders all of them.
|
|
87
|
+
name: "application-spa-all",
|
|
88
|
+
generator: "application",
|
|
89
|
+
answers: {
|
|
90
|
+
appPath: "my-app",
|
|
91
|
+
forms: true,
|
|
92
|
+
intl: true,
|
|
93
|
+
relay: true,
|
|
94
|
+
rendering: "spa",
|
|
95
|
+
runInstall: false,
|
|
96
|
+
},
|
|
97
|
+
},
|
|
66
98
|
];
|
|
67
99
|
/**
|
|
68
100
|
* Look up a fixture by name.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fixtures.js","sourceRoot":"","sources":["../../../../src/testing/conformance/fixtures.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAYH,mFAAmF;AACnF,MAAM,iBAAiB,GAAG;IACxB,UAAU,EAAE,IAAI;IAChB,WAAW,EAAE,IAAI;IACjB,YAAY,EAAE,KAAK;CACX,CAAC;AAEX;;;GAGG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAkC;IACjE;QACE,IAAI,EAAE,iBAAiB;QACvB,SAAS,EAAE,iBAAiB;QAC5B,OAAO,EAAE,EAAE,aAAa,EAAE,uBAAuB,EAAE,GAAG,iBAAiB,EAAE;KAC1E;IACD;QACE,IAAI,EAAE,kBAAkB;QACxB,SAAS,EAAE,kBAAkB;QAC7B,OAAO,EAAE,EAAE,aAAa,EAAE,gBAAgB,EAAE,GAAG,iBAAiB,EAAE;KACnE;IACD;QACE,IAAI,EAAE,eAAe;QACrB,SAAS,EAAE,eAAe;QAC1B,OAAO,EAAE,EAAE,aAAa,EAAE,gBAAgB,EAAE,GAAG,iBAAiB,EAAE;KACnE;IACD;QACE,IAAI,EAAE,SAAS;QACf,SAAS,EAAE,SAAS;QACpB,OAAO,EAAE;YACP,IAAI,EAAE,mBAAmB;YACzB,IAAI,EAAE,SAAS;YACf,WAAW,EAAE,YAAY;YACzB,SAAS,EAAE,KAAK;YAChB,aAAa,EAAE,KAAK;YACpB,OAAO,EAAE,KAAK;YACd,cAAc,EAAE,KAAK;YACrB,UAAU,EAAE,KAAK;SAClB;KACF;IACD;QACE,IAAI,EAAE,aAAa;QACnB,SAAS,EAAE,aAAa;QACxB,OAAO,EAAE;YACP,OAAO,EAAE,QAAQ;YACjB,KAAK,EAAE,IAAI;YACX,KAAK,EAAE,KAAK;YACZ,UAAU,EAAE,KAAK;SAClB;KACF;CACF,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,UAAU,OAAO,CAAC,IAAY;IAClC,MAAM,KAAK,GAAG,oBAAoB,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;IACxE,IAAI,CAAC,KAAK;QAAE,MAAM,IAAI,KAAK,CAAC,iCAAiC,IAAI,GAAG,CAAC,CAAC;IACtE,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
1
|
+
{"version":3,"file":"fixtures.js","sourceRoot":"","sources":["../../../../src/testing/conformance/fixtures.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAYH,mFAAmF;AACnF,MAAM,iBAAiB,GAAG;IACxB,UAAU,EAAE,IAAI;IAChB,WAAW,EAAE,IAAI;IACjB,YAAY,EAAE,KAAK;CACX,CAAC;AAEX;;;GAGG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAkC;IACjE;QACE,IAAI,EAAE,iBAAiB;QACvB,SAAS,EAAE,iBAAiB;QAC5B,OAAO,EAAE,EAAE,aAAa,EAAE,uBAAuB,EAAE,GAAG,iBAAiB,EAAE;KAC1E;IACD;QACE,IAAI,EAAE,kBAAkB;QACxB,SAAS,EAAE,kBAAkB;QAC7B,OAAO,EAAE,EAAE,aAAa,EAAE,gBAAgB,EAAE,GAAG,iBAAiB,EAAE;KACnE;IACD;QACE,IAAI,EAAE,eAAe;QACrB,SAAS,EAAE,eAAe;QAC1B,OAAO,EAAE,EAAE,aAAa,EAAE,gBAAgB,EAAE,GAAG,iBAAiB,EAAE;KACnE;IACD;QACE,IAAI,EAAE,SAAS;QACf,SAAS,EAAE,SAAS;QACpB,OA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tE,OAAO,KAAK,CAAC;AACf,CAAC"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
* @packageDocumentation
|
|
9
9
|
*/
|
|
10
10
|
export type { AnyGenerator, ForbidReserved, GeneratorDefinition, GeneratorMeta, PromptDefinition, ReservedOption, StampConfig, } from "./types/index.js";
|
|
11
|
+
export { COMPONENT_TIER_LAYERS, componentLayerFor, GLOBAL_COMPONENT_LAYER, isSubTierLayer, } from "./layer/index.js";
|
|
11
12
|
export type { RunTaskWithStampOptions } from "./stamp/index.js";
|
|
12
13
|
export { applyStamp, createGeneratorStamp, createStampOnEffectStart, runTaskWithStamp, } from "./stamp/index.js";
|
|
13
14
|
export type { AnswerablePrompt, ExecuteContext, GeneratorResult, } from "./execute/index.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAMH,YAAY,EACV,YAAY,EACZ,cAAc,EACd,mBAAmB,EACnB,aAAa,EACb,gBAAgB,EAChB,cAAc,EACd,WAAW,GACZ,MAAM,kBAAkB,CAAC;AAM1B,YAAY,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,EACL,UAAU,EACV,oBAAoB,EACpB,wBAAwB,EACxB,gBAAgB,GACjB,MAAM,kBAAkB,CAAC;AAM1B,YAAY,EACV,gBAAgB,EAChB,cAAc,EACd,eAAe,GAChB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,OAAO,EACP,mBAAmB,EACnB,wBAAwB,EACxB,mBAAmB,EACnB,qBAAqB,EACrB,eAAe,GAChB,MAAM,oBAAoB,CAAC;AAO5B,YAAY,EACV,aAAa,EACb,gBAAgB,EAChB,UAAU,EACV,iBAAiB,EACjB,YAAY,EACZ,aAAa,EACb,cAAc,EACd,YAAY,EACZ,UAAU,EACV,UAAU,GACX,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,wBAAwB,EACxB,UAAU,EACV,SAAS,EACT,uBAAuB,EACvB,SAAS,EACT,oBAAoB,GACrB,MAAM,mBAAmB,CAAC;AAM3B,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,oBAAoB,EACpB,gBAAgB,EAChB,uBAAuB,EACvB,aAAa,EACb,aAAa,EACb,iBAAiB,EACjB,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EAChB,eAAe,EACf,kBAAkB,GACnB,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAMlD,YAAY,EACV,cAAc,EACd,cAAc,EACd,kBAAkB,EAClB,eAAe,EACf,gBAAgB,GACjB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,SAAS,EACT,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,YAAY,EACZ,gBAAgB,EAChB,YAAY,EACZ,OAAO,EACP,UAAU,EACV,YAAY,EACZ,iBAAiB,EACjB,QAAQ,EACR,WAAW,EACX,eAAe,EACf,WAAW,GACZ,MAAM,qBAAqB,CAAC;AAM7B,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AACxF,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,YAAY,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAMH,YAAY,EACV,YAAY,EACZ,cAAc,EACd,mBAAmB,EACnB,aAAa,EACb,gBAAgB,EAChB,cAAc,EACd,WAAW,GACZ,MAAM,kBAAkB,CAAC;AAM1B,OAAO,EACL,qBAAq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,gBAAgB,EAChB,YAAY,EACZ,OAAO,EACP,UAAU,EACV,YAAY,EACZ,iBAAiB,EACjB,QAAQ,EACR,WAAW,EACX,eAAe,EACf,WAAW,GACZ,MAAM,qBAAqB,CAAC;AAM7B,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AACxF,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,YAAY,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which cascade layer a package's component stylesheets sit in.
|
|
3
|
+
*
|
|
4
|
+
* `@canonical/styles` orders the component tiers in one statement, and the
|
|
5
|
+
* order follows the design system's own tier tree, flat: `ds.components.global`
|
|
6
|
+
* below `ds.components.sites`, `documentation`, `stores` and `apps`, and a
|
|
7
|
+
* sub-tier package — one product's own components — in a layer of its own named
|
|
8
|
+
* after it, `ds.components.apps-lxd`. Flat rather than nested because a nested
|
|
9
|
+
* layer sorts inside its parent, so `ds.components.apps.lxd` would sit below
|
|
10
|
+
* every rule written directly in `ds.components.apps`, which is the opposite of
|
|
11
|
+
* what a product tier needs.
|
|
12
|
+
*
|
|
13
|
+
* The mapping is by package name because that is the one identifier a generator
|
|
14
|
+
* always has, and because it is the name the tier tree is keyed on. Getting it
|
|
15
|
+
* from the package rather than from the author is the point: a wrong layer is
|
|
16
|
+
* silent, and reintroduces the source-order race the layers exist to end.
|
|
17
|
+
*
|
|
18
|
+
* Owner ruling 2026-09-06 (VC.31). `ds.components.app` is retired.
|
|
19
|
+
*/
|
|
20
|
+
/** The root of the component tiers; the layer a tierless package falls back to. */
|
|
21
|
+
export declare const GLOBAL_COMPONENT_LAYER = "ds.components.global";
|
|
22
|
+
/** Every second-level layer name, in the order pragma's statement names them. */
|
|
23
|
+
export declare const COMPONENT_TIER_LAYERS: string[];
|
|
24
|
+
/**
|
|
25
|
+
* The layer for a package's component stylesheets, from its name.
|
|
26
|
+
*
|
|
27
|
+
* The stem may be the whole name after the scope and framework prefix
|
|
28
|
+
* (`@canonical/react-ds-app` → `ds.components.apps`) or carry a product suffix
|
|
29
|
+
* (`@canonical/react-ds-app-lxd` → `ds.components.apps-lxd`). A name that
|
|
30
|
+
* matches no tier is global, which is both the safe default and what the
|
|
31
|
+
* untiered packages are.
|
|
32
|
+
*
|
|
33
|
+
* Pure.
|
|
34
|
+
*/
|
|
35
|
+
export declare function componentLayerFor(packageName: string | undefined): string;
|
|
36
|
+
/**
|
|
37
|
+
* True when the layer is a sub-tier — one product's own — rather than one of
|
|
38
|
+
* the five the styles package's order statement already names. A sub-tier
|
|
39
|
+
* package declares its own layer, first in its CSS entry, because no statement
|
|
40
|
+
* upstream of it can know the name.
|
|
41
|
+
*/
|
|
42
|
+
export declare function isSubTierLayer(layer: string): boolean;
|
|
43
|
+
//# sourceMappingURL=componentLayer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"componentLayer.d.ts","sourceRoot":"","sources":["../../../src/layer/componentLayer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,mFAAmF;AACnF,eAAO,MAAM,sBAAsB,yBAAyB,CAAC;AAmB7D,iFAAiF;AACjF,eAAO,MAAM,qBAAqB,UAEjC,CAAC;AAEF;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAmBzE;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAErD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/layer/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,iBAAiB,EACjB,sBAAsB,EACtB,cAAc,GACf,MAAM,qBAAqB,CAAC"}
|
|
@@ -23,7 +23,7 @@ export interface ConformanceFixture {
|
|
|
23
23
|
readonly answers: Readonly<Record<string, unknown>>;
|
|
24
24
|
}
|
|
25
25
|
/**
|
|
26
|
-
* The design-system generator fixtures — the
|
|
26
|
+
* The design-system generator fixtures — the seven trees pragma's `create` verbs
|
|
27
27
|
* and summon's `execute` must agree on byte for byte.
|
|
28
28
|
*/
|
|
29
29
|
export declare const CONFORMANCE_FIXTURES: readonly ConformanceFixture[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fixtures.d.ts","sourceRoot":"","sources":["../../../../src/testing/conformance/fixtures.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,8EAA8E;AAC9E,MAAM,WAAW,kBAAkB;IACjC,qDAAqD;IACrD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,oFAAoF;IACpF,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,+EAA+E;IAC/E,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CACrD;AASD;;;GAGG;AACH,eAAO,MAAM,oBAAoB,EAAE,SAAS,kBAAkB,
|
|
1
|
+
{"version":3,"file":"fixtures.d.ts","sourceRoot":"","sources":["../../../../src/testing/conformance/fixtures.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,8EAA8E;AAC9E,MAAM,WAAW,kBAAkB;IACjC,qDAAqD;IACrD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,oFAAoF;IACpF,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,+EAA+E;IAC/E,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CACrD;AASD;;;GAGG;AACH,eAAO,MAAM,oBAAoB,EAAE,SAAS,kBAAkB,EAwE7D,CAAC;AAEF;;;;;;;GAOG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,kBAAkB,CAIxD"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@canonical/summon-core",
|
|
3
3
|
"description": "Code generation framework: generator definitions, templates, stamps, discovery. Built on @canonical/task.",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.38.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
7
7
|
"types": "dist/types/index.d.ts",
|
|
@@ -62,10 +62,10 @@
|
|
|
62
62
|
"test:vitest:watch": "vitest"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
|
-
"@biomejs/biome": "2.
|
|
66
|
-
"@canonical/biome-config": "^0.
|
|
67
|
-
"@canonical/typescript-config": "^0.
|
|
68
|
-
"@canonical/webarchitect": "^0.
|
|
65
|
+
"@biomejs/biome": "2.5.13",
|
|
66
|
+
"@canonical/biome-config": "^0.38.0",
|
|
67
|
+
"@canonical/typescript-config": "^0.38.0",
|
|
68
|
+
"@canonical/webarchitect": "^0.38.0",
|
|
69
69
|
"@types/bun": "^1.3.10",
|
|
70
70
|
"@types/ejs": "^3.1.5",
|
|
71
71
|
"@types/node": "^26.0.0",
|
|
@@ -75,15 +75,18 @@
|
|
|
75
75
|
"vitest": "^4.0.18"
|
|
76
76
|
},
|
|
77
77
|
"dependencies": {
|
|
78
|
-
"@canonical/task": "^0.
|
|
79
|
-
"@canonical/utils": "^0.
|
|
80
|
-
"chalk": "^
|
|
81
|
-
"commander": "^
|
|
78
|
+
"@canonical/task": "^0.38.0",
|
|
79
|
+
"@canonical/utils": "^0.38.0",
|
|
80
|
+
"chalk": "^6.0.0",
|
|
81
|
+
"commander": "^15.0.0",
|
|
82
82
|
"ejs": "^5.0.0",
|
|
83
83
|
"ink": "^6.8.0",
|
|
84
84
|
"ink-select-input": "^6.2.0",
|
|
85
85
|
"ink-text-input": "^6.0.0",
|
|
86
86
|
"react": "^19.2.4"
|
|
87
87
|
},
|
|
88
|
-
"
|
|
88
|
+
"engines": {
|
|
89
|
+
"node": ">=22.18 <23 || >=23.6"
|
|
90
|
+
},
|
|
91
|
+
"gitHead": "4d10a68a9b299af6fe3d1d7d053e54ca128944ad"
|
|
89
92
|
}
|