@awsless/cli 0.1.16 → 0.1.17

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 +40 -18
  2. package/package.json +12 -10
package/dist/bin.js CHANGED
@@ -119581,7 +119581,7 @@ var require_client4 = __commonJS((exports) => {
119581
119581
  // ../../node_modules/.pnpm/@smithy+core@3.29.7/node_modules/@smithy/core/dist-cjs/submodules/config/index.js
119582
119582
  var require_config2 = __commonJS((exports) => {
119583
119583
  var { homedir: homedir3 } = __require("os");
119584
- var { sep: sep4, join: join53 } = __require("path");
119584
+ var { sep: sep6, join: join53 } = __require("path");
119585
119585
  var { createHash: createHash22 } = __require("crypto");
119586
119586
  var { readFile: readFile$1 } = __require("fs/promises");
119587
119587
  var { IniSectionType: IniSectionType2 } = require_dist_cjs();
@@ -119721,7 +119721,7 @@ var require_config2 = __commonJS((exports) => {
119721
119721
  return "DEFAULT";
119722
119722
  };
119723
119723
  var getHomeDir = () => {
119724
- const { HOME, USERPROFILE, HOMEPATH, HOMEDRIVE = `C:${sep4}` } = process.env;
119724
+ const { HOME, USERPROFILE, HOMEPATH, HOMEDRIVE = `C:${sep6}` } = process.env;
119725
119725
  if (HOME)
119726
119726
  return HOME;
119727
119727
  if (USERPROFILE)
@@ -199059,16 +199059,31 @@ function watch(paths, options = {}) {
199059
199059
  }
199060
199060
 
199061
199061
  // src/config/load/watch.ts
199062
+ import { basename as basename6, sep as sep2 } from "path";
199063
+ var isConfigFile = (path7) => {
199064
+ const base = basename6(path7);
199065
+ return /^app\.(json|jsonc|json5)$/.test(base) || /(^|\.)stack\.(json|jsonc|json5)$/.test(base);
199066
+ };
199062
199067
  var watchConfig = async (options, resolve7, reject) => {
199063
199068
  await loadAppConfig(options);
199064
199069
  debug("Start watching...");
199065
- const ext2 = "{json,jsonc,json5}";
199066
- const watcher = watch([`app.${ext2}`, `**/stack.${ext2}`, `**/*.stack.${ext2}`], {
199067
- cwd: directories.root,
199068
- ignored: ["**/node_modules/**", "**/dist/**"],
199070
+ const ignoredDirectories = new Set(["node_modules", ".awsless", "dist", ".git"]);
199071
+ const watcher = watch(directories.root, {
199072
+ ignored: (path7, stats2) => {
199073
+ if (path7.split(sep2).some((segment) => ignoredDirectories.has(segment))) {
199074
+ return true;
199075
+ }
199076
+ if (stats2?.isFile()) {
199077
+ return !isConfigFile(path7);
199078
+ }
199079
+ return false;
199080
+ },
199069
199081
  awaitWriteFinish: true
199070
199082
  });
199071
- watcher.on("change", async () => {
199083
+ watcher.on("change", async (path7) => {
199084
+ if (!isConfigFile(path7)) {
199085
+ return;
199086
+ }
199072
199087
  try {
199073
199088
  const appConfig = await loadAppConfig(options);
199074
199089
  const stackConfigs = await loadStackConfigs(options);
@@ -199084,7 +199099,7 @@ var watchConfig = async (options, resolve7, reject) => {
199084
199099
  // src/dev/index.ts
199085
199100
  import { loadWorkspace as loadWorkspace3 } from "@awsless/ts-file-cache";
199086
199101
  import { mkdir as mkdir11, rm as rm12, writeFile as writeFile15 } from "fs/promises";
199087
- import { join as join51 } from "path";
199102
+ import { basename as basename7, join as join51, sep as sep5 } from "path";
199088
199103
 
199089
199104
  // src/dev/context.ts
199090
199105
  import { DynamoDBServer } from "@awsless/dynamodb-server";
@@ -199094,7 +199109,7 @@ import { join as join46 } from "path";
199094
199109
  import { createHash as createHash20 } from "crypto";
199095
199110
  import { mkdir as mkdir9, readdir as readdir8, readFile as readFile18, rm as rm10, stat as stat9, writeFile as writeFile12 } from "fs/promises";
199096
199111
  import { createServer as createServer7 } from "http";
199097
- import { dirname as dirname24, isAbsolute as isAbsolute7, join as join45, relative as relative12, sep as sep2 } from "path";
199112
+ import { dirname as dirname24, isAbsolute as isAbsolute7, join as join45, relative as relative12, sep as sep3 } from "path";
199098
199113
  var escapeXml = (value) => {
199099
199114
  return value.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll('"', "&quot;").replaceAll("'", "&apos;");
199100
199115
  };
@@ -199185,7 +199200,7 @@ var createS3Server = (props) => {
199185
199200
  if (entry.isDirectory()) {
199186
199201
  await walk2(path7);
199187
199202
  } else {
199188
- const objectKey = relative12(bucketDir, path7).split(sep2).join("/");
199203
+ const objectKey = relative12(bucketDir, path7).split(sep3).join("/");
199189
199204
  if (!objectKey.startsWith(prefix)) {
199190
199205
  continue;
199191
199206
  }
@@ -199835,7 +199850,7 @@ import { DynamoDBDocumentClient, ScanCommand as ScanCommand2 } from "@aws-sdk/li
199835
199850
  import { randomUUID as randomUUID8 } from "crypto";
199836
199851
  import { readdir as readdir9, readFile as readFile19, stat as stat10, writeFile as writeFile14 } from "fs/promises";
199837
199852
  import { createServer as createServer9 } from "http";
199838
- import { join as join49, relative as relative13, sep as sep3 } from "path";
199853
+ import { join as join49, relative as relative13, sep as sep4 } from "path";
199839
199854
 
199840
199855
  // src/dev/worker.ts
199841
199856
  import { spawn as spawn7 } from "child_process";
@@ -202522,7 +202537,7 @@ var createDashboardServer = (props) => {
202522
202537
  if (entry.isDirectory()) {
202523
202538
  await walk2(path7);
202524
202539
  } else {
202525
- const key = relative13(props.storeRoot, path7).split(sep3).slice(1).join("/");
202540
+ const key = relative13(props.storeRoot, path7).split(sep4).slice(1).join("/");
202526
202541
  if (key.startsWith(prefix)) {
202527
202542
  const info2 = await stat10(path7);
202528
202543
  files.push({ key, size: info2.size, modified: info2.mtime.toISOString() });
@@ -203226,8 +203241,15 @@ var startDev = async (props) => {
203226
203241
  });
203227
203242
  dashboard.connect(dispatch);
203228
203243
  await dashboard.listen(dashboardPort);
203244
+ const ignoredDirectories = new Set(["node_modules", ".awsless", "dist", ".git"]);
203229
203245
  const watcher = watch(directories.root, {
203230
- ignored: ["**/node_modules/**", "**/.awsless/**", "**/dist/**", "**/.git/**", "**/*.stack.*", "**/app.json*"],
203246
+ ignored: (path7) => {
203247
+ if (path7.split(sep5).some((segment) => ignoredDirectories.has(segment))) {
203248
+ return true;
203249
+ }
203250
+ const base = basename7(path7);
203251
+ return base.includes(".stack.") || base.startsWith("app.json");
203252
+ },
203231
203253
  ignoreInitial: true,
203232
203254
  awaitWriteFinish: { stabilityThreshold: 100, pollInterval: 50 }
203233
203255
  });
@@ -205640,7 +205662,7 @@ var fromEnv3 = (envVarSelector, options) => async () => {
205640
205662
 
205641
205663
  // ../../node_modules/.pnpm/@smithy+shared-ini-file-loader@4.4.7/node_modules/@smithy/shared-ini-file-loader/dist-es/getHomeDir.js
205642
205664
  import { homedir as homedir3 } from "os";
205643
- import { sep as sep4 } from "path";
205665
+ import { sep as sep6 } from "path";
205644
205666
  var homeDirCache = {};
205645
205667
  var getHomeDirCacheKey = () => {
205646
205668
  if (process && process.geteuid) {
@@ -205649,7 +205671,7 @@ var getHomeDirCacheKey = () => {
205649
205671
  return "DEFAULT";
205650
205672
  };
205651
205673
  var getHomeDir = () => {
205652
- const { HOME, USERPROFILE, HOMEPATH, HOMEDRIVE = `C:${sep4}` } = process.env;
205674
+ const { HOME, USERPROFILE, HOMEPATH, HOMEDRIVE = `C:${sep6}` } = process.env;
205653
205675
  if (HOME)
205654
205676
  return HOME;
205655
205677
  if (USERPROFILE)
@@ -207112,16 +207134,16 @@ import { readFile as readFile23 } from "fs/promises";
207112
207134
  import { join as join57 } from "path";
207113
207135
 
207114
207136
  // ../../node_modules/.pnpm/@aws-sdk+util-user-agent-node@3.973.14_aws-crt@1.33.1/node_modules/@aws-sdk/util-user-agent-node/dist-es/getNodeModulesParentDirs.js
207115
- import { normalize as normalize4, sep as sep5 } from "path";
207137
+ import { normalize as normalize4, sep as sep7 } from "path";
207116
207138
  var getNodeModulesParentDirs = (dirname28) => {
207117
207139
  const cwd2 = process.cwd();
207118
207140
  if (!dirname28) {
207119
207141
  return [cwd2];
207120
207142
  }
207121
207143
  const normalizedPath = normalize4(dirname28);
207122
- const parts = normalizedPath.split(sep5);
207144
+ const parts = normalizedPath.split(sep7);
207123
207145
  const nodeModulesIndex = parts.indexOf("node_modules");
207124
- const parentDir = nodeModulesIndex !== -1 ? parts.slice(0, nodeModulesIndex).join(sep5) : normalizedPath;
207146
+ const parentDir = nodeModulesIndex !== -1 ? parts.slice(0, nodeModulesIndex).join(sep7) : normalizedPath;
207125
207147
  if (cwd2 === parentDir) {
207126
207148
  return [cwd2];
207127
207149
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@awsless/cli",
3
- "version": "0.1.16",
3
+ "version": "0.1.17",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -38,13 +38,13 @@
38
38
  "@aws-sdk/lib-dynamodb": "^3.1112.0",
39
39
  "@opensearch-project/opensearch": "^3.6.0",
40
40
  "@awsless/big-float": "^0.1.7",
41
+ "@awsless/duration": "^0.0.4",
41
42
  "@awsless/dynamodb": "^0.3.25",
42
43
  "@awsless/dynamodb-server": "^0.1.10",
43
44
  "@awsless/json": "^0.0.11",
44
45
  "@awsless/lambda": "^0.0.48",
45
- "@awsless/duration": "^0.0.4",
46
- "@awsless/ts-file-cache": "^0.0.17",
47
46
  "@awsless/s3": "^0.0.22",
47
+ "@awsless/ts-file-cache": "^0.0.17",
48
48
  "@awsless/validate": "^0.2.0",
49
49
  "@awsless/weak-cache": "^0.0.1",
50
50
  "awsless": "^0.1.4"
@@ -107,31 +107,33 @@
107
107
  "wildstring": "^1.0.9",
108
108
  "wrap-ansi": "^10.0.1",
109
109
  "zod": "^4.4.3",
110
- "@awsless/big-float": "^0.1.7",
111
110
  "@awsless/cloudwatch": "^0.0.1",
112
111
  "@awsless/clui": "^0.0.9",
112
+ "@awsless/big-float": "^0.1.7",
113
113
  "@awsless/duration": "^0.0.4",
114
114
  "@awsless/dynamodb": "^0.3.25",
115
115
  "@awsless/dynamodb-server": "^0.1.10",
116
116
  "@awsless/iot": "^0.0.5",
117
- "@awsless/json": "^0.0.11",
118
117
  "@awsless/lambda": "^0.0.48",
119
- "@awsless/redis": "^0.1.13",
118
+ "@awsless/json": "^0.0.11",
120
119
  "@awsless/open-search": "^0.0.28",
121
120
  "@awsless/s3": "^0.0.22",
121
+ "@awsless/redis": "^0.1.13",
122
122
  "@awsless/size": "^0.0.3",
123
123
  "@awsless/sns": "^0.0.11",
124
124
  "@awsless/sqs": "^0.0.24",
125
125
  "@awsless/ts-file-cache": "^0.0.17",
126
126
  "@awsless/validate": "^0.2.0",
127
- "awsless": "^0.1.4",
128
- "@awsless/weak-cache": "^0.0.1"
127
+ "@awsless/weak-cache": "^0.0.1",
128
+ "awsless": "^0.1.4"
129
129
  },
130
130
  "scripts": {
131
- "test": "bun cli/build-handlers.ts && pnpm vitest",
131
+ "test": "pnpm typecheck && bun cli/build-handlers.ts && pnpm vitest",
132
132
  "build": "bun cli/build.ts",
133
133
  "jack": "pnpm build && bun dist/bin.js --config-file=./example/jack/app.jsonc",
134
134
  "kennedy": "pnpm build && bun dist/bin.js --config-file=./example/kennedy/app.jsonc",
135
- "prepublish": "if pnpm test; then pnpm build; else exit; fi"
135
+ "prepublish": "if pnpm test; then pnpm build; else exit; fi",
136
+ "typecheck": "tsc --noEmit",
137
+ "types": "bun dist/bin.js types --config-file=./example/jack/app.jsonc && bun dist/bin.js types --config-file=./example/kennedy/app.jsonc"
136
138
  }
137
139
  }