@sveltejs/vite-plugin-svelte 1.0.2 → 1.0.5

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
@@ -31,7 +31,7 @@ __export(src_exports, {
31
31
  });
32
32
  module.exports = __toCommonJS(src_exports);
33
33
 
34
- // ../../node_modules/.pnpm/tsup@6.2.2/node_modules/tsup/assets/cjs_shims.js
34
+ // ../../node_modules/.pnpm/tsup@6.2.3/node_modules/tsup/assets/cjs_shims.js
35
35
  var getImportMetaUrl = () => typeof document === "undefined" ? new URL("file:" + __filename).href : document.currentScript && document.currentScript.src || new URL("main.js", document.baseURI).href;
36
36
  var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
37
37
 
@@ -1262,7 +1262,7 @@ async function preResolveOptions(inlineOptions = {}, viteUserConfig, viteEnv) {
1262
1262
  }
1263
1263
  function mergeConfigs(...configs) {
1264
1264
  let result = {};
1265
- for (const config of configs.filter(Boolean)) {
1265
+ for (const config of configs.filter((x) => x != null)) {
1266
1266
  result = (0, import_deepmerge.default)(result, config, {
1267
1267
  arrayMerge: (target, source) => source ?? target
1268
1268
  });
@@ -1751,6 +1751,20 @@ var import_vite4 = require("vite");
1751
1751
  var import_path8 = __toESM(require("path"), 1);
1752
1752
  var import_url2 = require("url");
1753
1753
  var import_fs6 = __toESM(require("fs"), 1);
1754
+
1755
+ // src/ui/inspector/utils.ts
1756
+ var FS_PREFIX = `/@fs/`;
1757
+ var IS_WINDOWS2 = process.platform === "win32";
1758
+ var queryRE = /\?.*$/s;
1759
+ var hashRE = /#.*$/s;
1760
+ function idToFile(id) {
1761
+ if (id.startsWith(FS_PREFIX)) {
1762
+ id = id = id.slice(IS_WINDOWS2 ? FS_PREFIX.length : FS_PREFIX.length - 1);
1763
+ }
1764
+ return id.replace(hashRE, "").replace(queryRE, "");
1765
+ }
1766
+
1767
+ // src/ui/inspector/plugin.ts
1754
1768
  var defaultInspectorOptions = {
1755
1769
  toggleKeyCombo: process.platform === "win32" ? "control-shift" : "meta-shift",
1756
1770
  holdMode: false,
@@ -1811,7 +1825,12 @@ function svelteInspector() {
1811
1825
  if (id === "virtual:svelte-inspector-options") {
1812
1826
  return `export default ${JSON.stringify(inspectorOptions ?? {})}`;
1813
1827
  } else if (id.startsWith(inspectorPath)) {
1814
- return await import_fs6.default.promises.readFile(id, "utf-8");
1828
+ const file = idToFile(id);
1829
+ if (import_fs6.default.existsSync(file)) {
1830
+ return await import_fs6.default.promises.readFile(file, "utf-8");
1831
+ } else {
1832
+ log.error(`failed to find file for svelte-inspector: ${file}, referenced by id ${id}.`);
1833
+ }
1815
1834
  }
1816
1835
  },
1817
1836
  transform(code, id, options) {