From 4c0bea5398b40023847b2e6ecb06ed6d6b14028c Mon Sep 17 00:00:00 2001 From: remiposo <57336808+remiposo@users.noreply.github.com> Date: Wed, 11 Jun 2025 15:10:31 +0900 Subject: [PATCH] fix: reduce bundle size and bump version --- packages/kysely-tailordb-codegen/build.js | 15 +++++++-------- packages/kysely-tailordb-codegen/package.json | 2 +- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/packages/kysely-tailordb-codegen/build.js b/packages/kysely-tailordb-codegen/build.js index 92d33c5..e1d77fc 100644 --- a/packages/kysely-tailordb-codegen/build.js +++ b/packages/kysely-tailordb-codegen/build.js @@ -61,15 +61,14 @@ const getInjectContent = (globalName, globalInject) => { return `import { ${exportName} } from "${moduleSpecifier}"; globalThis.${globalName} = ${exportName};`; }; -// Due to the use of dynamic require, bundling `git-diff` is difficult. -// However, since it's not used in this use case, we can mock it instead. -const mockGitDiff = { - name: "mock-git-diff", +// Mock packages that are difficult to bundle and not used in the current use case. +const mockPackages = { + name: "mock-packages", setup(build) { - build.onResolve({ filter: /^git-diff$/ }, (args) => { - return { path: args.path, namespace: "git-diff" }; + build.onResolve({ filter: /^(git-diff|cosmiconfig)$/ }, (args) => { + return { path: args.path, namespace: "mock-packages" }; }); - build.onLoad({ filter: /.*/, namespace: "git-diff" }, () => { + build.onLoad({ filter: /.*/, namespace: "mock-packages" }, () => { return { contents: "export default null" }; }); }, @@ -84,7 +83,7 @@ build({ define: { global: "globalThis", }, - plugins: [unenvAlias, unenvInject, mockGitDiff], + plugins: [unenvAlias, unenvInject, mockPackages], // Unused drivers are left unbundled as-is. // Note that future updates to `kysely-codegen` may introduce new drivers. external: [ diff --git a/packages/kysely-tailordb-codegen/package.json b/packages/kysely-tailordb-codegen/package.json index 18558c6..771406a 100644 --- a/packages/kysely-tailordb-codegen/package.json +++ b/packages/kysely-tailordb-codegen/package.json @@ -1,6 +1,6 @@ { "name": "@tailor-platform/function-kysely-tailordb-codegen", - "version": "0.1.0", + "version": "0.1.1", "description": "Generate Kysely code for TailorDB", "repository": { "type": "git",