nuxt-nightly 4.1.3-29329120.ce0fe6f6 → 4.1.3-29329366.5eb356e7

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.
@@ -56,14 +56,17 @@ ${warnings.map((w) => `- ${w}`).join("\n")}
56
56
  You can use a different key or move the call to a composable to ensure the options are shared across calls.`);
57
57
  }
58
58
  }
59
- const initialFetchOptions = { cause: "initial", dedupe: options.dedupe };
60
- if (!nuxtApp._asyncData[key.value]?._init) {
61
- initialFetchOptions.cachedData = options.getCachedData(key.value, nuxtApp, { cause: "initial" });
62
- nuxtApp._asyncData[key.value] = createAsyncData(nuxtApp, key.value, _handler, options, initialFetchOptions.cachedData);
59
+ function createInitialFetch() {
60
+ const initialFetchOptions = { cause: "initial", dedupe: options.dedupe };
61
+ if (!nuxtApp._asyncData[key.value]?._init) {
62
+ initialFetchOptions.cachedData = options.getCachedData(key.value, nuxtApp, { cause: "initial" });
63
+ nuxtApp._asyncData[key.value] = createAsyncData(nuxtApp, key.value, _handler, options, initialFetchOptions.cachedData);
64
+ }
65
+ return () => nuxtApp._asyncData[key.value].execute(initialFetchOptions);
63
66
  }
67
+ const initialFetch = createInitialFetch();
64
68
  const asyncData = nuxtApp._asyncData[key.value];
65
69
  asyncData._deps++;
66
- const initialFetch = () => nuxtApp._asyncData[key.value].execute(initialFetchOptions);
67
70
  const fetchOnServer = options.server !== false && nuxtApp.payload.serverRendered;
68
71
  if (import.meta.server && fetchOnServer && options.immediate) {
69
72
  const promise = initialFetch();
@@ -120,14 +123,14 @@ You can use a different key or move the call to a composable to ensure the optio
120
123
  keyChanging = true;
121
124
  const hadData = nuxtApp._asyncData[oldKey]?.data.value !== void 0;
122
125
  const wasRunning = nuxtApp._asyncDataPromises[oldKey] !== void 0;
123
- const initialFetchOptions2 = { cause: "initial", dedupe: options.dedupe };
126
+ const initialFetchOptions = { cause: "initial", dedupe: options.dedupe };
124
127
  if (!nuxtApp._asyncData[newKey]?._init) {
125
128
  let initialValue;
126
129
  if (oldKey && hadData) {
127
130
  initialValue = nuxtApp._asyncData[oldKey].data.value;
128
131
  } else {
129
132
  initialValue = options.getCachedData(newKey, nuxtApp, { cause: "initial" });
130
- initialFetchOptions2.cachedData = initialValue;
133
+ initialFetchOptions.cachedData = initialValue;
131
134
  }
132
135
  nuxtApp._asyncData[newKey] = createAsyncData(nuxtApp, newKey, _handler, options, initialValue);
133
136
  }
@@ -136,7 +139,7 @@ You can use a different key or move the call to a composable to ensure the optio
136
139
  unregister(oldKey);
137
140
  }
138
141
  if (options.immediate || hadData || wasRunning) {
139
- nuxtApp._asyncData[newKey].execute(initialFetchOptions2);
142
+ nuxtApp._asyncData[newKey].execute(initialFetchOptions);
140
143
  }
141
144
  queuePostFlushCb(() => {
142
145
  keyChanging = false;
@@ -163,8 +166,14 @@ You can use a different key or move the call to a composable to ensure the optio
163
166
  pending: writableComputedRef(() => nuxtApp._asyncData[key.value]?.pending),
164
167
  status: writableComputedRef(() => nuxtApp._asyncData[key.value]?.status),
165
168
  error: writableComputedRef(() => nuxtApp._asyncData[key.value]?.error),
166
- refresh: (...args2) => nuxtApp._asyncData[key.value].execute(...args2),
167
- execute: (...args2) => nuxtApp._asyncData[key.value].execute(...args2),
169
+ refresh: (...args2) => {
170
+ if (!nuxtApp._asyncData[key.value]?._init) {
171
+ const initialFetch2 = createInitialFetch();
172
+ return initialFetch2();
173
+ }
174
+ return nuxtApp._asyncData[key.value].execute(...args2);
175
+ },
176
+ execute: (...args2) => asyncReturn.refresh(...args2),
168
177
  clear: () => clearNuxtDataByKey(nuxtApp, key.value)
169
178
  };
170
179
  const asyncDataPromise = Promise.resolve(nuxtApp._asyncDataPromises[key.value]).then(() => asyncReturn);
package/dist/index.mjs CHANGED
@@ -3548,7 +3548,7 @@ const componentsModule = defineNuxtModule({
3548
3548
  }
3549
3549
  }
3550
3550
  }, { server: false });
3551
- addBuildPlugin(IslandsTransformPlugin({ getComponents, selectiveClient }), { client: false });
3551
+ addBuildPlugin(IslandsTransformPlugin({ getComponents, selectiveClient }), { client: false, prepend: true });
3552
3552
  if (selectiveClient && nuxt.options.builder === "@nuxt/vite-builder") {
3553
3553
  addVitePlugin(() => ComponentsChunkPlugin({ dev: nuxt.options.dev, getComponents }));
3554
3554
  } else {
@@ -3830,7 +3830,7 @@ function addDeclarationTemplates(ctx, options) {
3830
3830
  });
3831
3831
  }
3832
3832
 
3833
- const version = "4.1.3-29329120.ce0fe6f6";
3833
+ const version = "4.1.3-29329366.5eb356e7";
3834
3834
 
3835
3835
  const createImportProtectionPatterns = (nuxt, options) => {
3836
3836
  const patterns = [];
@@ -4551,18 +4551,13 @@ async function initNitro(nuxt) {
4551
4551
  return nuxt.callHook("prerender:routes", { routes });
4552
4552
  });
4553
4553
  if (nuxt.options.vue.runtimeCompiler) {
4554
- nuxt.hook("vite:extendConfig", (config, { isClient }) => {
4555
- if (isClient) {
4556
- if (Array.isArray(config.resolve.alias)) {
4557
- config.resolve.alias.push({
4558
- find: "vue",
4559
- replacement: "vue/dist/vue.esm-bundler"
4560
- });
4561
- } else {
4562
- config.resolve.alias = {
4563
- ...config.resolve.alias,
4564
- vue: "vue/dist/vue.esm-bundler"
4565
- };
4554
+ addVitePlugin({
4555
+ name: "nuxt:vue:runtime-compiler",
4556
+ applyToEnvironment: (environment) => environment.name === "client",
4557
+ enforce: "pre",
4558
+ resolveId(id, importer) {
4559
+ if (id === "vue") {
4560
+ return this.resolve("vue/dist/vue.esm-bundler", importer, { skipSelf: true });
4566
4561
  }
4567
4562
  }
4568
4563
  });
@@ -5200,24 +5195,24 @@ function detectImportNames(code, composableMeta) {
5200
5195
  const VIRTUAL_RE = /^\0?virtual:(?:nuxt:)?/;
5201
5196
  function ResolveDeepImportsPlugin(nuxt) {
5202
5197
  const exclude = ["virtual:", "\0virtual:", "/__skip_vite", "@vitest/"];
5203
- let conditions;
5198
+ const conditions = {};
5199
+ function resolveConditions(environment) {
5200
+ const resolvedConditions = /* @__PURE__ */ new Set([nuxt.options.dev ? "development" : "production", ...environment.config.resolve.conditions]);
5201
+ if (resolvedConditions.has("browser")) {
5202
+ resolvedConditions.add("web");
5203
+ resolvedConditions.add("import");
5204
+ resolvedConditions.add("module");
5205
+ resolvedConditions.add("default");
5206
+ }
5207
+ if (environment.config.mode === "test") {
5208
+ resolvedConditions.add("import");
5209
+ resolvedConditions.add("require");
5210
+ }
5211
+ return [...resolvedConditions];
5212
+ }
5204
5213
  return {
5205
5214
  name: "nuxt:resolve-bare-imports",
5206
5215
  enforce: "post",
5207
- configResolved(config) {
5208
- const resolvedConditions = /* @__PURE__ */ new Set([nuxt.options.dev ? "development" : "production", ...config.resolve.conditions]);
5209
- if (resolvedConditions.has("browser")) {
5210
- resolvedConditions.add("web");
5211
- resolvedConditions.add("import");
5212
- resolvedConditions.add("module");
5213
- resolvedConditions.add("default");
5214
- }
5215
- if (config.mode === "test") {
5216
- resolvedConditions.add("import");
5217
- resolvedConditions.add("require");
5218
- }
5219
- conditions = [...resolvedConditions];
5220
- },
5221
5216
  async resolveId(id, importer) {
5222
5217
  if (!importer || isAbsolute(id) || !isAbsolute(importer) && !VIRTUAL_RE.test(importer) || exclude.some((e) => id.startsWith(e))) {
5223
5218
  return;
@@ -5239,10 +5234,11 @@ function ResolveDeepImportsPlugin(nuxt) {
5239
5234
  if (res !== void 0 && res !== null) {
5240
5235
  return res;
5241
5236
  }
5237
+ const environmentConditions = conditions[this.environment.name] ||= resolveConditions(this.environment);
5242
5238
  const path = resolveModulePath(id, {
5243
5239
  from: [dir, ...nuxt.options.modulesDir].map((d) => directoryToURL(d)),
5244
5240
  suffixes: ["", "index"],
5245
- conditions,
5241
+ conditions: environmentConditions,
5246
5242
  try: true
5247
5243
  });
5248
5244
  if (!path) {
@@ -5276,28 +5272,31 @@ const runtimeDependencies = [
5276
5272
 
5277
5273
  function ResolveExternalsPlugin(nuxt) {
5278
5274
  let external = /* @__PURE__ */ new Set();
5275
+ const nitro = useNitro();
5279
5276
  return {
5280
5277
  name: "nuxt:resolve-externals",
5281
5278
  enforce: "pre",
5282
- async configResolved() {
5283
- if (!nuxt.options.dev) {
5284
- const { runtimeDependencies: runtimeNitroDependencies = [] } = await tryImportModule("nitropack/runtime/meta", {
5285
- url: new URL(import.meta.url)
5286
- }) || {};
5287
- external = /* @__PURE__ */ new Set([
5288
- // explicit dependencies we use in our ssr renderer - these can be inlined (if necessary) in the nitro build
5289
- "unhead",
5290
- "@unhead/vue",
5291
- "@nuxt/devalue",
5292
- "rou3",
5293
- "unstorage",
5294
- // ensure we only have one version of vue if nitro is going to inline anyway
5295
- ...nuxt._nitro.options.inlineDynamicImports ? ["vue", "@vue/server-renderer"] : [],
5296
- ...runtimeDependencies,
5297
- // dependencies we might share with nitro - these can be inlined (if necessary) in the nitro build
5298
- ...runtimeNitroDependencies
5299
- ]);
5279
+ async applyToEnvironment(environment) {
5280
+ if (nuxt.options.dev || environment.name !== "ssr") {
5281
+ return false;
5300
5282
  }
5283
+ const { runtimeDependencies: runtimeNitroDependencies = [] } = await tryImportModule("nitropack/runtime/meta", {
5284
+ url: new URL(import.meta.url)
5285
+ }) || {};
5286
+ external = /* @__PURE__ */ new Set([
5287
+ // explicit dependencies we use in our ssr renderer - these can be inlined (if necessary) in the nitro build
5288
+ "unhead",
5289
+ "@unhead/vue",
5290
+ "@nuxt/devalue",
5291
+ "rou3",
5292
+ "unstorage",
5293
+ // ensure we only have one version of vue if nitro is going to inline anyway
5294
+ ...nitro.options.inlineDynamicImports ? ["vue", "@vue/server-renderer"] : [],
5295
+ ...runtimeDependencies,
5296
+ // dependencies we might share with nitro - these can be inlined (if necessary) in the nitro build
5297
+ ...runtimeNitroDependencies
5298
+ ]);
5299
+ return true;
5301
5300
  },
5302
5301
  async resolveId(id, importer) {
5303
5302
  if (!external.has(id)) {
@@ -5667,9 +5666,8 @@ Using \`${fallbackCompatibilityDate}\` as fallback. More info at: ${colors.under
5667
5666
  addVitePlugin(() => Object.assign(ImpoundPlugin.vite({ ...nuxtProtectionConfig, error: false }), { name: "nuxt:import-protection" }), { client: false });
5668
5667
  addVitePlugin(() => Object.assign(ImpoundPlugin.vite({ ...nuxtProtectionConfig, error: true }), { name: "nuxt:import-protection" }), { server: false });
5669
5668
  addWebpackPlugin(() => ImpoundPlugin.webpack(nuxtProtectionConfig));
5670
- addVitePlugin(() => ResolveDeepImportsPlugin(nuxt), { client: false });
5671
- addVitePlugin(() => ResolveDeepImportsPlugin(nuxt), { server: false });
5672
- addVitePlugin(() => ResolveExternalsPlugin(nuxt), { client: false, prepend: true });
5669
+ addVitePlugin(() => ResolveDeepImportsPlugin(nuxt));
5670
+ addVitePlugin(() => ResolveExternalsPlugin(nuxt), { prepend: true });
5673
5671
  addBuildPlugin(PrehydrateTransformPlugin({ sourcemap: !!nuxt.options.sourcemap.server || !!nuxt.options.sourcemap.client }));
5674
5672
  if (nuxt.options.experimental.localLayerAliases) {
5675
5673
  addBuildPlugin(LayerAliasingPlugin({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nuxt-nightly",
3
- "version": "4.1.3-29329120.ce0fe6f6",
3
+ "version": "4.1.3-29329366.5eb356e7",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/nuxt/nuxt.git",
@@ -67,10 +67,10 @@
67
67
  "@nuxt/cli": "npm:@nuxt/cli-nightly@latest",
68
68
  "@nuxt/devalue": "^2.0.2",
69
69
  "@nuxt/devtools": "^2.6.5",
70
- "@nuxt/kit": "npm:@nuxt/kit-nightly@4.1.3-29329120.ce0fe6f6",
71
- "@nuxt/schema": "npm:@nuxt/schema-nightly@4.1.3-29329120.ce0fe6f6",
70
+ "@nuxt/kit": "npm:@nuxt/kit-nightly@4.1.3-29329366.5eb356e7",
71
+ "@nuxt/schema": "npm:@nuxt/schema-nightly@4.1.3-29329366.5eb356e7",
72
72
  "@nuxt/telemetry": "^2.6.6",
73
- "@nuxt/vite-builder": "npm:@nuxt/vite-builder-nightly@4.1.3-29329120.ce0fe6f6",
73
+ "@nuxt/vite-builder": "npm:@nuxt/vite-builder-nightly@4.1.3-29329366.5eb356e7",
74
74
  "@unhead/vue": "^2.0.14",
75
75
  "@vue/shared": "^3.5.22",
76
76
  "c12": "^3.3.0",