veryfront 0.1.736 → 0.1.737
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/transforms/mdx/esm-module-loader/module-fetcher/index.d.ts.map +1 -1
- package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/index.js +7 -41
- package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/nested-imports.d.ts +14 -0
- package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/nested-imports.d.ts.map +1 -1
- package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/nested-imports.js +50 -1
- 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":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/src/transforms/mdx/esm-module-loader/module-fetcher/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oCAAoC,CAAC;AACjE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AAO5E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAcxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAS9F;;GAEG;AACH,qBAAa,yBAA0B,SAAQ,KAAK;gBACtC,cAAc,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;CAOtD;AAED;;GAEG;AACH,qBAAa,6BAA8B,SAAQ,KAAK;gBAC1C,SAAS,EAAE,MAAM;CAI9B;AAcD;;;GAGG;AACH,wBAAsB,mBAAmB,CACvC,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,oBAAoB,EAC7B,gBAAgB,CAAC,EAAE,MAAM,EACzB,OAAO,GAAE,GAAG,CAAC,MAAM,CAAa,GAC/B,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAwFxB;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/src/transforms/mdx/esm-module-loader/module-fetcher/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oCAAoC,CAAC;AACjE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AAO5E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAcxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAS9F;;GAEG;AACH,qBAAa,yBAA0B,SAAQ,KAAK;gBACtC,cAAc,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;CAOtD;AAED;;GAEG;AACH,qBAAa,6BAA8B,SAAQ,KAAK;gBAC1C,SAAS,EAAE,MAAM;CAI9B;AAcD;;;GAGG;AACH,wBAAsB,mBAAmB,CACvC,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,oBAAoB,EAC7B,gBAAgB,CAAC,EAAE,MAAM,EACzB,OAAO,GAAE,GAAG,CAAC,MAAM,CAAa,GAC/B,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAwFxB;AA2ND;;GAEG;AACH,wBAAgB,0BAA0B,CACxC,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,cAAc,EACvB,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE;IACR,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC,GACA,oBAAoB,CAUtB"}
|
|
@@ -24,7 +24,7 @@ import { resolveModuleFile } from "../resolution/file-finder.js";
|
|
|
24
24
|
import { buildMissingModuleError } from "../missing-module.js";
|
|
25
25
|
import { getTransformCacheKey, getVersionedPathCacheKey } from "./cache-keys.js";
|
|
26
26
|
import { rewriteDntImports, rewriteVeryfrontImports } from "./import-rewriter.js";
|
|
27
|
-
import {
|
|
27
|
+
import { resolveNestedModuleImports } from "./nested-imports.js";
|
|
28
28
|
import { readDistributedCache, writeDistributedCache } from "./distributed-cache.js";
|
|
29
29
|
import { fetchModuleViaHTTP } from "./http-fetcher.js";
|
|
30
30
|
import { cacheModule, normalizePath } from "./module-cache.js";
|
|
@@ -256,49 +256,15 @@ async function doFetchAndCacheModule(normalizedPath, context, fetchAndCacheModul
|
|
|
256
256
|
// This ensures we don't cache code with unresolved /_vf_modules/ paths.
|
|
257
257
|
needsDistributedCacheWrite = true;
|
|
258
258
|
}
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
normalizedPath,
|
|
263
|
-
vfModulesCount: vfModules.length,
|
|
264
|
-
relativeCount: relative.length,
|
|
265
|
-
vfModulePaths: vfModules.map((m) => m.path).slice(0, 5),
|
|
266
|
-
relativePaths: relative.map((m) => m.path).slice(0, 5),
|
|
267
|
-
});
|
|
268
|
-
log.debug(`${LOG_PREFIX_MDX_LOADER} [fetchAndCacheModule] processing vfModules START`, {
|
|
269
|
-
projectSlug,
|
|
270
|
-
normalizedPath,
|
|
271
|
-
count: vfModules.length,
|
|
272
|
-
});
|
|
273
|
-
const vfStart = performance.now();
|
|
274
|
-
const nestedResults = await Promise.all(vfModules.map(async ({ original, path }) => ({
|
|
275
|
-
original,
|
|
276
|
-
nestedFilePath: await fetchAndCacheModuleFn(path, normalizedPath),
|
|
277
|
-
nestedPath: path,
|
|
278
|
-
})));
|
|
279
|
-
log.debug(`${LOG_PREFIX_MDX_LOADER} [fetchAndCacheModule] processing vfModules DONE`, {
|
|
280
|
-
projectSlug,
|
|
281
|
-
normalizedPath,
|
|
282
|
-
vfMs: (performance.now() - vfStart).toFixed(1),
|
|
283
|
-
});
|
|
284
|
-
moduleCode = await processNestedImports(moduleCode, nestedResults, esmCacheDir, context.strictMissingModules ?? true, normalizedPath, projectSlug);
|
|
285
|
-
log.debug(`${LOG_PREFIX_MDX_LOADER} [fetchAndCacheModule] processing relative imports START`, {
|
|
286
|
-
projectSlug,
|
|
259
|
+
moduleCode = await resolveNestedModuleImports({
|
|
260
|
+
moduleCode,
|
|
261
|
+
esmCacheDir,
|
|
287
262
|
normalizedPath,
|
|
288
|
-
|
|
289
|
-
});
|
|
290
|
-
const relStart = performance.now();
|
|
291
|
-
const relativeResults = await Promise.all(relative.map(async ({ original, path }) => ({
|
|
292
|
-
original,
|
|
293
|
-
nestedFilePath: await fetchAndCacheModuleFn(path, normalizedPath),
|
|
294
|
-
relativePath: path,
|
|
295
|
-
})));
|
|
296
|
-
log.debug(`${LOG_PREFIX_MDX_LOADER} [fetchAndCacheModule] processing relative imports DONE`, {
|
|
263
|
+
strictMissingModules: context.strictMissingModules ?? true,
|
|
297
264
|
projectSlug,
|
|
298
|
-
|
|
299
|
-
|
|
265
|
+
fetchAndCacheModule: fetchAndCacheModuleFn,
|
|
266
|
+
log,
|
|
300
267
|
});
|
|
301
|
-
moduleCode = await processNestedImports(moduleCode, relativeResults, esmCacheDir, context.strictMissingModules ?? true, normalizedPath, projectSlug);
|
|
302
268
|
// Write to distributed cache AFTER nested imports are resolved.
|
|
303
269
|
// This ensures other pods get fully-resolved code without /_vf_modules/ paths.
|
|
304
270
|
if (needsDistributedCacheWrite && distResult?.distributedCache && transformCacheKey) {
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* @module transforms/mdx/esm-module-loader/module-fetcher/nested-imports
|
|
5
5
|
*/
|
|
6
6
|
import type { NestedImportResult } from "../types.js";
|
|
7
|
+
import type { Logger } from "../../../../utils/logger/logger.js";
|
|
7
8
|
/**
|
|
8
9
|
* Find nested module imports in code.
|
|
9
10
|
* Matches both /_vf_modules/... and file:///_vf_modules/... patterns.
|
|
@@ -29,4 +30,17 @@ export declare function hasUnresolvedImports(moduleCode: string): {
|
|
|
29
30
|
* Process nested imports by replacing them with file:// paths or stub modules.
|
|
30
31
|
*/
|
|
31
32
|
export declare function processNestedImports(moduleCode: string, results: NestedImportResult[], esmCacheDir: string, strictMissingModules: boolean, parentModulePath?: string, projectSlug?: string): Promise<string>;
|
|
33
|
+
export interface ResolveNestedModuleImportsInput {
|
|
34
|
+
moduleCode: string;
|
|
35
|
+
esmCacheDir: string;
|
|
36
|
+
normalizedPath: string;
|
|
37
|
+
projectSlug: string;
|
|
38
|
+
strictMissingModules: boolean;
|
|
39
|
+
fetchAndCacheModule: (path: string, parent?: string) => Promise<string | null>;
|
|
40
|
+
log?: Logger;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Resolve nested /_vf_modules and relative imports into local file:// cache paths.
|
|
44
|
+
*/
|
|
45
|
+
export declare function resolveNestedModuleImports(input: ResolveNestedModuleImportsInput): Promise<string>;
|
|
32
46
|
//# sourceMappingURL=nested-imports.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nested-imports.d.ts","sourceRoot":"","sources":["../../../../../../src/src/transforms/mdx/esm-module-loader/module-fetcher/nested-imports.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"nested-imports.d.ts","sourceRoot":"","sources":["../../../../../../src/src/transforms/mdx/esm-module-loader/module-fetcher/nested-imports.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAQH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAGtD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oCAAoC,CAAC;AAEjE;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*/
|
|
6
|
-
import { RELATIVE_IMPORT_PATTERN, UNRESOLVED_VF_MODULES_PATTERN, VF_MODULE_IMPORT_PATTERN, } from "../constants.js";
|
|
6
|
+
import { LOG_PREFIX_MDX_LOADER, RELATIVE_IMPORT_PATTERN, UNRESOLVED_VF_MODULES_PATTERN, VF_MODULE_IMPORT_PATTERN, } from "../constants.js";
|
|
7
7
|
import { createStubModule } from "../utils/stub-module.js";
|
|
8
8
|
import { buildMissingModuleError } from "../missing-module.js";
|
|
9
9
|
/**
|
|
@@ -67,3 +67,52 @@ export async function processNestedImports(moduleCode, results, esmCacheDir, str
|
|
|
67
67
|
}
|
|
68
68
|
return result;
|
|
69
69
|
}
|
|
70
|
+
/**
|
|
71
|
+
* Resolve nested /_vf_modules and relative imports into local file:// cache paths.
|
|
72
|
+
*/
|
|
73
|
+
export async function resolveNestedModuleImports(input) {
|
|
74
|
+
let moduleCode = input.moduleCode;
|
|
75
|
+
const { vfModules, relative } = findNestedImports(moduleCode);
|
|
76
|
+
input.log?.debug(`${LOG_PREFIX_MDX_LOADER} [fetchAndCacheModule] found nested imports`, {
|
|
77
|
+
projectSlug: input.projectSlug,
|
|
78
|
+
normalizedPath: input.normalizedPath,
|
|
79
|
+
vfModulesCount: vfModules.length,
|
|
80
|
+
relativeCount: relative.length,
|
|
81
|
+
vfModulePaths: vfModules.map((module) => module.path).slice(0, 5),
|
|
82
|
+
relativePaths: relative.map((module) => module.path).slice(0, 5),
|
|
83
|
+
});
|
|
84
|
+
input.log?.debug(`${LOG_PREFIX_MDX_LOADER} [fetchAndCacheModule] processing vfModules START`, {
|
|
85
|
+
projectSlug: input.projectSlug,
|
|
86
|
+
normalizedPath: input.normalizedPath,
|
|
87
|
+
count: vfModules.length,
|
|
88
|
+
});
|
|
89
|
+
const vfStart = performance.now();
|
|
90
|
+
const nestedResults = await Promise.all(vfModules.map(async ({ original, path }) => ({
|
|
91
|
+
original,
|
|
92
|
+
nestedFilePath: await input.fetchAndCacheModule(path, input.normalizedPath),
|
|
93
|
+
nestedPath: path,
|
|
94
|
+
})));
|
|
95
|
+
input.log?.debug(`${LOG_PREFIX_MDX_LOADER} [fetchAndCacheModule] processing vfModules DONE`, {
|
|
96
|
+
projectSlug: input.projectSlug,
|
|
97
|
+
normalizedPath: input.normalizedPath,
|
|
98
|
+
vfMs: (performance.now() - vfStart).toFixed(1),
|
|
99
|
+
});
|
|
100
|
+
moduleCode = await processNestedImports(moduleCode, nestedResults, input.esmCacheDir, input.strictMissingModules, input.normalizedPath, input.projectSlug);
|
|
101
|
+
input.log?.debug(`${LOG_PREFIX_MDX_LOADER} [fetchAndCacheModule] processing relative imports START`, {
|
|
102
|
+
projectSlug: input.projectSlug,
|
|
103
|
+
normalizedPath: input.normalizedPath,
|
|
104
|
+
count: relative.length,
|
|
105
|
+
});
|
|
106
|
+
const relStart = performance.now();
|
|
107
|
+
const relativeResults = await Promise.all(relative.map(async ({ original, path }) => ({
|
|
108
|
+
original,
|
|
109
|
+
nestedFilePath: await input.fetchAndCacheModule(path, input.normalizedPath),
|
|
110
|
+
relativePath: path,
|
|
111
|
+
})));
|
|
112
|
+
input.log?.debug(`${LOG_PREFIX_MDX_LOADER} [fetchAndCacheModule] processing relative imports DONE`, {
|
|
113
|
+
projectSlug: input.projectSlug,
|
|
114
|
+
normalizedPath: input.normalizedPath,
|
|
115
|
+
relMs: (performance.now() - relStart).toFixed(1),
|
|
116
|
+
});
|
|
117
|
+
return await processNestedImports(moduleCode, relativeResults, input.esmCacheDir, input.strictMissingModules, input.normalizedPath, input.projectSlug);
|
|
118
|
+
}
|