@maverickcer/env-cap 0.7.0 → 0.7.2
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/CHANGELOG.md +17 -0
- package/dist/.dts/_ipc/display-path.d.ts.map +1 -1
- package/dist/.dts/_ipc/no-node-fs.d.ts +3 -2
- package/dist/.dts/_ipc/no-node-fs.d.ts.map +1 -1
- package/dist/.dts/_ipc/resolve-tsconfig-paths.d.ts.map +1 -1
- package/dist/.dts/build/discover.d.ts +17 -1
- package/dist/.dts/build/discover.d.ts.map +1 -1
- package/dist/.dts/build/generate-usage.d.ts +1 -1
- package/dist/.dts/build/generate-usage.d.ts.map +1 -1
- package/dist/.dts/build/glob.d.ts +1 -1
- package/dist/.dts/build/index.d.ts +3 -3
- package/dist/{build-WKDIAWF7.js → build-5S64M63L.js} +36 -16
- package/dist/build-5S64M63L.js.map +1 -0
- package/dist/build.cjs +79 -59
- package/dist/build.cjs.map +1 -1
- package/dist/build.js +78 -58
- package/dist/build.js.map +1 -1
- package/dist/{chunk-KEGYUHBU.js → chunk-JQBYTJ2D.js} +2 -2
- package/dist/cli/index.js +3 -3
- package/dist/eslint-plugin/index.cjs +16 -5
- package/dist/eslint-plugin/index.cjs.map +1 -1
- package/dist/eslint-plugin/index.js +16 -5
- package/dist/eslint-plugin/index.js.map +1 -1
- package/package.json +8 -7
- package/skills/env-cap/SKILL.md +1 -1
- package/skills/env-cap/references/api.md +1 -1
- package/dist/build-WKDIAWF7.js.map +0 -1
- /package/dist/{chunk-KEGYUHBU.js.map → chunk-JQBYTJ2D.js.map} +0 -0
package/dist/build.cjs
CHANGED
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var path = require('path');
|
|
4
4
|
var crypto = require('crypto');
|
|
5
5
|
var module$1 = require('module');
|
|
6
6
|
|
|
7
7
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var path__default = /*#__PURE__*/_interopDefault(path);
|
|
10
10
|
var crypto__default = /*#__PURE__*/_interopDefault(crypto);
|
|
11
11
|
|
|
12
12
|
// node_modules/tsup/assets/cjs_shims.js
|
|
13
13
|
var getImportMetaUrl = () => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.tagName.toUpperCase() === "SCRIPT" ? document.currentScript.src : new URL("main.js", document.baseURI).href;
|
|
14
14
|
var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
|
|
15
15
|
function displayPath(root, filePath) {
|
|
16
|
-
if (!
|
|
17
|
-
const relative =
|
|
18
|
-
if (relative.startsWith(
|
|
19
|
-
|
|
16
|
+
if (!path__default.default.isAbsolute(filePath)) return filePath.split(path__default.default.sep).join("/");
|
|
17
|
+
const relative = path__default.default.relative(root, filePath);
|
|
18
|
+
if (relative === ".." || relative.startsWith(`..${path__default.default.sep}`) || path__default.default.isAbsolute(relative))
|
|
19
|
+
return filePath;
|
|
20
|
+
return relative.split(path__default.default.sep).join("/");
|
|
20
21
|
}
|
|
21
22
|
|
|
22
23
|
// src/build/source-position.ts
|
|
@@ -76,7 +77,7 @@ async function buildCitationSnapshots(activeContracts, previous, root, readFile)
|
|
|
76
77
|
let acknowledgment;
|
|
77
78
|
let contentHash;
|
|
78
79
|
try {
|
|
79
|
-
const content = await readFile(
|
|
80
|
+
const content = await readFile(path__default.default.resolve(root, position.file));
|
|
80
81
|
contentHash = hashContent(content);
|
|
81
82
|
const baseline = previousBaselines.get(
|
|
82
83
|
`${identity}#${position.file}:${position.line}:${position.column}`
|
|
@@ -270,7 +271,7 @@ async function readEvidenceSnapshot(snapshotPath, fs) {
|
|
|
270
271
|
return { status: "ok", snapshot: parsed };
|
|
271
272
|
}
|
|
272
273
|
async function writeEvidenceSnapshot(snapshotPath, snapshot, fs) {
|
|
273
|
-
await fs.mkdir(
|
|
274
|
+
await fs.mkdir(path__default.default.dirname(snapshotPath), { recursive: true });
|
|
274
275
|
await fs.writeFile(snapshotPath, `${JSON.stringify(snapshot, null, 2)}
|
|
275
276
|
`, "utf8");
|
|
276
277
|
}
|
|
@@ -375,24 +376,27 @@ function isAlwaysSkippedDirName(name) {
|
|
|
375
376
|
return name === "node_modules" || name === ".git";
|
|
376
377
|
}
|
|
377
378
|
var MAX_DISCOVERED_SCHEMA_FILES = 1e3;
|
|
378
|
-
async function
|
|
379
|
+
async function discoverFiles(options) {
|
|
379
380
|
const files = await walkDirectory(options.root, options.root, options.exclude, options.fs);
|
|
380
|
-
|
|
381
|
+
return files.filter((file) => {
|
|
381
382
|
const relativePath = toPosixRelative(options.root, file);
|
|
382
383
|
return matchesAnyPattern(relativePath, options.include) && !matchesAnyPattern(relativePath, options.exclude);
|
|
383
|
-
});
|
|
384
|
+
}).map((file) => path__default.default.normalize(file)).sort();
|
|
385
|
+
}
|
|
386
|
+
async function discoverSchemaFiles(options) {
|
|
387
|
+
const included = await discoverFiles(options);
|
|
384
388
|
if (included.length > MAX_DISCOVERED_SCHEMA_FILES) {
|
|
385
389
|
throw new Error(
|
|
386
390
|
`discoverSchemaFiles: found ${String(included.length)} files matching "include" under ${options.root} -- more than the ${String(MAX_DISCOVERED_SCHEMA_FILES)}-file sanity limit. This almost always means "root" (or "include"/"exclude") resolved more broadly than intended -- e.g. an omitted "root" falling back to an unexpectedly large process.cwd() -- rather than a real project genuinely declaring this many contracts. Narrow "root"/"include"/"exclude" to the intended project boundary.`
|
|
387
391
|
);
|
|
388
392
|
}
|
|
389
|
-
return included
|
|
393
|
+
return included;
|
|
390
394
|
}
|
|
391
395
|
async function walkDirectory(directory, root, exclude, fs) {
|
|
392
396
|
const entries = await fs.readdir(directory, { withFileTypes: true });
|
|
393
397
|
const results = [];
|
|
394
398
|
for (const entry of entries) {
|
|
395
|
-
const fullPath =
|
|
399
|
+
const fullPath = path__default.default.join(directory, entry.name);
|
|
396
400
|
if (entry.isDirectory()) {
|
|
397
401
|
if (isAlwaysSkippedDirName(entry.name)) continue;
|
|
398
402
|
const relativeDir = `${toPosixRelative(root, fullPath)}/`;
|
|
@@ -407,7 +411,7 @@ async function walkDirectory(directory, root, exclude, fs) {
|
|
|
407
411
|
return results;
|
|
408
412
|
}
|
|
409
413
|
function toPosixRelative(root, target) {
|
|
410
|
-
return
|
|
414
|
+
return path__default.default.relative(root, target).split(path__default.default.sep).join("/");
|
|
411
415
|
}
|
|
412
416
|
function matchesAnyPattern(filePath, patterns) {
|
|
413
417
|
return patterns.some((pattern) => globToRegExp(pattern).test(filePath));
|
|
@@ -1108,11 +1112,11 @@ function donatedTo(variable) {
|
|
|
1108
1112
|
return DONATED.get(variable) ?? /* @__PURE__ */ new Set();
|
|
1109
1113
|
}
|
|
1110
1114
|
function isWithinDirectory(baseDir, targetPath) {
|
|
1111
|
-
const relative =
|
|
1112
|
-
return relative !== ".." && !relative.startsWith(`..${
|
|
1115
|
+
const relative = path__default.default.relative(baseDir, targetPath);
|
|
1116
|
+
return relative !== ".." && !relative.startsWith(`..${path__default.default.sep}`) && !path__default.default.isAbsolute(relative);
|
|
1113
1117
|
}
|
|
1114
1118
|
function resolveWithinRoot(root, location, optionName, functionName) {
|
|
1115
|
-
const resolved =
|
|
1119
|
+
const resolved = path__default.default.resolve(root, location);
|
|
1116
1120
|
if (!isWithinDirectory(root, resolved)) {
|
|
1117
1121
|
return {
|
|
1118
1122
|
ok: false,
|
|
@@ -1135,10 +1139,10 @@ function isRecord2(value) {
|
|
|
1135
1139
|
return typeof value === "object" && value !== null;
|
|
1136
1140
|
}
|
|
1137
1141
|
async function locatePackageManifest(packageName, root, fs) {
|
|
1138
|
-
const req = module$1.createRequire(
|
|
1142
|
+
const req = module$1.createRequire(path__default.default.join(root, "package.json"));
|
|
1139
1143
|
try {
|
|
1140
1144
|
const packageJsonPath = req.resolve(`${packageName}/package.json`);
|
|
1141
|
-
return { packageJsonPath, packageDir:
|
|
1145
|
+
return { packageJsonPath, packageDir: path__default.default.dirname(packageJsonPath) };
|
|
1142
1146
|
} catch {
|
|
1143
1147
|
}
|
|
1144
1148
|
let mainFile;
|
|
@@ -1147,9 +1151,9 @@ async function locatePackageManifest(packageName, root, fs) {
|
|
|
1147
1151
|
} catch {
|
|
1148
1152
|
return void 0;
|
|
1149
1153
|
}
|
|
1150
|
-
let dir =
|
|
1154
|
+
let dir = path__default.default.dirname(mainFile);
|
|
1151
1155
|
for (let i = 0; i < PACKAGE_JSON_ANCESTOR_SEARCH_LIMIT; i++) {
|
|
1152
|
-
const candidate =
|
|
1156
|
+
const candidate = path__default.default.join(dir, "package.json");
|
|
1153
1157
|
try {
|
|
1154
1158
|
const parsed = JSON.parse(await fs.readFile(candidate, "utf8"));
|
|
1155
1159
|
if (isRecord2(parsed) && parsed["name"] === packageName) {
|
|
@@ -1157,7 +1161,7 @@ async function locatePackageManifest(packageName, root, fs) {
|
|
|
1157
1161
|
}
|
|
1158
1162
|
} catch {
|
|
1159
1163
|
}
|
|
1160
|
-
const parent =
|
|
1164
|
+
const parent = path__default.default.dirname(dir);
|
|
1161
1165
|
if (parent === dir) break;
|
|
1162
1166
|
dir = parent;
|
|
1163
1167
|
}
|
|
@@ -1199,7 +1203,7 @@ async function resolveUncached(packageName, root, fs) {
|
|
|
1199
1203
|
reason: `"${packageName}"'s package.json has no "envCap.schema" field (or it is not a string).`
|
|
1200
1204
|
};
|
|
1201
1205
|
}
|
|
1202
|
-
const lexicallyResolved =
|
|
1206
|
+
const lexicallyResolved = path__default.default.resolve(packageDir, declaredField);
|
|
1203
1207
|
if (!isWithinDirectory(packageDir, lexicallyResolved)) {
|
|
1204
1208
|
return {
|
|
1205
1209
|
ok: false,
|
|
@@ -1342,7 +1346,7 @@ function typescriptPath(file, separator) {
|
|
|
1342
1346
|
async function loadTsconfigPaths(product, root, tsconfigOption, fs) {
|
|
1343
1347
|
if (tsconfigOption === false) return { resolution: void 0, warning: void 0 };
|
|
1344
1348
|
const isExplicit = tsconfigOption !== void 0;
|
|
1345
|
-
const configFile =
|
|
1349
|
+
const configFile = path__default.default.resolve(root, tsconfigOption ?? "tsconfig.json");
|
|
1346
1350
|
if (!await fileExists(configFile, fs)) {
|
|
1347
1351
|
if (!isExplicit) return { resolution: void 0, warning: void 0 };
|
|
1348
1352
|
return {
|
|
@@ -1354,10 +1358,19 @@ async function loadTsconfigPaths(product, root, tsconfigOption, fs) {
|
|
|
1354
1358
|
};
|
|
1355
1359
|
}
|
|
1356
1360
|
assertCompilerApi(product, ts);
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
)
|
|
1361
|
+
let text;
|
|
1362
|
+
try {
|
|
1363
|
+
text = await fs.readFile(configFile, "utf8");
|
|
1364
|
+
} catch (error) {
|
|
1365
|
+
return {
|
|
1366
|
+
resolution: void 0,
|
|
1367
|
+
warning: {
|
|
1368
|
+
file: configFile,
|
|
1369
|
+
message: `Could not read "${configFile}": ${error.message}`
|
|
1370
|
+
}
|
|
1371
|
+
};
|
|
1372
|
+
}
|
|
1373
|
+
const readResult = ts.parseConfigFileTextToJson(typescriptPath(configFile, path__default.default.sep), text);
|
|
1361
1374
|
if (readResult.error) {
|
|
1362
1375
|
const detail = ts.flattenDiagnosticMessageText(readResult.error.messageText, ts.sys.newLine);
|
|
1363
1376
|
return {
|
|
@@ -1368,13 +1381,20 @@ async function loadTsconfigPaths(product, root, tsconfigOption, fs) {
|
|
|
1368
1381
|
}
|
|
1369
1382
|
};
|
|
1370
1383
|
}
|
|
1371
|
-
const parsed = ts.parseJsonConfigFileContent(readResult.config, ts.sys,
|
|
1384
|
+
const parsed = ts.parseJsonConfigFileContent(readResult.config, ts.sys, path__default.default.dirname(configFile));
|
|
1385
|
+
const problems = parsed.errors.filter((diagnostic) => diagnostic.code !== 18003);
|
|
1386
|
+
const warning = problems.length === 0 ? void 0 : {
|
|
1387
|
+
file: configFile,
|
|
1388
|
+
message: `"${configFile}" has problems the compiler reported: ${problems.map(
|
|
1389
|
+
(diagnostic) => ts.flattenDiagnosticMessageText(diagnostic.messageText, ts.sys.newLine)
|
|
1390
|
+
).join("; ")}`
|
|
1391
|
+
};
|
|
1372
1392
|
const { paths, baseUrl } = pathMappingOptions(parsed.options);
|
|
1373
1393
|
const hasPaths = paths !== void 0 && Object.keys(paths).length > 0;
|
|
1374
1394
|
if (!hasPaths && baseUrl === void 0) {
|
|
1375
|
-
return { resolution: void 0, warning
|
|
1395
|
+
return { resolution: void 0, warning };
|
|
1376
1396
|
}
|
|
1377
|
-
return { resolution: { compilerOptions: parsed.options, configFile }, warning
|
|
1397
|
+
return { resolution: { compilerOptions: parsed.options, configFile }, warning };
|
|
1378
1398
|
}
|
|
1379
1399
|
function resolveAliasImport(specifier, importingFile, resolution, cache) {
|
|
1380
1400
|
const cacheKey = `${importingFile}\0${specifier}`;
|
|
@@ -1383,8 +1403,8 @@ function resolveAliasImport(specifier, importingFile, resolution, cache) {
|
|
|
1383
1403
|
const resolvedFileName = result.resolvedModule?.resolvedFileName;
|
|
1384
1404
|
let resolved;
|
|
1385
1405
|
if (resolvedFileName) {
|
|
1386
|
-
const normalized =
|
|
1387
|
-
const isInNodeModules = normalized.split(
|
|
1406
|
+
const normalized = path__default.default.normalize(resolvedFileName);
|
|
1407
|
+
const isInNodeModules = normalized.split(path__default.default.sep).includes("node_modules");
|
|
1388
1408
|
const isTsSource = /\.tsx?$/.test(normalized);
|
|
1389
1409
|
if (!isInNodeModules && isTsSource) resolved = normalized;
|
|
1390
1410
|
}
|
|
@@ -1401,12 +1421,12 @@ function loadTsconfigPaths2(root, tsconfigOption, fs) {
|
|
|
1401
1421
|
async function resolveRelativeImport(importingFile, specifier, fs) {
|
|
1402
1422
|
if (!specifier.startsWith("./") && !specifier.startsWith("../")) return void 0;
|
|
1403
1423
|
const withoutExt = specifier.replace(/\.(js|jsx|ts|tsx)$/, "");
|
|
1404
|
-
const base =
|
|
1424
|
+
const base = path__default.default.resolve(path__default.default.dirname(importingFile), withoutExt);
|
|
1405
1425
|
for (const candidate of [
|
|
1406
1426
|
`${base}.ts`,
|
|
1407
1427
|
`${base}.tsx`,
|
|
1408
|
-
|
|
1409
|
-
|
|
1428
|
+
path__default.default.join(base, "index.ts"),
|
|
1429
|
+
path__default.default.join(base, "index.tsx")
|
|
1410
1430
|
]) {
|
|
1411
1431
|
if (await fileExists2(candidate, fs)) return candidate;
|
|
1412
1432
|
}
|
|
@@ -1641,7 +1661,7 @@ async function linkFiles(discoveredFiles, readFile, context, packageOrigins = /*
|
|
|
1641
1661
|
}
|
|
1642
1662
|
function summarizeContract(contract, root) {
|
|
1643
1663
|
return {
|
|
1644
|
-
file:
|
|
1664
|
+
file: path__default.default.relative(root, contract.file),
|
|
1645
1665
|
exportName: contract.exportName,
|
|
1646
1666
|
contractName: contract.contractName,
|
|
1647
1667
|
variableCount: contract.variables.length,
|
|
@@ -2639,7 +2659,7 @@ function discoverValidationContexts(contracts) {
|
|
|
2639
2659
|
}
|
|
2640
2660
|
function renderManifest(contracts, outputFile) {
|
|
2641
2661
|
const sorted = [...contracts].sort((a, b) => a.file.localeCompare(b.file));
|
|
2642
|
-
const outputDir =
|
|
2662
|
+
const outputDir = path__default.default.dirname(outputFile);
|
|
2643
2663
|
const usedNames = /* @__PURE__ */ new Set();
|
|
2644
2664
|
const importLines = [];
|
|
2645
2665
|
const referenceNames = [];
|
|
@@ -2659,7 +2679,7 @@ function renderManifest(contracts, outputFile) {
|
|
|
2659
2679
|
specifier = contract.packageOrigin.packageName;
|
|
2660
2680
|
} else {
|
|
2661
2681
|
const withoutExt = contract.file.replace(/\.tsx?$/, "");
|
|
2662
|
-
specifier =
|
|
2682
|
+
specifier = path__default.default.relative(outputDir, withoutExt).split(path__default.default.sep).join("/");
|
|
2663
2683
|
if (!specifier.startsWith(".")) specifier = `./${specifier}`;
|
|
2664
2684
|
}
|
|
2665
2685
|
const binding = localName === contract.exportName ? contract.exportName : `${contract.exportName} as ${localName}`;
|
|
@@ -2723,11 +2743,11 @@ function computeManifest(root, linkResult, onIncompatibility) {
|
|
|
2723
2743
|
}
|
|
2724
2744
|
async function writeManifest(outputPath, activeContracts, fs) {
|
|
2725
2745
|
const manifestSource = renderManifest(activeContracts, outputPath);
|
|
2726
|
-
await fs.mkdir(
|
|
2746
|
+
await fs.mkdir(path__default.default.dirname(outputPath), { recursive: true });
|
|
2727
2747
|
await fs.writeFile(outputPath, manifestSource, "utf8");
|
|
2728
2748
|
}
|
|
2729
2749
|
async function generateEnvManifest(options) {
|
|
2730
|
-
const root =
|
|
2750
|
+
const root = path__default.default.resolve(options.root ?? process.cwd());
|
|
2731
2751
|
const include = options.include ?? defaultInclude();
|
|
2732
2752
|
const exclude = options.exclude ?? defaultExclude();
|
|
2733
2753
|
const locationResult = resolveWithinRoot(
|
|
@@ -2911,7 +2931,7 @@ function renderUsageReport(computed) {
|
|
|
2911
2931
|
|
|
2912
2932
|
// src/build/generate-usage.ts
|
|
2913
2933
|
async function computeScanSurface(root, exclude, origins, fs) {
|
|
2914
|
-
const localScanFiles = await
|
|
2934
|
+
const localScanFiles = await discoverFiles({
|
|
2915
2935
|
fs,
|
|
2916
2936
|
root,
|
|
2917
2937
|
include: ["**/*.ts", "**/*.tsx"],
|
|
@@ -2923,7 +2943,7 @@ async function computeScanSurface(root, exclude, origins, fs) {
|
|
|
2923
2943
|
for (const origin of origins.values()) {
|
|
2924
2944
|
if (seenPackageDirs.has(origin.packageDir)) continue;
|
|
2925
2945
|
seenPackageDirs.add(origin.packageDir);
|
|
2926
|
-
const packageScanFiles = await
|
|
2946
|
+
const packageScanFiles = await discoverFiles({
|
|
2927
2947
|
fs,
|
|
2928
2948
|
root: origin.packageDir,
|
|
2929
2949
|
include: ["**/*.ts", "**/*.tsx"],
|
|
@@ -2958,20 +2978,20 @@ async function computeUsage(root, contracts, scanFiles, readFile, context, scann
|
|
|
2958
2978
|
};
|
|
2959
2979
|
const dependencyOwnership = graph.contracts.map((c) => ({
|
|
2960
2980
|
contractName: c.contractName,
|
|
2961
|
-
file:
|
|
2981
|
+
file: path__default.default.relative(root, c.file),
|
|
2962
2982
|
owner: ownerFor(c.file, c.exportName),
|
|
2963
2983
|
variableCount: c.variables.size,
|
|
2964
|
-
consumers: c.consumingFiles.map((f) =>
|
|
2984
|
+
consumers: c.consumingFiles.map((f) => path__default.default.relative(root, f))
|
|
2965
2985
|
}));
|
|
2966
2986
|
const abandonedContracts = findings.abandoned.map((f) => ({
|
|
2967
2987
|
contractName: f.contractName,
|
|
2968
|
-
file:
|
|
2988
|
+
file: path__default.default.relative(root, f.file),
|
|
2969
2989
|
owner: ownerFor(f.file, f.exportName)
|
|
2970
2990
|
}));
|
|
2971
2991
|
const unresolvedConsumers = findings.unresolvedConsumers.map(
|
|
2972
2992
|
(f) => ({
|
|
2973
2993
|
contractName: f.contractName,
|
|
2974
|
-
file:
|
|
2994
|
+
file: path__default.default.relative(root, f.file),
|
|
2975
2995
|
reason: f.reason
|
|
2976
2996
|
})
|
|
2977
2997
|
);
|
|
@@ -3038,11 +3058,11 @@ async function computeUsage(root, contracts, scanFiles, readFile, context, scann
|
|
|
3038
3058
|
}
|
|
3039
3059
|
async function writeUsageReport(reportPath, computed, fs) {
|
|
3040
3060
|
const source = renderUsageReport(computed);
|
|
3041
|
-
await fs.mkdir(
|
|
3061
|
+
await fs.mkdir(path__default.default.dirname(reportPath), { recursive: true });
|
|
3042
3062
|
await fs.writeFile(reportPath, source, "utf8");
|
|
3043
3063
|
}
|
|
3044
3064
|
async function generateUsageReport(options) {
|
|
3045
|
-
const root =
|
|
3065
|
+
const root = path__default.default.resolve(options.root ?? process.cwd());
|
|
3046
3066
|
const include = options.include ?? defaultInclude();
|
|
3047
3067
|
const exclude = options.exclude ?? defaultExclude();
|
|
3048
3068
|
let reportPath;
|
|
@@ -4143,7 +4163,7 @@ async function writeEnvExample(contracts, location, fs, options = {}) {
|
|
|
4143
4163
|
}
|
|
4144
4164
|
if (existingContent === void 0) {
|
|
4145
4165
|
const content2 = renderEnvExample(contracts, []);
|
|
4146
|
-
await fs.mkdir(
|
|
4166
|
+
await fs.mkdir(path__default.default.dirname(location), { recursive: true });
|
|
4147
4167
|
await fs.writeFile(location, content2, "utf8");
|
|
4148
4168
|
return {
|
|
4149
4169
|
writtenPath: location,
|
|
@@ -4168,7 +4188,7 @@ async function writeEnvExample(contracts, location, fs, options = {}) {
|
|
|
4168
4188
|
const content = renderEnvExample(contracts, headerLines);
|
|
4169
4189
|
const writtenPath = onExisting === "overwrite" ? location : `${location}.${Date.now()}`;
|
|
4170
4190
|
const skippedExistingPath = onExisting === "overwrite" ? void 0 : location;
|
|
4171
|
-
await fs.mkdir(
|
|
4191
|
+
await fs.mkdir(path__default.default.dirname(writtenPath), { recursive: true });
|
|
4172
4192
|
await fs.writeFile(writtenPath, content, "utf8");
|
|
4173
4193
|
return { writtenPath, skippedExistingPath, staleVariables, variablesToComment, variablesToAdd };
|
|
4174
4194
|
}
|
|
@@ -4266,7 +4286,7 @@ async function writeDocumentation(docsPath, envExamplePath, root, contracts, con
|
|
|
4266
4286
|
generatedAt,
|
|
4267
4287
|
previousContent
|
|
4268
4288
|
});
|
|
4269
|
-
await fs.mkdir(
|
|
4289
|
+
await fs.mkdir(path__default.default.dirname(docsPath), { recursive: true });
|
|
4270
4290
|
await fs.writeFile(docsPath, docsSource, "utf8");
|
|
4271
4291
|
const envExample = envExamplePath ? (
|
|
4272
4292
|
// `exactOptionalPropertyTypes` rejects an explicit `undefined`, so the key is omitted when unset.
|
|
@@ -4280,7 +4300,7 @@ async function writeDocumentation(docsPath, envExamplePath, root, contracts, con
|
|
|
4280
4300
|
return { envExample };
|
|
4281
4301
|
}
|
|
4282
4302
|
async function generateDocumentation(options) {
|
|
4283
|
-
const root =
|
|
4303
|
+
const root = path__default.default.resolve(options.root ?? process.cwd());
|
|
4284
4304
|
const include = options.include ?? defaultInclude();
|
|
4285
4305
|
const exclude = options.exclude ?? defaultExclude();
|
|
4286
4306
|
const expiringWithinDays = options.expiringWithinDays ?? DEFAULT_EXPIRING_WITHIN_DAYS;
|
|
@@ -4484,12 +4504,12 @@ function buildOwnershipModel(contracts, root) {
|
|
|
4484
4504
|
|
|
4485
4505
|
// src/build/tool-version.ts
|
|
4486
4506
|
function readToolVersion() {
|
|
4487
|
-
return "0.7.
|
|
4507
|
+
return "0.7.2";
|
|
4488
4508
|
}
|
|
4489
4509
|
|
|
4490
4510
|
// src/build/generate-evidence.ts
|
|
4491
4511
|
async function generateEvidenceModel(options) {
|
|
4492
|
-
const root =
|
|
4512
|
+
const root = path__default.default.resolve(options.root ?? process.cwd());
|
|
4493
4513
|
const include = options.include ?? defaultInclude();
|
|
4494
4514
|
const exclude = options.exclude ?? defaultExclude();
|
|
4495
4515
|
const expiringWithinDays = options.expiringWithinDays ?? DEFAULT_EXPIRING_WITHIN_DAYS;
|
|
@@ -4631,10 +4651,10 @@ async function writeEvidenceFingerprint(evidencePath, fingerprint, fs) {
|
|
|
4631
4651
|
`, "utf8");
|
|
4632
4652
|
}
|
|
4633
4653
|
async function getEvidenceModel(options) {
|
|
4634
|
-
const root =
|
|
4654
|
+
const root = path__default.default.resolve(options.root ?? process.cwd());
|
|
4635
4655
|
const include = options.include ?? defaultInclude();
|
|
4636
4656
|
const exclude = options.exclude ?? defaultExclude();
|
|
4637
|
-
const evidencePath =
|
|
4657
|
+
const evidencePath = path__default.default.resolve(root, options.location);
|
|
4638
4658
|
const fingerprintPath = fingerprintPathFor(evidencePath);
|
|
4639
4659
|
const recompute = async (missReason) => ({
|
|
4640
4660
|
evidence: await generateEvidenceModel(options),
|
|
@@ -4700,7 +4720,7 @@ function requestedPass(option) {
|
|
|
4700
4720
|
return option === false ? void 0 : option;
|
|
4701
4721
|
}
|
|
4702
4722
|
async function computeArtifacts(options) {
|
|
4703
|
-
const root =
|
|
4723
|
+
const root = path__default.default.resolve(options.root ?? process.cwd());
|
|
4704
4724
|
const include = options.include ?? defaultInclude();
|
|
4705
4725
|
const exclude = options.exclude ?? defaultExclude();
|
|
4706
4726
|
const manifestOptions = requestedPass(options.manifest);
|
|
@@ -5053,7 +5073,7 @@ function sarifLocations(finding) {
|
|
|
5053
5073
|
function buildSarifLog(findingModel) {
|
|
5054
5074
|
const ruleIds = [...new Set(findingModel.findings.map((f) => f.code))].sort();
|
|
5055
5075
|
return {
|
|
5056
|
-
$schema: "https://
|
|
5076
|
+
$schema: "https://docs.oasis-open.org/sarif/sarif/v2.1.0/errata01/os/schemas/sarif-schema-2.1.0.json",
|
|
5057
5077
|
version: "2.1.0",
|
|
5058
5078
|
runs: [
|
|
5059
5079
|
{
|