@tschk/moonshine-cli 0.3.7 → 0.4.1
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 +12 -12
- package/src/adopt/conventions.ts +39 -0
- package/src/adopt/frameworks.ts +155 -0
- package/src/adopt/gaps.ts +188 -0
- package/src/adopt/plan.ts +232 -0
- package/src/adopt/project.ts +71 -0
- package/src/adopt/report.ts +167 -0
- package/src/adopt/scan.ts +282 -0
- package/src/adopt/templates.ts +180 -0
- package/src/adopt/types.ts +66 -0
- package/src/adopt.ts +42 -1237
- package/src/compile.ts +18 -9
- package/src/config.ts +1 -1
- package/src/new.ts +112 -102
- package/src/preview.ts +18 -4
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/** The shapes a scan and a plan travel in. */
|
|
2
|
+
import type { RouteConvention } from "@tschk/moonshine-compiler";
|
|
3
|
+
import type { Framework } from "./frameworks.js";
|
|
4
|
+
|
|
5
|
+
export type { Framework };
|
|
6
|
+
|
|
7
|
+
export type NextImport = {
|
|
8
|
+
/** Project-relative file holding the import. */
|
|
9
|
+
file: string;
|
|
10
|
+
specifier: string;
|
|
11
|
+
/** Whether `@tschk/moonshine-next` implements this specifier. */
|
|
12
|
+
aliasable: boolean;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export type TemplateFile = {
|
|
16
|
+
/** Project-relative `.svelte` / `.vue` file. */
|
|
17
|
+
file: string;
|
|
18
|
+
/** URL path this template becomes, when it maps to one. */
|
|
19
|
+
route?: string;
|
|
20
|
+
/** Project-relative route module generated for it. */
|
|
21
|
+
generated?: string;
|
|
22
|
+
/** Whether the crepuscularity frontend compiled the template. */
|
|
23
|
+
ok: boolean;
|
|
24
|
+
/** View IR nodes produced. */
|
|
25
|
+
nodes?: number;
|
|
26
|
+
/** The compiled View IR, embedded in the generated route module. */
|
|
27
|
+
ir?: unknown;
|
|
28
|
+
/** IR schema version the parser emitted. */
|
|
29
|
+
irVersion?: number;
|
|
30
|
+
/** Parse error, verbatim. Unsupported constructs are errors, not silent drops. */
|
|
31
|
+
error?: string;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export type AdoptScan = {
|
|
35
|
+
projectDir: string;
|
|
36
|
+
framework: Framework;
|
|
37
|
+
/** Project-relative route directory, when one was found. */
|
|
38
|
+
routesDir?: string;
|
|
39
|
+
convention?: RouteConvention;
|
|
40
|
+
routes: { path: string; file: string }[];
|
|
41
|
+
/** Templates compiled to View IR, for the Svelte and Vue paths. */
|
|
42
|
+
templates: TemplateFile[];
|
|
43
|
+
imports: NextImport[];
|
|
44
|
+
conventions: string[];
|
|
45
|
+
/** Blunt list of what adoption does not carry over. */
|
|
46
|
+
manual: string[];
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export type AdoptChange = {
|
|
50
|
+
file: string;
|
|
51
|
+
summary: string;
|
|
52
|
+
/** What the write does to a file that may or may not exist yet. */
|
|
53
|
+
action: "create" | "modify" | "none";
|
|
54
|
+
/** Concrete keys and values the write adds, shown before confirmation. */
|
|
55
|
+
details: string[];
|
|
56
|
+
/** Already true before this run; used to keep repeat runs honest. */
|
|
57
|
+
alreadyApplied: boolean;
|
|
58
|
+
contents?: string;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export type AdoptPlan = {
|
|
62
|
+
scan: AdoptScan;
|
|
63
|
+
changes: AdoptChange[];
|
|
64
|
+
/** Source files whose imports had to be edited because no alias covered them. */
|
|
65
|
+
rewritten: string[];
|
|
66
|
+
};
|