naro-cli 0.28.0 → 0.30.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.
@@ -4,9 +4,43 @@ import "./chunk-K3NQKI34.js";
4
4
  // ../../packages/build/src/stack.ts
5
5
  import { readFile, stat } from "fs/promises";
6
6
  import { join } from "path";
7
- import {
8
- frameworkList
9
- } from "@vercel/frameworks";
7
+ var STACKS = [
8
+ { slug: "nextjs", detectors: { every: [{ matchPackage: "next" }] } },
9
+ { slug: "gatsby", detectors: { every: [{ matchPackage: "gatsby" }] } },
10
+ { slug: "astro", detectors: { every: [{ matchPackage: "astro" }] } },
11
+ {
12
+ slug: "docusaurus-2",
13
+ detectors: { some: [{ matchPackage: "@docusaurus/core" }] }
14
+ },
15
+ { slug: "angular", detectors: { every: [{ matchPackage: "@angular/cli" }] } },
16
+ // Vercel spells this one as a content pattern on package.json — the very
17
+ // pattern matchPackage builds (see detectorMatches).
18
+ {
19
+ slug: "sveltekit-1",
20
+ detectors: { every: [{ matchPackage: "@sveltejs/kit" }] }
21
+ },
22
+ {
23
+ slug: "create-react-app",
24
+ detectors: {
25
+ some: [
26
+ { matchPackage: "react-scripts" },
27
+ { matchPackage: "react-dev-utils" }
28
+ ]
29
+ }
30
+ },
31
+ {
32
+ slug: "nuxtjs",
33
+ detectors: {
34
+ some: [
35
+ { matchPackage: "nuxt" },
36
+ { matchPackage: "nuxt3" },
37
+ { matchPackage: "nuxt-edge" },
38
+ { matchPackage: "nuxt-nightly" }
39
+ ]
40
+ }
41
+ },
42
+ { slug: "vite", detectors: { every: [{ matchPackage: "vite" }] } }
43
+ ];
10
44
  var PRESET_STACKS = {
11
45
  next: "nextjs",
12
46
  "next-export": "nextjs",
@@ -51,8 +85,7 @@ async function detectorMatches(reader, { path, matchContent, matchPackage }) {
51
85
  if (!await reader.isFile(file)) return false;
52
86
  return new RegExp(pattern, "m").test(await reader.readFile(file));
53
87
  }
54
- async function frameworkMatches(reader, framework) {
55
- const { every, some } = framework.detectors ?? {};
88
+ async function stackMatches(reader, { detectors: { every, some } }) {
56
89
  if (!every && !some) return false;
57
90
  if (every) {
58
91
  const results = await Promise.all(
@@ -68,27 +101,13 @@ async function frameworkMatches(reader, framework) {
68
101
  }
69
102
  return true;
70
103
  }
71
- function removeSuperseded(matches, slug) {
72
- const index = matches.findIndex((framework2) => framework2?.slug === slug);
73
- const framework = matches[index];
74
- if (!framework) return;
75
- for (const next of framework.supersedes ?? [])
76
- removeSuperseded(matches, next);
77
- matches.splice(index, 1);
78
- }
79
104
  async function detectStack(root, reader = localReader(root)) {
80
- const candidates = frameworkList.filter(
81
- (framework) => !framework.experimental && framework.slug
82
- );
83
105
  const matches = await Promise.all(
84
- candidates.map(
85
- async (framework) => await frameworkMatches(reader, framework) ? framework : null
106
+ STACKS.map(
107
+ async (stack) => await stackMatches(reader, stack) ? stack.slug : null
86
108
  )
87
109
  );
88
- for (const match of matches.slice()) {
89
- for (const slug2 of match?.supersedes ?? []) removeSuperseded(matches, slug2);
90
- }
91
- const slug = matches.find((match) => match !== null)?.slug ?? null;
110
+ const slug = matches.find((match) => match !== null) ?? null;
92
111
  if (slug === "vite") return await viteLibrary(reader) ?? "vite";
93
112
  return slug && STACK_SLUG_PATTERN.test(slug) ? slug : null;
94
113
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "naro-cli",
3
- "version": "0.28.0",
3
+ "version": "0.30.0",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "naro": "./dist/index.js"
@@ -13,7 +13,7 @@
13
13
  "access": "public"
14
14
  },
15
15
  "engines": {
16
- "node": ">=20"
16
+ "node": ">=22"
17
17
  },
18
18
  "exports": {
19
19
  ".": {
@@ -24,26 +24,25 @@
24
24
  "dependencies": {
25
25
  "@cloudflare/unenv-preset": "2.16.2",
26
26
  "@supabase/supabase-js": "2.112.3",
27
- "@vercel/frameworks": "3.34.0",
28
- "esbuild": "0.28.1",
29
- "miniflare": "5.20261006.0-alpha",
27
+ "esbuild": "0.28.2",
28
+ "miniflare": "5.20261104.0-beta",
30
29
  "unenv": "2.0.0-rc.24",
31
30
  "vinext": "1.1.0",
32
- "wrangler": "4.148.0"
31
+ "wrangler": "4.158.0"
33
32
  },
34
33
  "devDependencies": {
35
34
  "tsup": "8.5.0",
36
35
  "tsx": "4.23.12",
37
36
  "typescript": "7.0.2",
38
37
  "vitest": "3.2.7",
39
- "naro-js": "0.9.0",
40
38
  "@next-deploy/build": "0.1.0",
39
+ "naro-js": "0.9.0",
41
40
  "@next-deploy/config": "0.1.0",
41
+ "@next-deploy/core": "0.1.0",
42
42
  "@next-deploy/data-core": "0.1.0",
43
43
  "@next-deploy/functions-runtime": "0.1.0",
44
- "@next-deploy/functions-bundler": "0.1.0",
45
44
  "@next-deploy/sdk": "0.1.0",
46
- "@next-deploy/core": "0.1.0"
45
+ "@next-deploy/functions-bundler": "0.1.0"
47
46
  },
48
47
  "scripts": {
49
48
  "build": "tsup && pnpm build:types",