@analogjs/storybook-angular 2.0.0-beta.1 → 2.0.0-beta.11
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/package.json +6 -6
- package/src/index.d.ts +1 -1
- package/src/index.js +1 -1
- package/src/index.js.map +1 -1
- package/src/lib/build-storybook/build-storybook.d.ts +1 -1
- package/src/lib/build-storybook/build-storybook.js +1 -1
- package/src/lib/build-storybook/build-storybook.js.map +1 -1
- package/src/lib/builders.json +2 -1
- package/src/lib/preset.d.ts +4 -0
- package/src/lib/preset.js +138 -0
- package/src/lib/preset.js.map +1 -0
- package/src/lib/start-storybook/start-storybook.d.ts +1 -1
- package/src/lib/start-storybook/start-storybook.js +1 -1
- package/src/lib/start-storybook/start-storybook.js.map +1 -1
- package/src/lib/testing.d.ts +1 -0
- package/src/lib/testing.js +3 -2
- package/src/lib/testing.js.map +1 -1
- package/preset.d.ts +0 -5
- package/preset.js.map +0 -1
- package/preset.mjs +0 -132
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@analogjs/storybook-angular",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.11",
|
|
4
4
|
"description": "Storybook Integration for Angular & Vite",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"import": "./src/index.js",
|
|
29
29
|
"require": "./src/index.js"
|
|
30
30
|
},
|
|
31
|
-
"./preset": "./preset.
|
|
31
|
+
"./preset": "./src/lib/preset.js",
|
|
32
32
|
"./package.json": "./package.json",
|
|
33
33
|
"./*": "./src/*",
|
|
34
34
|
"./testing": {
|
|
@@ -39,16 +39,16 @@
|
|
|
39
39
|
},
|
|
40
40
|
"main": "src/index.js",
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@storybook/builder-vite": "
|
|
42
|
+
"@storybook/builder-vite": "^10.0.0-rc.0"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
|
-
"@storybook/angular": "
|
|
45
|
+
"@storybook/angular": "^10.0.0-rc.0",
|
|
46
46
|
"@analogjs/vite-plugin-angular": "*",
|
|
47
|
-
"storybook": "
|
|
47
|
+
"storybook": "^10.0.0-rc.0",
|
|
48
48
|
"vite": "^5.0.0 || ^6.0.0 || ^7.0.0"
|
|
49
49
|
},
|
|
50
50
|
"engines": {
|
|
51
|
-
"node": ">=
|
|
51
|
+
"node": ">=20.0.0"
|
|
52
52
|
},
|
|
53
53
|
"builders": "src/lib/builders.json",
|
|
54
54
|
"ng-add": {
|
package/src/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from './types';
|
|
2
|
-
export * from '@storybook/angular/
|
|
2
|
+
export * from '@storybook/angular/client';
|
package/src/index.js
CHANGED
package/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/storybook-angular/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/storybook-angular/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,2BAA2B,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import BuildStorybookBuilder from '@storybook/angular/
|
|
1
|
+
import BuildStorybookBuilder from '@storybook/angular/builders/build-storybook';
|
|
2
2
|
export default BuildStorybookBuilder;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-storybook.js","sourceRoot":"","sources":["../../../../../../packages/storybook-angular/src/lib/build-storybook/build-storybook.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,MAAM,
|
|
1
|
+
{"version":3,"file":"build-storybook.js","sourceRoot":"","sources":["../../../../../../packages/storybook-angular/src/lib/build-storybook/build-storybook.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,MAAM,6CAA6C,CAAC;AAEhF,eAAe,qBAAqB,CAAC"}
|
package/src/lib/builders.json
CHANGED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const previewAnnotations: (entries: any[], options: any) => Promise<any[]>;
|
|
2
|
+
export declare const core: (config: any, options: any) => Promise<any>;
|
|
3
|
+
export declare const viteFinal: (config: any, options: any) => Promise<Record<string, any>>;
|
|
4
|
+
export { addons } from '@storybook/angular/preset';
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { resolve } from 'node:path';
|
|
2
|
+
import { core as PresetCore } from '@storybook/angular/preset';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
export const previewAnnotations = async (entries = [], options) => {
|
|
5
|
+
const config = fileURLToPath(import.meta.resolve('@storybook/angular/client/config'));
|
|
6
|
+
const annotations = [...entries, config];
|
|
7
|
+
if (options.enableProdMode) {
|
|
8
|
+
const previewProdPath = fileURLToPath(import.meta.resolve('@storybook/angular/client/preview-prod'));
|
|
9
|
+
annotations.unshift(previewProdPath);
|
|
10
|
+
}
|
|
11
|
+
const docsConfig = await options.presets.apply('docs', {}, options);
|
|
12
|
+
const docsEnabled = Object.keys(docsConfig).length > 0;
|
|
13
|
+
if (docsEnabled) {
|
|
14
|
+
const docsConfigPath = fileURLToPath(import.meta.resolve('@storybook/angular/client/docs/config'));
|
|
15
|
+
annotations.push(docsConfigPath);
|
|
16
|
+
}
|
|
17
|
+
return annotations;
|
|
18
|
+
};
|
|
19
|
+
export const core = async (config, options) => {
|
|
20
|
+
const presetCore = PresetCore(config, options);
|
|
21
|
+
return {
|
|
22
|
+
...presetCore,
|
|
23
|
+
builder: {
|
|
24
|
+
name: import.meta.resolve('@storybook/builder-vite'),
|
|
25
|
+
options: { ...presetCore.options },
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
export const viteFinal = async (config, options) => {
|
|
30
|
+
// Remove any loaded analogjs plugins from a vite.config.(m)ts file
|
|
31
|
+
config.plugins = config.plugins
|
|
32
|
+
.flat()
|
|
33
|
+
.filter((plugin) => !plugin.name.includes('analogjs'));
|
|
34
|
+
// Merge custom configuration into the default config
|
|
35
|
+
const { mergeConfig, normalizePath } = await import('vite');
|
|
36
|
+
const { default: angular } = await import('@analogjs/vite-plugin-angular');
|
|
37
|
+
// @ts-ignore
|
|
38
|
+
const framework = await options.presets.apply('framework');
|
|
39
|
+
return mergeConfig(config, {
|
|
40
|
+
// Add dependencies to pre-optimization
|
|
41
|
+
optimizeDeps: {
|
|
42
|
+
include: [
|
|
43
|
+
'@storybook/angular/client',
|
|
44
|
+
'@analogjs/storybook-angular',
|
|
45
|
+
'@angular/compiler',
|
|
46
|
+
'@angular/platform-browser',
|
|
47
|
+
'@angular/platform-browser/animations',
|
|
48
|
+
'tslib',
|
|
49
|
+
...(options?.angularBuilderOptions?.experimentalZoneless
|
|
50
|
+
? []
|
|
51
|
+
: ['zone.js']),
|
|
52
|
+
],
|
|
53
|
+
},
|
|
54
|
+
plugins: [
|
|
55
|
+
angular({
|
|
56
|
+
jit: typeof framework.options?.jit !== 'undefined'
|
|
57
|
+
? framework.options?.jit
|
|
58
|
+
: true,
|
|
59
|
+
liveReload: typeof framework.options?.liveReload !== 'undefined'
|
|
60
|
+
? framework.options?.liveReload
|
|
61
|
+
: false,
|
|
62
|
+
tsconfig: options?.tsConfig ?? './.storybook/tsconfig.json',
|
|
63
|
+
inlineStylesExtension: typeof framework.options?.inlineStylesExtension !== 'undefined'
|
|
64
|
+
? framework.options?.inlineStylesExtension
|
|
65
|
+
: 'css',
|
|
66
|
+
}),
|
|
67
|
+
angularOptionsPlugin(options, { normalizePath }),
|
|
68
|
+
storybookEsbuildPlugin(),
|
|
69
|
+
],
|
|
70
|
+
define: {
|
|
71
|
+
STORYBOOK_ANGULAR_OPTIONS: JSON.stringify({
|
|
72
|
+
experimentalZoneless: !!options?.angularBuilderOptions?.experimentalZoneless,
|
|
73
|
+
}),
|
|
74
|
+
},
|
|
75
|
+
});
|
|
76
|
+
};
|
|
77
|
+
function angularOptionsPlugin(options, { normalizePath }) {
|
|
78
|
+
return {
|
|
79
|
+
name: 'analogjs-storybook-options-plugin',
|
|
80
|
+
config() {
|
|
81
|
+
const loadPaths = options?.angularBuilderOptions?.stylePreprocessorOptions?.loadPaths;
|
|
82
|
+
const sassOptions = options?.angularBuilderOptions?.stylePreprocessorOptions?.sass;
|
|
83
|
+
if (Array.isArray(loadPaths)) {
|
|
84
|
+
return {
|
|
85
|
+
css: {
|
|
86
|
+
preprocessorOptions: {
|
|
87
|
+
scss: {
|
|
88
|
+
...sassOptions,
|
|
89
|
+
loadPaths: loadPaths.map((loadPath) => `${resolve(options.angularBuilderContext.workspaceRoot, loadPath)}`),
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
return;
|
|
96
|
+
},
|
|
97
|
+
transform(code, id) {
|
|
98
|
+
if (normalizePath(id).endsWith(normalizePath(`${options.configDir}/preview.ts`))) {
|
|
99
|
+
const imports = [];
|
|
100
|
+
const styles = options?.angularBuilderOptions?.styles;
|
|
101
|
+
if (Array.isArray(styles)) {
|
|
102
|
+
styles.forEach((style) => {
|
|
103
|
+
imports.push(style);
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
const zoneless = options?.angularBuilderOptions?.experimentalZoneless;
|
|
107
|
+
if (!zoneless) {
|
|
108
|
+
imports.push('zone.js');
|
|
109
|
+
}
|
|
110
|
+
return {
|
|
111
|
+
code: `
|
|
112
|
+
${imports.map((extraImport) => `import '${extraImport}';`).join('\n')}
|
|
113
|
+
${code}
|
|
114
|
+
`,
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
return;
|
|
118
|
+
},
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
function storybookEsbuildPlugin() {
|
|
122
|
+
return {
|
|
123
|
+
name: 'analogjs-storybook-esbuild-config',
|
|
124
|
+
apply: 'build',
|
|
125
|
+
config() {
|
|
126
|
+
return {
|
|
127
|
+
esbuild: {
|
|
128
|
+
// Don't mangle class names during the build
|
|
129
|
+
// This fixes display of compodoc argtypes
|
|
130
|
+
keepNames: true,
|
|
131
|
+
},
|
|
132
|
+
};
|
|
133
|
+
},
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
export { addons } from '@storybook/angular/preset';
|
|
137
|
+
//# sourceMappingURL=preset.js.map
|
|
138
|
+
//# sourceMappingURL=preset.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preset.js","sourceRoot":"","sources":["../../../../../packages/storybook-angular/src/lib/preset.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,IAAI,IAAI,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,CAAC,MAAM,kBAAkB,GAAG,KAAK,EAAE,OAAO,GAAG,EAAE,EAAE,OAAO,EAAE,EAAE;IAChE,MAAM,MAAM,GAAG,aAAa,CAC1B,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,kCAAkC,CAAC,CACxD,CAAC;IACF,MAAM,WAAW,GAAG,CAAC,GAAG,OAAO,EAAE,MAAM,CAAC,CAAC;IAEzC,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC;QAC3B,MAAM,eAAe,GAAG,aAAa,CACnC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,wCAAwC,CAAC,CAC9D,CAAC;QACF,WAAW,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;IACvC,CAAC;IAED,MAAM,UAAU,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;IACpE,MAAM,WAAW,GAAG,MAAM,CAAC,IAAI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E,IAAI;WACP;iBACF,CAAC;YACJ,CAAC;YAED,OAAO;QACT,CAAC;KACF,CAAC;AACJ,CAAC;AAED,SAAS,sBAAsB;IAC7B,OAAO;QACL,IAAI,EAAE,mCAAmC;QACzC,KAAK,EAAE,OAAO;QACd,MAAM;YACJ,OAAO;gBACL,OAAO,EAAE;oBACP,4CAA4C;oBAC5C,0CAA0C;oBAC1C,SAAS,EAAE,IAAI;iBAChB;aACF,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC;AAED,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AACnD,kCAAkC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import StartStorybookBuilder from '@storybook/angular/
|
|
1
|
+
import StartStorybookBuilder from '@storybook/angular/builders/start-storybook';
|
|
2
2
|
export default StartStorybookBuilder;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"start-storybook.js","sourceRoot":"","sources":["../../../../../../packages/storybook-angular/src/lib/start-storybook/start-storybook.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,MAAM,
|
|
1
|
+
{"version":3,"file":"start-storybook.js","sourceRoot":"","sources":["../../../../../../packages/storybook-angular/src/lib/start-storybook/start-storybook.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,MAAM,6CAA6C,CAAC;AAEhF,eAAe,qBAAqB,CAAC"}
|
package/src/lib/testing.d.ts
CHANGED
package/src/lib/testing.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import '@angular/compiler';
|
|
2
|
+
import { setProjectAnnotations as originalSetProjectAnnotations } from '@storybook/angular/client';
|
|
3
|
+
import * as configAnnotations from '@storybook/angular/client/config';
|
|
3
4
|
export const render = configAnnotations.render;
|
|
4
5
|
export async function renderToCanvas(context, element) {
|
|
5
6
|
element.id = context.id;
|
package/src/lib/testing.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testing.js","sourceRoot":"","sources":["../../../../../packages/storybook-angular/src/lib/testing.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"testing.js","sourceRoot":"","sources":["../../../../../packages/storybook-angular/src/lib/testing.ts"],"names":[],"mappings":"AAAA,OAAO,mBAAmB,CAAC;AAE3B,OAAO,EAAE,qBAAqB,IAAI,6BAA6B,EAAE,MAAM,2BAA2B,CAAC;AAMnG,OAAO,KAAK,iBAAiB,MAAM,kCAAkC,CAAC;AAEtE,MAAM,CAAC,MAAM,MAAM,GAAG,iBAAiB,CAAC,MAAM,CAAC;AAE/C,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,OAAuC,EACvC,OAAoB;IAEpB,OAAO,CAAC,EAAE,GAAG,OAAO,CAAC,EAAE,CAAC;IACxB,MAAM,iBAAiB,CAAC,cAAc,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;AAC3D,CAAC;AAED,MAAM,iBAAiB,GAAG;IACxB,MAAM;IACN,cAAc;CACf,CAAC;AAEF,MAAM,UAAU,qBAAqB,CACnC,kBAE2C;IAE3C,OAAO,6BAA6B,CAAC;QACnC,iBAAiB;QACjB,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,kBAAkB,CAAC;YACnC,CAAC,CAAC,kBAAkB;YACpB,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC;KAC1B,CAAkD,CAAC;AACtD,CAAC"}
|
package/preset.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { PresetProperty } from 'storybook/internal/types';
|
|
2
|
-
import { StorybookConfig } from './src/types';
|
|
3
|
-
export declare const core: PresetProperty<'core'>;
|
|
4
|
-
export declare const viteFinal: NonNullable<StorybookConfig['viteFinal']>;
|
|
5
|
-
export { addons, previewAnnotations } from '@storybook/angular/dist/preset.js';
|
package/preset.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"preset.js","sourceRoot":"","sources":["../../../../packages/storybook-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BAAmB;gBACnB,sCAAsC;gBACtC,+BAA+B;gBAC/B,uBAAuB;gBACvB,OAAO;gBACP,SAAS;aACV;SACF;QACD,OAAO,EAAE;YACP,OAAO,CAAC;gBACN,GAAG,EACD,OAAO,SAAS,CAAC,OAAO,EAAE,GAAG,KAAK,WAAW;oBAC3C,CAAC,CAAC,SAAS,CAAC,OAAO,EAAE,GAAG;oBACxB,CAAC,CAAC,IAAI;gBACV,UAAU,EACR,OAAO,SAAS,CAAC,OAAO,EAAE,UAAU,KAAK,WAAW;oBAClD,CAAC,CAAC,SAAS,CAAC,OAAO,EAAE,UAAU;oBAC/B,CAAC,CAAC,KAAK;gBACX,QAAQ,EAAE,OAAO,EAAE,QAAQ,IAAI,4BAA4B;aAC5D,CAAC;SACH;QACD,MAAM,EAAE;YACN,yBAAyB,EAAE,IAAI,CAAC,SAAS,CAAC;gBACxC,oBAAoB,EAClB,CAAC,CAAC,OAAO,EAAE,qBAAqB,EAAE,oBAAoB;aACzD,CAAC;SACH;KACF,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,OAAO,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC"}
|
package/preset.mjs
DELETED
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
import { dirname, join, resolve } from 'node:path';
|
|
2
|
-
import { createRequire } from 'node:module';
|
|
3
|
-
import { core as PresetCore } from '@storybook/angular/dist/preset.js';
|
|
4
|
-
const require = createRequire(import.meta.url);
|
|
5
|
-
const getAbsolutePath = (input) =>
|
|
6
|
-
dirname(require.resolve(join(input, 'package.json')));
|
|
7
|
-
export const core = async (config, options) => {
|
|
8
|
-
const presetCore = PresetCore(config, options);
|
|
9
|
-
return {
|
|
10
|
-
...presetCore,
|
|
11
|
-
builder: {
|
|
12
|
-
name: getAbsolutePath('@storybook/builder-vite'),
|
|
13
|
-
options: { ...presetCore.options },
|
|
14
|
-
},
|
|
15
|
-
};
|
|
16
|
-
};
|
|
17
|
-
export const viteFinal = async (config, options) => {
|
|
18
|
-
// Remove any loaded analogjs plugins from a vite.config.(m)ts file
|
|
19
|
-
config.plugins = config.plugins
|
|
20
|
-
.flat()
|
|
21
|
-
.filter((plugin) => !plugin.name.includes('analogjs'));
|
|
22
|
-
|
|
23
|
-
// Merge custom configuration into the default config
|
|
24
|
-
const { mergeConfig, normalizePath } = await import('vite');
|
|
25
|
-
const { default: angular } = await import('@analogjs/vite-plugin-angular');
|
|
26
|
-
// @ts-ignore
|
|
27
|
-
const framework = await options.presets.apply('framework');
|
|
28
|
-
return mergeConfig(config, {
|
|
29
|
-
// Add dependencies to pre-optimization
|
|
30
|
-
optimizeDeps: {
|
|
31
|
-
include: [
|
|
32
|
-
'@storybook/angular/dist/client/index.js',
|
|
33
|
-
'@analogjs/storybook-angular',
|
|
34
|
-
'@angular/compiler',
|
|
35
|
-
'@angular/platform-browser',
|
|
36
|
-
'@angular/platform-browser/animations',
|
|
37
|
-
'tslib',
|
|
38
|
-
...(options?.angularBuilderOptions?.experimentalZoneless
|
|
39
|
-
? []
|
|
40
|
-
: ['zone.js']),
|
|
41
|
-
],
|
|
42
|
-
},
|
|
43
|
-
plugins: [
|
|
44
|
-
angular({
|
|
45
|
-
jit:
|
|
46
|
-
typeof framework.options?.jit !== 'undefined'
|
|
47
|
-
? framework.options?.jit
|
|
48
|
-
: true,
|
|
49
|
-
liveReload:
|
|
50
|
-
typeof framework.options?.liveReload !== 'undefined'
|
|
51
|
-
? framework.options?.liveReload
|
|
52
|
-
: false,
|
|
53
|
-
tsconfig: options?.tsConfig ?? './.storybook/tsconfig.json',
|
|
54
|
-
inlineStylesExtension:
|
|
55
|
-
typeof framework.options?.inlineStylesExtension !== 'undefined'
|
|
56
|
-
? framework.options?.inlineStylesExtension
|
|
57
|
-
: 'css',
|
|
58
|
-
}),
|
|
59
|
-
angularOptionsPlugin(options, { normalizePath }),
|
|
60
|
-
],
|
|
61
|
-
define: {
|
|
62
|
-
STORYBOOK_ANGULAR_OPTIONS: JSON.stringify({
|
|
63
|
-
experimentalZoneless:
|
|
64
|
-
!!options?.angularBuilderOptions?.experimentalZoneless,
|
|
65
|
-
}),
|
|
66
|
-
},
|
|
67
|
-
});
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
function angularOptionsPlugin(options, { normalizePath }) {
|
|
71
|
-
return {
|
|
72
|
-
name: 'analogjs-storybook-options-plugin',
|
|
73
|
-
config() {
|
|
74
|
-
const loadPaths =
|
|
75
|
-
options?.angularBuilderOptions?.stylePreprocessorOptions?.loadPaths;
|
|
76
|
-
const sassOptions =
|
|
77
|
-
options?.angularBuilderOptions?.stylePreprocessorOptions?.sass;
|
|
78
|
-
|
|
79
|
-
if (Array.isArray(loadPaths)) {
|
|
80
|
-
return {
|
|
81
|
-
css: {
|
|
82
|
-
preprocessorOptions: {
|
|
83
|
-
scss: {
|
|
84
|
-
...sassOptions,
|
|
85
|
-
loadPaths: loadPaths.map(
|
|
86
|
-
(loadPath) =>
|
|
87
|
-
`${resolve(options.angularBuilderContext.workspaceRoot, loadPath)}`,
|
|
88
|
-
),
|
|
89
|
-
},
|
|
90
|
-
},
|
|
91
|
-
},
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
return;
|
|
96
|
-
},
|
|
97
|
-
transform(code, id) {
|
|
98
|
-
if (
|
|
99
|
-
normalizePath(id).endsWith(
|
|
100
|
-
normalizePath(`${options.configDir}/preview.ts`),
|
|
101
|
-
)
|
|
102
|
-
) {
|
|
103
|
-
const imports = [];
|
|
104
|
-
const styles = options?.angularBuilderOptions?.styles;
|
|
105
|
-
|
|
106
|
-
if (Array.isArray(styles)) {
|
|
107
|
-
styles.forEach((style) => {
|
|
108
|
-
imports.push(style);
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
const zoneless = options?.angularBuilderOptions?.experimentalZoneless;
|
|
113
|
-
|
|
114
|
-
if (!zoneless) {
|
|
115
|
-
imports.push('zone.js');
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
return {
|
|
119
|
-
code: `
|
|
120
|
-
${imports.map((extraImport) => `import '${extraImport}';`).join('\n')}
|
|
121
|
-
${code}
|
|
122
|
-
`,
|
|
123
|
-
};
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
return;
|
|
127
|
-
},
|
|
128
|
-
};
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
export { addons, previewAnnotations } from '@storybook/angular/dist/preset.js';
|
|
132
|
-
//# sourceMappingURL=preset.js.map
|