@storybook/angular 6.5.9 → 7.0.0-alpha.2
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/{ts3.9 → types}/builders/build-storybook/index.d.ts +1 -1
- package/dist/types/builders/build-storybook/index.js +58 -0
- package/dist/{ts3.9 → types}/builders/build-storybook/schema.json +0 -0
- package/dist/{ts3.9 → types}/builders/builders.json +0 -0
- package/dist/{ts3.9 → types}/builders/start-storybook/index.d.ts +1 -1
- package/dist/types/builders/start-storybook/index.js +66 -0
- package/dist/{ts3.9 → types}/builders/start-storybook/schema.json +0 -0
- package/dist/{ts3.9 → types}/builders/utils/build-standalone-errors-handler.d.ts +0 -0
- package/dist/{ts3.9 → types}/builders/utils/build-standalone-errors-handler.js +5 -5
- package/dist/{ts3.9 → types}/builders/utils/run-compodoc.d.ts +0 -0
- package/dist/{ts3.9 → types}/builders/utils/run-compodoc.js +9 -4
- package/dist/{ts3.9 → types}/client/docs/compodoc.d.ts +0 -0
- package/dist/{ts3.9 → types}/client/docs/compodoc.js +47 -34
- package/dist/{ts3.9 → types}/client/docs/config.d.ts +2 -3
- package/dist/{ts3.9 → types}/client/docs/config.js +0 -2
- package/dist/{ts3.9 → types}/client/docs/index.d.ts +0 -0
- package/dist/{ts3.9 → types}/client/docs/index.js +6 -2
- package/dist/{ts3.9 → types}/client/docs/sourceDecorator.d.ts +0 -0
- package/dist/{ts3.9 → types}/client/docs/sourceDecorator.js +10 -9
- package/dist/{ts3.9 → types}/client/docs/types.d.ts +0 -0
- package/dist/{ts3.9 → types}/client/docs/types.js +0 -0
- package/dist/{ts3.9 → types}/client/index.d.ts +0 -0
- package/dist/{ts3.9 → types}/client/index.js +9 -5
- package/dist/{ts3.9 → types}/client/preview/angular/app.token.d.ts +0 -0
- package/dist/{ts3.9 → types}/client/preview/angular/app.token.js +0 -0
- package/dist/{ts3.9 → types}/client/preview/angular/components/app.component.d.ts +0 -0
- package/dist/{ts3.9 → types}/client/preview/angular/components/app.component.js +4 -4
- package/dist/{ts3.9 → types}/client/preview/angular/helpers.d.ts +0 -0
- package/dist/{ts3.9 → types}/client/preview/angular/helpers.js +6 -6
- package/dist/{ts3.9 → types}/client/preview/angular-beta/AbstractRenderer.d.ts +0 -0
- package/dist/{ts3.9 → types}/client/preview/angular-beta/AbstractRenderer.js +40 -48
- package/dist/{ts3.9 → types}/client/preview/angular-beta/CanvasRenderer.d.ts +0 -0
- package/dist/types/client/preview/angular-beta/CanvasRenderer.js +16 -0
- package/dist/{ts3.9 → types}/client/preview/angular-beta/ComputesTemplateFromComponent.d.ts +0 -0
- package/dist/{ts3.9 → types}/client/preview/angular-beta/ComputesTemplateFromComponent.js +10 -8
- package/dist/{ts3.9 → types}/client/preview/angular-beta/DocsRenderer.d.ts +0 -0
- package/dist/types/client/preview/angular-beta/DocsRenderer.js +41 -0
- package/dist/{ts3.9 → types}/client/preview/angular-beta/RendererFactory.d.ts +0 -0
- package/dist/types/client/preview/angular-beta/RendererFactory.js +55 -0
- package/dist/{ts3.9 → types}/client/preview/angular-beta/StorybookModule.d.ts +0 -0
- package/dist/{ts3.9 → types}/client/preview/angular-beta/StorybookModule.js +17 -16
- package/dist/{ts3.9 → types}/client/preview/angular-beta/StorybookProvider.d.ts +0 -0
- package/dist/{ts3.9 → types}/client/preview/angular-beta/StorybookProvider.js +2 -1
- package/dist/{ts3.9 → types}/client/preview/angular-beta/StorybookWrapperComponent.d.ts +0 -0
- package/dist/{ts3.9 → types}/client/preview/angular-beta/StorybookWrapperComponent.js +11 -10
- package/dist/{ts3.9 → types}/client/preview/angular-beta/utils/NgComponentAnalyzer.d.ts +0 -0
- package/dist/{ts3.9 → types}/client/preview/angular-beta/utils/NgComponentAnalyzer.js +24 -13
- package/dist/{ts3.9 → types}/client/preview/angular-beta/utils/NgModulesAnalyzer.d.ts +0 -0
- package/dist/{ts3.9 → types}/client/preview/angular-beta/utils/NgModulesAnalyzer.js +3 -2
- package/dist/{ts3.9 → types}/client/preview/angular-polyfills.d.ts +0 -0
- package/dist/{ts3.9 → types}/client/preview/angular-polyfills.js +0 -0
- package/dist/{ts3.9 → types}/client/preview/config.d.ts +0 -0
- package/dist/{ts3.9 → types}/client/preview/config.js +1 -1
- package/dist/{ts3.9 → types}/client/preview/decorateStory.d.ts +0 -0
- package/dist/{ts3.9 → types}/client/preview/decorateStory.js +11 -6
- package/dist/{ts3.9 → types}/client/preview/decorators.d.ts +0 -0
- package/dist/{ts3.9 → types}/client/preview/decorators.js +23 -11
- package/dist/{ts3.9 → types}/client/preview/globals.d.ts +0 -0
- package/dist/{ts3.9 → types}/client/preview/globals.js +0 -0
- package/dist/{ts3.9 → types}/client/preview/index.d.ts +0 -0
- package/dist/{ts3.9 → types}/client/preview/index.js +6 -4
- package/dist/{ts3.9 → types}/client/preview/render.d.ts +0 -0
- package/dist/types/client/preview/render.js +24 -0
- package/dist/{ts3.9 → types}/client/preview/types-6-0.d.ts +0 -0
- package/dist/{ts3.9 → types}/client/preview/types-6-0.js +0 -0
- package/dist/{ts3.9 → types}/client/preview/types-7-0.d.ts +0 -0
- package/dist/{ts3.9 → types}/client/preview/types-7-0.js +0 -0
- package/dist/{ts3.9 → types}/client/preview/types.d.ts +0 -0
- package/dist/{ts3.9 → types}/client/preview/types.js +0 -0
- package/dist/{ts3.4/public_api.d.ts → types/index.d.ts} +2 -1
- package/dist/{ts3.9/public_api.js → types/index.js} +7 -2
- package/dist/types/preset.d.ts +13 -0
- package/dist/types/preset.js +32 -0
- package/dist/{ts3.9 → types}/renderer.d.ts +0 -0
- package/dist/{ts3.9 → types}/renderer.js +1 -0
- package/dist/{ts3.9 → types}/server/__mocks-ng-workspace__/empty-projects-entry/angular.json +0 -0
- package/dist/{ts3.9 → types}/server/__mocks-ng-workspace__/minimal-config/angular.json +0 -0
- package/dist/{ts3.9 → types}/server/__mocks-ng-workspace__/minimal-config/src/main.d.ts +0 -0
- package/dist/{ts3.9 → types}/server/__mocks-ng-workspace__/minimal-config/src/main.js +0 -0
- package/dist/{ts3.9 → types}/server/__mocks-ng-workspace__/minimal-config/src/tsconfig.app.json +0 -0
- package/dist/{ts3.9 → types}/server/__mocks-ng-workspace__/minimal-config/tsconfig.json +0 -0
- package/dist/{ts3.9 → types}/server/__mocks-ng-workspace__/some-config/angular.json +0 -0
- package/dist/{ts3.9 → types}/server/__mocks-ng-workspace__/some-config/src/main.d.ts +0 -0
- package/dist/{ts3.9 → types}/server/__mocks-ng-workspace__/some-config/src/main.js +0 -0
- package/dist/{ts3.9 → types}/server/__mocks-ng-workspace__/some-config/src/tsconfig.app.json +0 -0
- package/dist/{ts3.9 → types}/server/__mocks-ng-workspace__/some-config/tsconfig.json +0 -0
- package/dist/{ts3.9 → types}/server/__mocks-ng-workspace__/with-angularBrowserTarget/angular.json +0 -0
- package/dist/{ts3.9 → types}/server/__mocks-ng-workspace__/with-angularBrowserTarget/src/main.d.ts +0 -0
- package/dist/{ts3.9 → types}/server/__mocks-ng-workspace__/with-angularBrowserTarget/src/main.js +0 -0
- package/dist/{ts3.9 → types}/server/__mocks-ng-workspace__/with-angularBrowserTarget/src/tsconfig.app.json +0 -0
- package/dist/{ts3.9 → types}/server/__mocks-ng-workspace__/with-angularBrowserTarget/tsconfig.json +0 -0
- package/dist/{ts3.9 → types}/server/__mocks-ng-workspace__/with-lib/angular.json +0 -0
- package/dist/{ts3.9 → types}/server/__mocks-ng-workspace__/with-lib/projects/pattern-lib/src/main.d.ts +0 -0
- package/dist/{ts3.9 → types}/server/__mocks-ng-workspace__/with-lib/projects/pattern-lib/src/main.js +0 -0
- package/dist/{ts3.9 → types}/server/__mocks-ng-workspace__/with-lib/projects/pattern-lib/tsconfig.lib.json +0 -0
- package/dist/{ts3.9 → types}/server/__mocks-ng-workspace__/with-lib/tsconfig.json +0 -0
- package/dist/{ts3.9 → types}/server/__mocks-ng-workspace__/with-nx/angular.json +0 -0
- package/dist/{ts3.9 → types}/server/__mocks-ng-workspace__/with-nx/nx.json +0 -0
- package/dist/{ts3.9 → types}/server/__mocks-ng-workspace__/with-nx/src/main.d.ts +0 -0
- package/dist/{ts3.9 → types}/server/__mocks-ng-workspace__/with-nx/src/main.js +0 -0
- package/dist/{ts3.9 → types}/server/__mocks-ng-workspace__/with-nx/src/tsconfig.app.json +0 -0
- package/dist/{ts3.9 → types}/server/__mocks-ng-workspace__/with-nx/tsconfig.json +0 -0
- package/dist/{ts3.9 → types}/server/__mocks-ng-workspace__/with-nx-workspace/nx.json +0 -0
- package/dist/{ts3.9 → types}/server/__mocks-ng-workspace__/with-nx-workspace/src/main.d.ts +0 -0
- package/dist/{ts3.9 → types}/server/__mocks-ng-workspace__/with-nx-workspace/src/main.js +0 -0
- package/dist/{ts3.9 → types}/server/__mocks-ng-workspace__/with-nx-workspace/src/tsconfig.app.json +0 -0
- package/dist/{ts3.9 → types}/server/__mocks-ng-workspace__/with-nx-workspace/tsconfig.json +0 -0
- package/dist/{ts3.9 → types}/server/__mocks-ng-workspace__/with-nx-workspace/workspace.json +0 -0
- package/dist/{ts3.9 → types}/server/__mocks-ng-workspace__/with-options-styles/angular.json +0 -0
- package/dist/{ts3.9 → types}/server/__mocks-ng-workspace__/with-options-styles/src/main.d.ts +0 -0
- package/dist/{ts3.9 → types}/server/__mocks-ng-workspace__/with-options-styles/src/main.js +0 -0
- package/dist/{ts3.9 → types}/server/__mocks-ng-workspace__/with-options-styles/src/tsconfig.app.json +0 -0
- package/dist/{ts3.9 → types}/server/__mocks-ng-workspace__/with-options-styles/tsconfig.json +0 -0
- package/dist/{ts3.9 → types}/server/__mocks-ng-workspace__/without-architect-build/angular.json +0 -0
- package/dist/{ts3.9 → types}/server/__mocks-ng-workspace__/without-architect-build-options/angular.json +0 -0
- package/dist/{ts3.9 → types}/server/__mocks-ng-workspace__/without-compatible-projects/angular.json +0 -0
- package/dist/{ts3.9 → types}/server/__mocks-ng-workspace__/without-projects-entry/angular.json +0 -0
- package/dist/{ts3.9 → types}/server/__mocks-ng-workspace__/without-projects-entry/projects/pattern-lib/src/main.d.ts +0 -0
- package/dist/{ts3.9 → types}/server/__mocks-ng-workspace__/without-projects-entry/projects/pattern-lib/src/main.js +0 -0
- package/dist/{ts3.9 → types}/server/__mocks-ng-workspace__/without-projects-entry/projects/pattern-lib/tsconfig.lib.json +0 -0
- package/dist/{ts3.9 → types}/server/__mocks-ng-workspace__/without-projects-entry/tsconfig.json +0 -0
- package/dist/{ts3.9 → types}/server/__mocks-ng-workspace__/without-tsConfig/angular.json +0 -0
- package/dist/{ts3.9 → types}/server/__mocks-ng-workspace__/without-tsConfig/src/main.d.ts +0 -0
- package/dist/{ts3.9 → types}/server/__mocks-ng-workspace__/without-tsConfig/src/main.js +0 -0
- package/dist/{ts3.9 → types}/server/__mocks-ng-workspace__/without-tsConfig/src/tsconfig.app.json +0 -0
- package/dist/{ts3.9 → types}/server/__mocks-ng-workspace__/without-tsConfig/tsconfig.json +0 -0
- package/dist/{ts3.9 → types}/server/angular-cli-webpack-12.2.x.d.ts +0 -0
- package/dist/types/server/angular-cli-webpack-12.2.x.js +66 -0
- package/dist/{ts3.9 → types}/server/angular-cli-webpack-13.x.x.d.ts +0 -0
- package/dist/types/server/angular-cli-webpack-13.x.x.js +70 -0
- package/dist/types/server/angular-cli-webpack-older.d.ts +6 -0
- package/dist/types/server/angular-cli-webpack-older.js +111 -0
- package/dist/{ts3.9 → types}/server/angular-devkit-build-webpack.d.ts +6 -6
- package/dist/{ts3.9 → types}/server/angular-devkit-build-webpack.js +66 -54
- package/dist/{ts3.9 → types}/server/angular-read-workspace.d.ts +0 -0
- package/dist/{ts3.9 → types}/server/angular-read-workspace.js +8 -14
- package/dist/{ts3.9 → types}/server/create-fork-ts-checker-plugin.d.ts +0 -0
- package/dist/{ts3.9 → types}/server/create-fork-ts-checker-plugin.js +1 -1
- package/dist/{ts3.9 → types}/server/framework-preset-angular-cli.d.ts +1 -1
- package/dist/types/server/framework-preset-angular-cli.js +175 -0
- package/dist/{ts3.9 → types}/server/framework-preset-angular-docs.d.ts +0 -0
- package/dist/{ts3.9 → types}/server/framework-preset-angular-docs.js +4 -3
- package/dist/{ts3.9 → types}/server/framework-preset-angular-ivy.d.ts +1 -1
- package/dist/{ts3.9 → types}/server/framework-preset-angular-ivy.js +26 -22
- package/dist/{ts3.9 → types}/server/framework-preset-angular.d.ts +0 -0
- package/dist/types/server/framework-preset-angular.js +103 -0
- package/dist/{ts3.9 → types}/server/ngx-template-loader/index.d.ts +0 -0
- package/dist/{ts3.9 → types}/server/ngx-template-loader/index.js +0 -0
- package/dist/{ts3.9/server/options.d.ts → types/server/preset-options.d.ts} +1 -3
- package/dist/{ts3.9/types/index.js → types/server/preset-options.js} +0 -0
- package/dist/{ts3.9 → types}/server/ts_config.d.ts +0 -0
- package/dist/{ts3.9 → types}/server/ts_config.js +0 -0
- package/dist/{ts3.9 → types}/server/utils/filter-out-styling-rules.d.ts +0 -0
- package/dist/{ts3.9 → types}/server/utils/filter-out-styling-rules.js +2 -1
- package/dist/{ts3.9 → types}/server/utils/module-is-available.d.ts +0 -0
- package/dist/{ts3.9 → types}/server/utils/module-is-available.js +2 -1
- package/dist/{ts3.4 → types}/server/utils/normalize-asset-patterns.d.ts +7 -6
- package/dist/{ts3.9 → types}/server/utils/normalize-asset-patterns.js +9 -9
- package/dist/{ts3.9 → types}/server/utils/normalize-optimization.d.ts +1 -1
- package/dist/{ts3.9 → types}/server/utils/normalize-optimization.js +3 -2
- package/dist/types/types.d.ts +13 -0
- package/dist/types/types.js +2 -0
- package/jest.config.js +1 -0
- package/package.json +47 -56
- package/preset.js +1 -1
- package/renderer.d.ts +1 -1
- package/renderer.js +1 -1
- package/standalone.js +2 -3
- package/types-6-0.d.ts +1 -1
- package/types-7-0.d.ts +1 -1
- package/bin/build.js +0 -4
- package/bin/index.js +0 -3
- package/demo.d.ts +0 -4
- package/demo.js +0 -5
- package/dist/ts3.4/builders/build-storybook/index.d.ts +0 -15
- package/dist/ts3.4/builders/start-storybook/index.d.ts +0 -15
- package/dist/ts3.4/builders/utils/build-standalone-errors-handler.d.ts +0 -1
- package/dist/ts3.4/builders/utils/run-compodoc.d.ts +0 -6
- package/dist/ts3.4/client/docs/compodoc.d.ts +0 -18
- package/dist/ts3.4/client/docs/config.d.ts +0 -15
- package/dist/ts3.4/client/docs/index.d.ts +0 -1
- package/dist/ts3.4/client/docs/prepareForInline.d.ts +0 -7
- package/dist/ts3.4/client/docs/sourceDecorator.d.ts +0 -9
- package/dist/ts3.4/client/docs/types.d.ts +0 -102
- package/dist/ts3.4/client/index.d.ts +0 -4
- package/dist/ts3.4/client/preview/angular/app.token.d.ts +0 -3
- package/dist/ts3.4/client/preview/angular/components/app.component.d.ts +0 -38
- package/dist/ts3.4/client/preview/angular/helpers.d.ts +0 -8
- package/dist/ts3.4/client/preview/angular-beta/AbstractRenderer.d.ts +0 -57
- package/dist/ts3.4/client/preview/angular-beta/CanvasRenderer.d.ts +0 -14
- package/dist/ts3.4/client/preview/angular-beta/ComputesTemplateFromComponent.d.ts +0 -17
- package/dist/ts3.4/client/preview/angular-beta/DocsRenderer.d.ts +0 -14
- package/dist/ts3.4/client/preview/angular-beta/RendererFactory.d.ts +0 -11
- package/dist/ts3.4/client/preview/angular-beta/StorybookModule.d.ts +0 -9
- package/dist/ts3.4/client/preview/angular-beta/StorybookProvider.d.ts +0 -5
- package/dist/ts3.4/client/preview/angular-beta/StorybookWrapperComponent.d.ts +0 -9
- package/dist/ts3.4/client/preview/angular-beta/utils/NgComponentAnalyzer.d.ts +0 -29
- package/dist/ts3.4/client/preview/angular-beta/utils/NgModulesAnalyzer.d.ts +0 -6
- package/dist/ts3.4/client/preview/angular-polyfills.d.ts +0 -41
- package/dist/ts3.4/client/preview/config.d.ts +0 -6
- package/dist/ts3.4/client/preview/decorateStory.d.ts +0 -4
- package/dist/ts3.4/client/preview/decorators.d.ts +0 -6
- package/dist/ts3.4/client/preview/globals.d.ts +0 -1
- package/dist/ts3.4/client/preview/index.d.ts +0 -25
- package/dist/ts3.4/client/preview/render.d.ts +0 -7
- package/dist/ts3.4/client/preview/types-6-0.d.ts +0 -42
- package/dist/ts3.4/client/preview/types-7-0.d.ts +0 -9
- package/dist/ts3.4/client/preview/types.d.ts +0 -29
- package/dist/ts3.4/demo/button.component.d.ts +0 -5
- package/dist/ts3.4/demo/welcome.component.d.ts +0 -4
- package/dist/ts3.4/renderer.d.ts +0 -4
- package/dist/ts3.4/server/__mocks-ng-workspace__/minimal-config/src/main.d.ts +0 -1
- package/dist/ts3.4/server/__mocks-ng-workspace__/some-config/src/main.d.ts +0 -1
- package/dist/ts3.4/server/__mocks-ng-workspace__/with-angularBrowserTarget/src/main.d.ts +0 -1
- package/dist/ts3.4/server/__mocks-ng-workspace__/with-lib/projects/pattern-lib/src/main.d.ts +0 -1
- package/dist/ts3.4/server/__mocks-ng-workspace__/with-nx/src/main.d.ts +0 -1
- package/dist/ts3.4/server/__mocks-ng-workspace__/with-nx-workspace/src/main.d.ts +0 -1
- package/dist/ts3.4/server/__mocks-ng-workspace__/with-options-styles/src/main.d.ts +0 -1
- package/dist/ts3.4/server/__mocks-ng-workspace__/without-projects-entry/projects/pattern-lib/src/main.d.ts +0 -1
- package/dist/ts3.4/server/__mocks-ng-workspace__/without-tsConfig/src/main.d.ts +0 -1
- package/dist/ts3.4/server/angular-cli-webpack-12.2.x.d.ts +0 -1
- package/dist/ts3.4/server/angular-cli-webpack-13.x.x.d.ts +0 -1
- package/dist/ts3.4/server/angular-cli-webpack-older.d.ts +0 -73
- package/dist/ts3.4/server/angular-devkit-build-webpack.d.ts +0 -30
- package/dist/ts3.4/server/angular-read-workspace.d.ts +0 -13
- package/dist/ts3.4/server/build.d.ts +0 -1
- package/dist/ts3.4/server/create-fork-ts-checker-plugin.d.ts +0 -3
- package/dist/ts3.4/server/framework-preset-angular-cli.d.ts +0 -3
- package/dist/ts3.4/server/framework-preset-angular-docs.d.ts +0 -2
- package/dist/ts3.4/server/framework-preset-angular-ivy.d.ts +0 -10
- package/dist/ts3.4/server/framework-preset-angular.d.ts +0 -5
- package/dist/ts3.4/server/index.d.ts +0 -1
- package/dist/ts3.4/server/ngx-template-loader/index.d.ts +0 -1
- package/dist/ts3.4/server/options.d.ts +0 -14
- package/dist/ts3.4/server/preset.d.ts +0 -3
- package/dist/ts3.4/server/ts_config.d.ts +0 -2
- package/dist/ts3.4/server/utils/filter-out-styling-rules.d.ts +0 -2
- package/dist/ts3.4/server/utils/module-is-available.d.ts +0 -1
- package/dist/ts3.4/server/utils/normalize-optimization.d.ts +0 -3
- package/dist/ts3.4/types/index.d.ts +0 -6
- package/dist/ts3.9/builders/build-storybook/index.js +0 -65
- package/dist/ts3.9/builders/start-storybook/index.js +0 -73
- package/dist/ts3.9/client/docs/prepareForInline.d.ts +0 -7
- package/dist/ts3.9/client/docs/prepareForInline.js +0 -45
- package/dist/ts3.9/client/preview/angular-beta/CanvasRenderer.js +0 -34
- package/dist/ts3.9/client/preview/angular-beta/DocsRenderer.js +0 -59
- package/dist/ts3.9/client/preview/angular-beta/RendererFactory.js +0 -65
- package/dist/ts3.9/client/preview/render.js +0 -34
- package/dist/ts3.9/demo/button.component.d.ts +0 -5
- package/dist/ts3.9/demo/button.component.js +0 -46
- package/dist/ts3.9/demo/welcome.component.d.ts +0 -4
- package/dist/ts3.9/demo/welcome.component.js +0 -99
- package/dist/ts3.9/public_api.d.ts +0 -1
- package/dist/ts3.9/server/angular-cli-webpack-12.2.x.js +0 -56
- package/dist/ts3.9/server/angular-cli-webpack-13.x.x.js +0 -60
- package/dist/ts3.9/server/angular-cli-webpack-older.d.ts +0 -73
- package/dist/ts3.9/server/angular-cli-webpack-older.js +0 -110
- package/dist/ts3.9/server/build.d.ts +0 -1
- package/dist/ts3.9/server/build.js +0 -28
- package/dist/ts3.9/server/framework-preset-angular-cli.js +0 -177
- package/dist/ts3.9/server/framework-preset-angular.js +0 -100
- package/dist/ts3.9/server/index.d.ts +0 -1
- package/dist/ts3.9/server/index.js +0 -8
- package/dist/ts3.9/server/options.js +0 -8
- package/dist/ts3.9/server/preset.d.ts +0 -3
- package/dist/ts3.9/server/preset.js +0 -13
- package/dist/ts3.9/server/utils/normalize-asset-patterns.d.ts +0 -6
- package/dist/ts3.9/types/index.d.ts +0 -6
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
// Private angular devkit stuff
|
|
2
|
+
const { generateI18nBrowserWebpackConfigFromContext, } = require('@angular-devkit/build-angular/src/utils/webpack-browser-config');
|
|
3
|
+
const { getCommonConfig, getStylesConfig, getDevServerConfig, getTypeScriptConfig, } = require('@angular-devkit/build-angular/src/webpack/configs');
|
|
4
|
+
const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin');
|
|
5
|
+
const { filterOutStylingRules } = require('./utils/filter-out-styling-rules');
|
|
6
|
+
/**
|
|
7
|
+
* Extract webpack config from angular-cli 13.x.x
|
|
8
|
+
* ⚠️ This file is in JavaScript to not use TypeScript. Because current storybook TypeScript version is not compatible with Angular CLI.
|
|
9
|
+
* FIXME: Try another way with TypeScript on future storybook version (7 maybe 🤞)
|
|
10
|
+
*
|
|
11
|
+
* @param {*} baseConfig Previous webpack config from storybook
|
|
12
|
+
* @param {*} options { builderOptions, builderContext }
|
|
13
|
+
*/
|
|
14
|
+
exports.getWebpackConfig = async (baseConfig, { builderOptions, builderContext }) => {
|
|
15
|
+
/**
|
|
16
|
+
* Get angular-cli Webpack config
|
|
17
|
+
*/
|
|
18
|
+
const { config: cliConfig } = await generateI18nBrowserWebpackConfigFromContext({
|
|
19
|
+
// Default options
|
|
20
|
+
index: 'noop-index',
|
|
21
|
+
main: 'noop-main',
|
|
22
|
+
outputPath: 'noop-out',
|
|
23
|
+
// Options provided by user
|
|
24
|
+
...builderOptions,
|
|
25
|
+
// Fixed options
|
|
26
|
+
optimization: false,
|
|
27
|
+
namedChunks: false,
|
|
28
|
+
progress: false,
|
|
29
|
+
buildOptimizer: false,
|
|
30
|
+
aot: false,
|
|
31
|
+
}, builderContext, (wco) => [
|
|
32
|
+
getCommonConfig(wco),
|
|
33
|
+
getStylesConfig(wco),
|
|
34
|
+
getTypeScriptConfig ? getTypeScriptConfig(wco) : getDevServerConfig(wco),
|
|
35
|
+
]);
|
|
36
|
+
/**
|
|
37
|
+
* Merge baseConfig Webpack with angular-cli Webpack
|
|
38
|
+
*/
|
|
39
|
+
const entry = [
|
|
40
|
+
...baseConfig.entry,
|
|
41
|
+
...(cliConfig.entry.styles ?? []),
|
|
42
|
+
...(cliConfig.entry.polyfills ?? []),
|
|
43
|
+
];
|
|
44
|
+
// Don't use storybooks styling rules because we have to use rules created by @angular-devkit/build-angular
|
|
45
|
+
// because @angular-devkit/build-angular created rules have include/exclude for global style files.
|
|
46
|
+
const rulesExcludingStyles = filterOutStylingRules(baseConfig);
|
|
47
|
+
const module = {
|
|
48
|
+
...baseConfig.module,
|
|
49
|
+
rules: [...cliConfig.module.rules, ...rulesExcludingStyles],
|
|
50
|
+
};
|
|
51
|
+
const plugins = [...(cliConfig.plugins ?? []), ...baseConfig.plugins];
|
|
52
|
+
const resolve = {
|
|
53
|
+
...baseConfig.resolve,
|
|
54
|
+
modules: Array.from(new Set([...baseConfig.resolve.modules, ...cliConfig.resolve.modules])),
|
|
55
|
+
plugins: [
|
|
56
|
+
new TsconfigPathsPlugin({
|
|
57
|
+
configFile: builderOptions.tsConfig,
|
|
58
|
+
mainFields: ['browser', 'module', 'main'],
|
|
59
|
+
}),
|
|
60
|
+
],
|
|
61
|
+
};
|
|
62
|
+
return {
|
|
63
|
+
...baseConfig,
|
|
64
|
+
entry,
|
|
65
|
+
module,
|
|
66
|
+
plugins,
|
|
67
|
+
resolve,
|
|
68
|
+
resolveLoader: cliConfig.resolveLoader,
|
|
69
|
+
};
|
|
70
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import webpack, { Configuration } from 'webpack';
|
|
2
|
+
import type { PresetOptions } from './preset-options';
|
|
3
|
+
/**
|
|
4
|
+
* Old way currently support version lower than 12.2.x
|
|
5
|
+
*/
|
|
6
|
+
export declare function getWebpackConfig(baseConfig: webpack.Configuration, options: PresetOptions): Promise<Configuration>;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getWebpackConfig = void 0;
|
|
7
|
+
const node_logger_1 = require("@storybook/node-logger");
|
|
8
|
+
const tsconfig_paths_webpack_plugin_1 = __importDefault(require("tsconfig-paths-webpack-plugin"));
|
|
9
|
+
const architect_1 = require("@angular-devkit/architect");
|
|
10
|
+
const angular_read_workspace_1 = require("./angular-read-workspace");
|
|
11
|
+
const angular_devkit_build_webpack_1 = require("./angular-devkit-build-webpack");
|
|
12
|
+
const filter_out_styling_rules_1 = require("./utils/filter-out-styling-rules");
|
|
13
|
+
/**
|
|
14
|
+
* Old way currently support version lower than 12.2.x
|
|
15
|
+
*/
|
|
16
|
+
async function getWebpackConfig(baseConfig, options) {
|
|
17
|
+
const dirToSearch = process.cwd();
|
|
18
|
+
// Read angular workspace
|
|
19
|
+
let workspaceConfig;
|
|
20
|
+
try {
|
|
21
|
+
workspaceConfig = await (0, angular_read_workspace_1.readAngularWorkspaceConfig)(dirToSearch);
|
|
22
|
+
}
|
|
23
|
+
catch (error) {
|
|
24
|
+
node_logger_1.logger.error(`=> Could not find angular workspace config (angular.json) on this path "${dirToSearch}"`);
|
|
25
|
+
node_logger_1.logger.info(`=> Fail to load angular-cli config. Using base config`);
|
|
26
|
+
return baseConfig;
|
|
27
|
+
}
|
|
28
|
+
// Find angular project target
|
|
29
|
+
let project;
|
|
30
|
+
let target;
|
|
31
|
+
let confName;
|
|
32
|
+
try {
|
|
33
|
+
// Default behavior when `angularBrowserTarget` are not explicitly defined to null
|
|
34
|
+
if (options.angularBrowserTarget !== null) {
|
|
35
|
+
const browserTarget = options.angularBrowserTarget
|
|
36
|
+
? (0, architect_1.targetFromTargetString)(options.angularBrowserTarget)
|
|
37
|
+
: {
|
|
38
|
+
configuration: undefined,
|
|
39
|
+
project: (0, angular_read_workspace_1.getDefaultProjectName)(workspaceConfig),
|
|
40
|
+
target: 'build',
|
|
41
|
+
};
|
|
42
|
+
const fondProject = (0, angular_read_workspace_1.findAngularProjectTarget)(workspaceConfig, browserTarget.project, browserTarget.target);
|
|
43
|
+
project = fondProject.project;
|
|
44
|
+
target = fondProject.target;
|
|
45
|
+
confName = browserTarget.configuration;
|
|
46
|
+
node_logger_1.logger.info(`=> Using angular project "${browserTarget.project}:${browserTarget.target}${confName ? `:${confName}` : ''}" for configuring Storybook`);
|
|
47
|
+
}
|
|
48
|
+
// Start storybook when only tsConfig is provided.
|
|
49
|
+
if (options.angularBrowserTarget === null && options.tsConfig) {
|
|
50
|
+
node_logger_1.logger.info(`=> Using default angular project with "tsConfig:${options.tsConfig}"`);
|
|
51
|
+
project = { root: '', extensions: {}, targets: undefined };
|
|
52
|
+
target = { builder: '', options: { tsConfig: options.tsConfig } };
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
catch (error) {
|
|
56
|
+
node_logger_1.logger.error(`=> Could not find angular project: ${error.message}`);
|
|
57
|
+
node_logger_1.logger.info(`=> Fail to load angular-cli config. Using base config`);
|
|
58
|
+
return baseConfig;
|
|
59
|
+
}
|
|
60
|
+
// Use angular-cli to get some webpack config
|
|
61
|
+
let angularCliWebpackConfig;
|
|
62
|
+
try {
|
|
63
|
+
angularCliWebpackConfig = await (0, angular_devkit_build_webpack_1.extractAngularCliWebpackConfig)(dirToSearch, project, target, confName);
|
|
64
|
+
node_logger_1.logger.info(`=> Using angular-cli webpack config`);
|
|
65
|
+
}
|
|
66
|
+
catch (error) {
|
|
67
|
+
node_logger_1.logger.error(`=> Could not get angular cli webpack config`);
|
|
68
|
+
throw error;
|
|
69
|
+
}
|
|
70
|
+
return mergeAngularCliWebpackConfig(angularCliWebpackConfig, baseConfig);
|
|
71
|
+
}
|
|
72
|
+
exports.getWebpackConfig = getWebpackConfig;
|
|
73
|
+
function mergeAngularCliWebpackConfig({ cliCommonWebpackConfig, cliStyleWebpackConfig, tsConfigPath }, baseConfig) {
|
|
74
|
+
// Don't use storybooks styling rules because we have to use rules created by @angular-devkit/build-angular
|
|
75
|
+
// because @angular-devkit/build-angular created rules have include/exclude for global style files.
|
|
76
|
+
const rulesExcludingStyles = (0, filter_out_styling_rules_1.filterOutStylingRules)(baseConfig);
|
|
77
|
+
// styleWebpackConfig.entry adds global style files to the webpack context
|
|
78
|
+
const entry = [
|
|
79
|
+
...baseConfig.entry,
|
|
80
|
+
// @ts-ignore
|
|
81
|
+
...Object.values(cliStyleWebpackConfig.entry).reduce((acc, item) => acc.concat(item), []),
|
|
82
|
+
];
|
|
83
|
+
const module = {
|
|
84
|
+
...baseConfig.module,
|
|
85
|
+
rules: [...cliStyleWebpackConfig.module.rules, ...rulesExcludingStyles],
|
|
86
|
+
};
|
|
87
|
+
// We use cliCommonConfig plugins to serve static assets files.
|
|
88
|
+
const plugins = [
|
|
89
|
+
...cliStyleWebpackConfig.plugins,
|
|
90
|
+
...cliCommonWebpackConfig.plugins,
|
|
91
|
+
...baseConfig.plugins,
|
|
92
|
+
];
|
|
93
|
+
const resolve = {
|
|
94
|
+
...baseConfig.resolve,
|
|
95
|
+
modules: Array.from(new Set([...baseConfig.resolve.modules, ...cliCommonWebpackConfig.resolve.modules])),
|
|
96
|
+
plugins: [
|
|
97
|
+
new tsconfig_paths_webpack_plugin_1.default({
|
|
98
|
+
configFile: tsConfigPath,
|
|
99
|
+
mainFields: ['browser', 'module', 'main'],
|
|
100
|
+
}),
|
|
101
|
+
],
|
|
102
|
+
};
|
|
103
|
+
return {
|
|
104
|
+
...baseConfig,
|
|
105
|
+
entry,
|
|
106
|
+
module,
|
|
107
|
+
plugins,
|
|
108
|
+
resolve,
|
|
109
|
+
resolveLoader: cliCommonWebpackConfig.resolveLoader,
|
|
110
|
+
};
|
|
111
|
+
}
|
|
@@ -4,22 +4,22 @@
|
|
|
4
4
|
*
|
|
5
5
|
* It uses code block of angular cli to extract parts of webpack configuration
|
|
6
6
|
*/
|
|
7
|
-
import
|
|
7
|
+
import { Configuration } from 'webpack';
|
|
8
8
|
import { workspaces } from '@angular-devkit/core';
|
|
9
9
|
export declare type AngularCliWebpackConfig = {
|
|
10
10
|
cliCommonWebpackConfig: {
|
|
11
|
-
plugins:
|
|
11
|
+
plugins: Configuration['plugins'];
|
|
12
12
|
resolve: {
|
|
13
13
|
modules: string[];
|
|
14
14
|
};
|
|
15
|
-
resolveLoader:
|
|
15
|
+
resolveLoader: Configuration['resolveLoader'];
|
|
16
16
|
};
|
|
17
17
|
cliStyleWebpackConfig: {
|
|
18
|
-
entry:
|
|
18
|
+
entry: Configuration['entry'];
|
|
19
19
|
module: {
|
|
20
|
-
rules:
|
|
20
|
+
rules: Configuration['module']['rules'];
|
|
21
21
|
};
|
|
22
|
-
plugins:
|
|
22
|
+
plugins: Configuration['plugins'];
|
|
23
23
|
};
|
|
24
24
|
tsConfigPath: string;
|
|
25
25
|
};
|
|
@@ -7,7 +7,11 @@
|
|
|
7
7
|
*/
|
|
8
8
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
9
9
|
if (k2 === undefined) k2 = k;
|
|
10
|
-
Object.
|
|
10
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
11
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
12
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
13
|
+
}
|
|
14
|
+
Object.defineProperty(o, k2, desc);
|
|
11
15
|
}) : (function(o, m, k, k2) {
|
|
12
16
|
if (k2 === undefined) k2 = k;
|
|
13
17
|
o[k2] = m[k];
|
|
@@ -20,19 +24,10 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
20
24
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
21
25
|
if (mod && mod.__esModule) return mod;
|
|
22
26
|
var result = {};
|
|
23
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
27
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
24
28
|
__setModuleDefault(result, mod);
|
|
25
29
|
return result;
|
|
26
30
|
};
|
|
27
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
28
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
29
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
30
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
31
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
32
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
33
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
34
|
-
});
|
|
35
|
-
};
|
|
36
31
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
32
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
33
|
};
|
|
@@ -47,12 +42,12 @@ const normalize_optimization_1 = require("./utils/normalize-optimization");
|
|
|
47
42
|
const importAngularCliWebpackConfigGenerator = () => {
|
|
48
43
|
let angularWebpackConfig;
|
|
49
44
|
// First we look for webpack config according to directory structure of Angular 11
|
|
50
|
-
if (module_is_available_1.moduleIsAvailable('@angular-devkit/build-angular/src/webpack/configs')) {
|
|
45
|
+
if ((0, module_is_available_1.moduleIsAvailable)('@angular-devkit/build-angular/src/webpack/configs')) {
|
|
51
46
|
// eslint-disable-next-line global-require
|
|
52
47
|
angularWebpackConfig = require('@angular-devkit/build-angular/src/webpack/configs');
|
|
53
48
|
}
|
|
54
49
|
// We fallback on directory structure of Angular 10 (and below)
|
|
55
|
-
else if (module_is_available_1.moduleIsAvailable('@angular-devkit/build-angular/src/angular-cli-files/models/webpack-configs')) {
|
|
50
|
+
else if ((0, module_is_available_1.moduleIsAvailable)('@angular-devkit/build-angular/src/angular-cli-files/models/webpack-configs')) {
|
|
56
51
|
// eslint-disable-next-line global-require
|
|
57
52
|
angularWebpackConfig = require('@angular-devkit/build-angular/src/angular-cli-files/models/webpack-configs');
|
|
58
53
|
}
|
|
@@ -66,18 +61,18 @@ const importAngularCliWebpackConfigGenerator = () => {
|
|
|
66
61
|
};
|
|
67
62
|
const importAngularCliReadTsconfigUtil = () => {
|
|
68
63
|
// First we look for webpack config according to directory structure of Angular 11
|
|
69
|
-
if (module_is_available_1.moduleIsAvailable('@angular-devkit/build-angular/src/utils/read-tsconfig')) {
|
|
64
|
+
if ((0, module_is_available_1.moduleIsAvailable)('@angular-devkit/build-angular/src/utils/read-tsconfig')) {
|
|
70
65
|
// eslint-disable-next-line global-require
|
|
71
66
|
return require('@angular-devkit/build-angular/src/utils/read-tsconfig');
|
|
72
67
|
}
|
|
73
68
|
// We fallback on directory structure of Angular 10 (and below)
|
|
74
|
-
if (module_is_available_1.moduleIsAvailable('@angular-devkit/build-angular/src/angular-cli-files/utilities/read-tsconfig')) {
|
|
69
|
+
if ((0, module_is_available_1.moduleIsAvailable)('@angular-devkit/build-angular/src/angular-cli-files/utilities/read-tsconfig')) {
|
|
75
70
|
// eslint-disable-next-line global-require
|
|
76
71
|
return require('@angular-devkit/build-angular/src/angular-cli-files/utilities/read-tsconfig');
|
|
77
72
|
}
|
|
78
73
|
throw new Error('ReadTsconfig not found in "@angular-devkit/build-angular"');
|
|
79
74
|
};
|
|
80
|
-
const buildWebpackConfigOptions = (dirToSearch, project, target, confName) =>
|
|
75
|
+
const buildWebpackConfigOptions = async (dirToSearch, project, target, confName) => {
|
|
81
76
|
let conf = {};
|
|
82
77
|
if (confName) {
|
|
83
78
|
if (!target.configurations) {
|
|
@@ -88,65 +83,82 @@ const buildWebpackConfigOptions = (dirToSearch, project, target, confName) => __
|
|
|
88
83
|
}
|
|
89
84
|
conf = target.configurations[confName];
|
|
90
85
|
}
|
|
91
|
-
const projectBuildOptions =
|
|
86
|
+
const projectBuildOptions = { ...target.options, ...conf };
|
|
92
87
|
const requiredOptions = ['tsConfig'];
|
|
93
88
|
if (!requiredOptions.every((key) => !!projectBuildOptions[key])) {
|
|
94
89
|
throw new Error(`Missing required options in project target. Check "${requiredOptions.join(', ')}"`);
|
|
95
90
|
}
|
|
96
|
-
const workspaceRootNormalized = core_1.normalize(dirToSearch);
|
|
97
|
-
const projectRootNormalized = core_1.resolve(workspaceRootNormalized, core_1.normalize(project.root || ''));
|
|
91
|
+
const workspaceRootNormalized = (0, core_1.normalize)(dirToSearch);
|
|
92
|
+
const projectRootNormalized = (0, core_1.resolve)(workspaceRootNormalized, (0, core_1.normalize)(project.root || ''));
|
|
98
93
|
const sourceRootNormalized = project.sourceRoot
|
|
99
|
-
? core_1.resolve(workspaceRootNormalized, core_1.normalize(project.sourceRoot))
|
|
94
|
+
? (0, core_1.resolve)(workspaceRootNormalized, (0, core_1.normalize)(project.sourceRoot))
|
|
100
95
|
: undefined;
|
|
101
|
-
const tsConfigPath = path_1.default.resolve(core_1.getSystemPath(workspaceRootNormalized), projectBuildOptions.tsConfig);
|
|
102
|
-
const tsConfig = importAngularCliReadTsconfigUtil().readTsconfig(tsConfigPath);
|
|
103
|
-
const ts =
|
|
96
|
+
const tsConfigPath = path_1.default.resolve((0, core_1.getSystemPath)(workspaceRootNormalized), projectBuildOptions.tsConfig);
|
|
97
|
+
const tsConfig = await importAngularCliReadTsconfigUtil().readTsconfig(tsConfigPath);
|
|
98
|
+
const ts = await Promise.resolve().then(() => __importStar(require('typescript')));
|
|
104
99
|
const scriptTarget = tsConfig.options.target || ts.ScriptTarget.ES5;
|
|
105
|
-
const buildOptions =
|
|
100
|
+
const buildOptions = {
|
|
106
101
|
// Default options
|
|
107
|
-
budgets: [],
|
|
102
|
+
budgets: [],
|
|
103
|
+
fileReplacements: [],
|
|
104
|
+
main: '',
|
|
105
|
+
outputPath: 'dist/storybook-angular',
|
|
106
|
+
scripts: [],
|
|
107
|
+
sourceMap: {},
|
|
108
|
+
styles: [],
|
|
109
|
+
// Deleted in angular 12. Keep for compatibility with versions lower than angular 12
|
|
110
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
111
|
+
// @ts-ignore
|
|
112
|
+
lazyModules: [],
|
|
113
|
+
// Project Options
|
|
114
|
+
...projectBuildOptions,
|
|
115
|
+
assets: (0, normalize_asset_patterns_1.normalizeAssetPatterns)(projectBuildOptions.assets || [], workspaceRootNormalized, projectRootNormalized, sourceRootNormalized),
|
|
116
|
+
optimization: (0, normalize_optimization_1.normalizeOptimization)(projectBuildOptions.optimization),
|
|
108
117
|
// Forced options
|
|
109
|
-
statsJson: false,
|
|
118
|
+
statsJson: false,
|
|
119
|
+
// Deleted in angular 12. Keep for compatibility with versions lower than angular 12
|
|
120
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
121
|
+
// @ts-ignore
|
|
122
|
+
forkTypeChecker: false,
|
|
123
|
+
};
|
|
110
124
|
return {
|
|
111
|
-
|
|
125
|
+
projectName: 'this-is-just-a-fake-name-for-getting-rid-of-the-error',
|
|
126
|
+
root: (0, core_1.getSystemPath)(workspaceRootNormalized),
|
|
112
127
|
// The dependency of `@angular-devkit/build-angular` to `@angular-devkit/core` is not exactly the same version as the one for storybook (node modules of node modules ^^)
|
|
113
|
-
logger: node_1.createConsoleLogger(),
|
|
114
|
-
projectRoot: core_1.getSystemPath(projectRootNormalized),
|
|
115
|
-
sourceRoot: sourceRootNormalized ? core_1.getSystemPath(sourceRootNormalized) : undefined,
|
|
128
|
+
logger: (0, node_1.createConsoleLogger)(),
|
|
129
|
+
projectRoot: (0, core_1.getSystemPath)(projectRootNormalized),
|
|
130
|
+
sourceRoot: sourceRootNormalized ? (0, core_1.getSystemPath)(sourceRootNormalized) : undefined,
|
|
116
131
|
buildOptions,
|
|
117
132
|
tsConfig,
|
|
118
133
|
tsConfigPath,
|
|
119
134
|
scriptTarget,
|
|
120
135
|
};
|
|
121
|
-
}
|
|
136
|
+
};
|
|
122
137
|
/**
|
|
123
138
|
* Uses angular cli to extract webpack configuration.
|
|
124
139
|
* The `AngularCliWebpackConfig` type lists the parts used by storybook
|
|
125
140
|
*/
|
|
126
|
-
function extractAngularCliWebpackConfig(dirToSearch, project, target, confName) {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
resolve: {
|
|
137
|
-
modules: (_a = cliCommonConfig.resolve) === null || _a === void 0 ? void 0 : _a.modules,
|
|
138
|
-
},
|
|
139
|
-
resolveLoader: cliCommonConfig.resolveLoader,
|
|
141
|
+
async function extractAngularCliWebpackConfig(dirToSearch, project, target, confName) {
|
|
142
|
+
const { getCommonConfig, getStylesConfig } = importAngularCliWebpackConfigGenerator();
|
|
143
|
+
const webpackConfigOptions = await buildWebpackConfigOptions(dirToSearch, project, target, confName);
|
|
144
|
+
const cliCommonConfig = getCommonConfig(webpackConfigOptions);
|
|
145
|
+
const cliStyleConfig = getStylesConfig(webpackConfigOptions);
|
|
146
|
+
return {
|
|
147
|
+
cliCommonWebpackConfig: {
|
|
148
|
+
plugins: cliCommonConfig.plugins,
|
|
149
|
+
resolve: {
|
|
150
|
+
modules: cliCommonConfig.resolve?.modules,
|
|
140
151
|
},
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
152
|
+
resolveLoader: cliCommonConfig.resolveLoader,
|
|
153
|
+
},
|
|
154
|
+
cliStyleWebpackConfig: {
|
|
155
|
+
entry: cliStyleConfig.entry,
|
|
156
|
+
module: {
|
|
157
|
+
rules: [...cliStyleConfig.module.rules],
|
|
147
158
|
},
|
|
148
|
-
|
|
149
|
-
}
|
|
150
|
-
|
|
159
|
+
plugins: cliStyleConfig.plugins,
|
|
160
|
+
},
|
|
161
|
+
tsConfigPath: webpackConfigOptions.tsConfigPath,
|
|
162
|
+
};
|
|
151
163
|
}
|
|
152
164
|
exports.extractAngularCliWebpackConfig = extractAngularCliWebpackConfig;
|
|
File without changes
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.findAngularProjectTarget = exports.getDefaultProjectName = exports.readAngularWorkspaceConfig = void 0;
|
|
13
4
|
const node_1 = require("@angular-devkit/core/node");
|
|
@@ -18,7 +9,7 @@ const core_1 = require("@angular-devkit/core");
|
|
|
18
9
|
* - Either from NX if it is present
|
|
19
10
|
* - Either from `@angular-devkit/core` -> https://github.com/angular/angular-cli/tree/master/packages/angular_devkit/core
|
|
20
11
|
*/
|
|
21
|
-
|
|
12
|
+
const readAngularWorkspaceConfig = async (dirToSearch) => {
|
|
22
13
|
const host = core_1.workspaces.createWorkspaceHost(new node_1.NodeJsSyncHost());
|
|
23
14
|
try {
|
|
24
15
|
/**
|
|
@@ -49,9 +40,10 @@ exports.readAngularWorkspaceConfig = (dirToSearch) => __awaiter(void 0, void 0,
|
|
|
49
40
|
catch (e) {
|
|
50
41
|
// Ignore if the client does not use NX
|
|
51
42
|
}
|
|
52
|
-
return (
|
|
53
|
-
}
|
|
54
|
-
exports.
|
|
43
|
+
return (await core_1.workspaces.readWorkspace(dirToSearch, host)).workspace;
|
|
44
|
+
};
|
|
45
|
+
exports.readAngularWorkspaceConfig = readAngularWorkspaceConfig;
|
|
46
|
+
const getDefaultProjectName = (workspace) => {
|
|
55
47
|
const environmentProjectName = process.env.STORYBOOK_ANGULAR_PROJECT;
|
|
56
48
|
if (environmentProjectName) {
|
|
57
49
|
return environmentProjectName;
|
|
@@ -68,7 +60,8 @@ exports.getDefaultProjectName = (workspace) => {
|
|
|
68
60
|
}
|
|
69
61
|
throw new Error('No angular projects found');
|
|
70
62
|
};
|
|
71
|
-
exports.
|
|
63
|
+
exports.getDefaultProjectName = getDefaultProjectName;
|
|
64
|
+
const findAngularProjectTarget = (workspace, projectName, targetName) => {
|
|
72
65
|
if (!workspace.projects || !Object.keys(workspace.projects).length) {
|
|
73
66
|
throw new Error('No angular projects found');
|
|
74
67
|
}
|
|
@@ -82,3 +75,4 @@ exports.findAngularProjectTarget = (workspace, projectName, targetName) => {
|
|
|
82
75
|
const target = project.targets.get(targetName);
|
|
83
76
|
return { project, target };
|
|
84
77
|
};
|
|
78
|
+
exports.findAngularProjectTarget = findAngularProjectTarget;
|
|
File without changes
|
|
@@ -9,7 +9,7 @@ const node_logger_1 = require("@storybook/node-logger");
|
|
|
9
9
|
function default_1(tsLoaderOptions) {
|
|
10
10
|
if (tsLoaderOptions && tsLoaderOptions.configFile) {
|
|
11
11
|
return new fork_ts_checker_webpack_plugin_1.default({
|
|
12
|
-
|
|
12
|
+
typescript: { configFile: tsLoaderOptions.configFile },
|
|
13
13
|
async: true,
|
|
14
14
|
});
|
|
15
15
|
}
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.webpackFinal = void 0;
|
|
30
|
+
const node_logger_1 = require("@storybook/node-logger");
|
|
31
|
+
const architect_1 = require("@angular-devkit/architect");
|
|
32
|
+
const find_up_1 = require("find-up");
|
|
33
|
+
const semver_1 = __importDefault(require("@storybook/semver"));
|
|
34
|
+
const ts_dedent_1 = __importDefault(require("ts-dedent"));
|
|
35
|
+
const core_1 = require("@angular-devkit/core");
|
|
36
|
+
const module_is_available_1 = require("./utils/module-is-available");
|
|
37
|
+
const angular_cli_webpack_12_2_x_1 = require("./angular-cli-webpack-12.2.x");
|
|
38
|
+
const angular_cli_webpack_13_x_x_1 = require("./angular-cli-webpack-13.x.x");
|
|
39
|
+
const angular_cli_webpack_older_1 = require("./angular-cli-webpack-older");
|
|
40
|
+
const angular_read_workspace_1 = require("./angular-read-workspace");
|
|
41
|
+
async function webpackFinal(baseConfig, options) {
|
|
42
|
+
if (!(0, module_is_available_1.moduleIsAvailable)('@angular-devkit/build-angular')) {
|
|
43
|
+
node_logger_1.logger.info('=> Using base config because "@angular-devkit/build-angular" is not installed');
|
|
44
|
+
return baseConfig;
|
|
45
|
+
}
|
|
46
|
+
const angularCliVersion = await Promise.resolve().then(() => __importStar(require('@angular/cli'))).then((m) => semver_1.default.coerce(m.VERSION.full));
|
|
47
|
+
/**
|
|
48
|
+
* Ordered array to use the specific getWebpackConfig according to some condition like angular-cli version
|
|
49
|
+
*/
|
|
50
|
+
const webpackGetterByVersions = [
|
|
51
|
+
{
|
|
52
|
+
info: '=> Loading angular-cli config for angular >= 13.0.0',
|
|
53
|
+
condition: semver_1.default.satisfies(angularCliVersion, '>=13.0.0'),
|
|
54
|
+
getWebpackConfig: async (_baseConfig, _options) => {
|
|
55
|
+
const builderContext = getBuilderContext(_options);
|
|
56
|
+
const builderOptions = await getBuilderOptions(_options, builderContext);
|
|
57
|
+
const legacyDefaultOptions = await getLegacyDefaultBuildOptions(_options);
|
|
58
|
+
return (0, angular_cli_webpack_13_x_x_1.getWebpackConfig)(_baseConfig, {
|
|
59
|
+
builderOptions: {
|
|
60
|
+
watch: options.configType === 'DEVELOPMENT',
|
|
61
|
+
...legacyDefaultOptions,
|
|
62
|
+
...builderOptions,
|
|
63
|
+
},
|
|
64
|
+
builderContext,
|
|
65
|
+
});
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
info: '=> Loading angular-cli config for angular 12.2.x',
|
|
70
|
+
condition: semver_1.default.satisfies(angularCliVersion, '12.2.x') && options.angularBuilderContext,
|
|
71
|
+
getWebpackConfig: async (_baseConfig, _options) => {
|
|
72
|
+
const builderContext = getBuilderContext(_options);
|
|
73
|
+
const builderOptions = await getBuilderOptions(_options, builderContext);
|
|
74
|
+
return (0, angular_cli_webpack_12_2_x_1.getWebpackConfig)(_baseConfig, {
|
|
75
|
+
builderOptions,
|
|
76
|
+
builderContext,
|
|
77
|
+
});
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
info: '=> Loading angular-cli config for angular lower than 12.2.0',
|
|
82
|
+
condition: true,
|
|
83
|
+
getWebpackConfig: angular_cli_webpack_older_1.getWebpackConfig,
|
|
84
|
+
},
|
|
85
|
+
];
|
|
86
|
+
const webpackGetter = webpackGetterByVersions.find((wg) => wg.condition);
|
|
87
|
+
node_logger_1.logger.info(webpackGetter.info);
|
|
88
|
+
return Promise.resolve(webpackGetter.getWebpackConfig(baseConfig, options));
|
|
89
|
+
}
|
|
90
|
+
exports.webpackFinal = webpackFinal;
|
|
91
|
+
/**
|
|
92
|
+
* Get Builder Context
|
|
93
|
+
* If storybook is not start by angular builder create dumb BuilderContext
|
|
94
|
+
*/
|
|
95
|
+
function getBuilderContext(options) {
|
|
96
|
+
return (options.angularBuilderContext ??
|
|
97
|
+
{
|
|
98
|
+
target: { project: 'noop-project', builder: '', options: {} },
|
|
99
|
+
workspaceRoot: process.cwd(),
|
|
100
|
+
getProjectMetadata: () => ({}),
|
|
101
|
+
getTargetOptions: () => ({}),
|
|
102
|
+
logger: new core_1.logging.Logger('Storybook'),
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Get builder options
|
|
107
|
+
* Merge target options from browser target and from storybook options
|
|
108
|
+
*/
|
|
109
|
+
async function getBuilderOptions(options, builderContext) {
|
|
110
|
+
/**
|
|
111
|
+
* Get Browser Target options
|
|
112
|
+
*/
|
|
113
|
+
let browserTargetOptions = {};
|
|
114
|
+
if (options.angularBrowserTarget) {
|
|
115
|
+
const browserTarget = (0, architect_1.targetFromTargetString)(options.angularBrowserTarget);
|
|
116
|
+
node_logger_1.logger.info(`=> Using angular browser target options from "${browserTarget.project}:${browserTarget.target}${browserTarget.configuration ? `:${browserTarget.configuration}` : ''}"`);
|
|
117
|
+
browserTargetOptions = await builderContext.getTargetOptions(browserTarget);
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Merge target options from browser target options and from storybook options
|
|
121
|
+
*/
|
|
122
|
+
const builderOptions = {
|
|
123
|
+
...browserTargetOptions,
|
|
124
|
+
...options.angularBuilderOptions,
|
|
125
|
+
tsConfig: options.tsConfig ??
|
|
126
|
+
(0, find_up_1.sync)('tsconfig.json', { cwd: options.configDir }) ??
|
|
127
|
+
browserTargetOptions.tsConfig,
|
|
128
|
+
};
|
|
129
|
+
node_logger_1.logger.info(`=> Using angular project with "tsConfig:${builderOptions.tsConfig}"`);
|
|
130
|
+
return builderOptions;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Get options from legacy way
|
|
134
|
+
* /!\ This is only for backward compatibility and would be removed on Storybook 7.0
|
|
135
|
+
* only work for angular.json with [defaultProject].build or "storybook.build" config
|
|
136
|
+
*/
|
|
137
|
+
async function getLegacyDefaultBuildOptions(options) {
|
|
138
|
+
if (options.angularBrowserTarget !== undefined) {
|
|
139
|
+
// Not use legacy way with builder (`angularBrowserTarget` is defined or null with builder and undefined without)
|
|
140
|
+
return {};
|
|
141
|
+
}
|
|
142
|
+
node_logger_1.logger.warn((0, ts_dedent_1.default) `Your Storybook startup uses a solution that will not be supported in version 7.0.
|
|
143
|
+
You must use angular builder to have an explicit configuration on the project used in angular.json
|
|
144
|
+
Read more at:
|
|
145
|
+
- https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#sb-angular-builder)
|
|
146
|
+
- https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#angular13)
|
|
147
|
+
`);
|
|
148
|
+
const dirToSearch = process.cwd();
|
|
149
|
+
// Read angular workspace
|
|
150
|
+
let workspaceConfig;
|
|
151
|
+
try {
|
|
152
|
+
workspaceConfig = await (0, angular_read_workspace_1.readAngularWorkspaceConfig)(dirToSearch);
|
|
153
|
+
}
|
|
154
|
+
catch (error) {
|
|
155
|
+
node_logger_1.logger.error(`=> Could not find angular workspace config (angular.json) on this path "${dirToSearch}"`);
|
|
156
|
+
node_logger_1.logger.info(`=> Fail to load angular-cli config. Using base config`);
|
|
157
|
+
return {};
|
|
158
|
+
}
|
|
159
|
+
// Find angular project target
|
|
160
|
+
try {
|
|
161
|
+
const browserTarget = {
|
|
162
|
+
configuration: undefined,
|
|
163
|
+
project: (0, angular_read_workspace_1.getDefaultProjectName)(workspaceConfig),
|
|
164
|
+
target: 'build',
|
|
165
|
+
};
|
|
166
|
+
const { target } = (0, angular_read_workspace_1.findAngularProjectTarget)(workspaceConfig, browserTarget.project, browserTarget.target);
|
|
167
|
+
node_logger_1.logger.info(`=> Using angular project "${browserTarget.project}:${browserTarget.target}" for configuring Storybook`);
|
|
168
|
+
return { ...target.options };
|
|
169
|
+
}
|
|
170
|
+
catch (error) {
|
|
171
|
+
node_logger_1.logger.error(`=> Could not find angular project: ${error.message}`);
|
|
172
|
+
node_logger_1.logger.info(`=> Fail to load angular-cli config. Using base config`);
|
|
173
|
+
return {};
|
|
174
|
+
}
|
|
175
|
+
}
|