@storybook/angular 10.1.0-alpha.9 → 10.1.0-beta.1
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-6CHBWP5J.js +711 -0
- package/dist/_browser-chunks/{chunk-CV6HSYTZ.js → chunk-T32Z4CGF.js} +13 -28
- package/dist/_node-chunks/chunk-3IVWZ4N7.js +43 -0
- package/dist/_node-chunks/chunk-3YP3TYEA.js +62 -0
- package/dist/builders/build-storybook/index.js +87 -102
- package/dist/builders/start-storybook/index.js +104 -124
- package/dist/client/config.js +84 -179
- package/dist/client/docs/config.js +15 -33
- package/dist/client/index.js +2 -2
- package/dist/index.js +2 -2
- package/dist/node/index.js +6 -10
- package/dist/preset.js +19 -29
- package/dist/server/framework-preset-angular-cli.js +156 -158
- package/dist/server/framework-preset-angular-ivy.js +16 -25
- package/package.json +16 -17
- package/dist/_browser-chunks/chunk-L4GU2V72.js +0 -939
- package/dist/_node-chunks/chunk-PBNB2IPX.js +0 -17
- package/dist/_node-chunks/chunk-RLZZSHQD.js +0 -93
- package/dist/_node-chunks/chunk-T6SLYNLE.js +0 -58
|
@@ -1,20 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_tvjgcptid3o from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_tvjgcptid3o from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_tvjgcptid3o from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_tvjgcptid3o.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_tvjgcptid3o.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_tvjgcptid3o.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 "../_node-chunks/chunk-
|
|
15
|
-
import {
|
|
16
|
-
__name
|
|
17
|
-
} from "../_node-chunks/chunk-PBNB2IPX.js";
|
|
14
|
+
} from "../_node-chunks/chunk-3IVWZ4N7.js";
|
|
18
15
|
|
|
19
16
|
// src/server/framework-preset-angular-cli.ts
|
|
20
17
|
import { logger } from "storybook/internal/node-logger";
|
|
@@ -27,91 +24,65 @@ import { logging } from "@angular-devkit/core";
|
|
|
27
24
|
import { createRequire } from "node:module";
|
|
28
25
|
|
|
29
26
|
// src/server/plugins/storybook-normalize-angular-entry-plugin.js
|
|
30
|
-
var PLUGIN_NAME = "storybook-normalize-angular-entry-plugin"
|
|
31
|
-
var StorybookNormalizeAngularEntryPlugin = class {
|
|
32
|
-
static {
|
|
33
|
-
__name(this, "StorybookNormalizeAngularEntryPlugin");
|
|
34
|
-
}
|
|
27
|
+
var PLUGIN_NAME = "storybook-normalize-angular-entry-plugin", StorybookNormalizeAngularEntryPlugin = class {
|
|
35
28
|
constructor(options) {
|
|
36
29
|
this.options = options;
|
|
37
30
|
}
|
|
38
31
|
apply(compiler) {
|
|
39
32
|
compiler.hooks.environment.tap(PLUGIN_NAME, () => {
|
|
40
|
-
|
|
33
|
+
let originalEntry = compiler.options.entry;
|
|
41
34
|
compiler.options.entry = async () => {
|
|
42
35
|
let entryResult;
|
|
43
|
-
if (typeof originalEntry
|
|
36
|
+
if (typeof originalEntry == "function")
|
|
44
37
|
try {
|
|
45
38
|
entryResult = await originalEntry();
|
|
46
39
|
} catch (error) {
|
|
47
|
-
console.error("Failed to execute the entry function:", error);
|
|
48
|
-
throw error;
|
|
40
|
+
throw console.error("Failed to execute the entry function:", error), error;
|
|
49
41
|
}
|
|
50
|
-
|
|
42
|
+
else
|
|
51
43
|
entryResult = originalEntry;
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
return entryResult;
|
|
44
|
+
return entryResult && entryResult.main && entryResult.styles ? {
|
|
45
|
+
main: {
|
|
46
|
+
import: Array.from(
|
|
47
|
+
/* @__PURE__ */ new Set([...entryResult.main.import, ...entryResult.styles.import])
|
|
48
|
+
)
|
|
49
|
+
}
|
|
50
|
+
} : entryResult;
|
|
63
51
|
};
|
|
64
|
-
})
|
|
65
|
-
compiler.hooks.thisCompilation.tap(PLUGIN_NAME, (compilation) => {
|
|
52
|
+
}), compiler.hooks.thisCompilation.tap(PLUGIN_NAME, (compilation) => {
|
|
66
53
|
this.compilation = compilation;
|
|
67
54
|
});
|
|
68
55
|
}
|
|
69
56
|
};
|
|
70
57
|
|
|
71
58
|
// src/server/utils/filter-out-styling-rules.ts
|
|
72
|
-
var isStylingRule =
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}
|
|
77
|
-
if (!(test instanceof RegExp)) {
|
|
78
|
-
return false;
|
|
79
|
-
}
|
|
80
|
-
return test.test(".css") || test.test(".scss") || test.test(".sass");
|
|
81
|
-
}, "isStylingRule");
|
|
82
|
-
var filterOutStylingRules = /* @__PURE__ */ __name((config) => {
|
|
83
|
-
return config.module.rules.filter((rule) => !isStylingRule(rule));
|
|
84
|
-
}, "filterOutStylingRules");
|
|
59
|
+
var isStylingRule = (rule) => {
|
|
60
|
+
let { test } = rule;
|
|
61
|
+
return !test || !(test instanceof RegExp) ? !1 : test.test(".css") || test.test(".scss") || test.test(".sass");
|
|
62
|
+
}, filterOutStylingRules = (config) => config.module.rules.filter((rule) => !isStylingRule(rule));
|
|
85
63
|
|
|
86
64
|
// src/server/angular-cli-webpack.js
|
|
87
|
-
var require2 = createRequire(import.meta.url)
|
|
88
|
-
var {
|
|
65
|
+
var require2 = createRequire(import.meta.url), {
|
|
89
66
|
generateI18nBrowserWebpackConfigFromContext
|
|
90
|
-
} = require2("@angular-devkit/build-angular/src/utils/webpack-browser-config")
|
|
91
|
-
var TsconfigPathsPlugin = require2("tsconfig-paths-webpack-plugin");
|
|
92
|
-
var {
|
|
67
|
+
} = require2("@angular-devkit/build-angular/src/utils/webpack-browser-config"), TsconfigPathsPlugin = require2("tsconfig-paths-webpack-plugin"), {
|
|
93
68
|
getCommonConfig,
|
|
94
69
|
getStylesConfig,
|
|
95
70
|
getDevServerConfig,
|
|
96
71
|
getTypeScriptConfig
|
|
97
|
-
} = require2("@angular-devkit/build-angular/src/tools/webpack/configs")
|
|
98
|
-
var getWebpackConfig = /* @__PURE__ */ __name(async (baseConfig, { builderOptions, builderContext }) => {
|
|
72
|
+
} = require2("@angular-devkit/build-angular/src/tools/webpack/configs"), getWebpackConfig = async (baseConfig, { builderOptions, builderContext }) => {
|
|
99
73
|
async function getCustomStylesConfig(wco) {
|
|
100
|
-
|
|
101
|
-
|
|
74
|
+
let { root } = wco;
|
|
75
|
+
if ((() => {
|
|
102
76
|
try {
|
|
103
|
-
|
|
77
|
+
let output = import.meta.resolve("@tailwindcss/postcss", root);
|
|
104
78
|
return isAbsolute(output);
|
|
105
79
|
} catch {
|
|
106
|
-
return
|
|
80
|
+
return !1;
|
|
107
81
|
}
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
fs.readdir = async function(path, options) {
|
|
113
|
-
const results = await originalReaddir.call(this, path, options);
|
|
114
|
-
const tailwindFiles = [
|
|
82
|
+
})()) {
|
|
83
|
+
let fs = require2("node:fs/promises"), originalReaddir = fs.readdir;
|
|
84
|
+
fs.readdir = async function(path2, options) {
|
|
85
|
+
let results = await originalReaddir.call(this, path2, options), tailwindFiles = [
|
|
115
86
|
"tailwind.config.js",
|
|
116
87
|
"tailwind.config.cjs",
|
|
117
88
|
"tailwind.config.mjs",
|
|
@@ -119,52 +90,45 @@ var getWebpackConfig = /* @__PURE__ */ __name(async (baseConfig, { builderOption
|
|
|
119
90
|
];
|
|
120
91
|
return results.filter((file) => !tailwindFiles.includes(file));
|
|
121
92
|
};
|
|
122
|
-
|
|
93
|
+
let styleConfig = await getStylesConfig(wco);
|
|
123
94
|
fs.readdir = originalReaddir;
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
const extraPostcssPlugins = [
|
|
127
|
-
typeof tailwindPackage === "function" ? tailwindPackage() : tailwindPackage.default()
|
|
95
|
+
let tailwindPackage = await import(import.meta.resolve("@tailwindcss/postcss", root)), extraPostcssPlugins = [
|
|
96
|
+
typeof tailwindPackage == "function" ? tailwindPackage() : tailwindPackage.default()
|
|
128
97
|
];
|
|
129
|
-
styleConfig.module.rules.map((rule) => rule.rules).forEach((rule) => {
|
|
98
|
+
return styleConfig.module.rules.map((rule) => rule.rules).forEach((rule) => {
|
|
130
99
|
rule.forEach((r) => {
|
|
131
|
-
r.oneOf?.forEach?.((oneOfRule) => {
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
plugins: [...originalOptions.plugins, ...extraPostcssPlugins]
|
|
140
|
-
};
|
|
100
|
+
r.oneOf?.forEach?.((oneOfRule) => oneOfRule.use.forEach((use) => {
|
|
101
|
+
if (use.loader.includes("postcss-loader") && use.options.postcssOptions) {
|
|
102
|
+
let originalOptionsFn = use.options.postcssOptions;
|
|
103
|
+
use.options.postcssOptions = (loaderOptions) => {
|
|
104
|
+
let originalOptions = originalOptionsFn(loaderOptions);
|
|
105
|
+
return {
|
|
106
|
+
...originalOptions,
|
|
107
|
+
plugins: [...originalOptions.plugins, ...extraPostcssPlugins]
|
|
141
108
|
};
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
});
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
}));
|
|
145
112
|
});
|
|
146
|
-
});
|
|
147
|
-
|
|
148
|
-
} else {
|
|
113
|
+
}), styleConfig;
|
|
114
|
+
} else
|
|
149
115
|
return getStylesConfig(wco);
|
|
150
|
-
}
|
|
151
116
|
}
|
|
152
|
-
|
|
153
|
-
const { config: cliConfig } = await generateI18nBrowserWebpackConfigFromContext(
|
|
117
|
+
let { config: cliConfig } = await generateI18nBrowserWebpackConfigFromContext(
|
|
154
118
|
{
|
|
155
119
|
// Default options
|
|
156
120
|
index: "noop-index",
|
|
157
121
|
main: "noop-main",
|
|
158
122
|
// Options provided by user
|
|
159
123
|
...builderOptions,
|
|
160
|
-
styles: builderOptions.styles?.map((style) => typeof style
|
|
161
|
-
outputPath: typeof builderOptions.outputPath
|
|
124
|
+
styles: builderOptions.styles?.map((style) => typeof style == "string" ? style : style.input).filter((style) => typeof style == "string" || style.inject !== !1),
|
|
125
|
+
outputPath: typeof builderOptions.outputPath == "string" ? builderOptions.outputPath : builderOptions.outputPath?.base ?? "noop-out",
|
|
162
126
|
// Fixed options
|
|
163
|
-
optimization:
|
|
164
|
-
namedChunks:
|
|
165
|
-
progress:
|
|
166
|
-
buildOptimizer:
|
|
167
|
-
aot:
|
|
127
|
+
optimization: !1,
|
|
128
|
+
namedChunks: !1,
|
|
129
|
+
progress: !1,
|
|
130
|
+
buildOptimizer: !1,
|
|
131
|
+
aot: !1
|
|
168
132
|
},
|
|
169
133
|
builderContext,
|
|
170
134
|
(wco) => [
|
|
@@ -173,26 +137,19 @@ var getWebpackConfig = /* @__PURE__ */ __name(async (baseConfig, { builderOption
|
|
|
173
137
|
getTypeScriptConfig ? getTypeScriptConfig(wco) : getDevServerConfig(wco)
|
|
174
138
|
]
|
|
175
139
|
);
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
cliConfig.entry.polyfills.push("zone.js");
|
|
179
|
-
}
|
|
180
|
-
const entry = [
|
|
140
|
+
!builderOptions.experimentalZoneless && !cliConfig.entry.polyfills?.includes("zone.js") && (cliConfig.entry.polyfills ??= [], cliConfig.entry.polyfills.push("zone.js"));
|
|
141
|
+
let entry = [
|
|
181
142
|
...cliConfig.entry.polyfills ?? [],
|
|
182
143
|
...baseConfig.entry,
|
|
183
144
|
...cliConfig.entry.styles ?? []
|
|
184
|
-
]
|
|
185
|
-
const rulesExcludingStyles = filterOutStylingRules(baseConfig);
|
|
186
|
-
const module = {
|
|
145
|
+
], rulesExcludingStyles = filterOutStylingRules(baseConfig), module = {
|
|
187
146
|
...baseConfig.module,
|
|
188
147
|
rules: [...cliConfig.module.rules, ...rulesExcludingStyles]
|
|
189
|
-
}
|
|
190
|
-
const plugins = [
|
|
148
|
+
}, plugins = [
|
|
191
149
|
...cliConfig.plugins ?? [],
|
|
192
150
|
...baseConfig.plugins,
|
|
193
151
|
new StorybookNormalizeAngularEntryPlugin()
|
|
194
|
-
]
|
|
195
|
-
const resolve = {
|
|
152
|
+
], resolve2 = {
|
|
196
153
|
...baseConfig.resolve,
|
|
197
154
|
modules: Array.from(/* @__PURE__ */ new Set([...baseConfig.resolve.modules, ...cliConfig.resolve.modules])),
|
|
198
155
|
plugins: [
|
|
@@ -207,22 +164,85 @@ var getWebpackConfig = /* @__PURE__ */ __name(async (baseConfig, { builderOption
|
|
|
207
164
|
entry,
|
|
208
165
|
module,
|
|
209
166
|
plugins,
|
|
210
|
-
resolve,
|
|
167
|
+
resolve: resolve2,
|
|
211
168
|
resolveLoader: cliConfig.resolveLoader
|
|
212
169
|
};
|
|
213
|
-
}
|
|
170
|
+
};
|
|
214
171
|
|
|
215
172
|
// src/server/framework-preset-angular-cli.ts
|
|
216
173
|
import { getProjectRoot, resolvePackageDir } from "storybook/internal/common";
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
174
|
+
|
|
175
|
+
// ../../node_modules/pathe/dist/shared/pathe.ff20891b.mjs
|
|
176
|
+
var _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
|
|
177
|
+
function normalizeWindowsPath(input = "") {
|
|
178
|
+
return input && input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
|
|
179
|
+
}
|
|
180
|
+
var _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
|
|
181
|
+
var _ROOT_FOLDER_RE = /^\/([A-Za-z]:)?$/;
|
|
182
|
+
function cwd() {
|
|
183
|
+
return typeof process < "u" && typeof process.cwd == "function" ? process.cwd().replace(/\\/g, "/") : "/";
|
|
184
|
+
}
|
|
185
|
+
var resolve = function(...arguments_) {
|
|
186
|
+
arguments_ = arguments_.map((argument) => normalizeWindowsPath(argument));
|
|
187
|
+
let resolvedPath = "", resolvedAbsolute = !1;
|
|
188
|
+
for (let index = arguments_.length - 1; index >= -1 && !resolvedAbsolute; index--) {
|
|
189
|
+
let path2 = index >= 0 ? arguments_[index] : cwd();
|
|
190
|
+
!path2 || path2.length === 0 || (resolvedPath = `${path2}/${resolvedPath}`, resolvedAbsolute = isAbsolute2(path2));
|
|
221
191
|
}
|
|
192
|
+
return resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute), resolvedAbsolute && !isAbsolute2(resolvedPath) ? `/${resolvedPath}` : resolvedPath.length > 0 ? resolvedPath : ".";
|
|
193
|
+
};
|
|
194
|
+
function normalizeString(path2, allowAboveRoot) {
|
|
195
|
+
let res = "", lastSegmentLength = 0, lastSlash = -1, dots = 0, char = null;
|
|
196
|
+
for (let index = 0; index <= path2.length; ++index) {
|
|
197
|
+
if (index < path2.length)
|
|
198
|
+
char = path2[index];
|
|
199
|
+
else {
|
|
200
|
+
if (char === "/")
|
|
201
|
+
break;
|
|
202
|
+
char = "/";
|
|
203
|
+
}
|
|
204
|
+
if (char === "/") {
|
|
205
|
+
if (!(lastSlash === index - 1 || dots === 1)) if (dots === 2) {
|
|
206
|
+
if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
|
|
207
|
+
if (res.length > 2) {
|
|
208
|
+
let lastSlashIndex = res.lastIndexOf("/");
|
|
209
|
+
lastSlashIndex === -1 ? (res = "", lastSegmentLength = 0) : (res = res.slice(0, lastSlashIndex), lastSegmentLength = res.length - 1 - res.lastIndexOf("/")), lastSlash = index, dots = 0;
|
|
210
|
+
continue;
|
|
211
|
+
} else if (res.length > 0) {
|
|
212
|
+
res = "", lastSegmentLength = 0, lastSlash = index, dots = 0;
|
|
213
|
+
continue;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
allowAboveRoot && (res += res.length > 0 ? "/.." : "..", lastSegmentLength = 2);
|
|
217
|
+
} else
|
|
218
|
+
res.length > 0 ? res += `/${path2.slice(lastSlash + 1, index)}` : res = path2.slice(lastSlash + 1, index), lastSegmentLength = index - lastSlash - 1;
|
|
219
|
+
lastSlash = index, dots = 0;
|
|
220
|
+
} else char === "." && dots !== -1 ? ++dots : dots = -1;
|
|
221
|
+
}
|
|
222
|
+
return res;
|
|
223
|
+
}
|
|
224
|
+
var isAbsolute2 = function(p) {
|
|
225
|
+
return _IS_ABSOLUTE_RE.test(p);
|
|
226
|
+
};
|
|
227
|
+
var relative = function(from, to) {
|
|
228
|
+
let _from = resolve(from).replace(_ROOT_FOLDER_RE, "$1").split("/"), _to = resolve(to).replace(_ROOT_FOLDER_RE, "$1").split("/");
|
|
229
|
+
if (_to[0][1] === ":" && _from[0][1] === ":" && _from[0] !== _to[0])
|
|
230
|
+
return _to.join("/");
|
|
231
|
+
let _fromCopy = [..._from];
|
|
232
|
+
for (let segment of _fromCopy) {
|
|
233
|
+
if (_to[0] !== segment)
|
|
234
|
+
break;
|
|
235
|
+
_from.shift(), _to.shift();
|
|
236
|
+
}
|
|
237
|
+
return [..._from.map(() => ".."), ..._to].join("/");
|
|
238
|
+
};
|
|
239
|
+
|
|
240
|
+
// src/server/framework-preset-angular-cli.ts
|
|
241
|
+
async function webpackFinal(baseConfig, options) {
|
|
242
|
+
if (!resolvePackageDir("@angular-devkit/build-angular"))
|
|
243
|
+
return logger.info('Using base config because "@angular-devkit/build-angular" is not installed'), baseConfig;
|
|
222
244
|
checkForLegacyBuildOptions(options);
|
|
223
|
-
|
|
224
|
-
const builderOptions = await getBuilderOptions(options, builderContext);
|
|
225
|
-
const webpackConfig = await getWebpackConfig(baseConfig, {
|
|
245
|
+
let builderContext = getBuilderContext(options), builderOptions = await getBuilderOptions(options, builderContext), webpackConfig = await getWebpackConfig(baseConfig, {
|
|
226
246
|
builderOptions: {
|
|
227
247
|
watch: options.configType === "DEVELOPMENT",
|
|
228
248
|
...builderOptions
|
|
@@ -230,14 +250,10 @@ async function webpackFinal(baseConfig, options) {
|
|
|
230
250
|
builderContext
|
|
231
251
|
});
|
|
232
252
|
webpackConfig.plugins = webpackConfig.plugins ?? [];
|
|
233
|
-
|
|
253
|
+
let miniCssPlugin = webpackConfig?.plugins?.find(
|
|
234
254
|
(plugin) => plugin?.constructor?.name === "MiniCssExtractPlugin"
|
|
235
255
|
);
|
|
236
|
-
|
|
237
|
-
miniCssPlugin.options.filename = "[name].[contenthash].css";
|
|
238
|
-
miniCssPlugin.options.chunkFilename = "[name].iframe.[contenthash].css";
|
|
239
|
-
}
|
|
240
|
-
webpackConfig.plugins.push(
|
|
256
|
+
miniCssPlugin && "options" in miniCssPlugin && (miniCssPlugin.options.filename = "[name].[contenthash].css", miniCssPlugin.options.chunkFilename = "[name].iframe.[contenthash].css"), webpackConfig.plugins.push(
|
|
241
257
|
new WebpackDefinePlugin({
|
|
242
258
|
STORYBOOK_ANGULAR_OPTIONS: JSON.stringify({
|
|
243
259
|
experimentalZoneless: builderOptions.experimentalZoneless
|
|
@@ -246,13 +262,12 @@ async function webpackFinal(baseConfig, options) {
|
|
|
246
262
|
);
|
|
247
263
|
try {
|
|
248
264
|
resolvePackageDir("@angular/animations");
|
|
249
|
-
} catch
|
|
265
|
+
} catch {
|
|
250
266
|
webpackConfig.plugins.push(
|
|
251
267
|
new WebpackIgnorePlugin({
|
|
252
268
|
resourceRegExp: /@angular\/platform-browser\/animations$/
|
|
253
269
|
})
|
|
254
|
-
)
|
|
255
|
-
webpackConfig.plugins.push(
|
|
270
|
+
), webpackConfig.plugins.push(
|
|
256
271
|
new WebpackIgnorePlugin({
|
|
257
272
|
resourceRegExp: /@angular\/animations\/browser$/
|
|
258
273
|
})
|
|
@@ -260,57 +275,40 @@ async function webpackFinal(baseConfig, options) {
|
|
|
260
275
|
}
|
|
261
276
|
return webpackConfig;
|
|
262
277
|
}
|
|
263
|
-
__name(webpackFinal, "webpackFinal");
|
|
264
278
|
function getBuilderContext(options) {
|
|
265
279
|
return options.angularBuilderContext ?? {
|
|
266
280
|
target: { project: "noop-project", builder: "", options: {} },
|
|
267
281
|
workspaceRoot: process.cwd(),
|
|
268
|
-
getProjectMetadata:
|
|
269
|
-
getTargetOptions:
|
|
282
|
+
getProjectMetadata: () => ({}),
|
|
283
|
+
getTargetOptions: () => ({}),
|
|
270
284
|
logger: new logging.Logger("Storybook")
|
|
271
285
|
};
|
|
272
286
|
}
|
|
273
|
-
__name(getBuilderContext, "getBuilderContext");
|
|
274
287
|
function deepMerge(target, source) {
|
|
275
|
-
|
|
276
|
-
for (
|
|
277
|
-
|
|
278
|
-
if (typeof source[key] === "object" && !Array.isArray(source[key]) && typeof target[key] === "object" && !Array.isArray(target[key]) && target[key] !== null) {
|
|
279
|
-
result[key] = deepMerge(target[key], source[key]);
|
|
280
|
-
} else {
|
|
281
|
-
result[key] = source[key];
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
}
|
|
288
|
+
let result = { ...target };
|
|
289
|
+
for (let key in source)
|
|
290
|
+
source[key] !== void 0 && source[key] !== null && (typeof source[key] == "object" && !Array.isArray(source[key]) && typeof target[key] == "object" && !Array.isArray(target[key]) && target[key] !== null ? result[key] = deepMerge(target[key], source[key]) : result[key] = source[key]);
|
|
285
291
|
return result;
|
|
286
292
|
}
|
|
287
|
-
__name(deepMerge, "deepMerge");
|
|
288
293
|
async function getBuilderOptions(options, builderContext) {
|
|
289
294
|
let browserTargetOptions = {};
|
|
290
295
|
if (options.angularBrowserTarget) {
|
|
291
|
-
|
|
296
|
+
let browserTarget = targetFromTargetString(options.angularBrowserTarget);
|
|
292
297
|
logger.info(
|
|
293
|
-
|
|
294
|
-
);
|
|
295
|
-
browserTargetOptions = await builderContext.getTargetOptions(browserTarget);
|
|
298
|
+
`Using angular browser target options from "${browserTarget.project}:${browserTarget.target}${browserTarget.configuration ? `:${browserTarget.configuration}` : ""}"`
|
|
299
|
+
), browserTargetOptions = await builderContext.getTargetOptions(browserTarget);
|
|
296
300
|
}
|
|
297
|
-
|
|
301
|
+
let explicitAngularBuilderOptions = await builderContext.getTargetOptions(
|
|
298
302
|
builderContext.target
|
|
299
|
-
);
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
builderOptions.experimentalZoneless = options.angularBuilderOptions?.experimentalZoneless;
|
|
304
|
-
return builderOptions;
|
|
303
|
+
), builderOptions = deepMerge(browserTargetOptions, explicitAngularBuilderOptions || {});
|
|
304
|
+
return builderOptions.tsConfig = options.tsConfig ?? up("tsconfig.json", { cwd: options.configDir, last: getProjectRoot() }) ?? browserTargetOptions.tsConfig, logger.info(
|
|
305
|
+
`Using angular project with "tsConfig:${relative(getProjectRoot(), builderOptions.tsConfig)}"`
|
|
306
|
+
), builderOptions.experimentalZoneless = options.angularBuilderOptions?.experimentalZoneless, builderOptions;
|
|
305
307
|
}
|
|
306
|
-
__name(getBuilderOptions, "getBuilderOptions");
|
|
307
308
|
function checkForLegacyBuildOptions(options) {
|
|
308
|
-
if (options.angularBrowserTarget
|
|
309
|
-
|
|
310
|
-
}
|
|
311
|
-
throw new AngularLegacyBuildOptionsError();
|
|
309
|
+
if (options.angularBrowserTarget === void 0)
|
|
310
|
+
throw new AngularLegacyBuildOptionsError();
|
|
312
311
|
}
|
|
313
|
-
__name(checkForLegacyBuildOptions, "checkForLegacyBuildOptions");
|
|
314
312
|
export {
|
|
315
313
|
deepMerge,
|
|
316
314
|
getBuilderOptions,
|
|
@@ -1,59 +1,50 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_tvjgcptid3o from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_tvjgcptid3o from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_tvjgcptid3o from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_tvjgcptid3o.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_tvjgcptid3o.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_tvjgcptid3o.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
11
|
// ------------------------------------------------------------
|
|
12
|
-
import {
|
|
13
|
-
__name
|
|
14
|
-
} from "../_node-chunks/chunk-PBNB2IPX.js";
|
|
15
12
|
|
|
16
13
|
// src/server/framework-preset-angular-ivy.ts
|
|
17
14
|
import { join } from "node:path";
|
|
18
15
|
import { createRequire } from "node:module";
|
|
19
16
|
var require2 = createRequire(import.meta.url);
|
|
20
17
|
function loadEsmModule(modulePath) {
|
|
21
|
-
return new Function("modulePath",
|
|
18
|
+
return new Function("modulePath", "return import(modulePath);")(modulePath);
|
|
22
19
|
}
|
|
23
|
-
|
|
24
|
-
var runNgcc = /* @__PURE__ */ __name(async () => {
|
|
20
|
+
var runNgcc = async () => {
|
|
25
21
|
let ngcc;
|
|
26
22
|
try {
|
|
27
23
|
ngcc = require2("@angular/compiler-cli/ngcc");
|
|
28
|
-
} catch
|
|
24
|
+
} catch {
|
|
29
25
|
ngcc = await loadEsmModule("@angular/compiler-cli/ngcc");
|
|
30
26
|
}
|
|
31
27
|
ngcc.process({
|
|
32
28
|
// should be async: true but does not work due to
|
|
33
29
|
// https://github.com/storybookjs/storybook/pull/11157/files#r615413803
|
|
34
|
-
async:
|
|
30
|
+
async: !1,
|
|
35
31
|
basePath: join(process.cwd(), "node_modules"),
|
|
36
32
|
// absolute path to node_modules
|
|
37
|
-
createNewEntryPointFormats:
|
|
33
|
+
createNewEntryPointFormats: !0,
|
|
38
34
|
// --create-ivy-entry-points
|
|
39
|
-
compileAllFormats:
|
|
35
|
+
compileAllFormats: !1
|
|
40
36
|
// --first-only
|
|
41
37
|
});
|
|
42
|
-
},
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
const angularOptions = typeof framework === "object" ? framework.options : {};
|
|
46
|
-
if (angularOptions.enableIvy === false) {
|
|
47
|
-
return webpackConfig;
|
|
48
|
-
}
|
|
49
|
-
return {
|
|
38
|
+
}, webpack = async (webpackConfig, options) => {
|
|
39
|
+
let framework = await options.presets.apply("framework");
|
|
40
|
+
return (typeof framework == "object" ? framework.options : {}).enableIvy === !1 ? webpackConfig : {
|
|
50
41
|
...webpackConfig,
|
|
51
42
|
resolve: {
|
|
52
43
|
...webpackConfig.resolve,
|
|
53
44
|
mainFields: ["browser", "module", "main"]
|
|
54
45
|
}
|
|
55
46
|
};
|
|
56
|
-
}
|
|
47
|
+
};
|
|
57
48
|
export {
|
|
58
49
|
runNgcc,
|
|
59
50
|
webpack
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/angular",
|
|
3
|
-
"version": "10.1.0-
|
|
3
|
+
"version": "10.1.0-beta.1",
|
|
4
4
|
"description": "Storybook for Angular: Develop, document, and test UI components in isolation",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"storybook",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"prep": "jiti ../../../scripts/build/build-package.ts"
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
|
-
"@storybook/builder-webpack5": "10.1.0-
|
|
64
|
+
"@storybook/builder-webpack5": "10.1.0-beta.1",
|
|
65
65
|
"@storybook/global": "^5.0.0",
|
|
66
66
|
"telejson": "8.0.0",
|
|
67
67
|
"ts-dedent": "^2.0.0",
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
"@angular/forms": "^19.1.1",
|
|
82
82
|
"@angular/platform-browser": "^19.1.1",
|
|
83
83
|
"@angular/platform-browser-dynamic": "^19.1.1",
|
|
84
|
-
"@storybook/core-webpack": "10.1.0-
|
|
84
|
+
"@storybook/core-webpack": "10.1.0-beta.1",
|
|
85
85
|
"@types/node": "^22.0.0",
|
|
86
86
|
"empathic": "^2.0.0",
|
|
87
87
|
"rimraf": "^6.0.1",
|
|
@@ -90,20 +90,19 @@
|
|
|
90
90
|
"zone.js": "^0.15.0"
|
|
91
91
|
},
|
|
92
92
|
"peerDependencies": {
|
|
93
|
-
"@angular-devkit/architect": ">=0.1800.0 < 0.
|
|
94
|
-
"@angular-devkit/build-angular": ">=18.0.0 <
|
|
95
|
-
"@angular-devkit/core": ">=18.0.0 <
|
|
96
|
-
"@angular/animations": ">=18.0.0 <
|
|
97
|
-
"@angular/cli": ">=18.0.0 <
|
|
98
|
-
"@angular/common": ">=18.0.0 <
|
|
99
|
-
"@angular/compiler": ">=18.0.0 <
|
|
100
|
-
"@angular/compiler-cli": ">=18.0.0 <
|
|
101
|
-
"@angular/core": ">=18.0.0 <
|
|
102
|
-
"@angular/
|
|
103
|
-
"@angular/platform-browser": ">=18.0.0 <
|
|
104
|
-
"@angular/platform-browser-dynamic": ">=18.0.0 < 21.0.0",
|
|
93
|
+
"@angular-devkit/architect": ">=0.1800.0 < 0.2200.0",
|
|
94
|
+
"@angular-devkit/build-angular": ">=18.0.0 < 22.0.0",
|
|
95
|
+
"@angular-devkit/core": ">=18.0.0 < 22.0.0",
|
|
96
|
+
"@angular/animations": ">=18.0.0 < 22.0.0",
|
|
97
|
+
"@angular/cli": ">=18.0.0 < 22.0.0",
|
|
98
|
+
"@angular/common": ">=18.0.0 < 22.0.0",
|
|
99
|
+
"@angular/compiler": ">=18.0.0 < 22.0.0",
|
|
100
|
+
"@angular/compiler-cli": ">=18.0.0 < 22.0.0",
|
|
101
|
+
"@angular/core": ">=18.0.0 < 22.0.0",
|
|
102
|
+
"@angular/platform-browser": ">=18.0.0 < 22.0.0",
|
|
103
|
+
"@angular/platform-browser-dynamic": ">=18.0.0 < 22.0.0",
|
|
105
104
|
"rxjs": "^6.5.3 || ^7.4.0",
|
|
106
|
-
"storybook": "^10.1.0-
|
|
105
|
+
"storybook": "^10.1.0-beta.1",
|
|
107
106
|
"typescript": "^4.9.0 || ^5.0.0",
|
|
108
107
|
"zone.js": ">=0.14.0"
|
|
109
108
|
},
|
|
@@ -122,5 +121,5 @@
|
|
|
122
121
|
"access": "public"
|
|
123
122
|
},
|
|
124
123
|
"builders": "builders.json",
|
|
125
|
-
"gitHead": "
|
|
124
|
+
"gitHead": "a8e7fd8a655c69780bc20b9749d2699e45beae1l"
|
|
126
125
|
}
|