@analogjs/storybook-angular 2.0.0-beta.9 → 2.0.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 +23 -0
- package/package.json +8 -11
- package/preset.js +1 -0
- package/src/index.d.ts +2 -2
- package/src/index.js +1 -2
- 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/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 -149
package/README.md
CHANGED
|
@@ -89,6 +89,29 @@ To register global styles, add them to the `@analogjs/storybook-angular` builder
|
|
|
89
89
|
}
|
|
90
90
|
```
|
|
91
91
|
|
|
92
|
+
## Enabling Zoneless Change Detection
|
|
93
|
+
|
|
94
|
+
To use zoneless change detection for the Storybook, add the `experimentalZoneless` flag to the `@analogjs/storybook-angular` builder options in the `angular.json` or `project.json`.
|
|
95
|
+
|
|
96
|
+
```json
|
|
97
|
+
"storybook": {
|
|
98
|
+
"builder": "@analogjs/storybook-angular:start-storybook",
|
|
99
|
+
"options": {
|
|
100
|
+
// ... other options
|
|
101
|
+
"experimentalZoneless": true
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
"build-storybook": {
|
|
105
|
+
"builder": "@analogjs/storybook-angular:build-storybook",
|
|
106
|
+
"options": {
|
|
107
|
+
// ... other options
|
|
108
|
+
"experimentalZoneless": true
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
> Zoneless change detection is the default for new projects starting Angular v21.
|
|
114
|
+
|
|
92
115
|
## Setting up Static Assets
|
|
93
116
|
|
|
94
117
|
Static assets are configured in the `.storybook/main.ts` file using the `staticDirs` array.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@analogjs/storybook-angular",
|
|
3
|
-
"version": "2.0.0
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Storybook Integration for Angular & Vite",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
@@ -25,30 +25,27 @@
|
|
|
25
25
|
"exports": {
|
|
26
26
|
".": {
|
|
27
27
|
"types": "./src/index.d.ts",
|
|
28
|
-
"
|
|
29
|
-
"require": "./src/index.js"
|
|
28
|
+
"default": "./src/index.js"
|
|
30
29
|
},
|
|
31
|
-
"./preset": "./preset.
|
|
30
|
+
"./preset": "./preset.js",
|
|
32
31
|
"./package.json": "./package.json",
|
|
33
|
-
"./*": "./src/*",
|
|
34
32
|
"./testing": {
|
|
35
33
|
"types": "./src/lib/testing.d.ts",
|
|
36
|
-
"
|
|
37
|
-
"require": "./src/lib/testing.js"
|
|
34
|
+
"default": "./src/lib/testing.js"
|
|
38
35
|
}
|
|
39
36
|
},
|
|
40
37
|
"main": "src/index.js",
|
|
41
38
|
"dependencies": {
|
|
42
|
-
"@storybook/builder-vite": "
|
|
39
|
+
"@storybook/builder-vite": "^10.0.0"
|
|
43
40
|
},
|
|
44
41
|
"peerDependencies": {
|
|
45
|
-
"@storybook/angular": "
|
|
42
|
+
"@storybook/angular": "^10.0.0",
|
|
46
43
|
"@analogjs/vite-plugin-angular": "*",
|
|
47
|
-
"storybook": "
|
|
44
|
+
"storybook": "^10.0.0",
|
|
48
45
|
"vite": "^5.0.0 || ^6.0.0 || ^7.0.0"
|
|
49
46
|
},
|
|
50
47
|
"engines": {
|
|
51
|
-
"node": ">=
|
|
48
|
+
"node": ">=20.0.0"
|
|
52
49
|
},
|
|
53
50
|
"builders": "src/lib/builders.json",
|
|
54
51
|
"ng-add": {
|
package/preset.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './src/lib/preset.js';
|
package/src/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
1
|
+
export { type AngularOptions, type Parameters as AngularParameters, type AngularRenderer, type Decorator, type IStory, type Loader, type Meta, type Preview, type StoryContext, type StoryFn, type StoryObj, applicationConfig, argsToTemplate, componentWrapperDecorator, moduleMetadata, setProjectAnnotations, } from '@storybook/angular';
|
|
2
|
+
export { type FrameworkOptions, type StorybookConfig } from './types';
|
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,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/storybook-angular/src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAYL,iBAAiB,EACjB,cAAc,EACd,yBAAyB,EACzB,cAAc,EACd,qBAAqB,GACtB,MAAM,oBAAoB,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"}
|
|
@@ -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,CAAC,UAAU,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;IACvD,IAAI,WAAW,EAAE,CAAC;QA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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-angular/src/preset.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,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ACV;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,149 +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
|
-
storybookEsbuildPlugin(),
|
|
61
|
-
],
|
|
62
|
-
define: {
|
|
63
|
-
STORYBOOK_ANGULAR_OPTIONS: JSON.stringify({
|
|
64
|
-
experimentalZoneless:
|
|
65
|
-
!!options?.angularBuilderOptions?.experimentalZoneless,
|
|
66
|
-
}),
|
|
67
|
-
},
|
|
68
|
-
});
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
function angularOptionsPlugin(options, { normalizePath }) {
|
|
72
|
-
return {
|
|
73
|
-
name: 'analogjs-storybook-options-plugin',
|
|
74
|
-
config() {
|
|
75
|
-
const loadPaths =
|
|
76
|
-
options?.angularBuilderOptions?.stylePreprocessorOptions?.loadPaths;
|
|
77
|
-
const sassOptions =
|
|
78
|
-
options?.angularBuilderOptions?.stylePreprocessorOptions?.sass;
|
|
79
|
-
|
|
80
|
-
if (Array.isArray(loadPaths)) {
|
|
81
|
-
return {
|
|
82
|
-
css: {
|
|
83
|
-
preprocessorOptions: {
|
|
84
|
-
scss: {
|
|
85
|
-
...sassOptions,
|
|
86
|
-
loadPaths: loadPaths.map(
|
|
87
|
-
(loadPath) =>
|
|
88
|
-
`${resolve(options.angularBuilderContext.workspaceRoot, loadPath)}`,
|
|
89
|
-
),
|
|
90
|
-
},
|
|
91
|
-
},
|
|
92
|
-
},
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
return;
|
|
97
|
-
},
|
|
98
|
-
transform(code, id) {
|
|
99
|
-
if (
|
|
100
|
-
normalizePath(id).endsWith(
|
|
101
|
-
normalizePath(`${options.configDir}/preview.ts`),
|
|
102
|
-
)
|
|
103
|
-
) {
|
|
104
|
-
const imports = [];
|
|
105
|
-
const styles = options?.angularBuilderOptions?.styles;
|
|
106
|
-
|
|
107
|
-
if (Array.isArray(styles)) {
|
|
108
|
-
styles.forEach((style) => {
|
|
109
|
-
imports.push(style);
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
const zoneless = options?.angularBuilderOptions?.experimentalZoneless;
|
|
114
|
-
|
|
115
|
-
if (!zoneless) {
|
|
116
|
-
imports.push('zone.js');
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
return {
|
|
120
|
-
code: `
|
|
121
|
-
${imports.map((extraImport) => `import '${extraImport}';`).join('\n')}
|
|
122
|
-
${code}
|
|
123
|
-
`,
|
|
124
|
-
};
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
return;
|
|
128
|
-
},
|
|
129
|
-
};
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
function storybookEsbuildPlugin() {
|
|
133
|
-
return {
|
|
134
|
-
name: 'analogjs-storybook-esbuild-config',
|
|
135
|
-
apply: 'build',
|
|
136
|
-
config() {
|
|
137
|
-
return {
|
|
138
|
-
esbuild: {
|
|
139
|
-
// Don't mangle class names during the build
|
|
140
|
-
// This fixes display of compodoc argtypes
|
|
141
|
-
keepNames: true,
|
|
142
|
-
},
|
|
143
|
-
};
|
|
144
|
-
},
|
|
145
|
-
};
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
export { addons, previewAnnotations } from '@storybook/angular/dist/preset.js';
|
|
149
|
-
//# sourceMappingURL=preset.js.map
|