rafters 0.4.2 → 0.4.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/index.js +28 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -30201,8 +30201,16 @@ function trackInstalled(config2, items) {
|
|
|
30201
30201
|
function rootFor(field, cwd, fallback) {
|
|
30202
30202
|
return field === void 0 ? fallback : resolveRoot(field, cwd, fallback);
|
|
30203
30203
|
}
|
|
30204
|
+
function sourceRootFor(config2, cwd) {
|
|
30205
|
+
const componentsResolved = rootFor(config2?.componentsPath, cwd, "components/ui");
|
|
30206
|
+
return componentsResolved.replace(/\/?components\/ui$/, "");
|
|
30207
|
+
}
|
|
30204
30208
|
function transformPath(registryPath, config2, cwd = process.cwd()) {
|
|
30205
30209
|
if (!config2) return registryPath;
|
|
30210
|
+
if (registryPath.startsWith("lib/composites/")) {
|
|
30211
|
+
const sourceRoot = sourceRootFor(config2, cwd);
|
|
30212
|
+
return sourceRoot ? join7(sourceRoot, registryPath) : registryPath;
|
|
30213
|
+
}
|
|
30206
30214
|
const replacements = [
|
|
30207
30215
|
["components/ui/", config2.componentsPath, "components/ui"],
|
|
30208
30216
|
["lib/primitives/", config2.primitivesPath, "lib/primitives"],
|
|
@@ -30217,8 +30225,7 @@ function transformPath(registryPath, config2, cwd = process.cwd()) {
|
|
|
30217
30225
|
return registryPath;
|
|
30218
30226
|
}
|
|
30219
30227
|
function substrateProjectPath(registryPath, config2, cwd = process.cwd()) {
|
|
30220
|
-
const
|
|
30221
|
-
const sourceRoot = componentsResolved.replace(/\/?components\/ui$/, "");
|
|
30228
|
+
const sourceRoot = sourceRootFor(config2, cwd);
|
|
30222
30229
|
return sourceRoot ? join7(sourceRoot, registryPath) : registryPath;
|
|
30223
30230
|
}
|
|
30224
30231
|
function fileExists(cwd, relativePath) {
|
|
@@ -30251,6 +30258,7 @@ function transformFileContent(content, config2, fileType = "component", cwd = pr
|
|
|
30251
30258
|
return base || null;
|
|
30252
30259
|
}
|
|
30253
30260
|
if (isSubsystemFile) {
|
|
30261
|
+
} else if (fileType === "composite") {
|
|
30254
30262
|
} else if (fileType === "component" && installPath) {
|
|
30255
30263
|
const componentName = extractComponentName(installPath);
|
|
30256
30264
|
transformed = transformed.replace(
|
|
@@ -30335,7 +30343,7 @@ async function installItem(cwd, item, options, config2, substrateKinds = []) {
|
|
|
30335
30343
|
}
|
|
30336
30344
|
}
|
|
30337
30345
|
await mkdir2(dirname(targetPath), { recursive: true });
|
|
30338
|
-
const fileType = item.type === "primitive" ? "primitive" : item.type === "substrate" ? "substrate" : "component";
|
|
30346
|
+
const fileType = item.type === "primitive" ? "primitive" : item.type === "substrate" ? "substrate" : item.type === "composite" ? "composite" : "component";
|
|
30339
30347
|
const transformedContent = transformFileContent(file2.content, config2, fileType, cwd, {
|
|
30340
30348
|
substrateKinds,
|
|
30341
30349
|
installPath: file2.path
|
|
@@ -30640,6 +30648,10 @@ var AppliedRuleSchema = external_exports.union([
|
|
|
30640
30648
|
config: external_exports.record(external_exports.string(), external_exports.unknown())
|
|
30641
30649
|
})
|
|
30642
30650
|
]);
|
|
30651
|
+
var BindingSchema3 = external_exports.object({
|
|
30652
|
+
$bind: external_exports.string().regex(/^[A-Za-z_][A-Za-z0-9_]*(\.[^.]+)*$/).refine((path) => path !== "props", "a props path needs at least one segment")
|
|
30653
|
+
}).strict();
|
|
30654
|
+
var RepeatNameSchema = external_exports.string().regex(/^[A-Za-z_][A-Za-z0-9_]*$/).refine((name) => name !== "props", '"props" is reserved');
|
|
30643
30655
|
var CompositeBlockSchema = external_exports.object({
|
|
30644
30656
|
id: external_exports.string().min(1),
|
|
30645
30657
|
type: external_exports.string().min(1),
|
|
@@ -30651,7 +30663,19 @@ var CompositeBlockSchema = external_exports.object({
|
|
|
30651
30663
|
children: external_exports.array(external_exports.string()).optional(),
|
|
30652
30664
|
parentId: external_exports.string().optional(),
|
|
30653
30665
|
meta: external_exports.record(external_exports.string(), external_exports.unknown()).optional(),
|
|
30654
|
-
rules: external_exports.array(AppliedRuleSchema).optional()
|
|
30666
|
+
rules: external_exports.array(AppliedRuleSchema).optional(),
|
|
30667
|
+
/** Render this block and its subtree once per item of the bound array. */
|
|
30668
|
+
each: BindingSchema3.optional(),
|
|
30669
|
+
/** The name each item is bound to; required with `each`, forbidden without it. */
|
|
30670
|
+
as: RepeatNameSchema.optional()
|
|
30671
|
+
}).superRefine((block, ctx) => {
|
|
30672
|
+
if (block.each === void 0 !== (block.as === void 0)) {
|
|
30673
|
+
ctx.addIssue({
|
|
30674
|
+
code: "custom",
|
|
30675
|
+
message: "`each` and `as` must be set together",
|
|
30676
|
+
path: ["each"]
|
|
30677
|
+
});
|
|
30678
|
+
}
|
|
30655
30679
|
});
|
|
30656
30680
|
var UsagePatternsSchema2 = external_exports.object({
|
|
30657
30681
|
do: external_exports.array(external_exports.string()),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rafters",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.3",
|
|
4
4
|
"description": "Design Intelligence CLI. Scaffold tokens, import existing shadcn/Tailwind v4 sources, add components, and serve an MCP server so AI agents read decisions instead of guessing.",
|
|
5
5
|
"homepage": "https://rafters.studio",
|
|
6
6
|
"license": "MIT",
|