veryfront 0.1.837 → 0.1.838

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.837",
3
+ "version": "0.1.838",
4
4
  "license": "Apache-2.0",
5
5
  "nodeModulesDir": "auto",
6
6
  "minimumDependencyAge": {
@@ -1 +1 @@
1
- {"version":3,"file":"module-server.d.ts","sourceRoot":"","sources":["../../../../src/src/modules/server/module-server.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAG5E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAyDtE;;;;;;;;;GASG;AACH,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAwDrD,CAAC;AAyEF,MAAM,WAAW,mBAAmB;IAClC,yDAAyD;IACzD,SAAS,EAAE,MAAM,CAAC;IAClB,6BAA6B;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,sBAAsB;IACtB,OAAO,EAAE,cAAc,CAAC;IACxB,uBAAuB;IACvB,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,+DAA+D;IAC/D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gFAAgF;IAChF,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,mDAAmD;IACnD,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,uDAAuD;IACvD,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC7B,yDAAyD;IACzD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,sFAAsF;IACtF,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,sDAAsD;AACtD,wBAAgB,WAAW,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,QAAQ,CAAC,CAubzF;AAwWD;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAGrD"}
1
+ {"version":3,"file":"module-server.d.ts","sourceRoot":"","sources":["../../../../src/src/modules/server/module-server.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAG5E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AA0DtE;;;;;;;;;GASG;AACH,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAwDrD,CAAC;AAyEF,MAAM,WAAW,mBAAmB;IAClC,yDAAyD;IACzD,SAAS,EAAE,MAAM,CAAC;IAClB,6BAA6B;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,sBAAsB;IACtB,OAAO,EAAE,cAAc,CAAC;IACxB,uBAAuB;IACvB,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,+DAA+D;IAC/D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gFAAgF;IAChF,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,mDAAmD;IACnD,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,uDAAuD;IACvD,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC7B,yDAAyD;IACzD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,sFAAsF;IACtF,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,sDAAsD;AACtD,wBAAgB,WAAW,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,QAAQ,CAAC,CA8bzF;AAwWD;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAGrD"}
@@ -20,7 +20,7 @@ import { FRAMEWORK_ROOT, resolveFrameworkSourcePath, } from "../../platform/comp
20
20
  import { getReactUrls, REACT_DEFAULT_VERSION } from "../../utils/constants/cdn.js";
21
21
  import { readLimitedCrossProjectSource } from "./cross-project-source-limit.js";
22
22
  import { sha256Short } from "../../cache/hash.js";
23
- import { getReleaseDependencyRewriteManifestState, rewriteReleaseDependencyImportsForModule, } from "../../release-assets/module-consumption.js";
23
+ import { getReleaseDependencyRewriteManifestState, hasReleaseDependencyImportSpecifiers, rewriteReleaseDependencyImportsForModule, } from "../../release-assets/module-consumption.js";
24
24
  import { RELEASE_ASSET_IMMUTABLE_MAX_AGE_SECONDS, RELEASE_MODULE_RUNTIME_VERSION_PARAM, RELEASE_MODULE_VERSION_PARAM, } from "../../release-assets/constants.js";
25
25
  import { buildSourceMissCacheKey, hasSourceMiss, rememberSourceMiss, } from "./module-source-resolution-cache.js";
26
26
  import { buildReleaseModuleResponseCacheKey, getReleaseModuleResponse, rememberReleaseModuleResponse, } from "./module-response-cache.js";
@@ -337,17 +337,16 @@ export function serveModule(req, options) {
337
337
  shouldCacheReleaseVersionedModule(url, options, isSSR);
338
338
  let releaseDependencyManifest = null;
339
339
  let releaseDependencyManifestVersion = null;
340
- let releaseDependencyManifestReady = true;
340
+ let releaseDependencyManifestRequired = false;
341
341
  if (canCacheReleaseVersionedModule) {
342
342
  const manifestState = await getReleaseDependencyRewriteManifestState(options.releaseId);
343
343
  if (manifestState.enabled) {
344
344
  releaseDependencyManifest = manifestState.manifest;
345
345
  releaseDependencyManifestVersion = manifestState.manifest?.manifestVersion ?? null;
346
- releaseDependencyManifestReady = manifestState.manifest !== null;
346
+ releaseDependencyManifestRequired = manifestState.manifest === null;
347
347
  }
348
348
  }
349
- const releaseModuleResponseCacheKey = canCacheReleaseVersionedModule &&
350
- releaseDependencyManifestReady
349
+ const releaseModuleResponseCacheKey = canCacheReleaseVersionedModule
351
350
  ? buildReleaseModuleResponseCacheKey({
352
351
  projectIdentity: effectiveProjectId,
353
352
  projectDir,
@@ -363,11 +362,16 @@ export function serveModule(req, options) {
363
362
  if (releaseModuleResponseCacheKey) {
364
363
  const cachedResponse = await getReleaseModuleResponse(releaseModuleResponseCacheKey);
365
364
  if (cachedResponse?.entry) {
366
- markRequestProfilePhase("module.response_cache_hit");
367
- if (cachedResponse.source === "distributed") {
368
- markRequestProfilePhase("module.response_cache_distributed_hit");
365
+ const canUseCachedResponse = !releaseDependencyManifestRequired ||
366
+ !(await hasReleaseDependencyImportSpecifiers(cachedResponse.entry.body));
367
+ if (canUseCachedResponse) {
368
+ markRequestProfilePhase("module.response_cache_hit");
369
+ if (cachedResponse.source === "distributed") {
370
+ markRequestProfilePhase("module.response_cache_distributed_hit");
371
+ }
372
+ return createModuleResponse(method, cachedResponse.entry.body, cachedResponse.entry.status, Object.fromEntries(cachedResponse.entry.headers));
369
373
  }
370
- return createModuleResponse(method, cachedResponse.entry.body, cachedResponse.entry.status, Object.fromEntries(cachedResponse.entry.headers));
374
+ markRequestProfilePhase("module.response_cache_manifest_blocked");
371
375
  }
372
376
  markRequestProfilePhase("module.response_cache_miss");
373
377
  }
@@ -465,14 +469,17 @@ export function serveModule(req, options) {
465
469
  code = await addReleaseVersionToFallbackImports(code, modulePath, options.releaseId);
466
470
  }
467
471
  }
472
+ const canCacheModuleResponse = releaseModuleResponseCacheKey !== null &&
473
+ (!releaseDependencyManifestRequired ||
474
+ !(await hasReleaseDependencyImportSpecifiers(code)));
468
475
  const headers = getModuleHeaders(modulePath, {
469
- cacheable: releaseModuleResponseCacheKey !== null,
476
+ cacheable: canCacheModuleResponse,
470
477
  });
471
478
  logger.debug("Request complete", {
472
479
  path: modulePath,
473
480
  durationMs: (performance.now() - startTime).toFixed(1),
474
481
  });
475
- if (releaseModuleResponseCacheKey && method === "GET") {
482
+ if (canCacheModuleResponse && method === "GET") {
476
483
  void rememberReleaseModuleResponse(releaseModuleResponseCacheKey, {
477
484
  body: code,
478
485
  status: HTTP_OK,
@@ -19,6 +19,7 @@ export interface ReleaseDependencyRewriteManifestState {
19
19
  manifest: ReleaseAssetManifest | null;
20
20
  }
21
21
  export declare function isReleaseDependencyImportMapRewriteEnabled(): boolean;
22
+ export declare function hasReleaseDependencyImportSpecifiers(code: string): Promise<boolean>;
22
23
  export declare function getReleaseDependencyRewriteManifestState(releaseId: string | null | undefined): Promise<ReleaseDependencyRewriteManifestState>;
23
24
  export declare function rewriteReleaseDependencyImportsForModule(code: string, options: RewriteReleaseDependencyImportsOptions): Promise<string>;
24
25
  //# sourceMappingURL=module-consumption.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"module-consumption.d.ts","sourceRoot":"","sources":["../../../src/src/release-assets/module-consumption.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAQH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAEjE,MAAM,WAAW,sCAAsC;IACrD,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,oBAAoB,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IACxD,QAAQ,CAAC,EAAE,oBAAoB,GAAG,IAAI,CAAC;CACxC;AAED,MAAM,WAAW,qCAAqC;IACpD,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,oBAAoB,GAAG,IAAI,CAAC;CACvC;AAED,wBAAgB,0CAA0C,IAAI,OAAO,CAEpE;AAED,wBAAsB,wCAAwC,CAC5D,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GACnC,OAAO,CAAC,qCAAqC,CAAC,CAShD;AAmDD,wBAAsB,wCAAwC,CAC5D,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,sCAAsC,GAC9C,OAAO,CAAC,MAAM,CAAC,CA6BjB"}
1
+ {"version":3,"file":"module-consumption.d.ts","sourceRoot":"","sources":["../../../src/src/release-assets/module-consumption.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAQH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAEjE,MAAM,WAAW,sCAAsC;IACrD,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,oBAAoB,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IACxD,QAAQ,CAAC,EAAE,oBAAoB,GAAG,IAAI,CAAC;CACxC;AAED,MAAM,WAAW,qCAAqC;IACpD,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,oBAAoB,GAAG,IAAI,CAAC;CACvC;AAED,wBAAgB,0CAA0C,IAAI,OAAO,CAEpE;AAWD,wBAAsB,oCAAoC,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CASzF;AAED,wBAAsB,wCAAwC,CAC5D,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GACnC,OAAO,CAAC,qCAAqC,CAAC,CAShD;AAmDD,wBAAsB,wCAAwC,CAC5D,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,sCAAsC,GAC9C,OAAO,CAAC,MAAM,CAAC,CA6BjB"}
@@ -17,6 +17,26 @@ import { getReadyManifestForRenderAsync } from "./manifest-cache.js";
17
17
  export function isReleaseDependencyImportMapRewriteEnabled() {
18
18
  return getHostEnv(RELEASE_ASSET_DEPENDENCY_IMPORT_MAP_ENV_FLAG) === "1";
19
19
  }
20
+ function isHttpImportSpecifier(specifier) {
21
+ try {
22
+ const url = new URL(specifier);
23
+ return url.protocol === "http:" || url.protocol === "https:";
24
+ }
25
+ catch {
26
+ return false;
27
+ }
28
+ }
29
+ export async function hasReleaseDependencyImportSpecifiers(code) {
30
+ if (!code.includes("http") && !code.includes("veryfront-http-bundle"))
31
+ return false;
32
+ for (const imp of await parseImports(code)) {
33
+ if (!imp.n)
34
+ continue;
35
+ if (isHttpImportSpecifier(imp.n) || localHttpBundlePath(imp.n))
36
+ return true;
37
+ }
38
+ return false;
39
+ }
20
40
  export async function getReleaseDependencyRewriteManifestState(releaseId) {
21
41
  if (!releaseId || !isReleaseDependencyImportMapRewriteEnabled()) {
22
42
  return { enabled: false, manifest: null };
@@ -1,3 +1,3 @@
1
1
  /** Shared version value. */
2
- export declare const VERSION = "0.1.837";
2
+ export declare const VERSION = "0.1.838";
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.837";
4
+ export const VERSION = "0.1.838";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "veryfront",
3
- "version": "0.1.837",
3
+ "version": "0.1.838",
4
4
  "description": "The simplest way to build AI-powered apps",
5
5
  "keywords": [
6
6
  "react",