@sveltejs/vite-plugin-svelte 1.0.0-next.46 → 1.0.0-next.47

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 CHANGED
@@ -39,11 +39,12 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
39
39
  // src/index.ts
40
40
  var src_exports = {};
41
41
  __export(src_exports, {
42
+ loadSvelteConfig: () => loadSvelteConfig,
42
43
  svelte: () => svelte
43
44
  });
44
45
  module.exports = __toCommonJS(src_exports);
45
46
 
46
- // ../../node_modules/.pnpm/tsup@5.12.8/node_modules/tsup/assets/cjs_shims.js
47
+ // ../../node_modules/.pnpm/tsup@6.0.1/node_modules/tsup/assets/cjs_shims.js
47
48
  var getImportMetaUrl = () => typeof document === "undefined" ? new URL("file:" + __filename).href : document.currentScript && document.currentScript.src || new URL("main.js", document.baseURI).href;
48
49
  var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
49
50
 
@@ -477,9 +478,9 @@ var knownSvelteConfigNames = [
477
478
  "svelte.config.cjs",
478
479
  "svelte.config.mjs"
479
480
  ];
480
- var dynamicImportDefault = new Function("path", 'return import(path + "?t=" + Date.now()).then(m => m.default)');
481
+ var dynamicImportDefault = new Function("path", "timestamp", 'return import(path + "?t=" + timestamp).then(m => m.default)');
481
482
  async function loadSvelteConfig(viteConfig, inlineOptions) {
482
- if (inlineOptions.configFile === false) {
483
+ if ((inlineOptions == null ? void 0 : inlineOptions.configFile) === false) {
483
484
  return;
484
485
  }
485
486
  const configFile = findConfigToLoad(viteConfig, inlineOptions);
@@ -487,7 +488,7 @@ async function loadSvelteConfig(viteConfig, inlineOptions) {
487
488
  let err;
488
489
  if (configFile.endsWith(".js") || configFile.endsWith(".mjs")) {
489
490
  try {
490
- const result = await dynamicImportDefault((0, import_url.pathToFileURL)(configFile).href);
491
+ const result = await dynamicImportDefault((0, import_url.pathToFileURL)(configFile).href, import_fs.default.statSync(configFile).mtimeMs);
491
492
  if (result != null) {
492
493
  return __spreadProps(__spreadValues({}, result), {
493
494
  configFile
@@ -523,8 +524,8 @@ async function loadSvelteConfig(viteConfig, inlineOptions) {
523
524
  }
524
525
  }
525
526
  function findConfigToLoad(viteConfig, inlineOptions) {
526
- const root = viteConfig.root || process.cwd();
527
- if (inlineOptions.configFile) {
527
+ const root = (viteConfig == null ? void 0 : viteConfig.root) || process.cwd();
528
+ if (inlineOptions == null ? void 0 : inlineOptions.configFile) {
528
529
  const abolutePath = import_path.default.isAbsolute(inlineOptions.configFile) ? inlineOptions.configFile : import_path.default.resolve(root, inlineOptions.configFile);
529
530
  if (!import_fs.default.existsSync(abolutePath)) {
530
531
  throw new Error(`failed to find svelte config file ${abolutePath}.`);
@@ -1778,6 +1779,7 @@ function svelte(inlineOptions) {
1778
1779
  }
1779
1780
  // Annotate the CommonJS export names for ESM import in node:
1780
1781
  0 && (module.exports = {
1782
+ loadSvelteConfig,
1781
1783
  svelte
1782
1784
  });
1783
1785
  //# sourceMappingURL=index.cjs.map