@donotdev/cli 0.1.46 → 0.2.1
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/dependencies-matrix.json +189 -149
- package/dist/bin/commands/agent-setup.js +83 -19
- package/dist/bin/commands/build.js +207 -62
- package/dist/bin/commands/bump.js +108 -44
- package/dist/bin/commands/cacheout.js +83 -19
- package/dist/bin/commands/coach.js +83 -19
- package/dist/bin/commands/create-app.js +111 -43
- package/dist/bin/commands/create-project.js +111 -43
- package/dist/bin/commands/db.js +134098 -72027
- package/dist/bin/commands/deploy.js +524 -323
- package/dist/bin/commands/dev.js +87 -23
- package/dist/bin/commands/doctor.js +83 -19
- package/dist/bin/commands/emu.js +93 -29
- package/dist/bin/commands/format.js +83 -19
- package/dist/bin/commands/get-demo.js +87 -23
- package/dist/bin/commands/make-admin.js +7466 -8217
- package/dist/bin/commands/preview.js +87 -23
- package/dist/bin/commands/seed.js +134098 -72027
- package/dist/bin/commands/setup-cicd.js +107 -43
- package/dist/bin/commands/setup.js +110 -43
- package/dist/bin/commands/staging.js +524 -323
- package/dist/bin/commands/sync-secrets.js +88 -24
- package/dist/bin/commands/type-check.js +83 -19
- package/dist/bin/commands/wai.js +83 -19
- package/dist/bin/dndev.js +8 -3
- package/dist/index.js +534 -331
- package/package.json +3 -3
- package/templates/app-next/src/app/ClientLayout.tsx.example +11 -1
- package/templates/app-next/src/app/layout.tsx.example +19 -1
- package/templates/deploy-config/vercel.json.example +13 -13
- package/templates/functions-firebase/src/billing/handleStripeWebhook.ts.example +8 -18
- package/templates/functions-firebase/src/billing/index.ts.example +0 -1
- package/templates/functions-firebase/src/billing/refreshSubscriptionStatus.ts.example +4 -8
- package/templates/functions-firebase/src/index.ts.example +0 -1
- package/templates/functions-supabase/supabase/config.toml.example +4 -0
- package/templates/functions-supabase/supabase/functions/stripe-webhook/index.ts.example +12 -0
- package/templates/functions-supabase/supabase/migrations/20250101000005_webhook_events.sql +133 -0
- package/templates/functions-vercel/.env.example +9 -0
- package/templates/functions-vercel/src/api/billing/handleStripeWebhook.ts.example +12 -14
- package/templates/functions-vercel/src/api/billing/refreshSubscriptionStatus.ts.example +4 -14
- package/templates/overlay-supabase/src/config/providers.ts.example +2 -2
- package/templates/root-consumer/.claude/hooks/guard-write.sh.example +32 -0
- package/templates/root-consumer/.claude/hooks/record-lookup.sh.example +22 -0
- package/templates/root-consumer/.claude/rules/definition-of-done.md.example +7 -0
- package/templates/root-consumer/.claude/rules/framework.md.example +6 -0
- package/templates/root-consumer/.claude/settings.json.example +11 -1
- package/templates/functions-firebase/src/billing/processPaymentSuccess.ts.example +0 -14
- 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
|
-
|
|
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
|
-
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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)] : [],
|
|
1197
|
-
`),
|
|
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 +
|
|
1213
|
+
rowPadding: a2 + b,
|
|
1205
1214
|
style: (g, x) => o(g, g.disabled ? "disabled" : x ? "active" : "inactive")
|
|
1206
1215
|
}).join(`
|
|
1207
1216
|
${r2}`)}
|
|
1208
|
-
${
|
|
1217
|
+
${f}
|
|
1209
1218
|
`;
|
|
1210
1219
|
}
|
|
1211
1220
|
}
|
|
@@ -4957,15 +4966,15 @@ var require_pattern = __commonJS({
|
|
|
4957
4966
|
exports.removeDuplicateSlashes = removeDuplicateSlashes;
|
|
4958
4967
|
function partitionAbsoluteAndRelative(patterns) {
|
|
4959
4968
|
const absolute = [];
|
|
4960
|
-
const
|
|
4969
|
+
const relative4 = [];
|
|
4961
4970
|
for (const pattern of patterns) {
|
|
4962
4971
|
if (isAbsolute(pattern)) {
|
|
4963
4972
|
absolute.push(pattern);
|
|
4964
4973
|
} else {
|
|
4965
|
-
|
|
4974
|
+
relative4.push(pattern);
|
|
4966
4975
|
}
|
|
4967
4976
|
}
|
|
4968
|
-
return [absolute,
|
|
4977
|
+
return [absolute, relative4];
|
|
4969
4978
|
}
|
|
4970
4979
|
exports.partitionAbsoluteAndRelative = partitionAbsoluteAndRelative;
|
|
4971
4980
|
function isAbsolute(pattern) {
|
|
@@ -5841,9 +5850,9 @@ var require_reusify = __commonJS({
|
|
|
5841
5850
|
}
|
|
5842
5851
|
});
|
|
5843
5852
|
|
|
5844
|
-
// node_modules/.bun/fastq@1.20.
|
|
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.
|
|
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
|
-
|
|
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 (
|
|
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 (
|
|
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 (
|
|
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 (
|
|
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
|
|
@@ -8505,7 +8569,7 @@ import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
|
8505
8569
|
function readdirSync3(dirPath, options) {
|
|
8506
8570
|
return pathResolverInstance.readdirSync(dirPath, options);
|
|
8507
8571
|
}
|
|
8508
|
-
var pathResolverInstance, getRepoRoot, resolvePackage, normalizePath, pathExists, readSync, statSync2, joinPath;
|
|
8572
|
+
var pathResolverInstance, getRepoRoot, resolvePackage, resolveFrameworkPackage, normalizePath, pathExists, readSync, statSync2, joinPath;
|
|
8509
8573
|
var init_pathResolver = __esm({
|
|
8510
8574
|
"packages/tooling/src/utils/pathResolver.ts"() {
|
|
8511
8575
|
"use strict";
|
|
@@ -8514,6 +8578,7 @@ var init_pathResolver = __esm({
|
|
|
8514
8578
|
pathResolverInstance = PathResolver.getInstance({ debug: false });
|
|
8515
8579
|
getRepoRoot = () => pathResolverInstance.getRepoRoot();
|
|
8516
8580
|
resolvePackage = (spec, from) => pathResolverInstance.resolvePackage(spec, from || null);
|
|
8581
|
+
resolveFrameworkPackage = (name, from) => pathResolverInstance.resolveFrameworkPackage(name, from || null);
|
|
8517
8582
|
normalizePath = (...pathSegments) => {
|
|
8518
8583
|
return pathResolverInstance.normalizePath(join3(...pathSegments));
|
|
8519
8584
|
};
|
|
@@ -8573,7 +8638,7 @@ var init_typed_file_operations = __esm({
|
|
|
8573
8638
|
});
|
|
8574
8639
|
|
|
8575
8640
|
// packages/tooling/src/bundler/utils.ts
|
|
8576
|
-
import { Buffer } from "node:buffer";
|
|
8641
|
+
import { Buffer as Buffer2 } from "node:buffer";
|
|
8577
8642
|
import { copyFileSync as copyFileSync2, readFileSync as readFileSync2, writeFileSync as writeFileSync2, mkdirSync as mkdirSync2 } from "node:fs";
|
|
8578
8643
|
import { createRequire as createRequire3 } from "node:module";
|
|
8579
8644
|
import { dirname as dirname4, resolve as resolve3 } from "node:path";
|
|
@@ -8590,7 +8655,7 @@ var init_utils2 = __esm({
|
|
|
8590
8655
|
globalThis.require = require2;
|
|
8591
8656
|
globalThis.__filename = __filename;
|
|
8592
8657
|
globalThis.__dirname = __dirname;
|
|
8593
|
-
globalThis.Buffer =
|
|
8658
|
+
globalThis.Buffer = Buffer2;
|
|
8594
8659
|
globalThis.process = process;
|
|
8595
8660
|
if (typeof global === "undefined") {
|
|
8596
8661
|
globalThis.global = globalThis;
|
|
@@ -8860,9 +8925,9 @@ var init_cli_input = __esm({
|
|
|
8860
8925
|
}
|
|
8861
8926
|
});
|
|
8862
8927
|
|
|
8863
|
-
// node_modules/.bun/esbuild@0.
|
|
8928
|
+
// node_modules/.bun/esbuild@0.28.2/node_modules/esbuild/lib/main.js
|
|
8864
8929
|
var require_main = __commonJS({
|
|
8865
|
-
"node_modules/.bun/esbuild@0.
|
|
8930
|
+
"node_modules/.bun/esbuild@0.28.2/node_modules/esbuild/lib/main.js"(exports, module) {
|
|
8866
8931
|
"use strict";
|
|
8867
8932
|
init_utils2();
|
|
8868
8933
|
var __defProp2 = Object.defineProperty;
|
|
@@ -9039,11 +9104,11 @@ var require_main = __commonJS({
|
|
|
9039
9104
|
encodeUTF8 = (text2) => encoder.encode(text2);
|
|
9040
9105
|
decodeUTF8 = (bytes) => decoder.decode(bytes);
|
|
9041
9106
|
encodeInvariant = 'new TextEncoder().encode("")';
|
|
9042
|
-
} else if (typeof
|
|
9043
|
-
encodeUTF8 = (text2) =>
|
|
9107
|
+
} else if (typeof Buffer2 !== "undefined") {
|
|
9108
|
+
encodeUTF8 = (text2) => Buffer2.from(text2);
|
|
9044
9109
|
decodeUTF8 = (bytes) => {
|
|
9045
9110
|
let { buffer, byteOffset, byteLength } = bytes;
|
|
9046
|
-
return
|
|
9111
|
+
return Buffer2.from(buffer, byteOffset, byteLength).toString();
|
|
9047
9112
|
};
|
|
9048
9113
|
encodeInvariant = 'Buffer.from("")';
|
|
9049
9114
|
} else {
|
|
@@ -9420,10 +9485,12 @@ is not a problem with esbuild. You need to fix your environment instead.
|
|
|
9420
9485
|
let color = getFlag(options, keys, "color", mustBeBoolean);
|
|
9421
9486
|
let logLevel = getFlag(options, keys, "logLevel", mustBeString);
|
|
9422
9487
|
let logLimit = getFlag(options, keys, "logLimit", mustBeInteger);
|
|
9488
|
+
let logStyle = getFlag(options, keys, "logStyle", mustBeString);
|
|
9423
9489
|
if (color !== void 0) flags.push(`--color=${color}`);
|
|
9424
9490
|
else if (isTTY2) flags.push(`--color=true`);
|
|
9425
9491
|
flags.push(`--log-level=${logLevel || logLevelDefault}`);
|
|
9426
9492
|
flags.push(`--log-limit=${logLimit || 0}`);
|
|
9493
|
+
if (logStyle) flags.push(`--log-style=${logStyle}`);
|
|
9427
9494
|
}
|
|
9428
9495
|
function validateStringValue(value, what, key) {
|
|
9429
9496
|
if (typeof value !== "string") {
|
|
@@ -9772,8 +9839,8 @@ is not a problem with esbuild. You need to fix your environment instead.
|
|
|
9772
9839
|
if (isFirstPacket) {
|
|
9773
9840
|
isFirstPacket = false;
|
|
9774
9841
|
let binaryVersion = String.fromCharCode(...bytes);
|
|
9775
|
-
if (binaryVersion !== "0.
|
|
9776
|
-
throw new Error(`Cannot start service: Host version "${"0.
|
|
9842
|
+
if (binaryVersion !== "0.28.2") {
|
|
9843
|
+
throw new Error(`Cannot start service: Host version "${"0.28.2"}" does not match binary version ${quote(binaryVersion)}`);
|
|
9777
9844
|
}
|
|
9778
9845
|
return;
|
|
9779
9846
|
}
|
|
@@ -9912,6 +9979,7 @@ is not a problem with esbuild. You need to fix your environment instead.
|
|
|
9912
9979
|
let kind = getFlag(options, keys, "kind", mustBeString);
|
|
9913
9980
|
let color = getFlag(options, keys, "color", mustBeBoolean);
|
|
9914
9981
|
let terminalWidth = getFlag(options, keys, "terminalWidth", mustBeInteger);
|
|
9982
|
+
let logStyle = getFlag(options, keys, "logStyle", mustBeString);
|
|
9915
9983
|
checkForInvalidFlags(options, keys, `in ${callName}() call`);
|
|
9916
9984
|
if (kind === void 0) throw new Error(`Missing "kind" in ${callName}() call`);
|
|
9917
9985
|
if (kind !== "error" && kind !== "warning") throw new Error(`Expected "kind" to be "error" or "warning" in ${callName}() call`);
|
|
@@ -9922,6 +9990,7 @@ is not a problem with esbuild. You need to fix your environment instead.
|
|
|
9922
9990
|
};
|
|
9923
9991
|
if (color !== void 0) request.color = color;
|
|
9924
9992
|
if (terminalWidth !== void 0) request.terminalWidth = terminalWidth;
|
|
9993
|
+
if (logStyle !== void 0) request.logStyle = logStyle;
|
|
9925
9994
|
sendRequest(refs, request, (error2, response) => {
|
|
9926
9995
|
if (error2) return callback(new Error(error2), null);
|
|
9927
9996
|
callback(null, response.messages);
|
|
@@ -10905,7 +10974,7 @@ for your current platform.`);
|
|
|
10905
10974
|
"node_modules",
|
|
10906
10975
|
".cache",
|
|
10907
10976
|
"esbuild",
|
|
10908
|
-
`pnpapi-${pkg.replace("/", "-")}-${"0.
|
|
10977
|
+
`pnpapi-${pkg.replace("/", "-")}-${"0.28.2"}-${path.basename(subpath)}`
|
|
10909
10978
|
);
|
|
10910
10979
|
if (!fs3.existsSync(binTargetPath)) {
|
|
10911
10980
|
fs3.mkdirSync(path.dirname(binTargetPath), { recursive: true });
|
|
@@ -10938,7 +11007,7 @@ for your current platform.`);
|
|
|
10938
11007
|
}
|
|
10939
11008
|
}
|
|
10940
11009
|
var _a;
|
|
10941
|
-
var isInternalWorkerThread = ((_a = worker_threads == null ? void 0 : worker_threads.workerData) == null ? void 0 : _a.esbuildVersion) === "0.
|
|
11010
|
+
var isInternalWorkerThread = ((_a = worker_threads == null ? void 0 : worker_threads.workerData) == null ? void 0 : _a.esbuildVersion) === "0.28.2";
|
|
10942
11011
|
var esbuildCommandAndArgs = () => {
|
|
10943
11012
|
if ((!ESBUILD_BINARY_PATH || false) && (path2.basename(__filename) !== "main.js" || path2.basename(__dirname) !== "lib")) {
|
|
10944
11013
|
throw new Error(
|
|
@@ -11005,7 +11074,7 @@ More information: The file containing the code for esbuild's JavaScript API (${_
|
|
|
11005
11074
|
}
|
|
11006
11075
|
}
|
|
11007
11076
|
};
|
|
11008
|
-
var version = "0.
|
|
11077
|
+
var version = "0.28.2";
|
|
11009
11078
|
var build2 = (options) => ensureServiceIsRunning().build(options);
|
|
11010
11079
|
var context = (buildOptions) => ensureServiceIsRunning().context(buildOptions);
|
|
11011
11080
|
var transform = (input, options) => ensureServiceIsRunning().transform(input, options);
|
|
@@ -11108,7 +11177,7 @@ More information: The file containing the code for esbuild's JavaScript API (${_
|
|
|
11108
11177
|
var ensureServiceIsRunning = () => {
|
|
11109
11178
|
if (longLivedService) return longLivedService;
|
|
11110
11179
|
let [command, args] = esbuildCommandAndArgs();
|
|
11111
|
-
let child = child_process.spawn(command, args.concat(`--service=${"0.
|
|
11180
|
+
let child = child_process.spawn(command, args.concat(`--service=${"0.28.2"}`, "--ping"), {
|
|
11112
11181
|
windowsHide: true,
|
|
11113
11182
|
stdio: ["pipe", "pipe", "inherit"],
|
|
11114
11183
|
cwd: defaultWD
|
|
@@ -11212,7 +11281,7 @@ More information: The file containing the code for esbuild's JavaScript API (${_
|
|
|
11212
11281
|
esbuild: node_exports
|
|
11213
11282
|
});
|
|
11214
11283
|
callback(service);
|
|
11215
|
-
let stdout2 = child_process.execFileSync(command, args.concat(`--service=${"0.
|
|
11284
|
+
let stdout2 = child_process.execFileSync(command, args.concat(`--service=${"0.28.2"}`), {
|
|
11216
11285
|
cwd: defaultWD,
|
|
11217
11286
|
windowsHide: true,
|
|
11218
11287
|
input: stdin2,
|
|
@@ -11232,7 +11301,7 @@ More information: The file containing the code for esbuild's JavaScript API (${_
|
|
|
11232
11301
|
var startWorkerThreadService = (worker_threads2) => {
|
|
11233
11302
|
let { port1: mainPort, port2: workerPort } = new worker_threads2.MessageChannel();
|
|
11234
11303
|
let worker = new worker_threads2.Worker(__filename, {
|
|
11235
|
-
workerData: { workerPort, defaultWD, esbuildVersion: "0.
|
|
11304
|
+
workerData: { workerPort, defaultWD, esbuildVersion: "0.28.2" },
|
|
11236
11305
|
transferList: [workerPort],
|
|
11237
11306
|
// From node's documentation: https://nodejs.org/api/worker_threads.html
|
|
11238
11307
|
//
|
|
@@ -11368,7 +11437,7 @@ __export(bundle_edge_function_exports, {
|
|
|
11368
11437
|
bundleEdgeFunction: () => bundleEdgeFunction
|
|
11369
11438
|
});
|
|
11370
11439
|
import fs2 from "node:fs";
|
|
11371
|
-
import { resolve as resolve4, dirname as dirname5, join as join4 } from "node:path";
|
|
11440
|
+
import { resolve as resolve4, dirname as dirname5, join as join4, relative as relative3, sep as sep2 } from "node:path";
|
|
11372
11441
|
function detectWorkspace() {
|
|
11373
11442
|
let currentDir = process.cwd();
|
|
11374
11443
|
const maxDepth = 10;
|
|
@@ -11450,25 +11519,19 @@ function createDenoEdgePlugin(workspace, denoImports, functionsDir) {
|
|
|
11450
11519
|
setup(build2) {
|
|
11451
11520
|
build2.onResolve({ filter: /^@donotdev\/functions\/.+/ }, (args) => {
|
|
11452
11521
|
const subpath = args.path.replace("@donotdev/functions/", "");
|
|
11453
|
-
|
|
11454
|
-
|
|
11455
|
-
|
|
11456
|
-
|
|
11457
|
-
|
|
11458
|
-
"functions",
|
|
11459
|
-
"src",
|
|
11460
|
-
subpath,
|
|
11461
|
-
"index.ts"
|
|
11462
|
-
)
|
|
11463
|
-
};
|
|
11522
|
+
const packageDir = workspace.type === "dndev" ? resolve4(workspace.root, "packages", "functions") : resolveFrameworkPackage("@donotdev/functions", functionsDir);
|
|
11523
|
+
if (!packageDir) {
|
|
11524
|
+
throw new Error(
|
|
11525
|
+
`@donotdev/functions not found from ${functionsDir}. Install it in the app.`
|
|
11526
|
+
);
|
|
11464
11527
|
}
|
|
11465
|
-
const
|
|
11466
|
-
|
|
11467
|
-
|
|
11468
|
-
|
|
11469
|
-
|
|
11470
|
-
|
|
11471
|
-
return
|
|
11528
|
+
const entry = resolve4(packageDir, "src", subpath, "index.ts");
|
|
11529
|
+
if (!fs2.existsSync(entry)) {
|
|
11530
|
+
throw new Error(
|
|
11531
|
+
`${args.path} has no source entry at ${entry}. Check the import path.`
|
|
11532
|
+
);
|
|
11533
|
+
}
|
|
11534
|
+
return { path: entry };
|
|
11472
11535
|
});
|
|
11473
11536
|
build2.onResolve({ filter: /^@donotdev\/core$/ }, (args) => {
|
|
11474
11537
|
if (workspace.type === "dndev") {
|
|
@@ -11587,6 +11650,7 @@ function createDenoEdgePlugin(workspace, denoImports, functionsDir) {
|
|
|
11587
11650
|
build2.onResolve({ filter: /.*/ }, (args) => {
|
|
11588
11651
|
if (args.kind === "entry-point") return null;
|
|
11589
11652
|
if (args.path.startsWith(".") || args.path.startsWith("/")) return null;
|
|
11653
|
+
if (args.path.startsWith("node:")) return { path: args.path, external: true };
|
|
11590
11654
|
if (args.path.startsWith("@donotdev/")) return null;
|
|
11591
11655
|
const packageRoot = args.path.startsWith("@") ? args.path.split("/").slice(0, 2).join("/") : args.path.split("/")[0];
|
|
11592
11656
|
if (packageRoot && ALWAYS_BUNDLE.has(packageRoot)) return null;
|
|
@@ -11601,6 +11665,72 @@ function createDenoEdgePlugin(workspace, denoImports, functionsDir) {
|
|
|
11601
11665
|
}
|
|
11602
11666
|
};
|
|
11603
11667
|
}
|
|
11668
|
+
function importChain(metafile, entry, target) {
|
|
11669
|
+
const previous = /* @__PURE__ */ new Map([[entry, null]]);
|
|
11670
|
+
const queue = [entry];
|
|
11671
|
+
while (queue.length > 0) {
|
|
11672
|
+
const current = queue.shift();
|
|
11673
|
+
if (current === target) break;
|
|
11674
|
+
for (const imported of metafile.inputs[current]?.imports ?? []) {
|
|
11675
|
+
if (previous.has(imported.path)) continue;
|
|
11676
|
+
previous.set(imported.path, current);
|
|
11677
|
+
queue.push(imported.path);
|
|
11678
|
+
}
|
|
11679
|
+
}
|
|
11680
|
+
if (!previous.has(target)) return [target];
|
|
11681
|
+
const chain = [];
|
|
11682
|
+
for (let at = target; at !== null; at = previous.get(at) ?? null) {
|
|
11683
|
+
chain.unshift(at);
|
|
11684
|
+
}
|
|
11685
|
+
return chain;
|
|
11686
|
+
}
|
|
11687
|
+
function assertEdgeBoundary(metafile, entryPointPath, workspace, functionsDir) {
|
|
11688
|
+
const isFrameworkModule = (input) => {
|
|
11689
|
+
const absolute = resolve4(process.cwd(), input);
|
|
11690
|
+
if (absolute.startsWith(resolve4(functionsDir) + sep2)) return false;
|
|
11691
|
+
return absolute.includes(`${sep2}node_modules${sep2}@donotdev${sep2}`) || workspace.type === "dndev" && absolute.startsWith(resolve4(workspace.root, "packages") + sep2);
|
|
11692
|
+
};
|
|
11693
|
+
const entry = relative3(process.cwd(), entryPointPath).split(sep2).join("/");
|
|
11694
|
+
if (!metafile.inputs[entry]) {
|
|
11695
|
+
throw new Error(`Edge bundle metafile has no input for ${entryPointPath}`);
|
|
11696
|
+
}
|
|
11697
|
+
const output = Object.values(metafile.outputs)[0];
|
|
11698
|
+
if (!output) throw new Error("Edge bundle metafile has no output");
|
|
11699
|
+
const bundled = Object.entries(output.inputs).filter(([, info2]) => info2.bytesInOutput > 0).map(([input]) => input);
|
|
11700
|
+
const externals = output.imports.filter((imported) => imported.external).map((imported) => imported.path);
|
|
11701
|
+
const firstHit = /* @__PURE__ */ new Map();
|
|
11702
|
+
for (const { label, pattern, frameworkOnly } of EDGE_FORBIDDEN) {
|
|
11703
|
+
const input = bundled.find((path) => pattern.test(path));
|
|
11704
|
+
if (input) {
|
|
11705
|
+
firstHit.set(label, { module: input, importer: input });
|
|
11706
|
+
continue;
|
|
11707
|
+
}
|
|
11708
|
+
const hit = externals.filter((path) => pattern.test(path)).flatMap((external) => {
|
|
11709
|
+
const importers = bundled.filter(
|
|
11710
|
+
(path) => metafile.inputs[path]?.imports.some(
|
|
11711
|
+
(imported) => imported.external && imported.path === external
|
|
11712
|
+
)
|
|
11713
|
+
);
|
|
11714
|
+
return (importers.length > 0 ? importers : [entry]).map((importer) => ({
|
|
11715
|
+
module: external,
|
|
11716
|
+
importer
|
|
11717
|
+
}));
|
|
11718
|
+
}).find(({ importer }) => !frameworkOnly || isFrameworkModule(importer));
|
|
11719
|
+
if (hit) firstHit.set(label, hit);
|
|
11720
|
+
}
|
|
11721
|
+
if (firstHit.size > 0) {
|
|
11722
|
+
const violations = [...firstHit].map(([label, { module, importer }]) => {
|
|
11723
|
+
const chain = importChain(metafile, entry, importer);
|
|
11724
|
+
if (module !== importer) chain.push(module);
|
|
11725
|
+
return `${label}:
|
|
11726
|
+
${chain.join("\n \u2192 ")}`;
|
|
11727
|
+
});
|
|
11728
|
+
throw new Error(
|
|
11729
|
+
`Edge function ${entryPointPath} would load modules that do not belong in a Supabase Edge Function:
|
|
11730
|
+
` + violations.map((v) => ` - ${v}`).join("\n") + "\nThe chain shows which import pulls each one in. Import Supabase or provider-neutral modules instead (@donotdev/functions/supabase, @donotdev/core/server); never Firebase, client code or React. If the chain goes through @donotdev/functions, update it to the same version as your CLI."
|
|
11731
|
+
);
|
|
11732
|
+
}
|
|
11733
|
+
}
|
|
11604
11734
|
async function bundleEdgeFunction(options) {
|
|
11605
11735
|
const { entryPointPath, functionsDir } = options;
|
|
11606
11736
|
const workspace = detectWorkspace();
|
|
@@ -11657,7 +11787,8 @@ async function bundleEdgeFunction(options) {
|
|
|
11657
11787
|
plugins: [createDenoEdgePlugin(workspace, denoImports, functionsDir)],
|
|
11658
11788
|
mainFields: ["module", "main"],
|
|
11659
11789
|
conditions: ["import", "module"],
|
|
11660
|
-
logLevel: "warning"
|
|
11790
|
+
logLevel: "warning",
|
|
11791
|
+
metafile: true
|
|
11661
11792
|
};
|
|
11662
11793
|
const result = await (0, import_esbuild.build)(config);
|
|
11663
11794
|
if (result.errors.length > 0) {
|
|
@@ -11665,6 +11796,7 @@ async function bundleEdgeFunction(options) {
|
|
|
11665
11796
|
throw new Error(`Edge function bundling failed:
|
|
11666
11797
|
${errorMessages}`);
|
|
11667
11798
|
}
|
|
11799
|
+
assertEdgeBoundary(result.metafile, entryPointPath, workspace, functionsDir);
|
|
11668
11800
|
if (result.warnings.length > 0) {
|
|
11669
11801
|
for (const warning of result.warnings) {
|
|
11670
11802
|
log2.debug(`[bundle-edge] Warning: ${warning.text}`);
|
|
@@ -11700,7 +11832,7 @@ async function buildSupabaseEdgeFunctions(functionsDir) {
|
|
|
11700
11832
|
});
|
|
11701
11833
|
const outputPath = join4(buildDir, `${functionName}.js`);
|
|
11702
11834
|
fs2.writeFileSync(outputPath, bundled, "utf8");
|
|
11703
|
-
const size =
|
|
11835
|
+
const size = Buffer2.byteLength(bundled, "utf8");
|
|
11704
11836
|
results.push({ name: functionName, outputPath, size });
|
|
11705
11837
|
log2.info(` ${functionName} \u2192 ${(size / 1024).toFixed(1)} KB`);
|
|
11706
11838
|
} catch (error2) {
|
|
@@ -11718,7 +11850,7 @@ ${errors.length} function(s) failed to bundle`);
|
|
|
11718
11850
|
All ${results.length} function(s) built to ${buildDir}`);
|
|
11719
11851
|
return { success: true, functions: results, errors: [] };
|
|
11720
11852
|
}
|
|
11721
|
-
var import_esbuild, ALWAYS_BUNDLE;
|
|
11853
|
+
var import_esbuild, ALWAYS_BUNDLE, EDGE_FORBIDDEN;
|
|
11722
11854
|
var init_bundle_edge_function = __esm({
|
|
11723
11855
|
"packages/tooling/src/utils/bundle-edge-function.ts"() {
|
|
11724
11856
|
"use strict";
|
|
@@ -11727,6 +11859,19 @@ var init_bundle_edge_function = __esm({
|
|
|
11727
11859
|
init_cli_output();
|
|
11728
11860
|
init_pathResolver();
|
|
11729
11861
|
ALWAYS_BUNDLE = /* @__PURE__ */ new Set(["valibot"]);
|
|
11862
|
+
EDGE_FORBIDDEN = [
|
|
11863
|
+
{ label: "firebase-admin", pattern: /(^|[/:])firebase-admin(\/|$)/ },
|
|
11864
|
+
{ label: "firebase-functions", pattern: /(^|[/:])firebase-functions(\/|$)/ },
|
|
11865
|
+
{
|
|
11866
|
+
label: "@donotdev/firebase",
|
|
11867
|
+
pattern: /(^|[/:])@donotdev\/firebase(\/|$)|(^|\/)providers\/firebase\//
|
|
11868
|
+
},
|
|
11869
|
+
{
|
|
11870
|
+
label: "client code (@donotdev/utils client)",
|
|
11871
|
+
pattern: /core\/utils\/src\/client\//
|
|
11872
|
+
},
|
|
11873
|
+
{ label: "react", pattern: /(^|[/:])react(\/|$)/, frameworkOnly: true }
|
|
11874
|
+
];
|
|
11730
11875
|
}
|
|
11731
11876
|
});
|
|
11732
11877
|
|