@awsless/cli 0.0.46-next.17 → 0.0.46-next.18

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
@@ -56327,7 +56327,7 @@ var require_client2 = __commonJS((exports) => {
56327
56327
  // ../../node_modules/.pnpm/@smithy+core@3.29.7/node_modules/@smithy/core/dist-cjs/submodules/config/index.js
56328
56328
  var require_config = __commonJS((exports) => {
56329
56329
  var { homedir: homedir2 } = __require("os");
56330
- var { sep: sep2, join: join28 } = __require("path");
56330
+ var { sep: sep2, join: join29 } = __require("path");
56331
56331
  var { createHash: createHash16 } = __require("crypto");
56332
56332
  var { readFile: readFile$1 } = __require("fs/promises");
56333
56333
  var { IniSectionType: IniSectionType2 } = require_dist_cjs();
@@ -56485,7 +56485,7 @@ var require_config = __commonJS((exports) => {
56485
56485
  var getSSOTokenFilepath = (id) => {
56486
56486
  const hasher = createHash16("sha1");
56487
56487
  const cacheName = hasher.update(id).digest("hex");
56488
- return join28(getHomeDir(), ".aws", "sso", "cache", `${cacheName}.json`);
56488
+ return join29(getHomeDir(), ".aws", "sso", "cache", `${cacheName}.json`);
56489
56489
  };
56490
56490
  var tokenIntercept = {};
56491
56491
  var getSSOTokenFromFile = async (id) => {
@@ -56512,9 +56512,9 @@ var require_config = __commonJS((exports) => {
56512
56512
  ...data.default && { default: data.default }
56513
56513
  });
56514
56514
  var ENV_CONFIG_PATH = "AWS_CONFIG_FILE";
56515
- var getConfigFilepath = () => process.env[ENV_CONFIG_PATH] || join28(getHomeDir(), ".aws", "config");
56515
+ var getConfigFilepath = () => process.env[ENV_CONFIG_PATH] || join29(getHomeDir(), ".aws", "config");
56516
56516
  var ENV_CREDENTIALS_PATH = "AWS_SHARED_CREDENTIALS_FILE";
56517
- var getCredentialsFilepath = () => process.env[ENV_CREDENTIALS_PATH] || join28(getHomeDir(), ".aws", "credentials");
56517
+ var getCredentialsFilepath = () => process.env[ENV_CREDENTIALS_PATH] || join29(getHomeDir(), ".aws", "credentials");
56518
56518
  var prefixKeyRegex = /^([\w-]+)\s(["'])?([\w-@+.%:/]+)\2$/;
56519
56519
  var profileNameBlockList = ["__proto__", "profile __proto__"];
56520
56520
  var parseIni = (iniData) => {
@@ -56580,11 +56580,11 @@ var require_config = __commonJS((exports) => {
56580
56580
  const relativeHomeDirPrefix = "~/";
56581
56581
  let resolvedFilepath = filepath;
56582
56582
  if (filepath.startsWith(relativeHomeDirPrefix)) {
56583
- resolvedFilepath = join28(homeDir, filepath.slice(2));
56583
+ resolvedFilepath = join29(homeDir, filepath.slice(2));
56584
56584
  }
56585
56585
  let resolvedConfigFilepath = configFilepath;
56586
56586
  if (configFilepath.startsWith(relativeHomeDirPrefix)) {
56587
- resolvedConfigFilepath = join28(homeDir, configFilepath.slice(2));
56587
+ resolvedConfigFilepath = join29(homeDir, configFilepath.slice(2));
56588
56588
  }
56589
56589
  const parsedFiles = await Promise.all([
56590
56590
  readFile13(resolvedConfigFilepath, {
@@ -74177,7 +74177,7 @@ var require_signin = __commonJS((exports) => {
74177
74177
  import { createHash as createHash16, createPrivateKey, createPublicKey, sign } from "crypto";
74178
74178
  import { promises as fs3 } from "fs";
74179
74179
  import { homedir as homedir3 } from "os";
74180
- import { dirname as dirname17, join as join31 } from "path";
74180
+ import { dirname as dirname17, join as join32 } from "path";
74181
74181
  var import_config24, import_protocols3, LoginCredentialsFetcher;
74182
74182
  var init_LoginCredentialsFetcher = __esm(() => {
74183
74183
  import_config24 = __toESM(require_config(), 1);
@@ -74336,10 +74336,10 @@ var init_LoginCredentialsFetcher = __esm(() => {
74336
74336
  await fs3.writeFile(tokenFilePath, JSON.stringify(token, null, 2), "utf8");
74337
74337
  }
74338
74338
  getTokenFilePath() {
74339
- const directory = process.env.AWS_LOGIN_CACHE_DIRECTORY ?? join31(homedir3(), ".aws", "login", "cache");
74339
+ const directory = process.env.AWS_LOGIN_CACHE_DIRECTORY ?? join32(homedir3(), ".aws", "login", "cache");
74340
74340
  const loginSessionBytes = Buffer.from(this.loginSession, "utf8");
74341
74341
  const loginSessionSha256 = createHash16("sha256").update(loginSessionBytes).digest("hex");
74342
- return join31(directory, `${loginSessionSha256}.json`);
74342
+ return join32(directory, `${loginSessionSha256}.json`);
74343
74343
  }
74344
74344
  derToRawSignature(derSignature) {
74345
74345
  let offset = 2;
@@ -106149,7 +106149,7 @@ var searchFeature = defineFeature({
106149
106149
 
106150
106150
  // src/feature/site/index.ts
106151
106151
  import { createHash as createHash12 } from "crypto";
106152
- import { basename as basename3, dirname as dirname12, join as join19 } from "path";
106152
+ import { dirname as dirname12, join as join20 } from "path";
106153
106153
 
106154
106154
  // src/util/cache.ts
106155
106155
  import { lstat as lstat3, readdir as readdir4 } from "fs/promises";
@@ -106188,6 +106188,40 @@ var listAllFiles = async (list2) => {
106188
106188
  return files;
106189
106189
  };
106190
106190
 
106191
+ // src/feature/site/static-routes.ts
106192
+ import { basename as basename3, join as join19 } from "path";
106193
+ var planStaticRoutes = (files, sitePath) => {
106194
+ const plan = { files: {}, dirs: [] };
106195
+ const assetDirs = new Set;
106196
+ for (const file2 of files) {
106197
+ if (file2.endsWith(".html")) {
106198
+ const strippedHtmlFile = file2.endsWith("index.html") ? file2.slice(0, -11) : file2.slice(0, -5);
106199
+ const urlFriendlyFile = strippedHtmlFile.endsWith("/") ? strippedHtmlFile.slice(0, -1) : strippedHtmlFile;
106200
+ plan.files[join19(sitePath, urlFriendlyFile)] = file2;
106201
+ continue;
106202
+ }
106203
+ if (!basename3(file2).includes(".")) {
106204
+ plan.files[join19(sitePath, file2)] = file2;
106205
+ continue;
106206
+ }
106207
+ if (sitePath !== "/") {
106208
+ continue;
106209
+ }
106210
+ const firstSegment = file2.split("/")[0];
106211
+ if (file2.includes("/") && !firstSegment.includes(".")) {
106212
+ assetDirs.add(firstSegment);
106213
+ continue;
106214
+ }
106215
+ plan.files[join19(sitePath, file2)] = file2;
106216
+ }
106217
+ if (sitePath === "/") {
106218
+ plan.dirs = [...assetDirs].map((dir) => join19(sitePath, dir, "*."));
106219
+ } else {
106220
+ plan.catchAll = join19(sitePath, "*.");
106221
+ }
106222
+ return plan;
106223
+ };
106224
+
106191
106225
  // src/feature/site/index.ts
106192
106226
  var siteFeature = defineFeature({
106193
106227
  name: "site",
@@ -106209,7 +106243,7 @@ var siteFeature = defineFeature({
106209
106243
  return build2(fingerprint, async (write) => {
106210
106244
  const credentialProvider = await getCredentials(ctx.appConfig.profile);
106211
106245
  const credentials2 = await credentialProvider();
106212
- const cwd = join19(directories.root, dirname12(ctx.stackConfig.file));
106246
+ const cwd = join20(directories.root, dirname12(ctx.stackConfig.file));
106213
106247
  const env2 = {
106214
106248
  ...process.env,
106215
106249
  APP: ctx.appConfig.name,
@@ -106273,7 +106307,7 @@ ${(errors3.trim() || output.trim()).slice(-2000)}`);
106273
106307
  cwd: staticDir,
106274
106308
  nodir: true
106275
106309
  }).sort();
106276
- const hashes = files.map((file2) => $hash(join19(staticDir, file2)));
106310
+ const hashes = files.map((file2) => $hash(join20(staticDir, file2)));
106277
106311
  const version = $combine(...hashes).pipe((hashes2) => {
106278
106312
  const hash2 = createHash12("sha1");
106279
106313
  for (const [index, file2] of files.entries()) {
@@ -106289,26 +106323,16 @@ ${(errors3.trim() || output.trim()).slice(-2000)}`);
106289
106323
  version
106290
106324
  });
106291
106325
  const staticRoutes = {};
106292
- for (const file2 of files) {
106293
- if (file2.endsWith(".html")) {
106294
- const strippedHtmlFile = file2.endsWith("index.html") ? file2.slice(0, -11) : file2.slice(0, -5);
106295
- const urlFriendlyFile = strippedHtmlFile.endsWith("/") ? strippedHtmlFile.slice(0, -1) : strippedHtmlFile;
106296
- const routeFileKey = join19(props.path, urlFriendlyFile);
106297
- staticRoutes[routeFileKey] = {
106298
- type: "s3",
106299
- domainName: bucket.regionalDomainName,
106300
- rewrite: { to: $interpolate`/${folder}v-${deployment.version}/${file2}` }
106301
- };
106302
- } else if (!basename3(file2).includes(".")) {
106303
- staticRoutes[join19(props.path, file2)] = {
106304
- type: "s3",
106305
- domainName: bucket.regionalDomainName,
106306
- rewrite: { to: $interpolate`/${folder}v-${deployment.version}/${file2}` }
106307
- };
106308
- }
106326
+ const plan = planStaticRoutes(files, props.path);
106327
+ for (const [routeFileKey, file2] of Object.entries(plan.files)) {
106328
+ staticRoutes[routeFileKey] = {
106329
+ type: "s3",
106330
+ domainName: bucket.regionalDomainName,
106331
+ rewrite: { to: $interpolate`/${folder}v-${deployment.version}/${file2}` }
106332
+ };
106309
106333
  }
106310
106334
  const pathPattern = props.path === "/" ? "" : props.path.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
106311
- staticRoutes[join19(props.path, "*.")] = {
106335
+ const assetRoute = {
106312
106336
  type: "s3",
106313
106337
  domainName: bucket.regionalDomainName,
106314
106338
  rewrite: {
@@ -106316,6 +106340,12 @@ ${(errors3.trim() || output.trim()).slice(-2000)}`);
106316
106340
  to: $interpolate`/${folder}v-${deployment.version}/$1`
106317
106341
  }
106318
106342
  };
106343
+ for (const routeDirKey of plan.dirs) {
106344
+ staticRoutes[routeDirKey] = assetRoute;
106345
+ }
106346
+ if (plan.catchAll) {
106347
+ staticRoutes[plan.catchAll] = assetRoute;
106348
+ }
106319
106349
  addRoutes(staticRoutes, { dependsOn: [deployment, bucket.policy] });
106320
106350
  }
106321
106351
  });
@@ -106325,7 +106355,7 @@ ${(errors3.trim() || output.trim()).slice(-2000)}`);
106325
106355
  });
106326
106356
 
106327
106357
  // src/feature/store/index.ts
106328
- import { join as join20 } from "path";
106358
+ import { join as join21 } from "path";
106329
106359
  import { toDays as toDays8 } from "@awsless/duration";
106330
106360
 
106331
106361
  // src/feature/store/util.ts
@@ -106448,8 +106478,8 @@ var storeFeature = defineFeature({
106448
106478
  key: `${folder}${file2}`,
106449
106479
  cacheControl: getCacheControl(file2),
106450
106480
  contentType: getContentType(file2),
106451
- source: join20(props.static, file2),
106452
- sourceHash: $hash(join20(props.static, file2))
106481
+ source: join21(props.static, file2),
106482
+ sourceHash: $hash(join21(props.static, file2))
106453
106483
  }, {
106454
106484
  replaceOnChanges: ["bucket", "key"]
106455
106485
  });
@@ -107074,7 +107104,7 @@ var layerFeature = defineFeature({
107074
107104
  // src/feature/image/index.ts
107075
107105
  import { toDays as toDays9 } from "@awsless/duration";
107076
107106
  import { formatRouteEnvName as formatRouteEnvName4 } from "awsless";
107077
- import { dirname as dirname13, join as join21 } from "path";
107107
+ import { dirname as dirname13, join as join22 } from "path";
107078
107108
  import { fileURLToPath as fileURLToPath9 } from "url";
107079
107109
  var imageFeature = defineFeature({
107080
107110
  name: "image",
@@ -107089,7 +107119,7 @@ var imageFeature = defineFeature({
107089
107119
  throw new FileError("app.json", "The image feature requires an arm64 function bundle.");
107090
107120
  }
107091
107121
  const group = new Group(ctx.base, "image", "layer");
107092
- const path2 = join21(dirname13(fileURLToPath9(import.meta.url)), "/layers/sharp-arm.zip");
107122
+ const path2 = join22(dirname13(fileURLToPath9(import.meta.url)), "/layers/sharp-arm.zip");
107093
107123
  const layerId = formatGlobalResourceName({
107094
107124
  appName: ctx.appConfig.name,
107095
107125
  resourceType: "layer",
@@ -107154,7 +107184,7 @@ var imageFeature = defineFeature({
107154
107184
  const serverRouteKey = formatRouteKey(ctx.stack.name, "image", id);
107155
107185
  bundle.addHandler({
107156
107186
  routeKey: serverRouteKey,
107157
- file: join21(dirname13(fileURLToPath9(import.meta.url)), "/handlers/image.js"),
107187
+ file: join22(dirname13(fileURLToPath9(import.meta.url)), "/handlers/image.js"),
107158
107188
  exportName: "default",
107159
107189
  external: ["sharp"]
107160
107190
  });
@@ -107192,8 +107222,8 @@ var imageFeature = defineFeature({
107192
107222
  new aws.s3.BucketObject(group, `static-${file2}`, {
107193
107223
  bucket: bucket.name,
107194
107224
  key: `${folder}origin/${file2}`,
107195
- source: join21(props.origin.static, file2),
107196
- sourceHash: $hash(join21(props.origin.static, file2))
107225
+ source: join22(props.origin.static, file2),
107226
+ sourceHash: $hash(join22(props.origin.static, file2))
107197
107227
  }, {
107198
107228
  replaceOnChanges: ["bucket", "key"]
107199
107229
  });
@@ -107209,7 +107239,7 @@ var imageFeature = defineFeature({
107209
107239
  // src/feature/icon/index.ts
107210
107240
  import { toDays as toDays10 } from "@awsless/duration";
107211
107241
  import { formatRouteEnvName as formatRouteEnvName5 } from "awsless";
107212
- import { dirname as dirname14, join as join22 } from "path";
107242
+ import { dirname as dirname14, join as join23 } from "path";
107213
107243
  import { fileURLToPath as fileURLToPath10 } from "url";
107214
107244
  var iconFeature = defineFeature({
107215
107245
  name: "icon",
@@ -107241,7 +107271,7 @@ var iconFeature = defineFeature({
107241
107271
  const serverRouteKey = formatRouteKey(ctx.stack.name, "icon", id);
107242
107272
  bundle.addHandler({
107243
107273
  routeKey: serverRouteKey,
107244
- file: join22(dirname14(fileURLToPath10(import.meta.url)), "/handlers/icon.js"),
107274
+ file: join23(dirname14(fileURLToPath10(import.meta.url)), "/handlers/icon.js"),
107245
107275
  exportName: "default"
107246
107276
  });
107247
107277
  addRoutes({
@@ -107281,8 +107311,8 @@ var iconFeature = defineFeature({
107281
107311
  new aws.s3.BucketObject(group, `static-${file2}`, {
107282
107312
  bucket: bucket.name,
107283
107313
  key: `${folder}origin/${file2}`,
107284
- source: join22(props.origin.static, file2),
107285
- sourceHash: $hash(join22(props.origin.static, file2))
107314
+ source: join23(props.origin.static, file2),
107315
+ sourceHash: $hash(join23(props.origin.static, file2))
107286
107316
  }, {
107287
107317
  replaceOnChanges: ["bucket", "key"]
107288
107318
  });
@@ -107309,10 +107339,10 @@ var import_deepmerge3 = __toESM(require_cjs2(), 1);
107309
107339
  // src/feature/job/build/executable.ts
107310
107340
  import { createHash as createHash13 } from "crypto";
107311
107341
  import { readFile as readFile11, writeFile as writeFile7 } from "fs/promises";
107312
- import { join as join23, resolve as resolve3 } from "path";
107342
+ import { join as join24, resolve as resolve3 } from "path";
107313
107343
  var buildJobExecutable = async (input, outputPath, architecture) => {
107314
- const filePath = join23(outputPath, "program");
107315
- const wrapperPath = join23(outputPath, "wrapper.ts");
107344
+ const filePath = join24(outputPath, "program");
107345
+ const wrapperPath = join24(outputPath, "wrapper.ts");
107316
107346
  const handlerPath = resolve3(input);
107317
107347
  await writeFile7(wrapperPath, `import { parse } from '@awsless/json'
107318
107348
  import { getObject } from '@awsless/s3'
@@ -107822,7 +107852,7 @@ import { stringify as stringify3 } from "@awsless/json";
107822
107852
  import { generateFileHash as generateFileHash3 } from "@awsless/ts-file-cache";
107823
107853
  var import_deepmerge5 = __toESM(require_cjs2(), 1);
107824
107854
  import { createHash as createHash15 } from "crypto";
107825
- import { join as join24 } from "path";
107855
+ import { join as join25 } from "path";
107826
107856
  var createFargateTask = (parentGroup, ctx, ns, id, local) => {
107827
107857
  const group = new Group(parentGroup, "instance", ns);
107828
107858
  const name = formatLocalResourceName({
@@ -108027,7 +108057,7 @@ var createFargateTask = (parentGroup, ctx, ns, id, local) => {
108027
108057
  healthCheck: props.healthCheck ? {
108028
108058
  command: [
108029
108059
  "CMD-SHELL",
108030
- `curl -f http://${join24("localhost", props.healthCheck.path)} || exit 1`
108060
+ `curl -f http://${join25("localhost", props.healthCheck.path)} || exit 1`
108031
108061
  ],
108032
108062
  interval: toSeconds10(props.healthCheck.interval),
108033
108063
  retries: props.healthCheck.retries,
@@ -110723,12 +110753,12 @@ import { DynamoDBClient as DynamoDBClient3 } from "@awsless/dynamodb";
110723
110753
  // src/cli/ui/complex/run-tests.ts
110724
110754
  var import_wildstring3 = __toESM(require_wildstring(), 1);
110725
110755
  import { mkdir as mkdir6, readFile as readFile12, writeFile as writeFile8 } from "fs/promises";
110726
- import { join as join26 } from "path";
110756
+ import { join as join27 } from "path";
110727
110757
  import { parse as parse5, stringify as stringify4 } from "@awsless/json";
110728
110758
  import { generateFolderHash, loadWorkspace as loadWorkspace2 } from "@awsless/ts-file-cache";
110729
110759
 
110730
110760
  // src/test/start.ts
110731
- import { dirname as dirname15, join as join25 } from "path";
110761
+ import { dirname as dirname15, join as join26 } from "path";
110732
110762
  import { fileURLToPath as fileURLToPath11 } from "url";
110733
110763
  import { configDefaults } from "vitest/config";
110734
110764
  import { startVitest } from "vitest/node";
@@ -110749,7 +110779,7 @@ var startTest = async (props) => {
110749
110779
  globals: true,
110750
110780
  reporters: [new NullReporter],
110751
110781
  setupFiles: [
110752
- join25(__dirname4, "test-global-setup.js")
110782
+ join26(__dirname4, "test-global-setup.js")
110753
110783
  ]
110754
110784
  }, {
110755
110785
  logLevel: "silent",
@@ -110903,7 +110933,7 @@ var logTestErrors = (event) => {
110903
110933
  };
110904
110934
  var runTest = async (stack, dir, filters, workspace, opts) => {
110905
110935
  await mkdir6(directories.test, { recursive: true });
110906
- const file2 = join26(directories.test, `${stack}.json`);
110936
+ const file2 = join27(directories.test, `${stack}.json`);
110907
110937
  const fingerprint = await generateFolderHash(workspace, dir);
110908
110938
  if (!process.env.NO_CACHE) {
110909
110939
  const exists2 = await fileExist(file2);
@@ -112257,7 +112287,7 @@ var watchConfig = async (options, resolve4, reject) => {
112257
112287
 
112258
112288
  // src/type-gen/generate.ts
112259
112289
  import { mkdir as mkdir7, writeFile as writeFile9 } from "fs/promises";
112260
- import { dirname as dirname16, join as join27, relative as relative8 } from "path";
112290
+ import { dirname as dirname16, join as join28, relative as relative8 } from "path";
112261
112291
  var generateTypes = async (props) => {
112262
112292
  const files = [];
112263
112293
  await Promise.all(features.map((feature) => {
@@ -112265,7 +112295,7 @@ var generateTypes = async (props) => {
112265
112295
  ...props,
112266
112296
  async write(file2, data, include = false) {
112267
112297
  const code = data?.toString("utf8");
112268
- const path2 = join27(directories.types, file2);
112298
+ const path2 = join28(directories.types, file2);
112269
112299
  if (code) {
112270
112300
  if (include) {
112271
112301
  files.push(relative8(directories.root, path2));
@@ -112279,7 +112309,7 @@ var generateTypes = async (props) => {
112279
112309
  if (files.length) {
112280
112310
  const code = files.map((file2) => `/// <reference path='${file2}' />`).join(`
112281
112311
  `);
112282
- await writeFile9(join27(directories.root, `awsless.d.ts`), code);
112312
+ await writeFile9(join28(directories.root, `awsless.d.ts`), code);
112283
112313
  }
112284
112314
  };
112285
112315
 
@@ -114376,7 +114406,7 @@ var DEFAULT_PROFILE = "default";
114376
114406
  var getProfileName = (init) => init.profile || process.env[ENV_PROFILE] || DEFAULT_PROFILE;
114377
114407
 
114378
114408
  // ../../node_modules/.pnpm/@smithy+shared-ini-file-loader@4.4.7/node_modules/@smithy/shared-ini-file-loader/dist-es/loadSharedConfigFiles.js
114379
- import { join as join30 } from "path";
114409
+ import { join as join31 } from "path";
114380
114410
 
114381
114411
  // ../../node_modules/.pnpm/@smithy+shared-ini-file-loader@4.4.7/node_modules/@smithy/shared-ini-file-loader/dist-es/constants.js
114382
114412
  var CONFIG_PREFIX_SEPARATOR = ".";
@@ -114398,14 +114428,14 @@ var getConfigData = (data) => Object.entries(data).filter(([key]) => {
114398
114428
  });
114399
114429
 
114400
114430
  // ../../node_modules/.pnpm/@smithy+shared-ini-file-loader@4.4.7/node_modules/@smithy/shared-ini-file-loader/dist-es/getConfigFilepath.js
114401
- import { join as join28 } from "path";
114431
+ import { join as join29 } from "path";
114402
114432
  var ENV_CONFIG_PATH = "AWS_CONFIG_FILE";
114403
- var getConfigFilepath = () => process.env[ENV_CONFIG_PATH] || join28(getHomeDir(), ".aws", "config");
114433
+ var getConfigFilepath = () => process.env[ENV_CONFIG_PATH] || join29(getHomeDir(), ".aws", "config");
114404
114434
 
114405
114435
  // ../../node_modules/.pnpm/@smithy+shared-ini-file-loader@4.4.7/node_modules/@smithy/shared-ini-file-loader/dist-es/getCredentialsFilepath.js
114406
- import { join as join29 } from "path";
114436
+ import { join as join30 } from "path";
114407
114437
  var ENV_CREDENTIALS_PATH = "AWS_SHARED_CREDENTIALS_FILE";
114408
- var getCredentialsFilepath = () => process.env[ENV_CREDENTIALS_PATH] || join29(getHomeDir(), ".aws", "credentials");
114438
+ var getCredentialsFilepath = () => process.env[ENV_CREDENTIALS_PATH] || join30(getHomeDir(), ".aws", "credentials");
114409
114439
 
114410
114440
  // ../../node_modules/.pnpm/@smithy+shared-ini-file-loader@4.4.7/node_modules/@smithy/shared-ini-file-loader/dist-es/parseIni.js
114411
114441
  var prefixKeyRegex = /^([\w-]+)\s(["'])?([\w-@\+\.%:/]+)\2$/;
@@ -114478,11 +114508,11 @@ var loadSharedConfigFiles = async (init = {}) => {
114478
114508
  const relativeHomeDirPrefix = "~/";
114479
114509
  let resolvedFilepath = filepath;
114480
114510
  if (filepath.startsWith(relativeHomeDirPrefix)) {
114481
- resolvedFilepath = join30(homeDir, filepath.slice(2));
114511
+ resolvedFilepath = join31(homeDir, filepath.slice(2));
114482
114512
  }
114483
114513
  let resolvedConfigFilepath = configFilepath;
114484
114514
  if (configFilepath.startsWith(relativeHomeDirPrefix)) {
114485
- resolvedConfigFilepath = join30(homeDir, configFilepath.slice(2));
114515
+ resolvedConfigFilepath = join31(homeDir, configFilepath.slice(2));
114486
114516
  }
114487
114517
  const parsedFiles = await Promise.all([
114488
114518
  readFile13(resolvedConfigFilepath, {
@@ -115575,7 +115605,7 @@ var getRuntimeUserAgentPair = () => {
115575
115605
 
115576
115606
  // ../../node_modules/.pnpm/@aws-sdk+util-user-agent-node@3.973.14_aws-crt@1.30.0_supports-color@8.1.1_/node_modules/@aws-sdk/util-user-agent-node/dist-es/getTypeScriptUserAgentPair.js
115577
115607
  import { readFile as readFile15 } from "fs/promises";
115578
- import { join as join32 } from "path";
115608
+ import { join as join33 } from "path";
115579
115609
 
115580
115610
  // ../../node_modules/.pnpm/@aws-sdk+util-user-agent-node@3.973.14_aws-crt@1.30.0_supports-color@8.1.1_/node_modules/@aws-sdk/util-user-agent-node/dist-es/getNodeModulesParentDirs.js
115581
115611
  import { normalize as normalize3, sep as sep3 } from "path";
@@ -115623,7 +115653,7 @@ var getSanitizedDevTypeScriptVersion = (version2 = "") => {
115623
115653
  // ../../node_modules/.pnpm/@aws-sdk+util-user-agent-node@3.973.14_aws-crt@1.30.0_supports-color@8.1.1_/node_modules/@aws-sdk/util-user-agent-node/dist-es/getTypeScriptUserAgentPair.js
115624
115654
  var __dirname = "/Users/work/Code/awsless/node_modules/.pnpm/@aws-sdk+util-user-agent-node@3.973.14_aws-crt@1.30.0_supports-color@8.1.1_/node_modules/@aws-sdk/util-user-agent-node/dist-es";
115625
115655
  var tscVersion;
115626
- var TS_PACKAGE_JSON = join32("node_modules", "typescript", "package.json");
115656
+ var TS_PACKAGE_JSON = join33("node_modules", "typescript", "package.json");
115627
115657
  var getTypeScriptUserAgentPair = async () => {
115628
115658
  if (tscVersion === null) {
115629
115659
  return;
@@ -115643,7 +115673,7 @@ var getTypeScriptUserAgentPair = async () => {
115643
115673
  let versionFromApp;
115644
115674
  for (const nodeModulesParentDir of nodeModulesParentDirs) {
115645
115675
  try {
115646
- const appPackageJsonPath = join32(nodeModulesParentDir, "package.json");
115676
+ const appPackageJsonPath = join33(nodeModulesParentDir, "package.json");
115647
115677
  const packageJson = await readFile15(appPackageJsonPath, "utf-8");
115648
115678
  const { dependencies, devDependencies } = JSON.parse(packageJson);
115649
115679
  const version2 = devDependencies?.typescript ?? dependencies?.typescript;
@@ -115661,7 +115691,7 @@ var getTypeScriptUserAgentPair = async () => {
115661
115691
  let versionFromNodeModules;
115662
115692
  for (const nodeModulesParentDir of nodeModulesParentDirs) {
115663
115693
  try {
115664
- const tsPackageJsonPath = join32(nodeModulesParentDir, TS_PACKAGE_JSON);
115694
+ const tsPackageJsonPath = join33(nodeModulesParentDir, TS_PACKAGE_JSON);
115665
115695
  const packageJson = await readFile15(tsPackageJsonPath, "utf-8");
115666
115696
  const { version: version2 } = JSON.parse(packageJson);
115667
115697
  const sanitizedVersion2 = getSanitizedTypeScriptVersion(version2);
@@ -118722,7 +118752,7 @@ var sinon;
118722
118752
  const arraySlice = arrayProto.slice;
118723
118753
  const concat = arrayProto.concat;
118724
118754
  const forEach = arrayProto.forEach;
118725
- const join33 = arrayProto.join;
118755
+ const join34 = arrayProto.join;
118726
118756
  const splice = arrayProto.splice;
118727
118757
  function applyDefaults(obj, defaults2) {
118728
118758
  for (const key of Object.keys(defaults2)) {
@@ -118758,7 +118788,7 @@ var sinon;
118758
118788
  let actual = "";
118759
118789
  if (!calledInOrder(arguments)) {
118760
118790
  try {
118761
- expected = join33(arguments, ", ");
118791
+ expected = join34(arguments, ", ");
118762
118792
  const calls = arraySlice(arguments);
118763
118793
  let i4 = calls.length;
118764
118794
  while (i4) {
@@ -118766,7 +118796,7 @@ var sinon;
118766
118796
  splice(calls, i4, 1);
118767
118797
  }
118768
118798
  }
118769
- actual = join33(orderByFirstCall(calls), ", ");
118799
+ actual = join34(orderByFirstCall(calls), ", ");
118770
118800
  } catch (e7) {}
118771
118801
  failAssertion(this, `expected ${expected} to be called in order but were called as ${actual}`);
118772
118802
  } else {
@@ -118811,7 +118841,7 @@ var sinon;
118811
118841
  ` expected = ${inspect(expectation)}`,
118812
118842
  ` actual = ${inspect(actual)}`
118813
118843
  ];
118814
- failAssertion(this, join33(formatted, `
118844
+ failAssertion(this, join34(formatted, `
118815
118845
  `));
118816
118846
  }
118817
118847
  }
@@ -118916,7 +118946,7 @@ var sinon;
118916
118946
  const valueToString = require2("@sinonjs/commons").valueToString;
118917
118947
  const exportAsyncBehaviors = require2("./util/core/export-async-behaviors");
118918
118948
  const concat = arrayProto.concat;
118919
- const join33 = arrayProto.join;
118949
+ const join34 = arrayProto.join;
118920
118950
  const reverse = arrayProto.reverse;
118921
118951
  const slice = arrayProto.slice;
118922
118952
  const useLeftMostCallback = -1;
@@ -118953,7 +118983,7 @@ var sinon;
118953
118983
  msg = `${functionName(behavior.stub)} expected to yield, but no callback was passed.`;
118954
118984
  }
118955
118985
  if (args.length > 0) {
118956
- msg += ` Received [${join33(args, ", ")}]`;
118986
+ msg += ` Received [${join34(args, ", ")}]`;
118957
118987
  }
118958
118988
  return msg;
118959
118989
  }
@@ -119763,7 +119793,7 @@ var sinon;
119763
119793
  const filter2 = arrayProto.filter;
119764
119794
  const forEach = arrayProto.forEach;
119765
119795
  const every = arrayProto.every;
119766
- const join33 = arrayProto.join;
119796
+ const join34 = arrayProto.join;
119767
119797
  const push = arrayProto.push;
119768
119798
  const slice = arrayProto.slice;
119769
119799
  const unshift = arrayProto.unshift;
@@ -119840,10 +119870,10 @@ var sinon;
119840
119870
  });
119841
119871
  this.restore();
119842
119872
  if (messages.length > 0) {
119843
- mockExpectation.fail(join33(concat(messages, met), `
119873
+ mockExpectation.fail(join34(concat(messages, met), `
119844
119874
  `));
119845
119875
  } else if (met.length > 0) {
119846
- mockExpectation.pass(join33(concat(messages, met), `
119876
+ mockExpectation.pass(join34(concat(messages, met), `
119847
119877
  `));
119848
119878
  }
119849
119879
  return true;
@@ -119896,7 +119926,7 @@ var sinon;
119896
119926
  args,
119897
119927
  stack: err.stack
119898
119928
  })}`);
119899
- mockExpectation.fail(join33(messages, `
119929
+ mockExpectation.fail(join34(messages, `
119900
119930
  `));
119901
119931
  }
119902
119932
  });
@@ -120003,14 +120033,14 @@ var sinon;
120003
120033
  const valueToString = require2("@sinonjs/commons").valueToString;
120004
120034
  const concat = arrayProto.concat;
120005
120035
  const filter2 = arrayProto.filter;
120006
- const join33 = arrayProto.join;
120036
+ const join34 = arrayProto.join;
120007
120037
  const map = arrayProto.map;
120008
120038
  const reduce = arrayProto.reduce;
120009
120039
  const slice = arrayProto.slice;
120010
120040
  function throwYieldError(proxy, text2, args) {
120011
120041
  let msg = functionName(proxy) + text2;
120012
120042
  if (args.length) {
120013
- msg += ` Received [${join33(slice(args), ", ")}]`;
120043
+ msg += ` Received [${join34(slice(args), ", ")}]`;
120014
120044
  }
120015
120045
  throw new Error(msg);
120016
120046
  }
@@ -120132,7 +120162,7 @@ var sinon;
120132
120162
  const formattedArgs = map(this.args, function(arg) {
120133
120163
  return inspect(arg);
120134
120164
  });
120135
- callStr = `${callStr + join33(formattedArgs, ", ")})`;
120165
+ callStr = `${callStr + join34(formattedArgs, ", ")})`;
120136
120166
  if (typeof this.returnValue !== "undefined") {
120137
120167
  callStr += ` => ${inspect(this.returnValue)}`;
120138
120168
  }
@@ -120863,7 +120893,7 @@ var sinon;
120863
120893
  const timesInWords = require2("./util/core/times-in-words");
120864
120894
  const inspect = require2("util").inspect;
120865
120895
  const jsDiff = require2("diff");
120866
- const join33 = arrayProto.join;
120896
+ const join34 = arrayProto.join;
120867
120897
  const map = arrayProto.map;
120868
120898
  const push = arrayProto.push;
120869
120899
  const slice = arrayProto.slice;
@@ -120891,7 +120921,7 @@ var sinon;
120891
120921
  }
120892
120922
  return text2;
120893
120923
  });
120894
- return join33(objects, "");
120924
+ return join34(objects, "");
120895
120925
  }
120896
120926
  function quoteStringValue(value) {
120897
120927
  if (typeof value === "string") {
@@ -120949,7 +120979,7 @@ ${stringifiedCall}`;
120949
120979
  push(calls, stringifiedCall);
120950
120980
  }
120951
120981
  return calls.length > 0 ? `
120952
- ${join33(calls, `
120982
+ ${join34(calls, `
120953
120983
  `)}` : "";
120954
120984
  },
120955
120985
  t: function(spyInstance) {
@@ -120957,10 +120987,10 @@ ${join33(calls, `
120957
120987
  for (let i4 = 0, l5 = spyInstance.callCount;i4 < l5; ++i4) {
120958
120988
  push(objects, inspect(spyInstance.thisValues[i4]));
120959
120989
  }
120960
- return join33(objects, ", ");
120990
+ return join34(objects, ", ");
120961
120991
  },
120962
120992
  "*": function(spyInstance, args) {
120963
- return join33(map(args, function(arg) {
120993
+ return join34(map(args, function(arg) {
120964
120994
  return inspect(arg);
120965
120995
  }), ", ");
120966
120996
  }
@@ -121292,7 +121322,7 @@ ${join33(calls, `
121292
121322
  }, { "@sinonjs/commons": 48 }], 26: [function(require2, module, exports) {
121293
121323
  const arrayProto = require2("@sinonjs/commons").prototypes.array;
121294
121324
  const hasOwnProperty2 = require2("@sinonjs/commons").prototypes.object.hasOwnProperty;
121295
- const join33 = arrayProto.join;
121325
+ const join34 = arrayProto.join;
121296
121326
  const push = arrayProto.push;
121297
121327
  const hasDontEnumBug = function() {
121298
121328
  const obj = {
@@ -121333,7 +121363,7 @@ ${join33(calls, `
121333
121363
  push(result, obj[prop]());
121334
121364
  }
121335
121365
  }
121336
- return join33(result, "") !== "0123456789";
121366
+ return join34(result, "") !== "0123456789";
121337
121367
  }();
121338
121368
  function extendCommon(target2, sources, doCopy) {
121339
121369
  let source, i4, prop;
@@ -123398,7 +123428,7 @@ ${job.error.stack.split(`
123398
123428
  module.exports = matcherPrototype;
123399
123429
  }, { "../create-matcher": 63 }], 71: [function(require2, module, exports) {
123400
123430
  var functionName = require2("@sinonjs/commons").functionName;
123401
- var join33 = require2("@sinonjs/commons").prototypes.array.join;
123431
+ var join34 = require2("@sinonjs/commons").prototypes.array.join;
123402
123432
  var map = require2("@sinonjs/commons").prototypes.array.map;
123403
123433
  var stringIndexOf = require2("@sinonjs/commons").prototypes.string.indexOf;
123404
123434
  var valueToString = require2("@sinonjs/commons").valueToString;
@@ -123429,7 +123459,7 @@ ${job.error.stack.split(`
123429
123459
  m5.test = function(actual) {
123430
123460
  return matchObject(actual, expectation, match3);
123431
123461
  };
123432
- m5.message = `match(${join33(array, ", ")})`;
123462
+ m5.message = `match(${join34(array, ", ")})`;
123433
123463
  return m5;
123434
123464
  },
123435
123465
  regexp: function(m5, expectation) {
@@ -126753,7 +126783,7 @@ ${job.error.stack.split(`
126753
126783
  tokenize: function tokenize(value) {
126754
126784
  return value.split("");
126755
126785
  },
126756
- join: function join33(chars) {
126786
+ join: function join34(chars) {
126757
126787
  return chars.join("");
126758
126788
  }
126759
126789
  };
@@ -1,7 +1,7 @@
1
1
  // src/feature/bundle/server/handle.ts
2
2
  import { patch, unpatch } from "@awsless/json";
3
3
  import { ExpectedError, invoke, isErrorResponse } from "@awsless/lambda";
4
- import { formatRoutePayload, getCurrentRoute, withRoute } from "awsless";
4
+ import { formatRoutePayload, getCurrentRoute, withBundleRoute } from "awsless";
5
5
 
6
6
  // src/feature/bundle/server/resource/util.ts
7
7
  var routeType = (route) => {
@@ -198,6 +198,18 @@ var restHandler = (event) => {
198
198
  return;
199
199
  };
200
200
 
201
+ // src/feature/bundle/server/resource/route.ts
202
+ var routeHandler = (event) => {
203
+ if (typeof event?.["$awsless-route"] === "string") {
204
+ return;
205
+ }
206
+ const route = event?.headers?.["x-awsless-route"];
207
+ if (typeof route === "string" && routeType(route) === "route") {
208
+ return webRoute(route, event);
209
+ }
210
+ return;
211
+ };
212
+
201
213
  // src/feature/bundle/server/resource/rpc.ts
202
214
  var rpcHandler = (event) => {
203
215
  const route = event?.["$awsless-route"];
@@ -320,6 +332,7 @@ var createBundle = (handlers) => {
320
332
  topicHandler,
321
333
  taskHandler,
322
334
  restHandler,
335
+ routeHandler,
323
336
  rpcHandler,
324
337
  siteHandler,
325
338
  storeHandler,
@@ -333,8 +346,7 @@ var createBundle = (handlers) => {
333
346
  return match;
334
347
  }
335
348
  }
336
- const route = event?.["$awsless-route"] ?? event?.headers?.["x-awsless-route"];
337
- throw new Error("Unknown bundle route: " + route);
349
+ throw new Error(`Unknown bundle route: ${event?.["$awsless-route"] ?? event?.headers?.["x-awsless-route"]} `);
338
350
  };
339
351
  return async (event, context) => {
340
352
  const handleRoute = (match2) => {
@@ -343,13 +355,13 @@ var createBundle = (handlers) => {
343
355
  throw new Error("Unknown bundle route: " + match2.key);
344
356
  }
345
357
  process.env.AWSLESS_ROUTE = match2.key;
346
- return withRoute(match2.key, invokeRoute, async () => {
358
+ return withBundleRoute(match2.key, internalInvoke, async () => {
347
359
  const handle = await load();
348
360
  const routedContext = { ...context, route: match2.key };
349
361
  return handle(match2.payload ?? {}, routedContext);
350
362
  });
351
363
  };
352
- const invokeRoute = async (key, payload) => {
364
+ const internalInvoke = async (key, payload) => {
353
365
  const caller = getCurrentRoute();
354
366
  const throwExpectedErrors = process.env.THROW_EXPECTED_ERRORS;
355
367
  let result;
@@ -14048,7 +14048,7 @@ var require_svgstore = __commonJS((exports, module) => {
14048
14048
 
14049
14049
  // src/feature/icon/server/handle.ts
14050
14050
  import { getObject, putObject } from "@awsless/s3";
14051
- import { getRouteEnv, invokeRoute } from "awsless";
14051
+ import { getRouteEnv, internalInvoke } from "awsless";
14052
14052
 
14053
14053
  // ../../node_modules/.pnpm/svgo@4.0.1/node_modules/svgo/dist/svgo.browser.js
14054
14054
  var visitSkip = Symbol();
@@ -33332,7 +33332,7 @@ var handle_default = async (event) => {
33332
33332
  }
33333
33333
  const originRoute = getRouteEnv("ICON_ORIGIN");
33334
33334
  if (!baseIcon && originRoute) {
33335
- const result = await invokeRoute(originRoute, { path });
33335
+ const result = await internalInvoke(originRoute, { path });
33336
33336
  if (typeof result === "string") {
33337
33337
  baseIcon = Buffer.from(result);
33338
33338
  } else if (result === undefined) {
@@ -1,7 +1,7 @@
1
1
  // src/feature/image/server/handle.ts
2
2
  import { getObject, putObject } from "@awsless/s3";
3
3
  import sharp from "sharp";
4
- import { getRouteEnv, invokeRoute } from "awsless";
4
+ import { getRouteEnv, internalInvoke } from "awsless";
5
5
 
6
6
  // src/feature/image/server/validate.ts
7
7
  import { object, picklist, pipe, safeParse, string, transform } from "@awsless/validate";
@@ -92,7 +92,7 @@ var handle_default = async (event) => {
92
92
  }
93
93
  const originRoute = getRouteEnv("IMAGE_ORIGIN");
94
94
  if (!baseImage && originRoute) {
95
- const result = await invokeRoute(originRoute, { path: originalPath });
95
+ const result = await internalInvoke(originRoute, { path: originalPath });
96
96
  if (typeof result === "string") {
97
97
  baseImage = Buffer.from(result, "base64");
98
98
  } else if (result === undefined) {
@@ -22,7 +22,7 @@ import {
22
22
  putItem,
23
23
  string as dbString
24
24
  } from "@awsless/dynamodb";
25
- import { getRouteEnv, invokeRoute } from "awsless";
25
+ import { getRouteEnv, internalInvoke } from "awsless";
26
26
  import { createHash } from "crypto";
27
27
  import * as zlib from "zlib";
28
28
  var RuntimeErrorSchema = object({
@@ -107,7 +107,7 @@ var handle_default = async (event, context) => {
107
107
  if (!error || await isOwnRequest(error.requestId)) {
108
108
  continue;
109
109
  }
110
- const invoke = invokeRoute(consumerRoute, {
110
+ const invoke = internalInvoke(consumerRoute, {
111
111
  ...error,
112
112
  origin,
113
113
  date: logEvent.timestamp
@@ -1,6 +1,6 @@
1
1
  // src/feature/rpc/server/handle.ts
2
2
  import { ExpectedError, ViewableError } from "@awsless/lambda";
3
- import { invokeRoute as invokeRoute2 } from "awsless";
3
+ import { internalInvoke as internalInvoke2 } from "awsless";
4
4
  import { randomUUID } from "node:crypto";
5
5
 
6
6
  // src/feature/rpc/server/auth.ts
@@ -51,7 +51,7 @@ function isFuture(date) {
51
51
  }
52
52
 
53
53
  // src/feature/rpc/server/auth.ts
54
- import { getRouteEnv, invokeRoute } from "awsless";
54
+ import { getRouteEnv, internalInvoke } from "awsless";
55
55
 
56
56
  // src/feature/rpc/server/validate.ts
57
57
  import {
@@ -135,7 +135,7 @@ var authenticate = async (token) => {
135
135
  }
136
136
  let response;
137
137
  try {
138
- response = await invokeRoute(authRoute, { token });
138
+ response = await internalInvoke(authRoute, { token });
139
139
  } catch (error) {
140
140
  console.error(error);
141
141
  return {
@@ -463,7 +463,7 @@ var handle_default = async (event) => {
463
463
  }
464
464
  let data;
465
465
  try {
466
- data = await invokeRoute2(fn.details.name, {
466
+ data = await internalInvoke2(fn.details.name, {
467
467
  ...fn.payload ?? {},
468
468
  ...auth.context ?? {},
469
469
  viewer: buildViewerPayload(request.output)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@awsless/cli",
3
- "version": "0.0.46-next.17",
3
+ "version": "0.0.46-next.18",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -38,15 +38,15 @@
38
38
  "@awsless/ts-file-cache": "^0.0.16"
39
39
  },
40
40
  "peerDependencies": {
41
- "@awsless/big-float": "^0.1.7",
42
- "@awsless/duration": "^0.0.4",
41
+ "@awsless/validate": "^0.1.7",
43
42
  "@awsless/json": "^0.0.11",
43
+ "@awsless/dynamodb": "^0.3.21",
44
+ "@awsless/big-float": "^0.1.7",
44
45
  "@awsless/lambda": "^0.0.47",
45
46
  "@awsless/s3": "^0.0.22",
46
- "@awsless/validate": "^0.1.7",
47
+ "@awsless/duration": "^0.0.4",
47
48
  "@awsless/weak-cache": "^0.0.1",
48
- "awsless": "^0.0.15-next.3",
49
- "@awsless/dynamodb": "^0.3.21"
49
+ "awsless": "^0.0.15-next.4"
50
50
  },
51
51
  "devDependencies": {
52
52
  "@clack/prompts": "^0.7.0",
@@ -100,25 +100,25 @@
100
100
  "zip-a-folder": "^3.1.6",
101
101
  "zod": "^3.24.2",
102
102
  "zod-to-json-schema": "^3.24.3",
103
+ "@awsless/big-float": "^0.1.7",
103
104
  "@awsless/cloudwatch": "^0.0.1",
104
- "@awsless/duration": "^0.0.4",
105
+ "@awsless/clui": "^0.0.9",
105
106
  "@awsless/dynamodb": "^0.3.21",
106
- "@awsless/big-float": "^0.1.7",
107
107
  "@awsless/iot": "^0.0.5",
108
- "@awsless/clui": "^0.0.9",
109
108
  "@awsless/json": "^0.0.11",
110
109
  "@awsless/lambda": "^0.0.47",
111
- "@awsless/s3": "^0.0.22",
112
110
  "@awsless/open-search": "^0.0.24",
111
+ "@awsless/scheduler": "^0.0.5",
113
112
  "@awsless/sns": "^0.0.11",
113
+ "@awsless/sqs": "^0.0.24",
114
114
  "@awsless/redis": "^0.1.13",
115
- "@awsless/ssm": "^0.0.8",
116
- "@awsless/weak-cache": "^0.0.1",
117
- "@awsless/scheduler": "^0.0.5",
118
- "awsless": "^0.0.15-next.3",
119
115
  "@awsless/validate": "^0.1.7",
120
- "@awsless/sqs": "^0.0.24",
121
- "@awsless/size": "^0.0.2"
116
+ "@awsless/s3": "^0.0.22",
117
+ "@awsless/weak-cache": "^0.0.1",
118
+ "@awsless/ssm": "^0.0.8",
119
+ "awsless": "^0.0.15-next.4",
120
+ "@awsless/size": "^0.0.2",
121
+ "@awsless/duration": "^0.0.4"
122
122
  },
123
123
  "scripts": {
124
124
  "test": "bun cli/build-handlers.ts && pnpm vitest",