@astryxdesign/cli 0.7.11-canary.ec945c9 → 0.7.11

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 (64) hide show
  1. package/CHANGELOG.md +51 -0
  2. package/api/build/kit/rank.mjs +4 -21
  3. package/api/build/kit/words.d.mts +0 -1
  4. package/api/build/kit/words.mjs +1 -1
  5. package/api/icon/_adapter.d.mts +2 -3
  6. package/api/icon/_adapter.mjs +2 -8
  7. package/api/icon/_authoring.d.mts +0 -1
  8. package/api/icon/_authoring.mjs +66 -586
  9. package/api/icon/_records.d.mts +1 -1
  10. package/api/icon/_records.mjs +0 -1
  11. package/api/icon/add/add.mjs +38 -224
  12. package/api/icon/icon.type.d.mts +2 -22
  13. package/api/icon/icon.type.mjs +2 -6
  14. package/api/icon/iconAdd.doc.mjs +2 -2
  15. package/api/icon/iconNewDefinition.doc.mjs +2 -3
  16. package/api/icon/iconNewSet.doc.mjs +4 -4
  17. package/api/icon/search/search.mjs +9 -10
  18. package/api/integration/add-helpers.d.mts +1 -11
  19. package/api/integration/add-helpers.mjs +2 -5
  20. package/api/integration/authoring-checks.d.mts +2 -0
  21. package/api/integration/authoring-checks.mjs +6 -1
  22. package/api/logger.mjs +1 -2
  23. package/api/swizzle/_adapter.d.mts +0 -1
  24. package/api/swizzle/_adapter.mjs +1 -4
  25. package/api/swizzle/copy/copy.d.mts +43 -2
  26. package/api/swizzle/copy/copy.mjs +314 -194
  27. package/api/swizzle/swizzle.d.mts +2 -0
  28. package/api/swizzle/swizzle.doc.mjs +4 -8
  29. package/api/swizzle/swizzle.mjs +7 -3
  30. package/api/swizzle/swizzle.type.d.mts +1 -1
  31. package/api/swizzle/swizzle.type.mjs +2 -2
  32. package/assets/discover/official-packages.json +0 -12
  33. package/assets/docs/tree/icon-sets.doc.mjs +5 -11
  34. package/assets/templates/pages/file-explorer/page.tsx +79 -103
  35. package/assets/templates/pages/table-grouped/page.tsx +232 -160
  36. package/assets/templates/pages/table-grouped/template.doc.mjs +2 -0
  37. package/assets/templates/pages/theme-showcase/page.tsx +792 -724
  38. package/assets/templates/pages/theme-showcase/template.doc.mjs +5 -4
  39. package/clients/cli/commands/experimental/icon.mjs +10 -31
  40. package/clients/cli/commands/experimental-icon-add.doc.mjs +1 -1
  41. package/clients/cli/commands/experimental-icon-new-definition.doc.mjs +1 -2
  42. package/clients/cli/commands/experimental-icon-new-set.doc.mjs +2 -2
  43. package/clients/cli/commands/swizzle.doc.mjs +3 -6
  44. package/clients/cli/commands/swizzle.mjs +9 -8
  45. package/foundation/discovery/component-loader.d.mts +1 -1
  46. package/foundation/discovery/doc-types.mjs +2 -9
  47. package/foundation/discovery/icon-ranking.d.mts +3 -27
  48. package/foundation/discovery/icon-ranking.mjs +8 -125
  49. package/foundation/discovery/icon-set-checks.mjs +35 -44
  50. package/foundation/discovery/icon-set-discovery.d.mts +0 -13
  51. package/foundation/discovery/icon-set-discovery.mjs +0 -25
  52. package/foundation/discovery/icon-set-writer.d.mts +16 -238
  53. package/foundation/discovery/icon-set-writer.mjs +79 -676
  54. package/foundation/discovery/module-exports.d.mts +2 -3
  55. package/foundation/discovery/module-exports.mjs +37 -167
  56. package/foundation/fs/paths.d.mts +1 -2
  57. package/foundation/fs/paths.mjs +4 -3
  58. package/package.json +6 -6
  59. package/api/icon/_default-look.d.mts +0 -155
  60. package/api/icon/_default-look.mjs +0 -474
  61. package/api/swizzle/_moduleGraph.d.mts +0 -162
  62. package/api/swizzle/_moduleGraph.mjs +0 -754
  63. package/foundation/text/shell-arg.d.mts +0 -14
  64. package/foundation/text/shell-arg.mjs +0 -17
@@ -131,10 +131,7 @@ export function packageJsonFilesUpdate(
131
131
  }
132
132
  }
133
133
 
134
- if (
135
- (pkg.exports !== undefined || createExports) &&
136
- publicExports.length > 0
137
- ) {
134
+ if ((pkg.exports !== undefined || createExports) && publicExports.length > 0) {
138
135
  const authored = pkg.exports;
139
136
  /** @type {Record<string, unknown>} */
140
137
  let exportsMap;
@@ -486,7 +483,7 @@ export async function loadCurrentManifest(manifestFile, manifestExists) {
486
483
  * @param {string} manifestPath
487
484
  * @param {string[]} files
488
485
  * @param {boolean} dryRun
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[]}}}
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[]}}}
490
487
  */
