@ruvyxa/adapter-netlify 1.0.2 → 1.0.4

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,7 +1,27 @@
1
1
  import type { Adapter } from "@ruvyxa/core";
2
+ /**
3
+ * Options for the Netlify adapter.
4
+ */
2
5
  export interface NetlifyAdapterOptions {
6
+ /** Custom Netlify functions directory. Defaults to `${outDir}/netlify/functions`. */
3
7
  functionsDir?: string;
4
8
  }
9
+ /**
10
+ * Create a Netlify deployment adapter for Ruvyxa.
11
+ *
12
+ * Produces serverless function bundles and static assets for Netlify
13
+ * deployment. Generates a `netlify.toml` config reference for routing.
14
+ *
15
+ * @example
16
+ * ```ts
17
+ * import { defineConfig } from "ruvyxa/config"
18
+ * import { netlifyAdapter } from "@ruvyxa/adapter-netlify"
19
+ *
20
+ * export default defineConfig({
21
+ * adapter: netlifyAdapter({ functionsDir: "netlify/functions" })
22
+ * })
23
+ * ```
24
+ */
5
25
  export declare function netlifyAdapter(options?: NetlifyAdapterOptions): Adapter;
6
26
  export default netlifyAdapter;
7
27
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAA+B,MAAM,cAAc,CAAA;AAExE,MAAM,WAAW,qBAAqB;IACpC,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB;AAED,wBAAgB,cAAc,CAAC,OAAO,GAAE,qBAA0B,GAAG,OAAO,CAiB3E;AAED,eAAe,cAAc,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAA+B,MAAM,cAAc,CAAA;AAExE;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,qFAAqF;IACrF,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,cAAc,CAAC,OAAO,GAAE,qBAA0B,GAAG,OAAO,CA8B3E;AAED,eAAe,cAAc,CAAA"}
package/dist/index.js CHANGED
@@ -1,8 +1,31 @@
1
+ /**
2
+ * Create a Netlify deployment adapter for Ruvyxa.
3
+ *
4
+ * Produces serverless function bundles and static assets for Netlify
5
+ * deployment. Generates a `netlify.toml` config reference for routing.
6
+ *
7
+ * @example
8
+ * ```ts
9
+ * import { defineConfig } from "ruvyxa/config"
10
+ * import { netlifyAdapter } from "@ruvyxa/adapter-netlify"
11
+ *
12
+ * export default defineConfig({
13
+ * adapter: netlifyAdapter({ functionsDir: "netlify/functions" })
14
+ * })
15
+ * ```
16
+ */
1
17
  export function netlifyAdapter(options = {}) {
18
+ if (options.functionsDir !== undefined && typeof options.functionsDir !== "string") {
19
+ throw new Error(`[RUV2001] netlifyAdapter: "functionsDir" must be a string, got ${typeof options.functionsDir}`);
20
+ }
21
+ if (options.functionsDir !== undefined && options.functionsDir.trim() === "") {
22
+ throw new Error(`[RUV2001] netlifyAdapter: "functionsDir" must not be an empty string`);
23
+ }
2
24
  return {
3
25
  name: "netlify",
4
26
  target: "serverless",
5
27
  build(ctx) {
28
+ validateBuildContext(ctx, "netlifyAdapter");
6
29
  const functionsDir = options.functionsDir ?? `${ctx.outDir}/netlify/functions`;
7
30
  return {
8
31
  name: "netlify",
@@ -17,4 +40,12 @@ export function netlifyAdapter(options = {}) {
17
40
  };
18
41
  }
19
42
  export default netlifyAdapter;
43
+ function validateBuildContext(ctx, adapterName) {
44
+ if (!ctx.root || typeof ctx.root !== "string") {
45
+ throw new Error(`[RUV2000] ${adapterName}: BuildContext.root is required and must be a non-empty string`);
46
+ }
47
+ if (!ctx.outDir || typeof ctx.outDir !== "string") {
48
+ throw new Error(`[RUV2000] ${adapterName}: BuildContext.outDir is required and must be a non-empty string`);
49
+ }
50
+ }
20
51
  //# 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":"AAMA,MAAM,UAAU,cAAc,CAAC,UAAiC,EAAE;IAChE,OAAO;QACL,IAAI,EAAE,SAAS;QACf,MAAM,EAAE,YAAY;QACpB,KAAK,CAAC,GAAiB;YACrB,MAAM,YAAY,GAAG,OAAO,CAAC,YAAY,IAAI,GAAG,GAAG,CAAC,MAAM,oBAAoB,CAAA;YAC9E,OAAO;gBACL,IAAI,EAAE,SAAS;gBACf,MAAM,EAAE,YAAY;gBACpB,QAAQ,EAAE,SAAS;gBACnB,KAAK,EAAE,GAAG,GAAG,CAAC,MAAM,aAAa;gBACjC,SAAS,EAAE,GAAG,GAAG,CAAC,MAAM,SAAS;gBACjC,YAAY;gBACZ,WAAW,EAAE,CAAC,cAAc,CAAC;aAC9B,CAAA;QACH,CAAC;KACF,CAAA;AACH,CAAC;AAED,eAAe,cAAc,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAUA;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,cAAc,CAAC,UAAiC,EAAE;IAChE,IAAI,OAAO,CAAC,YAAY,KAAK,SAAS,IAAI,OAAO,OAAO,CAAC,YAAY,KAAK,QAAQ,EAAE,CAAC;QACnF,MAAM,IAAI,KAAK,CACb,kEAAkE,OAAO,OAAO,CAAC,YAAY,EAAE,CAChG,CAAA;IACH,CAAC;IAED,IAAI,OAAO,CAAC,YAAY,KAAK,SAAS,IAAI,OAAO,CAAC,YAAY,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;QAC7E,MAAM,IAAI,KAAK,CACb,sEAAsE,CACvE,CAAA;IACH,CAAC;IAED,OAAO;QACL,IAAI,EAAE,SAAS;QACf,MAAM,EAAE,YAAY;QACpB,KAAK,CAAC,GAAiB;YACrB,oBAAoB,CAAC,GAAG,EAAE,gBAAgB,CAAC,CAAA;YAC3C,MAAM,YAAY,GAAG,OAAO,CAAC,YAAY,IAAI,GAAG,GAAG,CAAC,MAAM,oBAAoB,CAAA;YAC9E,OAAO;gBACL,IAAI,EAAE,SAAS;gBACf,MAAM,EAAE,YAAY;gBACpB,QAAQ,EAAE,SAAS;gBACnB,KAAK,EAAE,GAAG,GAAG,CAAC,MAAM,aAAa;gBACjC,SAAS,EAAE,GAAG,GAAG,CAAC,MAAM,SAAS;gBACjC,YAAY;gBACZ,WAAW,EAAE,CAAC,cAAc,CAAC;aAC9B,CAAA;QACH,CAAC;KACF,CAAA;AACH,CAAC;AAED,eAAe,cAAc,CAAA;AAE7B,SAAS,oBAAoB,CAAC,GAAiB,EAAE,WAAmB;IAClE,IAAI,CAAC,GAAG,CAAC,IAAI,IAAI,OAAO,GAAG,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC9C,MAAM,IAAI,KAAK,CACb,aAAa,WAAW,gEAAgE,CACzF,CAAA;IACH,CAAC;IACD,IAAI,CAAC,GAAG,CAAC,MAAM,IAAI,OAAO,GAAG,CAAC,MAAM,KAAK,QAAQ,EAAE,CAAC;QAClD,MAAM,IAAI,KAAK,CACb,aAAa,WAAW,kEAAkE,CAC3F,CAAA;IACH,CAAC;AACH,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ruvyxa/adapter-netlify",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "Shape Ruvyxa builds for Netlify functions and assets with a small typed adapter contract.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -38,12 +38,12 @@
38
38
  }
39
39
  },
40
40
  "dependencies": {
41
- "@ruvyxa/core": "^1.0.2"
41
+ "@ruvyxa/core": "^1.0.4"
42
42
  },
43
43
  "scripts": {
44
44
  "build": "tsc -p tsconfig.json",
45
45
  "check": "tsc -p tsconfig.json --noEmit",
46
- "test": "vitest run",
46
+ "test": "node --test \"../../../tests/packages/adapter-netlify/**/*.test.ts\"",
47
47
  "format": "tsc -p tsconfig.json --noEmit"
48
48
  }
49
49
  }