From d14b55c6574c1ee0444feb9035a9a81ed7f1c209 Mon Sep 17 00:00:00 2001 From: bluwy Date: Mon, 10 Oct 2022 16:38:21 +0800 Subject: [PATCH] Support strict dependency install for image integration --- .changeset/small-laws-dream.md | 5 +++++ packages/integrations/image/package.json | 2 +- packages/integrations/image/src/index.ts | 5 ++--- pnpm-lock.yaml | 4 ++-- 4 files changed, 10 insertions(+), 6 deletions(-) create mode 100644 .changeset/small-laws-dream.md diff --git a/.changeset/small-laws-dream.md b/.changeset/small-laws-dream.md new file mode 100644 index 000000000000..8061f3ea237e --- /dev/null +++ b/.changeset/small-laws-dream.md @@ -0,0 +1,5 @@ +--- +'@astrojs/image': patch +--- + +Support strict dependency install diff --git a/packages/integrations/image/package.json b/packages/integrations/image/package.json index 533dadc83744..c941d3fba718 100644 --- a/packages/integrations/image/package.json +++ b/packages/integrations/image/package.json @@ -45,6 +45,7 @@ "@altano/tiny-async-pool": "^1.0.2", "http-cache-semantics": "^4.1.0", "image-size": "^1.0.2", + "kleur": "^4.1.5", "magic-string": "^0.25.9", "mime": "^3.0.0", "slash": "^4.0.0" @@ -57,7 +58,6 @@ "astro-scripts": "workspace:*", "chai": "^4.3.6", "cheerio": "^1.0.0-rc.11", - "kleur": "^4.1.4", "mocha": "^9.2.2", "rollup-plugin-copy": "^3.4.0", "sharp": "^0.31.0", diff --git a/packages/integrations/image/src/index.ts b/packages/integrations/image/src/index.ts index 9b6a73ebfd12..3aaf2731534e 100644 --- a/packages/integrations/image/src/index.ts +++ b/packages/integrations/image/src/index.ts @@ -49,9 +49,6 @@ export default function integration(options: IntegrationOptions = {}): AstroInte function getViteConfiguration() { return { plugins: [createPlugin(_config, resolvedOptions)], - optimizeDeps: { - include: ['image-size'].filter(Boolean), - }, build: { rollupOptions: { external: ['sharp'], @@ -59,6 +56,8 @@ export default function integration(options: IntegrationOptions = {}): AstroInte }, ssr: { noExternal: ['@astrojs/image', resolvedOptions.serviceEntryPoint], + // CJS dependencies used by `serviceEntryPoint` + external: ['http-cache-semantics', 'image-size', 'mime'], }, assetsInclude: ['**/*.wasm'], }; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 04f1ca855ac3..1f1fdf8505be 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -2536,7 +2536,7 @@ importers: cheerio: ^1.0.0-rc.11 http-cache-semantics: ^4.1.0 image-size: ^1.0.2 - kleur: ^4.1.4 + kleur: ^4.1.5 magic-string: ^0.25.9 mime: ^3.0.0 mocha: ^9.2.2 @@ -2549,6 +2549,7 @@ importers: '@altano/tiny-async-pool': 1.0.2 http-cache-semantics: 4.1.0 image-size: 1.0.2 + kleur: 4.1.5 magic-string: 0.25.9 mime: 3.0.0 slash: 4.0.0 @@ -2560,7 +2561,6 @@ importers: astro-scripts: link:../../../scripts chai: 4.3.6 cheerio: 1.0.0-rc.12 - kleur: 4.1.5 mocha: 9.2.2 rollup-plugin-copy: 3.4.0 sharp: 0.31.1