@donotdev/cli 0.1.46 → 0.2.0

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 (47) hide show
  1. package/dependencies-matrix.json +189 -149
  2. package/dist/bin/commands/agent-setup.js +83 -19
  3. package/dist/bin/commands/build.js +105 -37
  4. package/dist/bin/commands/bump.js +108 -44
  5. package/dist/bin/commands/cacheout.js +83 -19
  6. package/dist/bin/commands/coach.js +83 -19
  7. package/dist/bin/commands/create-app.js +107 -43
  8. package/dist/bin/commands/create-project.js +107 -43
  9. package/dist/bin/commands/db.js +134098 -72027
  10. package/dist/bin/commands/deploy.js +310 -239
  11. package/dist/bin/commands/dev.js +87 -23
  12. package/dist/bin/commands/doctor.js +83 -19
  13. package/dist/bin/commands/emu.js +93 -29
  14. package/dist/bin/commands/format.js +83 -19
  15. package/dist/bin/commands/get-demo.js +87 -23
  16. package/dist/bin/commands/make-admin.js +7466 -8217
  17. package/dist/bin/commands/preview.js +87 -23
  18. package/dist/bin/commands/seed.js +134098 -72027
  19. package/dist/bin/commands/setup-cicd.js +107 -43
  20. package/dist/bin/commands/setup.js +110 -43
  21. package/dist/bin/commands/staging.js +310 -239
  22. package/dist/bin/commands/sync-secrets.js +88 -24
  23. package/dist/bin/commands/type-check.js +83 -19
  24. package/dist/bin/commands/wai.js +83 -19
  25. package/dist/bin/dndev.js +8 -3
  26. package/dist/index.js +317 -246
  27. package/package.json +3 -3
  28. package/templates/app-next/src/app/ClientLayout.tsx.example +11 -1
  29. package/templates/app-next/src/app/layout.tsx.example +19 -1
  30. package/templates/functions-firebase/src/billing/handleStripeWebhook.ts.example +8 -18
  31. package/templates/functions-firebase/src/billing/index.ts.example +0 -1
  32. package/templates/functions-firebase/src/billing/refreshSubscriptionStatus.ts.example +4 -8
  33. package/templates/functions-firebase/src/index.ts.example +0 -1
  34. package/templates/functions-supabase/supabase/config.toml.example +4 -0
  35. package/templates/functions-supabase/supabase/functions/stripe-webhook/index.ts.example +12 -0
  36. package/templates/functions-supabase/supabase/migrations/20250101000005_webhook_events.sql +133 -0
  37. package/templates/functions-vercel/.env.example +9 -0
  38. package/templates/functions-vercel/src/api/billing/handleStripeWebhook.ts.example +12 -14
  39. package/templates/functions-vercel/src/api/billing/refreshSubscriptionStatus.ts.example +4 -14
  40. package/templates/overlay-supabase/src/config/providers.ts.example +2 -2
  41. package/templates/root-consumer/.claude/hooks/guard-write.sh.example +32 -0
  42. package/templates/root-consumer/.claude/hooks/record-lookup.sh.example +22 -0
  43. package/templates/root-consumer/.claude/rules/definition-of-done.md.example +7 -0
  44. package/templates/root-consumer/.claude/rules/framework.md.example +6 -0
  45. package/templates/root-consumer/.claude/settings.json.example +11 -1
  46. package/templates/functions-firebase/src/billing/processPaymentSuccess.ts.example +0 -14
  47. package/templates/functions-vercel/src/api/billing/processPaymentSuccess.ts.example +0 -20
@@ -10,11 +10,20 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
10
10
  if (typeof require !== "undefined") return require.apply(this, arguments);
11
11
  throw Error('Dynamic require of "' + x + '" is not supported');
12
12
  });
