nuxt-nightly 4.1.2-29293231.4568e845 → 4.1.2-29293260.327ba8f5

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.
Files changed (2) hide show
  1. package/dist/index.mjs +61 -41
  2. package/package.json +4 -4
package/dist/index.mjs CHANGED
@@ -3355,7 +3355,7 @@ const componentsModule = defineNuxtModule({
3355
3355
  defaults: {
3356
3356
  dirs: []
3357
3357
  },
3358
- async setup(componentOptions, nuxt) {
3358
+ async setup(moduleOptions, nuxt) {
3359
3359
  let componentDirs = [];
3360
3360
  const context = {
3361
3361
  components: []
@@ -3367,52 +3367,40 @@ const componentsModule = defineNuxtModule({
3367
3367
  addBuildPlugin(ComponentNamePlugin({ sourcemap: !!nuxt.options.sourcemap.client, getComponents }), { server: false });
3368
3368
  addBuildPlugin(ComponentNamePlugin({ sourcemap: !!nuxt.options.sourcemap.server, getComponents }), { client: false });
3369
3369
  }
3370
- const normalizeDirs = (dir, cwd, options) => {
3371
- if (Array.isArray(dir)) {
3372
- return dir.map((dir2) => normalizeDirs(dir2, cwd, options)).flat().sort(compareDirByPathLength);
3373
- }
3374
- if (dir === true || dir === void 0) {
3375
- return [
3376
- { priority: options?.priority || 0, path: resolve(cwd, "components/islands"), island: true },
3377
- { priority: options?.priority || 0, path: resolve(cwd, "components/global"), global: true },
3378
- { priority: options?.priority || 0, path: resolve(cwd, "components") }
3379
- ];
3380
- }
3381
- if (typeof dir === "string") {
3382
- return [
3383
- { priority: options?.priority || 0, path: resolve(cwd, resolveAlias$1(dir)) }
3384
- ];
3385
- }
3386
- if (!dir) {
3387
- return [];
3388
- }
3389
- const dirs = (dir.dirs || [dir]).map((dir2) => typeof dir2 === "string" ? { path: dir2 } : dir2).filter((_dir) => _dir.path);
3390
- return dirs.map((_dir) => ({
3391
- priority: options?.priority || 0,
3392
- ..._dir,
3393
- path: resolve(cwd, resolveAlias$1(_dir.path))
3394
- }));
3395
- };
3396
3370
  nuxt.hook("app:resolve", async () => {
3397
- const allDirs = nuxt.options._layers.map((layer) => normalizeDirs(layer.config.components, layer.config.srcDir, { priority: layer.config.srcDir === nuxt.options.srcDir ? 1 : 0 })).flat();
3371
+ const allDirs = [];
3372
+ for (const layer of nuxt.options._layers) {
3373
+ const layerDirs = normalizeDirs(layer.config.components, layer.config.srcDir, { priority: layer.config.srcDir === nuxt.options.srcDir ? 1 : 0 });
3374
+ allDirs.push(...layerDirs);
3375
+ }
3398
3376
  await nuxt.callHook("components:dirs", allDirs);
3399
- componentDirs = allDirs.filter(isPureObjectOrString).map((dir) => {
3377
+ const userComponentDirs = [];
3378
+ const libraryComponentDirs = [];
3379
+ for (const dir of allDirs) {
3380
+ if (!isPureObjectOrString(dir)) {
3381
+ continue;
3382
+ }
3400
3383
  const dirOptions = typeof dir === "object" ? dir : { path: dir };
3401
3384
  const dirPath = resolveAlias$1(dirOptions.path);
3402
- const transpile = typeof dirOptions.transpile === "boolean" ? dirOptions.transpile : "auto";
3403
3385
  const extensions = (dirOptions.extensions || nuxt.options.extensions).map((e) => e.replace(STARTER_DOT_RE, ""));
3386
+ const _transpile = typeof dirOptions.transpile === "boolean" ? dirOptions.transpile : "auto";
3387
+ const transpile = _transpile === "auto" ? dirPath.includes("node_modules") : _transpile;
3388
+ if (transpile) {
3389
+ nuxt.options.build.transpile.push(dirPath);
3390
+ }
3404
3391
  const present = isDirectory(dirPath);
3405
3392
  if (!present && !DEFAULT_COMPONENTS_DIRS_RE.test(dirOptions.path)) {
3406
3393
  logger.warn("Components directory not found: `" + dirPath + "`");
3407
3394
  }
3408
- return {
3409
- global: componentOptions.global,
3395
+ const dirs = dirPath.includes("node_modules") ? libraryComponentDirs : userComponentDirs;
3396
+ dirs.push({
3397
+ global: moduleOptions.global,
3410
3398
  ...dirOptions,
3411
3399
  // TODO: https://github.com/nuxt/framework/pull/251
3412
3400
  enabled: true,
3413
3401
  path: dirPath,
3414
3402
  extensions,
3415
- pattern: dirOptions.pattern || `**/*.{${extensions.join(",")},}`,
3403
+ pattern: dirOptions.pattern || (extensions.length > 1 ? `**/*.{${extensions.join(",")}}` : `**/*.${extensions[0] || "*"}`),
3416
3404
  ignore: [
3417
3405
  "**/*{M,.m,-m}ixin.{js,ts,jsx,tsx}",
3418
3406
  // ignore mixins
@@ -3420,21 +3408,20 @@ const componentsModule = defineNuxtModule({
3420
3408
  // .d.ts files
3421
3409
  ...dirOptions.ignore || []
3422
3410
  ],
3423
- transpile: transpile === "auto" ? dirPath.includes("node_modules") : transpile
3424
- };
3425
- }).filter((d) => d.enabled);
3411
+ transpile
3412
+ });
3413
+ }
3426
3414
  componentDirs = [
3427
- ...componentDirs.filter((dir) => !dir.path.includes("node_modules")),
3428
- ...componentDirs.filter((dir) => dir.path.includes("node_modules"))
3415
+ ...userComponentDirs,
3416
+ ...libraryComponentDirs
3429
3417
  ];
3430
- nuxt.options.build.transpile.push(...componentDirs.filter((dir) => dir.transpile).map((dir) => dir.path));
3431
3418
  });
3432
3419
  addTemplate(componentsDeclarationTemplate);
3433
3420
  addTypeTemplate(componentsTypeTemplate);
3434
3421
  addPluginTemplate(componentsPluginTemplate);
3435
3422
  addTemplate(componentNamesTemplate);
3436
3423
  addTemplate({ ...componentsIslandsTemplate, filename: "components.islands.mjs" });
3437
- if (componentOptions.generateMetadata) {
3424
+ if (moduleOptions.generateMetadata) {
3438
3425
  addTemplate(componentsMetadataTemplate);
3439
3426
  }
3440
3427
  const serverComponentRuntime = await findPath(join(distDir, "components/runtime/server-component")) ?? join(distDir, "components/runtime/server-component");
@@ -3543,6 +3530,39 @@ const componentsModule = defineNuxtModule({
3543
3530
  }
3544
3531
  }
3545
3532
  });
3533
+ function normalizeDirs(dir, cwd, options) {
3534
+ if (Array.isArray(dir)) {
3535
+ return dir.map((dir2) => normalizeDirs(dir2, cwd, options)).flat().sort(compareDirByPathLength);
3536
+ }
3537
+ if (dir === true || dir === void 0) {
3538
+ return [
3539
+ { priority: options?.priority || 0, path: resolve(cwd, "components/islands"), island: true },
3540
+ { priority: options?.priority || 0, path: resolve(cwd, "components/global"), global: true },
3541
+ { priority: options?.priority || 0, path: resolve(cwd, "components") }
3542
+ ];
3543
+ }
3544
+ if (typeof dir === "string") {
3545
+ return [
3546
+ { priority: options?.priority || 0, path: resolve(cwd, resolveAlias$1(dir)) }
3547
+ ];
3548
+ }
3549
+ if (!dir) {
3550
+ return [];
3551
+ }
3552
+ const normalizedDirs = [];
3553
+ for (const d of "dirs" in dir ? dir.dirs || [] : [dir]) {
3554
+ const normalizedDir = typeof d === "string" ? { path: d } : d;
3555
+ if (!normalizedDir.path) {
3556
+ continue;
3557
+ }
3558
+ normalizedDirs.push({
3559
+ priority: options?.priority || 0,
3560
+ ...normalizedDir,
3561
+ path: resolve(cwd, resolveAlias$1(normalizedDir.path))
3562
+ });
3563
+ }
3564
+ return normalizedDirs.sort(compareDirByPathLength);
3565
+ }
3546
3566
 
3547
3567
  const NODE_MODULES_RE$1 = /[\\/]node_modules[\\/]/;
3548
3568
  const IMPORTS_RE = /(['"])#imports\1/;
@@ -3769,7 +3789,7 @@ function addDeclarationTemplates(ctx, options) {
3769
3789
  });
3770
3790
  }
3771
3791
 
3772
- const version = "4.1.2-29293231.4568e845";
3792
+ const version = "4.1.2-29293260.327ba8f5";
3773
3793
 
3774
3794
  const createImportProtectionPatterns = (nuxt, options) => {
3775
3795
  const patterns = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nuxt-nightly",
3
- "version": "4.1.2-29293231.4568e845",
3
+ "version": "4.1.2-29293260.327ba8f5",
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-29293231.4568e845",
71
- "@nuxt/schema": "npm:@nuxt/schema-nightly@4.1.2-29293231.4568e845",
70
+ "@nuxt/kit": "npm:@nuxt/kit-nightly@4.1.2-29293260.327ba8f5",
71
+ "@nuxt/schema": "npm:@nuxt/schema-nightly@4.1.2-29293260.327ba8f5",
72
72
  "@nuxt/telemetry": "^2.6.6",
73
- "@nuxt/vite-builder": "npm:@nuxt/vite-builder-nightly@4.1.2-29293231.4568e845",
73
+ "@nuxt/vite-builder": "npm:@nuxt/vite-builder-nightly@4.1.2-29293260.327ba8f5",
74
74
  "@unhead/vue": "^2.0.14",
75
75
  "@vue/shared": "^3.5.21",
76
76
  "c12": "^3.2.0",