@guren/plugin-lambda 0.6.0 → 0.6.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
@@ -15,7 +15,7 @@ Installing registers a `lambda:build` command and scaffolds `src/lambda.ts` —
15
15
  bunx guren lambda:build
16
16
  ```
17
17
 
18
- `lambda:build` runs the deploy-runtime checks `guren doctor` reports (a warning, never a failure, on an in-memory session or OAuth store, a `ScryptHasher`, or filesystem provider discovery), then your app's `build` script, then assembles a `.lambda/` directory:
18
+ `lambda:build` runs the deploy-runtime checks `guren doctor` reports (a warning, never a failure, on an in-memory session or OAuth store, a Bun-only password hasher (`Argon2Hasher`, `hasher: 'argon2'`, or `new Hash({ algorithm: 'argon2' })`), or filesystem provider discovery), then your app's `build` script, then assembles a `.lambda/` directory:
19
19
 
20
20
  | Path | Contents |
21
21
  |------|----------|
@@ -55,13 +55,13 @@ new GurenLambdaApp(stack, 'App', {
55
55
  })
56
56
  ```
57
57
 
58
- HTTP API, queue worker with partial batch failures, EventBridge scheduling, and asset routing (`/assets/*`, `/public/*`) come wired with the handler names `lambda:build` emits. Every sub-resource is exposed as a property for further customization.
58
+ HTTP API, queue worker with partial batch failures, EventBridge scheduling, and asset routing (`/public/*`, where the built assets are served from, plus each root entry of `.lambda/assets`) come wired with the handler names `lambda:build` emits. Every sub-resource is exposed as a property for further customization.
59
59
 
60
60
  ## Things Lambda changes
61
61
 
62
62
  - **Bundle time is production.** `bun build` inlines `process.env.NODE_ENV` when bundling; the build pins it to `"production"` so runtime configuration cannot accidentally ship a development bundle.
63
63
  - **The filesystem is read-only** except `/tmp`. Sessions and cache need a store that survives invocations — `DatabaseSessionStore`, or Redis via `@guren/core/redis`.
64
- - **Passwords hash with Node's scrypt.** The default hasher detects the runtime and uses `NodeHasher` off Bun; hashes are not interchangeable with Bun's `ScryptHasher`.
64
+ - **Passwords hash with Node's scrypt.** The default hasher writes `node:crypto` scrypt on every runtime, so a column seeded under Bun verifies here. Argon2id rows, written by `hasher: 'argon2'` or by a release before scrypt became the default, do not.
65
65
  - **Static assets belong on S3 + CloudFront**, not in the function. Point real asset URLs at the function's environment (`GUREN_INERTIA_ENTRY`, `GUREN_INERTIA_STYLES`) to override the baked same-origin defaults.
66
66
  - **The database wants the RDS Data API.** `createAwsDataApiDatabase` from `@guren/core` connects to Aurora Serverless v2 over HTTP — no pool, no RDS Proxy, no VPC. Classic RDS works too with `createPostgresDatabase` plus RDS Proxy (`clientOptions: { prepare: false, max: 1 }`).
67
67
 
@@ -1,7 +1,7 @@
1
1
  import { n as LAMBDA_HANDLER_MODULE, t as LAMBDA_HANDLER_EXPORTS } from "./handlers-Dtt3k5Ue.js";
