packstruct 1.1.2 → 1.1.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/README.md +1 -1
- package/package.json +2 -2
- package/src/lint.mjs +16 -5
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# packstruct 1.1.
|
|
1
|
+
# packstruct 1.1.3
|
|
2
2
|
|
|
3
3
|
The shared `/packs` spec. **One manifest + entry + lifecycle contract, many hosts**: [crashtest](https://github.com/dhaupin/crashtest) (scenario), [poststruct](https://github.com/dhaupin/poststruct) (check), plus two profiles bound to the host-owned [memstruct](https://github.com/dhaupin/memstruct) standard - [`memory`](profiles/memory.md) (vant's markdown store) and [`sync`](profiles/sync.md) (gistory's merge).
|
|
4
4
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "packstruct",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.3",
|
|
4
4
|
"description": "The shared /packs spec: one manifest, entry, and lifecycle contract for crashtest and poststruct packs - plus a zero-dependency lint CLI that kills broken pack manifests at author time.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"LICENSE"
|
|
23
23
|
],
|
|
24
24
|
"scripts": {
|
|
25
|
-
"test": "node test/run.mjs && node --test test/status.test.mjs test/refusal-matrix.test.mjs test/run-capped.test.mjs tests/ship-from-download.test.cjs tests/release-verify.test.cjs tests/distribution.test.cjs tests/check-action-pins.test.cjs && node --test tests/check-prestruct-pins.test.cjs",
|
|
25
|
+
"test": "node test/run.mjs && node --test test/status.test.mjs test/refusal-matrix.test.mjs test/deep-probe-cwd.test.mjs test/run-capped.test.mjs tests/ship-from-download.test.cjs tests/release-verify.test.cjs tests/post-permalinks.test.cjs tests/distribution.test.cjs tests/check-action-pins.test.cjs tests/npm-parity.test.cjs && node --test tests/check-prestruct-pins.test.cjs",
|
|
26
26
|
"test:ship": "node --test tests/ship-from-download.test.cjs",
|
|
27
27
|
"lint:docs": "node scripts/check-docs-frontmatter.cjs && node scripts/check-docs-links.cjs && node scripts/check-docs-style.cjs && node scripts/check-jekyll-filters.cjs && node scripts/check-language.cjs",
|
|
28
28
|
"lint:pins": "node scripts/check-action-pins.cjs",
|
package/src/lint.mjs
CHANGED
|
@@ -309,11 +309,18 @@ try {
|
|
|
309
309
|
// pipe-EOF that an orphaned grandchild spawned by the entry can hold
|
|
310
310
|
// forever, and an output-flooding entry hits the 1MB cap (an honest
|
|
311
311
|
// entry-import refusal), not a scratch-file flood that fills the disk.
|
|
312
|
-
|
|
312
|
+
//
|
|
313
|
+
// `cwd` is the host root (the parent of the linted `packs/`), never the
|
|
314
|
+
// caller's cwd. A pack entry is host code and resolves host paths such as
|
|
315
|
+
// `lib/traveler.js` relative to its own repo; inheriting the caller's cwd
|
|
316
|
+
// made the same tree lint clean from inside the host and false-fail with
|
|
317
|
+
// `entry-import` from anywhere else (packstruct#120).
|
|
318
|
+
async function childProbe(absPath, timeoutMs = PROBE_TIMEOUT_MS, cwd) {
|
|
313
319
|
const fileUrl = pathToFileURL(absPath).href
|
|
314
320
|
const r = await runCapped({
|
|
315
321
|
cmd: process.execPath,
|
|
316
322
|
args: ['--input-type=module', '--no-warnings', '-e', childProbeScript(fileUrl)],
|
|
323
|
+
cwd,
|
|
317
324
|
timeoutMs,
|
|
318
325
|
maxBuffer: 1024 * 1024,
|
|
319
326
|
killSignal: 'SIGKILL',
|
|
@@ -340,7 +347,7 @@ async function childProbe(absPath, timeoutMs = PROBE_TIMEOUT_MS) {
|
|
|
340
347
|
// in-process (inert data - no code execution needed); code modules are
|
|
341
348
|
// child-probed one by one, same as pack entries. The library's internal
|
|
342
349
|
// shapes stay the host's business.
|
|
343
|
-
async function collectLibraryUnits(ref, timeoutMs) {
|
|
350
|
+
async function collectLibraryUnits(ref, timeoutMs, cwd) {
|
|
344
351
|
const units = []
|
|
345
352
|
if (ref.endsWith('.json')) {
|
|
346
353
|
const obj = JSON.parse(readFileSync(ref, 'utf8'))
|
|
@@ -356,7 +363,7 @@ async function collectLibraryUnits(ref, timeoutMs) {
|
|
|
356
363
|
for (const file of files) {
|
|
357
364
|
let report
|
|
358
365
|
try {
|
|
359
|
-
report = await childProbe(file, timeoutMs)
|
|
366
|
+
report = await childProbe(file, timeoutMs, cwd)
|
|
360
367
|
} catch (err) {
|
|
361
368
|
throw new Error(`${file}: ${err.message}`)
|
|
362
369
|
}
|
|
@@ -376,6 +383,10 @@ export async function deepLintPacks(dir, opts = {}) {
|
|
|
376
383
|
const warnings = [...(shallow.warnings ?? [])]
|
|
377
384
|
const localChecked = shallow.localChecked ?? 0
|
|
378
385
|
const publicDir = join(dir, 'public')
|
|
386
|
+
// The host root every probe runs in: the parent of the linted `packs/`
|
|
387
|
+
// (the same root resolvePacksRoot discovers). Probes are host code and
|
|
388
|
+
// resolve host paths relative to it (packstruct#120).
|
|
389
|
+
const hostRoot = dirname(resolve(dir))
|
|
379
390
|
let libraryIds = 0
|
|
380
391
|
if (!existsSync(publicDir)) {
|
|
381
392
|
return { packsChecked: shallow.packsChecked, localChecked, violations, warnings, modulesProbed: 0, idsCensused: 0, libraryIds }
|
|
@@ -392,7 +403,7 @@ export async function deepLintPacks(dir, opts = {}) {
|
|
|
392
403
|
// namespaced-ids norm, engine side: the #19 44-vs-49 zero-collision claim).
|
|
393
404
|
if (opts.against !== undefined) {
|
|
394
405
|
try {
|
|
395
|
-
const lib = await collectLibraryUnits(opts.against, timeoutMs)
|
|
406
|
+
const lib = await collectLibraryUnits(opts.against, timeoutMs, hostRoot)
|
|
396
407
|
for (const { id, at } of lib) {
|
|
397
408
|
if (idSeen.has(id)) continue // the library's own internals: not ours to judge
|
|
398
409
|
idSeen.set(id, { pack: DEEP_LIB_TAG, at: `--against (${at})` })
|
|
@@ -428,7 +439,7 @@ export async function deepLintPacks(dir, opts = {}) {
|
|
|
428
439
|
if (typeof m.entry !== 'string' || !existsSync(join(packDir, m.entry))) continue
|
|
429
440
|
let report
|
|
430
441
|
try {
|
|
431
|
-
report = await childProbe(resolve(packDir, m.entry), timeoutMs)
|
|
442
|
+
report = await childProbe(resolve(packDir, m.entry), timeoutMs, hostRoot)
|
|
432
443
|
} catch (err) {
|
|
433
444
|
violations.push(tagLane({ pack: name, norm: 'entry-import', message: `entry "${m.entry}": ${err.message}` }, lane))
|
|
434
445
|
continue
|