@veryfront/ext-content-mdx 0.1.1081 → 0.1.1083
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/_dnt.polyfills.d.ts +0 -6
- package/esm/_dnt.polyfills.d.ts.map +1 -1
- package/esm/_dnt.shims.d.ts +1 -1
- package/esm/deno.d.ts +3 -0
- package/esm/deno.js +8 -5
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_loader_state.d.ts +2 -2
- package/esm/src/transforms/mdx/compiler/frontmatter-extractor.js +1 -1
- package/esm/src/utils/logger/logger.d.ts.map +1 -1
- package/esm/src/utils/logger/logger.js +16 -12
- package/esm/src/utils/version-constant.d.ts +1 -1
- package/esm/src/utils/version-constant.js +1 -1
- package/package.json +2 -2
- package/esm/src/config/defaults.d.ts +0 -39
- package/esm/src/config/defaults.d.ts.map +0 -1
- package/esm/src/config/defaults.js +0 -65
- package/esm/src/errors/error-registry/agent.d.ts +0 -18
- package/esm/src/errors/error-registry/agent.d.ts.map +0 -1
- package/esm/src/errors/error-registry/agent.js +0 -60
- package/esm/src/errors/error-registry/boundary.d.ts +0 -16
- package/esm/src/errors/error-registry/boundary.d.ts.map +0 -1
- package/esm/src/errors/error-registry/boundary.js +0 -52
- package/esm/src/errors/error-registry/build.d.ts +0 -20
- package/esm/src/errors/error-registry/build.d.ts.map +0 -1
- package/esm/src/errors/error-registry/build.js +0 -68
- package/esm/src/errors/error-registry/config.d.ts +0 -22
- package/esm/src/errors/error-registry/config.d.ts.map +0 -1
- package/esm/src/errors/error-registry/config.js +0 -70
- package/esm/src/errors/error-registry/deploy.d.ts +0 -12
- package/esm/src/errors/error-registry/deploy.d.ts.map +0 -1
- package/esm/src/errors/error-registry/deploy.js +0 -36
- package/esm/src/errors/error-registry/dev.d.ts +0 -14
- package/esm/src/errors/error-registry/dev.d.ts.map +0 -1
- package/esm/src/errors/error-registry/dev.js +0 -44
- package/esm/src/errors/error-registry/general.d.ts +0 -29
- package/esm/src/errors/error-registry/general.d.ts.map +0 -1
- package/esm/src/errors/error-registry/general.js +0 -92
- package/esm/src/errors/error-registry/module.d.ts +0 -16
- package/esm/src/errors/error-registry/module.d.ts.map +0 -1
- package/esm/src/errors/error-registry/module.js +0 -52
- package/esm/src/errors/error-registry/route.d.ts +0 -16
- package/esm/src/errors/error-registry/route.d.ts.map +0 -1
- package/esm/src/errors/error-registry/route.js +0 -52
- package/esm/src/errors/error-registry/runtime.d.ts +0 -18
- package/esm/src/errors/error-registry/runtime.d.ts.map +0 -1
- package/esm/src/errors/error-registry/runtime.js +0 -60
- package/esm/src/errors/error-registry/server.d.ts +0 -39
- package/esm/src/errors/error-registry/server.d.ts.map +0 -1
- package/esm/src/errors/error-registry/server.js +0 -129
- package/esm/src/errors/error-registry-helpers.d.ts +0 -6
- package/esm/src/errors/error-registry-helpers.d.ts.map +0 -1
- package/esm/src/errors/error-registry-helpers.js +0 -9
- package/esm/src/errors/error-registry.d.ts +0 -114
- package/esm/src/errors/error-registry.d.ts.map +0 -1
- package/esm/src/errors/error-registry.js +0 -60
- package/esm/src/errors/types.d.ts +0 -84
- package/esm/src/errors/types.d.ts.map +0 -1
- package/esm/src/errors/types.js +0 -69
- package/esm/src/errors/veryfront-error.d.ts +0 -149
- package/esm/src/errors/veryfront-error.d.ts.map +0 -1
- package/esm/src/errors/veryfront-error.js +0 -61
- package/esm/src/modules/react-loader/ssr-module-loader/concurrency/semaphore.d.ts +0 -13
- package/esm/src/modules/react-loader/ssr-module-loader/concurrency/semaphore.d.ts.map +0 -1
- package/esm/src/modules/react-loader/ssr-module-loader/concurrency/semaphore.js +0 -55
- package/esm/src/observability/tracing/api-shim.d.ts +0 -191
- package/esm/src/observability/tracing/api-shim.d.ts.map +0 -1
- package/esm/src/observability/tracing/api-shim.js +0 -281
- package/esm/src/observability/tracing/otlp-setup.d.ts +0 -63
- package/esm/src/observability/tracing/otlp-setup.d.ts.map +0 -1
- package/esm/src/observability/tracing/otlp-setup.js +0 -219
- package/esm/src/observability/tracing/telemetry-env.d.ts +0 -3
- package/esm/src/observability/tracing/telemetry-env.d.ts.map +0 -1
- package/esm/src/observability/tracing/telemetry-env.js +0 -10
- package/esm/src/platform/adapters/base.d.ts +0 -209
- package/esm/src/platform/adapters/base.d.ts.map +0 -1
- package/esm/src/platform/adapters/base.js +0 -15
- package/esm/src/platform/compat/constants.d.ts +0 -13
- package/esm/src/platform/compat/constants.d.ts.map +0 -1
- package/esm/src/platform/compat/constants.js +0 -12
- package/esm/src/platform/compat/fs.d.ts +0 -75
- package/esm/src/platform/compat/fs.d.ts.map +0 -1
- package/esm/src/platform/compat/fs.js +0 -315
- package/esm/src/transforms/import-rewriter/url-builder.d.ts +0 -70
- package/esm/src/transforms/import-rewriter/url-builder.d.ts.map +0 -1
- package/esm/src/transforms/import-rewriter/url-builder.js +0 -152
- package/esm/src/utils/base64url.d.ts +0 -6
- package/esm/src/utils/base64url.d.ts.map +0 -1
- package/esm/src/utils/base64url.js +0 -12
- package/esm/src/utils/bundle-manifest.d.ts +0 -63
- package/esm/src/utils/bundle-manifest.d.ts.map +0 -1
- package/esm/src/utils/bundle-manifest.js +0 -96
- package/esm/src/utils/constants/buffers.d.ts +0 -24
- package/esm/src/utils/constants/buffers.d.ts.map +0 -1
- package/esm/src/utils/constants/buffers.js +0 -23
- package/esm/src/utils/constants/build.d.ts +0 -8
- package/esm/src/utils/constants/build.d.ts.map +0 -1
- package/esm/src/utils/constants/build.js +0 -7
- package/esm/src/utils/constants/cache.d.ts +0 -74
- package/esm/src/utils/constants/cache.d.ts.map +0 -1
- package/esm/src/utils/constants/cache.js +0 -133
- package/esm/src/utils/constants/cdn.d.ts +0 -29
- package/esm/src/utils/constants/cdn.d.ts.map +0 -1
- package/esm/src/utils/constants/cdn.js +0 -58
- package/esm/src/utils/constants/crypto.d.ts +0 -10
- package/esm/src/utils/constants/crypto.d.ts.map +0 -1
- package/esm/src/utils/constants/crypto.js +0 -9
- package/esm/src/utils/constants/env.d.ts +0 -16
- package/esm/src/utils/constants/env.d.ts.map +0 -1
- package/esm/src/utils/constants/env.js +0 -20
- package/esm/src/utils/constants/hash.d.ts +0 -5
- package/esm/src/utils/constants/hash.d.ts.map +0 -1
- package/esm/src/utils/constants/hash.js +0 -4
- package/esm/src/utils/constants/hmr.d.ts +0 -24
- package/esm/src/utils/constants/hmr.d.ts.map +0 -1
- package/esm/src/utils/constants/hmr.js +0 -26
- package/esm/src/utils/constants/html.d.ts +0 -13
- package/esm/src/utils/constants/html.d.ts.map +0 -1
- package/esm/src/utils/constants/html.js +0 -12
- package/esm/src/utils/constants/http.d.ts +0 -77
- package/esm/src/utils/constants/http.d.ts.map +0 -1
- package/esm/src/utils/constants/http.js +0 -76
- package/esm/src/utils/constants/index.d.ts +0 -23
- package/esm/src/utils/constants/index.d.ts.map +0 -1
- package/esm/src/utils/constants/index.js +0 -22
- package/esm/src/utils/constants/limits.d.ts +0 -27
- package/esm/src/utils/constants/limits.d.ts.map +0 -1
- package/esm/src/utils/constants/limits.js +0 -26
- package/esm/src/utils/constants/metrics.d.ts +0 -10
- package/esm/src/utils/constants/metrics.d.ts.map +0 -1
- package/esm/src/utils/constants/metrics.js +0 -34
- package/esm/src/utils/constants/network.d.ts +0 -23
- package/esm/src/utils/constants/network.d.ts.map +0 -1
- package/esm/src/utils/constants/network.js +0 -27
- package/esm/src/utils/constants/priorities.d.ts +0 -31
- package/esm/src/utils/constants/priorities.d.ts.map +0 -1
- package/esm/src/utils/constants/priorities.js +0 -30
- package/esm/src/utils/constants/retry.d.ts +0 -14
- package/esm/src/utils/constants/retry.d.ts.map +0 -1
- package/esm/src/utils/constants/retry.js +0 -13
- package/esm/src/utils/constants/server.d.ts +0 -107
- package/esm/src/utils/constants/server.d.ts.map +0 -1
- package/esm/src/utils/constants/server.js +0 -120
- package/esm/src/utils/feature-flags.d.ts +0 -7
- package/esm/src/utils/feature-flags.d.ts.map +0 -1
- package/esm/src/utils/feature-flags.js +0 -8
- package/esm/src/utils/hash-utils.d.ts +0 -19
- package/esm/src/utils/hash-utils.d.ts.map +0 -1
- package/esm/src/utils/hash-utils.js +0 -42
- package/esm/src/utils/import-lockfile.d.ts +0 -52
- package/esm/src/utils/import-lockfile.d.ts.map +0 -1
- package/esm/src/utils/import-lockfile.js +0 -187
- package/esm/src/utils/index.d.ts +0 -27
- package/esm/src/utils/index.d.ts.map +0 -1
- package/esm/src/utils/index.js +0 -25
- package/esm/src/utils/logger/components.d.ts +0 -73
- package/esm/src/utils/logger/components.d.ts.map +0 -1
- package/esm/src/utils/logger/components.js +0 -81
- package/esm/src/utils/logger/index.d.ts +0 -10
- package/esm/src/utils/logger/index.d.ts.map +0 -1
- package/esm/src/utils/logger/index.js +0 -9
- package/esm/src/utils/logger/request-context.d.ts +0 -27
- package/esm/src/utils/logger/request-context.d.ts.map +0 -1
- package/esm/src/utils/logger/request-context.js +0 -28
- package/esm/src/utils/memoize.d.ts +0 -19
- package/esm/src/utils/memoize.d.ts.map +0 -1
- package/esm/src/utils/memoize.js +0 -72
- package/esm/src/utils/parallel.d.ts +0 -25
- package/esm/src/utils/parallel.d.ts.map +0 -1
- package/esm/src/utils/parallel.js +0 -91
- package/esm/src/utils/path-utils.d.ts +0 -34
- package/esm/src/utils/path-utils.d.ts.map +0 -1
- package/esm/src/utils/path-utils.js +0 -138
- package/esm/src/utils/perf-timer.d.ts +0 -11
- package/esm/src/utils/perf-timer.d.ts.map +0 -1
- package/esm/src/utils/perf-timer.js +0 -114
- package/esm/src/utils/platform.d.ts +0 -9
- package/esm/src/utils/platform.d.ts.map +0 -1
- package/esm/src/utils/platform.js +0 -11
- package/esm/src/utils/runtime-guards.d.ts +0 -29
- package/esm/src/utils/runtime-guards.d.ts.map +0 -1
- package/esm/src/utils/runtime-guards.js +0 -23
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Canonical component names for structured logging.
|
|
3
|
-
*
|
|
4
|
-
* These names are used with `logger.component("name")` to create
|
|
5
|
-
* component-scoped loggers. The component field appears in JSON output
|
|
6
|
-
* for Grafana/Loki filtering and as `[name]` in text output.
|
|
7
|
-
*
|
|
8
|
-
* Convention: lowercase-kebab-case.
|
|
9
|
-
* Not enforced at runtime — any string is accepted. This registry is a
|
|
10
|
-
* non-exhaustive reference to promote reuse and discoverability.
|
|
11
|
-
*
|
|
12
|
-
* @module
|
|
13
|
-
*/
|
|
14
|
-
export const LogComponents = {
|
|
15
|
-
// Server & infrastructure
|
|
16
|
-
server: "server",
|
|
17
|
-
config: "config",
|
|
18
|
-
middleware: "middleware",
|
|
19
|
-
cors: "cors",
|
|
20
|
-
security: "security",
|
|
21
|
-
discovery: "discovery",
|
|
22
|
-
pipeline: "pipeline",
|
|
23
|
-
global: "global",
|
|
24
|
-
// Rendering
|
|
25
|
-
ssr: "ssr",
|
|
26
|
-
ssrService: "ssr-service",
|
|
27
|
-
ssrOrchestrator: "ssr-orchestrator",
|
|
28
|
-
rsc: "rsc",
|
|
29
|
-
html: "html",
|
|
30
|
-
htmlGenerator: "html-generator",
|
|
31
|
-
mdx: "mdx",
|
|
32
|
-
mdxCompiler: "mdx-compiler",
|
|
33
|
-
mdxCache: "mdx-cache",
|
|
34
|
-
hmr: "hmr",
|
|
35
|
-
hmrHandler: "hmr-handler",
|
|
36
|
-
hmrServer: "hmr-server",
|
|
37
|
-
renderer: "renderer",
|
|
38
|
-
snippetRenderer: "snippet-renderer",
|
|
39
|
-
// Build & transforms
|
|
40
|
-
build: "build",
|
|
41
|
-
esm: "esm",
|
|
42
|
-
esmTransform: "esm-transform",
|
|
43
|
-
ssrTransform: "ssr-transform",
|
|
44
|
-
ssrModuleLoader: "ssr-module-loader",
|
|
45
|
-
moduleLoader: "module-loader",
|
|
46
|
-
moduleServer: "module-server",
|
|
47
|
-
// Caching
|
|
48
|
-
cache: "cache",
|
|
49
|
-
cacheRegistry: "cache-registry",
|
|
50
|
-
distributedCache: "distributed-cache",
|
|
51
|
-
httpCache: "http-cache",
|
|
52
|
-
httpCacheWrapper: "http-cache-wrapper",
|
|
53
|
-
ssrHttpCache: "ssr-http-cache",
|
|
54
|
-
fileCache: "file-cache",
|
|
55
|
-
moduleCache: "module-cache",
|
|
56
|
-
transformCache: "transform-cache",
|
|
57
|
-
// API & HTTP
|
|
58
|
-
api: "api",
|
|
59
|
-
httpHandler: "http-handler",
|
|
60
|
-
client: "client",
|
|
61
|
-
runtimeHandler: "runtime-handler",
|
|
62
|
-
// Platform & adapters
|
|
63
|
-
redis: "redis",
|
|
64
|
-
fsIntegration: "fs-integration",
|
|
65
|
-
readOperations: "read-operations",
|
|
66
|
-
// Observability
|
|
67
|
-
otel: "otel",
|
|
68
|
-
tracing: "tracing",
|
|
69
|
-
metrics: "metrics",
|
|
70
|
-
autoInstrument: "auto-instrument",
|
|
71
|
-
perf: "perf",
|
|
72
|
-
// Agent & AI
|
|
73
|
-
agent: "agent",
|
|
74
|
-
tool: "tool",
|
|
75
|
-
// Workflow
|
|
76
|
-
workflowDiscovery: "workflow-discovery",
|
|
77
|
-
// Misc
|
|
78
|
-
validator: "validator",
|
|
79
|
-
error: "error",
|
|
80
|
-
env: "env",
|
|
81
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Utils Logger
|
|
3
|
-
*
|
|
4
|
-
* @module utils/logger
|
|
5
|
-
*/
|
|
6
|
-
export { __registerLogRecordEmitter, __registerRequestContextGetter, __registerTraceContextGetter, __resetLoggerConfigForTests, __resetLogRecordEmitterForTests, __resetTraceContextGetterForTests, agentLogger, bundlerLogger, cliLogger, createRequestLogger, createRunUserLogger, getBaseLogger, getDefaultLevel, type LogEntry, type LogFormat, type Logger, logger, LogLevel, proxyLogger, refreshLoggerConfig, rendererLogger, serverLogger, } from "./logger.js";
|
|
7
|
-
export { ANSI, colorize, formatContextText, formatErrorText, formatTimestamp, formatValue, isRecord, LEVEL_COLORS, LEVEL_GLYPHS, type LogLevelName, normalizeText, padTag, PREFIX_WIDTH, type SerializedError, serializeError, TAG_WIDTH, truncateText, } from "./core.js";
|
|
8
|
-
export { getRequestContext, getRequestLogger, type RequestContext, requestContextStore, runWithRequestContext, runWithRequestContextAsync, } from "./request-context.js";
|
|
9
|
-
export { type LogComponent, LogComponents } from "./components.js";
|
|
10
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/src/utils/logger/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,0BAA0B,EAC1B,8BAA8B,EAC9B,4BAA4B,EAC5B,2BAA2B,EAC3B,+BAA+B,EAC/B,iCAAiC,EACjC,WAAW,EACX,aAAa,EACb,SAAS,EACT,mBAAmB,EACnB,mBAAmB,EACnB,aAAa,EACb,eAAe,EACf,KAAK,QAAQ,EACb,KAAK,SAAS,EACd,KAAK,MAAM,EACX,MAAM,EACN,QAAQ,EACR,WAAW,EACX,mBAAmB,EACnB,cAAc,EACd,YAAY,GACb,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,IAAI,EACJ,QAAQ,EACR,iBAAiB,EACjB,eAAe,EACf,eAAe,EACf,WAAW,EACX,QAAQ,EACR,YAAY,EACZ,YAAY,EACZ,KAAK,YAAY,EACjB,aAAa,EACb,MAAM,EACN,YAAY,EACZ,KAAK,eAAe,EACpB,cAAc,EACd,SAAS,EACT,YAAY,GACb,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,KAAK,cAAc,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,0BAA0B,GAC3B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,KAAK,YAAY,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Utils Logger
|
|
3
|
-
*
|
|
4
|
-
* @module utils/logger
|
|
5
|
-
*/
|
|
6
|
-
export { __registerLogRecordEmitter, __registerRequestContextGetter, __registerTraceContextGetter, __resetLoggerConfigForTests, __resetLogRecordEmitterForTests, __resetTraceContextGetterForTests, agentLogger, bundlerLogger, cliLogger, createRequestLogger, createRunUserLogger, getBaseLogger, getDefaultLevel, logger, LogLevel, proxyLogger, refreshLoggerConfig, rendererLogger, serverLogger, } from "./logger.js";
|
|
7
|
-
export { ANSI, colorize, formatContextText, formatErrorText, formatTimestamp, formatValue, isRecord, LEVEL_COLORS, LEVEL_GLYPHS, normalizeText, padTag, PREFIX_WIDTH, serializeError, TAG_WIDTH, truncateText, } from "./core.js";
|
|
8
|
-
export { getRequestContext, getRequestLogger, requestContextStore, runWithRequestContext, runWithRequestContextAsync, } from "./request-context.js";
|
|
9
|
-
export { LogComponents } from "./components.js";
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**************************
|
|
2
|
-
* Request Context Store
|
|
3
|
-
*
|
|
4
|
-
* Uses AsyncLocalStorage to propagate request-scoped logger context
|
|
5
|
-
* throughout the call stack without explicit parameter passing.
|
|
6
|
-
*
|
|
7
|
-
* @module utils/logger/request-context
|
|
8
|
-
**************************/
|
|
9
|
-
import { AsyncLocalStorage } from "node:async_hooks";
|
|
10
|
-
import { type Logger } from "./logger.js";
|
|
11
|
-
/** Context for request. */
|
|
12
|
-
export interface RequestContext {
|
|
13
|
-
logger: Logger;
|
|
14
|
-
requestId: string;
|
|
15
|
-
projectSlug?: string;
|
|
16
|
-
projectId?: string;
|
|
17
|
-
domain?: string;
|
|
18
|
-
userId?: string;
|
|
19
|
-
conversationId?: string;
|
|
20
|
-
}
|
|
21
|
-
export declare const requestContextStore: AsyncLocalStorage<RequestContext>;
|
|
22
|
-
export declare function getRequestContext(): RequestContext | undefined;
|
|
23
|
-
export declare function getRequestLogger(): Logger | undefined;
|
|
24
|
-
export declare function runWithRequestContext<T>(context: RequestContext, fn: () => T): T;
|
|
25
|
-
/** Run with request context async. */
|
|
26
|
-
export declare function runWithRequestContextAsync<T>(context: RequestContext, fn: () => Promise<T>): Promise<T>;
|
|
27
|
-
//# sourceMappingURL=request-context.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"request-context.d.ts","sourceRoot":"","sources":["../../../../src/src/utils/logger/request-context.ts"],"names":[],"mappings":"AAAA;;;;;;;4BAO4B;AAE5B,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAkC,KAAK,MAAM,EAAE,MAAM,aAAa,CAAC;AAE1E,2BAA2B;AAC3B,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,eAAO,MAAM,mBAAmB,mCAA0C,CAAC;AAE3E,wBAAgB,iBAAiB,IAAI,cAAc,GAAG,SAAS,CAE9D;AAED,wBAAgB,gBAAgB,IAAI,MAAM,GAAG,SAAS,CAErD;AAED,wBAAgB,qBAAqB,CAAC,CAAC,EAAE,OAAO,EAAE,cAAc,EAAE,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC,CAEhF;AAED,sCAAsC;AACtC,wBAAgB,0BAA0B,CAAC,CAAC,EAC1C,OAAO,EAAE,cAAc,EACvB,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GACnB,OAAO,CAAC,CAAC,CAAC,CAEZ"}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**************************
|
|
2
|
-
* Request Context Store
|
|
3
|
-
*
|
|
4
|
-
* Uses AsyncLocalStorage to propagate request-scoped logger context
|
|
5
|
-
* throughout the call stack without explicit parameter passing.
|
|
6
|
-
*
|
|
7
|
-
* @module utils/logger/request-context
|
|
8
|
-
**************************/
|
|
9
|
-
import { AsyncLocalStorage } from "node:async_hooks";
|
|
10
|
-
import { __registerRequestContextGetter } from "./logger.js";
|
|
11
|
-
export const requestContextStore = new AsyncLocalStorage();
|
|
12
|
-
export function getRequestContext() {
|
|
13
|
-
return requestContextStore.getStore();
|
|
14
|
-
}
|
|
15
|
-
export function getRequestLogger() {
|
|
16
|
-
return getRequestContext()?.logger;
|
|
17
|
-
}
|
|
18
|
-
export function runWithRequestContext(context, fn) {
|
|
19
|
-
return requestContextStore.run(context, fn);
|
|
20
|
-
}
|
|
21
|
-
/** Run with request context async. */
|
|
22
|
-
export function runWithRequestContextAsync(context, fn) {
|
|
23
|
-
return requestContextStore.run(context, fn);
|
|
24
|
-
}
|
|
25
|
-
// Register the context getter with the logger module.
|
|
26
|
-
// This allows context-aware loggers to access request context
|
|
27
|
-
// without creating a circular dependency.
|
|
28
|
-
__registerRequestContextGetter(getRequestContext);
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/** Implement memo cache. */
|
|
2
|
-
export declare class MemoCache<V> {
|
|
3
|
-
private cache;
|
|
4
|
-
get(key: string): V | undefined;
|
|
5
|
-
set(key: string, value: V): void;
|
|
6
|
-
has(key: string): boolean;
|
|
7
|
-
clear(): void;
|
|
8
|
-
size(): number;
|
|
9
|
-
}
|
|
10
|
-
/** Memoize async. */
|
|
11
|
-
export declare function memoizeAsync<Args extends unknown[], Result>(fn: (...args: Args) => Promise<Result>, keyHasher: (...args: Args) => string): (...args: Args) => Promise<Result>;
|
|
12
|
-
/** Memoize. */
|
|
13
|
-
export declare function memoize<Args extends unknown[], Result>(fn: (...args: Args) => Result, keyHasher: (...args: Args) => string): (...args: Args) => Result;
|
|
14
|
-
/**
|
|
15
|
-
* FNV-1a hash algorithm for fast cache key generation.
|
|
16
|
-
* 10-15x faster than JSON.stringify() and uses 70-80% less memory.
|
|
17
|
-
*/
|
|
18
|
-
export declare function simpleHash(...values: unknown[]): string;
|
|
19
|
-
//# sourceMappingURL=memoize.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"memoize.d.ts","sourceRoot":"","sources":["../../../src/src/utils/memoize.ts"],"names":[],"mappings":"AAGA,4BAA4B;AAC5B,qBAAa,SAAS,CAAC,CAAC;IACtB,OAAO,CAAC,KAAK,CAAwB;IAErC,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS;IAI/B,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI;IAIhC,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAIzB,KAAK,IAAI,IAAI;IAIb,IAAI,IAAI,MAAM;CAGf;AA2CD,qBAAqB;AACrB,wBAAgB,YAAY,CAAC,IAAI,SAAS,OAAO,EAAE,EAAE,MAAM,EACzD,EAAE,EAAE,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,MAAM,CAAC,EACtC,SAAS,EAAE,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,MAAM,GACnC,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,MAAM,CAAC,CAEpC;AAED,eAAe;AACf,wBAAgB,OAAO,CAAC,IAAI,SAAS,OAAO,EAAE,EAAE,MAAM,EACpD,EAAE,EAAE,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,MAAM,EAC7B,SAAS,EAAE,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,MAAM,GACnC,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,MAAM,CAE3B;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,GAAG,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,CAavD"}
|
package/esm/src/utils/memoize.js
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { FNV1A_PRIME_32 } from "./constants/crypto.js";
|
|
2
|
-
import { HASH_SEED_FNV1A } from "./constants/hash.js";
|
|
3
|
-
/** Implement memo cache. */
|
|
4
|
-
export class MemoCache {
|
|
5
|
-
cache = new Map();
|
|
6
|
-
get(key) {
|
|
7
|
-
return this.cache.get(key);
|
|
8
|
-
}
|
|
9
|
-
set(key, value) {
|
|
10
|
-
this.cache.set(key, value);
|
|
11
|
-
}
|
|
12
|
-
has(key) {
|
|
13
|
-
return this.cache.has(key);
|
|
14
|
-
}
|
|
15
|
-
clear() {
|
|
16
|
-
this.cache.clear();
|
|
17
|
-
}
|
|
18
|
-
size() {
|
|
19
|
-
return this.cache.size;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
function memoizeWithCache(fn, keyHasher) {
|
|
23
|
-
const cache = new MemoCache();
|
|
24
|
-
const inflight = new Map();
|
|
25
|
-
return (...args) => {
|
|
26
|
-
const key = keyHasher(...args);
|
|
27
|
-
if (cache.has(key)) {
|
|
28
|
-
return cache.get(key);
|
|
29
|
-
}
|
|
30
|
-
const existing = inflight.get(key);
|
|
31
|
-
if (existing)
|
|
32
|
-
return existing;
|
|
33
|
-
const result = fn(...args);
|
|
34
|
-
if (!(result instanceof Promise)) {
|
|
35
|
-
cache.set(key, result);
|
|
36
|
-
return result;
|
|
37
|
-
}
|
|
38
|
-
const promise = result.then((resolved) => {
|
|
39
|
-
cache.set(key, resolved);
|
|
40
|
-
inflight.delete(key);
|
|
41
|
-
return resolved;
|
|
42
|
-
}, (error) => {
|
|
43
|
-
inflight.delete(key);
|
|
44
|
-
throw error;
|
|
45
|
-
});
|
|
46
|
-
inflight.set(key, promise);
|
|
47
|
-
return promise;
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
/** Memoize async. */
|
|
51
|
-
export function memoizeAsync(fn, keyHasher) {
|
|
52
|
-
return memoizeWithCache(fn, keyHasher);
|
|
53
|
-
}
|
|
54
|
-
/** Memoize. */
|
|
55
|
-
export function memoize(fn, keyHasher) {
|
|
56
|
-
return memoizeWithCache(fn, keyHasher);
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* FNV-1a hash algorithm for fast cache key generation.
|
|
60
|
-
* 10-15x faster than JSON.stringify() and uses 70-80% less memory.
|
|
61
|
-
*/
|
|
62
|
-
export function simpleHash(...values) {
|
|
63
|
-
let hash = HASH_SEED_FNV1A;
|
|
64
|
-
for (const value of values) {
|
|
65
|
-
const str = typeof value === "string" ? value : String(value);
|
|
66
|
-
for (let i = 0; i < str.length; i++) {
|
|
67
|
-
hash ^= str.charCodeAt(i);
|
|
68
|
-
hash = Math.imul(hash, FNV1A_PRIME_32);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
return (hash >>> 0).toString(36);
|
|
72
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/*******************************
|
|
2
|
-
* Parallel Execution Utilities
|
|
3
|
-
*
|
|
4
|
-
* Provides utilities for parallel execution with concurrency control.
|
|
5
|
-
* Uses a semaphore to limit the number of concurrent operations.
|
|
6
|
-
*
|
|
7
|
-
* @module core/utils/parallel
|
|
8
|
-
*******************************/
|
|
9
|
-
import { Semaphore } from "../modules/react-loader/ssr-module-loader/concurrency/semaphore.js";
|
|
10
|
-
type ParallelOptions = {
|
|
11
|
-
concurrency?: number;
|
|
12
|
-
semaphore?: Semaphore;
|
|
13
|
-
timeoutMs?: number;
|
|
14
|
-
};
|
|
15
|
-
/** Run parallel map. */
|
|
16
|
-
export declare function parallelMap<T, R>(items: T[], fn: (item: T, index: number) => Promise<R>, options?: ParallelOptions): Promise<R[]>;
|
|
17
|
-
export declare function parallelAll<T extends readonly (() => Promise<unknown>)[]>(fns: T, options?: ParallelOptions): Promise<{
|
|
18
|
-
[K in keyof T]: Awaited<ReturnType<T[K]>>;
|
|
19
|
-
}>;
|
|
20
|
-
export declare function parallelFind<T>(items: T[], predicate: (item: T, index: number) => Promise<boolean>, options?: ParallelOptions): Promise<T | undefined>;
|
|
21
|
-
export declare function parallelFilter<T>(items: T[], predicate: (item: T, index: number) => Promise<boolean>, options?: ParallelOptions): Promise<T[]>;
|
|
22
|
-
export declare function createSemaphore(permits: number): Semaphore;
|
|
23
|
-
export declare function getApiSemaphore(): Semaphore;
|
|
24
|
-
export {};
|
|
25
|
-
//# sourceMappingURL=parallel.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parallel.d.ts","sourceRoot":"","sources":["../../../src/src/utils/parallel.ts"],"names":[],"mappings":"AAAA;;;;;;;iCAOiC;AAEjC,OAAO,EAAE,SAAS,EAAE,MAAM,oEAAoE,CAAC;AAY/F,KAAK,eAAe,GAAG;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAgBF,wBAAwB;AACxB,wBAAgB,WAAW,CAAC,CAAC,EAAE,CAAC,EAC9B,KAAK,EAAE,CAAC,EAAE,EACV,EAAE,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC,CAAC,EAC1C,OAAO,GAAE,eAAoB,GAC5B,OAAO,CAAC,CAAC,EAAE,CAAC,CA4Bd;AAED,wBAAgB,WAAW,CAAC,CAAC,SAAS,SAAS,CAAC,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC,EAAE,EACvE,GAAG,EAAE,CAAC,EACN,OAAO,GAAE,eAAoB,GAC5B,OAAO,CAAC;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAAE,CAAC,CAMxD;AAED,wBAAgB,YAAY,CAAC,CAAC,EAC5B,KAAK,EAAE,CAAC,EAAE,EACV,SAAS,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,EACvD,OAAO,GAAE,eAAoB,GAC5B,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC,CAkCxB;AAED,wBAAgB,cAAc,CAAC,CAAC,EAC9B,KAAK,EAAE,CAAC,EAAE,EACV,SAAS,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,EACvD,OAAO,GAAE,eAAoB,GAC5B,OAAO,CAAC,CAAC,EAAE,CAAC,CAcd;AAED,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,CAE1D;AAED,wBAAgB,eAAe,IAAI,SAAS,CAE3C"}
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
/*******************************
|
|
2
|
-
* Parallel Execution Utilities
|
|
3
|
-
*
|
|
4
|
-
* Provides utilities for parallel execution with concurrency control.
|
|
5
|
-
* Uses a semaphore to limit the number of concurrent operations.
|
|
6
|
-
*
|
|
7
|
-
* @module core/utils/parallel
|
|
8
|
-
*******************************/
|
|
9
|
-
import { Semaphore } from "../modules/react-loader/ssr-module-loader/concurrency/semaphore.js";
|
|
10
|
-
import { withSpan } from "../observability/tracing/otlp-setup.js";
|
|
11
|
-
import { TIMEOUT_ERROR } from "../errors/error-registry.js";
|
|
12
|
-
const DEFAULT_CONCURRENCY = 20;
|
|
13
|
-
const ACQUIRE_TIMEOUT_MS = 30_000;
|
|
14
|
-
// No maxQueueSize — parallelMap schedules all items via Promise.all,
|
|
15
|
-
// so a queue cap would reject items in large batches instead of letting
|
|
16
|
-
// them progress under the concurrency limit with timeout-based backpressure.
|
|
17
|
-
const apiSemaphore = new Semaphore(DEFAULT_CONCURRENCY);
|
|
18
|
-
async function acquireOrThrow(semaphore, timeoutMs, label) {
|
|
19
|
-
const acquired = await semaphore.tryAcquire(timeoutMs);
|
|
20
|
-
if (acquired)
|
|
21
|
-
return;
|
|
22
|
-
throw TIMEOUT_ERROR.create({
|
|
23
|
-
detail: `${label}: timed out waiting for semaphore after ${timeoutMs}ms (available: ${semaphore.available}, waiting: ${semaphore.waiting})`,
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
/** Run parallel map. */
|
|
27
|
-
export function parallelMap(items, fn, options = {}) {
|
|
28
|
-
return withSpan("utils.parallelMap", async () => {
|
|
29
|
-
if (items.length === 0)
|
|
30
|
-
return [];
|
|
31
|
-
const semaphore = options.semaphore ?? apiSemaphore;
|
|
32
|
-
const timeoutMs = options.timeoutMs ?? ACQUIRE_TIMEOUT_MS;
|
|
33
|
-
const results = new Array(items.length);
|
|
34
|
-
await Promise.all(items.map(async (item, index) => {
|
|
35
|
-
await acquireOrThrow(semaphore, timeoutMs, "parallelMap");
|
|
36
|
-
try {
|
|
37
|
-
results[index] = await fn(item, index);
|
|
38
|
-
}
|
|
39
|
-
finally {
|
|
40
|
-
semaphore.release();
|
|
41
|
-
}
|
|
42
|
-
}));
|
|
43
|
-
return results;
|
|
44
|
-
}, {
|
|
45
|
-
"parallel.itemCount": items.length,
|
|
46
|
-
"parallel.timeoutMs": options.timeoutMs ?? ACQUIRE_TIMEOUT_MS,
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
export function parallelAll(fns, options = {}) {
|
|
50
|
-
return parallelMap([...fns], (fn) => fn(), options);
|
|
51
|
-
}
|
|
52
|
-
export function parallelFind(items, predicate, options = {}) {
|
|
53
|
-
return withSpan("utils.parallelFind", async () => {
|
|
54
|
-
if (items.length === 0)
|
|
55
|
-
return undefined;
|
|
56
|
-
const semaphore = options.semaphore ?? apiSemaphore;
|
|
57
|
-
const timeoutMs = options.timeoutMs ?? ACQUIRE_TIMEOUT_MS;
|
|
58
|
-
let found;
|
|
59
|
-
let foundIndex = Infinity;
|
|
60
|
-
await Promise.all(items.map(async (item, index) => {
|
|
61
|
-
if (index >= foundIndex)
|
|
62
|
-
return;
|
|
63
|
-
await acquireOrThrow(semaphore, timeoutMs, "parallelFind");
|
|
64
|
-
try {
|
|
65
|
-
if (index >= foundIndex)
|
|
66
|
-
return;
|
|
67
|
-
const matches = await predicate(item, index);
|
|
68
|
-
if (!matches || index >= foundIndex)
|
|
69
|
-
return;
|
|
70
|
-
found = item;
|
|
71
|
-
foundIndex = index;
|
|
72
|
-
}
|
|
73
|
-
finally {
|
|
74
|
-
semaphore.release();
|
|
75
|
-
}
|
|
76
|
-
}));
|
|
77
|
-
return found;
|
|
78
|
-
}, { "parallel.itemCount": items.length });
|
|
79
|
-
}
|
|
80
|
-
export function parallelFilter(items, predicate, options = {}) {
|
|
81
|
-
return withSpan("utils.parallelFilter", async () => {
|
|
82
|
-
const results = await parallelMap(items, async (item, index) => ({ item, keep: await predicate(item, index) }), options);
|
|
83
|
-
return results.filter((r) => r.keep).map((r) => r.item);
|
|
84
|
-
}, { "parallel.itemCount": items.length });
|
|
85
|
-
}
|
|
86
|
-
export function createSemaphore(permits) {
|
|
87
|
-
return new Semaphore(permits);
|
|
88
|
-
}
|
|
89
|
-
export function getApiSemaphore() {
|
|
90
|
-
return apiSemaphore;
|
|
91
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { isAbsolute } from "../platform/compat/path/resolution.js";
|
|
2
|
-
/** Normalizes path. */
|
|
3
|
-
export declare function normalizePath(pathname: string): string;
|
|
4
|
-
export declare function joinPath(a: string, b: string): string;
|
|
5
|
-
export declare function isWithinDirectory(root: string, target: string): boolean;
|
|
6
|
-
/**
|
|
7
|
-
* Get file extension including the dot (e.g., ".ts", ".tsx").
|
|
8
|
-
* Returns empty string if no extension found.
|
|
9
|
-
*/
|
|
10
|
-
export declare function getExtension(path: string): string;
|
|
11
|
-
/**
|
|
12
|
-
* Get file extension without the dot, lowercased (e.g., "ts", "tsx").
|
|
13
|
-
* Returns empty string if no extension found.
|
|
14
|
-
*/
|
|
15
|
-
export declare function getExtensionName(path: string): string;
|
|
16
|
-
export declare function getDirectory(path: string): string;
|
|
17
|
-
export declare function hasHashedFilename(path: string): boolean;
|
|
18
|
-
/**
|
|
19
|
-
* Get esbuild loader type from file extension
|
|
20
|
-
*/
|
|
21
|
-
export declare function getEsbuildLoader(filePath: string): "tsx" | "jsx" | "ts" | "js";
|
|
22
|
-
export { isAbsolute as isAbsolutePath };
|
|
23
|
-
export declare function toBase64Url(input: string): string;
|
|
24
|
-
export declare function fromBase64Url(encoded: string): string;
|
|
25
|
-
/**
|
|
26
|
-
* Check if a normalized path is a framework path that should not be fetched from API.
|
|
27
|
-
*
|
|
28
|
-
* Framework paths can appear in two forms:
|
|
29
|
-
* 1. "_veryfront/..." - original framework module path prefix
|
|
30
|
-
* 2. "src/react/...", "src/platform/...", etc. - framework source paths
|
|
31
|
-
* (after FSAdapter normalizes absolute paths like /Users/.../veryfront-server/src/...)
|
|
32
|
-
*/
|
|
33
|
-
export declare function isFrameworkSourcePath(normalizedPath: string): boolean;
|
|
34
|
-
//# sourceMappingURL=path-utils.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"path-utils.d.ts","sourceRoot":"","sources":["../../../src/src/utils/path-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,uCAAuC,CAAC;AAS9E,uBAAuB;AACvB,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAGtD;AAED,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAIrD;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAMvE;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAIjD;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAIrD;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAKjD;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEvD;AAQD;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,KAAK,GAAG,KAAK,GAAG,IAAI,GAAG,IAAI,CAG9E;AAED,OAAO,EAAE,UAAU,IAAI,cAAc,EAAE,CAAC;AAExC,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEjD;AAUD,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAerD;AAgCD;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAQrE"}
|
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
import { isAbsolute, normalize } from "../platform/compat/path/resolution.js";
|
|
2
|
-
import { base64urlEncode } from "./base64url.js";
|
|
3
|
-
import { logger } from "./logger/logger.js";
|
|
4
|
-
function stripTrailingSlash(pathname) {
|
|
5
|
-
if (pathname === "/")
|
|
6
|
-
return pathname;
|
|
7
|
-
return pathname.replace(/\/+$/, "");
|
|
8
|
-
}
|
|
9
|
-
/** Normalizes path. */
|
|
10
|
-
export function normalizePath(pathname) {
|
|
11
|
-
if (!pathname)
|
|
12
|
-
return pathname;
|
|
13
|
-
return stripTrailingSlash(normalize(pathname.replace(/\\+/g, "/")));
|
|
14
|
-
}
|
|
15
|
-
export function joinPath(a, b) {
|
|
16
|
-
const left = a.replace(/\/$/, "");
|
|
17
|
-
const right = b.replace(/^\//, "");
|
|
18
|
-
return `${left}/${right}`;
|
|
19
|
-
}
|
|
20
|
-
export function isWithinDirectory(root, target) {
|
|
21
|
-
const normalizedRoot = stripTrailingSlash(normalizePath(root));
|
|
22
|
-
const normalizedTarget = stripTrailingSlash(normalizePath(target));
|
|
23
|
-
if (normalizedRoot === "/")
|
|
24
|
-
return normalizedTarget.startsWith("/");
|
|
25
|
-
return normalizedTarget === normalizedRoot || normalizedTarget.startsWith(`${normalizedRoot}/`);
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Get file extension including the dot (e.g., ".ts", ".tsx").
|
|
29
|
-
* Returns empty string if no extension found.
|
|
30
|
-
*/
|
|
31
|
-
export function getExtension(path) {
|
|
32
|
-
const lastDot = path.lastIndexOf(".");
|
|
33
|
-
if (lastDot === -1 || lastDot === path.length - 1)
|
|
34
|
-
return "";
|
|
35
|
-
return path.slice(lastDot);
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Get file extension without the dot, lowercased (e.g., "ts", "tsx").
|
|
39
|
-
* Returns empty string if no extension found.
|
|
40
|
-
*/
|
|
41
|
-
export function getExtensionName(path) {
|
|
42
|
-
const lastDot = path.lastIndexOf(".");
|
|
43
|
-
if (lastDot === -1 || lastDot === path.length - 1)
|
|
44
|
-
return "";
|
|
45
|
-
return path.slice(lastDot + 1).toLowerCase();
|
|
46
|
-
}
|
|
47
|
-
export function getDirectory(path) {
|
|
48
|
-
const normalized = normalizePath(path);
|
|
49
|
-
const lastSlash = normalized.lastIndexOf("/");
|
|
50
|
-
if (lastSlash <= 0)
|
|
51
|
-
return "/";
|
|
52
|
-
return normalized.slice(0, lastSlash);
|
|
53
|
-
}
|
|
54
|
-
export function hasHashedFilename(path) {
|
|
55
|
-
return /\.[a-f0-9]{8,}\./.test(path);
|
|
56
|
-
}
|
|
57
|
-
const EXTENSION_TO_LOADER = {
|
|
58
|
-
".tsx": "tsx",
|
|
59
|
-
".jsx": "jsx",
|
|
60
|
-
".ts": "ts",
|
|
61
|
-
};
|
|
62
|
-
/**
|
|
63
|
-
* Get esbuild loader type from file extension
|
|
64
|
-
*/
|
|
65
|
-
export function getEsbuildLoader(filePath) {
|
|
66
|
-
const ext = getExtension(filePath).toLowerCase();
|
|
67
|
-
return EXTENSION_TO_LOADER[ext] ?? "js";
|
|
68
|
-
}
|
|
69
|
-
export { isAbsolute as isAbsolutePath };
|
|
70
|
-
export function toBase64Url(input) {
|
|
71
|
-
return base64urlEncode(input);
|
|
72
|
-
}
|
|
73
|
-
function getRequiredBase64Padding(length) {
|
|
74
|
-
const remainder = length % 4;
|
|
75
|
-
if (remainder === 0)
|
|
76
|
-
return "";
|
|
77
|
-
if (remainder === 2)
|
|
78
|
-
return "==";
|
|
79
|
-
if (remainder === 3)
|
|
80
|
-
return "=";
|
|
81
|
-
return undefined;
|
|
82
|
-
}
|
|
83
|
-
export function fromBase64Url(encoded) {
|
|
84
|
-
const b64 = encoded.replaceAll("-", "+").replaceAll("_", "/");
|
|
85
|
-
const padding = getRequiredBase64Padding(b64.length);
|
|
86
|
-
if (padding === undefined) {
|
|
87
|
-
logger.debug(`Failed to decode base64url string "${encoded}": invalid length`);
|
|
88
|
-
return "";
|
|
89
|
-
}
|
|
90
|
-
try {
|
|
91
|
-
return atob(b64 + padding);
|
|
92
|
-
}
|
|
93
|
-
catch (error) {
|
|
94
|
-
logger.debug(`Failed to decode base64url string "${encoded}":`, error);
|
|
95
|
-
return "";
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* Framework source directories that should never be fetched from the API.
|
|
100
|
-
* These are framework-internal modules that must be resolved from local filesystem.
|
|
101
|
-
*/
|
|
102
|
-
const FRAMEWORK_SOURCE_DIRS = [
|
|
103
|
-
"react",
|
|
104
|
-
"platform",
|
|
105
|
-
"client",
|
|
106
|
-
"lib",
|
|
107
|
-
"html",
|
|
108
|
-
"utils",
|
|
109
|
-
"transforms",
|
|
110
|
-
"modules",
|
|
111
|
-
"server",
|
|
112
|
-
"config",
|
|
113
|
-
"errors",
|
|
114
|
-
"observability",
|
|
115
|
-
"rendering",
|
|
116
|
-
"security",
|
|
117
|
-
"data",
|
|
118
|
-
"cache",
|
|
119
|
-
"build",
|
|
120
|
-
"repositories",
|
|
121
|
-
"cli",
|
|
122
|
-
];
|
|
123
|
-
const FRAMEWORK_SOURCE_PATH_RE = new RegExp(`^src/(${FRAMEWORK_SOURCE_DIRS.join("|")})/`);
|
|
124
|
-
/**
|
|
125
|
-
* Check if a normalized path is a framework path that should not be fetched from API.
|
|
126
|
-
*
|
|
127
|
-
* Framework paths can appear in two forms:
|
|
128
|
-
* 1. "_veryfront/..." - original framework module path prefix
|
|
129
|
-
* 2. "src/react/...", "src/platform/...", etc. - framework source paths
|
|
130
|
-
* (after FSAdapter normalizes absolute paths like /Users/.../veryfront-server/src/...)
|
|
131
|
-
*/
|
|
132
|
-
export function isFrameworkSourcePath(normalizedPath) {
|
|
133
|
-
// Check for _veryfront/ prefix (with or without embedded: prefix)
|
|
134
|
-
if (normalizedPath.startsWith("_veryfront/") || normalizedPath.startsWith("embedded:_veryfront/")) {
|
|
135
|
-
return true;
|
|
136
|
-
}
|
|
137
|
-
return FRAMEWORK_SOURCE_PATH_RE.test(normalizedPath);
|
|
138
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/** Request payload for start. */
|
|
2
|
-
export declare function startRequest(requestId: string): void;
|
|
3
|
-
/** Starts timer. */
|
|
4
|
-
export declare function startTimer(label: string, parent?: string): () => void;
|
|
5
|
-
/** Time async. */
|
|
6
|
-
export declare function timeAsync<T>(label: string, fn: () => Promise<T>, parent?: string): Promise<T>;
|
|
7
|
-
/** Request payload for end. */
|
|
8
|
-
export declare function endRequest(requestId: string): void;
|
|
9
|
-
/** Check whether request performance timing is enabled. */
|
|
10
|
-
export declare function isEnabled(): boolean;
|
|
11
|
-
//# sourceMappingURL=perf-timer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"perf-timer.d.ts","sourceRoot":"","sources":["../../../src/src/utils/perf-timer.ts"],"names":[],"mappings":"AAkCA,iCAAiC;AACjC,wBAAgB,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAKpD;AAED,oBAAoB;AACpB,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,IAAI,CAUrE;AAED,kBAAkB;AAClB,wBAAsB,SAAS,CAAC,CAAC,EAC/B,KAAK,EAAE,MAAM,EACb,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EACpB,MAAM,CAAC,EAAE,MAAM,GACd,OAAO,CAAC,CAAC,CAAC,CASZ;AAED,+BAA+B;AAC/B,wBAAgB,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAmElD;AAED,2DAA2D;AAC3D,wBAAgB,SAAS,IAAI,OAAO,CAEnC"}
|