From c9a01ac7b26dbeffa2a0d5a9c60b562a42fbddbf Mon Sep 17 00:00:00 2001 From: Devon Govett Date: Sun, 20 Sep 2020 09:56:54 -0700 Subject: [PATCH 1/2] Add docs for loadPartialConfig file handling changes https://github.com/babel/babel/pull/11907 --- docs/core.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/core.md b/docs/core.md index 3658b96d04..86baec91bc 100644 --- a/docs/core.md +++ b/docs/core.md @@ -258,6 +258,11 @@ resolves the plugins and presets and proceeds no further. The expectation is that callers will take the config's `.options`, manipulate it as they see fit and pass it back to Babel again. +This function accepts one additional option in addition to the standard [options](#options): `showIgnoredFiles`. +When set to true, `loadPartialConfig` always returns a result when a file is ignored, rather than `null`. +This is useful in order to allow the caller to access the list of files that influenced this outcome, e.g. +for watch mode. The caller can determine whether a file was ignored based on the returned `fileHandling` property. + * `babelrc: string | void` - The path of the [file-relative configuration](config-files.md#file-relative-configuration) file, if there was one. * `babelignore: string | void` - The path of the `.babelignore` file, if there was one. * `config: string | void` - The path of the [project-wide config file](config-files.md#project-wide-configuration) file, if there was one. @@ -268,6 +273,9 @@ and pass it back to Babel again. to false so that later calls to Babel will not make a second attempt to load config files. * `hasFilesystemConfig(): boolean` - Check if the resolved config loaded any settings from the filesystem. +* `fileHandling` - This is set to `"transpile"`, `"ignored"`, or `"unsupported"` to indicate to the caller what to do with this file. +* `files` - A `Set` of file paths that were read to build the resulting config, including project wide config files, local config files, + extended config files, ignore files, etc. Useful for implementing watch mode or cache invalidation. [`ConfigItem`](#configitem-type) instances expose properties to introspect the values, but each item should be treated as immutable. If changes are desired, the item should be From 0b294f341c9515cfc22f91202a8c2546aa6788f0 Mon Sep 17 00:00:00 2001 From: Devon Govett Date: Sat, 26 Sep 2020 10:08:47 -0700 Subject: [PATCH 2/2] Update core.md --- docs/core.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/core.md b/docs/core.md index 86baec91bc..b334f09b18 100644 --- a/docs/core.md +++ b/docs/core.md @@ -258,7 +258,7 @@ resolves the plugins and presets and proceeds no further. The expectation is that callers will take the config's `.options`, manipulate it as they see fit and pass it back to Babel again. -This function accepts one additional option in addition to the standard [options](#options): `showIgnoredFiles`. +This function accepts one additional option as part of the options object in addition to the standard [options](#options): `showIgnoredFiles`. When set to true, `loadPartialConfig` always returns a result when a file is ignored, rather than `null`. This is useful in order to allow the caller to access the list of files that influenced this outcome, e.g. for watch mode. The caller can determine whether a file was ignored based on the returned `fileHandling` property.