Skip to content

[build-output-utils] Support fallback static asset exclusions - #17234

Merged
petebacondarwin merged 1 commit into
codex/cf-autoconfig-project-filesfrom
codex/static-assets-ignore-fallback
Nov 28, 2026
Merged

petebacondarwin merged 1 commit into
codex/cf-autoconfig-project-filesfrom
codex/static-assets-ignore-fallback

Conversation

@petebacondarwin

@petebacondarwin petebacondarwin commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Supports cloudflare/cf#803. Stacked on #17164. Callers can now build their own filter with createAssetsCopyFilter and the exported scaffolded patterns, then pass it to writeAssets. Fallback patterns apply only when the source has no .assetsignore; an empty file opts out. onSkip reports the relative paths pruned during copying.


  • Tests
    • Tests included/updated
    • Automated tests not possible - manual testing has been completed as follows:
    • Additional testing not necessary because:
  • Public documentation
    • Cloudflare docs PR(s):
    • Documentation not necessary because: This is a shared package API; the user-visible behavior is in cf.

Note

This is a contribution from Codex.


Devin Review

@changeset-bot

changeset-bot Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 54f3435

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 12 packages
Name Type
@cloudflare/autoconfig Minor
@cloudflare/build-output-utils Minor
@cloudflare/workers-utils Minor
wrangler Patch
@cloudflare/containers-shared Patch
@cloudflare/test-server Patch
@cloudflare/vite-plugin Patch
@cloudflare/cli-shared-helpers Patch
@cloudflare/deploy-helpers Patch
@cloudflare/dev-helpers Patch
@cloudflare/remote-bindings Patch
@cloudflare/workers-auth Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

devin-ai-integration[bot]

This comment was marked as resolved.

@ask-bonk

ask-bonk Bot commented Nov 27, 2026

Copy link
Copy Markdown
Contributor

LGTM

github run

@pkg-pr-new

pkg-pr-new Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
@cloudflare/autoconfig

npm i https://pkg.pr.new/@cloudflare/autoconfig@17234

@cloudflare/build-output-utils

npm i https://pkg.pr.new/@cloudflare/build-output-utils@17234

@cloudflare/codemods

npm i https://pkg.pr.new/@cloudflare/codemods@17234

@cloudflare/config

npm i https://pkg.pr.new/@cloudflare/config@17234

@cloudflare/containers-shared

npm i https://pkg.pr.new/@cloudflare/containers-shared@17234

create-cloudflare

npm i https://pkg.pr.new/create-cloudflare@17234

@cloudflare/deploy-helpers

npm i https://pkg.pr.new/@cloudflare/deploy-helpers@17234

@cloudflare/kv-asset-handler

npm i https://pkg.pr.new/@cloudflare/kv-asset-handler@17234

miniflare

npm i https://pkg.pr.new/miniflare@17234

@cloudflare/pages-functions

npm i https://pkg.pr.new/@cloudflare/pages-functions@17234

@cloudflare/pages-shared

npm i https://pkg.pr.new/@cloudflare/pages-shared@17234

@cloudflare/runtime-types

npm i https://pkg.pr.new/@cloudflare/runtime-types@17234

@cloudflare/test-server

npm i https://pkg.pr.new/@cloudflare/test-server@17234

@cloudflare/unenv-preset

npm i https://pkg.pr.new/@cloudflare/unenv-preset@17234

@cloudflare/vite-plugin

npm i https://pkg.pr.new/@cloudflare/vite-plugin@17234

@cloudflare/vitest-plugin

npm i https://pkg.pr.new/@cloudflare/vitest-plugin@17234

@cloudflare/workers-auth

npm i https://pkg.pr.new/@cloudflare/workers-auth@17234

@cloudflare/workers-editor-shared

npm i https://pkg.pr.new/@cloudflare/workers-editor-shared@17234

@cloudflare/workers-utils

npm i https://pkg.pr.new/@cloudflare/workers-utils@17234

wrangler

npm i https://pkg.pr.new/wrangler@17234

commit: 54f3435

@petebacondarwin
petebacondarwin marked this pull request as ready for review November 27, 2026 16:26
@workers-devprod
workers-devprod requested review from a team and dario-piotrowicz and removed request for a team November 27, 2026 16:26
@workers-devprod

