@antelopejs/core 1.24.4 → 1.24.5-next.527.g689924d
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.
|
@@ -2,6 +2,6 @@ import { type PathMatcher } from "../../utils";
|
|
|
2
2
|
import { type InterfacePackagePlan, type ManagerContext } from "./module-manager-context";
|
|
3
3
|
export declare function unrequireModuleFiles(this: ManagerContext, moduleId: string, shouldPreserveInterfaceGraph?: boolean): void;
|
|
4
4
|
export declare function evictModuleFiles(this: ManagerContext, moduleId: string, shouldPreserveInterfaceGraph: boolean): void;
|
|
5
|
-
export declare function collectAvoidedFolders(this: ManagerContext, moduleId: string,
|
|
5
|
+
export declare function collectAvoidedFolders(this: ManagerContext, moduleId: string, moduleRoots: readonly string[], isInModule: PathMatcher): string[];
|
|
6
6
|
export declare function belongsToInterfacePackageTree(this: ManagerContext, filePath: string, isInModule: PathMatcher): boolean;
|
|
7
7
|
export declare function evictInterfacePackageCopies(plans: ReadonlyMap<string, InterfacePackagePlan>): void;
|
|
@@ -38,10 +38,12 @@ exports.evictModuleFiles = evictModuleFiles;
|
|
|
38
38
|
exports.collectAvoidedFolders = collectAvoidedFolders;
|
|
39
39
|
exports.belongsToInterfacePackageTree = belongsToInterfacePackageTree;
|
|
40
40
|
exports.evictInterfacePackageCopies = evictInterfacePackageCopies;
|
|
41
|
+
const node_fs_1 = require("node:fs");
|
|
41
42
|
const path = __importStar(require("node:path"));
|
|
42
43
|
const utils_1 = require("../../utils");
|
|
43
44
|
const module_manager_bindings_1 = require("./module-manager-bindings");
|
|
44
45
|
const module_manifest_1 = require("./module-manifest");
|
|
46
|
+
const NODE_MODULES = "node_modules";
|
|
45
47
|
function unrequireModuleFiles(moduleId, shouldPreserveInterfaceGraph = true) {
|
|
46
48
|
(0, utils_1.clearPathResolutionCache)();
|
|
47
49
|
this.evictModuleFiles(moduleId, shouldPreserveInterfaceGraph);
|
|
@@ -51,11 +53,11 @@ function evictModuleFiles(moduleId, shouldPreserveInterfaceGraph) {
|
|
|
51
53
|
if (!entry) {
|
|
52
54
|
return;
|
|
53
55
|
}
|
|
54
|
-
const
|
|
56
|
+
const moduleRoots = collectModuleRoots(path.resolve(entry.module.manifest.folder));
|
|
55
57
|
const moduleEntryFile = (0, module_manifest_1.resolveManifestEntryFile)(entry.module.manifest);
|
|
56
|
-
const isInModule = (
|
|
57
|
-
const isLoadedInModule = (
|
|
58
|
-
const avoidedMatchers = this.collectAvoidedFolders(moduleId,
|
|
58
|
+
const isInModule = matchAny(moduleRoots.map(utils_1.createPathWithinMatcher));
|
|
59
|
+
const isLoadedInModule = matchAny(moduleRoots.map(utils_1.createLoadedFileMatcher));
|
|
60
|
+
const avoidedMatchers = this.collectAvoidedFolders(moduleId, moduleRoots, isInModule).map((folder) => (0, utils_1.createLoadedFileMatcher)(folder));
|
|
59
61
|
for (const filePath of Object.keys(require.cache)) {
|
|
60
62
|
if (!isLoadedInModule(filePath)) {
|
|
61
63
|
continue;
|
|
@@ -70,10 +72,41 @@ function evictModuleFiles(moduleId, shouldPreserveInterfaceGraph) {
|
|
|
70
72
|
}
|
|
71
73
|
}
|
|
72
74
|
}
|
|
73
|
-
function
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
function matchAny(matchers) {
|
|
76
|
+
return (filePath) => matchers.some((matches) => matches(filePath));
|
|
77
|
+
}
|
|
78
|
+
function collectModuleRoots(moduleFolder) {
|
|
79
|
+
const roots = [moduleFolder];
|
|
80
|
+
const pending = [moduleFolder];
|
|
81
|
+
for (let folder = pending.pop(); folder; folder = pending.pop()) {
|
|
82
|
+
for (const child of readFolder(folder)) {
|
|
83
|
+
if (child.name === NODE_MODULES) {
|
|
84
|
+
continue;
|
|
85
|
+
}
|
|
86
|
+
const childPath = path.join(folder, child.name);
|
|
87
|
+
if (child.isDirectory()) {
|
|
88
|
+
pending.push(childPath);
|
|
89
|
+
}
|
|
90
|
+
else if (child.isSymbolicLink()) {
|
|
91
|
+
const target = (0, utils_1.normalizeExistingPath)(childPath);
|
|
92
|
+
if (!(0, utils_1.isPathWithin)(moduleFolder, target)) {
|
|
93
|
+
roots.push(target);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return roots;
|
|
99
|
+
}
|
|
100
|
+
function readFolder(folder) {
|
|
101
|
+
try {
|
|
102
|
+
return (0, node_fs_1.readdirSync)(folder, { withFileTypes: true });
|
|
103
|
+
}
|
|
104
|
+
catch {
|
|
105
|
+
return [];
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
function collectAvoidedFolders(moduleId, moduleRoots, isInModule) {
|
|
109
|
+
const avoidedFolders = new Set(moduleRoots.map((root) => path.join(root, NODE_MODULES)));
|
|
77
110
|
for (const [id, other] of this.loaded) {
|
|
78
111
|
if (id !== moduleId && isInModule(other.module.manifest.folder)) {
|
|
79
112
|
avoidedFolders.add(path.resolve(other.module.manifest.folder));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module-manager-cache.js","sourceRoot":"","sources":["../../../src/core/modules/module-manager-cache.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"module-manager-cache.js","sourceRoot":"","sources":["../../../src/core/modules/module-manager-cache.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoBA,oDAOC;AAED,4CAqCC;AA2CD,sDAeC;AAED,sEAUC;AAQD,kEAkBC;AAlKD,qCAAmD;AACnD,gDAAkC;AAElC,uCAOqB;AACrB,uEAAmE;AAKnE,uDAA6D;AAE7D,MAAM,YAAY,GAAG,cAAc,CAAC;AAEpC,SAAgB,oBAAoB,CAElC,QAAgB,EAChB,4BAA4B,GAAG,IAAI;IAEnC,IAAA,gCAAwB,GAAE,CAAC;IAC3B,IAAI,CAAC,gBAAgB,CAAC,QAAQ,EAAE,4BAA4B,CAAC,CAAC;AA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,EAAE,EAAE,CAAC;QACrB,IAAI,CAAC,gBAAgB;QACrB,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,EAAE,eAAe,EAAE,EAAE,EAAE,CAChD,eAAe,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,EAAE,CACzC;KACF,CAAC;SACD,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;SACjD,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAA,+BAAuB,EAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC9D,KAAK,MAAM,QAAQ,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QAClD,IAAI,QAAQ,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC;YACpD,OAAO,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QACjC,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -87,7 +87,7 @@ export interface ManagerMethods {
|
|
|
87
87
|
getAllManagedModules(): ManagedModule[];
|
|
88
88
|
unrequireModuleFiles(moduleId: string, shouldPreserveInterfaceGraph?: boolean): void;
|
|
89
89
|
evictModuleFiles(moduleId: string, shouldPreserveInterfaceGraph: boolean): void;
|
|
90
|
-
collectAvoidedFolders(moduleId: string,
|
|
90
|
+
collectAvoidedFolders(moduleId: string, moduleRoots: readonly string[], isInModule: PathMatcher): string[];
|
|
91
91
|
belongsToInterfacePackageTree(filePath: string, isInModule: PathMatcher): boolean;
|
|
92
92
|
setInstanceRoot(root: string): void;
|
|
93
93
|
placeModule(moduleId: string, manifest: ModuleManifest): ModuleManifest;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antelopejs/core",
|
|
3
|
-
"version": "1.24.
|
|
3
|
+
"version": "1.24.5-next.527.g689924d",
|
|
4
4
|
"description": "TypeScript framework extending hexagonal architecture across your application and its ecosystem through explicit contracts and replaceable modules.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"antelopejs",
|
|
@@ -115,7 +115,7 @@
|
|
|
115
115
|
"standard": true
|
|
116
116
|
}
|
|
117
117
|
},
|
|
118
|
-
"gitHead": "
|
|
118
|
+
"gitHead": "689924d3cdb3bd93b667b998de1595e1da3f41ee",
|
|
119
119
|
"scripts": {
|
|
120
120
|
"build": "rimraf dist && tsc",
|
|
121
121
|
"release": "pnpm run lint && pnpm run typecheck && pnpm run test && pnpm run prepack && release-it",
|