chore(publish): add publishConfig {access:public, provenance:true}#193
Closed
John-David Dalton (jdalton) wants to merge 4 commits intomainfrom
Closed
chore(publish): add publishConfig {access:public, provenance:true}#193John-David Dalton (jdalton) wants to merge 4 commits intomainfrom
John-David Dalton (jdalton) wants to merge 4 commits intomainfrom
Conversation
…delay
Adopt native APIs where the option surface lines up, with feature-detect
fallbacks where needed. Engines is >=22, so the builtins are present in
practice; detection guards against monkey-patching and minor-version gaps.
src/primordials.ts
- Add `ArrayFromAsync` (ES2024). Unbound, matching `ArrayFrom` — the
spec algorithm uses `this` only for the species constructor and
falls back to plain Array when undefined.
src/promises.ts
- Add `fromAsync<T>()` helper backed by the new `ArrayFromAsync`
primordial, with a `for await` + push fallback for older runtimes.
- Refactor `withResolvers` to consume the existing
`PromiseWithResolvers` primordial directly instead of re-detecting.
src/globs.ts
- Route `glob` / `globSync` through `node:fs.glob` / `node:fs.globSync`
when the caller's options reduce to `cwd` + `ignore` (mapped to
`exclude`); fall back to fast-glob for the wider option surface.
- `getGlobMatcher` fast-paths single non-negated patterns through
`path.matchesGlob` (Node 22.5+/20.17+) and caches the result in the
existing LRU. Trailing-slash normalization still applies.
- Async path uses the new `fromAsync` helper instead of an IIFE.
- `canUseNodeFsGlob` and `getMatchesGlob` exported as `@internal` for
unit tests. Tri-state cache uses a `_probed` boolean (no `null`).
src/crypto.ts (new)
- `hash(algorithm, data, encoding)` helper that prefers Node's one-shot
`crypto.hash` (~30% faster on small inputs) with a
`createHash().update().digest()` fallback. `getNativeHash` exposed
as `@internal`. Wired into `package.json` exports.
src/http-request.ts
- Replace 3 `await new Promise(r => setTimeout(r, ms))` sites with
`await delay(ms)` from `node:timers/promises`. JSDoc example updated.
src/dlx/{cache,integrity,binary}.ts
- Route 4 one-shot `createHash(...).update(...).digest(...)` calls
through the new `hash()` helper. `binary.ts` keeps `getCrypto()` for
`timingSafeEqual`.
test/unit/{globs,dlx/package}.test.mts
- Mark two describes that mutate describe-scope variables as sequential.
Pre-existing flakes exposed reliably by the faster `fs.glob` path
(vitest default `sequence.concurrent: true` raced on shared `tmpRoot` /
`process.env['SOCKET_DLX_DIR']`).
test/unit/{primordials,promises,crypto}.test.mts
- New tests covering `ArrayFromAsync`, `fromAsync` (native + fallback
branches), `hash`, and `getNativeHash`.
Coverage on modified files: 98% statements, 100% functions, 89% branches.
Pure formatting output from `pnpm run fix --all`: - .git-hooks/pre-commit.mts: " → ' on a literal string - xport.schema.json: collapse single-element `required` arrays onto one line (Prettier default)
Provenance attestation becomes a property of the package, not a property of the workflow's --provenance CLI flag. access:public also load-bears for first-publish of @Scoped packages on a fresh npm registry session.
Collaborator
Author
|
Switching to direct push to main per repo policy. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
publishConfig: {access: "public", provenance: true}on the rootpackage.json.--provenanceCLI flag. Survives any future emergency-publish path that bypassesprovenance.yml.access: "public"also load-bears for first-publish of@scopedpackages on a fresh npm registry session.Test plan