@clearlydev/nx-archweave 0.6.1 → 0.7.0
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/README.md +34 -3
- package/dist/eslint/index.js +1 -1
- package/dist/generators/_chunks/{chunk-MQNQJOWA.js → chunk-22FVJUNE.js} +4 -2
- package/dist/generators/_chunks/{chunk-CH5AF5S2.js → chunk-2ADC6RKP.js} +1 -1
- package/dist/generators/_chunks/{chunk-2K4JADTK.js → chunk-6PKKKQMD.js} +46 -3
- package/dist/generators/_chunks/chunk-72D3GWHO.js +269 -0
- package/dist/generators/_chunks/{chunk-2TQWFUMC.js → chunk-736LFDT4.js} +21 -1
- package/dist/generators/_chunks/{chunk-D7J7HTND.js → chunk-7RTT5NBN.js} +4 -4
- package/dist/generators/_chunks/chunk-AOKTOS3U.js +294 -0
- package/dist/generators/_chunks/chunk-B6RBCUIL.js +325 -0
- package/dist/generators/_chunks/{chunk-XZM354ZH.js → chunk-CHZPA6OE.js} +5 -3
- package/dist/generators/_chunks/{chunk-UAPIAMRL.js → chunk-DAXD47YO.js} +1 -1
- package/dist/generators/_chunks/chunk-GN76UMTK.js +28 -0
- package/dist/generators/_chunks/{chunk-L52OUT5T.js → chunk-J24X4EOB.js} +1 -1
- package/dist/generators/_chunks/{chunk-EHYC6FUR.js → chunk-JSHZ6VSW.js} +1 -1
- package/dist/generators/_chunks/chunk-KNVBFTH4.js +64 -0
- package/dist/generators/_chunks/chunk-MF75SQM6.js +98 -0
- package/dist/generators/_chunks/chunk-N6SPEKJB.js +106 -0
- package/dist/generators/_chunks/chunk-OX7W4SJ2.js +214 -0
- package/dist/generators/_chunks/chunk-R2VEJGNP.js +84 -0
- package/dist/generators/_chunks/chunk-SBOQHME6.js +140 -0
- package/dist/generators/_chunks/{chunk-WD2HL2RE.js → chunk-STGNMZLM.js} +1 -1
- package/dist/generators/_chunks/{chunk-XXXON43Z.js → chunk-SZRBDQCU.js} +4 -51
- package/dist/generators/_chunks/{chunk-LKXSS5E2.js → chunk-W2BBF5MS.js} +3 -86
- package/dist/generators/add-agent-rules/generator.js +2 -2
- package/dist/generators/add-backend/generator.js +2 -2
- package/dist/generators/add-fsd-lite/generator.js +7 -5
- package/dist/generators/add-github-templates/generator.js +2 -2
- package/dist/generators/add-integration/generator.js +2 -2
- package/dist/generators/add-review/generator.js +2 -2
- package/dist/generators/add-storybook/files/example/button/button.stories.tsx.template +13 -0
- package/dist/generators/add-storybook/files/example/button/button.tsx.template +7 -0
- package/dist/generators/add-storybook/files/example/index.ts.template +1 -0
- package/dist/generators/add-storybook/files/library/tailwind.css.template +2 -0
- package/dist/generators/add-storybook/generator.js +28 -0
- package/dist/generators/add-tailwind/files/next/postcss.config.mjs.template +7 -0
- package/dist/generators/add-tailwind/files/react-vite/index.css.template +2 -0
- package/dist/generators/add-tailwind/generator.js +26 -0
- package/dist/generators/allow-builds/generator.js +7 -207
- package/dist/generators/doctor/generator.js +388 -29
- package/dist/generators/entity/generator.js +4 -3
- package/dist/generators/feature/generator.js +4 -3
- package/dist/generators/init/generator.js +49 -10
- package/dist/generators/install-integration/generator.js +2 -2
- package/dist/generators/page/generator.js +4 -3
- package/dist/generators/shared/generator.js +4 -3
- package/dist/generators/widget/generator.js +4 -3
- package/dist/migrations/update-0.5.3/add-toolkit-config-lint-input.js +7 -3
- package/generators.json +10 -0
- package/package.json +1 -1
- package/src/generators/add-storybook/schema.json +33 -0
- package/src/generators/add-tailwind/schema.json +18 -0
- package/src/generators/init/schema.json +8 -0
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
import {
|
|
2
|
+
renderAddStorybookReport
|
|
3
|
+
} from "./chunk-SBOQHME6.js";
|
|
4
|
+
import {
|
|
5
|
+
resolveToolTarget,
|
|
6
|
+
storybookPreviewStep
|
|
7
|
+
} from "./chunk-MF75SQM6.js";
|
|
8
|
+
import {
|
|
9
|
+
pnpmMajorFromModulesManifest
|
|
10
|
+
} from "./chunk-OX7W4SJ2.js";
|
|
11
|
+
import {
|
|
12
|
+
STORYBOOK_ESLINT_IGNORE,
|
|
13
|
+
STORYBOOK_ESLINT_IMPORT,
|
|
14
|
+
STORYBOOK_ESLINT_PLUGIN,
|
|
15
|
+
STORYBOOK_ESLINT_SPREAD,
|
|
16
|
+
STORYBOOK_IGNORE_REASON,
|
|
17
|
+
STORYBOOK_PLUGIN_REACT,
|
|
18
|
+
STORYBOOK_PLUGIN_REACT_RANGE,
|
|
19
|
+
STORYBOOK_TAILWIND_CSS,
|
|
20
|
+
STORYBOOK_UNKNOWN_VITE_TARGET,
|
|
21
|
+
STORYBOOK_VITE_CONFIG_PLUGIN_TARGET,
|
|
22
|
+
STORYBOOK_VITE_PLUGIN_TARGET,
|
|
23
|
+
TAILWIND_CSS_IMPORT,
|
|
24
|
+
TAILWIND_DEPENDENCIES,
|
|
25
|
+
TAILWIND_VITE_IMPORT,
|
|
26
|
+
TAILWIND_VITE_PLUGIN,
|
|
27
|
+
applyStorybookEslintConfig,
|
|
28
|
+
ensurePreviewImport,
|
|
29
|
+
ensureTailwindCss,
|
|
30
|
+
storybookDefaultViteConfig,
|
|
31
|
+
storybookMainFramework,
|
|
32
|
+
storybookViteTarget,
|
|
33
|
+
stylesheetImportLine,
|
|
34
|
+
tailwindSourceLine,
|
|
35
|
+
widenStoriesGlob,
|
|
36
|
+
wireTailwindVitePlugin
|
|
37
|
+
} from "./chunk-B6RBCUIL.js";
|
|
38
|
+
import {
|
|
39
|
+
generatorFilesDir,
|
|
40
|
+
renderTemplateFiles
|
|
41
|
+
} from "./chunk-YNMLB4DL.js";
|
|
42
|
+
import {
|
|
43
|
+
resolveDryRun
|
|
44
|
+
} from "./chunk-TUN34LAQ.js";
|
|
45
|
+
import {
|
|
46
|
+
runNxFor
|
|
47
|
+
} from "./chunk-JSHZ6VSW.js";
|
|
48
|
+
import {
|
|
49
|
+
applyJsonEdits,
|
|
50
|
+
readToolkitConfig,
|
|
51
|
+
recordToolProject,
|
|
52
|
+
recordedToolProjects,
|
|
53
|
+
treePackageManager
|
|
54
|
+
} from "./chunk-736LFDT4.js";
|
|
55
|
+
import {
|
|
56
|
+
detectYarnFlavor,
|
|
57
|
+
packageManagerCommands
|
|
58
|
+
} from "./chunk-5Z7VZPES.js";
|
|
59
|
+
|
|
60
|
+
// src/generators/add-storybook/generator.ts
|
|
61
|
+
import { posix } from "node:path";
|
|
62
|
+
var STORYBOOK_MAINS = ["main.ts", "main.mts", "main.js"];
|
|
63
|
+
var STORYBOOK_PREVIEWS = ["preview.ts", "preview.tsx", "preview.mts", "preview.js", "preview.jsx"];
|
|
64
|
+
var ESLINT_CONFIGS = ["eslint.config.mjs", "eslint.config.js", "eslint.config.cjs", "eslint.config.ts", "eslint.config.mts"];
|
|
65
|
+
var SOURCE_STORIES_GLOB = "'../src/**/*.@(mdx|stories.@(js|jsx|ts|tsx))'";
|
|
66
|
+
var UI_FRAMEWORK = { "react-vite": "@storybook/react-vite", next: "@storybook/nextjs" };
|
|
67
|
+
var prefixOf = (root) => root === "" || root === "." ? "" : `${root}/`;
|
|
68
|
+
var storybookDirOf = (root) => `${prefixOf(root)}.storybook`;
|
|
69
|
+
var mainOf = (tree, root) => STORYBOOK_MAINS.map((name) => `${storybookDirOf(root)}/${name}`).find((path) => tree.exists(path));
|
|
70
|
+
function libraryCheck(tree, root) {
|
|
71
|
+
const main = mainOf(tree, root);
|
|
72
|
+
const framework = main === void 0 ? null : storybookMainFramework(tree.read(main, "utf-8") ?? "");
|
|
73
|
+
if (framework === null) return "unknown";
|
|
74
|
+
return framework === UI_FRAMEWORK["react-vite"] ? "react-vite" : { unsupported: framework };
|
|
75
|
+
}
|
|
76
|
+
function switchLibraryCommands(tree, refusal) {
|
|
77
|
+
const nx = runNxFor((path) => tree.exists(path), (path) => tree.read(path, "utf-8"));
|
|
78
|
+
return {
|
|
79
|
+
reason: "library-framework",
|
|
80
|
+
project: refusal.project,
|
|
81
|
+
root: refusal.root,
|
|
82
|
+
framework: refusal.framework,
|
|
83
|
+
commands: [`${nx} g @nx/storybook:configuration ${refusal.project} --uiFramework=${UI_FRAMEWORK["react-vite"]}`, `${nx} g @clearlydev/nx-archweave:add-storybook --project=${refusal.project}`]
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
function readJsonObject(tree, path) {
|
|
87
|
+
try {
|
|
88
|
+
const parsed = JSON.parse(tree.read(path, "utf-8") ?? "null");
|
|
89
|
+
return typeof parsed === "object" && parsed !== null && !Array.isArray(parsed) ? parsed : null;
|
|
90
|
+
} catch {
|
|
91
|
+
return null;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
function storybookRange(tree, appRoot) {
|
|
95
|
+
for (const path of [.../* @__PURE__ */ new Set(["package.json", `${prefixOf(appRoot)}package.json`])]) {
|
|
96
|
+
const pkg = readJsonObject(tree, path);
|
|
97
|
+
for (const field of ["devDependencies", "dependencies"]) {
|
|
98
|
+
const range = pkg?.[field]?.["storybook"];
|
|
99
|
+
if (typeof range === "string") return range;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
return null;
|
|
103
|
+
}
|
|
104
|
+
function pnpmMajor(tree) {
|
|
105
|
+
const declared = /^pnpm@(\d+)\./.exec(String(readJsonObject(tree, "package.json")?.["packageManager"] ?? ""))?.[1];
|
|
106
|
+
if (declared !== void 0) return Number(declared);
|
|
107
|
+
const modules = tree.read("node_modules/.modules.yaml", "utf-8");
|
|
108
|
+
return modules === null ? void 0 : pnpmMajorFromModulesManifest(modules);
|
|
109
|
+
}
|
|
110
|
+
function setupCommands(tree, project, framework, passedProject) {
|
|
111
|
+
const nx = runNxFor((path) => tree.exists(path), (path) => tree.read(path, "utf-8"));
|
|
112
|
+
const major = pnpmMajor(tree);
|
|
113
|
+
const pnpm = treePackageManager(tree, readToolkitConfig(tree)) === "pnpm";
|
|
114
|
+
return {
|
|
115
|
+
reason: "no-storybook-config",
|
|
116
|
+
project,
|
|
117
|
+
commands: [
|
|
118
|
+
`${nx} add @nx/storybook`,
|
|
119
|
+
`${nx} g @nx/storybook:configuration ${project} --uiFramework=${UI_FRAMEWORK[framework]}`,
|
|
120
|
+
`${nx} g @clearlydev/nx-archweave:add-storybook${passedProject === void 0 ? "" : ` --project=${passedProject}`}`
|
|
121
|
+
],
|
|
122
|
+
coreJsPure: pnpm && framework === "next" && (major === void 0 || major >= 11) ? ["pnpm approve-builds '!core-js-pure'", "pnpm install"] : null
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
function storiesStep(tree, main, write) {
|
|
126
|
+
const result = widenStoriesGlob(tree.read(main, "utf-8") ?? "");
|
|
127
|
+
if (result.status === "applied" && write) tree.write(main, result.text);
|
|
128
|
+
return result.status === "unrecognized" ? { file: main, outcome: "not-wired", reason: result.reason, lines: [SOURCE_STORIES_GLOB], target: "the stories array" } : { file: main, outcome: result.status };
|
|
129
|
+
}
|
|
130
|
+
function eslintStep(tree, app, applyEslint, write) {
|
|
131
|
+
const lines = [STORYBOOK_ESLINT_IMPORT, STORYBOOK_ESLINT_IGNORE, STORYBOOK_ESLINT_SPREAD];
|
|
132
|
+
const config = ESLINT_CONFIGS.map((name) => `${prefixOf(app.root)}${name}`).find((path) => tree.exists(path));
|
|
133
|
+
if (config === void 0) return { file: `${prefixOf(app.root)}eslint.config.mjs`, outcome: "not-wired", reason: "no-eslint-config", lines, note: STORYBOOK_IGNORE_REASON };
|
|
134
|
+
const rootConfig = prefixOf(app.root) === "" ? void 0 : ESLINT_CONFIGS.find((name) => tree.exists(name));
|
|
135
|
+
const result = applyStorybookEslintConfig(tree.read(config, "utf-8") ?? "", rootConfig === void 0 ? "" : tree.read(rootConfig, "utf-8") ?? "");
|
|
136
|
+
if (result.status === "already-applied") return { file: config, outcome: "already-applied" };
|
|
137
|
+
if (result.status === "unrecognized") return { file: config, outcome: "not-wired", reason: result.reason, lines, note: STORYBOOK_IGNORE_REASON };
|
|
138
|
+
if (!applyEslint) return { file: config, outcome: "not-wired", reason: "without-apply-eslint", lines, note: STORYBOOK_IGNORE_REASON };
|
|
139
|
+
if (write) tree.write(config, result.text);
|
|
140
|
+
return { file: config, outcome: "applied" };
|
|
141
|
+
}
|
|
142
|
+
function previewStep(tree, app, write) {
|
|
143
|
+
if (!recordedToolProjects(readToolkitConfig(tree), "tailwind").includes(app.project)) return null;
|
|
144
|
+
return storybookPreviewStep(tree, app, write, { stylesheetMustExist: true });
|
|
145
|
+
}
|
|
146
|
+
function addDependencies(tree, root, wanted, write) {
|
|
147
|
+
const raw = tree.read("package.json", "utf-8");
|
|
148
|
+
const missing = wanted.filter(([name]) => !declares(tree, root, name));
|
|
149
|
+
if (raw === null || readJsonObject(tree, "package.json") === null) return { dependencies: "unrecognized", added: missing.map(([name]) => name) };
|
|
150
|
+
if (missing.length === 0) return { dependencies: "present", added: [] };
|
|
151
|
+
if (write) tree.write("package.json", applyJsonEdits(raw, missing.map(([name, range]) => [["devDependencies", name], range])));
|
|
152
|
+
return { dependencies: "added", added: missing.map(([name]) => name) };
|
|
153
|
+
}
|
|
154
|
+
function declares(tree, root, name) {
|
|
155
|
+
return [.../* @__PURE__ */ new Set(["package.json", `${prefixOf(root)}package.json`])].some(
|
|
156
|
+
(path) => ["dependencies", "devDependencies"].some((field) => readJsonObject(tree, path)?.[field]?.[name] !== void 0)
|
|
157
|
+
);
|
|
158
|
+
}
|
|
159
|
+
var PLUGIN_REACT_IMPORT = /^\s*import\s[^;]*?\bfrom\s*['"]@vitejs\/plugin-react['"]/m;
|
|
160
|
+
function libraryVitePluginStep(tree, root, main, write) {
|
|
161
|
+
const mainText = tree.read(main, "utf-8") ?? "";
|
|
162
|
+
const target = storybookViteTarget(mainText);
|
|
163
|
+
const viteConfig = target.kind === "viteConfigPath" ? posix.join(root, target.path) : target.kind === "none" ? storybookDefaultViteConfig(root, (path) => tree.exists(path)) : null;
|
|
164
|
+
if (target.kind === "none" && viteConfig === null) {
|
|
165
|
+
return { file: main, outcome: "not-wired", what: "tailwind-plugin", reason: "no-vite-target", lines: [TAILWIND_VITE_IMPORT, `${TAILWIND_VITE_PLUGIN} // in ${STORYBOOK_UNKNOWN_VITE_TARGET}`] };
|
|
166
|
+
}
|
|
167
|
+
const file = viteConfig ?? main;
|
|
168
|
+
const what = target.kind === "viteFinal" ? "tailwind-plugin" : target.kind === "viteConfigPath" ? "tailwind-plugin-vite-config" : "tailwind-plugin-default-vite-config";
|
|
169
|
+
const lines = [TAILWIND_VITE_IMPORT, `${TAILWIND_VITE_PLUGIN} // in ${target.kind === "viteFinal" ? STORYBOOK_VITE_PLUGIN_TARGET : STORYBOOK_VITE_CONFIG_PLUGIN_TARGET}`];
|
|
170
|
+
const text = target.kind === "viteFinal" ? mainText : tree.read(file, "utf-8");
|
|
171
|
+
if (text === null) return { file, outcome: "not-wired", what, reason: "no-vite-config", lines };
|
|
172
|
+
const result = wireTailwindVitePlugin(text);
|
|
173
|
+
if (result.status === "applied" && write) tree.write(file, result.text);
|
|
174
|
+
return result.status === "unrecognized" ? { file, outcome: "not-wired", what, reason: result.reason, lines } : { file, outcome: result.status, what };
|
|
175
|
+
}
|
|
176
|
+
function libraryTailwindSteps(tree, root, main, write) {
|
|
177
|
+
const storybookDir = storybookDirOf(root);
|
|
178
|
+
const steps = [libraryVitePluginStep(tree, root, main, write)];
|
|
179
|
+
const css = `${storybookDir}/tailwind.css`;
|
|
180
|
+
const cssText = tree.read(css, "utf-8");
|
|
181
|
+
if (cssText === null) {
|
|
182
|
+
const files = renderTemplateFiles(posix.join(generatorFilesDir("add-storybook", import.meta.url), "library"), storybookDir, {});
|
|
183
|
+
if (write) for (const file of files) tree.write(file.filePath, file.content);
|
|
184
|
+
steps.push({ file: css, outcome: "created" });
|
|
185
|
+
} else {
|
|
186
|
+
const sourceLine = tailwindSourceLine("../src");
|
|
187
|
+
const result = ensureTailwindCss(cssText, sourceLine);
|
|
188
|
+
if (result.status === "applied" && write) tree.write(css, result.text);
|
|
189
|
+
steps.push(result.status === "unrecognized" ? { file: css, outcome: "not-wired", reason: result.reason, lines: [TAILWIND_CSS_IMPORT, sourceLine] } : { file: css, outcome: result.status });
|
|
190
|
+
}
|
|
191
|
+
const preview = STORYBOOK_PREVIEWS.map((name) => `${storybookDir}/${name}`).find((path) => tree.exists(path));
|
|
192
|
+
if (preview === void 0) {
|
|
193
|
+
steps.push({ file: `${storybookDir}/preview.ts`, outcome: "not-wired", reason: "no-preview", lines: [stylesheetImportLine(STORYBOOK_TAILWIND_CSS)] });
|
|
194
|
+
} else {
|
|
195
|
+
const result = ensurePreviewImport(tree.read(preview, "utf-8") ?? "", STORYBOOK_TAILWIND_CSS);
|
|
196
|
+
if (result.status === "applied" && write) tree.write(preview, result.text);
|
|
197
|
+
steps.push(result.status === "unrecognized" ? { file: preview, outcome: "not-wired", reason: result.reason, lines: [stylesheetImportLine(STORYBOOK_TAILWIND_CSS)] } : { file: preview, outcome: result.status });
|
|
198
|
+
}
|
|
199
|
+
return steps;
|
|
200
|
+
}
|
|
201
|
+
function exampleFiles(tree, app, write) {
|
|
202
|
+
const target = `${prefixOf(app.sourceRoot)}shared/ui`;
|
|
203
|
+
const files = renderTemplateFiles(posix.join(generatorFilesDir("add-storybook", import.meta.url), "example"), target, { storybookFramework: UI_FRAMEWORK[app.framework] });
|
|
204
|
+
const existing = files.map((file) => file.filePath).filter((path) => tree.exists(path));
|
|
205
|
+
if (existing.length > 0) return { outcome: "skipped", existing };
|
|
206
|
+
if (write) for (const file of files) tree.write(file.filePath, file.content);
|
|
207
|
+
return { outcome: "created", files: files.map((file) => file.filePath) };
|
|
208
|
+
}
|
|
209
|
+
var refusedReport = (dryRun, refusal) => ({
|
|
210
|
+
dryRun,
|
|
211
|
+
refusal,
|
|
212
|
+
project: null,
|
|
213
|
+
projectType: null,
|
|
214
|
+
framework: null,
|
|
215
|
+
steps: [],
|
|
216
|
+
dependencies: null,
|
|
217
|
+
added: [],
|
|
218
|
+
example: null,
|
|
219
|
+
record: null,
|
|
220
|
+
tailwindRecord: null,
|
|
221
|
+
replacedSection: false,
|
|
222
|
+
installCommand: null
|
|
223
|
+
});
|
|
224
|
+
function runAddStorybook(tree, options) {
|
|
225
|
+
const dryRun = options.dryRun ?? false;
|
|
226
|
+
const target = resolveToolTarget(tree, options.project, { libraries: libraryCheck });
|
|
227
|
+
if (target.kind === "refused") {
|
|
228
|
+
const { refusal } = target;
|
|
229
|
+
return refusedReport(dryRun, refusal.reason === "unsupported-library" && refusal.framework === UI_FRAMEWORK.next ? switchLibraryCommands(tree, refusal) : refusal);
|
|
230
|
+
}
|
|
231
|
+
const main = mainOf(tree, target.root);
|
|
232
|
+
if (main === void 0) return refusedReport(dryRun, setupCommands(tree, target.project, target.framework, options.project));
|
|
233
|
+
const range = storybookRange(tree, target.root);
|
|
234
|
+
if (range === null) {
|
|
235
|
+
const nx = runNxFor((path) => tree.exists(path), (path) => tree.read(path, "utf-8"));
|
|
236
|
+
return refusedReport(dryRun, { reason: "no-storybook-dependency", project: target.project, command: `${nx} add @nx/storybook` });
|
|
237
|
+
}
|
|
238
|
+
const write = !dryRun;
|
|
239
|
+
const library = target.projectType === "library";
|
|
240
|
+
const app = { project: target.project, root: target.root, sourceRoot: target.sourceRoot, framework: target.framework };
|
|
241
|
+
const mainImportsPluginReact = PLUGIN_REACT_IMPORT.test(tree.read(main, "utf-8") ?? "");
|
|
242
|
+
const steps = [storiesStep(tree, main, write), eslintStep(tree, app, options.applyEslint ?? false, write)];
|
|
243
|
+
const wanted = [[STORYBOOK_ESLINT_PLUGIN, range]];
|
|
244
|
+
const tailwind = library && (options.tailwind === true || recordedToolProjects(readToolkitConfig(tree), "storybook", "tailwind").includes(app.project));
|
|
245
|
+
if (tailwind) {
|
|
246
|
+
steps.push(...libraryTailwindSteps(tree, app.root, main, write));
|
|
247
|
+
wanted.push(...Object.entries({ ...TAILWIND_DEPENDENCIES.common, ...TAILWIND_DEPENDENCIES["react-vite"] }));
|
|
248
|
+
}
|
|
249
|
+
if (!library) {
|
|
250
|
+
const preview = previewStep(tree, app, write);
|
|
251
|
+
if (preview !== null) steps.push(preview);
|
|
252
|
+
}
|
|
253
|
+
if (library && mainImportsPluginReact) wanted.push([STORYBOOK_PLUGIN_REACT, STORYBOOK_PLUGIN_REACT_RANGE]);
|
|
254
|
+
const { dependencies, added } = addDependencies(tree, app.root, wanted, write);
|
|
255
|
+
const example = !options.example ? null : library ? { outcome: "not-for-libraries" } : exampleFiles(tree, app, write);
|
|
256
|
+
const config = readToolkitConfig(tree);
|
|
257
|
+
const section = config?.["storybook"];
|
|
258
|
+
const replacedSection = section !== void 0 && (typeof section !== "object" || section === null || Array.isArray(section));
|
|
259
|
+
const record = recordToolProject(tree, "storybook", app.project, write);
|
|
260
|
+
const tailwindOutcome = tailwind ? recordToolProject(tree, "storybook", app.project, write, "tailwind") : null;
|
|
261
|
+
const tailwindRecord = tailwindOutcome === "created" && record === "created" ? "updated" : tailwindOutcome;
|
|
262
|
+
const known = treePackageManager(tree, config);
|
|
263
|
+
const pm = known ?? "pnpm";
|
|
264
|
+
const install = packageManagerCommands(pm, pm === "yarn" ? detectYarnFlavor((path) => tree.exists(path), (path) => tree.read(path, "utf-8")) : void 0).install;
|
|
265
|
+
return {
|
|
266
|
+
dryRun,
|
|
267
|
+
refusal: null,
|
|
268
|
+
project: app.project,
|
|
269
|
+
projectType: target.projectType,
|
|
270
|
+
framework: app.framework,
|
|
271
|
+
steps,
|
|
272
|
+
dependencies,
|
|
273
|
+
added,
|
|
274
|
+
pluginReact: dependencies !== "present" && added.includes(STORYBOOK_PLUGIN_REACT),
|
|
275
|
+
example,
|
|
276
|
+
record,
|
|
277
|
+
tailwindRecord,
|
|
278
|
+
replacedSection: replacedSection && record !== "unrecognized",
|
|
279
|
+
installCommand: dependencies === "added" ? install : null,
|
|
280
|
+
...dependencies === "added" && known === null ? { installAssumed: true } : {},
|
|
281
|
+
...!library && options.tailwind === true ? { tailwindIgnored: true } : {}
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
async function addStorybookGenerator(tree, options) {
|
|
285
|
+
console.log(renderAddStorybookReport(runAddStorybook(tree, { ...options, dryRun: resolveDryRun(options) })));
|
|
286
|
+
}
|
|
287
|
+
var generator_default = addStorybookGenerator;
|
|
288
|
+
|
|
289
|
+
export {
|
|
290
|
+
storybookRange,
|
|
291
|
+
runAddStorybook,
|
|
292
|
+
addStorybookGenerator,
|
|
293
|
+
generator_default
|
|
294
|
+
};
|
|
@@ -0,0 +1,325 @@
|
|
|
1
|
+
import {
|
|
2
|
+
insertConfigEntries
|
|
3
|
+
} from "./chunk-KNVBFTH4.js";
|
|
4
|
+
import {
|
|
5
|
+
maskComments
|
|
6
|
+
} from "./chunk-6ZTIUBB2.js";
|
|
7
|
+
|
|
8
|
+
// ../templates/dist/tailwind/tailwind.js
|
|
9
|
+
var TAILWIND_DEPENDENCIES = {
|
|
10
|
+
common: { tailwindcss: "^4.3.5" },
|
|
11
|
+
"react-vite": { "@tailwindcss/vite": "^4.3.5" },
|
|
12
|
+
next: { "@tailwindcss/postcss": "^4.3.5", postcss: "^8.5.34" }
|
|
13
|
+
};
|
|
14
|
+
var TAILWIND_CSS_IMPORT = '@import "tailwindcss";';
|
|
15
|
+
function tailwindSourceLine(path) {
|
|
16
|
+
return `@source "${path}";`;
|
|
17
|
+
}
|
|
18
|
+
var TAILWIND_VITE_IMPORT = "import tailwindcss from '@tailwindcss/vite';";
|
|
19
|
+
var TAILWIND_VITE_PLUGIN = "tailwindcss()";
|
|
20
|
+
function stylesheetImportLine(spec) {
|
|
21
|
+
return `import '${spec}';`;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// ../templates/dist/storybook/storybook.js
|
|
25
|
+
var STORYBOOK_ESLINT_PLUGIN = "eslint-plugin-storybook";
|
|
26
|
+
var STORYBOOK_ESLINT_IMPORT = "import storybook from 'eslint-plugin-storybook';";
|
|
27
|
+
var STORYBOOK_ESLINT_IGNORE = "{ ignores: ['storybook-static'] },";
|
|
28
|
+
var STORYBOOK_ESLINT_SPREAD = "...storybook.configs['flat/recommended'],";
|
|
29
|
+
var STORYBOOK_IGNORE_REASON = "build-storybook writes storybook-static/ inside the app, and ESLint doesn't read .gitignore, so lint fails on the bundle without this";
|
|
30
|
+
var STORYBOOK_TAILWIND_CSS = "./tailwind.css";
|
|
31
|
+
var STORYBOOK_VITE_PLUGIN_TARGET = "viteFinal's plugins, after react()";
|
|
32
|
+
var STORYBOOK_VITE_CONFIG_PLUGIN_TARGET = "its plugins array, right after react()";
|
|
33
|
+
var STORYBOOK_UNKNOWN_VITE_TARGET = "the plugins of the Vite config this Storybook uses";
|
|
34
|
+
var STORYBOOK_PLUGIN_REACT = "@vitejs/plugin-react";
|
|
35
|
+
var STORYBOOK_PLUGIN_REACT_RANGE = "^5.2.0";
|
|
36
|
+
|
|
37
|
+
// ../template-engine/dist/storybook/storybook-edits.js
|
|
38
|
+
import { posix } from "node:path";
|
|
39
|
+
var COVERING_GLOB = /['"]\.\.\/(?:src\/)?\*\*\//;
|
|
40
|
+
var NX_APP_LAYER_GLOB = /(['"])\.\.\/src\/(?:app|lib)\/\*\*\//g;
|
|
41
|
+
function storiesCoverSource(mainText) {
|
|
42
|
+
return COVERING_GLOB.test(maskComments(mainText));
|
|
43
|
+
}
|
|
44
|
+
function widenStoriesGlob(mainText) {
|
|
45
|
+
if (storiesCoverSource(mainText))
|
|
46
|
+
return { status: "already-applied" };
|
|
47
|
+
const masked = maskComments(mainText);
|
|
48
|
+
if (!/\bstories\s*:/.test(masked))
|
|
49
|
+
return { status: "unrecognized", reason: "no-stories-glob" };
|
|
50
|
+
const matches = [...masked.matchAll(NX_APP_LAYER_GLOB)];
|
|
51
|
+
if (matches.length === 0)
|
|
52
|
+
return { status: "unrecognized", reason: "narrow-stories-glob" };
|
|
53
|
+
let text = mainText;
|
|
54
|
+
for (const match of matches.reverse()) {
|
|
55
|
+
text = `${text.slice(0, match.index)}${match[1]}../src/**/${text.slice(match.index + match[0].length)}`;
|
|
56
|
+
}
|
|
57
|
+
return { status: "applied", text };
|
|
58
|
+
}
|
|
59
|
+
var PLUGIN_IMPORT = /^\s*import\s+([A-Za-z_$][\w$]*)\s+from\s+['"]eslint-plugin-storybook['"]/m;
|
|
60
|
+
var IGNORE = /ignores\s*:\s*\[[^\]]*['"](?:\*\*\/)?storybook-static(?:\/\*\*)?['"]/;
|
|
61
|
+
var spreadOf = (name) => new RegExp(`\\.\\.\\.\\s*${name.replace(/\$/g, "\\$")}\\.configs\\s*\\[`);
|
|
62
|
+
function storybookEslintStatus(configText, rootConfigText = "") {
|
|
63
|
+
const masked = maskComments(configText);
|
|
64
|
+
const imported = PLUGIN_IMPORT.exec(masked);
|
|
65
|
+
return { plugin: imported !== null && spreadOf(imported[1]).test(masked), ignore: IGNORE.test(masked) || IGNORE.test(maskComments(rootConfigText)) };
|
|
66
|
+
}
|
|
67
|
+
function applyStorybookEslintConfig(configText, rootConfigText = "") {
|
|
68
|
+
const masked = maskComments(configText);
|
|
69
|
+
const imported = PLUGIN_IMPORT.exec(masked);
|
|
70
|
+
const name = imported?.[1] ?? "storybook";
|
|
71
|
+
const imports = imported === null ? [STORYBOOK_ESLINT_IMPORT] : [];
|
|
72
|
+
const ignored = IGNORE.test(masked) || IGNORE.test(maskComments(rootConfigText));
|
|
73
|
+
const spread = name === "storybook" ? STORYBOOK_ESLINT_SPREAD : STORYBOOK_ESLINT_SPREAD.replace("storybook.", `${name}.`);
|
|
74
|
+
const entries = [...ignored ? [] : [STORYBOOK_ESLINT_IGNORE], ...spreadOf(name).test(masked) ? [] : [spread]];
|
|
75
|
+
if (imports.length === 0 && entries.length === 0)
|
|
76
|
+
return { status: "already-applied" };
|
|
77
|
+
const result = insertConfigEntries(configText, imports, entries);
|
|
78
|
+
return result.status === "applied" ? result : { status: "unrecognized", reason: "unknown-eslint-config" };
|
|
79
|
+
}
|
|
80
|
+
var IMPORT_SPEC = /^[ \t]*import\b(?:[^;'"]*?\bfrom\s*)?\s*['"]([^'"]+)['"]/gm;
|
|
81
|
+
function ensurePreviewImport(previewText, spec) {
|
|
82
|
+
const masked = maskComments(previewText);
|
|
83
|
+
const imports = [...masked.matchAll(IMPORT_SPEC)];
|
|
84
|
+
if (imports.some((match) => posix.normalize(match[1]) === posix.normalize(spec)))
|
|
85
|
+
return { status: "already-applied" };
|
|
86
|
+
const eol = previewText.includes("\r\n") ? "\r\n" : "\n";
|
|
87
|
+
const line = `${stylesheetImportLine(spec)}${eol}`;
|
|
88
|
+
const first = imports[0]?.index ?? 0;
|
|
89
|
+
return { status: "applied", text: `${previewText.slice(0, first)}${line}${previewText.slice(first)}` };
|
|
90
|
+
}
|
|
91
|
+
var FRAMEWORK = /\bframework\s*:\s*(?:(\{)|[^'"\n,}]*?['"]([^'"]+)['"])/;
|
|
92
|
+
var FRAMEWORK_NAME = /\bname\s*:\s*[^'"\n,}]*?['"]([^'"]+)['"]/;
|
|
93
|
+
function storybookMainFramework(mainText) {
|
|
94
|
+
const masked = maskComments(mainText);
|
|
95
|
+
const match = FRAMEWORK.exec(masked);
|
|
96
|
+
if (match === null)
|
|
97
|
+
return null;
|
|
98
|
+
if (match[1] === void 0)
|
|
99
|
+
return match[2];
|
|
100
|
+
let depth = 0;
|
|
101
|
+
let own = "";
|
|
102
|
+
for (let index = match.index + match[0].length - 1; index < masked.length; index++) {
|
|
103
|
+
const char = masked[index];
|
|
104
|
+
if (char === "{")
|
|
105
|
+
depth++;
|
|
106
|
+
else if (char === "}" && --depth === 0)
|
|
107
|
+
break;
|
|
108
|
+
else if (depth === 1)
|
|
109
|
+
own += char;
|
|
110
|
+
}
|
|
111
|
+
return FRAMEWORK_NAME.exec(own)?.[1] ?? null;
|
|
112
|
+
}
|
|
113
|
+
function storybookViteTarget(mainText) {
|
|
114
|
+
const masked = maskComments(mainText);
|
|
115
|
+
if (/\bviteFinal\s*[:(]/.test(masked))
|
|
116
|
+
return { kind: "viteFinal" };
|
|
117
|
+
const path = /\bviteConfigPath\s*:\s*['"]([^'"]+)['"]/.exec(masked)?.[1];
|
|
118
|
+
return path === void 0 ? { kind: "none" } : { kind: "viteConfigPath", path };
|
|
119
|
+
}
|
|
120
|
+
var VITE_CONFIG_NAMES = ["vite.config.js", "vite.config.mjs", "vite.config.ts", "vite.config.cjs", "vite.config.mts", "vite.config.cts"];
|
|
121
|
+
function storybookDefaultViteConfig(root, exists) {
|
|
122
|
+
const found = VITE_CONFIG_NAMES.map((name) => posix.join(root, name)).filter(exists);
|
|
123
|
+
return found.length === 1 ? found[0] : null;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// ../template-engine/dist/tailwind/tailwind-edits.js
|
|
127
|
+
var eolOf = (text) => text.includes("\r\n") ? "\r\n" : "\n";
|
|
128
|
+
function closingIndex(text, open, opener, closer) {
|
|
129
|
+
let depth = 0;
|
|
130
|
+
for (let index = open; index < text.length; index++) {
|
|
131
|
+
if (text[index] === opener)
|
|
132
|
+
depth++;
|
|
133
|
+
else if (text[index] === closer && --depth === 0)
|
|
134
|
+
return index + 1;
|
|
135
|
+
}
|
|
136
|
+
return -1;
|
|
137
|
+
}
|
|
138
|
+
function pluginArrays(text) {
|
|
139
|
+
const openings = [];
|
|
140
|
+
for (const match of text.matchAll(/\bplugins\s*:\s*\[/g)) {
|
|
141
|
+
const lineStart = text.lastIndexOf("\n", match.index) + 1;
|
|
142
|
+
if (text.slice(lineStart, match.index).trim().startsWith("//"))
|
|
143
|
+
continue;
|
|
144
|
+
openings.push(match.index + match[0].length - 1);
|
|
145
|
+
}
|
|
146
|
+
return openings;
|
|
147
|
+
}
|
|
148
|
+
var TAILWIND_VITE_IMPORT_NAME = /^\s*import\s+([A-Za-z_$][\w$]*)\s+from\s+['"]@tailwindcss\/vite['"]/m;
|
|
149
|
+
var callOf = (name) => new RegExp(`(?<![\\w$.])${name.replace(/\$/g, "\\$")}\\s*\\(`);
|
|
150
|
+
function loadsTailwindVitePlugin(configText) {
|
|
151
|
+
const masked = maskComments(configText);
|
|
152
|
+
const name = TAILWIND_VITE_IMPORT_NAME.exec(masked)?.[1];
|
|
153
|
+
return name !== void 0 && callOf(name).test(masked);
|
|
154
|
+
}
|
|
155
|
+
function wireTailwindVitePlugin(configText) {
|
|
156
|
+
const masked = maskComments(configText);
|
|
157
|
+
const imported = TAILWIND_VITE_IMPORT_NAME.exec(masked)?.[1];
|
|
158
|
+
if (imported === void 0 && masked.includes("@tailwindcss/vite"))
|
|
159
|
+
return { status: "unrecognized", reason: "tailwind-import-shape" };
|
|
160
|
+
const name = imported ?? "tailwindcss";
|
|
161
|
+
const arrays = pluginArrays(configText);
|
|
162
|
+
const open = arrays.length === 1 ? arrays[0] : -1;
|
|
163
|
+
const close = open === -1 ? -1 : closingIndex(configText, open, "[", "]");
|
|
164
|
+
const calledAnywhere = callOf(name).test(masked);
|
|
165
|
+
const called = close === -1 ? calledAnywhere : callOf(name).test(masked.slice(open, close));
|
|
166
|
+
if (imported !== void 0 && called)
|
|
167
|
+
return { status: "already-applied" };
|
|
168
|
+
if (arrays.length === 0)
|
|
169
|
+
return { status: "unrecognized", reason: "no-plugins-array" };
|
|
170
|
+
if (arrays.length > 1)
|
|
171
|
+
return { status: "unrecognized", reason: "several-plugins-arrays" };
|
|
172
|
+
if (calledAnywhere && !called)
|
|
173
|
+
return { status: "unrecognized", reason: "tailwind-call-outside-plugins" };
|
|
174
|
+
const reactImport = /^import\s+(\w+)\s+from\s+['"]@vitejs\/plugin-react(?:-swc)?['"];?[ \t]*\r?$/m.exec(configText);
|
|
175
|
+
if (reactImport === null)
|
|
176
|
+
return { status: "unrecognized", reason: "no-react-plugin" };
|
|
177
|
+
const call = new RegExp(`\\b${reactImport[1]}\\s*\\(`).exec(configText.slice(open, close));
|
|
178
|
+
if (close === -1 || call === null)
|
|
179
|
+
return { status: "unrecognized", reason: "no-react-plugin" };
|
|
180
|
+
const callOpen = open + call.index + call[0].length - 1;
|
|
181
|
+
const callEnd = closingIndex(configText, callOpen, "(", ")");
|
|
182
|
+
if (callEnd === -1)
|
|
183
|
+
return { status: "unrecognized", reason: "no-react-plugin" };
|
|
184
|
+
const eol = eolOf(configText);
|
|
185
|
+
const importEnd = reactImport.index + reactImport[0].replace(/\r$/, "").length;
|
|
186
|
+
const withPlugin = called ? configText : `${configText.slice(0, callEnd)}, ${name}()${configText.slice(callEnd)}`;
|
|
187
|
+
const text = imported !== void 0 ? withPlugin : `${withPlugin.slice(0, importEnd)}${eol}${TAILWIND_VITE_IMPORT}${withPlugin.slice(importEnd)}`;
|
|
188
|
+
return { status: "applied", text };
|
|
189
|
+
}
|
|
190
|
+
function prependStylesheetImport(moduleText, spec) {
|
|
191
|
+
const escaped = spec.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
192
|
+
if (new RegExp(`^\\s*import\\s+['"]${escaped}['"]`, "m").test(moduleText))
|
|
193
|
+
return { status: "already-applied" };
|
|
194
|
+
if (!/^\s*import\s/m.test(moduleText))
|
|
195
|
+
return { status: "unrecognized", reason: "no-imports" };
|
|
196
|
+
return { status: "applied", text: `${stylesheetImportLine(spec)}${eolOf(moduleText)}${moduleText}` };
|
|
197
|
+
}
|
|
198
|
+
var TAILWIND_IMPORT = /^@import\s+['"]tailwindcss(?:\/[^'"]+)?['"][^;\r\n]*;?[ \t]*\r?$/m;
|
|
199
|
+
function ensureTailwindCss(cssText, sourceLine) {
|
|
200
|
+
const eol = eolOf(cssText);
|
|
201
|
+
const wanted = tailwindSourcePaths(sourceLine)[0];
|
|
202
|
+
const hasSource = tailwindSourcePaths(cssText).includes(wanted);
|
|
203
|
+
const existing = TAILWIND_IMPORT.exec(cssText);
|
|
204
|
+
if (existing !== null && hasSource)
|
|
205
|
+
return { status: "already-applied" };
|
|
206
|
+
if (existing !== null) {
|
|
207
|
+
const end = existing.index + existing[0].replace(/\r$/, "").length;
|
|
208
|
+
const rest = cssText.slice(end);
|
|
209
|
+
const tail = rest.startsWith(eol) ? rest : `${eol}${rest}`;
|
|
210
|
+
return { status: "applied", text: `${cssText.slice(0, end)}${eol}${sourceLine}${tail}` };
|
|
211
|
+
}
|
|
212
|
+
const head = hasSource ? `${TAILWIND_CSS_IMPORT}${eol}` : `${TAILWIND_CSS_IMPORT}${eol}${sourceLine}${eol}`;
|
|
213
|
+
const charset = /^@charset\s[^\r\n]*\r?\n/.exec(cssText);
|
|
214
|
+
const at = charset === null ? 0 : charset[0].length;
|
|
215
|
+
return { status: "applied", text: `${cssText.slice(0, at)}${head}${cssText.slice(at)}` };
|
|
216
|
+
}
|
|
217
|
+
function layoutStylesheet(layoutText) {
|
|
218
|
+
const specs = [...layoutText.matchAll(/^\s*import\s+['"](\.\.?\/[^'"]+\.css)['"]/gm)].map((match) => match[1]);
|
|
219
|
+
if (specs.length === 0)
|
|
220
|
+
return { status: "unrecognized", reason: "no-css-import" };
|
|
221
|
+
if (specs.length > 1)
|
|
222
|
+
return { status: "unrecognized", reason: "several-css-imports" };
|
|
223
|
+
return { status: "found", spec: specs[0] };
|
|
224
|
+
}
|
|
225
|
+
function postcssHasTailwind(text) {
|
|
226
|
+
return text.includes("@tailwindcss/postcss");
|
|
227
|
+
}
|
|
228
|
+
function hasTailwindImport(cssText) {
|
|
229
|
+
return TAILWIND_IMPORT.test(cssText);
|
|
230
|
+
}
|
|
231
|
+
function tailwindSourcePaths(cssText) {
|
|
232
|
+
return [...cssText.matchAll(/^[ \t]*@source\s+['"]([^'"]+)['"]/gm)].map((match) => match[1]);
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
// ../template-engine/dist/tailwind/loaded-stylesheets.js
|
|
236
|
+
import { posix as posix2 } from "node:path";
|
|
237
|
+
var SOURCE_FILE = /\.(?:[cm]?[jt]sx?)$/;
|
|
238
|
+
var SCAN_LIMIT = 2e3;
|
|
239
|
+
var prefixOf = (root) => root === "" || root === "." ? "" : `${root}/`;
|
|
240
|
+
var viteAppLayerStylesheet = (sourceRoot) => `${prefixOf(sourceRoot)}app/styles/index.css`;
|
|
241
|
+
function sourceFiles(files, dir, out = []) {
|
|
242
|
+
for (const name of files.children(dir)) {
|
|
243
|
+
if (out.length >= SCAN_LIMIT)
|
|
244
|
+
break;
|
|
245
|
+
if (name === "node_modules" || name.startsWith("."))
|
|
246
|
+
continue;
|
|
247
|
+
const path = `${prefixOf(dir)}${name}`;
|
|
248
|
+
if (!files.isFile(path))
|
|
249
|
+
sourceFiles(files, path, out);
|
|
250
|
+
else if (SOURCE_FILE.test(name))
|
|
251
|
+
out.push(path);
|
|
252
|
+
}
|
|
253
|
+
return out;
|
|
254
|
+
}
|
|
255
|
+
function loadedViteStylesheets(app, files) {
|
|
256
|
+
const appDir = prefixOf(app.root);
|
|
257
|
+
const sheets = /* @__PURE__ */ new Set();
|
|
258
|
+
for (const file of sourceFiles(files, app.sourceRoot)) {
|
|
259
|
+
for (const match of (files.read(file) ?? "").matchAll(/^\s*import\s+['"](\.\.?\/[^'"]+\.css)['"]/gm)) {
|
|
260
|
+
sheets.add(posix2.normalize(posix2.join(posix2.dirname(file), match[1])));
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
for (const match of (files.read(`${appDir}index.html`) ?? "").matchAll(/<link\b[^>]*\bhref=["']([^"':]+\.css)["'][^>]*>/gi)) {
|
|
264
|
+
const href = match[1];
|
|
265
|
+
sheets.add(posix2.normalize(href.startsWith("/") ? `${appDir}${href.slice(1)}` : `${appDir}${href}`));
|
|
266
|
+
}
|
|
267
|
+
return [...sheets];
|
|
268
|
+
}
|
|
269
|
+
function viteTailwindEntry(app, files, loaded = loadedViteStylesheets(app, files)) {
|
|
270
|
+
const wired = loaded.filter((path) => hasTailwindImport(files.read(path) ?? ""));
|
|
271
|
+
const appLayer = viteAppLayerStylesheet(app.sourceRoot);
|
|
272
|
+
return wired.includes(appLayer) ? appLayer : wired[0] ?? null;
|
|
273
|
+
}
|
|
274
|
+
function nextRootLayout(app, files) {
|
|
275
|
+
const src = prefixOf(app.sourceRoot);
|
|
276
|
+
return [`${src}app/layout.tsx`, `${src}app/layout.jsx`].find((path) => files.isFile(path) && files.read(path) !== null) ?? null;
|
|
277
|
+
}
|
|
278
|
+
function tailwindEntryStylesheet(app, files) {
|
|
279
|
+
if (app.framework === "react-vite")
|
|
280
|
+
return viteTailwindEntry(app, files) ?? viteAppLayerStylesheet(app.sourceRoot);
|
|
281
|
+
const layout = nextRootLayout(app, files);
|
|
282
|
+
const found = layout === null ? null : layoutStylesheet(files.read(layout) ?? "");
|
|
283
|
+
return layout !== null && found?.status === "found" ? posix2.normalize(posix2.join(posix2.dirname(layout), found.spec)) : null;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
export {
|
|
287
|
+
TAILWIND_DEPENDENCIES,
|
|
288
|
+
TAILWIND_CSS_IMPORT,
|
|
289
|
+
tailwindSourceLine,
|
|
290
|
+
TAILWIND_VITE_IMPORT,
|
|
291
|
+
TAILWIND_VITE_PLUGIN,
|
|
292
|
+
stylesheetImportLine,
|
|
293
|
+
STORYBOOK_ESLINT_PLUGIN,
|
|
294
|
+
STORYBOOK_ESLINT_IMPORT,
|
|
295
|
+
STORYBOOK_ESLINT_IGNORE,
|
|
296
|
+
STORYBOOK_ESLINT_SPREAD,
|
|
297
|
+
STORYBOOK_IGNORE_REASON,
|
|
298
|
+
STORYBOOK_TAILWIND_CSS,
|
|
299
|
+
STORYBOOK_VITE_PLUGIN_TARGET,
|
|
300
|
+
STORYBOOK_VITE_CONFIG_PLUGIN_TARGET,
|
|
301
|
+
STORYBOOK_UNKNOWN_VITE_TARGET,
|
|
302
|
+
STORYBOOK_PLUGIN_REACT,
|
|
303
|
+
STORYBOOK_PLUGIN_REACT_RANGE,
|
|
304
|
+
storiesCoverSource,
|
|
305
|
+
widenStoriesGlob,
|
|
306
|
+
storybookEslintStatus,
|
|
307
|
+
applyStorybookEslintConfig,
|
|
308
|
+
ensurePreviewImport,
|
|
309
|
+
storybookMainFramework,
|
|
310
|
+
storybookViteTarget,
|
|
311
|
+
storybookDefaultViteConfig,
|
|
312
|
+
loadsTailwindVitePlugin,
|
|
313
|
+
wireTailwindVitePlugin,
|
|
314
|
+
prependStylesheetImport,
|
|
315
|
+
ensureTailwindCss,
|
|
316
|
+
layoutStylesheet,
|
|
317
|
+
postcssHasTailwind,
|
|
318
|
+
hasTailwindImport,
|
|
319
|
+
tailwindSourcePaths,
|
|
320
|
+
viteAppLayerStylesheet,
|
|
321
|
+
loadedViteStylesheets,
|
|
322
|
+
viteTailwindEntry,
|
|
323
|
+
nextRootLayout,
|
|
324
|
+
tailwindEntryStylesheet
|
|
325
|
+
};
|
|
@@ -2,9 +2,11 @@ import {
|
|
|
2
2
|
SEGMENT_NAME_PATTERN,
|
|
3
3
|
isEssenceSegmentName,
|
|
4
4
|
isUsableSliceApiName,
|
|
5
|
-
resolveFrontendApp,
|
|
6
5
|
resolveSlicePublicApiName
|
|
7
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-R2VEJGNP.js";
|
|
7
|
+
import {
|
|
8
|
+
resolveFrontendApp
|
|
9
|
+
} from "./chunk-W2BBF5MS.js";
|
|
8
10
|
import {
|
|
9
11
|
profileById
|
|
10
12
|
} from "./chunk-YEMQFSL6.js";
|
|
@@ -20,7 +22,7 @@ import {
|
|
|
20
22
|
readToolkitConfig,
|
|
21
23
|
recordedFrontends,
|
|
22
24
|
resolveLocaleOption
|
|
23
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-736LFDT4.js";
|
|
24
26
|
|
|
25
27
|
// src/generators/slice/core.ts
|
|
26
28
|
import { join } from "node:path";
|