Skip to content

Commit 3138da1

Browse files
authored
Revert "Revert "fix: πŸ› mfsu ι”™θ――ηš„εŽ»θ―»ε–ι€šθΏ‡ npm link θΏ‡ηš„εŒ…ηš„ζΊη ζ–‡δ»Ά (#10194)" (#10196)" (#10201)
This reverts commit 6086f4a. Co-authored-by: pshu <pishu.spf@antfin.com>
1 parent ab28b95 commit 3138da1

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

β€Žpackages/mfsu/src/mfsu/strategyStaticAnalyze.tsβ€Ž

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,18 +130,18 @@ export class StaticAnalyzeStrategy implements IMFSUStrategy {
130130
c.removedFiles,
131131
);
132132

133-
const cwd = this.mfsu.opts.cwd!;
133+
const srcPath = this.staticDepInfo.opts.srcCodeCache.getSrcPath();
134134

135135
const fileEvents = [
136136
...this.staticDepInfo.opts.srcCodeCache.replayChangeEvents(),
137137

138-
...extractJSCodeFiles(cwd, c.modifiedFiles).map((f) => {
138+
...extractJSCodeFiles(srcPath, c.modifiedFiles).map((f) => {
139139
return {
140140
event: 'change' as const,
141141
path: f,
142142
};
143143
}),
144-
...extractJSCodeFiles(cwd, c.removedFiles).map((f) => {
144+
...extractJSCodeFiles(srcPath, c.removedFiles).map((f) => {
145145
return {
146146
event: 'unlink' as const,
147147
path: f,
@@ -191,7 +191,11 @@ function extractJSCodeFiles(folderBase: string, files: ReadonlySet<string>) {
191191
}
192192

193193
for (let file of files.values()) {
194-
if (file.startsWith(folderBase) && REG_CODE_EXT.test(file)) {
194+
if (
195+
file.startsWith(folderBase) &&
196+
REG_CODE_EXT.test(file) &&
197+
file.indexOf('node_modules') === -1
198+
) {
195199
jsFiles.push(file);
196200
}
197201
}

β€Žpackages/mfsu/src/staticDepInfo/staticDepInfo.tsβ€Ž

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ type AutoUpdateSrcCodeCache = {
2424
getMergedCode(): MergedCodeInfo;
2525
handleFileChangeEvents(events: FileChangeEvent[]): void;
2626
replayChangeEvents(): FileChangeEvent[];
27+
getSrcPath(): string;
2728
};
2829

2930
interface IOpts {

β€Žpackages/preset-umi/src/libs/folderCache/LazySourceCodeCache.tsβ€Ž

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ export class LazySourceCodeCache {
5656
await this.loadFiles(files);
5757
}
5858

59+
getSrcPath() {
60+
return this.srcPath;
61+
}
62+
5963
public async loadFiles(files: string[]) {
6064
const loaded = await this.filesLoader(files);
6165

0 commit comments

Comments
Β (0)