@modern-js/app-tools 2.58.1-alpha.3 → 2.58.1-alpha.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.
@@ -174,71 +174,52 @@ function deserializeMap(serializedData) {
174
174
  return value;
175
175
  });
176
176
  }
177
+ const loadCache = async (filePath, enabled) => {
178
+ if (enabled && await import_utils.fs.pathExists(filePath)) {
179
+ console.log("load cache:", filePath);
180
+ const data = (await import_utils.fs.readFile(filePath)).toString();
181
+ return deserializeMap(data);
182
+ }
183
+ return void 0;
184
+ };
185
+ const writeCache = async (filePath, cacheMap) => {
186
+ const newCacheMap = /* @__PURE__ */ new Map();
187
+ for (const [key, value] of cacheMap.entries()) {
188
+ if (key.includes("node_modules/")) {
189
+ newCacheMap.set(key, value);
190
+ }
191
+ }
192
+ await import_utils.fs.writeFile(filePath, await serializeMap(newCacheMap));
193
+ console.log(`write ${import_path.default.basename(filePath)} finish`);
194
+ };
177
195
  const traceFiles = async ({ entryFiles, serverRootDir, base = "/", cacheOptions, traceOptions }) => {
178
- const { cacheDir, fileCache: enableFileCache, analysisCache: enableAnalysisCache, symlinkCache: enableSymlinkCache } = cacheOptions;
196
+ const { cacheDir, fileCache, analysisCache, symlinkCache } = cacheOptions;
179
197
  const analysisCacheFile = import_path.default.join(cacheDir, "analysis-cache.json");
180
198
  const fileCacheFile = import_path.default.join(cacheDir, "file-cache.json");
181
199
  const symlinkCacheFile = import_path.default.join(cacheDir, "symlink-cache.json");
182
- const cache = /* @__PURE__ */ Object.create(null);
183
- if (enableAnalysisCache && await import_utils.fs.pathExists(analysisCacheFile)) {
184
- const analysisCache2 = (await import_utils.fs.readFile(analysisCacheFile)).toString();
185
- cache.analysisCache = deserializeMap(analysisCache2);
186
- }
187
- if (enableFileCache && await import_utils.fs.pathExists(fileCacheFile)) {
188
- const fileCache2 = (await import_utils.fs.readFile(fileCacheFile)).toString();
189
- cache.fileCache = deserializeMap(fileCache2);
190
- }
191
- if (enableSymlinkCache && await import_utils.fs.pathExists(symlinkCacheFile)) {
192
- const symlinkCache2 = (await import_utils.fs.readFile(symlinkCacheFile)).toString();
193
- cache.symlinkCache = deserializeMap(symlinkCache2);
194
- }
200
+ const cache = {
201
+ analysisCache: await loadCache(analysisCacheFile, analysisCache),
202
+ fileCache: await loadCache(fileCacheFile, fileCache),
203
+ symlinkCache: await loadCache(symlinkCacheFile, symlinkCache)
204
+ };
195
205
  const res = await (0, import_nft.nodeFileTrace)(entryFiles, {
196
206
  base,
197
207
  processCwd: serverRootDir,
198
208
  cache,
199
209
  ...traceOptions
200
210
  });
201
- const { analysisCache, fileCache, symlinkCache } = cache;
202
211
  if (analysisCache || fileCache || symlinkCache) {
203
212
  await import_utils.fs.ensureDir(cacheDir);
204
- if (analysisCache && enableAnalysisCache) {
205
- const newAnalysisCache = new Map(analysisCache);
206
- for (const key of newAnalysisCache.keys()) {
207
- if (!key.includes("node_modules/")) {
208
- newAnalysisCache.delete(key);
209
- }
210
- }
211
- (async () => {
212
- await import_utils.fs.writeFile(analysisCacheFile, await serializeMap(newAnalysisCache));
213
- console.log("write analysis cache finish");
214
- })();
213
+ if (cache.analysisCache && analysisCache) {
214
+ await writeCache(analysisCacheFile, cache.analysisCache);
215
215
  }
216
- if (fileCache && enableFileCache) {
217
- const newFileCache = new Map(fileCache);
218
- for (const key of newFileCache.keys()) {
219
- if (!key.includes("node_modules/")) {
220
- newFileCache.delete(key);
221
- }
222
- }
223
- (async () => {
224
- await import_utils.fs.writeFile(fileCacheFile, await serializeMap(newFileCache));
225
- console.log("write file cache finish");
226
- })();
216
+ if (cache.fileCache && fileCache) {
217
+ await writeCache(fileCacheFile, cache.fileCache);
227
218
  }
228
- if (symlinkCache && enableSymlinkCache) {
229
- const newSymlinkCache = new Map(symlinkCache);
230
- for (const key of newSymlinkCache.keys()) {
231
- if (!key.includes("node_modules/")) {
232
- newSymlinkCache.delete(key);
233
- }
234
- }
235
- (async () => {
236
- await import_utils.fs.writeFile(symlinkCacheFile, await serializeMap(newSymlinkCache));
237
- console.log("write symlink cache finish");
238
- })();
219
+ if (cache.symlinkCache && symlinkCache) {
220
+ await writeCache(symlinkCacheFile, cache.symlinkCache);
239
221
  }
240
222
  }
241
- console.log("ffffffff", __filename);
242
223
  return res;
243
224
  };
244
225
  const resolveTracedPath = async (base, p) => import_utils.fs.realpath(import_path.default.resolve(base, p));
@@ -432,19 +432,13 @@ function deserializeMap(serializedData) {
432
432
  return value;
433
433
  });
434
434
  }
435
- var traceFiles = function() {
436
- var _ref = _async_to_generator(function(param) {
437
- var entryFiles, serverRootDir, _param_base, base, cacheOptions, traceOptions, cacheDir, enableFileCache, enableAnalysisCache, enableSymlinkCache, analysisCacheFile, fileCacheFile, symlinkCacheFile, cache, _tmp, analysisCache, _tmp1, fileCache, _tmp2, symlinkCache, res, analysisCache1, fileCache1, symlinkCache1, newAnalysisCache, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, key, newFileCache, _iteratorNormalCompletion1, _didIteratorError1, _iteratorError1, _iterator1, _step1, key1, newSymlinkCache, _iteratorNormalCompletion2, _didIteratorError2, _iteratorError2, _iterator2, _step2, key2;
435
+ var loadCache = function() {
436
+ var _ref = _async_to_generator(function(filePath, enabled) {
437
+ var _tmp, data;
438
438
  return _ts_generator(this, function(_state) {
439
439
  switch (_state.label) {
440
440
  case 0:
441
- entryFiles = param.entryFiles, serverRootDir = param.serverRootDir, _param_base = param.base, base = _param_base === void 0 ? "/" : _param_base, cacheOptions = param.cacheOptions, traceOptions = param.traceOptions;
442
- cacheDir = cacheOptions.cacheDir, enableFileCache = cacheOptions.fileCache, enableAnalysisCache = cacheOptions.analysisCache, enableSymlinkCache = cacheOptions.symlinkCache;
443
- analysisCacheFile = path.join(cacheDir, "analysis-cache.json");
444
- fileCacheFile = path.join(cacheDir, "file-cache.json");
445
- symlinkCacheFile = path.join(cacheDir, "symlink-cache.json");
446
- cache = /* @__PURE__ */ Object.create(null);
447
- _tmp = enableAnalysisCache;
441
+ _tmp = enabled;
448
442
  if (!_tmp)
449
443
  return [
450
444
  3,
@@ -452,7 +446,7 @@ var traceFiles = function() {
452
446
  ];
453
447
  return [
454
448
  4,
455
- fse.pathExists(analysisCacheFile)
449
+ fse.pathExists(filePath)
456
450
  ];
457
451
  case 1:
458
452
  _tmp = _state.sent();
@@ -463,71 +457,116 @@ var traceFiles = function() {
463
457
  3,
464
458
  4
465
459
  ];
460
+ console.log("load cache:", filePath);
466
461
  return [
467
462
  4,
468
- fse.readFile(analysisCacheFile)
463
+ fse.readFile(filePath)
469
464
  ];
470
465
  case 3:
471
- analysisCache = _state.sent().toString();
472
- cache.analysisCache = deserializeMap(analysisCache);
473
- _state.label = 4;
466
+ data = _state.sent().toString();
467
+ return [
468
+ 2,
469
+ deserializeMap(data)
470
+ ];
474
471
  case 4:
475
- _tmp1 = enableFileCache;
476
- if (!_tmp1)
477
- return [
478
- 3,
479
- 6
480
- ];
472
+ return [
473
+ 2,
474
+ void 0
475
+ ];
476
+ }
477
+ });
478
+ });
479
+ return function loadCache2(filePath, enabled) {
480
+ return _ref.apply(this, arguments);
481
+ };
482
+ }();
483
+ var writeCache = function() {
484
+ var _ref = _async_to_generator(function(filePath, cacheMap) {
485
+ var newCacheMap, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, _step_value, key, value, _, _tmp;
486
+ return _ts_generator(this, function(_state) {
487
+ switch (_state.label) {
488
+ case 0:
489
+ newCacheMap = /* @__PURE__ */ new Map();
490
+ _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
491
+ try {
492
+ for (_iterator = cacheMap.entries()[Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
493
+ _step_value = _sliced_to_array(_step.value, 2), key = _step_value[0], value = _step_value[1];
494
+ if (key.includes("node_modules/")) {
495
+ newCacheMap.set(key, value);
496
+ }
497
+ }
498
+ } catch (err) {
499
+ _didIteratorError = true;
500
+ _iteratorError = err;
501
+ } finally {
502
+ try {
503
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
504
+ _iterator.return();
505
+ }
506
+ } finally {
507
+ if (_didIteratorError) {
508
+ throw _iteratorError;
509
+ }
510
+ }
511
+ }
512
+ _ = fse.writeFile;
513
+ _tmp = [
514
+ filePath
515
+ ];
481
516
  return [
482
517
  4,
483
- fse.pathExists(fileCacheFile)
518
+ serializeMap(newCacheMap)
484
519
  ];
485
- case 5:
486
- _tmp1 = _state.sent();
487
- _state.label = 6;
488
- case 6:
489
- if (!_tmp1)
490
- return [
491
- 3,
492
- 8
493
- ];
520
+ case 1:
494
521
  return [
495
522
  4,
496
- fse.readFile(fileCacheFile)
523
+ _.apply(fse, _tmp.concat([
524
+ _state.sent()
525
+ ]))
497
526
  ];
498
- case 7:
499
- fileCache = _state.sent().toString();
500
- cache.fileCache = deserializeMap(fileCache);
501
- _state.label = 8;
502
- case 8:
503
- _tmp2 = enableSymlinkCache;
504
- if (!_tmp2)
505
- return [
506
- 3,
507
- 10
508
- ];
527
+ case 2:
528
+ _state.sent();
529
+ console.log("write ".concat(path.basename(filePath), " finish"));
530
+ return [
531
+ 2
532
+ ];
533
+ }
534
+ });
535
+ });
536
+ return function writeCache2(filePath, cacheMap) {
537
+ return _ref.apply(this, arguments);
538
+ };
539
+ }();
540
+ var traceFiles = function() {
541
+ var _ref = _async_to_generator(function(param) {
542
+ var entryFiles, serverRootDir, _param_base, base, cacheOptions, traceOptions, cacheDir, fileCache, analysisCache, symlinkCache, analysisCacheFile, fileCacheFile, symlinkCacheFile, cache, _tmp, res;
543
+ return _ts_generator(this, function(_state) {
544
+ switch (_state.label) {
545
+ case 0:
546
+ entryFiles = param.entryFiles, serverRootDir = param.serverRootDir, _param_base = param.base, base = _param_base === void 0 ? "/" : _param_base, cacheOptions = param.cacheOptions, traceOptions = param.traceOptions;
547
+ cacheDir = cacheOptions.cacheDir, fileCache = cacheOptions.fileCache, analysisCache = cacheOptions.analysisCache, symlinkCache = cacheOptions.symlinkCache;
548
+ analysisCacheFile = path.join(cacheDir, "analysis-cache.json");
549
+ fileCacheFile = path.join(cacheDir, "file-cache.json");
550
+ symlinkCacheFile = path.join(cacheDir, "symlink-cache.json");
551
+ _tmp = {};
509
552
  return [
510
553
  4,
511
- fse.pathExists(symlinkCacheFile)
554
+ loadCache(analysisCacheFile, analysisCache)
512
555
  ];
513
- case 9:
514
- _tmp2 = _state.sent();
515
- _state.label = 10;
516
- case 10:
517
- if (!_tmp2)
518
- return [
519
- 3,
520
- 12
521
- ];
556
+ case 1:
557
+ _tmp.analysisCache = _state.sent();
522
558
  return [
523
559
  4,
524
- fse.readFile(symlinkCacheFile)
560
+ loadCache(fileCacheFile, fileCache)
525
561
  ];
526
- case 11:
527
- symlinkCache = _state.sent().toString();
528
- cache.symlinkCache = deserializeMap(symlinkCache);
529
- _state.label = 12;
530
- case 12:
562
+ case 2:
563
+ _tmp.fileCache = _state.sent();
564
+ return [
565
+ 4,
566
+ loadCache(symlinkCacheFile, symlinkCache)
567
+ ];
568
+ case 3:
569
+ cache = (_tmp.symlinkCache = _state.sent(), _tmp);
531
570
  return [
532
571
  4,
533
572
  nodeFileTrace(entryFiles, _object_spread({
@@ -536,185 +575,58 @@ var traceFiles = function() {
536
575
  cache
537
576
  }, traceOptions))
538
577
  ];
539
- case 13:
578
+ case 4:
540
579
  res = _state.sent();
541
- analysisCache1 = cache.analysisCache, fileCache1 = cache.fileCache, symlinkCache1 = cache.symlinkCache;
542
- if (!(analysisCache1 || fileCache1 || symlinkCache1))
580
+ if (!(analysisCache || fileCache || symlinkCache))
543
581
  return [
544
582
  3,
545
- 15
583
+ 11
546
584
  ];
547
585
  return [
548
586
  4,
549
587
  fse.ensureDir(cacheDir)
550
588
  ];
551
- case 14:
589
+ case 5:
552
590
  _state.sent();
553
- if (analysisCache1 && enableAnalysisCache) {
554
- newAnalysisCache = new Map(analysisCache1);
555
- _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
556
- try {
557
- for (_iterator = newAnalysisCache.keys()[Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
558
- key = _step.value;
559
- if (!key.includes("node_modules/")) {
560
- newAnalysisCache.delete(key);
561
- }
562
- }
563
- } catch (err) {
564
- _didIteratorError = true;
565
- _iteratorError = err;
566
- } finally {
567
- try {
568
- if (!_iteratorNormalCompletion && _iterator.return != null) {
569
- _iterator.return();
570
- }
571
- } finally {
572
- if (_didIteratorError) {
573
- throw _iteratorError;
574
- }
575
- }
576
- }
577
- _async_to_generator(function() {
578
- var _, _tmp3;
579
- return _ts_generator(this, function(_state2) {
580
- switch (_state2.label) {
581
- case 0:
582
- _ = fse.writeFile;
583
- _tmp3 = [
584
- analysisCacheFile
585
- ];
586
- return [
587
- 4,
588
- serializeMap(newAnalysisCache)
589
- ];
590
- case 1:
591
- return [
592
- 4,
593
- _.apply(fse, _tmp3.concat([
594
- _state2.sent()
595
- ]))
596
- ];
597
- case 2:
598
- _state2.sent();
599
- console.log("write analysis cache finish");
600
- return [
601
- 2
602
- ];
603
- }
604
- });
605
- })();
606
- }
607
- if (fileCache1 && enableFileCache) {
608
- newFileCache = new Map(fileCache1);
609
- _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = void 0;
610
- try {
611
- for (_iterator1 = newFileCache.keys()[Symbol.iterator](); !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true) {
612
- key1 = _step1.value;
613
- if (!key1.includes("node_modules/")) {
614
- newFileCache.delete(key1);
615
- }
616
- }
617
- } catch (err) {
618
- _didIteratorError1 = true;
619
- _iteratorError1 = err;
620
- } finally {
621
- try {
622
- if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
623
- _iterator1.return();
624
- }
625
- } finally {
626
- if (_didIteratorError1) {
627
- throw _iteratorError1;
628
- }
629
- }
630
- }
631
- _async_to_generator(function() {
632
- var _, _tmp3;
633
- return _ts_generator(this, function(_state2) {
634
- switch (_state2.label) {
635
- case 0:
636
- _ = fse.writeFile;
637
- _tmp3 = [
638
- fileCacheFile
639
- ];
640
- return [
641
- 4,
642
- serializeMap(newFileCache)
643
- ];
644
- case 1:
645
- return [
646
- 4,
647
- _.apply(fse, _tmp3.concat([
648
- _state2.sent()
649
- ]))
650
- ];
651
- case 2:
652
- _state2.sent();
653
- console.log("write file cache finish");
654
- return [
655
- 2
656
- ];
657
- }
658
- });
659
- })();
660
- }
661
- if (symlinkCache1 && enableSymlinkCache) {
662
- newSymlinkCache = new Map(symlinkCache1);
663
- _iteratorNormalCompletion2 = true, _didIteratorError2 = false, _iteratorError2 = void 0;
664
- try {
665
- for (_iterator2 = newSymlinkCache.keys()[Symbol.iterator](); !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
666
- key2 = _step2.value;
667
- if (!key2.includes("node_modules/")) {
668
- newSymlinkCache.delete(key2);
669
- }
670
- }
671
- } catch (err) {
672
- _didIteratorError2 = true;
673
- _iteratorError2 = err;
674
- } finally {
675
- try {
676
- if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
677
- _iterator2.return();
678
- }
679
- } finally {
680
- if (_didIteratorError2) {
681
- throw _iteratorError2;
682
- }
683
- }
684
- }
685
- _async_to_generator(function() {
686
- var _, _tmp3;
687
- return _ts_generator(this, function(_state2) {
688
- switch (_state2.label) {
689
- case 0:
690
- _ = fse.writeFile;
691
- _tmp3 = [
692
- symlinkCacheFile
693
- ];
694
- return [
695
- 4,
696
- serializeMap(newSymlinkCache)
697
- ];
698
- case 1:
699
- return [
700
- 4,
701
- _.apply(fse, _tmp3.concat([
702
- _state2.sent()
703
- ]))
704
- ];
705
- case 2:
706
- _state2.sent();
707
- console.log("write symlink cache finish");
708
- return [
709
- 2
710
- ];
711
- }
712
- });
713
- })();
714
- }
715
- _state.label = 15;
716
- case 15:
717
- console.log("ffffffff", __filename);
591
+ if (!(cache.analysisCache && analysisCache))
592
+ return [
593
+ 3,
594
+ 7
595
+ ];
596
+ return [
597
+ 4,
598
+ writeCache(analysisCacheFile, cache.analysisCache)
599
+ ];
600
+ case 6:
601
+ _state.sent();
602
+ _state.label = 7;
603
+ case 7:
604
+ if (!(cache.fileCache && fileCache))
605
+ return [
606
+ 3,
607
+ 9
608
+ ];
609
+ return [
610
+ 4,
611
+ writeCache(fileCacheFile, cache.fileCache)
612
+ ];
613
+ case 8:
614
+ _state.sent();
615
+ _state.label = 9;
616
+ case 9:
617
+ if (!(cache.symlinkCache && symlinkCache))
618
+ return [
619
+ 3,
620
+ 11
621
+ ];
622
+ return [
623
+ 4,
624
+ writeCache(symlinkCacheFile, cache.symlinkCache)
625
+ ];
626
+ case 10:
627
+ _state.sent();
628
+ _state.label = 11;
629
+ case 11:
718
630
  return [
719
631
  2,
720
632
  res
@@ -133,71 +133,52 @@ function deserializeMap(serializedData) {
133
133
  return value;
134
134
  });
135
135
  }
136
+ const loadCache = async (filePath, enabled) => {
137
+ if (enabled && await fse.pathExists(filePath)) {
138
+ console.log("load cache:", filePath);
139
+ const data = (await fse.readFile(filePath)).toString();
140
+ return deserializeMap(data);
141
+ }
142
+ return void 0;
143
+ };
144
+ const writeCache = async (filePath, cacheMap) => {
145
+ const newCacheMap = /* @__PURE__ */ new Map();
146
+ for (const [key, value] of cacheMap.entries()) {
147
+ if (key.includes("node_modules/")) {
148
+ newCacheMap.set(key, value);
149
+ }
150
+ }
151
+ await fse.writeFile(filePath, await serializeMap(newCacheMap));
152
+ console.log(`write ${path.basename(filePath)} finish`);
153
+ };
136
154
  const traceFiles = async ({ entryFiles, serverRootDir, base = "/", cacheOptions, traceOptions }) => {
137
- const { cacheDir, fileCache: enableFileCache, analysisCache: enableAnalysisCache, symlinkCache: enableSymlinkCache } = cacheOptions;
155
+ const { cacheDir, fileCache, analysisCache, symlinkCache } = cacheOptions;
138
156
  const analysisCacheFile = path.join(cacheDir, "analysis-cache.json");
139
157
  const fileCacheFile = path.join(cacheDir, "file-cache.json");
140
158
  const symlinkCacheFile = path.join(cacheDir, "symlink-cache.json");
141
- const cache = /* @__PURE__ */ Object.create(null);
142
- if (enableAnalysisCache && await fse.pathExists(analysisCacheFile)) {
143
- const analysisCache2 = (await fse.readFile(analysisCacheFile)).toString();
144
- cache.analysisCache = deserializeMap(analysisCache2);
145
- }
146
- if (enableFileCache && await fse.pathExists(fileCacheFile)) {
147
- const fileCache2 = (await fse.readFile(fileCacheFile)).toString();
148
- cache.fileCache = deserializeMap(fileCache2);
149
- }
150
- if (enableSymlinkCache && await fse.pathExists(symlinkCacheFile)) {
151
- const symlinkCache2 = (await fse.readFile(symlinkCacheFile)).toString();
152
- cache.symlinkCache = deserializeMap(symlinkCache2);
153
- }
159
+ const cache = {
160
+ analysisCache: await loadCache(analysisCacheFile, analysisCache),
161
+ fileCache: await loadCache(fileCacheFile, fileCache),
162
+ symlinkCache: await loadCache(symlinkCacheFile, symlinkCache)
163
+ };
154
164
  const res = await nodeFileTrace(entryFiles, {
155
165
  base,
156
166
  processCwd: serverRootDir,
157
167
  cache,
158
168
  ...traceOptions
159
169
  });
160
- const { analysisCache, fileCache, symlinkCache } = cache;
161
170
  if (analysisCache || fileCache || symlinkCache) {
162
171
  await fse.ensureDir(cacheDir);
163
- if (analysisCache && enableAnalysisCache) {
164
- const newAnalysisCache = new Map(analysisCache);
165
- for (const key of newAnalysisCache.keys()) {
166
- if (!key.includes("node_modules/")) {
167
- newAnalysisCache.delete(key);
168
- }
169
- }
170
- (async () => {
171
- await fse.writeFile(analysisCacheFile, await serializeMap(newAnalysisCache));
172
- console.log("write analysis cache finish");
173
- })();
172
+ if (cache.analysisCache && analysisCache) {
173
+ await writeCache(analysisCacheFile, cache.analysisCache);
174
174
  }
175
- if (fileCache && enableFileCache) {
176
- const newFileCache = new Map(fileCache);
177
- for (const key of newFileCache.keys()) {
178
- if (!key.includes("node_modules/")) {
179
- newFileCache.delete(key);
180
- }
181
- }
182
- (async () => {
183
- await fse.writeFile(fileCacheFile, await serializeMap(newFileCache));
184
- console.log("write file cache finish");
185
- })();
175
+ if (cache.fileCache && fileCache) {
176
+ await writeCache(fileCacheFile, cache.fileCache);
186
177
  }
187
- if (symlinkCache && enableSymlinkCache) {
188
- const newSymlinkCache = new Map(symlinkCache);
189
- for (const key of newSymlinkCache.keys()) {
190
- if (!key.includes("node_modules/")) {
191
- newSymlinkCache.delete(key);
192
- }
193
- }
194
- (async () => {
195
- await fse.writeFile(symlinkCacheFile, await serializeMap(newSymlinkCache));
196
- console.log("write symlink cache finish");
197
- })();
178
+ if (cache.symlinkCache && symlinkCache) {
179
+ await writeCache(symlinkCacheFile, cache.symlinkCache);
198
180
  }
199
181
  }
200
- console.log("ffffffff", __filename);
201
182
  return res;
202
183
  };
203
184
  const resolveTracedPath = async (base, p) => fse.realpath(path.resolve(base, p));
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "2.58.1-alpha.3",
18
+ "version": "2.58.1-alpha.4",
19
19
  "jsnext:source": "./src/index.ts",
20
20
  "types": "./dist/types/index.d.ts",
21
21
  "main": "./dist/cjs/index.js",
@@ -91,17 +91,17 @@
91
91
  "std-env": "^3.7.0",
92
92
  "@modern-js/node-bundle-require": "2.58.0",
93
93
  "@modern-js/core": "2.58.0",
94
+ "@modern-js/plugin-lint": "2.58.0",
94
95
  "@modern-js/plugin": "2.58.0",
96
+ "@modern-js/prod-server": "2.58.0",
95
97
  "@modern-js/plugin-i18n": "2.58.0",
96
- "@modern-js/plugin-lint": "2.58.0",
97
- "@modern-js/server-core": "2.58.0",
98
- "@modern-js/server-utils": "2.58.0",
98
+ "@modern-js/rsbuild-plugin-esbuild": "2.58.0",
99
99
  "@modern-js/server": "2.58.0",
100
+ "@modern-js/server-core": "2.58.0",
100
101
  "@modern-js/types": "2.58.0",
102
+ "@modern-js/server-utils": "2.58.0",
101
103
  "@modern-js/utils": "2.58.0",
102
- "@modern-js/prod-server": "2.58.0",
103
104
  "@modern-js/uni-builder": "2.58.0",
104
- "@modern-js/rsbuild-plugin-esbuild": "2.58.0",
105
105
  "@modern-js/plugin-data-loader": "2.58.0"
106
106
  },
107
107
  "devDependencies": {