@awsless/cli 0.0.46-next.21 → 0.0.46-next.22

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/bin.js CHANGED
@@ -101700,7 +101700,7 @@ var SitesSchema = exports_external.record(ResourceIdSchema, exports_external.obj
101700
101700
  configs: exports_external.string().array().optional().describe("Define the config values for your build command.")
101701
101701
  }).optional().describe(`Specifies the build process for sites that need a build step.`),
101702
101702
  static: exports_external.union([LocalDirectorySchema, exports_external.boolean()]).optional().describe("Specifies the path to the static files directory. Additionally you can also pass `true` when you don't have local static files, but still want to make an S3 bucket."),
101703
- ssr: FunctionSchema.optional().describe("Specifies the file that will render the site on the server.")
101703
+ ssr: StackFunctionSchema.optional().describe("Specifies the file that will render the site on the server.")
101704
101704
  })).optional().describe("Define the sites in your stack.");
101705
101705
 
101706
101706
  // src/feature/store/schema.ts
@@ -106637,7 +106637,37 @@ ${(errors3.trim() || output.trim()).slice(-2000)}`);
106637
106637
  });
106638
106638
  });
106639
106639
  }
106640
- if (props.ssr) {
106640
+ if (props.ssr && isStandaloneFunction(props.ssr)) {
106641
+ const fn = createLambdaFunction(ctx, `${id}-ssr`, props.ssr);
106642
+ const url = new aws.lambda.FunctionUrl(group, "ssr-url", {
106643
+ functionName: fn.lambda.functionName,
106644
+ authorizationType: "AWS_IAM"
106645
+ });
106646
+ new aws.lambda.Permission(group, "ssr-url-permission", {
106647
+ functionName: fn.lambda.functionName,
106648
+ statementId: "cloudfront-url",
106649
+ principal: "cloudfront.amazonaws.com",
106650
+ sourceAccount: ctx.accountId,
106651
+ action: "lambda:InvokeFunctionUrl",
106652
+ functionUrlAuthType: "AWS_IAM"
106653
+ });
106654
+ new aws.lambda.Permission(group, "ssr-invoke-permission", {
106655
+ functionName: fn.lambda.functionName,
106656
+ statementId: "cloudfront-invoke",
106657
+ principal: "cloudfront.amazonaws.com",
106658
+ sourceAccount: ctx.accountId,
106659
+ action: "lambda:InvokeFunction",
106660
+ invokedViaFunctionUrl: true
106661
+ });
106662
+ addRoutes({
106663
+ [routeKey]: {
106664
+ type: "lambda",
106665
+ forwardHost: true,
106666
+ urlEncodedQueryString: true,
106667
+ domainName: url.functionUrl.pipe((url2) => url2.split("/")[2])
106668
+ }
106669
+ });
106670
+ } else if (props.ssr) {
106641
106671
  const ssr = props.ssr;
106642
106672
  const bundleRouteKey = formatRouteKey(ctx.stack.name, "site", id);
106643
106673
  registerBundleFunction(ctx, bundleRouteKey, ssr);
@@ -107472,7 +107502,7 @@ var layerFeature = defineFeature({
107472
107502
  skipDestroy: true
107473
107503
  }, {
107474
107504
  dependsOn: [zip],
107475
- replaceOnChanges: ["sourceCodeHash", "s3ObjectVersion"]
107505
+ replaceOnChanges: ["sourceCodeHash"]
107476
107506
  });
107477
107507
  ctx.shared.add("layer", "arn", id, layer.arn);
107478
107508
  ctx.shared.add("layer", "packages", id, props.packages ?? [id]);
@@ -107529,7 +107559,7 @@ var imageFeature = defineFeature({
107529
107559
  skipDestroy: true
107530
107560
  }, {
107531
107561
  dependsOn: [zipFile],
107532
- replaceOnChanges: ["sourceCodeHash", "s3ObjectVersion"]
107562
+ replaceOnChanges: ["sourceCodeHash"]
107533
107563
  });
107534
107564
  ctx.shared.add("layer", "arn", layerId, layer.arn);
107535
107565
  const bundle = ctx.shared.get("bundle", "main");
@@ -109241,7 +109271,7 @@ var MAX_VALUE_SIZE = 1000;
109241
109271
  var ORIGIN_PLACEHOLDER = "x".repeat(64);
109242
109272
  var assertRouteValueSize = (key, route) => {
109243
109273
  const withOrigin = (entry) => {
109244
- return entry.type === "lambda" ? { ...entry, domainName: ORIGIN_PLACEHOLDER } : entry;
109274
+ return entry.type === "lambda" && !entry.domainName ? { ...entry, domainName: ORIGIN_PLACEHOLDER } : entry;
109245
109275
  };
109246
109276
  for (const entry of Array.isArray(route) ? route : [route]) {
109247
109277
  if (Buffer.byteLength(JSON.stringify(withOrigin(entry)), "utf8") > MAX_VALUE_SIZE) {
@@ -109313,7 +109343,7 @@ var routerFeature = defineFeature({
109313
109343
  for (const dependency of options?.dependsOn ?? []) {
109314
109344
  routeDependencies.add(dependency);
109315
109345
  }
109316
- if (Object.values(newRoutes).flat().some((route) => route.type === "lambda")) {
109346
+ if (Object.values(newRoutes).flat().some((route) => route.type === "lambda" && !route.domainName)) {
109317
109347
  hasLambdaRoutes = true;
109318
109348
  }
109319
109349
  });
@@ -109692,7 +109722,7 @@ var routerFeature = defineFeature({
109692
109722
  functionVersion: bundle.lambda.version,
109693
109723
  routes: $resolve([routes, lambdaUrlHost], (routes2, lambdaUrlHost2) => {
109694
109724
  const withOrigin = (route) => {
109695
- return route.type === "lambda" ? { ...route, domainName: lambdaUrlHost2 } : route;
109725
+ return route.type === "lambda" && !route.domainName ? { ...route, domainName: lambdaUrlHost2 } : route;
109696
109726
  };
109697
109727
  return Object.entries(routes2).flatMap(([key, route]) => createRouteStoreEntries(key, Array.isArray(route) ? route.map(withOrigin) : withOrigin(route)));
109698
109728
  })