Skip to content

armgit / hypit

Public Imported from GitHub
0

Clone any viral video with AI agents. Not just a script, the whole workflow: swap the face, the words, the B-roll, ship 100 variants in one command, and get your 100M views.

fix: keep dotfiles out of the package digest

rpone6ba7bcb761e6
diff --git a/packages/package-loader-node/src/lock.ts b/packages/package-loader-node/src/lock.ts
index 174952cf..a20623dd 100644
--- a/packages/package-loader-node/src/lock.ts
+++ b/packages/package-loader-node/src/lock.ts
@@ -212,6 +212,10 @@ async function filesUnder(root: string, cursor = root): Promise<readonly string[
if (entry.isDirectory() && ALWAYS_IGNORED_DIRECTORIES.has(entry.name)) continue;
if (cursor === root && entry.isDirectory() && DEVELOPMENT_ROOT_DIRECTORIES.has(entry.name)) continue;
if (cursor === root && entry.isFile() && developmentRootFile(entry.name)) continue;
+ // A package's bytes are the same on every machine. Dotfiles are editor and operating-system
+ // droppings — .DS_Store above all — so hashing them makes one developer's lock unusable
+ // everywhere else, and the failure reads as an unrelated stale-lock error.
+ if (entry.isFile() && entry.name.startsWith(".")) continue;
const path = join(cursor, entry.name);
if (entry.isDirectory()) values.push(...await filesUnder(root, path));
else if (entry.isFile()) values.push(path);
diff --git a/packages/package-loader-node/test/loader.test.ts b/packages/package-loader-node/test/loader.test.ts
index 4f3074f2..4dce8370 100644
--- a/packages/package-loader-node/test/loader.test.ts
+++ b/packages/package-loader-node/test/loader.test.ts
@@ -454,3 +454,32 @@ test("a third-party Runtime Adapter stays outside the Host and is identified by
assert.notEqual(first, `sha256:${"7".repeat(64)}`);
assert.notEqual(first, second);
});
+
+test("a package digest ignores editor and operating-system dotfiles", async () => {
+ const root = await mkdtemp(join(tmpdir(), "svml-package-dotfile-"));
+ const packageRoot = join(root, "node_modules", "example-dotfile");
+ await mkdir(packageRoot, { recursive: true });
+ await writeFile(join(packageRoot, "package.json"), JSON.stringify({
+ name: "example-dotfile",
+ version: "1.0.0",
+ type: "module",
+ exports: "./index.mjs",
+ svml: { activation: "./index.mjs" },
+ }, null, 2), "utf8");
+ await writeFile(join(packageRoot, "index.mjs"), `export default {
+ format: "svml.node-package@1",
+ name: "example-dotfile",
+ };\n`, "utf8");
+
+ const before = await createNodePackageLock(["example-dotfile"], root);
+ // A Finder dropping is not part of the package. Hashing one made a lock written on macOS
+ // report every other machine as stale, and the failure read as an unrelated stale-lock error.
+ await writeFile(join(packageRoot, ".DS_Store"), "finder", "utf8");
+ const after = await createNodePackageLock(["example-dotfile"], root);
+
+ assert.equal(after.digest, before.digest);
+ assert.deepEqual(
+ after.artifacts.map((artifact) => artifact.digest),
+ before.artifacts.map((artifact) => artifact.digest),
+ );
+});
diff --git a/tools/repository-hygiene.test.mjs b/tools/repository-hygiene.test.mjs
index b1ed2e89..6a9b0940 100644
--- a/tools/repository-hygiene.test.mjs
+++ b/tools/repository-hygiene.test.mjs
@@ -5,7 +5,7 @@ import test from "node:test";
import ts from "typescript";
const repositoryRoot = new URL("../", import.meta.url);
-const scanRoots = ["docs", "examples", "packages", "services", "spec", "test", "tools"];
+const scanRoots = ["docs", "examples", "packages", "services", "test", "tools"];
const rootTextFiles = ["README.md", "package.json", "pnpm-workspace.yaml", "tsconfig.json"];
const ignoredDirectories = new Set(["node_modules", "dist", "output", ".svml", ".vitepress"]);
const textExtensions = new Set([