@storybook/angular-vite 10.6.0-alpha.7 → 10.6.0-alpha.8
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/dist/_node-chunks/{chunk-QNPJ2GGJ.js → chunk-5GTDRCMW.js} +18 -8
- package/dist/_node-chunks/{chunk-V7GJH7LA.js → chunk-DQYSVBAE.js} +7 -7
- package/dist/_node-chunks/{chunk-GWJVWZ3H.js → chunk-FLU3HTGB.js} +6 -6
- package/dist/_node-chunks/{story-docs-template-analysis-6YH7XNRB.js → story-docs-template-analysis-LGFOFAHO.js} +6 -6
- package/dist/builders/build-storybook/index.js +15 -10
- package/dist/builders/start-storybook/index.js +15 -10
- package/dist/docgen/docgen-worker.js +47 -25
- package/dist/node/index.js +6 -6
- package/dist/node/vitest.js +6 -6
- package/dist/preset.js +68 -48
- package/package.json +5 -5
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_z1ub7mlv0j from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_z1ub7mlv0j from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_z1ub7mlv0j from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_z1ub7mlv0j.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_z1ub7mlv0j.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_z1ub7mlv0j.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -12,6 +12,7 @@ var require = CJS_COMPAT_NODE_MODULE_8ni5g5ueuqs.createRequire(import.meta.url);
|
|
|
12
12
|
|
|
13
13
|
// src/find-tsconfig.ts
|
|
14
14
|
import { getProjectRoot } from "storybook/internal/common";
|
|
15
|
+
import { resolve as resolve2 } from "node:path";
|
|
15
16
|
|
|
16
17
|
// ../../../node_modules/empathic/find.mjs
|
|
17
18
|
import { join as join2 } from "node:path";
|
|
@@ -42,9 +43,18 @@ function up2(name, options) {
|
|
|
42
43
|
}
|
|
43
44
|
|
|
44
45
|
// src/find-tsconfig.ts
|
|
45
|
-
var findTsconfigUp = (configDir) => up2("tsconfig.json", { cwd: configDir, last: getProjectRoot() })
|
|
46
|
+
var findTsconfigUp = (configDir) => up2("tsconfig.json", { cwd: configDir, last: getProjectRoot() }), resolveTsconfig = ({
|
|
47
|
+
workspaceRoot,
|
|
48
|
+
configDir,
|
|
49
|
+
tsConfig,
|
|
50
|
+
browserTsConfig
|
|
51
|
+
}) => {
|
|
52
|
+
let configured = tsConfig ?? findTsconfigUp(configDir) ?? browserTsConfig;
|
|
53
|
+
return configured ? resolve2(workspaceRoot, configured) : void 0;
|
|
54
|
+
};
|
|
46
55
|
|
|
47
56
|
export {
|
|
48
57
|
up2 as up,
|
|
49
|
-
findTsconfigUp
|
|
58
|
+
findTsconfigUp,
|
|
59
|
+
resolveTsconfig
|
|
50
60
|
};
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_z1ub7mlv0j from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_z1ub7mlv0j from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_z1ub7mlv0j from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_z1ub7mlv0j.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_z1ub7mlv0j.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_z1ub7mlv0j.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
11
|
// ------------------------------------------------------------
|
|
12
12
|
import {
|
|
13
13
|
up
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-5GTDRCMW.js";
|
|
15
15
|
|
|
16
16
|
// ../../../node_modules/empathic/package.mjs
|
|
17
17
|
function up2(options) {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_z1ub7mlv0j from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_z1ub7mlv0j from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_z1ub7mlv0j from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_z1ub7mlv0j.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_z1ub7mlv0j.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_z1ub7mlv0j.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_z1ub7mlv0j from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_z1ub7mlv0j from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_z1ub7mlv0j from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_z1ub7mlv0j.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_z1ub7mlv0j.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_z1ub7mlv0j.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_z1ub7mlv0j from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_z1ub7mlv0j from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_z1ub7mlv0j from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_z1ub7mlv0j.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_z1ub7mlv0j.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_z1ub7mlv0j.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -13,10 +13,10 @@ import {
|
|
|
13
13
|
errorSummary,
|
|
14
14
|
printErrorDetails,
|
|
15
15
|
up
|
|
16
|
-
} from "../../_node-chunks/chunk-
|
|
16
|
+
} from "../../_node-chunks/chunk-DQYSVBAE.js";
|
|
17
17
|
import {
|
|
18
|
-
|
|
19
|
-
} from "../../_node-chunks/chunk-
|
|
18
|
+
resolveTsconfig
|
|
19
|
+
} from "../../_node-chunks/chunk-5GTDRCMW.js";
|
|
20
20
|
|
|
21
21
|
// src/builders/build-storybook/index.ts
|
|
22
22
|
import { readFileSync } from "node:fs";
|
|
@@ -91,7 +91,12 @@ async function setup(options, context) {
|
|
|
91
91
|
await context.getTargetOptions(browserTarget),
|
|
92
92
|
await context.getBuilderNameForTarget(browserTarget)
|
|
93
93
|
)), {
|
|
94
|
-
tsConfig:
|
|
94
|
+
tsConfig: resolveTsconfig({
|
|
95
|
+
workspaceRoot: context.workspaceRoot,
|
|
96
|
+
configDir: options.configDir,
|
|
97
|
+
tsConfig: options.tsConfig,
|
|
98
|
+
browserTsConfig: browserOptions?.tsConfig
|
|
99
|
+
})
|
|
95
100
|
};
|
|
96
101
|
}
|
|
97
102
|
async function runInstance(options) {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_z1ub7mlv0j from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_z1ub7mlv0j from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_z1ub7mlv0j from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_z1ub7mlv0j.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_z1ub7mlv0j.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_z1ub7mlv0j.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -13,10 +13,10 @@ import {
|
|
|
13
13
|
errorSummary,
|
|
14
14
|
printErrorDetails,
|
|
15
15
|
up
|
|
16
|
-
} from "../../_node-chunks/chunk-
|
|
16
|
+
} from "../../_node-chunks/chunk-DQYSVBAE.js";
|
|
17
17
|
import {
|
|
18
|
-
|
|
19
|
-
} from "../../_node-chunks/chunk-
|
|
18
|
+
resolveTsconfig
|
|
19
|
+
} from "../../_node-chunks/chunk-5GTDRCMW.js";
|
|
20
20
|
|
|
21
21
|
// src/builders/start-storybook/index.ts
|
|
22
22
|
import { readFileSync } from "node:fs";
|
|
@@ -121,7 +121,12 @@ async function setup(options, context) {
|
|
|
121
121
|
await context.getTargetOptions(browserTarget),
|
|
122
122
|
await context.getBuilderNameForTarget(browserTarget)
|
|
123
123
|
)), {
|
|
124
|
-
tsConfig:
|
|
124
|
+
tsConfig: resolveTsconfig({
|
|
125
|
+
workspaceRoot: context.workspaceRoot,
|
|
126
|
+
configDir: options.configDir,
|
|
127
|
+
tsConfig: options.tsConfig,
|
|
128
|
+
browserTsConfig: browserOptions?.tsConfig
|
|
129
|
+
})
|
|
125
130
|
};
|
|
126
131
|
}
|
|
127
132
|
async function runInstance(options) {
|
|
@@ -1,32 +1,33 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_z1ub7mlv0j from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_z1ub7mlv0j from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_z1ub7mlv0j from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_z1ub7mlv0j.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_z1ub7mlv0j.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_z1ub7mlv0j.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
11
|
// ------------------------------------------------------------
|
|
12
12
|
import {
|
|
13
13
|
resolveStoryComponent
|
|
14
|
-
} from "../_node-chunks/chunk-
|
|
14
|
+
} from "../_node-chunks/chunk-FLU3HTGB.js";
|
|
15
15
|
|
|
16
16
|
// src/docgen/docgen-worker.ts
|
|
17
17
|
import { STORY_FILE_TEST_REGEXP, getStoryImportPathFromEntry as getStoryImportPathFromEntry2 } from "storybook/internal/common";
|
|
18
18
|
import { logger as logger4 } from "storybook/internal/node-logger";
|
|
19
19
|
|
|
20
20
|
// ../../lib/angular-cm/dist/index.js
|
|
21
|
-
import
|
|
22
|
-
import
|
|
23
|
-
import
|
|
21
|
+
import CJS_COMPAT_NODE_URL_zejiuct5sdn from "node:url";
|
|
22
|
+
import CJS_COMPAT_NODE_PATH_zejiuct5sdn from "node:path";
|
|
23
|
+
import CJS_COMPAT_NODE_MODULE_zejiuct5sdn from "node:module";
|
|
24
24
|
import {
|
|
25
25
|
ComponentMetaManager,
|
|
26
26
|
parseTsconfigCommandLine
|
|
27
27
|
} from "storybook/internal/component-meta";
|
|
28
28
|
import { isInNodeModules, slash } from "storybook/internal/common";
|
|
29
29
|
import {
|
|
30
|
+
extractComponentJsDocInfo,
|
|
30
31
|
ProgramBackedProject,
|
|
31
32
|
ProjectFileTracker
|
|
32
33
|
} from "storybook/internal/component-meta";
|
|
@@ -34,7 +35,7 @@ import { logger as logger3 } from "storybook/internal/node-logger";
|
|
|
34
35
|
import * as path from "node:path";
|
|
35
36
|
import { logger as logger2 } from "storybook/internal/node-logger";
|
|
36
37
|
import { logger } from "storybook/internal/node-logger";
|
|
37
|
-
var __filename =
|
|
38
|
+
var __filename = CJS_COMPAT_NODE_URL_zejiuct5sdn.fileURLToPath(import.meta.url), __dirname = CJS_COMPAT_NODE_PATH_zejiuct5sdn.dirname(__filename), require2 = CJS_COMPAT_NODE_MODULE_zejiuct5sdn.createRequire(import.meta.url), NOOP_LOGGER = {
|
|
38
39
|
warn: () => {
|
|
39
40
|
},
|
|
40
41
|
debug: () => {
|
|
@@ -1330,7 +1331,15 @@ var KNOWN_DECORATORS = {
|
|
|
1330
1331
|
}
|
|
1331
1332
|
let checker = program.getTypeChecker(), fileMeta = analyzeSourceFile(this.typescript, sourceFile, checker), entry = this.pickEntry(fileMeta, sourceFile, names);
|
|
1332
1333
|
if (entry)
|
|
1333
|
-
return this.debug(`${describe(entry)} from ${fileName}`), {
|
|
1334
|
+
return this.debug(`${describe(entry)} from ${fileName}`), {
|
|
1335
|
+
entry,
|
|
1336
|
+
json: fileMeta,
|
|
1337
|
+
...jsDocInfoField(
|
|
1338
|
+
this.typescript,
|
|
1339
|
+
checker,
|
|
1340
|
+
findClassDeclaration(this.typescript, sourceFile, entry.name)
|
|
1341
|
+
)
|
|
1342
|
+
};
|
|
1334
1343
|
let viaExports = this.extractViaModuleExports(checker, sourceFile, fileMeta, names);
|
|
1335
1344
|
if (viaExports)
|
|
1336
1345
|
return this.debug(`${describe(viaExports.entry)} from ${fileName}, reached through its exports`), viaExports;
|
|
@@ -1373,7 +1382,11 @@ var KNOWN_DECORATORS = {
|
|
|
1373
1382
|
continue;
|
|
1374
1383
|
let declarationFile = declaration.getSourceFile(), targetMeta = declarationFile === sourceFile ? fileMeta : analyzeSourceFile(this.typescript, declarationFile, checker), entry = findRecord(targetMeta, declaration.name.text);
|
|
1375
1384
|
if (entry)
|
|
1376
|
-
return {
|
|
1385
|
+
return {
|
|
1386
|
+
entry,
|
|
1387
|
+
json: targetMeta,
|
|
1388
|
+
...jsDocInfoField(this.typescript, checker, declaration)
|
|
1389
|
+
};
|
|
1377
1390
|
}
|
|
1378
1391
|
}
|
|
1379
1392
|
}, importClosure = (typescript, program, entry) => {
|
|
@@ -1401,6 +1414,15 @@ var KNOWN_DECORATORS = {
|
|
|
1401
1414
|
let counts = "inputsClass" in entry ? `${entry.inputsClass?.length ?? 0} input(s), ${entry.outputsClass?.length ?? 0} output(s), ${"propertiesClass" in entry ? entry.propertiesClass?.length ?? 0 : 0} propertie(s)` : `${entry.properties.length} propertie(s), ${entry.methods.length} method(s)`;
|
|
1402
1415
|
return `extracted ${entry.type} ${entry.name} with ${counts}`;
|
|
1403
1416
|
}, findRecord = (fileMeta, name) => name ? allRecords(fileMeta).find((record) => record.name === name) : void 0;
|
|
1417
|
+
function findClassDeclaration(typescript, sourceFile, name) {
|
|
1418
|
+
return sourceFile.statements.find(
|
|
1419
|
+
(statement) => typescript.isClassDeclaration(statement) && statement.name?.text === name
|
|
1420
|
+
);
|
|
1421
|
+
}
|
|
1422
|
+
function jsDocInfoField(typescript, checker, declaration) {
|
|
1423
|
+
let symbol = declaration?.name && checker.getSymbolAtLocation(declaration.name);
|
|
1424
|
+
return symbol ? { jsDocInfo: extractComponentJsDocInfo(typescript, checker, symbol) } : {};
|
|
1425
|
+
}
|
|
1404
1426
|
function findDefaultExportedClassName(typescript, sourceFile) {
|
|
1405
1427
|
for (let statement of sourceFile.statements) {
|
|
1406
1428
|
if (typescript.isClassDeclaration(statement) && statement.name && statement.modifiers?.some(
|
|
@@ -1536,7 +1558,17 @@ function buildApiDescription(argTypes, componentName) {
|
|
|
1536
1558
|
}
|
|
1537
1559
|
|
|
1538
1560
|
// src/docgen/build-docgen.ts
|
|
1539
|
-
var inputsOf = (entry) => "inputsClass" in entry ? entry.inputsClass ?? [] : [], outputsOf = (entry) => "outputsClass" in entry ? entry.outputsClass ?? [] : [],
|
|
1561
|
+
var inputsOf = (entry) => "inputsClass" in entry ? entry.inputsClass ?? [] : [], outputsOf = (entry) => "outputsClass" in entry ? entry.outputsClass ?? [] : [], describedBy = (text) => text?.trim() || void 0, analyzerJsDocTags = (entry) => {
|
|
1562
|
+
let tags = {};
|
|
1563
|
+
for (let tag of entry.jsdoctags ?? []) {
|
|
1564
|
+
let name = tag.tagName?.escapedText;
|
|
1565
|
+
if (!name)
|
|
1566
|
+
continue;
|
|
1567
|
+
let value = tag.comment === void 0 ? "" : String(tag.comment).trim();
|
|
1568
|
+
(tags[name] ??= []).push(value);
|
|
1569
|
+
}
|
|
1570
|
+
return tags;
|
|
1571
|
+
}, metaToSnippetMeta = (meta) => {
|
|
1540
1572
|
let { entry } = meta, inputs = inputsOf(entry).map((input) => input.name), inputNames = new Set(inputs), outputs = [];
|
|
1541
1573
|
for (let output of outputsOf(entry)) {
|
|
1542
1574
|
let bindingName2 = inputNames.has(output.name) ? `${output.name}Change` : output.name;
|
|
@@ -1553,16 +1585,6 @@ var inputsOf = (entry) => "inputsClass" in entry ? entry.inputsClass ?? [] : [],
|
|
|
1553
1585
|
members: enumeration.childs.map((child) => ({ name: child.name, value: child.value }))
|
|
1554
1586
|
}))
|
|
1555
1587
|
};
|
|
1556
|
-
}, extractJsDocTags = (entry) => {
|
|
1557
|
-
let tags = {};
|
|
1558
|
-
for (let tag of entry.jsdoctags ?? []) {
|
|
1559
|
-
let name = tag?.tagName?.escapedText;
|
|
1560
|
-
if (!name)
|
|
1561
|
-
continue;
|
|
1562
|
-
let value = tag.comment === void 0 ? "" : String(tag.comment).trim();
|
|
1563
|
-
(tags[name] ??= []).push(value);
|
|
1564
|
-
}
|
|
1565
|
-
return tags;
|
|
1566
1588
|
}, errorPayload = (base, name, message) => ({ ...base, jsDocTags: {}, error: { name, message } }), buildDocgenPayload = (input, context) => {
|
|
1567
1589
|
let { manager, options, logger: logger5 } = context, storyImportPath = getStoryImportPathFromEntry(input.entry);
|
|
1568
1590
|
if (!storyImportPath)
|
|
@@ -1634,7 +1656,7 @@ Check that the file exports the component class and is covered by a tsconfig.jso
|
|
|
1634
1656
|
metadataJson: meta.json,
|
|
1635
1657
|
propsTable: "api",
|
|
1636
1658
|
logger: logger5
|
|
1637
|
-
}), jsDocTags =
|
|
1659
|
+
}), jsDocTags = meta.jsDocInfo?.jsDocTags ?? analyzerJsDocTags(meta.entry), description = describedBy(meta.jsDocInfo?.description) ?? describedBy(meta.entry.rawdescription) ?? describedBy(meta.entry.description);
|
|
1638
1660
|
return {
|
|
1639
1661
|
...base,
|
|
1640
1662
|
// The analyzer knows the class name even when the story file imported it as a default export.
|
package/dist/node/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_z1ub7mlv0j from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_z1ub7mlv0j from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_z1ub7mlv0j from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_z1ub7mlv0j.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_z1ub7mlv0j.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_z1ub7mlv0j.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
package/dist/node/vitest.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_z1ub7mlv0j from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_z1ub7mlv0j from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_z1ub7mlv0j from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_z1ub7mlv0j.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_z1ub7mlv0j.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_z1ub7mlv0j.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
package/dist/preset.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_z1ub7mlv0j from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_z1ub7mlv0j from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_z1ub7mlv0j from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_z1ub7mlv0j.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_z1ub7mlv0j.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_z1ub7mlv0j.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
11
|
// ------------------------------------------------------------
|
|
12
12
|
import {
|
|
13
13
|
findTsconfigUp
|
|
14
|
-
} from "./_node-chunks/chunk-
|
|
14
|
+
} from "./_node-chunks/chunk-5GTDRCMW.js";
|
|
15
15
|
import {
|
|
16
16
|
parseStoryFile
|
|
17
|
-
} from "./_node-chunks/chunk-
|
|
17
|
+
} from "./_node-chunks/chunk-FLU3HTGB.js";
|
|
18
18
|
|
|
19
19
|
// src/preset.ts
|
|
20
20
|
import { findConfigFile } from "storybook/internal/common";
|
|
@@ -26,7 +26,8 @@ import {
|
|
|
26
26
|
getRealPath
|
|
27
27
|
} from "storybook/internal/mocking-utils";
|
|
28
28
|
import { logger as logger5 } from "storybook/internal/node-logger";
|
|
29
|
-
import {
|
|
29
|
+
import { AngularUnresolvedStyleError } from "storybook/internal/server-errors";
|
|
30
|
+
import { readFileSync as readFileSync3, statSync as statSync2 } from "node:fs";
|
|
30
31
|
import { basename, isAbsolute as isAbsolute2, relative as relative2, resolve as resolve4 } from "node:path";
|
|
31
32
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
32
33
|
|
|
@@ -399,7 +400,7 @@ var EVAL_FAILED = /* @__PURE__ */ Symbol("story-docs-eval-failed"), createArgExt
|
|
|
399
400
|
}, evaluateArgLiteral = (node, enums) => {
|
|
400
401
|
let value = evaluateNode(unwrapExpression(node), enums);
|
|
401
402
|
return value === EVAL_FAILED ? void 0 : printExpressionValue(value, /* @__PURE__ */ new Set());
|
|
402
|
-
}, printArgSource = (node) => babelPrint(t.cloneNode(node, !0)), quoteExpressionString = (value) => `'${value.replace(/\\/g, "\\\\").replace(/'/g, "\\'").replace(/\n/g, "\\n").replace(/\r/g, "\\r")}'`, printExpressionValue = (value, seen) => typeof value == "string" ? quoteExpressionString(value) : typeof value != "object" || value === null ? `${value}` : seen.has(value) ? quoteExpressionString("[Circular]") : (seen.add(value), Array.isArray(value) ? `[${value.map((element) => printExpressionValue(element ?? null, seen)).join(", ")}]` : `{${Object.entries(value).filter(([, entryValue]) => entryValue !== void 0).map(
|
|
403
|
+
}, argFieldValue = (node) => printArgSource(unwrapExpression(node)), printArgSource = (node) => babelPrint(t.cloneNode(node, !0)), quoteExpressionString = (value) => `'${value.replace(/\\/g, "\\\\").replace(/'/g, "\\'").replace(/\n/g, "\\n").replace(/\r/g, "\\r")}'`, printExpressionValue = (value, seen) => typeof value == "string" ? quoteExpressionString(value) : typeof value != "object" || value === null ? `${value}` : seen.has(value) ? quoteExpressionString("[Circular]") : (seen.add(value), Array.isArray(value) ? `[${value.map((element) => printExpressionValue(element ?? null, seen)).join(", ")}]` : `{${Object.entries(value).filter(([, entryValue]) => entryValue !== void 0).map(
|
|
403
404
|
([key, entryValue]) => `${isValidIdentifier(key) ? key : quoteExpressionString(key)}: ${printExpressionValue(entryValue, seen)}`
|
|
404
405
|
).join(", ")}}`), escapeAttributeExpression = (expression) => expression.replace(/&(?=#|\w+;)/g, "&").replace(/"/g, """), evaluateNode = (node, enums) => {
|
|
405
406
|
let unwrapped = unwrapExpression(node);
|
|
@@ -750,7 +751,9 @@ var ngModulesFromDecorators = (decorators, componentName) => {
|
|
|
750
751
|
|
|
751
752
|
// src/docgen/story-docs-snippet.ts
|
|
752
753
|
var HOST_SELECTOR = "app-demo", HOST_CLASS = "DemoComponent", escapeTemplateLiteral = (template) => template.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$\{/g, "\\${");
|
|
753
|
-
var memberName = (name) => isValidIdentifier(name) ? name : `['${name}']`,
|
|
754
|
+
var memberName = (name) => isValidIdentifier(name) ? name : `['${name}']`, memberValue = (value) => value.split(`
|
|
755
|
+
`).join(`
|
|
756
|
+
`), embedTemplate = (template) => template.includes(`
|
|
754
757
|
`) ? `
|
|
755
758
|
${template.split(`
|
|
756
759
|
`).map((line) => line === "" ? line : ` ${line}`).join(`
|
|
@@ -771,7 +774,7 @@ ${template.split(`
|
|
|
771
774
|
...moduleNames.length > 0 ? ngModules?.importStatements ?? [] : []
|
|
772
775
|
], declared = viaComponentOutlet ? "NgComponentOutlet" : [...standalone ? [componentName] : [], ...moduleNames].join(", "), members = [
|
|
773
776
|
...viaComponentOutlet ? [` protected readonly ${componentName} = ${componentName};`] : [],
|
|
774
|
-
...fields.map(({ name, value }) => ` ${memberName(name)} = ${value};`),
|
|
777
|
+
...fields.map(({ name, value }) => ` ${memberName(name)} = ${memberValue(value)};`),
|
|
775
778
|
...outputs.map((name) => ` ${memberName(name)}(event: unknown) {}`)
|
|
776
779
|
], body = members.length > 0 ? `{
|
|
777
780
|
${members.join(`
|
|
@@ -920,7 +923,7 @@ var buildStoryDocsPayload = async (input, context) => {
|
|
|
920
923
|
unresolvedArgs: unresolved
|
|
921
924
|
};
|
|
922
925
|
}, renderStorySnippet = async (snippetMeta, shape, storyDecorators, deps) => {
|
|
923
|
-
let { componentImport } = deps, localName = componentNameOf(shape.csf._metaAnnotations.component) ?? snippetMeta.name, ngModules = storyNgModules(storyDecorators, deps), expansion = argsExpansion(snippetMeta, shape), userMarkup = userTemplate(shape, shape.unresolvedArgs.length === 0 ? expansion : void 0), host = (template, viaComponentOutlet, outputs,
|
|
926
|
+
let { componentImport } = deps, localName = componentNameOf(shape.csf._metaAnnotations.component) ?? snippetMeta.name, ngModules = storyNgModules(storyDecorators, deps), expansion = argsExpansion(snippetMeta, shape), userMarkup = userTemplate(shape, shape.unresolvedArgs.length === 0 ? expansion : void 0), host = (template, viaComponentOutlet, outputs, fields2) => buildHostComponentSnippet({
|
|
924
927
|
template,
|
|
925
928
|
componentName: localName,
|
|
926
929
|
componentImport,
|
|
@@ -928,10 +931,10 @@ var buildStoryDocsPayload = async (input, context) => {
|
|
|
928
931
|
standalone: snippetMeta.standalone,
|
|
929
932
|
ngModules,
|
|
930
933
|
outputs,
|
|
931
|
-
fields
|
|
934
|
+
fields: fields2
|
|
932
935
|
});
|
|
933
936
|
if (userMarkup?.kind === "literal") {
|
|
934
|
-
let { analyzeStoryTemplate } = await import("./_node-chunks/story-docs-template-analysis-
|
|
937
|
+
let { analyzeStoryTemplate } = await import("./_node-chunks/story-docs-template-analysis-LGFOFAHO.js"), analysis = analyzeStoryTemplate(userMarkup.markup, userMarkup.expansions), referencedNames = new Set(analysis.kind === "resolved" ? analysis.referencedNames : []), boundOutputs = analysis.kind === "resolved" ? snippetMeta.outputs.filter((name) => analysis.boundOutputs.includes(name)) : [], hostArgs = referencedArgFields(
|
|
935
938
|
referencedNames,
|
|
936
939
|
userMarkup.representedArgs,
|
|
937
940
|
shape,
|
|
@@ -954,20 +957,21 @@ var buildStoryDocsPayload = async (input, context) => {
|
|
|
954
957
|
);
|
|
955
958
|
}
|
|
956
959
|
let markupSources = userMarkup?.source === void 0 ? [] : [userMarkup.source];
|
|
957
|
-
|
|
960
|
+
if (!snippetMeta.selector)
|
|
961
|
+
return withWarnings(
|
|
962
|
+
host(buildComponentOutletTemplate(localName, { selfClosing: !0 }), !0, []),
|
|
963
|
+
unresolvedWarning(markupSources)
|
|
964
|
+
);
|
|
965
|
+
let { bindings, fields } = componentBindings(snippetMeta, shape);
|
|
966
|
+
return withWarnings(
|
|
958
967
|
host(
|
|
959
|
-
buildTemplate(snippetMeta.selector, {
|
|
960
|
-
...componentBindings(snippetMeta, shape),
|
|
961
|
-
selfClosing: !0
|
|
962
|
-
}),
|
|
968
|
+
buildTemplate(snippetMeta.selector, { ...bindings, selfClosing: !0 }),
|
|
963
969
|
!1,
|
|
964
|
-
snippetMeta.outputs
|
|
970
|
+
snippetMeta.outputs,
|
|
971
|
+
fields
|
|
965
972
|
),
|
|
966
973
|
unresolvedWarning([...markupSources, ...shape.unresolvedArgs]),
|
|
967
974
|
unboundArgsWarning(localName, snippetMeta, shape)
|
|
968
|
-
) : withWarnings(
|
|
969
|
-
host(buildComponentOutletTemplate(localName, { selfClosing: !0 }), !0, []),
|
|
970
|
-
unresolvedWarning(markupSources)
|
|
971
975
|
);
|
|
972
976
|
}, referencedArgFields = (referencedNames, representedArgs, shape, boundOutputs, enums) => {
|
|
973
977
|
let taken = /* @__PURE__ */ new Set([...representedArgs, ...boundOutputs]), fields = [], unresolved = [];
|
|
@@ -997,11 +1001,16 @@ var buildStoryDocsPayload = async (input, context) => {
|
|
|
997
1001
|
let reason = new Set(unbound.map(({ kind }) => kind)).size === 1 ? `declares no such ${unbound[0].kind}` : "declares no compatible input or output";
|
|
998
1002
|
return `Incomplete snippet: ${unbound.map(({ name }) => `\`${name}\``).join(", ")} could not be bound, since ${componentName} ${reason}.`;
|
|
999
1003
|
}, componentBindings = (snippetMeta, shape) => {
|
|
1000
|
-
let inputNames = new Set(snippetMeta.inputs);
|
|
1001
|
-
|
|
1002
|
-
name
|
|
1003
|
-
|
|
1004
|
-
|
|
1004
|
+
let inputNames = new Set(snippetMeta.inputs), inputs = [], fields = [];
|
|
1005
|
+
for (let [name, node] of Object.entries(shape.args))
|
|
1006
|
+
if (inputNames.has(name)) {
|
|
1007
|
+
if (evaluateArgLiteral(node, snippetMeta.enums) === void 0 && isSelfContained(node)) {
|
|
1008
|
+
fields.push({ name, value: argFieldValue(node) }), inputs.push({ name, expression: formatPropInTemplate(name) });
|
|
1009
|
+
continue;
|
|
1010
|
+
}
|
|
1011
|
+
inputs.push({ name, expression: evaluateArgExpression(node, snippetMeta.enums) });
|
|
1012
|
+
}
|
|
1013
|
+
return { bindings: { inputs, outputs: snippetMeta.outputs }, fields };
|
|
1005
1014
|
}, argsExpansion = (snippetMeta, shape) => {
|
|
1006
1015
|
let inputNames = new Set(snippetMeta.inputs), outputNames = new Set(snippetMeta.outputs), inputs = [], outputs = [];
|
|
1007
1016
|
for (let [name, node] of Object.entries(shape.args))
|
|
@@ -1201,38 +1210,49 @@ function compodocJsonStubPlugin(configDir) {
|
|
|
1201
1210
|
}
|
|
1202
1211
|
};
|
|
1203
1212
|
}
|
|
1213
|
+
var STYLE_EXTENSIONS = [".css", ".scss", ".sass", ".less"], isFile = (path) => statSync2(path, { throwIfNoEntry: !1 })?.isFile() === !0;
|
|
1214
|
+
function resolveBuilderStyle(stylePath, workspaceRoot) {
|
|
1215
|
+
let workspacePath = resolve4(workspaceRoot, stylePath), onDisk = [workspacePath, ...STYLE_EXTENSIONS.map((ext) => workspacePath + ext)].find(
|
|
1216
|
+
isFile
|
|
1217
|
+
);
|
|
1218
|
+
if (onDisk)
|
|
1219
|
+
return onDisk;
|
|
1220
|
+
if (isAbsolute2(stylePath) || /^\.\.?[/\\]/.test(stylePath))
|
|
1221
|
+
throw new AngularUnresolvedStyleError({
|
|
1222
|
+
stylePath,
|
|
1223
|
+
workspaceRoot,
|
|
1224
|
+
extensions: STYLE_EXTENSIONS
|
|
1225
|
+
});
|
|
1226
|
+
return stylePath;
|
|
1227
|
+
}
|
|
1204
1228
|
function angularOptionsPlugin(options, { normalizePath, zoneless }) {
|
|
1205
|
-
let
|
|
1229
|
+
let resolvedPreviewPath, workspaceRoot = process.cwd();
|
|
1206
1230
|
return {
|
|
1207
1231
|
name: "storybook-angular-vite-options-plugin",
|
|
1208
1232
|
config(userConfig) {
|
|
1209
|
-
|
|
1233
|
+
resolvedPreviewPath = findConfigFile("preview", options.configDir) ?? void 0, workspaceRoot = options.angularBuilderContext?.workspaceRoot ?? userConfig?.root ?? process.cwd();
|
|
1210
1234
|
let stylePreprocessorOptions = options?.angularBuilderOptions?.stylePreprocessorOptions ?? {}, loadPaths = stylePreprocessorOptions.includePaths ?? stylePreprocessorOptions.loadPaths, sassOptions = stylePreprocessorOptions.sass;
|
|
1211
|
-
if (!Array.isArray(loadPaths) && !sassOptions)
|
|
1212
|
-
return
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
...Array.isArray(loadPaths) ? { loadPaths: loadPaths.map((loadPath) => `${resolve4(workspaceRoot, loadPath)}`) } : {}
|
|
1235
|
+
if (!(!Array.isArray(loadPaths) && !sassOptions))
|
|
1236
|
+
return {
|
|
1237
|
+
css: {
|
|
1238
|
+
preprocessorOptions: {
|
|
1239
|
+
scss: {
|
|
1240
|
+
...sassOptions,
|
|
1241
|
+
...Array.isArray(loadPaths) ? { loadPaths: loadPaths.map((loadPath) => `${resolve4(workspaceRoot, loadPath)}`) } : {}
|
|
1242
|
+
}
|
|
1220
1243
|
}
|
|
1221
1244
|
}
|
|
1222
|
-
}
|
|
1223
|
-
};
|
|
1245
|
+
};
|
|
1224
1246
|
},
|
|
1225
1247
|
async transform(code, id) {
|
|
1226
1248
|
if (resolvedPreviewPath && normalizePath(id).endsWith(normalizePath(resolvedPreviewPath))) {
|
|
1227
1249
|
let imports = [], styles = options?.angularBuilderOptions?.styles;
|
|
1228
|
-
Array.isArray(styles) && styles.forEach((style) => {
|
|
1250
|
+
return Array.isArray(styles) && styles.forEach((style) => {
|
|
1229
1251
|
let stylePath = typeof style == "string" ? style : style !== null && typeof style == "object" && "input" in style && typeof style.input == "string" ? style.input : void 0;
|
|
1230
|
-
stylePath !== void 0 && imports.push(stylePath);
|
|
1231
|
-
}), zoneless || imports.push("zone.js")
|
|
1232
|
-
let projectRoot = resolvedConfig?.root ?? process.cwd();
|
|
1233
|
-
return {
|
|
1252
|
+
stylePath !== void 0 && imports.push(normalizePath(resolveBuilderStyle(stylePath, workspaceRoot)));
|
|
1253
|
+
}), zoneless || imports.push("zone.js"), {
|
|
1234
1254
|
code: `
|
|
1235
|
-
${imports.map((extraImport) =>
|
|
1255
|
+
${imports.map((extraImport) => `import '${extraImport}';`).join(`
|
|
1236
1256
|
`)}
|
|
1237
1257
|
${code}
|
|
1238
1258
|
`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/angular-vite",
|
|
3
|
-
"version": "10.6.0-alpha.
|
|
3
|
+
"version": "10.6.0-alpha.8",
|
|
4
4
|
"description": "Storybook for Angular: Develop, document, and test UI components in isolation",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"storybook",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"!src/**/*"
|
|
64
64
|
],
|
|
65
65
|
"dependencies": {
|
|
66
|
-
"@storybook/builder-vite": "10.6.0-alpha.
|
|
66
|
+
"@storybook/builder-vite": "10.6.0-alpha.8",
|
|
67
67
|
"@storybook/global": "^5.0.0",
|
|
68
68
|
"telejson": "8.0.0",
|
|
69
69
|
"ts-dedent": "^2.0.0",
|
|
@@ -83,8 +83,8 @@
|
|
|
83
83
|
"@angular/platform-browser": "^21.2.14",
|
|
84
84
|
"@angular/platform-browser-dynamic": "^21.2.14",
|
|
85
85
|
"@babel/types": "^7.28.5",
|
|
86
|
-
"@storybook/angular-cm": "10.6.0-alpha.
|
|
87
|
-
"@storybook/angular-compodoc": "10.6.0-alpha.
|
|
86
|
+
"@storybook/angular-cm": "10.6.0-alpha.8",
|
|
87
|
+
"@storybook/angular-compodoc": "10.6.0-alpha.8",
|
|
88
88
|
"@types/node": "^22.19.1",
|
|
89
89
|
"empathic": "^2.0.0",
|
|
90
90
|
"memfs": "^4.11.1",
|
|
@@ -105,7 +105,7 @@
|
|
|
105
105
|
"@angular/core": ">=21.0.0 < 23.0.0",
|
|
106
106
|
"@angular/platform-browser": ">=21.0.0 < 23.0.0",
|
|
107
107
|
"rxjs": "^7.4.0",
|
|
108
|
-
"storybook": "^10.6.0-alpha.
|
|
108
|
+
"storybook": "^10.6.0-alpha.8",
|
|
109
109
|
"typescript": ">= 5.9.x",
|
|
110
110
|
"vite": ">=8.0.0",
|
|
111
111
|
"zone.js": ">=0.14.0"
|