cmdzero 0.8.2 → 0.8.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/package.json +1 -1
- package/src/resolver.js +12 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cmdzero",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.3",
|
|
4
4
|
"description": "Tweak your UI live in the browser and write the changes straight to source. Copy and Tailwind edits cost zero tokens; everything else routes to a right-sized model via headless claude.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
package/src/resolver.js
CHANGED
|
@@ -28,13 +28,18 @@ export function parseLoc(loc) {
|
|
|
28
28
|
export function loadTarget(root, loc) {
|
|
29
29
|
const parsed = parseLoc(loc);
|
|
30
30
|
const { line, col } = parsed;
|
|
31
|
-
// Stamps come from
|
|
32
|
-
// 0-based column) and the @cmdzero/react dev runtime (
|
|
33
|
-
//
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
31
|
+
// Stamps come from three sources: the babel plugin (root-relative path,
|
|
32
|
+
// 0-based column) and the @cmdzero/react dev runtime (1-based column), which
|
|
33
|
+
// reports whatever the bundler handed jsxDEV — an absolute path under
|
|
34
|
+
// webpack, but "[project]/..." under Turbopack. Normalize the path and match
|
|
35
|
+
// either column convention.
|
|
36
|
+
const raw = parsed.file.replace(/^\[project\]\//, '');
|
|
37
|
+
// Resolve before the escape check: the guard has to see a normalized path,
|
|
38
|
+
// or a "foo/../../.." stamp walks straight past a leading-".." test.
|
|
39
|
+
const file = path.relative(root, path.resolve(root, raw));
|
|
40
|
+
if (file.startsWith('..') || path.isAbsolute(file)) {
|
|
41
|
+
throw new Error('file outside root');
|
|
42
|
+
}
|
|
38
43
|
const abs = path.resolve(root, file);
|
|
39
44
|
const content = fs.readFileSync(abs, 'utf8');
|
|
40
45
|
const ast = parseSource(content, file);
|