Skip to content

Commit

Permalink
logging
Browse files Browse the repository at this point in the history
  • Loading branch information
haarg committed Sep 14, 2024
1 parent 0e20b38 commit 763a9ba
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 11 deletions.
32 changes: 22 additions & 10 deletions dist/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -22555,23 +22555,32 @@ var prefixes = {
"=": "",
"@": "Dist::Zilla::PluginBundle::",
"%": "Dist::Zilla::Stash::",
"": "Dist::Zilla::Plugin::",
"_": "Dist::Zilla"
"": "Dist::Zilla::Plugin::"
};
var prefixRx = /^(?:_$|[=@%]|)/;
var quoteMeta = (k) => k.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
var prefixRx = new RegExp("^(?:" + Object.keys(prefixes).map(quoteMeta).join("|") + ")");
var expandConfigPackageName = (section) => section.replace(prefixRx, (prefix) => prefixes[prefix]);
var parseDistINI = async (content) => {
const prereqs = [];
const rootSection = {
section: "_",
pack: "Dist::Zilla",
settings: {}
};
const sections = [rootSection];
let currentSettings = rootSection.settings;
const sections = [rootSection];
for (const { section, comment, key, value } of peg$parse2(await content)) {
if (section) {
const [, plugin, name] = section.match(/^([^\/]*)(?:\/(.*))?$/);
const pack = expandConfigPackageName(plugin);
currentSettings = {};
sections.push({ section, settings: currentSettings });
sections.push({
section,
plugin,
pack,
name,
settings: currentSettings
});
} else if (comment) {
const res = comment.match(/^\s*authordep\s*(\S+)\s*(?:=\s*([^;]+))?\s*/);
if (res !== null) {
Expand All @@ -22592,13 +22601,12 @@ var parseDistINI = async (content) => {
version: ">=0"
});
}
for (const { section, settings } of sections) {
const plugin = expandConfigPackageName(section.replace(/\s*\/.*$/, ""));
for (const { section, pack, settings } of sections) {
prereqs.push({
prereq: plugin,
prereq: pack,
version: fullVersion(settings[":version"] || "0")
});
if (plugin === "Dist::Zilla::PluginBundle::Filter" || plugin === "Dist::Zilla::PluginBundle::ConfigSlicer") {
if (pack === "Dist::Zilla::PluginBundle::Filter" || pack === "Dist::Zilla::PluginBundle::ConfigSlicer") {
prereqs.push({
prereq: expandConfigPackageName(settings["-bundle"]),
version: fullVersion(settings["-version"] || "0")
Expand Down Expand Up @@ -25364,13 +25372,17 @@ var getPrereqs = async ({
throw e;
}
}
console.log({ source });
const content = fh.readFile({ encoding: "utf8" });
const allPrereqs = await parser(content);
console.log({ allPrereqs });
const filteredPrereqs = filterPrereqs({
prereqs: await parser(content),
prereqs: allPrereqs,
phases: new Set(phases),
relationships: new Set(relationships),
features: new Set(features)
}).toSorted(sortByPrereq);
console.log({ filteredPrereqs });
const prereqs = {};
for (const { prereq, version: version2 } of filteredPrereqs) {
if (prereqs[prereq]) {
Expand Down
10 changes: 9 additions & 1 deletion src/get-prereqs.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,23 @@ export const getPrereqs = async ({
}
}

console.log({source});

Check failure on line 73 in src/get-prereqs.mjs

View workflow job for this annotation

GitHub Actions / lint

A space is required after '{'

Check failure on line 73 in src/get-prereqs.mjs

View workflow job for this annotation

GitHub Actions / lint

A space is required before '}'

const content = fh.readFile({ encoding: 'utf8' });

const allPrereqs = await parser(content);

console.log({allPrereqs});

Check failure on line 79 in src/get-prereqs.mjs

View workflow job for this annotation

GitHub Actions / lint

A space is required after '{'

Check failure on line 79 in src/get-prereqs.mjs

View workflow job for this annotation

GitHub Actions / lint

A space is required before '}'

const filteredPrereqs = filterPrereqs({
prereqs: await parser(content),
prereqs: allPrereqs,
phases: new Set(phases),
relationships: new Set(relationships),
features: new Set(features),
}).toSorted(sortByPrereq);

console.log({filteredPrereqs});

Check failure on line 88 in src/get-prereqs.mjs

View workflow job for this annotation

GitHub Actions / lint

A space is required after '{'

Check failure on line 88 in src/get-prereqs.mjs

View workflow job for this annotation

GitHub Actions / lint

A space is required before '}'

const prereqs = {};
for (const { prereq, version } of filteredPrereqs) {
if (prereqs[prereq]) {
Expand Down

0 comments on commit 763a9ba

Please sign in to comment.