@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 CHANGED
@@ -72,23 +72,21 @@ All Solas options are passed to `solas()` inside `defineConfig`.
72
72
 
73
73
  ### `url`
74
74
 
75
- Use `url` to tell Solas what the public application origin is.
75
+ `url` is optional. If you set it, Solas treats it as the public origin for your app.
76
76
 
77
- `url` is optional.
77
+ Solas resolves it in this order:
78
78
 
79
- This happens inside `solas()` when the plugin builds its validated config object. Solas assigns `config.url` with this lookup order:
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 injects `APP_URL` and `VITE_APP_URL` into `import.meta.env`.
89
- - The current Solas runtime does not otherwise require `config.url` for routing, build, or prerender to work.
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, that means you do not have to pass `url` unless your application code wants a canonical origin value, or you want to standardise that value in config rather than relying on environment variables.
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 variables, set one of these instead:
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
@@ -52,6 +52,7 @@ async function build() {
52
52
  for await (const result of Prerender.Build.run(app, manifest.prerenderedRoutes, {
53
53
  timeout,
54
54
  concurrency,
55
+ origin: manifest.url,
55
56
  })) {
56
57
  const route = result.route;
57
58
  try {
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() ?? process.env.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.APP_URL'] = JSON.stringify(process.env.APP_URL);
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);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jk2908/solas",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "A React Server Components meta-framework powered by Vite",
5
5
  "keywords": [
6
6
  "framework",