@chuckcchen/vite-plugin 0.0.2 → 0.0.4
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/bundler.d.ts +27 -27
- package/dist/bundler.js +89 -89
- package/dist/bundler.js.map +1 -1
- package/dist/core.d.ts +14 -14
- package/dist/core.d.ts.map +1 -1
- package/dist/core.js +179 -150
- package/dist/core.js.map +1 -1
- package/dist/factory.d.ts +124 -0
- package/dist/factory.d.ts.map +1 -0
- package/dist/factory.js +264 -0
- package/dist/factory.js.map +1 -0
- package/dist/helpers.d.ts +40 -0
- package/dist/helpers.d.ts.map +1 -0
- package/dist/helpers.js +166 -0
- package/dist/helpers.js.map +1 -0
- package/dist/index.d.ts +8 -75
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -56
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +113 -113
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +3 -3
- package/dist/utils.d.ts +56 -56
- package/dist/utils.js +68 -68
- package/dist/utils.js.map +1 -1
- package/package.json +2 -1
package/dist/utils.d.ts
CHANGED
|
@@ -1,43 +1,43 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* EdgeOne Vite Plugin Adapter -
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* -
|
|
6
|
-
* -
|
|
7
|
-
* -
|
|
8
|
-
* -
|
|
9
|
-
* -
|
|
2
|
+
* EdgeOne Vite Plugin Adapter - Utility Functions Module
|
|
3
|
+
*
|
|
4
|
+
* This module provides a set of general utility functions, including:
|
|
5
|
+
* - Logging
|
|
6
|
+
* - File system operations (read, write, copy, delete, etc.)
|
|
7
|
+
* - Path detection
|
|
8
|
+
* - File size formatting
|
|
9
|
+
* - Conditional waiting, etc.
|
|
10
10
|
*/
|
|
11
11
|
import type { Logger } from "./types.js";
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
13
|
+
* Create logger instance
|
|
14
14
|
*
|
|
15
|
-
* @param verbose -
|
|
16
|
-
* @returns
|
|
15
|
+
* @param verbose - Enable verbose logging mode, default is false
|
|
16
|
+
* @returns Logger object with log, verbose, warn, error methods
|
|
17
17
|
*
|
|
18
18
|
* @example
|
|
19
19
|
* const logger = createLogger(true);
|
|
20
|
-
* logger.verbose("
|
|
21
|
-
* logger.warn("
|
|
20
|
+
* logger.verbose("This message only shows in verbose mode");
|
|
21
|
+
* logger.warn("This is a warning message");
|
|
22
22
|
*/
|
|
23
23
|
export declare function createLogger(verbose?: boolean): Logger;
|
|
24
24
|
/**
|
|
25
|
-
*
|
|
25
|
+
* Check if specified path exists
|
|
26
26
|
*
|
|
27
|
-
* @param filePath -
|
|
28
|
-
* @returns
|
|
27
|
+
* @param filePath - File or directory path to check
|
|
28
|
+
* @returns True if path exists, false otherwise
|
|
29
29
|
*
|
|
30
30
|
* @example
|
|
31
31
|
* if (await pathExists('/path/to/file')) {
|
|
32
|
-
* console.log('
|
|
32
|
+
* console.log('File exists');
|
|
33
33
|
* }
|
|
34
34
|
*/
|
|
35
35
|
export declare function pathExists(filePath: string): Promise<boolean>;
|
|
36
36
|
/**
|
|
37
|
-
*
|
|
37
|
+
* Find first existing path from candidate list
|
|
38
38
|
*
|
|
39
|
-
* @param candidates -
|
|
40
|
-
* @returns
|
|
39
|
+
* @param candidates - Candidate paths array, sorted by priority
|
|
40
|
+
* @returns First existing path, or null if none exist
|
|
41
41
|
*
|
|
42
42
|
* @example
|
|
43
43
|
* const buildDir = await findExistingPath([
|
|
@@ -48,71 +48,71 @@ export declare function pathExists(filePath: string): Promise<boolean>;
|
|
|
48
48
|
*/
|
|
49
49
|
export declare function findExistingPath(candidates: string[]): Promise<string | null>;
|
|
50
50
|
/**
|
|
51
|
-
*
|
|
52
|
-
*
|
|
51
|
+
* Recursively copy directory
|
|
52
|
+
* Copy all contents from source directory to destination directory
|
|
53
53
|
*
|
|
54
|
-
* @param src -
|
|
55
|
-
* @param dest -
|
|
54
|
+
* @param src - Source directory path
|
|
55
|
+
* @param dest - Destination directory path
|
|
56
56
|
*
|
|
57
57
|
* @example
|
|
58
58
|
* await copyDirectory('dist/client', '.edgeone/assets');
|
|
59
59
|
*/
|
|
60
60
|
export declare function copyDirectory(src: string, dest: string): Promise<void>;
|
|
61
61
|
/**
|
|
62
|
-
*
|
|
63
|
-
*
|
|
62
|
+
* Clean directory (delete and recreate)
|
|
63
|
+
* Used to ensure directory is in a clean empty state
|
|
64
64
|
*
|
|
65
|
-
* @param dir -
|
|
65
|
+
* @param dir - Directory path to clean
|
|
66
66
|
*
|
|
67
67
|
* @example
|
|
68
68
|
* await cleanDirectory('.edgeone');
|
|
69
69
|
*/
|
|
70
70
|
export declare function cleanDirectory(dir: string): Promise<void>;
|
|
71
71
|
/**
|
|
72
|
-
*
|
|
73
|
-
*
|
|
72
|
+
* Ensure directory exists
|
|
73
|
+
* Recursively create if directory doesn't exist
|
|
74
74
|
*
|
|
75
|
-
* @param dir -
|
|
75
|
+
* @param dir - Directory path
|
|
76
76
|
*
|
|
77
77
|
* @example
|
|
78
78
|
* await ensureDirectory('.edgeone/server-handler');
|
|
79
79
|
*/
|
|
80
80
|
export declare function ensureDirectory(dir: string): Promise<void>;
|
|
81
81
|
/**
|
|
82
|
-
*
|
|
82
|
+
* Read file content as string
|
|
83
83
|
*
|
|
84
|
-
* @param filePath -
|
|
85
|
-
* @returns
|
|
84
|
+
* @param filePath - File path
|
|
85
|
+
* @returns File content string (UTF-8 encoded)
|
|
86
86
|
*
|
|
87
87
|
* @example
|
|
88
88
|
* const content = await readFile('dist/server/index.js');
|
|
89
89
|
*/
|
|
90
90
|
export declare function readFile(filePath: string): Promise<string>;
|
|
91
91
|
/**
|
|
92
|
-
*
|
|
93
|
-
*
|
|
92
|
+
* Write content to file
|
|
93
|
+
* Automatically creates parent directory if it doesn't exist
|
|
94
94
|
*
|
|
95
|
-
* @param filePath -
|
|
96
|
-
* @param content -
|
|
95
|
+
* @param filePath - File path
|
|
96
|
+
* @param content - Content to write
|
|
97
97
|
*
|
|
98
98
|
* @example
|
|
99
99
|
* await writeFile('.edgeone/meta.json', JSON.stringify(config));
|
|
100
100
|
*/
|
|
101
101
|
export declare function writeFile(filePath: string, content: string): Promise<void>;
|
|
102
102
|
/**
|
|
103
|
-
*
|
|
103
|
+
* Delete file
|
|
104
104
|
*
|
|
105
|
-
* @param filePath -
|
|
105
|
+
* @param filePath - File path to delete
|
|
106
106
|
*
|
|
107
107
|
* @example
|
|
108
108
|
* await deleteFile('server-wrapper.temp.js');
|
|
109
109
|
*/
|
|
110
110
|
export declare function deleteFile(filePath: string): Promise<void>;
|
|
111
111
|
/**
|
|
112
|
-
*
|
|
112
|
+
* Format file size to human-readable string
|
|
113
113
|
*
|
|
114
|
-
* @param bytes -
|
|
115
|
-
* @returns
|
|
114
|
+
* @param bytes - Number of bytes
|
|
115
|
+
* @returns Formatted string, e.g. "1.5 KB", "2.3 MB"
|
|
116
116
|
*
|
|
117
117
|
* @example
|
|
118
118
|
* formatSize(1536); // "1.5 KB"
|
|
@@ -120,14 +120,14 @@ export declare function deleteFile(filePath: string): Promise<void>;
|
|
|
120
120
|
*/
|
|
121
121
|
export declare function formatSize(bytes: number): string;
|
|
122
122
|
/**
|
|
123
|
-
*
|
|
124
|
-
*
|
|
123
|
+
* Wait for condition to be met (with retry mechanism)
|
|
124
|
+
* Used to wait for async operations to complete, like file writes
|
|
125
125
|
*
|
|
126
|
-
* @param condition -
|
|
127
|
-
* @param options -
|
|
128
|
-
* @param options.maxRetries -
|
|
129
|
-
* @param options.delay -
|
|
130
|
-
* @returns
|
|
126
|
+
* @param condition - Async condition function returning boolean
|
|
127
|
+
* @param options - Configuration options
|
|
128
|
+
* @param options.maxRetries - Maximum retry count, default 15
|
|
129
|
+
* @param options.delay - Delay between retries in milliseconds, default 300ms
|
|
130
|
+
* @returns True if condition met, false if timeout
|
|
131
131
|
*
|
|
132
132
|
* @example
|
|
133
133
|
* const ready = await waitFor(
|
|
@@ -140,10 +140,10 @@ export declare function waitFor(condition: () => Promise<boolean>, options?: {
|
|
|
140
140
|
delay?: number;
|
|
141
141
|
}): Promise<boolean>;
|
|
142
142
|
/**
|
|
143
|
-
*
|
|
143
|
+
* List files and subdirectory names in directory
|
|
144
144
|
*
|
|
145
|
-
* @param dir -
|
|
146
|
-
* @returns
|
|
145
|
+
* @param dir - Directory path
|
|
146
|
+
* @returns Array of file and directory names, empty array if directory doesn't exist
|
|
147
147
|
*
|
|
148
148
|
* @example
|
|
149
149
|
* const files = await listFiles('dist/client');
|
|
@@ -151,14 +151,14 @@ export declare function waitFor(condition: () => Promise<boolean>, options?: {
|
|
|
151
151
|
*/
|
|
152
152
|
export declare function listFiles(dir: string): Promise<string[]>;
|
|
153
153
|
/**
|
|
154
|
-
*
|
|
154
|
+
* Recursively count files in directory
|
|
155
155
|
*
|
|
156
|
-
* @param dir -
|
|
157
|
-
* @returns
|
|
156
|
+
* @param dir - Directory path
|
|
157
|
+
* @returns Total file count (excluding directories)
|
|
158
158
|
*
|
|
159
159
|
* @example
|
|
160
160
|
* const count = await countFiles('dist');
|
|
161
|
-
* console.log(
|
|
161
|
+
* console.log(`Build artifacts contain ${count} files`);
|
|
162
162
|
*/
|
|
163
163
|
export declare function countFiles(dir: string): Promise<number>;
|
|
164
164
|
//# sourceMappingURL=utils.d.ts.map
|
package/dist/utils.js
CHANGED
|
@@ -1,57 +1,57 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* EdgeOne Vite Plugin Adapter -
|
|
2
|
+
* EdgeOne Vite Plugin Adapter - Utility Functions Module
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
* -
|
|
6
|
-
* -
|
|
7
|
-
* -
|
|
8
|
-
* -
|
|
9
|
-
* -
|
|
4
|
+
* This module provides a set of general utility functions, including:
|
|
5
|
+
* - Logging
|
|
6
|
+
* - File system operations (read, write, copy, delete, etc.)
|
|
7
|
+
* - Path detection
|
|
8
|
+
* - File size formatting
|
|
9
|
+
* - Conditional waiting, etc.
|
|
10
10
|
*/
|
|
11
11
|
import fs from "fs/promises";
|
|
12
12
|
import path from "path";
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
14
|
+
* Create logger instance
|
|
15
15
|
*
|
|
16
|
-
* @param verbose -
|
|
17
|
-
* @returns
|
|
16
|
+
* @param verbose - Enable verbose logging mode, default is false
|
|
17
|
+
* @returns Logger object with log, verbose, warn, error methods
|
|
18
18
|
*
|
|
19
19
|
* @example
|
|
20
20
|
* const logger = createLogger(true);
|
|
21
|
-
* logger.verbose("
|
|
22
|
-
* logger.warn("
|
|
21
|
+
* logger.verbose("This message only shows in verbose mode");
|
|
22
|
+
* logger.warn("This is a warning message");
|
|
23
23
|
*/
|
|
24
24
|
export function createLogger(verbose = false) {
|
|
25
25
|
return {
|
|
26
|
-
//
|
|
26
|
+
// Normal log, always outputs
|
|
27
27
|
log: (message, ...args) => {
|
|
28
28
|
console.log(`[EdgeOne Adapter] ${message}`, ...args);
|
|
29
29
|
},
|
|
30
|
-
//
|
|
30
|
+
// Verbose log, only outputs in verbose mode
|
|
31
31
|
verbose: (message, ...args) => {
|
|
32
32
|
if (verbose) {
|
|
33
33
|
console.log(`[EdgeOne Adapter] ${message}`, ...args);
|
|
34
34
|
}
|
|
35
35
|
},
|
|
36
|
-
//
|
|
36
|
+
// Warning log with warning icon
|
|
37
37
|
warn: (message, ...args) => {
|
|
38
38
|
console.warn(`[EdgeOne Adapter] ⚠️ ${message}`, ...args);
|
|
39
39
|
},
|
|
40
|
-
//
|
|
40
|
+
// Error log with error icon
|
|
41
41
|
error: (message, ...args) => {
|
|
42
42
|
console.error(`[EdgeOne Adapter] ❌ ${message}`, ...args);
|
|
43
43
|
},
|
|
44
44
|
};
|
|
45
45
|
}
|
|
46
46
|
/**
|
|
47
|
-
*
|
|
47
|
+
* Check if specified path exists
|
|
48
48
|
*
|
|
49
|
-
* @param filePath -
|
|
50
|
-
* @returns
|
|
49
|
+
* @param filePath - File or directory path to check
|
|
50
|
+
* @returns True if path exists, false otherwise
|
|
51
51
|
*
|
|
52
52
|
* @example
|
|
53
53
|
* if (await pathExists('/path/to/file')) {
|
|
54
|
-
* console.log('
|
|
54
|
+
* console.log('File exists');
|
|
55
55
|
* }
|
|
56
56
|
*/
|
|
57
57
|
export async function pathExists(filePath) {
|
|
@@ -64,10 +64,10 @@ export async function pathExists(filePath) {
|
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
66
|
/**
|
|
67
|
-
*
|
|
67
|
+
* Find first existing path from candidate list
|
|
68
68
|
*
|
|
69
|
-
* @param candidates -
|
|
70
|
-
* @returns
|
|
69
|
+
* @param candidates - Candidate paths array, sorted by priority
|
|
70
|
+
* @returns First existing path, or null if none exist
|
|
71
71
|
*
|
|
72
72
|
* @example
|
|
73
73
|
* const buildDir = await findExistingPath([
|
|
@@ -85,11 +85,11 @@ export async function findExistingPath(candidates) {
|
|
|
85
85
|
return null;
|
|
86
86
|
}
|
|
87
87
|
/**
|
|
88
|
-
*
|
|
89
|
-
*
|
|
88
|
+
* Recursively copy directory
|
|
89
|
+
* Copy all contents from source directory to destination directory
|
|
90
90
|
*
|
|
91
|
-
* @param src -
|
|
92
|
-
* @param dest -
|
|
91
|
+
* @param src - Source directory path
|
|
92
|
+
* @param dest - Destination directory path
|
|
93
93
|
*
|
|
94
94
|
* @example
|
|
95
95
|
* await copyDirectory('dist/client', '.edgeone/assets');
|
|
@@ -98,10 +98,10 @@ export async function copyDirectory(src, dest) {
|
|
|
98
98
|
await fs.cp(src, dest, { recursive: true });
|
|
99
99
|
}
|
|
100
100
|
/**
|
|
101
|
-
*
|
|
102
|
-
*
|
|
101
|
+
* Clean directory (delete and recreate)
|
|
102
|
+
* Used to ensure directory is in a clean empty state
|
|
103
103
|
*
|
|
104
|
-
* @param dir -
|
|
104
|
+
* @param dir - Directory path to clean
|
|
105
105
|
*
|
|
106
106
|
* @example
|
|
107
107
|
* await cleanDirectory('.edgeone');
|
|
@@ -111,10 +111,10 @@ export async function cleanDirectory(dir) {
|
|
|
111
111
|
await fs.mkdir(dir, { recursive: true });
|
|
112
112
|
}
|
|
113
113
|
/**
|
|
114
|
-
*
|
|
115
|
-
*
|
|
114
|
+
* Ensure directory exists
|
|
115
|
+
* Recursively create if directory doesn't exist
|
|
116
116
|
*
|
|
117
|
-
* @param dir -
|
|
117
|
+
* @param dir - Directory path
|
|
118
118
|
*
|
|
119
119
|
* @example
|
|
120
120
|
* await ensureDirectory('.edgeone/server-handler');
|
|
@@ -123,10 +123,10 @@ export async function ensureDirectory(dir) {
|
|
|
123
123
|
await fs.mkdir(dir, { recursive: true });
|
|
124
124
|
}
|
|
125
125
|
/**
|
|
126
|
-
*
|
|
126
|
+
* Read file content as string
|
|
127
127
|
*
|
|
128
|
-
* @param filePath -
|
|
129
|
-
* @returns
|
|
128
|
+
* @param filePath - File path
|
|
129
|
+
* @returns File content string (UTF-8 encoded)
|
|
130
130
|
*
|
|
131
131
|
* @example
|
|
132
132
|
* const content = await readFile('dist/server/index.js');
|
|
@@ -135,24 +135,24 @@ export async function readFile(filePath) {
|
|
|
135
135
|
return fs.readFile(filePath, "utf-8");
|
|
136
136
|
}
|
|
137
137
|
/**
|
|
138
|
-
*
|
|
139
|
-
*
|
|
138
|
+
* Write content to file
|
|
139
|
+
* Automatically creates parent directory if it doesn't exist
|
|
140
140
|
*
|
|
141
|
-
* @param filePath -
|
|
142
|
-
* @param content -
|
|
141
|
+
* @param filePath - File path
|
|
142
|
+
* @param content - Content to write
|
|
143
143
|
*
|
|
144
144
|
* @example
|
|
145
145
|
* await writeFile('.edgeone/meta.json', JSON.stringify(config));
|
|
146
146
|
*/
|
|
147
147
|
export async function writeFile(filePath, content) {
|
|
148
|
-
//
|
|
148
|
+
// Ensure parent directory exists
|
|
149
149
|
await ensureDirectory(path.dirname(filePath));
|
|
150
150
|
await fs.writeFile(filePath, content);
|
|
151
151
|
}
|
|
152
152
|
/**
|
|
153
|
-
*
|
|
153
|
+
* Delete file
|
|
154
154
|
*
|
|
155
|
-
* @param filePath -
|
|
155
|
+
* @param filePath - File path to delete
|
|
156
156
|
*
|
|
157
157
|
* @example
|
|
158
158
|
* await deleteFile('server-wrapper.temp.js');
|
|
@@ -161,10 +161,10 @@ export async function deleteFile(filePath) {
|
|
|
161
161
|
await fs.unlink(filePath);
|
|
162
162
|
}
|
|
163
163
|
/**
|
|
164
|
-
*
|
|
164
|
+
* Format file size to human-readable string
|
|
165
165
|
*
|
|
166
|
-
* @param bytes -
|
|
167
|
-
* @returns
|
|
166
|
+
* @param bytes - Number of bytes
|
|
167
|
+
* @returns Formatted string, e.g. "1.5 KB", "2.3 MB"
|
|
168
168
|
*
|
|
169
169
|
* @example
|
|
170
170
|
* formatSize(1536); // "1.5 KB"
|
|
@@ -175,20 +175,20 @@ export function formatSize(bytes) {
|
|
|
175
175
|
return "0 B";
|
|
176
176
|
const k = 1024;
|
|
177
177
|
const sizes = ["B", "KB", "MB", "GB"];
|
|
178
|
-
//
|
|
178
|
+
// Calculate appropriate unit level
|
|
179
179
|
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
180
|
-
//
|
|
180
|
+
// Convert and keep two decimal places
|
|
181
181
|
return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + " " + sizes[i];
|
|
182
182
|
}
|
|
183
183
|
/**
|
|
184
|
-
*
|
|
185
|
-
*
|
|
184
|
+
* Wait for condition to be met (with retry mechanism)
|
|
185
|
+
* Used to wait for async operations to complete, like file writes
|
|
186
186
|
*
|
|
187
|
-
* @param condition -
|
|
188
|
-
* @param options -
|
|
189
|
-
* @param options.maxRetries -
|
|
190
|
-
* @param options.delay -
|
|
191
|
-
* @returns
|
|
187
|
+
* @param condition - Async condition function returning boolean
|
|
188
|
+
* @param options - Configuration options
|
|
189
|
+
* @param options.maxRetries - Maximum retry count, default 15
|
|
190
|
+
* @param options.delay - Delay between retries in milliseconds, default 300ms
|
|
191
|
+
* @returns True if condition met, false if timeout
|
|
192
192
|
*
|
|
193
193
|
* @example
|
|
194
194
|
* const ready = await waitFor(
|
|
@@ -199,11 +199,11 @@ export function formatSize(bytes) {
|
|
|
199
199
|
export async function waitFor(condition, options = {}) {
|
|
200
200
|
const { maxRetries = 15, delay = 300 } = options;
|
|
201
201
|
for (let i = 0; i < maxRetries; i++) {
|
|
202
|
-
//
|
|
202
|
+
// Check if condition is met
|
|
203
203
|
if (await condition()) {
|
|
204
204
|
return true;
|
|
205
205
|
}
|
|
206
|
-
//
|
|
206
|
+
// If not last attempt, wait then retry
|
|
207
207
|
if (i < maxRetries - 1) {
|
|
208
208
|
await new Promise((resolve) => setTimeout(resolve, delay));
|
|
209
209
|
}
|
|
@@ -211,10 +211,10 @@ export async function waitFor(condition, options = {}) {
|
|
|
211
211
|
return false;
|
|
212
212
|
}
|
|
213
213
|
/**
|
|
214
|
-
*
|
|
214
|
+
* List files and subdirectory names in directory
|
|
215
215
|
*
|
|
216
|
-
* @param dir -
|
|
217
|
-
* @returns
|
|
216
|
+
* @param dir - Directory path
|
|
217
|
+
* @returns Array of file and directory names, empty array if directory doesn't exist
|
|
218
218
|
*
|
|
219
219
|
* @example
|
|
220
220
|
* const files = await listFiles('dist/client');
|
|
@@ -229,33 +229,33 @@ export async function listFiles(dir) {
|
|
|
229
229
|
}
|
|
230
230
|
}
|
|
231
231
|
/**
|
|
232
|
-
*
|
|
232
|
+
* Recursively count files in directory
|
|
233
233
|
*
|
|
234
|
-
* @param dir -
|
|
235
|
-
* @returns
|
|
234
|
+
* @param dir - Directory path
|
|
235
|
+
* @returns Total file count (excluding directories)
|
|
236
236
|
*
|
|
237
237
|
* @example
|
|
238
238
|
* const count = await countFiles('dist');
|
|
239
|
-
* console.log(
|
|
239
|
+
* console.log(`Build artifacts contain ${count} files`);
|
|
240
240
|
*/
|
|
241
241
|
export async function countFiles(dir) {
|
|
242
242
|
let count = 0;
|
|
243
243
|
try {
|
|
244
|
-
//
|
|
244
|
+
// Get directory contents with type info
|
|
245
245
|
const entries = await fs.readdir(dir, { withFileTypes: true });
|
|
246
246
|
for (const entry of entries) {
|
|
247
247
|
if (entry.isDirectory()) {
|
|
248
|
-
//
|
|
248
|
+
// Recursively count subdirectory
|
|
249
249
|
count += await countFiles(path.join(dir, entry.name));
|
|
250
250
|
}
|
|
251
251
|
else {
|
|
252
|
-
//
|
|
252
|
+
// Increment file count
|
|
253
253
|
count++;
|
|
254
254
|
}
|
|
255
255
|
}
|
|
256
256
|
}
|
|
257
257
|
catch {
|
|
258
|
-
//
|
|
258
|
+
// Ignore errors (e.g. directory doesn't exist)
|
|
259
259
|
}
|
|
260
260
|
return count;
|
|
261
261
|
}
|
package/dist/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,MAAM,aAAa,CAAC;AAC7B,OAAO,IAAI,MAAM,MAAM,CAAC;AAGxB;;;;;;;;;;GAUG;AACH,MAAM,UAAU,YAAY,CAAC,UAAmB,KAAK;IACnD,OAAO;QACL,
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,MAAM,aAAa,CAAC;AAC7B,OAAO,IAAI,MAAM,MAAM,CAAC;AAGxB;;;;;;;;;;GAUG;AACH,MAAM,UAAU,YAAY,CAAC,UAAmB,KAAK;IACnD,OAAO;QACL,6BAA6B;QAC7B,GAAG,EAAE,CAAC,OAAe,EAAE,GAAG,IAAe,EAAE,EAAE;YAC3C,OAAO,CAAC,GAAG,CAAC,qBAAqB,OAAO,EAAE,EAAE,GAAG,IAAI,CAAC,CAAC;QACvD,CAAC;QACD,4CAA4C;QAC5C,OAAO,EAAE,CAAC,OAAe,EAAE,GAAG,IAAe,EAAE,EAAE;YAC/C,IAAI,OAAO,EAAE,CAAC;gBACZ,OAAO,CAAC,GAAG,CAAC,qBAAqB,OAAO,EAAE,EAAE,GAAG,IAAI,CAAC,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EAAE,IAAI,EAAE,CAAC,CAAC;QAE/D,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;YAC5B,IAAI,KAAK,CAAC,WAAW,EAAE,EAAE,CAAC;gBACxB,iCAAiC;gBACjC,KAAK,IAAI,MAAM,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;YACxD,CAAC;iBAAM,CAAC;gBACN,uBAAuB;gBACvB,KAAK,EAAE,CAAC;YACV,CAAC;QACH,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;QACP,+CAA+C;IACjD,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chuckcchen/vite-plugin",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"description": "Core adapter plugin for EdgeOne platform - handles build artifacts, bundling, and deployment configuration",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
"exports": {
|
|
9
9
|
".": {
|
|
10
10
|
"types": "./dist/index.d.ts",
|
|
11
|
+
"development": "./src/index.ts",
|
|
11
12
|
"import": "./dist/index.js"
|
|
12
13
|
}
|
|
13
14
|
},
|