eslint-plugin-next-edge-boundary 0.1.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 (68) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +110 -0
  3. package/dist/configs/recommended.d.ts +3 -0
  4. package/dist/configs/recommended.d.ts.map +1 -0
  5. package/dist/configs/recommended.js +13 -0
  6. package/dist/configs/recommended.js.map +1 -0
  7. package/dist/configs/strict.d.ts +3 -0
  8. package/dist/configs/strict.d.ts.map +1 -0
  9. package/dist/configs/strict.js +13 -0
  10. package/dist/configs/strict.js.map +1 -0
  11. package/dist/core/classify.d.ts +14 -0
  12. package/dist/core/classify.d.ts.map +1 -0
  13. package/dist/core/classify.js +59 -0
  14. package/dist/core/classify.js.map +1 -0
  15. package/dist/core/constants.d.ts +10 -0
  16. package/dist/core/constants.d.ts.map +1 -0
  17. package/dist/core/constants.js +92 -0
  18. package/dist/core/constants.js.map +1 -0
  19. package/dist/core/entrypoints.d.ts +2 -0
  20. package/dist/core/entrypoints.d.ts.map +1 -0
  21. package/dist/core/entrypoints.js +20 -0
  22. package/dist/core/entrypoints.js.map +1 -0
  23. package/dist/core/format-chain.d.ts +5 -0
  24. package/dist/core/format-chain.d.ts.map +1 -0
  25. package/dist/core/format-chain.js +35 -0
  26. package/dist/core/format-chain.js.map +1 -0
  27. package/dist/core/import-graph.d.ts +35 -0
  28. package/dist/core/import-graph.d.ts.map +1 -0
  29. package/dist/core/import-graph.js +169 -0
  30. package/dist/core/import-graph.js.map +1 -0
  31. package/dist/core/import-kind.d.ts +10 -0
  32. package/dist/core/import-kind.d.ts.map +1 -0
  33. package/dist/core/import-kind.js +19 -0
  34. package/dist/core/import-kind.js.map +1 -0
  35. package/dist/core/options.d.ts +26 -0
  36. package/dist/core/options.d.ts.map +1 -0
  37. package/dist/core/options.js +116 -0
  38. package/dist/core/options.js.map +1 -0
  39. package/dist/core/resolve-module.d.ts +24 -0
  40. package/dist/core/resolve-module.d.ts.map +1 -0
  41. package/dist/core/resolve-module.js +232 -0
  42. package/dist/core/resolve-module.js.map +1 -0
  43. package/dist/core/size-estimate.d.ts +17 -0
  44. package/dist/core/size-estimate.d.ts.map +1 -0
  45. package/dist/core/size-estimate.js +48 -0
  46. package/dist/core/size-estimate.js.map +1 -0
  47. package/dist/index.d.ts +18 -0
  48. package/dist/index.d.ts.map +1 -0
  49. package/dist/index.js +40 -0
  50. package/dist/index.js.map +1 -0
  51. package/dist/rules/max-graph-bytes.d.ts +3 -0
  52. package/dist/rules/max-graph-bytes.d.ts.map +1 -0
  53. package/dist/rules/max-graph-bytes.js +123 -0
  54. package/dist/rules/max-graph-bytes.js.map +1 -0
  55. package/dist/rules/no-barrels.d.ts +3 -0
  56. package/dist/rules/no-barrels.d.ts.map +1 -0
  57. package/dist/rules/no-barrels.js +93 -0
  58. package/dist/rules/no-barrels.js.map +1 -0
  59. package/dist/rules/no-node-apis.d.ts +3 -0
  60. package/dist/rules/no-node-apis.d.ts.map +1 -0
  61. package/dist/rules/no-node-apis.js +118 -0
  62. package/dist/rules/no-node-apis.js.map +1 -0
  63. package/dist/rules/types.d.ts +30 -0
  64. package/dist/rules/types.d.ts.map +1 -0
  65. package/dist/rules/types.js +2 -0
  66. package/dist/rules/types.js.map +1 -0
  67. package/docs/hero.png +0 -0
  68. package/package.json +63 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 asyncfinkd
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,110 @@
1
+ # eslint-plugin-next-edge-boundary
2
+
3
+ Your Edge entry doesn’t fail the build. It just gets slower every PR. This rule fails the PR instead.
4
+
5
+ One convenient import in `middleware.ts` or Next 16 `proxy.ts` can drag in `node:fs` three files deep — or a 400KB local graph — while `next build` still passes. This plugin fails that PR in the editor / CI, on the entry import, with the chain.
6
+
7
+ <p align="center">
8
+ <img src="docs/hero.png" alt="ESLint error on src/proxy.ts: notify import flagged because the graph reaches node:fs through notify.ts → write-log.ts" width="920" />
9
+ </p>
10
+
11
+ The squiggle sits on `./lib/notify` — not on a leaf deep in the tree. That is the point.
12
+
13
+ ## Before / after
14
+
15
+ ```ts
16
+ // ❌ proxy.ts — “just reuse notify”
17
+ import { notify } from "./lib/notify";
18
+ ```
19
+
20
+ ```ts
21
+ // ✅ proxy.ts — thin Edge slice
22
+ import { notifyEdge } from "./lib/notify-edge";
23
+ ```
24
+
25
+ Banning `fs` on the entry file is not enough. The leak is almost always transitive. Byte bloat happens even when nothing Node-shaped shows up — so there is a graph size budget too.
26
+
27
+ ## Install
28
+
29
+ ```bash
30
+ pnpm add -D eslint-plugin-next-edge-boundary
31
+ ```
32
+
33
+ Peer: `eslint` `>=9`. Optional: `typescript`.
34
+
35
+ ### Flat config
36
+
37
+ ```js
38
+ import nextEdgeBoundary from "eslint-plugin-next-edge-boundary";
39
+
40
+ export default [
41
+ {
42
+ files: [
43
+ "middleware.ts",
44
+ "src/middleware.ts",
45
+ "proxy.ts",
46
+ "src/proxy.ts",
47
+ ],
48
+ ...nextEdgeBoundary.configs.recommended,
49
+ },
50
+ ];
51
+ ```
52
+
53
+ Use `configs.strict` for a 32 KiB budget and barrels as errors. Legacy eslintrc: `configs["recommended-legacy"]` / `configs["strict-legacy"]`.
54
+
55
+ ## Rules
56
+
57
+ | Rule | What it catches |
58
+ | ---- | ---------------- |
59
+ | `next-edge-boundary/no-node-apis` | Value-import graph reaches Node builtins (`fs` / `node:fs`, …) or a denylist package (`sharp`, `pg`, `mongodb`, …) |
60
+ | `next-edge-boundary/max-graph-bytes` | Estimated local source graph exceeds the budget (64 KiB recommended, 32 KiB strict) |
61
+ | `next-edge-boundary/no-barrels` | Entry imports of barrels (`@/lib`, `@/utils`, …) or `import * as` namespaces |
62
+
63
+ `import type` / `export type` are ignored — they erase at compile time.
64
+
65
+ ### recommended vs strict
66
+
67
+ | | recommended | strict |
68
+ | - | ----------- | ------ |
69
+ | `no-node-apis` | error | error |
70
+ | `max-graph-bytes` | error · `max: 65536` | error · `max: 32768` |
71
+ | `no-barrels` | warn | error |
72
+
73
+ ## Why not `no-restricted-imports` / Next build alone
74
+
75
+ | Approach | Gap |
76
+ | -------- | --- |
77
+ | `no-restricted-imports` | Direct specifiers only. No transitive walk, no size budget, no chain. |
78
+ | Next / Edge build | Often fails late, and mainly on hard Node APIs. Quiet size regression can ship for weeks. |
79
+ | This plugin | Transitive graph + byte budget + chain on the entry import, at lint time. |
80
+
81
+ ## Options
82
+
83
+ Shared on every rule:
84
+
85
+ ```ts
86
+ {
87
+ allowModules?: string[];
88
+ denyModules?: string[];
89
+ ignorePatterns?: string[];
90
+ tsconfigPath?: string;
91
+ allowImportChains?: string[][]; // last resort
92
+ }
93
+ ```
94
+
95
+ `max-graph-bytes`: `max`, `includeNodeModules`, `packageWeights`
96
+ `no-barrels`: `barrelPatterns`, `forbidNamespaceImports`
97
+
98
+ ## Entrypoints
99
+
100
+ Matched by basename: `middleware.ts` / `.js`, `proxy.ts` / `.js` (Next.js 16). Scope them with ESLint `files` as above.
101
+
102
+ ## Limitations
103
+
104
+ - Dynamic `import()` is ignored in v1
105
+ - Not a bundler — local source byte estimate, not Turbopack/webpack output
106
+ - App Router `export const runtime = 'edge'` detection is not in v1
107
+
108
+ ## License
109
+
110
+ MIT
@@ -0,0 +1,3 @@
1
+ import type { Linter } from "eslint";
2
+ export declare const recommendedConfig: Linter.Config;
3
+ //# sourceMappingURL=recommended.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recommended.d.ts","sourceRoot":"","sources":["../../src/configs/recommended.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAGrC,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,MAUtC,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { DEFAULT_MAX_BYTES_RECOMMENDED } from "../core/constants.js";
2
+ export const recommendedConfig = {
3
+ name: "next-edge-boundary/recommended",
4
+ rules: {
5
+ "next-edge-boundary/no-node-apis": "error",
6
+ "next-edge-boundary/max-graph-bytes": [
7
+ "error",
8
+ { max: DEFAULT_MAX_BYTES_RECOMMENDED },
9
+ ],
10
+ "next-edge-boundary/no-barrels": "warn",
11
+ },
12
+ };
13
+ //# sourceMappingURL=recommended.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recommended.js","sourceRoot":"","sources":["../../src/configs/recommended.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,6BAA6B,EAAE,MAAM,sBAAsB,CAAC;AAErE,MAAM,CAAC,MAAM,iBAAiB,GAAkB;IAC9C,IAAI,EAAE,gCAAgC;IACtC,KAAK,EAAE;QACL,iCAAiC,EAAE,OAAO;QAC1C,oCAAoC,EAAE;YACpC,OAAO;YACP,EAAE,GAAG,EAAE,6BAA6B,EAAE;SACvC;QACD,+BAA+B,EAAE,MAAM;KACxC;CACF,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { Linter } from "eslint";
2
+ export declare const strictConfig: Linter.Config;
3
+ //# sourceMappingURL=strict.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"strict.d.ts","sourceRoot":"","sources":["../../src/configs/strict.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAGrC,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,MAUjC,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { DEFAULT_MAX_BYTES_STRICT } from "../core/constants.js";
2
+ export const strictConfig = {
3
+ name: "next-edge-boundary/strict",
4
+ rules: {
5
+ "next-edge-boundary/no-node-apis": "error",
6
+ "next-edge-boundary/max-graph-bytes": [
7
+ "error",
8
+ { max: DEFAULT_MAX_BYTES_STRICT },
9
+ ],
10
+ "next-edge-boundary/no-barrels": "error",
11
+ },
12
+ };
13
+ //# sourceMappingURL=strict.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"strict.js","sourceRoot":"","sources":["../../src/configs/strict.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAEhE,MAAM,CAAC,MAAM,YAAY,GAAkB;IACzC,IAAI,EAAE,2BAA2B;IACjC,KAAK,EAAE;QACL,iCAAiC,EAAE,OAAO;QAC1C,oCAAoC,EAAE;YACpC,OAAO;YACP,EAAE,GAAG,EAAE,wBAAwB,EAAE;SAClC;QACD,+BAA+B,EAAE,OAAO;KACzC;CACF,CAAC"}
@@ -0,0 +1,14 @@
1
+ import type { ResolveResult } from "./resolve-module.js";
2
+ export type Classification = {
3
+ kind: "allow";
4
+ reason: "allowlist" | "local" | "unknown-package";
5
+ } | {
6
+ kind: "deny";
7
+ reason: "builtin" | "denylist";
8
+ moduleId: string;
9
+ };
10
+ export declare function classifyModule(resolved: ResolveResult, options?: {
11
+ allowModules?: string[];
12
+ denyModules?: string[];
13
+ }): Classification;
14
+ //# sourceMappingURL=classify.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"classify.d.ts","sourceRoot":"","sources":["../../src/core/classify.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD,MAAM,MAAM,cAAc,GACtB;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,WAAW,GAAG,OAAO,GAAG,iBAAiB,CAAA;CAAE,GACpE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,SAAS,GAAG,UAAU,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC;AAWvE,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,aAAa,EACvB,OAAO,GAAE;IACP,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB,GACL,cAAc,CAyDhB"}
@@ -0,0 +1,59 @@
1
+ import { DEFAULT_DENY_PACKAGES, NODE_BUILTINS, } from "./constants.js";
2
+ import { matchesAllowOrDeny } from "./options.js";
3
+ function normalizeBuiltin(id) {
4
+ return id.startsWith("node:") ? id.slice("node:".length) : id;
5
+ }
6
+ function isDeniedBuiltin(id) {
7
+ const name = normalizeBuiltin(id);
8
+ return NODE_BUILTINS.has(name);
9
+ }
10
+ export function classifyModule(resolved, options = {}) {
11
+ const rawId = resolved.kind === "package"
12
+ ? resolved.packageName
13
+ : resolved.id;
14
+ const displayId = resolved.kind === "builtin"
15
+ ? resolved.id.startsWith("node:")
16
+ ? resolved.id
17
+ : `node:${resolved.id}`
18
+ : resolved.kind === "package"
19
+ ? resolved.packageName
20
+ : resolved.id;
21
+ if (matchesAllowOrDeny(displayId, options.allowModules)) {
22
+ return { kind: "allow", reason: "allowlist" };
23
+ }
24
+ if (resolved.kind === "package" && matchesAllowOrDeny(rawId, options.allowModules)) {
25
+ return { kind: "allow", reason: "allowlist" };
26
+ }
27
+ if (matchesAllowOrDeny(displayId, options.denyModules)) {
28
+ return { kind: "deny", reason: "denylist", moduleId: displayId };
29
+ }
30
+ if (resolved.kind === "package" && matchesAllowOrDeny(rawId, options.denyModules)) {
31
+ return { kind: "deny", reason: "denylist", moduleId: rawId };
32
+ }
33
+ if (resolved.kind === "builtin" && isDeniedBuiltin(resolved.id)) {
34
+ return {
35
+ kind: "deny",
36
+ reason: "builtin",
37
+ moduleId: displayId,
38
+ };
39
+ }
40
+ if (resolved.kind === "package") {
41
+ const denySet = new Set([
42
+ ...DEFAULT_DENY_PACKAGES,
43
+ ...(options.denyModules ?? []),
44
+ ]);
45
+ if (denySet.has(resolved.packageName)) {
46
+ return {
47
+ kind: "deny",
48
+ reason: "denylist",
49
+ moduleId: resolved.packageName,
50
+ };
51
+ }
52
+ return { kind: "allow", reason: "unknown-package" };
53
+ }
54
+ if (resolved.kind === "file") {
55
+ return { kind: "allow", reason: "local" };
56
+ }
57
+ return { kind: "allow", reason: "unknown-package" };
58
+ }
59
+ //# sourceMappingURL=classify.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"classify.js","sourceRoot":"","sources":["../../src/core/classify.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,aAAa,GACd,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAOlD,SAAS,gBAAgB,CAAC,EAAU;IAClC,OAAO,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AAChE,CAAC;AAED,SAAS,eAAe,CAAC,EAAU;IACjC,MAAM,IAAI,GAAG,gBAAgB,CAAC,EAAE,CAAC,CAAC;IAClC,OAAO,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AACjC,CAAC;AAED,MAAM,UAAU,cAAc,CAC5B,QAAuB,EAC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AAC;IAC/D,CAAC;IAED,IAAI,QAAQ,CAAC,IAAI,KAAK,SAAS,IAAI,eAAe,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE,CAAC;QAChE,OAAO;YACL,IAAI,EAAE,MAAM;YACZ,MAAM,EAAE,SAAS;YACjB,QAAQ,EAAE,SAAS;SACpB,CAAC;IACJ,CAAC;IAED,IAAI,QAAQ,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;QAChC,MAAM,OAAO,GAAG,IAAI,GAAG,CAAS;YAC9B,GAAG,qBAAqB;YACxB,GAAG,CAAC,OAAO,CAAC,WAAW,IAAI,EAAE,CAAC;SAC/B,CAAC,CAAC;QACH,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC;YACtC,OAAO;gBACL,IAAI,EAAE,MAAM;gBACZ,MAAM,EAAE,UAAU;gBAClB,QAAQ,EAAE,QAAQ,CAAC,WAAW;aAC/B,CAAC;QACJ,CAAC;QACD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,iBAAiB,EAAE,CAAC;IACtD,CAAC;IAED,IAAI,QAAQ,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;QAC7B,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;IAC5C,CAAC;IAED,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,iBAAiB,EAAE,CAAC;AACtD,CAAC"}
@@ -0,0 +1,10 @@
1
+ export declare const PACKAGE_NAME = "eslint-plugin-next-edge-boundary";
2
+ export declare const DEFAULT_ENTRY_GLOBS: readonly ["**/middleware.ts", "**/middleware.js", "**/proxy.ts", "**/proxy.js"];
3
+ export declare const DEFAULT_MAX_BYTES_RECOMMENDED = 65536;
4
+ export declare const DEFAULT_MAX_BYTES_STRICT = 32768;
5
+ export declare const NODE_BUILTINS: Set<string>;
6
+ export declare const DEFAULT_DENY_PACKAGES: readonly ["sharp", "fs-extra", "graceful-fs", "better-sqlite3", "sqlite3", "pg", "mysql2", "mongodb", "webpack", "esbuild"];
7
+ export declare const DEFAULT_BARREL_PATTERNS: readonly ["@/lib", "@/lib/index", "@/utils", "@/utils/index", "~/lib", "~/lib/index", "~/utils", "~/utils/index"];
8
+ export declare const SOURCE_EXTENSIONS: readonly [".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs", ".mts", ".cts"];
9
+ export declare const DEFAULT_PACKAGE_WEIGHTS: Record<string, number>;
10
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/core/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,qCAAqC,CAAC;AAE/D,eAAO,MAAM,mBAAmB,iFAKtB,CAAC;AAEX,eAAO,MAAM,6BAA6B,QAAS,CAAC;AACpD,eAAO,MAAM,wBAAwB,QAAS,CAAC;AAE/C,eAAO,MAAM,aAAa,aA2CxB,CAAC;AAEH,eAAO,MAAM,qBAAqB,6HAWxB,CAAC;AAEX,eAAO,MAAM,uBAAuB,mHAS1B,CAAC;AAEX,eAAO,MAAM,iBAAiB,yEASpB,CAAC;AAEX,eAAO,MAAM,uBAAuB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAK1D,CAAC"}
@@ -0,0 +1,92 @@
1
+ export const PACKAGE_NAME = "eslint-plugin-next-edge-boundary";
2
+ export const DEFAULT_ENTRY_GLOBS = [
3
+ "**/middleware.ts",
4
+ "**/middleware.js",
5
+ "**/proxy.ts",
6
+ "**/proxy.js",
7
+ ];
8
+ export const DEFAULT_MAX_BYTES_RECOMMENDED = 65_536;
9
+ export const DEFAULT_MAX_BYTES_STRICT = 32_768;
10
+ export const NODE_BUILTINS = new Set([
11
+ "assert",
12
+ "async_hooks",
13
+ "buffer",
14
+ "child_process",
15
+ "cluster",
16
+ "console",
17
+ "constants",
18
+ "crypto",
19
+ "dgram",
20
+ "diagnostics_channel",
21
+ "dns",
22
+ "domain",
23
+ "events",
24
+ "fs",
25
+ "http",
26
+ "http2",
27
+ "https",
28
+ "inspector",
29
+ "module",
30
+ "net",
31
+ "os",
32
+ "path",
33
+ "perf_hooks",
34
+ "process",
35
+ "punycode",
36
+ "querystring",
37
+ "readline",
38
+ "repl",
39
+ "stream",
40
+ "string_decoder",
41
+ "sys",
42
+ "timers",
43
+ "tls",
44
+ "trace_events",
45
+ "tty",
46
+ "url",
47
+ "util",
48
+ "v8",
49
+ "vm",
50
+ "wasi",
51
+ "worker_threads",
52
+ "zlib",
53
+ ]);
54
+ export const DEFAULT_DENY_PACKAGES = [
55
+ "sharp",
56
+ "fs-extra",
57
+ "graceful-fs",
58
+ "better-sqlite3",
59
+ "sqlite3",
60
+ "pg",
61
+ "mysql2",
62
+ "mongodb",
63
+ "webpack",
64
+ "esbuild",
65
+ ];
66
+ export const DEFAULT_BARREL_PATTERNS = [
67
+ "@/lib",
68
+ "@/lib/index",
69
+ "@/utils",
70
+ "@/utils/index",
71
+ "~/lib",
72
+ "~/lib/index",
73
+ "~/utils",
74
+ "~/utils/index",
75
+ ];
76
+ export const SOURCE_EXTENSIONS = [
77
+ ".ts",
78
+ ".tsx",
79
+ ".js",
80
+ ".jsx",
81
+ ".mjs",
82
+ ".cjs",
83
+ ".mts",
84
+ ".cts",
85
+ ];
86
+ export const DEFAULT_PACKAGE_WEIGHTS = {
87
+ lodash: 70_000,
88
+ moment: 60_000,
89
+ "date-fns": 40_000,
90
+ axios: 20_000,
91
+ };
92
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/core/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,YAAY,GAAG,kCAAkC,CAAC;AAE/D,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,kBAAkB;IAClB,kBAAkB;IAClB,aAAa;IACb,aAAa;CACL,CAAC;AAEX,MAAM,CAAC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0,0 +1,2 @@
1
+ export declare function isEdgeEntrypoint(filename: string): boolean;
2
+ //# sourceMappingURL=entrypoints.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entrypoints.d.ts","sourceRoot":"","sources":["../../src/core/entrypoints.ts"],"names":[],"mappings":"AAiBA,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAG1D"}
@@ -0,0 +1,20 @@
1
+ import path from "node:path";
2
+ const ENTRY_BASENAMES = new Set([
3
+ "middleware.ts",
4
+ "middleware.js",
5
+ "middleware.mts",
6
+ "middleware.mjs",
7
+ "middleware.cts",
8
+ "middleware.cjs",
9
+ "proxy.ts",
10
+ "proxy.js",
11
+ "proxy.mts",
12
+ "proxy.mjs",
13
+ "proxy.cts",
14
+ "proxy.cjs",
15
+ ]);
16
+ export function isEdgeEntrypoint(filename) {
17
+ const base = path.basename(filename);
18
+ return ENTRY_BASENAMES.has(base);
19
+ }
20
+ //# sourceMappingURL=entrypoints.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entrypoints.js","sourceRoot":"","sources":["../../src/core/entrypoints.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,MAAM,eAAe,GAAG,IAAI,GAAG,CAAC;IAC9B,eAAe;IACf,eAAe;IACf,gBAAgB;IAChB,gBAAgB;IAChB,gBAAgB;IAChB,gBAAgB;IAChB,UAAU;IACV,UAAU;IACV,WAAW;IACX,WAAW;IACX,WAAW;IACX,WAAW;CACZ,CAAC,CAAC;AAEH,MAAM,UAAU,gBAAgB,CAAC,QAAgB;IAC/C,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACrC,OAAO,eAAe,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AACnC,CAAC"}
@@ -0,0 +1,5 @@
1
+ export declare function formatChain(chain: string[], options?: {
2
+ cwd?: string;
3
+ }): string;
4
+ export declare function formatBytes(bytes: number): string;
5
+ //# sourceMappingURL=format-chain.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format-chain.d.ts","sourceRoot":"","sources":["../../src/core/format-chain.ts"],"names":[],"mappings":"AAEA,wBAAgB,WAAW,CACzB,KAAK,EAAE,MAAM,EAAE,EACf,OAAO,GAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAO,GAC7B,MAAM,CAWR;AAaD,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAUjD"}
@@ -0,0 +1,35 @@
1
+ import path from "node:path";
2
+ export function formatChain(chain, options = {}) {
3
+ const cwd = options.cwd ?? process.cwd();
4
+ const lines = chain.map((item, index) => {
5
+ const display = toDisplayPath(item, cwd);
6
+ const indent = " ".repeat(index);
7
+ if (index === 0) {
8
+ return `${indent}${display}`;
9
+ }
10
+ return `${indent}→ ${display}`;
11
+ });
12
+ return lines.join("\n");
13
+ }
14
+ function toDisplayPath(item, cwd) {
15
+ if (item.startsWith("node:") || !path.isAbsolute(item)) {
16
+ return item;
17
+ }
18
+ const relative = path.relative(cwd, item);
19
+ if (!relative || relative.startsWith("..")) {
20
+ return item;
21
+ }
22
+ return relative.replaceAll("\\", "/");
23
+ }
24
+ export function formatBytes(bytes) {
25
+ if (bytes < 1024) {
26
+ return `${bytes}B`;
27
+ }
28
+ if (bytes < 1024 * 1024) {
29
+ const kb = bytes / 1024;
30
+ return `${kb >= 10 ? Math.round(kb) : kb.toFixed(1).replace(/\.0$/, "")}KB`;
31
+ }
32
+ const mb = bytes / (1024 * 1024);
33
+ return `${mb.toFixed(1).replace(/\.0$/, "")}MB`;
34
+ }
35
+ //# sourceMappingURL=format-chain.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format-chain.js","sourceRoot":"","sources":["../../src/core/format-chain.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,MAAM,UAAU,WAAW,CACzB,KAAe,EACf,UAA4B,EAA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OAAO,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC;IAC9E,CAAC;IACD,MAAM,EAAE,GAAG,KAAK,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC;IACjC,OAAO,GAAG,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC;AAClD,CAAC"}
@@ -0,0 +1,35 @@
1
+ import { type Classification } from "./classify.js";
2
+ import { type SharedOptions } from "./options.js";
3
+ import { type ResolveResult } from "./resolve-module.js";
4
+ export type GraphNode = {
5
+ id: string;
6
+ kind: "file" | "builtin" | "package" | "unresolved";
7
+ packageName?: string;
8
+ classification: Classification;
9
+ };
10
+ export type ImportEdge = {
11
+ from: string;
12
+ specifier: string;
13
+ resolved: ResolveResult;
14
+ };
15
+ export type GraphWalkResult = {
16
+ nodes: GraphNode[];
17
+ edges: ImportEdge[];
18
+ chains: Map<string, string[]>;
19
+ };
20
+ export type EntryImport = {
21
+ specifier: string;
22
+ node: unknown;
23
+ isType: boolean;
24
+ isNamespace: boolean;
25
+ };
26
+ export declare function clearGraphCaches(): void;
27
+ export declare function collectValueImportSpecifiers(source: string): string[];
28
+ export declare function walkImportGraph(entryFile: string, options?: SharedOptions & {
29
+ seedSpecifiers?: string[];
30
+ }): GraphWalkResult;
31
+ export declare function findDeniedPaths(walk: GraphWalkResult): Array<{
32
+ moduleId: string;
33
+ chain: string[];
34
+ }>;
35
+ //# sourceMappingURL=import-graph.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"import-graph.d.ts","sourceRoot":"","sources":["../../src/core/import-graph.ts"],"names":[],"mappings":"AACA,OAAO,EAAkB,KAAK,cAAc,EAAE,MAAM,eAAe,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