bun-workspaces 1.11.1 → 1.11.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bun-workspaces",
3
- "version": "1.11.1",
3
+ "version": "1.11.2",
4
4
  "description": "A monorepo management tool for Bun, with a CLI and API to enhance Bun's native workspaces.",
5
5
  "license": "MIT",
6
6
  "exports": {
@@ -25,7 +25,11 @@ import {
25
25
  import { createMultiProcessOutput } from "../../../runScript/output/multiProcessOutput.mjs";
26
26
  import { checkIsRecursiveScript } from "../../../runScript/recursion.mjs";
27
27
  import { resolveScriptShell } from "../../../runScript/scriptShellOption.mjs";
28
- import { findWorkspaces, sortWorkspaces } from "../../../workspaces/index.mjs";
28
+ import {
29
+ findWorkspaces,
30
+ parseWorkspacePattern,
31
+ sortWorkspaces,
32
+ } from "../../../workspaces/index.mjs";
29
33
  import { preventDependencyCycles } from "../../../workspaces/dependencyGraph/index.mjs";
30
34
  import { PROJECT_ERRORS } from "../../errors.mjs";
31
35
  import {
@@ -418,10 +422,9 @@ class _FileSystemProject extends ProjectBase {
418
422
  );
419
423
  }
420
424
  const matchedWorkspaces = sortWorkspaces(
421
- (
422
- options.workspacePatterns ??
423
- this.workspaces.map((workspace) => workspace.name)
424
- ).flatMap((pattern) => this.findWorkspacesByPattern(pattern)),
425
+ options.workspacePatterns
426
+ ? this.findWorkspacesByPattern(...options.workspacePatterns)
427
+ : this.workspaces,
425
428
  );
426
429
  let workspaces = matchedWorkspaces
427
430
  .filter(
@@ -442,13 +445,24 @@ class _FileSystemProject extends ProjectBase {
442
445
  return (aScriptConfig.order ?? 0) - (bScriptConfig.order ?? 0);
443
446
  });
444
447
  if (!workspaces.length) {
448
+ const singlePattern =
449
+ options.workspacePatterns?.length === 1
450
+ ? options.workspacePatterns[0]
451
+ : null;
452
+ const parsedSingle = singlePattern
453
+ ? parseWorkspacePattern(singlePattern)
454
+ : null;
445
455
  const isSingleMatchNotFound =
446
- options.workspacePatterns?.length === 1 &&
447
- !options.workspacePatterns[0].includes("*") &&
456
+ parsedSingle !== null &&
457
+ parsedSingle.target === "default" &&
458
+ !parsedSingle.isNegated &&
459
+ !parsedSingle.isRegex &&
460
+ !parsedSingle.isRootSelector &&
461
+ !parsedSingle.value.includes("*") &&
448
462
  !matchedWorkspaces.length;
449
463
  throw new PROJECT_ERRORS.ProjectWorkspaceNotFound(
450
464
  isSingleMatchNotFound
451
- ? `Workspace name or alias not found: ${JSON.stringify(options?.workspacePatterns?.[0])}`
465
+ ? `Workspace name or alias not found: ${JSON.stringify(singlePattern)}`
452
466
  : `No matching workspaces found with script ${JSON.stringify(options.script)}`,
453
467
  );
454
468
  }