stera-ui 0.3.1 → 0.3.3
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/{chunk-26HP67ZM.js → chunk-QD7FOI3A.js} +43 -7
- package/dist/cli.js +135 -39
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -1
- package/dist/schema/index.d.ts +22 -22
- package/dist/utils/index.d.ts +13 -2
- package/dist/utils/index.js +3 -1
- package/package.json +1 -1
|
@@ -66,14 +66,22 @@ var TYPE_TO_ALIAS = {
|
|
|
66
66
|
};
|
|
67
67
|
function resolveAlias(alias, projectRoot) {
|
|
68
68
|
const tsConfig = loadConfig(projectRoot);
|
|
69
|
-
if (tsConfig.resultType === "success") {
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
69
|
+
if (tsConfig.resultType === "success" && Object.keys(tsConfig.paths).length > 0) {
|
|
70
|
+
const hasMatchingPrefix = Object.keys(tsConfig.paths).some((key) => {
|
|
71
|
+
const prefix = key.replace(/\/\*$/, "");
|
|
72
|
+
return alias === prefix || alias.startsWith(`${prefix}/`);
|
|
73
|
+
});
|
|
74
|
+
if (hasMatchingPrefix) {
|
|
75
|
+
const match = createMatchPath(tsConfig.absoluteBaseUrl, tsConfig.paths);
|
|
76
|
+
const resolved = match(alias, void 0, () => true, [".ts", ".tsx"]);
|
|
77
|
+
if (resolved) {
|
|
78
|
+
return path.relative(projectRoot, resolved);
|
|
79
|
+
}
|
|
74
80
|
}
|
|
75
81
|
}
|
|
76
|
-
|
|
82
|
+
throw new Error(
|
|
83
|
+
`Could not resolve alias "${alias}" from tsconfig.json. Ensure compilerOptions.paths defines a mapping for it (e.g. "${alias}/*"), then re-run. See https://ui.stera.sh/docs/installation.`
|
|
84
|
+
);
|
|
77
85
|
}
|
|
78
86
|
function resolveOutputPath(config, projectRoot, file) {
|
|
79
87
|
const alias = TYPE_TO_ALIAS[file.type];
|
|
@@ -129,6 +137,7 @@ function loadConfig2(cwd) {
|
|
|
129
137
|
// src/utils/detect-project.ts
|
|
130
138
|
import fs2 from "fs";
|
|
131
139
|
import path3 from "path";
|
|
140
|
+
import { loadConfig as loadConfig3 } from "tsconfig-paths";
|
|
132
141
|
function hasFile(cwd, filenames) {
|
|
133
142
|
return filenames.some((f) => fs2.existsSync(path3.join(cwd, f)));
|
|
134
143
|
}
|
|
@@ -182,6 +191,24 @@ function detectProject(cwd) {
|
|
|
182
191
|
}
|
|
183
192
|
return { hasSrc, framework, rsc, existingCssFile, layoutFile };
|
|
184
193
|
}
|
|
194
|
+
function detectAliasPrefix(cwd) {
|
|
195
|
+
let tsConfig;
|
|
196
|
+
try {
|
|
197
|
+
tsConfig = loadConfig3(cwd);
|
|
198
|
+
} catch {
|
|
199
|
+
return null;
|
|
200
|
+
}
|
|
201
|
+
if (tsConfig.resultType !== "success" || Object.keys(tsConfig.paths).length === 0) {
|
|
202
|
+
return null;
|
|
203
|
+
}
|
|
204
|
+
for (const [alias, targets] of Object.entries(tsConfig.paths)) {
|
|
205
|
+
if (targets.includes("./*") || targets.includes("./src/*") || targets.includes("./app/*")) {
|
|
206
|
+
return alias.replace(/\/\*$/, "");
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
const first = Object.keys(tsConfig.paths)[0];
|
|
210
|
+
return first ? first.replace(/\/\*$/, "") : null;
|
|
211
|
+
}
|
|
185
212
|
|
|
186
213
|
// src/utils/detect-globals.ts
|
|
187
214
|
import fs3 from "fs";
|
|
@@ -192,7 +219,15 @@ function hasGlobalsCss(config, projectRoot) {
|
|
|
192
219
|
return false;
|
|
193
220
|
}
|
|
194
221
|
const steraPath = path4.join(path4.dirname(cssPath), "stera-ui.css");
|
|
195
|
-
|
|
222
|
+
if (fs3.existsSync(steraPath)) {
|
|
223
|
+
return true;
|
|
224
|
+
}
|
|
225
|
+
try {
|
|
226
|
+
const contents = fs3.readFileSync(cssPath, "utf-8");
|
|
227
|
+
return contents.includes("--color-bg-surface");
|
|
228
|
+
} catch {
|
|
229
|
+
return false;
|
|
230
|
+
}
|
|
196
231
|
}
|
|
197
232
|
|
|
198
233
|
// src/utils/install-deps.ts
|
|
@@ -679,6 +714,7 @@ export {
|
|
|
679
714
|
findConfigPath,
|
|
680
715
|
loadConfig2 as loadConfig,
|
|
681
716
|
detectProject,
|
|
717
|
+
detectAliasPrefix,
|
|
682
718
|
hasGlobalsCss,
|
|
683
719
|
brand,
|
|
684
720
|
dim,
|
package/dist/cli.js
CHANGED
|
@@ -111,14 +111,22 @@ var TYPE_TO_ALIAS = {
|
|
|
111
111
|
};
|
|
112
112
|
function resolveAlias(alias, projectRoot) {
|
|
113
113
|
const tsConfig = loadConfig2(projectRoot);
|
|
114
|
-
if (tsConfig.resultType === "success") {
|
|
115
|
-
const
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
114
|
+
if (tsConfig.resultType === "success" && Object.keys(tsConfig.paths).length > 0) {
|
|
115
|
+
const hasMatchingPrefix = Object.keys(tsConfig.paths).some((key) => {
|
|
116
|
+
const prefix = key.replace(/\/\*$/, "");
|
|
117
|
+
return alias === prefix || alias.startsWith(`${prefix}/`);
|
|
118
|
+
});
|
|
119
|
+
if (hasMatchingPrefix) {
|
|
120
|
+
const match = createMatchPath(tsConfig.absoluteBaseUrl, tsConfig.paths);
|
|
121
|
+
const resolved = match(alias, void 0, () => true, [".ts", ".tsx"]);
|
|
122
|
+
if (resolved) {
|
|
123
|
+
return path2.relative(projectRoot, resolved);
|
|
124
|
+
}
|
|
119
125
|
}
|
|
120
126
|
}
|
|
121
|
-
|
|
127
|
+
throw new Error(
|
|
128
|
+
`Could not resolve alias "${alias}" from tsconfig.json. Ensure compilerOptions.paths defines a mapping for it (e.g. "${alias}/*"), then re-run. See https://ui.stera.sh/docs/installation.`
|
|
129
|
+
);
|
|
122
130
|
}
|
|
123
131
|
function resolveOutputPath(config, projectRoot, file) {
|
|
124
132
|
const alias = TYPE_TO_ALIAS[file.type];
|
|
@@ -363,34 +371,54 @@ function hasGlobalsCss(config, projectRoot) {
|
|
|
363
371
|
return false;
|
|
364
372
|
}
|
|
365
373
|
const steraPath = path5.join(path5.dirname(cssPath), "stera-ui.css");
|
|
366
|
-
|
|
374
|
+
if (fs4.existsSync(steraPath)) {
|
|
375
|
+
return true;
|
|
376
|
+
}
|
|
377
|
+
try {
|
|
378
|
+
const contents = fs4.readFileSync(cssPath, "utf-8");
|
|
379
|
+
return contents.includes("--color-bg-surface");
|
|
380
|
+
} catch {
|
|
381
|
+
return false;
|
|
382
|
+
}
|
|
367
383
|
}
|
|
368
384
|
|
|
369
385
|
// src/commands/add.ts
|
|
370
386
|
var transforms = [transformImports];
|
|
371
387
|
async function add(components, options) {
|
|
372
388
|
const cwd = options.cwd ? path6.resolve(options.cwd) : process.cwd();
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
389
|
+
const spinner = createSpinner("Fetching registry");
|
|
390
|
+
try {
|
|
391
|
+
for (const name of components) {
|
|
392
|
+
const item = await getComponent(name);
|
|
393
|
+
if (!item) {
|
|
394
|
+
spinner.fail(`Component "${name}" not found in registry.`);
|
|
395
|
+
console.error(` Run "stera-ui list" to see available components.`);
|
|
396
|
+
process.exit(1);
|
|
397
|
+
}
|
|
379
398
|
}
|
|
399
|
+
} catch (err) {
|
|
400
|
+
spinner.fail("Failed to fetch registry");
|
|
401
|
+
throw err;
|
|
380
402
|
}
|
|
381
403
|
const configPath = findConfigPath(cwd);
|
|
382
404
|
if (!configPath) {
|
|
383
|
-
|
|
384
|
-
` Error: ${CONFIG_FILE} not found. Run "stera-ui init" first.`
|
|
385
|
-
);
|
|
405
|
+
spinner.fail(`${CONFIG_FILE} not found. Run "stera-ui init" first.`);
|
|
386
406
|
process.exit(1);
|
|
387
407
|
}
|
|
388
408
|
const config = loadConfig(cwd);
|
|
389
409
|
if (!config) {
|
|
390
|
-
|
|
410
|
+
spinner.fail(`Failed to parse ${CONFIG_FILE}.`);
|
|
391
411
|
process.exit(1);
|
|
392
412
|
}
|
|
393
413
|
const projectRoot = path6.dirname(configPath);
|
|
414
|
+
let resolved;
|
|
415
|
+
try {
|
|
416
|
+
resolved = await resolveDependencies(components);
|
|
417
|
+
} catch (err) {
|
|
418
|
+
spinner.fail("Failed to fetch registry");
|
|
419
|
+
throw err;
|
|
420
|
+
}
|
|
421
|
+
spinner.succeed("Registry resolved");
|
|
394
422
|
const isAddingGlobals = components.includes("globals");
|
|
395
423
|
if (!isAddingGlobals && !hasGlobalsCss(config, projectRoot)) {
|
|
396
424
|
console.warn(`
|
|
@@ -399,7 +427,6 @@ async function add(components, options) {
|
|
|
399
427
|
console.warn(` Run "stera-ui add globals" to install base styles.
|
|
400
428
|
`);
|
|
401
429
|
}
|
|
402
|
-
const resolved = await resolveDependencies(components);
|
|
403
430
|
for (const item of resolved) {
|
|
404
431
|
for (const file of item.files ?? []) {
|
|
405
432
|
if (file.content) {
|
|
@@ -458,6 +485,7 @@ import { select } from "@inquirer/prompts";
|
|
|
458
485
|
// src/utils/detect-project.ts
|
|
459
486
|
import fs5 from "fs";
|
|
460
487
|
import path7 from "path";
|
|
488
|
+
import { loadConfig as loadConfig3 } from "tsconfig-paths";
|
|
461
489
|
function hasFile(cwd, filenames) {
|
|
462
490
|
return filenames.some((f) => fs5.existsSync(path7.join(cwd, f)));
|
|
463
491
|
}
|
|
@@ -511,6 +539,24 @@ function detectProject(cwd) {
|
|
|
511
539
|
}
|
|
512
540
|
return { hasSrc, framework, rsc, existingCssFile, layoutFile };
|
|
513
541
|
}
|
|
542
|
+
function detectAliasPrefix(cwd) {
|
|
543
|
+
let tsConfig;
|
|
544
|
+
try {
|
|
545
|
+
tsConfig = loadConfig3(cwd);
|
|
546
|
+
} catch {
|
|
547
|
+
return null;
|
|
548
|
+
}
|
|
549
|
+
if (tsConfig.resultType !== "success" || Object.keys(tsConfig.paths).length === 0) {
|
|
550
|
+
return null;
|
|
551
|
+
}
|
|
552
|
+
for (const [alias, targets] of Object.entries(tsConfig.paths)) {
|
|
553
|
+
if (targets.includes("./*") || targets.includes("./src/*") || targets.includes("./app/*")) {
|
|
554
|
+
return alias.replace(/\/\*$/, "");
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
const first = Object.keys(tsConfig.paths)[0];
|
|
558
|
+
return first ? first.replace(/\/\*$/, "") : null;
|
|
559
|
+
}
|
|
514
560
|
|
|
515
561
|
// src/utils/detect-fonts.ts
|
|
516
562
|
import fs6 from "fs";
|
|
@@ -943,7 +989,7 @@ function parseTemplateLiteralToCnArgs(templateLiteral) {
|
|
|
943
989
|
|
|
944
990
|
// src/commands/init.ts
|
|
945
991
|
var DEFAULT_FONT_NAMES = ["font-geist", "font-geist-mono"];
|
|
946
|
-
function buildConfig(project, strategy) {
|
|
992
|
+
function buildConfig(project, strategy, aliasPrefix) {
|
|
947
993
|
let cssPath;
|
|
948
994
|
if (project.existingCssFile) {
|
|
949
995
|
cssPath = project.existingCssFile;
|
|
@@ -957,11 +1003,11 @@ function buildConfig(project, strategy) {
|
|
|
957
1003
|
version: 1,
|
|
958
1004
|
css: cssPath,
|
|
959
1005
|
aliases: {
|
|
960
|
-
components:
|
|
961
|
-
utils:
|
|
962
|
-
ui:
|
|
963
|
-
lib:
|
|
964
|
-
hooks:
|
|
1006
|
+
components: `${aliasPrefix}/components`,
|
|
1007
|
+
utils: `${aliasPrefix}/lib/utils`,
|
|
1008
|
+
ui: `${aliasPrefix}/components/ui`,
|
|
1009
|
+
lib: `${aliasPrefix}/lib`,
|
|
1010
|
+
hooks: `${aliasPrefix}/hooks`
|
|
965
1011
|
},
|
|
966
1012
|
fonts: {
|
|
967
1013
|
strategy
|
|
@@ -1045,16 +1091,23 @@ async function promptFontStrategy(detected, skipPrompts) {
|
|
|
1045
1091
|
return strategy;
|
|
1046
1092
|
}
|
|
1047
1093
|
async function fetchDefaultFonts() {
|
|
1094
|
+
const spinner = createSpinner("Fetching fonts");
|
|
1048
1095
|
const fonts = [];
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1096
|
+
try {
|
|
1097
|
+
for (const name of DEFAULT_FONT_NAMES) {
|
|
1098
|
+
try {
|
|
1099
|
+
const item = await fetchRegistryItem(name);
|
|
1100
|
+
if (item.type === "registry:font") {
|
|
1101
|
+
fonts.push(item);
|
|
1102
|
+
}
|
|
1103
|
+
} catch {
|
|
1054
1104
|
}
|
|
1055
|
-
} catch {
|
|
1056
1105
|
}
|
|
1106
|
+
} catch (err) {
|
|
1107
|
+
spinner.fail("Failed to fetch fonts");
|
|
1108
|
+
throw err;
|
|
1057
1109
|
}
|
|
1110
|
+
spinner.succeed("Fonts resolved");
|
|
1058
1111
|
return fonts;
|
|
1059
1112
|
}
|
|
1060
1113
|
async function executeFontStrategy(strategy, project, detected, config, cwd) {
|
|
@@ -1131,6 +1184,19 @@ async function init(options) {
|
|
|
1131
1184
|
process.exit(1);
|
|
1132
1185
|
}
|
|
1133
1186
|
const project = detectProject(cwd);
|
|
1187
|
+
const aliasPrefix = detectAliasPrefix(cwd);
|
|
1188
|
+
if (!aliasPrefix) {
|
|
1189
|
+
console.error("");
|
|
1190
|
+
console.error(" Error: No import alias found in your tsconfig.json file.");
|
|
1191
|
+
console.error(
|
|
1192
|
+
' Stera UI requires a path alias (e.g. "@/*": ["./src/*"]) in compilerOptions.paths.'
|
|
1193
|
+
);
|
|
1194
|
+
console.error(
|
|
1195
|
+
" See https://ui.stera.sh/docs/installation for setup instructions per framework."
|
|
1196
|
+
);
|
|
1197
|
+
console.error("");
|
|
1198
|
+
process.exit(1);
|
|
1199
|
+
}
|
|
1134
1200
|
const frameworkName = project.framework === "next" ? "Next.js" : project.framework === "vite" ? "Vite" : null;
|
|
1135
1201
|
const parts = [];
|
|
1136
1202
|
if (frameworkName) parts.push(frameworkName);
|
|
@@ -1144,7 +1210,7 @@ async function init(options) {
|
|
|
1144
1210
|
detectedFonts,
|
|
1145
1211
|
options.yes ?? false
|
|
1146
1212
|
);
|
|
1147
|
-
const config = buildConfig(project, strategy);
|
|
1213
|
+
const config = buildConfig(project, strategy, aliasPrefix);
|
|
1148
1214
|
const configPath = path10.join(cwd, CONFIG_FILE);
|
|
1149
1215
|
fs9.writeFileSync(
|
|
1150
1216
|
configPath,
|
|
@@ -1159,8 +1225,16 @@ async function init(options) {
|
|
|
1159
1225
|
` ${CHECK} Stera already initialised ${dim(`(${path10.join(path10.dirname(project.existingCssFile), "stera-ui.css")} exists)`)}`
|
|
1160
1226
|
);
|
|
1161
1227
|
} else {
|
|
1228
|
+
const fetchSpinner = createSpinner("Fetching base styles");
|
|
1229
|
+
let globalsItem;
|
|
1162
1230
|
try {
|
|
1163
|
-
|
|
1231
|
+
globalsItem = await fetchRegistryItem("globals");
|
|
1232
|
+
} catch {
|
|
1233
|
+
fetchSpinner.fail("Base styles not found \u2014 skipping");
|
|
1234
|
+
globalsItem = null;
|
|
1235
|
+
}
|
|
1236
|
+
if (globalsItem) {
|
|
1237
|
+
fetchSpinner.succeed("Base styles resolved");
|
|
1164
1238
|
const globalsContent = globalsItem.files?.[0]?.content ?? "";
|
|
1165
1239
|
const { content: steraUiContent, imports } = stripImportLines(globalsContent);
|
|
1166
1240
|
const steraUiPath = path10.join(cssDir, "stera-ui.css");
|
|
@@ -1173,11 +1247,18 @@ async function init(options) {
|
|
|
1173
1247
|
}
|
|
1174
1248
|
insertImportLine(existingCssPath, "@import './stera-ui.css';");
|
|
1175
1249
|
console.log(` ${CHECK} Added @import to ${project.existingCssFile}`);
|
|
1176
|
-
} catch {
|
|
1177
1250
|
}
|
|
1178
1251
|
}
|
|
1179
1252
|
} else {
|
|
1180
|
-
const
|
|
1253
|
+
const fetchSpinner = createSpinner("Fetching base styles");
|
|
1254
|
+
let resolved;
|
|
1255
|
+
try {
|
|
1256
|
+
resolved = await resolveDependencies(["globals"]);
|
|
1257
|
+
} catch (err) {
|
|
1258
|
+
fetchSpinner.fail("Failed to fetch base styles");
|
|
1259
|
+
throw err;
|
|
1260
|
+
}
|
|
1261
|
+
fetchSpinner.succeed("Base styles resolved");
|
|
1181
1262
|
const filtered = resolved.filter((item) => item.name !== "fonts");
|
|
1182
1263
|
const { written } = await writeComponentFiles(filtered, config, cwd);
|
|
1183
1264
|
for (const file of written) {
|
|
@@ -1191,14 +1272,21 @@ async function init(options) {
|
|
|
1191
1272
|
config,
|
|
1192
1273
|
cwd
|
|
1193
1274
|
);
|
|
1275
|
+
const depsSpinner = createSpinner("Fetching package list");
|
|
1276
|
+
let globalsForDeps;
|
|
1194
1277
|
try {
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1278
|
+
globalsForDeps = await fetchRegistryItem("globals");
|
|
1279
|
+
} catch {
|
|
1280
|
+
depsSpinner.fail("Package list unavailable \u2014 skipping");
|
|
1281
|
+
globalsForDeps = null;
|
|
1282
|
+
}
|
|
1283
|
+
if (globalsForDeps) {
|
|
1284
|
+
depsSpinner.succeed("Package list resolved");
|
|
1285
|
+
if (globalsForDeps.dependencies) {
|
|
1286
|
+
const deps = [...new Set(globalsForDeps.dependencies)].sort();
|
|
1198
1287
|
console.log("");
|
|
1199
1288
|
await installDependencies(deps, cwd);
|
|
1200
1289
|
}
|
|
1201
|
-
} catch {
|
|
1202
1290
|
}
|
|
1203
1291
|
console.log("");
|
|
1204
1292
|
console.log(" Next steps:");
|
|
@@ -1212,7 +1300,15 @@ async function init(options) {
|
|
|
1212
1300
|
|
|
1213
1301
|
// src/commands/list.ts
|
|
1214
1302
|
async function list() {
|
|
1215
|
-
const
|
|
1303
|
+
const spinner = createSpinner("Fetching registry");
|
|
1304
|
+
let items;
|
|
1305
|
+
try {
|
|
1306
|
+
items = await getAllComponents();
|
|
1307
|
+
} catch (err) {
|
|
1308
|
+
spinner.fail("Failed to fetch registry");
|
|
1309
|
+
throw err;
|
|
1310
|
+
}
|
|
1311
|
+
spinner.succeed("Registry resolved");
|
|
1216
1312
|
const groups = /* @__PURE__ */ new Map();
|
|
1217
1313
|
for (const item of items) {
|
|
1218
1314
|
const type = item.type.replace("registry:", "");
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { fetchRegistryIndex, fetchRegistryItem, getAllComponents, getComponent, resolveDependencies } from './registry/index.js';
|
|
2
2
|
export { RegistryFontItem, RegistryIndex, RegistryItem, RegistryItemFile, RegistryItemFont, RegistryItemType, SteraConfig, configSchema, registryIndexSchema, registryItemFileSchema, registryItemFontSchema, registryItemSchema, registryItemTypeSchema } from './schema/index.js';
|
|
3
|
-
export { CHECK, CONFIG_FILE, CROSS, LOGO, ProjectInfo, TransformContext, TransformFn, WARN, WriteOptions, WriteResult, applyTransforms, brand, createSpinner, detectPackageManager, detectProject, dim, findConfigPath, hasGlobalsCss, installDependencies, loadConfig, massageTreeForFonts, resolveOutputPath, transformImports, updateFonts, writeComponentFiles } from './utils/index.js';
|
|
3
|
+
export { CHECK, CONFIG_FILE, CROSS, LOGO, ProjectInfo, TransformContext, TransformFn, WARN, WriteOptions, WriteResult, applyTransforms, brand, createSpinner, detectAliasPrefix, detectPackageManager, detectProject, dim, findConfigPath, hasGlobalsCss, installDependencies, loadConfig, massageTreeForFonts, resolveOutputPath, transformImports, updateFonts, writeComponentFiles } from './utils/index.js';
|
|
4
4
|
import 'zod';
|
package/dist/index.js
CHANGED
|
@@ -22,6 +22,7 @@ import {
|
|
|
22
22
|
applyTransforms,
|
|
23
23
|
brand,
|
|
24
24
|
createSpinner,
|
|
25
|
+
detectAliasPrefix,
|
|
25
26
|
detectPackageManager,
|
|
26
27
|
detectProject,
|
|
27
28
|
dim,
|
|
@@ -34,7 +35,7 @@ import {
|
|
|
34
35
|
transformImports,
|
|
35
36
|
updateFonts,
|
|
36
37
|
writeComponentFiles
|
|
37
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-QD7FOI3A.js";
|
|
38
39
|
export {
|
|
39
40
|
CHECK,
|
|
40
41
|
CONFIG_FILE,
|
|
@@ -45,6 +46,7 @@ export {
|
|
|
45
46
|
brand,
|
|
46
47
|
configSchema,
|
|
47
48
|
createSpinner,
|
|
49
|
+
detectAliasPrefix,
|
|
48
50
|
detectPackageManager,
|
|
49
51
|
detectProject,
|
|
50
52
|
dim,
|
package/dist/schema/index.d.ts
CHANGED
|
@@ -8,13 +8,13 @@ declare const registryItemFileSchema: z.ZodObject<{
|
|
|
8
8
|
content: z.ZodOptional<z.ZodString>;
|
|
9
9
|
target: z.ZodOptional<z.ZodString>;
|
|
10
10
|
}, "strip", z.ZodTypeAny, {
|
|
11
|
-
type: "registry:ui" | "registry:component" | "registry:hook" | "registry:lib" | "registry:style" | "registry:font";
|
|
12
11
|
path: string;
|
|
12
|
+
type: "registry:ui" | "registry:component" | "registry:hook" | "registry:lib" | "registry:style" | "registry:font";
|
|
13
13
|
content?: string | undefined;
|
|
14
14
|
target?: string | undefined;
|
|
15
15
|
}, {
|
|
16
|
-
type: "registry:ui" | "registry:component" | "registry:hook" | "registry:lib" | "registry:style" | "registry:font";
|
|
17
16
|
path: string;
|
|
17
|
+
type: "registry:ui" | "registry:component" | "registry:hook" | "registry:lib" | "registry:style" | "registry:font";
|
|
18
18
|
content?: string | undefined;
|
|
19
19
|
target?: string | undefined;
|
|
20
20
|
}>;
|
|
@@ -88,13 +88,13 @@ declare const registryItemSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
|
88
88
|
content: z.ZodOptional<z.ZodString>;
|
|
89
89
|
target: z.ZodOptional<z.ZodString>;
|
|
90
90
|
}, "strip", z.ZodTypeAny, {
|
|
91
|
-
type: "registry:ui" | "registry:component" | "registry:hook" | "registry:lib" | "registry:style" | "registry:font";
|
|
92
91
|
path: string;
|
|
92
|
+
type: "registry:ui" | "registry:component" | "registry:hook" | "registry:lib" | "registry:style" | "registry:font";
|
|
93
93
|
content?: string | undefined;
|
|
94
94
|
target?: string | undefined;
|
|
95
95
|
}, {
|
|
96
|
-
type: "registry:ui" | "registry:component" | "registry:hook" | "registry:lib" | "registry:style" | "registry:font";
|
|
97
96
|
path: string;
|
|
97
|
+
type: "registry:ui" | "registry:component" | "registry:hook" | "registry:lib" | "registry:style" | "registry:font";
|
|
98
98
|
content?: string | undefined;
|
|
99
99
|
target?: string | undefined;
|
|
100
100
|
}>, "many">>;
|
|
@@ -114,8 +114,8 @@ declare const registryItemSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
|
114
114
|
dependencies?: string[] | undefined;
|
|
115
115
|
registryDependencies?: string[] | undefined;
|
|
116
116
|
files?: {
|
|
117
|
-
type: "registry:ui" | "registry:component" | "registry:hook" | "registry:lib" | "registry:style" | "registry:font";
|
|
118
117
|
path: string;
|
|
118
|
+
type: "registry:ui" | "registry:component" | "registry:hook" | "registry:lib" | "registry:style" | "registry:font";
|
|
119
119
|
content?: string | undefined;
|
|
120
120
|
target?: string | undefined;
|
|
121
121
|
}[] | undefined;
|
|
@@ -135,8 +135,8 @@ declare const registryItemSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
|
135
135
|
dependencies?: string[] | undefined;
|
|
136
136
|
registryDependencies?: string[] | undefined;
|
|
137
137
|
files?: {
|
|
138
|
-
type: "registry:ui" | "registry:component" | "registry:hook" | "registry:lib" | "registry:style" | "registry:font";
|
|
139
138
|
path: string;
|
|
139
|
+
type: "registry:ui" | "registry:component" | "registry:hook" | "registry:lib" | "registry:style" | "registry:font";
|
|
140
140
|
content?: string | undefined;
|
|
141
141
|
target?: string | undefined;
|
|
142
142
|
}[] | undefined;
|
|
@@ -152,13 +152,13 @@ declare const registryItemSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
|
152
152
|
content: z.ZodOptional<z.ZodString>;
|
|
153
153
|
target: z.ZodOptional<z.ZodString>;
|
|
154
154
|
}, "strip", z.ZodTypeAny, {
|
|
155
|
-
type: "registry:ui" | "registry:component" | "registry:hook" | "registry:lib" | "registry:style" | "registry:font";
|
|
156
155
|
path: string;
|
|
156
|
+
type: "registry:ui" | "registry:component" | "registry:hook" | "registry:lib" | "registry:style" | "registry:font";
|
|
157
157
|
content?: string | undefined;
|
|
158
158
|
target?: string | undefined;
|
|
159
159
|
}, {
|
|
160
|
-
type: "registry:ui" | "registry:component" | "registry:hook" | "registry:lib" | "registry:style" | "registry:font";
|
|
161
160
|
path: string;
|
|
161
|
+
type: "registry:ui" | "registry:component" | "registry:hook" | "registry:lib" | "registry:style" | "registry:font";
|
|
162
162
|
content?: string | undefined;
|
|
163
163
|
target?: string | undefined;
|
|
164
164
|
}>, "many">;
|
|
@@ -166,8 +166,8 @@ declare const registryItemSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
|
166
166
|
type: "registry:ui" | "registry:component" | "registry:hook" | "registry:lib" | "registry:style";
|
|
167
167
|
name: string;
|
|
168
168
|
files: {
|
|
169
|
-
type: "registry:ui" | "registry:component" | "registry:hook" | "registry:lib" | "registry:style" | "registry:font";
|
|
170
169
|
path: string;
|
|
170
|
+
type: "registry:ui" | "registry:component" | "registry:hook" | "registry:lib" | "registry:style" | "registry:font";
|
|
171
171
|
content?: string | undefined;
|
|
172
172
|
target?: string | undefined;
|
|
173
173
|
}[];
|
|
@@ -177,8 +177,8 @@ declare const registryItemSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
|
177
177
|
type: "registry:ui" | "registry:component" | "registry:hook" | "registry:lib" | "registry:style";
|
|
178
178
|
name: string;
|
|
179
179
|
files: {
|
|
180
|
-
type: "registry:ui" | "registry:component" | "registry:hook" | "registry:lib" | "registry:style" | "registry:font";
|
|
181
180
|
path: string;
|
|
181
|
+
type: "registry:ui" | "registry:component" | "registry:hook" | "registry:lib" | "registry:style" | "registry:font";
|
|
182
182
|
content?: string | undefined;
|
|
183
183
|
target?: string | undefined;
|
|
184
184
|
}[];
|
|
@@ -231,13 +231,13 @@ declare const registryIndexSchema: z.ZodObject<{
|
|
|
231
231
|
content: z.ZodOptional<z.ZodString>;
|
|
232
232
|
target: z.ZodOptional<z.ZodString>;
|
|
233
233
|
}, "strip", z.ZodTypeAny, {
|
|
234
|
-
type: "registry:ui" | "registry:component" | "registry:hook" | "registry:lib" | "registry:style" | "registry:font";
|
|
235
234
|
path: string;
|
|
235
|
+
type: "registry:ui" | "registry:component" | "registry:hook" | "registry:lib" | "registry:style" | "registry:font";
|
|
236
236
|
content?: string | undefined;
|
|
237
237
|
target?: string | undefined;
|
|
238
238
|
}, {
|
|
239
|
-
type: "registry:ui" | "registry:component" | "registry:hook" | "registry:lib" | "registry:style" | "registry:font";
|
|
240
239
|
path: string;
|
|
240
|
+
type: "registry:ui" | "registry:component" | "registry:hook" | "registry:lib" | "registry:style" | "registry:font";
|
|
241
241
|
content?: string | undefined;
|
|
242
242
|
target?: string | undefined;
|
|
243
243
|
}>, "many">>;
|
|
@@ -257,8 +257,8 @@ declare const registryIndexSchema: z.ZodObject<{
|
|
|
257
257
|
dependencies?: string[] | undefined;
|
|
258
258
|
registryDependencies?: string[] | undefined;
|
|
259
259
|
files?: {
|
|
260
|
-
type: "registry:ui" | "registry:component" | "registry:hook" | "registry:lib" | "registry:style" | "registry:font";
|
|
261
260
|
path: string;
|
|
261
|
+
type: "registry:ui" | "registry:component" | "registry:hook" | "registry:lib" | "registry:style" | "registry:font";
|
|
262
262
|
content?: string | undefined;
|
|
263
263
|
target?: string | undefined;
|
|
264
264
|
}[] | undefined;
|
|
@@ -278,8 +278,8 @@ declare const registryIndexSchema: z.ZodObject<{
|
|
|
278
278
|
dependencies?: string[] | undefined;
|
|
279
279
|
registryDependencies?: string[] | undefined;
|
|
280
280
|
files?: {
|
|
281
|
-
type: "registry:ui" | "registry:component" | "registry:hook" | "registry:lib" | "registry:style" | "registry:font";
|
|
282
281
|
path: string;
|
|
282
|
+
type: "registry:ui" | "registry:component" | "registry:hook" | "registry:lib" | "registry:style" | "registry:font";
|
|
283
283
|
content?: string | undefined;
|
|
284
284
|
target?: string | undefined;
|
|
285
285
|
}[] | undefined;
|
|
@@ -295,13 +295,13 @@ declare const registryIndexSchema: z.ZodObject<{
|
|
|
295
295
|
content: z.ZodOptional<z.ZodString>;
|
|
296
296
|
target: z.ZodOptional<z.ZodString>;
|
|
297
297
|
}, "strip", z.ZodTypeAny, {
|
|
298
|
-
type: "registry:ui" | "registry:component" | "registry:hook" | "registry:lib" | "registry:style" | "registry:font";
|
|
299
298
|
path: string;
|
|
299
|
+
type: "registry:ui" | "registry:component" | "registry:hook" | "registry:lib" | "registry:style" | "registry:font";
|
|
300
300
|
content?: string | undefined;
|
|
301
301
|
target?: string | undefined;
|
|
302
302
|
}, {
|
|
303
|
-
type: "registry:ui" | "registry:component" | "registry:hook" | "registry:lib" | "registry:style" | "registry:font";
|
|
304
303
|
path: string;
|
|
304
|
+
type: "registry:ui" | "registry:component" | "registry:hook" | "registry:lib" | "registry:style" | "registry:font";
|
|
305
305
|
content?: string | undefined;
|
|
306
306
|
target?: string | undefined;
|
|
307
307
|
}>, "many">;
|
|
@@ -309,8 +309,8 @@ declare const registryIndexSchema: z.ZodObject<{
|
|
|
309
309
|
type: "registry:ui" | "registry:component" | "registry:hook" | "registry:lib" | "registry:style";
|
|
310
310
|
name: string;
|
|
311
311
|
files: {
|
|
312
|
-
type: "registry:ui" | "registry:component" | "registry:hook" | "registry:lib" | "registry:style" | "registry:font";
|
|
313
312
|
path: string;
|
|
313
|
+
type: "registry:ui" | "registry:component" | "registry:hook" | "registry:lib" | "registry:style" | "registry:font";
|
|
314
314
|
content?: string | undefined;
|
|
315
315
|
target?: string | undefined;
|
|
316
316
|
}[];
|
|
@@ -320,8 +320,8 @@ declare const registryIndexSchema: z.ZodObject<{
|
|
|
320
320
|
type: "registry:ui" | "registry:component" | "registry:hook" | "registry:lib" | "registry:style";
|
|
321
321
|
name: string;
|
|
322
322
|
files: {
|
|
323
|
-
type: "registry:ui" | "registry:component" | "registry:hook" | "registry:lib" | "registry:style" | "registry:font";
|
|
324
323
|
path: string;
|
|
324
|
+
type: "registry:ui" | "registry:component" | "registry:hook" | "registry:lib" | "registry:style" | "registry:font";
|
|
325
325
|
content?: string | undefined;
|
|
326
326
|
target?: string | undefined;
|
|
327
327
|
}[];
|
|
@@ -346,8 +346,8 @@ declare const registryIndexSchema: z.ZodObject<{
|
|
|
346
346
|
dependencies?: string[] | undefined;
|
|
347
347
|
registryDependencies?: string[] | undefined;
|
|
348
348
|
files?: {
|
|
349
|
-
type: "registry:ui" | "registry:component" | "registry:hook" | "registry:lib" | "registry:style" | "registry:font";
|
|
350
349
|
path: string;
|
|
350
|
+
type: "registry:ui" | "registry:component" | "registry:hook" | "registry:lib" | "registry:style" | "registry:font";
|
|
351
351
|
content?: string | undefined;
|
|
352
352
|
target?: string | undefined;
|
|
353
353
|
}[] | undefined;
|
|
@@ -355,8 +355,8 @@ declare const registryIndexSchema: z.ZodObject<{
|
|
|
355
355
|
type: "registry:ui" | "registry:component" | "registry:hook" | "registry:lib" | "registry:style";
|
|
356
356
|
name: string;
|
|
357
357
|
files: {
|
|
358
|
-
type: "registry:ui" | "registry:component" | "registry:hook" | "registry:lib" | "registry:style" | "registry:font";
|
|
359
358
|
path: string;
|
|
359
|
+
type: "registry:ui" | "registry:component" | "registry:hook" | "registry:lib" | "registry:style" | "registry:font";
|
|
360
360
|
content?: string | undefined;
|
|
361
361
|
target?: string | undefined;
|
|
362
362
|
}[];
|
|
@@ -381,8 +381,8 @@ declare const registryIndexSchema: z.ZodObject<{
|
|
|
381
381
|
dependencies?: string[] | undefined;
|
|
382
382
|
registryDependencies?: string[] | undefined;
|
|
383
383
|
files?: {
|
|
384
|
-
type: "registry:ui" | "registry:component" | "registry:hook" | "registry:lib" | "registry:style" | "registry:font";
|
|
385
384
|
path: string;
|
|
385
|
+
type: "registry:ui" | "registry:component" | "registry:hook" | "registry:lib" | "registry:style" | "registry:font";
|
|
386
386
|
content?: string | undefined;
|
|
387
387
|
target?: string | undefined;
|
|
388
388
|
}[] | undefined;
|
|
@@ -390,8 +390,8 @@ declare const registryIndexSchema: z.ZodObject<{
|
|
|
390
390
|
type: "registry:ui" | "registry:component" | "registry:hook" | "registry:lib" | "registry:style";
|
|
391
391
|
name: string;
|
|
392
392
|
files: {
|
|
393
|
-
type: "registry:ui" | "registry:component" | "registry:hook" | "registry:lib" | "registry:style" | "registry:font";
|
|
394
393
|
path: string;
|
|
394
|
+
type: "registry:ui" | "registry:component" | "registry:hook" | "registry:lib" | "registry:style" | "registry:font";
|
|
395
395
|
content?: string | undefined;
|
|
396
396
|
target?: string | undefined;
|
|
397
397
|
}[];
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -67,10 +67,21 @@ interface ProjectInfo {
|
|
|
67
67
|
* - Existing Tailwind CSS entry file
|
|
68
68
|
*/
|
|
69
69
|
declare function detectProject(cwd: string): ProjectInfo;
|
|
70
|
+
/**
|
|
71
|
+
* Detect the alias prefix (e.g. "@" or "~") from the project's tsconfig.json
|
|
72
|
+
* `compilerOptions.paths`. Mirrors shadcn's approach.
|
|
73
|
+
*
|
|
74
|
+
* Returns null when tsconfig can't be loaded or defines no path mappings —
|
|
75
|
+
* `init` should surface a clear error in that case rather than templating
|
|
76
|
+
* aliases that won't resolve.
|
|
77
|
+
*/
|
|
78
|
+
declare function detectAliasPrefix(cwd: string): string | null;
|
|
70
79
|
|
|
71
80
|
/**
|
|
72
81
|
* Check if Stera has already been initialised in the user's project.
|
|
73
|
-
*
|
|
82
|
+
* Returns true if either a sibling `stera-ui.css` exists (existing-CSS init
|
|
83
|
+
* path) or the user's CSS file itself contains Stera tokens inline
|
|
84
|
+
* (no-existing-CSS init path, or a hand-rolled setup).
|
|
74
85
|
*/
|
|
75
86
|
declare function hasGlobalsCss(config: SteraConfig, projectRoot: string): boolean;
|
|
76
87
|
|
|
@@ -132,4 +143,4 @@ declare function updateFonts(fonts: RegistryFontItem[], project: ProjectInfo, cw
|
|
|
132
143
|
silent?: boolean;
|
|
133
144
|
}): Promise<void>;
|
|
134
145
|
|
|
135
|
-
export { CHECK, CONFIG_FILE, CROSS, LOGO, type ProjectInfo, type TransformContext, type TransformFn, WARN, type WriteOptions, type WriteResult, applyTransforms, brand, createSpinner, detectPackageManager, detectProject, dim, findConfigPath, hasGlobalsCss, installDependencies, loadConfig, massageTreeForFonts, resolveOutputPath, transformImports, updateFonts, writeComponentFiles };
|
|
146
|
+
export { CHECK, CONFIG_FILE, CROSS, LOGO, type ProjectInfo, type TransformContext, type TransformFn, WARN, type WriteOptions, type WriteResult, applyTransforms, brand, createSpinner, detectAliasPrefix, detectPackageManager, detectProject, dim, findConfigPath, hasGlobalsCss, installDependencies, loadConfig, massageTreeForFonts, resolveOutputPath, transformImports, updateFonts, writeComponentFiles };
|
package/dist/utils/index.js
CHANGED
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
applyTransforms,
|
|
8
8
|
brand,
|
|
9
9
|
createSpinner,
|
|
10
|
+
detectAliasPrefix,
|
|
10
11
|
detectPackageManager,
|
|
11
12
|
detectProject,
|
|
12
13
|
dim,
|
|
@@ -19,7 +20,7 @@ import {
|
|
|
19
20
|
transformImports,
|
|
20
21
|
updateFonts,
|
|
21
22
|
writeComponentFiles
|
|
22
|
-
} from "../chunk-
|
|
23
|
+
} from "../chunk-QD7FOI3A.js";
|
|
23
24
|
export {
|
|
24
25
|
CHECK,
|
|
25
26
|
CONFIG_FILE,
|
|
@@ -29,6 +30,7 @@ export {
|
|
|
29
30
|
applyTransforms,
|
|
30
31
|
brand,
|
|
31
32
|
createSpinner,
|
|
33
|
+
detectAliasPrefix,
|
|
32
34
|
detectPackageManager,
|
|
33
35
|
detectProject,
|
|
34
36
|
dim,
|