vite 8.0.0-beta.0 → 8.0.0-beta.2

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/README.md CHANGED
@@ -9,7 +9,7 @@
9
9
  - 🔩 Universal Plugin Interface
10
10
  - 🔑 Fully Typed APIs
11
11
 
12
- Vite (French word for "fast", pronounced `/vit/`) is a new breed of frontend build tool that significantly improves the frontend development experience. It consists of two major parts:
12
+ Vite (French word for "fast", pronounced `/viːt/`) is a new breed of frontend build tool that significantly improves the frontend development experience. It consists of two major parts:
13
13
 
14
14
  - A dev server that serves your source files over [native ES modules](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules), with [rich built-in features](https://vite.dev/guide/features.html) and astonishingly fast [Hot Module Replacement (HMR)](https://vite.dev/guide/features.html#hot-module-replacement).
15
15
 
@@ -1,6 +1,6 @@
1
1
  import "@vite/env";
2
2
 
3
- //#region \0@oxc-project+runtime@0.101.0/helpers/typeof.js
3
+ //#region \0@oxc-project+runtime@0.102.0/helpers/typeof.js
4
4
  function _typeof(o) {
5
5
  "@babel/helpers - typeof";
6
6
  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o$1) {
@@ -11,7 +11,7 @@ function _typeof(o) {
11
11
  }
12
12
 
13
13
  //#endregion
14
- //#region \0@oxc-project+runtime@0.101.0/helpers/toPrimitive.js
14
+ //#region \0@oxc-project+runtime@0.102.0/helpers/toPrimitive.js
15
15
  function toPrimitive(t, r) {
16
16
  if ("object" != _typeof(t) || !t) return t;
17
17
  var e = t[Symbol.toPrimitive];
@@ -24,14 +24,14 @@ function toPrimitive(t, r) {
24
24
  }
25
25
 
26
26
  //#endregion
27
- //#region \0@oxc-project+runtime@0.101.0/helpers/toPropertyKey.js
27
+ //#region \0@oxc-project+runtime@0.102.0/helpers/toPropertyKey.js
28
28
  function toPropertyKey(t) {
29
29
  var i = toPrimitive(t, "string");
30
30
  return "symbol" == _typeof(i) ? i : i + "";
31
31
  }
32
32
 
33
33
  //#endregion
34
- //#region \0@oxc-project+runtime@0.101.0/helpers/defineProperty.js
34
+ //#region \0@oxc-project+runtime@0.102.0/helpers/defineProperty.js
35
35
  function _defineProperty(e, r, t) {
36
36
  return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
37
37
  value: t,
@@ -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 };