From 42ba6cad9748015df5859e3f17177d9e8ae6ecc6 Mon Sep 17 00:00:00 2001 From: Christina Holland Date: Tue, 28 May 2024 13:26:18 -0700 Subject: [PATCH] Fix @google/generative-ai/files paths (#156) --- .changeset/calm-otters-confess.md | 5 +++++ packages/main/api-extractor.files.json | 2 +- packages/main/files/package.json | 10 +++++----- packages/main/rollup.config.mjs | 9 ++++++--- 4 files changed, 17 insertions(+), 9 deletions(-) create mode 100644 .changeset/calm-otters-confess.md diff --git a/.changeset/calm-otters-confess.md b/.changeset/calm-otters-confess.md new file mode 100644 index 00000000..58b4e2d8 --- /dev/null +++ b/.changeset/calm-otters-confess.md @@ -0,0 +1,5 @@ +--- +"@google/generative-ai": patch +--- + +Fix paths to @google/generative-ai/files. diff --git a/packages/main/api-extractor.files.json b/packages/main/api-extractor.files.json index 4819da00..ffa2f792 100644 --- a/packages/main/api-extractor.files.json +++ b/packages/main/api-extractor.files.json @@ -1,6 +1,6 @@ { "extends": "../../config/api-extractor.json", - "mainEntryPointFilePath": "/dist/files/src/files/index.d.ts", + "mainEntryPointFilePath": "/dist/src/files/index.d.ts", "dtsRollup": { "enabled": true, "untrimmedFilePath": "/dist/files/files.d.ts" diff --git a/packages/main/files/package.json b/packages/main/files/package.json index 01371633..d88794bd 100644 --- a/packages/main/files/package.json +++ b/packages/main/files/package.json @@ -1,8 +1,8 @@ { - "name": "@google/generative-ai/files", + "name": "@google/generative-ai-files", "description": "GoogleAI file upload manager", - "main": "./dist/files/index.js", - "browser": "./dist/files/index.mjs", - "module": "./dist/files/index.mjs", - "typings": "./dist/files/files.d.ts" + "main": "../dist/files/index.js", + "browser": "../dist/files/index.mjs", + "module": "../dist/files/index.mjs", + "typings": "../dist/files/files.d.ts" } diff --git a/packages/main/rollup.config.mjs b/packages/main/rollup.config.mjs index 67b9ad3f..4daae413 100644 --- a/packages/main/rollup.config.mjs +++ b/packages/main/rollup.config.mjs @@ -20,7 +20,6 @@ import typescriptPlugin from "rollup-plugin-typescript2"; import typescript from "typescript"; import json from "@rollup/plugin-json"; import pkg from "./package.json" assert { type: "json" }; -import filePkg from "./files/package.json" assert { type: "json" }; const es2017BuildPlugins = [ typescriptPlugin({ @@ -65,13 +64,17 @@ const cjsBuilds = [ const filesBuilds = [ { input: "src/files/index.ts", - output: [{ file: filePkg.module, format: "es", sourcemap: true }], + output: [ + { file: pkg.exports["./files"].import, format: "es", sourcemap: true }, + ], external: ["fs"], plugins: [...es2017BuildPlugins], }, { input: "src/files/index.ts", - output: [{ file: filePkg.main, format: "cjs", sourcemap: true }], + output: [ + { file: pkg.exports["./files"].require, format: "cjs", sourcemap: true }, + ], external: ["fs"], plugins: [...es2017BuildPlugins], },