workers-devprod commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Codeowners approval required for this PR:

  • @cloudflare/deploy-config
  • ✅ @cloudflare/wrangler
Show detailed file reviewers
  • packages/workers-shared/utils/helpers.ts: [@cloudflare/deploy-config]

@clanky-the-clanker clanky-the-clanker Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Superseded by the review of 906e85f7.

This review, of 59ed2478

✅ Approved — No issues found. Existing callers behave as before because the fallback patterns default to an empty list and an empty .assetsignore still turns them off. onSkip reports each pruned entry once, and the tests cover both fallback cases and that the scaffolded patterns match what is written.

The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.


✅ All checks passed

🚀 Release: ✅ LGTM

The changeset covers the two packages whose public API changed. The asset filtering is opt-in, so existing builds do not change unless a caller passes fallback patterns.


🔒 Security: ✅ LGTM

The fallback patterns come from the caller and default to empty. The reserved output directory is still excluded, and the .dev.vars/.env exclusions are unchanged.


📖 AGENTS.md: ✅ LGTM

No issues with the repository guidelines.


📋 Code Quality: ✅ LGTM

  • createAssetsIgnoreFunction applies fallbackPatterns only when no .assetsignore can be read. An empty .assetsignore therefore still turns the fallback off, and a test covers that case.
  • writeAssets still makes the same ignore decision as before. When the file and directory forms of a path disagree, it still calls stat to pick one. onSkip fires once for each pruned entry. A pruned directory is not recursed into, so its children are not reported. The reserved .cloudflare skip is reported too.
  • The run.ts refactor keeps the same scaffolded entries, and the new autoconfig test checks that they match what is written to the file.

⚡ Performance: ✅ LGTM

No performance concerns.


📝 Documentation: ✅ LGTM

The new options have JSDoc comments, and the changeset describes the API additions.


Reviewed commit: 59ed2478

@clanky-the-clanker clanky-the-clanker Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Superseded by the review of ea3ca12b.

This review, of 906e85f7

✅ Approved — No issues found. Fallback patterns apply only when .assetsignore is missing, so an empty file still opts out. onSkip reports each pruned entry once, including the reserved .cloudflare entry, and existing callers behave as before.

The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.


✅ All checks passed

🚀 Release: ✅ LGTM

The changeset covers the packages whose public API changed and releases the additions as minor versions. The filtering is opt-in, so existing builds do not change unless a caller passes fallback patterns.


🔒 Security: ✅ LGTM

The fallback patterns come from the caller and default to an empty list. The reserved output directory is still excluded, and the .dev.vars/.env exclusions are unchanged. If the caller's filter throws, the copy fails rather than letting entries through.


📖 AGENTS.md: ✅ LGTM

No issues with the repository guidelines.


📋 Code Quality: ✅ LGTM

  • createAssetsIgnoreFunction (packages/workers-shared/utils/helpers.ts) adds fallbackPatterns only when .assetsignore cannot be read. An empty file returns "", so it still opts out. The default [] leaves existing callers unchanged.
  • In writeAssets, the copy filter is now async and awaits the caller's filter. onSkip fires once for each pruned entry, and the children of a pruned directory are not visited, so they are not reported. The reserved .cloudflare entry is also reported.
  • The workers-utils wrapper passes fallbackPatterns through and still turns InvalidAssetsIgnoreError into UserError.
  • The tests cover the fallback when .assetsignore is missing, empty, or has content, and they cover the reported reserved-entry skip.

⚡ Performance: ✅ LGTM

No performance concerns.


📝 Documentation: ✅ LGTM

The new options have JSDoc comments, and the changeset describes the API additions.


Reviewed commit: 906e85f7

@jamesopstad jamesopstad left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codeowners bypass

@workers-devprod workers-devprod left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codeowners reviews satisfied

@github-project-automation github-project-automation Bot moved this from Untriaged to Approved in workers-sdk Nov 27, 2026
@petebacondarwin
petebacondarwin force-pushed the codex/static-assets-ignore-fallback branch from 906e85f to ea3ca12 Compare November 28, 2026 08:33

@clanky-the-clanker clanky-the-clanker Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Superseded by the review of 54f34354.

This review, of ea3ca12b

