Improve sourcemap generation and performance (#7901)

This commit is contained in:
Bjorn Lu 2023-08-02 11:30:53 +08:00 committed by GitHub
parent 543d210752
commit 00cb28f496
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 34 additions and 27 deletions

View file

@ -0,0 +1,6 @@
---
'@astrojs/image': patch
'astro': patch
---
Improve sourcemap generation and performance

View file

@ -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",

View file

@ -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;

View file

@ -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' }),
};
}
},

View file

@ -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' }),
};
}
},

View file

@ -15,6 +15,6 @@ export async function transform(code: string, id: string) {
return {
code: s.toString(),
map: s.generateMap(),
map: s.generateMap({ hires: 'boundary' }),
};
}

View file

@ -35,7 +35,7 @@ export default function astroScriptsPostPlugin({
return {
code: s.toString(),
map: s.generateMap({ hires: true }),
map: s.generateMap({ hires: 'boundary' }),
};
},
};

View file

@ -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": {

View file

@ -130,7 +130,7 @@ export function createPlugin(config: AstroConfig, options: Required<IntegrationO
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;

View file

@ -63,7 +63,7 @@
"@ungap/structured-clone": "^0.3.4",
"chai": "^4.3.7",
"event-target-shim": "^6.0.2",
"magic-string": "^0.27.0",
"magic-string": "^0.30.2",
"mocha": "^9.2.2",
"rollup": "^2.79.1",
"tslib": "^2.5.3",

View file

@ -591,8 +591,8 @@ importers:
specifier: ^4.1.4
version: 4.1.5
magic-string:
specifier: ^0.27.0
version: 0.27.0
specifier: ^0.30.2
version: 0.30.2
mime:
specifier: ^3.0.0
version: 3.0.0
@ -3788,8 +3788,8 @@ importers:
specifier: ^4.1.5
version: 4.1.5
magic-string:
specifier: ^0.27.0
version: 0.27.0
specifier: ^0.30.2
version: 0.30.2
mime:
specifier: ^3.0.0
version: 3.0.0
@ -5456,8 +5456,8 @@ importers:
specifier: ^6.0.2
version: 6.0.2
magic-string:
specifier: ^0.27.0
version: 0.27.0
specifier: ^0.30.2
version: 0.30.2
mocha:
specifier: ^9.2.2
version: 9.2.2
@ -8776,7 +8776,7 @@ packages:
debug: 4.3.4
deepmerge: 4.3.1
kleur: 4.1.5
magic-string: 0.30.0
magic-string: 0.30.2
svelte: 3.59.1
svelte-hmr: 0.15.2(svelte@3.59.1)
vite: 4.4.6(@types/node@18.16.18)(sass@1.63.4)
@ -9442,7 +9442,7 @@ packages:
/@vitest/snapshot@0.31.4:
resolution: {integrity: sha512-LemvNumL3NdWSmfVAMpXILGyaXPkZbG5tyl6+RQSdcHnTj6hvA49UAI8jzez9oQyE/FWLKRSNqTGzsHuk89LRA==}
dependencies:
magic-string: 0.30.0
magic-string: 0.30.2
pathe: 1.1.0
pretty-format: 27.5.1
dev: false
@ -9524,7 +9524,7 @@ packages:
'@vue/reactivity-transform': 3.3.4
'@vue/shared': 3.3.4
estree-walker: 2.0.2
magic-string: 0.30.0
magic-string: 0.30.2
postcss: 8.4.24
source-map-js: 1.0.2
@ -9541,7 +9541,7 @@ packages:
'@vue/compiler-core': 3.3.4
'@vue/shared': 3.3.4
estree-walker: 2.0.2
magic-string: 0.30.0
magic-string: 0.30.2
/@vue/reactivity@3.1.5:
resolution: {integrity: sha512-1tdfLmNjWG6t/CsPldh+foumYFo3cpyCHgBYQ34ylaMsJ+SNHQ1kApMIa8jN+i593zQuaw3AdWH0nJTARzCFhg==}
@ -13664,12 +13664,20 @@ packages:
engines: {node: '>=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: