inventive-ui 0.0.3 → 0.0.5
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/index.js +51 -11
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -190,7 +190,7 @@ var BANNER_COMPACT = [
|
|
|
190
190
|
var FULL_BANNER_WIDTH = 101;
|
|
191
191
|
function resolveCliVersion() {
|
|
192
192
|
try {
|
|
193
|
-
return true ? "0.0.
|
|
193
|
+
return true ? "0.0.5" : "1.0.0";
|
|
194
194
|
} catch {
|
|
195
195
|
return "1.0.0";
|
|
196
196
|
}
|
|
@@ -5303,11 +5303,28 @@ function loadPublicSlotContract(cwd = process.cwd()) {
|
|
|
5303
5303
|
return null;
|
|
5304
5304
|
}
|
|
5305
5305
|
}
|
|
5306
|
+
function slotRequiresPrefetch(entry) {
|
|
5307
|
+
if (entry.prefetch === true) return true;
|
|
5308
|
+
if (entry.prefetch === false) return false;
|
|
5309
|
+
if (entry.bootstrap === "sync") return true;
|
|
5310
|
+
return Array.isArray(entry.profile) && entry.profile.includes("critical");
|
|
5311
|
+
}
|
|
5306
5312
|
function contractEntryToBootstrapPolicy(entry) {
|
|
5307
|
-
|
|
5308
|
-
|
|
5313
|
+
return slotRequiresPrefetch(entry) ? "core" : "optional";
|
|
5314
|
+
}
|
|
5315
|
+
function validateSlotPrefetchPolicy(entry) {
|
|
5316
|
+
const type = entry.type ?? "?";
|
|
5317
|
+
const requires = slotRequiresPrefetch(entry);
|
|
5318
|
+
if (requires && entry.prefetch === false) {
|
|
5319
|
+
return `slot "${type}" is core/critical but prefetch is false`;
|
|
5320
|
+
}
|
|
5321
|
+
if ((entry.bootstrap === "sync" || Array.isArray(entry.profile) && entry.profile.includes("critical")) && entry.prefetch !== true) {
|
|
5322
|
+
return `slot "${type}" must declare prefetch: true (sync/critical peer hub)`;
|
|
5323
|
+
}
|
|
5324
|
+
if (!requires && entry.prefetch === true) {
|
|
5325
|
+
return `slot "${type}" declares prefetch: true but is not sync/critical`;
|
|
5309
5326
|
}
|
|
5310
|
-
return
|
|
5327
|
+
return null;
|
|
5311
5328
|
}
|
|
5312
5329
|
|
|
5313
5330
|
// src/utils/slot-emitters.ts
|
|
@@ -5805,11 +5822,12 @@ function validateGeneratedSlotImports(cwd = process.cwd()) {
|
|
|
5805
5822
|
);
|
|
5806
5823
|
return issues.map((issue) => issue);
|
|
5807
5824
|
}
|
|
5808
|
-
function renderGetComponentExpr(emitter) {
|
|
5825
|
+
function renderGetComponentExpr(emitter, _slotPropsType = "unknown") {
|
|
5809
5826
|
const access = emitter.lazyAccess.replace(/^\./, "").trim();
|
|
5810
5827
|
const parts = access.split(".").filter(Boolean);
|
|
5811
5828
|
const compName = emitter.componentName;
|
|
5812
5829
|
if (parts.length === 0) {
|
|
5830
|
+
assertJsIdentifier(compName, "component export");
|
|
5813
5831
|
return `resolveComponentExport(mod, ${JSON.stringify(compName)})`;
|
|
5814
5832
|
}
|
|
5815
5833
|
if (parts.length === 1) {
|
|
@@ -5824,7 +5842,11 @@ function renderGetComponentExpr(emitter) {
|
|
|
5824
5842
|
for (const part of rest) {
|
|
5825
5843
|
assertJsIdentifier(part, "component export member");
|
|
5826
5844
|
}
|
|
5827
|
-
const
|
|
5845
|
+
const rootName = root === "default" ? compName : root;
|
|
5846
|
+
if (rest.length === 1) {
|
|
5847
|
+
return `resolveComponentExport(mod, ${JSON.stringify(rootName)}, ${JSON.stringify(rest[0])})`;
|
|
5848
|
+
}
|
|
5849
|
+
const rootExpr = `resolveComponentExport(mod, ${JSON.stringify(rootName)})`;
|
|
5828
5850
|
return `${rootExpr}?.${rest.join(".")}`;
|
|
5829
5851
|
}
|
|
5830
5852
|
function writeComponentSlotFiles(cwd = process.cwd()) {
|
|
@@ -5855,6 +5877,16 @@ function writeComponentSlotFiles(cwd = process.cwd()) {
|
|
|
5855
5877
|
cwd
|
|
5856
5878
|
);
|
|
5857
5879
|
generationIssues.push(...emitterIssues.map((issue) => `- ${issue}`));
|
|
5880
|
+
const contract = loadPublicSlotContract(cwd);
|
|
5881
|
+
if (contract) {
|
|
5882
|
+
for (const entry of contract.slots ?? []) {
|
|
5883
|
+
if (!entry.public) continue;
|
|
5884
|
+
const prefetchError = validateSlotPrefetchPolicy(entry);
|
|
5885
|
+
if (prefetchError) {
|
|
5886
|
+
generationIssues.push(prefetchError);
|
|
5887
|
+
}
|
|
5888
|
+
}
|
|
5889
|
+
}
|
|
5858
5890
|
const slotPolicy = loadSlotBootstrapPolicy(cwd);
|
|
5859
5891
|
const coreEmitters = [];
|
|
5860
5892
|
const optionalEmitters = [];
|
|
@@ -5879,7 +5911,12 @@ function writeComponentSlotFiles(cwd = process.cwd()) {
|
|
|
5879
5911
|
if (fs15.existsSync(outPath)) fs15.removeSync(outPath);
|
|
5880
5912
|
continue;
|
|
5881
5913
|
}
|
|
5882
|
-
safeWriteFile(
|
|
5914
|
+
safeWriteFile(
|
|
5915
|
+
outPath,
|
|
5916
|
+
renderGroupedSlotFileContent(group.emitters, {
|
|
5917
|
+
prefetch: group.fileName === SLOT_GROUP_CORE_FILE
|
|
5918
|
+
})
|
|
5919
|
+
);
|
|
5883
5920
|
}
|
|
5884
5921
|
const existingSlots = fs15.existsSync(slotsDir) ? fs15.readdirSync(slotsDir).filter((f) => f.endsWith(".slot.tsx") || f.endsWith(".generated.tsx")) : [];
|
|
5885
5922
|
for (const file of existingSlots) {
|
|
@@ -5908,7 +5945,7 @@ function writeComponentSlotFiles(cwd = process.cwd()) {
|
|
|
5908
5945
|
);
|
|
5909
5946
|
}
|
|
5910
5947
|
}
|
|
5911
|
-
function renderGroupedSlotFileContent(emitters) {
|
|
5948
|
+
function renderGroupedSlotFileContent(emitters, options = {}) {
|
|
5912
5949
|
const needsComponentProps = emitters.some((emitter) => emitter.propsName === "Props");
|
|
5913
5950
|
const lines = [
|
|
5914
5951
|
"// Managed by iui. Do not edit manually.",
|
|
@@ -5955,7 +5992,10 @@ function renderGroupedSlotFileContent(emitters) {
|
|
|
5955
5992
|
const renderer = `${alias}Renderer`;
|
|
5956
5993
|
lines.push(`const ${renderer} = createEagerComponent<${alias}SlotProps>(`);
|
|
5957
5994
|
lines.push(` () => import(${escapeTsStringLiteral(emitter.lazyImportSpecifier)}),`);
|
|
5958
|
-
lines.push(` (mod) => ${renderGetComponentExpr(emitter)} as React.ComponentType<${alias}SlotProps>,`);
|
|
5995
|
+
lines.push(` (mod) => ${renderGetComponentExpr(emitter, `${alias}SlotProps`)} as React.ComponentType<${alias}SlotProps>,`);
|
|
5996
|
+
if (options.prefetch) {
|
|
5997
|
+
lines.push(" { prefetch: true },");
|
|
5998
|
+
}
|
|
5959
5999
|
lines.push(");", "");
|
|
5960
6000
|
lines.push(`registerSlot(${escapeTsStringLiteral(emitter.type)}, (slot) => {`);
|
|
5961
6001
|
lines.push(" const { type, ...props } = slot;");
|
|
@@ -8581,7 +8621,7 @@ async function updateCommand(opts = {}) {
|
|
|
8581
8621
|
const auth = await ensureAuthSession();
|
|
8582
8622
|
await ensureLicenseSession();
|
|
8583
8623
|
const inProject = isInsideProject();
|
|
8584
|
-
const currentCliVersion = true ? "0.0.
|
|
8624
|
+
const currentCliVersion = true ? "0.0.5" : "unknown";
|
|
8585
8625
|
const latestCliVersion = await fetchLatestCliVersion(auth.token);
|
|
8586
8626
|
const cliUpdateAvailable = latestCliVersion !== null && isVersionGreater(latestCliVersion, currentCliVersion);
|
|
8587
8627
|
if (latestCliVersion && cliUpdateAvailable) {
|
|
@@ -8863,7 +8903,7 @@ var AUTH_EXEMPT_COMMANDS = /* @__PURE__ */ new Set([
|
|
|
8863
8903
|
"doctor",
|
|
8864
8904
|
"list"
|
|
8865
8905
|
]);
|
|
8866
|
-
program.name("iui").description("The official CLI for the Inventive UI Design System").version(true ? "0.0.
|
|
8906
|
+
program.name("iui").description("The official CLI for the Inventive UI Design System").version(true ? "0.0.5" : "1.0.0").option("-C, --cwd <dir>", "Run as if started in the given directory").option("-q, --quiet", "Minimal output (also respects IUI_QUIET=1)").option("--no-color", "Disable ANSI colors");
|
|
8867
8907
|
program.command("login").description("Authenticate with GitHub and link your license").option("-f, --force", "Force re-authentication and register this device").option("--bootstrap", "After login, run optional setup prompts").action((opts) => loginCommand(opts));
|
|
8868
8908
|
program.command("logout").description("Remove stored credentials").action(logoutCommand);
|
|
8869
8909
|
program.command("whoami").description("Show authenticated identity and license details").action(whoamiCommand);
|