✅ Approved — No issues found. Fallback patterns apply only when .assetsignore is missing, so an empty file still opts out. onSkip reports each pruned entry once, including the reserved .cloudflare entry, and existing callers behave as before.

The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.


✅ All checks passed

🚀 Release: ✅ LGTM

The changeset covers the packages whose public API changed and releases the additions as minor versions. The filtering is opt-in, so existing builds do not change unless a caller passes fallback patterns.


🔒 Security: ✅ LGTM

The fallback patterns come from the caller and default to an empty list. The reserved output directory is still excluded, and the .dev.vars/.env exclusions are unchanged. If the caller's filter throws, the copy fails rather than letting entries through.


📖 AGENTS.md: ✅ LGTM

No issues with the repository guidelines.


📋 Code Quality: ✅ LGTM

  • createAssetsIgnoreFunction (packages/workers-shared/utils/helpers.ts) adds fallbackPatterns only when .assetsignore cannot be read. An empty file returns "", so it still opts out. The default [] leaves existing callers unchanged.
  • In writeAssets, the copy filter is now async and awaits the caller's filter. onSkip fires once for each pruned entry, and the children of a pruned directory are not visited, so they are not reported. The reserved .cloudflare entry is also reported.
  • The workers-utils wrapper passes fallbackPatterns through and still turns InvalidAssetsIgnoreError into UserError.
  • The tests cover the fallback when .assetsignore is missing, empty, or has content, and they cover the reported reserved-entry skip.

⚡ Performance: ✅ LGTM

No performance concerns.


📝 Documentation: ✅ LGTM

The new options have JSDoc comments, and the changeset describes the API additions.


Reviewed commit: ea3ca12b — same changes as 906e85f7, so this is that commit's review (no new review was run; line numbers are as of 906e85f7)

@petebacondarwin
petebacondarwin force-pushed the codex/static-assets-ignore-fallback branch from ea3ca12 to 54f3435 Compare November 28, 2026 08:40
@petebacondarwin

Copy link
Copy Markdown
Contributor Author

/devin review

@devin-ai-integration

Copy link
Copy Markdown
Contributor

Starting Devin Review.

Devin Review

@clanky-the-clanker clanky-the-clanker Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Approved — No issues found. Fallback patterns apply only when .assetsignore is missing, so an empty file still opts out. onSkip reports each pruned entry once, including the reserved .cloudflare entry, and existing callers behave as before.

The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.


✅ All checks passed

🚀 Release: ✅ LGTM

The changeset covers the packages whose public API changed and releases the additions as minor versions. The filtering is opt-in, so existing builds do not change unless a caller passes fallback patterns.


🔒 Security: ✅ LGTM

The fallback patterns come from the caller and default to an empty list. The reserved output directory is still excluded, and the .dev.vars/.env exclusions are unchanged. If the caller's filter throws, the copy fails rather than letting entries through.


📖 AGENTS.md: ✅ LGTM

No issues with the repository guidelines.


📋 Code Quality: ✅ LGTM

  • createAssetsIgnoreFunction (packages/workers-shared/utils/helpers.ts) adds fallbackPatterns only when .assetsignore cannot be read. An empty file returns "", so it still opts out. The default [] leaves existing callers unchanged.
  • In writeAssets, the copy filter is now async and awaits the caller's filter. onSkip fires once for each pruned entry, and the children of a pruned directory are not visited, so they are not reported. The reserved .cloudflare entry is also reported.
  • The workers-utils wrapper passes fallbackPatterns through and still turns InvalidAssetsIgnoreError into UserError.
  • The tests cover the fallback when .assetsignore is missing, empty, or has content, and they cover the reported reserved-entry skip.

⚡ Performance: ✅ LGTM

No performance concerns.


📝 Documentation: ✅ LGTM

The new options have JSDoc comments, and the changeset describes the API additions.


Reviewed commit: 54f34354 — same changes as 906e85f7, so this is that commit's review (no new review was run; line numbers are as of 906e85f7)

@petebacondarwin
petebacondarwin merged commit 7217f26 into main Nov 28, 2026
84 checks passed
@petebacondarwin
petebacondarwin deleted the codex/static-assets-ignore-fallback branch November 28, 2026 08:57
@github-project-automation github-project-automation Bot moved this from Approved to Done in workers-sdk Nov 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants