@sveltejs/vite-plugin-svelte 1.0.0-next.44 → 1.0.0-next.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +20 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.js +19 -6
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
- package/src/ui/inspector/Inspector.svelte +1 -1
- package/src/ui/inspector/plugin.ts +1 -1
- package/src/utils/__tests__/dependencies.spec.ts +7 -4
- package/src/utils/__tests__/sourcemap.spec.ts +1 -0
- package/src/utils/compile.ts +2 -1
- package/src/utils/options.ts +26 -6
package/dist/index.cjs
CHANGED
|
@@ -43,7 +43,7 @@ __export(src_exports, {
|
|
|
43
43
|
});
|
|
44
44
|
module.exports = __toCommonJS(src_exports);
|
|
45
45
|
|
|
46
|
-
// ../../node_modules/.pnpm/tsup@5.12.
|
|
46
|
+
// ../../node_modules/.pnpm/tsup@5.12.8/node_modules/tsup/assets/cjs_shims.js
|
|
47
47
|
var getImportMetaUrl = () => typeof document === "undefined" ? new URL("file:" + __filename).href : document.currentScript && document.currentScript.src || new URL("main.js", document.baseURI).href;
|
|
48
48
|
var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
|
|
49
49
|
|
|
@@ -302,7 +302,8 @@ var _createCompileSvelte = (makeHot) => async function compileSvelte2(svelteRequ
|
|
|
302
302
|
const dependencies = [];
|
|
303
303
|
const compileOptions = __spreadProps(__spreadValues({}, options.compilerOptions), {
|
|
304
304
|
filename,
|
|
305
|
-
generate: ssr ? "ssr" : "dom"
|
|
305
|
+
generate: ssr ? "ssr" : "dom",
|
|
306
|
+
format: "esm"
|
|
306
307
|
});
|
|
307
308
|
if (options.hot && options.emitCss) {
|
|
308
309
|
const hash = `s-${safeBase64Hash(normalizedFilename)}`;
|
|
@@ -1101,10 +1102,7 @@ async function preResolveOptions(inlineOptions = {}, viteUserConfig, viteEnv) {
|
|
|
1101
1102
|
});
|
|
1102
1103
|
const defaultOptions = {
|
|
1103
1104
|
extensions: [".svelte"],
|
|
1104
|
-
emitCss: true
|
|
1105
|
-
compilerOptions: {
|
|
1106
|
-
format: "esm"
|
|
1107
|
-
}
|
|
1105
|
+
emitCss: true
|
|
1108
1106
|
};
|
|
1109
1107
|
const svelteConfig = await loadSvelteConfig(viteConfigWithResolvedRoot, inlineOptions);
|
|
1110
1108
|
const extraOptions = {
|
|
@@ -1141,6 +1139,7 @@ function resolveOptions(preResolveOptions2, viteConfig) {
|
|
|
1141
1139
|
isProduction: viteConfig.isProduction
|
|
1142
1140
|
};
|
|
1143
1141
|
const merged = mergeConfigs(defaultOptions, preResolveOptions2, extraOptions);
|
|
1142
|
+
removeIgnoredOptions(merged);
|
|
1144
1143
|
addExtraPreprocessors(merged, viteConfig);
|
|
1145
1144
|
enforceOptionsForHmr(merged);
|
|
1146
1145
|
enforceOptionsForProduction(merged);
|
|
@@ -1189,6 +1188,20 @@ function enforceOptionsForProduction(options) {
|
|
|
1189
1188
|
}
|
|
1190
1189
|
}
|
|
1191
1190
|
}
|
|
1191
|
+
function removeIgnoredOptions(options) {
|
|
1192
|
+
const ignoredCompilerOptions = ["generate", "format", "filename"];
|
|
1193
|
+
if (options.hot && options.emitCss) {
|
|
1194
|
+
ignoredCompilerOptions.push("cssHash");
|
|
1195
|
+
}
|
|
1196
|
+
const passedCompilerOptions = Object.keys(options.compilerOptions || {});
|
|
1197
|
+
const passedIgnored = passedCompilerOptions.filter((o) => ignoredCompilerOptions.includes(o));
|
|
1198
|
+
if (passedIgnored.length) {
|
|
1199
|
+
log.warn(`The following Svelte compilerOptions are controlled by vite-plugin-svelte and essential to its functionality. User-specified values are ignored. Please remove them from your configuration: ${passedIgnored.join(", ")}`);
|
|
1200
|
+
passedIgnored.forEach((ignored) => {
|
|
1201
|
+
delete options.compilerOptions[ignored];
|
|
1202
|
+
});
|
|
1203
|
+
}
|
|
1204
|
+
}
|
|
1192
1205
|
function resolveViteRoot(viteConfig) {
|
|
1193
1206
|
return (0, import_vite3.normalizePath)(viteConfig.root ? import_path4.default.resolve(viteConfig.root) : process.cwd());
|
|
1194
1207
|
}
|
|
@@ -1560,7 +1573,7 @@ function svelteInspector() {
|
|
|
1560
1573
|
disabled = true;
|
|
1561
1574
|
} else {
|
|
1562
1575
|
if (vps.api.options.kit && !inspectorOptions.appendTo) {
|
|
1563
|
-
const out_dir = vps.api.options.kit.outDir || ".svelte-kit";
|
|
1576
|
+
const out_dir = import_path8.default.basename(vps.api.options.kit.outDir || ".svelte-kit");
|
|
1564
1577
|
inspectorOptions.appendTo = `${out_dir}/runtime/client/start.js`;
|
|
1565
1578
|
}
|
|
1566
1579
|
appendTo = inspectorOptions.appendTo;
|