veryfront 0.1.754 → 0.1.756
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/cli/auth/callback-server.d.ts +4 -1
- package/esm/cli/auth/callback-server.d.ts.map +1 -1
- package/esm/cli/auth/callback-server.js +52 -13
- package/esm/cli/auth/index.d.ts +1 -1
- package/esm/cli/auth/index.d.ts.map +1 -1
- package/esm/cli/auth/index.js +1 -1
- package/esm/cli/auth/login.d.ts +2 -0
- package/esm/cli/auth/login.d.ts.map +1 -1
- package/esm/cli/auth/login.js +18 -6
- package/esm/cli/commands/demo/demo.d.ts.map +1 -1
- package/esm/cli/commands/demo/demo.js +6 -7
- package/esm/deno.js +1 -1
- package/esm/src/agent/runtime/index.d.ts +3 -96
- package/esm/src/agent/runtime/index.d.ts.map +1 -1
- package/esm/src/agent/runtime/index.js +21 -341
- package/esm/src/agent/runtime/model-capabilities.d.ts +3 -0
- package/esm/src/agent/runtime/model-capabilities.d.ts.map +1 -0
- package/esm/src/agent/runtime/model-capabilities.js +18 -0
- package/esm/src/agent/runtime/runtime-tool-config.d.ts +14 -0
- package/esm/src/agent/runtime/runtime-tool-config.d.ts.map +1 -0
- package/esm/src/agent/runtime/runtime-tool-config.js +37 -0
- package/esm/src/agent/runtime/skill-policy-enforcement.d.ts +16 -0
- package/esm/src/agent/runtime/skill-policy-enforcement.d.ts.map +1 -0
- package/esm/src/agent/runtime/skill-policy-enforcement.js +55 -0
- package/esm/src/agent/runtime/tool-result-continuation.d.ts +34 -0
- package/esm/src/agent/runtime/tool-result-continuation.d.ts.map +1 -0
- package/esm/src/agent/runtime/tool-result-continuation.js +194 -0
- package/esm/src/agent/schemas/agent.schema.d.ts +7 -0
- package/esm/src/agent/schemas/agent.schema.d.ts.map +1 -1
- package/esm/src/agent/schemas/agent.schema.js +9 -3
- package/esm/src/agent/schemas/index.d.ts +1 -1
- package/esm/src/agent/schemas/index.d.ts.map +1 -1
- package/esm/src/agent/schemas/index.js +1 -1
- package/esm/src/cache/dependency-graph.d.ts +1 -0
- package/esm/src/cache/dependency-graph.d.ts.map +1 -1
- package/esm/src/cache/dependency-graph.js +7 -1
- package/esm/src/modules/server/module-batch-handler.d.ts.map +1 -1
- package/esm/src/modules/server/module-batch-handler.js +47 -35
- package/esm/src/modules/server/module-server.d.ts.map +1 -1
- package/esm/src/modules/server/module-server.js +31 -9
- package/esm/src/modules/server/rate-limiter.d.ts +3 -2
- package/esm/src/modules/server/rate-limiter.d.ts.map +1 -1
- package/esm/src/platform/adapters/base.d.ts +24 -3
- package/esm/src/platform/adapters/base.d.ts.map +1 -1
- package/esm/src/platform/adapters/base.js +15 -1
- package/esm/src/platform/adapters/runtime/bun/websocket-adapter.d.ts +2 -0
- package/esm/src/platform/adapters/runtime/bun/websocket-adapter.d.ts.map +1 -1
- package/esm/src/platform/adapters/runtime/bun/websocket-adapter.js +33 -1
- package/esm/src/platform/adapters/runtime/node/websocket-adapter.d.ts +1 -1
- package/esm/src/platform/adapters/runtime/node/websocket-adapter.d.ts.map +1 -1
- package/esm/src/platform/adapters/runtime/node/websocket-adapter.js +3 -10
- package/esm/src/proxy/handler.d.ts.map +1 -1
- package/esm/src/proxy/handler.js +25 -116
- package/esm/src/proxy/local-project-resolver.d.ts +18 -0
- package/esm/src/proxy/local-project-resolver.d.ts.map +1 -0
- package/esm/src/proxy/local-project-resolver.js +63 -0
- package/esm/src/proxy/proxy-token-resolution.d.ts +37 -0
- package/esm/src/proxy/proxy-token-resolution.d.ts.map +1 -0
- package/esm/src/proxy/proxy-token-resolution.js +51 -0
- package/esm/src/rendering/orchestrator/module-loader/index.d.ts +10 -0
- package/esm/src/rendering/orchestrator/module-loader/index.d.ts.map +1 -1
- package/esm/src/rendering/orchestrator/module-loader/index.js +23 -158
- package/esm/src/rendering/orchestrator/module-loader/module-persistence.d.ts +20 -0
- package/esm/src/rendering/orchestrator/module-loader/module-persistence.d.ts.map +1 -0
- package/esm/src/rendering/orchestrator/module-loader/module-persistence.js +80 -0
- package/esm/src/rendering/orchestrator/module-loader/module-transform-cache.d.ts +59 -0
- package/esm/src/rendering/orchestrator/module-loader/module-transform-cache.d.ts.map +1 -0
- package/esm/src/rendering/orchestrator/module-loader/module-transform-cache.js +97 -0
- package/esm/src/routing/api/handler.d.ts +2 -1
- package/esm/src/routing/api/handler.d.ts.map +1 -1
- package/esm/src/routing/api/handler.js +2 -1
- package/esm/src/routing/api/route-executor.d.ts +3 -0
- package/esm/src/routing/api/route-executor.d.ts.map +1 -1
- package/esm/src/routing/api/route-executor.js +28 -0
- package/esm/src/runtime/runtime-bridge.js +2 -2
- package/esm/src/security/http/base-handler.d.ts +3 -2
- package/esm/src/security/http/base-handler.d.ts.map +1 -1
- package/esm/src/security/http/base-handler.js +1 -1
- package/esm/src/security/sandbox/project-worker.d.ts +1 -0
- package/esm/src/security/sandbox/project-worker.d.ts.map +1 -1
- package/esm/src/security/sandbox/project-worker.js +17 -1
- package/esm/src/security/sandbox/worker-egress-guard.d.ts +15 -0
- package/esm/src/security/sandbox/worker-egress-guard.d.ts.map +1 -0
- package/esm/src/security/sandbox/worker-egress-guard.js +201 -0
- package/esm/src/security/sandbox/worker-permissions.d.ts +6 -2
- package/esm/src/security/sandbox/worker-permissions.d.ts.map +1 -1
- package/esm/src/security/sandbox/worker-permissions.js +34 -3
- package/esm/src/security/sandbox/worker-pool.d.ts +1 -1
- package/esm/src/security/sandbox/worker-pool.d.ts.map +1 -1
- package/esm/src/security/sandbox/worker-pool.js +35 -9
- package/esm/src/server/handlers/preview/hmr-client-manager.d.ts +3 -2
- package/esm/src/server/handlers/preview/hmr-client-manager.d.ts.map +1 -1
- package/esm/src/server/handlers/preview/hmr.handler.d.ts.map +1 -1
- package/esm/src/server/handlers/preview/hmr.handler.js +4 -1
- package/esm/src/server/handlers/request/api/api-handler-wrapper.js +1 -1
- package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/http-fallback.d.ts +32 -0
- package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/http-fallback.d.ts.map +1 -0
- package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/http-fallback.js +27 -0
- package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/import-rewriter.d.ts.map +1 -1
- package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/import-rewriter.js +23 -3
- 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 +32 -30
- package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/persistence.d.ts +34 -0
- package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/persistence.d.ts.map +1 -0
- package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/persistence.js +30 -0
- package/esm/src/utils/version-constant.d.ts +1 -1
- package/esm/src/utils/version-constant.js +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unresolved module HTTP fallback phase for the MDX ESM module fetcher.
|
|
3
|
+
*
|
|
4
|
+
* @module transforms/mdx/esm-module-loader/module-fetcher/http-fallback
|
|
5
|
+
*/
|
|
6
|
+
import { buildMissingModuleError } from "../missing-module.js";
|
|
7
|
+
import { fetchModuleViaHTTP } from "./http-fetcher.js";
|
|
8
|
+
import { cacheModule } from "./module-cache.js";
|
|
9
|
+
/**
|
|
10
|
+
* Resolve an unresolved filesystem module through the local HTTP fallback.
|
|
11
|
+
*/
|
|
12
|
+
export async function resolveUnresolvedModuleViaHttpFallback(input) {
|
|
13
|
+
const fetchViaHttp = input.fetchViaHttp ?? fetchModuleViaHTTP;
|
|
14
|
+
const cacheLocalModule = input.cacheLocalModule ?? cacheModule;
|
|
15
|
+
const moduleCode = await fetchViaHttp(input.normalizedPath, input.adapter, input.fetchAndCacheModule, input.log, input.projectSlug, input.isLocalProject);
|
|
16
|
+
if (moduleCode) {
|
|
17
|
+
return await cacheLocalModule(input.normalizedPath, moduleCode, input.esmCacheDir, input.pathCache, input.log, input.reactVersion);
|
|
18
|
+
}
|
|
19
|
+
if (input.strictMissingModules ?? true) {
|
|
20
|
+
throw buildMissingModuleError({
|
|
21
|
+
modulePath: input.normalizedPath,
|
|
22
|
+
importer: input.parentModulePath,
|
|
23
|
+
projectSlug: input.projectSlug,
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"import-rewriter.d.ts","sourceRoot":"","sources":["../../../../../../src/src/transforms/mdx/esm-module-loader/module-fetcher/import-rewriter.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"import-rewriter.d.ts","sourceRoot":"","sources":["../../../../../../src/src/transforms/mdx/esm-module-loader/module-fetcher/import-rewriter.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AA2CH;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAgB5D;AAwCD,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CA0D7F"}
|
|
@@ -5,23 +5,43 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { dirname, join, resolve } from "../../../../platform/compat/path/index.js";
|
|
7
7
|
import { FRAMEWORK_ROOT } from "../constants.js";
|
|
8
|
-
import {
|
|
8
|
+
import { DEFAULT_REACT_VERSION, veryfrontStrategy, } from "../../../import-rewriter/index.js";
|
|
9
9
|
import { getLocalFs } from "../cache/index.js";
|
|
10
10
|
import { findStaticImportFromSpans, findStaticSideEffectImportSpans, replaceSourceSpans, } from "../utils/source-spans.js";
|
|
11
|
+
const MODULE_FETCHER_VERYFRONT_CONTEXT = {
|
|
12
|
+
filePath: "",
|
|
13
|
+
projectDir: "",
|
|
14
|
+
projectId: "",
|
|
15
|
+
target: "ssr",
|
|
16
|
+
dev: false,
|
|
17
|
+
reactVersion: DEFAULT_REACT_VERSION,
|
|
18
|
+
};
|
|
19
|
+
function rewriteVeryfrontModuleSpecifier(specifier) {
|
|
20
|
+
const result = veryfrontStrategy.rewrite({
|
|
21
|
+
specifier,
|
|
22
|
+
isDynamic: false,
|
|
23
|
+
start: 0,
|
|
24
|
+
end: specifier.length,
|
|
25
|
+
statementStart: 0,
|
|
26
|
+
statementEnd: 0,
|
|
27
|
+
raw: {},
|
|
28
|
+
}, MODULE_FETCHER_VERYFRONT_CONTEXT);
|
|
29
|
+
return result.specifier;
|
|
30
|
+
}
|
|
11
31
|
/**
|
|
12
32
|
* Rewrite veryfront/* imports to /_vf_modules/_veryfront/ paths for MDX module loading.
|
|
13
33
|
* Uses deno.json exports/imports as the source of truth and appends ?ssr=true.
|
|
14
34
|
*/
|
|
15
35
|
export function rewriteVeryfrontImports(code) {
|
|
16
36
|
const replacements = findStaticImportFromSpans(code, (specifier) => specifier.startsWith("veryfront/") ? specifier : null).flatMap(({ original, path, start, end }) => {
|
|
17
|
-
const mapped =
|
|
37
|
+
const mapped = rewriteVeryfrontModuleSpecifier(path);
|
|
18
38
|
if (!mapped)
|
|
19
39
|
return [];
|
|
20
40
|
return [{
|
|
21
41
|
start,
|
|
22
42
|
end,
|
|
23
43
|
expected: original,
|
|
24
|
-
replacement: `from "${mapped}
|
|
44
|
+
replacement: `from "${mapped}"`,
|
|
25
45
|
}];
|
|
26
46
|
});
|
|
27
47
|
return replaceSourceSpans(code, replacements);
|
|
@@ -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;AAG5E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAcxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,sBAAsB,CAAC;AAS9B;;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;AAG5E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAcxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,sBAAsB,CAAC;AAS9B;;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;AA8ID;;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"}
|
|
@@ -17,13 +17,13 @@ import { LOG_PREFIX_MDX_LOADER } from "../constants.js";
|
|
|
17
17
|
import { getModulePathCache } from "../cache/index.js";
|
|
18
18
|
import { hashString } from "../utils/hash.js";
|
|
19
19
|
import { resolveModuleFile } from "../resolution/file-finder.js";
|
|
20
|
-
import { buildMissingModuleError } from "../missing-module.js";
|
|
21
20
|
import { getTransformCacheKey, getVersionedPathCacheKey } from "./cache-keys.js";
|
|
22
21
|
import { resolveNestedModuleImports } from "./nested-imports.js";
|
|
23
|
-
import { readDistributedCache
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
22
|
+
import { readDistributedCache } from "./distributed-cache.js";
|
|
23
|
+
import { resolveUnresolvedModuleViaHttpFallback } from "./http-fallback.js";
|
|
24
|
+
import { normalizePath } from "./module-cache.js";
|
|
26
25
|
import { readValidCachedModulePath } from "./path-cache-lookup.js";
|
|
26
|
+
import { persistResolvedModule } from "./persistence.js";
|
|
27
27
|
import { transformResolvedModuleSource } from "./source-transform.js";
|
|
28
28
|
// Re-export extracted modules for backward compatibility
|
|
29
29
|
export { rewriteDntImports } from "./import-rewriter.js";
|
|
@@ -165,18 +165,19 @@ async function doFetchAndCacheModule(normalizedPath, context, fetchAndCacheModul
|
|
|
165
165
|
try {
|
|
166
166
|
const resolved = await resolveModuleFile(normalizedPath, adapter, projectDir);
|
|
167
167
|
if (!resolved) {
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
168
|
+
return await resolveUnresolvedModuleViaHttpFallback({
|
|
169
|
+
normalizedPath,
|
|
170
|
+
adapter,
|
|
171
|
+
fetchAndCacheModule: fetchAndCacheModuleFn,
|
|
172
|
+
log,
|
|
173
|
+
projectSlug,
|
|
174
|
+
isLocalProject: context.isLocalProject,
|
|
175
|
+
strictMissingModules: context.strictMissingModules ?? true,
|
|
176
|
+
esmCacheDir,
|
|
177
|
+
pathCache,
|
|
178
|
+
reactVersion: effectiveReactVersion,
|
|
179
|
+
parentModulePath,
|
|
180
|
+
});
|
|
180
181
|
}
|
|
181
182
|
const { sourceCode, actualFilePath } = resolved;
|
|
182
183
|
const contentHash = hashString(sourceCode);
|
|
@@ -219,23 +220,24 @@ async function doFetchAndCacheModule(normalizedPath, context, fetchAndCacheModul
|
|
|
219
220
|
fetchAndCacheModule: fetchAndCacheModuleFn,
|
|
220
221
|
log,
|
|
221
222
|
});
|
|
222
|
-
|
|
223
|
-
// This ensures other pods get fully-resolved code without /_vf_modules/ paths.
|
|
224
|
-
if (needsDistributedCacheWrite && distResult?.distributedCache && transformCacheKey) {
|
|
225
|
-
writeDistributedCache(distResult.distributedCache, transformCacheKey, projectId, contentSourceId, moduleCode, normalizedPath, log);
|
|
226
|
-
}
|
|
227
|
-
log.debug(`${LOG_PREFIX_MDX_LOADER} [fetchAndCacheModule] cacheModule START`, {
|
|
228
|
-
projectSlug,
|
|
223
|
+
return await persistResolvedModule({
|
|
229
224
|
normalizedPath,
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
225
|
+
moduleCode,
|
|
226
|
+
esmCacheDir,
|
|
227
|
+
pathCache,
|
|
228
|
+
log,
|
|
234
229
|
projectSlug,
|
|
235
|
-
|
|
236
|
-
|
|
230
|
+
reactVersion: effectiveReactVersion,
|
|
231
|
+
distributedCacheWrite: needsDistributedCacheWrite && distResult?.distributedCache && transformCacheKey &&
|
|
232
|
+
contentSourceId
|
|
233
|
+
? {
|
|
234
|
+
distributedCache: distResult.distributedCache,
|
|
235
|
+
transformCacheKey,
|
|
236
|
+
projectId,
|
|
237
|
+
contentSourceId,
|
|
238
|
+
}
|
|
239
|
+
: undefined,
|
|
237
240
|
});
|
|
238
|
-
return finalCachedPath;
|
|
239
241
|
}
|
|
240
242
|
catch (error) {
|
|
241
243
|
log.warn(`${LOG_PREFIX_MDX_LOADER} Failed to process ${normalizedPath}`, error);
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Final persistence phase for the MDX ESM module fetcher.
|
|
3
|
+
*
|
|
4
|
+
* @module transforms/mdx/esm-module-loader/module-fetcher/persistence
|
|
5
|
+
*/
|
|
6
|
+
import type { Logger } from "../../../../utils/logger/logger.js";
|
|
7
|
+
import { cacheModule } from "./module-cache.js";
|
|
8
|
+
import { writeDistributedCache } from "./distributed-cache.js";
|
|
9
|
+
type CacheLocalModuleFn = typeof cacheModule;
|
|
10
|
+
type WriteDistributedCacheFn = typeof writeDistributedCache;
|
|
11
|
+
type DistributedCache = Parameters<WriteDistributedCacheFn>[0];
|
|
12
|
+
export interface PersistResolvedModuleInput {
|
|
13
|
+
normalizedPath: string;
|
|
14
|
+
moduleCode: string;
|
|
15
|
+
esmCacheDir: string;
|
|
16
|
+
pathCache: Map<string, string>;
|
|
17
|
+
log: Logger;
|
|
18
|
+
projectSlug: string;
|
|
19
|
+
reactVersion?: string;
|
|
20
|
+
distributedCacheWrite?: {
|
|
21
|
+
distributedCache: DistributedCache;
|
|
22
|
+
transformCacheKey: string;
|
|
23
|
+
projectId: string;
|
|
24
|
+
contentSourceId: string;
|
|
25
|
+
};
|
|
26
|
+
cacheLocalModule?: CacheLocalModuleFn;
|
|
27
|
+
writeToDistributedCache?: WriteDistributedCacheFn;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Persist fully resolved module code to distributed and local caches.
|
|
31
|
+
*/
|
|
32
|
+
export declare function persistResolvedModule(input: PersistResolvedModuleInput): Promise<string | null>;
|
|
33
|
+
export {};
|
|
34
|
+
//# sourceMappingURL=persistence.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"persistence.d.ts","sourceRoot":"","sources":["../../../../../../src/src/transforms/mdx/esm-module-loader/module-fetcher/persistence.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oCAAoC,CAAC;AAEjE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAE/D,KAAK,kBAAkB,GAAG,OAAO,WAAW,CAAC;AAC7C,KAAK,uBAAuB,GAAG,OAAO,qBAAqB,CAAC;AAC5D,KAAK,gBAAgB,GAAG,UAAU,CAAC,uBAAuB,CAAC,CAAC,CAAC,CAAC,CAAC;AAE/D,MAAM,WAAW,0BAA0B;IACzC,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,qBAAqB,CAAC,EAAE;QACtB,gBAAgB,EAAE,gBAAgB,CAAC;QACnC,iBAAiB,EAAE,MAAM,CAAC;QAC1B,SAAS,EAAE,MAAM,CAAC;QAClB,eAAe,EAAE,MAAM,CAAC;KACzB,CAAC;IACF,gBAAgB,CAAC,EAAE,kBAAkB,CAAC;IACtC,uBAAuB,CAAC,EAAE,uBAAuB,CAAC;CACnD;AAED;;GAEG;AACH,wBAAsB,qBAAqB,CACzC,KAAK,EAAE,0BAA0B,GAChC,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAoCxB"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Final persistence phase for the MDX ESM module fetcher.
|
|
3
|
+
*
|
|
4
|
+
* @module transforms/mdx/esm-module-loader/module-fetcher/persistence
|
|
5
|
+
*/
|
|
6
|
+
import { LOG_PREFIX_MDX_LOADER } from "../constants.js";
|
|
7
|
+
import { cacheModule } from "./module-cache.js";
|
|
8
|
+
import { writeDistributedCache } from "./distributed-cache.js";
|
|
9
|
+
/**
|
|
10
|
+
* Persist fully resolved module code to distributed and local caches.
|
|
11
|
+
*/
|
|
12
|
+
export async function persistResolvedModule(input) {
|
|
13
|
+
const writeToDistributedCache = input.writeToDistributedCache ?? writeDistributedCache;
|
|
14
|
+
const cacheLocalModule = input.cacheLocalModule ?? cacheModule;
|
|
15
|
+
if (input.distributedCacheWrite) {
|
|
16
|
+
writeToDistributedCache(input.distributedCacheWrite.distributedCache, input.distributedCacheWrite.transformCacheKey, input.distributedCacheWrite.projectId, input.distributedCacheWrite.contentSourceId, input.moduleCode, input.normalizedPath, input.log);
|
|
17
|
+
}
|
|
18
|
+
input.log.debug(`${LOG_PREFIX_MDX_LOADER} [fetchAndCacheModule] cacheModule START`, {
|
|
19
|
+
projectSlug: input.projectSlug,
|
|
20
|
+
normalizedPath: input.normalizedPath,
|
|
21
|
+
});
|
|
22
|
+
const cacheStart = performance.now();
|
|
23
|
+
const finalCachedPath = await cacheLocalModule(input.normalizedPath, input.moduleCode, input.esmCacheDir, input.pathCache, input.log, input.reactVersion);
|
|
24
|
+
input.log.debug(`${LOG_PREFIX_MDX_LOADER} [fetchAndCacheModule] cacheModule DONE`, {
|
|
25
|
+
projectSlug: input.projectSlug,
|
|
26
|
+
normalizedPath: input.normalizedPath,
|
|
27
|
+
cacheMs: (performance.now() - cacheStart).toFixed(1),
|
|
28
|
+
});
|
|
29
|
+
return finalCachedPath;
|
|
30
|
+
}
|