From 74cd869374af1c49a90f23c2eb8bf776bd756859 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Mangeonjean?= Date: Thu, 26 Oct 2023 14:55:53 +0200 Subject: [PATCH 1/2] fix: fix vsix read file function --- src/rollup-vsix-plugin.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/rollup-vsix-plugin.ts b/src/rollup-vsix-plugin.ts index 262514c7..1a273f79 100644 --- a/src/rollup-vsix-plugin.ts +++ b/src/rollup-vsix-plugin.ts @@ -86,8 +86,8 @@ export default function plugin ({ const getFileContent = async (filePath: string): Promise => { return readFileSync(filePath) } - const listFiles = async (path: string) => { - return (vsixFS.readdirSync(path) as string[]) + const listFiles = async (filePath: string) => { + return (vsixFS.readdirSync(path.join('/', filePath)) as string[]) } const extensionResources = (await extractResourcesFromExtensionManifest(manifest, getFileContent, listFiles)) .filter(resource => vsixFS.existsSync(path.join('/', resource.realPath ?? resource.path))) From 7c78c9fe4b2599004c6e316d156b65e86fc41785 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Mangeonjean?= Date: Thu, 26 Oct 2023 14:58:07 +0200 Subject: [PATCH 2/2] feat: add a way to request the vsix in getAdditionalResources --- src/rollup-vsix-plugin.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/rollup-vsix-plugin.ts b/src/rollup-vsix-plugin.ts index 1a273f79..c8918db7 100644 --- a/src/rollup-vsix-plugin.ts +++ b/src/rollup-vsix-plugin.ts @@ -12,7 +12,7 @@ interface Options { exclude?: FilterPattern rollupPlugins?: InputPluginOption[] transformManifest?: (manifest: IExtensionManifest) => IExtensionManifest - getAdditionalResources?: (manifest: IExtensionManifest) => Promise + getAdditionalResources?: (manifest: IExtensionManifest, getFileContent: (path: string) => Promise, listFiles: (path: string) => Promise) => Promise } function read (stream: Readable): Promise { @@ -94,7 +94,7 @@ export default function plugin ({ const resources = [ ...extensionResources, - ...await getAdditionalResources(manifest) + ...await getAdditionalResources(manifest, getFileContent, listFiles) ] const pathMapping = (await Promise.all(resources.map(async resource => {