Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
unstablefileinvalidations
Browse files Browse the repository at this point in the history
gorakong committed Dec 6, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent d7081ad commit e970623
Showing 5 changed files with 8 additions and 24 deletions.
5 changes: 1 addition & 4 deletions packages/core/core/src/RequestTracker.js
Original file line number Diff line number Diff line change
@@ -1219,15 +1219,12 @@ async function loadRequestGraph(options): Async<RequestGraph> {
snapshotPath,
opts,
);
if (options.nodeModuleInvalidations != null) {
events.push(...options.nodeModuleInvalidations);
}
requestGraph.invalidateUnpredictableNodes();
requestGraph.invalidateOnBuildNodes();
requestGraph.invalidateEnvNodes(options.env);
requestGraph.invalidateOptionNodes(options);
requestGraph.respondToFSEvents(
events.map(e => ({
(options.unstableFileInvalidations || events).map(e => ({
type: e.type,
path: toProjectPath(options.projectRoot, e.path),
})),
9 changes: 1 addition & 8 deletions packages/core/core/src/resolveOptions.js
Original file line number Diff line number Diff line change
@@ -147,13 +147,6 @@ export default async function resolveOptions(

let port = determinePort(initialOptions.serveOptions, env.PORT);

let nodeModuleInvalidations = initialOptions.nodeModuleInvalidations?.map(
path => ({
type: 'create',
path,
}),
);

return {
config: getRelativeConfigSpecifier(
inputFS,
@@ -173,7 +166,7 @@ export default async function resolveOptions(
shouldBuildLazily,
lazyIncludes,
lazyExcludes,
nodeModuleInvalidations,
unstableFileInvalidations: initialOptions.unstableFileInvalidations,
shouldBundleIncrementally: initialOptions.shouldBundleIncrementally ?? true,
shouldContentHash,
serveOptions: initialOptions.serveOptions
2 changes: 1 addition & 1 deletion packages/core/core/src/types.js
Original file line number Diff line number Diff line change
@@ -281,7 +281,7 @@ export type ParcelOptions = {|
shouldTrace: boolean,
shouldPatchConsole: boolean,
detailedReport?: ?DetailedReportOptions,
nodeModuleInvalidations?: Array<{|
unstableFileInvalidations?: Array<{|
path: FilePath,
type: EventType,
|}>,
13 changes: 3 additions & 10 deletions packages/core/parcel/src/cli.js
Original file line number Diff line number Diff line change
@@ -101,9 +101,6 @@ const commonOptions = {
},
[],
],
'--node-module-invalidations <path>': [
'Comma separated list of file paths of node_module packages to be invalidated',
],
};

var hmrOptions = {
@@ -469,11 +466,10 @@ async function normalizeOptions(

let mode = command.name() === 'build' ? 'production' : 'development';

const normalizeCommaSeparatedList = (input?: string): string[] => {
const normalizeIncludeExcludeList = (input?: string): string[] => {
if (typeof input !== 'string') return [];
return input.split(',').map(value => value.trim());
};

return {
shouldDisableCache: command.cache === false,
cacheDir: command.cacheDir,
@@ -488,11 +484,8 @@ async function normalizeOptions(
shouldProfile: command.profile,
shouldTrace: command.trace,
shouldBuildLazily: typeof command.lazy !== 'undefined',
lazyIncludes: normalizeCommaSeparatedList(command.lazy),
lazyExcludes: normalizeCommaSeparatedList(command.lazyExclude),
nodeModuleInvalidations: normalizeCommaSeparatedList(
command.nodeModuleInvalidations,
),
lazyIncludes: normalizeIncludeExcludeList(command.lazy),
lazyExcludes: normalizeIncludeExcludeList(command.lazyExclude),
shouldBundleIncrementally:
process.env.PARCEL_INCREMENTAL_BUNDLING === 'false' ? false : true,
detailedReport:
3 changes: 2 additions & 1 deletion packages/core/types/index.js
Original file line number Diff line number Diff line change
@@ -14,6 +14,7 @@ import type {Cache} from '@parcel/cache';

import type {AST as _AST, ConfigResult as _ConfigResult} from './unsafe';
import type {TraceMeasurement} from '@parcel/profiler';
import type {EventType} from '@parcel/watcher';

/** Plugin-specific AST, <code>any</code> */
export type AST = _AST;
@@ -306,7 +307,7 @@ export type InitialParcelOptions = {|
+lazyIncludes?: string[],
+lazyExcludes?: string[],
+shouldBundleIncrementally?: boolean,
+nodeModuleInvalidations?: Array<FilePath>,
+unstableFileInvalidations?: Array<{|path: FilePath, type: EventType|}>,

+inputFS?: FileSystem,
+outputFS?: FileSystem,

0 comments on commit e970623

Please sign in to comment.