Skip to content

Extract portable npm metadata transformations - #519

Draft
andrew wants to merge 1 commit into
mainfrom
extract-portable-npm-metadata
Draft

andrew wants to merge 1 commit into
mainfrom
extract-portable-npm-metadata

Conversation

@andrew

@andrew andrew commented Oct 18, 2026

Copy link
Copy Markdown
Contributor

npm metadata rewriting currently depends on handler.Proxy, which pulls SQL drivers, cloud SDKs and metrics into its import graph. Move the transformation into internal/metadata/npm with explicit policy, evaluation time, public URL and hosted-version inputs. The existing npm routes use the extracted code, and npm and Composer share the JSON scanner through internal/jsonscan.

This implements the npm portion of the first experiment in #501. Fetching, storage, caching and HTTP responses stay in the native handler, with optional callbacks preserving per-version logging. The extracted code can run under Go and TinyGo/WASI without new dependencies or compiler-specific branches. Cooldown uses one evaluation time per rewrite; the HTTP response formats and policy rules are preserved.

}
rewritten := make([]byte, 0, len(dist)-len(urlMember.value(dist))+len(encoded))
rewritten = append(rewritten, dist[:urlMember.valStart]...)
rewritten := make([]byte, 0, len(dist)-len(urlMember.Value(dist))+len(encoded))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants