@powerlines/nx 0.10.26 → 0.10.28

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.
Files changed (42) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/{chunk-ACE6O62X.js → chunk-2PYUYDPD.js} +11 -11
  3. package/dist/{chunk-6WVDB4DZ.js → chunk-2YSHMNU6.js} +2 -2
  4. package/dist/{chunk-ONWCIW2E.mjs → chunk-5WHBT2BW.mjs} +1 -1
  5. package/dist/{chunk-PJYRCGK4.js → chunk-7E3PRE6W.js} +2 -2
  6. package/dist/{chunk-6UH4EGMN.mjs → chunk-DLZ7E67Y.mjs} +1 -1
  7. package/dist/{chunk-BXKPRYNH.mjs → chunk-DMX7BNND.mjs} +22 -14
  8. package/dist/{chunk-7TPTVC3S.js → chunk-GVA7U7C4.js} +2 -2
  9. package/dist/{chunk-2SFOQMAA.js → chunk-HLYNF7YE.js} +533 -654
  10. package/dist/{chunk-B5L3T46G.js → chunk-HVWVP6CD.js} +2 -2
  11. package/dist/{chunk-JPTGZQLU.js → chunk-MAMHMV35.js} +22 -14
  12. package/dist/{chunk-A26KXB6A.js → chunk-ND7VF7PZ.js} +2 -2
  13. package/dist/{chunk-4A6Y7MGQ.js → chunk-PM5JBU7Z.js} +2 -2
  14. package/dist/{chunk-IAWSQ5AX.mjs → chunk-QE2RQBEB.mjs} +527 -648
  15. package/dist/{chunk-Z22G7IM3.mjs → chunk-RIM7CNHX.mjs} +1 -1
  16. package/dist/{chunk-KCL7KVDF.mjs → chunk-VQX5TBLP.mjs} +1 -1
  17. package/dist/{chunk-X6GFPXO4.mjs → chunk-WGIN2BGP.mjs} +11 -11
  18. package/dist/{chunk-L46S3DXB.mjs → chunk-Y4WK22DY.mjs} +1 -1
  19. package/dist/{chunk-A7SAZMVH.mjs → chunk-ZIBEDH47.mjs} +1 -1
  20. package/dist/executors.js +14 -14
  21. package/dist/executors.mjs +7 -7
  22. package/dist/index.js +17 -17
  23. package/dist/index.mjs +9 -9
  24. package/dist/src/base/base-executor.js +3 -3
  25. package/dist/src/base/base-executor.mjs +2 -2
  26. package/dist/src/executors/build/executor.js +5 -5
  27. package/dist/src/executors/build/executor.mjs +3 -3
  28. package/dist/src/executors/clean/executor.js +5 -5
  29. package/dist/src/executors/clean/executor.mjs +3 -3
  30. package/dist/src/executors/docs/executor.js +5 -5
  31. package/dist/src/executors/docs/executor.mjs +3 -3
  32. package/dist/src/executors/lint/executor.js +5 -5
  33. package/dist/src/executors/lint/executor.mjs +3 -3
  34. package/dist/src/executors/prepare/executor.js +5 -5
  35. package/dist/src/executors/prepare/executor.mjs +3 -3
  36. package/dist/src/helpers/plugin-utilities.js +5 -5
  37. package/dist/src/helpers/plugin-utilities.mjs +2 -2
  38. package/dist/src/plugin/index.js +4 -4
  39. package/dist/src/plugin/index.mjs +3 -3
  40. package/dist/src/types/plugin.d.mts +24 -0
  41. package/dist/src/types/plugin.d.ts +24 -0
  42. package/package.json +8 -8
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkACE6O62X_js = require('./chunk-ACE6O62X.js');
3
+ var chunk2PYUYDPD_js = require('./chunk-2PYUYDPD.js');
4
4
  var chunkSHUYVCID_js = require('./chunk-SHUYVCID.js');
5
5
  var logger = require('@storm-software/config-tools/logger');
6
6
  var baseExecutor = require('@storm-software/workspace-tools/base/base-executor');
@@ -51,6 +51,7 @@ var join = require('@stryke/path/join');
51
51
  var isNull = require('@stryke/type-checks/is-null');
52
52
  var isString = require('@stryke/type-checks/is-string');
53
53
  var uuid = require('@stryke/unique-id/uuid');
54
+ var bundleRequire = require('bundle-require');
54
55
  var jiti = require('jiti');
55
56
  var isUndefined = require('@stryke/type-checks/is-undefined');
56
57
  var parseTypeDefinition = require('@stryke/convert/parse-type-definition');
@@ -58,8 +59,10 @@ var isFile = require('@stryke/fs/is-file');
58
59
  var $ = require('@stryke/capnp');
59
60
  var bufferToString = require('@stryke/convert/buffer-to-string');
60
61
  var buffer = require('@stryke/fs/buffer');
62
+ var correctPath = require('@stryke/path/correct-path');
61
63
  var prettyBytes = require('@stryke/string-format/pretty-bytes');
62
64
  var isBuffer = require('@stryke/type-checks/is-buffer');
65
+ var flatCache = require('flat-cache');
63
66
  var buffer$1 = require('buffer');
64
67
  var _fs = require('fs');
65
68
  var colors = require('@storm-software/config-tools/utilities/colors');
@@ -67,6 +70,7 @@ var noop = require('@stryke/helpers/noop');
67
70
  var isParentPath = require('@stryke/path/is-parent-path');
68
71
  var memfs = require('memfs');
69
72
  var unionfs = require('unionfs');
73
+ var tsMorph = require('ts-morph');
70
74
  var isObject = require('@stryke/type-checks/is-object');
71
75
 
72
76
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
@@ -102,7 +106,7 @@ function resolveModulePath(nodePath, state) {
102
106
  return;
103
107
  }
104
108
  const sourcePath = nodePath.node.value;
