@sveltejs/vite-plugin-svelte 1.0.0-next.39 → 1.0.0-next.40
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 +13 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +12 -5
- package/dist/index.js.map +1 -1
- package/package.json +8 -8
- package/src/index.ts +1 -1
- package/src/utils/options.ts +23 -7
package/dist/index.cjs
CHANGED
|
@@ -49,7 +49,7 @@ __export(src_exports, {
|
|
|
49
49
|
svelte: () => svelte
|
|
50
50
|
});
|
|
51
51
|
|
|
52
|
-
// ../../node_modules/.pnpm/tsup@5.
|
|
52
|
+
// ../../node_modules/.pnpm/tsup@5.12.1_typescript@4.6.2/node_modules/tsup/assets/cjs_shims.js
|
|
53
53
|
var getImportMetaUrl = () => typeof document === "undefined" ? new URL("file:" + __filename).href : document.currentScript && document.currentScript.src || new URL("main.js", document.baseURI).href;
|
|
54
54
|
var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
|
|
55
55
|
|
|
@@ -1194,7 +1194,7 @@ function enforceOptionsForProduction(options) {
|
|
|
1194
1194
|
function resolveViteRoot(viteConfig) {
|
|
1195
1195
|
return (0, import_vite3.normalizePath)(viteConfig.root ? import_path3.default.resolve(viteConfig.root) : process.cwd());
|
|
1196
1196
|
}
|
|
1197
|
-
function buildExtraViteConfig(options, config
|
|
1197
|
+
function buildExtraViteConfig(options, config) {
|
|
1198
1198
|
const svelteDeps = findRootSvelteDependencies(options.root);
|
|
1199
1199
|
const extraViteConfig = {
|
|
1200
1200
|
resolve: {
|
|
@@ -1202,10 +1202,10 @@ function buildExtraViteConfig(options, config, configEnv) {
|
|
|
1202
1202
|
dedupe: [...SVELTE_IMPORTS, ...SVELTE_HMR_IMPORTS]
|
|
1203
1203
|
}
|
|
1204
1204
|
};
|
|
1205
|
-
if (
|
|
1205
|
+
if (options.isServe) {
|
|
1206
1206
|
extraViteConfig.optimizeDeps = buildOptimizeDepsForSvelte(svelteDeps, options, config.optimizeDeps);
|
|
1207
1207
|
}
|
|
1208
|
-
extraViteConfig.ssr = buildSSROptionsForSvelte(svelteDeps, options, config);
|
|
1208
|
+
extraViteConfig.ssr = buildSSROptionsForSvelte(svelteDeps, options, config, extraViteConfig);
|
|
1209
1209
|
return extraViteConfig;
|
|
1210
1210
|
}
|
|
1211
1211
|
function buildOptimizeDepsForSvelte(svelteDeps, options, optimizeDeps2) {
|
|
@@ -1268,9 +1268,16 @@ function buildSSROptionsForSvelte(svelteDeps, options, config) {
|
|
|
1268
1268
|
var _a2, _b2, _c2, _d;
|
|
1269
1269
|
return !((_b2 = (_a2 = config.ssr) == null ? void 0 : _a2.external) == null ? void 0 : _b2.includes(x)) && !((_d = (_c2 = config.optimizeDeps) == null ? void 0 : _c2.include) == null ? void 0 : _d.includes(x));
|
|
1270
1270
|
}));
|
|
1271
|
-
|
|
1271
|
+
const ssr = {
|
|
1272
1272
|
noExternal
|
|
1273
1273
|
};
|
|
1274
|
+
if (options.isServe) {
|
|
1275
|
+
ssr.external = Array.from(new Set(svelteDeps.flatMap((dep) => Object.keys(dep.pkg.dependencies || {})))).filter((dep) => {
|
|
1276
|
+
var _a2, _b2, _c2, _d;
|
|
1277
|
+
return !ssr.noExternal.includes(dep) && !((_b2 = (_a2 = config.ssr) == null ? void 0 : _a2.noExternal) == null ? void 0 : _b2.includes(dep)) && !((_d = (_c2 = config.ssr) == null ? void 0 : _c2.external) == null ? void 0 : _d.includes(dep));
|
|
1278
|
+
});
|
|
1279
|
+
}
|
|
1280
|
+
return ssr;
|
|
1274
1281
|
}
|
|
1275
1282
|
function patchResolvedViteConfig(viteConfig, options) {
|
|
1276
1283
|
var _a, _b;
|
|
@@ -1546,7 +1553,7 @@ function svelte(inlineOptions) {
|
|
|
1546
1553
|
log.setLevel(config.logLevel);
|
|
1547
1554
|
}
|
|
1548
1555
|
options = await preResolveOptions(inlineOptions, config, configEnv);
|
|
1549
|
-
const extraViteConfig = buildExtraViteConfig(options, config
|
|
1556
|
+
const extraViteConfig = buildExtraViteConfig(options, config);
|
|
1550
1557
|
log.debug("additional vite config", extraViteConfig);
|
|
1551
1558
|
return extraViteConfig;
|
|
1552
1559
|
},
|