@sveltejs/vite-plugin-svelte 1.0.0-next.33 → 1.0.0-next.34
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 +112 -64
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +74 -36
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
- package/src/index.ts +5 -0
- package/src/utils/optimizer.ts +43 -0
- package/src/utils/options.ts +1 -0
- package/src/utils/preprocess.ts +2 -1
- package/src/utils/watch.ts +1 -1
package/dist/index.cjs
CHANGED
|
@@ -23,37 +23,42 @@ var __spreadValues = (a, b) => {
|
|
|
23
23
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
24
24
|
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
25
25
|
var __export = (target, all) => {
|
|
26
|
-
__markAsModule(target);
|
|
27
26
|
for (var name in all)
|
|
28
27
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
29
28
|
};
|
|
30
|
-
var __reExport = (target, module2, desc) => {
|
|
29
|
+
var __reExport = (target, module2, copyDefault, desc) => {
|
|
31
30
|
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
32
31
|
for (let key of __getOwnPropNames(module2))
|
|
33
|
-
if (!__hasOwnProp.call(target, key) && key !== "default")
|
|
32
|
+
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
34
33
|
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
35
34
|
}
|
|
36
35
|
return target;
|
|
37
36
|
};
|
|
38
|
-
var
|
|
39
|
-
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default",
|
|
37
|
+
var __toESM = (module2, isNodeMode) => {
|
|
38
|
+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
40
39
|
};
|
|
40
|
+
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
41
|
+
return (module2, temp) => {
|
|
42
|
+
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
43
|
+
};
|
|
44
|
+
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
41
45
|
|
|
42
46
|
// src/index.ts
|
|
43
|
-
|
|
47
|
+
var src_exports = {};
|
|
48
|
+
__export(src_exports, {
|
|
44
49
|
svelte: () => svelte
|
|
45
50
|
});
|
|
46
51
|
|
|
47
|
-
// ../../node_modules/.pnpm/tsup@5.11.
|
|
52
|
+
// ../../node_modules/.pnpm/tsup@5.11.10_typescript@4.5.4/node_modules/tsup/assets/cjs_shims.js
|
|
48
53
|
var getImportMetaUrl = () => typeof document === "undefined" ? new URL("file:" + __filename).href : document.currentScript && document.currentScript.src || new URL("main.js", document.baseURI).href;
|
|
49
54
|
var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
|
|
50
55
|
|
|
51
56
|
// src/index.ts
|
|
52
|
-
var
|
|
57
|
+
var import_fs7 = __toESM(require("fs"), 1);
|
|
53
58
|
|
|
54
59
|
// src/utils/log.ts
|
|
55
|
-
var import_colors =
|
|
56
|
-
var import_debug =
|
|
60
|
+
var import_colors = require("kleur/colors");
|
|
61
|
+
var import_debug = __toESM(require("debug"), 1);
|
|
57
62
|
var levels = ["debug", "info", "warn", "error", "silent"];
|
|
58
63
|
var prefix = "vite-plugin-svelte";
|
|
59
64
|
var loggers = {
|
|
@@ -112,7 +117,7 @@ function _log(logger, message, payload) {
|
|
|
112
117
|
function createLogger(level) {
|
|
113
118
|
const logger = loggers[level];
|
|
114
119
|
const logFn = _log.bind(null, logger);
|
|
115
|
-
const logged = new Set();
|
|
120
|
+
const logged = /* @__PURE__ */ new Set();
|
|
116
121
|
const once = function(message, payload) {
|
|
117
122
|
if (logged.has(message)) {
|
|
118
123
|
return;
|
|
@@ -204,7 +209,7 @@ async function handleHotUpdate(compileSvelte2, ctx, svelteRequest, cache, option
|
|
|
204
209
|
const content = await read();
|
|
205
210
|
const compileData = await compileSvelte2(svelteRequest, content, options);
|
|
206
211
|
cache.update(compileData);
|
|
207
|
-
const affectedModules = new Set();
|
|
212
|
+
const affectedModules = /* @__PURE__ */ new Set();
|
|
208
213
|
const cssModule = server.moduleGraph.getModuleById(svelteRequest.cssId);
|
|
209
214
|
const mainModule = server.moduleGraph.getModuleById(svelteRequest.id);
|
|
210
215
|
const cssUpdated = cssModule && cssChanged(cachedCss, compileData.compiled.css);
|
|
@@ -264,12 +269,12 @@ function normalizeJsCode(code) {
|
|
|
264
269
|
}
|
|
265
270
|
|
|
266
271
|
// src/utils/compile.ts
|
|
267
|
-
var import_compiler =
|
|
268
|
-
var import_svelte_hmr =
|
|
272
|
+
var import_compiler = require("svelte/compiler");
|
|
273
|
+
var import_svelte_hmr = require("svelte-hmr");
|
|
269
274
|
|
|
270
275
|
// src/utils/hash.ts
|
|
271
|
-
var crypto =
|
|
272
|
-
var hashes = Object.create(null);
|
|
276
|
+
var crypto = __toESM(require("crypto"), 1);
|
|
277
|
+
var hashes = /* @__PURE__ */ Object.create(null);
|
|
273
278
|
var hash_length = 12;
|
|
274
279
|
function safeBase64Hash(input) {
|
|
275
280
|
if (hashes[input]) {
|
|
@@ -376,9 +381,9 @@ function createCompileSvelte(options) {
|
|
|
376
381
|
}
|
|
377
382
|
|
|
378
383
|
// src/utils/id.ts
|
|
379
|
-
var import_pluginutils =
|
|
380
|
-
var import_vite =
|
|
381
|
-
var fs =
|
|
384
|
+
var import_pluginutils = require("@rollup/pluginutils");
|
|
385
|
+
var import_vite = require("vite");
|
|
386
|
+
var fs = __toESM(require("fs"), 1);
|
|
382
387
|
var VITE_FS_PREFIX = "/@fs/";
|
|
383
388
|
var IS_WINDOWS = process.platform === "win32";
|
|
384
389
|
function splitId(id) {
|
|
@@ -454,13 +459,13 @@ function buildIdParser(options) {
|
|
|
454
459
|
}
|
|
455
460
|
|
|
456
461
|
// src/utils/options.ts
|
|
457
|
-
var import_vite3 =
|
|
462
|
+
var import_vite3 = require("vite");
|
|
458
463
|
|
|
459
464
|
// src/utils/load-svelte-config.ts
|
|
460
|
-
var import_module =
|
|
461
|
-
var import_path =
|
|
462
|
-
var import_fs =
|
|
463
|
-
var import_url =
|
|
465
|
+
var import_module = require("module");
|
|
466
|
+
var import_path = __toESM(require("path"), 1);
|
|
467
|
+
var import_fs = __toESM(require("fs"), 1);
|
|
468
|
+
var import_url = require("url");
|
|
464
469
|
var esmRequire;
|
|
465
470
|
var knownSvelteConfigNames = [
|
|
466
471
|
"svelte.config.js",
|
|
@@ -549,12 +554,12 @@ var SVELTE_HMR_IMPORTS = [
|
|
|
549
554
|
];
|
|
550
555
|
|
|
551
556
|
// src/utils/options.ts
|
|
552
|
-
var import_path3 =
|
|
557
|
+
var import_path3 = __toESM(require("path"), 1);
|
|
553
558
|
|
|
554
559
|
// src/utils/dependencies.ts
|
|
555
|
-
var import_path2 =
|
|
556
|
-
var import_fs2 =
|
|
557
|
-
var import_module2 =
|
|
560
|
+
var import_path2 = __toESM(require("path"), 1);
|
|
561
|
+
var import_fs2 = __toESM(require("fs"), 1);
|
|
562
|
+
var import_module2 = require("module");
|
|
558
563
|
function findRootSvelteDependencies(root, cwdFallback = true) {
|
|
559
564
|
log.debug(`findSvelteDependencies: searching svelte dependencies in ${root}`);
|
|
560
565
|
const pkgFile = import_path2.default.join(root, "package.json");
|
|
@@ -579,7 +584,7 @@ function findRootSvelteDependencies(root, cwdFallback = true) {
|
|
|
579
584
|
].filter((dep) => !is_common_without_svelte_field(dep));
|
|
580
585
|
return getSvelteDependencies(deps, root);
|
|
581
586
|
}
|
|
582
|
-
function getSvelteDependencies(deps, pkgDir,
|
|
587
|
+
function getSvelteDependencies(deps, pkgDir, path7 = []) {
|
|
583
588
|
const result = [];
|
|
584
589
|
const localRequire = (0, import_module2.createRequire)(`${pkgDir}/package.json`);
|
|
585
590
|
const resolvedDeps = deps.map((dep) => resolveDependencyData(dep, localRequire)).filter(Boolean);
|
|
@@ -587,18 +592,18 @@ function getSvelteDependencies(deps, pkgDir, path6 = []) {
|
|
|
587
592
|
const type = getSvelteDependencyType(pkg);
|
|
588
593
|
if (!type)
|
|
589
594
|
continue;
|
|
590
|
-
result.push({ name: pkg.name, type, pkg, dir, path:
|
|
595
|
+
result.push({ name: pkg.name, type, pkg, dir, path: path7 });
|
|
591
596
|
if (type === "component-library" && pkg.dependencies) {
|
|
592
597
|
let dependencyNames = Object.keys(pkg.dependencies);
|
|
593
|
-
const circular = dependencyNames.filter((name) =>
|
|
598
|
+
const circular = dependencyNames.filter((name) => path7.includes(name));
|
|
594
599
|
if (circular.length > 0) {
|
|
595
|
-
log.warn.enabled && log.warn(`skipping circular svelte dependencies in automated vite optimizeDeps handling`, circular.map((x) =>
|
|
596
|
-
dependencyNames = dependencyNames.filter((name) => !
|
|
600
|
+
log.warn.enabled && log.warn(`skipping circular svelte dependencies in automated vite optimizeDeps handling`, circular.map((x) => path7.concat(x).join(">")));
|
|
601
|
+
dependencyNames = dependencyNames.filter((name) => !path7.includes(name));
|
|
597
602
|
}
|
|
598
|
-
if (
|
|
599
|
-
log.debug.once(`encountered deep svelte dependency tree: ${
|
|
603
|
+
if (path7.length === 3) {
|
|
604
|
+
log.debug.once(`encountered deep svelte dependency tree: ${path7.join(">")}`);
|
|
600
605
|
}
|
|
601
|
-
result.push(...getSvelteDependencies(dependencyNames, dir,
|
|
606
|
+
result.push(...getSvelteDependencies(dependencyNames, dir, path7.concat(pkg.name)));
|
|
602
607
|
}
|
|
603
608
|
}
|
|
604
609
|
return result;
|
|
@@ -705,11 +710,11 @@ function needsOptimization(dep, localRequire) {
|
|
|
705
710
|
}
|
|
706
711
|
|
|
707
712
|
// src/utils/options.ts
|
|
708
|
-
var import_module3 =
|
|
713
|
+
var import_module3 = require("module");
|
|
709
714
|
|
|
710
715
|
// src/utils/esbuild.ts
|
|
711
|
-
var import_fs3 =
|
|
712
|
-
var import_compiler2 =
|
|
716
|
+
var import_fs3 = require("fs");
|
|
717
|
+
var import_compiler2 = require("svelte/compiler");
|
|
713
718
|
|
|
714
719
|
// src/utils/error.ts
|
|
715
720
|
function toRollupError(error) {
|
|
@@ -828,12 +833,12 @@ async function compileSvelte(options, { filename, code }) {
|
|
|
828
833
|
}
|
|
829
834
|
|
|
830
835
|
// src/utils/preprocess.ts
|
|
831
|
-
var import_vite2 =
|
|
832
|
-
var import_magic_string2 =
|
|
833
|
-
var import_compiler3 =
|
|
836
|
+
var import_vite2 = require("vite");
|
|
837
|
+
var import_magic_string2 = __toESM(require("magic-string"), 1);
|
|
838
|
+
var import_compiler3 = require("svelte/compiler");
|
|
834
839
|
|
|
835
840
|
// src/utils/sourcemap.ts
|
|
836
|
-
var import_magic_string =
|
|
841
|
+
var import_magic_string = __toESM(require("magic-string"), 1);
|
|
837
842
|
async function buildMagicString(from, to, options) {
|
|
838
843
|
let diff_match_patch, DIFF_DELETE, DIFF_INSERT;
|
|
839
844
|
try {
|
|
@@ -890,7 +895,8 @@ function createViteScriptPreprocessor() {
|
|
|
890
895
|
loader: lang,
|
|
891
896
|
tsconfigRaw: {
|
|
892
897
|
compilerOptions: {
|
|
893
|
-
importsNotUsedAsValues: "preserve"
|
|
898
|
+
importsNotUsedAsValues: "preserve",
|
|
899
|
+
preserveValueImports: true
|
|
894
900
|
}
|
|
895
901
|
}
|
|
896
902
|
});
|
|
@@ -1054,7 +1060,7 @@ function validateSourceMapOutputWrapper(group, i) {
|
|
|
1054
1060
|
}
|
|
1055
1061
|
|
|
1056
1062
|
// src/utils/options.ts
|
|
1057
|
-
var knownOptions = new Set([
|
|
1063
|
+
var knownOptions = /* @__PURE__ */ new Set([
|
|
1058
1064
|
"configFile",
|
|
1059
1065
|
"include",
|
|
1060
1066
|
"exclude",
|
|
@@ -1108,6 +1114,7 @@ function resolveOptions(preResolveOptions2, viteConfig) {
|
|
|
1108
1114
|
};
|
|
1109
1115
|
const merged = __spreadProps(__spreadValues(__spreadValues({}, defaultOptions), preResolveOptions2), {
|
|
1110
1116
|
compilerOptions: __spreadValues(__spreadValues({}, defaultOptions.compilerOptions), preResolveOptions2.compilerOptions),
|
|
1117
|
+
root: viteConfig.root,
|
|
1111
1118
|
isProduction: viteConfig.isProduction
|
|
1112
1119
|
});
|
|
1113
1120
|
addExtraPreprocessors(merged, viteConfig);
|
|
@@ -1175,16 +1182,16 @@ function buildExtraViteConfig(options, config, configEnv) {
|
|
|
1175
1182
|
extraViteConfig.ssr = buildSSROptionsForSvelte(svelteDeps, options, config);
|
|
1176
1183
|
return extraViteConfig;
|
|
1177
1184
|
}
|
|
1178
|
-
function buildOptimizeDepsForSvelte(svelteDeps, options,
|
|
1185
|
+
function buildOptimizeDepsForSvelte(svelteDeps, options, optimizeDeps2) {
|
|
1179
1186
|
const include = [];
|
|
1180
1187
|
const exclude = ["svelte-hmr"];
|
|
1181
1188
|
const isIncluded = (dep) => {
|
|
1182
1189
|
var _a;
|
|
1183
|
-
return include.includes(dep) || ((_a =
|
|
1190
|
+
return include.includes(dep) || ((_a = optimizeDeps2 == null ? void 0 : optimizeDeps2.include) == null ? void 0 : _a.includes(dep));
|
|
1184
1191
|
};
|
|
1185
1192
|
const isExcluded = (dep) => {
|
|
1186
1193
|
var _a;
|
|
1187
|
-
return exclude.includes(dep) || ((_a =
|
|
1194
|
+
return exclude.includes(dep) || ((_a = optimizeDeps2 == null ? void 0 : optimizeDeps2.exclude) == null ? void 0 : _a.some((id) => dep === id || id.startsWith(`${dep}/`)));
|
|
1188
1195
|
};
|
|
1189
1196
|
if (!isExcluded("svelte")) {
|
|
1190
1197
|
const svelteImportsToInclude = SVELTE_IMPORTS.filter((x) => x !== "svelte/ssr");
|
|
@@ -1250,10 +1257,10 @@ function patchResolvedViteConfig(viteConfig, options) {
|
|
|
1250
1257
|
// src/utils/vite-plugin-svelte-cache.ts
|
|
1251
1258
|
var VitePluginSvelteCache = class {
|
|
1252
1259
|
constructor() {
|
|
1253
|
-
this._css = new Map();
|
|
1254
|
-
this._js = new Map();
|
|
1255
|
-
this._dependencies = new Map();
|
|
1256
|
-
this._dependants = new Map();
|
|
1260
|
+
this._css = /* @__PURE__ */ new Map();
|
|
1261
|
+
this._js = /* @__PURE__ */ new Map();
|
|
1262
|
+
this._dependencies = /* @__PURE__ */ new Map();
|
|
1263
|
+
this._dependants = /* @__PURE__ */ new Map();
|
|
1257
1264
|
}
|
|
1258
1265
|
update(compileData) {
|
|
1259
1266
|
this.updateCSS(compileData);
|
|
@@ -1277,7 +1284,7 @@ var VitePluginSvelteCache = class {
|
|
|
1277
1284
|
const added = dependencies.filter((d) => !prevDependencies.includes(d));
|
|
1278
1285
|
added.forEach((d) => {
|
|
1279
1286
|
if (!this._dependants.has(d)) {
|
|
1280
|
-
this._dependants.set(d, new Set());
|
|
1287
|
+
this._dependants.set(d, /* @__PURE__ */ new Set());
|
|
1281
1288
|
}
|
|
1282
1289
|
this._dependants.get(d).add(compileData.filename);
|
|
1283
1290
|
});
|
|
@@ -1315,15 +1322,15 @@ var VitePluginSvelteCache = class {
|
|
|
1315
1322
|
return this._js.get(svelteRequest.normalizedFilename);
|
|
1316
1323
|
}
|
|
1317
1324
|
}
|
|
1318
|
-
getDependants(
|
|
1319
|
-
const dependants = this._dependants.get(
|
|
1325
|
+
getDependants(path7) {
|
|
1326
|
+
const dependants = this._dependants.get(path7);
|
|
1320
1327
|
return dependants ? [...dependants] : [];
|
|
1321
1328
|
}
|
|
1322
1329
|
};
|
|
1323
1330
|
|
|
1324
1331
|
// src/utils/watch.ts
|
|
1325
|
-
var import_fs4 =
|
|
1326
|
-
var import_path4 =
|
|
1332
|
+
var import_fs4 = __toESM(require("fs"), 1);
|
|
1333
|
+
var import_path4 = __toESM(require("path"), 1);
|
|
1327
1334
|
function setupWatchers(options, cache, requestParser) {
|
|
1328
1335
|
const { server, configFile: svelteConfigFile } = options;
|
|
1329
1336
|
if (!server) {
|
|
@@ -1350,7 +1357,6 @@ function setupWatchers(options, cache, requestParser) {
|
|
|
1350
1357
|
}
|
|
1351
1358
|
};
|
|
1352
1359
|
const triggerViteRestart = (filename) => {
|
|
1353
|
-
var _a;
|
|
1354
1360
|
if (serverConfig.middlewareMode) {
|
|
1355
1361
|
const message = "Svelte config change detected, restart your dev process to apply the changes.";
|
|
1356
1362
|
log.info(message, filename);
|
|
@@ -1360,7 +1366,7 @@ function setupWatchers(options, cache, requestParser) {
|
|
|
1360
1366
|
});
|
|
1361
1367
|
} else {
|
|
1362
1368
|
log.info(`svelte config changed: restarting vite server. - file: ${filename}`);
|
|
1363
|
-
server.restart(
|
|
1369
|
+
server.restart();
|
|
1364
1370
|
}
|
|
1365
1371
|
};
|
|
1366
1372
|
const possibleSvelteConfigs = knownSvelteConfigNames.map((cfg) => import_path4.default.join(root, cfg));
|
|
@@ -1398,9 +1404,9 @@ function ensureWatchedFile(watcher, file, root) {
|
|
|
1398
1404
|
}
|
|
1399
1405
|
|
|
1400
1406
|
// src/utils/resolve.ts
|
|
1401
|
-
var import_path5 =
|
|
1402
|
-
var import_fs5 =
|
|
1403
|
-
var import_require_relative =
|
|
1407
|
+
var import_path5 = __toESM(require("path"), 1);
|
|
1408
|
+
var import_fs5 = __toESM(require("fs"), 1);
|
|
1409
|
+
var import_require_relative = __toESM(require("require-relative"), 1);
|
|
1404
1410
|
function resolveViaPackageJsonSvelte(importee, importer) {
|
|
1405
1411
|
if (importer && isBareImport(importee)) {
|
|
1406
1412
|
const importeePkgFile = import_require_relative.default.resolve(`${importee}/package.json`, import_path5.default.dirname(importer));
|
|
@@ -1425,6 +1431,44 @@ function isBareImport(importee) {
|
|
|
1425
1431
|
}
|
|
1426
1432
|
}
|
|
1427
1433
|
|
|
1434
|
+
// src/utils/optimizer.ts
|
|
1435
|
+
var import_fs6 = __toESM(require("fs"), 1);
|
|
1436
|
+
var import_path6 = __toESM(require("path"), 1);
|
|
1437
|
+
var import_vite4 = require("vite");
|
|
1438
|
+
var PREBUNDLE_SENSITIVE_OPTIONS = [
|
|
1439
|
+
"compilerOptions",
|
|
1440
|
+
"configFile",
|
|
1441
|
+
"experimental",
|
|
1442
|
+
"extensions",
|
|
1443
|
+
"ignorePluginPreprocessors",
|
|
1444
|
+
"preprocess"
|
|
1445
|
+
];
|
|
1446
|
+
async function handleOptimizeDeps(options, viteConfig) {
|
|
1447
|
+
if (!options.experimental.prebundleSvelteLibraries || !viteConfig.cacheDir)
|
|
1448
|
+
return;
|
|
1449
|
+
const viteMetadataPath = import_path6.default.resolve(viteConfig.cacheDir, "_metadata.json");
|
|
1450
|
+
if (!import_fs6.default.existsSync(viteMetadataPath))
|
|
1451
|
+
return;
|
|
1452
|
+
const svelteMetadataPath = import_path6.default.resolve(viteConfig.cacheDir, "_svelte_metadata.json");
|
|
1453
|
+
const currentSvelteMetadata = JSON.stringify(generateSvelteMetadata(options), (_, value) => {
|
|
1454
|
+
return typeof value === "function" ? value.toString() : value;
|
|
1455
|
+
});
|
|
1456
|
+
if (import_fs6.default.existsSync(svelteMetadataPath)) {
|
|
1457
|
+
const existingSvelteMetadata = import_fs6.default.readFileSync(svelteMetadataPath, "utf8");
|
|
1458
|
+
if (existingSvelteMetadata === currentSvelteMetadata)
|
|
1459
|
+
return;
|
|
1460
|
+
}
|
|
1461
|
+
await (0, import_vite4.optimizeDeps)(viteConfig, true);
|
|
1462
|
+
import_fs6.default.writeFileSync(svelteMetadataPath, currentSvelteMetadata);
|
|
1463
|
+
}
|
|
1464
|
+
function generateSvelteMetadata(options) {
|
|
1465
|
+
const metadata = {};
|
|
1466
|
+
for (const key of PREBUNDLE_SENSITIVE_OPTIONS) {
|
|
1467
|
+
metadata[key] = options[key];
|
|
1468
|
+
}
|
|
1469
|
+
return metadata;
|
|
1470
|
+
}
|
|
1471
|
+
|
|
1428
1472
|
// src/index.ts
|
|
1429
1473
|
function svelte(inlineOptions) {
|
|
1430
1474
|
if (process.env.DEBUG != null) {
|
|
@@ -1432,7 +1476,7 @@ function svelte(inlineOptions) {
|
|
|
1432
1476
|
}
|
|
1433
1477
|
validateInlineOptions(inlineOptions);
|
|
1434
1478
|
const cache = new VitePluginSvelteCache();
|
|
1435
|
-
const pkg_export_errors = new Set();
|
|
1479
|
+
const pkg_export_errors = /* @__PURE__ */ new Set();
|
|
1436
1480
|
let requestParser;
|
|
1437
1481
|
let options;
|
|
1438
1482
|
let viteConfig;
|
|
@@ -1460,6 +1504,9 @@ function svelte(inlineOptions) {
|
|
|
1460
1504
|
viteConfig = config;
|
|
1461
1505
|
log.debug("resolved options", options);
|
|
1462
1506
|
},
|
|
1507
|
+
async buildStart() {
|
|
1508
|
+
await handleOptimizeDeps(options, viteConfig);
|
|
1509
|
+
},
|
|
1463
1510
|
configureServer(server) {
|
|
1464
1511
|
options.server = server;
|
|
1465
1512
|
setupWatchers(options, cache, requestParser);
|
|
@@ -1478,7 +1525,7 @@ function svelte(inlineOptions) {
|
|
|
1478
1525
|
}
|
|
1479
1526
|
if (viteConfig.assetsInclude(filename)) {
|
|
1480
1527
|
log.debug(`load returns raw content for ${filename}`);
|
|
1481
|
-
return
|
|
1528
|
+
return import_fs7.default.readFileSync(filename, "utf-8");
|
|
1482
1529
|
}
|
|
1483
1530
|
}
|
|
1484
1531
|
},
|
|
@@ -1574,6 +1621,7 @@ function svelte(inlineOptions) {
|
|
|
1574
1621
|
}
|
|
1575
1622
|
};
|
|
1576
1623
|
}
|
|
1624
|
+
module.exports = __toCommonJS(src_exports);
|
|
1577
1625
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1578
1626
|
0 && (module.exports = {
|
|
1579
1627
|
svelte
|