@unieojs/unio-nextjs-adapter 0.1.0 → 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/README.md CHANGED
@@ -9,8 +9,35 @@ npm i @unieojs/unio-nextjs-adapter --save
9
9
  ```
10
10
 
11
11
  After a Next.js build completes, the adapter writes `.unio/output` with
12
- `unio.json`, `routes.json`, `middleware.json`, `artifacts.json`, static assets,
13
- and server function descriptors.
12
+ `unio.json`, `routes.json`, `middleware.json`, `artifacts.json`,
13
+ `features.json`, `observability.json`, static assets, and server function
14
+ descriptors.
15
+
16
+ Zero-config platform usage can point Next.js at the package entry through
17
+ `adapterPath` or `NEXT_ADAPTER_PATH`.
18
+
19
+ Projects that need deployment-specific sidecars can create a local adapter
20
+ module and pass extension hooks:
21
+
22
+ ```js
23
+ import { createUnioNextjsAdapter } from "@unieojs/unio-nextjs-adapter";
24
+
25
+ export default createUnioNextjsAdapter({
26
+ extendServerFunctionDescriptor({ descriptor, routeGroup }) {
27
+ return {
28
+ ...descriptor,
29
+ "x-example-platform": { routeGroup },
30
+ };
31
+ },
32
+ extendArtifacts({ artifacts }) {
33
+ return artifacts;
34
+ },
35
+ async afterEmit({ outputDir }) {
36
+ // Write files referenced by extra artifacts here.
37
+ void outputDir;
38
+ },
39
+ });
40
+ ```
14
41
 
15
42
  Current support:
16
43
 
@@ -20,3 +47,20 @@ Current support:
20
47
  - Node.js middleware is represented in `middleware.json` and backed by a
21
48
  `serverFunction`.
22
49
  - Edge middleware and edge routes fail fast until Unio support lands.
50
+
51
+ Example output:
52
+
53
+ ```text
54
+ .unio/output/
55
+ unio.json
56
+ routes.json
57
+ middleware.json
58
+ artifacts.json
59
+ features.json
60
+ observability.json
61
+ static/
62
+ server-functions/
63
+ app-routes-api-hello/
64
+ serverFunction.json
65
+ .next/server/app/api/hello/route.js
66
+ ```
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { NextAdapter } from "./types.js";
1
+ import type { NextAdapter, UnioNextjsAdapterOptions } from "./types.js";
2
2
  /**
3
3
  * Adapter name. Exported at top level so Next.js can read it when loading
4
4
  * via the CJS entry: its `interopDefault(mod) = mod.default` returns the
@@ -6,10 +6,10 @@ import type { NextAdapter } from "./types.js";
6
6
  * inside the default export.
7
7
  */
8
8
  export declare const name = "unio-nextjs-adapter";
9
+ export declare function createUnioNextjsAdapter(options?: UnioNextjsAdapterOptions): NextAdapter;
9
10
  export declare const adapter: NextAdapter;
10
11
  export default adapter;
11
12
  export { modifyConfig } from "./modify-config.js";
12
13
  export { onBuildComplete } from "./on-build-complete.js";
13
14
  export { emitUboaOutput } from "./uboa.js";
14
- export { assertSsgOnly } from "./assert-ssg.js";
15
- export type { BuildContext, ModifyConfigContext, NextAdapter, NextConfigLike, NextPhase, Outputs, PrerenderOutput, RouteOutput, RoutingInfo, StaticFileOutput, } from "./types.js";
15
+ export type { AfterEmitContext, BuildContext, CapabilityStatus, ExtendArtifactsContext, ExtendServerFunctionDescriptorContext, GeneratedUboa, ModifyConfigContext, NextAdapter, NextConfigLike, NextPhase, NextRouteOutputGroup, Outputs, PrerenderOutput, RouteOutput, RoutingInfo, StaticFileOutput, UboaApiSchemaArtifact, UboaApiSchemaFormat, UboaArtifact, UboaArtifactReference, UboaArtifactResourceKind, UboaAssetsRoute, UboaAssetsArtifact, UboaCapabilities, UboaEdgeBundleArtifact, UboaEdgeFunctionRoute, UboaEdgeMiddleware, UboaMiddleware, UboaNodejsMiddleware, UboaRoute, UboaServerFunctionDescriptor, UboaServerFunctionArtifact, UboaServerFunctionRoute, UnioNextjsAdapterOptions, } from "./types.js";
package/dist/index.js CHANGED
@@ -7,14 +7,16 @@ import { onBuildComplete } from "./on-build-complete.js";
7
7
  * inside the default export.
8
8
  */
9
9
  export const name = "unio-nextjs-adapter";
10
- export const adapter = {
11
- name,
12
- modifyConfig,
13
- onBuildComplete,
14
- };
10
+ export function createUnioNextjsAdapter(options = {}) {
11
+ return {
12
+ name,
13
+ modifyConfig,
14
+ onBuildComplete: (ctx) => onBuildComplete(ctx, options),
15
+ };
16
+ }
17
+ export const adapter = createUnioNextjsAdapter();
15
18
  export default adapter;
16
19
  export { modifyConfig } from "./modify-config.js";
17
20
  export { onBuildComplete } from "./on-build-complete.js";
18
21
  export { emitUboaOutput } from "./uboa.js";
19
- export { assertSsgOnly } from "./assert-ssg.js";
20
22
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAGzD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,qBAAqB,CAAC;AAE1C,MAAM,CAAC,MAAM,OAAO,GAAgB;IAClC,IAAI;IACJ,YAAY;IACZ,eAAe;CAChB,CAAC;AAEF,eAAe,OAAO,CAAC;AAEvB,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAGzD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,qBAAqB,CAAC;AAE1C,MAAM,UAAU,uBAAuB,CACrC,UAAoC,EAAE;IAEtC,OAAO;QACL,IAAI;QACJ,YAAY;QACZ,eAAe,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,eAAe,CAAC,GAAG,EAAE,OAAO,CAAC;KACxD,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,OAAO,GAAgB,uBAAuB,EAAE,CAAC;AAE9D,eAAe,OAAO,CAAC;AAEvB,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC"}
@@ -1,2 +1,2 @@
1
- import type { BuildContext } from "./types.js";
2
- export declare function onBuildComplete(ctx: BuildContext): Promise<void>;
1
+ import type { BuildContext, UnioNextjsAdapterOptions } from "./types.js";
2
+ export declare function onBuildComplete(ctx: BuildContext, options?: UnioNextjsAdapterOptions): Promise<void>;
@@ -23,6 +23,7 @@ async function cleanIntermediate(intermediateDir, protectedDirs) {
23
23
  return false;
24
24
  }
25
25
  try {
26
+ await fs.access(target);
26
27
  await fs.rm(target, { recursive: true, force: true });
27
28
  return true;
28
29
  }
@@ -30,9 +31,12 @@ async function cleanIntermediate(intermediateDir, protectedDirs) {
30
31
  return false;
31
32
  }
32
33
  }
33
- export async function onBuildComplete(ctx) {
34
+ export async function onBuildComplete(ctx, options = {}) {
34
35
  const { projectDir, distDir } = ctx;
35
- const uboa = await emitUboaOutput(ctx);
36
+ const uboa = await emitUboaOutput(ctx, options);
37
+ await logAndClean(uboa, projectDir, distDir);
38
+ }
39
+ async function logAndClean(uboa, projectDir, distDir) {
36
40
  const uboaOutputDir = path.resolve(projectDir, ".unio", "output");
37
41
  const intermediates = new Set();
38
42
  intermediates.add(path.resolve(projectDir, "out"));
@@ -41,7 +45,8 @@ export async function onBuildComplete(ctx) {
41
45
  for (const dir of intermediates) {
42
46
  const cleaned = await cleanIntermediate(dir, [projectDir, uboaOutputDir]);
43
47
  if (cleaned) {
44
- console.log(`${LOG_PREFIX} cleaned intermediate ${path.relative(projectDir, dir) || dir}/`);
48
+ const label = path.relative(projectDir, dir) || dir;
49
+ console.log(`${LOG_PREFIX} cleaned intermediate ${label}/`);
45
50
  }
46
51
  }
47
52
  console.log(`${LOG_PREFIX} ✔ .unio/output ready: ` +
@@ -1 +1 @@
1
- {"version":3,"file":"on-build-complete.js","sourceRoot":"","sources":["../src/on-build-complete.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAG3C,MAAM,UAAU,GAAG,uBAAuB,CAAC;AAE3C;;;;;;;;GAQG;AACH,KAAK,UAAU,iBAAiB,CAC9B,eAAuB,EACvB,aAAuB;IAEvB,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;IAE7C,KAAK,MAAM,CAAC,IAAI,aAAa,EAAE,CAAC;QAC9B,MAAM,YAAY,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QACrC,IAAI,MAAM,KAAK,YAAY;YAAE,OAAO,KAAK,CAAC;QAC1C,MAAM,GAAG,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;QAChD,MAAM,QAAQ,GAAG,GAAG,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;QAC9E,IAAI,QAAQ;YAAE,OAAO,KAAK,CAAC;IAC7B,CAAC;IAED,IAAI,CAAC;QACH,MAAM,EAAE,CAAC,EAAE,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;QACtD,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,GAAiB;IACr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e;IAEf,MAAM,aAAa,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;IAElE,MAAM,aAAa,GAAG,IAAI,GAAG,EAAU,CAAC;IACxC,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC,CAAC;IACnD,IAAI,OAAO;QAAE,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;IAEtD,KAAK,MAAM,GAAG,IAAI,aAAa,EAAE,CAAC;QAChC,MAAM,OAAO,GAAG,MAAM,iBAAiB,CAAC,GAAG,EAAE,CAAC,UAAU,EAAE,aAAa,CAAC,CAAC,CAAC;QAC1E,IAAI,OAAO,EAAE,CAAC;YACZ,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,UAAU,EAAE,GAAG,CAAC,IAAI,GAAG,CAAC;YACpD,OAAO,CAAC,GAAG,CAAC,GAAG,UAAU,2BAA2B,KAAK,GAAG,CAAC,CAAC;QAChE,CAAC;IACH,CAAC;IAED,OAAO,CAAC,GAAG,CACT,GAAG,UAAU,yBAAyB;QACpC,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,aAAa,IAAI,CAAC,UAAU,CAAC,MAAM,gBAAgB;QACxE,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,YAAY,CACvC,CAAC;AACJ,CAAC"}
package/dist/types.d.ts CHANGED
@@ -56,7 +56,11 @@ export interface BuildContext {
56
56
  distDir: string;
57
57
  /** Absolute project root */
58
58
  projectDir: string;
59
+ /** Absolute repository root, when Next.js provides it */
60
+ repoRoot?: string;
59
61
  config: NextConfigLike;
62
+ nextVersion?: string;
63
+ buildId?: string;
60
64
  }
61
65
  /**
62
66
  * Second argument Next.js passes to `modifyConfig`. Verified against
@@ -73,3 +77,130 @@ export interface NextAdapter {
73
77
  modifyConfig?: (config: NextConfigLike, ctx: ModifyConfigContext) => NextConfigLike | Promise<NextConfigLike>;
74
78
  onBuildComplete?: (ctx: BuildContext) => void | Promise<void>;
75
79
  }
80
+ export type CapabilityStatus = "supported" | "partial" | "degraded" | "unsupported";
81
+ export interface UboaCapabilities {
82
+ static: CapabilityStatus;
83
+ routes: CapabilityStatus;
84
+ serverlessFunction: CapabilityStatus;
85
+ serverFunctionIntrospection: CapabilityStatus;
86
+ restRouteIntrospection: CapabilityStatus;
87
+ edgeMiddleware: CapabilityStatus;
88
+ isr: CapabilityStatus;
89
+ imageOptimization: CapabilityStatus;
90
+ }
91
+ interface UboaRouteBase {
92
+ id: string;
93
+ match: string;
94
+ }
95
+ export interface UboaAssetsRoute extends UboaRouteBase {
96
+ type: "assets";
97
+ entry: string;
98
+ serverFunction?: never;
99
+ edgeFunction?: never;
100
+ methods?: never;
101
+ }
102
+ export interface UboaServerFunctionRoute extends UboaRouteBase {
103
+ type: "serverFunction";
104
+ serverFunction: string;
105
+ methods?: string[];
106
+ entry?: never;
107
+ edgeFunction?: never;
108
+ }
109
+ export interface UboaEdgeFunctionRoute extends UboaRouteBase {
110
+ type: "edgeFunction";
111
+ edgeFunction: string;
112
+ entry?: never;
113
+ serverFunction?: never;
114
+ methods?: never;
115
+ }
116
+ export type UboaRoute = UboaAssetsRoute | UboaServerFunctionRoute | UboaEdgeFunctionRoute;
117
+ interface UboaMiddlewareBase {
118
+ name: string;
119
+ match: string[];
120
+ }
121
+ export interface UboaEdgeMiddleware extends UboaMiddlewareBase {
122
+ runtime: "edge";
123
+ entry: string;
124
+ serverFunction?: never;
125
+ }
126
+ export interface UboaNodejsMiddleware extends UboaMiddlewareBase {
127
+ runtime: "nodejs";
128
+ serverFunction: string;
129
+ entry?: never;
130
+ }
131
+ export type UboaMiddleware = UboaEdgeMiddleware | UboaNodejsMiddleware;
132
+ export type UboaArtifactResourceKind = "assets" | "serverFunction" | "edgeBundle" | "apiSchema";
133
+ export interface UboaAssetsArtifact {
134
+ id: string;
135
+ resourceKind: "assets";
136
+ path: string;
137
+ }
138
+ export interface UboaServerFunctionArtifact {
139
+ id: string;
140
+ resourceKind: "serverFunction";
141
+ path: string;
142
+ }
143
+ export interface UboaEdgeBundleArtifact {
144
+ id: string;
145
+ resourceKind: "edgeBundle";
146
+ path: string;
147
+ }
148
+ export interface UboaArtifactReference {
149
+ id: string;
150
+ resourceKind: UboaArtifactResourceKind;
151
+ }
152
+ export type UboaApiSchemaFormat = "oneapi";
153
+ export interface UboaApiSchemaArtifact {
154
+ id: string;
155
+ resourceKind: "apiSchema";
156
+ path: string;
157
+ schemaFormat: UboaApiSchemaFormat;
158
+ describes?: UboaArtifactReference;
159
+ }
160
+ export type UboaArtifact = UboaAssetsArtifact | UboaServerFunctionArtifact | UboaEdgeBundleArtifact | UboaApiSchemaArtifact;
161
+ export interface UboaServerFunctionDescriptor {
162
+ name: string;
163
+ runtime: string;
164
+ entry: string;
165
+ handler: string;
166
+ memory: number;
167
+ maxDuration: number;
168
+ environment: Record<string, unknown>;
169
+ bindings: Record<string, unknown>;
170
+ framework: Record<string, unknown>;
171
+ source: Record<string, unknown>;
172
+ [key: string]: unknown;
173
+ }
174
+ export type NextRouteOutputGroup = "pages" | "pagesApi" | "appPages" | "appRoutes" | "middleware";
175
+ export interface GeneratedUboa {
176
+ outputDir: string;
177
+ routes: UboaRoute[];
178
+ middleware: UboaMiddleware[];
179
+ artifacts: UboaArtifact[];
180
+ capabilities: UboaCapabilities;
181
+ warnings: string[];
182
+ }
183
+ export interface ExtendServerFunctionDescriptorContext {
184
+ descriptor: UboaServerFunctionDescriptor;
185
+ name: string;
186
+ route: RouteOutput;
187
+ routeGroup: NextRouteOutputGroup;
188
+ ctx: BuildContext;
189
+ }
190
+ export interface ExtendArtifactsContext {
191
+ artifacts: UboaArtifact[];
192
+ routes: UboaRoute[];
193
+ middleware: UboaMiddleware[];
194
+ ctx: BuildContext;
195
+ }
196
+ export interface AfterEmitContext {
197
+ outputDir: string;
198
+ generated: GeneratedUboa;
199
+ ctx: BuildContext;
200
+ }
201
+ export interface UnioNextjsAdapterOptions {
202
+ extendServerFunctionDescriptor?: (context: ExtendServerFunctionDescriptorContext) => Record<string, unknown> | Promise<Record<string, unknown>>;
203
+ extendArtifacts?: (context: ExtendArtifactsContext) => UboaArtifact[] | Promise<UboaArtifact[]>;
204
+ afterEmit?: (context: AfterEmitContext) => void | Promise<void>;
205
+ }
206
+ export {};
package/dist/uboa.d.ts CHANGED
@@ -1,26 +1,2 @@
1
- import type { BuildContext } from "./types.js";
2
- interface UboaRoute {
3
- id: string;
4
- match: string;
5
- type: "static" | "serverFunction";
6
- entry?: string;
7
- serverFunction?: string;
8
- }
9
- interface UboaMiddleware {
10
- name: string;
11
- match: string[];
12
- runtime: "serverless";
13
- serverFunction?: string;
14
- }
15
- interface UboaArtifact {
16
- id: string;
17
- resourceKind: "assets" | "serverFunction";
18
- path: string;
19
- }
20
- interface GeneratedUboa {
21
- routes: UboaRoute[];
22
- middleware: UboaMiddleware[];
23
- artifacts: UboaArtifact[];
24
- }
25
- export declare function emitUboaOutput(ctx: BuildContext): Promise<GeneratedUboa>;
26
- export {};
1
+ import type { BuildContext, GeneratedUboa, UnioNextjsAdapterOptions } from "./types.js";
2
+ export declare function emitUboaOutput(ctx: BuildContext, options?: UnioNextjsAdapterOptions): Promise<GeneratedUboa>;