@larose-ui/cli 0.1.1 → 0.1.2

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.
Files changed (2) hide show
  1. package/dist/cli.js +24 -9
  2. package/package.json +4 -4
package/dist/cli.js CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  // src/cli.ts
4
4
  import { writeFileSync } from "fs";
5
- import { resolve } from "path";
5
+ import { resolve as resolve2 } from "path";
6
6
 
7
7
  // src/doctor.ts
8
8
  import { readdir as readdir2, readFile as readFile2, stat, writeFile } from "fs/promises";
@@ -730,16 +730,16 @@ function formatVisualRegressionReport(result) {
730
730
 
731
731
  // src/doctor.ts
732
732
  var BUNDLE_BUDGETS_KB = {
733
- "@larose-ui/core": 10,
734
- "@larose-ui/tokens": 5,
733
+ "@larose-ui/core": 15,
734
+ "@larose-ui/tokens": 65,
735
735
  "@larose-ui/network": 6,
736
736
  "@larose-ui/offline": 5,
737
737
  "@larose-ui/permissions": 8,
738
738
  "@larose-ui/data": 15,
739
739
  "@larose-ui/forms": 10,
740
- "@larose-ui/react": 70,
741
- "@larose-ui/runtime": 36,
742
- "@larose-ui/observability": 26,
740
+ "@larose-ui/react": 460,
741
+ "@larose-ui/runtime": 40,
742
+ "@larose-ui/observability": 28,
743
743
  "@larose-ui/contracts": 5,
744
744
  "@larose-ui/migration": 14,
745
745
  "@larose-ui/testing": 10,
@@ -1099,10 +1099,24 @@ async function runRelease(rootDir2, json = false) {
1099
1099
  return { output, ready };
1100
1100
  }
1101
1101
 
1102
+ // src/pathSafety.ts
1103
+ import { resolve, sep } from "path";
1104
+ function resolveSafePath(rootDir2, targetPath) {
1105
+ const root = resolve(rootDir2);
1106
+ const resolved = resolve(root, targetPath);
1107
+ if (resolved === root) {
1108
+ return resolved;
1109
+ }
1110
+ if (!resolved.startsWith(root + sep)) {
1111
+ throw new Error(`Path must stay within the project directory: ${targetPath}`);
1112
+ }
1113
+ return resolved;
1114
+ }
1115
+
1102
1116
  // src/cli.ts
1103
1117
  var args = process.argv.slice(2);
1104
1118
  var command = args[0] ?? "help";
1105
- var rootDir = resolve(process.cwd());
1119
+ var rootDir = resolve2(process.cwd());
1106
1120
  function hasFlag(flag) {
1107
1121
  return args.includes(flag);
1108
1122
  }
@@ -1142,8 +1156,9 @@ async function main() {
1142
1156
  const output = args[3];
1143
1157
  const code = runGenerate(type, name);
1144
1158
  if (output) {
1145
- writeFileSync(output, code);
1146
- console.log(`Generated ${output}`);
1159
+ const safeOutput = resolveSafePath(rootDir, output);
1160
+ writeFileSync(safeOutput, code);
1161
+ console.log(`Generated ${safeOutput}`);
1147
1162
  } else {
1148
1163
  console.log(code);
1149
1164
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@larose-ui/cli",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "CLI for laRose UI platform — doctor, migrate, generate",
5
5
  "type": "module",
6
6
  "bin": {
@@ -11,9 +11,9 @@
11
11
  "README.md"
12
12
  ],
13
13
  "dependencies": {
14
- "@larose-ui/contracts": "0.1.1",
15
- "@larose-ui/migration": "0.1.1",
16
- "@larose-ui/accessibility": "0.1.1"
14
+ "@larose-ui/accessibility": "0.1.2",
15
+ "@larose-ui/contracts": "0.1.2",
16
+ "@larose-ui/migration": "0.1.1"
17
17
  },
18
18
  "devDependencies": {
19
19
  "tsup": "^8.3.5",