diff --git a/.changeset/wise-glasses-hang.md b/.changeset/wise-glasses-hang.md new file mode 100644 index 000000000000..15abb3c5b102 --- /dev/null +++ b/.changeset/wise-glasses-hang.md @@ -0,0 +1,6 @@ +--- +'@astrojs/image': patch +'astro': patch +--- + +Improve sourcemap generation and performance diff --git a/packages/astro/package.json b/packages/astro/package.json index 5e06ee6788b5..e093a4f1d0e8 100644 --- a/packages/astro/package.json +++ b/packages/astro/package.json @@ -150,7 +150,7 @@ "html-escaper": "^3.0.3", "js-yaml": "^4.1.0", "kleur": "^4.1.4", - "magic-string": "^0.27.0", + "magic-string": "^0.30.2", "mime": "^3.0.0", "network-information-types": "^0.1.1", "ora": "^6.3.1", diff --git a/packages/astro/src/assets/vite-plugin-assets.ts b/packages/astro/src/assets/vite-plugin-assets.ts index 6a29d02f0b0d..56525300167c 100644 --- a/packages/astro/src/assets/vite-plugin-assets.ts +++ b/packages/astro/src/assets/vite-plugin-assets.ts @@ -150,7 +150,7 @@ export default function assets({ if (s) { return { code: s.toString(), - map: resolvedConfig.build.sourcemap ? s.generateMap({ hires: true }) : null, + map: resolvedConfig.build.sourcemap ? s.generateMap({ hires: 'boundary' }) : null, }; } else { return null; diff --git a/packages/astro/src/vite-plugin-astro-postprocess/index.ts b/packages/astro/src/vite-plugin-astro-postprocess/index.ts index be8ddb7b0687..9a2e185af6c8 100644 --- a/packages/astro/src/vite-plugin-astro-postprocess/index.ts +++ b/packages/astro/src/vite-plugin-astro-postprocess/index.ts @@ -56,7 +56,7 @@ export default function astro(): Plugin { if (s) { return { code: s.toString(), - map: s.generateMap({ hires: true }), + map: s.generateMap({ hires: 'boundary' }), }; } }, diff --git a/packages/astro/src/vite-plugin-env/index.ts b/packages/astro/src/vite-plugin-env/index.ts index 57a1ada63963..2b9f04cd4f1d 100644 --- a/packages/astro/src/vite-plugin-env/index.ts +++ b/packages/astro/src/vite-plugin-env/index.ts @@ -141,7 +141,7 @@ export default function envVitePlugin({ settings }: EnvPluginOptions): vite.Plug if (s) { return { code: s.toString(), - map: s.generateMap({ hires: true }), + map: s.generateMap({ hires: 'boundary' }), }; } }, diff --git a/packages/astro/src/vite-plugin-html/transform/index.ts b/packages/astro/src/vite-plugin-html/transform/index.ts index 139f01555859..d5be9676249e 100644 --- a/packages/astro/src/vite-plugin-html/transform/index.ts +++ b/packages/astro/src/vite-plugin-html/transform/index.ts @@ -15,6 +15,6 @@ export async function transform(code: string, id: string) { return { code: s.toString(), - map: s.generateMap(), + map: s.generateMap({ hires: 'boundary' }), }; } diff --git a/packages/astro/src/vite-plugin-scripts/page-ssr.ts b/packages/astro/src/vite-plugin-scripts/page-ssr.ts index 82fc12761f96..1a02ca13fc16 100644 --- a/packages/astro/src/vite-plugin-scripts/page-ssr.ts +++ b/packages/astro/src/vite-plugin-scripts/page-ssr.ts @@ -35,7 +35,7 @@ export default function astroScriptsPostPlugin({ return { code: s.toString(), - map: s.generateMap({ hires: true }), + map: s.generateMap({ hires: 'boundary' }), }; }, }; diff --git a/packages/integrations/image/package.json b/packages/integrations/image/package.json index 61176f86754c..1ac8727cbeb2 100644 --- a/packages/integrations/image/package.json +++ b/packages/integrations/image/package.json @@ -45,7 +45,7 @@ "http-cache-semantics": "^4.1.1", "image-size": "^1.0.2", "kleur": "^4.1.5", - "magic-string": "^0.27.0", + "magic-string": "^0.30.2", "mime": "^3.0.0" }, "devDependencies": { diff --git a/packages/integrations/image/src/vite-plugin-astro-image.ts b/packages/integrations/image/src/vite-plugin-astro-image.ts index bf5078fb30e1..637f6e3d53af 100644 --- a/packages/integrations/image/src/vite-plugin-astro-image.ts +++ b/packages/integrations/image/src/vite-plugin-astro-image.ts @@ -130,7 +130,7 @@ export function createPlugin(config: AstroConfig, options: Required=12'} dependencies: '@jridgewell/sourcemap-codec': 1.4.15 + dev: false /magic-string@0.30.0: resolution: {integrity: sha512-LA+31JYDJLs82r2ScLrlz1GjSgu66ZV518eyWT+S8VhyQn/JL0u9MeBOvQMGYiPk1DBiSN9DDMOcXvigJZaViQ==} engines: {node: '>=12'} dependencies: '@jridgewell/sourcemap-codec': 1.4.15 + dev: false + + /magic-string@0.30.2: + resolution: {integrity: sha512-lNZdu7pewtq/ZvWUp9Wpf/x7WzMTsR26TWV03BRZrXFsv+BI6dy8RAiKgm1uM/kyR0rCfUcqvOlXKG66KhIGug==} + engines: {node: '>=12'} + dependencies: + '@jridgewell/sourcemap-codec': 1.4.15 /make-dir@3.1.0: resolution: {integrity: sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==} @@ -18693,7 +18701,6 @@ packages: resolution: {directory: packages/astro, type: directory} id: file:packages/astro name: astro - version: 2.9.7 engines: {node: '>=16.12.0', npm: '>=6.14.0'} hasBin: true peerDependencies: @@ -18737,7 +18744,7 @@ packages: html-escaper: 3.0.3 js-yaml: 4.1.0 kleur: 4.1.5 - magic-string: 0.27.0 + magic-string: 0.30.2 mime: 3.0.0 network-information-types: 0.1.1(typescript@5.0.4) ora: 6.3.1 @@ -18779,25 +18786,21 @@ packages: file:packages/astro/test/fixtures/css-assets/packages/font-awesome: resolution: {directory: packages/astro/test/fixtures/css-assets/packages/font-awesome, type: directory} name: '@test/astro-font-awesome-package' - version: 0.0.1 dev: false file:packages/astro/test/fixtures/multiple-renderers/renderers/one: resolution: {directory: packages/astro/test/fixtures/multiple-renderers/renderers/one, type: directory} name: '@test/astro-renderer-one' - version: 1.0.0 dev: false file:packages/astro/test/fixtures/multiple-renderers/renderers/two: resolution: {directory: packages/astro/test/fixtures/multiple-renderers/renderers/two, type: directory} name: '@test/astro-renderer-two' - version: 1.0.0 dev: false file:packages/astro/test/fixtures/solid-component/deps/solid-jsx-component: resolution: {directory: packages/astro/test/fixtures/solid-component/deps/solid-jsx-component, type: directory} name: '@test/solid-jsx-component' - version: 0.0.0 dependencies: solid-js: 1.7.6 dev: false @@ -18806,7 +18809,6 @@ packages: resolution: {directory: packages/integrations/netlify, type: directory} id: file:packages/integrations/netlify name: '@astrojs/netlify' - version: 2.5.2 peerDependencies: astro: '*' dependencies: @@ -18821,7 +18823,6 @@ packages: resolution: {directory: packages/integrations/vercel, type: directory} id: file:packages/integrations/vercel name: '@astrojs/vercel' - version: 3.7.5 peerDependencies: astro: '*' dependencies: