From 9607de1ff7fc70f125f1bafdb6467dae95f6d291 Mon Sep 17 00:00:00 2001 From: Isaac Roberts <119639439+madebyisaacr@users.noreply.github.com> Date: Fri, 27 Feb 2026 12:44:31 -0500 Subject: [PATCH 1/3] Replace \ with / in file names --- packages/plugin-tools/src/lib.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/plugin-tools/src/lib.ts b/packages/plugin-tools/src/lib.ts index 80f0b6509..9c4f37ef9 100644 --- a/packages/plugin-tools/src/lib.ts +++ b/packages/plugin-tools/src/lib.ts @@ -54,6 +54,14 @@ export function zipPluginDistribution(options: ZipPluginDistributionOptions): st zip.addLocalFolder(distPath) zip.deleteFile(markerFileName) zip.addFile(markerFileName, Buffer.from("true", "utf-8")) + + // Normalize all entry paths to use forward slashes + for (const entry of zip.getEntries()) { + if (entry.entryName.includes("\\")) { + entry.entryName = entry.entryName.replace(/\\/g, "/") + } + } + zip.writeZip(zipFilePath) return zipFilePath From 2127e25bc3654ce0e145cc32d20529cd912c27bf Mon Sep 17 00:00:00 2001 From: Isaac Roberts <119639439+madebyisaacr@users.noreply.github.com> Date: Fri, 27 Feb 2026 12:50:31 -0500 Subject: [PATCH 2/3] Update package.json --- packages/plugin-tools/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/plugin-tools/package.json b/packages/plugin-tools/package.json index 1bc02c785..1566eb49d 100644 --- a/packages/plugin-tools/package.json +++ b/packages/plugin-tools/package.json @@ -1,6 +1,6 @@ { "name": "framer-plugin-tools", - "version": "1.2.0", + "version": "1.2.1", "description": "CLI Tools for Framer Plugins", "type": "module", "main": "dist/index.js", From 15b265cd9fc8884943d8d1c3dec82010970b4a4e Mon Sep 17 00:00:00 2001 From: Isaac Roberts <119639439+madebyisaacr@users.noreply.github.com> Date: Mon, 2 Mar 2026 11:04:27 -0500 Subject: [PATCH 3/3] Add test --- packages/plugin-tools/src/lib.test.ts | 13 ++++++++++++- packages/plugin-tools/src/lib.ts | 18 ++++++++++-------- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/packages/plugin-tools/src/lib.test.ts b/packages/plugin-tools/src/lib.test.ts index 8caccb1ec..19d636742 100644 --- a/packages/plugin-tools/src/lib.test.ts +++ b/packages/plugin-tools/src/lib.test.ts @@ -3,7 +3,7 @@ import os from "node:os" import path from "node:path" import AdmZip from "adm-zip" import { afterEach, beforeEach, describe, expect, it } from "vitest" -import { detectPackageManager, zipPluginDistribution } from "./lib" +import { detectPackageManager, normalizeZipEntryPaths, zipPluginDistribution } from "./lib" describe("detectPackageManager", () => { let tmpDir: string @@ -203,6 +203,17 @@ describe("zipPluginDistribution", () => { expect(entries).toContain("assets/images/logo.png") }) + it("normalizes backslash entry names to use forward slashes", () => { + const zip = new AdmZip() + zip.addFile("nested\\dir\\file.txt", Buffer.from("content", "utf-8")) + + normalizeZipEntryPaths(zip) + + const entries = zip.getEntries().map(e => e.entryName) + expect(entries).toContain("nested/dir/file.txt") + expect(entries).not.toContain("nested\\dir\\file.txt") + }) + it("returns correct zipPath", () => { const distDir = path.join(tmpDir, "dist") fs.mkdirSync(distDir) diff --git a/packages/plugin-tools/src/lib.ts b/packages/plugin-tools/src/lib.ts index 9c4f37ef9..55be965bd 100644 --- a/packages/plugin-tools/src/lib.ts +++ b/packages/plugin-tools/src/lib.ts @@ -35,6 +35,15 @@ interface ZipPluginDistributionOptions { zipFileName: string } +// Normalize all entry paths to use forward slashes +export function normalizeZipEntryPaths(zip: AdmZip): void { + for (const entry of zip.getEntries()) { + if (entry.entryName.includes("\\")) { + entry.entryName = entry.entryName.replace(/\\/g, "/") + } + } +} + export function zipPluginDistribution(options: ZipPluginDistributionOptions): string { const distPath = path.isAbsolute(options.distPath) ? options.distPath : path.join(options.cwd, options.distPath) @@ -54,14 +63,7 @@ export function zipPluginDistribution(options: ZipPluginDistributionOptions): st zip.addLocalFolder(distPath) zip.deleteFile(markerFileName) zip.addFile(markerFileName, Buffer.from("true", "utf-8")) - - // Normalize all entry paths to use forward slashes - for (const entry of zip.getEntries()) { - if (entry.entryName.includes("\\")) { - entry.entryName = entry.entryName.replace(/\\/g, "/") - } - } - + normalizeZipEntryPaths(zip) zip.writeZip(zipFilePath) return zipFilePath