evolit 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.
package/README.md CHANGED
@@ -32,6 +32,20 @@ Supported authored module extensions:
32
32
  - `.tsx`
33
33
  - `.mjs`
34
34
 
35
+ ### Internal imports
36
+
37
+ Imports beginning with `@/` resolve from the application root in server and browser graphs. This
38
+ keeps internal imports stable when modules move between route directories:
39
+
40
+ ```jsx
41
+ import FeatureCard from "@/app/components/feature-card";
42
+ import { formatPrice } from "@/lib/format-price";
43
+ ```
44
+
45
+ Generated applications declare `"@/*": ["./*"]` in `jsconfig.json`, so editors and typechecking
46
+ use the same convention. An explicit `@/*` mapping in `jsconfig.json` or `tsconfig.json` takes
47
+ priority when an application needs a different source root.
48
+
35
49
  ## Commands
36
50
 
37
51
  ```sh
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "evolit",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "A convention-driven application framework for LitSX and web components.",
5
5
  "type": "module",
6
6
  "packageManager": "yarn@4.10.3",
package/src/compiler.js CHANGED
@@ -706,8 +706,24 @@ async function resolveProjectPathAlias(projectRoot, specifier) {
706
706
  return null;
707
707
  }
708
708
 
709
+ async function resolveProjectRootAlias(projectRoot, specifier) {
710
+ if (!specifier.startsWith("@/") || specifier.length === 2) return null;
711
+
712
+ const normalizedProjectRoot = path.resolve(projectRoot);
713
+ const candidatePath = path.resolve(normalizedProjectRoot, specifier.slice(2));
714
+ const relativePath = path.relative(normalizedProjectRoot, candidatePath);
715
+ const isOutsideProject =
716
+ relativePath === ".."
717
+ || relativePath.startsWith(`..${path.sep}`)
718
+ || path.isAbsolute(relativePath);
719
+ if (isOutsideProject) return null;
720
+
721
+ return resolveImportPath(path.join(normalizedProjectRoot, "__alias__.js"), candidatePath);
722
+ }
723
+
709
724
  async function resolveProjectMappedImport(projectRoot, importerPath, specifier) {
710
725
  return await resolveProjectPathAlias(projectRoot, specifier)
726
+ ?? await resolveProjectRootAlias(projectRoot, specifier)
711
727
  ?? await resolveProjectPackageImportMap(importerPath, specifier);
712
728
  }
713
729
 
@@ -1,4 +1,4 @@
1
- import FeatureCard from "./components/feature-card.jsx";
1
+ import FeatureCard from "@/app/components/feature-card";
2
2
 
3
3
  export default async function HomePage() {
4
4
  return (
@@ -9,6 +9,11 @@
9
9
  "jsx": "react-jsx",
10
10
  "jsxImportSource": "@litsx/core",
11
11
  "allowArbitraryExtensions": true,
12
+ "paths": {
13
+ "@/*": [
14
+ "./*"
15
+ ]
16
+ },
12
17
  "plugins": [
13
18
  {
14
19
  "name": "@litsx/typescript"