@hyperframes/share 0.9.33 → 0.9.35
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/dist/sourceIgnore.d.mts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
/** Explicit, project-relative exclusions. This only removes files; it cannot override safety exclusions.
|
|
2
2
|
* @param {string} root @returns {Promise<(path: string) => boolean>} */
|
|
3
3
|
export function readSourceIgnore(root: string): Promise<(path: string) => boolean>;
|
|
4
|
+
/** The exclusions change detection applies. Change detection must keep working whatever the file holds: the CLI
|
|
5
|
+
* reads `.hyperframesignore` as gitignore syntax (`/renders/`, `**`, `!keep`), which this reader refuses. An
|
|
6
|
+
* unreadable file then excludes only scratch files, so a scan sees more files, never fewer. Source capture keeps
|
|
7
|
+
* the strict reader and still refuses the file. @param {string} root @returns {Promise<(path: string) => boolean>} */
|
|
8
|
+
export function readChangeIgnore(root: string): Promise<(path: string) => boolean>;
|
|
4
9
|
export class SourceIgnoreError extends Error {
|
|
5
10
|
code: string;
|
|
6
11
|
}
|
package/package.json
CHANGED
package/src/projectSnapshot.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @ts-check
|
|
2
2
|
// A project's files as change detection sees them: every file the film can use (isOutsideFilm), keyed by mtime and
|
|
3
3
|
// size, except html, keyed by content without the data-hf-id stamps. A run's change set and the watcher both read it.
|
|
4
|
-
import {
|
|
4
|
+
import { readChangeIgnore } from "./sourceIgnore.mjs";
|
|
5
5
|
import fs from "node:fs/promises";
|
|
6
6
|
import { constants } from "node:fs";
|
|
7
7
|
import path from "node:path";
|
|
@@ -61,7 +61,7 @@ async function entryKind(entry, full, followSymlinks) {
|
|
|
61
61
|
export async function snapshotProject(dir, { byContent = false, followSymlinks = false } = {}) {
|
|
62
62
|
/** @type {Snapshot} */
|
|
63
63
|
const result = new Map();
|
|
64
|
-
const ignored = await
|
|
64
|
+
const ignored = await readChangeIgnore(dir);
|
|
65
65
|
/** @param {string} current @param {Set<string>} ancestors */
|
|
66
66
|
async function walk(current, ancestors) {
|
|
67
67
|
const real = await fs.realpath(current).catch(() => null);
|
|
@@ -102,7 +102,7 @@ export function snapshotFingerprint(snapshot) {
|
|
|
102
102
|
export async function snapshotFiles(dir, files) {
|
|
103
103
|
/** @type {Map<string, unknown>} */
|
|
104
104
|
const result = new Map();
|
|
105
|
-
const ignored = await
|
|
105
|
+
const ignored = await readChangeIgnore(dir);
|
|
106
106
|
for (const file of files) {
|
|
107
107
|
const full = path.join(dir, file);
|
|
108
108
|
const stat = await fs.lstat(full).catch(() => null);
|
package/src/sourceIgnore.mjs
CHANGED
|
@@ -63,6 +63,14 @@ export async function readSourceIgnore(root) {
|
|
|
63
63
|
return (path) => scratch(path) || entries.some((entry) => entry.test(path));
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
+
/** The exclusions change detection applies. Change detection must keep working whatever the file holds: the CLI
|
|
67
|
+
* reads `.hyperframesignore` as gitignore syntax (`/renders/`, `**`, `!keep`), which this reader refuses. An
|
|
68
|
+
* unreadable file then excludes only scratch files, so a scan sees more files, never fewer. Source capture keeps
|
|
69
|
+
* the strict reader and still refuses the file. @param {string} root @returns {Promise<(path: string) => boolean>} */
|
|
70
|
+
export async function readChangeIgnore(root) {
|
|
71
|
+
return readSourceIgnore(root).catch(() => scratch);
|
|
72
|
+
}
|
|
73
|
+
|
|
66
74
|
/** @param {string} entry */
|
|
67
75
|
function ignorePattern(entry) {
|
|
68
76
|
const path = entry.replace(/\/$/, "");
|