@guren/plugin-vercel 0.1.1 → 0.2.0

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/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ServiceProvider } from '@guren/core';
1
+ import { ServiceProviderConstructor } from '@guren/core';
2
2
 
3
3
  type PathLike = string | URL;
4
4
  interface VercelAppLike {
@@ -17,10 +17,22 @@ interface BuildVercelOutputOptions {
17
17
  ssrDir?: PathLike;
18
18
  migrationsDir?: PathLike;
19
19
  }
20
- declare class GurenPluginVercelProvider extends ServiceProvider {
21
- register(): void;
20
+ /**
21
+ * Configuration for the Vercel plugin. Currently empty — reserved so future
22
+ * fields never force another registration-shape change.
23
+ */
24
+ interface VercelPluginConfig {
22
25
  }
26
+ /**
27
+ * Register the Vercel plugin.
28
+ *
29
+ * @example
30
+ * ```typescript
31
+ * createApp({ providers: [vercelPlugin()] })
32
+ * ```
33
+ */
34
+ declare function vercelPlugin(config?: VercelPluginConfig): ServiceProviderConstructor;
23
35
  declare function createVercelHandler(app: VercelAppLike): Promise<VercelHandler>;
24
36
  declare function buildVercelOutput(options?: BuildVercelOutputOptions): void;
25
37
 
26
- export { type BuildVercelOutputOptions, GurenPluginVercelProvider, type VercelAppLike, type VercelHandler, buildVercelOutput, createVercelHandler };
38
+ export { type BuildVercelOutputOptions, type VercelAppLike, type VercelHandler, type VercelPluginConfig, buildVercelOutput, createVercelHandler, vercelPlugin };
package/dist/index.js CHANGED
@@ -2,11 +2,15 @@
2
2
  import { cpSync, existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "fs";
3
3
  import { basename, extname, resolve } from "path";
4
4
  import { fileURLToPath } from "url";
5
- import { ServiceProvider } from "@guren/core";
6
- var GurenPluginVercelProvider = class extends ServiceProvider {
5
+ import { definePlugin } from "@guren/core";
6
+ var factory = definePlugin({
7
+ name: "vercel",
7
8
  register() {
8
9
  }
9
- };
10
+ });
11
+ function vercelPlugin(config = {}) {
12
+ return factory(config);
13
+ }
10
14
  async function createVercelHandler(app) {
11
15
  await app.boot();
12
16
  return {
@@ -37,6 +41,16 @@ function buildVercelOutput(options = {}) {
37
41
  {
38
42
  version: 3,
39
43
  routes: [
44
+ // Built assets self-reference the Vite plugin's derived base,
45
+ // `/public/assets/`, while the files themselves are copied to the
46
+ // output root. Without this the entry script still loads — its path
47
+ // is injected directly — but every chunk it imports falls through
48
+ // to the function and comes back as HTML.
49
+ //
50
+ // A `rewrites` entry in vercel.json only covers builds Vercel runs
51
+ // itself; a `--prebuilt` upload is routed by this file alone, which
52
+ // is the flow the deployment guide documents.
53
+ { src: "/public/(.*)", dest: "/$1" },
40
54
  { handle: "filesystem" },
41
55
  { src: "/(.*)", dest: "/index" }
42
56
  ]
@@ -162,7 +176,7 @@ function loadManifest(...paths) {
162
176
  return void 0;
163
177
  }
164
178
  export {
165
- GurenPluginVercelProvider,
166
179
  buildVercelOutput,
167
- createVercelHandler
180
+ createVercelHandler,
181
+ vercelPlugin
168
182
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@guren/plugin-vercel",
3
- "version": "0.1.1",
3
+ "version": "0.2.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -15,6 +15,9 @@
15
15
  "publishConfig": {
16
16
  "access": "public"
17
17
  },
18
+ "gurenPlugin": {
19
+ "compatibility": ">=1.0.0 <2.0.0"
20
+ },
18
21
  "files": [
19
22
  "dist"
20
23
  ],
@@ -32,7 +35,7 @@
32
35
  "typecheck": "tsc --noEmit"
33
36
  },
34
37
  "dependencies": {
35
- "@guren/core": "^1.0.0-rc.12"
38
+ "@guren/core": "^1.3.0"
36
39
  },
37
40
  "devDependencies": {
38
41
  "@types/node": "^20.14.10",