@builder.io/dev-tools 1.66.1-dev.202606171106.3ccc9ceba → 1.66.1-dev.202606182046.8d0b6f483

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 (43) hide show
  1. package/cli/index.cjs +1371 -2153
  2. package/cli/index.cjs.map +4 -4
  3. package/core/index.cjs +1 -1
  4. package/core/index.mjs +1 -1
  5. package/node/index.cjs +1 -1
  6. package/node/index.mjs +1 -1
  7. package/package.json +1 -1
  8. package/server/index.cjs +10 -61
  9. package/server/index.mjs +10 -61
  10. package/types/cli/codegen.d.ts +0 -1
  11. package/types/tsconfig.tsbuildinfo +1 -1
  12. package/types/_tests_/codegen-orphan-tool-sweep.test.d.ts +0 -1
  13. package/types/_tests_/figma-generate.e2e.d.ts +0 -1
  14. package/types/cli/database-scaffold/cli.d.ts +0 -3
  15. package/types/cli/database-scaffold/provision.d.ts +0 -68
  16. package/types/cli/database-scaffold/provision.test.d.ts +0 -1
  17. package/types/cli/database-scaffold/scaffold.d.ts +0 -12
  18. package/types/cli/database-scaffold/scaffold.test.d.ts +0 -1
  19. package/types/cli/database-scaffold/template-files.d.ts +0 -26
  20. package/types/cli/database-scaffold/user-summary.d.ts +0 -4
  21. package/types/cli/database-scaffold/user-summary.test.d.ts +0 -1
  22. package/types/cli/generate.d.ts +0 -16
  23. package/types/cli/indexing.d.ts +0 -5
  24. package/types/cli/launch/github.d.ts +0 -3
  25. package/types/cli/launch/hosting/run-database-migration.d.ts +0 -13
  26. package/types/cli/launch/hosting/run-database-migration.test.d.ts +0 -1
  27. package/types/cli/utils/browser-testing-agent.d.ts +0 -2
  28. package/types/cli/utils/dev-server-url-parser.d.ts +0 -12
  29. package/types/cli/utils/dev-server-url-parser.test.d.ts +0 -1
  30. package/types/cli/utils/project-configuration-agent.d.ts +0 -2
  31. package/types/cli/utils/rules-parser.d.ts +0 -17
  32. package/types/cli/utils/rules-parser.test.d.ts +0 -1
  33. package/types/cli/utils/yaml-frontmatter.d.ts +0 -32
  34. package/types/cli/utils/yaml-frontmatter.test.d.ts +0 -1
  35. package/types/core/component-map-builder.d.ts +0 -42
  36. package/types/server/snapshot-mode.d.ts +0 -24
  37. package/types/server/source-map-resolver/cache.d.ts +0 -36
  38. package/types/server/source-map-resolver/indexed-map-resolver.d.ts +0 -10
  39. package/types/server/source-map-resolver/loader.d.ts +0 -16
  40. package/types/server/source-map-resolver/security.d.ts +0 -21
  41. package/types/server/source-map-resolver/types.d.ts +0 -41
  42. package/types/server/source-map-resolver/validation.d.ts +0 -16
  43. package/types/server/source-map-resolver.d.ts +0 -25
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1,3 +0,0 @@
1
- export declare function runDatabaseScaffoldCommand(args: {
2
- projectRoot?: string;
3
- }): number;
@@ -1,68 +0,0 @@
1
- import type { PushChangesArgs } from "#ai-utils";
2
- import type { Credentials } from "../credentials";
3
- export interface ProvisionDatabaseResult {
4
- status: "ready" | "exists";
5
- neonProjectId: string;
6
- mainBranchId: string;
7
- region: string;
8
- branchNeonId: string;
9
- }
10
- export interface GitSession {
11
- git(args: string[], opts?: string | {
12
- cwd?: string;
13
- }): Promise<string | void>;
14
- pushChanges(opts: PushChangesArgs): Promise<{
15
- success?: boolean;
16
- message?: string;
17
- }>;
18
- }
19
- export declare function fetchFusionDatabaseStatus(args: {
20
- credentials: Credentials;
21
- projectId: string;
22
- debug?: boolean;
23
- signal?: AbortSignal;
24
- }): Promise<{
25
- ok: true;
26
- enabled: boolean;
27
- } | {
28
- ok: false;
29
- error: string;
30
- }>;
31
- export declare function resolveFusionBranchId(args: {
32
- credentials: Credentials;
33
- projectId: string;
34
- branchName: string;
35
- debug?: boolean;
36
- signal?: AbortSignal;
37
- }): Promise<{
38
- ok: true;
39
- branchId: string;
40
- } | {
41
- ok: false;
42
- error: string;
43
- }>;
44
- export declare function provisionFusionDatabase(args: {
45
- credentials: Credentials;
46
- projectId: string;
47
- branchId: string;
48
- debug?: boolean;
49
- signal?: AbortSignal;
50
- }): Promise<{
51
- ok: true;
52
- result: ProvisionDatabaseResult;
53
- } | {
54
- ok: false;
55
- error: string;
56
- }>;
57
- export declare function commitScaffoldFiles(args: {
58
- session: GitSession;
59
- gitRoot: string;
60
- relativePaths: string[];
61
- signal?: AbortSignal;
62
- }): Promise<{
63
- ok: true;
64
- committed: boolean;
65
- } | {
66
- ok: false;
67
- error: string;
68
- }>;
@@ -1 +0,0 @@
1
- export {};
@@ -1,12 +0,0 @@
1
- export interface ScaffoldDrizzleDatabaseResult {
2
- ok: boolean;
3
- rootDir: string;
4
- written: string[];
5
- skipped: string[];
6
- packageJsonUpdated: boolean;
7
- error?: string;
8
- }
9
- export declare function isDrizzleScaffoldPresent(rootDir: string): boolean;
10
- export declare function scaffoldDrizzleDatabase(args: {
11
- rootDir: string;
12
- }): ScaffoldDrizzleDatabaseResult;
@@ -1 +0,0 @@
1
- export {};
@@ -1,26 +0,0 @@
1
- export declare const BUILDER_CONFIG_JSON = "{\n \"database\": {\n \"kind\": \"postgres\",\n \"migrations\": \"drizzle\",\n \"schemaDir\": \"drizzle\"\n }\n}\n";
2
- export declare const DRIZZLE_CONFIG_TS = "import \"dotenv/config\";\nimport { defineConfig } from \"drizzle-kit\";\n\nexport default defineConfig({\n schema: \"./drizzle/schema.ts\",\n out: \"./drizzle/migrations\",\n dialect: \"postgresql\",\n dbCredentials: { url: process.env.DATABASE_URL_UNPOOLED! },\n});\n";
3
- export declare const DRIZZLE_SCHEMA_TS = "import { pgTable } from \"drizzle-orm/pg-core\";\n\n// Add tables for this project below.\n";
4
- export declare const SERVER_DB_TS = "import { neon } from \"@neondatabase/serverless\";\nimport { drizzle } from \"drizzle-orm/neon-http\";\nimport type { NeonHttpDatabase } from \"drizzle-orm/neon-http\";\nimport * as schema from \"../drizzle/schema\";\n\nlet dbInstance: NeonHttpDatabase<typeof schema> | undefined;\n\nexport function getDb(): NeonHttpDatabase<typeof schema> {\n if (dbInstance) {\n return dbInstance;\n }\n\n const databaseUrl = process.env.DATABASE_URL;\n if (!databaseUrl) {\n throw new Error(\"DATABASE_URL is required to initialize the database client\");\n }\n\n dbInstance = drizzle(neon(databaseUrl), { schema });\n return dbInstance;\n}\n\nexport { schema };\n";
5
- export declare const MAYBE_MIGRATE_MJS = "import { spawnSync } from \"node:child_process\";\n\nconst branchKind = process.env.FUSION_BRANCH_KIND;\n\nif (branchKind !== \"feature\") {\n if (branchKind !== \"main\") {\n console.warn(\n `Skipping database migrations because FUSION_BRANCH_KIND is ${branchKind ?? \"unset\"}`,\n );\n }\n\n process.exit(0);\n}\n\nif (!process.env.DATABASE_URL_UNPOOLED) {\n console.warn(\n \"Skipping database migrations because DATABASE_URL_UNPOOLED is not set\",\n );\n process.exit(0);\n}\n\nconst isWindows = process.platform === \"win32\";\nconst npmCommand = isWindows ? \"npm.cmd\" : \"npm\";\nconst result = spawnSync(npmCommand, [\"run\", \"db:migrate\"], {\n env: process.env,\n shell: isWindows,\n stdio: \"inherit\",\n});\n\nif (result.error) {\n console.error(result.error.message);\n process.exit(1);\n}\n\nprocess.exit(result.status ?? 1);\n";
6
- export declare const GUARD_NO_DRIZZLE_PUSH_MJS = "import { readdirSync, readFileSync, statSync } from \"node:fs\";\nimport { resolve } from \"node:path\";\n\nconst bannedCommandPattern = /\\bdrizzle-kit\\b[^\\r\\n]*\\bpush\\b/;\nconst root = resolve(process.argv[2] ?? process.cwd());\nconst candidatePaths = [\n resolve(root, \"package.json\"),\n resolve(root, \"drizzle.config.ts\"),\n resolve(root, \"scripts\"),\n resolve(root, \"server\"),\n resolve(root, \"client\"),\n resolve(root, \"shared\"),\n resolve(root, \".github/workflows\"),\n];\nconst workflowExtensions = new Set([\".yml\", \".yaml\"]);\nconst sourceExtensions = new Set([\n \".cjs\",\n \".js\",\n \".jsx\",\n \".mjs\",\n \".sh\",\n \".ts\",\n \".tsx\",\n]);\nconst testFilePattern = /(?:^|[\\\\/])[^\\\\/]+\\.test\\.[cm]?[jt]sx?$/;\nconst guardFilePattern = /(?:^|[\\\\/])guard-no-drizzle-push\\.mjs$/;\n\nfunction getExtension(filePath) {\n const index = filePath.lastIndexOf(\".\");\n return index === -1 ? \"\" : filePath.slice(index);\n}\n\nfunction collectFiles(path) {\n try {\n const stats = statSync(path);\n\n if (stats.isFile()) {\n if (testFilePattern.test(path) || guardFilePattern.test(path)) {\n return [];\n }\n\n return path.endsWith(\"package.json\") ||\n workflowExtensions.has(getExtension(path)) ||\n sourceExtensions.has(getExtension(path))\n ? [path]\n : [];\n }\n\n if (!stats.isDirectory()) {\n return [];\n }\n\n return readdirSync(path).flatMap((entry) =>\n collectFiles(resolve(path, entry)),\n );\n } catch (error) {\n if (error?.code === \"ENOENT\") {\n return [];\n }\n\n throw error;\n }\n}\n\nconst scannedFiles = [...new Set(candidatePaths.flatMap(collectFiles))];\nconst offenders = scannedFiles.filter((filePath) =>\n bannedCommandPattern.test(readFileSync(filePath, \"utf8\")),\n);\n\nif (offenders.length > 0) {\n console.error(`Banned Drizzle command found in:\\n${offenders.join(\"\\n\")}`);\n process.exit(1);\n}\n";
7
- export declare const SCAFFOLD_FILES: {
8
- readonly "builder.config.json": "{\n \"database\": {\n \"kind\": \"postgres\",\n \"migrations\": \"drizzle\",\n \"schemaDir\": \"drizzle\"\n }\n}\n";
9
- readonly "drizzle.config.ts": "import \"dotenv/config\";\nimport { defineConfig } from \"drizzle-kit\";\n\nexport default defineConfig({\n schema: \"./drizzle/schema.ts\",\n out: \"./drizzle/migrations\",\n dialect: \"postgresql\",\n dbCredentials: { url: process.env.DATABASE_URL_UNPOOLED! },\n});\n";
10
- readonly "drizzle/schema.ts": "import { pgTable } from \"drizzle-orm/pg-core\";\n\n// Add tables for this project below.\n";
11
- readonly "server/db.ts": "import { neon } from \"@neondatabase/serverless\";\nimport { drizzle } from \"drizzle-orm/neon-http\";\nimport type { NeonHttpDatabase } from \"drizzle-orm/neon-http\";\nimport * as schema from \"../drizzle/schema\";\n\nlet dbInstance: NeonHttpDatabase<typeof schema> | undefined;\n\nexport function getDb(): NeonHttpDatabase<typeof schema> {\n if (dbInstance) {\n return dbInstance;\n }\n\n const databaseUrl = process.env.DATABASE_URL;\n if (!databaseUrl) {\n throw new Error(\"DATABASE_URL is required to initialize the database client\");\n }\n\n dbInstance = drizzle(neon(databaseUrl), { schema });\n return dbInstance;\n}\n\nexport { schema };\n";
12
- readonly "scripts/maybe-migrate.mjs": "import { spawnSync } from \"node:child_process\";\n\nconst branchKind = process.env.FUSION_BRANCH_KIND;\n\nif (branchKind !== \"feature\") {\n if (branchKind !== \"main\") {\n console.warn(\n `Skipping database migrations because FUSION_BRANCH_KIND is ${branchKind ?? \"unset\"}`,\n );\n }\n\n process.exit(0);\n}\n\nif (!process.env.DATABASE_URL_UNPOOLED) {\n console.warn(\n \"Skipping database migrations because DATABASE_URL_UNPOOLED is not set\",\n );\n process.exit(0);\n}\n\nconst isWindows = process.platform === \"win32\";\nconst npmCommand = isWindows ? \"npm.cmd\" : \"npm\";\nconst result = spawnSync(npmCommand, [\"run\", \"db:migrate\"], {\n env: process.env,\n shell: isWindows,\n stdio: \"inherit\",\n});\n\nif (result.error) {\n console.error(result.error.message);\n process.exit(1);\n}\n\nprocess.exit(result.status ?? 1);\n";
13
- readonly "scripts/guard-no-drizzle-push.mjs": "import { readdirSync, readFileSync, statSync } from \"node:fs\";\nimport { resolve } from \"node:path\";\n\nconst bannedCommandPattern = /\\bdrizzle-kit\\b[^\\r\\n]*\\bpush\\b/;\nconst root = resolve(process.argv[2] ?? process.cwd());\nconst candidatePaths = [\n resolve(root, \"package.json\"),\n resolve(root, \"drizzle.config.ts\"),\n resolve(root, \"scripts\"),\n resolve(root, \"server\"),\n resolve(root, \"client\"),\n resolve(root, \"shared\"),\n resolve(root, \".github/workflows\"),\n];\nconst workflowExtensions = new Set([\".yml\", \".yaml\"]);\nconst sourceExtensions = new Set([\n \".cjs\",\n \".js\",\n \".jsx\",\n \".mjs\",\n \".sh\",\n \".ts\",\n \".tsx\",\n]);\nconst testFilePattern = /(?:^|[\\\\/])[^\\\\/]+\\.test\\.[cm]?[jt]sx?$/;\nconst guardFilePattern = /(?:^|[\\\\/])guard-no-drizzle-push\\.mjs$/;\n\nfunction getExtension(filePath) {\n const index = filePath.lastIndexOf(\".\");\n return index === -1 ? \"\" : filePath.slice(index);\n}\n\nfunction collectFiles(path) {\n try {\n const stats = statSync(path);\n\n if (stats.isFile()) {\n if (testFilePattern.test(path) || guardFilePattern.test(path)) {\n return [];\n }\n\n return path.endsWith(\"package.json\") ||\n workflowExtensions.has(getExtension(path)) ||\n sourceExtensions.has(getExtension(path))\n ? [path]\n : [];\n }\n\n if (!stats.isDirectory()) {\n return [];\n }\n\n return readdirSync(path).flatMap((entry) =>\n collectFiles(resolve(path, entry)),\n );\n } catch (error) {\n if (error?.code === \"ENOENT\") {\n return [];\n }\n\n throw error;\n }\n}\n\nconst scannedFiles = [...new Set(candidatePaths.flatMap(collectFiles))];\nconst offenders = scannedFiles.filter((filePath) =>\n bannedCommandPattern.test(readFileSync(filePath, \"utf8\")),\n);\n\nif (offenders.length > 0) {\n console.error(`Banned Drizzle command found in:\\n${offenders.join(\"\\n\")}`);\n process.exit(1);\n}\n";
14
- };
15
- export declare const DRIZZLE_RUNTIME_DEPS: {
16
- readonly "@neondatabase/serverless": "^1.0.2";
17
- readonly "drizzle-orm": "0.45.2";
18
- };
19
- export declare const DRIZZLE_DEV_DEPS: {
20
- readonly "drizzle-kit": "0.31.10";
21
- };
22
- export declare const DRIZZLE_SCRIPTS: {
23
- readonly "db:generate": "drizzle-kit generate";
24
- readonly "db:migrate": "drizzle-kit migrate";
25
- readonly "ci:guard-no-drizzle-push": "node scripts/guard-no-drizzle-push.mjs";
26
- };
@@ -1,4 +0,0 @@
1
- import type { ActionItem } from "#ai-utils";
2
- import { formatDatabaseEnabledUserSummary } from "#ai-utils";
3
- export { formatDatabaseEnabledUserSummary };
4
- export declare function appendDatabaseUserSummaryToActions(actions: ActionItem[] | undefined, summaryLine: string): ActionItem[];
@@ -1 +0,0 @@
1
- export {};
@@ -1,16 +0,0 @@
1
- import type { ComponentInfo, ComponentRegistry, DevToolsSys } from "../types";
2
- import type { CLIArgs } from "./index";
3
- import { type FigmaComponentInfo, type UserContext } from "#ai-utils";
4
- export declare const runFigmaGenerate: (sys: DevToolsSys, args: CLIArgs) => Promise<undefined>;
5
- export interface MappingCodeV3 {
6
- figmaNode?: FigmaComponentInfo;
7
- registry?: ComponentRegistry;
8
- userContext?: UserContext;
9
- figmaUrl?: string;
10
- docsUrl?: string;
11
- registeredCmp?: ComponentInfo;
12
- previousCompletion?: string;
13
- userPrompt?: string;
14
- token?: string;
15
- pragma?: string;
16
- }
@@ -1,5 +0,0 @@
1
- import type { DevToolsSys } from "../types";
2
- import type { CLIArgs } from "./index";
3
- import { type Credentials } from "./credentials";
4
- export declare const runCodeIndexing: (_sys: DevToolsSys, _args: CLIArgs) => Promise<void>;
5
- export declare const codeIndexing: (sys: DevToolsSys, credentials: Credentials) => Promise<void>;
@@ -1,3 +0,0 @@
1
- export declare const getKVHiddenComment: (key: string, value: string) => string;
2
- export declare const getPreviewUrl: (projectId: string, branchName: string) => string;
3
- export declare const getInitialDescription: (projectId: string, branchName: string) => string;
@@ -1,13 +0,0 @@
1
- import type { BuildConfigOverrides } from "#ai-utils";
2
- import type { DevServerOrchestrator } from "../dev-server-orchestrator";
3
- export declare function shouldRunDeployDatabaseMigration(workingDirectory: string, buildConfigOverrides?: BuildConfigOverrides): boolean;
4
- export declare function runDeployDatabaseMigration(args: {
5
- devServer: DevServerOrchestrator;
6
- buildConfigOverrides?: BuildConfigOverrides;
7
- signal?: AbortSignal;
8
- }): Promise<{
9
- ok: true;
10
- } | {
11
- ok: false;
12
- output: string;
13
- }>;
@@ -1,2 +0,0 @@
1
- import type { CustomAgentDefinition } from "$/ai-utils";
2
- export declare const BROWSER_TESTING_AGENT: CustomAgentDefinition;
@@ -1,12 +0,0 @@
1
- export interface DevServerUrlInfo {
2
- url: string;
3
- port: number;
4
- }
5
- /**
6
- * Parse dev server output to extract URL and port information
7
- *
8
- * @param output - The command output string to parse
9
- * @param customPatterns - Optional array of custom regex patterns to try first
10
- * @returns Object with url and port, or null if no valid URL found
11
- */
12
- export declare function parseDevServerOutput(output: string, customPatterns?: string[]): DevServerUrlInfo | null;
@@ -1 +0,0 @@
1
- export {};
@@ -1,2 +0,0 @@
1
- import type { CustomAgentDefinition } from "$/ai-utils";
2
- export declare const PROJECT_CONFIGURATION_AGENT: CustomAgentDefinition;
@@ -1,17 +0,0 @@
1
- /**
2
- * Custom instruction/rules parsing utilities
3
- * Handles parsing of custom instruction files (.mdc, .cursorrules, etc.)
4
- */
5
- import type { CustomInstruction } from "$/ai-utils";
6
- /**
7
- * Parse a custom instruction file
8
- * Supports both:
9
- * - .mdc files with YAML frontmatter
10
- * - Plain text files (.cursorrules, .builderrules, etc.)
11
- *
12
- * @param fileContent - Raw file content
13
- * @param filePath - File path (for generating name and id)
14
- * @param hashFunction - Optional hash function for generating unique IDs
15
- * @returns Parsed CustomInstruction or null
16
- */
17
- export declare function parseCustomInstructionFile(fileContent: string, filePath: string, hashFunction?: (content: string) => string): CustomInstruction | null;
@@ -1 +0,0 @@
1
- export {};
@@ -1,32 +0,0 @@
1
- /**
2
- * Generic YAML frontmatter parser for Markdown files
3
- * Supports both simple key-value pairs and arrays
4
- */
5
- export interface YamlFrontmatterResult<T = Record<string, any>> {
6
- frontmatter: T;
7
- body: string;
8
- }
9
- /**
10
- * Checks if content has YAML frontmatter
11
- */
12
- export declare function hasYamlFrontmatter(content: string): boolean;
13
- /**
14
- * Parses YAML frontmatter from a string
15
- * Handles simple YAML: key-value pairs, arrays, and comments
16
- */
17
- export declare function parseYamlFrontmatter(yamlContent: string): Record<string, any>;
18
- /**
19
- * Extracts YAML frontmatter and body from Markdown content
20
- * @param content - The raw Markdown content with frontmatter
21
- * @returns Object with frontmatter and body, or null if no frontmatter found
22
- */
23
- export declare function extractYamlFrontmatter(content: string): {
24
- frontmatterContent: string;
25
- body: string;
26
- } | null;
27
- /**
28
- * Parse Markdown file with YAML frontmatter
29
- * @param content - The raw file content
30
- * @returns Parsed frontmatter and body
31
- */
32
- export declare function parseMarkdownWithYaml<T = Record<string, any>>(content: string): YamlFrontmatterResult<T>;
@@ -1 +0,0 @@
1
- export {};
@@ -1,42 +0,0 @@
1
- /**
2
- * Component Map Builder
3
- *
4
- * Builds a map of component names to their source file locations for the Design tab.
5
- * This allows the Design tab to work without requiring React's _debugSource or customer plugins.
6
- */
7
- import type { DevToolsSys } from "../types";
8
- export interface ComponentLocation {
9
- file: string;
10
- line: number;
11
- column: number;
12
- displayName: string;
13
- }
14
- export type ComponentMap = Record<string, ComponentLocation[]>;
15
- /**
16
- * Build a map of component names to their source locations
17
- */
18
- export declare function buildComponentMap(sys: DevToolsSys, rootDir?: string): Promise<ComponentMap>;
19
- /**
20
- * Cache for component map with file watching
21
- */
22
- export declare class ComponentMapCache {
23
- private cache;
24
- private lastBuilt;
25
- private building;
26
- private readonly ttl;
27
- private sys;
28
- private rootDir;
29
- constructor(sys: DevToolsSys, rootDir?: string);
30
- /**
31
- * Get the component map, building it if necessary
32
- */
33
- get(): Promise<ComponentMap>;
34
- /**
35
- * Invalidate the cache
36
- */
37
- invalidate(): void;
38
- /**
39
- * Force rebuild of the component map
40
- */
41
- rebuild(): Promise<ComponentMap>;
42
- }
@@ -1,24 +0,0 @@
1
- import type { DevToolsHttpServer } from "../types";
2
- interface SnapshotModeContext {
3
- eventId: string;
4
- projectId: string;
5
- gitSha: string;
6
- pvcName: string;
7
- callbackBase: string;
8
- callbackToken: string;
9
- }
10
- /**
11
- * Attach snapshot-mode lifecycle handlers to the dev-tools server.
12
- * Only called when FUSION_SNAPSHOT_MODE=1.
13
- *
14
- * - On dev-server ready: POST /internal/snapshot-completed → exit(0)
15
- * - On SIGTERM: POST /internal/snapshot-failed (reason=evicted) → exit(143)
16
- * - On unhandled error: POST /internal/snapshot-failed → exit(1)
17
- */
18
- export declare function attachSnapshotModeHandlers(ctx: SnapshotModeContext, server: DevToolsHttpServer): void;
19
- /**
20
- * Initialize snapshot mode from environment variables.
21
- * Returns context if FUSION_SNAPSHOT_MODE=1, null otherwise.
22
- */
23
- export declare function getSnapshotModeContext(): SnapshotModeContext | null;
24
- export {};
@@ -1,36 +0,0 @@
1
- /**
2
- * LRU cache for source maps and TraceMap instances
3
- */
4
- import { TraceMap } from "@jridgewell/trace-mapping";
5
- import type { SourceMapV3 } from "./types";
6
- interface CachedSourceMap {
7
- json: SourceMapV3;
8
- /** TraceMap instances keyed by section index (-1 for non-indexed maps) */
9
- tracers: Map<number, TraceMap>;
10
- }
11
- /**
12
- * Get or create cache key from bundled path and source mapping URL
13
- */
14
- export declare function getCacheKey(bundledPath: string, sourceMappingURL: string): string;
15
- /**
16
- * Get cached source map data
17
- * Returns undefined if not cached, null if cached as failed
18
- */
19
- export declare function getCached(key: string): CachedSourceMap | null | undefined;
20
- /**
21
- * Cache a successfully loaded source map
22
- */
23
- export declare function setCached(key: string, json: SourceMapV3): CachedSourceMap;
24
- /**
25
- * Cache a failed load attempt (negative caching)
26
- */
27
- export declare function setCachedFailure(key: string): void;
28
- /**
29
- * Get or create a TraceMap for a specific section (or -1 for non-indexed)
30
- */
31
- export declare function getOrCreateTracer(entry: CachedSourceMap, sectionIndex: number, mapJson: SourceMapV3): TraceMap;
32
- /**
33
- * Clear all cached data
34
- */
35
- export declare function clearCache(): void;
36
- export {};
@@ -1,10 +0,0 @@
1
- /**
2
- * Utilities for handling indexed source maps (section maps)
3
- */
4
- import type { SourceMapSection, SectionMatch } from "./types";
5
- /**
6
- * Find the section containing a given position in an indexed source map.
7
- * Sections are ordered by offset, so we find the last one that starts
8
- * at or before the target position.
9
- */
10
- export declare function findMatchingSection(sections: SourceMapSection[], line: number, column: number): SectionMatch | null;
@@ -1,16 +0,0 @@
1
- /**
2
- * File and source map loading utilities
3
- */
4
- import type { ResolveContext } from "./types";
5
- /**
6
- * Extract sourceMappingURL from JS file content
7
- */
8
- export declare function extractSourceMappingURL(content: string): string | null;
9
- /**
10
- * Load JS file content from dev server or filesystem
11
- */
12
- export declare function loadJSContent(ctx: ResolveContext, bundledPath: string, isServerChunk: boolean): Promise<string | null>;
13
- /**
14
- * Load source map content from various sources
15
- */
16
- export declare function loadSourceMapContent(ctx: ResolveContext, bundledPath: string, sourceMappingURL: string): Promise<string | null>;
@@ -1,21 +0,0 @@
1
- /**
2
- * Security utilities for path validation and sanitization
3
- */
4
- /**
5
- * Check if a resolved path is safely within the project root.
6
- * Prevents sibling directory access (e.g., /project-sensitive when root is /project)
7
- */
8
- export declare function isPathWithinRoot(filePath: string, rootPath: string): boolean;
9
- /**
10
- * Sanitize and validate a bundled path input.
11
- * Returns decoded path or null if invalid.
12
- */
13
- export declare function sanitizeBundledPath(bundledPath: string): string | null;
14
- /**
15
- * Check if a chunk filename is definitely internal (not user code)
16
- */
17
- export declare function isDefinitelyInternalChunk(filename: string): boolean;
18
- /**
19
- * Check if a resolved source path is framework code
20
- */
21
- export declare function isFrameworkCode(sourcePath: string): boolean;
@@ -1,41 +0,0 @@
1
- /**
2
- * Shared types for source map resolution
3
- */
4
- export interface OriginalPosition {
5
- source: string;
6
- line: number;
7
- column: number;
8
- name?: string;
9
- }
10
- /**
11
- * Source Map v3 JSON structure
12
- * Based on: https://sourcemaps.info/spec.html
13
- */
14
- export interface SourceMapV3 {
15
- version: number;
16
- file?: string;
17
- sourceRoot?: string;
18
- sources?: string[];
19
- sourcesContent?: (string | null)[];
20
- names?: string[];
21
- mappings?: string;
22
- sections?: SourceMapSection[];
23
- }
24
- export interface SourceMapSection {
25
- offset: {
26
- line: number;
27
- column: number;
28
- };
29
- map?: SourceMapV3;
30
- url?: string;
31
- }
32
- export interface ResolveContext {
33
- projectRoot: string;
34
- devServerUrl: string;
35
- }
36
- export interface SectionMatch {
37
- section: SourceMapSection;
38
- index: number;
39
- relativeLine: number;
40
- relativeColumn: number;
41
- }
@@ -1,16 +0,0 @@
1
- /**
2
- * Source map validation utilities
3
- */
4
- import type { SourceMapV3 } from "./types";
5
- export interface ValidationResult {
6
- valid: boolean;
7
- error?: string;
8
- }
9
- /**
10
- * Validate a source map v3 structure
11
- */
12
- export declare function validateSourceMap(json: unknown): ValidationResult;
13
- /**
14
- * Clean up source map structure before processing
15
- */
16
- export declare function prepareSourceMap(json: SourceMapV3): SourceMapV3;
@@ -1,25 +0,0 @@
1
- /**
2
- * Server-side source map resolution using @jridgewell/trace-mapping
3
- * Fetches bundled files from dev server and resolves to original source locations
4
- */
5
- import type { OriginalPosition } from "./source-map-resolver/types";
6
- import { clearCache } from "./source-map-resolver/cache";
7
- export type { OriginalPosition };
8
- export { clearCache as clearSourceMapCache };
9
- /**
10
- * Resolve a bundled file location to its original source location
11
- * @param projectRoot Root directory of the project (for file fallback)
12
- * @param devServerUrl Base URL of the dev server (e.g., http://localhost:3000)
13
- * @param bundledPath Path to the bundled file (e.g., /_next/static/chunks/app/page.js)
14
- * @param line Line number in bundled file (1-indexed)
15
- * @param column Column number in bundled file (0-indexed)
16
- */
17
- export declare function resolveSourceLocation(projectRoot: string, devServerUrl: string, bundledPath: string, line: number, column: number): Promise<OriginalPosition | null>;
18
- /**
19
- * Batch resolve multiple source locations with deduplication
20
- */
21
- export declare function batchResolveSourceLocations(projectRoot: string, devServerUrl: string, locations: Array<{
22
- bundledPath: string;
23
- line: number;
24
- column: number;
25
- }>): Promise<Array<OriginalPosition | null>>;