@donotdev/cli 0.2.0 → 0.2.2

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.
@@ -2,7 +2,7 @@
2
2
  "$schema": "./dependencies-matrix.schema.json",
3
3
  "version": "0.0.8",
4
4
  "description": "Centralized dependency versions for DoNotDev framework. Single source of truth for all external dependencies. Third-party optional deps are auto-detected from peerDependenciesMeta via scanInstalledPackageOptionals() — no manual constants update needed.",
5
- "lastUpdated": "2026-11-08",
5
+ "lastUpdated": "2026-11-09",
6
6
  "migrationGuides": {
7
7
  "0.0→0.1": {
8
8
  "path": "docs/migration/v0.0-to-v0.1.md",
@@ -41,31 +41,31 @@
41
41
  "@donotdev/auth": {
42
42
  "description": "Authentication package",
43
43
  "packages": {
44
- "@donotdev/auth": "^0.2.0"
44
+ "@donotdev/auth": "^0.2.2"
45
45
  }
46
46
  },
47
47
  "@donotdev/billing": {
48
48
  "description": "Billing package",
49
49
  "packages": {
50
- "@donotdev/billing": "^0.2.0"
50
+ "@donotdev/billing": "^0.2.2"
51
51
  }
52
52
  },
53
53
  "@donotdev/components": {
54
54
  "description": "UI components package",
55
55
  "packages": {
56
- "@donotdev/components": "^0.2.0"
56
+ "@donotdev/components": "^0.2.2"
57
57
  }
58
58
  },
59
59
  "@donotdev/core": {
60
60
  "description": "Core framework package",
61
61
  "packages": {
62
- "@donotdev/core": "^0.2.0"
62
+ "@donotdev/core": "^0.2.2"
63
63
  }
64
64
  },
65
65
  "@donotdev/crud": {
66
66
  "description": "CRUD operations package",
67
67
  "packages": {
68
- "@donotdev/crud": "^0.2.0"
68
+ "@donotdev/crud": "^0.2.2"
69
69
  }
70
70
  },
71
71
  "@donotdev/demo": {
@@ -77,13 +77,13 @@
77
77
  "@donotdev/firebase": {
78
78
  "description": "Firebase provider package",
79
79
  "packages": {
80
- "@donotdev/firebase": "^0.2.0"
80
+ "@donotdev/firebase": "^0.2.2"
81
81
  }
82
82
  },
83
83
  "@donotdev/functions": {
84
84
  "description": "Firebase Functions package",
85
85
  "packages": {
86
- "@donotdev/functions": "^0.2.0"
86
+ "@donotdev/functions": "^0.2.2"
87
87
  }
88
88
  },
89
89
  "@donotdev/oauth": {
@@ -95,19 +95,19 @@
95
95
  "@donotdev/templates": {
96
96
  "description": "Page templates package",
97
97
  "packages": {
98
- "@donotdev/templates": "^0.2.0"
98
+ "@donotdev/templates": "^0.2.2"
99
99
  }
100
100
  },
101
101
  "@donotdev/ui": {
102
102
  "description": "UI and routing package",
103
103
  "packages": {
104
- "@donotdev/ui": "^0.2.0"
104
+ "@donotdev/ui": "^0.2.2"
105
105
  }
106
106
  },
107
107
  "@donotdev/expo": {
108
108
  "description": "Expo/React Native components package",
109
109
  "packages": {
110
- "@donotdev/expo": "^0.2.0"
110
+ "@donotdev/expo": "^0.2.2"
111
111
  }
112
112
  },
113
113
  "@donotdev/supabase": {
@@ -480,7 +480,7 @@
480
480
  "@donotdev/cli": {
481
481
  "description": "Cli package",
482
482
  "packages": {
483
- "@donotdev/cli": "^0.2.0"
483
+ "@donotdev/cli": "^0.2.2"
484
484
  }
485
485
  },
486
486
  "@donotdev/mcp-server": {
@@ -4966,15 +4966,15 @@ var require_pattern = __commonJS({
4966
4966
  exports.removeDuplicateSlashes = removeDuplicateSlashes;
4967
4967
  function partitionAbsoluteAndRelative(patterns) {
4968
4968
  const absolute = [];
4969
- const relative3 = [];
4969
+ const relative4 = [];
4970
4970
  for (const pattern of patterns) {
4971
4971
  if (isAbsolute(pattern)) {
4972
4972
  absolute.push(pattern);
4973
4973
  } else {
4974
- relative3.push(pattern);
4974
+ relative4.push(pattern);
4975
4975
  }
4976
4976
  }
4977
- return [absolute, relative3];
4977
+ return [absolute, relative4];
4978
4978
  }
4979
4979
  exports.partitionAbsoluteAndRelative = partitionAbsoluteAndRelative;
4980
4980
  function isAbsolute(pattern) {
@@ -8569,7 +8569,7 @@ import { fileURLToPath as fileURLToPath2 } from "node:url";
8569
8569
  function readdirSync3(dirPath, options) {
8570
8570
  return pathResolverInstance.readdirSync(dirPath, options);
8571
8571
  }
8572
- var pathResolverInstance, getRepoRoot, resolvePackage, normalizePath, pathExists, readSync, statSync2, joinPath;
8572
+ var pathResolverInstance, getRepoRoot, resolvePackage, resolveFrameworkPackage, normalizePath, pathExists, readSync, statSync2, joinPath;
8573
8573
  var init_pathResolver = __esm({
8574
8574
  "packages/tooling/src/utils/pathResolver.ts"() {
8575
8575
  "use strict";
@@ -8578,6 +8578,7 @@ var init_pathResolver = __esm({
8578
8578
  pathResolverInstance = PathResolver.getInstance({ debug: false });
8579
8579
  getRepoRoot = () => pathResolverInstance.getRepoRoot();
8580
8580
  resolvePackage = (spec, from) => pathResolverInstance.resolvePackage(spec, from || null);
8581
+ resolveFrameworkPackage = (name, from) => pathResolverInstance.resolveFrameworkPackage(name, from || null);
8581
8582
  normalizePath = (...pathSegments) => {
8582
8583
  return pathResolverInstance.normalizePath(join3(...pathSegments));
8583
8584
  };
@@ -11436,7 +11437,7 @@ __export(bundle_edge_function_exports, {
11436
11437
  bundleEdgeFunction: () => bundleEdgeFunction
11437
11438
  });
11438
11439
  import fs2 from "node:fs";
11439
- 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";
11440
11441
  function detectWorkspace() {
11441
11442
  let currentDir = process.cwd();
11442
11443
  const maxDepth = 10;
@@ -11518,25 +11519,19 @@ function createDenoEdgePlugin(workspace, denoImports, functionsDir) {
11518
11519
  setup(build2) {
11519
11520
  build2.onResolve({ filter: /^@donotdev\/functions\/.+/ }, (args) => {
11520
11521
  const subpath = args.path.replace("@donotdev/functions/", "");
11521
- if (workspace.type === "dndev") {
11522
- return {
11523
- path: resolve4(
11524
- workspace.root,
11525
- "packages",
11526
- "functions",
11527
- "src",
11528
- subpath,
11529
- "index.ts"
11530
- )
11531
- };
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
+ );
11532
11527
  }
11533
- const resolved = resolvePackageExport(
11534
- "@donotdev/functions",
11535
- `./${subpath}`,
11536
- functionsDir
11537
- );
11538
- if (resolved) return { path: resolved };
11539
- return null;
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 };
11540
11535
  });
11541
11536
  build2.onResolve({ filter: /^@donotdev\/core$/ }, (args) => {
11542
11537
  if (workspace.type === "dndev") {
@@ -11655,6 +11650,7 @@ function createDenoEdgePlugin(workspace, denoImports, functionsDir) {
11655
11650
  build2.onResolve({ filter: /.*/ }, (args) => {
11656
11651
  if (args.kind === "entry-point") return null;
11657
11652
  if (args.path.startsWith(".") || args.path.startsWith("/")) return null;
11653
+ if (args.path.startsWith("node:")) return { path: args.path, external: true };
11658
11654
  if (args.path.startsWith("@donotdev/")) return null;
11659
11655
  const packageRoot = args.path.startsWith("@") ? args.path.split("/").slice(0, 2).join("/") : args.path.split("/")[0];
11660
11656
  if (packageRoot && ALWAYS_BUNDLE.has(packageRoot)) return null;
@@ -11669,6 +11665,72 @@ function createDenoEdgePlugin(workspace, denoImports, functionsDir) {
11669
11665
  }
11670
11666
  };
11671
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
+ }
11672
11734
  async function bundleEdgeFunction(options) {
11673
11735
  const { entryPointPath, functionsDir } = options;
11674
11736
  const workspace = detectWorkspace();
@@ -11725,7 +11787,8 @@ async function bundleEdgeFunction(options) {
11725
11787
  plugins: [createDenoEdgePlugin(workspace, denoImports, functionsDir)],
11726
11788
  mainFields: ["module", "main"],
11727
11789
  conditions: ["import", "module"],
11728
- logLevel: "warning"
11790
+ logLevel: "warning",
11791
+ metafile: true
11729
11792
  };
11730
11793
  const result = await (0, import_esbuild.build)(config);
11731
11794
  if (result.errors.length > 0) {
@@ -11733,6 +11796,7 @@ async function bundleEdgeFunction(options) {
11733
11796
  throw new Error(`Edge function bundling failed:
11734
11797
  ${errorMessages}`);
11735
11798
  }
11799
+ assertEdgeBoundary(result.metafile, entryPointPath, workspace, functionsDir);
11736
11800
  if (result.warnings.length > 0) {
11737
11801
  for (const warning of result.warnings) {
11738
11802
  log2.debug(`[bundle-edge] Warning: ${warning.text}`);
@@ -11786,7 +11850,7 @@ ${errors.length} function(s) failed to bundle`);
11786
11850
  All ${results.length} function(s) built to ${buildDir}`);
11787
11851
  return { success: true, functions: results, errors: [] };
11788
11852
  }
11789
- var import_esbuild, ALWAYS_BUNDLE;
11853
+ var import_esbuild, ALWAYS_BUNDLE, EDGE_FORBIDDEN;
11790
11854
  var init_bundle_edge_function = __esm({
11791
11855
  "packages/tooling/src/utils/bundle-edge-function.ts"() {
11792
11856
  "use strict";
@@ -11795,6 +11859,19 @@ var init_bundle_edge_function = __esm({
11795
11859
  init_cli_output();
11796
11860
  init_pathResolver();
11797
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
+ ];
11798
11875
  }
11799
11876
  });
11800
11877
 
@@ -9800,6 +9800,8 @@ async function createApp(appName, appConfig, workspaceRoot, templatesRoot) {
9800
9800
  appName,
9801
9801
  appShortName: appName.toUpperCase().replace(/-/g, " "),
9802
9802
  includeFunctions: Boolean(row.functionsTemplate),
9803
+ // vercel.json functions/rewrites/env only fit Vercel API functions, not Supabase or Firebase ones.
9804
+ includeVercelFunctions: row.functionsTemplate === "functions-vercel",
9803
9805
  needsCRUD: Boolean(appConfig.needsCRUD),
9804
9806
  setupGithubActions: false,
9805
9807
  appNames: [appName],
@@ -9894,6 +9896,8 @@ async function createApp(appName, appConfig, workspaceRoot, templatesRoot) {
9894
9896
  appName,
9895
9897
  template: isReservedTemplate ? "vite" : appTemplate,
9896
9898
  includeFunctions: Boolean(row.functionsTemplate),
9899
+ // vercel.json functions/rewrites/env only fit Vercel API functions, not Supabase or Firebase ones.
9900
+ includeVercelFunctions: row.functionsTemplate === "functions-vercel",
9897
9901
  platform: isReservedTemplate ? void 0 : backendPlatform
9898
9902
  });
9899
9903
  const packageJsonPath = joinPath(appDir, "package.json");
@@ -10121,6 +10121,8 @@ async function createApp(appName, appConfig, workspaceRoot, templatesRoot) {
10121
10121
  appName,
10122
10122
  appShortName: appName.toUpperCase().replace(/-/g, " "),
10123
10123
  includeFunctions: Boolean(row.functionsTemplate),
10124
+ // vercel.json functions/rewrites/env only fit Vercel API functions, not Supabase or Firebase ones.
10125
+ includeVercelFunctions: row.functionsTemplate === "functions-vercel",
10124
10126
  needsCRUD: Boolean(appConfig.needsCRUD),
10125
10127
  setupGithubActions: false,
10126
10128
  appNames: [appName],
@@ -10215,6 +10217,8 @@ async function createApp(appName, appConfig, workspaceRoot, templatesRoot) {
10215
10217
  appName,
10216
10218
  template: isReservedTemplate ? "vite" : appTemplate,
10217
10219
  includeFunctions: Boolean(row.functionsTemplate),
10220
+ // vercel.json functions/rewrites/env only fit Vercel API functions, not Supabase or Firebase ones.
10221
+ includeVercelFunctions: row.functionsTemplate === "functions-vercel",
10218
10222
  platform: isReservedTemplate ? void 0 : backendPlatform
10219
10223
  });
10220
10224
  const packageJsonPath = joinPath(appDir, "package.json");