@astryxdesign/cli 0.7.11 → 0.7.12-canary.ccb4a6d

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.
Files changed (68) hide show
  1. package/api/build/kit/rank.mjs +21 -4
  2. package/api/build/kit/words.d.mts +1 -0
  3. package/api/build/kit/words.mjs +1 -1
  4. package/api/icon/_adapter.d.mts +3 -2
  5. package/api/icon/_adapter.mjs +8 -2
  6. package/api/icon/_authoring.d.mts +1 -0
  7. package/api/icon/_authoring.mjs +586 -66
  8. package/api/icon/_default-look.d.mts +155 -0
  9. package/api/icon/_default-look.mjs +474 -0
  10. package/api/icon/_records.d.mts +1 -1
  11. package/api/icon/_records.mjs +1 -0
  12. package/api/icon/add/add.mjs +224 -38
  13. package/api/icon/icon.type.d.mts +22 -2
  14. package/api/icon/icon.type.mjs +6 -2
  15. package/api/icon/iconAdd.doc.mjs +2 -2
  16. package/api/icon/iconNewDefinition.doc.mjs +3 -2
  17. package/api/icon/iconNewSet.doc.mjs +4 -4
  18. package/api/icon/search/search.mjs +10 -9
  19. package/api/integration/add-helpers.d.mts +11 -1
  20. package/api/integration/add-helpers.mjs +5 -2
  21. package/api/integration/authoring-checks.d.mts +0 -2
  22. package/api/integration/authoring-checks.mjs +1 -6
  23. package/api/logger.mjs +2 -1
  24. package/api/swizzle/_adapter.d.mts +1 -0
  25. package/api/swizzle/_adapter.mjs +4 -1
  26. package/api/swizzle/_moduleGraph.d.mts +171 -0
  27. package/api/swizzle/_moduleGraph.mjs +795 -0
  28. package/api/swizzle/copy/copy.d.mts +2 -43
  29. package/api/swizzle/copy/copy.mjs +195 -314
  30. package/api/swizzle/swizzle.d.mts +0 -2
  31. package/api/swizzle/swizzle.doc.mjs +9 -4
  32. package/api/swizzle/swizzle.mjs +3 -7
  33. package/api/swizzle/swizzle.type.d.mts +2 -1
  34. package/api/swizzle/swizzle.type.mjs +3 -2
  35. package/assets/discover/official-packages.json +20 -0
  36. package/assets/docs/tree/icon-sets.doc.mjs +11 -5
  37. package/assets/templates/blocks/components/Table/TableRowIndexTable.doc.mjs +1 -1
  38. package/assets/templates/blocks/components/Table/TableRowIndexTable.tsx +2 -2
  39. package/assets/templates/pages/course-detail/page.tsx +699 -0
  40. package/assets/templates/pages/course-detail/template.doc.mjs +37 -0
  41. package/assets/templates/pages/file-explorer/page.tsx +103 -79
  42. package/assets/templates/pages/table-grouped/page.tsx +160 -232
  43. package/assets/templates/pages/table-grouped/template.doc.mjs +0 -2
  44. package/assets/templates/pages/theme-showcase/page.tsx +724 -792
  45. package/assets/templates/pages/theme-showcase/template.doc.mjs +4 -5
  46. package/authoring/doctypes/template/type.ts +1 -0
  47. package/clients/cli/commands/experimental/icon.mjs +31 -10
  48. package/clients/cli/commands/experimental-icon-add.doc.mjs +1 -1
  49. package/clients/cli/commands/experimental-icon-new-definition.doc.mjs +2 -1
  50. package/clients/cli/commands/experimental-icon-new-set.doc.mjs +2 -2
  51. package/clients/cli/commands/swizzle.doc.mjs +8 -3
  52. package/clients/cli/commands/swizzle.mjs +21 -9
  53. package/foundation/discovery/component-loader.d.mts +1 -1
  54. package/foundation/discovery/doc-types.mjs +9 -2
  55. package/foundation/discovery/icon-ranking.d.mts +27 -3
  56. package/foundation/discovery/icon-ranking.mjs +125 -8
  57. package/foundation/discovery/icon-set-checks.mjs +44 -35
  58. package/foundation/discovery/icon-set-discovery.d.mts +13 -0
  59. package/foundation/discovery/icon-set-discovery.mjs +25 -0
  60. package/foundation/discovery/icon-set-writer.d.mts +238 -16
  61. package/foundation/discovery/icon-set-writer.mjs +676 -79
  62. package/foundation/discovery/module-exports.d.mts +3 -2
  63. package/foundation/discovery/module-exports.mjs +167 -37
  64. package/foundation/fs/paths.d.mts +2 -1
  65. package/foundation/fs/paths.mjs +3 -4
  66. package/foundation/text/shell-arg.d.mts +14 -0
  67. package/foundation/text/shell-arg.mjs +17 -0
  68. package/package.json +6 -6
