@easel-sh/cli 0.1.0-alpha.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.
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +195 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/create-lambda-gateway.d.ts +11 -0
- package/dist/commands/create-lambda-gateway.d.ts.map +1 -0
- package/dist/commands/create-lambda-gateway.js +409 -0
- package/dist/commands/create-lambda-gateway.js.map +1 -0
- package/dist/commands/generate-manifest.d.ts +7 -0
- package/dist/commands/generate-manifest.d.ts.map +1 -0
- package/dist/commands/generate-manifest.js +145 -0
- package/dist/commands/generate-manifest.js.map +1 -0
- package/dist/commands/list-functions.d.ts +7 -0
- package/dist/commands/list-functions.d.ts.map +1 -0
- package/dist/commands/list-functions.js +140 -0
- package/dist/commands/list-functions.js.map +1 -0
- package/dist/commands/package-functions.d.ts +9 -0
- package/dist/commands/package-functions.d.ts.map +1 -0
- package/dist/commands/package-functions.js +292 -0
- package/dist/commands/package-functions.js.map +1 -0
- package/dist/commands/upload-manifest.d.ts +7 -0
- package/dist/commands/upload-manifest.d.ts.map +1 -0
- package/dist/commands/upload-manifest.js +53 -0
- package/dist/commands/upload-manifest.js.map +1 -0
- package/dist/commands/upload-static.d.ts +7 -0
- package/dist/commands/upload-static.d.ts.map +1 -0
- package/dist/commands/upload-static.js +142 -0
- package/dist/commands/upload-static.js.map +1 -0
- package/dist/utils/types.d.ts +38 -0
- package/dist/utils/types.d.ts.map +1 -0
- package/dist/utils/types.js +2 -0
- package/dist/utils/types.js.map +1 -0
- package/dist/utils/vercel-config.d.ts +60 -0
- package/dist/utils/vercel-config.d.ts.map +1 -0
- package/dist/utils/vercel-config.js +121 -0
- package/dist/utils/vercel-config.js.map +1 -0
- package/dist/utils.d.ts +31 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +263 -0
- package/dist/utils.js.map +1 -0
- package/package.json +26 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import * as fs from 'fs';
|
|
2
|
+
import * as path from 'path';
|
|
3
|
+
export async function uploadManifest(options) {
|
|
4
|
+
const { manifestFile, hostname, serviceUrl } = options;
|
|
5
|
+
// Read manifest file
|
|
6
|
+
const manifestPath = path.resolve(manifestFile);
|
|
7
|
+
if (!fs.existsSync(manifestPath)) {
|
|
8
|
+
throw new Error(`Manifest file not found: ${manifestPath}`);
|
|
9
|
+
}
|
|
10
|
+
const manifestContent = fs.readFileSync(manifestPath, 'utf8');
|
|
11
|
+
let manifest;
|
|
12
|
+
try {
|
|
13
|
+
manifest = JSON.parse(manifestContent);
|
|
14
|
+
}
|
|
15
|
+
catch (error) {
|
|
16
|
+
throw new Error(`Failed to parse manifest JSON: ${error.message}`);
|
|
17
|
+
}
|
|
18
|
+
// Validate manifest structure
|
|
19
|
+
if (!manifest.routes || !Array.isArray(manifest.routes)) {
|
|
20
|
+
throw new Error('Invalid manifest: routes must be an array');
|
|
21
|
+
}
|
|
22
|
+
if (!manifest.fileManifest || !Array.isArray(manifest.fileManifest)) {
|
|
23
|
+
throw new Error('Invalid manifest: fileManifest must be an array');
|
|
24
|
+
}
|
|
25
|
+
if (!manifest.resourceManifest || !Array.isArray(manifest.resourceManifest)) {
|
|
26
|
+
throw new Error('Invalid manifest: resourceManifest must be an array');
|
|
27
|
+
}
|
|
28
|
+
// Upload to metadata service
|
|
29
|
+
const url = `${serviceUrl.replace(/\/$/, '')}/manifests/${encodeURIComponent(hostname)}`;
|
|
30
|
+
try {
|
|
31
|
+
const response = await fetch(url, {
|
|
32
|
+
method: 'POST',
|
|
33
|
+
headers: {
|
|
34
|
+
'Content-Type': 'application/json',
|
|
35
|
+
},
|
|
36
|
+
body: manifestContent,
|
|
37
|
+
});
|
|
38
|
+
if (!response.ok) {
|
|
39
|
+
const errorText = await response.text();
|
|
40
|
+
throw new Error(`Upload failed: ${response.status} ${response.statusText} - ${errorText}`);
|
|
41
|
+
}
|
|
42
|
+
const result = await response.json();
|
|
43
|
+
console.log(`✓ Manifest uploaded successfully for hostname: ${hostname}`);
|
|
44
|
+
console.log(` Service URL: ${serviceUrl}`);
|
|
45
|
+
}
|
|
46
|
+
catch (error) {
|
|
47
|
+
if (error instanceof TypeError && error.message.includes('fetch')) {
|
|
48
|
+
throw new Error(`Failed to connect to metadata service at ${serviceUrl}. Is it running?`);
|
|
49
|
+
}
|
|
50
|
+
throw error;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=upload-manifest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upload-manifest.js","sourceRoot":"","sources":["../../src/commands/upload-manifest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAQ7B,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,OAA8B;IACjE,MAAM,EAAE,YAAY,EAAE,QAAQ,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;IAEvD,qBAAqB;IACrB,MAAM,YAAY,GAAG,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;IAChD,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,YAAY,CAAC,EAAE,CAAC;QACjC,MAAM,IAAI,KAAK,CAAC,4BAA4B,YAAY,EAAE,CAAC,CAAC;IAC9D,CAAC;IAED,MAAM,eAAe,GAAG,EAAE,CAAC,YAAY,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;IAC9D,IAAI,QAAa,CAAC;IAClB,IAAI,CAAC;QACH,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;IACzC,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,MAAM,IAAI,KAAK,CAAC,kCAAkC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;IACrE,CAAC;IAED,8BAA8B;IAC9B,IAAI,CA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AkB,UAAU,EAAE,CAAC,CAAC;IAC9C,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,IAAI,KAAK,YAAY,SAAS,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;YAClE,MAAM,IAAI,KAAK,CAAC,4CAA4C,UAAU,kBAAkB,CAAC,CAAC;QAC5F,CAAC;QACD,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upload-static.d.ts","sourceRoot":"","sources":["../../src/commands/upload-static.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,mBAAmB;IAClC,eAAe,EAAE,MAAM,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;CACpB;AA8FD,wBAAsB,YAAY,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CAsF9E"}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import * as fs from 'fs';
|
|
2
|
+
import * as path from 'path';
|
|
3
|
+
import { resolveVercelOutputDir } from '../utils.js';
|
|
4
|
+
/**
|
|
5
|
+
* Recursively scan static directory and collect all files
|
|
6
|
+
*/
|
|
7
|
+
function scanStaticDirectory(staticDir) {
|
|
8
|
+
const files = [];
|
|
9
|
+
function scanRecursive(currentDir, baseDir) {
|
|
10
|
+
if (!fs.existsSync(currentDir)) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
const entries = fs.readdirSync(currentDir, { withFileTypes: true });
|
|
14
|
+
for (const entry of entries) {
|
|
15
|
+
const fullPath = path.join(currentDir, entry.name);
|
|
16
|
+
if (entry.isDirectory()) {
|
|
17
|
+
scanRecursive(fullPath, baseDir);
|
|
18
|
+
}
|
|
19
|
+
else if (entry.isFile()) {
|
|
20
|
+
const relativePath = path.relative(baseDir, fullPath);
|
|
21
|
+
// Convert to web path format (forward slashes, leading slash)
|
|
22
|
+
const webPath = '/' + relativePath.split(path.sep).join('/');
|
|
23
|
+
try {
|
|
24
|
+
const content = fs.readFileSync(fullPath);
|
|
25
|
+
files.push({
|
|
26
|
+
filePath: fullPath,
|
|
27
|
+
relativePath: webPath,
|
|
28
|
+
content,
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
console.warn(`Warning: Failed to read file ${fullPath}: ${error.message}`);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
scanRecursive(staticDir, staticDir);
|
|
38
|
+
return files;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Get MIME type from file extension
|
|
42
|
+
* Note: We always use application/octet-stream for uploads to avoid any
|
|
43
|
+
* content-type parsing issues. We just need to store the binary data.
|
|
44
|
+
*/
|
|
45
|
+
function getMimeType(filePath) {
|
|
46
|
+
// Always use octet-stream - we just need to store the binary blob
|
|
47
|
+
return 'application/octet-stream';
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Upload a single file to the metadata service
|
|
51
|
+
*/
|
|
52
|
+
async function uploadFile(serviceUrl, hostname, file) {
|
|
53
|
+
const url = `${serviceUrl.replace(/\/$/, '')}/static/${encodeURIComponent(hostname)}`;
|
|
54
|
+
// Determine content type
|
|
55
|
+
const contentType = getMimeType(file.relativePath);
|
|
56
|
+
try {
|
|
57
|
+
const response = await fetch(url, {
|
|
58
|
+
method: 'POST',
|
|
59
|
+
headers: {
|
|
60
|
+
'Content-Type': contentType,
|
|
61
|
+
'X-File-Path': file.relativePath,
|
|
62
|
+
},
|
|
63
|
+
body: file.content,
|
|
64
|
+
});
|
|
65
|
+
if (!response.ok) {
|
|
66
|
+
const errorText = await response.text();
|
|
67
|
+
throw new Error(`Upload failed: ${response.status} ${response.statusText} - ${errorText}`);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
catch (error) {
|
|
71
|
+
if (error instanceof TypeError && error.message.includes('fetch')) {
|
|
72
|
+
throw new Error(`Failed to connect to metadata service at ${serviceUrl}. Is it running?`);
|
|
73
|
+
}
|
|
74
|
+
throw error;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
export async function uploadStatic(options) {
|
|
78
|
+
const { vercelOutputDir, hostname, serviceUrl } = options;
|
|
79
|
+
// Resolve base Vercel output directory
|
|
80
|
+
const baseDir = resolveVercelOutputDir(vercelOutputDir);
|
|
81
|
+
const staticDir = path.join(baseDir, "static");
|
|
82
|
+
// Check if static directory exists
|
|
83
|
+
if (!fs.existsSync(staticDir)) {
|
|
84
|
+
throw new Error(`Static directory not found: ${staticDir}`);
|
|
85
|
+
}
|
|
86
|
+
if (!fs.statSync(staticDir).isDirectory()) {
|
|
87
|
+
throw new Error(`Path is not a directory: ${staticDir}`);
|
|
88
|
+
}
|
|
89
|
+
console.log(`Scanning static directory: ${staticDir}`);
|
|
90
|
+
const files = scanStaticDirectory(staticDir);
|
|
91
|
+
if (files.length === 0) {
|
|
92
|
+
console.warn("No files found in static directory");
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
console.log(`Found ${files.length} file(s) to upload`);
|
|
96
|
+
console.log(`Uploading to metadata service at ${serviceUrl}...`);
|
|
97
|
+
// Upload files with rolling concurrency (maintain exactly N concurrent uploads)
|
|
98
|
+
const CONCURRENCY = 50; // Upload 50 files concurrently for maximum speed
|
|
99
|
+
let completed = 0;
|
|
100
|
+
const errors = [];
|
|
101
|
+
// Rolling concurrency: maintain exactly N concurrent operations
|
|
102
|
+
// As soon as one finishes, start the next one
|
|
103
|
+
const executing = new Set();
|
|
104
|
+
for (const file of files) {
|
|
105
|
+
// Create the upload promise
|
|
106
|
+
const uploadPromise = (async () => {
|
|
107
|
+
try {
|
|
108
|
+
await uploadFile(serviceUrl, hostname, file);
|
|
109
|
+
completed++;
|
|
110
|
+
process.stdout.write(`\rProgress: ${completed}/${files.length} files uploaded`);
|
|
111
|
+
}
|
|
112
|
+
catch (error) {
|
|
113
|
+
errors.push({ file: file.relativePath, error: error.message });
|
|
114
|
+
console.error(`\nFailed to upload ${file.relativePath}: ${error.message}`);
|
|
115
|
+
}
|
|
116
|
+
})();
|
|
117
|
+
// Add to executing set
|
|
118
|
+
executing.add(uploadPromise);
|
|
119
|
+
// Remove from executing set when done
|
|
120
|
+
uploadPromise.finally(() => {
|
|
121
|
+
executing.delete(uploadPromise);
|
|
122
|
+
});
|
|
123
|
+
// If we've hit the concurrency limit, wait for one to finish
|
|
124
|
+
if (executing.size >= CONCURRENCY) {
|
|
125
|
+
await Promise.race(executing);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
// Wait for all remaining uploads to complete
|
|
129
|
+
await Promise.all(executing);
|
|
130
|
+
const uploaded = completed;
|
|
131
|
+
const failed = errors.length;
|
|
132
|
+
console.log(`\n✓ Upload complete: ${uploaded} succeeded, ${failed} failed`);
|
|
133
|
+
if (errors.length > 0) {
|
|
134
|
+
console.error("\nErrors:");
|
|
135
|
+
for (const { file, error } of errors) {
|
|
136
|
+
console.error(` - ${file}: ${error}`);
|
|
137
|
+
}
|
|
138
|
+
throw new Error(`Failed to upload ${failed} file(s)`);
|
|
139
|
+
}
|
|
140
|
+
console.log(`✓ All static assets uploaded successfully for hostname: ${hostname}`);
|
|
141
|
+
}
|
|
142
|
+
//# sourceMappingURL=upload-static.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upload-static.js","sourceRoot":"","sources":["../../src/commands/upload-static.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAcrD;;GAEG;AACH,SAAS,mBAAmB,CAAC,SAAiB;IAC5C,MAAM,KAAK,GAAe,EAAE,CAAC;IAE7B,SAAS,aAAa,CAAC,UAAkB,EAAE,OAAe;QAC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AAC,CAAC;QACzC,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,oBAAoB,MAAM,UAAU,CAAC,CAAC;IACxD,CAAC;IAED,OAAO,CAAC,GAAG,CACT,2DAA2D,QAAQ,EAAE,CACtE,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export interface Route {
|
|
2
|
+
handle?: string;
|
|
3
|
+
src?: string;
|
|
4
|
+
dest?: string;
|
|
5
|
+
headers?: Record<string, string>;
|
|
6
|
+
methods?: string[];
|
|
7
|
+
continue?: boolean;
|
|
8
|
+
caseSensitive?: boolean;
|
|
9
|
+
check?: boolean;
|
|
10
|
+
status?: number;
|
|
11
|
+
has?: any[];
|
|
12
|
+
missing?: any[];
|
|
13
|
+
locale?: {
|
|
14
|
+
redirect?: Record<string, string>;
|
|
15
|
+
cookie?: string;
|
|
16
|
+
};
|
|
17
|
+
mitigate?: {
|
|
18
|
+
action: string;
|
|
19
|
+
};
|
|
20
|
+
transforms?: any[];
|
|
21
|
+
override?: boolean;
|
|
22
|
+
important?: boolean;
|
|
23
|
+
}
|
|
24
|
+
export interface FileManifestEntry {
|
|
25
|
+
match: string;
|
|
26
|
+
path: string;
|
|
27
|
+
contentType?: string;
|
|
28
|
+
}
|
|
29
|
+
export type FileManifestItem = string | FileManifestEntry;
|
|
30
|
+
export interface DeploymentManifest {
|
|
31
|
+
routes: Route[];
|
|
32
|
+
fileManifest: FileManifestItem[];
|
|
33
|
+
resourceManifest: string[];
|
|
34
|
+
resourceHashes?: Record<string, string>;
|
|
35
|
+
version?: string;
|
|
36
|
+
createdAt?: string;
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/utils/types.ts"],"names":[],"mappings":"AACA,MAAM,WAAW,KAAK;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAA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js","sourceRoot":"","sources":["../../src/utils/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { Route } from './types.js';
|
|
2
|
+
export interface FileOverride {
|
|
3
|
+
path?: string;
|
|
4
|
+
contentType?: string;
|
|
5
|
+
}
|
|
6
|
+
export interface VercelConfig {
|
|
7
|
+
routes?: VercelRoute[];
|
|
8
|
+
overrides?: Record<string, FileOverride>;
|
|
9
|
+
[key: string]: any;
|
|
10
|
+
}
|
|
11
|
+
export interface VercelRoute {
|
|
12
|
+
src?: string;
|
|
13
|
+
dest?: string;
|
|
14
|
+
headers?: Record<string, string>;
|
|
15
|
+
methods?: string[];
|
|
16
|
+
continue?: boolean;
|
|
17
|
+
caseSensitive?: boolean;
|
|
18
|
+
check?: boolean;
|
|
19
|
+
status?: number;
|
|
20
|
+
has?: VercelHasCondition[];
|
|
21
|
+
missing?: VercelHasCondition[];
|
|
22
|
+
locale?: {
|
|
23
|
+
redirect?: Record<string, string>;
|
|
24
|
+
cookie?: string;
|
|
25
|
+
};
|
|
26
|
+
mitigate?: {
|
|
27
|
+
action: string;
|
|
28
|
+
};
|
|
29
|
+
transforms?: VercelTransform[];
|
|
30
|
+
override?: boolean;
|
|
31
|
+
important?: boolean;
|
|
32
|
+
handle?: string;
|
|
33
|
+
}
|
|
34
|
+
export interface VercelHasCondition {
|
|
35
|
+
type: string;
|
|
36
|
+
key?: string;
|
|
37
|
+
value?: string | any;
|
|
38
|
+
}
|
|
39
|
+
export interface VercelTransform {
|
|
40
|
+
type: string;
|
|
41
|
+
op: string;
|
|
42
|
+
target: any;
|
|
43
|
+
args?: any;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Parse Vercel config.json and convert routes to our Route format
|
|
47
|
+
*/
|
|
48
|
+
export declare function parseVercelConfig(configPath: string): Route[];
|
|
49
|
+
/**
|
|
50
|
+
* Parse overrides from config.json
|
|
51
|
+
*/
|
|
52
|
+
export declare function parseOverrides(configPath: string): Record<string, {
|
|
53
|
+
path?: string;
|
|
54
|
+
contentType?: string;
|
|
55
|
+
}>;
|
|
56
|
+
/**
|
|
57
|
+
* Scan static files directory to build file manifest
|
|
58
|
+
*/
|
|
59
|
+
export declare function buildFileManifest(staticDir: string): string[];
|
|
60
|
+
//# sourceMappingURL=vercel-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vercel-config.d.ts","sourceRoot":"","sources":["../../src/utils/vercel-config.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAExC,MAAM,WAAW,YAAY;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,CAAC,EAAE,WAAW,EAAE,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IACzC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED,MAAM,WAAW,WAAW;IAC1B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,kBAAkB,EAAE,CAAC;IAC3B,OAAO,CAAC,EAAE,kBAAkB,EAAE,CAAC;IAC/B,MAAM,CAAC,EAAE;QACP,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAClC,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB,CAAC;IACF,QAAQ,CAAC,EAAE;QACT,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,UAAU,CAAC,EAAE,eAAe,EAAE,CAAC;IAC/B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC;CACtB;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,GAAG,CAAC;IACZ,IAAI,CAAC,EAAE,GAAG,CAAC;CACZ;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAG,KAAK,EAAE,CAa7D;AA0ED;;GAEG;AACH,wBAAgB,cAAc,CAC5B,UAAU,EAAE,MAAM,GACjB,MAAM,CAAC,MAAM,EAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CASzD;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,CA0B7D"}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import * as fs from 'fs';
|
|
2
|
+
import * as path from 'path';
|
|
3
|
+
/**
|
|
4
|
+
* Parse Vercel config.json and convert routes to our Route format
|
|
5
|
+
*/
|
|
6
|
+
export function parseVercelConfig(configPath) {
|
|
7
|
+
if (!fs.existsSync(configPath)) {
|
|
8
|
+
throw new Error(`Config file not found: ${configPath}`);
|
|
9
|
+
}
|
|
10
|
+
const configContent = fs.readFileSync(configPath, "utf8");
|
|
11
|
+
const config = JSON.parse(configContent);
|
|
12
|
+
if (!config.routes || !Array.isArray(config.routes)) {
|
|
13
|
+
return [];
|
|
14
|
+
}
|
|
15
|
+
return config.routes.map(convertVercelRoute);
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Convert a Vercel route to our Route format
|
|
19
|
+
*/
|
|
20
|
+
function convertVercelRoute(vercelRoute) {
|
|
21
|
+
const route = {};
|
|
22
|
+
// Handle field
|
|
23
|
+
if (vercelRoute.handle) {
|
|
24
|
+
route.handle = vercelRoute.handle;
|
|
25
|
+
}
|
|
26
|
+
// Source fields
|
|
27
|
+
if (vercelRoute.src) {
|
|
28
|
+
route.src = vercelRoute.src;
|
|
29
|
+
}
|
|
30
|
+
if (vercelRoute.dest !== undefined) {
|
|
31
|
+
route.dest = vercelRoute.dest;
|
|
32
|
+
}
|
|
33
|
+
if (vercelRoute.headers) {
|
|
34
|
+
route.headers = vercelRoute.headers;
|
|
35
|
+
}
|
|
36
|
+
if (vercelRoute.methods) {
|
|
37
|
+
route.methods = vercelRoute.methods;
|
|
38
|
+
}
|
|
39
|
+
if (vercelRoute.continue !== undefined) {
|
|
40
|
+
route.continue = vercelRoute.continue;
|
|
41
|
+
}
|
|
42
|
+
if (vercelRoute.caseSensitive !== undefined) {
|
|
43
|
+
route.caseSensitive = vercelRoute.caseSensitive;
|
|
44
|
+
}
|
|
45
|
+
if (vercelRoute.check !== undefined) {
|
|
46
|
+
route.check = vercelRoute.check;
|
|
47
|
+
}
|
|
48
|
+
if (vercelRoute.status !== undefined) {
|
|
49
|
+
route.status = vercelRoute.status;
|
|
50
|
+
}
|
|
51
|
+
if (vercelRoute.has) {
|
|
52
|
+
route.has = vercelRoute.has.map(convertHasCondition);
|
|
53
|
+
}
|
|
54
|
+
if (vercelRoute.missing) {
|
|
55
|
+
route.missing = vercelRoute.missing.map(convertHasCondition);
|
|
56
|
+
}
|
|
57
|
+
if (vercelRoute.locale) {
|
|
58
|
+
route.locale = vercelRoute.locale;
|
|
59
|
+
}
|
|
60
|
+
if (vercelRoute.mitigate) {
|
|
61
|
+
route.mitigate = vercelRoute.mitigate;
|
|
62
|
+
}
|
|
63
|
+
if (vercelRoute.transforms) {
|
|
64
|
+
route.transforms = vercelRoute.transforms;
|
|
65
|
+
}
|
|
66
|
+
if (vercelRoute.override !== undefined) {
|
|
67
|
+
route.override = vercelRoute.override;
|
|
68
|
+
}
|
|
69
|
+
if (vercelRoute.important !== undefined) {
|
|
70
|
+
route.important = vercelRoute.important;
|
|
71
|
+
}
|
|
72
|
+
return route;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Convert Vercel has condition to our format
|
|
76
|
+
*/
|
|
77
|
+
function convertHasCondition(condition) {
|
|
78
|
+
return {
|
|
79
|
+
type: condition.type,
|
|
80
|
+
key: condition.key,
|
|
81
|
+
value: condition.value,
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Parse overrides from config.json
|
|
86
|
+
*/
|
|
87
|
+
export function parseOverrides(configPath) {
|
|
88
|
+
if (!fs.existsSync(configPath)) {
|
|
89
|
+
return {};
|
|
90
|
+
}
|
|
91
|
+
const configContent = fs.readFileSync(configPath, "utf8");
|
|
92
|
+
const config = JSON.parse(configContent);
|
|
93
|
+
return config.overrides || {};
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Scan static files directory to build file manifest
|
|
97
|
+
*/
|
|
98
|
+
export function buildFileManifest(staticDir) {
|
|
99
|
+
const files = [];
|
|
100
|
+
function scanDirectory(dir, baseDir) {
|
|
101
|
+
if (!fs.existsSync(dir)) {
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
const entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
105
|
+
for (const entry of entries) {
|
|
106
|
+
const fullPath = path.join(dir, entry.name);
|
|
107
|
+
const relativePath = path.relative(baseDir, fullPath);
|
|
108
|
+
if (entry.isDirectory()) {
|
|
109
|
+
scanDirectory(fullPath, baseDir);
|
|
110
|
+
}
|
|
111
|
+
else if (entry.isFile()) {
|
|
112
|
+
// Convert to web path format (forward slashes, leading slash)
|
|
113
|
+
const webPath = '/' + relativePath.split(path.sep).join('/');
|
|
114
|
+
files.push(webPath);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
scanDirectory(staticDir, staticDir);
|
|
119
|
+
return files.sort();
|
|
120
|
+
}
|
|
121
|
+
//# sourceMappingURL=vercel-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vercel-config.js","sourceRoot":"","sources":["../../src/utils/vercel-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAmD7B;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAC,UAAkB;IAClD,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;QAC/B,MAAM,IAAI,KAAK,CAAC,0BAA0B,UAAU,EAAE,CAAC,CAAC;IAC1D,CAAC;IAED,MAAM,aAAa,GAAG,EAAE,CAAC,YAAY,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;IAC1D,MAAM,MAAM,GAAiB,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;IAEvD,IAAI,CAAC,MAAM,CAAC,MAAM,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;QACpD,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,OAAO,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;AAC/C,CAAC;AAED;;GAEG;AACH,SAAS,kBAAkB,CAAC,WAAwB;IAClD,MAAM,KAAK,GAAU,EAAE,CAAC;IAExB,eAAe;IACf,IAAI,WAAW,CAAC,MAAM,EAAE,CAAC;QACvB,KAAK,CAAC,MAAM,GAAG,WAAW,CAAC,MAAa,CAAC;IAC3C,CAAC;IAED,gBAAgB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AAC,GAAW,EAAE,OAAe;QACjD,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;YACxB,OAAO;QACT,CAAC;QAED,MAAM,OAAO,GAAG,EAAE,CAAC,WAAW,CAAC,GAAG,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC;QAE7D,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;YAC5B,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;YAC5C,MAAM,YAAY,GAAG,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;YAEtD,IAAI,KAAK,CAAC,WAAW,EAAE,EAAE,CAAC;gBACxB,aAAa,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;YACnC,CAAC;iBAAM,IAAI,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC;gBAC1B,8DAA8D;gBAC9D,MAAM,OAAO,GAAG,GAAG,GAAG,YAAY,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;gBAC7D,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YACtB,CAAC;QACH,CAAC;IACH,CAAC;IAED,aAAa,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;IACpC,OAAO,KAAK,CAAC,IAAI,EAAE,CAAC;AACtB,CAAC"}
|
package/dist/utils.d.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolve the Vercel output directory from a given path
|
|
3
|
+
* Handles cases where the path points to:
|
|
4
|
+
* - .vercel/output (use as-is)
|
|
5
|
+
* - .vercel (append 'output')
|
|
6
|
+
* - project root or other (append '.vercel/output')
|
|
7
|
+
*/
|
|
8
|
+
export declare function resolveVercelOutputDir(inputDir: string): string;
|
|
9
|
+
/**
|
|
10
|
+
* Find the workspace root (where the Next.js app is located)
|
|
11
|
+
*/
|
|
12
|
+
export declare function findWorkspaceRoot(): string;
|
|
13
|
+
export interface FunctionInfo {
|
|
14
|
+
resourceName: string;
|
|
15
|
+
configPath: string;
|
|
16
|
+
funcDir: string;
|
|
17
|
+
hash?: string;
|
|
18
|
+
prerenderConfigPath?: string;
|
|
19
|
+
prerenderFallbackPath?: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Recursively scan a directory for .func directories that contain .vc-config.json
|
|
23
|
+
* Follows symlinks to find all functions
|
|
24
|
+
*/
|
|
25
|
+
export declare function scanFunctions(dir: string, baseDir: string): FunctionInfo[];
|
|
26
|
+
/**
|
|
27
|
+
* Calculate a deterministic hash for a function directory
|
|
28
|
+
* Similar to the bash script: uses sorted file names and contents
|
|
29
|
+
*/
|
|
30
|
+
export declare function hashFunctionDirectory(funcDir: string): string;
|
|
31
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAOA;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAc/D;AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CAyC1C;AAED,MAAM,WAAW,YAAY;IAC3B,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,qBAAqB,CAAC,EAAE,MAAM,CAAC;CAChC;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,YAAY,EAAE,CA0I1E;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAgE7D"}
|