@visual-check/cli 0.2.1 → 0.2.3

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 (95) hide show
  1. package/dist/affected-stories/affected-stories.d.ts +3 -0
  2. package/dist/affected-stories/affected-stories.d.ts.map +1 -1
  3. package/dist/affected-stories/affected-stories.js +15 -1
  4. package/dist/affected-stories/affected-stories.js.map +1 -1
  5. package/dist/affected-stories/angular-builder.d.ts +33 -0
  6. package/dist/affected-stories/angular-builder.d.ts.map +1 -0
  7. package/dist/affected-stories/angular-builder.js +168 -0
  8. package/dist/affected-stories/angular-builder.js.map +1 -0
  9. package/dist/affected-stories/storybook-rules.d.ts +10 -2
  10. package/dist/affected-stories/storybook-rules.d.ts.map +1 -1
  11. package/dist/affected-stories/storybook-rules.js +18 -2
  12. package/dist/affected-stories/storybook-rules.js.map +1 -1
  13. package/dist/capture/capture-session.d.ts +26 -2
  14. package/dist/capture/capture-session.d.ts.map +1 -1
  15. package/dist/capture/capture-session.js +22 -5
  16. package/dist/capture/capture-session.js.map +1 -1
  17. package/dist/capture/clock-and-random.d.ts +39 -0
  18. package/dist/capture/clock-and-random.d.ts.map +1 -0
  19. package/dist/capture/clock-and-random.js +74 -0
  20. package/dist/capture/clock-and-random.js.map +1 -0
  21. package/dist/capture/driver/cdp/cdp-page.d.ts +5 -0
  22. package/dist/capture/driver/cdp/cdp-page.d.ts.map +1 -1
  23. package/dist/capture/driver/cdp/cdp-page.js +107 -17
  24. package/dist/capture/driver/cdp/cdp-page.js.map +1 -1
  25. package/dist/commands/capture-settings.d.ts +1 -1
  26. package/dist/commands/capture-settings.d.ts.map +1 -1
  27. package/dist/commands/capture-settings.js +2 -0
  28. package/dist/commands/capture-settings.js.map +1 -1
  29. package/dist/commands/network-warning.d.ts.map +1 -1
  30. package/dist/commands/network-warning.js +2 -1
  31. package/dist/commands/network-warning.js.map +1 -1
  32. package/dist/commands/run-cli.d.ts +3 -3
  33. package/dist/commands/run-cli.d.ts.map +1 -1
  34. package/dist/commands/run-cli.js +2 -2
  35. package/dist/commands/run-cli.js.map +1 -1
  36. package/dist/commands/snapshot-result.d.ts +3 -3
  37. package/dist/commands/snapshot-result.d.ts.map +1 -1
  38. package/dist/commands/snapshot-result.js +6 -4
  39. package/dist/commands/snapshot-result.js.map +1 -1
  40. package/dist/config/checks.d.ts +11 -0
  41. package/dist/config/checks.d.ts.map +1 -1
  42. package/dist/config/checks.js +24 -0
  43. package/dist/config/checks.js.map +1 -1
  44. package/dist/config/define-config.d.ts +12 -0
  45. package/dist/config/define-config.d.ts.map +1 -1
  46. package/dist/config/define-config.js.map +1 -1
  47. package/dist/config/resolve-config.d.ts +8 -0
  48. package/dist/config/resolve-config.d.ts.map +1 -1
  49. package/dist/config/resolve-config.js +16 -3
  50. package/dist/config/resolve-config.js.map +1 -1
  51. package/dist/config/story-options.d.ts +10 -0
  52. package/dist/config/story-options.d.ts.map +1 -1
  53. package/dist/config/story-options.js +3 -1
  54. package/dist/config/story-options.js.map +1 -1
  55. package/dist/config/validate-config.d.ts.map +1 -1
  56. package/dist/config/validate-config.js +3 -1
  57. package/dist/config/validate-config.js.map +1 -1
  58. package/dist/init/addon-question.d.ts +0 -4
  59. package/dist/init/addon-question.d.ts.map +1 -1
  60. package/dist/init/addon-question.js +1 -2
  61. package/dist/init/addon-question.js.map +1 -1
  62. package/dist/init/existing-config.d.ts.map +1 -1
  63. package/dist/init/existing-config.js +7 -6
  64. package/dist/init/existing-config.js.map +1 -1
  65. package/dist/init/install.d.ts +5 -3
  66. package/dist/init/install.d.ts.map +1 -1
  67. package/dist/init/install.js +8 -6
  68. package/dist/init/install.js.map +1 -1
  69. package/dist/init/questions.d.ts +5 -1
  70. package/dist/init/questions.d.ts.map +1 -1
  71. package/dist/init/questions.js +2 -2
  72. package/dist/init/questions.js.map +1 -1
  73. package/dist/init/run-init.d.ts +5 -5
  74. package/dist/init/run-init.d.ts.map +1 -1
  75. package/dist/init/run-init.js +20 -18
  76. package/dist/init/run-init.js.map +1 -1
  77. package/dist/init/setup-files.d.ts +14 -4
  78. package/dist/init/setup-files.d.ts.map +1 -1
  79. package/dist/init/setup-files.js +19 -7
  80. package/dist/init/setup-files.js.map +1 -1
  81. package/dist/init/storybook-start.d.ts +19 -0
  82. package/dist/init/storybook-start.d.ts.map +1 -1
  83. package/dist/init/storybook-start.js +9 -2
  84. package/dist/init/storybook-start.js.map +1 -1
  85. package/dist/init/unfollowed-imports.d.ts +91 -0
  86. package/dist/init/unfollowed-imports.d.ts.map +1 -0
  87. package/dist/init/unfollowed-imports.js +223 -0
  88. package/dist/init/unfollowed-imports.js.map +1 -0
  89. package/dist/report/report-document.d.ts +3 -3
  90. package/package.json +3 -3
  91. package/skill/SKILL.md +1 -1
  92. package/dist/init/unlisted-dependencies.d.ts +0 -75
  93. package/dist/init/unlisted-dependencies.d.ts.map +0 -1
  94. package/dist/init/unlisted-dependencies.js +0 -142
  95. package/dist/init/unlisted-dependencies.js.map +0 -1
