Skip to content

Commit dd523f9

Browse files
fix: keep the file URL helpers out of a generated declaration
Placed after the `WebpackOptionsInterception` typedef, the first helper's description was the one `generate-types` emitted for that interface, so `types.d.ts` no longer matched its own generator. They sit with the other config helpers now and the generated output is unchanged again.
1 parent 2dd6923 commit dd523f9

1 file changed

Lines changed: 22 additions & 22 deletions

File tree

‎lib/config/normalization.js‎

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -36,28 +36,6 @@ const { fileUrlToPath } = require("../util/identifier");
3636
* @property {WebpackOptionsNormalized["devtool"]=} devtool
3737
*/
3838

39-
/**
40-
* Converts a file URL to the path it names. Anything that is not a string is
41-
* returned unchanged, so `false` and `undefined` pass through.
42-
* @template {string | false | undefined} T
43-
* @param {T} pathOrUrl an absolute path, a file URL, `false` or `undefined`
44-
* @returns {T} an absolute path, `false` or `undefined`
45-
*/
46-
const optionalFileUrlToPath = (pathOrUrl) =>
47-
typeof pathOrUrl === "string"
48-
? /** @type {T} */ (fileUrlToPath(pathOrUrl))
49-
: pathOrUrl;
50-
51-
/**
52-
* Converts every file URL of a list to the path it names.
53-
* @param {(string | RegExp)[]} pathsOrUrls absolute paths, file URLs or regular expressions
54-
* @returns {(string | RegExp)[]} absolute paths and regular expressions
55-
*/
56-
const fileUrlsToPaths = (pathsOrUrls) =>
57-
pathsOrUrls.map((pathOrUrl) =>
58-
typeof pathOrUrl === "string" ? fileUrlToPath(pathOrUrl) : pathOrUrl
59-
);
60-
6139
const handledDeprecatedNoEmitOnErrors = util.deprecate(
6240
/**
6341
* Handles the callback logic for this hook.
@@ -161,6 +139,28 @@ const keyedNestedConfig = (value, fn, customKeys) => {
161139
return result;
162140
};
163141

142+
/**
143+
* Converts a file URL to the path it names. Anything that is not a string is
144+
* returned unchanged, so `false` and `undefined` pass through.
145+
* @template {string | false | undefined} T
146+
* @param {T} pathOrUrl an absolute path, a file URL, `false` or `undefined`
147+
* @returns {T} an absolute path, `false` or `undefined`
148+
*/
149+
const optionalFileUrlToPath = (pathOrUrl) =>
150+
typeof pathOrUrl === "string"
151+
? /** @type {T} */ (fileUrlToPath(pathOrUrl))
152+
: pathOrUrl;
153+
154+
/**
155+
* Converts every file URL of a list to the path it names.
156+
* @param {(string | RegExp)[]} pathsOrUrls absolute paths, file URLs or regular expressions
157+
* @returns {(string | RegExp)[]} absolute paths and regular expressions
158+
*/
159+
const fileUrlsToPaths = (pathsOrUrls) =>
160+
pathsOrUrls.map((pathOrUrl) =>
161+
typeof pathOrUrl === "string" ? fileUrlToPath(pathOrUrl) : pathOrUrl
162+
);
163+
164164
/**
165165
* Normalize `output.resourceHints` into its object form: the scalar / array /
166166
* function shorthand becomes `{ initial: <value> }` (with `"preload"` aliased to

0 commit comments

Comments
 (0)