@mark1russell7/conventions 0.14.1 → 0.15.0
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/README.md +1 -0
- package/build/cli.js +1 -1
- package/build/index.d.ts +9 -0
- package/build/index.d.ts.map +1 -1
- package/build/index.js +1 -1
- package/build/{run-2K_CrANg.js → run-DPO3BOI4.js} +134 -3
- package/build/run-DPO3BOI4.js.map +1 -0
- package/package.json +1 -1
- package/build/run-2K_CrANg.js.map +0 -1
package/README.md
CHANGED
|
@@ -54,6 +54,7 @@ The rules come from the invariants audit of 2026-10-26 (strategy item s38). The
|
|
|
54
54
|
| `roadmap-parses` | Each call of the Pages workflow of the template (`reusable-pages.yml`) gives a `roadmap`, or `site-pages: false`. Without it, the Status page shows no item of the plan. Each roadmap that a workflow gives to the Status page (a `roadmap:` key) parses as `@mark1russell7/site-pages` reads it. The rule uses the parser of site-pages. Thus a pull request finds a bad row, and the Pages job on `main` does not stop on it. | fleet `fail-closed` (STRATEGY.md, 2026-10-30). |
|
|
55
55
|
| `runner-budget` | All repositories of the account share 40 runners. Each `strategy` with a `matrix` has a `max-parallel` of 3 or less. Each workflow has a concurrency group at the top or in each job. A job that calls a shared workflow of the option `grouped` gets its group from that workflow, and each job of that workflow has a group. The minute of each `cron` comes from a hash of the repository and the file (1 to 59), so the schedules of the repositories do not start together. The repository comes from `GITHUB_REPOSITORY` or from the remote `origin`. | fleet `runner-slots` (STRATEGY.md, 2026-10-30). |
|
|
56
56
|
| `gate-trigger` | No workflow has `paths` or `paths-ignore` on `on.pull_request` or `on.pull_request_target`. The ruleset needs the summary check `<Name> OK` of each gate, and a workflow with a path filter does not start on each pull request. Then its check is not there, the ruleset cannot ask for it, and a pull request can merge before the gate ends. A gate uses the actions `changes` and `gate-summary` of the template (`CI.md`, "A gate with paths"). | fleet `gate-trigger` (STRATEGY.md, 2026-11-02). |
|
|
57
|
+
| `license-file` | Each public package has a license field, and a license file with the same license in its own folder. A repository with a public package has a license file at its root. npm packs only the license file of the folder of the package, and GitHub reads only the one of the root: on 2026-11-02 five public repositories showed no license on GitHub while npm said MIT. `conventions fix` writes the missing files. | fleet strategy (2026-11-02). |
|
|
57
58
|
| `home-package` | A change does not add a function with a signature name of another home of the map (for example `median`, `mulberry32` or `writeFileAtomic`). A local copy drifts from the home and splits the fixes. On 2026-11-02 the fleet had 68 local statistics functions in 14 repositories. The rule examines only the lines that the change adds, so the copies that exist do not break. | fleet direction 18 (STRATEGY.md, 2026-11-02). |
|
|
58
59
|
|
|
59
60
|
The rule `release-files` needs the base of the change. On a pull request, the checkout is a merge commit, and the rule reads its two parents (`fetch-depth` 2 or more). In other runs, give `--base <ref>`. Without a base, the rule shows `skip`. The rule also needs each commit of the change. A shallow checkout can end inside the change. Then the authors and the messages that the rule reads are not those of the change, so the rule shows `error`. A pull request of one commit is complete at depth 2. For a longer one, the CI of the template deepens the checkout to the merge base.
|
package/build/cli.js
CHANGED
package/build/index.d.ts
CHANGED
|
@@ -231,6 +231,15 @@ export declare function repoOf(context: RuleContext): string | undefined;
|
|
|
231
231
|
/** This function gives the message of a break: the home, and if the home already exports the name. */
|
|
232
232
|
export declare function messageOf(file: string, name: string, home: Home): string;
|
|
233
233
|
export declare const homePackage: Rule;
|
|
234
|
+
/** For each license that the rule knows, a pattern of its text. The text of another license is not checked. */
|
|
235
|
+
export declare const LICENSE_TEXTS: Readonly<Record<string, RegExp>>;
|
|
236
|
+
/** This function gives the name of the license file in a folder, or undefined. */
|
|
237
|
+
export declare function licenseFileOf(dir: string): string | undefined;
|
|
238
|
+
/** This function gives the name of the author of a manifest: the string before `<` or `(`, or the field `name`. */
|
|
239
|
+
export declare function authorOf(author: unknown): string | undefined;
|
|
240
|
+
/** This function gives the text of the MIT license. */
|
|
241
|
+
export declare function mitText(year: number, holder: string): string;
|
|
242
|
+
export declare const licenseFile: Rule;
|
|
234
243
|
/** The compare of two real paths. It is true through a link too, and it works on each Node version. */
|
|
235
244
|
export declare const REAL_COMPARE = "process.argv[1] !== undefined && realpathSync(process.argv[1]) === realpathSync(fileURLToPath(import.meta.url))";
|
|
236
245
|
/** This function tells if each Node version of the range has `import.meta.main`: 22.18 and later in 22, and 24.2 and later. Node 23 does not have it. */
|
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/rule.ts","../src/config.ts","../src/rules/cue-preset.ts","../src/rules/gate-trigger.ts","../src/map.ts","../src/rules/home-package.ts","../src/rules/main-check.ts","../src/rules/no-build-output.ts","../src/rules/no-local-paths.ts","../src/rules/pinned-git-deps.ts","../src/rules/release-files.ts","../src/rules/required-scripts.ts","../src/rules/roadmap-parses.ts","../src/rules/runner-budget.ts","../src/rules/source-main.ts","../src/rules/tests-required.ts","../src/rules/tsconfig-test.ts","../src/rules/typed-files.ts","../src/rules/typed-scripts.ts","../src/rules/trust-policy.ts","../src/rules/workspace-protocol.ts","../src/rules/index.ts","../src/home-exports.ts","../src/run.ts","../src/workspace.ts"],"mappings":";UASiB;WACN;WACA;WACA;;;UAIM;;WAEN;;WAEA;WACA;;WAEA;;WAEA,iBAAiB;;;;;;UAOX;;WAEN;;WAEA;;WAEA;;;wBAIK,YAAY,cAAc,cAAc;;KAQ5C;;KAGA,UAAU,SAAS,eAAe;;UAG7B;WACN;WACA,SAAS;WACT;;;KAIC,WAAW,SAAS;;UAGf;;WAEN;;WAEA;;WAEA;;WAEA;WACA,UAAU;;;UAIJ;;WAEN;;WAEA,aAAa;;WAEb,mBAAmB;;WAEnB,KAAK,SAAS;;WAEd;;EAET;;EAEA,IAAI;;;KAIM,uBAAuB;WAAqB;;;UAGvC;;WAEN;;WAEA;;WAEA;;WAEA;;WAEA,kBAAkB;;WAElB,SAAS,SAAS,eAAe;EAC1C,MAAM,SAAS,aAAa,SAAS,UAAU;;;qBAIpC;;wBAGG,aAAa,UAAU,UAAU;;wBAOjC,OAAO,cAAc,gBAAgB;;wBAOrC,QAAQ,cAAc,eAAe;;qBAMxC,WAAY,gBAAgB;;qBAG5B,YAAa;;wBAGV,WAAW,cAAc;;;;;;wBASzB,WAAW;;wBA2BX,UAAU;;wBAUV,OAAO,cAAc;;qBAOxB,UAAW,aAAa;;;;;wBAMrB,aAAa,SAAS,KAAK,oDAAoD;;UCrM9E;;WAEN;;WAEA;;WAEA;;WAEA,SAAS;;;UAIH;;WAEN;;WAEA,OAAO,SAAS,eAAe;;;wBAW1B,eAAe,MAAM,OAAO;;;;;;;wBAU5B,YAAY,gBAAgB,gBAAgB,SAAS;;qBCnCxD;qBA2FA,WAAW;;UCtFP;WACN;WACA;WACA;;;wBAIK,cAAc,eAAe;;qBAoBhC;;wBAgCG,YAAY;;;;;;;wBAkBZ,YAAY,cAAc,cAAc;EAAoC;;EAAmB;;qBA8IlG,aAAa;;KCtOd;;UAGK;;WAEN;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA,OAAO;;WAEP;;;;;;WAMA;;WAEA;;;qBAIE;;qBAIA,gBAAgB;;wBAmRb,YAAY,wBAAwB;;wBAUpC,WAAW,eAAe,QAAQ,gBAAgB,kBAAkB;;wBAMpE,UAAU,eAAe,iBAAgB,kBAA0B;;wBAkBnE,YAAY,iBAAgB;;wBAW5B,QAAQ,gBAAgB;;UClV9B;WACC,MAAM;WACN,SAAS;;;wBAIJ,aAAa,gBAAgB,SAAS;;wBAKtC,aAAa;;wBAMb,OAAO,SAAS;;wBAShB,UAAU,cAAc,cAAc,MAAM;qBAS/C,aAAa;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/rule.ts","../src/config.ts","../src/rules/cue-preset.ts","../src/rules/gate-trigger.ts","../src/map.ts","../src/rules/home-package.ts","../src/rules/license-file.ts","../src/rules/main-check.ts","../src/rules/no-build-output.ts","../src/rules/no-local-paths.ts","../src/rules/pinned-git-deps.ts","../src/rules/release-files.ts","../src/rules/required-scripts.ts","../src/rules/roadmap-parses.ts","../src/rules/runner-budget.ts","../src/rules/source-main.ts","../src/rules/tests-required.ts","../src/rules/tsconfig-test.ts","../src/rules/typed-files.ts","../src/rules/typed-scripts.ts","../src/rules/trust-policy.ts","../src/rules/workspace-protocol.ts","../src/rules/index.ts","../src/home-exports.ts","../src/run.ts","../src/workspace.ts"],"mappings":"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"}
|
package/build/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { st as ACTIONS_COMMIT, I as DEFAULT_ALLOWED, mt as DEPENDENCY_FIELDS, $ as HOMES, ot as HOME_EXPORTS, L as HOME_PATTERNS, p as IGNORE_AFTER, U as LICENSE_TEXTS, et as MAP_RULE, B as REAL_COMPARE, d as RULES, ft as STRICT_OPTIONS, m as TRAIN_SCOPES, t as USAGE, n as annotations, W as authorOf, ht as cleanPath, gt as codePackages, _ as configsOfScript, ct as convertGate, r as createContext, pt as cuePreset, J as declaredName, jt as defaultOptions, tt as findHomes, i as formatResult, lt as gateTrigger, Dt as globFolders, Ot as globToRegExp, _t as hasFile, V as hasImportMetaMain, x as hasTests, Y as homePackage, vt as inFolder, N as isGitSpecifier, P as isPinned, C as isSourcePath, yt as keyLine, G as licenseFile, K as licenseFileOf, bt as lineOf, a as listRules, H as mainCheck, nt as mapMarkdown, rt as mapText, xt as matchesAny, it as mergeHomes, X as messageOf, q as mitText, z as noBuildOutput, R as noLocalPaths, kt as packageFolders, Mt as parseConfig, St as parseJsonc, w as pathsOf, F as pinnedGitDeps, ut as prPathFilters, o as readConfig, Ct as readJsonc, at as readOverlay, M as releaseFiles, wt as replaceLine, Z as repoOf, E as repositoryOfRemote, j as requiredScripts, k as roadmapOfLine, A as roadmapParses, s as runChecks, c as runCli, l as runFix, Tt as runGit, D as runnerBudget, O as scheduleMinute, v as scriptsOf, Q as signaturesOf, T as sourceMain, Et as specifiersOf, u as summaryMarkdown, dt as summaryName, b as testsRequired, h as trustPolicy, S as tsconfigTest, y as typedFiles, g as typedScripts, At as workspaceGlobs, f as workspaceProtocol } from "./run-DPO3BOI4.js";
|
|
@@ -6539,6 +6539,136 @@ const homePackage = {
|
|
|
6539
6539
|
return breaks;
|
|
6540
6540
|
}
|
|
6541
6541
|
};
|
|
6542
|
+
// src/rules/license-file.ts
|
|
6543
|
+
/**
|
|
6544
|
+
* The rule `license-file`. Each public package has a license field and, in its own folder, a license file with the
|
|
6545
|
+
* same license. A repository with a public package has a license file at its root.
|
|
6546
|
+
*/
|
|
6547
|
+
/** The names of a license file, without case. */
|
|
6548
|
+
const LICENSE_NAME = /^licen[cs]e(?:\.(?:md|txt))?$/i;
|
|
6549
|
+
/** For each license that the rule knows, a pattern of its text. The text of another license is not checked. */
|
|
6550
|
+
const LICENSE_TEXTS = {
|
|
6551
|
+
MIT: /\bMIT License\b|Permission is hereby granted, free of charge/,
|
|
6552
|
+
ISC: /\bISC License\b|Permission to use, copy, modify, and\/or distribute/,
|
|
6553
|
+
"Apache-2.0": /Apache License,?\s+Version 2\.0/,
|
|
6554
|
+
"BSD-3-Clause": /Redistribution and use in source and binary forms[\s\S]*Neither the name/
|
|
6555
|
+
};
|
|
6556
|
+
/** This function gives the name of the license file in a folder, or undefined. */
|
|
6557
|
+
function licenseFileOf(dir) {
|
|
6558
|
+
if (!existsSync(dir)) return void 0;
|
|
6559
|
+
return readdirSync(dir, { withFileTypes: true }).find((entry) => entry.isFile() && LICENSE_NAME.test(entry.name))?.name;
|
|
6560
|
+
}
|
|
6561
|
+
/** This function gives the name of the author of a manifest: the string before `<` or `(`, or the field `name`. */
|
|
6562
|
+
function authorOf(author) {
|
|
6563
|
+
const before = (text) => {
|
|
6564
|
+
const at = text.search(/[<(]/);
|
|
6565
|
+
return at === -1 ? text : text.slice(0, at);
|
|
6566
|
+
};
|
|
6567
|
+
const name = typeof author === "string" ? before(author) : typeof author === "object" && author !== null && typeof author.name === "string" ? author.name : void 0;
|
|
6568
|
+
return name === void 0 || name.trim() === "" ? void 0 : name.trim();
|
|
6569
|
+
}
|
|
6570
|
+
/** This function gives the text of the MIT license. */
|
|
6571
|
+
function mitText(year, holder) {
|
|
6572
|
+
return `MIT License
|
|
6573
|
+
|
|
6574
|
+
Copyright (c) ${year} ${holder}
|
|
6575
|
+
|
|
6576
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6577
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
6578
|
+
in the Software without restriction, including without limitation the rights
|
|
6579
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
6580
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
6581
|
+
furnished to do so, subject to the following conditions:
|
|
6582
|
+
|
|
6583
|
+
The above copyright notice and this permission notice shall be included in all
|
|
6584
|
+
copies or substantial portions of the Software.
|
|
6585
|
+
|
|
6586
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
6587
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
6588
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
6589
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
6590
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
6591
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
6592
|
+
SOFTWARE.
|
|
6593
|
+
`;
|
|
6594
|
+
}
|
|
6595
|
+
const isPublic = (pkg) => pkg.manifest["private"] !== true;
|
|
6596
|
+
const licenseFile = {
|
|
6597
|
+
id: "license-file",
|
|
6598
|
+
title: "Each public package has a license field and, in its own folder, a license file with the same license. A repository with a public package has a license file at its root.",
|
|
6599
|
+
reason: "npm packs the license file of the folder of the package only, and GitHub reads the license file of the root only. On 2026-11-02 five public repositories (packing, rigor, layout-contract, typeset, template) had no license file at the root, so GitHub showed them as without a license while their packages on npm said MIT.",
|
|
6600
|
+
fix: "Add a license field to package.json (MIT is the license of each package of the fleet). `conventions fix` writes each missing license file: a copy of a license file of the repository with the same license, or else the MIT text with the author of the manifest. Correct a license file whose text is not the license of the field.",
|
|
6601
|
+
sources: [
|
|
6602
|
+
"vex",
|
|
6603
|
+
"coeval",
|
|
6604
|
+
"client",
|
|
6605
|
+
"highways"
|
|
6606
|
+
].map((repo) => ({
|
|
6607
|
+
repo,
|
|
6608
|
+
rule: "license-file",
|
|
6609
|
+
doc: "LICENSE (MIT, at the root, with license MIT in each package.json)"
|
|
6610
|
+
})),
|
|
6611
|
+
options: {},
|
|
6612
|
+
check(context) {
|
|
6613
|
+
const all = [context.rootPackage, ...codePackages(context)];
|
|
6614
|
+
const unique = all.filter((pkg, index) => all.findIndex((other) => other.file === pkg.file) === index);
|
|
6615
|
+
const published = unique.filter(isPublic);
|
|
6616
|
+
if (published.length === 0) return [];
|
|
6617
|
+
const breaks = [];
|
|
6618
|
+
const texts = /* @__PURE__ */ new Map();
|
|
6619
|
+
const licenseOf = (pkg) => typeof pkg.manifest["license"] === "string" ? pkg.manifest["license"] : void 0;
|
|
6620
|
+
for (const pkg of unique) {
|
|
6621
|
+
const name = licenseFileOf(pkg.dir);
|
|
6622
|
+
if (name === void 0) continue;
|
|
6623
|
+
const text = readFileSync(join(pkg.dir, name), "utf8");
|
|
6624
|
+
const license = Object.keys(LICENSE_TEXTS).find((id) => LICENSE_TEXTS[id]?.test(text) === true) ?? licenseOf(pkg);
|
|
6625
|
+
if (license !== void 0 && !texts.has(license)) texts.set(license, text);
|
|
6626
|
+
}
|
|
6627
|
+
const missing = (folder, license, author, why) => {
|
|
6628
|
+
const file = inFolder(folder, "LICENSE");
|
|
6629
|
+
const holder = authorOf(author) ?? authorOf(context.rootPackage.manifest["author"]);
|
|
6630
|
+
const text = texts.get(license) ?? (license === "MIT" && holder !== void 0 ? mitText((/* @__PURE__ */ new Date()).getFullYear(), holder) : void 0);
|
|
6631
|
+
breaks.push({
|
|
6632
|
+
file,
|
|
6633
|
+
message: `${folder === "" ? "The root" : folder} has no license file: ${why}`,
|
|
6634
|
+
...text === void 0 ? {} : { edits: [{
|
|
6635
|
+
file,
|
|
6636
|
+
before: "",
|
|
6637
|
+
after: text
|
|
6638
|
+
}] }
|
|
6639
|
+
});
|
|
6640
|
+
};
|
|
6641
|
+
for (const pkg of published) {
|
|
6642
|
+
const license = licenseOf(pkg);
|
|
6643
|
+
const name = String(pkg.manifest["name"] ?? pkg.folder);
|
|
6644
|
+
if (license === void 0) {
|
|
6645
|
+
breaks.push({
|
|
6646
|
+
file: pkg.file,
|
|
6647
|
+
message: `The public package ${name} has no license field.`
|
|
6648
|
+
});
|
|
6649
|
+
continue;
|
|
6650
|
+
}
|
|
6651
|
+
const found = licenseFileOf(pkg.dir);
|
|
6652
|
+
if (found === void 0) {
|
|
6653
|
+
missing(pkg.folder, license, pkg.manifest["author"], `npm packs only the license file of the folder of ${name} (${license}).`);
|
|
6654
|
+
continue;
|
|
6655
|
+
}
|
|
6656
|
+
const text = readFileSync(join(pkg.dir, found), "utf8");
|
|
6657
|
+
if (LICENSE_TEXTS[license]?.test(text) === false) {
|
|
6658
|
+
const line = lineOf(pkg.text, "\"license\"");
|
|
6659
|
+
breaks.push({
|
|
6660
|
+
file: inFolder(pkg.folder, found),
|
|
6661
|
+
message: `${inFolder(pkg.folder, found)} is not the text of ${license}, the license field of ${name}${line === void 0 ? "" : ` (${pkg.file}:${line})`}.`
|
|
6662
|
+
});
|
|
6663
|
+
}
|
|
6664
|
+
}
|
|
6665
|
+
if (!published.includes(context.rootPackage) && licenseFileOf(context.root) === void 0) {
|
|
6666
|
+
const license = published.map(licenseOf).find((item) => item !== void 0);
|
|
6667
|
+
if (license !== void 0) missing("", license, published[0]?.manifest["author"], "GitHub reads only the license file of the root.");
|
|
6668
|
+
}
|
|
6669
|
+
return breaks;
|
|
6670
|
+
}
|
|
6671
|
+
};
|
|
6542
6672
|
// src/rules/main-check.ts
|
|
6543
6673
|
/**
|
|
6544
6674
|
* The rule `main-check`: a script does not find out that it is the main module by a compare of `process.argv[1]` with
|
|
@@ -9206,7 +9336,8 @@ const RULES = [
|
|
|
9206
9336
|
roadmapParses,
|
|
9207
9337
|
runnerBudget,
|
|
9208
9338
|
gateTrigger,
|
|
9209
|
-
homePackage
|
|
9339
|
+
homePackage,
|
|
9340
|
+
licenseFile
|
|
9210
9341
|
];
|
|
9211
9342
|
// src/run.ts
|
|
9212
9343
|
/**
|
|
@@ -9602,6 +9733,6 @@ function runMap(args, io) {
|
|
|
9602
9733
|
else io.stdout(mapText(found));
|
|
9603
9734
|
return 0;
|
|
9604
9735
|
}
|
|
9605
|
-
export {
|
|
9736
|
+
export { HOMES as $, roadmapParses as A, workspaceGlobs as At, REAL_COMPARE as B, isSourcePath as C, readJsonc as Ct, runnerBudget as D, globFolders as Dt, repositoryOfRemote as E, specifiersOf as Et, pinnedGitDeps as F, licenseFile as G, mainCheck as H, DEFAULT_ALLOWED as I, declaredName as J, licenseFileOf as K, HOME_PATTERNS as L, releaseFiles as M, parseConfig as Mt, isGitSpecifier as N, scheduleMinute as O, globToRegExp as Ot, isPinned as P, signaturesOf as Q, noLocalPaths as R, tsconfigTest as S, parseJsonc as St, sourceMain as T, runGit as Tt, LICENSE_TEXTS as U, hasImportMetaMain as V, authorOf as W, messageOf as X, homePackage as Y, repoOf as Z, configsOfScript as _, hasFile as _t, listRules as a, readOverlay as at, testsRequired as b, lineOf as bt, runCli as c, convertGate as ct, RULES as d, summaryName as dt, MAP_RULE as et, workspaceProtocol as f, STRICT_OPTIONS as ft, typedScripts as g, codePackages as gt, trustPolicy as h, cleanPath as ht, formatResult as i, mergeHomes as it, requiredScripts as j, defaultOptions as jt, roadmapOfLine as k, packageFolders as kt, runFix as l, gateTrigger as lt, TRAIN_SCOPES as m, DEPENDENCY_FIELDS as mt, annotations as n, mapMarkdown as nt, readConfig as o, HOME_EXPORTS as ot, IGNORE_AFTER as p, cuePreset as pt, mitText as q, createContext as r, mapText as rt, runChecks as s, ACTIONS_COMMIT as st, USAGE as t, findHomes as tt, summaryMarkdown as u, prPathFilters as ut, scriptsOf as v, inFolder as vt, pathsOf as w, replaceLine as wt, hasTests as x, matchesAny as xt, typedFiles as y, keyLine as yt, noBuildOutput as z };
|
|
9606
9737
|
|
|
9607
|
-
//# sourceMappingURL=run-
|
|
9738
|
+
//# sourceMappingURL=run-DPO3BOI4.js.map
|