From 879b65dd02b5a51eaabbf2e459709beaee4aa8ae Mon Sep 17 00:00:00 2001 From: Sarah Date: Tue, 21 Jan 2025 20:23:50 +0100 Subject: [PATCH] Fix preprocessing not being applied on Windows (#234) * Fix preprocessing not happening for files on Windows * Add Sarah as contributor * Use path.isAbsolute instead of custom function --- package.json | 3 ++- src/processScript/index.ts | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 21c7278..462b314 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,8 @@ "contributors": [ "Daniel Swann (https://github.com/danswann)", "Longboyy", - "Helloman892" + "Helloman892", + "Sarah Klocke (https://sarahisweird.dev/)" ], "main": "index.js", "repository": { diff --git a/src/processScript/index.ts b/src/processScript/index.ts index 4038ea0..05abeea 100644 --- a/src/processScript/index.ts +++ b/src/processScript/index.ts @@ -26,7 +26,7 @@ import rollupPluginJSON from "@rollup/plugin-json" import rollupPluginNodeResolve from "@rollup/plugin-node-resolve" import type { LaxPartial } from "@samual/lib" import { assert } from "@samual/lib/assert" -import { relative as getRelativePath } from "path" +import { relative as getRelativePath, sep as pathSeparator, isAbsolute as isAbsolutePath } from "path" import prettier from "prettier" import { rollup } from "rollup" import { supportedExtensions as extensions } from "../constants" @@ -260,7 +260,7 @@ export async function processScript(code: string, { { name: `hackmud-script-manager`, async transform(code, id) { - if (id.startsWith(`/`) && !id.includes(`/node_modules/`)) + if (isAbsolutePath(id) && !id.includes(`${pathSeparator}node_modules${pathSeparator}`)) return (await preprocess(code, { uniqueId })).code let program!: NodePath -- knotmirror 0.0.1