@awsless/cli 0.1.45 → 0.1.48
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 +57 -31
- package/package.json +3 -3
package/dist/bin.js
CHANGED
|
@@ -153094,8 +153094,8 @@ import { dirname as dirname5, join as join9 } from "path";
|
|
|
153094
153094
|
|
|
153095
153095
|
// src/util/timer.ts
|
|
153096
153096
|
var import_pretty_hrtime = __toESM(require_pretty_hrtime(), 1);
|
|
153097
|
-
var createTimer = () => {
|
|
153098
|
-
const start = process.hrtime();
|
|
153097
|
+
var createTimer = (since) => {
|
|
153098
|
+
const start = since ?? process.hrtime();
|
|
153099
153099
|
return () => {
|
|
153100
153100
|
const end = process.hrtime(start);
|
|
153101
153101
|
const [time, unit] = import_pretty_hrtime.default(end).split(" ");
|
|
@@ -162803,7 +162803,7 @@ var emailFeature = defineFeature({
|
|
|
162803
162803
|
actions: ["ses:SendEmail", "ses:SendRawEmail"],
|
|
162804
162804
|
resources: [
|
|
162805
162805
|
`arn:aws:ses:${ctx.appConfig.region}:${ctx.accountId}:identity/*`,
|
|
162806
|
-
`arn:aws:ses:${ctx.appConfig.region}:${ctx.accountId}:configuration-set
|
|
162806
|
+
`arn:aws:ses:${ctx.appConfig.region}:${ctx.accountId}:configuration-set/*`
|
|
162807
162807
|
]
|
|
162808
162808
|
});
|
|
162809
162809
|
},
|
|
@@ -166038,7 +166038,7 @@ var startDevRouter = async (props) => {
|
|
|
166038
166038
|
const match = compileRoutes(props.routes);
|
|
166039
166039
|
const server = Bun.serve({
|
|
166040
166040
|
port: props.port,
|
|
166041
|
-
hostname: "127.0.0.1",
|
|
166041
|
+
hostname: props.host ? "0.0.0.0" : "127.0.0.1",
|
|
166042
166042
|
idleTimeout: 120,
|
|
166043
166043
|
async fetch(request, server) {
|
|
166044
166044
|
const url = new URL(request.url);
|
|
@@ -179813,6 +179813,9 @@ var deployments = (program) => {
|
|
|
179813
179813
|
});
|
|
179814
179814
|
};
|
|
179815
179815
|
|
|
179816
|
+
// src/cli/command/dev.ts
|
|
179817
|
+
import { networkInterfaces } from "os";
|
|
179818
|
+
|
|
179816
179819
|
// src/dev/watch-tree.ts
|
|
179817
179820
|
import { watch } from "fs";
|
|
179818
179821
|
import { readdir as readdir6, stat as stat6 } from "fs/promises";
|
|
@@ -184097,6 +184100,32 @@ var startDev = async (props) => {
|
|
|
184097
184100
|
});
|
|
184098
184101
|
const bundleName = getBundleFunctionName(appConfig.name);
|
|
184099
184102
|
const buildDir = getBuildPath("bundle", bundleName, ".");
|
|
184103
|
+
const sorted = [...builders].toSorted((a, b) => Number(a.type === "bundle") - Number(b.type === "bundle"));
|
|
184104
|
+
let workspace;
|
|
184105
|
+
const buildAll = async () => {
|
|
184106
|
+
let changed = false;
|
|
184107
|
+
for (const builder of sorted) {
|
|
184108
|
+
const meta = await build(builder.type, builder.name, builder.builder, {
|
|
184109
|
+
workspace
|
|
184110
|
+
});
|
|
184111
|
+
if (!meta?.cached) {
|
|
184112
|
+
changed = true;
|
|
184113
|
+
}
|
|
184114
|
+
debug(`Build ${builder.type}:${builder.name}`, meta?.cached ? "cached" : String(meta?.buildTime));
|
|
184115
|
+
}
|
|
184116
|
+
await writeFile15(getBuildPath("bundle", bundleName, "files/awsless-env.mjs"), `export default {}
|
|
184117
|
+
`);
|
|
184118
|
+
await linkSdkPackages(workspace, buildDir, log);
|
|
184119
|
+
return changed;
|
|
184120
|
+
};
|
|
184121
|
+
const buildStarted = process.hrtime();
|
|
184122
|
+
let buildError;
|
|
184123
|
+
const building = (async () => {
|
|
184124
|
+
workspace = await loadWorkspace3(directories.root);
|
|
184125
|
+
await buildAll();
|
|
184126
|
+
})().catch((error) => {
|
|
184127
|
+
buildError = error;
|
|
184128
|
+
});
|
|
184100
184129
|
const { env, lambda } = await phase({
|
|
184101
184130
|
start: "Preparing the local resources...",
|
|
184102
184131
|
done: "Prepared the local resources"
|
|
@@ -184150,28 +184179,6 @@ var startDev = async (props) => {
|
|
|
184150
184179
|
`);
|
|
184151
184180
|
return { env, lambda };
|
|
184152
184181
|
});
|
|
184153
|
-
const sorted = [...builders].toSorted((a, b) => Number(a.type === "bundle") - Number(b.type === "bundle"));
|
|
184154
|
-
let workspace;
|
|
184155
|
-
const buildAll = async () => {
|
|
184156
|
-
let changed = false;
|
|
184157
|
-
for (const builder of sorted) {
|
|
184158
|
-
const meta = await build(builder.type, builder.name, builder.builder, {
|
|
184159
|
-
workspace
|
|
184160
|
-
});
|
|
184161
|
-
if (!meta?.cached) {
|
|
184162
|
-
changed = true;
|
|
184163
|
-
}
|
|
184164
|
-
debug(`Build ${builder.type}:${builder.name}`, meta?.cached ? "cached" : String(meta?.buildTime));
|
|
184165
|
-
}
|
|
184166
|
-
await writeFile15(getBuildPath("bundle", bundleName, "files/awsless-env.mjs"), `export default {}
|
|
184167
|
-
`);
|
|
184168
|
-
await linkSdkPackages(workspace, buildDir, log);
|
|
184169
|
-
return changed;
|
|
184170
|
-
};
|
|
184171
|
-
await phase({ start: "Building the bundle...", done: "Built the bundle" }, async () => {
|
|
184172
|
-
workspace = await loadWorkspace3(directories.root);
|
|
184173
|
-
await buildAll();
|
|
184174
|
-
});
|
|
184175
184182
|
const emitWorkerLine = (line, error = false, route) => {
|
|
184176
184183
|
dev.events.emit("worker", { date: Date.now(), line, error, route });
|
|
184177
184184
|
};
|
|
@@ -184304,6 +184311,12 @@ var startDev = async (props) => {
|
|
|
184304
184311
|
}
|
|
184305
184312
|
detail(breakdown(timings));
|
|
184306
184313
|
});
|
|
184314
|
+
await phase({ start: "Building the bundle...", done: "Built the bundle", since: buildStarted }, async () => {
|
|
184315
|
+
await building;
|
|
184316
|
+
if (buildError) {
|
|
184317
|
+
throw buildError;
|
|
184318
|
+
}
|
|
184319
|
+
});
|
|
184307
184320
|
await phase({
|
|
184308
184321
|
start: "Starting the bundle worker...",
|
|
184309
184322
|
done: "Started the bundle worker"
|
|
@@ -184340,6 +184353,7 @@ var startDev = async (props) => {
|
|
|
184340
184353
|
routers.push(await startDevRouter({
|
|
184341
184354
|
routes: dev.routes.filter((route) => route.routerId === id),
|
|
184342
184355
|
port,
|
|
184356
|
+
host: props.host,
|
|
184343
184357
|
dispatch,
|
|
184344
184358
|
onError(error, routeKey) {
|
|
184345
184359
|
const detail = error instanceof Error ? error.stack ?? error.message : String(error);
|
|
@@ -184516,8 +184530,18 @@ var buildTypes = async (props) => {
|
|
|
184516
184530
|
};
|
|
184517
184531
|
|
|
184518
184532
|
// src/cli/command/dev.ts
|
|
184533
|
+
var findLanIp = () => {
|
|
184534
|
+
for (const entries of Object.values(networkInterfaces())) {
|
|
184535
|
+
for (const entry of entries ?? []) {
|
|
184536
|
+
if (entry.family === "IPv4" && !entry.internal) {
|
|
184537
|
+
return entry.address;
|
|
184538
|
+
}
|
|
184539
|
+
}
|
|
184540
|
+
}
|
|
184541
|
+
return;
|
|
184542
|
+
};
|
|
184519
184543
|
var dev = (program) => {
|
|
184520
|
-
program.command("dev").description("Start the development service").option("--port <port>", "The port for the local router", "3000").action(async (options) => {
|
|
184544
|
+
program.command("dev").description("Start the development service").option("--port <port>", "The port for the local router", "3000").option("--host", "Expose the routers on the local network, for testing on a phone").action(async (options) => {
|
|
184521
184545
|
await layout("dev", async ({ exit, ...props }) => {
|
|
184522
184546
|
await buildTypes(props);
|
|
184523
184547
|
const port = Number(options.port);
|
|
@@ -184537,7 +184561,7 @@ var dev = (program) => {
|
|
|
184537
184561
|
const start = async (appConfig = props.appConfig, stackConfigs = props.stackConfigs) => {
|
|
184538
184562
|
let logger = (message) => logs_exports.step(message);
|
|
184539
184563
|
const phase = async (titles, fn) => {
|
|
184540
|
-
const time = createTimer();
|
|
184564
|
+
const time = createTimer(titles.since);
|
|
184541
184565
|
let detail = "";
|
|
184542
184566
|
return logs_exports.task({
|
|
184543
184567
|
initialMessage: titles.start,
|
|
@@ -184557,6 +184581,7 @@ var dev = (program) => {
|
|
|
184557
184581
|
appConfig,
|
|
184558
184582
|
stackConfigs,
|
|
184559
184583
|
port,
|
|
184584
|
+
host: options.host,
|
|
184560
184585
|
pool,
|
|
184561
184586
|
phase,
|
|
184562
184587
|
onLog(message) {
|
|
@@ -184564,11 +184589,12 @@ var dev = (program) => {
|
|
|
184564
184589
|
}
|
|
184565
184590
|
});
|
|
184566
184591
|
logs_exports.success("Local dev environment ready.");
|
|
184592
|
+
const lanIp = options.host ? findLanIp() : undefined;
|
|
184567
184593
|
logs_exports.list("Endpoints", {
|
|
184568
184594
|
Dashboard: color2.info(`http://localhost:${instance.dashboardPort}`),
|
|
184569
|
-
...Object.fromEntries(Object.entries(instance.routerPorts).
|
|
184570
|
-
`Router ${id}`,
|
|
184571
|
-
color2.info(`http
|
|
184595
|
+
...Object.fromEntries(Object.entries(instance.routerPorts).flatMap(([id, routerPort]) => [
|
|
184596
|
+
[`Router ${id}`, color2.info(`http://localhost:${routerPort}`)],
|
|
184597
|
+
...lanIp ? [[`Router ${id} (lan)`, color2.info(`http://${lanIp}:${routerPort}`)]] : []
|
|
184572
184598
|
]))
|
|
184573
184599
|
});
|
|
184574
184600
|
claimSignals();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@awsless/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.48",
|
|
4
4
|
"bugs": {
|
|
5
5
|
"url": "https://github.com/awsless/awsless/issues"
|
|
6
6
|
},
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"@awsless/sns": "^0.0.13",
|
|
57
57
|
"@awsless/sqs": "^0.0.25",
|
|
58
58
|
"@awsless/ts-file-cache": "^0.0.22",
|
|
59
|
-
"@awsless/validate": "^0.2.
|
|
59
|
+
"@awsless/validate": "^0.2.2",
|
|
60
60
|
"@awsless/weak-cache": "^0.0.2",
|
|
61
61
|
"@clack/prompts": "1.7.0",
|
|
62
62
|
"@jridgewell/trace-mapping": "0.3.31",
|
|
@@ -122,7 +122,7 @@
|
|
|
122
122
|
"@awsless/lambda": "^0.0.51",
|
|
123
123
|
"@awsless/s3": "^0.0.23",
|
|
124
124
|
"@awsless/ts-file-cache": "^0.0.22",
|
|
125
|
-
"@awsless/validate": "^0.2.
|
|
125
|
+
"@awsless/validate": "^0.2.2",
|
|
126
126
|
"@awsless/weak-cache": "^0.0.2",
|
|
127
127
|
"@opensearch-project/opensearch": "3.6.0",
|
|
128
128
|
"awsless": "^0.1.14"
|