@@ -20,17 +20,23 @@ export interface ConfigStorybook {
20
20
  */
21
21
  url: string;
22
22
  /**
23
- * The Storybook's package folder, relative to the config's folder. Left out when it is `'.'`.
23
+ * The folder Storybook runs in, relative to the config's folder. Left out when it is `'.'`.
24
24
  */
25
25
  dir?: string;
26
26
  /**
27
27
  * Storybook's config folder, relative to `dir`. Left out when it is `'.storybook'`.
28
28
  */
29
29
  configDir?: string;
30
+ /**
31
+ * The baselines folder, relative to `dir`. Left out when it is `'.visual-check/baselines'`.
32
+ */
33
+ baselines?: string;
30
34
  }
31
35
  /**
32
- * Builds the config entry of a Storybook from where it is: its package folder becomes `dir`, relative to the config's
33
- * folder, and its config folder becomes `configDir`, relative to that package folder.
36
+ * Builds the config entry of a Storybook from where it is: the folder it runs in becomes `dir`, relative to the
37
+ * config's folder, and its config folder becomes `configDir`, relative to `dir`. Its baselines stay in its package
38
+ * folder: when that isn't `dir`, as for an Nx executor that runs Storybook in the workspace root, `baselines` points
39
+ * there, relative to `dir`.
34
40
  */
