@storybook/angular 8.0.0-alpha.11 → 8.0.0-alpha.13

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.
@@ -5,12 +5,12 @@ const rxjs_1 = require("rxjs");
5
5
  const operators_1 = require("rxjs/operators");
6
6
  const find_up_1 = require("find-up");
7
7
  const read_pkg_up_1 = require("read-pkg-up");
8
- const cli_1 = require("@storybook/cli");
8
+ const core_common_1 = require("@storybook/core-common");
9
9
  const telemetry_1 = require("@storybook/telemetry");
10
10
  const core_server_1 = require("@storybook/core-server");
11
11
  const run_compodoc_1 = require("../utils/run-compodoc");
12
12
  const error_handler_1 = require("../utils/error-handler");
13
- (0, telemetry_1.addToGlobalContext)('cliVersion', cli_1.versions.storybook);
13
+ (0, telemetry_1.addToGlobalContext)('cliVersion', core_common_1.versions.storybook);
14
14
  const commandBuilder = (options, context) => {
15
15
  const builder = (0, rxjs_1.from)(setup(options, context)).pipe((0, operators_1.switchMap)(({ tsConfig }) => {
16
16
  const runCompodoc$ = options.compodoc
@@ -18,7 +18,7 @@ const commandBuilder = (options, context) => {
18
18
  : (0, rxjs_1.of)({});
19
19
  return runCompodoc$.pipe((0, operators_1.mapTo)({ tsConfig }));
20
20
  }), (0, operators_1.map)(({ tsConfig }) => {
21
- (0, cli_1.getEnvConfig)(options, {
21
+ (0, core_common_1.getEnvConfig)(options, {
22
22
  staticDir: 'SBCONFIG_STATIC_DIR',
23
23
  outputDir: 'SBCONFIG_OUTPUT_DIR',
24
24
  configDir: 'SBCONFIG_CONFIG_DIR',
@@ -40,7 +40,7 @@ const buildMock = {
40
40
  withTelemetry: (name, options, fn) => fn(),
41
41
  };
42
42
  vitest_1.vi.doMock('@storybook/core-server', () => buildMock);
43
- vitest_1.vi.doMock('@storybook/cli', () => ({
43
+ vitest_1.vi.doMock('@storybook/core-common', () => ({
44
44
  JsPackageManagerFactory: {
45
45
  getPackageManager: () => ({
46
46
  runPackageCommand: mockRunScript,
@@ -5,12 +5,12 @@ const rxjs_1 = require("rxjs");
5
5
  const operators_1 = require("rxjs/operators");
6
6
  const find_up_1 = require("find-up");
7
7
  const read_pkg_up_1 = require("read-pkg-up");
8
- const cli_1 = require("@storybook/cli");
8
+ const core_common_1 = require("@storybook/core-common");
9
9
  const telemetry_1 = require("@storybook/telemetry");
10
10
  const core_server_1 = require("@storybook/core-server");
11
11
  const run_compodoc_1 = require("../utils/run-compodoc");
12
12
  const error_handler_1 = require("../utils/error-handler");
13
- (0, telemetry_1.addToGlobalContext)('cliVersion', cli_1.versions.storybook);
13
+ (0, telemetry_1.addToGlobalContext)('cliVersion', core_common_1.versions.storybook);
14
14
  const commandBuilder = (options, context) => {
15
15
  const builder = (0, rxjs_1.from)(setup(options, context)).pipe((0, operators_1.switchMap)(({ tsConfig }) => {
16
16
  const runCompodoc$ = options.compodoc
@@ -21,7 +21,7 @@ const commandBuilder = (options, context) => {
21
21
  : (0, rxjs_1.of)({});
22
22
  return runCompodoc$.pipe((0, operators_1.mapTo)({ tsConfig }));
23
23
  }), (0, operators_1.map)(({ tsConfig }) => {
24
- (0, cli_1.getEnvConfig)(options, {
24
+ (0, core_common_1.getEnvConfig)(options, {
25
25
  port: 'SBCONFIG_PORT',
26
26
  host: 'SBCONFIG_HOSTNAME',
27
27
  staticDir: 'SBCONFIG_STATIC_DIR',
@@ -42,7 +42,7 @@ const buildMock = {
42
42
  vitest_1.vi.doMock('@storybook/core-server', () => buildMock);
43
43
  vitest_1.vi.doMock('find-up', () => ({ sync: () => './storybook/tsconfig.ts' }));
44
44
  const mockRunScript = vitest_1.vi.fn();
45
- vitest_1.vi.mock('@storybook/cli', () => ({
45
+ vitest_1.vi.mock('@storybook/core-common', () => ({
46
46
  getEnvConfig: (options) => options,
47
47
  versions: {
48
48
  storybook: 'x.x.x',
@@ -26,7 +26,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.runCompodoc = void 0;
27
27
  const rxjs_1 = require("rxjs");
28
28
  const path = __importStar(require("path"));
29
- const cli_1 = require("@storybook/cli");
29
+ const core_common_1 = require("@storybook/core-common");
30
30
  const hasTsConfigArg = (args) => args.indexOf('-p') !== -1;
31
31
  const hasOutputArg = (args) => args.indexOf('-d') !== -1 || args.indexOf('--output') !== -1;
32
32
  // path.relative is necessary to workaround a compodoc issue with
@@ -42,7 +42,7 @@ const runCompodoc = ({ compodocArgs, tsconfig }, context) => {
42
42
  ...(hasOutputArg(compodocArgs) ? [] : ['-d', `${context.workspaceRoot || '.'}`]),
43
43
  ...compodocArgs,
44
44
  ];
45
- const packageManager = cli_1.JsPackageManagerFactory.getPackageManager();
45
+ const packageManager = core_common_1.JsPackageManagerFactory.getPackageManager();
46
46
  try {
47
47
  const stdout = packageManager.runPackageCommandSync('compodoc', finalCompodocArgs, context.workspaceRoot, 'inherit');
48
48
  context.logger.info(stdout);
@@ -5,7 +5,7 @@ const vitest_1 = require("vitest");
5
5
  const operators_1 = require("rxjs/operators");
6
6
  const run_compodoc_1 = require("./run-compodoc");
7
7
  const mockRunScript = vitest_1.vi.fn();
8
- vitest_1.vi.mock('@storybook/cli', () => ({
8
+ vitest_1.vi.mock('@storybook/core-common', () => ({
9
9
  JsPackageManagerFactory: {
10
10
  getPackageManager: () => ({
11
11
  runPackageCommandSync: mockRunScript,
@@ -1,12 +1,13 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  const rxjs_1 = require("rxjs");
7
4
  const vitest_1 = require("vitest");
8
- const node_assert_1 = __importDefault(require("node:assert"));
9
5
  const BootstrapQueue_1 = require("./BootstrapQueue");
6
+ const instantWaitFor = (fn) => {
7
+ return vitest_1.vi.waitFor(fn, {
8
+ interval: 0,
9
+ });
10
+ };
10
11
  (0, vitest_1.describe)('BootstrapQueue', () => {
11
12
  (0, vitest_1.beforeEach)(async () => {
12
13
  vitest_1.vi.spyOn(console, 'log').mockImplementation(() => { });
@@ -23,15 +24,19 @@ const BootstrapQueue_1 = require("./BootstrapQueue");
23
24
  (0, BootstrapQueue_1.queueBootstrapping)(bootstrapApp).then(() => {
24
25
  bootstrapAppFinished();
25
26
  });
26
- await vitest_1.vi.waitFor(() => {
27
- (0, node_assert_1.default)(bootstrapApp.mock.calls.length === 1, 'bootstrapApp should have been called once');
27
+ await instantWaitFor(() => {
28
+ if (bootstrapApp.mock.calls.length !== 1) {
29
+ throw new Error('bootstrapApp should not have been called yet');
30
+ }
28
31
  });
29
32
  (0, vitest_1.expect)(bootstrapApp).toHaveBeenCalled();
30
33
  (0, vitest_1.expect)(bootstrapAppFinished).not.toHaveBeenCalled();
31
34
  pendingSubject.next();
32
35
  pendingSubject.complete();
33
- await vitest_1.vi.waitFor(() => {
34
- (0, node_assert_1.default)(bootstrapAppFinished.mock.calls.length === 1, 'bootstrapApp should have been called once');
36
+ await instantWaitFor(() => {
37
+ if (bootstrapAppFinished.mock.calls.length !== 1) {
38
+ throw new Error('bootstrapApp should have been called once');
39
+ }
35
40
  });
36
41
  (0, vitest_1.expect)(bootstrapAppFinished).toHaveBeenCalled();
37
42
  });
@@ -54,8 +59,10 @@ const BootstrapQueue_1 = require("./BootstrapQueue");
54
59
  (0, BootstrapQueue_1.queueBootstrapping)(bootstrapApp).then(bootstrapAppFinished);
55
60
  (0, BootstrapQueue_1.queueBootstrapping)(bootstrapApp2).then(bootstrapAppFinished2);
56
61
  (0, BootstrapQueue_1.queueBootstrapping)(bootstrapApp3).then(bootstrapAppFinished3);
57
- await vitest_1.vi.waitFor(() => {
58
- (0, node_assert_1.default)(bootstrapApp.mock.calls.length === 1, 'bootstrapApp should have been called once');
62
+ await instantWaitFor(() => {
63
+ if (bootstrapApp.mock.calls.length !== 1) {
64
+ throw new Error('bootstrapApp should have been called once');
65
+ }
59
66
  });
60
67
  (0, vitest_1.expect)(bootstrapApp).toHaveBeenCalled();
61
68
  (0, vitest_1.expect)(bootstrapAppFinished).not.toHaveBeenCalled();
@@ -65,8 +72,10 @@ const BootstrapQueue_1 = require("./BootstrapQueue");
65
72
  (0, vitest_1.expect)(bootstrapAppFinished3).not.toHaveBeenCalled();
66
73
  pendingSubject.next();
67
74
  pendingSubject.complete();
68
- await vitest_1.vi.waitFor(() => {
69
- (0, node_assert_1.default)(bootstrapApp2.mock.calls.length === 1, 'bootstrapApp2 should have been called once');
75
+ await instantWaitFor(() => {
76
+ if (bootstrapApp2.mock.calls.length !== 1) {
77
+ throw new Error('bootstrapApp2 should have been called once');
78
+ }
70
79
  });
71
80
  (0, vitest_1.expect)(bootstrapApp).toHaveReturnedTimes(1);
72
81
  (0, vitest_1.expect)(bootstrapAppFinished).toHaveBeenCalled();
@@ -76,8 +85,10 @@ const BootstrapQueue_1 = require("./BootstrapQueue");
76
85
  (0, vitest_1.expect)(bootstrapAppFinished3).not.toHaveBeenCalled();
77
86
  pendingSubject2.next();
78
87
  pendingSubject2.complete();
79
- await vitest_1.vi.waitFor(() => {
80
- (0, node_assert_1.default)(bootstrapApp3.mock.calls.length === 1, 'bootstrapApp3 should have been called once');
88
+ await instantWaitFor(() => {
89
+ if (bootstrapApp3.mock.calls.length !== 1) {
90
+ throw new Error('bootstrapApp3 should have been called once');
91
+ }
81
92
  });
82
93
  (0, vitest_1.expect)(bootstrapApp).toHaveReturnedTimes(1);
83
94
  (0, vitest_1.expect)(bootstrapAppFinished).toHaveBeenCalled();
@@ -87,8 +98,10 @@ const BootstrapQueue_1 = require("./BootstrapQueue");
87
98
  (0, vitest_1.expect)(bootstrapAppFinished3).not.toHaveBeenCalled();
88
99
  pendingSubject3.next();
89
100
  pendingSubject3.complete();
90
- await vitest_1.vi.waitFor(() => {
91
- (0, node_assert_1.default)(bootstrapAppFinished3.mock.calls.length === 1, 'bootstrapAppFinished3 should have been called once');
101
+ await instantWaitFor(() => {
102
+ if (bootstrapAppFinished3.mock.calls.length !== 1) {
103
+ throw new Error('bootstrapAppFinished3 should have been called once');
104
+ }
92
105
  });
93
106
  (0, vitest_1.expect)(bootstrapApp).toHaveReturnedTimes(1);
94
107
  (0, vitest_1.expect)(bootstrapAppFinished).toHaveBeenCalled();
@@ -112,15 +125,19 @@ const BootstrapQueue_1 = require("./BootstrapQueue");
112
125
  const bootstrapAppError2 = vitest_1.vi.fn();
113
126
  (0, BootstrapQueue_1.queueBootstrapping)(bootstrapApp).then(bootstrapAppFinished).catch(bootstrapAppError);
114
127
  (0, BootstrapQueue_1.queueBootstrapping)(bootstrapApp2).then(bootstrapAppFinished2).catch(bootstrapAppError2);
115
- await vitest_1.vi.waitFor(() => {
116
- (0, node_assert_1.default)(bootstrapApp.mock.calls.length === 1, 'bootstrapApp should have been called once');
128
+ await instantWaitFor(() => {
129
+ if (bootstrapApp.mock.calls.length !== 1) {
130
+ throw new Error('bootstrapApp should have been called once');
131
+ }
117
132
  });
118
133
  (0, vitest_1.expect)(bootstrapApp).toHaveBeenCalledTimes(1);
119
134
  (0, vitest_1.expect)(bootstrapAppFinished).not.toHaveBeenCalled();
120
135
  (0, vitest_1.expect)(bootstrapApp2).not.toHaveBeenCalled();
121
136
  pendingSubject.error(new Error('test error'));
122
- await vitest_1.vi.waitFor(() => {
123
- (0, node_assert_1.default)(bootstrapAppError.mock.calls.length === 1, 'bootstrapAppError should have been called once');
137
+ await instantWaitFor(() => {
138
+ if (bootstrapAppError.mock.calls.length !== 1) {
139
+ throw new Error('bootstrapAppError should have been called once');
140
+ }
124
141
  });
125
142
  (0, vitest_1.expect)(bootstrapApp).toHaveBeenCalledTimes(1);
126
143
  (0, vitest_1.expect)(bootstrapAppFinished).not.toHaveBeenCalled();
@@ -130,8 +147,10 @@ const BootstrapQueue_1 = require("./BootstrapQueue");
130
147
  (0, vitest_1.expect)(bootstrapAppError2).not.toHaveBeenCalled();
131
148
  pendingSubject2.next();
132
149
  pendingSubject2.complete();
133
- await vitest_1.vi.waitFor(() => {
134
- (0, node_assert_1.default)(bootstrapAppFinished2.mock.calls.length === 1, 'bootstrapAppFinished2 should have been called once');
150
+ await instantWaitFor(() => {
151
+ if (bootstrapAppFinished2.mock.calls.length !== 1) {
152
+ throw new Error('bootstrapAppFinished2 should have been called once');
153
+ }
135
154
  });
136
155
  (0, vitest_1.expect)(bootstrapApp).toHaveBeenCalledTimes(1);
137
156
  (0, vitest_1.expect)(bootstrapAppFinished).not.toHaveBeenCalled();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/angular",
3
- "version": "8.0.0-alpha.11",
3
+ "version": "8.0.0-alpha.13",
4
4
  "description": "Storybook for Angular: Develop Angular components in isolation with hot reloading.",
5
5
  "keywords": [
6
6
  "storybook",
@@ -37,19 +37,18 @@
37
37
  "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/tsc.ts"
38
38
  },
39
39
  "dependencies": {
40
- "@storybook/builder-webpack5": "8.0.0-alpha.11",
41
- "@storybook/cli": "8.0.0-alpha.11",
42
- "@storybook/client-logger": "8.0.0-alpha.11",
43
- "@storybook/core-common": "8.0.0-alpha.11",
44
- "@storybook/core-events": "8.0.0-alpha.11",
45
- "@storybook/core-server": "8.0.0-alpha.11",
46
- "@storybook/core-webpack": "8.0.0-alpha.11",
47
- "@storybook/docs-tools": "8.0.0-alpha.11",
40
+ "@storybook/builder-webpack5": "8.0.0-alpha.13",
41
+ "@storybook/client-logger": "8.0.0-alpha.13",
42
+ "@storybook/core-common": "8.0.0-alpha.13",
43
+ "@storybook/core-events": "8.0.0-alpha.13",
44
+ "@storybook/core-server": "8.0.0-alpha.13",
45
+ "@storybook/core-webpack": "8.0.0-alpha.13",
46
+ "@storybook/docs-tools": "8.0.0-alpha.13",
48
47
  "@storybook/global": "^5.0.0",
49
- "@storybook/node-logger": "8.0.0-alpha.11",
50
- "@storybook/preview-api": "8.0.0-alpha.11",
51
- "@storybook/telemetry": "8.0.0-alpha.11",
52
- "@storybook/types": "8.0.0-alpha.11",
48
+ "@storybook/node-logger": "8.0.0-alpha.13",
49
+ "@storybook/preview-api": "8.0.0-alpha.13",
50
+ "@storybook/telemetry": "8.0.0-alpha.13",
51
+ "@storybook/types": "8.0.0-alpha.13",
53
52
  "@types/node": "^18.0.0",
54
53
  "@types/react": "^18.0.37",
55
54
  "@types/react-dom": "^18.0.11",