@eggjs/core 7.0.2-beta.7 → 7.0.2-beta.8
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/loader/manifest.d.ts +14 -0
- package/dist/loader/manifest.js +41 -0
- package/package.json +9 -9
|
@@ -54,6 +54,20 @@ declare class ManifestStore {
|
|
|
54
54
|
generateManifest(options: ManifestGenerateOptions): StartupManifest;
|
|
55
55
|
static write(baseDir: string, manifest: StartupManifest): Promise<void>;
|
|
56
56
|
static clean(baseDir: string): void;
|
|
57
|
+
/**
|
|
58
|
+
* Enable Node.js module compile cache for the current process.
|
|
59
|
+
* Sets NODE_COMPILE_CACHE and NODE_COMPILE_CACHE_PORTABLE env vars
|
|
60
|
+
* so forked child processes also inherit compile cache.
|
|
61
|
+
*/
|
|
62
|
+
static enableCompileCache(baseDir: string): void;
|
|
63
|
+
/**
|
|
64
|
+
* Flush accumulated compile cache entries to disk.
|
|
65
|
+
*/
|
|
66
|
+
static flushCompileCache(): void;
|
|
67
|
+
/**
|
|
68
|
+
* Remove the compile cache directory.
|
|
69
|
+
*/
|
|
70
|
+
static cleanCompileCache(baseDir: string): void;
|
|
57
71
|
}
|
|
58
72
|
interface ManifestGenerateOptions {
|
|
59
73
|
serverEnv: string;
|
package/dist/loader/manifest.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import BuiltinModule from "node:module";
|
|
1
2
|
import fs from "node:fs";
|
|
2
3
|
import fsp from "node:fs/promises";
|
|
3
4
|
import path from "node:path";
|
|
@@ -182,6 +183,46 @@ var ManifestStore = class ManifestStore {
|
|
|
182
183
|
} catch (err) {
|
|
183
184
|
if (err.code !== "ENOENT") throw err;
|
|
184
185
|
}
|
|
186
|
+
ManifestStore.cleanCompileCache(baseDir);
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Enable Node.js module compile cache for the current process.
|
|
190
|
+
* Sets NODE_COMPILE_CACHE and NODE_COMPILE_CACHE_PORTABLE env vars
|
|
191
|
+
* so forked child processes also inherit compile cache.
|
|
192
|
+
*/
|
|
193
|
+
static enableCompileCache(baseDir) {
|
|
194
|
+
if (process.env.NODE_COMPILE_CACHE || process.env.NODE_DISABLE_COMPILE_CACHE) return;
|
|
195
|
+
const cacheDir = path.join(baseDir, ".egg", "compile-cache");
|
|
196
|
+
process.env.NODE_COMPILE_CACHE = cacheDir;
|
|
197
|
+
process.env.NODE_COMPILE_CACHE_PORTABLE = "1";
|
|
198
|
+
try {
|
|
199
|
+
const result = BuiltinModule.enableCompileCache?.(cacheDir);
|
|
200
|
+
debug("compile cache enabled: %o", result);
|
|
201
|
+
} catch (err) {
|
|
202
|
+
debug("compile cache enable failed: %o", err);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Flush accumulated compile cache entries to disk.
|
|
207
|
+
*/
|
|
208
|
+
static flushCompileCache() {
|
|
209
|
+
try {
|
|
210
|
+
BuiltinModule.flushCompileCache?.();
|
|
211
|
+
debug("compile cache flushed");
|
|
212
|
+
} catch (err) {
|
|
213
|
+
debug("compile cache flush failed: %o", err);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Remove the compile cache directory.
|
|
218
|
+
*/
|
|
219
|
+
static cleanCompileCache(baseDir) {
|
|
220
|
+
const compileCacheDir = path.join(baseDir, ".egg", "compile-cache");
|
|
221
|
+
fs.rmSync(compileCacheDir, {
|
|
222
|
+
recursive: true,
|
|
223
|
+
force: true
|
|
224
|
+
});
|
|
225
|
+
debug("compile cache removed: %s", compileCacheDir);
|
|
185
226
|
}
|
|
186
227
|
#toRelative(absPath) {
|
|
187
228
|
return (path.isAbsolute(absPath) ? path.relative(this.baseDir, absPath) : absPath).replaceAll(path.sep, "/");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eggjs/core",
|
|
3
|
-
"version": "7.0.2-beta.
|
|
3
|
+
"version": "7.0.2-beta.8",
|
|
4
4
|
"description": "A core plugin framework based on @eggjs/koa",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"egg",
|
|
@@ -41,11 +41,11 @@
|
|
|
41
41
|
"ready-callback": "^4.0.0",
|
|
42
42
|
"tsconfig-paths": "^4.2.0",
|
|
43
43
|
"utility": "^2.5.0",
|
|
44
|
-
"@eggjs/extend2": "5.0.2-beta.
|
|
45
|
-
"@eggjs/koa": "3.1.2-beta.
|
|
46
|
-
"@eggjs/
|
|
47
|
-
"@eggjs/router": "4.0.2-beta.
|
|
48
|
-
"@eggjs/
|
|
44
|
+
"@eggjs/extend2": "5.0.2-beta.8",
|
|
45
|
+
"@eggjs/koa": "3.1.2-beta.8",
|
|
46
|
+
"@eggjs/utils": "5.0.2-beta.8",
|
|
47
|
+
"@eggjs/router": "4.0.2-beta.8",
|
|
48
|
+
"@eggjs/path-matching": "3.0.2-beta.8"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@types/js-yaml": "^4.0.9",
|
|
@@ -57,9 +57,9 @@
|
|
|
57
57
|
"mm": "^4.0.2",
|
|
58
58
|
"typescript": "^5.9.3",
|
|
59
59
|
"urllib": "^4.8.2",
|
|
60
|
-
"@eggjs/mock": "7.0.2-beta.
|
|
61
|
-
"@eggjs/tsconfig": "3.1.2-beta.
|
|
62
|
-
"@eggjs/supertest": "9.0.2-beta.
|
|
60
|
+
"@eggjs/mock": "7.0.2-beta.8",
|
|
61
|
+
"@eggjs/tsconfig": "3.1.2-beta.8",
|
|
62
|
+
"@eggjs/supertest": "9.0.2-beta.8"
|
|
63
63
|
},
|
|
64
64
|
"engines": {
|
|
65
65
|
"node": ">=22.18.0"
|