@kubb/core 2.0.0-beta.1 → 2.0.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +24 -18
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +24 -40
- package/dist/index.d.ts +24 -40
- package/dist/index.js +24 -18
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
- package/src/PluginManager.ts +26 -8
- package/src/build.ts +0 -10
- package/src/plugin.ts +4 -4
- package/src/types.ts +22 -41
package/dist/index.cjs
CHANGED
|
@@ -1169,8 +1169,7 @@ var definePlugin = createPlugin((options) => {
|
|
|
1169
1169
|
return {
|
|
1170
1170
|
name: pluginName,
|
|
1171
1171
|
options,
|
|
1172
|
-
key: ["
|
|
1173
|
-
kind: "controller",
|
|
1172
|
+
key: ["core"],
|
|
1174
1173
|
api() {
|
|
1175
1174
|
return {
|
|
1176
1175
|
get config() {
|
|
@@ -1514,16 +1513,15 @@ Names: ${JSON.stringify(names, void 0, 2)}`
|
|
|
1514
1513
|
}
|
|
1515
1514
|
getPluginsByKey(hookName, pluginKey) {
|
|
1516
1515
|
const plugins = [...this.plugins];
|
|
1517
|
-
const [
|
|
1516
|
+
const [searchPluginName, searchIdentifier] = pluginKey;
|
|
1518
1517
|
const pluginByPluginName = plugins.filter((plugin) => plugin[hookName]).filter((item) => {
|
|
1519
|
-
const [
|
|
1518
|
+
const [name, identifier] = item.key;
|
|
1520
1519
|
const identifierCheck = identifier?.toString() === searchIdentifier?.toString();
|
|
1521
|
-
const kindCheck = kind === searchKind;
|
|
1522
1520
|
const nameCheck = name === searchPluginName;
|
|
1523
1521
|
if (searchIdentifier) {
|
|
1524
|
-
return identifierCheck &&
|
|
1522
|
+
return identifierCheck && nameCheck;
|
|
1525
1523
|
}
|
|
1526
|
-
return
|
|
1524
|
+
return nameCheck;
|
|
1527
1525
|
});
|
|
1528
1526
|
if (!pluginByPluginName?.length) {
|
|
1529
1527
|
const corePlugin = plugins.find((plugin) => plugin.name === "core" && plugin[hookName]);
|
|
@@ -1555,7 +1553,7 @@ Names: ${JSON.stringify(names, void 0, 2)}`
|
|
|
1555
1553
|
}
|
|
1556
1554
|
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
1557
1555
|
static get hooks() {
|
|
1558
|
-
return ["
|
|
1556
|
+
return ["buildStart", "resolvePath", "resolveName", "load", "transform", "writeFile", "buildEnd"];
|
|
1559
1557
|
}
|
|
1560
1558
|
};
|
|
1561
1559
|
_core = new WeakMap();
|
|
@@ -1573,7 +1571,23 @@ getSortedPlugins_fn = function(hookName) {
|
|
|
1573
1571
|
}
|
|
1574
1572
|
return plugins.filter((item) => item[hookName]);
|
|
1575
1573
|
}
|
|
1576
|
-
return plugins
|
|
1574
|
+
return plugins.map((plugin) => {
|
|
1575
|
+
if (plugin.pre) {
|
|
1576
|
+
const isValid = plugin.pre.every((pluginName2) => plugins.find((pluginToFind) => pluginToFind.name === pluginName2));
|
|
1577
|
+
if (!isValid) {
|
|
1578
|
+
throw new ValidationPluginError(`This plugin has a pre set that is not valid(${JSON.stringify(plugin.pre, void 0, 2)})`);
|
|
1579
|
+
}
|
|
1580
|
+
}
|
|
1581
|
+
return plugin;
|
|
1582
|
+
}).sort((a, b) => {
|
|
1583
|
+
if (b.pre?.includes(a.name)) {
|
|
1584
|
+
return 1;
|
|
1585
|
+
}
|
|
1586
|
+
if (b.post?.includes(a.name)) {
|
|
1587
|
+
return -1;
|
|
1588
|
+
}
|
|
1589
|
+
return 0;
|
|
1590
|
+
});
|
|
1577
1591
|
};
|
|
1578
1592
|
_addExecutedToCallStack = new WeakSet();
|
|
1579
1593
|
addExecutedToCallStack_fn = function(executer) {
|
|
@@ -1664,7 +1678,7 @@ _parse = new WeakSet();
|
|
|
1664
1678
|
parse_fn = function(plugin, pluginManager, context) {
|
|
1665
1679
|
const usedPluginNames = __privateGet(pluginManager, _usedPluginNames);
|
|
1666
1680
|
setUniqueName(plugin.name, usedPluginNames);
|
|
1667
|
-
const key =
|
|
1681
|
+
const key = [plugin.name, usedPluginNames[plugin.name]].filter(Boolean);
|
|
1668
1682
|
if (plugin.name !== "core" && usedPluginNames[plugin.name] >= 2) {
|
|
1669
1683
|
pluginManager.logger.warn("Using multiple of the same plugin is an experimental feature");
|
|
1670
1684
|
}
|
|
@@ -1787,10 +1801,6 @@ ${code}`);
|
|
|
1787
1801
|
async function build(options) {
|
|
1788
1802
|
const pluginManager = await setup(options);
|
|
1789
1803
|
const { fileManager, logger } = pluginManager;
|
|
1790
|
-
await pluginManager.hookParallel({
|
|
1791
|
-
hookName: "validate",
|
|
1792
|
-
parameters: [pluginManager.plugins]
|
|
1793
|
-
});
|
|
1794
1804
|
await pluginManager.hookParallel({
|
|
1795
1805
|
hookName: "buildStart",
|
|
1796
1806
|
parameters: [options.config]
|
|
@@ -1806,10 +1816,6 @@ async function safeBuild(options) {
|
|
|
1806
1816
|
const pluginManager = await setup(options);
|
|
1807
1817
|
const { fileManager, logger } = pluginManager;
|
|
1808
1818
|
try {
|
|
1809
|
-
await pluginManager.hookParallel({
|
|
1810
|
-
hookName: "validate",
|
|
1811
|
-
parameters: [pluginManager.plugins]
|
|
1812
|
-
});
|
|
1813
1819
|
await pluginManager.hookParallel({
|
|
1814
1820
|
hookName: "buildStart",
|
|
1815
1821
|
parameters: [options.config]
|