Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unstable File Invalidations #9420

Merged
merged 3 commits into from
Dec 8, 2023
Merged

Unstable File Invalidations #9420

merged 3 commits into from
Dec 8, 2023

Conversation

gorakong
Copy link
Contributor

@gorakong gorakong commented Dec 5, 2023

↪️ Pull Request

This PR allows passing in file paths through FS Event objects as an option through Parcel's node API. These are then converted to events and invalidated in the RequestTracker. This should support the ability to invalidate node_module packages in CI when combined with a list that is generated by comparing an old vs new copy of the yarn.lock (of the project being built).

💻 Examples

Example usage:

const bundler = new Parcel({
  entries: 'src/entry.tsx',
  shouldDisableCache: false,
  unstableFileInvalidations: [
    {path: 'node_modules/react-dom/profiling.js', type: 'create'},
    {
      path: 'node_modules/react/cjs/react.production.min.js',
      type: 'create',
    },
    {
      path: 'src/foo.tsx',
      type: 'update',
    },
  ]
});

🚨 Test instructions

(These reference the example above):

  • Did a build of src/entry.tsx without unstableFileInvalidations
  • Then did another build of the same entry (without clearing the cache) with unstableFileInvalidations passed in as an option
  • Verified that both node_modules/react-dom/profiling.js, node_modules/react/cjs/react.production.min.js, and src/foo.tsx are all rebuilt

Copy link
Contributor

@JakeLane JakeLane left a comment

Choose a reason for hiding this comment

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

Awesome work!

packages/core/parcel/src/cli.js Outdated Show resolved Hide resolved
@gorakong gorakong force-pushed the gkong/node-module-invalidations branch from 2c1fdc0 to d7081ad Compare December 5, 2023 22:54
@gorakong gorakong force-pushed the gkong/node-module-invalidations branch from 8a23c90 to e970623 Compare December 6, 2023 21:34
@gorakong gorakong changed the title node_module invalidations passed in as CLI options Unstable File Invalidations Dec 7, 2023
@gorakong gorakong merged commit 295eb3b into v2 Dec 8, 2023
14 of 16 checks passed
@gorakong gorakong deleted the gkong/node-module-invalidations branch December 8, 2023 06:42
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.

3 participants