mirror of https://github.com/webpack/webpack.git
add support for generics to tooling
This commit is contained in:
parent
d12e283ba1
commit
f72d36b9cb
|
|
@ -12,11 +12,11 @@ const SortableSet = require("../util/SortableSet");
|
|||
const deterministicGrouping = require("../util/deterministicGrouping");
|
||||
const contextify = require("../util/identifier").contextify;
|
||||
|
||||
/** @typedef {import("../Compiler")} Compiler */
|
||||
/** @typedef {import("../Chunk")} Chunk */
|
||||
/** @typedef {import("../Compiler")} Compiler */
|
||||
/** @typedef {import("../Module")} Module */
|
||||
/** @typedef {import("../util/deterministicGrouping").Options<Module>} DeterministicGroupingOptionsForModule */
|
||||
/** @typedef {import("../util/deterministicGrouping").GroupedItems<Module>} DeterministicGroupingGroupedItemsForModule */
|
||||
/** @typedef {import("../util/deterministicGrouping").Options<Module>} DeterministicGroupingOptionsForModule */
|
||||
|
||||
const deterministicGroupingForModules = /** @type {function(DeterministicGroupingOptionsForModule): DeterministicGroupingGroupedItemsForModule[]} */ (deterministicGrouping);
|
||||
|
||||
|
|
|
|||
|
|
@ -97,12 +97,12 @@ const schema = [
|
|||
},
|
||||
{
|
||||
title: "type imports",
|
||||
regexp: /(\/\*\* @typedef \{import\("[^"]+"\)(\.\w+)*\} \w+ \*\/\n)+\n/g,
|
||||
regexp: /(\/\*\* (?:@template \w+ )*@typedef \{import\("[^"]+"\)(\.\w+)*(?:<(?:(?:\w\.)*\w+, )*(?:\w\.)*\w+>)?\} \w+(?:<(?:(?:\w\.)*\w+, )*(?:\w\.)*\w+>)? \*\/\n)+\n/g,
|
||||
updateMessage: "sort type imports alphabetically",
|
||||
update(content) {
|
||||
const items = execToArray(
|
||||
content,
|
||||
/\/\*\* @typedef \{import\("([^"]+)"\)((?:\.\w+)*)\} \w+ \*\/\n/g
|
||||
/\/\*\* (?:@template \w+ )*@typedef \{import\("([^"]+)"\)((?:\.\w+)*(?:<(?:(?:\w\.)*\w+, )*(?:\w\.)*\w+>)?)\} \w+(?:<(?:(?:\w\.)*\w+, )*(?:\w\.)*\w+>)? \*\/\n/g
|
||||
);
|
||||
items.sort(sortImport);
|
||||
return items.map(item => item.content).join("") + "\n";
|
||||
|
|
|
|||
Loading…
Reference in New Issue