13
- var __esm = (fn, res) => function __init() {
14
- return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
13
+ var __esm = (fn, res, err) => function __init() {
14
+ if (err) throw err[0];
15
+ try {
16
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
17
+ } catch (e) {
18
+ throw err = [e], e;
19
+ }
15
20
  };
16
21
  var __commonJS = (cb, mod) => function __require2() {
17
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
22
+ try {
23
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
24
+ } catch (e) {
25
+ throw mod = 0, e;
26
+ }
18
27
  };
19
28
  var __copyProps = (to, from, except, desc) => {
20
29
  if (from && typeof from === "object" || typeof from === "function") {
@@ -453,13 +462,13 @@ var require_src = __commonJS({
453
462
  }
454
463
  });
455
464
 
456
- // node_modules/.bun/@clack+core@1.5.0/node_modules/@clack/core/dist/index.mjs
465
+ // node_modules/.bun/@clack+core@1.5.1/node_modules/@clack/core/dist/index.mjs
457
466
  import { styleText } from "node:util";
458
467
  import { stdout, stdin } from "node:process";
459
468
  import { ReadStream } from "node:tty";
460
469
  var import_sisteransi, a$1, t, settings, R, getColumns;
461
470
  var init_dist3 = __esm({
462
- "node_modules/.bun/@clack+core@1.5.0/node_modules/@clack/core/dist/index.mjs"() {
471
+ "node_modules/.bun/@clack+core@1.5.1/node_modules/@clack/core/dist/index.mjs"() {
463
472
  init_utils2();
464
473
  init_main();
465
474
  import_sisteransi = __toESM(require_src(), 1);
@@ -512,7 +521,7 @@ var init_dist3 = __esm({
512
521
  }
513
522
  });
514
523
 
515
- // node_modules/.bun/@clack+prompts@1.8.0/node_modules/@clack/prompts/dist/index.mjs
524
+ // node_modules/.bun/@clack+prompts@1.8.1/node_modules/@clack/prompts/dist/index.mjs
516
525
  import { styleText as styleText2, stripVTControlCharacters } from "node:util";
517
526
  import process$1 from "node:process";
518
527
  import { existsSync, lstatSync, readdirSync } from "node:fs";
@@ -525,7 +534,7 @@ function isUnicodeSupported() {
525
534
  }
526
535
  var import_sisteransi2, unicode, unicodeOr, S_STEP_ACTIVE, S_STEP_CANCEL, S_STEP_ERROR, S_STEP_SUBMIT, S_BAR_START, S_BAR, S_BAR_END, S_BAR_START_RIGHT, S_BAR_END_RIGHT, S_RADIO_ACTIVE, S_RADIO_INACTIVE, S_CHECKBOX_ACTIVE, S_CHECKBOX_SELECTED, S_CHECKBOX_INACTIVE, S_PASSWORD_MASK, S_BAR_H, S_CORNER_TOP_RIGHT, S_CONNECT_LEFT, S_CORNER_BOTTOM_RIGHT, S_CORNER_BOTTOM_LEFT, S_CORNER_TOP_LEFT, S_INFO, S_SUCCESS, S_WARN, S_ERROR, MULTISELECT_INSTRUCTIONS, log, intro, outro, W$1, C, note, u2, SELECT_INSTRUCTIONS, i;
527
536
  var init_dist4 = __esm({
528
- "node_modules/.bun/@clack+prompts@1.8.0/node_modules/@clack/prompts/dist/index.mjs"() {
537
+ "node_modules/.bun/@clack+prompts@1.8.1/node_modules/@clack/prompts/dist/index.mjs"() {
529
538
  init_utils2();
530
539
  init_dist3();
531
540
  init_dist3();
@@ -5147,9 +5156,9 @@ var require_reusify = __commonJS({
5147
5156
  }
5148
5157
  });
5149
5158
 
5150
- // node_modules/.bun/fastq@1.20.1/node_modules/fastq/queue.js
5159
+ // node_modules/.bun/fastq@1.20.3/node_modules/fastq/queue.js
5151
5160
  var require_queue = __commonJS({
5152
- "node_modules/.bun/fastq@1.20.1/node_modules/fastq/queue.js"(exports, module) {
5161
+ "node_modules/.bun/fastq@1.20.3/node_modules/fastq/queue.js"(exports, module) {
5153
5162
  "use strict";
5154
5163
  init_utils2();
5155
5164
  var reusify = require_reusify();
@@ -5329,11 +5338,12 @@ var require_queue = __commonJS({
5329
5338
  current.value = null;
5330
5339
  current.callback = noop;
5331
5340
  current.errorHandler = null;
5341
+ current.next = null;
5332
5342
  if (errorHandler2) {
5333
5343
  errorHandler2(new Error("abort"), val);
5334
5344
  }
5335
5345
  callback.call(context2, new Error("abort"));
5336
- current.release(current);
5346
+ cache.release(current);
5337
5347
  current = next;
5338
5348
  }
5339
5349
  self.drain = noop;
@@ -6799,7 +6809,7 @@ import {
6799
6809
  sep,
6800
6810
  extname
6801
6811
  } from "node:path";
6802
- import "node:url";
6812
+ import { fileURLToPath } from "node:url";
6803
6813
  function safeExecuteAsync(fn, message) {
6804
6814
  return fn().catch((error2) => {
6805
6815
  throw new Error(
@@ -6856,6 +6866,7 @@ var init_PathResolver = __esm({
6856
6866
  options;
6857
6867
  _repoRoot;
6858
6868
  _appRoot = null;
6869
+ _writtenPaths = null;
6859
6870
  /**
6860
6871
  * Get or create singleton instance
6861
6872
  * @param options - Configuration options
@@ -7174,16 +7185,17 @@ var init_PathResolver = __esm({
7174
7185
  }
7175
7186
  const detectedFormat = this._detectFormat(filePath, format);
7176
7187
  let writeContent;
7177
- if (Buffer.isBuffer(content)) {
7188
+ if (Buffer2.isBuffer(content)) {
7178
7189
  writeContent = content;
7179
7190
  } else if (detectedFormat === "json" && typeof content === "object") {
7180
- writeContent = JSON.stringify(content, null, 2);
7191
+ writeContent = `${JSON.stringify(content, null, 2)}
7192
+ `;
7181
7193
  } else {
7182
7194
  writeContent = String(content);
7183
7195
  }
7184
7196
  try {
7185
7197
  return await safeExecuteAsync(async () => {
7186
- if (Buffer.isBuffer(writeContent)) {
7198
+ if (Buffer2.isBuffer(writeContent)) {
7187
7199
  await fs.promises.writeFile(normalizedPath, writeContent);
7188
7200
  } else {
7189
7201
  await fs.promises.writeFile(normalizedPath, writeContent, "utf8");
@@ -7235,19 +7247,21 @@ var init_PathResolver = __esm({
7235
7247
  }
7236
7248
  const detectedFormat = this._detectFormat(filePath, format);
7237
7249
  let writeContent;
7238
- if (Buffer.isBuffer(content)) {
7250
+ if (Buffer2.isBuffer(content)) {
7239
7251
  writeContent = content;
7240
7252
  } else if (detectedFormat === "json" && typeof content === "object") {
7241
- writeContent = JSON.stringify(content, null, 2);
7253
+ writeContent = `${JSON.stringify(content, null, 2)}
7254
+ `;
7242
7255
  } else {
7243
7256
  writeContent = String(content);
7244
7257
  }
7245
7258
  try {
7246
- if (Buffer.isBuffer(writeContent)) {
7259
+ if (Buffer2.isBuffer(writeContent)) {
7247
7260
  fs.writeFileSync(normalizedPath, writeContent);
7248
7261
  } else {
7249
7262
  fs.writeFileSync(normalizedPath, writeContent, "utf8");
7250
7263
  }
7264
+ this._writtenPaths?.add(normalizedPath);
7251
7265
  if (verbose) {
7252
7266
  log3.info(
7253
7267
  `${fileExists ? "Updated" : "Created"} file: ${normalizedPath}`
@@ -7332,6 +7346,7 @@ var init_PathResolver = __esm({
7332
7346
  }
7333
7347
  try {
7334
7348
  fs.copyFileSync(srcPath, normalizedDestPath);
7349
+ this._writtenPaths?.add(normalizedDestPath);
7335
7350
  if (verbose) {
7336
7351
  log3.info(
7337
7352
  `${fileExists ? "Updated" : "Created"} file: ${normalizedDestPath}`
@@ -7399,6 +7414,24 @@ var init_PathResolver = __esm({
7399
7414
  return null;
7400
7415
  }
7401
7416
  }
7417
+ /**
7418
+ * Resolve the real path of a file, following symlinks
7419
+ * @param filePath - Path to resolve
7420
+ * @returns Resolved real path
7421
+ */
7422
+ realpathSync(filePath) {
7423
+ return fs.realpathSync(filePath);
7424
+ }
7425
+ /**
7426
+ * Watch a directory for changes
7427
+ * @param dirPath - Directory to watch
7428
+ * @param options - fs.watch options
7429
+ * @param callback - Callback for change events
7430
+ * @returns FSWatcher instance
7431
+ */
7432
+ watch(dirPath, options, callback) {
7433
+ return fs.watch(dirPath, options, callback);
7434
+ }
7402
7435
  /**
7403
7436
  * Get file stats synchronously (follows symlinks)
7404
7437
  * Returns null if file doesn't exist (graceful degradation)
@@ -7478,6 +7511,28 @@ var init_PathResolver = __esm({
7478
7511
  * Get app root (where vite.config.ts is, Vite's config.root)
7479
7512
  * Falls back to repoRoot if not set
7480
7513
  */
7514
+ /**
7515
+ * Start recording every path written by writeSync/copySync.
7516
+ * Lets a generator know exactly which files the current run produced,
7517
+ * without comparing file timestamps to a clock.
7518
+ */
7519
+ startWriteRecording() {
7520
+ this._writtenPaths = /* @__PURE__ */ new Set();
7521
+ }
7522
+ /**
7523
+ * Stop recording and return the normalized paths written since
7524
+ * startWriteRecording().
7525
+ */
7526
+ stopWriteRecording() {
7527
+ if (!this._writtenPaths) {
7528
+ throw new Error(
7529
+ "stopWriteRecording() called without startWriteRecording()"
7530
+ );
7531
+ }
7532
+ const written = this._writtenPaths;
7533
+ this._writtenPaths = null;
7534
+ return written;
7535
+ }
7481
7536
  getAppRoot() {
7482
7537
  if (!this._appRoot) {
7483
7538
  return this._repoRoot;
@@ -7735,6 +7790,15 @@ var init_PathResolver = __esm({
7735
7790
  const cjsPath = this.getEmptyCjsModulePath();
7736
7791
  return cjsPath.replace(/\.cjs$/, ".js");
7737
7792
  }
7793
+ /**
7794
+ * Get absolute path to empty flag component module.
7795
+ * Returns `export default () => null;` — used by flag filtering plugins
7796
+ * to replace unused flag files at build time.
7797
+ */
7798
+ getEmptyFlagModulePath() {
7799
+ const __dirname2 = dirname2(fileURLToPath(import.meta.url));
7800
+ return this.normalizePath(resolve(__dirname2, "emptyFlag.js"));
7801
+ }
7738
7802
  /**
7739
7803
  * Get absolute path to empty CJS module for esbuild pre-bundling.
7740
7804
  * CJS because esbuild statically analyzes ESM exports — CJS has dynamic
@@ -7832,7 +7896,7 @@ var init_pathResolver = __esm({
7832
7896
  });
7833
7897
 
7834
7898
  // packages/tooling/src/bundler/utils.ts
7835
- import { Buffer } from "node:buffer";
7899
+ import { Buffer as Buffer2 } from "node:buffer";
7836
7900
  import { copyFileSync as copyFileSync2, readFileSync as readFileSync2, writeFileSync as writeFileSync2, mkdirSync as mkdirSync2 } from "node:fs";
7837
7901
  import { createRequire as createRequire3 } from "node:module";
7838
7902
  import { dirname as dirname4, resolve as resolve3 } from "node:path";
@@ -7849,7 +7913,7 @@ var init_utils2 = __esm({
7849
7913
  globalThis.require = require2;
7850
7914
  globalThis.__filename = __filename;
7851
7915
  globalThis.__dirname = __dirname;
7852
- globalThis.Buffer = Buffer;
7916
+ globalThis.Buffer = Buffer2;
7853
7917
  globalThis.process = process;
7854
7918
  if (typeof global === "undefined") {
7855
7919
  globalThis.global = globalThis;
@@ -10,11 +10,20 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
10
10
  if (typeof require !== "undefined") return require.apply(this, arguments);
11
11
  throw Error('Dynamic require of "' + x + '" is not supported');
12
12
  });
13
- var __esm = (fn, res) => function __init() {
14
- return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
13
+ var __esm = (fn, res, err) => function __init() {
14
+ if (err) throw err[0];
15
+ try {
16
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
17
+ } catch (e) {
18
+ throw err = [e], e;
19
+ }
15
20
  };
16
21
  var __commonJS = (cb, mod) => function __require2() {
17
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
22
+ try {
23
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
24
+ } catch (e) {
25
+ throw mod = 0, e;
26
+ }
18
27
  };
19
28
  var __export = (target, all) => {
20
29
  for (var name in all)
@@ -457,7 +466,7 @@ var require_src = __commonJS({
457
466
  }
458
467
  });
459
468
 
460
- // node_modules/.bun/@clack+core@1.5.0/node_modules/@clack/core/dist/index.mjs
469
+ // node_modules/.bun/@clack+core@1.5.1/node_modules/@clack/core/dist/index.mjs
461
470
  import { styleText } from "node:util";
462
471
  import { stdout, stdin } from "node:process";
463
472
  import * as l from "node:readline";
@@ -556,7 +565,7 @@ function runValidation(e, a2) {
556
565
  }
557
566
  var import_sisteransi, a$1, t, settings, R, CANCEL_SYMBOL, getColumns, getRows, y, n$1;
558
567
  var init_dist3 = __esm({
559
- "node_modules/.bun/@clack+core@1.5.0/node_modules/@clack/core/dist/index.mjs"() {
568
+ "node_modules/.bun/@clack+core@1.5.1/node_modules/@clack/core/dist/index.mjs"() {
560
569
  init_utils2();
561
570
  init_main();
562
571
  import_sisteransi = __toESM(require_src(), 1);
@@ -815,7 +824,7 @@ var init_dist3 = __esm({
815
824
  }
816
825
  });
817
826
 
818
- // node_modules/.bun/@clack+prompts@1.8.0/node_modules/@clack/prompts/dist/index.mjs
827
+ // node_modules/.bun/@clack+prompts@1.8.1/node_modules/@clack/prompts/dist/index.mjs
819
828
  import { styleText as styleText2, stripVTControlCharacters } from "node:util";
820
829
  import process$1 from "node:process";
821
830
  import { existsSync, lstatSync, readdirSync } from "node:fs";
@@ -832,7 +841,7 @@ function formatInstructionFooter(o, e) {
832
841
  }
833
842
  var import_sisteransi2, unicode, isCI, unicodeOr, S_STEP_ACTIVE, S_STEP_CANCEL, S_STEP_ERROR, S_STEP_SUBMIT, S_BAR_START, S_BAR, S_BAR_END, S_BAR_START_RIGHT, S_BAR_END_RIGHT, S_RADIO_ACTIVE, S_RADIO_INACTIVE, S_CHECKBOX_ACTIVE, S_CHECKBOX_SELECTED, S_CHECKBOX_INACTIVE, S_PASSWORD_MASK, S_BAR_H, S_CORNER_TOP_RIGHT, S_CONNECT_LEFT, S_CORNER_BOTTOM_RIGHT, S_CORNER_BOTTOM_LEFT, S_CORNER_TOP_LEFT, S_INFO, S_SUCCESS, S_WARN, S_ERROR, symbol, symbolBar, I, limitOptions, MULTISELECT_INSTRUCTIONS, log, cancel, W$1, C, note, W, spinner, u2, SELECT_INSTRUCTIONS, c, select, i;
834
843
  var init_dist4 = __esm({
835
- "node_modules/.bun/@clack+prompts@1.8.0/node_modules/@clack/prompts/dist/index.mjs"() {
844
+ "node_modules/.bun/@clack+prompts@1.8.1/node_modules/@clack/prompts/dist/index.mjs"() {
836
845
  init_utils2();
837
846
  init_dist3();
838
847
  init_dist3();
@@ -1193,19 +1202,19 @@ ${styleText2("gray", S_BAR)}` : ""}`;
1193
1202
  }
1194
1203
  default: {
1195
1204
  const r2 = n3 ? `${styleText2("cyan", S_BAR)} ` : "", a2 = u3.split(`
1196
- `).length, p = d ? formatInstructionFooter(SELECT_INSTRUCTIONS, n3) : n3 ? [styleText2("cyan", S_BAR_END)] : [], b = p.join(`
1197
- `), f = p.length + 1;
1205
+ `).length, p = d ? formatInstructionFooter(SELECT_INSTRUCTIONS, n3) : n3 ? [styleText2("cyan", S_BAR_END)] : [], f = p.join(`
1206
+ `), b = p.length + 1;
1198
1207
  return `${u3}${r2}${limitOptions({
1199
1208
  output: t2.output,
1200
1209
  cursor: this.cursor,
1201
1210
  options: this.options,
1202
1211
  maxItems: t2.maxItems,
1203
1212
  columnPadding: r2.length,
1204
- rowPadding: a2 + f,
1213
+ rowPadding: a2 + b,
1205
1214
  style: (g, x) => o(g, g.disabled ? "disabled" : x ? "active" : "inactive")
1206
1215
  }).join(`
1207
1216
  ${r2}`)}
1208
- ${b}
1217
+ ${f}
1209
1218
  `;
1210
1219
  }
1211
1220
  }
@@ -5841,9 +5850,9 @@ var require_reusify = __commonJS({
5841
5850
  }
5842
5851
  });
5843
5852
 
5844
- // node_modules/.bun/fastq@1.20.1/node_modules/fastq/queue.js
5853
+ // node_modules/.bun/fastq@1.20.3/node_modules/fastq/queue.js
5845
5854
  var require_queue = __commonJS({
5846
- "node_modules/.bun/fastq@1.20.1/node_modules/fastq/queue.js"(exports, module) {
5855
+ "node_modules/.bun/fastq@1.20.3/node_modules/fastq/queue.js"(exports, module) {
5847
5856
  "use strict";
5848
5857
  init_utils2();
5849
5858
  var reusify = require_reusify();
@@ -6023,11 +6032,12 @@ var require_queue = __commonJS({
6023
6032
  current.value = null;
6024
6033
  current.callback = noop;
6025
6034
  current.errorHandler = null;
6035
+ current.next = null;
6026
6036
  if (errorHandler2) {
6027
6037
  errorHandler2(new Error("abort"), val);
6028
6038
  }
6029
6039
  callback.call(context2, new Error("abort"));
6030
- current.release(current);
6040
+ cache.release(current);
6031
6041
  current = next;
6032
6042
  }
6033
6043
  self.drain = noop;
@@ -7493,7 +7503,7 @@ import {
7493
7503
  sep,
7494
7504
  extname
7495
7505
  } from "node:path";
7496
- import "node:url";
7506
+ import { fileURLToPath } from "node:url";
7497
7507
  function safeExecuteAsync(fn, message) {
7498
7508
  return fn().catch((error2) => {
7499
7509
  throw new Error(
@@ -7550,6 +7560,7 @@ var init_PathResolver = __esm({
7550
7560
  options;
7551
7561
  _repoRoot;
7552
7562
  _appRoot = null;
7563
+ _writtenPaths = null;
7553
7564
  /**
7554
7565
  * Get or create singleton instance
7555
7566
  * @param options - Configuration options
@@ -7868,16 +7879,17 @@ var init_PathResolver = __esm({
7868
7879
  }
7869
7880
  const detectedFormat = this._detectFormat(filePath, format);
7870
7881
  let writeContent;
7871
- if (Buffer.isBuffer(content)) {
7882
+ if (Buffer2.isBuffer(content)) {
7872
7883
  writeContent = content;
7873
7884
  } else if (detectedFormat === "json" && typeof content === "object") {
7874
- writeContent = JSON.stringify(content, null, 2);
7885
+ writeContent = `${JSON.stringify(content, null, 2)}
7886
+ `;
7875
7887
  } else {
7876
7888
  writeContent = String(content);
7877
7889
  }
7878
7890
  try {
7879
7891
  return await safeExecuteAsync(async () => {
7880
- if (Buffer.isBuffer(writeContent)) {
7892
+ if (Buffer2.isBuffer(writeContent)) {
7881
7893
  await fs.promises.writeFile(normalizedPath, writeContent);
7882
7894
  } else {
7883
7895
  await fs.promises.writeFile(normalizedPath, writeContent, "utf8");
@@ -7929,19 +7941,21 @@ var init_PathResolver = __esm({
7929
7941
  }
7930
7942
  const detectedFormat = this._detectFormat(filePath, format);
7931
7943
  let writeContent;
7932
- if (Buffer.isBuffer(content)) {
7944
+ if (Buffer2.isBuffer(content)) {
7933
7945
  writeContent = content;
7934
7946
  } else if (detectedFormat === "json" && typeof content === "object") {
7935
- writeContent = JSON.stringify(content, null, 2);
7947
+ writeContent = `${JSON.stringify(content, null, 2)}
7948
+ `;
7936
7949
  } else {
7937
7950
  writeContent = String(content);
7938
7951
  }
7939
7952
  try {
7940
- if (Buffer.isBuffer(writeContent)) {
7953
+ if (Buffer2.isBuffer(writeContent)) {
7941
7954
  fs.writeFileSync(normalizedPath, writeContent);
7942
7955
  } else {
7943
7956
  fs.writeFileSync(normalizedPath, writeContent, "utf8");
7944
7957
  }
7958
+ this._writtenPaths?.add(normalizedPath);
7945
7959
  if (verbose) {
7946
7960
  log3.info(
7947
7961
  `${fileExists ? "Updated" : "Created"} file: ${normalizedPath}`
@@ -8026,6 +8040,7 @@ var init_PathResolver = __esm({
8026
8040
  }
8027
8041
  try {
8028
8042
  fs.copyFileSync(srcPath, normalizedDestPath);
8043
+ this._writtenPaths?.add(normalizedDestPath);
8029
8044
  if (verbose) {
8030
8045
  log3.info(
8031
8046
  `${fileExists ? "Updated" : "Created"} file: ${normalizedDestPath}`
@@ -8093,6 +8108,24 @@ var init_PathResolver = __esm({
8093
8108
  return null;
8094
8109
  }
8095
8110
  }
8111
+ /**
8112
+ * Resolve the real path of a file, following symlinks
8113
+ * @param filePath - Path to resolve
8114
+ * @returns Resolved real path
8115
+ */
8116
+ realpathSync(filePath) {
8117
+ return fs.realpathSync(filePath);
8118
+ }
8119
+ /**
8120
+ * Watch a directory for changes
8121
+ * @param dirPath - Directory to watch
8122
+ * @param options - fs.watch options
8123
+ * @param callback - Callback for change events
8124
+ * @returns FSWatcher instance
8125
+ */
8126
+ watch(dirPath, options, callback) {
8127
+ return fs.watch(dirPath, options, callback);
8128
+ }
8096
8129
  /**
8097
8130
  * Get file stats synchronously (follows symlinks)
8098
8131
  * Returns null if file doesn't exist (graceful degradation)
@@ -8172,6 +8205,28 @@ var init_PathResolver = __esm({
8172
8205
  * Get app root (where vite.config.ts is, Vite's config.root)
8173
8206
  * Falls back to repoRoot if not set
8174
8207
  */
8208
+ /**
8209
+ * Start recording every path written by writeSync/copySync.
8210
+ * Lets a generator know exactly which files the current run produced,
8211
+ * without comparing file timestamps to a clock.
8212
+ */
8213
+ startWriteRecording() {
8214
+ this._writtenPaths = /* @__PURE__ */ new Set();
8215
+ }
8216
+ /**
8217
+ * Stop recording and return the normalized paths written since
8218
+ * startWriteRecording().
8219
+ */
8220
+ stopWriteRecording() {
8221
+ if (!this._writtenPaths) {
8222
+ throw new Error(
8223
+ "stopWriteRecording() called without startWriteRecording()"
8224
+ );
8225
+ }
8226
+ const written = this._writtenPaths;
8227
+ this._writtenPaths = null;
8228
+ return written;
8229
+ }
8175
8230
  getAppRoot() {
8176
8231
  if (!this._appRoot) {
8177
8232
  return this._repoRoot;
@@ -8429,6 +8484,15 @@ var init_PathResolver = __esm({
8429
8484
  const cjsPath = this.getEmptyCjsModulePath();
8430
8485
  return cjsPath.replace(/\.cjs$/, ".js");
8431
8486
  }
8487
+ /**
8488
+ * Get absolute path to empty flag component module.
8489
+ * Returns `export default () => null;` — used by flag filtering plugins
8490
+ * to replace unused flag files at build time.
8491
+ */
8492
+ getEmptyFlagModulePath() {
8493
+ const __dirname2 = dirname2(fileURLToPath(import.meta.url));
8494
+ return this.normalizePath(resolve(__dirname2, "emptyFlag.js"));
8495
+ }
8432
8496
  /**
8433
8497
  * Get absolute path to empty CJS module for esbuild pre-bundling.
8434
8498
  * CJS because esbuild statically analyzes ESM exports — CJS has dynamic
@@ -8573,7 +8637,7 @@ var init_typed_file_operations = __esm({
8573
8637
  });
8574
8638
 
8575
8639
  // packages/tooling/src/bundler/utils.ts
8576
- import { Buffer } from "node:buffer";
8640
+ import { Buffer as Buffer2 } from "node:buffer";
8577
8641
  import { copyFileSync as copyFileSync2, readFileSync as readFileSync2, writeFileSync as writeFileSync2, mkdirSync as mkdirSync2 } from "node:fs";
8578
8642
  import { createRequire as createRequire3 } from "node:module";
8579
8643
  import { dirname as dirname4, resolve as resolve3 } from "node:path";
@@ -8590,7 +8654,7 @@ var init_utils2 = __esm({
8590
8654
  globalThis.require = require2;
8591
8655
  globalThis.__filename = __filename;
8592
8656
  globalThis.__dirname = __dirname;
8593
- globalThis.Buffer = Buffer;
8657
+ globalThis.Buffer = Buffer2;
8594
8658
  globalThis.process = process;
8595
8659
  if (typeof global === "undefined") {
8596
8660
  globalThis.global = globalThis;
@@ -8860,9 +8924,9 @@ var init_cli_input = __esm({
8860
8924
  }
8861
8925
  });
8862
8926
 
8863
- // node_modules/.bun/esbuild@0.27.7/node_modules/esbuild/lib/main.js
8927
+ // node_modules/.bun/esbuild@0.28.2/node_modules/esbuild/lib/main.js
8864
8928
  var require_main = __commonJS({
8865
- "node_modules/.bun/esbuild@0.27.7/node_modules/esbuild/lib/main.js"(exports, module) {
8929
+ "node_modules/.bun/esbuild@0.28.2/node_modules/esbuild/lib/main.js"(exports, module) {
8866
8930
  "use strict";
8867
8931
  init_utils2();
8868
8932
  var __defProp2 = Object.defineProperty;
@@ -9039,11 +9103,11 @@ var require_main = __commonJS({
9039
9103
  encodeUTF8 = (text2) => encoder.encode(text2);
9040
9104
  decodeUTF8 = (bytes) => decoder.decode(bytes);
9041
9105
  encodeInvariant = 'new TextEncoder().encode("")';
9042
- } else if (typeof Buffer !== "undefined") {
9043
- encodeUTF8 = (text2) => Buffer.from(text2);
9106
+ } else if (typeof Buffer2 !== "undefined") {
9107
+ encodeUTF8 = (text2) => Buffer2.from(text2);
9044
9108
  decodeUTF8 = (bytes) => {
9045
9109
  let { buffer, byteOffset, byteLength } = bytes;
9046
- return Buffer.from(buffer, byteOffset, byteLength).toString();
9110
+ return Buffer2.from(buffer, byteOffset, byteLength).toString();
9047
9111
  };
9048
9112
  encodeInvariant = 'Buffer.from("")';
9049
9113
  } else {
@@ -9420,10 +9484,12 @@ is not a problem with esbuild. You need to fix your environment instead.
9420
9484
  let color = getFlag(options, keys, "color", mustBeBoolean);
9421
9485
  let logLevel = getFlag(options, keys, "logLevel", mustBeString);
9422
9486
  let logLimit = getFlag(options, keys, "logLimit", mustBeInteger);
9487
+ let logStyle = getFlag(options, keys, "logStyle", mustBeString);
9423
9488
  if (color !== void 0) flags.push(`--color=${color}`);
9424
9489
  else if (isTTY2) flags.push(`--color=true`);
9425
9490
  flags.push(`--log-level=${logLevel || logLevelDefault}`);
9426
9491
  flags.push(`--log-limit=${logLimit || 0}`);
9492
+ if (logStyle) flags.push(`--log-style=${logStyle}`);
9427
9493
  }
9428
9494
  function validateStringValue(value, what, key) {
9429
9495
  if (typeof value !== "string") {
@@ -9772,8 +9838,8 @@ is not a problem with esbuild. You need to fix your environment instead.
9772
9838
  if (isFirstPacket) {
9773
9839
  isFirstPacket = false;
9774
9840
  let binaryVersion = String.fromCharCode(...bytes);
9775
- if (binaryVersion !== "0.27.7") {
9776
- throw new Error(`Cannot start service: Host version "${"0.27.7"}" does not match binary version ${quote(binaryVersion)}`);
9841
+ if (binaryVersion !== "0.28.2") {
9842
+ throw new Error(`Cannot start service: Host version "${"0.28.2"}" does not match binary version ${quote(binaryVersion)}`);
9777
9843
  }
9778
9844
  return;
9779
9845
  }
@@ -9912,6 +9978,7 @@ is not a problem with esbuild. You need to fix your environment instead.
9912
9978
  let kind = getFlag(options, keys, "kind", mustBeString);
9913
9979
  let color = getFlag(options, keys, "color", mustBeBoolean);
9914
9980
  let terminalWidth = getFlag(options, keys, "terminalWidth", mustBeInteger);
9981
+ let logStyle = getFlag(options, keys, "logStyle", mustBeString);
9915
9982
  checkForInvalidFlags(options, keys, `in ${callName}() call`);
9916
9983
  if (kind === void 0) throw new Error(`Missing "kind" in ${callName}() call`);
9917
9984
  if (kind !== "error" && kind !== "warning") throw new Error(`Expected "kind" to be "error" or "warning" in ${callName}() call`);
@@ -9922,6 +9989,7 @@ is not a problem with esbuild. You need to fix your environment instead.
9922
9989
  };
9923
9990
  if (color !== void 0) request.color = color;
9924
9991
  if (terminalWidth !== void 0) request.terminalWidth = terminalWidth;
9992
+ if (logStyle !== void 0) request.logStyle = logStyle;
9925
9993
  sendRequest(refs, request, (error2, response) => {
9926
9994
  if (error2) return callback(new Error(error2), null);
9927
9995
  callback(null, response.messages);
@@ -10905,7 +10973,7 @@ for your current platform.`);
10905
10973
  "node_modules",
10906
10974
  ".cache",
10907
10975
  "esbuild",
10908
- `pnpapi-${pkg.replace("/", "-")}-${"0.27.7"}-${path.basename(subpath)}`
10976
+ `pnpapi-${pkg.replace("/", "-")}-${"0.28.2"}-${path.basename(subpath)}`
10909
10977
  );
10910
10978
  if (!fs3.existsSync(binTargetPath)) {
10911
10979
  fs3.mkdirSync(path.dirname(binTargetPath), { recursive: true });
@@ -10938,7 +11006,7 @@ for your current platform.`);
10938
11006
  }
10939
11007
  }
10940
11008
  var _a;
10941
- var isInternalWorkerThread = ((_a = worker_threads == null ? void 0 : worker_threads.workerData) == null ? void 0 : _a.esbuildVersion) === "0.27.7";
11009
+ var isInternalWorkerThread = ((_a = worker_threads == null ? void 0 : worker_threads.workerData) == null ? void 0 : _a.esbuildVersion) === "0.28.2";
10942
11010
  var esbuildCommandAndArgs = () => {
10943
11011
  if ((!ESBUILD_BINARY_PATH || false) && (path2.basename(__filename) !== "main.js" || path2.basename(__dirname) !== "lib")) {
10944
11012
  throw new Error(
@@ -11005,7 +11073,7 @@ More information: The file containing the code for esbuild's JavaScript API (${_
11005
11073
  }
11006
11074
  }
11007
11075
  };
11008
- var version = "0.27.7";
11076
+ var version = "0.28.2";
11009
11077
  var build2 = (options) => ensureServiceIsRunning().build(options);
11010
11078
  var context = (buildOptions) => ensureServiceIsRunning().context(buildOptions);
11011
11079
  var transform = (input, options) => ensureServiceIsRunning().transform(input, options);
@@ -11108,7 +11176,7 @@ More information: The file containing the code for esbuild's JavaScript API (${_
11108
11176
  var ensureServiceIsRunning = () => {
11109
11177
  if (longLivedService) return longLivedService;
11110
11178
  let [command, args] = esbuildCommandAndArgs();
11111
- let child = child_process.spawn(command, args.concat(`--service=${"0.27.7"}`, "--ping"), {
11179
+ let child = child_process.spawn(command, args.concat(`--service=${"0.28.2"}`, "--ping"), {
11112
11180
  windowsHide: true,
11113
11181
  stdio: ["pipe", "pipe", "inherit"],
11114
11182
  cwd: defaultWD
@@ -11212,7 +11280,7 @@ More information: The file containing the code for esbuild's JavaScript API (${_
11212
11280
  esbuild: node_exports
11213
11281
  });
11214
11282
  callback(service);
11215
- let stdout2 = child_process.execFileSync(command, args.concat(`--service=${"0.27.7"}`), {
11283
+ let stdout2 = child_process.execFileSync(command, args.concat(`--service=${"0.28.2"}`), {
11216
11284
  cwd: defaultWD,
11217
11285
  windowsHide: true,
11218
11286
  input: stdin2,
@@ -11232,7 +11300,7 @@ More information: The file containing the code for esbuild's JavaScript API (${_
11232
11300
  var startWorkerThreadService = (worker_threads2) => {
11233
11301
  let { port1: mainPort, port2: workerPort } = new worker_threads2.MessageChannel();
11234
11302
  let worker = new worker_threads2.Worker(__filename, {
11235
- workerData: { workerPort, defaultWD, esbuildVersion: "0.27.7" },
11303
+ workerData: { workerPort, defaultWD, esbuildVersion: "0.28.2" },
11236
11304
  transferList: [workerPort],
11237
11305
  // From node's documentation: https://nodejs.org/api/worker_threads.html
11238
11306
  //
@@ -11700,7 +11768,7 @@ async function buildSupabaseEdgeFunctions(functionsDir) {
11700
11768
  });
11701
11769
  const outputPath = join4(buildDir, `${functionName}.js`);
11702
11770
  fs2.writeFileSync(outputPath, bundled, "utf8");
11703
- const size = Buffer.byteLength(bundled, "utf8");
11771
+ const size = Buffer2.byteLength(bundled, "utf8");
11704
11772
  results.push({ name: functionName, outputPath, size });
11705
11773
  log2.info(` ${functionName} \u2192 ${(size / 1024).toFixed(1)} KB`);
11706
11774
  } catch (error2) {