@jk2908/solas 0.1.0 → 0.1.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/README.md +8 -14
- package/dist/cli.js +1 -0
- package/dist/index.js +3 -3
- package/dist/types.d.ts +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -72,23 +72,21 @@ All Solas options are passed to `solas()` inside `defineConfig`.
|
|
|
72
72
|
|
|
73
73
|
### `url`
|
|
74
74
|
|
|
75
|
-
|
|
75
|
+
`url` is optional. If you set it, Solas treats it as the public origin for your app.
|
|
76
76
|
|
|
77
|
-
|
|
77
|
+
Solas resolves it in this order:
|
|
78
78
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
- `config.url`
|
|
79
|
+
- the `url` option passed to `solas()`
|
|
82
80
|
- `VITE_APP_URL`
|
|
83
|
-
- `APP_URL`
|
|
84
81
|
|
|
85
82
|
Current behaviour:
|
|
86
83
|
|
|
87
84
|
- Solas reads that value during plugin configuration.
|
|
88
|
-
- Solas
|
|
89
|
-
-
|
|
85
|
+
- Solas exposes the resolved value as `import.meta.env.VITE_APP_URL`.
|
|
86
|
+
- If `url` is set, prerender uses it as the request origin for build-time renders.
|
|
87
|
+
- The runtime router does not otherwise require `config.url` for routing to work.
|
|
90
88
|
|
|
91
|
-
In practice,
|
|
89
|
+
In practice, you only need `url` if your app code wants to read the public origin from `import.meta.env.VITE_APP_URL`, or if your prerendered output needs a real public origin.
|
|
92
90
|
|
|
93
91
|
If you do want to set it explicitly, this is the shape:
|
|
94
92
|
|
|
@@ -102,11 +100,7 @@ export default defineConfig(({ mode }) => ({
|
|
|
102
100
|
}))
|
|
103
101
|
```
|
|
104
102
|
|
|
105
|
-
If you prefer environment
|
|
106
|
-
|
|
107
|
-
```sh
|
|
108
|
-
APP_URL=https://example.com
|
|
109
|
-
```
|
|
103
|
+
If you prefer an environment variable, set this instead:
|
|
110
104
|
|
|
111
105
|
```sh
|
|
112
106
|
VITE_APP_URL=https://example.com
|
package/dist/cli.js
CHANGED
package/dist/index.js
CHANGED
|
@@ -21,7 +21,7 @@ function solas(c) {
|
|
|
21
21
|
const config = Solas.Config.validate({
|
|
22
22
|
...DEFAULT_CONFIG,
|
|
23
23
|
...c,
|
|
24
|
-
url: c.url ?? process.env.VITE_APP_URL?.toString()
|
|
24
|
+
url: c.url ?? process.env.VITE_APP_URL?.toString(),
|
|
25
25
|
});
|
|
26
26
|
if (config.logger?.level)
|
|
27
27
|
Logger.defaultLevel = config.logger.level;
|
|
@@ -183,8 +183,7 @@ function solas(c) {
|
|
|
183
183
|
viteConfig.server ??= {};
|
|
184
184
|
viteConfig.server.port = config.port ?? viteConfig.server.port ?? 8787;
|
|
185
185
|
viteConfig.define ??= {};
|
|
186
|
-
viteConfig.define['import.meta.env.
|
|
187
|
-
viteConfig.define['import.meta.env.VITE_APP_URL'] = JSON.stringify(process.env.VITE_APP_URL);
|
|
186
|
+
viteConfig.define['import.meta.env.VITE_APP_URL'] = JSON.stringify(config.url);
|
|
188
187
|
viteConfig.define['import.meta.env.SOLAS_VERSION'] = JSON.stringify(pkg.version);
|
|
189
188
|
viteConfig.resolve ??= {};
|
|
190
189
|
viteConfig.resolve.alias = {
|
|
@@ -216,6 +215,7 @@ function solas(c) {
|
|
|
216
215
|
await Bun.write(path.join(generatedDir, 'build.json'), JSON.stringify({
|
|
217
216
|
prerenderedRoutes: Array.from(buildContext.prerenderedRoutes),
|
|
218
217
|
precompress: config.precompress,
|
|
218
|
+
url: config.url,
|
|
219
219
|
}));
|
|
220
220
|
logger.info('[closeBundle]', 'vite build complete');
|
|
221
221
|
},
|
package/dist/types.d.ts
CHANGED
|
@@ -82,6 +82,7 @@ export type LooseNumber<T extends number> = T | (number & {});
|
|
|
82
82
|
export type BuildManifest = {
|
|
83
83
|
prerenderedRoutes: string[];
|
|
84
84
|
precompress: boolean;
|
|
85
|
+
url?: PluginConfig['url'];
|
|
85
86
|
};
|
|
86
87
|
export declare namespace Route {
|
|
87
88
|
type Metadata = Metadata.Item | ((input: Metadata.Input<Router.Params>) => Promise<Metadata.Item> | Metadata.Item);
|