491
488
  export function receipt(kind, name, root, manifestPath, files, dryRun) {
492
489
  return {
@@ -1,6 +1,8 @@
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;
4
6
  /**
5
7
  * Find integration template ids that are also owned by Core.
6
8
  * @param {string} [pkg] Installed integration package; omit for the local package.
@@ -57,7 +57,12 @@ 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
- import {shellArg} from '../../foundation/text/shell-arg.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
+ }
61
66
 
62
67
  /**
63
68
  * The provider ID a package without a name is checked under: a valid bare
package/api/logger.mjs CHANGED
@@ -3,8 +3,7 @@
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`, the experimental icon commands)
7
- * writes progress through.
6
+ * command (`upgrade`, `init`, `themeBuild`) writes progress through.
8
7
  *
9
8
  * It is silent by default, so a programmatic caller (or `--json` mode) sees
10
9
  * nothing but the returned `{type, data}`. The CLI calls `logger.setSilent(false)`
@@ -30,4 +30,3 @@ 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,8 +9,7 @@
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, and so is the copy's
13
- * module graph (_moduleGraph.mjs), which reads the owner package's source.
12
+ * lookup is here too, on the shared search-path walk.
14
13
  */
15
14
 
16
15
  import {executablesOnSearchPath} from '../../foundation/env/search-path.mjs';
@@ -19,8 +18,6 @@ import {resolveComponentReplacements} from '../../foundation/discovery/component
19
18
  import {ERROR_CODES} from '../../foundation/response/error-codes.mjs';
20
19
  import {AstryxError} from '../error.mjs';
21
20
 
22
- export {planCopy, relativeSpecifierBetween, renderFile} from './_moduleGraph.mjs';
23
-
24
21
  /**
25
22
  * Whether an executable `gh` is on `PATH` (with a `PATHEXT` extension on
26
23
  * Windows), found without running it. The copy receipt offers its
@@ -1,10 +1,51 @@
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
+ /**
5
+ * Rewrite relative imports that point outside the component directory to use
6
+ * the OWNER package's subpaths. Imports within the copied directory (./x) are
7
+ * left untouched.
8
+ *
9
+ * e.g. with ownerPackage '@astryxdesign/core':
10
+ * '../theme/tokens.stylex' -> '@astryxdesign/core/theme/tokens.stylex'
11
+ * '../utils/mergeProps' -> '@astryxdesign/core/utils'
12
+ * '../../locales/en.json' -> '@astryxdesign/core/locales/en.json'
13
+ * import('../Tooltip/Tooltip') -> import('@astryxdesign/core/Tooltip')
14
+ *
15
+ * Most sibling dirs are barrels, so the top-dir collapse (`../utils/x` ->
16
+ * `<pkg>/utils`) resolves. Two shapes must NOT be collapsed to the top dir:
17
+ * - Asset files (`.json`, `.css`): exported by full subpath (e.g.
18
+ * `./locales/*.json`, `./reset.css`), and collapsing a two-levels-up
19
+ * `../../locales/x.json` would emit the invalid `<pkg>/..`.
20
+ * - StyleX modules (`*.stylex`): the StyleX compiler needs the real module
21
+ * path so it can resolve the styles at compile time. The barrel re-export
22
+ * loses the module identity. Core exports every `.stylex` file by its
23
+ * deep subpath (e.g. `./utils/focusOutline.stylex`,
24
+ * `./theme/tokens.stylex`).
25
+ *
26
+ * @param {string} content
27
+ * @param {string} [ownerPackage]
28
+ * @param {(importPath: string) => boolean} [keep] Imports to leave relative:
29
+ * the modules the copy carries in the same layout (see `sharedModulesOf`).
30
+ */
31
+ export function rewriteImports(content: string, ownerPackage?: string, keep?: (importPath: string) => boolean): string;
32
+ /**
33
+ * The modules a copy carries beside the component, in the package's own
34
+ * layout under the output directory (`spec:AST-110` FR4): each private
35
+ * attribute owner module the component imports, and every unexported StyleX
36
+ * module such a carried module imports, transitively. The component's own
37
+ * imports of them, and theirs of each other, stay relative.
38
+ *
39
+ * @param {string} srcRoot the owner package's source root
40
+ * @param {string} componentDir
41
+ * @param {string[]} componentFiles files of the component that are copied
42
+ * @returns {Map<string, string>} module path (relative to srcRoot, no
43
+ * extension) -> its file path relative to srcRoot
44
+ */
45
+ export function sharedModulesOf(srcRoot: string, componentDir: string, componentFiles: string[]): Map<string, string>;
4
46
  /**
5
47
  * Copy one component's source into the consumer project for customization,
6
- * with the internal modules it needs and its imports of the owner package's
7
- * public paths.
48
+ * rewriting escaping relative imports to the owner package's subpaths.
8
49
  *
9
50
  * @param {string} component bare or XDS-prefixed component name
10
51
  * @param {{cwd?: string, output?: string, package?: string, overwrite?: boolean}} [options]