uilint 0.2.78 → 0.2.79

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.
@@ -34,7 +34,7 @@ import {
34
34
 
35
35
  // src/commands/init/analyze.ts
36
36
  import { existsSync as existsSync3, readFileSync as readFileSync3 } from "fs";
37
- import { join as join3 } from "path";
37
+ import { join as join3, relative as relative2 } from "path";
38
38
  import { findWorkspaceRoot } from "uilint-core/node";
39
39
 
40
40
  // src/utils/vite-detect.ts
@@ -342,6 +342,33 @@ async function analyze(projectPath = process.cwd()) {
342
342
  const projectHasPackageJson = existsSync3(join3(projectPath, "package.json"));
343
343
  if (projectHasPackageJson && projectPath !== workspaceRoot) {
344
344
  rawPackages = rawPackages.filter((pkg) => pkg.path === projectPath);
345
+ if (rawPackages.length === 0) {
346
+ try {
347
+ const pkgPath = join3(projectPath, "package.json");
348
+ const pkg = JSON.parse(readFileSync3(pkgPath, "utf-8"));
349
+ const name = pkg.name || relative2(workspaceRoot, projectPath) || ".";
350
+ const displayPath = relative2(workspaceRoot, projectPath) || ".";
351
+ const deps = {
352
+ ...pkg.dependencies,
353
+ ...pkg.devDependencies
354
+ };
355
+ const frontendIndicators = ["react", "react-dom", "next", "vue", "svelte", "@angular/core", "solid-js", "preact"];
356
+ const isFrontend = frontendIndicators.some((dep) => dep in deps);
357
+ const isTypeScript = existsSync3(join3(projectPath, "tsconfig.json")) || "typescript" in deps;
358
+ const eslintConfigFiles = ["eslint.config.js", "eslint.config.ts", "eslint.config.mjs", "eslint.config.cjs"];
359
+ const hasEslintConfig2 = eslintConfigFiles.some((f) => existsSync3(join3(projectPath, f)));
360
+ rawPackages.push({
361
+ path: projectPath,
362
+ displayPath,
363
+ name,
364
+ hasEslintConfig: hasEslintConfig2,
365
+ isFrontend,
366
+ isRoot: false,
367
+ isTypeScript
368
+ });
369
+ } catch {
370
+ }
371
+ }
345
372
  }
346
373
  const packages = rawPackages.map((pkg) => {
347
374
  const eslintConfigPath = findEslintConfigFile(pkg.path);
@@ -402,7 +429,7 @@ import { fileURLToPath } from "url";
402
429
 
403
430
  // src/utils/react-inject.ts
404
431
  import { existsSync as existsSync4, readFileSync as readFileSync4, writeFileSync } from "fs";
405
- import { join as join4, relative as relative2 } from "path";
432
+ import { join as join4, relative as relative3 } from "path";
406
433
  import { parseModule, generateCode } from "magicast";
407
434
  function getDefaultCandidates(projectPath, appRoot) {
408
435
  const viteMainCandidates = [
@@ -706,7 +733,7 @@ async function createProvidersAndModifyLayout(projectPath, appRoot) {
706
733
  layoutMod = parseModule(layoutContent);
707
734
  } catch {
708
735
  throw new Error(
709
- `Unable to parse ${relative2(projectPath, layoutPath)} as JavaScript/TypeScript.`
736
+ `Unable to parse ${relative3(projectPath, layoutPath)} as JavaScript/TypeScript.`
710
737
  );
711
738
  }
712
739
  const layoutProgram = layoutMod.$ast;
@@ -716,8 +743,8 @@ async function createProvidersAndModifyLayout(projectPath, appRoot) {
716
743
  writeFileSync(layoutPath, updatedLayout, "utf-8");
717
744
  }
718
745
  return {
719
- providersFile: relative2(projectPath, providersPath),
720
- layoutFile: relative2(projectPath, layoutPath),
746
+ providersFile: relative3(projectPath, providersPath),
747
+ layoutFile: relative3(projectPath, layoutPath),
721
748
  modified: true
722
749
  };
723
750
  }
@@ -742,7 +769,7 @@ async function installReactUILintOverlay(opts) {
742
769
  }
743
770
  if (opts.targetFile) {
744
771
  const absTarget2 = opts.targetFile;
745
- const relTarget = relative2(opts.projectPath, absTarget2);
772
+ const relTarget = relative3(opts.projectPath, absTarget2);
746
773
  if (!existsSync4(absTarget2)) {
747
774
  throw new Error(`Target file not found: ${relTarget}`);
748
775
  }
@@ -3531,7 +3558,7 @@ ${semanticCat?.icon ?? "\u{1F9E0}"} ${semanticCat?.name ?? "Semantic rules"} (${
3531
3558
 
3532
3559
  // src/utils/client-boundary-tracer.ts
3533
3560
  import { existsSync as existsSync13, readFileSync as readFileSync10 } from "fs";
3534
- import { join as join15, dirname as dirname4, relative as relative3 } from "path";
3561
+ import { join as join15, dirname as dirname4, relative as relative4 } from "path";
3535
3562
  import { parseModule as parseModule4 } from "magicast";
3536
3563
  function hasUseClientDirective(filePath) {
3537
3564
  try {
@@ -3620,7 +3647,7 @@ function traceClientBoundaries(projectPath, appRoot) {
3620
3647
  return null;
3621
3648
  }
3622
3649
  const layoutIsClient = hasUseClientDirective(layoutFile);
3623
- const layoutRelative = relative3(projectPath, layoutFile);
3650
+ const layoutRelative = relative4(projectPath, layoutFile);
3624
3651
  if (layoutIsClient) {
3625
3652
  return {
3626
3653
  layoutIsClient: true,
@@ -3650,7 +3677,7 @@ function traceClientBoundaries(projectPath, appRoot) {
3650
3677
  if (hasUseClientDirective(resolvedPath)) {
3651
3678
  clientBoundaries.push({
3652
3679
  filePath: resolvedPath,
3653
- relativePath: relative3(projectPath, resolvedPath),
3680
+ relativePath: relative4(projectPath, resolvedPath),
3654
3681
  componentNames: imp.specifiers,
3655
3682
  importSource: imp.source
3656
3683
  });
@@ -4018,4 +4045,4 @@ export {
4018
4045
  analyze,
4019
4046
  execute
4020
4047
  };
4021
- //# sourceMappingURL=chunk-EBKSYMP2.js.map
4048
+ //# sourceMappingURL=chunk-KCDJL7K7.js.map