@catheadowl/pathscope 0.4.0 → 0.4.1
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 +19 -0
- package/dist/cjs/index.js +30 -24
- package/dist/win-attr.js +23 -7
- package/dist/win-attr.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,25 @@ description: pathscope changelog — user-visible changes per release, newest fi
|
|
|
7
7
|
All notable changes to this project are documented here. The format follows
|
|
8
8
|
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
|
9
9
|
|
|
10
|
+
## 0.4.1 — 2026-11-20
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
|
|
14
|
+
- **loader never-throws restored under the require(esm) hybrid** (2026-11-20,
|
|
15
|
+
consumer-found during the 0.4.0 registry-install verification): requiring
|
|
16
|
+
this package by absolute path from an eval entry
|
|
17
|
+
(`node -e "require('<abs pkg dir>')"`) made Node's require(esm) define
|
|
18
|
+
`__filename` as the eval main's `'[eval]'`, and the CJS-projection anchor
|
|
19
|
+
branch fed that sentinel straight into `createRequire` — an uncaught
|
|
20
|
+
ERR_INVALID_ARG_VALUE at the first walkScope, past the loader's
|
|
21
|
+
never-throws contract. The anchor now trusts `__filename` only when it is
|
|
22
|
+
an absolute path and falls through to `import.meta.url` (which
|
|
23
|
+
require(esm) forms as this file's real URL), and the load call site
|
|
24
|
+
hardens the contract with its own guard. Narrow edge: exports-map
|
|
25
|
+
require, import, and real-file parents were always clean, and 0.3.0 was
|
|
26
|
+
unaffected. A regression pin drives the exact eval-entry shape (abs-path
|
|
27
|
+
require + a real walk with a family file) against the built dist.
|
|
28
|
+
|
|
10
29
|
## 0.4.0 — 2026-11-20
|
|
11
30
|
|
|
12
31
|
### Added
|
package/dist/cjs/index.js
CHANGED
|
@@ -3199,7 +3199,7 @@ module.exports = __toCommonJS(index_exports);
|
|
|
3199
3199
|
|
|
3200
3200
|
// src/engine.ts
|
|
3201
3201
|
var import_node_fs4 = require("node:fs");
|
|
3202
|
-
var
|
|
3202
|
+
var import_node_path3 = require("node:path");
|
|
3203
3203
|
var import_node_process2 = require("node:process");
|
|
3204
3204
|
var import_fdir = __toESM(require_dist(), 1);
|
|
3205
3205
|
|
|
@@ -3230,7 +3230,7 @@ function reanchorLine(line, prefix) {
|
|
|
3230
3230
|
|
|
3231
3231
|
// src/exclusion-engine.ts
|
|
3232
3232
|
var import_node_fs2 = require("node:fs");
|
|
3233
|
-
var
|
|
3233
|
+
var import_node_path2 = require("node:path");
|
|
3234
3234
|
var import_ignore = __toESM(require_ignore(), 1);
|
|
3235
3235
|
|
|
3236
3236
|
// src/presets.ts
|
|
@@ -3340,11 +3340,12 @@ var PathscopeGitError = class extends Error {
|
|
|
3340
3340
|
|
|
3341
3341
|
// src/win-attr.ts
|
|
3342
3342
|
var import_node_module = require("node:module");
|
|
3343
|
+
var import_node_path = require("node:path");
|
|
3343
3344
|
var import_node_process = require("node:process");
|
|
3344
3345
|
var import_meta = {};
|
|
3345
3346
|
var cached;
|
|
3346
3347
|
function requireForThisFile() {
|
|
3347
|
-
if (typeof __filename
|
|
3348
|
+
if (typeof __filename === "string" && (0, import_node_path.isAbsolute)(__filename)) return (0, import_node_module.createRequire)(__filename);
|
|
3348
3349
|
return (0, import_node_module.createRequire)(import_meta.url);
|
|
3349
3350
|
}
|
|
3350
3351
|
var PREBUILD_CANDIDATES = [
|
|
@@ -3355,7 +3356,12 @@ function loadWinAttr() {
|
|
|
3355
3356
|
if (cached !== void 0) return cached;
|
|
3356
3357
|
cached = null;
|
|
3357
3358
|
if (import_node_process.platform === "win32") {
|
|
3358
|
-
|
|
3359
|
+
let require2;
|
|
3360
|
+
try {
|
|
3361
|
+
require2 = requireForThisFile();
|
|
3362
|
+
} catch {
|
|
3363
|
+
return cached;
|
|
3364
|
+
}
|
|
3359
3365
|
for (const candidate of PREBUILD_CANDIDATES) {
|
|
3360
3366
|
try {
|
|
3361
3367
|
const mod = require2(candidate);
|
|
@@ -3379,7 +3385,7 @@ function hiddenFaceDiagnostic(excludeDotEntriesOn, addonAvailable, isWin) {
|
|
|
3379
3385
|
|
|
3380
3386
|
// src/exclusion-engine.ts
|
|
3381
3387
|
var nodeExclusionIO = {
|
|
3382
|
-
exists: (dirKey, name) => Promise.resolve((0, import_node_fs2.existsSync)((0,
|
|
3388
|
+
exists: (dirKey, name) => Promise.resolve((0, import_node_fs2.existsSync)((0, import_node_path2.join)(dirKey, ...name.split("/")))),
|
|
3383
3389
|
readGitignore: (dirKey) => Promise.resolve(readGitignoreText(dirKey)),
|
|
3384
3390
|
readIgnoreFamily: (dirKey) => Promise.resolve({
|
|
3385
3391
|
ignore: readIgnoreFileText(dirKey, ".ignore"),
|
|
@@ -3388,7 +3394,7 @@ var nodeExclusionIO = {
|
|
|
3388
3394
|
hidden: (dirKey, name) => {
|
|
3389
3395
|
const winAttr = loadWinAttr();
|
|
3390
3396
|
if (winAttr === null) return Promise.resolve(null);
|
|
3391
|
-
return Promise.resolve(winAttr.getHidden((0,
|
|
3397
|
+
return Promise.resolve(winAttr.getHidden((0, import_node_path2.join)(dirKey, ...name.split("/"))) === 1);
|
|
3392
3398
|
}
|
|
3393
3399
|
};
|
|
3394
3400
|
function validateOptions(options) {
|
|
@@ -3881,7 +3887,7 @@ function createHiddenStashFs(winAttr) {
|
|
|
3881
3887
|
var DEFAULT_MAX_FILES = 2e3;
|
|
3882
3888
|
async function walkScope(root, options = {}) {
|
|
3883
3889
|
validateOptions(options);
|
|
3884
|
-
const rootNative = (0,
|
|
3890
|
+
const rootNative = (0, import_node_path3.resolve)(root);
|
|
3885
3891
|
if (!(0, import_node_fs4.existsSync)(rootNative)) {
|
|
3886
3892
|
throw new PathscopeConfigError(`scan root does not exist: ${rootNative}`);
|
|
3887
3893
|
}
|
|
@@ -3890,7 +3896,7 @@ async function walkScope(root, options = {}) {
|
|
|
3890
3896
|
const stoneHits = (key) => {
|
|
3891
3897
|
const hits = [];
|
|
3892
3898
|
for (const name of engine.stoneNames) {
|
|
3893
|
-
if ((0, import_node_fs4.existsSync)((0,
|
|
3899
|
+
if ((0, import_node_fs4.existsSync)((0, import_node_path3.join)(key, ...name.split("/")))) hits.push(name);
|
|
3894
3900
|
}
|
|
3895
3901
|
return hits;
|
|
3896
3902
|
};
|
|
@@ -3975,7 +3981,7 @@ async function walkScope(root, options = {}) {
|
|
|
3975
3981
|
|
|
3976
3982
|
// src/explain.ts
|
|
3977
3983
|
var import_node_fs5 = require("node:fs");
|
|
3978
|
-
var
|
|
3984
|
+
var import_node_path4 = require("node:path");
|
|
3979
3985
|
function parseRelPath(relPath) {
|
|
3980
3986
|
if (typeof relPath !== "string") {
|
|
3981
3987
|
throw new PathscopeConfigError("relPath must be a scan-root-relative POSIX path string");
|
|
@@ -4003,7 +4009,7 @@ function parseRelPath(relPath) {
|
|
|
4003
4009
|
}
|
|
4004
4010
|
async function explainScopePath(root, relPath, options = {}) {
|
|
4005
4011
|
const { segments, isDir, isRoot } = parseRelPath(relPath);
|
|
4006
|
-
const rootNative = (0,
|
|
4012
|
+
const rootNative = (0, import_node_path4.resolve)(root);
|
|
4007
4013
|
if (!(0, import_node_fs5.existsSync)(rootNative)) {
|
|
4008
4014
|
throw new PathscopeConfigError(`scan root does not exist: ${rootNative}`);
|
|
4009
4015
|
}
|
|
@@ -4088,7 +4094,7 @@ async function explainScopePath(root, relPath, options = {}) {
|
|
|
4088
4094
|
|
|
4089
4095
|
// src/universe.ts
|
|
4090
4096
|
var import_node_child_process = require("node:child_process");
|
|
4091
|
-
var
|
|
4097
|
+
var import_node_path5 = require("node:path");
|
|
4092
4098
|
var import_ignore2 = __toESM(require_ignore(), 1);
|
|
4093
4099
|
var repoRootCache = /* @__PURE__ */ new Map();
|
|
4094
4100
|
function clearUniverseCache() {
|
|
@@ -4161,8 +4167,8 @@ function filterDiffRawRecords(stdout) {
|
|
|
4161
4167
|
return [...kept];
|
|
4162
4168
|
}
|
|
4163
4169
|
function rebaseToRoot(repoRootNative, rootAbs, repoRelPosix) {
|
|
4164
|
-
const rel = (0,
|
|
4165
|
-
if (rel === "" || (0,
|
|
4170
|
+
const rel = (0, import_node_path5.relative)(rootAbs, (0, import_node_path5.join)(repoRootNative, repoRelPosix));
|
|
4171
|
+
if (rel === "" || (0, import_node_path5.isAbsolute)(rel) || rel.startsWith("..")) return null;
|
|
4166
4172
|
return toPosix(rel);
|
|
4167
4173
|
}
|
|
4168
4174
|
function validateFilter(filter) {
|
|
@@ -4196,7 +4202,7 @@ async function gitUniverse(root, options = {}) {
|
|
|
4196
4202
|
);
|
|
4197
4203
|
}
|
|
4198
4204
|
if (options.filter !== void 0) validateFilter(options.filter);
|
|
4199
|
-
const rootAbs = (0,
|
|
4205
|
+
const rootAbs = (0, import_node_path5.resolve)(root);
|
|
4200
4206
|
const repoRoot = repoRootOf(rootAbs);
|
|
4201
4207
|
let repoRelative;
|
|
4202
4208
|
if (variant === "staged") {
|
|
@@ -4222,14 +4228,14 @@ async function gitUniverse(root, options = {}) {
|
|
|
4222
4228
|
}
|
|
4223
4229
|
|
|
4224
4230
|
// src/discover.ts
|
|
4225
|
-
var
|
|
4231
|
+
var import_node_path8 = require("node:path");
|
|
4226
4232
|
|
|
4227
4233
|
// node_modules/.pnpm/find-up@8.0.0/node_modules/find-up/index.js
|
|
4228
|
-
var
|
|
4234
|
+
var import_node_path7 = __toESM(require("node:path"), 1);
|
|
4229
4235
|
|
|
4230
4236
|
// node_modules/.pnpm/locate-path@8.0.0/node_modules/locate-path/index.js
|
|
4231
4237
|
var import_node_process3 = __toESM(require("node:process"), 1);
|
|
4232
|
-
var
|
|
4238
|
+
var import_node_path6 = __toESM(require("node:path"), 1);
|
|
4233
4239
|
var import_node_fs6 = __toESM(require("node:fs"), 1);
|
|
4234
4240
|
var import_node_url = require("node:url");
|
|
4235
4241
|
var typeMappings = {
|
|
@@ -4254,7 +4260,7 @@ function locatePathSync(paths, {
|
|
|
4254
4260
|
const statFunction = allowSymlinks ? import_node_fs6.default.statSync : import_node_fs6.default.lstatSync;
|
|
4255
4261
|
for (const path_ of paths) {
|
|
4256
4262
|
try {
|
|
4257
|
-
const stat2 = statFunction(
|
|
4263
|
+
const stat2 = statFunction(import_node_path6.default.resolve(cwd, path_), {
|
|
4258
4264
|
throwIfNoEntry: false
|
|
4259
4265
|
});
|
|
4260
4266
|
if (!stat2) {
|
|
@@ -4281,9 +4287,9 @@ var TEN_MEGABYTES_IN_BYTES = 10 * 1024 * 1024;
|
|
|
4281
4287
|
// node_modules/.pnpm/find-up@8.0.0/node_modules/find-up/index.js
|
|
4282
4288
|
var findUpStop = /* @__PURE__ */ Symbol("findUpStop");
|
|
4283
4289
|
function findUpMultipleSync(name, options = {}) {
|
|
4284
|
-
let directory =
|
|
4285
|
-
const { root } =
|
|
4286
|
-
const stopAt =
|
|
4290
|
+
let directory = import_node_path7.default.resolve(toPath2(options.cwd) ?? "");
|
|
4291
|
+
const { root } = import_node_path7.default.parse(directory);
|
|
4292
|
+
const stopAt = import_node_path7.default.resolve(directory, toPath2(options.stopAt) ?? root);
|
|
4287
4293
|
const limit = options.limit ?? Number.POSITIVE_INFINITY;
|
|
4288
4294
|
const paths = [name].flat();
|
|
4289
4295
|
const runMatcher = (locateOptions) => {
|
|
@@ -4303,12 +4309,12 @@ function findUpMultipleSync(name, options = {}) {
|
|
|
4303
4309
|
break;
|
|
4304
4310
|
}
|
|
4305
4311
|
if (foundPath) {
|
|
4306
|
-
matches.push(
|
|
4312
|
+
matches.push(import_node_path7.default.resolve(directory, foundPath));
|
|
4307
4313
|
}
|
|
4308
4314
|
if (directory === stopAt || matches.length >= limit) {
|
|
4309
4315
|
break;
|
|
4310
4316
|
}
|
|
4311
|
-
directory =
|
|
4317
|
+
directory = import_node_path7.default.dirname(directory);
|
|
4312
4318
|
}
|
|
4313
4319
|
return matches;
|
|
4314
4320
|
}
|
|
@@ -4344,7 +4350,7 @@ function locateNearest(names, options = {}) {
|
|
|
4344
4350
|
(name) => foundPosix.length >= suffixOf(name).length && fold(foundPosix.slice(foundPosix.length - suffixOf(name).length)) === fold(suffixOf(name))
|
|
4345
4351
|
);
|
|
4346
4352
|
if (hit === void 0) {
|
|
4347
|
-
return { name: (0,
|
|
4353
|
+
return { name: (0, import_node_path8.basename)(found), path: found };
|
|
4348
4354
|
}
|
|
4349
4355
|
return { name: hit, path: found };
|
|
4350
4356
|
}
|
package/dist/win-attr.js
CHANGED
|
@@ -13,17 +13,23 @@
|
|
|
13
13
|
* {@link hiddenFaceDiagnostic}).
|
|
14
14
|
*/
|
|
15
15
|
import { createRequire } from 'node:module';
|
|
16
|
+
import { isAbsolute } from 'node:path';
|
|
16
17
|
import { platform } from 'node:process';
|
|
17
18
|
let cached;
|
|
18
19
|
/**
|
|
19
|
-
* A require anchored to THIS file,
|
|
20
|
-
*
|
|
21
|
-
* with format=cjs), so
|
|
22
|
-
*
|
|
23
|
-
* `
|
|
20
|
+
* A require anchored to THIS file, across every known projection — including
|
|
21
|
+
* the require(esm) hybrid. The CJS bundle stubs `import.meta` as an empty
|
|
22
|
+
* object (esbuild: import.meta is not available with format=cjs), so it
|
|
23
|
+
* rides `__filename`; the ESM projection has no `__filename` and uses
|
|
24
|
+
* `import.meta.url`. The hybrid is the trap: `require(esm)` of this package
|
|
25
|
+
* from an eval entry (`node -e "require('<abs pkg dir>')"`) DEFINES
|
|
26
|
+
* `__filename` as the eval main's `'[eval]'`, and `createRequire('[eval]')`
|
|
27
|
+
* rejects it (ERR_INVALID_ARG_VALUE). The sentinel fails the isAbsolute
|
|
28
|
+
* test and falls through to `import.meta.url`, which require(esm) forms as
|
|
29
|
+
* this file's real URL — the same anchor the ESM projection uses.
|
|
24
30
|
*/
|
|
25
31
|
function requireForThisFile() {
|
|
26
|
-
if (typeof __filename
|
|
32
|
+
if (typeof __filename === 'string' && isAbsolute(__filename))
|
|
27
33
|
return createRequire(__filename);
|
|
28
34
|
return createRequire(import.meta.url);
|
|
29
35
|
}
|
|
@@ -43,7 +49,17 @@ export function loadWinAttr() {
|
|
|
43
49
|
return cached;
|
|
44
50
|
cached = null;
|
|
45
51
|
if (platform === 'win32') {
|
|
46
|
-
|
|
52
|
+
let require;
|
|
53
|
+
try {
|
|
54
|
+
require = requireForThisFile();
|
|
55
|
+
}
|
|
56
|
+
catch {
|
|
57
|
+
// No projection produced a usable anchor — unreachable in the known
|
|
58
|
+
// matrix (ESM / CJS bundle / require(esm) real parent / require(esm)
|
|
59
|
+
// eval entry), and the never-throws loader contract outranks every
|
|
60
|
+
// projection guess: degradation with the loud diagnostic is the channel.
|
|
61
|
+
return cached;
|
|
62
|
+
}
|
|
47
63
|
for (const candidate of PREBUILD_CANDIDATES) {
|
|
48
64
|
try {
|
|
49
65
|
const mod = require(candidate);
|
package/dist/win-attr.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"win-attr.js","sourceRoot":"","sources":["../src/win-attr.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAcxC,IAAI,MAAwC,CAAC;AAE7C
|
|
1
|
+
{"version":3,"file":"win-attr.js","sourceRoot":"","sources":["../src/win-attr.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAcxC,IAAI,MAAwC,CAAC;AAE7C;;;;;;;;;;;GAWG;AACH,SAAS,kBAAkB;IACzB,IAAI,OAAO,UAAU,KAAK,QAAQ,IAAI,UAAU,CAAC,UAAU,CAAC;QAAE,OAAO,aAAa,CAAC,UAAU,CAAC,CAAC;IAC/F,OAAO,aAAa,CAAC,OAAO,IAAI,CAAC,GAAG,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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@catheadowl/pathscope",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "Cross-repo shared engine resolving the in-scope file set: walk or per-path point queries (excluded + why), gitignore cascade, mounted exclusion presets, loud budget, git universe, boundary stones — under a git-native alignment skeleton with conformance fixtures adjudicated by a git oracle.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|