vite 8.0.0-beta.0 → 8.0.0-beta.1

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.
@@ -740,6 +740,7 @@ const directSocketHost = __HMR_DIRECT_TARGET__;
740
740
  const base = __BASE__ || "/";
741
741
  const hmrTimeout = __HMR_TIMEOUT__;
742
742
  const wsToken = __WS_TOKEN__;
743
+ const isBundleMode = __BUNDLED_DEV__;
743
744
  const transport = normalizeModuleRunnerTransport((() => {
744
745
  let wsTransport = createWebSocketModuleRunnerTransport({
745
746
  createConnection: () => new WebSocket(`${socketProtocol}://${socketHost}?token=${wsToken}`, "vite-hmr"),
@@ -808,7 +809,14 @@ const pageReload = debounceReload(20);
808
809
  const hmrClient = new HMRClient({
809
810
  error: (err) => console.error("[vite]", err),
810
811
  debug: (...msg) => console.debug("[vite]", ...msg)
811
- }, transport, async function importUpdatedModule({ acceptedPath, timestamp, explicitImportRequired, isWithinCircularImport }) {
812
+ }, transport, isBundleMode ? async function importUpdatedModule({ url, acceptedPath, isWithinCircularImport }) {
813
+ const importPromise = import(base + url).then(() => globalThis.__rolldown_runtime__.loadExports(acceptedPath));
814
+ if (isWithinCircularImport) importPromise.catch(() => {
815
+ console.info(`[hmr] ${acceptedPath} failed to apply HMR as it's within a circular import. Reloading page to reset the execution order. To debug and break the circular import, you can run \`vite --debug hmr\` to log the circular dependency path if a file change triggered it.`);
816
+ pageReload();
817
+ });
818
+ return await importPromise;
819
+ } : async function importUpdatedModule({ acceptedPath, timestamp, explicitImportRequired, isWithinCircularImport }) {
812
820
  const [acceptedPathWithoutQuery, query] = acceptedPath.split(`?`);
813
821
  const importPromise = import(
814
822
  /* @vite-ignore */
@@ -1101,6 +1109,32 @@ function injectQuery(url, queryToInject) {
1101
1109
  const { search, hash } = new URL(url, "http://vite.dev");
1102
1110
  return `${pathname}?${queryToInject}${search ? `&` + search.slice(1) : ""}${hash || ""}`;
1103
1111
  }
1112
+ if (isBundleMode && typeof DevRuntime !== "undefined") {
1113
+ var _ref;
1114
+ class ViteDevRuntime extends DevRuntime {
1115
+ createModuleHotContext(moduleId) {
1116
+ const ctx = createHotContext(moduleId);
1117
+ ctx._internal = {
1118
+ updateStyle,
1119
+ removeStyle
1120
+ };
1121
+ return ctx;
1122
+ }
1123
+ applyUpdates(_boundaries) {}
1124
+ }
1125
+ (_ref = globalThis).__rolldown_runtime__ ?? (_ref.__rolldown_runtime__ = new ViteDevRuntime({ send(message) {
1126
+ switch (message.type) {
1127
+ case "hmr:module-registered":
1128
+ transport.send({
1129
+ type: "custom",
1130
+ event: "vite:module-loaded",
1131
+ data: { modules: message.modules.slice() }
1132
+ });
1133
+ break;
1134
+ default: throw new Error(`Unknown message type: ${JSON.stringify(message)}`);
1135
+ }
1136
+ } }));
1137
+ }
1104
1138
 
1105
1139
  //#endregion
1106
1140
  export { ErrorOverlay, createHotContext, injectQuery, removeStyle, updateStyle };
@@ -1,4 +1,4 @@
1
1
  import "./logger.js";
2
- import { A as builderOptionsDefaults, B as resolveUserExternal, D as ChunkMetadataMap, E as BuildEnvironment, F as resolveBuildEnvironmentOptions, H as toOutputFilePathInHtml, I as resolveBuildOutputs, L as resolveBuildPlugins, M as createToImportMetaURLBasedRelativeRuntime, N as injectEnvironmentToHooks, O as build, P as onRollupLog, R as resolveBuilderOptions, U as toOutputFilePathInJS, V as toOutputFilePathInCss, W as toOutputFilePathWithoutRuntime, j as createBuilder, k as buildEnvironmentOptionsDefaults, z as resolveLibFilename } from "./node.js";
2
+ import { A as createBuilder, B as resolveRolldownOptions, D as buildEnvironmentOptionsDefaults, E as build, F as resolveBuildEnvironmentOptions, G as toOutputFilePathWithoutRuntime, H as toOutputFilePathInCss, I as resolveBuildOutputs, L as resolveBuildPlugins, M as enhanceRollupError, N as injectEnvironmentToHooks, O as builderOptionsDefaults, P as onRollupLog, R as resolveBuilderOptions, T as ChunkMetadataMap, U as toOutputFilePathInHtml, V as resolveUserExternal, W as toOutputFilePathInJS, j as createToImportMetaURLBasedRelativeRuntime, k as clearLine, w as BuildEnvironment, z as resolveLibFilename } from "./node.js";
3
3
 
4
4
  export { createBuilder, resolveBuildPlugins };