@awsless/cli 0.0.46-local.5 → 0.0.46-local.7

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.
Files changed (2) hide show
  1. package/dist/bin.js +56 -16
  2. package/package.json +16 -16
package/dist/bin.js CHANGED
@@ -153513,7 +153513,7 @@ var bundleFeature = defineFeature({
153513
153513
  ctx.registerBuild("bundle", name, buildBundle({
153514
153514
  name,
153515
153515
  handlers,
153516
- minify: defaults2.minify,
153516
+ minify: ctx.dev ? false : defaults2.minify,
153517
153517
  external: [...defaults2.external ?? [], ...layerPackages]
153518
153518
  }));
153519
153519
  const sourceHash = new Output(envDeps, async (resolve3) => {
@@ -158681,7 +158681,7 @@ var siteFeature = defineFeature({
158681
158681
  });
158682
158682
  const addRoutes = ctx.shared.entry("router", "addRoutes", props.router);
158683
158683
  const routeKey = props.path.endsWith("/") ? `${props.path}*` : `${props.path}/*`;
158684
- if (props.build) {
158684
+ if (props.build && !(ctx.dev && props.dev)) {
158685
158685
  const buildProps = props.build;
158686
158686
  ctx.registerBuild("site", name, async (build2) => {
158687
158687
  const fingerprint = await generateCacheKey(buildProps.cacheKey);
@@ -158728,7 +158728,7 @@ ${(errors3.trim() || output.trim()).slice(-2000)}`);
158728
158728
  });
158729
158729
  });
158730
158730
  }
158731
- if (props.ssr && isStandaloneFunction(props.ssr) && !ctx.dev) {
158731
+ if (props.ssr && ctx.dev && props.dev) {} else if (props.ssr && isStandaloneFunction(props.ssr) && !ctx.dev) {
158732
158732
  const fn = createLambdaFunction(ctx, `${id}-ssr`, props.ssr);
158733
158733
  if (ctx.shared.has("router", "endpoint", props.router)) {
158734
158734
  fn.setEnvironment(`ROUTER_${constantCase(props.router)}_ENDPOINT`, ctx.shared.entry("router", "endpoint", props.router));
@@ -159270,7 +159270,7 @@ var tableFeature = defineFeature({
159270
159270
  const sort2 = props.sort ? typeValue(props.sort) : "undefined";
159271
159271
  const indexes = props.indexes && Object.keys(props.indexes).length > 0 ? `{ ${Object.entries(props.indexes).map(([indexName, index]) => {
159272
159272
  const indexSort = index.sort ? `; sort: ${typeValue(index.sort)}` : "";
159273
- return `${indexName}: { hash: ${typeValue(index.hash)}${indexSort} }`;
159273
+ return `'${indexName}': { hash: ${typeValue(index.hash)}${indexSort} }`;
159274
159274
  }).join("; ")} }` : "undefined";
159275
159275
  list2.addType(name, `{
159276
159276
  readonly name: '${tableName}'
@@ -166477,12 +166477,16 @@ var dashboardHtml = `<!doctype html>
166477
166477
  .filters input { flex: 1; }
166478
166478
  .filters input::placeholder { color: var(--muted); }
166479
166479
  .filters .count { color: var(--muted); align-self: center; white-space: nowrap; }
166480
- .rows { display: flex; flex-direction: column; }
166480
+ /* The stack & name columns share one grid across every row, so the
166481
+ names line up no matter how long each stack name is. */
166482
+ .rows { display: grid; grid-template-columns: fit-content(280px) 1fr auto; }
166483
+ .rows > .empty { grid-column: 1 / -1; }
166481
166484
  .row {
166482
- display: flex;
166485
+ display: grid;
166486
+ grid-template-columns: subgrid;
166487
+ grid-column: 1 / -1;
166483
166488
  gap: 12px;
166484
166489
  align-items: baseline;
166485
- width: 100%;
166486
166490
  text-align: left;
166487
166491
  background: none;
166488
166492
  border: none;
@@ -166500,14 +166504,20 @@ var dashboardHtml = `<!doctype html>
166500
166504
  text-overflow: ellipsis;
166501
166505
  white-space: nowrap;
166502
166506
  }
166503
- .row .id { font-weight: bold; }
166507
+ .row .id {
166508
+ font-weight: bold;
166509
+ min-width: 0;
166510
+ overflow: hidden;
166511
+ text-overflow: ellipsis;
166512
+ white-space: nowrap;
166513
+ }
166504
166514
  .row .info {
166505
166515
  color: var(--muted);
166506
- margin-left: auto;
166516
+ justify-self: end;
166507
166517
  overflow: hidden;
166508
166518
  text-overflow: ellipsis;
166509
166519
  white-space: nowrap;
166510
- max-width: 45%;
166520
+ max-width: 100%;
166511
166521
  }
166512
166522
  textarea {
166513
166523
  width: 100%;
@@ -166800,6 +166810,19 @@ const rpcPanel = (main, r) => {
166800
166810
  }
166801
166811
 
166802
166812
  const query = $('select', {}, r.queries.map(name => $('option', { value: name, textContent: name })))
166813
+
166814
+ // The token rides the same "authentication" header the rpc client
166815
+ // sends, & sticks around per api so a page reload keeps it.
166816
+ const authKey = 'rpc-auth-token:' + r.routeKey
166817
+ const auth = $('input', {
166818
+ type: 'text',
166819
+ placeholder: 'Auth token (optional)',
166820
+ value: localStorage.getItem(authKey) ?? '',
166821
+ autocomplete: 'off',
166822
+ spellcheck: false,
166823
+ })
166824
+ auth.oninput = () => localStorage.setItem(authKey, auth.value)
166825
+
166803
166826
  const payload = $('textarea', { value: '{}', spellcheck: false })
166804
166827
  const status = $('span', { className: 'status' })
166805
166828
  const result = $('pre', { className: 'result', hidden: true })
@@ -166818,7 +166841,10 @@ const rpcPanel = (main, r) => {
166818
166841
  version: '2.0',
166819
166842
  rawPath: '/',
166820
166843
  requestContext: { http: { method: 'POST', userAgent: 'awsless dev dashboard', sourceIp: '127.0.0.1' } },
166821
- headers: { 'content-type': 'application/json' },
166844
+ headers: {
166845
+ 'content-type': 'application/json',
166846
+ ...(auth.value.trim() ? { authentication: auth.value.trim() } : {}),
166847
+ },
166822
166848
  body: JSON.stringify([{ name: query.value, ...(parsed === undefined ? {} : { payload: parsed }) }]),
166823
166849
  }
166824
166850
 
@@ -166842,7 +166868,7 @@ const rpcPanel = (main, r) => {
166842
166868
  }
166843
166869
 
166844
166870
  main.append(
166845
- $('div', { className: 'filters' }, [query]),
166871
+ $('div', { className: 'filters' }, [query, auth]),
166846
166872
  payload,
166847
166873
  $('div', { className: 'actions' }, [run, status]),
166848
166874
  result,
@@ -167863,18 +167889,25 @@ var startDev = async (props) => {
167863
167889
  const sorted = [...builders].sort((a4, b6) => Number(a4.type === "bundle") - Number(b6.type === "bundle"));
167864
167890
  const workspace = await loadWorkspace3(directories.root);
167865
167891
  const buildAll = async () => {
167892
+ let changed = false;
167866
167893
  for (const builder of sorted) {
167867
- await build(builder.type, builder.name, builder.builder, { workspace });
167894
+ const meta = await build(builder.type, builder.name, builder.builder, { workspace });
167895
+ if (!meta?.cached) {
167896
+ changed = true;
167897
+ }
167898
+ debug(`Build ${builder.type}:${builder.name}`, meta?.cached ? "cached" : String(meta?.buildTime));
167868
167899
  }
167869
167900
  await writeFile13(getBuildPath("bundle", bundleName, "files/awsless-env.mjs"), `export default {}
167870
167901
  `);
167871
167902
  await linkSdkPackages(buildDir, log);
167903
+ return changed;
167872
167904
  };
167873
167905
  log("Building the bundle...");
167874
167906
  await buildAll();
167875
167907
  const worker = createBundleWorker({ buildDir, env: env4, functionName: bundleName });
167876
167908
  let dirty = false;
167877
167909
  let fresh;
167910
+ let restartNeeded = false;
167878
167911
  const ensureFresh = async () => {
167879
167912
  if (!dirty) {
167880
167913
  return;
@@ -167883,10 +167916,16 @@ var startDev = async (props) => {
167883
167916
  dirty = false;
167884
167917
  const started = Date.now();
167885
167918
  try {
167886
- await buildAll();
167919
+ const changed = await buildAll();
167887
167920
  const built = Date.now();
167888
- await worker.restart();
167889
- log(`Reloaded the bundle in ${Date.now() - started}ms (build ${built - started}ms, worker ${Date.now() - built}ms)`);
167921
+ if (changed || restartNeeded) {
167922
+ restartNeeded = true;
167923
+ await worker.restart();
167924
+ restartNeeded = false;
167925
+ log(`Reloaded the bundle in ${Date.now() - started}ms (build ${built - started}ms, worker ${Date.now() - built}ms)`);
167926
+ } else {
167927
+ debug(`Rebuild found no changes in ${Date.now() - started}ms`);
167928
+ }
167890
167929
  } catch (error3) {
167891
167930
  dirty = true;
167892
167931
  throw error3;
@@ -167917,6 +167956,7 @@ var startDev = async (props) => {
167917
167956
  log(`The bundle worker failed to start: ${error3 instanceof Error ? error3.message : String(error3)}`);
167918
167957
  log("Fix the error - the next invoke retries.");
167919
167958
  dirty = true;
167959
+ restartNeeded = true;
167920
167960
  }
167921
167961
  const seeder = createSeedRunner({ stackConfigs, env: env4 });
167922
167962
  const resetData = createDataReset({ pool: props.pool, appConfig, stackConfigs });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@awsless/cli",
3
- "version": "0.0.46-local.5",
3
+ "version": "0.0.46-local.7",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -42,15 +42,15 @@
42
42
  "@awsless/ts-file-cache": "^0.0.16"
43
43
  },
44
44
  "peerDependencies": {
45
- "@awsless/s3": "^0.0.22",
45
+ "@awsless/big-float": "^0.1.7",
46
+ "@awsless/dynamodb": "^0.3.22",
46
47
  "@awsless/lambda": "^0.0.47",
47
48
  "@awsless/duration": "^0.0.4",
48
49
  "@awsless/json": "^0.0.11",
49
- "@awsless/big-float": "^0.1.7",
50
- "@awsless/dynamodb": "^0.3.22",
51
- "@awsless/validate": "^0.1.7",
50
+ "@awsless/s3": "^0.0.22",
51
+ "awsless": "^0.0.15-local.3",
52
52
  "@awsless/weak-cache": "^0.0.1",
53
- "awsless": "^0.0.15-local.3"
53
+ "@awsless/validate": "^0.1.7"
54
54
  },
55
55
  "devDependencies": {
56
56
  "@aws-sdk/client-cloudformation": "^3.369.0",
@@ -120,25 +120,25 @@
120
120
  "zip-a-folder": "^3.1.6",
121
121
  "zod": "^3.24.2",
122
122
  "zod-to-json-schema": "^3.24.3",
123
- "@awsless/big-float": "^0.1.7",
124
123
  "@awsless/cloudwatch": "^0.0.1",
125
- "@awsless/duration": "^0.0.4",
126
124
  "@awsless/clui": "^0.0.9",
127
- "@awsless/iot": "^0.0.5",
125
+ "@awsless/big-float": "^0.1.7",
126
+ "@awsless/dynamodb": "^0.3.22",
128
127
  "@awsless/json": "^0.0.11",
129
128
  "@awsless/lambda": "^0.0.47",
130
- "@awsless/dynamodb": "^0.3.22",
131
129
  "@awsless/open-search": "^0.0.24",
132
- "@awsless/s3": "^0.0.22",
130
+ "@awsless/duration": "^0.0.4",
133
131
  "@awsless/redis": "^0.1.13",
134
- "@awsless/scheduler": "^0.0.5",
135
- "@awsless/sns": "^0.0.11",
136
132
  "@awsless/size": "^0.0.2",
137
- "@awsless/validate": "^0.1.7",
138
- "@awsless/ssm": "^0.0.8",
133
+ "@awsless/iot": "^0.0.5",
139
134
  "@awsless/sqs": "^0.0.24",
135
+ "@awsless/ssm": "^0.0.8",
136
+ "@awsless/sns": "^0.0.11",
137
+ "@awsless/s3": "^0.0.22",
138
+ "@awsless/validate": "^0.1.7",
140
139
  "@awsless/weak-cache": "^0.0.1",
141
- "awsless": "^0.0.15-local.3"
140
+ "awsless": "^0.0.15-local.3",
141
+ "@awsless/scheduler": "^0.0.5"
142
142
  },
143
143
  "scripts": {
144
144
  "test": "bun cli/build-handlers.ts && pnpm vitest",