105
- const resolvedPath = state.context?.fs.resolve(sourcePath);
109
+ const resolvedPath = state.context?.fs.resolveSync(sourcePath);
106
110
  if (resolvedPath) {
107
111
  nodePath.replaceWith(t__namespace.stringLiteral(
108
112
  // Remove the file extension if it exists
@@ -206,33 +210,31 @@ function formatTypes(code) {
206
210
  ).replaceAll("#private;", "").replace(/__Ω/g, "");
207
211
  }
208
212
  chunkSHUYVCID_js.__name(formatTypes, "formatTypes");
209
- async function emitTypes(context, tsconfig, files) {
210
- context.log(types.LogLevelLabel.TRACE, "Creating the TypeScript compiler host");
211
- const program = ts2.createProgram(files, tsconfig.options, ts2.createCompilerHost(tsconfig.options));
212
- context.log(types.LogLevelLabel.TRACE, `Running the TypeScript compiler for ${context.builtins.length} built-in runtime files.`);
213
+ async function emitTypes(context, files) {
214
+ context.log(types.LogLevelLabel.TRACE, `Running the TypeScript compiler for ${files.length} generated runtime files.`);
215
+ context.program.addSourceFilesAtPaths(files);
216
+ const result = context.program.emitToMemory({
217
+ emitOnlyDtsFiles: true
218
+ });
213
219
  let builtinModules = "";
214
- const emitResult = program.emit(void 0, (fileName, text, _, __, sourceFiles, _data) => {
215
- const sourceFile = sourceFiles?.[0];
216
- if (sourceFile?.fileName && !fileName.endsWith(".map")) {
217
- if (context.builtins.some((file) => file === sourceFile.fileName || context.fs.metadata[file]?.id && context.fs.metadata[file]?.id === sourceFile.fileName)) {
220
+ for (const file of result.getFiles()) {
221
+ if (!file.filePath.endsWith(".map")) {
222
+ if (context.builtins.some((builtin) => builtin === file.filePath || context.fs.metadata[builtin]?.id && context.fs.metadata[builtin]?.id === file.filePath)) {
223
+ const module = await context.fs.resolve(file.filePath);
218
224
  builtinModules += `
219
- declare module "${context.fs.resolve(sourceFile.fileName)}" {
220
- ${text.trim().replace(/^\s*export\s*declare\s*/gm, "export ").replace(/^\s*declare\s*/gm, "")}
221
- }
222
- `;
225
+ declare module "${module}" {
226
+ ${file.text.trim().replace(/^\s*export\s*declare\s*/gm, "export ").replace(/^\s*declare\s*/gm, "")}
227
+ }
228
+ `;
223
229
  }
224
230
  }
225
- }, void 0, true);
226
- const diagnostics = ts2.getPreEmitDiagnostics(program).concat(emitResult.diagnostics);
231
+ }
227
232
  const diagnosticMessages = [];
228
- diagnostics.forEach((diagnostic) => {
229
- if (diagnostic.file) {
230
- const { line, character } = ts2.getLineAndCharacterOfPosition(diagnostic.file, diagnostic.start);
231
- const message = ts2.flattenDiagnosticMessageText(diagnostic.messageText, "\n");
232
- diagnosticMessages.push(`${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}`);
233
+ result.getDiagnostics().forEach((diagnostic) => {
234
+ if (diagnostic.getSourceFile()?.getBaseName()) {
235
+ diagnosticMessages.push(`${diagnostic.getSourceFile()?.getBaseName()} (${(diagnostic.getLineNumber() ?? 0) + 1}): ${ts2.flattenDiagnosticMessageText(diagnostic.getMessageText().toString(), "\n")}`);
233
236
  } else {
234
- const message = ts2.flattenDiagnosticMessageText(diagnostic.messageText, "\n");
235
- diagnosticMessages.push(message);
237
+ diagnosticMessages.push(ts2.flattenDiagnosticMessageText(diagnostic.getMessageText().toString(), "\n"));
236
238
  }
237
239
  });
238
240
  const diagnosticMessage = diagnosticMessages.join("\n");
@@ -547,6 +549,7 @@ async function initializeTsconfig(context) {
547
549
  const tsconfigFilePath = getTsconfigFilePath(context.workspaceConfig.workspaceRoot, context.config.projectRoot, context.config.tsconfig);
548
550
  context.tsconfig.originalTsconfigJson = await json.readJsonFile(tsconfigFilePath);
549
551
  context.tsconfig.tsconfigJson = await resolveTsconfigChanges(context);
552
+ context.log(types.LogLevelLabel.TRACE, "Writing updated TypeScript configuration (tsconfig.json) file to disk.");
550
553
  await context.fs.writeFile(tsconfigFilePath, stormJson.StormJSON.stringify(context.tsconfig.tsconfigJson), {
551
554
  mode: "fs"
552
555
  });
@@ -654,6 +657,7 @@ function createDefaultEnvironment(userConfig) {
654
657
  chunkSHUYVCID_js.__name(createDefaultEnvironment, "createDefaultEnvironment");
655
658
  function resolveOptions(options) {
656
659
  return defu5__default.default(options, {
660
+ debug: options.logLevel === "trace",
657
661
  interopDefault: true,
658
662
  fsCache: options.mode !== "development" ? joinPaths.joinPaths(options.cacheDir, "jiti") : false,
659
663
  moduleCache: options.mode !== "development"
@@ -747,8 +751,6 @@ function replacePathTokens(context, path) {
747
751
  return path.replaceAll("{workspaceRoot}", context.workspaceConfig.workspaceRoot).replaceAll("{root}", context.config.projectRoot).replaceAll("{projectRoot}", context.config.projectRoot).replaceAll("{powerlinesPath}", context.powerlinesPath).replaceAll("{cachePath}", context.cachePath).replaceAll("{dataPath}", context.dataPath).replaceAll("{logPath}", context.envPaths.log).replaceAll("{tempPath}", context.envPaths.temp).replaceAll("{configPath}", context.envPaths.config).replaceAll("{outputPath}", context.config.output.outputPath).replaceAll("{distPath}", context.config.output.distPath).replaceAll("{artifactsPath}", replace.replacePath(context.artifactsPath, context.workspaceConfig.workspaceRoot)).replaceAll("{builtinPath}", replace.replacePath(context.builtinsPath, context.workspaceConfig.workspaceRoot)).replaceAll("{entryPath}", replace.replacePath(context.entryPath, context.workspaceConfig.workspaceRoot));
748
752
  }
749
753
  chunkSHUYVCID_js.__name(replacePathTokens, "replacePathTokens");
750
-
751
- // ../powerlines/src/lib/entry.ts
752
754
  function resolveEntryInputFile(context, typeDefinition) {
753
755
  return replace.replacePath(typeDefinition.file, joinPaths.joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot));
754
756
  }
@@ -896,187 +898,6 @@ var FileMetadata = class _FileMetadata extends $__namespace.Struct {
896
898
  return "FileMetadata_" + super.toString();
897
899
  }
898
900
  };
899
- var ChunkData = class extends $__namespace.Struct {
900
- static {
901
- chunkSHUYVCID_js.__name(this, "ChunkData");
902
- }
903
- static _capnp = {
904
- displayName: "ChunkData",
905
- id: "84076f13b057f83a",
906
- size: new $__namespace.ObjectSize(8, 4)
907
- };
908
- /**
909
- * An additional name for the file.
910
- *
911
- */
912
- get id() {
913
- return $__namespace.utils.getText(0, this);
914
- }
915
- set id(value) {
916
- $__namespace.utils.setText(0, value, this);
917
- }
918
- /**
919
- * Files that are implicitly loaded after one of the specified files.
920
- *
921
- */
922
- get name() {
923
- return $__namespace.utils.getText(1, this);
924
- }
925
- set name(value) {
926
- $__namespace.utils.setText(1, value, this);
927
- }
928
- _adoptImplicitlyLoadedAfterOneOf(value) {
929
- $__namespace.utils.adopt(value, $__namespace.utils.getPointer(2, this));
930
- }
931
- _disownImplicitlyLoadedAfterOneOf() {
932
- return $__namespace.utils.disown(this.implicitlyLoadedAfterOneOf);
933
- }
934
- /**
935
- * The importer of the file.
936
- *
937
- */
938
- get implicitlyLoadedAfterOneOf() {
939
- return $__namespace.utils.getList(2, $__namespace.TextList, this);
940
- }
941
- _hasImplicitlyLoadedAfterOneOf() {
942
- return !$__namespace.utils.isNull($__namespace.utils.getPointer(2, this));
943
- }
944
- _initImplicitlyLoadedAfterOneOf(length) {
945
- return $__namespace.utils.initList(2, $__namespace.TextList, length, this);
946
- }
947
- set implicitlyLoadedAfterOneOf(value) {
948
- $__namespace.utils.copyFrom(value, $__namespace.utils.getPointer(2, this));
949
- }
950
- /**
951
- * The signature preservation mode for the file.
952
- *
953
- */
954
- get importer() {
955
- return $__namespace.utils.getText(3, this);
956
- }
957
- set importer(value) {
958
- $__namespace.utils.setText(3, value, this);
959
- }
960
- get preserveSignature() {
961
- return $__namespace.utils.getUint16(0, this);
962
- }
963
- set preserveSignature(value) {
964
- $__namespace.utils.setUint16(0, value, this);
965
- }
966
- toString() {
967
- return "ChunkData_" + super.toString();
968
- }
969
- };
970
- var PrebuiltData = class extends $__namespace.Struct {
971
- static {
972
- chunkSHUYVCID_js.__name(this, "PrebuiltData");
973
- }
974
- static _capnp = {
975
- displayName: "PrebuiltData",
976
- id: "c5b1a6ca696328ee",
977
- size: new $__namespace.ObjectSize(0, 4)
978
- };
979
- /**
980
- * An additional name for the file.
981
- *
982
- */
983
- get id() {
984
- return $__namespace.utils.getText(0, this);
985
- }
986
- set id(value) {
987
- $__namespace.utils.setText(0, value, this);
988
- }
989
- /**
990
- * The file exports.
991
- *
992
- */
993
- get name() {
994
- return $__namespace.utils.getText(1, this);
995
- }
996
- set name(value) {
997
- $__namespace.utils.setText(1, value, this);
998
- }
999
- _adoptExports(value) {
1000
- $__namespace.utils.adopt(value, $__namespace.utils.getPointer(2, this));
1001
- }
1002
- _disownExports() {
1003
- return $__namespace.utils.disown(this.exports);
1004
- }
1005
- /**
1006
- * The source map for the file.
1007
- *
1008
- */
1009
- get exports() {
1010
- return $__namespace.utils.getList(2, $__namespace.TextList, this);
1011
- }
1012
- _hasExports() {
1013
- return !$__namespace.utils.isNull($__namespace.utils.getPointer(2, this));
1014
- }
1015
- _initExports(length) {
1016
- return $__namespace.utils.initList(2, $__namespace.TextList, length, this);
1017
- }
1018
- set exports(value) {
1019
- $__namespace.utils.copyFrom(value, $__namespace.utils.getPointer(2, this));
1020
- }
1021
- get map() {
1022
- return $__namespace.utils.getText(3, this);
1023
- }
1024
- set map(value) {
1025
- $__namespace.utils.setText(3, value, this);
1026
- }
1027
- toString() {
1028
- return "PrebuiltData_" + super.toString();
1029
- }
1030
- };
1031
- var AssetData = class extends $__namespace.Struct {
1032
- static {
1033
- chunkSHUYVCID_js.__name(this, "AssetData");
1034
- }
1035
- static _capnp = {
1036
- displayName: "AssetData",
1037
- id: "da660c6c1fa4c830",
1038
- size: new $__namespace.ObjectSize(8, 3)
1039
- };
1040
- /**
1041
- * An additional name for the file.
1042
- *
1043
- */
1044
- get id() {
1045
- return $__namespace.utils.getText(0, this);
1046
- }
1047
- set id(value) {
1048
- $__namespace.utils.setText(0, value, this);
1049
- }
1050
- /**
1051
- * Indicates whether the file needs a code reference.
1052
- *
1053
- */
1054
- get name() {
1055
- return $__namespace.utils.getText(1, this);
1056
- }
1057
- set name(value) {
1058
- $__namespace.utils.setText(1, value, this);
1059
- }
1060
- /**
1061
- * The original file name before any transformations.
1062
- *
1063
- */
1064
- get needsCodeReference() {
1065
- return $__namespace.utils.getBit(0, this);
1066
- }
1067
- set needsCodeReference(value) {
1068
- $__namespace.utils.setBit(0, value, this);
1069
- }
1070
- get originalFileName() {
1071
- return $__namespace.utils.getText(2, this);
1072
- }
1073
- set originalFileName(value) {
1074
- $__namespace.utils.setText(2, value, this);
1075
- }
1076
- toString() {
1077
- return "AssetData_" + super.toString();
1078
- }
1079
- };
1080
901
  var FileId = class extends $__namespace.Struct {
1081
902
  static {
1082
903
  chunkSHUYVCID_js.__name(this, "FileId");
@@ -1142,14 +963,11 @@ var FileSystem = class _FileSystem extends $__namespace.Struct {
1142
963
  static _capnp = {
1143
964
  displayName: "FileSystem",
1144
965
  id: "ae0c23d43e56abcf",
1145
- size: new $__namespace.ObjectSize(0, 6)
966
+ size: new $__namespace.ObjectSize(0, 3)
1146
967
  };
1147
968
  static _Ids;
1148
969
  static _Files;
1149
970
  static _Metadata;
1150
- static _Assets;
1151
- static _Chunks;
1152
- static _Prebuilt;
1153
971
  _adoptIds(value) {
1154
972
  $__namespace.utils.adopt(value, $__namespace.utils.getPointer(0, this));
1155
973
  }
@@ -1204,60 +1022,6 @@ var FileSystem = class _FileSystem extends $__namespace.Struct {
1204
1022
  set metadata(value) {
1205
1023
  $__namespace.utils.copyFrom(value, $__namespace.utils.getPointer(2, this));
1206
1024
  }
1207
- _adoptAssets(value) {
1208
- $__namespace.utils.adopt(value, $__namespace.utils.getPointer(3, this));
1209
- }
1210
- _disownAssets() {
1211
- return $__namespace.utils.disown(this.assets);
1212
- }
1213
- get assets() {
1214
- return $__namespace.utils.getList(3, _FileSystem._Assets, this);
1215
- }
1216
- _hasAssets() {
1217
- return !$__namespace.utils.isNull($__namespace.utils.getPointer(3, this));
1218
- }
1219
- _initAssets(length) {
1220
- return $__namespace.utils.initList(3, _FileSystem._Assets, length, this);
1221
- }
1222
- set assets(value) {
1223
- $__namespace.utils.copyFrom(value, $__namespace.utils.getPointer(3, this));
1224
- }
1225
- _adoptChunks(value) {
1226
- $__namespace.utils.adopt(value, $__namespace.utils.getPointer(4, this));
1227
- }
1228
- _disownChunks() {
1229
- return $__namespace.utils.disown(this.chunks);
1230
- }
1231
- get chunks() {
1232
- return $__namespace.utils.getList(4, _FileSystem._Chunks, this);
1233
- }
1234
- _hasChunks() {
1235
- return !$__namespace.utils.isNull($__namespace.utils.getPointer(4, this));
1236
- }
1237
- _initChunks(length) {
1238
- return $__namespace.utils.initList(4, _FileSystem._Chunks, length, this);
1239
- }
1240
- set chunks(value) {
1241
- $__namespace.utils.copyFrom(value, $__namespace.utils.getPointer(4, this));
1242
- }
1243
- _adoptPrebuilt(value) {
1244
- $__namespace.utils.adopt(value, $__namespace.utils.getPointer(5, this));
1245
- }
1246
- _disownPrebuilt() {
1247
- return $__namespace.utils.disown(this.prebuilt);
1248
- }
1249
- get prebuilt() {
1250
- return $__namespace.utils.getList(5, _FileSystem._Prebuilt, this);
1251
- }
1252
- _hasPrebuilt() {
1253
- return !$__namespace.utils.isNull($__namespace.utils.getPointer(5, this));
1254
- }
1255
- _initPrebuilt(length) {
1256
- return $__namespace.utils.initList(5, _FileSystem._Prebuilt, length, this);
1257
- }
1258
- set prebuilt(value) {
1259
- $__namespace.utils.copyFrom(value, $__namespace.utils.getPointer(5, this));
1260
- }
1261
1025
  toString() {
1262
1026
  return "FileSystem_" + super.toString();
1263
1027
  }
@@ -1266,9 +1030,6 @@ FileMetadata._Properties = $__namespace.CompositeList(FileMetadata_KeyValuePair)
1266
1030
  FileSystem._Ids = $__namespace.CompositeList(FileId);
1267
1031
  FileSystem._Files = $__namespace.CompositeList(FileData);
1268
1032
  FileSystem._Metadata = $__namespace.CompositeList(FileMetadata);
1269
- FileSystem._Assets = $__namespace.CompositeList(AssetData);
1270
- FileSystem._Chunks = $__namespace.CompositeList(ChunkData);
1271
- FileSystem._Prebuilt = $__namespace.CompositeList(PrebuiltData);
1272
1033
 
1273
1034
  // ../powerlines/src/types/fs.ts
1274
1035
  var __VFS_PATCH__ = "__VFS_PATCH__";
@@ -1316,13 +1077,9 @@ function isBufferEncoding(options) {
1316
1077
  }
1317
1078
  chunkSHUYVCID_js.__name(isBufferEncoding, "isBufferEncoding");
1318
1079
  function isPowerlinesWriteFileOptions(options) {
1319
- return !isBufferEncoding(options) && isSetObject.isSetObject(options) && ("skipFormat" in options || "mode" in options && (options.mode === "fs" || options.mode === "virtual"));
1080
+ return !isBufferEncoding(options) && isSetObject.isSetObject(options) && "mode" in options && (options.mode === "fs" || options.mode === "virtual");
1320
1081
  }
1321
1082
  chunkSHUYVCID_js.__name(isPowerlinesWriteFileOptions, "isPowerlinesWriteFileOptions");
1322
- function isNodeWriteFileOptions(options) {
1323
- return !isUndefined.isUndefined(options) && (isBufferEncoding(options) || !isPowerlinesWriteFileOptions(options));
1324
- }
1325
- chunkSHUYVCID_js.__name(isNodeWriteFileOptions, "isNodeWriteFileOptions");
1326
1083
  function isVirtualFileData(obj) {
1327
1084
  return !!(isSetObject.isSetObject(obj) && "code" in obj && obj.code);
1328
1085
  }
@@ -1459,6 +1216,18 @@ function patchFS(originalFS, vfs) {
1459
1216
  };
1460
1217
  }
1461
1218
  chunkSHUYVCID_js.__name(patchFS, "patchFS");
1219
+ function isValidId(id, prefix = "powerlines") {
1220
+ return id.replace(/^\\0/, "").startsWith(`${prefix.replace(/:$/, "")}`);
1221
+ }
1222
+ chunkSHUYVCID_js.__name(isValidId, "isValidId");
1223
+ function normalizeId(id, prefix = "powerlines") {
1224
+ return `${prefix.replace(/:$/, "")}:${toFilePath(id).replace(new RegExp(`^${prefix.replace(/:$/, "")}:`), "").replace(/^\\0/, "").replace(filePathFns.findFileDotExtensionSafe(toFilePath(id)), "")}`;
1225
+ }
1226
+ chunkSHUYVCID_js.__name(normalizeId, "normalizeId");
1227
+ function normalizePath(path, builtinsPath, prefix = "powerlines") {
1228
+ return isValidId(toFilePath(path), prefix) ? normalizeId(toFilePath(path), prefix).replace(new RegExp(`^${prefix.replace(/:$/, "")}:`), builtinsPath) : toFilePath(path);
1229
+ }
1230
+ chunkSHUYVCID_js.__name(normalizePath, "normalizePath");
1462
1231
  var UnifiedFS = class _UnifiedFS extends unionfs.Union {
1463
1232
  static {
1464
1233
  chunkSHUYVCID_js.__name(this, "UnifiedFS");
@@ -1635,9 +1404,9 @@ var VirtualFileSystem = class _VirtualFileSystem {
1635
1404
  */
1636
1405
  #paths;
1637
1406
  /**
1638
- * A map of virtual file paths to their underlying file content.
1407
+ * A cache for module resolution results.
1639
1408
  */
1640
- #cachedResolver = /* @__PURE__ */ new Map();
1409
+ #resolverCache;
1641
1410
  /**
1642
1411
  * The unified volume that combines the virtual file system with the real file system.
1643
1412
  *
@@ -1672,189 +1441,35 @@ var VirtualFileSystem = class _VirtualFileSystem {
1672
1441
  * @returns `true` if the path exists, otherwise `false`.
1673
1442
  */
1674
1443
  #existsSync(path) {
1675
- const formattedPath = this.formatPath(path);
1676
- return this.#unifiedFS.virtual.existsSync(formattedPath) || this.#unifiedFS.physical.existsSync(formattedPath) || this.#unifiedFS.resolveFS(path).existsSync(formattedPath);
1677
- }
1678
- /**
1679
- * Builds a regular expression from a string pattern for path matching.
1680
- *
1681
- * @param strPattern - The string pattern to convert.
1682
- * @returns A regular expression for matching paths.
1683
- */
1684
- #buildRegex(strPattern) {
1685
- const token = "::GLOBSTAR::";
1686
- return new RegExp(`^${this.formatPath(strPattern).replace(/\*\*/g, token).replace(/[.+^${}()|[\]\\]/g, "\\$&").replace(/\*/g, "[^/]*").replace(/\?/g, "[^/]").replace(new RegExp(token, "g"), ".*")}$`);
1444
+ return this.#unifiedFS.virtual.existsSync(this.#normalizePath(path)) || this.#unifiedFS.physical.existsSync(this.#normalizePath(path)) || this.#unifiedFS.resolveFS(path).existsSync(this.#normalizePath(path));
1687
1445
  }
1688
1446
  /**
1689
- * Formats a file id by removing the file extension and prepending the runtime prefix.
1447
+ * Normalizes a given module id by resolving it against the built-ins path.
1690
1448
  *
1691
- * @param id - The file ID to format.
1692
- * @returns The formatted file ID.
1449
+ * @param id - The module id to normalize.
1450
+ * @returns The normalized module id.
1693
1451
  */
1694
- #formatId(id) {
1695
- const formattedId = toFilePath(id);
1696
- return `${this.#context.config.output.builtinPrefix}:${formattedId.replace(new RegExp(`^${this.#context.config.output.builtinPrefix}:`), "").replace(/^\\0/, "").replace(filePathFns.findFileDotExtensionSafe(formattedId), "")}`;
1697
- }
1698
- /**
1699
- * Resolves an id parameter to a corresponding virtual file path in the virtual file system (VFS).
1700
- *
1701
- * @param id - The id to resolve.
1702
- * @returns The resolved file id if it exists, otherwise undefined.
1703
- */
1704
- #resolveId(id) {
1705
- if (this.#ids[this.#formatId(id)]) {
1706
- return this.#ids[this.#formatId(id)] || false;
1707
- }
1708
- return false;
1709
- }
1710
- /**
1711
- * Resolves a path parameter to a corresponding virtual file path in the virtual file system (VFS).
1712
- *
1713
- * @param path - The path to resolve.
1714
- * @param options - Optional parameters for resolving the path.
1715
- * @returns The resolved file path if it exists, otherwise undefined.
1716
- */
1717
- #resolvePath(path, options = {}) {
1718
- if (isType.isAbsolutePath(path)) {
1719
- if (this.#existsSync(path)) {
1720
- return path;
1721
- }
1722
- const result = this.#checkVariants(path);
1723
- if (result) {
1724
- return result;
1725
- }
1726
- }
1727
- for (const parentPath of this.#resolveParentPaths(path, options.paths)) {
1728
- const request = joinPaths.joinPaths(parentPath, path);
1729
- if (this.#existsSync(request)) {
1730
- return request;
1731
- }
1732
- const result = this.#checkVariants(request);
1733
- if (result) {
1734
- return result;
1735
- }
1736
- }
1737
- return false;
1738
- }
1739
- /**
1740
- * Resolves parent paths for a given request.
1741
- *
1742
- * @param request - The request path to resolve parent paths for.
1743
- * @param parents - An optional array of parent paths to consider.
1744
- * @returns An array of resolved parent paths.
1745
- */
1746
- #resolveParentPaths(request, parents = []) {
1747
- let paths = [
1748
- this.#context.workspaceConfig.workspaceRoot,
1749
- joinPaths.joinPaths(this.#context.workspaceConfig.workspaceRoot, this.#context.config.projectRoot)
1750
- ];
1751
- if (this.#context.tsconfig.options.paths) {
1752
- paths = this.#context.tsconfig.options.paths ? Object.keys(this.#context.tsconfig.options.paths).filter((tsconfigPath) => request.startsWith(tsconfigPath.replaceAll("*", ""))).map((tsconfigPath) => this.#context.tsconfig.options.paths?.[tsconfigPath]).flat().reduce((ret, path) => {
1753
- if (path && !ret.includes(joinPaths.joinPaths(this.#context.workspaceConfig.workspaceRoot, path))) {
1754
- ret.push(joinPaths.joinPaths(this.#context.workspaceConfig.workspaceRoot, path));
1755
- }
1756
- return ret;
1757
- }, paths) : paths;
1758
- }
1759
- return paths.reduce((ret, path) => {
1760
- if (!ret.includes(path)) {
1761
- ret.push(path);
1762
- }
1763
- return ret;
1764
- }, parents.filter(Boolean).map((p) => this.formatPath(p)));
1452
+ #normalizeId(id) {
1453
+ return normalizeId(id, this.#context.config.output.builtinPrefix);
1765
1454
  }
1766
1455
  /**
1767
- * Clears the resolver cache for a given path.
1456
+ * Normalizes a given path by resolving it against the project root, workspace root, and built-ins path.
1768
1457
  *
1769
- * @param path - The path to clear the resolver cache for.
1458
+ * @param path - The path to normalize.
1459
+ * @returns The normalized path.
1770
1460
  */
1771
- #clearResolverCache(path) {
1772
- this.#cachedResolver.keys().filter((key) => key.startsWith(toFilePath(path))).forEach((key) => this.#cachedResolver.delete(key));
1461
+ #normalizePath(path) {
1462
+ return normalizePath(path, this.#context.builtinsPath, this.#context.config.output.builtinPrefix);
1773
1463
  }
1774
1464
  /**
1775
- * Check if the file exists with different variants (index, extensions).
1776
- *
1777
- * @param request - The request path to check.
1778
- * @param parentPath - An optional parent path to prepend to the request.
1779
- * @returns The file path if it exists, otherwise false.
1780
- */
1781
- #checkVariants(request, parentPath) {
1782
- const path = parentPath ? joinPaths.joinPaths(parentPath, request) : request;
1783
- let file = this.#checkExtensions(path);
1784
- if (file) {
1785
- return file;
1786
- }
1787
- file = this.#checkIndex(path);
1788
- if (file) {
1789
- return file;
1790
- }
1791
- return false;
1792
- }
1793
- /**
1794
- * Check if the index file exists in the given request path.
1795
- *
1796
- * @param request - The request path to check.
1797
- * @returns The index file path if it exists, otherwise false.
1798
- */
1799
- #checkIndex(request) {
1800
- let file = joinPaths.joinPaths(request, "index");
1801
- if (this.#existsSync(file)) {
1802
- return file;
1803
- }
1804
- file = this.#checkExtensions(file);
1805
- if (file) {
1806
- return file;
1807
- }
1808
- return false;
1809
- }
1810
- /**
1811
- * Check if the file exists with different extensions.
1465
+ * Builds a regular expression from a string pattern for path matching.
1812
1466
  *
1813
- * @param request - The request path to check.
1814
- * @returns The file path if it exists with any of the checked extensions, otherwise false.
1467
+ * @param path - The string pattern to convert.
1468
+ * @returns A regular expression for matching paths.
1815
1469
  */
1816
- #checkExtensions(request) {
1817
- let file = `${request}.ts`;
1818
- if (this.#existsSync(file)) {
1819
- return file;
1820
- }
1821
- file = `${request}.mts`;
1822
- if (this.#existsSync(file)) {
1823
- return file;
1824
- }
1825
- file = `${request}.cts`;
1826
- if (this.#existsSync(file)) {
1827
- return file;
1828
- }
1829
- file = `${request}.tsx`;
1830
- if (this.#existsSync(file)) {
1831
- return file;
1832
- }
1833
- file = `${request}.js`;
1834
- if (this.#existsSync(file)) {
1835
- return file;
1836
- }
1837
- file = `${request}.mjs`;
1838
- if (this.#existsSync(file)) {
1839
- return file;
1840
- }
1841
- file = `${request}.cjs`;
1842
- if (this.#existsSync(file)) {
1843
- return file;
1844
- }
1845
- file = `${request}.jsx`;
1846
- if (this.#existsSync(file)) {
1847
- return file;
1848
- }
1849
- file = `${request}.json`;
1850
- if (this.#existsSync(file)) {
1851
- return file;
1852
- }
1853
- file = `${request}.d.ts`;
1854
- if (this.#existsSync(file)) {
1855
- return file;
1856
- }
1857
- return false;
1470
+ #buildRegex(path) {
1471
+ const token = "::GLOBSTAR::";
1472
+ return new RegExp(`^${this.#normalizePath(path).replace(/\*\*/g, token).replace(/[.+^${}()|[\]\\]/g, "\\$&").replace(/\*/g, "[^/]*").replace(/\?/g, "[^/]").replace(new RegExp(token, "g"), ".*")}$`);
1858
1473
  }
1859
1474
  /**
1860
1475
  * Creates a virtual file system (VFS) that is backed up to a Cap'n Proto message buffer.
@@ -1863,8 +1478,8 @@ var VirtualFileSystem = class _VirtualFileSystem {
1863
1478
  * @returns A promise that resolves to a new virtual file system instance.
1864
1479
  */
1865
1480
  static async create(context) {
1866
- if (!context.config.skipCache && exists.existsSync(joinPaths.joinPaths(context.cachePath, "fs.bin"))) {
1867
- const buffer$1 = await buffer.readFileBuffer(joinPaths.joinPaths(context.cachePath, "fs.bin"));
1481
+ if (!context.config.skipCache && exists.existsSync(joinPaths.joinPaths(context.dataPath, "fs.bin"))) {
1482
+ const buffer$1 = await buffer.readFileBuffer(joinPaths.joinPaths(context.dataPath, "fs.bin"));
1868
1483
  const message2 = new $__namespace.Message(buffer$1, false);
1869
1484
  return new _VirtualFileSystem(context, message2.getRoot(FileSystem));
1870
1485
  }
@@ -1878,8 +1493,8 @@ var VirtualFileSystem = class _VirtualFileSystem {
1878
1493
  * @returns A new virtual file system instance.
1879
1494
  */
1880
1495
  static createSync(context) {
1881
- if (!context.config.skipCache && exists.existsSync(joinPaths.joinPaths(context.cachePath, "fs.bin"))) {
1882
- const buffer$1 = buffer.readFileBufferSync(joinPaths.joinPaths(context.cachePath, "fs.bin"));
1496
+ if (!context.config.skipCache && exists.existsSync(joinPaths.joinPaths(context.dataPath, "fs.bin"))) {
1497
+ const buffer$1 = buffer.readFileBufferSync(joinPaths.joinPaths(context.dataPath, "fs.bin"));
1883
1498
  const message2 = new $__namespace.Message(buffer$1, false);
1884
1499
  return new _VirtualFileSystem(context, message2.getRoot(FileSystem));
1885
1500
  }
@@ -1890,19 +1505,43 @@ var VirtualFileSystem = class _VirtualFileSystem {
1890
1505
  * A map of file ids to their metadata.
1891
1506
  */
1892
1507
  get metadata() {
1893
- return this.#metadata;
1508
+ return new Proxy(this.#metadata, {
1509
+ get: /* @__PURE__ */ chunkSHUYVCID_js.__name((target, prop) => {
1510
+ return target[this.#normalizeId(prop)];
1511
+ }, "get")
1512
+ });
1894
1513
  }
1895
1514
  /**
1896
- * A map of module ids to their file paths.
1515
+ * A map of file paths to their module ids.
1897
1516
  */
1898
1517
  get ids() {
1899
- return this.#ids;
1518
+ return new Proxy(this.#paths, {
1519
+ get: /* @__PURE__ */ chunkSHUYVCID_js.__name((target, prop) => {
1520
+ return target[this.#normalizePath(prop)];
1521
+ }, "get")
1522
+ });
1900
1523
  }
1901
1524
  /**
1902
- * A map of virtual file paths to their IDs.
1525
+ * A map of module ids to their file paths.
1903
1526
  */
1904
1527
  get paths() {
1905
- return this.#paths;
1528
+ return new Proxy(this.#paths, {
1529
+ get: /* @__PURE__ */ chunkSHUYVCID_js.__name((target, prop) => {
1530
+ return target[this.#normalizeId(prop)];
1531
+ }, "get")
1532
+ });
1533
+ }
1534
+ get resolverCache() {
1535
+ if (!this.#resolverCache) {
1536
+ this.#resolverCache = flatCache.create({
1537
+ cacheId: "module-resolution",
1538
+ cacheDir: this.#context.cachePath,
1539
+ ttl: 60 * 60 * 1e3,
1540
+ lruSize: 5e3,
1541
+ persistInterval: 100
1542
+ });
1543
+ }
1544
+ return this.#resolverCache;
1906
1545
  }
1907
1546
  /**
1908
1547
  * Creates a new instance of the {@link VirtualFileSystem}.
@@ -1947,17 +1586,13 @@ var VirtualFileSystem = class _VirtualFileSystem {
1947
1586
  * Check if a path or id corresponds to a virtual file **(does not actually exists on disk)**.
1948
1587
  *
1949
1588
  * @param pathOrId - The path or id to check.
1950
- * @param options - Optional parameters for resolving the path.
1951
1589
  * @returns Whether the path or id corresponds to a virtual file **(does not actually exists on disk)**.
1952
1590
  */
1953
- isVirtual(pathOrId, options = {}) {
1591
+ isVirtual(pathOrId, importer, options = {}) {
1954
1592
  if (!pathOrId) {
1955
1593
  return false;
1956
1594
  }
1957
- const resolvedPath = this.resolve(pathOrId, {
1958
- ...options,
1959
- pathType: "file"
1960
- });
1595
+ const resolvedPath = this.resolveSync(pathOrId, importer, options);
1961
1596
  if (!resolvedPath) {
1962
1597
  return false;
1963
1598
  }
@@ -1967,17 +1602,13 @@ var VirtualFileSystem = class _VirtualFileSystem {
1967
1602
  * Check if a path or id corresponds to a file written to the file system **(actually exists on disk)**.
1968
1603
  *
1969
1604
  * @param pathOrId - The path or id to check.
1970
- * @param options - Optional parameters for resolving the path.
1971
1605
  * @returns Whether the path or id corresponds to a file written to the file system **(actually exists on disk)**.
1972
1606
  */
1973
- isPhysical(pathOrId, options = {}) {
1607
+ isPhysical(pathOrId, importer, options = {}) {
1974
1608
  if (!pathOrId) {
1975
1609
  return false;
1976
1610
  }
1977
- const resolvedPath = this.resolve(pathOrId, {
1978
- ...options,
1979
- pathType: "file"
1980
- });
1611
+ const resolvedPath = this.resolveSync(pathOrId, importer, options);
1981
1612
  if (!resolvedPath) {
1982
1613
  return false;
1983
1614
  }
@@ -1999,16 +1630,17 @@ var VirtualFileSystem = class _VirtualFileSystem {
1999
1630
  * @param path - The path to create the directory at.
2000
1631
  */
2001
1632
  unlinkSync(path, options) {
2002
- const formattedPath = toFilePath(path);
2003
- if (!this.isFile(formattedPath)) {
1633
+ if (!this.isFile(this.#normalizePath(path))) {
2004
1634
  return;
2005
1635
  }
2006
- this.#log(types.LogLevelLabel.TRACE, `Synchronously removing file: ${formattedPath}`);
2007
- this.#unifiedFS.resolveFS(path, options).unlinkSync(formattedPath);
2008
- if (this.paths[formattedPath] && this.metadata[this.paths[formattedPath]]) {
2009
- delete this.metadata[this.paths[formattedPath]];
1636
+ this.#log(types.LogLevelLabel.TRACE, `Synchronously removing file: ${this.#normalizePath(path)}`);
1637
+ this.#unifiedFS.resolveFS(path, options).unlinkSync(this.#normalizePath(path));
1638
+ if (this.#ids[this.#normalizePath(path)] && this.#metadata[this.#ids[this.#normalizePath(path)]]) {
1639
+ delete this.#metadata[this.#ids[this.#normalizePath(path)]];
1640
+ delete this.#ids[this.#normalizePath(path)];
1641
+ delete this.#paths[this.#normalizeId(path)];
1642
+ this.#resolverCache.delete(this.#normalizePath(path));
2010
1643
  }
2011
- this.#clearResolverCache(formattedPath);
2012
1644
  }
2013
1645
  /**
2014
1646
  * Removes a file in the virtual file system (VFS).
@@ -2016,19 +1648,17 @@ var VirtualFileSystem = class _VirtualFileSystem {
2016
1648
  * @param path - The path to create the directory at.
2017
1649
  */
2018
1650
  async unlink(path, options) {
2019
- const formattedPath = toFilePath(path);
2020
- if (!this.isFile(formattedPath)) {
1651
+ if (!this.isFile(this.#normalizePath(path))) {
2021
1652
  return;
2022
1653
  }
2023
- this.#log(types.LogLevelLabel.TRACE, `Removing file: ${formattedPath}`);
1654
+ this.#log(types.LogLevelLabel.TRACE, `Removing file: ${this.#normalizePath(path)}`);
2024
1655
  if (isFunction.isFunction(this.#unifiedFS.resolveFS(path, options).promises.unlink)) {
2025
- await this.#unifiedFS.resolveFS(path, options).promises.unlink(formattedPath);
2026
- if (this.paths[formattedPath] && this.metadata[this.paths[formattedPath]]) {
2027
- delete this.metadata[this.paths[formattedPath]];
1656
+ await this.#unifiedFS.resolveFS(path, options).promises.unlink(this.#normalizePath(path));
1657
+ if (this.#ids[this.#normalizePath(path)] && this.#metadata[this.#ids[this.#normalizePath(path)]]) {
1658
+ delete this.#metadata[this.#ids[this.#normalizePath(path)]];
2028
1659
  }
2029
- this.#clearResolverCache(formattedPath);
2030
1660
  } else {
2031
- this.unlinkSync(formattedPath, options);
1661
+ this.unlinkSync(this.#normalizePath(path), options);
2032
1662
  }
2033
1663
  }
2034
1664
  /**
@@ -2038,15 +1668,13 @@ var VirtualFileSystem = class _VirtualFileSystem {
2038
1668
  * @param options - Options for creating the directory.
2039
1669
  */
2040
1670
  rmdirSync(path, options = {}) {
2041
- const formattedPath = toFilePath(path);
2042
- if (!this.isDirectory(formattedPath)) {
1671
+ if (!this.isDirectory(this.#normalizePath(path))) {
2043
1672
  return;
2044
1673
  }
2045
- this.#log(types.LogLevelLabel.TRACE, `Synchronously removing directory: ${formattedPath}`);
2046
- this.#unifiedFS.resolveFS(path, options).rmdirSync(formattedPath, defu5__default.default(options, {
1674
+ this.#log(types.LogLevelLabel.TRACE, `Synchronously removing directory: ${this.#normalizePath(path)}`);
1675
+ this.#unifiedFS.resolveFS(path, options).rmdirSync(this.#normalizePath(path), defu5__default.default(options, {
2047
1676
  recursive: true
2048
1677
  }));
2049
- this.#clearResolverCache(formattedPath);
2050
1678
  }
2051
1679
  /**
2052
1680
  * Removes a directory in the virtual file system (VFS).
@@ -2056,19 +1684,17 @@ var VirtualFileSystem = class _VirtualFileSystem {
2056
1684
  * @returns A promise that resolves to the path of the created directory, or undefined if the directory could not be created.
2057
1685
  */
2058
1686
  async rmdir(path, options = {}) {
2059
- const formattedPath = toFilePath(path);
2060
- if (!this.isDirectory(formattedPath)) {
1687
+ if (!this.isDirectory(this.#normalizePath(path))) {
2061
1688
  return;
2062
1689
  }
2063
- this.#log(types.LogLevelLabel.TRACE, `Removing directory: ${formattedPath}`);
1690
+ this.#log(types.LogLevelLabel.TRACE, `Removing directory: ${this.#normalizePath(path)}`);
2064
1691
  if (isFunction.isFunction(this.#unifiedFS.resolveFS(path, options).promises.rm)) {
2065
- await this.#unifiedFS.resolveFS(path, options).promises.rm(formattedPath, defu5__default.default(options, {
1692
+ await this.#unifiedFS.resolveFS(path, options).promises.rm(this.#normalizePath(path), defu5__default.default(options, {
2066
1693
  force: true,
2067
1694
  recursive: true
2068
1695
  }));
2069
- this.#clearResolverCache(formattedPath);
2070
1696
  } else {
2071
- this.rmdirSync(formattedPath, defu5__default.default(options ?? {}, {
1697
+ this.rmdirSync(this.#normalizePath(path), defu5__default.default(options ?? {}, {
2072
1698
  force: true,
2073
1699
  recursive: true
2074
1700
  }));
@@ -2082,11 +1708,11 @@ var VirtualFileSystem = class _VirtualFileSystem {
2082
1708
  * @returns A promise that resolves when the file is removed.
2083
1709
  */
2084
1710
  async rm(path, options = {}) {
2085
- this.#log(types.LogLevelLabel.TRACE, `Removing: ${toFilePath(path)}`);
2086
- if (this.isDirectory(path)) {
2087
- return this.rmdir(path, options);
1711
+ this.#log(types.LogLevelLabel.TRACE, `Removing: ${this.#normalizePath(path)}`);
1712
+ if (this.isDirectory(this.#normalizePath(path))) {
1713
+ return this.rmdir(this.#normalizePath(path), options);
2088
1714
  }
2089
- return this.unlink(path, options);
1715
+ return this.unlink(this.#normalizePath(path), options);
2090
1716
  }
2091
1717
  /**
2092
1718
  * Synchronously removes a file or directory in the virtual file system (VFS).
@@ -2095,11 +1721,11 @@ var VirtualFileSystem = class _VirtualFileSystem {
2095
1721
  * @param options - Options for removing the file or directory.
2096
1722
  */
2097
1723
  rmSync(path, options = {}) {
2098
- this.#log(types.LogLevelLabel.TRACE, `Removing: ${toFilePath(path)}`);
2099
- if (this.isDirectory(path)) {
2100
- return this.rmdirSync(path, options);
1724
+ this.#log(types.LogLevelLabel.TRACE, `Removing: ${this.#normalizePath(path)}`);
1725
+ if (this.isDirectory(this.#normalizePath(path))) {
1726
+ return this.rmdirSync(this.#normalizePath(path), options);
2101
1727
  }
2102
- return this.unlinkSync(path, options);
1728
+ return this.unlinkSync(this.#normalizePath(path), options);
2103
1729
  }
2104
1730
  /**
2105
1731
  * Creates a directory in the virtual file system (VFS).
@@ -2109,9 +1735,9 @@ var VirtualFileSystem = class _VirtualFileSystem {
2109
1735
  * @returns A promise that resolves to the path of the created directory, or undefined if the directory could not be created.
2110
1736
  */
2111
1737
  mkdirSync(path, options = {}) {
2112
- const filePath = toFilePath(path);
2113
- this.#clearResolverCache(filePath);
2114
- return this.#unifiedFS.resolveFS(filePath, options).mkdirSync(filePath, defu5__default.default(options ?? {}, {
1738
+ return this.#unifiedFS.resolveFS(this.#normalizePath(path), options).mkdirSync(this.#normalizePath(path), defu5__default.default(omit.omit(options, [
1739
+ "mode"
1740
+ ]), {
2115
1741
  recursive: true
2116
1742
  }));
2117
1743
  }
@@ -2124,17 +1750,19 @@ var VirtualFileSystem = class _VirtualFileSystem {
2124
1750
  */
2125
1751
  async mkdir(path, options = {}) {
2126
1752
  let result;
2127
- const filePath = toFilePath(path);
2128
- if (isFunction.isFunction(this.#unifiedFS.resolveFS(filePath, options).promises.mkdir)) {
2129
- result = await this.#unifiedFS.resolveFS(filePath, options).promises.mkdir(filePath, defu5__default.default(options ?? {}, {
1753
+ if (isFunction.isFunction(this.#unifiedFS.resolveFS(this.#normalizePath(path), options).promises.mkdir)) {
1754
+ result = await this.#unifiedFS.resolveFS(this.#normalizePath(path), options).promises.mkdir(this.#normalizePath(path), defu5__default.default(omit.omit(options, [
1755
+ "mode"
1756
+ ]), {
2130
1757
  recursive: true
2131
1758
  }));
2132
1759
  } else {
2133
- result = this.#unifiedFS.resolveFS(filePath, options).mkdirSync(filePath, defu5__default.default(options ?? {}, {
1760
+ result = this.#unifiedFS.resolveFS(this.#normalizePath(path), options).mkdirSync(this.#normalizePath(path), defu5__default.default(omit.omit(options, [
1761
+ "mode"
1762
+ ]), {
2134
1763
  recursive: true
2135
1764
  }));
2136
1765
  }
2137
- this.#clearResolverCache(filePath);
2138
1766
  return result;
2139
1767
  }
2140
1768
  /**
@@ -2146,17 +1774,15 @@ var VirtualFileSystem = class _VirtualFileSystem {
2146
1774
  async glob(patterns) {
2147
1775
  const results = [];
2148
1776
  for (const pattern of toArray.toArray(patterns)) {
2149
- const normalized = this.formatPath(pattern);
1777
+ const normalized = this.#normalizePath(pattern);
2150
1778
  if (!/[*?[\]{}]/.test(normalized) && !normalized.includes("**")) {
2151
- const resolved = this.resolve(normalized, {
2152
- pathType: "file"
2153
- });
1779
+ const resolved = this.resolveSync(normalized);
2154
1780
  if (resolved && !results.includes(resolved)) {
2155
1781
  results.push(resolved);
2156
1782
  }
2157
1783
  continue;
2158
1784
  }
2159
- const absPattern = isType.isAbsolutePath(normalized) ? normalized : this.formatPath(joinPaths.joinPaths(this.#context.workspaceConfig.workspaceRoot, normalized));
1785
+ const absPattern = isType.isAbsolutePath(normalized) ? normalized : this.#normalizePath(joinPaths.joinPaths(this.#context.workspaceConfig.workspaceRoot, normalized));
2160
1786
  const firstGlobIdx = absPattern.search(/[*?[\]{}]/);
2161
1787
  const baseDir = firstGlobIdx === -1 ? filePathFns.findFilePath(absPattern) : absPattern.slice(0, Math.max(0, absPattern.lastIndexOf("/", firstGlobIdx)));
2162
1788
  const stack = [
@@ -2171,7 +1797,7 @@ var VirtualFileSystem = class _VirtualFileSystem {
2171
1797
  continue;
2172
1798
  }
2173
1799
  for (const entry of entries) {
2174
- const full = this.formatPath(joinPaths.joinPaths(dir, entry));
1800
+ const full = this.#normalizePath(joinPaths.joinPaths(dir, entry));
2175
1801
  let stats;
2176
1802
  try {
2177
1803
  stats = this.#unifiedFS.lstatSync(full);
@@ -2183,9 +1809,7 @@ var VirtualFileSystem = class _VirtualFileSystem {
2183
1809
  stack.push(full);
2184
1810
  } else if (stats.isFile()) {
2185
1811
  if (this.#buildRegex(absPattern).test(full)) {
2186
- const resolved = this.resolve(full, {
2187
- pathType: "file"
2188
- });
1812
+ const resolved = this.resolveSync(full);
2189
1813
  if (resolved && !results.includes(resolved)) {
2190
1814
  results.push(resolved);
2191
1815
  }
@@ -2205,17 +1829,15 @@ var VirtualFileSystem = class _VirtualFileSystem {
2205
1829
  globSync(patterns) {
2206
1830
  const results = [];
2207
1831
  for (const pattern of toArray.toArray(patterns)) {
2208
- const normalized = this.formatPath(pattern);
1832
+ const normalized = this.#normalizePath(pattern);
2209
1833
  if (!/[*?[\]{}]/.test(normalized) && !normalized.includes("**")) {
2210
- const resolved = this.resolve(normalized, {
2211
- pathType: "file"
2212
- });
1834
+ const resolved = this.resolveSync(normalized);
2213
1835
  if (resolved && !results.includes(resolved)) {
2214
1836
  results.push(resolved);
2215
1837
  }
2216
1838
  continue;
2217
1839
  }
2218
- const absPattern = isType.isAbsolutePath(normalized) ? normalized : this.formatPath(joinPaths.joinPaths(this.#context.workspaceConfig.workspaceRoot, normalized));
1840
+ const absPattern = isType.isAbsolutePath(normalized) ? normalized : this.#normalizePath(joinPaths.joinPaths(this.#context.workspaceConfig.workspaceRoot, normalized));
2219
1841
  const firstGlobIdx = absPattern.search(/[*?[\]{}]/);
2220
1842
  const baseDir = firstGlobIdx === -1 ? filePathFns.findFilePath(absPattern) : absPattern.slice(0, Math.max(0, absPattern.lastIndexOf("/", firstGlobIdx)));
2221
1843
  const stack = [
@@ -2230,7 +1852,7 @@ var VirtualFileSystem = class _VirtualFileSystem {
2230
1852
  continue;
2231
1853
  }
2232
1854
  for (const entry of entries) {
2233
- const full = this.formatPath(joinPaths.joinPaths(dir, entry));
1855
+ const full = this.#normalizePath(joinPaths.joinPaths(dir, entry));
2234
1856
  let stats;
2235
1857
  try {
2236
1858
  stats = this.#unifiedFS.lstatSync(full);
@@ -2242,9 +1864,7 @@ var VirtualFileSystem = class _VirtualFileSystem {
2242
1864
  stack.push(full);
2243
1865
  } else if (stats.isFile()) {
2244
1866
  if (this.#buildRegex(absPattern).test(full)) {
2245
- const resolved = this.resolve(full, {
2246
- pathType: "file"
2247
- });
1867
+ const resolved = this.resolveSync(full);
2248
1868
  if (resolved && !results.includes(resolved)) {
2249
1869
  results.push(resolved);
2250
1870
  }
@@ -2314,21 +1934,15 @@ var VirtualFileSystem = class _VirtualFileSystem {
2314
1934
  * @returns A promise that resolves to the contents of the file as a string, or undefined if the file does not exist.
2315
1935
  */
2316
1936
  async readFile(pathOrId, options = "utf8") {
2317
- if (!pathOrId) {
2318
- return void 0;
2319
- }
2320
- const filePath = this.resolve(toFilePath(pathOrId), {
2321
- pathType: "file"
2322
- });
2323
- if (filePath) {
1937
+ const filePath = await this.resolve(pathOrId);
1938
+ if (filePath && this.isFile(filePath)) {
2324
1939
  let result;
2325
1940
  if (isFunction.isFunction(this.#unifiedFS.resolveFS(filePath).promises.readFile)) {
2326
1941
  result = (await this.#unifiedFS.resolveFS(filePath).promises.readFile(filePath, options))?.toString("utf8");
2327
1942
  } else {
2328
1943
  result = this.#unifiedFS.resolveFS(filePath).readFileSync(filePath, options);
2329
1944
  }
2330
- const content = isBuffer.isBuffer(result) ? bufferToString.bufferToString(result) : result;
2331
- return content;
1945
+ return isBuffer.isBuffer(result) ? bufferToString.bufferToString(result) : result;
2332
1946
  }
2333
1947
  return void 0;
2334
1948
  }
@@ -2339,16 +1953,10 @@ var VirtualFileSystem = class _VirtualFileSystem {
2339
1953
  * @returns The contents of the file as a string, or undefined if the file does not exist.
2340
1954
  */
2341
1955
  readFileSync(pathOrId, options = "utf8") {
2342
- if (!pathOrId) {
2343
- return void 0;
2344
- }
2345
- const filePath = this.resolve(toFilePath(pathOrId), {
2346
- pathType: "file"
2347
- });
2348
- if (filePath) {
1956
+ const filePath = this.resolveSync(pathOrId);
1957
+ if (filePath && this.isFile(filePath)) {
2349
1958
  const result = this.#unifiedFS.resolveFS(filePath).readFileSync(filePath, options);
2350
- const content = isBuffer.isBuffer(result) ? bufferToString.bufferToString(result) : result;
2351
- return content;
1959
+ return isBuffer.isBuffer(result) ? bufferToString.bufferToString(result) : result;
2352
1960
  }
2353
1961
  return void 0;
2354
1962
  }
@@ -2361,34 +1969,40 @@ var VirtualFileSystem = class _VirtualFileSystem {
2361
1969
  * @returns A promise that resolves when the file is written.
2362
1970
  */
2363
1971
  async writeFile(path, data = "", options = "utf8") {
2364
- const formattedPath = this.formatPath(path);
2365
- if (!this.isDirectory(filePathFns.findFilePath(formattedPath))) {
2366
- await this.mkdir(filePathFns.findFilePath(formattedPath), isPowerlinesWriteFileOptions(options) ? options : void 0);
1972
+ if (!this.isDirectory(filePathFns.findFilePath(this.#normalizePath(path)))) {
1973
+ await this.mkdir(filePathFns.findFilePath(this.#normalizePath(path)), isPowerlinesWriteFileOptions(options) ? options : void 0);
2367
1974
  }
2368
- let code = isVirtualFileData(data) ? data.code : data;
1975
+ const metadata = isVirtualFileData(data) ? data : {};
1976
+ metadata.id = this.#normalizeId(path);
1977
+ let code = isVirtualFileData(data) ? metadata.code : data;
2369
1978
  if ((!isPowerlinesWriteFileOptions(options) || !options.skipFormat) && isSetString.isSetString(code)) {
2370
- const resolvedConfig = await prettier.resolveConfig(formattedPath);
1979
+ const resolvedConfig = await prettier.resolveConfig(this.#normalizePath(path));
2371
1980
  if (resolvedConfig) {
2372
1981
  code = await prettier.format(code, {
2373
- absolutePath: formattedPath,
1982
+ absolutePath: this.#normalizePath(path),
2374
1983
  ...resolvedConfig
2375
1984
  });
2376
1985
  }
2377
1986
  }
2378
- const outputMode = this.#unifiedFS.resolveMode(formattedPath, isPowerlinesWriteFileOptions(options) ? options : void 0);
2379
- this.#log(types.LogLevelLabel.TRACE, `Writing ${formattedPath} file to the ${outputMode === "fs" ? "" : "virtual "}file system (size: ${prettyBytes.prettyBytes(new buffer$1.Blob(toArray.toArray(code)).size)})`);
2380
- this.metadata[formattedPath] = {
1987
+ const outputMode = this.#unifiedFS.resolveMode(this.#normalizePath(path), isPowerlinesWriteFileOptions(options) ? options : void 0);
1988
+ this.#log(types.LogLevelLabel.TRACE, `Writing ${this.#normalizePath(path)} file to the ${outputMode === "fs" ? "" : "virtual "}file system (size: ${prettyBytes.prettyBytes(new buffer$1.Blob(toArray.toArray(code)).size)})`);
1989
+ this.#metadata[metadata.id] = {
2381
1990
  mode: outputMode,
2382
1991
  variant: "normal",
2383
1992
  timestamp: Date.now(),
2384
- ...isVirtualFileData(data) ? data : {}
1993
+ ...metadata
2385
1994
  };
2386
- this.#clearResolverCache(formattedPath);
2387
- const ifs = this.#unifiedFS.resolveFS(formattedPath, isPowerlinesWriteFileOptions(options) ? options : void 0);
1995
+ this.#paths[metadata.id] = this.#normalizePath(path);
1996
+ this.#ids[this.#normalizePath(path)] = metadata.id;
1997
+ const ifs = this.#unifiedFS.resolveFS(this.#normalizePath(path), isPowerlinesWriteFileOptions(options) ? options : void 0);
2388
1998
  if (isFunction.isFunction(ifs.promises.writeFile)) {
2389
- return ifs.promises.writeFile(formattedPath, code, isNodeWriteFileOptions(options) ? options : "utf8");
1999
+ return ifs.promises.writeFile(this.#normalizePath(path), code, isSetObject.isSetObject(options) ? omit.omit(options, [
2000
+ "mode"
2001
+ ]) : "utf8");
2390
2002
  }
2391
- return ifs.writeFileSync(formattedPath, code, isNodeWriteFileOptions(options) ? options : "utf8");
2003
+ return ifs.writeFileSync(this.#normalizePath(path), code, isSetObject.isSetObject(options) ? omit.omit(options, [
2004
+ "mode"
2005
+ ]) : "utf8");
2392
2006
  }
2393
2007
  /**
2394
2008
  * Synchronously writes a file to the virtual file system (VFS).
@@ -2398,21 +2012,23 @@ var VirtualFileSystem = class _VirtualFileSystem {
2398
2012
  * @param options - Optional parameters for writing the file.
2399
2013
  */
2400
2014
  writeFileSync(path, data = "", options = "utf8") {
2401
- const formattedPath = this.formatPath(path);
2402
- if (!this.isDirectory(filePathFns.findFilePath(formattedPath))) {
2403
- this.mkdirSync(filePathFns.findFilePath(formattedPath), isPowerlinesWriteFileOptions(options) ? options : void 0);
2404
- }
2405
- const code = isVirtualFileData(data) ? data.code : data;
2406
- const outputMode = this.#unifiedFS.resolveMode(formattedPath, isPowerlinesWriteFileOptions(options) ? options : void 0);
2407
- this.#log(types.LogLevelLabel.TRACE, `Writing ${formattedPath} file to the ${outputMode === "fs" ? "" : "virtual "}file system (size: ${prettyBytes.prettyBytes(new buffer$1.Blob(toArray.toArray(code)).size)})`);
2408
- this.metadata[formattedPath] = {
2015
+ if (!this.isDirectory(filePathFns.findFilePath(this.#normalizePath(path)))) {
2016
+ this.mkdirSync(filePathFns.findFilePath(this.#normalizePath(path)), isPowerlinesWriteFileOptions(options) ? options : void 0);
2017
+ }
2018
+ const metadata = isVirtualFileData(data) ? data : {};
2019
+ metadata.id = this.#normalizeId(path);
2020
+ const code = isVirtualFileData(data) ? metadata.code : data;
2021
+ const outputMode = this.#unifiedFS.resolveMode(this.#normalizePath(path), isPowerlinesWriteFileOptions(options) ? options : void 0);
2022
+ this.#log(types.LogLevelLabel.TRACE, `Writing ${this.#normalizePath(path)} file to the ${outputMode === "fs" ? "" : "virtual "}file system (size: ${prettyBytes.prettyBytes(new buffer$1.Blob(toArray.toArray(code)).size)})`);
2023
+ this.#metadata[metadata.id] = {
2409
2024
  mode: outputMode,
2410
2025
  variant: "normal",
2411
2026
  timestamp: Date.now(),
2412
- ...isVirtualFileData(data) ? data : {}
2027
+ ...metadata
2413
2028
  };
2414
- this.#clearResolverCache(formattedPath);
2415
- const writeStream = this.#unifiedFS.resolveFS(formattedPath, isPowerlinesWriteFileOptions(options) ? options : void 0).createWriteStream(formattedPath);
2029
+ this.#paths[metadata.id] = this.#normalizePath(path);
2030
+ this.#ids[this.#normalizePath(path)] = metadata.id;
2031
+ const writeStream = this.#unifiedFS.resolveFS(this.#normalizePath(path), isPowerlinesWriteFileOptions(options) ? options : void 0).createWriteStream(this.#normalizePath(path));
2416
2032
  try {
2417
2033
  writeStream.write(code);
2418
2034
  } finally {
@@ -2426,7 +2042,7 @@ var VirtualFileSystem = class _VirtualFileSystem {
2426
2042
  * @returns `true` if the file exists, otherwise `false`.
2427
2043
  */
2428
2044
  existsSync(pathOrId) {
2429
- return this.resolve(pathOrId) !== false;
2045
+ return !!this.resolveSync(pathOrId);
2430
2046
  }
2431
2047
  /**
2432
2048
  * Retrieves the metadata of a file in the virtual file system (VFS).
@@ -2435,7 +2051,7 @@ var VirtualFileSystem = class _VirtualFileSystem {
2435
2051
  * @returns The metadata of the file, or undefined if the file does not exist.
2436
2052
  */
2437
2053
  getMetadata(pathOrId) {
2438
- const resolved = this.resolve(pathOrId);
2054
+ const resolved = this.resolveSync(pathOrId);
2439
2055
  if (resolved && this.metadata[resolved]) {
2440
2056
  return this.metadata[resolved];
2441
2057
  }
@@ -2451,7 +2067,7 @@ var VirtualFileSystem = class _VirtualFileSystem {
2451
2067
  * @returns `true` if the file exists, otherwise `false`.
2452
2068
  */
2453
2069
  isFile(pathOrId) {
2454
- const resolved = this.resolve(pathOrId);
2070
+ const resolved = this.resolveSync(pathOrId);
2455
2071
  return !!(resolved && (this.#unifiedFS.virtual.existsSync(resolved) && this.#unifiedFS.virtual.lstatSync(resolved).isFile() || this.#unifiedFS.physical.existsSync(resolved) && this.#unifiedFS.physical.lstatSync(resolved).isFile() || this.#unifiedFS.resolveFS(resolved).existsSync(resolved) && this.#unifiedFS.resolveFS(resolved).lstatSync(resolved).isFile()));
2456
2072
  }
2457
2073
  /**
@@ -2461,7 +2077,7 @@ var VirtualFileSystem = class _VirtualFileSystem {
2461
2077
  * @returns `true` if the directory exists, otherwise `false`.
2462
2078
  */
2463
2079
  isDirectory(pathOrId) {
2464
- const resolved = this.resolve(pathOrId);
2080
+ const resolved = this.resolveSync(pathOrId);
2465
2081
  return !!(resolved && (this.#unifiedFS.virtual.existsSync(resolved) && this.#unifiedFS.virtual.lstatSync(resolved).isDirectory() || this.#unifiedFS.physical.existsSync(resolved) && this.#unifiedFS.physical.lstatSync(resolved).isDirectory() || this.#unifiedFS.resolveFS(resolved).existsSync(resolved) && this.#unifiedFS.resolveFS(resolved).lstatSync(resolved).isDirectory()));
2466
2082
  }
2467
2083
  /**
@@ -2471,7 +2087,7 @@ var VirtualFileSystem = class _VirtualFileSystem {
2471
2087
  * @returns A promise that resolves to the file's status information, or false if the file does not exist.
2472
2088
  */
2473
2089
  async stat(pathOrId, options) {
2474
- return this.#unifiedFS.resolveFS(pathOrId).promises.stat(this.resolve(toFilePath(pathOrId)) || toFilePath(pathOrId), options);
2090
+ return this.#unifiedFS.resolveFS(pathOrId).promises.stat(await this.resolve(pathOrId) || pathOrId, options);
2475
2091
  }
2476
2092
  /**
2477
2093
  * Synchronously retrieves the status of a file in the virtual file system (VFS).
@@ -2480,7 +2096,7 @@ var VirtualFileSystem = class _VirtualFileSystem {
2480
2096
  * @returns The file's status information, or false if the file does not exist.
2481
2097
  */
2482
2098
  statSync(pathOrId) {
2483
- return this.#unifiedFS.resolveFS(pathOrId).statSync(this.resolve(toFilePath(pathOrId)) || toFilePath(pathOrId));
2099
+ return this.#unifiedFS.resolveFS(pathOrId).statSync(this.resolveSync(pathOrId) || pathOrId);
2484
2100
  }
2485
2101
  /**
2486
2102
  * Retrieves the status of a symbolic link in the virtual file system (VFS).
@@ -2489,7 +2105,7 @@ var VirtualFileSystem = class _VirtualFileSystem {
2489
2105
  * @returns A promise that resolves to the symbolic link's status information, or false if the link does not exist.
2490
2106
  */
2491
2107
  async lstat(pathOrId, options) {
2492
- return this.#unifiedFS.resolveFS(pathOrId).promises.lstat(this.resolve(toFilePath(pathOrId)) || toFilePath(pathOrId), options);
2108
+ return this.#unifiedFS.resolveFS(pathOrId).promises.lstat(await this.resolve(pathOrId) || pathOrId, options);
2493
2109
  }
2494
2110
  /**
2495
2111
  * Synchronously retrieves the status of a symbolic link in the virtual file system (VFS).
@@ -2498,7 +2114,7 @@ var VirtualFileSystem = class _VirtualFileSystem {
2498
2114
  * @returns The symbolic link's status information, or false if the link does not exist.
2499
2115
  */
2500
2116
  lstatSync(pathOrId, options) {
2501
- return this.#unifiedFS.resolveFS(pathOrId).lstatSync(this.resolve(toFilePath(pathOrId)) || toFilePath(pathOrId), options);
2117
+ return this.#unifiedFS.resolveFS(pathOrId).lstatSync(this.resolveSync(pathOrId) || pathOrId, options);
2502
2118
  }
2503
2119
  /**
2504
2120
  * Resolves a path or ID to its real path in the virtual file system (VFS).
@@ -2507,52 +2123,113 @@ var VirtualFileSystem = class _VirtualFileSystem {
2507
2123
  * @returns The resolved real path if it exists, otherwise undefined.
2508
2124
  */
2509
2125
  realpathSync(pathOrId) {
2510
- const filePath = this.resolve(toFilePath(pathOrId));
2126
+ const filePath = this.resolveSync(pathOrId);
2511
2127
  if (!filePath) {
2512
- throw new Error(`File not found: ${toFilePath(pathOrId)}`);
2128
+ throw new Error(`File not found: ${pathOrId}`);
2513
2129
  }
2514
2130
  return filePath;
2515
2131
  }
2516
2132
  /**
2517
- * Resolves a path or ID parameter to a corresponding virtual file path in the virtual file system (VFS).
2133
+ * A helper function to resolve modules in the virtual file system (VFS).
2518
2134
  *
2519
- * @param pathOrId - The path or ID to resolve.
2520
- * @param options - Optional parameters for resolving the path, such as whether to include the file extension.
2521
- * @returns The resolved file path if it exists, otherwise undefined.
2522
- */
2523
- resolve(pathOrId, options = {}) {
2524
- const formattedPathOrId = toFilePath(pathOrId);
2525
- const resolverKey = `${formattedPathOrId}${options.withExtension ? "-ext" : ""}${options.paths ? `-${murmurhash.murmurhash(options.paths)}` : ""}${options.pathType ? `-${options.pathType}` : ""}`;
2526
- if (this.#cachedResolver.has(resolverKey)) {
2527
- return this.#cachedResolver.get(resolverKey);
2528
- }
2529
- let result = this.#resolveId(formattedPathOrId);
2530
- if (!result) {
2531
- result = this.#resolvePath(formattedPathOrId, options);
2135
+ * @remarks
2136
+ * This function can be used to resolve modules relative to the project root directory.
2137
+ *
2138
+ * @example
2139
+ * ```ts
2140
+ * const resolved = await context.resolvePath("some-module", "/path/to/importer");
2141
+ * ```
2142
+ *
2143
+ * @param id - The module to resolve.
2144
+ * @param importer - An optional path to the importer module.
2145
+ * @param options - Additional resolution options.
2146
+ * @returns A promise that resolves to the resolved module path.
2147
+ */
2148
+ async resolve(id, importer, options = {}) {
2149
+ let result = this.resolverCache.get(this.#normalizeId(id));
2150
+ if (result) {
2151
+ return result;
2532
2152
  }
2153
+ result = this.paths[this.#normalizeId(id)];
2533
2154
  if (!result) {
2534
- result = false;
2155
+ const paths = options.paths ?? [];
2156
+ if (importer && !paths.includes(importer)) {
2157
+ paths.push(importer);
2158
+ }
2159
+ paths.push(this.#context.workspaceConfig.workspaceRoot);
2160
+ paths.push(joinPaths.joinPaths(this.#context.workspaceConfig.workspaceRoot, this.#context.config.projectRoot));
2161
+ paths.push(joinPaths.joinPaths(this.#context.workspaceConfig.workspaceRoot, this.#context.config.sourceRoot));
2162
+ paths.push(...Object.keys(this.#context.tsconfig.options.paths ?? {}).filter((tsconfigPath) => id.startsWith(tsconfigPath.replace(/\*$/, ""))).map((tsconfigPath) => this.#context.tsconfig.options.paths?.[tsconfigPath]).flat().filter(Boolean).map((tsconfigPath) => append.appendPath(tsconfigPath, this.#context.workspaceConfig.workspaceRoot)));
2163
+ for (const combination of resolve.getResolutionCombinations(id, {
2164
+ paths
2165
+ })) {
2166
+ if (this.#existsSync(combination)) {
2167
+ result = combination;
2168
+ }
2169
+ }
2170
+ try {
2171
+ result = await resolve.resolve(id, {
2172
+ paths
2173
+ });
2174
+ } catch {
2175
+ }
2535
2176
  }
2536
- if (result && options.withExtension === false) {
2537
- return result.replace(/\.[m|c]?[t|j]sx?$/, "");
2177
+ if (result) {
2178
+ result = correctPath.toAbsolutePath(append.appendPath(result, this.#context.config.projectRoot), this.#context.workspaceConfig.workspaceRoot);
2179
+ this.resolverCache.set(this.#normalizeId(id), result);
2538
2180
  }
2539
- this.#cachedResolver.set(resolverKey, result);
2540
2181
  return result;
2541
2182
  }
2542
2183
  /**
2543
- * Converts a relative path to an absolute path based on the workspace and project root.
2184
+ * A synchronous helper function to resolve modules using the Jiti resolver
2185
+ *
2186
+ * @remarks
2187
+ * This function can be used to resolve modules relative to the project root directory.
2544
2188
  *
2545
- * @param path - The relative path to convert.
2546
- * @returns The absolute path.
2547
- */
2548
- formatPath(path) {
2549
- const formattedPath = toFilePath(path);
2550
- if (isType.isAbsolutePath(formattedPath) || formattedPath.startsWith(this.#context.workspaceConfig.workspaceRoot)) {
2551
- return formattedPath;
2552
- } else if (formattedPath.startsWith(this.#context.config.projectRoot)) {
2553
- return joinPaths.joinPaths(this.#context.workspaceConfig.workspaceRoot, formattedPath);
2189
+ * @example
2190
+ * ```ts
2191
+ * const resolvedPath = context.resolveSync("some-module", "/path/to/importer");
2192
+ * ```
2193
+ *
2194
+ * @param id - The module to resolve.
2195
+ * @param importer - An optional path to the importer module.
2196
+ * @param options - Additional resolution options.
2197
+ * @returns The resolved module path.
2198
+ */
2199
+ resolveSync(id, importer, options = {}) {
2200
+ let result = this.resolverCache.get(this.#normalizeId(id));
2201
+ if (result) {
2202
+ return result;
2203
+ }
2204
+ result = this.paths[this.#normalizeId(id)];
2205
+ if (!result) {
2206
+ const paths = options.paths ?? [];
2207
+ if (importer && !paths.includes(importer)) {
2208
+ paths.push(importer);
2209
+ }
2210
+ paths.push(this.#context.workspaceConfig.workspaceRoot);
2211
+ paths.push(joinPaths.joinPaths(this.#context.workspaceConfig.workspaceRoot, this.#context.config.projectRoot));
2212
+ paths.push(joinPaths.joinPaths(this.#context.workspaceConfig.workspaceRoot, this.#context.config.sourceRoot));
2213
+ paths.push(...Object.keys(this.#context.tsconfig?.options?.paths ?? {}).filter((tsconfigPath) => id.startsWith(tsconfigPath.replace(/\*$/, ""))).map((tsconfigPath) => this.#context.tsconfig?.options?.paths?.[tsconfigPath]).flat().filter(Boolean).map((tsconfigPath) => append.appendPath(tsconfigPath, this.#context.workspaceConfig.workspaceRoot)));
2214
+ for (const combination of resolve.getResolutionCombinations(id, {
2215
+ paths
2216
+ })) {
2217
+ if (this.#existsSync(combination)) {
2218
+ result = combination;
2219
+ }
2220
+ }
2221
+ try {
2222
+ result = resolve.resolveSync(id, {
2223
+ paths
2224
+ });
2225
+ } catch {
2226
+ }
2554
2227
  }
2555
- return formattedPath;
2228
+ if (result) {
2229
+ result = correctPath.toAbsolutePath(append.appendPath(result, this.#context.config.projectRoot), this.#context.workspaceConfig.workspaceRoot);
2230
+ this.resolverCache.set(this.#normalizeId(id), result);
2231
+ }
2232
+ return result;
2556
2233
  }
2557
2234
  /**
2558
2235
  * Disposes of the virtual file system (VFS) by saving its state to disk.
@@ -2561,7 +2238,7 @@ var VirtualFileSystem = class _VirtualFileSystem {
2561
2238
  if (!this.#isDisposed) {
2562
2239
  this.#isDisposed = true;
2563
2240
  this.#log(types.LogLevelLabel.DEBUG, "Disposing virtual file system...");
2564
- await this.unlink(joinPaths.joinPaths(this.#context.cachePath, "fs.bin"));
2241
+ await this.unlink(joinPaths.joinPaths(this.#context.dataPath, "fs.bin"));
2565
2242
  const message = new $__namespace.Message();
2566
2243
  const fs2 = message.initRoot(FileSystem);
2567
2244
  const virtualFS = this.#unifiedFS.toJSON();
@@ -2570,7 +2247,7 @@ var VirtualFileSystem = class _VirtualFileSystem {
2570
2247
  virtualFiles.forEach(([path, code], index) => {
2571
2248
  const fd = files.get(index);
2572
2249
  fd.path = path;
2573
- fd.code = code;
2250
+ fd.code = code || "";
2574
2251
  });
2575
2252
  const ids = fs2._initIds(Object.keys(this.ids).length);
2576
2253
  Object.entries(this.ids).forEach(([id, path], index) => {
@@ -2594,7 +2271,9 @@ var VirtualFileSystem = class _VirtualFileSystem {
2594
2271
  });
2595
2272
  }
2596
2273
  });
2597
- await buffer.writeFileBuffer(joinPaths.joinPaths(this.#context.cachePath, "fs.bin"), message.toArrayBuffer());
2274
+ await buffer.writeFileBuffer(joinPaths.joinPaths(this.#context.dataPath, "fs.bin"), message.toArrayBuffer());
2275
+ this.#resolverCache.save(true);
2276
+ this.#log(types.LogLevelLabel.DEBUG, "Virtual file system disposed.");
2598
2277
  }
2599
2278
  }
2600
2279
  /**
@@ -2622,6 +2301,105 @@ var VirtualFileSystem = class _VirtualFileSystem {
2622
2301
  return this.dispose();
2623
2302
  }
2624
2303
  };
2304
+ var VirtualFileSystemHost = class VirtualFileSystemHost2 extends tsMorph.InMemoryFileSystemHost {
2305
+ static {
2306
+ chunkSHUYVCID_js.__name(this, "VirtualFileSystemHost");
2307
+ }
2308
+ #fs;
2309
+ constructor(fs2) {
2310
+ super();
2311
+ this.#fs = fs2;
2312
+ }
2313
+ deleteSync(path) {
2314
+ this.#fs.rmSync(path);
2315
+ }
2316
+ readDirSync(dirPath) {
2317
+ return this.#fs.readdirSync(dirPath).reduce((ret, entry) => {
2318
+ const fullPath = this.#fs.resolveSync(join.joinPaths(dirPath, entry));
2319
+ if (fullPath) {
2320
+ ret.push({
2321
+ name: entry,
2322
+ isDirectory: this.#fs.isDirectory(fullPath),
2323
+ isFile: this.#fs.isFile(fullPath),
2324
+ isSymlink: false
2325
+ });
2326
+ }
2327
+ return ret;
2328
+ }, []);
2329
+ }
2330
+ async readFile(filePath) {
2331
+ if (!this.#fs.existsSync(filePath)) {
2332
+ throw new Error(`File not found: '${filePath}'. Please check the path and try again.`);
2333
+ }
2334
+ return await this.#fs.readFile(filePath);
2335
+ }
2336
+ readFileSync(filePath) {
2337
+ if (!this.#fs.existsSync(filePath)) {
2338
+ throw new Error(`File not found: '${filePath}'. Please check the path and try again.`);
2339
+ }
2340
+ return this.#fs.readFileSync(filePath);
2341
+ }
2342
+ async writeFile(filePath, fileText) {
2343
+ return this.#fs.writeFile(filePath, fileText);
2344
+ }
2345
+ writeFileSync(filePath, fileText) {
2346
+ this.#fs.writeFileSync(filePath, fileText);
2347
+ }
2348
+ async mkdir(dirPath) {
2349
+ await this.#fs.mkdir(dirPath);
2350
+ }
2351
+ mkdirSync(dirPath) {
2352
+ this.#fs.mkdirSync(dirPath);
2353
+ }
2354
+ async move(srcPath, destPath) {
2355
+ await this.#fs.move(srcPath, destPath);
2356
+ }
2357
+ moveSync(srcPath, destPath) {
2358
+ this.#fs.moveSync(srcPath, destPath);
2359
+ }
2360
+ async copy(srcPath, destPath) {
2361
+ await this.#fs.copy(srcPath, destPath);
2362
+ }
2363
+ copySync(srcPath, destPath) {
2364
+ this.#fs.copySync(srcPath, destPath);
2365
+ }
2366
+ async fileExists(filePath) {
2367
+ return this.#fs.isFile(filePath);
2368
+ }
2369
+ fileExistsSync(filePath) {
2370
+ return this.#fs.isFile(filePath);
2371
+ }
2372
+ async directoryExists(dirPath) {
2373
+ return this.#fs.isDirectory(dirPath);
2374
+ }
2375
+ directoryExistsSync(dirPath) {
2376
+ return this.#fs.isDirectory(dirPath);
2377
+ }
2378
+ realpathSync(path) {
2379
+ return this.#fs.resolveSync(path) || path;
2380
+ }
2381
+ getCurrentDirectory() {
2382
+ return "/";
2383
+ }
2384
+ async glob(patterns) {
2385
+ return this.#fs.glob(patterns);
2386
+ }
2387
+ globSync(patterns) {
2388
+ return this.#fs.globSync(patterns);
2389
+ }
2390
+ };
2391
+ function createProgram(context, override) {
2392
+ const project = new tsMorph.Project({
2393
+ compilerOptions: {
2394
+ ...context.tsconfig.options
2395
+ },
2396
+ tsConfigFilePath: context.tsconfig.tsconfigFilePath,
2397
+ fileSystem: new VirtualFileSystemHost(context.fs),
2398
+ ...override
2399
+ });
2400
+ return project;
2401
+ }
2402
+ chunkSHUYVCID_js.__name(createProgram, "createProgram");
2625
2403
 
2626
2404
  // ../powerlines/src/lib/contexts/context.ts
2627
2405
  var configCache = /* @__PURE__ */ new WeakMap();
@@ -2643,6 +2421,8 @@ var PowerlinesContext = class _PowerlinesContext {
2643
2421
  #envPaths;
2644
2422
  #fs;
2645
2423
  #tsconfig;
2424
+ #program;
2425
+ #resolvePatterns = [];
2646
2426
  #getConfigProps(config = {}) {
2647
2427
  return {
2648
2428
  variant: config.build?.variant,
@@ -2677,7 +2457,7 @@ var PowerlinesContext = class _PowerlinesContext {
2677
2457
  * @returns A promise that resolves to the new context.
2678
2458
  */
2679
2459
  static async from(workspaceRoot, config) {
2680
- const context = new _PowerlinesContext(await chunkACE6O62X_js.loadWorkspaceConfig(workspaceRoot, config.root));
2460
+ const context = new _PowerlinesContext(await chunk2PYUYDPD_js.loadWorkspaceConfig(workspaceRoot, config.root));
2681
2461
  await context.withUserConfig(config);
2682
2462
  context.powerlinesPath = await resolve.resolvePackage("powerlines");
2683
2463
  if (!context.powerlinesPath) {
@@ -2734,7 +2514,7 @@ var PowerlinesContext = class _PowerlinesContext {
2734
2514
  */
2735
2515
  get tsconfig() {
2736
2516
  if (!this.#tsconfig) {
2737
- this.#tsconfig = {
2517
+ this.tsconfig = {
2738
2518
  tsconfigFilePath: this.config.tsconfig
2739
2519
  };
2740
2520
  }
@@ -2745,6 +2525,7 @@ var PowerlinesContext = class _PowerlinesContext {
2745
2525
  */
2746
2526
  set tsconfig(value) {
2747
2527
  this.#tsconfig = value;
2528
+ this.#resolvePatterns = bundleRequire.tsconfigPathsToRegExp(value?.options?.paths ?? {});
2748
2529
  }
2749
2530
  /**
2750
2531
  * The virtual file system interface for the project
@@ -2774,10 +2555,10 @@ var PowerlinesContext = class _PowerlinesContext {
2774
2555
  workspaceRoot: this.workspaceConfig?.workspaceRoot,
2775
2556
  projectRoot: this.config?.projectRoot
2776
2557
  }, {
2777
- maxLength: chunkACE6O62X_js.PROJECT_ROOT_HASH_LENGTH
2558
+ maxLength: chunk2PYUYDPD_js.PROJECT_ROOT_HASH_LENGTH
2778
2559
  }),
2779
2560
  configHash: murmurhash.murmurhash(this.config, {
2780
- maxLength: chunkACE6O62X_js.CACHE_HASH_LENGTH
2561
+ maxLength: chunk2PYUYDPD_js.CACHE_HASH_LENGTH
2781
2562
  })
2782
2563
  };
2783
2564
  }
@@ -2837,7 +2618,7 @@ var PowerlinesContext = class _PowerlinesContext {
2837
2618
  * Get the path to the data directory for the project
2838
2619
  */
2839
2620
  get dataPath() {
2840
- return join.joinPaths(this.envPaths.data, "projects", chunkACE6O62X_js.getPrefixedProjectRootHash(this.config.name, this.meta.projectRootHash));
2621
+ return join.joinPaths(this.envPaths.data, "projects", chunk2PYUYDPD_js.getPrefixedProjectRootHash(this.config.name, this.meta.projectRootHash));
2841
2622
  }
2842
2623
  /**
2843
2624
  * Get the path to the cache directory for the project
@@ -2847,7 +2628,7 @@ var PowerlinesContext = class _PowerlinesContext {
2847
2628
  checksum: this.#checksum,
2848
2629
  config: this.meta.configHash
2849
2630
  }, {
2850
- maxLength: chunkACE6O62X_js.CACHE_HASH_LENGTH
2631
+ maxLength: chunk2PYUYDPD_js.CACHE_HASH_LENGTH
2851
2632
  }));
2852
2633
  }
2853
2634
  /**
@@ -2869,6 +2650,106 @@ var PowerlinesContext = class _PowerlinesContext {
2869
2650
  return Object.values(this.fs.metadata).filter((meta) => meta && meta.type === "builtin").map((meta) => meta?.id).filter(Boolean);
2870
2651
  }
2871
2652
  /**
2653
+ * The {@link Project} instance used for type reflection and module manipulation
2654
+ *
2655
+ * @see https://ts-morph.com/
2656
+ *
2657
+ * @remarks
2658
+ * This instance is created lazily on first access.
2659
+ */
2660
+ get program() {
2661
+ if (!this.#program) {
2662
+ this.#program = createProgram(this, {
2663
+ skipAddingFilesFromTsConfig: true
2664
+ });
2665
+ }
2666
+ return this.#program;
2667
+ }
2668
+ /**
2669
+ * A helper function to resolve modules in the Virtual File System
2670
+ *
2671
+ * @remarks
2672
+ * This function can be used to resolve modules relative to the project root directory.
2673
+ *
2674
+ * @example
2675
+ * ```ts
2676
+ * const resolved = await context.resolve("some-module", "/path/to/importer");
2677
+ * ```
2678
+ *
2679
+ * @param id - The module to resolve.
2680
+ * @param importer - An optional path to the importer module.
2681
+ * @param options - Additional resolution options.
2682
+ * @returns A promise that resolves to the resolved module path.
2683
+ */
2684
+ async resolveId(id, importer, options = {}) {
2685
+ if (this.fs.isVirtual(id)) {
2686
+ const result = await this.fs.resolve(id, importer, options);
2687
+ if (!result) {
2688
+ return void 0;
2689
+ }
2690
+ return {
2691
+ id: `\0${result}`,
2692
+ external: this.config.projectType !== "application"
2693
+ };
2694
+ }
2695
+ if (this.config.build.skipNodeModulesBundle) {
2696
+ if (bundleRequire.match(id, this.#resolvePatterns) || bundleRequire.match(id, this.config.build.noExternal)) {
2697
+ return void 0;
2698
+ }
2699
+ if (bundleRequire.match(id, this.config.build.external) || id.startsWith("node:")) {
2700
+ return {
2701
+ id,
2702
+ external: true
2703
+ };
2704
+ }
2705
+ if (!/^[A-Z]:[/\\]|^\.{0,2}\/|^\.{1,2}$/.test(id)) {
2706
+ return {
2707
+ id,
2708
+ external: true
2709
+ };
2710
+ }
2711
+ } else {
2712
+ if (bundleRequire.match(id, this.config.build.noExternal)) {
2713
+ return void 0;
2714
+ }
2715
+ if (bundleRequire.match(id, this.config.build.external) || id.startsWith("node:")) {
2716
+ return {
2717
+ id,
2718
+ external: true
2719
+ };
2720
+ }
2721
+ }
2722
+ return void 0;
2723
+ }
2724
+ /**
2725
+ * A helper function to load modules from the Virtual File System
2726
+ *
2727
+ * @remarks
2728
+ * This function can be used to load modules relative to the project root directory.
2729
+ *
2730
+ * @example
2731
+ * ```ts
2732
+ * const module = await context.load("some-module", "/path/to/importer");
2733
+ * ```
2734
+ *
2735
+ * @param id - The module to load.
2736
+ * @returns A promise that resolves to the loaded module.
2737
+ */
2738
+ async load(id) {
2739
+ const resolvedId = await this.fs.resolve(id);
2740
+ if (!resolvedId) {
2741
+ return void 0;
2742
+ }
2743
+ const code = await this.fs.readFile(resolvedId);
2744
+ if (!code) {
2745
+ return void 0;
2746
+ }
2747
+ return {
2748
+ code,
2749
+ map: null
2750
+ };
2751
+ }
2752
+ /**
2872
2753
  * Get the builtin virtual files that exist in the Powerlines virtual file system
2873
2754
  */
2874
2755
  async getBuiltins() {
@@ -3091,9 +2972,10 @@ var PowerlinesContext = class _PowerlinesContext {
3091
2972
  projectRoot: cacheKey.projectRoot,
3092
2973
  cacheDir: this.cachePath,
3093
2974
  mode: cacheKey.mode,
2975
+ logLevel: config.logLevel || this.config?.logLevel || this.workspaceConfig.logLevel || "info",
3094
2976
  skipCache: cacheKey.skipCache
3095
2977
  });
3096
- const userConfig = await chunkACE6O62X_js.loadUserConfigFile(cacheKey.projectRoot, this.workspaceConfig.workspaceRoot, this.resolver, cacheKey.command, cacheKey.mode, cacheKey.configFile, cacheKey.framework);
2978
+ const userConfig = await chunk2PYUYDPD_js.loadUserConfigFile(cacheKey.projectRoot, this.workspaceConfig.workspaceRoot, this.resolver, cacheKey.command, cacheKey.mode, cacheKey.configFile, cacheKey.framework);
3097
2979
  this.mergeUserConfig(userConfig.config);
3098
2980
  configCache.set(cacheKey, {
3099
2981
  projectJson: this.projectJson,
@@ -3204,6 +3086,24 @@ var PowerlinesContext = class _PowerlinesContext {
3204
3086
  ret.push(plugin);
3205
3087
  return ret;
3206
3088
  }, []);
3089
+ if (this.config.tsconfig) {
3090
+ this.config.tsconfig = replacePathTokens(this, this.config.tsconfig);
3091
+ }
3092
+ if (this.config.output.dts) {
3093
+ this.config.output.dts = replacePathTokens(this, this.config.output.dts);
3094
+ }
3095
+ if (this.config.build.polyfill) {
3096
+ this.config.build.polyfill = this.config.build.polyfill.map((polyfill) => replacePathTokens(this, polyfill));
3097
+ }
3098
+ if (this.config.output.assets) {
3099
+ this.config.output.assets = this.config.output.assets.map((asset) => ({
3100
+ ...asset,
3101
+ glob: replacePathTokens(this, asset.glob),
3102
+ ignore: asset.ignore ? asset.ignore.map((ignore) => replacePathTokens(this, ignore)) : void 0,
3103
+ input: replacePathTokens(this, asset.input),
3104
+ output: replacePathTokens(this, asset.output)
3105
+ }));
3106
+ }
3207
3107
  this.#fs ??= await VirtualFileSystem.create(this);
3208
3108
  }
3209
3109
  mergeUserConfig(from = {}, into = this.config.userConfig ?? {}) {
@@ -3452,7 +3352,7 @@ var PowerlinesAPIContext = class _PowerlinesAPIContext extends PowerlinesContext
3452
3352
  * @returns A promise that resolves to the new context.
3453
3353
  */
3454
3354
  static async from(workspaceRoot, config) {
3455
- const context = new _PowerlinesAPIContext(await chunkACE6O62X_js.loadWorkspaceConfig(workspaceRoot, config.root));
3355
+ const context = new _PowerlinesAPIContext(await chunk2PYUYDPD_js.loadWorkspaceConfig(workspaceRoot, config.root));
3456
3356
  await context.withUserConfig(config);
3457
3357
  context.powerlinesPath = await resolve.resolvePackage("powerlines");
3458
3358
  if (!context.powerlinesPath) {
@@ -3633,14 +3533,10 @@ ${context.entry.map((entry) => `- ${entry.input.file || entry.file}${entry.outpu
3633
3533
  await resolveTsconfig(context);
3634
3534
  await installDependencies(context);
3635
3535
  await this.callPostHook(context, "configResolved");
3636
- if (context.config.build.polyfill) {
3637
- context.config.build.polyfill = context.config.build.polyfill.map((polyfill) => replacePathTokens(context, polyfill));
3638
- }
3639
3536
  context.log(types.LogLevelLabel.TRACE, `Powerlines configuration has been resolved:
3640
3537
 
3641
3538
  ${console.formatLogMessage(context.config)}`);
3642
- context.fs[__VFS_PATCH__]();
3643
- await chunkACE6O62X_js.writeMetaFile(context);
3539
+ await chunk2PYUYDPD_js.writeMetaFile(context);
3644
3540
  context.persistedMeta = context.meta;
3645
3541
  if (!exists.existsSync(context.cachePath)) {
3646
3542
  await helpers.createDirectory(context.cachePath);
@@ -3689,35 +3585,19 @@ ${console.formatLogMessage(context.config)}`);
3689
3585
  if (!typescriptPath) {
3690
3586
  throw new Error("Could not resolve TypeScript package location. Please ensure TypeScript is installed.");
3691
3587
  }
3692
- const files = builtinFilePaths.reduce((ret, fileName) => {
3693
- const formatted = replace.replacePath(fileName, context.workspaceConfig.workspaceRoot);
3694
- if (!ret.includes(formatted)) {
3695
- ret.push(formatted);
3696
- }
3697
- return ret;
3698
- }, [
3699
- joinPaths.joinPaths(typescriptPath, "lib", "lib.esnext.full.d.ts")
3700
- ]);
3701
- context.log(types.LogLevelLabel.TRACE, "Parsing TypeScript configuration for the Powerlines project.");
3702
- const resolvedTsconfig = getParsedTypeScriptConfig(context.workspaceConfig.workspaceRoot, context.config.projectRoot, context.tsconfig.tsconfigFilePath, defu5__default.default({
3703
- compilerOptions: {
3704
- strict: false,
3705
- noEmit: false,
3706
- declaration: true,
3707
- declarationMap: false,
3708
- emitDeclarationOnly: true,
3709
- skipLibCheck: true
3588
+ const files = builtinFilePaths.reduce(
3589
+ (ret, fileName) => {
3590
+ const formatted = replace.replacePath(fileName, context.workspaceConfig.workspaceRoot);
3591
+ if (!ret.includes(formatted)) {
3592
+ ret.push(formatted);
3593
+ }
3594
+ return ret;
3710
3595
  },
3711
- exclude: [
3712
- "node_modules",
3713
- "dist"
3714
- ],
3715
- include: files
3716
- }, context.config.tsconfigRaw ?? {}));
3717
- resolvedTsconfig.options.configFilePath = joinPaths.joinPaths(context.workspaceConfig.workspaceRoot, context.tsconfig.tsconfigFilePath);
3718
- resolvedTsconfig.options.pathsBasePath = context.workspaceConfig.workspaceRoot;
3719
- resolvedTsconfig.options.suppressOutputPathCheck = true;
3720
- let generatedTypes = await emitTypes(context, resolvedTsconfig, files);
3596
+ []
3597
+ // [joinPaths(typescriptPath, "lib", "lib.esnext.full.d.ts")]
3598
+ );
3599
+ context.log(types.LogLevelLabel.TRACE, "Parsing TypeScript configuration for the Powerlines project.");
3600
+ let generatedTypes = await emitTypes(context, files);
3721
3601
  context.log(types.LogLevelLabel.TRACE, `Generating TypeScript declaration file in ${context.config.output.dts}.`);
3722
3602
  const directives = [];
3723
3603
  let result = await this.callPreHook(context, "generateTypes", generatedTypes);
@@ -3770,8 +3650,7 @@ ${formatTypes(generatedTypes)}
3770
3650
  throw new Error("Failed to parse the TypeScript configuration file.");
3771
3651
  }
3772
3652
  await this.callPostHook(context, "prepare");
3773
- await chunkACE6O62X_js.writeMetaFile(context);
3774
- context.fs[__VFS_REVERT__]();
3653
+ await chunk2PYUYDPD_js.writeMetaFile(context);
3775
3654
  });
3776
3655
  this.context.log(types.LogLevelLabel.INFO, "Powerlines API has been prepared successfully");
3777
3656
  }