Skip to content

Commit

Permalink
chore(updates): peer to vite 5 (#743)
Browse files Browse the repository at this point in the history
* chore(updates): peer to vite 5

* fix: udpate snapshots

* fix: return empty mappings for import-queries so that vite5 sourcemap inject doesn't do its thing
  • Loading branch information
dominikg authored Sep 15, 2023
1 parent 4e9628a commit bd5d43e
Show file tree
Hide file tree
Showing 32 changed files with 123 additions and 110 deletions.
6 changes: 6 additions & 0 deletions .changeset/brown-mails-fry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@sveltejs/vite-plugin-svelte-inspector': major
'@sveltejs/vite-plugin-svelte': major
---

breaking: update supported vite version to vite 5
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"publint": "^0.2.2",
"svelte": "^4.2.0",
"typescript": "^5.2.2",
"vite": "^4.4.9",
"vite": "^5.0.0-beta.1",
"vitest": "^0.34.4"
},
"lint-staged": {
Expand Down
2 changes: 1 addition & 1 deletion packages/e2e-tests/autoprefixer-browerslist/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"postcss-load-config": "^4.0.1",
"svelte": "^4.2.0",
"svelte-preprocess": "^5.0.4",
"vite": "^4.4.9"
"vite": "^5.0.0-beta.1"
},
"type": "module"
}
2 changes: 1 addition & 1 deletion packages/e2e-tests/configfile-custom/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"devDependencies": {
"@sveltejs/vite-plugin-svelte": "workspace:^",
"svelte": "^4.2.0",
"vite": "^4.4.9"
"vite": "^5.0.0-beta.1"
},
"type": "module"
}
2 changes: 1 addition & 1 deletion packages/e2e-tests/configfile-esm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"@sveltejs/vite-plugin-svelte": "workspace:^",
"svelte": "^4.2.0",
"svelte-preprocess": "^5.0.4",
"vite": "^4.4.9"
"vite": "^5.0.0-beta.1"
},
"type": "module"
}
2 changes: 1 addition & 1 deletion packages/e2e-tests/css-dev-sourcemap/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
"@sveltejs/vite-plugin-svelte": "workspace:^",
"sass": "^1.67.0",
"svelte": "^4.2.0",
"vite": "^4.4.9"
"vite": "^5.0.0-beta.1"
}
}
2 changes: 1 addition & 1 deletion packages/e2e-tests/css-none/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
"devDependencies": {
"@sveltejs/vite-plugin-svelte": "workspace:^",
"svelte": "^4.2.0",
"vite": "^4.4.9"
"vite": "^5.0.0-beta.1"
}
}
2 changes: 1 addition & 1 deletion packages/e2e-tests/custom-extensions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"devDependencies": {
"@sveltejs/vite-plugin-svelte": "workspace:^",
"svelte": "^4.2.0",
"vite": "^4.4.9"
"vite": "^5.0.0-beta.1"
},
"type": "module"
}
2 changes: 1 addition & 1 deletion packages/e2e-tests/env/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"devDependencies": {
"@sveltejs/vite-plugin-svelte": "workspace:^",
"svelte": "^4.2.0",
"vite": "^4.4.9"
"vite": "^5.0.0-beta.1"
},
"type": "module"
}
2 changes: 1 addition & 1 deletion packages/e2e-tests/hmr/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"e2e-test-dep-vite-plugins": "file:../_test_dependencies/vite-plugins",
"node-fetch": "^3.3.2",
"svelte": "^4.2.0",
"vite": "^4.4.9"
"vite": "^5.0.0-beta.1"
},
"type": "module"
}
2 changes: 1 addition & 1 deletion packages/e2e-tests/import-queries/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
"@sveltejs/vite-plugin-svelte": "workspace:^",
"sass": "^1.67.0",
"svelte": "^4.2.0",
"vite": "^4.4.9"
"vite": "^5.0.0-beta.1"
}
}
2 changes: 1 addition & 1 deletion packages/e2e-tests/inspector-kit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"devDependencies": {
"@sveltejs/kit": "^1.25.0",
"svelte": "^4.2.0",
"vite": "^4.4.9"
"vite": "^5.0.0-beta.1"
},
"type": "module"
}
2 changes: 1 addition & 1 deletion packages/e2e-tests/inspector-vite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
"devDependencies": {
"@sveltejs/vite-plugin-svelte": "workspace:^",
"svelte": "^4.2.0",
"vite": "^4.4.9"
"vite": "^5.0.0-beta.1"
}
}
2 changes: 1 addition & 1 deletion packages/e2e-tests/kit-node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"svelte-i18n": "^3.7.4",
"tiny-glob": "^0.2.9",
"typescript": "^5.2.2",
"vite": "^4.4.9"
"vite": "^5.0.0-beta.1"
},
"type": "module"
}
2 changes: 1 addition & 1 deletion packages/e2e-tests/package-json-svelte-field/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"@sveltejs/vite-plugin-svelte": "workspace:^",
"sass": "^1.67.0",
"svelte": "^4.2.0",
"vite": "^4.4.9"
"vite": "^5.0.0-beta.1"
},
"type": "module"
}
2 changes: 1 addition & 1 deletion packages/e2e-tests/prebundle-svelte-deps/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@
"sass": "^1.67.0",
"svelte": "^4.2.0",
"svelte-preprocess": "^5.0.4",
"vite": "^4.4.9"
"vite": "^5.0.0-beta.1"
}
}
2 changes: 1 addition & 1 deletion packages/e2e-tests/preprocess-with-vite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"sass": "^1.67.0",
"stylus": "^0.60.0",
"svelte": "^4.2.0",
"vite": "^4.4.9"
"vite": "^5.0.0-beta.1"
},
"type": "module"
}
2 changes: 1 addition & 1 deletion packages/e2e-tests/resolve-exports-svelte/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@
"devDependencies": {
"@sveltejs/vite-plugin-svelte": "workspace:^",
"svelte": "^4.2.0",
"vite": "^4.4.9"
"vite": "^5.0.0-beta.1"
}
}
2 changes: 1 addition & 1 deletion packages/e2e-tests/svelte-preprocess/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"svelte": "^4.2.0",
"svelte-preprocess": "^5.0.4",
"typescript": "^5.2.2",
"vite": "^4.4.9"
"vite": "^5.0.0-beta.1"
},
"type": "module"
}
2 changes: 1 addition & 1 deletion packages/e2e-tests/ts-type-import/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"@types/node": "^18.17.15",
"svelte": "^4.2.0",
"svelte-preprocess": "^5.0.4",
"vite": "^4.4.9"
"vite": "^5.0.0-beta.1"
},
"type": "module"
}
2 changes: 1 addition & 1 deletion packages/e2e-tests/vite-ssr-esm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
"npm-run-all": "^4.1.5",
"serve-static": "^1.15.0",
"svelte": "^4.2.0",
"vite": "^4.4.9"
"vite": "^5.0.0-beta.1"
}
}
2 changes: 1 addition & 1 deletion packages/e2e-tests/vite-ssr/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@
"express": "^4.18.2",
"serve-static": "^1.15.0",
"svelte": "^4.2.0",
"vite": "^4.4.9"
"vite": "^5.0.0-beta.1"
}
}
2 changes: 1 addition & 1 deletion packages/playground/big-component-library-kit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"svelte-check": "^3.5.1",
"svelte-preprocess": "^5.0.4",
"typescript": "^5.2.2",
"vite": "^4.4.9"
"vite": "^5.0.0-beta.1"
},
"type": "module"
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@
"lodash-es": "^4.17.21",
"svelte": "^4.2.0",
"svelte-preprocess": "^5.0.4",
"vite": "^4.4.9"
"vite": "^5.0.0-beta.1"
}
}
2 changes: 1 addition & 1 deletion packages/playground/big-component-library/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"carbon-preprocess-svelte": "^0.10.0",
"svelte": "^4.2.0",
"svelte-preprocess": "^5.0.4",
"vite": "^4.4.9"
"vite": "^5.0.0-beta.1"
},
"dependencies": {
"lodash-es": "^4.17.21"
Expand Down
2 changes: 1 addition & 1 deletion packages/playground/big/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
"devDependencies": {
"@sveltejs/vite-plugin-svelte": "workspace:^",
"svelte": "^4.2.0",
"vite": "^4.4.9"
"vite": "^5.0.0-beta.1"
}
}
2 changes: 1 addition & 1 deletion packages/playground/kit-demo-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"svelte": "^4.2.0",
"svelte-check": "^3.5.1",
"typescript": "^5.2.2",
"vite": "^4.4.9"
"vite": "^5.0.0-beta.1"
},
"type": "module"
}
2 changes: 1 addition & 1 deletion packages/playground/optimizedeps-include/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
"@sveltejs/vite-plugin-svelte": "workspace:^",
"svelte": "^4.2.0",
"tinro": "^0.6.12",
"vite": "^4.4.9"
"vite": "^5.0.0-beta.1"
}
}
4 changes: 2 additions & 2 deletions packages/vite-plugin-svelte-inspector/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@
"peerDependencies": {
"@sveltejs/vite-plugin-svelte": "^2.2.0",
"svelte": "^3.54.0 || ^4.0.0",
"vite": "^4.0.0"
"vite": "^5.0.0-beta.1 || ^5.0.0"
},
"devDependencies": {
"@types/debug": "^4.1.8",
"svelte": "^4.2.0",
"vite": "^4.4.9"
"vite": "^5.0.0-beta.1"
}
}
4 changes: 2 additions & 2 deletions packages/vite-plugin-svelte/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@
},
"peerDependencies": {
"svelte": "^3.54.0 || ^4.0.0",
"vite": "^4.0.0"
"vite": "^5.0.0-beta.1 || ^5.0.0"
},
"devDependencies": {
"@types/debug": "^4.1.8",
"esbuild": "^0.19.3",
"svelte": "^4.2.0",
"vite": "^4.4.9"
"vite": "^5.0.0-beta.1"
}
}
9 changes: 8 additions & 1 deletion packages/vite-plugin-svelte/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,14 @@ export function svelte(inlineOptions) {
if (svelteRequest) {
const { filename, query, raw } = svelteRequest;
if (raw) {
return loadRaw(svelteRequest, compileSvelte, options);
const code = await loadRaw(svelteRequest, compileSvelte, options);
// prevent vite from injecting sourcemaps in the results.
return {
code,
map: {
mappings: ''
}
};
} else {
if (query.svelte && query.type === 'style') {
const css = cache.getCSS(svelteRequest);
Expand Down
Loading

0 comments on commit bd5d43e

Please sign in to comment.