@astryxdesign/cli 0.6.3-canary.866c9ea → 0.6.3-canary.89c4819
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/api/build/build.type.d.mts +2 -2
- package/api/build/build.type.mjs +2 -2
- package/api/component/component.type.d.mts +6 -6
- package/api/component/component.type.mjs +19 -19
- package/api/discover/discover.type.d.mts +4 -4
- package/api/discover/discover.type.mjs +10 -10
- package/api/docs/docs.type.d.mts +4 -4
- package/api/docs/docs.type.mjs +10 -10
- package/api/hook/hook.type.d.mts +3 -3
- package/api/hook/hook.type.mjs +11 -11
- package/api/integration/add-contribution.mjs +3 -5
- package/api/integration/add-contribution.test.mjs +4 -4
- package/api/integration/pack-check.mjs +7 -49
- package/api/integration/pack-check.test.mjs +0 -249
- package/api/search/search.type.d.mts +1 -1
- package/api/search/search.type.mjs +1 -1
- package/api/swizzle/swizzle.type.d.mts +2 -2
- package/api/swizzle/swizzle.type.mjs +2 -2
- package/api/template/template.type.d.mts +5 -5
- package/api/template/template.type.mjs +12 -12
- package/api/theme/build/build.mjs +6 -20
- package/api/theme/build/build.test.mjs +0 -127
- package/api/theme/palette/generate/generate.mjs +1 -1
- package/api/theme/palette/generate/generator.d.mts +13 -10
- package/api/theme/palette/generate/generator.mjs +3 -7
- package/api/theme/theme.type.d.mts +11 -170
- package/api/theme/theme.type.mjs +27 -94
- package/api/upgrade/upgrade.type.d.mts +4 -4
- package/api/upgrade/upgrade.type.mjs +10 -10
- package/assets/docs/styling-libraries.doc.mjs +1 -1
- package/assets/docs/working-with-ai.doc.mjs +1 -1
- package/clients/cli/commands/integration-authoring.test.mjs +9 -13
- package/package.json +11 -9
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* xds --json build (no query) — the "how to build a page" playbook signal.
|
|
6
6
|
*/
|
|
7
7
|
export type BuildHelpResponse = {
|
|
8
8
|
type: "build.help";
|
|
@@ -11,7 +11,7 @@ export type BuildHelpResponse = {
|
|
|
11
11
|
};
|
|
12
12
|
};
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
14
|
+
* xds --json build "<idea>" — the composition kit for what you're building.
|
|
15
15
|
*
|
|
16
16
|
* Entries are raw `SearchResultEntry` objects (no package-manager-prefixed
|
|
17
17
|
* command strings — the CLI adds those); `frame`/`foundation` are static
|
package/api/build/build.type.mjs
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
10
|
+
* xds --json build (no query) — the "how to build a page" playbook signal.
|
|
11
11
|
*
|
|
12
12
|
* @typedef {object} BuildHelpResponse
|
|
13
13
|
* @property {'build.help'} type
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
|
-
*
|
|
19
|
+
* xds --json build "<idea>" — the composition kit for what you're building.
|
|
20
20
|
*
|
|
21
21
|
* Entries are raw `SearchResultEntry` objects (no package-manager-prefixed
|
|
22
22
|
* command strings — the CLI adds those); `frame`/`foundation` are static
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* xds --json component [--list] [--category X] [--detail names|compact|full]
|
|
6
6
|
*
|
|
7
7
|
* The list view emits ONE `component.list` type across all three detail levels;
|
|
8
8
|
* the depth is carried in `data.detail` and `data.components` holds the grouped
|
|
@@ -55,7 +55,7 @@ export type ComponentBriefEntry = {
|
|
|
55
55
|
import: string;
|
|
56
56
|
};
|
|
57
57
|
/**
|
|
58
|
-
*
|
|
58
|
+
* xds --json component <name>
|
|
59
59
|
*/
|
|
60
60
|
export type ComponentDetailResponse = {
|
|
61
61
|
type: "component.detail";
|
|
@@ -81,14 +81,14 @@ export type ComponentOwnership = {
|
|
|
81
81
|
sourceAvailable: boolean;
|
|
82
82
|
};
|
|
83
83
|
/**
|
|
84
|
-
*
|
|
84
|
+
* xds --json component <name> --props
|
|
85
85
|
*/
|
|
86
86
|
export type ComponentDetailPropsResponse = {
|
|
87
87
|
type: "component.detail.props";
|
|
88
88
|
data: import("@astryxdesign/cli/authoring").ComponentPropDoc[];
|
|
89
89
|
};
|
|
90
90
|
/**
|
|
91
|
-
*
|
|
91
|
+
* xds --json component <name> --source
|
|
92
92
|
*/
|
|
93
93
|
export type ComponentDetailSourceResponse = {
|
|
94
94
|
type: "component.detail.source";
|
|
@@ -98,7 +98,7 @@ export type ComponentDetailSourceResponse = {
|
|
|
98
98
|
};
|
|
99
99
|
};
|
|
100
100
|
/**
|
|
101
|
-
*
|
|
101
|
+
* xds --json component <name> --showcase
|
|
102
102
|
*/
|
|
103
103
|
export type ComponentDetailShowcaseResponse = {
|
|
104
104
|
type: "component.detail.showcase";
|
|
@@ -109,7 +109,7 @@ export type ComponentDetailShowcaseResponse = {
|
|
|
109
109
|
};
|
|
110
110
|
};
|
|
111
111
|
/**
|
|
112
|
-
*
|
|
112
|
+
* xds --json component <name> --blocks
|
|
113
113
|
*/
|
|
114
114
|
export type ComponentDetailBlocksResponse = {
|
|
115
115
|
type: "component.detail.blocks";
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
/**
|
|
4
4
|
* @file Colocated types for the `component` command — source of truth for the
|
|
5
5
|
* component command's JSON responses. These typedefs describe the `{type, data}`
|
|
6
|
-
* envelopes emitted by `
|
|
6
|
+
* envelopes emitted by `xds --json component` and returned by the `component()`
|
|
7
7
|
* API; the `types/component.d.ts` barrel re-exports them for consumers.
|
|
8
8
|
*
|
|
9
9
|
* Detail-level contract for list views (brief < compact < full):
|
|
@@ -11,23 +11,23 @@
|
|
|
11
11
|
* --detail compact Names + 1-line description + import path.
|
|
12
12
|
* --detail full Full ComponentDoc per entry (props, theming, examples, etc.).
|
|
13
13
|
*
|
|
14
|
-
* Invocation
|
|
14
|
+
* Invocation -> type discriminator
|
|
15
15
|
* ------------------------------------------------------------------
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
* (not found)
|
|
16
|
+
* xds --json component -> component.list (data.detail='names')
|
|
17
|
+
* xds --json component --list -> component.list (data.detail='names')
|
|
18
|
+
* xds --json component --category Form -> component.list (filtered)
|
|
19
|
+
* xds --json component --list --detail compact -> component.list (data.detail='compact')
|
|
20
|
+
* xds --json component --list --detail full -> component.list (data.detail='full')
|
|
21
|
+
* xds --json component Button -> component.detail
|
|
22
|
+
* xds --json component Button --props -> component.detail.props
|
|
23
|
+
* xds --json component Button --source -> component.detail.source
|
|
24
|
+
* xds --json component Button --showcase -> component.detail.showcase
|
|
25
|
+
* xds --json component Button --blocks -> component.detail.blocks
|
|
26
|
+
* (not found) -> CLIError
|
|
27
27
|
*/
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
|
-
*
|
|
30
|
+
* xds --json component [--list] [--category X] [--detail names|compact|full]
|
|
31
31
|
*
|
|
32
32
|
* The list view emits ONE `component.list` type across all three detail levels;
|
|
33
33
|
* the depth is carried in `data.detail` and `data.components` holds the grouped
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
*/
|
|
71
71
|
|
|
72
72
|
/**
|
|
73
|
-
*
|
|
73
|
+
* xds --json component <name>
|
|
74
74
|
* @typedef {object} ComponentDetailResponse
|
|
75
75
|
* @property {'component.detail'} type
|
|
76
76
|
* @property {import('@astryxdesign/cli/authoring').ComponentDoc & ComponentOwnership} data
|
|
@@ -87,28 +87,28 @@
|
|
|
87
87
|
*/
|
|
88
88
|
|
|
89
89
|
/**
|
|
90
|
-
*
|
|
90
|
+
* xds --json component <name> --props
|
|
91
91
|
* @typedef {object} ComponentDetailPropsResponse
|
|
92
92
|
* @property {'component.detail.props'} type
|
|
93
93
|
* @property {import('@astryxdesign/cli/authoring').ComponentPropDoc[]} data
|
|
94
94
|
*/
|
|
95
95
|
|
|
96
96
|
/**
|
|
97
|
-
*
|
|
97
|
+
* xds --json component <name> --source
|
|
98
98
|
* @typedef {object} ComponentDetailSourceResponse
|
|
99
99
|
* @property {'component.detail.source'} type
|
|
100
100
|
* @property {{component: string; source: string}} data
|
|
101
101
|
*/
|
|
102
102
|
|
|
103
103
|
/**
|
|
104
|
-
*
|
|
104
|
+
* xds --json component <name> --showcase
|
|
105
105
|
* @typedef {object} ComponentDetailShowcaseResponse
|
|
106
106
|
* @property {'component.detail.showcase'} type
|
|
107
107
|
* @property {{component: string; aspectRatio: number; source: string}} data
|
|
108
108
|
*/
|
|
109
109
|
|
|
110
110
|
/**
|
|
111
|
-
*
|
|
111
|
+
* xds --json component <name> --blocks
|
|
112
112
|
* @typedef {object} ComponentDetailBlocksResponse
|
|
113
113
|
* @property {'component.detail.blocks'} type
|
|
114
114
|
* @property {{component: string; showcase: BlockEntry | null; examples: BlockEntry[]; related: BlockEntry[]}} data
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* xds --json discover
|
|
6
6
|
*/
|
|
7
7
|
export type DiscoverListResponse = {
|
|
8
8
|
type: "discover.list";
|
|
@@ -25,21 +25,21 @@ export type DiscoverListEntry = {
|
|
|
25
25
|
displayName?: string | undefined;
|
|
26
26
|
};
|
|
27
27
|
/**
|
|
28
|
-
*
|
|
28
|
+
* xds --json discover
|
|
29
29
|
*/
|
|
30
30
|
export type DiscoverDetailResponse = {
|
|
31
31
|
type: "discover.detail";
|
|
32
32
|
data: DiscoverListEntry;
|
|
33
33
|
};
|
|
34
34
|
/**
|
|
35
|
-
*
|
|
35
|
+
* xds --json discover
|
|
36
36
|
*/
|
|
37
37
|
export type DiscoverDetailDocResponse = {
|
|
38
38
|
type: "discover.detail.doc";
|
|
39
39
|
data: import("@astryxdesign/cli/authoring").ComponentDoc;
|
|
40
40
|
};
|
|
41
41
|
/**
|
|
42
|
-
*
|
|
42
|
+
* xds --json discover <searchterm> (multiple matches)
|
|
43
43
|
*/
|
|
44
44
|
export type DiscoverSearchResponse = {
|
|
45
45
|
type: "discover.search";
|
|
@@ -6,16 +6,16 @@
|
|
|
6
6
|
*
|
|
7
7
|
* Invocation -> type discriminator
|
|
8
8
|
* ------------------------------------------------------------------
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* (not found)
|
|
9
|
+
* xds --json discover -> discover.list
|
|
10
|
+
* xds --json discover @scope/name -> discover.detail
|
|
11
|
+
* xds --json discover @scope/name/Component -> discover.detail.doc
|
|
12
|
+
* xds --json discover <searchterm> (1 match) -> discover.detail.doc
|
|
13
|
+
* xds --json discover <searchterm> (N matches) -> discover.search
|
|
14
|
+
* (not found) -> CLIError
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
|
-
*
|
|
18
|
+
* xds --json discover
|
|
19
19
|
* @typedef {object} DiscoverListResponse
|
|
20
20
|
* @property {'discover.list'} type
|
|
21
21
|
* @property {DiscoverListEntry[]} data
|
|
@@ -35,21 +35,21 @@
|
|
|
35
35
|
*/
|
|
36
36
|
|
|
37
37
|
/**
|
|
38
|
-
*
|
|
38
|
+
* xds --json discover @scope/name
|
|
39
39
|
* @typedef {object} DiscoverDetailResponse
|
|
40
40
|
* @property {'discover.detail'} type
|
|
41
41
|
* @property {DiscoverListEntry} data
|
|
42
42
|
*/
|
|
43
43
|
|
|
44
44
|
/**
|
|
45
|
-
*
|
|
45
|
+
* xds --json discover @scope/name/Component
|
|
46
46
|
* @typedef {object} DiscoverDetailDocResponse
|
|
47
47
|
* @property {'discover.detail.doc'} type
|
|
48
48
|
* @property {import('@astryxdesign/cli/authoring').ComponentDoc} data
|
|
49
49
|
*/
|
|
50
50
|
|
|
51
51
|
/**
|
|
52
|
-
*
|
|
52
|
+
* xds --json discover <searchterm> (multiple matches)
|
|
53
53
|
* @typedef {object} DiscoverSearchResponse
|
|
54
54
|
* @property {'discover.search'} type
|
|
55
55
|
* @property {{query: string, matches: DiscoverSearchEntry[]}} data
|
package/api/docs/docs.type.d.mts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* xds --json docs
|
|
6
6
|
*/
|
|
7
7
|
export type DocsListResponse = {
|
|
8
8
|
type: "docs.list";
|
|
@@ -23,14 +23,14 @@ export type DocsListEntry = {
|
|
|
23
23
|
replaces?: string | undefined;
|
|
24
24
|
};
|
|
25
25
|
/**
|
|
26
|
-
*
|
|
26
|
+
* xds --json docs <topic> --index
|
|
27
27
|
*/
|
|
28
28
|
export type DocsIndexResponse = {
|
|
29
29
|
type: "docs.index";
|
|
30
30
|
data: DocsIndex;
|
|
31
31
|
};
|
|
32
32
|
/**
|
|
33
|
-
*
|
|
33
|
+
* xds --json docs <topic>
|
|
34
34
|
*/
|
|
35
35
|
export type DocsDetailResponse = {
|
|
36
36
|
type: "docs.detail";
|
|
@@ -62,7 +62,7 @@ export type DocsIndexSection = {
|
|
|
62
62
|
summary: string;
|
|
63
63
|
};
|
|
64
64
|
/**
|
|
65
|
-
*
|
|
65
|
+
* xds --json docs <topic> <section>
|
|
66
66
|
*/
|
|
67
67
|
export type DocsDetailSectionResponse = {
|
|
68
68
|
type: "docs.detail.section";
|
package/api/docs/docs.type.mjs
CHANGED
|
@@ -4,17 +4,17 @@
|
|
|
4
4
|
* @file Colocated types for the `docs` command — source of truth for the docs
|
|
5
5
|
* command JSON responses. `types/docs.d.ts` re-exports these.
|
|
6
6
|
*
|
|
7
|
-
* Invocation
|
|
7
|
+
* Invocation -> type discriminator
|
|
8
8
|
* ------------------------------------------------------------
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* (unknown topic/section)
|
|
9
|
+
* xds --json docs -> docs.list
|
|
10
|
+
* xds --json docs <topic> -> docs.detail
|
|
11
|
+
* xds --json docs <topic> --index -> docs.index
|
|
12
|
+
* xds --json docs <topic> <section> -> docs.detail.section
|
|
13
|
+
* (unknown topic/section) -> CLIError
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
|
-
*
|
|
17
|
+
* xds --json docs
|
|
18
18
|
* @typedef {object} DocsListResponse
|
|
19
19
|
* @property {'docs.list'} type
|
|
20
20
|
* @property {DocsListEntry[]} data
|
|
@@ -31,14 +31,14 @@
|
|
|
31
31
|
*/
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
|
-
*
|
|
34
|
+
* xds --json docs <topic> --index
|
|
35
35
|
* @typedef {object} DocsIndexResponse
|
|
36
36
|
* @property {'docs.index'} type
|
|
37
37
|
* @property {DocsIndex} data
|
|
38
38
|
*/
|
|
39
39
|
|
|
40
40
|
/**
|
|
41
|
-
*
|
|
41
|
+
* xds --json docs <topic>
|
|
42
42
|
* @typedef {object} DocsDetailResponse
|
|
43
43
|
* @property {'docs.detail'} type
|
|
44
44
|
* @property {import('@astryxdesign/cli/authoring').ReferenceDoc} data
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
*/
|
|
64
64
|
|
|
65
65
|
/**
|
|
66
|
-
*
|
|
66
|
+
* xds --json docs <topic> <section>
|
|
67
67
|
* @typedef {object} DocsDetailSectionResponse
|
|
68
68
|
* @property {'docs.detail.section'} type
|
|
69
69
|
* @property {import('@astryxdesign/cli/authoring').ReferenceSection} data
|
package/api/hook/hook.type.d.mts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
export type HookDoc = import("@astryxdesign/cli/authoring").HookDoc;
|
|
5
5
|
export type HookParamDoc = import("@astryxdesign/cli/authoring").HookParamDoc;
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
7
|
+
* xds --json hook [--list] [--category X] [--detail names|compact|full]
|
|
8
8
|
*
|
|
9
9
|
* The list view emits ONE `hook.list` type across all three detail levels; the
|
|
10
10
|
* depth is carried in `data.detail` and `data.components` holds the grouped map
|
|
@@ -39,14 +39,14 @@ export type HookBriefEntry = {
|
|
|
39
39
|
import: string;
|
|
40
40
|
};
|
|
41
41
|
/**
|
|
42
|
-
*
|
|
42
|
+
* xds --json hook <name>
|
|
43
43
|
*/
|
|
44
44
|
export type HookDetailResponse = {
|
|
45
45
|
type: "hook.detail";
|
|
46
46
|
data: HookDoc;
|
|
47
47
|
};
|
|
48
48
|
/**
|
|
49
|
-
*
|
|
49
|
+
* xds --json hook <name> --params
|
|
50
50
|
*/
|
|
51
51
|
export type HookDetailParamsResponse = {
|
|
52
52
|
type: "hook.detail.params";
|
package/api/hook/hook.type.mjs
CHANGED
|
@@ -11,14 +11,14 @@
|
|
|
11
11
|
*
|
|
12
12
|
* Invocation -> type discriminator
|
|
13
13
|
* ------------------------------------------------------------------
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* (not found)
|
|
14
|
+
* xds --json hook -> hook.list (data.detail='names')
|
|
15
|
+
* xds --json hook --list -> hook.list (data.detail='names')
|
|
16
|
+
* xds --json hook --category State -> hook.list (filtered)
|
|
17
|
+
* xds --json hook --list --detail compact -> hook.list (data.detail='compact')
|
|
18
|
+
* xds --json hook --list --detail full -> hook.list (data.detail='full')
|
|
19
|
+
* xds --json hook useMediaQuery -> hook.detail
|
|
20
|
+
* xds --json hook useMediaQuery --params -> hook.detail.params
|
|
21
|
+
* (not found) -> CLIError
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
24
|
// Re-export the authored-doc types from core so the hook leaves reference these
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
/** @typedef {import('@astryxdesign/cli/authoring').HookParamDoc} HookParamDoc */
|
|
29
29
|
|
|
30
30
|
/**
|
|
31
|
-
*
|
|
31
|
+
* xds --json hook [--list] [--category X] [--detail names|compact|full]
|
|
32
32
|
*
|
|
33
33
|
* The list view emits ONE `hook.list` type across all three detail levels; the
|
|
34
34
|
* depth is carried in `data.detail` and `data.components` holds the grouped map
|
|
@@ -56,14 +56,14 @@
|
|
|
56
56
|
*/
|
|
57
57
|
|
|
58
58
|
/**
|
|
59
|
-
*
|
|
59
|
+
* xds --json hook <name>
|
|
60
60
|
* @typedef {object} HookDetailResponse
|
|
61
61
|
* @property {'hook.detail'} type
|
|
62
62
|
* @property {HookDoc} data
|
|
63
63
|
*/
|
|
64
64
|
|
|
65
65
|
/**
|
|
66
|
-
*
|
|
66
|
+
* xds --json hook <name> --params
|
|
67
67
|
* @typedef {object} HookDetailParamsResponse
|
|
68
68
|
* @property {'hook.detail.params'} type
|
|
69
69
|
* @property {HookParamDoc[]} data
|
|
@@ -250,8 +250,7 @@ async function addComponent(name, options) {
|
|
|
250
250
|
}
|
|
251
251
|
|
|
252
252
|
const sourcePath = projectPath(path.relative(packageDir, sourceFile));
|
|
253
|
-
const
|
|
254
|
-
const importSpecifier = `${owner}/${extensionlessPath}`;
|
|
253
|
+
const importSpecifier = `${owner}/${sourcePath}`;
|
|
255
254
|
const docContents = `export default {\n type: 'component',\n name: '${name}',\n import: ${JSON.stringify(importSpecifier)},\n description: '${name} component.',\n props: [],\n};\n`;
|
|
256
255
|
const sourceContents = `export function ${name}() {\n return <div>${name}</div>;\n}\n`;
|
|
257
256
|
|
|
@@ -264,7 +263,7 @@ async function addComponent(name, options) {
|
|
|
264
263
|
packageFile,
|
|
265
264
|
rootPath,
|
|
266
265
|
path.basename(manifestFile),
|
|
267
|
-
[{subpath:
|
|
266
|
+
[{subpath: sourcePath, target: sourcePath}],
|
|
268
267
|
);
|
|
269
268
|
if (pkgUpdate != null) {
|
|
270
269
|
plans.push({
|
|
@@ -577,7 +576,6 @@ async function addTemplate(name, options) {
|
|
|
577
576
|
|
|
578
577
|
const pascalName = kebabToPascal(name);
|
|
579
578
|
const sourcePath = projectPath(path.relative(packageDir, sourceFile));
|
|
580
|
-
const extensionlessPath = sourcePath.replace(/\.tsx?$/u, '');
|
|
581
579
|
const specContents = `export default {\n type: '${templateType}',\n name: '${name}',\n description: '${kebabToTitle(name)} template.',\n};\n`;
|
|
582
580
|
const sourceContents = `export default function ${pascalName}() {\n return <div>${kebabToTitle(name)}</div>;\n}\n`;
|
|
583
581
|
|
|
@@ -590,7 +588,7 @@ async function addTemplate(name, options) {
|
|
|
590
588
|
packageFile,
|
|
591
589
|
rootPath,
|
|
592
590
|
path.basename(manifestFile),
|
|
593
|
-
[{subpath:
|
|
591
|
+
[{subpath: sourcePath, target: sourcePath}],
|
|
594
592
|
);
|
|
595
593
|
if (pkgUpdate != null) {
|
|
596
594
|
plans.push({
|
|
@@ -118,14 +118,14 @@ describe('integrationAdd component', () => {
|
|
|
118
118
|
);
|
|
119
119
|
expect(pkg.exports).toEqual({
|
|
120
120
|
'.': './index.mjs',
|
|
121
|
-
'./components/MyWidget': './components/MyWidget.tsx',
|
|
121
|
+
'./components/MyWidget.tsx': './components/MyWidget.tsx',
|
|
122
122
|
});
|
|
123
123
|
expect(
|
|
124
124
|
fs.readFileSync(
|
|
125
125
|
path.join(tmpDir, 'components/MyWidget.doc.mjs'),
|
|
126
126
|
'utf-8',
|
|
127
127
|
),
|
|
128
|
-
).toContain('import: "@acme/integration/components/MyWidget"');
|
|
128
|
+
).toContain('import: "@acme/integration/components/MyWidget.tsx"');
|
|
129
129
|
});
|
|
130
130
|
|
|
131
131
|
it('does not create exports when the package has no exports map', async () => {
|
|
@@ -143,7 +143,7 @@ describe('integrationAdd component', () => {
|
|
|
143
143
|
setup({
|
|
144
144
|
exports: {
|
|
145
145
|
'.': './index.mjs',
|
|
146
|
-
'./components/MyWidget': './different.tsx',
|
|
146
|
+
'./components/MyWidget.tsx': './different.tsx',
|
|
147
147
|
},
|
|
148
148
|
});
|
|
149
149
|
|
|
@@ -421,7 +421,7 @@ describe('integrationAdd template', () => {
|
|
|
421
421
|
);
|
|
422
422
|
expect(pkg.exports).toEqual({
|
|
423
423
|
'.': './index.mjs',
|
|
424
|
-
'./templates/my-widget': './templates/my-widget.tsx',
|
|
424
|
+
'./templates/my-widget.tsx': './templates/my-widget.tsx',
|
|
425
425
|
});
|
|
426
426
|
});
|
|
427
427
|
|
|
@@ -388,14 +388,6 @@ async function validatePackedComponentExports(integration, scratchBase) {
|
|
|
388
388
|
components.map(component => component.specifier),
|
|
389
389
|
scratchBase,
|
|
390
390
|
);
|
|
391
|
-
issues.push(
|
|
392
|
-
...validateSpecifierExtensions(
|
|
393
|
-
components.map(({name, specifier}) => ({
|
|
394
|
-
label: `Component "${name}"`,
|
|
395
|
-
specifier,
|
|
396
|
-
})),
|
|
397
|
-
),
|
|
398
|
-
);
|
|
399
391
|
for (const {name, specifier} of components) {
|
|
400
392
|
const result = resolved.get(specifier);
|
|
401
393
|
if (!result?.url || result.error) {
|
|
@@ -435,27 +427,19 @@ async function validatePackedComponentExports(integration, scratchBase) {
|
|
|
435
427
|
*/
|
|
436
428
|
async function validatePackedTemplateExports(integration, scratchBase) {
|
|
437
429
|
const {templates} = await discoverIntegrationTemplatesForOne(integration);
|
|
438
|
-
const entries = templates.map(template => {
|
|
439
|
-
|
|
430
|
+
const entries = templates.map(template => ({
|
|
431
|
+
id: template.dirName,
|
|
432
|
+
specifier: `${integration.name}/${path
|
|
440
433
|
.relative(integration.__packageDir, template.filePath)
|
|
441
434
|
.split(path.sep)
|
|
442
|
-
.join('/')
|
|
443
|
-
|
|
444
|
-
return {
|
|
445
|
-
id: template.dirName,
|
|
446
|
-
specifier: `${integration.name}/${extensionless}`,
|
|
447
|
-
};
|
|
448
|
-
});
|
|
435
|
+
.join('/')}`,
|
|
436
|
+
}));
|
|
449
437
|
const resolved = resolveConsumerSpecifiers(
|
|
450
438
|
entries.map(entry => entry.specifier),
|
|
451
439
|
scratchBase,
|
|
452
440
|
);
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
label: `Template "${id}"`,
|
|
456
|
-
specifier,
|
|
457
|
-
})),
|
|
458
|
-
);
|
|
441
|
+
/** @type {Issue[]} */
|
|
442
|
+
const issues = [];
|
|
459
443
|
for (const {id, specifier} of entries) {
|
|
460
444
|
const result = resolved.get(specifier);
|
|
461
445
|
if (!result?.url || result.error) {
|
|
@@ -485,32 +469,6 @@ async function validatePackedTemplateExports(integration, scratchBase) {
|
|
|
485
469
|
return issues;
|
|
486
470
|
}
|
|
487
471
|
|
|
488
|
-
const TS_EXTENSION_RE = /\.tsx?$/u;
|
|
489
|
-
|
|
490
|
-
/**
|
|
491
|
-
* Reject specifiers that end in a TypeScript extension — they fail under
|
|
492
|
-
* default `moduleResolution` with TS5097/TS2307 unless the consumer enables
|
|
493
|
-
* `allowImportingTsExtensions`.
|
|
494
|
-
*
|
|
495
|
-
* @param {Array<{label: string, specifier: string}>} entries
|
|
496
|
-
* @returns {Issue[]}
|
|
497
|
-
*/
|
|
498
|
-
function validateSpecifierExtensions(entries) {
|
|
499
|
-
/** @type {Issue[]} */
|
|
500
|
-
const issues = [];
|
|
501
|
-
for (const {label, specifier} of entries) {
|
|
502
|
-
if (TS_EXTENSION_RE.test(specifier)) {
|
|
503
|
-
issues.push(
|
|
504
|
-
error(
|
|
505
|
-
'typescript_extension_in_specifier',
|
|
506
|
-
`${label} advertises import "${specifier}", which ends in a TypeScript extension. A consumer with default moduleResolution will reject it (TS5097). Use an extensionless specifier mapped through the package exports.`,
|
|
507
|
-
),
|
|
508
|
-
);
|
|
509
|
-
}
|
|
510
|
-
}
|
|
511
|
-
return issues;
|
|
512
|
-
}
|
|
513
|
-
|
|
514
472
|
/**
|
|
515
473
|
* Verify an integration package is ready to publish.
|
|
516
474
|
*
|