nuxt-nightly 4.1.2-29293780.be49123f → 4.1.2-29293810.0dcc386e

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.
@@ -114,7 +114,7 @@ You can use a different key or move the call to a composable to ensure the optio
114
114
  initialFetch();
115
115
  }
116
116
  const hasScope = getCurrentScope();
117
- const unsubExecute = watch([key, ...options.watch || []], ([newKey], [oldKey]) => {
117
+ const unsubKeyWatcher = watch(key, (newKey, oldKey) => {
118
118
  if ((newKey || oldKey) && newKey !== oldKey) {
119
119
  const hasRun = nuxtApp._asyncData[oldKey]?.data.value !== void 0;
120
120
  const isRunning = nuxtApp._asyncDataPromises[oldKey] !== void 0;
@@ -136,13 +136,16 @@ You can use a different key or move the call to a composable to ensure the optio
136
136
  if (options.immediate || hasRun || isRunning) {
137
137
  nuxtApp._asyncData[newKey].execute(initialFetchOptions2);
138
138
  }
139
- } else {
140
- asyncData._execute({ cause: "watch", dedupe: options.dedupe });
141
139
  }
142
140
  }, { flush: "sync" });
141
+ const unsubWatcher = options.watch ? watch(options.watch, () => {
142
+ asyncData._execute({ cause: "watch", dedupe: options.dedupe });
143
+ }) : () => {
144
+ };
143
145
  if (hasScope) {
144
146
  onScopeDispose(() => {
145
- unsubExecute();
147
+ unsubKeyWatcher();
148
+ unsubWatcher();
146
149
  unregister(key.value);
147
150
  });
148
151
  }
package/dist/index.mjs CHANGED
@@ -2278,9 +2278,6 @@ async function scanComponents(dirs, srcDir) {
2278
2278
  const filePaths = /* @__PURE__ */ new Set();
2279
2279
  const scannedPaths = [];
2280
2280
  for (const dir of dirs) {
2281
- if (dir.enabled === false) {
2282
- continue;
2283
- }
2284
2281
  const resolvedNames = /* @__PURE__ */ new Map();
2285
2282
  const files = (await glob(dir.pattern, { cwd: dir.path, ignore: dir.ignore })).sort();
2286
2283
  if (files.length) {
@@ -3423,8 +3420,6 @@ const componentsModule = defineNuxtModule({
3423
3420
  dirs.push({
3424
3421
  global: moduleOptions.global,
3425
3422
  ...dirOptions,
3426
- // TODO: https://github.com/nuxt/framework/pull/251
3427
- enabled: true,
3428
3423
  path: dirPath,
3429
3424
  extensions,
3430
3425
  pattern: dirOptions.pattern || (extensions.length > 1 ? `**/*.{${extensions.join(",")}}` : `**/*.${extensions[0] || "*"}`),
@@ -3655,26 +3650,11 @@ const importsModule = defineNuxtModule({
3655
3650
  virtualImports: ["#imports"],
3656
3651
  polyfills: true
3657
3652
  }),
3658
- async setup(options, nuxt) {
3653
+ setup(options, nuxt) {
3659
3654
  const presets = JSON.parse(JSON.stringify(options.presets));
3660
3655
  if (options.polyfills) {
3661
3656
  presets.push(...appCompatPresets);
3662
3657
  }
3663
- await nuxt.callHook("imports:sources", presets);
3664
- const { addons: inlineAddons, ...rest } = options;
3665
- const [addons, addonsOptions] = Array.isArray(inlineAddons) ? [inlineAddons] : [[], inlineAddons];
3666
- const ctx = createUnimport({
3667
- injectAtEnd: true,
3668
- ...rest,
3669
- addons: {
3670
- addons,
3671
- vueTemplate: options.autoImport,
3672
- vueDirectives: options.autoImport === false ? void 0 : true,
3673
- ...addonsOptions
3674
- },
3675
- presets
3676
- });
3677
- await nuxt.callHook("imports:context", ctx);
3678
3658
  let composablesDirs = [];
3679
3659
  if (options.scan) {
3680
3660
  for (const layer of nuxt.options._layers) {
@@ -3688,14 +3668,15 @@ const importsModule = defineNuxtModule({
3688
3668
  resolve(layer.config.rootDir, layer.config.dir?.shared ?? "shared", "types")
3689
3669
  );
3690
3670
  for (const dir of layer.config.imports?.dirs ?? []) {
3691
- if (!dir) {
3692
- continue;
3671
+ if (dir) {
3672
+ composablesDirs.push(resolve(layer.config.srcDir, dir));
3693
3673
  }
3694
- composablesDirs.push(resolve(layer.config.srcDir, dir));
3695
3674
  }
3696
3675
  }
3697
- await nuxt.callHook("imports:dirs", composablesDirs);
3698
- composablesDirs = composablesDirs.map((dir) => normalize(dir));
3676
+ nuxt.hook("modules:done", async () => {
3677
+ await nuxt.callHook("imports:dirs", composablesDirs);
3678
+ composablesDirs = composablesDirs.map((dir) => normalize(dir));
3679
+ });
3699
3680
  nuxt.hook("builder:watch", (event, relativePath) => {
3700
3681
  if (!["addDir", "unlinkDir"].includes(event)) {
3701
3682
  return;
@@ -3707,12 +3688,34 @@ const importsModule = defineNuxtModule({
3707
3688
  }
3708
3689
  });
3709
3690
  }
3691
+ let ctx;
3692
+ nuxt.hook("modules:done", async () => {
3693
+ await nuxt.callHook("imports:sources", presets);
3694
+ const { addons: inlineAddons, ...rest } = options;
3695
+ const [addons, addonsOptions] = Array.isArray(inlineAddons) ? [inlineAddons] : [[], inlineAddons];
3696
+ ctx = createUnimport({
3697
+ injectAtEnd: true,
3698
+ ...rest,
3699
+ addons: {
3700
+ addons,
3701
+ vueTemplate: options.autoImport,
3702
+ vueDirectives: options.autoImport === false ? void 0 : true,
3703
+ ...addonsOptions
3704
+ },
3705
+ presets
3706
+ });
3707
+ await nuxt.callHook("imports:context", ctx);
3708
+ });
3710
3709
  addTemplate({
3711
3710
  filename: "imports.mjs",
3712
3711
  getContents: async () => toExports(await ctx.getImports()) + '\nif (import.meta.dev) { console.warn("[nuxt] `#imports` should be transformed with real imports. There seems to be something wrong with the imports plugin.") }'
3713
3712
  });
3714
3713
  nuxt.options.alias["#imports"] = join(nuxt.options.buildDir, "imports");
3715
- addBuildPlugin(TransformPlugin({ ctx, options, sourcemap: !!nuxt.options.sourcemap.server || !!nuxt.options.sourcemap.client }));
3714
+ addBuildPlugin(TransformPlugin({
3715
+ ctx: { injectImports: (code, id, options2) => ctx.injectImports(code, id, options2) },
3716
+ options,
3717
+ sourcemap: !!nuxt.options.sourcemap.server || !!nuxt.options.sourcemap.client
3718
+ }));
3716
3719
  const priorities = getLayerDirectories(nuxt).map((dirs, i) => [dirs.app, -i]).sort(([a], [b]) => b.length - a.length);
3717
3720
  const IMPORTS_TEMPLATE_RE = /\/imports\.(?:d\.ts|mjs)$/;
3718
3721
  function isImportsTemplate(template) {
@@ -3749,8 +3752,11 @@ const importsModule = defineNuxtModule({
3749
3752
  filter: isImportsTemplate
3750
3753
  });
3751
3754
  };
3752
- await regenerateImports();
3753
- addDeclarationTemplates(ctx, options);
3755
+ nuxt.hook("modules:done", () => regenerateImports());
3756
+ addDeclarationTemplates({
3757
+ generateTypeDeclarations: (options2) => ctx.generateTypeDeclarations(options2),
3758
+ getImports: () => ctx.getImports()
3759
+ }, options);
3754
3760
  nuxt.hook("builder:watch", async (_, relativePath) => {
3755
3761
  const path = resolve(nuxt.options.srcDir, relativePath);
3756
3762
  if (options.scan && composablesDirs.some((dir) => dir === path || path.startsWith(dir + "/"))) {
@@ -3816,7 +3822,7 @@ function addDeclarationTemplates(ctx, options) {
3816
3822
  });
3817
3823
  }
3818
3824
 
3819
- const version = "4.1.2-29293780.be49123f";
3825
+ const version = "4.1.2-29293810.0dcc386e";
3820
3826
 
3821
3827
  const createImportProtectionPatterns = (nuxt, options) => {
3822
3828
  const patterns = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nuxt-nightly",
3
- "version": "4.1.2-29293780.be49123f",
3
+ "version": "4.1.2-29293810.0dcc386e",
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.3",
70
- "@nuxt/kit": "npm:@nuxt/kit-nightly@4.1.2-29293780.be49123f",
71
- "@nuxt/schema": "npm:@nuxt/schema-nightly@4.1.2-29293780.be49123f",
70
+ "@nuxt/kit": "npm:@nuxt/kit-nightly@4.1.2-29293810.0dcc386e",
71
+ "@nuxt/schema": "npm:@nuxt/schema-nightly@4.1.2-29293810.0dcc386e",
72
72
  "@nuxt/telemetry": "^2.6.6",
73
- "@nuxt/vite-builder": "npm:@nuxt/vite-builder-nightly@4.1.2-29293780.be49123f",
73
+ "@nuxt/vite-builder": "npm:@nuxt/vite-builder-nightly@4.1.2-29293810.0dcc386e",
74
74
  "@unhead/vue": "^2.0.14",
75
75
  "@vue/shared": "^3.5.21",
76
76
  "c12": "^3.2.0",