veryfront 0.1.732 → 0.1.734
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/deno.js +1 -1
- package/esm/src/observability/file-log-subscriber.d.ts.map +1 -1
- package/esm/src/observability/file-log-subscriber.js +3 -1
- package/esm/src/rendering/orchestrator/module-loader/dependency-resolver.d.ts +25 -0
- package/esm/src/rendering/orchestrator/module-loader/dependency-resolver.d.ts.map +1 -0
- package/esm/src/rendering/orchestrator/module-loader/dependency-resolver.js +87 -0
- package/esm/src/rendering/orchestrator/module-loader/index.d.ts.map +1 -1
- package/esm/src/rendering/orchestrator/module-loader/index.js +10 -79
- package/esm/src/utils/version-constant.d.ts +1 -1
- package/esm/src/utils/version-constant.js +1 -1
- package/package.json +1 -1
package/esm/deno.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-log-subscriber.d.ts","sourceRoot":"","sources":["../../../src/src/observability/file-log-subscriber.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAY,QAAQ,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEzE,sCAAsC;AACtC,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,QAAQ,CAAC;IAChB,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;CACzB;AAgBD,uBAAuB;AACvB,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAW3D;AAaD,qCAAqC;AACrC,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,IAAI,CAAoC;IAChD,OAAO,CAAC,WAAW,CAAK;IACxB,OAAO,CAAC,UAAU,CAAoC;IACtD,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,SAAS,CAA8B;IAC/C,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,gBAAgB,CAAS;IACjC,OAAO,CAAC,MAAM,CAAgB;gBAElB,MAAM,EAAE,aAAa;IAOjC,aAAa,IAAI,aAAa;IAQ9B,OAAO,CAAC,OAAO;
|
|
1
|
+
{"version":3,"file":"file-log-subscriber.d.ts","sourceRoot":"","sources":["../../../src/src/observability/file-log-subscriber.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAY,QAAQ,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEzE,sCAAsC;AACtC,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,QAAQ,CAAC;IAChB,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;CACzB;AAgBD,uBAAuB;AACvB,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAW3D;AAaD,qCAAqC;AACrC,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,IAAI,CAAoC;IAChD,OAAO,CAAC,WAAW,CAAK;IACxB,OAAO,CAAC,UAAU,CAAoC;IACtD,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,SAAS,CAA8B;IAC/C,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,gBAAgB,CAAS;IACjC,OAAO,CAAC,MAAM,CAAgB;gBAElB,MAAM,EAAE,aAAa;IAOjC,aAAa,IAAI,aAAa;IAQ9B,OAAO,CAAC,OAAO;YASD,UAAU;YAyBV,QAAQ;YAeR,SAAS;YAOT,MAAM;IAgCd,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAWtB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAY7B;AAED,kCAAkC;AAClC,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,aAAa,GAAG,iBAAiB,CAEhF"}
|
|
@@ -59,7 +59,9 @@ export class FileLogSubscriber {
|
|
|
59
59
|
};
|
|
60
60
|
}
|
|
61
61
|
enqueue(entry) {
|
|
62
|
-
this.writeQueue = this.writeQueue.then(() => this.writeEntry(entry)).catch(() => {
|
|
62
|
+
this.writeQueue = this.writeQueue.then(() => this.writeEntry(entry)).catch((error) => {
|
|
63
|
+
console.error(`[FileLogSubscriber] Failed writing to ${this.config.path}. File logging will continue.`, error instanceof Error ? error.message : String(error));
|
|
64
|
+
});
|
|
63
65
|
}
|
|
64
66
|
async writeEntry(entry) {
|
|
65
67
|
try {
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { RuntimeAdapter } from "../../../platform/adapters/base.js";
|
|
2
|
+
/** Resolved local module dependency discovered in a source module. */
|
|
3
|
+
export type ResolvedModuleDependency = {
|
|
4
|
+
full: string;
|
|
5
|
+
path: string;
|
|
6
|
+
relativePath: string;
|
|
7
|
+
depFilePath: string | null;
|
|
8
|
+
isLocalLib: boolean;
|
|
9
|
+
};
|
|
10
|
+
/** Resolved dependency after its source module has been transformed to a temp file. */
|
|
11
|
+
export type TransformedModuleDependency = ResolvedModuleDependency & {
|
|
12
|
+
depTempPath: string;
|
|
13
|
+
};
|
|
14
|
+
/** Input for resolving local module dependencies from source code. */
|
|
15
|
+
export interface ResolveModuleDependenciesInput {
|
|
16
|
+
fileContent: string;
|
|
17
|
+
filePath: string;
|
|
18
|
+
projectDir: string;
|
|
19
|
+
adapter: RuntimeAdapter;
|
|
20
|
+
}
|
|
21
|
+
/** Resolves @/ alias and relative local imports from a source module. */
|
|
22
|
+
export declare function resolveModuleDependencies(input: ResolveModuleDependenciesInput): Promise<ResolvedModuleDependency[]>;
|
|
23
|
+
/** Rewrites resolved local imports to their transformed temp file URLs. */
|
|
24
|
+
export declare function rewriteResolvedDependencyImports(fileContent: string, transformedDeps: TransformedModuleDependency[]): string;
|
|
25
|
+
//# sourceMappingURL=dependency-resolver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dependency-resolver.d.ts","sourceRoot":"","sources":["../../../../../src/src/rendering/orchestrator/module-loader/dependency-resolver.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AASzE,sEAAsE;AACtE,MAAM,MAAM,wBAAwB,GAAG;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,UAAU,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF,uFAAuF;AACvF,MAAM,MAAM,2BAA2B,GAAG,wBAAwB,GAAG;IACnE,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,sEAAsE;AACtE,MAAM,WAAW,8BAA8B;IAC7C,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,cAAc,CAAC;CACzB;AAgFD,yEAAyE;AACzE,wBAAsB,yBAAyB,CAC7C,KAAK,EAAE,8BAA8B,GACpC,OAAO,CAAC,wBAAwB,EAAE,CAAC,CAuBrC;AAED,2EAA2E;AAC3E,wBAAgB,gCAAgC,CAC9C,WAAW,EAAE,MAAM,EACnB,eAAe,EAAE,2BAA2B,EAAE,GAC7C,MAAM,CAMR"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { dirname, join, normalize } from "../../../platform/compat/path/index.js";
|
|
2
|
+
import { parallelMap, rendererLogger } from "../../../utils/index.js";
|
|
3
|
+
import { findSourceFile } from "../file-resolver/index.js";
|
|
4
|
+
const logger = rendererLogger.component("module-loader");
|
|
5
|
+
function collectAliasImports(fileContent) {
|
|
6
|
+
return [...fileContent.matchAll(/from\s+["'](@\/[^"']+)["']/g)].map((m) => ({
|
|
7
|
+
full: m[0],
|
|
8
|
+
path: m[1] ?? "",
|
|
9
|
+
}));
|
|
10
|
+
}
|
|
11
|
+
function collectRelativeImports(fileContent, fileDir) {
|
|
12
|
+
return [...fileContent.matchAll(/from\s+["'](\.\.?\/[^"']+)["']/g)]
|
|
13
|
+
.map((m) => ({ full: m[0], path: m[1] ?? "", fromDir: fileDir }))
|
|
14
|
+
// Ignore already-transformed file:// imports.
|
|
15
|
+
.filter((imp) => !imp.path.includes("file://"));
|
|
16
|
+
}
|
|
17
|
+
async function resolveAliasImport(imp, projectDir, adapter) {
|
|
18
|
+
const relativePath = imp.path.substring(2); // Remove @/ prefix.
|
|
19
|
+
const depFilePath = (await findSourceFile(relativePath, projectDir, adapter)) ??
|
|
20
|
+
(await findSourceFile(`components/${relativePath}`, projectDir, adapter));
|
|
21
|
+
return { ...imp, relativePath, depFilePath, isLocalLib: false };
|
|
22
|
+
}
|
|
23
|
+
async function resolveRelativeImport(imp, adapter) {
|
|
24
|
+
const basePath = normalize(join(imp.fromDir, imp.path));
|
|
25
|
+
logger.debug("Resolving relative import:", {
|
|
26
|
+
path: imp.path,
|
|
27
|
+
fromDir: imp.fromDir,
|
|
28
|
+
basePath,
|
|
29
|
+
});
|
|
30
|
+
const extensions = [".tsx", ".ts", ".jsx", ".js", ".mdx"];
|
|
31
|
+
let depFilePath = null;
|
|
32
|
+
if (await adapter.fs.exists(basePath)) {
|
|
33
|
+
const stat = await adapter.fs.stat(basePath);
|
|
34
|
+
if (!stat.isDirectory) {
|
|
35
|
+
depFilePath = basePath;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
if (!depFilePath) {
|
|
39
|
+
for (const ext of extensions) {
|
|
40
|
+
const pathWithExt = basePath + ext;
|
|
41
|
+
if (await adapter.fs.exists(pathWithExt)) {
|
|
42
|
+
depFilePath = pathWithExt;
|
|
43
|
+
break;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
if (!depFilePath) {
|
|
48
|
+
for (const ext of extensions) {
|
|
49
|
+
const indexPath = join(basePath, `index${ext}`);
|
|
50
|
+
if (await adapter.fs.exists(indexPath)) {
|
|
51
|
+
depFilePath = indexPath;
|
|
52
|
+
break;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return {
|
|
57
|
+
full: imp.full,
|
|
58
|
+
path: imp.path,
|
|
59
|
+
relativePath: imp.path,
|
|
60
|
+
depFilePath,
|
|
61
|
+
isLocalLib: false,
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
/** Resolves @/ alias and relative local imports from a source module. */
|
|
65
|
+
export async function resolveModuleDependencies(input) {
|
|
66
|
+
const fileDir = dirname(input.filePath);
|
|
67
|
+
const aliasImports = collectAliasImports(input.fileContent);
|
|
68
|
+
const relativeImports = collectRelativeImports(input.fileContent, fileDir);
|
|
69
|
+
logger.debug("Processing file:", {
|
|
70
|
+
filePath: input.filePath,
|
|
71
|
+
aliasImportsCount: aliasImports.length,
|
|
72
|
+
relativeImportsCount: relativeImports.length,
|
|
73
|
+
aliasImports: aliasImports.map((i) => i.path),
|
|
74
|
+
relativeImports: relativeImports.map((i) => i.path),
|
|
75
|
+
});
|
|
76
|
+
const resolvedAliasDeps = await parallelMap(aliasImports, (imp) => resolveAliasImport(imp, input.projectDir, input.adapter));
|
|
77
|
+
const resolvedRelativeDeps = await parallelMap(relativeImports, (imp) => resolveRelativeImport(imp, input.adapter));
|
|
78
|
+
return [...resolvedAliasDeps, ...resolvedRelativeDeps];
|
|
79
|
+
}
|
|
80
|
+
/** Rewrites resolved local imports to their transformed temp file URLs. */
|
|
81
|
+
export function rewriteResolvedDependencyImports(fileContent, transformedDeps) {
|
|
82
|
+
let rewritten = fileContent;
|
|
83
|
+
for (const dep of transformedDeps) {
|
|
84
|
+
rewritten = rewritten.replace(dep.full, `from "file://${dep.depTempPath}"`);
|
|
85
|
+
}
|
|
86
|
+
return rewritten;
|
|
87
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/src/rendering/orchestrator/module-loader/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/src/rendering/orchestrator/module-loader/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AA+BzE,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC7E,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAmEpE,wBAAsB,uBAAuB,CAC3C,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,cAAc,EAC5B,MAAM,EAAE,kBAAkB,EAC1B,eAAe,UAAQ,GACtB,OAAO,CAAC,MAAM,CAAC,CAsQjB;AAED,MAAM,WAAW,kBAAkB;IACjC,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,OAAO,EAAE,cAAc,CAAC;IACxB,IAAI,EAAE,aAAa,GAAG,YAAY,CAAC;IACnC,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9B,yDAAyD;IACzD,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAyBD;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAI5D;AAED;;;;;;GAMG;AACH,wBAAsB,UAAU,CAC9B,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,kBAAkB,GACzB,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CA6DlC"}
|
|
@@ -6,9 +6,8 @@
|
|
|
6
6
|
*
|
|
7
7
|
* @module rendering/orchestrator/module-loader
|
|
8
8
|
*/
|
|
9
|
-
import {
|
|
9
|
+
import { rendererLogger } from "../../../utils/index.js";
|
|
10
10
|
import { getLocalAdapter } from "../../../platform/adapters/registry.js";
|
|
11
|
-
import { findSourceFile } from "../file-resolver/index.js";
|
|
12
11
|
import { transformToESM } from "../../../transforms/esm-transform.js";
|
|
13
12
|
import { createFileSystem } from "../../../platform/compat/fs.js";
|
|
14
13
|
import { getProjectTmpDir } from "../../../modules/react-loader/index.js";
|
|
@@ -16,10 +15,11 @@ import { generateCacheKey as generateTransformCacheKey, getOrComputeTransform, i
|
|
|
16
15
|
import { TRANSFORM_DISTRIBUTED_TTL_SEC } from "../../../utils/constants/cache.js";
|
|
17
16
|
import { validateCachedBundlesByManifestOrCode } from "../../../transforms/esm/cached-bundle-validation.js";
|
|
18
17
|
import { getHttpBundleCacheDir, getMdxEsmCacheDir } from "../../../utils/cache-dir.js";
|
|
19
|
-
import {
|
|
18
|
+
import { join } from "../../../platform/compat/path/index.js";
|
|
20
19
|
import { hashCodeHex } from "../../../utils/hash-utils.js";
|
|
21
20
|
import { getModulePathCache, invalidateMdxEsmModule, lookupMdxEsmCache, saveModulePathCache, } from "../../../transforms/mdx/esm-module-loader/cache/index.js";
|
|
22
21
|
import { buildMdxEsmPathCacheKey } from "../../../transforms/mdx/esm-module-loader/cache-format.js";
|
|
22
|
+
import { resolveModuleDependencies, rewriteResolvedDependencyImports, } from "./dependency-resolver.js";
|
|
23
23
|
const logger = rendererLogger.component("module-loader");
|
|
24
24
|
// Re-export utilities
|
|
25
25
|
export { createEsmCache, createModuleCache, generateHash } from "./cache.js";
|
|
@@ -67,58 +67,6 @@ async function ensureDir(adapter, dir) {
|
|
|
67
67
|
pruneCreatedDirs();
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
|
-
async function resolveAliasImport(imp, projectDir, adapter) {
|
|
71
|
-
const relativePath = imp.path.substring(2); // Remove @/ prefix
|
|
72
|
-
const depFilePath = (await findSourceFile(relativePath, projectDir, adapter)) ??
|
|
73
|
-
(await findSourceFile(`components/${relativePath}`, projectDir, adapter));
|
|
74
|
-
return { ...imp, relativePath, depFilePath, isLocalLib: false };
|
|
75
|
-
}
|
|
76
|
-
async function resolveRelativeImport(imp, adapter) {
|
|
77
|
-
// Resolve the path relative to the file's directory and normalize to resolve ..
|
|
78
|
-
const basePath = normalize(join(imp.fromDir, imp.path));
|
|
79
|
-
logger.debug("Resolving relative import:", {
|
|
80
|
-
path: imp.path,
|
|
81
|
-
fromDir: imp.fromDir,
|
|
82
|
-
basePath,
|
|
83
|
-
});
|
|
84
|
-
// Try to find the source file with various extensions
|
|
85
|
-
const extensions = [".tsx", ".ts", ".jsx", ".js", ".mdx"];
|
|
86
|
-
let depFilePath = null;
|
|
87
|
-
// First try the exact path (in case it already has an extension)
|
|
88
|
-
if (await adapter.fs.exists(basePath)) {
|
|
89
|
-
const stat = await adapter.fs.stat(basePath);
|
|
90
|
-
if (!stat.isDirectory) {
|
|
91
|
-
depFilePath = basePath;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
// Try with extensions
|
|
95
|
-
if (!depFilePath) {
|
|
96
|
-
for (const ext of extensions) {
|
|
97
|
-
const pathWithExt = basePath + ext;
|
|
98
|
-
if (await adapter.fs.exists(pathWithExt)) {
|
|
99
|
-
depFilePath = pathWithExt;
|
|
100
|
-
break;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
// Try index files if path is a directory
|
|
105
|
-
if (!depFilePath) {
|
|
106
|
-
for (const ext of extensions) {
|
|
107
|
-
const indexPath = join(basePath, `index${ext}`);
|
|
108
|
-
if (await adapter.fs.exists(indexPath)) {
|
|
109
|
-
depFilePath = indexPath;
|
|
110
|
-
break;
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
return {
|
|
115
|
-
full: imp.full,
|
|
116
|
-
path: imp.path,
|
|
117
|
-
relativePath: imp.path,
|
|
118
|
-
depFilePath,
|
|
119
|
-
isLocalLib: false,
|
|
120
|
-
};
|
|
121
|
-
}
|
|
122
70
|
/**
|
|
123
71
|
* Transform a module and all its local dependencies (@/ alias and relative imports).
|
|
124
72
|
*
|
|
@@ -179,30 +127,13 @@ export async function transformModuleWithDeps(filePath, tmpDir, localAdapter, co
|
|
|
179
127
|
}
|
|
180
128
|
const readAdapter = useLocalAdapter ? localAdapter : adapter;
|
|
181
129
|
let fileContent = decodeFileContent(await readAdapter.fs.readFile(filePath));
|
|
182
|
-
const
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
// Match relative imports (./ and ../) - exclude npm:, http://, https://, file://
|
|
186
|
-
const relativeImports = [
|
|
187
|
-
...fileContent.matchAll(/from\s+["'](\.\.?\/[^"']+)["']/g),
|
|
188
|
-
]
|
|
189
|
-
.map((m) => ({ full: m[0], path: m[1] ?? "", fromDir: fileDir }))
|
|
190
|
-
// Filter out already-transformed file:// imports
|
|
191
|
-
.filter((imp) => !imp.path.includes("file://"));
|
|
192
|
-
logger.debug("Processing file:", {
|
|
130
|
+
const resolvedDeps = await resolveModuleDependencies({
|
|
131
|
+
adapter,
|
|
132
|
+
fileContent,
|
|
193
133
|
filePath,
|
|
194
|
-
|
|
195
|
-
relativeImportsCount: relativeImports.length,
|
|
196
|
-
aliasImports: aliasImports.map((i) => i.path),
|
|
197
|
-
relativeImports: relativeImports.map((i) => i.path),
|
|
134
|
+
projectDir,
|
|
198
135
|
});
|
|
199
|
-
|
|
200
|
-
const resolvedAliasDeps = await parallelMap(aliasImports, (imp) => resolveAliasImport(imp, projectDir, adapter));
|
|
201
|
-
// Resolve relative imports
|
|
202
|
-
const resolvedRelativeDeps = await parallelMap(relativeImports, (imp) => resolveRelativeImport(imp, adapter));
|
|
203
|
-
// Combine all resolved dependencies
|
|
204
|
-
const resolvedDeps = [...resolvedAliasDeps, ...resolvedRelativeDeps];
|
|
205
|
-
const transformedDeps = await parallelMap(resolvedDeps.filter((d) => d.depFilePath), async (dep) => {
|
|
136
|
+
const transformedDeps = await Promise.all(resolvedDeps.filter((d) => d.depFilePath).map(async (dep) => {
|
|
206
137
|
logger.debug("Found dependency:", {
|
|
207
138
|
path: dep.path,
|
|
208
139
|
depFilePath: dep.depFilePath,
|
|
@@ -210,9 +141,9 @@ export async function transformModuleWithDeps(filePath, tmpDir, localAdapter, co
|
|
|
210
141
|
});
|
|
211
142
|
const depTempPath = await transformModuleWithDeps(dep.depFilePath, tmpDir, localAdapter, config, dep.isLocalLib);
|
|
212
143
|
return { ...dep, depTempPath };
|
|
213
|
-
});
|
|
144
|
+
}));
|
|
145
|
+
fileContent = rewriteResolvedDependencyImports(fileContent, transformedDeps);
|
|
214
146
|
for (const dep of transformedDeps) {
|
|
215
|
-
fileContent = fileContent.replace(dep.full, `from "file://${dep.depTempPath}"`);
|
|
216
147
|
logger.debug("Replaced import:", {
|
|
217
148
|
path: dep.path,
|
|
218
149
|
depTempPath: dep.depTempPath,
|