@b9g/libuild 0.1.10 → 0.1.12

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/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## [0.1.11] - 2025-11-02
6
+
7
+ ### Fixed
8
+ - **CRITICAL**: Workspace dependencies (workspace:*) are now properly resolved to actual version numbers during build
9
+ - Validation warnings for valid libuild output paths (dist/src/ files that libuild creates)
10
+
5
11
  ## [0.1.10] - 2025-10-29
6
12
 
7
13
  ### Added
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@b9g/libuild",
3
- "version": "0.1.10",
3
+ "version": "0.1.12",
4
4
  "description": "Zero-config library builds",
5
5
  "keywords": [
6
6
  "build",
package/src/cli.cjs CHANGED
@@ -83,7 +83,42 @@ async function main() {
83
83
  process.exit(0);
84
84
  }
85
85
  const command = positionals[0] || "build";
86
- const targetDir = positionals[1];
86
+ let targetDir;
87
+ for (let i = 1; i < positionals.length; i++) {
88
+ const arg = positionals[i];
89
+ const flagValueFlags = ["--tag", "--access", "--registry", "--otp", "--workspace"];
90
+ const isValueForFlag = flagValueFlags.some((flag) => {
91
+ const flagIndex = process.argv.indexOf(flag);
92
+ const argIndex = process.argv.indexOf(arg);
93
+ return flagIndex !== -1 && argIndex === flagIndex + 1;
94
+ });
95
+ if (isValueForFlag) {
96
+ continue;
97
+ }
98
+ if (!arg.startsWith("--")) {
99
+ try {
100
+ const isSystemPath = Path.isAbsolute(arg) && (arg.startsWith("/bin/") || arg.startsWith("/usr/") || arg.startsWith("/etc/") || arg.startsWith("/var/") || arg.startsWith("/opt/") || arg.startsWith("/tmp/") || arg.startsWith("/System/") || arg.startsWith("/Applications/"));
101
+ if (isSystemPath) {
102
+ continue;
103
+ }
104
+ const resolvedPath = Path.resolve(arg);
105
+ if (arg.includes("/") || arg.includes("\\") || arg === "." || arg === ".." || arg.startsWith("./") || arg.startsWith("../")) {
106
+ targetDir = arg;
107
+ break;
108
+ }
109
+ const fs = await import("fs/promises");
110
+ try {
111
+ const stat = await fs.stat(resolvedPath);
112
+ if (stat.isDirectory() && !Path.isAbsolute(arg)) {
113
+ targetDir = arg;
114
+ break;
115
+ }
116
+ } catch {
117
+ }
118
+ } catch {
119
+ }
120
+ }
121
+ }
87
122
  const cwd = targetDir ? Path.resolve(targetDir) : process.cwd();
88
123
  const shouldSave = values.save || command === "publish" && !values["no-save"];
89
124
  const allowedNpmFlags = [
@@ -98,7 +133,8 @@ async function main() {
98
133
  "--include-workspace-root"
99
134
  ];
100
135
  const rawExtraArgs = process.argv.slice(2).filter(
101
- (arg) => !["build", "publish"].includes(arg) && !["--save", "--no-save", "--help", "-h", "--version", "-v"].includes(arg)
136
+ (arg) => !["build", "publish"].includes(arg) && !["--save", "--no-save", "--help", "-h", "--version", "-v"].includes(arg) && arg !== targetDir
137
+ // Don't filter out the target directory
102
138
  );
103
139
  const extraArgs = [];
104
140
  for (let i = 0; i < rawExtraArgs.length; i++) {
package/src/cli.js CHANGED
@@ -61,7 +61,42 @@ async function main() {
61
61
  process.exit(0);
62
62
  }
63
63
  const command = positionals[0] || "build";
64
- const targetDir = positionals[1];
64
+ let targetDir;
65
+ for (let i = 1; i < positionals.length; i++) {
66
+ const arg = positionals[i];
67
+ const flagValueFlags = ["--tag", "--access", "--registry", "--otp", "--workspace"];
68
+ const isValueForFlag = flagValueFlags.some((flag) => {
69
+ const flagIndex = process.argv.indexOf(flag);
70
+ const argIndex = process.argv.indexOf(arg);
71
+ return flagIndex !== -1 && argIndex === flagIndex + 1;
72
+ });
73
+ if (isValueForFlag) {
74
+ continue;
75
+ }
76
+ if (!arg.startsWith("--")) {
77
+ try {
78
+ const isSystemPath = Path.isAbsolute(arg) && (arg.startsWith("/bin/") || arg.startsWith("/usr/") || arg.startsWith("/etc/") || arg.startsWith("/var/") || arg.startsWith("/opt/") || arg.startsWith("/tmp/") || arg.startsWith("/System/") || arg.startsWith("/Applications/"));
79
+ if (isSystemPath) {
80
+ continue;
81
+ }
82
+ const resolvedPath = Path.resolve(arg);
83
+ if (arg.includes("/") || arg.includes("\\") || arg === "." || arg === ".." || arg.startsWith("./") || arg.startsWith("../")) {
84
+ targetDir = arg;
85
+ break;
86
+ }
87
+ const fs = await import("fs/promises");
88
+ try {
89
+ const stat = await fs.stat(resolvedPath);
90
+ if (stat.isDirectory() && !Path.isAbsolute(arg)) {
91
+ targetDir = arg;
92
+ break;
93
+ }
94
+ } catch {
95
+ }
96
+ } catch {
97
+ }
98
+ }
99
+ }
65
100
  const cwd = targetDir ? Path.resolve(targetDir) : process.cwd();
66
101
  const shouldSave = values.save || command === "publish" && !values["no-save"];
67
102
  const allowedNpmFlags = [
@@ -76,7 +111,8 @@ async function main() {
76
111
  "--include-workspace-root"
77
112
  ];
78
113
  const rawExtraArgs = process.argv.slice(2).filter(
79
- (arg) => !["build", "publish"].includes(arg) && !["--save", "--no-save", "--help", "-h", "--version", "-v"].includes(arg)
114
+ (arg) => !["build", "publish"].includes(arg) && !["--save", "--no-save", "--help", "-h", "--version", "-v"].includes(arg) && arg !== targetDir
115
+ // Don't filter out the target directory
80
116
  );
81
117
  const extraArgs = [];
82
118
  for (let i = 0; i < rawExtraArgs.length; i++) {