@storybook/angular-vite 10.6.0-alpha.5 → 10.6.0-alpha.6
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/_browser-chunks/{chunk-THKACJYB.js → chunk-BUNW7ROM.js} +5 -5
- package/dist/_browser-chunks/{chunk-XXAOQLNU.js → chunk-CHMLOECK.js} +88 -39
- package/dist/_browser-chunks/{chunk-6DVGZIOB.js → chunk-ECGMCGUZ.js} +78 -89
- package/dist/_browser-chunks/{chunk-GVH2OCSY.js → chunk-HBLYOJ22.js} +3 -3
- package/dist/_node-chunks/chunk-5LXEVSHB.js +35 -0
- package/dist/_node-chunks/{chunk-35U7AODH.js → chunk-6P3TQP4W.js} +7 -7
- package/dist/_node-chunks/{chunk-RC6UIUJ4.js → chunk-ORVVXDOZ.js} +6 -6
- package/dist/builders/build-storybook/index.js +8 -8
- package/dist/builders/start-storybook/index.js +8 -8
- package/dist/client/config.js +2 -2
- package/dist/client/docs/config.js +2 -2
- package/dist/client/index.js +4 -4
- package/dist/docgen/docgen-worker.js +1039 -554
- package/dist/index.js +4 -4
- package/dist/node/index.js +6 -6
- package/dist/node/vitest.js +6 -6
- package/dist/preset.js +506 -27
- package/package.json +5 -4
- package/dist/_node-chunks/chunk-77BJXJPD.js +0 -195
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.6",
|
|
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.6",
|
|
67
67
|
"@storybook/global": "^5.0.0",
|
|
68
68
|
"telejson": "8.0.0",
|
|
69
69
|
"ts-dedent": "^2.0.0",
|
|
@@ -83,7 +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-
|
|
86
|
+
"@storybook/angular-cm": "10.6.0-alpha.6",
|
|
87
|
+
"@storybook/angular-compodoc": "10.6.0-alpha.6",
|
|
87
88
|
"@types/node": "^22.19.1",
|
|
88
89
|
"empathic": "^2.0.0",
|
|
89
90
|
"memfs": "^4.11.1",
|
|
@@ -104,7 +105,7 @@
|
|
|
104
105
|
"@angular/core": ">=21.0.0 < 23.0.0",
|
|
105
106
|
"@angular/platform-browser": ">=21.0.0 < 23.0.0",
|
|
106
107
|
"rxjs": "^7.4.0",
|
|
107
|
-
"storybook": "^10.6.0-alpha.
|
|
108
|
+
"storybook": "^10.6.0-alpha.6",
|
|
108
109
|
"typescript": ">= 5.9.x",
|
|
109
110
|
"vite": ">=8.0.0",
|
|
110
111
|
"zone.js": ">=0.16.0"
|
|
@@ -1,195 +0,0 @@
|
|
|
1
|
-
import CJS_COMPAT_NODE_URL_1pj9uj7yzpf from 'node:url';
|
|
2
|
-
import CJS_COMPAT_NODE_PATH_1pj9uj7yzpf from 'node:path';
|
|
3
|
-
import CJS_COMPAT_NODE_MODULE_1pj9uj7yzpf from "node:module";
|
|
4
|
-
|
|
5
|
-
var __filename = CJS_COMPAT_NODE_URL_1pj9uj7yzpf.fileURLToPath(import.meta.url);
|
|
6
|
-
var __dirname = CJS_COMPAT_NODE_PATH_1pj9uj7yzpf.dirname(__filename);
|
|
7
|
-
var require = CJS_COMPAT_NODE_MODULE_1pj9uj7yzpf.createRequire(import.meta.url);
|
|
8
|
-
|
|
9
|
-
// ------------------------------------------------------------
|
|
10
|
-
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
|
-
// ------------------------------------------------------------
|
|
12
|
-
import {
|
|
13
|
-
findTsconfigUp
|
|
14
|
-
} from "./chunk-RC6UIUJ4.js";
|
|
15
|
-
|
|
16
|
-
// src/compodoc-config.ts
|
|
17
|
-
import { resolve } from "node:path";
|
|
18
|
-
var DEFAULT_COMPODOC_ARGS = ["-e", "json", "-d", "."], DOCUMENTATION_JSON = "documentation.json", readCompodocOutputDir = (compodocArgs) => {
|
|
19
|
-
for (let index = compodocArgs.length - 1; index >= 0; index--) {
|
|
20
|
-
let arg = compodocArgs[index];
|
|
21
|
-
if (arg.startsWith("--output="))
|
|
22
|
-
return arg.slice(9) || void 0;
|
|
23
|
-
if (arg === "-d" || arg === "--output") {
|
|
24
|
-
let value = compodocArgs[index + 1];
|
|
25
|
-
if (typeof value == "string" && !value.startsWith("-"))
|
|
26
|
-
return value;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
}, resolveCompodocConfig = async (options, extra = {}) => {
|
|
30
|
-
let framework = await options?.presets?.apply("framework"), frameworkOptions = typeof framework == "string" ? {} : framework?.options ?? {}, workspaceRoot = options?.angularBuilderContext?.workspaceRoot ?? extra.viteRoot ?? // Mirrors what builder-vite does with Vite's root, which only `viteFinal` can pass along. Without
|
|
31
|
-
// it the docgen reader falls back to cwd and looks in a different directory than the writer.
|
|
32
|
-
(options?.configDir ? resolve(options.configDir, "..") : void 0) ?? process.cwd(), compodocArgs = frameworkOptions.compodocArgs ?? DEFAULT_COMPODOC_ARGS;
|
|
33
|
-
return {
|
|
34
|
-
/** `framework.options.compodoc`: `false` means the user opted out of Compodoc entirely. */
|
|
35
|
-
enabled: frameworkOptions.compodoc !== !1,
|
|
36
|
-
compodocArgs,
|
|
37
|
-
tsconfig: frameworkOptions.tsconfig ?? options?.tsConfig ?? options?.angularBuilderOptions?.tsConfig ?? // The same walk the builders use, so Compodoc is pointed at the tsconfig the Angular build
|
|
38
|
-
// would have picked rather than a different guess.
|
|
39
|
-
(options?.configDir ? findTsconfigUp(options.configDir) : void 0) ?? resolve(workspaceRoot, "tsconfig.json"),
|
|
40
|
-
/** Directory Compodoc runs in, and the base its relative `file` paths are written against. */
|
|
41
|
-
workspaceRoot,
|
|
42
|
-
/** Absolute directory Compodoc writes {@link DOCUMENTATION_JSON} into. */
|
|
43
|
-
outputDir: resolve(workspaceRoot, readCompodocOutputDir(compodocArgs) ?? ".")
|
|
44
|
-
};
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
// src/compodoc/ensure-documentation.ts
|
|
48
|
-
import { withFileLock } from "storybook/internal/common";
|
|
49
|
-
import { logger as logger2 } from "storybook/internal/node-logger";
|
|
50
|
-
import { randomUUID } from "node:crypto";
|
|
51
|
-
import { readFileSync as readFileSync2, writeFileSync } from "node:fs";
|
|
52
|
-
import { join as join2 } from "node:path";
|
|
53
|
-
|
|
54
|
-
// src/compodoc/generate-documentation.ts
|
|
55
|
-
import { executeNodeCommand } from "storybook/internal/common";
|
|
56
|
-
import { logger } from "storybook/internal/node-logger";
|
|
57
|
-
import {
|
|
58
|
-
existsSync,
|
|
59
|
-
mkdirSync,
|
|
60
|
-
mkdtempSync,
|
|
61
|
-
readFileSync,
|
|
62
|
-
readdirSync,
|
|
63
|
-
renameSync,
|
|
64
|
-
rmSync,
|
|
65
|
-
statSync
|
|
66
|
-
} from "node:fs";
|
|
67
|
-
import { createRequire } from "node:module";
|
|
68
|
-
import { dirname, isAbsolute, join, relative, resolve as resolve2 } from "node:path";
|
|
69
|
-
import { pathToFileURL } from "node:url";
|
|
70
|
-
var COMPODOC_TIMEOUT_MS = 600 * 1e3, OUTPUT_TAIL_BYTES = 4e3, SCRATCH_PREFIX = ".compodoc-", resolveCompodocCli = (workspaceRoot) => {
|
|
71
|
-
let searchFrom = [pathToFileURL(join(resolve2(workspaceRoot), "noop.js")).href, import.meta.url];
|
|
72
|
-
for (let from of searchFrom)
|
|
73
|
-
try {
|
|
74
|
-
let packageJsonPath = createRequire(from).resolve("@compodoc/compodoc/package.json"), { bin } = JSON.parse(readFileSync(packageJsonPath, "utf8")), entry = typeof bin == "string" ? bin : bin?.compodoc;
|
|
75
|
-
if (entry)
|
|
76
|
-
return join(dirname(packageJsonPath), entry);
|
|
77
|
-
} catch {
|
|
78
|
-
}
|
|
79
|
-
}, hasTsconfigArg = (args) => args.includes("-p"), toChildRelativePath = (path, cwd) => isAbsolute(path) ? relative(cwd, path) : path, runCli = async (cli, args, cwd, timeoutMs) => {
|
|
80
|
-
let result = await executeNodeCommand({
|
|
81
|
-
scriptPath: cli,
|
|
82
|
-
args,
|
|
83
|
-
options: {
|
|
84
|
-
cwd,
|
|
85
|
-
// Interleaved into one stream, so the failure message reads in the order Compodoc printed it.
|
|
86
|
-
all: !0,
|
|
87
|
-
encoding: "utf8",
|
|
88
|
-
// Failures come back as a result rather than a throw, so a timeout and a non-zero exit are
|
|
89
|
-
// told apart by inspecting one object.
|
|
90
|
-
reject: !1,
|
|
91
|
-
timeout: timeoutMs,
|
|
92
|
-
// Compodoc does not shut down promptly on SIGTERM, and a hung scan would otherwise keep the
|
|
93
|
-
// docgen worker waiting for it.
|
|
94
|
-
killSignal: "SIGKILL"
|
|
95
|
-
}
|
|
96
|
-
});
|
|
97
|
-
if (!result.failed)
|
|
98
|
-
return;
|
|
99
|
-
let output = String(result.all ?? "").trim().slice(-OUTPUT_TAIL_BYTES);
|
|
100
|
-
throw new Error(
|
|
101
|
-
result.timedOut ? `Compodoc did not finish within ${timeoutMs}ms.
|
|
102
|
-
${output}` : `Compodoc exited with code ${result.exitCode}.
|
|
103
|
-
${output}`
|
|
104
|
-
);
|
|
105
|
-
}, removeAbandonedScratchDirs = (outputDir, olderThanMs) => {
|
|
106
|
-
let cutoff = Date.now() - olderThanMs;
|
|
107
|
-
for (let entry of readdirSync(outputDir, { withFileTypes: !0 })) {
|
|
108
|
-
if (!entry.isDirectory() || !entry.name.startsWith(SCRATCH_PREFIX))
|
|
109
|
-
continue;
|
|
110
|
-
let path = join(outputDir, entry.name);
|
|
111
|
-
try {
|
|
112
|
-
statSync(path).mtimeMs < cutoff && rmSync(path, { recursive: !0, force: !0 });
|
|
113
|
-
} catch {
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
}, generateDocumentation = async ({
|
|
117
|
-
compodocArgs,
|
|
118
|
-
tsconfig,
|
|
119
|
-
workspaceRoot,
|
|
120
|
-
outputDir,
|
|
121
|
-
timeoutMs = COMPODOC_TIMEOUT_MS
|
|
122
|
-
}) => {
|
|
123
|
-
let cli = resolveCompodocCli(workspaceRoot);
|
|
124
|
-
if (!cli)
|
|
125
|
-
throw new Error(
|
|
126
|
-
"@compodoc/compodoc could not be resolved. Install it as a devDependency, or set framework.options.compodoc to false to turn Angular docgen off."
|
|
127
|
-
);
|
|
128
|
-
mkdirSync(outputDir, { recursive: !0 }), removeAbandonedScratchDirs(outputDir, timeoutMs);
|
|
129
|
-
let scratchDir = mkdtempSync(join(outputDir, SCRATCH_PREFIX)), startedAt = Date.now();
|
|
130
|
-
logger.info("[storybook-angular-vite] Generating Angular documentation with Compodoc...");
|
|
131
|
-
try {
|
|
132
|
-
await runCli(
|
|
133
|
-
cli,
|
|
134
|
-
[
|
|
135
|
-
...hasTsconfigArg(compodocArgs) ? [] : ["-p", toChildRelativePath(tsconfig, workspaceRoot)],
|
|
136
|
-
...compodocArgs,
|
|
137
|
-
// Last occurrence wins on Compodoc's command line, so this overrides any `-d`/`--output` the
|
|
138
|
-
// user configured. Their directory is where the finished file lands, not where it is built.
|
|
139
|
-
"-d",
|
|
140
|
-
scratchDir
|
|
141
|
-
],
|
|
142
|
-
workspaceRoot,
|
|
143
|
-
timeoutMs
|
|
144
|
-
);
|
|
145
|
-
let produced = join(scratchDir, DOCUMENTATION_JSON);
|
|
146
|
-
if (!existsSync(produced))
|
|
147
|
-
throw new Error(
|
|
148
|
-
`Compodoc finished without writing ${DOCUMENTATION_JSON}. Check that its arguments still export JSON: ${compodocArgs.join(" ")}`
|
|
149
|
-
);
|
|
150
|
-
renameSync(produced, join(outputDir, DOCUMENTATION_JSON)), logger.debug(
|
|
151
|
-
`[storybook-angular-vite] generated ${DOCUMENTATION_JSON} in ${Date.now() - startedAt}ms`
|
|
152
|
-
);
|
|
153
|
-
} finally {
|
|
154
|
-
rmSync(scratchDir, { recursive: !0, force: !0 });
|
|
155
|
-
}
|
|
156
|
-
};
|
|
157
|
-
|
|
158
|
-
// src/compodoc/ensure-documentation.ts
|
|
159
|
-
var COMPODOC_LOCK = ".compodoc.lock", COMPODOC_RUN_MARKER = ".compodoc.run", RUN_ID_ENV = "STORYBOOK_COMPODOC_RUN_ID", currentRunId = () => process.env[RUN_ID_ENV] ??= randomUUID(), markerRunId = (markerPath) => {
|
|
160
|
-
try {
|
|
161
|
-
return readFileSync2(markerPath, "utf8").trim();
|
|
162
|
-
} catch {
|
|
163
|
-
return;
|
|
164
|
-
}
|
|
165
|
-
}, ensureCompodocDocumentation = async ({
|
|
166
|
-
compodocArgs,
|
|
167
|
-
tsconfig,
|
|
168
|
-
workspaceRoot,
|
|
169
|
-
outputDir,
|
|
170
|
-
waitBudgetMs
|
|
171
|
-
}) => {
|
|
172
|
-
let markerPath = join2(outputDir, COMPODOC_RUN_MARKER), runId = currentRunId();
|
|
173
|
-
if (markerRunId(markerPath) !== runId)
|
|
174
|
-
try {
|
|
175
|
-
await withFileLock(
|
|
176
|
-
join2(outputDir, COMPODOC_LOCK),
|
|
177
|
-
async () => {
|
|
178
|
-
markerRunId(markerPath) !== runId && (await generateDocumentation({ compodocArgs, tsconfig, workspaceRoot, outputDir }), writeFileSync(markerPath, runId));
|
|
179
|
-
},
|
|
180
|
-
{ waitBudgetMs }
|
|
181
|
-
) === "busy" && logger2.debug(
|
|
182
|
-
`[storybook-angular-vite] another process is still generating ${DOCUMENTATION_JSON}; continuing with what is on disk`
|
|
183
|
-
);
|
|
184
|
-
} catch (error) {
|
|
185
|
-
logger2.warn(
|
|
186
|
-
`[storybook-angular-vite] Compodoc generation failed: ${error instanceof Error ? error.message : String(error)}`
|
|
187
|
-
);
|
|
188
|
-
}
|
|
189
|
-
};
|
|
190
|
-
|
|
191
|
-
export {
|
|
192
|
-
DOCUMENTATION_JSON,
|
|
193
|
-
resolveCompodocConfig,
|
|
194
|
-
ensureCompodocDocumentation
|
|
195
|
-
};
|