@@ -131,7 +131,10 @@ export function packageJsonFilesUpdate(
131
131
  }
132
132
  }
133
133
 
134
- if ((pkg.exports !== undefined || createExports) && publicExports.length > 0) {
134
+ if (
135
+ (pkg.exports !== undefined || createExports) &&
136
+ publicExports.length > 0
137
+ ) {
135
138
  const authored = pkg.exports;
136
139
  /** @type {Record<string, unknown>} */
137
140
  let exportsMap;
@@ -483,7 +486,7 @@ export async function loadCurrentManifest(manifestFile, manifestExists) {
483
486
  * @param {string} manifestPath
484
487
  * @param {string[]} files
485
488
  * @param {boolean} dryRun
486
- * @returns {{type: 'integration.add', data: Omit<import('./integration-authoring.type.mjs').IntegrationAddData, 'kind'> & {kind: K, icons?: number, refreshed?: boolean, renamed?: Array<{from: string, to: string}>, mapped?: Array<{definition: string, icon: string}>, suggestions?: Array<{definition: string, icon: string, word: string}>, notes?: string[]}}}
489
+ * @returns {{type: 'integration.add', data: Omit<import('./integration-authoring.type.mjs').IntegrationAddData, 'kind'> & {kind: K, icons?: number, refreshed?: boolean, updated?: boolean, renamed?: Array<{from: string, to: string}>, moved?: Array<{id: string, from: string, to: string}>, licenseNoticeMissing?: {library: string, path: string}, mapped?: Array<{definition: string, icon: string}>, suggestions?: Array<{definition: string, icon: string, word: string}>, notes?: string[]}}}
487
490
  */
488
491
  export function receipt(kind, name, root, manifestPath, files, dryRun) {
489
492
  return {
@@ -1,8 +1,6 @@
1
1
  // @generated by scripts/sync-api-types.mjs from the JSDoc in api/**/*.mjs.
2
2
  // DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
3
3
 
4
- /** @param {string} value */
5
- export function shellArg(value: string): string;
6
4
  /**
7
5
  * Find integration template ids that are also owned by Core.
8
6
  * @param {string} [pkg] Installed integration package; omit for the local package.
@@ -57,12 +57,7 @@ import {
57
57
  } from './validate-integration.mjs';
58
58
  import {rootProblem} from '../../foundation/integrations/validate-contributions.mjs';
59
59
  import {normalizeProviderId} from '../../foundation/identity/provider-identity.mjs';
60
-
61
- /** @param {string} value */
62
- export function shellArg(value) {
63
- if (/^[A-Za-z0-9@/._-]+$/.test(value)) return value;
64
- return `'${value.replace(/'/g, `'\\''`)}'`;
65
- }
60
+ import {shellArg} from '../../foundation/text/shell-arg.mjs';
66
61
 
67
62
  /**
68
63
  * The provider ID a package without a name is checked under: a valid bare
package/api/logger.mjs CHANGED
@@ -3,7 +3,8 @@
3
3
  /**
4
4
  * @file The one `Logger`. Source of truth: the `Logger` type is generated from
5
5
  * the JSDoc here, and `logger` is the single instance every side-effecting
6
- * command (`upgrade`, `init`, `themeBuild`) writes progress through.
6
+ * command (`upgrade`, `init`, `themeBuild`, the experimental icon commands)
7
+ * writes progress through.
7
8
  *
8
9
  * It is silent by default, so a programmatic caller (or `--json` mode) sees
9
10
  * nothing but the returned `{type, data}`. The CLI calls `logger.setSilent(false)`
@@ -30,3 +30,4 @@ export function resolveCore(cwd: string): {
30
30
  components: string[];
31
31
  };
32
32
  export { CORE_PROVIDER_ID as CORE_PACKAGE } from "../../foundation/identity/providers.mjs";
33
+ export { planCopy, relativeSpecifierBetween, renderFile } from "./_moduleGraph.mjs";
@@ -9,7 +9,8 @@
9
9
  * for its "component not found" suggestions. Resolving core + listing lives
10
10
  * here once so neither leaf re-walks the filesystem. Throws AstryxError
11
11
  * (ERR_CORE_NOT_FOUND) when core can't be located. The copy receipt's `gh`
12
- * lookup is here too, on the shared search-path walk.
12
+ * lookup is here too, on the shared search-path walk, and so is the copy's
13
+ * module graph (_moduleGraph.mjs), which reads the owner package's source.
13
14
  */
14
15
 
15
16
  import {executablesOnSearchPath} from '../../foundation/env/search-path.mjs';
@@ -18,6 +19,8 @@ import {resolveComponentReplacements} from '../../foundation/discovery/component
18
19
  import {ERROR_CODES} from '../../foundation/response/error-codes.mjs';
19
20
  import {AstryxError} from '../error.mjs';
20
21
 
22
+ export {planCopy, relativeSpecifierBetween, renderFile} from './_moduleGraph.mjs';
23
+
21
24
  /**
22
25
  * Whether an executable `gh` is on `PATH` (with a `PATHEXT` extension on
23
26
  * Windows), found without running it. The copy receipt offers its
@@ -0,0 +1,171 @@
1
+ // @generated by scripts/sync-api-types.mjs from the JSDoc in api/**/*.mjs.
2
+ // DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
3
+
4
+ /**
5
+ * A specifier that is either fixed (a public subpath) or computed from where
6
+ * two copied files land.
7
+ * @typedef {string | {from: string, to: string}} SpecifierChoice
8
+ *
9
+ * @typedef {object} PlannedEdit
10
+ * @property {number} start
11
+ * @property {number} end
12
+ * @property {(specifierOf: (choice: SpecifierChoice) => string) => string} render
13
+ *
14
+ * @typedef {object} CopyPlan
15
+ * @property {Map<string, {code: string, edits: PlannedEdit[]}>} files every
16
+ * file the copy holds (absolute source path), with the edits its imports need
17
+ * @property {Map<string, Set<string>>} dependsOn file -> carried files its
18
+ * computed specifiers point at
19
+ * @property {Record<string, string>} dependencies each npm package the copied
20
+ * files import, other than the owner package and Node's built-in modules,
21
+ * with the range the owner package declares
22
+ */
23
+ /**
24
+ * Follow a component's module graph from its entry files and decide what the
25
+ * copy holds. A module inside the component folder is copied. A module
26
+ * outside it is reached through the owner package's public exports when every
27
+ * name taken from it is public there; otherwise the module that defines the
28
+ * name is copied, and imported by relative path. Tests, stories and docs are
29
+ * never reached, so they are never copied.
30
+ *
31
+ * @param {object} options
32
+ * @param {string} options.packageDir the owner package root
33
+ * @param {string} options.srcRoot its source root
34
+ * @param {string} options.componentDir
35
+ * @param {string} options.ownerPackage
36
+ * @param {string[]} options.entries absolute entry files of the component
37
+ * @returns {CopyPlan}
38
+ */
39
+ export function planCopy({ packageDir, srcRoot, componentDir, ownerPackage, entries, }: {
40
+ packageDir: string;
41
+ srcRoot: string;
42
+ componentDir: string;
43
+ ownerPackage: string;
44
+ entries: string[];
45
+ }): CopyPlan;
46
+ /**
47
+ * The source of a planned file with its edits applied.
48
+ * @param {{code: string, edits: PlannedEdit[]}} planned
49
+ * @param {(choice: SpecifierChoice) => string} specifierOf
50
+ */
51
+ export function renderFile(planned: {
52
+ code: string;
53
+ edits: PlannedEdit[];
54
+ }, specifierOf: (choice: SpecifierChoice) => string): string;
55
+ /**
56
+ * The relative specifier from one written file to another.
57
+ * @param {string} fromDest
58
+ * @param {string} toDest
59
+ */
60
+ export function relativeSpecifierBetween(fromDest: string, toDest: string): string;
61
+ export type ImportSpecifier = {
62
+ /**
63
+ * the exported name (`default` for a default import)
64
+ */
65
+ imported: string;
66
+ local: string;
67
+ typeOnly: boolean;
68
+ };
69
+ export type ModuleReference = {
70
+ kind: "named" | "namespace" | "sideEffect" | "dynamic" | "reexportAll" | "reexportNamed";
71
+ /**
72
+ * the specifier as written
73
+ */
74
+ source: string;
75
+ /**
76
+ * statement (or, for `import()`, string literal) start
77
+ */
78
+ start: number;
79
+ end: number;
80
+ /**
81
+ * the whole statement is `import type` / `export type`
82
+ */
83
+ typeOnly: boolean;
84
+ specifiers: ImportSpecifier[];
85
+ /**
86
+ * the local name of `* as X`
87
+ */
88
+ namespace?: string | undefined;
89
+ };
90
+ export type ParsedModule = {
91
+ code: string;
92
+ references: ModuleReference[];
93
+ /**
94
+ * names the module declares and exports
95
+ */
96
+ declares: Set<string>;
97
+ };
98
+ /**
99
+ * `value` reads runtime exports only;
100
+ * `type` reads type-only exports too
101
+ */
102
+ export type ExportKind = "value" | "type";
103
+ /**
104
+ * every name a module exports, with where it is declared
105
+ */
106
+ export type OriginsOf = (file: string, kind: ExportKind) => Map<string, {
107
+ file: string;
108
+ name: string;
109
+ }>;
110
+ /**
111
+ * `file#name` of a declaration -> the subpaths that export it, and as what
112
+ */
113
+ export type ExportersByOrigin = Map<string, Array<{
114
+ subpath: string;
115
+ name: string;
116
+ }>>;
117
+ export type PublicSurface = {
118
+ /**
119
+ * the subpaths
120
+ * that export each declaration as a value, and as a value or a type
121
+ */
122
+ byOrigin: Record<ExportKind, ExportersByOrigin>;
123
+ /**
124
+ * source file -> the subpath that
125
+ * exports exactly that file
126
+ */
127
+ byFile: Map<string, string>;
128
+ exportsField: Record<string, unknown> | undefined;
129
+ };
130
+ /**
131
+ * A specifier that is either fixed (a public subpath) or computed from where
132
+ * two copied files land.
133
+ */
134
+ export type SpecifierChoice = string | {
135
+ from: string;
136
+ to: string;
137
+ };
138
+ /**
139
+ * A specifier that is either fixed (a public subpath) or computed from where
140
+ * two copied files land.
141
+ */
142
+ export type PlannedEdit = {
143
+ start: number;
144
+ end: number;
145
+ render: (specifierOf: (choice: SpecifierChoice) => string) => string;
146
+ };
147
+ /**
148
+ * A specifier that is either fixed (a public subpath) or computed from where
149
+ * two copied files land.
150
+ */
151
+ export type CopyPlan = {
152
+ /**
153
+ * every
154
+ * file the copy holds (absolute source path), with the edits its imports need
155
+ */
156
+ files: Map<string, {
157
+ code: string;
158
+ edits: PlannedEdit[];
159
+ }>;
160
+ /**
161
+ * file -> carried files its
162
+ * computed specifiers point at
163
+ */
164
+ dependsOn: Map<string, Set<string>>;
165
+ /**
166
+ * each npm package the copied
167
+ * files import, other than the owner package and Node's built-in modules,
168
+ * with the range the owner package declares
169
+ */
170
+ dependencies: Record<string, string>;
171
+ };