@sjcx/vorma 0.0.0-pre.5 → 0.0.0-pre.7
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/LICENSE +197 -1
- package/dist/build/assets/css-static-public-assets.d.ts +22 -0
- package/dist/build/assets/static-public-asset-plugin.d.ts +20 -0
- package/dist/build/assets/static-public-assets.d.ts +44 -0
- package/dist/build/build-application.d.ts +18 -0
- package/dist/build/{bundle-client.d.ts → bundling/bundle-client.d.ts} +16 -5
- package/dist/build/{client-output-hashing.d.ts → bundling/client-output-hashing.d.ts} +1 -1
- package/dist/build/bundling/critical-css.d.ts +19 -0
- package/dist/build/cli.js +4793 -860
- package/dist/build/config/load-config.d.ts +142 -0
- package/dist/build/config/resolve-config.d.ts +63 -0
- package/dist/build/{source-layout.d.ts → config/source-layout.d.ts} +4 -6
- package/dist/build/config/url-pathname.d.ts +13 -0
- package/dist/build/config/vite-options.d.ts +80 -0
- package/dist/build/dev/application-process.d.ts +18 -0
- package/dist/build/dev/artifacts.d.ts +37 -0
- package/dist/build/dev/browser-source.d.ts +25 -0
- package/dist/build/dev/build.d.ts +33 -0
- package/dist/build/dev/cargo-metadata.d.ts +28 -0
- package/dist/build/dev/changes.d.ts +11 -0
- package/dist/build/dev/client-inputs.d.ts +25 -0
- package/dist/build/dev/client.d.ts +39 -0
- package/dist/build/dev/dev-protocol.d.ts +23 -0
- package/dist/build/dev/generated-paths.d.ts +27 -0
- package/dist/build/dev/generation.d.ts +31 -0
- package/dist/build/dev/index-html.d.ts +28 -0
- package/dist/build/dev/module-server.d.ts +24 -0
- package/dist/build/dev/patterns.d.ts +26 -0
- package/dist/build/dev/ports.d.ts +25 -0
- package/dist/build/dev/server-process.d.ts +34 -0
- package/dist/build/dev/server-sources.d.ts +19 -0
- package/dist/build/dev/session.d.ts +28 -0
- package/dist/build/dev/sources.d.ts +46 -0
- package/dist/build/{development-stylesheet.d.ts → dev/stylesheet.d.ts} +4 -4
- package/dist/build/dev/watcher.d.ts +30 -0
- package/dist/build/dev/work.d.ts +67 -0
- package/dist/build/generation/client-view-entries.d.ts +8 -0
- package/dist/build/generation/compile-application.d.ts +28 -0
- package/dist/build/generation/generate-application.d.ts +52 -0
- package/dist/build/generation/render-client-contracts.d.ts +15 -0
- package/dist/build/{render-source-text.d.ts → generation/render-source-text.d.ts} +3 -7
- package/dist/build/inspection/http-method.d.ts +4 -0
- package/dist/build/inspection/inspect-application.d.ts +25 -0
- package/dist/build/inspection/inspect-projects.d.ts +85 -0
- package/dist/build/inspection/rust-server.d.ts +57 -0
- package/dist/build/inspection/type-declarations.d.ts +20 -0
- package/dist/build/inspection/typescript-projects.d.ts +31 -0
- package/dist/build/issues.d.ts +25 -0
- package/dist/build/{contained-path.d.ts → output/contained-path.d.ts} +3 -13
- package/dist/build/output/content-hash.d.ts +9 -0
- package/dist/build/output/dist-dir.d.ts +34 -0
- package/dist/build/output/output-files.d.ts +23 -0
- package/dist/build/output/output-ownership.d.ts +44 -0
- package/dist/build/output/published-file-url.d.ts +6 -0
- package/dist/build/patterns/nested-route-chains.d.ts +12 -0
- package/dist/build/patterns/pattern-language.d.ts +3 -0
- package/dist/build/patterns/route-patterns.d.ts +12 -0
- package/dist/build/publication/assemble-artifacts.d.ts +37 -0
- package/dist/build/{browser-contracts.d.ts → publication/browser-contracts.d.ts} +1 -1
- package/dist/build/publication/build-metadata.d.ts +45 -0
- package/dist/build/publication/publish-artifacts.d.ts +17 -0
- package/dist/config-FbabCxBO.js +56 -0
- package/dist/config.d.ts +106 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -0
- package/dist/plugin-api-Btb0teGk.js +36 -0
- package/dist/vite/index.d.ts +14 -3
- package/dist/vite/index.js +25 -9
- package/dist/vite/plugin-api.d.ts +18 -0
- package/package.json +12 -16
- package/dist/build/assemble-artifacts.d.ts +0 -23
- package/dist/build/client-inputs.d.ts +0 -11
- package/dist/build/client-public-urls.d.ts +0 -20
- package/dist/build/compare-text.d.ts +0 -5
- package/dist/build/compile-application.d.ts +0 -40
- package/dist/build/content-digest.d.ts +0 -7
- package/dist/build/critical-css.d.ts +0 -7
- package/dist/build/css-public-assets.d.ts +0 -15
- package/dist/build/development-artifacts.d.ts +0 -36
- package/dist/build/development-browser-source.d.ts +0 -3
- package/dist/build/development-build.d.ts +0 -27
- package/dist/build/development-changes.d.ts +0 -14
- package/dist/build/development-client.d.ts +0 -21
- package/dist/build/development-generation.d.ts +0 -20
- package/dist/build/development-listener.d.ts +0 -14
- package/dist/build/development-patterns.d.ts +0 -5
- package/dist/build/development-protocol.d.ts +0 -20
- package/dist/build/development-server-process.d.ts +0 -30
- package/dist/build/development-sources.d.ts +0 -22
- package/dist/build/development-watcher.d.ts +0 -15
- package/dist/build/development-work.d.ts +0 -33
- package/dist/build/development.d.ts +0 -3
- package/dist/build/generate-application.d.ts +0 -62
- package/dist/build/index.d.ts +0 -14
- package/dist/build/index.js +0 -2
- package/dist/build/inspect-css-artifacts.d.ts +0 -11
- package/dist/build/inspect-projects.d.ts +0 -69
- package/dist/build/load-config.d.ts +0 -57
- package/dist/build/output-files.d.ts +0 -8
- package/dist/build/output-ownership.d.ts +0 -21
- package/dist/build/public-assets.d.ts +0 -32
- package/dist/build/publish-artifacts.d.ts +0 -20
- package/dist/build/render-client-contracts.d.ts +0 -10
- package/dist/build/render-client-transport.d.ts +0 -11
- package/dist/build/render-server-generated.d.ts +0 -22
- package/dist/build/render-types.d.ts +0 -31
- package/dist/build/resolve-config.d.ts +0 -47
- package/dist/build/typescript-projects.d.ts +0 -43
- package/dist/build-BeUTL6eX.js +0 -3036
- package/dist/build-invocation-D7Fu8gBK.js +0 -4
- package/dist/vite/build-invocation.d.ts +0 -4
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { Effect, Path } from "effect";
|
|
2
|
+
import { type VormaConfig } from "../../config.ts";
|
|
3
|
+
export type ConfigLoadIssue = {
|
|
4
|
+
readonly _tag: "ConfigLoadIssue";
|
|
5
|
+
readonly msg: string;
|
|
6
|
+
readonly cause?: unknown;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Decodes an authored Vorma configuration. The decoder rejects a key that the
|
|
10
|
+
* schema does not define.
|
|
11
|
+
*/
|
|
12
|
+
export declare function decodeVormaConfig(input: {
|
|
13
|
+
readonly authored: unknown;
|
|
14
|
+
readonly configFilePath: string;
|
|
15
|
+
}): Effect.Effect<VormaConfig, ConfigLoadIssue>;
|
|
16
|
+
/**
|
|
17
|
+
* Loads the Vorma configuration file that a command names, decodes it, and
|
|
18
|
+
* resolves it. A process calls this once and passes the result on. Vite's
|
|
19
|
+
* loader retains the configuration's own `import.meta.url`, so
|
|
20
|
+
* `core.importMetaUrl` must identify the loaded file.
|
|
21
|
+
*/
|
|
22
|
+
export declare function loadVormaConfig(input: {
|
|
23
|
+
readonly configPath: string;
|
|
24
|
+
readonly cmd: "build" | "serve";
|
|
25
|
+
readonly mode: "production" | "development";
|
|
26
|
+
}): Effect.Effect<{
|
|
27
|
+
config: {
|
|
28
|
+
readonly core: {
|
|
29
|
+
readonly importMetaUrl: string;
|
|
30
|
+
readonly distDir: string;
|
|
31
|
+
readonly staticPublicAssets: {
|
|
32
|
+
readonly srcDir: string;
|
|
33
|
+
readonly serveUrlPathPrefix: string;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
readonly build: {
|
|
37
|
+
readonly serverStartCmd: readonly [string, ...string[]];
|
|
38
|
+
};
|
|
39
|
+
readonly client: {
|
|
40
|
+
readonly tsConfigFile: string;
|
|
41
|
+
readonly viteConfigFile: string;
|
|
42
|
+
readonly tsGenOutFile: string;
|
|
43
|
+
readonly criticalCssFile?: string;
|
|
44
|
+
readonly entryFile: string;
|
|
45
|
+
readonly viewFilePattern: string;
|
|
46
|
+
};
|
|
47
|
+
readonly dev?: {
|
|
48
|
+
readonly server: {
|
|
49
|
+
readonly cargoManifestFile: string;
|
|
50
|
+
readonly cargoBin: string;
|
|
51
|
+
readonly cargoArgs?: readonly string[];
|
|
52
|
+
readonly binArgs?: readonly string[];
|
|
53
|
+
readonly wrapCmdFn?: (input: {
|
|
54
|
+
readonly executable: string;
|
|
55
|
+
readonly args: ReadonlyArray<string>;
|
|
56
|
+
}) => readonly [string, ...string[]];
|
|
57
|
+
readonly preferredPort?: number;
|
|
58
|
+
};
|
|
59
|
+
readonly onChange?: readonly {
|
|
60
|
+
readonly triggers: readonly [string, ...string[]];
|
|
61
|
+
readonly actions: readonly ["hard-browser-reload" | "restart-server" | "revalidate-client-data", ...("hard-browser-reload" | "restart-server" | "revalidate-client-data")[]];
|
|
62
|
+
}[];
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
resolved: import("./resolve-config.ts").ResolvedVormaConfig;
|
|
66
|
+
configFilePath: string;
|
|
67
|
+
/** The configuration file and the files that it imports. */
|
|
68
|
+
dependencies: string[];
|
|
69
|
+
}, ConfigLoadIssue | import("./resolve-config.ts").ConfigResolutionIssue, Path.Path>;
|
|
70
|
+
/** Loads and checks the authored Vite configuration before Vorma applies its settings. */
|
|
71
|
+
export declare function checkViteConfig(input: {
|
|
72
|
+
readonly configFilePath: string;
|
|
73
|
+
readonly viteConfigFilePath: string;
|
|
74
|
+
readonly cmd: "build" | "serve";
|
|
75
|
+
readonly mode: "production" | "development";
|
|
76
|
+
}): Effect.Effect<undefined, ConfigLoadIssue, Path.Path>;
|
|
77
|
+
/**
|
|
78
|
+
* Loads the configuration for `vorma dev`, which requires `dev`. The
|
|
79
|
+
* configuration file and its dependencies restart the whole development
|
|
80
|
+
* session; Vite restarts itself for the dependencies of its own configuration.
|
|
81
|
+
*/
|
|
82
|
+
export declare function loadDevConfig(configPath: string): Effect.Effect<{
|
|
83
|
+
configFilePath: string;
|
|
84
|
+
/** The configuration file and the files that it imports. */
|
|
85
|
+
dependencies: string[];
|
|
86
|
+
config: {
|
|
87
|
+
core: {
|
|
88
|
+
readonly importMetaUrl: string;
|
|
89
|
+
readonly distDir: string;
|
|
90
|
+
readonly staticPublicAssets: {
|
|
91
|
+
readonly srcDir: string;
|
|
92
|
+
readonly serveUrlPathPrefix: string;
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
build: {
|
|
96
|
+
readonly serverStartCmd: readonly [string, ...string[]];
|
|
97
|
+
};
|
|
98
|
+
client: {
|
|
99
|
+
readonly tsConfigFile: string;
|
|
100
|
+
readonly viteConfigFile: string;
|
|
101
|
+
readonly tsGenOutFile: string;
|
|
102
|
+
readonly criticalCssFile?: string;
|
|
103
|
+
readonly entryFile: string;
|
|
104
|
+
readonly viewFilePattern: string;
|
|
105
|
+
};
|
|
106
|
+
dev: {
|
|
107
|
+
readonly server: {
|
|
108
|
+
readonly cargoManifestFile: string;
|
|
109
|
+
readonly cargoBin: string;
|
|
110
|
+
readonly cargoArgs?: readonly string[];
|
|
111
|
+
readonly binArgs?: readonly string[];
|
|
112
|
+
readonly wrapCmdFn?: (input: {
|
|
113
|
+
readonly executable: string;
|
|
114
|
+
readonly args: ReadonlyArray<string>;
|
|
115
|
+
}) => readonly [string, ...string[]];
|
|
116
|
+
readonly preferredPort?: number;
|
|
117
|
+
};
|
|
118
|
+
readonly onChange?: readonly {
|
|
119
|
+
readonly triggers: readonly [string, ...string[]];
|
|
120
|
+
readonly actions: readonly ["hard-browser-reload" | "restart-server" | "revalidate-client-data", ...("hard-browser-reload" | "restart-server" | "revalidate-client-data")[]];
|
|
121
|
+
}[];
|
|
122
|
+
};
|
|
123
|
+
};
|
|
124
|
+
resolved: {
|
|
125
|
+
buildDir: string;
|
|
126
|
+
publicDir: string;
|
|
127
|
+
buildMetadataFilePath: string;
|
|
128
|
+
configFilePath: string;
|
|
129
|
+
configDir: string;
|
|
130
|
+
serverStartCmd: VormaConfig["build"]["serverStartCmd"];
|
|
131
|
+
clientTsConfigFilePath: string;
|
|
132
|
+
clientEntryFilePath: string;
|
|
133
|
+
viewFilePattern: string;
|
|
134
|
+
clientTypesFilePath: string;
|
|
135
|
+
staticPublicAssetsSourceDir: string;
|
|
136
|
+
viteConfigFilePath: string;
|
|
137
|
+
criticalCssEntryFilePath?: string;
|
|
138
|
+
staticPublicAssetsServeUrlPathPrefix: import("./resolve-config.ts").StaticPublicAssetsServeUrlPathPrefix;
|
|
139
|
+
distDir: string;
|
|
140
|
+
dev: import("./resolve-config.ts").ResolvedDev;
|
|
141
|
+
};
|
|
142
|
+
}, ConfigLoadIssue | import("./resolve-config.ts").ConfigResolutionIssue, Path.Path>;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { Effect } from "effect";
|
|
2
|
+
import * as Path from "effect/Path";
|
|
3
|
+
import type { VormaConfig } from "../../config.ts";
|
|
4
|
+
import { type BuildDirPaths } from "../output/dist-dir.ts";
|
|
5
|
+
export type StaticPublicAssetsServeUrlPathPrefix = "/" | `/${string}/`;
|
|
6
|
+
type DevConfig = NonNullable<VormaConfig["dev"]>;
|
|
7
|
+
/** The server that `vorma dev` compiles and runs, with its paths resolved. */
|
|
8
|
+
export type ResolvedDevServer = Omit<DevConfig["server"], "cargoManifestFile" | "cargoArgs" | "binArgs"> & {
|
|
9
|
+
/** The server's Cargo manifest. */
|
|
10
|
+
readonly cargoManifestFilePath: string;
|
|
11
|
+
/** The Cargo binary target that serves the Vorma app. */
|
|
12
|
+
readonly cargoBin: string;
|
|
13
|
+
readonly cargoArgs: ReadonlyArray<string>;
|
|
14
|
+
readonly binArgs: ReadonlyArray<string>;
|
|
15
|
+
};
|
|
16
|
+
export type ResolvedDev = Omit<DevConfig, "server"> & {
|
|
17
|
+
readonly server: ResolvedDevServer;
|
|
18
|
+
/** The build directory of `vorma dev`, in the dist directory, which the development server reads. */
|
|
19
|
+
readonly buildDir: string;
|
|
20
|
+
};
|
|
21
|
+
export type ResolvedVormaConfig = {
|
|
22
|
+
/** The configuration file that `core.importMetaUrl` identifies. */
|
|
23
|
+
readonly configFilePath: string;
|
|
24
|
+
/** The directory of the configuration file; every configured path is relative to it. */
|
|
25
|
+
readonly configDir: string;
|
|
26
|
+
/** The command that `vorma build` runs to read the application's declarations. */
|
|
27
|
+
readonly serverStartCmd: VormaConfig["build"]["serverStartCmd"];
|
|
28
|
+
readonly clientTsConfigFilePath: string;
|
|
29
|
+
readonly clientEntryFilePath: string;
|
|
30
|
+
/**
|
|
31
|
+
* The configured view file pattern, with forward slashes. It is relative to
|
|
32
|
+
* `configDir` unless it is absolute, so that matching it never reads a
|
|
33
|
+
* glob character of the directory path as part of the pattern.
|
|
34
|
+
*/
|
|
35
|
+
readonly viewFilePattern: string;
|
|
36
|
+
/** Where the build writes the client project's generated types. */
|
|
37
|
+
readonly clientTypesFilePath: string;
|
|
38
|
+
readonly staticPublicAssetsSourceDir: string;
|
|
39
|
+
/** The Vite configuration that Vorma's commands load; its Vorma plugin receives this configuration. */
|
|
40
|
+
readonly viteConfigFilePath: string;
|
|
41
|
+
readonly criticalCssEntryFilePath?: string;
|
|
42
|
+
readonly staticPublicAssetsServeUrlPathPrefix: StaticPublicAssetsServeUrlPathPrefix;
|
|
43
|
+
/** The configured dist directory, which holds the build directory of `vorma build` and the build directory of `vorma dev`. */
|
|
44
|
+
readonly distDir: string;
|
|
45
|
+
readonly dev: ResolvedDev | undefined;
|
|
46
|
+
} & BuildDirPaths;
|
|
47
|
+
export type ConfigResolutionIssue = {
|
|
48
|
+
readonly _tag: "ConfigResolutionIssue";
|
|
49
|
+
readonly field: "core.importMetaUrl" | "core.staticPublicAssets.serveUrlPathPrefix";
|
|
50
|
+
readonly msg: string;
|
|
51
|
+
readonly cause?: unknown;
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* Resolves every configured path once against the configuration file's
|
|
55
|
+
* directory. The configuration is decoded before this call.
|
|
56
|
+
*/
|
|
57
|
+
export declare function resolveVormaConfig(config: VormaConfig & {
|
|
58
|
+
readonly dev: DevConfig;
|
|
59
|
+
}): Effect.Effect<ResolvedVormaConfig & {
|
|
60
|
+
readonly dev: ResolvedDev;
|
|
61
|
+
}, ConfigResolutionIssue, Path.Path>;
|
|
62
|
+
export declare function resolveVormaConfig(config: VormaConfig): Effect.Effect<ResolvedVormaConfig, ConfigResolutionIssue, Path.Path>;
|
|
63
|
+
export {};
|
|
@@ -6,19 +6,17 @@ declare const APPLICATION_SOURCE_LAYOUT_BRAND: unique symbol;
|
|
|
6
6
|
export type ApplicationSourceLayout = ResolvedVormaConfig & {
|
|
7
7
|
readonly [APPLICATION_SOURCE_LAYOUT_BRAND]: true;
|
|
8
8
|
};
|
|
9
|
-
|
|
9
|
+
/** The configuration key that names a path. */
|
|
10
|
+
export type ApplicationSourcePathField = "dev.server.cargoManifestFile" | "client.tsConfigFile" | "client.viteConfigFile" | "client.entryFile" | "client.criticalCssFile" | "client.tsGenOutFile" | "core.staticPublicAssets.srcDir" | "core.distDir";
|
|
10
11
|
export type ApplicationSourceLayoutIssue = {
|
|
11
12
|
readonly field: ApplicationSourcePathField;
|
|
12
13
|
readonly path: string;
|
|
13
|
-
readonly
|
|
14
|
-
readonly actualType?: FileSystem.File.Type;
|
|
15
|
-
readonly message?: string;
|
|
16
|
-
readonly cause?: unknown;
|
|
14
|
+
readonly msg: string;
|
|
17
15
|
};
|
|
18
16
|
export type ApplicationSourceLayoutIssues = {
|
|
19
17
|
readonly _tag: "ApplicationSourceLayoutIssues";
|
|
20
18
|
readonly issues: ReadonlyArray<ApplicationSourceLayoutIssue>;
|
|
21
19
|
};
|
|
22
20
|
/** Loads the configured source layout before any application module executes. */
|
|
23
|
-
export declare function loadApplicationSourceLayout(config:
|
|
21
|
+
export declare function loadApplicationSourceLayout<Config extends ResolvedVormaConfig>(config: Config): Effect.Effect<ApplicationSourceLayout & Config, ApplicationSourceLayoutIssues, FileSystem.FileSystem | Path.Path>;
|
|
24
22
|
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Result } from "effect";
|
|
2
|
+
declare const URL_PATHNAME_BRAND: unique symbol;
|
|
3
|
+
export type UrlPathname = string & {
|
|
4
|
+
readonly [URL_PATHNAME_BRAND]: true;
|
|
5
|
+
};
|
|
6
|
+
export type UrlPathnameParseIssue = {
|
|
7
|
+
readonly _tag: "UrlPathnameParseIssue";
|
|
8
|
+
readonly value: string;
|
|
9
|
+
readonly cause?: unknown;
|
|
10
|
+
};
|
|
11
|
+
/** Parses the exact pathname representation used for request classification. */
|
|
12
|
+
export declare function parseUrlPathname(value: string): Result.Result<UrlPathname, UrlPathnameParseIssue>;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import type { Server } from "node:http";
|
|
2
|
+
/** The loopback address of Vorma's module server, from which development documents load browser modules. */
|
|
3
|
+
export declare const MODULE_SERVER_HOST = "127.0.0.1";
|
|
4
|
+
/**
|
|
5
|
+
* Vite runs in middleware mode inside Vorma's module server: it serves browser
|
|
6
|
+
* modules and hot updates on that server's port, and its WebSocket connection
|
|
7
|
+
* uses the same server.
|
|
8
|
+
*/
|
|
9
|
+
export declare function createDevViteOptions(input: {
|
|
10
|
+
/** `http://127.0.0.1:<port>`. */
|
|
11
|
+
readonly origin: string;
|
|
12
|
+
readonly port: number;
|
|
13
|
+
readonly server: Server;
|
|
14
|
+
}): {
|
|
15
|
+
base: string;
|
|
16
|
+
publicDir: false;
|
|
17
|
+
appType: "custom";
|
|
18
|
+
server: {
|
|
19
|
+
middlewareMode: true;
|
|
20
|
+
origin: string;
|
|
21
|
+
ws: {
|
|
22
|
+
server: Server<typeof import("node:http").IncomingMessage, typeof import("node:http").ServerResponse>;
|
|
23
|
+
protocol: string;
|
|
24
|
+
host: string;
|
|
25
|
+
port: number;
|
|
26
|
+
clientPort: number;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
/** A production build serves its hashed files at the static public assets path and writes no Vite public directory. */
|
|
31
|
+
export declare function createBuildViteOptions(input: {
|
|
32
|
+
readonly base: string;
|
|
33
|
+
}): {
|
|
34
|
+
base: string;
|
|
35
|
+
publicDir: false;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* The client environment builds exactly `inputs`, the client entry, the view
|
|
39
|
+
* modules, and the critical CSS entry, and writes ES modules into the build
|
|
40
|
+
* directory's public directory, which Vorma clears itself. Every output name
|
|
41
|
+
* carries a content hash and Vorma's prefix.
|
|
42
|
+
*/
|
|
43
|
+
export declare function createClientBuildViteOptions(input: {
|
|
44
|
+
readonly outDir: string;
|
|
45
|
+
/** The source files that the build starts from. Rolldown names each output after its file. */
|
|
46
|
+
readonly inputs: ReadonlyArray<string>;
|
|
47
|
+
}): {
|
|
48
|
+
build: {
|
|
49
|
+
outDir: string;
|
|
50
|
+
emptyOutDir: false;
|
|
51
|
+
write: true;
|
|
52
|
+
assetsDir: string;
|
|
53
|
+
cssCodeSplit: true;
|
|
54
|
+
rolldownOptions: {
|
|
55
|
+
input: string[];
|
|
56
|
+
preserveEntrySignatures: "strict";
|
|
57
|
+
output: {
|
|
58
|
+
format: "es";
|
|
59
|
+
dir: string;
|
|
60
|
+
entryFileNames: "vorma_out_[name]-[hash].js";
|
|
61
|
+
chunkFileNames: "vorma_out_[name]-[hash].js";
|
|
62
|
+
assetFileNames: "vorma_out_[name]-[hash][extname]";
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* One message for each option of an authored Vite configuration that has no
|
|
69
|
+
* effect under Vorma: an option that Vorma sets itself, and an option that
|
|
70
|
+
* applies only when Vite owns a server or performs server-side rendering.
|
|
71
|
+
* Options that act on Vite's module serving in middleware mode, such as
|
|
72
|
+
* `server.cors`, `server.fs`, `server.proxy`, and `server.hmr.overlay`, are
|
|
73
|
+
* not reported.
|
|
74
|
+
*/
|
|
75
|
+
export declare function findViteOptionsWithoutEffect(input: {
|
|
76
|
+
/** The Vite configuration as its file exports it, before plugins apply. */
|
|
77
|
+
readonly config: object;
|
|
78
|
+
/** How messages name the Vite configuration file. */
|
|
79
|
+
readonly fileName: string;
|
|
80
|
+
}): ReadonlyArray<string>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type Cause, Effect } from "effect";
|
|
2
|
+
import type { ResolvedDevServer } from "../config/resolve-config.ts";
|
|
3
|
+
export declare function superviseApplicationProcess(input: {
|
|
4
|
+
readonly server: Pick<ResolvedDevServer, "binArgs" | "wrapCmdFn">;
|
|
5
|
+
readonly configDir: string;
|
|
6
|
+
readonly port: number;
|
|
7
|
+
/** The dist directory, in which the server reads the build directory of `vorma dev`. */
|
|
8
|
+
readonly distDir: string;
|
|
9
|
+
}): Effect.Effect<{
|
|
10
|
+
start: (launch: {
|
|
11
|
+
readonly executable: string;
|
|
12
|
+
readonly expectedClientBuildId: string;
|
|
13
|
+
}) => Effect.Effect<void, unknown, import("effect/process/ChildProcessSpawner").ChildProcessSpawner>;
|
|
14
|
+
stop: Effect.Effect<void, never, never>;
|
|
15
|
+
testProcessRunning: () => boolean;
|
|
16
|
+
/** Reports each started process's unrequested exit. */
|
|
17
|
+
unexpectedExit: Effect.Effect<Cause.Cause<unknown>, never, never>;
|
|
18
|
+
}, never, import("effect/Scope").Scope>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { type ClientModule } from "../publication/build-metadata.ts";
|
|
2
|
+
import type { DevBuild, DevClient } from "./build.ts";
|
|
3
|
+
import type { IndexHtmlParts } from "./index-html.ts";
|
|
4
|
+
export declare function toDevModuleUrl(input: {
|
|
5
|
+
readonly origin: string;
|
|
6
|
+
readonly root: string;
|
|
7
|
+
readonly id: string;
|
|
8
|
+
}): string;
|
|
9
|
+
/** Keeps source URLs and browser contracts on the server; responses project only requested views. */
|
|
10
|
+
export declare function assembleDevArtifacts(input: {
|
|
11
|
+
readonly build: DevBuild;
|
|
12
|
+
readonly client: DevClient;
|
|
13
|
+
readonly indexHtmlParts: IndexHtmlParts;
|
|
14
|
+
}): {
|
|
15
|
+
metadata: {
|
|
16
|
+
formatVersion: number;
|
|
17
|
+
runtimeMode: "dev";
|
|
18
|
+
clientBuildId: string;
|
|
19
|
+
declarationsHash: string;
|
|
20
|
+
staticPublicAssetsServeUrlPathPrefix: import("../config/resolve-config.ts").StaticPublicAssetsServeUrlPathPrefix;
|
|
21
|
+
staticPublicAssetFileNames: string[];
|
|
22
|
+
staticPublicAssetUrls: Readonly<Record<string, string>>;
|
|
23
|
+
criticalCss: string;
|
|
24
|
+
devCsp: {
|
|
25
|
+
moduleServerOrigin: string;
|
|
26
|
+
webSocketOrigin: string;
|
|
27
|
+
nonce?: string;
|
|
28
|
+
};
|
|
29
|
+
devHeadHtml?: string;
|
|
30
|
+
devBodyPrependHtml?: string;
|
|
31
|
+
devBodyHtml?: string;
|
|
32
|
+
clientEntry: ClientModule;
|
|
33
|
+
clientViews: {
|
|
34
|
+
[k: string]: ClientModule;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export declare const DEV_BROWSER_MODULE = "\0vorma:development-browser";
|
|
2
|
+
/** The Vite HMR event that carries the session's messages to the browser module below. */
|
|
3
|
+
export declare const DEV_BROWSER_EVENT = "vorma:development";
|
|
4
|
+
/**
|
|
5
|
+
* What the session tells the browser. `full-reload` is Vite's own reload
|
|
6
|
+
* message; the other kinds travel on `DEV_BROWSER_EVENT` and the
|
|
7
|
+
* browser module below handles each one.
|
|
8
|
+
*/
|
|
9
|
+
export type DevBrowserMsg = {
|
|
10
|
+
readonly kind: "full-reload";
|
|
11
|
+
} | {
|
|
12
|
+
readonly kind: "rebuilding";
|
|
13
|
+
} | {
|
|
14
|
+
readonly kind: "error";
|
|
15
|
+
readonly msg: string;
|
|
16
|
+
} | {
|
|
17
|
+
readonly kind: "css";
|
|
18
|
+
readonly css: string;
|
|
19
|
+
} | {
|
|
20
|
+
readonly kind: "revalidate";
|
|
21
|
+
} | {
|
|
22
|
+
readonly kind: "ready";
|
|
23
|
+
};
|
|
24
|
+
/** Browser-only development controls use Vite's authenticated HMR connection. */
|
|
25
|
+
export declare function renderDevBrowserSource(): string;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Effect } from "effect";
|
|
2
|
+
import type { startDevClient } from "./client.ts";
|
|
3
|
+
import type { DevLayout } from "./generated-paths.ts";
|
|
4
|
+
import type { DevGeneration } from "./generation.ts";
|
|
5
|
+
import type { DevWork } from "./work.ts";
|
|
6
|
+
export type DevClient = Effect.Success<ReturnType<typeof startDevClient>>;
|
|
7
|
+
export type DevBuild = {
|
|
8
|
+
readonly generation: DevGeneration;
|
|
9
|
+
readonly stylesheet: {
|
|
10
|
+
readonly css: string;
|
|
11
|
+
readonly inputFilePaths: ReadonlyArray<string>;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Prepares native CSS after the generation's public-asset inputs exist. A
|
|
16
|
+
* later build gives Vite the generation's inputs first, and reads the critical
|
|
17
|
+
* CSS again unless its work is client work alone.
|
|
18
|
+
*/
|
|
19
|
+
export declare function prepareDevBuild(input: {
|
|
20
|
+
readonly layout: DevLayout;
|
|
21
|
+
readonly generation: DevGeneration;
|
|
22
|
+
readonly client: DevClient;
|
|
23
|
+
readonly previous?: {
|
|
24
|
+
readonly build: DevBuild;
|
|
25
|
+
readonly work: DevWork;
|
|
26
|
+
};
|
|
27
|
+
}): Effect.Effect<{
|
|
28
|
+
generation: DevGeneration;
|
|
29
|
+
stylesheet: {
|
|
30
|
+
readonly css: string;
|
|
31
|
+
readonly inputFilePaths: ReadonlyArray<string>;
|
|
32
|
+
};
|
|
33
|
+
}, import("./stylesheet.ts").DevStylesheetIssue, never>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Effect } from "effect";
|
|
2
|
+
/** What Cargo reports for the server's manifest that development reads. */
|
|
3
|
+
export type CargoMetadata = {
|
|
4
|
+
/** The directory into which Cargo builds, which every build writes. */
|
|
5
|
+
readonly targetDir: string;
|
|
6
|
+
/** The workspace root, which holds `Cargo.lock` and the root `Cargo.toml`. */
|
|
7
|
+
readonly workspaceRoot: string;
|
|
8
|
+
};
|
|
9
|
+
/** Cargo could not report its metadata; the message includes Cargo's own output. */
|
|
10
|
+
export type CargoMetadataIssue = {
|
|
11
|
+
readonly _tag: "CargoMetadataIssue";
|
|
12
|
+
readonly msg: string;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Cargo's target directory and workspace root for a manifest. Cargo resolves
|
|
16
|
+
* the target directory from `CARGO_TARGET_DIR`, its configuration files, and
|
|
17
|
+
* the workspace root.
|
|
18
|
+
*/
|
|
19
|
+
export declare function readCargoMetadata(input: {
|
|
20
|
+
readonly cargoManifestFilePath: string;
|
|
21
|
+
readonly configDir: string;
|
|
22
|
+
}): Effect.Effect<{
|
|
23
|
+
targetDir: string;
|
|
24
|
+
workspaceRoot: string;
|
|
25
|
+
}, {
|
|
26
|
+
_tag: "CargoMetadataIssue";
|
|
27
|
+
msg: string;
|
|
28
|
+
}, import("effect/process/ChildProcessSpawner").ChildProcessSpawner>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Effect } from "effect";
|
|
2
|
+
/**
|
|
3
|
+
* Batches native watcher events after 30 ms without another event. Completed
|
|
4
|
+
* batches accumulate while the consumer is busy; no changed path is discarded.
|
|
5
|
+
* A watcher error is logged, and watching continues.
|
|
6
|
+
*/
|
|
7
|
+
export declare function createDevChanges(): Effect.Effect<{
|
|
8
|
+
take: Effect.Effect<ReadonlySet<string>, never, never>;
|
|
9
|
+
recordChange: (filePath: string) => void;
|
|
10
|
+
recordError: (cause: unknown) => void;
|
|
11
|
+
}, never, import("effect/Scope").Scope>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { ApplicationGeneration } from "../generation/generate-application.ts";
|
|
2
|
+
import type { DevLayout } from "./generated-paths.ts";
|
|
3
|
+
import type { DevSourceInputs } from "./sources.ts";
|
|
4
|
+
/** Inspected build information stays in the orchestrator, never in a browser manifest. */
|
|
5
|
+
export type DevClientInputs = ReturnType<typeof toDevClientInputs>;
|
|
6
|
+
export declare function toDevClientInputs(input: {
|
|
7
|
+
readonly layout: DevLayout;
|
|
8
|
+
readonly generation: ApplicationGeneration;
|
|
9
|
+
readonly sources: DevSourceInputs;
|
|
10
|
+
}): {
|
|
11
|
+
configFilePath: string;
|
|
12
|
+
viteConfigFilePath: string;
|
|
13
|
+
clientEntryFilePath: string;
|
|
14
|
+
clientViewModules: readonly string[];
|
|
15
|
+
coordinatedResolutionFiles: ReadonlySet<string>;
|
|
16
|
+
generatedPaths: readonly string[];
|
|
17
|
+
views: readonly import("../generation/client-view-entries.ts").ClientViewEntry[];
|
|
18
|
+
staticPublicAssetLookups: readonly import("../inspection/inspect-projects.ts").StaticPublicAssetLookup[];
|
|
19
|
+
clientSourceTexts: {
|
|
20
|
+
[k: string]: string;
|
|
21
|
+
};
|
|
22
|
+
staticPublicAssets: readonly import("../assets/static-public-assets.ts").StaticPublicAsset[];
|
|
23
|
+
staticPublicAssetUrls: Readonly<Record<string, string>>;
|
|
24
|
+
publicDir: string;
|
|
25
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Effect } from "effect";
|
|
2
|
+
import { type ViteDevServer } from "vite";
|
|
3
|
+
import type { DevClientInputs } from "./client-inputs.ts";
|
|
4
|
+
import { type IndexHtmlParts } from "./index-html.ts";
|
|
5
|
+
import { type DevModuleServerAddress } from "./module-server.ts";
|
|
6
|
+
export type DevClientIssue = {
|
|
7
|
+
readonly _tag: "DevClientIssue";
|
|
8
|
+
readonly operation: "create" | "listen" | "close";
|
|
9
|
+
readonly cause: unknown;
|
|
10
|
+
};
|
|
11
|
+
/** Starts Vite for one inspected application; the surrounding Effect scope closes it. */
|
|
12
|
+
export declare function startDevClient(input: {
|
|
13
|
+
readonly inputs: DevClientInputs;
|
|
14
|
+
readonly address: DevModuleServerAddress;
|
|
15
|
+
readonly recordChangeFn: (filePath: string) => void;
|
|
16
|
+
/** Called when Vite has restarted itself, such as after a change to the Vite configuration. */
|
|
17
|
+
readonly onNativeRestartFn: () => void;
|
|
18
|
+
/** The Vorma configuration and its dependencies; a change restarts the session, not Vite alone. */
|
|
19
|
+
readonly configFiles: ReadonlySet<string>;
|
|
20
|
+
}): Effect.Effect<{
|
|
21
|
+
server: ViteDevServer;
|
|
22
|
+
restart: Effect.Effect<void, import("effect/Cause").UnknownError, never>;
|
|
23
|
+
origin: string;
|
|
24
|
+
webSocketOrigin: string;
|
|
25
|
+
/** The value of Vite's `html.cspNonce`, which reaches the development head. */
|
|
26
|
+
readonly cspNonce: string | undefined;
|
|
27
|
+
listen: Effect.Effect<void, import("./module-server.ts").DevModuleServerIssue, never>;
|
|
28
|
+
readonly views: readonly import("../generation/client-view-entries.ts").ClientViewEntry[];
|
|
29
|
+
resumeInspection: (shouldReload: boolean) => void;
|
|
30
|
+
/**
|
|
31
|
+
* What Vite's plugins add to the document, with every root-relative URL
|
|
32
|
+
* resolved against the module server. Vite and its plugins emit
|
|
33
|
+
* root-relative URLs for backend HTML integration. The head also carries
|
|
34
|
+
* the development browser module.
|
|
35
|
+
*/
|
|
36
|
+
readIndexHtmlParts: Effect.Effect<IndexHtmlParts, DevClientIssue, never>;
|
|
37
|
+
/** Replaces inspected sources and asset references within the existing Vite configuration. */
|
|
38
|
+
updateInputs(next: DevClientInputs): void;
|
|
39
|
+
}, DevClientIssue, import("effect/Scope").Scope>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** Process-environment names that the server reads. */
|
|
2
|
+
export declare const PROCESS_ENV_PROTOCOL: {
|
|
3
|
+
/**
|
|
4
|
+
* The dist directory, in a process that `vorma dev` started. The server
|
|
5
|
+
* reads its build from the build directory of `vorma dev` in it.
|
|
6
|
+
* `vorma dev` sets the variable for the server that it starts. A server in
|
|
7
|
+
* any other process ignores it and reads the application's
|
|
8
|
+
* `prod_dist_dir`.
|
|
9
|
+
*/
|
|
10
|
+
readonly distDirEnvVar: "VORMA_DIST_DIR";
|
|
11
|
+
};
|
|
12
|
+
/** Private development coordination between the launcher and the application process. */
|
|
13
|
+
export declare const DEV_PROTOCOL: {
|
|
14
|
+
readonly serverPortEnvVar: "PORT";
|
|
15
|
+
/** Set to "1" in a process that `vorma dev` started; `getIsDev` reads it. */
|
|
16
|
+
readonly devProcessEnvVar: "__VORMA_IS_DEV";
|
|
17
|
+
/**
|
|
18
|
+
* Vorma's handler answers a GET of this path in development with 200 and
|
|
19
|
+
* its build ID; `vorma dev` treats a replacement process as ready only
|
|
20
|
+
* after that answer.
|
|
21
|
+
*/
|
|
22
|
+
readonly readinessPath: "/.vorma/healthz";
|
|
23
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { ResolvedDev } from "../config/resolve-config.ts";
|
|
2
|
+
import type { ApplicationSourceLayout } from "../config/source-layout.ts";
|
|
3
|
+
import type { CargoMetadata } from "./cargo-metadata.ts";
|
|
4
|
+
/**
|
|
5
|
+
* The source layout, what Cargo reports for the server's manifest, and the
|
|
6
|
+
* paths that development writes, all of which only development reads.
|
|
7
|
+
* `buildDir`, `publicDir`, and `buildMetadataFilePath` name the build
|
|
8
|
+
* directory of `vorma dev`, not the build directory of `vorma build`.
|
|
9
|
+
*/
|
|
10
|
+
export type DevLayout = ApplicationSourceLayout & {
|
|
11
|
+
readonly dev: ResolvedDev;
|
|
12
|
+
readonly cargo: CargoMetadata;
|
|
13
|
+
/** See `getGeneratedPaths`. */
|
|
14
|
+
readonly generatedPaths: ReadonlyArray<string>;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* The paths that `vorma build`, `vorma dev`, and Cargo write: the configured
|
|
18
|
+
* dist directory, the client's generated types file, and Cargo's target
|
|
19
|
+
* directory. Their changes never start
|
|
20
|
+
* development work. `cargoTargetDir` is `undefined` only when Cargo could not
|
|
21
|
+
* report it, and the session then fails before it runs Cargo.
|
|
22
|
+
*/
|
|
23
|
+
export declare function getGeneratedPaths(input: {
|
|
24
|
+
readonly distDir: string;
|
|
25
|
+
readonly clientTypesFilePath: string;
|
|
26
|
+
readonly cargoTargetDir: string | undefined;
|
|
27
|
+
}): ReadonlyArray<string>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Effect } from "effect";
|
|
2
|
+
import { type ApplicationGeneration } from "../generation/generate-application.ts";
|
|
3
|
+
import type { DevLayout } from "./generated-paths.ts";
|
|
4
|
+
import { type DevSourceInputs } from "./sources.ts";
|
|
5
|
+
import type { DevWork } from "./work.ts";
|
|
6
|
+
export type DevGeneration = {
|
|
7
|
+
readonly application: ApplicationGeneration;
|
|
8
|
+
readonly sources: DevSourceInputs;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Captures independent source and public inputs concurrently, without
|
|
12
|
+
* activating a runtime, and writes the generated client types. The first
|
|
13
|
+
* generation of a session reads every input. A later generation reads only
|
|
14
|
+
* what its work changes: server work inspects the server and the client
|
|
15
|
+
* project and captures the static public assets, client work inspects the client
|
|
16
|
+
* project and reuses the server's inspection, and static work captures the
|
|
17
|
+
* static public assets and reuses both inspections.
|
|
18
|
+
*/
|
|
19
|
+
export declare function prepareDevGeneration(input: {
|
|
20
|
+
readonly layout: DevLayout;
|
|
21
|
+
readonly previous?: {
|
|
22
|
+
readonly generation: DevGeneration;
|
|
23
|
+
readonly work: DevWork;
|
|
24
|
+
};
|
|
25
|
+
}): Effect.Effect<{
|
|
26
|
+
application: ApplicationGeneration;
|
|
27
|
+
sources: DevSourceInputs;
|
|
28
|
+
}, import("../generation/generate-application.ts").ApplicationModelIssues | import("../generation/generate-application.ts").GeneratedApplicationWriteIssue | import("../assets/static-public-assets.ts").StaticPublicAssetIssue | import("../inspection/typescript-projects.ts").TsProjectIssue | import("../generation/generate-application.ts").UnknownStaticPublicAssetKeys | {
|
|
29
|
+
_tag: "InspectionIssues";
|
|
30
|
+
issues: import("../inspection/inspect-projects.ts").InspectionIssue[];
|
|
31
|
+
}, import("effect/process/ChildProcessSpawner").ChildProcessSpawner | import("effect/FileSystem").FileSystem | import("effect/Path").Path>;
|