2
2
  import { cpSync, existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
3
3
  import { resolve } from "node:path";
4
- import { MCP_SDK_SUBPATH_PREFIX, appUsesMcpPlugin, assertOutputDirOutsideRoot, clientManifestJson, importSpecifier, renderDevOnlyStub, resetOutputDir, resolveClientAssetEnv, resolvePathLike, resolveSsrEntryFile, ssrRuntimePaths, stageStaticAssets, stubbableDevOnlyModules, unusedSqlClients } from "@guren/core/internal/deploy-build";
4
+ import { MCP_SDK_SUBPATH_PREFIX, appUsesMcpPlugin, assertOutputDirOutsideRoot, bundledRuntimeEnv, importSpecifier, renderDevOnlyStub, resetOutputDir, resolveClientAssetEnv, resolvePathLike, resolveSsrEntryFile, ssrRuntimePaths, stageStaticAssets, stubbableDevOnlyModules, unusedSqlClients } from "@guren/core/internal/deploy-build";
5
5
  import { reportDeployRuntimeHazards } from "@guren/core/internal/deploy-check";
6
6
  //#region src/build.ts
7
7
  const MCP_UNAVAILABLE = "The MCP endpoint is unavailable on AWS Lambda — it generates files on disk.";
@@ -89,11 +89,10 @@ async function buildLambdaOutput(options = {}) {
89
89
  mkdirSync(funcDir, { recursive: true });
90
90
  stageStaticAssets(publicDir, resolve(out, "assets"));
91
91
  const env = buildLambdaEnvironment(assetEnv, ssrFile, ssrDir);
92
- const viteManifest = clientManifestJson(publicDir);
93
- const bakedEnv = viteManifest ? {
92
+ const bakedEnv = {
94
93
  ...env,
95
- GUREN_VITE_MANIFEST: viteManifest
96
- } : env;
94
+ ...bundledRuntimeEnv(root, publicDir, "Lambda build")
95
+ };
97
96
  const wrapperPath = resolve(out, `${LAMBDA_HANDLER_MODULE}.ts`);
98
97
  writeFileSync(wrapperPath, renderHandlerModule({
99
98
  out,
package/dist/cdk/index.js CHANGED
@@ -154,12 +154,9 @@ var GurenLambdaApp = class extends Construct {
154
154
  eventType: cloudfront.FunctionEventType.VIEWER_RESPONSE
155
155
  }]
156
156
  };
157
- const additionalBehaviors = {
158
- "/assets/*": assetBehavior,
159
- "/public/*": assetBehavior
160
- };
157
+ const additionalBehaviors = { "/public/*": assetBehavior };
161
158
  if (existsSync(props.assets.dir)) for (const entry of readdirSync(props.assets.dir, { withFileTypes: true })) {
162
- if (entry.name === "assets" || entry.name === "public") continue;
159
+ if (entry.name === "public") continue;
163
160
  additionalBehaviors[entry.isDirectory() ? `/${entry.name}/*` : `/${entry.name}`] = assetBehavior;
164
161
  }
165
162
  this.distribution = new cloudfront.Distribution(this, "Distribution", {
package/dist/commands.js CHANGED
@@ -1,4 +1,4 @@
1
- import { t as buildLambdaOutput } from "./build-Dn_V0LNZ.js";
1
+ import { t as buildLambdaOutput } from "./build-CDHl9ytl.js";
2
2
  import { DATABASE_DIALECTS, parseDatabaseDialects } from "@guren/core/internal/deploy-build";
3
3
  import { defineCommand } from "citty";
4
4
  var commands_default = { "lambda:build": defineCommand({
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { n as LAMBDA_HANDLER_MODULE, r as lambdaHandlerId, t as LAMBDA_HANDLER_EXPORTS } from "./handlers-Dtt3k5Ue.js";
2
- import { t as buildLambdaOutput } from "./build-Dn_V0LNZ.js";
2
+ import { t as buildLambdaOutput } from "./build-CDHl9ytl.js";
3
3
  import { definePlugin } from "@guren/core";
4
4
  //#region src/session/dynamodb-store.ts
5
5
  var DynamoDbSessionStore = class {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@guren/plugin-lambda",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -53,7 +53,7 @@
53
53
  "typecheck": "tsc --noEmit"
54
54
  },
55
55
  "dependencies": {
56
- "@guren/core": "^1.16.0",
56
+ "@guren/core": "^1.19.0",
57
57
  "citty": "^0.1.6"
58
58
  },
59
59
  "peerDependencies": {