@sveltejs/vite-plugin-svelte
Advanced tools
Comparing version 1.0.0-next.47 to 1.0.0-next.48
@@ -6,2 +6,3 @@ import { UserConfig, Plugin } from 'vite'; | ||
export { MarkupPreprocessor, Preprocessor, PreprocessorGroup, Processed } from 'svelte/types/compiler/preprocess'; | ||
import { KitConfig } from '@sveltejs/kit'; | ||
@@ -105,2 +106,6 @@ interface Options { | ||
experimental?: ExperimentalOptions; | ||
/** | ||
* Options for SvelteKit | ||
*/ | ||
kit?: KitConfig; | ||
} | ||
@@ -107,0 +112,0 @@ /** |
@@ -652,2 +652,3 @@ var __defProp = Object.defineProperty; | ||
"@lukeed/uuid", | ||
"@playwright/test", | ||
"@sveltejs/vite-plugin-svelte", | ||
@@ -662,2 +663,3 @@ "@sveltejs/kit", | ||
"mdsvex", | ||
"playwright", | ||
"postcss", | ||
@@ -671,3 +673,5 @@ "prettier", | ||
"typescript", | ||
"vite" | ||
"vite", | ||
"vitest", | ||
"__vite-browser-external" | ||
]; | ||
@@ -1128,2 +1132,3 @@ var COMMON_PREFIXES_WITHOUT_SVELTE_FIELD = [ | ||
removeIgnoredOptions(merged); | ||
addSvelteKitOptions(merged); | ||
addExtraPreprocessors(merged, viteConfig); | ||
@@ -1191,2 +1196,13 @@ enforceOptionsForHmr(merged); | ||
} | ||
function addSvelteKitOptions(options) { | ||
var _a, _b; | ||
if ((options == null ? void 0 : options.kit) != null) { | ||
const hydratable = ((_a = options.kit.browser) == null ? void 0 : _a.hydrate) !== false; | ||
if (options.compilerOptions.hydratable != null && options.compilerOptions.hydratable !== hydratable) { | ||
log.warn(`Conflicting values "compilerOptions.hydratable: ${options.compilerOptions.hydratable}" and "kit.browser.hydrate: ${(_b = options.kit.browser) == null ? void 0 : _b.hydrate}" in your svelte config. You should remove "compilerOptions.hydratable".`); | ||
} | ||
log.debug(`Setting compilerOptions.hydratable: ${hydratable} for SvelteKit`); | ||
options.compilerOptions.hydratable = hydratable; | ||
} | ||
} | ||
function resolveViteRoot(viteConfig) { | ||
@@ -1193,0 +1209,0 @@ return normalizePath2(viteConfig.root ? path4.resolve(viteConfig.root) : process.cwd()); |
{ | ||
"name": "@sveltejs/vite-plugin-svelte", | ||
"version": "1.0.0-next.47", | ||
"version": "1.0.0-next.48", | ||
"license": "MIT", | ||
@@ -62,2 +62,3 @@ "author": "dominikg", | ||
"devDependencies": { | ||
"@sveltejs/kit": "^1.0.0-next.350", | ||
"@types/debug": "^4.1.7", | ||
@@ -67,6 +68,6 @@ "@types/diff-match-patch": "^1.0.32", | ||
"esbuild": "^0.14.42", | ||
"rollup": "^2.75.4", | ||
"rollup": "^2.75.5", | ||
"svelte": "^3.48.0", | ||
"tsup": "^6.0.1", | ||
"vite": "^2.9.9" | ||
"tsup": "^6.1.0", | ||
"vite": "^2.9.10" | ||
}, | ||
@@ -73,0 +74,0 @@ "scripts": { |
@@ -130,2 +130,3 @@ import { log } from './log'; | ||
'@lukeed/uuid', | ||
'@playwright/test', | ||
'@sveltejs/vite-plugin-svelte', | ||
@@ -140,2 +141,3 @@ '@sveltejs/kit', | ||
'mdsvex', | ||
'playwright', | ||
'postcss', | ||
@@ -149,3 +151,5 @@ 'prettier', | ||
'typescript', | ||
'vite' | ||
'vite', | ||
'vitest', | ||
'__vite-browser-external' // see https://github.com/sveltejs/vite-plugin-svelte/issues/362 | ||
]; | ||
@@ -152,0 +156,0 @@ const COMMON_PREFIXES_WITHOUT_SVELTE_FIELD = [ |
@@ -14,4 +14,4 @@ /* eslint-disable no-unused-vars */ | ||
// eslint-disable-next-line node/no-missing-import | ||
import { CompileOptions, Warning } from 'svelte/types/compiler/interfaces'; | ||
import { | ||
import type { CompileOptions, Warning } from 'svelte/types/compiler/interfaces'; | ||
import type { | ||
MarkupPreprocessor, | ||
@@ -23,2 +23,4 @@ Preprocessor, | ||
} from 'svelte/types/compiler/preprocess'; | ||
// eslint-disable-next-line node/no-missing-import | ||
import type { KitConfig } from '@sveltejs/kit'; | ||
import path from 'path'; | ||
@@ -81,3 +83,2 @@ import { findRootSvelteDependencies, needsOptimization, SvelteDependency } from './dependencies'; | ||
); | ||
// configFile of svelteConfig contains the absolute path it was loaded from, | ||
@@ -122,2 +123,3 @@ // prefer it over the possibly relative inline path | ||
removeIgnoredOptions(merged); | ||
addSvelteKitOptions(merged); | ||
addExtraPreprocessors(merged, viteConfig); | ||
@@ -202,2 +204,19 @@ enforceOptionsForHmr(merged); | ||
// some SvelteKit options need compilerOptions to work, so set them here. | ||
function addSvelteKitOptions(options: ResolvedOptions) { | ||
if (options?.kit != null) { | ||
const hydratable = options.kit.browser?.hydrate !== false; | ||
if ( | ||
options.compilerOptions.hydratable != null && | ||
options.compilerOptions.hydratable !== hydratable | ||
) { | ||
log.warn( | ||
`Conflicting values "compilerOptions.hydratable: ${options.compilerOptions.hydratable}" and "kit.browser.hydrate: ${options.kit.browser?.hydrate}" in your svelte config. You should remove "compilerOptions.hydratable".` | ||
); | ||
} | ||
log.debug(`Setting compilerOptions.hydratable: ${hydratable} for SvelteKit`); | ||
options.compilerOptions.hydratable = hydratable; | ||
} | ||
} | ||
// vite passes unresolved `root`option to config hook but we need the resolved value, so do it here | ||
@@ -484,2 +503,7 @@ // https://github.com/sveltejs/vite-plugin-svelte/issues/113 | ||
experimental?: ExperimentalOptions; | ||
/** | ||
* Options for SvelteKit | ||
*/ | ||
kit?: KitConfig; | ||
} | ||
@@ -486,0 +510,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
494569
6348
9