35
41
  export declare function configStorybookOf(place: {
36
42
  /**
@@ -49,6 +55,10 @@ export declare function configStorybookOf(place: {
49
55
  * The absolute folder of the Storybook's package.
50
56
  */
51
57
  packageDir: string;
58
+ /**
59
+ * The absolute folder Storybook runs in.
60
+ */
61
+ runDir: string;
52
62
  /**
53
63
  * The absolute path of Storybook's config folder.
54
64
  */
@@ -61,7 +71,7 @@ export declare function configStorybookOf(place: {
61
71
  export declare function configEntryOf(storybook: ConfigStorybook): string;
62
72
  /**
63
73
  * Returns the source of `visual-check.config.ts`. It holds only what differs from the defaults: each Storybook's
64
- * `url`, plus its `dir` and `configDir` when they aren't the defaults. Never `platform`, `image` or any other key.
74
+ * `url`, plus its `dir`, `configDir` and `baselines` when they aren't the defaults. Never `platform`, `image` or any other key.
65
75
  */
66
76
  export declare function configSourceOf(storybooks: readonly ConfigStorybook[]): string;
67
77
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"setup-files.d.ts","sourceRoot":"","sources":["../../src/init/setup-files.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,eAAO,MAAM,oBAAoB,qCAAqC,CAAA;AAEtE;;;GAGG;AACH,eAAO,MAAM,eAAe,kgBAW3B,CAAA;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAA;IACZ;;OAEG;IACH,GAAG,EAAE,MAAM,CAAA;IACX;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE;IACvC;;OAEG;IACH,IAAI,EAAE,MAAM,CAAA;IACZ;;OAEG;IACH,GAAG,EAAE,MAAM,CAAA;IACX;;OAEG;IACH,YAAY,EAAE,MAAM,CAAA;IACpB;;OAEG;IACH,UAAU,EAAE,MAAM,CAAA;IAClB;;OAEG;IACH,SAAS,EAAE,M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MAAM,CAAA;IAClB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAA;IACd;;OAEG;IACH,SAAS,EAAE,MAAM,CAAA;CAClB,GAAG,eAAe,CAUlB;AAsDD;;;GAGG;AACH,wBAAgB,aAAa,CAAC,SAAS,EAAE,eAAe,GAAG,MAAM,CAEhE;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,UAAU,EAAE,SAAS,eAAe,EAAE,GAAG,MAAM,CAa7E;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAUlE;AAqDD;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,YAAY,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAevF;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,EAAE,CAe1F"}
@@ -1,5 +1,6 @@
1
1
  import { mkdirSync, readFileSync, writeFileSync } from 'node:fs';
2
2
  import { dirname } from 'node:path';
3
+ import { defaultBaselinesIn } from '../config/resolve-config.js';
3
4
  import { relativePathOf } from './find-storybooks.js';
4
5
  import { dependencyFields, isJsonObject } from './package-manager.js';
5
6
  /**
@@ -23,16 +24,23 @@ export const visualCheck = defineVisualCheck({
23
24
  })
24
25
  `;
25
26
  /**
26
- * Builds the config entry of a Storybook from where it is: its package folder becomes `dir`, relative to the config's
27
- * folder, and its config folder becomes `configDir`, relative to that package folder.
27
+ * The baselines folder the config uses when it sets none, relative to `dir`.
28
+ */
29
+ const defaultBaselines = '.visual-check/baselines';
30
+ /**
31
+ * Builds the config entry of a Storybook from where it is: the folder it runs in becomes `dir`, relative to the
32
+ * config's folder, and its config folder becomes `configDir`, relative to `dir`. Its baselines stay in its package
33
+ * folder: when that isn't `dir`, as for an Nx executor that runs Storybook in the workspace root, `baselines` points
34
+ * there, relative to `dir`.
28
35
  */
29
36
  export function configStorybookOf(place) {
30
- const { name, url, configFolder, packageDir, configDir } = place;
37
+ const { name, url, configFolder, packageDir, runDir, configDir } = place;
31
38
  return {
32
39
  name,
33
40
  url,
34
- dir: relativePathOf(configFolder, packageDir),
35
- configDir: relativePathOf(packageDir, configDir),
41
+ dir: relativePathOf(configFolder, runDir),
42
+ configDir: relativePathOf(runDir, configDir),
43
+ baselines: relativePathOf(runDir, defaultBaselinesIn(packageDir)),
36
44
  };
37
45
  }
38
46
  /**
@@ -60,7 +68,8 @@ function keyOf(name) {
60
68
  }
61
69
  /**
62
70
  * Returns the one-line object literal of a Storybook. The properties come in a fixed order: `dir`, `configDir`,
63
- * `url`. `dir` is left out when it is `'.'` and `configDir` when it is `'.storybook'`, the defaults.
71
+ * `baselines`, `url`. Each is left out when it is the default: `dir` when it is `'.'`, `configDir` when it is
72
+ * `'.storybook'` and `baselines` when it is `'.visual-check/baselines'`.
64
73
  */
65
74
  function storybookLiteralOf(storybook) {
66
75
  const properties = [];
@@ -70,6 +79,9 @@ function storybookLiteralOf(storybook) {
70
79
  if (storybook.configDir !== undefined && storybook.configDir !== '.storybook') {
71
80
  properties.push(`configDir: ${quoted(storybook.configDir)}`);
72
81
  }
82
+ if (storybook.baselines !== undefined && storybook.baselines !== defaultBaselines) {
83
+ properties.push(`baselines: ${quoted(storybook.baselines)}`);
84
+ }
73
85
  properties.push(`url: ${quoted(storybook.url)}`);
74
86
  return `{ ${properties.join(', ')} }`;
75
87
  }
@@ -82,7 +94,7 @@ export function configEntryOf(storybook) {
82
94
  }
83
95
  /**
84
96
  * Returns the source of `visual-check.config.ts`. It holds only what differs from the defaults: each Storybook's
85
- * `url`, plus its `dir` and `configDir` when they aren't the defaults. Never `platform`, `image` or any other key.
97
+ * `url`, plus its `dir`, `configDir` and `baselines` when they aren't the defaults. Never `platform`, `image` or any other key.
86
98
  */
87
99
  export function configSourceOf(storybooks) {
88
100
  const lines = storybooks.map((storybook) => ` ${configEntryOf(storybook)}`);
@@ -1 +1 @@
1
- {"version":3,"file":"setup-files.js","sourceRoot":"","sources":["../../src/init/setup-files.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAChE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAErE;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,kCAAkC,CAAA;AAEtE;;;GAGG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG;;;;;;;;;;;CAW9B,CAAA;AAwBD;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAqBjC;IACC,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,GAAG,KAAK,CAAA;IAEhE,OAAO;QACL,IAAI;QACJ,GAAG;QACH,GAAG,EAAE,cAAc,CAAC,YAAY,EAAE,UAAU,CAAC;QAC7C,SAAS,EAAE,cAAc,CAAC,UAAU,EAAE,SAAS,CAAC;KACjD,CAAA;AACH,CAAC;AAED;;GAEG;AACH,MAAM,iBAAiB,GAAG,4BAA4B,CAAA;AAEtD;;GAEG;AACH,SAAS,MAAM,CAAC,KAAa;IAC3B,MAAM,OAAO,GAAG,KAAK;SAClB,UAAU,CAAC,IAAI,EAAE,MAAM,CAAC;SACxB,UAAU,CAAC,GAAG,EAAE,KAAK,CAAC;SACtB,UAAU,CAAC,IAAI,EAAE,KAAK,CAAC;SACvB,UAAU,CAAC,IAAI,EAAE,KAAK,CAAC;SACvB,UAAU,CAAC,QAAQ,EAAE,SAAS,CAAC;SAC/B,UAAU,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAA;IAElC,OAAO,IAAI,OA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Q,CAAC,CAAA;YACjD,CAAC;YAED,OAAM;QACR,CAAC;IACH,CAAC;AACH,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,UAAU,CAAC,YAAoB,EAAE,OAA+B;IAC9E,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,gBAAgB,CAAC,YAAY,EAAE,mBAAmB,CAAC,CAAA;IAC9E,MAAM,QAAQ,GAAG,YAAY,CAAC,QAAQ,EAAE,YAAY,CAAC,IAAI,EAAE,CAAA;IAC3D,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,CACzC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,IAAI,CAAC,IAAI,QAAQ,CAAC,IAAI,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,CAC7E,CAAA;IAED,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,EAAE,CAAA;IACX,CAAC;IAED,QAAQ,CAAC,OAAO,GAAG,EAAE,GAAG,QAAQ,EAAE,GAAG,OAAO,EAAE,CAAA;IAC9C,iBAAiB,CAAC,YAAY,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAA;IAE/C,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,CAAA;AAChE,CAAC"}
@@ -39,6 +39,11 @@ export type StorybookStart = {
39
39
  * inferred.
40
40
  */
41
41
  port: number | undefined;
42
+ /**
43
+ * Whether `@nx/storybook/plugin` infers the target, which runs `storybook dev` in the project folder. A target in
44
+ * `project.json` runs its executor in the workspace root.
45
+ */
46
+ inferred: boolean;
42
47
  };
43
48
  /**
44
49
  * What `nxStartOf` reads of a package to find how Nx starts one of its Storybooks.
@@ -96,6 +101,20 @@ export declare function nxProjectNameOf(projectJson: unknown): string | undefine
96
101
  * Gives `undefined` when neither starts it.
97
102
  */
98
103
  export declare function nxStartOf(input: NxStartInput): StorybookStart | undefined;
104
+ /**
105
+ * Returns the absolute folder a Storybook runs in, which `index.json`'s `importPath`s are relative to: the workspace
106
+ * root for a `project.json` target, whose executor runs Storybook there, else its package folder.
107
+ */
108
+ export declare function runDirOf(storybook: {
109
+ /**
110
+ * The absolute folder of the Storybook's package.
111
+ */
112
+ packageDir: string;
113
+ /**
114
+ * How the Storybook starts, or `undefined` when nothing found does.
115
+ */
116
+ start: StorybookStart | undefined;
117
+ }, root: string): string;
99
118
  /**
100
119
  * Returns the port a Storybook's start sets: its script call's, or its Nx target's. `undefined` when it sets none, or
101
120
  * there's no start.
@@ -1 +1 @@
1
- {"version":3,"file":"storybook-start.d.ts","sourceRoot":"","sources":["../../src/init/storybook-start.ts"],"names":[],"mappings":"AAEA,OAAO,EAML,KAAK,cAAc,EAGpB,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EAAoB,KAAK,aAAa,EAAc,MAAM,wBAAwB,CAAA;AACzF,OAAO,EAAwB,KAAK,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAErE;;GAEG;AACH,MAAM,MAAM,cAAc,GACtB;IACE;;OAEG;IACH,IAAI,EAAE,QAAQ,CAAA;IACd;;OAEG;IACH,IAAI,EAAE,aAAa,CAAA;IACnB;;OAEG;IACH,UAAU,EAAE,MAAM,CAAA;IAClB;;OAEG;IACH,WAAW,EAAE,MAAM,GAAG,SAAS,CAAA;CAChC,GACD;IACE;;OAEG;IACH,IAAI,EAAE,IAAI,CAAA;IACV;;OAEG;IACH,OAAO,EAAE,MAAM,CAAA;IACf;;OAEG;IACH,MAAM,EAAE,MAAM,CAAA;IACd;;;OAGG;IACH,IAAI,EAAE,MAAM,GAAG,SAAS,CAAA;CACzB,CAAA;AASL;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,WAAW,EAAE,OAAO,CAAA;IACpB;;OAEG;IACH,WAAW,EAA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E;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,YAAY,GAAG,cAAc,GAAG,SAAS,CAqBzE;AAED;;;GAGG;AACH,wBAAgB,QAAQ,CACtB,SAAS,EAAE;IACT;;OAEG;IACH,UAAU,EAAE,MAAM,CAAA;IAClB;;OAEG;IACH,KAAK,EAAE,cAAc,GAAG,SAAS,CAAA;CAClC,EACD,IAAI,EAAE,MAAM,GACX,MAAM,CAER;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,cAAc,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAEjF;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAA;IACZ;;;OAGG;IACH,iBAAiB,EAAE,SAAS,MAAM,EAAE,CAAA;IACpC;;OAEG;IACH,SAAS,EAAE,OAAO,CAAA;CACnB;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE;IACP;;OAEG;IACH,IAAI,EAAE,MAAM,CAAA;IACZ;;OAEG;IACH,SAAS,EAAE,OAAO,CAAA;IAClB;;OAEG;IACH,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,qBAAqB,CAAC,CAAA;CAClD,EACD,cAAc,EAAE,cAAc,GAC7B,cAAc,CAMhB;AA0BD;;;GAGG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,cAAc,EACrB,cAAc,EAAE,cAAc,EAC9B,SAAS,EAAE,cAAc,GACxB,MAAM,CAMR"}
@@ -54,14 +54,21 @@ export function nxStartOf(input) {
54
54
  const options = isJsonObject(target.options) ? target.options : {};
55
55
  const served = typeof options.configDir === 'string' ? tidyFolder(options.configDir) : ownConfigDir;
56
56
  if (served === configDir) {
57
- return { kind: 'nx', project, target: 'storybook', port: portOf(options.port) };
57
+ return { kind: 'nx', project, target: 'storybook', port: portOf(options.port), inferred: false };
58
58
  }
59
59
  }
60
60
  const isProject = isJsonObject(projectJson) || hasManifest;
61
61
  return inferredTarget !== undefined && isProject && configDir === ownConfigDir
62
- ? { kind: 'nx', project, target: inferredTarget, port: undefined }
62
+ ? { kind: 'nx', project, target: inferredTarget, port: undefined, inferred: true }
63
63
  : undefined;
64
64
  }
65
+ /**
66
+ * Returns the absolute folder a Storybook runs in, which `index.json`'s `importPath`s are relative to: the workspace
67
+ * root for a `project.json` target, whose executor runs Storybook there, else its package folder.
68
+ */
69
+ export function runDirOf(storybook, root) {
70
+ return storybook.start?.kind === 'nx' && !storybook.start.inferred ? root : storybook.packageDir;
71
+ }
65
72
  /**
66
73
  * Returns the port a Storybook's start sets: its script call's, or its Nx target's. `undefined` when it sets none, or
67
74
  * there's no start.
@@ -1 +1 @@
1
- {"version":3,"file":"storybook-start.js","sourceRoot":"","sources":["../../src/init/storybook-start.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAA;AACjC,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,EACL,iBAAiB,EACjB,aAAa,EACb,YAAY,EACZ,cAAc,EACd,WAAW,EAEX,yBAAyB,EACzB,kBAAkB,GACnB,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EAAE,gBAAgB,EAAsB,UAAU,EAAE,MAAM,wBAAwB,CAAA;AACzF,OAAO,EAAE,oBAAoB,EAAkB,MAAM,gBAAgB,CAAA;AA4CrE;;GAEG;AACH,SAAS,MAAM,CAAC,KAAc;IAC5B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI,KAAK,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAA;AACjH,CAAC;AAqCD;;GAEG;AACH,MAAM,iBAAiB,GAAG,sBAAsB,CAAA;AAEhD;;;;GAIG;AACH,MAAM,UAAU,yBAAyB,CAAC,MAAe;IAC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EAAE,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC,CAAA;AACrH,CAAC"}
@@ -0,0 +1,91 @@
1
+ /**
2
+ * An import that the affected-stories graph can't follow: a package that isn't installed where it's imported, or an
3
+ * alias that nothing declares.
4
+ */
5
+ export interface UnfollowedImport {
6
+ /**
7
+ * What the code imports, such as `leftpad` or `@/components/Button`.
8
+ */
9
+ specifier: string;
10
+ /**
11
+ * The files that import it, relative to the project root.
12
+ */
13
+ paths: string[];
14
+ }
15
+ /**
16
+ * Finds the imports the affected-stories graph can't follow in the project at `root`. It throws when Fallow can't run.
17
+ *
18
+ * @public
19
+ */
20
+ export type FindUnfollowedImports = (root: string) => Promise<UnfollowedImport[]>;
21
+ /**
22
+ * Tells whether the package `name` is installed where the file at `path` can import it.
23
+ */
24
+ export type IsInstalled = (name: string, path: string) => boolean;
25
+ /**
26
+ * Reads the imports the graph can't follow from the document `fallow dead-code --format json` prints: its unresolved
27
+ * imports that aren't paths, then its unlisted dependencies that aren't installed where they're imported. Fallow counts
28
+ * a package against the importing package's own `package.json`, so a package the workspace root lists and hoists, or a
29
+ * workspace package linked into `node_modules`, counts as unlisted although the graph follows it.
30
+ *
31
+ * @throws {Error} When the document has no `unresolved_imports` or `unlisted_dependencies` array, or an entry is
32
+ * malformed.
33
+ */
34
+ export declare function unfollowedImportsOf(document: unknown, isInstalled: IsInstalled): UnfollowedImport[];
35
+ /**
36
+ * Tells whether the package `name` is installed for the file at `path`, relative to `root`: whether `node_modules`
37
+ * holds it in the file's folder or a folder above it, up to `root`. That's where Node looks, so it covers packages the
38
+ * workspace root hoists and workspace packages linked into `node_modules`. Under Yarn Plug'n'Play there's no
39
+ * `node_modules`, so it finds none.
40
+ */
41
+ export declare function isInstalledIn(root: string): IsInstalled;
42
+ /**
43
+ * What `execFile` rejects with when the process exits with a code, is killed or can't start.
44
+ */
45
+ interface ExecFailure {
46
+ /**
47
+ * What the process wrote to stdout.
48
+ */
49
+ stdout?: string;
50
+ /**
51
+ * What the process wrote to stderr.
52
+ */
53
+ stderr?: string;
54
+ /**
55
+ * The exit code, or a code such as `ENOENT` when the process didn't start.
56
+ */
57
+ code?: number | string;
58
+ /**
59
+ * Whether the timeout killed the process.
60
+ */
61
+ killed?: boolean;
62
+ /**
63
+ * The failure's message.
64
+ */
65
+ message?: string;
66
+ }
67
+ /**
68
+ * Words why a failed run failed: the timeout, Fallow's first line of stderr, or its exit code.
69
+ */
70
+ export declare function fallowFailureOf({ stderr, code, killed, message }: ExecFailure): string;
71
+ /**
72
+ * Asks Fallow for the imports in the project's code that the affected-stories graph can't follow. It runs with
73
+ * `--no-cache`, so Fallow writes no `.fallow/` folder into the project.
74
+ *
75
+ * @throws {Error} With Fallow's own error message when it prints one as JSON, else with its first line of stderr, its
76
+ * exit code or the timeout when its output isn't JSON.
77
+ *
78
+ * @public
79
+ */
80
+ export declare const findUnfollowedImports: FindUnfollowedImports;
81
+ /**
82
+ * Words the warning for imports the graph can't follow, or gives `undefined` when there are none. It names at most
83
+ * three imports, and counts the rest.
84
+ */
85
+ export declare function unfollowedImportsWarningOf(imports: readonly UnfollowedImport[]): string | undefined;
86
+ /**
87
+ * Words the warning for a Fallow that couldn't run.
88
+ */
89
+ export declare function fallowFailureWarningOf(error: unknown): string;
90
+ export {};
91
+ //# sourceMappingURL=unfollowed-imports.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unfollowed-imports.d.ts","sourceRoot":"","sources":["../../src/init/unfollowed-imports.ts"],"names":[],"mappings":"AAQA;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,SAAS,EAAE,MAAM,CAAA;IACjB;;OAEG;IACH,KAAK,EAAE,MAAM,EAAE,CAAA;CAChB;AAED;;;;GAIG;AACH,MAAM,MAAM,qBAAqB,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAAA;AAiBjF;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,OAAO,CAAA;AAqEjE;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,OAAO,EAAE,WAAW,EAAE,WAAW,GAAG,gBAAgB,EAAE,CAenG;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,CAgBvD;AAED;;GAEG;AACH,UAAU,WAAW;IACnB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;IACf;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;IACf;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACtB;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAgBD;;GAEG;AACH,wBAAgB,eAAe,CAAC,EAAE,MAAW,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,WAAW,GAAG,MAAM,CAQ3F;AAiDD;;;;;;;;GAQG;AACH,eAAO,MAAM,qBAAqB,EAAE,qBASnC,CAAA;AAqBD;;;GAGG;AACH,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,SAAS,gBAAgB,EAAE,GAAG,MAAM,GAAG,SAAS,CAkBnG;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAI7D"}
@@ -0,0 +1,223 @@
1
+ import { execFile } from 'node:child_process';
2
+ import { existsSync } from 'node:fs';
3
+ import { createRequire } from 'node:module';
4
+ import { dirname, join, resolve } from 'node:path';
5
+ import { promisify } from 'node:util';
6
+ import { listOf } from './list-of.js';
7
+ import { isJsonObject } from './package-manager.js';
8
+ /**
9
+ * `execFile` that returns a promise.
10
+ */
11
+ const execFileAsync = promisify(execFile);
12
+ /**
13
+ * The most output Fallow may write, in bytes.
14
+ */
15
+ const maxOutputBytes = 256 * 1024 * 1024;
16
+ /**
17
+ * The longest Fallow may run, in milliseconds.
18
+ */
19
+ const timeoutMs = 120_000;
20
+ /**
21
+ * Reads the files from a list of the places a finding is imported. A list that's empty or holds a place without a path
22
+ * throws.
23
+ */
24
+ function pathsOf(sites, finding) {
25
+ const paths = Array.isArray(sites) ? sites.map((site) => (isJsonObject(site) ? site.path : undefined)) : [];
26
+ if (paths.length === 0 || !paths.every((path) => typeof path === 'string')) {
27
+ throw new Error(`Fallow's output holds ${finding} without the files that import it.`);
28
+ }
29
+ return paths;
30
+ }
31
+ /**
32
+ * Reads one entry of Fallow's `unlisted_dependencies` array, keeping the files where the package isn't installed. An
33
+ * entry that isn't a package name with at least one importing file throws.
34
+ */
35
+ function unlistedDependencyOf(entry, isInstalled) {
36
+ if (!isJsonObject(entry) || typeof entry.package_name !== 'string') {
37
+ throw new Error("Fallow's output holds an unlisted dependency in a shape visual-check can't read.");
38
+ }
39
+ const name = entry.package_name;
40
+ const paths = pathsOf(entry.imported_from, 'an unlisted dependency').filter((path) => !isInstalled(name, path));
41
+ return { specifier: name, paths };
42
+ }
43
+ /**
44
+ * Reads one entry of Fallow's `unresolved_imports` array as the specifier and the file that imports it. An entry
45
+ * without both throws.
46
+ */
47
+ function unresolvedImportOf(entry) {
48
+ if (!isJsonObject(entry) || typeof entry.specifier !== 'string' || typeof entry.path !== 'string') {
49
+ throw new Error("Fallow's output holds an unresolved import in a shape visual-check can't read.");
50
+ }
51
+ return { specifier: entry.specifier, paths: [entry.path] };
52
+ }
53
+ /**
54
+ * Tells whether a specifier names a file by its path, such as `./a.js` or `/src/a.js`, rather than a package or an
55
+ * alias. A broken relative import is a typo the build reports, not a hole in the graph.
56
+ */
57
+ function isPathSpecifier(specifier) {
58
+ return specifier.startsWith('.') || specifier.startsWith('/');
59
+ }
60
+ /**
61
+ * Joins the imports that share a specifier into one, in the order each specifier first appears, and leaves out those
62
+ * no file imports.
63
+ */
64
+ function joinedImportsOf(imports) {
65
+ const paths = new Map();
66
+ for (const { specifier, paths: importing } of imports) {
67
+ const known = paths.get(specifier) ?? [];
68
+ paths.set(specifier, [...known, ...importing.filter((path) => !known.includes(path))]);
69
+ }
70
+ return [...paths]
71
+ .filter(([, importing]) => importing.length > 0)
72
+ .map(([specifier, importing]) => ({ specifier, paths: importing }));
73
+ }
74
+ /**
75
+ * Reads the imports the graph can't follow from the document `fallow dead-code --format json` prints: its unresolved
76
+ * imports that aren't paths, then its unlisted dependencies that aren't installed where they're imported. Fallow counts
77
+ * a package against the importing package's own `package.json`, so a package the workspace root lists and hoists, or a
78
+ * workspace package linked into `node_modules`, counts as unlisted although the graph follows it.
79
+ *
80
+ * @throws {Error} When the document has no `unresolved_imports` or `unlisted_dependencies` array, or an entry is
81
+ * malformed.
82
+ */
83
+ export function unfollowedImportsOf(document, isInstalled) {
84
+ if (!isJsonObject(document) ||
85
+ !Array.isArray(document.unresolved_imports) ||
86
+ !Array.isArray(document.unlisted_dependencies)) {
87
+ throw new Error("Fallow's output has no unresolved_imports or unlisted_dependencies list.");
88
+ }
89
+ const unresolved = document.unresolved_imports
90
+ .map(unresolvedImportOf)
91
+ .filter(({ specifier }) => !isPathSpecifier(specifier));
92
+ const unlisted = document.unlisted_dependencies.map((entry) => unlistedDependencyOf(entry, isInstalled));
93
+ return joinedImportsOf([...unresolved, ...unlisted]);
94
+ }
95
+ /**
96
+ * Tells whether the package `name` is installed for the file at `path`, relative to `root`: whether `node_modules`
97
+ * holds it in the file's folder or a folder above it, up to `root`. That's where Node looks, so it covers packages the
98
+ * workspace root hoists and workspace packages linked into `node_modules`. Under Yarn Plug'n'Play there's no
99
+ * `node_modules`, so it finds none.
100
+ */
101
+ export function isInstalledIn(root) {
102
+ const top = resolve(root);
103
+ return (name, path) => {
104
+ let folder = dirname(resolve(top, path));
105
+ while (!existsSync(join(folder, 'node_modules', name))) {
106
+ if (folder === top || dirname(folder) === folder) {
107
+ return false;
108
+ }
109
+ folder = dirname(folder);
110
+ }
111
+ return true;
112
+ };
113
+ }
114
+ /**
115
+ * Words why a failed run failed: the timeout, Fallow's first line of stderr, or its exit code.
116
+ */
117
+ export function fallowFailureOf({ stderr = '', code, killed, message }) {
118
+ if (killed === true) {
119
+ return `Fallow didn't finish within ${timeoutMs / 1000} s.`;
120
+ }
121
+ const firstLine = stderr.split('\n').find((line) => line.trim() !== '');
122
+ return firstLine?.trim() ?? (typeof code === 'number' ? `exit code ${code}` : (message ?? 'it failed'));
123
+ }
124
+ /**
125
+ * Runs Fallow's dead code check for unresolved imports and unlisted dependencies. Fallow exits 1 when it finds anything, so a failing exit
126
+ * still gives its output.
127
+ */
128
+ async function runFallow(root) {
129
+ const bin = createRequire(import.meta.url).resolve('fallow/bin/fallow');
130
+ const args = [
131
+ bin,
132
+ 'dead-code',
133
+ '--unresolved-imports',
134
+ '--unlisted-deps',
135
+ '--format',
136
+ 'json',
137
+ '--no-cache',
138
+ '--root',
139
+ root,
140
+ ];
141
+ try {
142
+ const { stdout } = await execFileAsync(process.execPath, args, {
143
+ cwd: root,
144
+ maxBuffer: maxOutputBytes,
145
+ timeout: timeoutMs,
146
+ windowsHide: true,
147
+ });
148
+ return { stdout, failure: undefined };
149
+ }
150
+ catch (error) {
151
+ const failure = error;
152
+ return { stdout: failure.stdout ?? '', failure: fallowFailureOf(failure) };
153
+ }
154
+ }
155
+ /**
156
+ * Parses what Fallow wrote to stdout.
157
+ *
158
+ * @throws {Error} With `failure` when the text isn't JSON, or with a generic message when Fallow gave no failure.
159
+ */
160
+ function documentOf(stdout, failure) {
161
+ try {
162
+ return JSON.parse(stdout);
163
+ }
164
+ catch {
165
+ throw new Error(failure ?? "Fallow's output isn't JSON.");
166
+ }
167
+ }
168
+ /**
169
+ * Asks Fallow for the imports in the project's code that the affected-stories graph can't follow. It runs with
170
+ * `--no-cache`, so Fallow writes no `.fallow/` folder into the project.
171
+ *
172
+ * @throws {Error} With Fallow's own error message when it prints one as JSON, else with its first line of stderr, its
173
+ * exit code or the timeout when its output isn't JSON.
174
+ *
175
+ * @public
176
+ */
177
+ export const findUnfollowedImports = async (root) => {
178
+ const { stdout, failure } = await runFallow(root);
179
+ const document = documentOf(stdout, failure);
180
+ if (isJsonObject(document) && document.error === true && typeof document.message === 'string') {
181
+ throw new Error(document.message);
182
+ }
183
+ return unfollowedImportsOf(document, isInstalledIn(root));
184
+ };
185
+ /**
186
+ * How many imports the warning names before it counts the rest.
187
+ */
188
+ const namedImportCount = 3;
189
+ /**
190
+ * Names the imports for the warning, each with the first file that imports it: up to three in full, `a in x.js and b
191
+ * in y.js`, and past three the first three and how many more, `a in x.js, b in y.js, c in z.js and 2 more`.
192
+ */
193
+ function importNamesOf(imports) {
194
+ const names = imports.map(({ specifier, paths }) => `${specifier} in ${paths[0]}`);
195
+ if (names.length <= namedImportCount) {
196
+ return listOf(names);
197
+ }
198
+ return `${names.slice(0, namedImportCount).join(', ')} and ${names.length - namedImportCount} more`;
199
+ }
200
+ /**
201
+ * Words the warning for imports the graph can't follow, or gives `undefined` when there are none. It names at most
202
+ * three imports, and counts the rest.
203
+ */
204
+ export function unfollowedImportsWarningOf(imports) {
205
+ if (imports.length === 0) {
206
+ return undefined;
207
+ }
208
+ const names = importNamesOf(imports);
209
+ if (imports.length === 1) {
210
+ return (`Warning: visual-check can't follow the import ${names}, so it can't tell which stories a change behind it ` +
211
+ "affects. If it's an alias, declare it in paths in tsconfig.json. If it's a package, install it.");
212
+ }
213
+ return (`Warning: visual-check can't follow the imports ${names}, so it can't tell which stories a change behind them ` +
214
+ "affects. If they're aliases, declare them in paths in tsconfig.json. If they're packages, install them.");
215
+ }
216
+ /**
217
+ * Words the warning for a Fallow that couldn't run.
218
+ */
219
+ export function fallowFailureWarningOf(error) {
220
+ const message = error instanceof Error ? error.message : String(error);
221
+ return `Warning: Fallow couldn't check the imports: ${message}`;
222
+ }
223
+ //# sourceMappingURL=unfollowed-imports.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unfollowed-imports.js","sourceRoot":"","s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AAc;IACnD,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;IAEtE,OAAO,+CAA+C,OAAO,EAAE,CAAA;AACjE,CAAC"}
@@ -397,9 +397,9 @@ export interface ReportEntryFields {
397
397
  */
398
398
  attempts: number;
399
399
  /**
400
- * How many pixels the first capture of a snapshot that differs or passed on a retry differs by and how many are
401
- * allowed, otherwise `null`. On a size difference `differ` counts the padding too and can be at most `allowed`,
402
- * since the size alone makes it differ.
400
+ * How many pixels the first capture differs by and how many are allowed: for a snapshot that differs, one that
401
+ * passed on a retry, and a baseline `update` wrote because it differed. Otherwise `null`. On a size difference
402
+ * `differ` counts the padding too and can be at most `allowed`, since the size alone makes it differ.
403
403
  */
404
404
  pixels: ReportPixels | null;
405
405
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@visual-check/cli",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -45,7 +45,7 @@
45
45
  "yauzl": "^3.4.0"
46
46
  },
47
47
  "peerDependencies": {
48
- "@visual-check/chromium": "^157.0.0"
48
+ "@visual-check/chromium": "^157.0.0 || ^158.0.0"
49
49
  },
50
50
  "devDependencies": {
51
51
  "@types/node": "22.20.5",
@@ -54,7 +54,7 @@
54
54
  "ink-testing-library": "4.0.0",
55
55
  "typescript": "7.0.2",
56
56
  "vitest": "5.1.0",
57
- "@visual-check/chromium": "157.0.0",
57
+ "@visual-check/chromium": "158.0.0",
58
58
  "@visual-check/typescript-config": "0.0.0"
59
59
  },
60
60
  "scripts": {
package/skill/SKILL.md CHANGED
@@ -74,7 +74,7 @@ While you troubleshoot a broken story, read its entry's console messages (`conso
74
74
  - a stale entry (`staleExpectedPageErrors`): the story no longer raises that page error. Remove the entry, or fix the story when it should still raise it.
75
75
  4. **A real network request** (an entry of `realRequests`), by its `host`: mock the request with MSW, or serve what it fetches from Storybook. A story that reaches the host on purpose sets `realRequests: 'warn'` or `'off'`, and a host every story may reach goes in the config's `silenceHosts`.
76
76
  5. **The remote-content hint** (a `hints` entry of kind `remote-content`), **or `update`'s remote-content warning:** serve the image from Storybook, then mock it with MSW, then mask it by host.
77
- 6. **A flaky snapshot, or a story that moves:** a mask by selector for timers, spinners and skeletons, or a `wait` hook.
77
+ 6. **A flaky snapshot, or a story that moves:** a fixed `clock` or `randomSeed` for today's date or random data, a mask by selector for timers, spinners and skeletons, or a `wait` hook.
78
78
 
79
79
  Options go in `parameters` through the `visualCheck` helper the project exports from `visual-check.ts` in each Storybook's config folder: on a story, on a stories file's meta, or in `preview` for every story.
80
80