@lablup/ui-common-cli 0.2.0-alpha.19 → 0.2.0-alpha.19.canary-20261020034030-36212c401
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/cli/agents.mjs +9 -3
- package/cli/paths.mjs +32 -5
- package/cli/rewrite.mjs +2 -5
- package/package.json +3 -3
package/cli/agents.mjs
CHANGED
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
forkedExports,
|
|
20
20
|
hiddenExports,
|
|
21
21
|
importAstryxInternal,
|
|
22
|
+
replacementNote,
|
|
22
23
|
uiCommonPackageJson,
|
|
23
24
|
} from "./paths.mjs";
|
|
24
25
|
import { rewriteOutput } from "./rewrite.mjs";
|
|
@@ -71,7 +72,7 @@ async function coreComponentCount() {
|
|
|
71
72
|
/** ui-common's own lines, appended to the rewritten Astryx block. */
|
|
72
73
|
function uiCommonSection({ version, astryxVersion, invocation }) {
|
|
73
74
|
const components = customExports()
|
|
74
|
-
.filter((c) => !c.legacy && !c.fork && /^[A-Z]/.test(c.name))
|
|
75
|
+
.filter((c) => !c.legacy && !c.fork && !c.wraps && /^[A-Z]/.test(c.name))
|
|
75
76
|
.map((c) => c.name);
|
|
76
77
|
const lines = [
|
|
77
78
|
`UI-COMMON (@lablup/ui-common v${version} wraps Astryx v${astryxVersion}):`,
|
|
@@ -84,9 +85,14 @@ function uiCommonSection({ version, astryxVersion, invocation }) {
|
|
|
84
85
|
`- Use ${entry.replacedBy} (@lablup/ui-common/${entry.replacedBy}), not ${entry.name}: ui-common hides ${entry.name}.`,
|
|
85
86
|
);
|
|
86
87
|
}
|
|
87
|
-
|
|
88
|
+
const replacements = forkedExports();
|
|
89
|
+
for (const fork of replacements.filter((f) => f.kind !== "wrapper")) {
|
|
90
|
+
lines.push(`- ${replacementNote(fork)}`);
|
|
91
|
+
}
|
|
92
|
+
const wrappers = replacements.filter((f) => f.kind === "wrapper");
|
|
93
|
+
if (wrappers.length > 0) {
|
|
88
94
|
lines.push(
|
|
89
|
-
`- ${
|
|
95
|
+
`- Form controls (${wrappers.map((w) => w.name).join(", ")}) are ui-common's Form.Item wrappers at Astryx's import paths: no label, description, isRequired or status message props. Use them inside Form.Item, which owns label, extra, rules and help; \`status\` is "error" | "warning" for the border only.`,
|
|
90
96
|
);
|
|
91
97
|
}
|
|
92
98
|
lines.push(
|
package/cli/paths.mjs
CHANGED
|
@@ -222,20 +222,30 @@ export function customExports(root = uiCommonRoot()) {
|
|
|
222
222
|
}
|
|
223
223
|
|
|
224
224
|
/**
|
|
225
|
-
* ui-common's own
|
|
226
|
-
* import paths as Astryx's, which exports.exclude.json hides
|
|
227
|
-
*
|
|
225
|
+
* ui-common's own versions of Astryx components, under the same names and
|
|
226
|
+
* import paths as Astryx's, which exports.exclude.json hides: copies with a
|
|
227
|
+
* fix and the same API (`kind: "fork"`, src/forks/), Form.Item wrappers that
|
|
228
|
+
* drop the field chrome (`kind: "wrapper"`, src/formControls/), and wrappers
|
|
229
|
+
* with the same API (`kind: "wrapped"`, Popover). `names`
|
|
230
|
+
* are the names a reader may meet it by; `from` is where a consumer imports
|
|
231
|
+
* it.
|
|
228
232
|
*
|
|
229
|
-
* @returns {Array<{name: string, from: string, names: string[], reason: string}>}
|
|
233
|
+
* @returns {Array<{name: string, kind: "fork" | "wrapper" | "wrapped", from: string, names: string[], reason: string}>}
|
|
230
234
|
*/
|
|
231
235
|
export function forkedExports() {
|
|
232
236
|
const exclusions = excludedExports();
|
|
233
237
|
return customExports()
|
|
234
|
-
.filter((c) => c.fork !== undefined)
|
|
238
|
+
.filter((c) => c.fork !== undefined || c.wraps !== undefined)
|
|
235
239
|
.map((c) => {
|
|
236
240
|
const exclusion = exclusions.find((e) => e.replacedBy === c.name);
|
|
237
241
|
return {
|
|
238
242
|
name: c.name,
|
|
243
|
+
kind:
|
|
244
|
+
c.wraps === undefined
|
|
245
|
+
? "fork"
|
|
246
|
+
: c.source.startsWith("formControls/")
|
|
247
|
+
? "wrapper"
|
|
248
|
+
: "wrapped",
|
|
239
249
|
from: `@lablup/ui-common/${c.subpath ?? exclusion?.name ?? ""}`,
|
|
240
250
|
names: exclusion?.exports ?? [c.name],
|
|
241
251
|
reason: exclusion?.reason ?? "",
|
|
@@ -243,6 +253,23 @@ export function forkedExports() {
|
|
|
243
253
|
});
|
|
244
254
|
}
|
|
245
255
|
|
|
256
|
+
/**
|
|
257
|
+
* What to tell a reader about one of `forkedExports()`.
|
|
258
|
+
*
|
|
259
|
+
* @param {{name: string, kind: "fork" | "wrapper" | "wrapped", from: string, reason: string}} entry
|
|
260
|
+
*/
|
|
261
|
+
export function replacementNote(entry) {
|
|
262
|
+
if (entry.kind === "wrapper") {
|
|
263
|
+
return (
|
|
264
|
+
`${entry.name} (${entry.from}) comes from ui-common: Astryx's, wrapped for Form.Item, same import path. ` +
|
|
265
|
+
`It takes no label, description, required or status message; Form.Item's label, extra, rules and help do.`
|
|
266
|
+
);
|
|
267
|
+
}
|
|
268
|
+
return entry.kind === "wrapped"
|
|
269
|
+
? `${entry.name} (${entry.from}) comes from ui-common: Astryx's, wrapped, same API and import path. ${entry.reason}`
|
|
270
|
+
: `${entry.name} (${entry.from}) comes from ui-common: its own copy of Astryx's, same API and import path. ${entry.reason}`;
|
|
271
|
+
}
|
|
272
|
+
|
|
246
273
|
/**
|
|
247
274
|
* The exclusions that hide an Astryx name behind a different one. A fork's
|
|
248
275
|
* exclusion is not one: the name stays, now ui-common's.
|
package/cli/rewrite.mjs
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* no quote, backslash or control character, so it is safe inside JSON string
|
|
6
6
|
* literals: `--json` output stays valid JSON.
|
|
7
7
|
*/
|
|
8
|
-
import { forkedExports, hiddenExports } from "./paths.mjs";
|
|
8
|
+
import { forkedExports, hiddenExports, replacementNote } from "./paths.mjs";
|
|
9
9
|
|
|
10
10
|
/** Astryx CLI subcommands. Used to tell `astryx component` from `astryx-base`. */
|
|
11
11
|
export const ASTRYX_COMMANDS = [
|
|
@@ -113,10 +113,7 @@ export function exclusionNotes(text, args = []) {
|
|
|
113
113
|
}
|
|
114
114
|
for (const fork of forkedExports()) {
|
|
115
115
|
if (fork.names.some(mentions)) {
|
|
116
|
-
notes.push(
|
|
117
|
-
`Note: ${fork.name} (${fork.from}) comes from ui-common: its own copy of ` +
|
|
118
|
-
`Astryx's, same API and import path. ${fork.reason}`,
|
|
119
|
-
);
|
|
116
|
+
notes.push(`Note: ${replacementNote(fork)}`);
|
|
120
117
|
}
|
|
121
118
|
}
|
|
122
119
|
return notes;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lablup/ui-common-cli",
|
|
3
|
-
"version": "0.2.0-alpha.19",
|
|
3
|
+
"version": "0.2.0-alpha.19.canary-20261020034030-36212c401",
|
|
4
4
|
"description": "The ui-common command line: the pinned Astryx CLI in @lablup/ui-common terms, the agent block, and the upgrade codemods",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Lablup Inc.",
|
|
@@ -42,9 +42,9 @@
|
|
|
42
42
|
"postcss-selector-parser": "^7.1.6"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
|
-
"@lablup/ui-common": "0.2.0-alpha.19"
|
|
45
|
+
"@lablup/ui-common": "0.2.0-alpha.19.canary-20261020034030-36212c401"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@lablup/ui-common": "0.2.0-alpha.19"
|
|
48
|
+
"@lablup/ui-common": "0.2.0-alpha.19.canary-20261020034030-36212c401"
|
|
49
49
|
}
|
|
50
50
|
}
|