veryfront 0.1.735 → 0.1.736

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  export default {
2
2
  "name": "veryfront",
3
- "version": "0.1.735",
3
+ "version": "0.1.736",
4
4
  "license": "Apache-2.0",
5
5
  "nodeModulesDir": "auto",
6
6
  "minimumDependencyAge": "P2D",
@@ -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;AAexD,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;AAoSD;;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"}
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;AAiRD;;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"}
@@ -18,18 +18,17 @@ import { loadImportMap } from "../../../../modules/import-map/index.js";
18
18
  import { getHttpBundleCacheDir } from "../../../../utils/cache-dir.js";
19
19
  import { REACT_DEFAULT_VERSION } from "../../../../utils/constants/cdn.js";
20
20
  import { LOG_PREFIX_MDX_LOADER } from "../constants.js";
21
- import { getLocalFs, getModulePathCache } from "../cache/index.js";
21
+ import { getModulePathCache } from "../cache/index.js";
22
22
  import { hashString } from "../utils/hash.js";
23
23
  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
27
  import { findNestedImports, processNestedImports } from "./nested-imports.js";
28
- import { validateCachedModule } from "./framework-validator.js";
29
- import { recordModuleToSession } from "./render-sessions.js";
30
28
  import { readDistributedCache, writeDistributedCache } from "./distributed-cache.js";
31
29
  import { fetchModuleViaHTTP } from "./http-fetcher.js";
32
30
  import { cacheModule, normalizePath } from "./module-cache.js";
31
+ import { readValidCachedModulePath } from "./path-cache-lookup.js";
33
32
  // Re-export extracted modules for backward compatibility
34
33
  export { rewriteDntImports } from "./import-rewriter.js";
35
34
  export { endRenderSession, hasRenderSession, startRenderSession } from "./render-sessions.js";
@@ -153,28 +152,20 @@ async function doFetchAndCacheModule(normalizedPath, context, fetchAndCacheModul
153
152
  const effectiveReactVersion = context.reactVersion ?? REACT_DEFAULT_VERSION;
154
153
  const pathCache = await getModulePathCache(esmCacheDir);
155
154
  const versionedKey = getVersionedPathCacheKey(normalizedPath, effectiveReactVersion);
156
- const cachedPath = pathCache.get(versionedKey);
157
- if (cachedPath) {
158
- try {
159
- const stat = await getLocalFs().stat(cachedPath);
160
- if (stat?.isFile) {
161
- const cachedCode = await getLocalFs().readTextFile(cachedPath);
162
- if (await validateCachedModule(normalizedPath, cachedPath, cachedCode, log, pathCache, versionedKey, context.contentSourceId
163
- ? {
164
- projectId: context.projectId,
165
- contentSourceId: context.contentSourceId,
166
- }
167
- : undefined)) {
168
- recordModuleToSession(normalizedPath);
169
- return cachedPath;
170
- }
155
+ const cachedPath = await readValidCachedModulePath({
156
+ normalizedPath,
157
+ pathCache,
158
+ versionedKey,
159
+ log,
160
+ recoveryOptions: context.contentSourceId
161
+ ? {
162
+ projectId: context.projectId,
163
+ contentSourceId: context.contentSourceId,
171
164
  }
172
- }
173
- catch (_) {
174
- /* expected: cached file may no longer exist on disk */
175
- pathCache.delete(versionedKey);
176
- }
177
- }
165
+ : undefined,
166
+ });
167
+ if (cachedPath)
168
+ return cachedPath;
178
169
  try {
179
170
  const resolved = await resolveModuleFile(normalizedPath, adapter, projectDir);
180
171
  if (!resolved) {
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Validated path-cache lookups for MDX ESM module fetching.
3
+ *
4
+ * @module transforms/mdx/esm-module-loader/module-fetcher/path-cache-lookup
5
+ */
6
+ import type { Logger } from "../../../../utils/logger/logger.js";
7
+ interface MdxRecoveryOptions {
8
+ projectId: string;
9
+ contentSourceId: string;
10
+ }
11
+ export interface ReadValidCachedModulePathInput {
12
+ normalizedPath: string;
13
+ pathCache: Map<string, string>;
14
+ versionedKey: string;
15
+ log: Logger;
16
+ recoveryOptions?: MdxRecoveryOptions;
17
+ }
18
+ /**
19
+ * Return a cached module path only when the path-cache entry points to an
20
+ * existing file whose contents pass the full cached-module validator.
21
+ */
22
+ export declare function readValidCachedModulePath(input: ReadValidCachedModulePathInput): Promise<string | null>;
23
+ export {};
24
+ //# sourceMappingURL=path-cache-lookup.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"path-cache-lookup.d.ts","sourceRoot":"","sources":["../../../../../../src/src/transforms/mdx/esm-module-loader/module-fetcher/path-cache-lookup.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oCAAoC,CAAC;AAKjE,UAAU,kBAAkB;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,8BAA8B;IAC7C,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,YAAY,EAAE,MAAM,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,eAAe,CAAC,EAAE,kBAAkB,CAAC;CACtC;AAED;;;GAGG;AACH,wBAAsB,yBAAyB,CAC7C,KAAK,EAAE,8BAA8B,GACpC,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CA6BxB"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Validated path-cache lookups for MDX ESM module fetching.
3
+ *
4
+ * @module transforms/mdx/esm-module-loader/module-fetcher/path-cache-lookup
5
+ */
6
+ import { getLocalFs } from "../cache/index.js";
7
+ import { validateCachedModule } from "./framework-validator.js";
8
+ import { recordModuleToSession } from "./render-sessions.js";
9
+ /**
10
+ * Return a cached module path only when the path-cache entry points to an
11
+ * existing file whose contents pass the full cached-module validator.
12
+ */
13
+ export async function readValidCachedModulePath(input) {
14
+ const cachedPath = input.pathCache.get(input.versionedKey);
15
+ if (!cachedPath)
16
+ return null;
17
+ try {
18
+ const stat = await getLocalFs().stat(cachedPath);
19
+ if (!stat?.isFile)
20
+ return null;
21
+ const cachedCode = await getLocalFs().readTextFile(cachedPath);
22
+ if (await validateCachedModule(input.normalizedPath, cachedPath, cachedCode, input.log, input.pathCache, input.versionedKey, input.recoveryOptions)) {
23
+ recordModuleToSession(input.normalizedPath);
24
+ return cachedPath;
25
+ }
26
+ }
27
+ catch (_) {
28
+ /* expected: cached file may no longer exist on disk */
29
+ input.pathCache.delete(input.versionedKey);
30
+ }
31
+ return null;
32
+ }
@@ -1,3 +1,3 @@
1
1
  /** Shared version value. */
2
- export declare const VERSION = "0.1.735";
2
+ export declare const VERSION = "0.1.736";
3
3
  //# sourceMappingURL=version-constant.d.ts.map
@@ -1,4 +1,4 @@
1
1
  // Keep in sync with deno.json version.
2
2
  // scripts/release.ts updates this constant during releases.
3
3
  /** Shared version value. */
4
- export const VERSION = "0.1.735";
4
+ export const VERSION = "0.1.736";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "veryfront",
3
- "version": "0.1.735",
3
+ "version": "0.1.736",
4
4
  "description": "The simplest way to build AI-powered apps",
5
5
  "keywords": [
6
6
  "react",