Skip to content

Unstable File Invalidations#9420

Merged
gorakong merged 3 commits into
v2from
gkong/node-module-invalidations
Dec 8, 2023
Merged

Unstable File Invalidations#9420
gorakong merged 3 commits into
v2from
gkong/node-module-invalidations

Conversation

@gorakong

@gorakong gorakong commented Dec 5, 2023

Copy link
Copy Markdown
Contributor

↪️ 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

@JakeLane JakeLane 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.

Awesome work!

Comment thread packages/core/parcel/src/cli.js Outdated
@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
@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