veryfront 0.1.714 → 0.1.716
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/platform/core-platform.d.ts.map +1 -1
- package/esm/src/platform/core-platform.js +9 -10
- package/esm/src/transforms/esm/bundle-deps-validator.d.ts.map +1 -1
- package/esm/src/transforms/esm/bundle-deps-validator.js +2 -1
- package/esm/src/transforms/esm/bundle-recovery.d.ts.map +1 -1
- package/esm/src/transforms/esm/bundle-recovery.js +3 -2
- package/esm/src/transforms/esm/http-cache-invariants.d.ts +1 -1
- package/esm/src/transforms/esm/http-cache-invariants.d.ts.map +1 -1
- package/esm/src/transforms/esm/http-cache-invariants.js +5 -4
- package/esm/src/transforms/esm/http-cache.d.ts.map +1 -1
- package/esm/src/transforms/esm/http-cache.js +2 -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":"core-platform.d.ts","sourceRoot":"","sources":["../../../src/src/platform/core-platform.ts"],"names":[],"mappings":"AACA,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,MAAM,GAAG,KAAK,GAAG,oBAAoB,GAAG,SAAS,CAAC;AAElF,UAAU,oBAAoB;IAC5B,eAAe,EAAE,OAAO,CAAC;IACzB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,aAAa,EAAE,OAAO,CAAC;IACvB,mBAAmB,EAAE,OAAO,CAAC;IAC7B,oBAAoB,EAAE,OAAO,CAAC;IAC9B,WAAW,EAAE,MAAM,CAAC;CACrB;
|
|
1
|
+
{"version":3,"file":"core-platform.d.ts","sourceRoot":"","sources":["../../../src/src/platform/core-platform.ts"],"names":[],"mappings":"AACA,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,MAAM,GAAG,KAAK,GAAG,oBAAoB,GAAG,SAAS,CAAC;AAElF,UAAU,oBAAoB;IAC5B,eAAe,EAAE,OAAO,CAAC;IACzB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,aAAa,EAAE,OAAO,CAAC;IACvB,mBAAmB,EAAE,OAAO,CAAC;IAC7B,oBAAoB,EAAE,OAAO,CAAC;IAC9B,WAAW,EAAE,MAAM,CAAC;CACrB;AAcD,wBAAgB,cAAc,IAAI,QAAQ,CAiBzC;AA2ED,wBAAgB,uBAAuB,CAAC,QAAQ,CAAC,EAAE,QAAQ,GAAG,oBAAoB,CAEjF;AAED,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,MAAM,oBAAoB,GAAG,OAAO,CAOlF;AAED,wBAAgB,mBAAmB,IAAI,MAAM,EAAE,CA8B9C;AAED,UAAU,mBAAmB;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,wBAAgB,6BAA6B,CAC3C,MAAM,EAAE,mBAAmB,EAC3B,QAAQ,CAAC,EAAE,QAAQ,GAClB;IACD,UAAU,EAAE,OAAO,CAAC;IACpB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB,CA8BA"}
|
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
import * as dntShim from "../../_dnt.shims.js";
|
|
2
|
+
function runtimeGlobal() {
|
|
3
|
+
return dntShim.dntGlobalThis;
|
|
4
|
+
}
|
|
2
5
|
export function detectPlatform() {
|
|
3
|
-
|
|
4
|
-
if (
|
|
6
|
+
const global = runtimeGlobal();
|
|
7
|
+
if (global.Deno?.version?.deno)
|
|
5
8
|
return "deno";
|
|
6
|
-
|
|
7
|
-
if (typeof Bun !== "undefined" && Bun.version)
|
|
9
|
+
if (global.Bun?.version)
|
|
8
10
|
return "bun";
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
typeof navigator !== "undefined" &&
|
|
12
|
-
navigator.userAgent === "Cloudflare-Workers") {
|
|
11
|
+
if (global.caches !== undefined &&
|
|
12
|
+
global.navigator?.userAgent === "Cloudflare-Workers") {
|
|
13
13
|
return "cloudflare-workers";
|
|
14
14
|
}
|
|
15
|
-
|
|
16
|
-
if (globalProcess?.versions?.node)
|
|
15
|
+
if (global.process?.versions?.node)
|
|
17
16
|
return "node";
|
|
18
17
|
return "unknown";
|
|
19
18
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bundle-deps-validator.d.ts","sourceRoot":"","sources":["../../../../src/src/transforms/esm/bundle-deps-validator.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,gBAAgB,EAAU,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"bundle-deps-validator.d.ts","sourceRoot":"","sources":["../../../../src/src/transforms/esm/bundle-deps-validator.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,gBAAgB,EAAU,MAAM,6BAA6B,CAAC;AAUvE;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CAwBrF;AAED;;;;GAIG;AACH,wBAAsB,uBAAuB,CAC3C,IAAI,EAAE,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,EAC3C,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,OAAO,CAAC,CAyFlB;AAED;;;GAGG;AACH,wBAAsB,+BAA+B,CACnD,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EAChB,EAAE,EAAE,UAAU,CAAC,OAAO,gBAAgB,CAAC,GACtC,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAAC,CA+BrD"}
|
|
@@ -10,6 +10,7 @@ import { createFileSystem, exists } from "../../platform/compat/fs.js";
|
|
|
10
10
|
import { join } from "../../platform/compat/path/index.js";
|
|
11
11
|
import { rendererLogger } from "../../utils/index.js";
|
|
12
12
|
import { httpBundleCache } from "./http-cache-wrapper.js";
|
|
13
|
+
import { unbrand } from "./http-cache-types.js";
|
|
13
14
|
import { extractSourceUrl } from "./source-url-embed.js";
|
|
14
15
|
import { ensureAbsoluteDir, hasIncompatibleFilePaths } from "./http-cache-helpers.js";
|
|
15
16
|
const logger = rendererLogger.component("http-cache");
|
|
@@ -103,7 +104,7 @@ export async function validateBundleDepsExist(deps, cacheDir) {
|
|
|
103
104
|
logger.debug("Dep cannot be recovered from Redis", { hash });
|
|
104
105
|
return false;
|
|
105
106
|
}
|
|
106
|
-
const code = localCode;
|
|
107
|
+
const code = unbrand(localCode);
|
|
107
108
|
if (hasIncompatibleFilePaths(code, absoluteCacheDir)) {
|
|
108
109
|
logger.debug("Dep has incompatible paths, rejecting cache", { hash });
|
|
109
110
|
return false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bundle-recovery.d.ts","sourceRoot":"","sources":["../../../../src/src/transforms/esm/bundle-recovery.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;
|
|
1
|
+
{"version":3,"file":"bundle-recovery.d.ts","sourceRoot":"","sources":["../../../../src/src/transforms/esm/bundle-recovery.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAUH,OAAO,EACL,KAAK,YAAY,EAIlB,MAAM,yBAAyB,CAAC;AAMjC,kFAAkF;AAClF,KAAK,iBAAiB,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,KAAK,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;AAExF;;;;GAIG;AACH,wBAAsB,uBAAuB,CAC3C,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,EAChB,eAAe,EAAE,iBAAiB,EAClC,UAAU,CAAC,EAAE,MAAM,GAClB,OAAO,CAAC,OAAO,CAAC,CAuJlB;AAED;;;GAGG;AACH,wBAAsB,sBAAsB,CAC1C,WAAW,EAAE,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,EAClD,QAAQ,EAAE,MAAM,EAChB,eAAe,EAAE,iBAAiB,GACjC,OAAO,CAAC,MAAM,EAAE,CAAC,CA2HnB;AAED;;GAEG;AACH,wBAAsB,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAyB3F"}
|
|
@@ -12,6 +12,7 @@ import { join } from "../../platform/compat/path/index.js";
|
|
|
12
12
|
import { rendererLogger } from "../../utils/logger/logger.js";
|
|
13
13
|
import { simpleHash } from "../../utils/hash-utils.js";
|
|
14
14
|
import { httpBundleCache } from "./http-cache-wrapper.js";
|
|
15
|
+
import { unbrand } from "./http-cache-types.js";
|
|
15
16
|
import { VeryfrontError } from "./http-cache-invariants.js";
|
|
16
17
|
import { extractSourceUrl } from "./source-url-embed.js";
|
|
17
18
|
import { ensureAbsoluteDir, hasIncompatibleFilePaths, normalizeHttpUrl, } from "./http-cache-helpers.js";
|
|
@@ -30,7 +31,7 @@ export async function recoverHttpBundleByHash(hash, cacheDir, cacheHttpModule, p
|
|
|
30
31
|
try {
|
|
31
32
|
const result = await httpBundleCache.getCodeByHash(hash);
|
|
32
33
|
if (result.code) {
|
|
33
|
-
const cachedCode = result.code;
|
|
34
|
+
const cachedCode = unbrand(result.code);
|
|
34
35
|
if (hasIncompatibleFilePaths(cachedCode, absoluteCacheDir)) {
|
|
35
36
|
logger.warn("Cached code has incompatible file paths, will re-fetch", {
|
|
36
37
|
hash,
|
|
@@ -237,7 +238,7 @@ export async function ensureHttpBundlesExist(bundlePaths, cacheDir, cacheHttpMod
|
|
|
237
238
|
}
|
|
238
239
|
return;
|
|
239
240
|
}
|
|
240
|
-
const code = localCode;
|
|
241
|
+
const code = unbrand(localCode);
|
|
241
242
|
if (hasIncompatibleFilePaths(code, absoluteCacheDir)) {
|
|
242
243
|
logger.warn("[HTTP-CACHE] Batch-fetched code has incompatible file paths, trying single recovery", { hash, localCacheDir: absoluteCacheDir });
|
|
243
244
|
const recovered = await recoverHttpBundleByHash(hash, absoluteCacheDir, cacheHttpModule);
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* @module transforms/esm/http-cache-invariants
|
|
8
8
|
*/
|
|
9
|
-
import type
|
|
9
|
+
import { type BundleHash, type LocalModuleCode, type PortableModuleCode } from "./http-cache-types.js";
|
|
10
10
|
import { CACHE_DIR_TOKEN, CACHE_INVARIANT_VIOLATION, hasHardcodedCachePaths as baseHasHardcodedCachePaths } from "../../cache/paths.js";
|
|
11
11
|
import { VeryfrontError } from "../../errors/types.js";
|
|
12
12
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http-cache-invariants.d.ts","sourceRoot":"","sources":["../../../../src/src/transforms/esm/http-cache-invariants.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"http-cache-invariants.d.ts","sourceRoot":"","sources":["../../../../src/src/transforms/esm/http-cache-invariants.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAEL,KAAK,UAAU,EACf,KAAK,eAAe,EACpB,KAAK,kBAAkB,EAExB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,eAAe,EACf,yBAAyB,EACzB,sBAAsB,IAAI,0BAA0B,EACrD,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAIvD;;;GAGG;AACH,OAAO,EAAE,eAAe,EAAE,CAAC;AAE3B,OAAO,EAAE,yBAAyB,EAAE,cAAc,EAAE,CAAC;AAErD;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB,mCAA6B,CAAC;AAYjE;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,kBAAkB,GAAG,IAAI,CAa7D;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,eAAe,GAAG,IAAI,CAcvD;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,CASrD;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,CAQ/D"}
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
* @module transforms/esm/http-cache-invariants
|
|
8
8
|
*/
|
|
9
9
|
import { rendererLogger } from "../../utils/index.js";
|
|
10
|
+
import { brand, unbrand, } from "./http-cache-types.js";
|
|
10
11
|
import { CACHE_DIR_TOKEN, CACHE_INVARIANT_VIOLATION, hasHardcodedCachePaths as baseHasHardcodedCachePaths, } from "../../cache/paths.js";
|
|
11
12
|
import { VeryfrontError } from "../../errors/types.js";
|
|
12
13
|
const logger = rendererLogger.component("http-cache");
|
|
@@ -41,7 +42,7 @@ function hasPortableTokens(code) {
|
|
|
41
42
|
* @throws VeryfrontError (cache-invariant-violation) if code contains hardcoded paths
|
|
42
43
|
*/
|
|
43
44
|
export function assertPortable(code) {
|
|
44
|
-
const codeStr = code;
|
|
45
|
+
const codeStr = unbrand(code);
|
|
45
46
|
if (hasHardcodedCachePaths(codeStr)) {
|
|
46
47
|
logger.error("Invariant violation: hardcoded paths in portable code", {
|
|
47
48
|
preview: codeStr.substring(0, 200),
|
|
@@ -59,7 +60,7 @@ export function assertPortable(code) {
|
|
|
59
60
|
* @throws VeryfrontError (cache-invariant-violation) if code contains portable tokens
|
|
60
61
|
*/
|
|
61
62
|
export function assertLocal(code) {
|
|
62
|
-
const codeStr = code;
|
|
63
|
+
const codeStr = unbrand(code);
|
|
63
64
|
if (hasPortableTokens(codeStr)) {
|
|
64
65
|
logger.error("Invariant violation: portable tokens in local code", {
|
|
65
66
|
tokenCount: (codeStr.match(new RegExp(CACHE_DIR_TOKEN, "g")) || []).length,
|
|
@@ -85,7 +86,7 @@ export function asBundleHash(hash) {
|
|
|
85
86
|
detail: `[CACHE INVARIANT VIOLATION] Invalid bundle hash format: "${hash}" (expected numeric)`,
|
|
86
87
|
});
|
|
87
88
|
}
|
|
88
|
-
return hash;
|
|
89
|
+
return brand(hash);
|
|
89
90
|
}
|
|
90
91
|
/**
|
|
91
92
|
* Safely cast string to LocalModuleCode after validation.
|
|
@@ -101,5 +102,5 @@ export function asLocalModuleCode(code) {
|
|
|
101
102
|
detail: `[CACHE INVARIANT VIOLATION] Cannot treat code as LocalModuleCode: contains ${CACHE_DIR_TOKEN} tokens`,
|
|
102
103
|
});
|
|
103
104
|
}
|
|
104
|
-
return code;
|
|
105
|
+
return brand(code);
|
|
105
106
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http-cache.d.ts","sourceRoot":"","sources":["../../../../src/src/transforms/esm/http-cache.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"http-cache.d.ts","sourceRoot":"","sources":["../../../../src/src/transforms/esm/http-cache.ts"],"names":[],"mappings":"AAyBA,OAAO,EACL,eAAe,EACf,uBAAuB,EACvB,oBAAoB,EACpB,qBAAqB,EACrB,kBAAkB,EACnB,MAAM,sBAAsB,CAAC;AAI9B,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzE,OAAO,EACL,KAAK,YAAY,EAEjB,wBAAwB,EACxB,K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Q,EAAE,MAAM,GACf,OAAO,CAAC,MAAM,EAAE,CAAC,CAEnB;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAErF;AAGD,eAAO,MAAM,wBAAwB,0BAAoB,CAAC"}
|
|
@@ -19,6 +19,7 @@ import { createBundleManifest, storeBundleManifest } from "./bundle-manifest.js"
|
|
|
19
19
|
import { HTTP_MODULE_DISTRIBUTED_TTL_SEC } from "../../utils/constants/cache.js";
|
|
20
20
|
import { HTTP_FETCH_TIMEOUT_MS } from "../../utils/constants/http.js";
|
|
21
21
|
import { httpBundleCache } from "./http-cache-wrapper.js";
|
|
22
|
+
import { unbrand } from "./http-cache-types.js";
|
|
22
23
|
import { asLocalModuleCode, VeryfrontError } from "./http-cache-invariants.js";
|
|
23
24
|
import { CACHE_DIR_TOKEN, detokenizeAllCachePaths, detokenizeCachePaths, tokenizeAllCachePaths, tokenizeCachePaths, } from "../../cache/paths.js";
|
|
24
25
|
import { looksLikeHtmlContent as looksLikeHtmlNotJs } from "./html-content.js";
|
|
@@ -108,7 +109,7 @@ async function cacheHttpModuleInternal(url, options) {
|
|
|
108
109
|
const fetchPromise = (async () => {
|
|
109
110
|
const cacheResult = await httpBundleCache.getCodeByUrl(String(hash));
|
|
110
111
|
if (cacheResult.code) {
|
|
111
|
-
const cachedCode = cacheResult.code;
|
|
112
|
+
const cachedCode = unbrand(cacheResult.code);
|
|
112
113
|
const deps = extractBundleDeps(cachedCode);
|
|
113
114
|
if (deps.length > 0) {
|
|
114
115
|
const depsExist = await validateBundleDepsExist(deps, cacheDir);
|