@storybook/angular 7.0.0-alpha.4 → 7.0.0-alpha.41
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 +1 -1
- package/dist/types/builders/utils/build-standalone-errors-handler.js +3 -6
- package/dist/types/builders/utils/run-compodoc.js +0 -1
- package/dist/types/client/{preview/angular/components → angular}/app.component.d.ts +1 -1
- package/dist/types/client/{preview/angular/components → angular}/app.component.js +1 -1
- package/dist/types/client/{preview/angular → angular}/app.token.d.ts +0 -0
- package/dist/types/client/{preview/angular → angular}/app.token.js +0 -0
- package/dist/types/client/{preview/angular → angular}/helpers.d.ts +1 -1
- package/dist/types/client/{preview/angular → angular}/helpers.js +2 -3
- package/dist/types/client/{preview/angular-beta → angular-beta}/AbstractRenderer.d.ts +1 -2
- package/dist/types/client/{preview/angular-beta → angular-beta}/AbstractRenderer.js +0 -0
- package/dist/types/client/{preview/angular-beta → angular-beta}/CanvasRenderer.d.ts +1 -2
- package/dist/types/client/{preview/angular-beta → angular-beta}/CanvasRenderer.js +0 -0
- package/dist/types/client/{preview/angular-beta → angular-beta}/ComputesTemplateFromComponent.d.ts +0 -0
- package/dist/types/client/{preview/angular-beta → angular-beta}/ComputesTemplateFromComponent.js +0 -0
- package/dist/types/client/{preview/angular-beta → angular-beta}/DocsRenderer.d.ts +1 -2
- package/dist/types/client/{preview/angular-beta → angular-beta}/DocsRenderer.js +0 -0
- package/dist/types/client/{preview/angular-beta → angular-beta}/RendererFactory.d.ts +0 -0
- package/dist/types/client/{preview/angular-beta → angular-beta}/RendererFactory.js +3 -3
- package/dist/types/client/{preview/angular-beta → angular-beta}/StorybookModule.d.ts +1 -1
- package/dist/types/client/{preview/angular-beta → angular-beta}/StorybookModule.js +3 -30
- package/dist/types/client/{preview/angular-beta → angular-beta}/StorybookProvider.d.ts +0 -0
- package/dist/types/client/{preview/angular-beta → angular-beta}/StorybookProvider.js +0 -0
- package/dist/types/client/{preview/angular-beta → angular-beta}/StorybookWrapperComponent.d.ts +0 -0
- package/dist/types/client/{preview/angular-beta → angular-beta}/StorybookWrapperComponent.js +0 -0
- package/dist/types/client/{preview/angular-beta → angular-beta}/utils/NgComponentAnalyzer.d.ts +0 -0
- package/dist/types/client/{preview/angular-beta → angular-beta}/utils/NgComponentAnalyzer.js +0 -0
- package/dist/types/client/{preview/angular-beta → angular-beta}/utils/NgModulesAnalyzer.d.ts +0 -0
- package/dist/types/client/{preview/angular-beta → angular-beta}/utils/NgModulesAnalyzer.js +0 -0
- package/dist/types/client/{preview/config.d.ts → config.d.ts} +2 -2
- package/dist/types/client/{preview/config.js → config.js} +2 -2
- package/dist/types/client/{preview/decorateStory.d.ts → decorateStory.d.ts} +1 -1
- package/dist/types/client/{preview/decorateStory.js → decorateStory.js} +1 -1
- package/dist/types/client/{preview/decorators.d.ts → decorators.d.ts} +1 -2
- package/dist/types/client/{preview/decorators.js → decorators.js} +0 -0
- package/dist/types/client/docs/compodoc.js +2 -3
- package/dist/types/client/docs/config.d.ts +3 -3
- package/dist/types/client/docs/sourceDecorator.d.ts +2 -2
- package/dist/types/client/{preview/angular-polyfills.d.ts → globals.d.ts} +0 -10
- package/dist/types/client/{preview/angular-polyfills.js → globals.js} +7 -1
- package/dist/types/client/index.d.ts +5 -4
- package/dist/types/client/index.js +6 -12
- package/dist/types/client/{preview/index.d.ts → public-api.d.ts} +2 -12
- package/dist/types/client/public-api.js +36 -0
- package/dist/types/client/{preview/types-6-0.d.ts → public-types.d.ts} +4 -19
- package/dist/types/client/{preview/types-6-0.js → public-types.js} +0 -0
- package/dist/types/client/{preview/render.d.ts → render.d.ts} +1 -1
- package/dist/types/client/{preview/render.js → render.js} +0 -0
- package/dist/types/client/{preview/types.d.ts → types.d.ts} +13 -8
- package/dist/types/client/{preview/types.js → types.js} +0 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.js +1 -1
- package/dist/types/preset.d.ts +4 -11
- package/dist/types/preset.js +12 -9
- package/dist/types/renderer.d.ts +4 -4
- package/dist/types/renderer.js +4 -4
- package/dist/types/server/__mocks-ng-workspace__/minimal-config/tsconfig.json +1 -4
- package/dist/types/server/__mocks-ng-workspace__/some-config/tsconfig.json +1 -4
- package/dist/types/server/__mocks-ng-workspace__/with-angularBrowserTarget/tsconfig.json +1 -4
- package/dist/types/server/__mocks-ng-workspace__/with-lib/projects/pattern-lib/tsconfig.lib.json +2 -8
- package/dist/types/server/__mocks-ng-workspace__/with-lib/tsconfig.json +1 -4
- package/dist/types/server/__mocks-ng-workspace__/with-nx/tsconfig.json +2 -7
- package/dist/types/server/__mocks-ng-workspace__/with-nx-workspace/tsconfig.json +2 -7
- package/dist/types/server/__mocks-ng-workspace__/with-options-styles/tsconfig.json +1 -4
- package/dist/types/server/__mocks-ng-workspace__/without-projects-entry/projects/pattern-lib/tsconfig.lib.json +2 -8
- package/dist/types/server/__mocks-ng-workspace__/without-projects-entry/tsconfig.json +1 -4
- package/dist/types/server/__mocks-ng-workspace__/without-tsConfig/tsconfig.json +1 -4
- package/dist/types/server/framework-preset-angular-cli.js +3 -22
- package/dist/types/server/framework-preset-angular-ivy.js +3 -1
- package/dist/types/types.d.ts +25 -9
- package/package.json +35 -42
- package/LICENSE +0 -21
- package/dist/types/client/preview/globals.d.ts +0 -1
- package/dist/types/client/preview/globals.js +0 -9
- package/dist/types/client/preview/index.js +0 -29
- package/dist/types/client/preview/types-7-0.d.ts +0 -9
- package/dist/types/client/preview/types-7-0.js +0 -2
- package/dist/types/server/angular-cli-webpack-12.2.x.d.ts +0 -1
- package/dist/types/server/angular-cli-webpack-12.2.x.js +0 -66
- package/dist/types/server/angular-cli-webpack-older.d.ts +0 -6
- package/dist/types/server/angular-cli-webpack-older.js +0 -111
- package/dist/types/server/angular-devkit-build-webpack.d.ts +0 -30
- package/dist/types/server/angular-devkit-build-webpack.js +0 -164
- package/dist/types/server/create-fork-ts-checker-plugin.d.ts +0 -3
- package/dist/types/server/create-fork-ts-checker-plugin.js +0 -19
- package/dist/types/server/framework-preset-angular.d.ts +0 -5
- package/dist/types/server/framework-preset-angular.js +0 -103
- package/dist/types/server/ngx-template-loader/index.d.ts +0 -1
- package/dist/types/server/ngx-template-loader/index.js +0 -46
- package/dist/types/server/ts_config.d.ts +0 -2
- package/dist/types/server/ts_config.js +0 -28
- package/types-6-0.d.ts +0 -1
- package/types-7-0.d.ts +0 -1
|
@@ -1,111 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file is to be watched !
|
|
3
|
-
* The code must be compatible from @angular-devkit version 6.1.0 to the latest supported
|
|
4
|
-
*
|
|
5
|
-
* It uses code block of angular cli to extract parts of webpack configuration
|
|
6
|
-
*/
|
|
7
|
-
import { Configuration } from 'webpack';
|
|
8
|
-
import { workspaces } from '@angular-devkit/core';
|
|
9
|
-
export declare type AngularCliWebpackConfig = {
|
|
10
|
-
cliCommonWebpackConfig: {
|
|
11
|
-
plugins: Configuration['plugins'];
|
|
12
|
-
resolve: {
|
|
13
|
-
modules: string[];
|
|
14
|
-
};
|
|
15
|
-
resolveLoader: Configuration['resolveLoader'];
|
|
16
|
-
};
|
|
17
|
-
cliStyleWebpackConfig: {
|
|
18
|
-
entry: Configuration['entry'];
|
|
19
|
-
module: {
|
|
20
|
-
rules: Configuration['module']['rules'];
|
|
21
|
-
};
|
|
22
|
-
plugins: Configuration['plugins'];
|
|
23
|
-
};
|
|
24
|
-
tsConfigPath: string;
|
|
25
|
-
};
|
|
26
|
-
/**
|
|
27
|
-
* Uses angular cli to extract webpack configuration.
|
|
28
|
-
* The `AngularCliWebpackConfig` type lists the parts used by storybook
|
|
29
|
-
*/
|
|
30
|
-
export declare function extractAngularCliWebpackConfig(dirToSearch: string, project: workspaces.ProjectDefinition, target: workspaces.TargetDefinition, confName?: string): Promise<AngularCliWebpackConfig>;
|
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* This file is to be watched !
|
|
4
|
-
* The code must be compatible from @angular-devkit version 6.1.0 to the latest supported
|
|
5
|
-
*
|
|
6
|
-
* It uses code block of angular cli to extract parts of webpack configuration
|
|
7
|
-
*/
|
|
8
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
9
|
-
if (k2 === undefined) k2 = k;
|
|
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);
|
|
15
|
-
}) : (function(o, m, k, k2) {
|
|
16
|
-
if (k2 === undefined) k2 = k;
|
|
17
|
-
o[k2] = m[k];
|
|
18
|
-
}));
|
|
19
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
20
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
21
|
-
}) : function(o, v) {
|
|
22
|
-
o["default"] = v;
|
|
23
|
-
});
|
|
24
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
25
|
-
if (mod && mod.__esModule) return mod;
|
|
26
|
-
var result = {};
|
|
27
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
28
|
-
__setModuleDefault(result, mod);
|
|
29
|
-
return result;
|
|
30
|
-
};
|
|
31
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
32
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
33
|
-
};
|
|
34
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
-
exports.extractAngularCliWebpackConfig = void 0;
|
|
36
|
-
const path_1 = __importDefault(require("path"));
|
|
37
|
-
const core_1 = require("@angular-devkit/core");
|
|
38
|
-
const node_1 = require("@angular-devkit/core/node");
|
|
39
|
-
const module_is_available_1 = require("./utils/module-is-available");
|
|
40
|
-
const normalize_asset_patterns_1 = require("./utils/normalize-asset-patterns");
|
|
41
|
-
const normalize_optimization_1 = require("./utils/normalize-optimization");
|
|
42
|
-
const importAngularCliWebpackConfigGenerator = () => {
|
|
43
|
-
let angularWebpackConfig;
|
|
44
|
-
// First we look for webpack config according to directory structure of Angular 11
|
|
45
|
-
if ((0, module_is_available_1.moduleIsAvailable)('@angular-devkit/build-angular/src/webpack/configs')) {
|
|
46
|
-
// eslint-disable-next-line global-require
|
|
47
|
-
angularWebpackConfig = require('@angular-devkit/build-angular/src/webpack/configs');
|
|
48
|
-
}
|
|
49
|
-
// We fallback on directory structure of Angular 10 (and below)
|
|
50
|
-
else if ((0, module_is_available_1.moduleIsAvailable)('@angular-devkit/build-angular/src/angular-cli-files/models/webpack-configs')) {
|
|
51
|
-
// eslint-disable-next-line global-require
|
|
52
|
-
angularWebpackConfig = require('@angular-devkit/build-angular/src/angular-cli-files/models/webpack-configs');
|
|
53
|
-
}
|
|
54
|
-
else {
|
|
55
|
-
throw new Error('Webpack config not found in "@angular-devkit/build-angular"');
|
|
56
|
-
}
|
|
57
|
-
return {
|
|
58
|
-
getCommonConfig: angularWebpackConfig.getCommonConfig,
|
|
59
|
-
getStylesConfig: angularWebpackConfig.getStylesConfig,
|
|
60
|
-
};
|
|
61
|
-
};
|
|
62
|
-
const importAngularCliReadTsconfigUtil = () => {
|
|
63
|
-
// First we look for webpack config according to directory structure of Angular 11
|
|
64
|
-
if ((0, module_is_available_1.moduleIsAvailable)('@angular-devkit/build-angular/src/utils/read-tsconfig')) {
|
|
65
|
-
// eslint-disable-next-line global-require
|
|
66
|
-
return require('@angular-devkit/build-angular/src/utils/read-tsconfig');
|
|
67
|
-
}
|
|
68
|
-
// We fallback on directory structure of Angular 10 (and below)
|
|
69
|
-
if ((0, module_is_available_1.moduleIsAvailable)('@angular-devkit/build-angular/src/angular-cli-files/utilities/read-tsconfig')) {
|
|
70
|
-
// eslint-disable-next-line global-require
|
|
71
|
-
return require('@angular-devkit/build-angular/src/angular-cli-files/utilities/read-tsconfig');
|
|
72
|
-
}
|
|
73
|
-
throw new Error('ReadTsconfig not found in "@angular-devkit/build-angular"');
|
|
74
|
-
};
|
|
75
|
-
const buildWebpackConfigOptions = async (dirToSearch, project, target, confName) => {
|
|
76
|
-
let conf = {};
|
|
77
|
-
if (confName) {
|
|
78
|
-
if (!target.configurations) {
|
|
79
|
-
throw new Error('Missing "configurations" section in project target');
|
|
80
|
-
}
|
|
81
|
-
if (!target.configurations[confName]) {
|
|
82
|
-
throw new Error(`Missing required configuration in project target. Check "${confName}"`);
|
|
83
|
-
}
|
|
84
|
-
conf = target.configurations[confName];
|
|
85
|
-
}
|
|
86
|
-
const projectBuildOptions = { ...target.options, ...conf };
|
|
87
|
-
const requiredOptions = ['tsConfig'];
|
|
88
|
-
if (!requiredOptions.every((key) => !!projectBuildOptions[key])) {
|
|
89
|
-
throw new Error(`Missing required options in project target. Check "${requiredOptions.join(', ')}"`);
|
|
90
|
-
}
|
|
91
|
-
const workspaceRootNormalized = (0, core_1.normalize)(dirToSearch);
|
|
92
|
-
const projectRootNormalized = (0, core_1.resolve)(workspaceRootNormalized, (0, core_1.normalize)(project.root || ''));
|
|
93
|
-
const sourceRootNormalized = project.sourceRoot
|
|
94
|
-
? (0, core_1.resolve)(workspaceRootNormalized, (0, core_1.normalize)(project.sourceRoot))
|
|
95
|
-
: undefined;
|
|
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')));
|
|
99
|
-
const scriptTarget = tsConfig.options.target || ts.ScriptTarget.ES5;
|
|
100
|
-
const buildOptions = {
|
|
101
|
-
// Default options
|
|
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),
|
|
117
|
-
// Forced options
|
|
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
|
-
};
|
|
124
|
-
return {
|
|
125
|
-
projectName: 'this-is-just-a-fake-name-for-getting-rid-of-the-error',
|
|
126
|
-
root: (0, core_1.getSystemPath)(workspaceRootNormalized),
|
|
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 ^^)
|
|
128
|
-
logger: (0, node_1.createConsoleLogger)(),
|
|
129
|
-
projectRoot: (0, core_1.getSystemPath)(projectRootNormalized),
|
|
130
|
-
sourceRoot: sourceRootNormalized ? (0, core_1.getSystemPath)(sourceRootNormalized) : undefined,
|
|
131
|
-
buildOptions,
|
|
132
|
-
tsConfig,
|
|
133
|
-
tsConfigPath,
|
|
134
|
-
scriptTarget,
|
|
135
|
-
};
|
|
136
|
-
};
|
|
137
|
-
/**
|
|
138
|
-
* Uses angular cli to extract webpack configuration.
|
|
139
|
-
* The `AngularCliWebpackConfig` type lists the parts used by storybook
|
|
140
|
-
*/
|
|
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,
|
|
151
|
-
},
|
|
152
|
-
resolveLoader: cliCommonConfig.resolveLoader,
|
|
153
|
-
},
|
|
154
|
-
cliStyleWebpackConfig: {
|
|
155
|
-
entry: cliStyleConfig.entry,
|
|
156
|
-
module: {
|
|
157
|
-
rules: [...cliStyleConfig.module.rules],
|
|
158
|
-
},
|
|
159
|
-
plugins: cliStyleConfig.plugins,
|
|
160
|
-
},
|
|
161
|
-
tsConfigPath: webpackConfigOptions.tsConfigPath,
|
|
162
|
-
};
|
|
163
|
-
}
|
|
164
|
-
exports.extractAngularCliWebpackConfig = extractAngularCliWebpackConfig;
|
|
@@ -1,19 +0,0 @@
|
|
|
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
|
-
/* eslint-disable func-names */
|
|
7
|
-
const fork_ts_checker_webpack_plugin_1 = __importDefault(require("fork-ts-checker-webpack-plugin"));
|
|
8
|
-
const node_logger_1 = require("@storybook/node-logger");
|
|
9
|
-
function default_1(tsLoaderOptions) {
|
|
10
|
-
if (tsLoaderOptions && tsLoaderOptions.configFile) {
|
|
11
|
-
return new fork_ts_checker_webpack_plugin_1.default({
|
|
12
|
-
typescript: { configFile: tsLoaderOptions.configFile },
|
|
13
|
-
async: true,
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
node_logger_1.logger.info('=> Using default options for ForkTsCheckerWebpackPlugin');
|
|
17
|
-
return new fork_ts_checker_webpack_plugin_1.default();
|
|
18
|
-
}
|
|
19
|
-
exports.default = default_1;
|
|
@@ -1,103 +0,0 @@
|
|
|
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.webpack = void 0;
|
|
30
|
-
const path_1 = __importDefault(require("path"));
|
|
31
|
-
const semver_1 = __importDefault(require("@storybook/semver"));
|
|
32
|
-
const webpack_1 = require("webpack");
|
|
33
|
-
const autoprefixer_1 = __importDefault(require("autoprefixer"));
|
|
34
|
-
const ts_config_1 = __importDefault(require("./ts_config"));
|
|
35
|
-
const create_fork_ts_checker_plugin_1 = __importDefault(require("./create-fork-ts-checker-plugin"));
|
|
36
|
-
async function webpack(config, { configDir, angularBuilderContext }) {
|
|
37
|
-
try {
|
|
38
|
-
// Disable all this webpack stuff if we use angular-cli >= 12
|
|
39
|
-
// Angular cli is in charge of doing all the necessary for angular. If there is any additional configuration to add, it must be done in the preset angular-cli versioned.
|
|
40
|
-
const angularCliVersion = await Promise.resolve().then(() => __importStar(require('@angular/cli'))).then((m) => semver_1.default.coerce(m.VERSION.full));
|
|
41
|
-
if ((semver_1.default.satisfies(angularCliVersion, '12.2.x') && angularBuilderContext) ||
|
|
42
|
-
semver_1.default.satisfies(angularCliVersion, '>=13.0.0')) {
|
|
43
|
-
return config;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
catch (error) {
|
|
47
|
-
// do nothing, continue
|
|
48
|
-
}
|
|
49
|
-
const tsLoaderOptions = (0, ts_config_1.default)(configDir);
|
|
50
|
-
return {
|
|
51
|
-
...config,
|
|
52
|
-
module: {
|
|
53
|
-
...config.module,
|
|
54
|
-
rules: [
|
|
55
|
-
...config.module.rules,
|
|
56
|
-
{
|
|
57
|
-
test: /\.tsx?$/,
|
|
58
|
-
use: [
|
|
59
|
-
{
|
|
60
|
-
loader: require.resolve('ts-loader'),
|
|
61
|
-
options: tsLoaderOptions,
|
|
62
|
-
},
|
|
63
|
-
{ loader: path_1.default.resolve(__dirname, 'ngx-template-loader') },
|
|
64
|
-
],
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
test: /[/\\]@angular[/\\]core[/\\].+\.js$/,
|
|
68
|
-
parser: { system: false },
|
|
69
|
-
},
|
|
70
|
-
{
|
|
71
|
-
test: /\.html$/,
|
|
72
|
-
loader: require.resolve('raw-loader'),
|
|
73
|
-
exclude: /\.async\.html$/,
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
test: /\.s(c|a)ss$/,
|
|
77
|
-
use: [
|
|
78
|
-
{ loader: require.resolve('raw-loader') },
|
|
79
|
-
{
|
|
80
|
-
loader: require.resolve('postcss-loader'),
|
|
81
|
-
options: {
|
|
82
|
-
postcssOptions: {
|
|
83
|
-
plugins: [(0, autoprefixer_1.default)()],
|
|
84
|
-
},
|
|
85
|
-
},
|
|
86
|
-
},
|
|
87
|
-
{ loader: require.resolve('sass-loader') },
|
|
88
|
-
],
|
|
89
|
-
},
|
|
90
|
-
],
|
|
91
|
-
},
|
|
92
|
-
resolve: {
|
|
93
|
-
...config.resolve,
|
|
94
|
-
},
|
|
95
|
-
plugins: [
|
|
96
|
-
...config.plugins,
|
|
97
|
-
// See https://github.com/angular/angular/issues/11580#issuecomment-401127742
|
|
98
|
-
new webpack_1.ContextReplacementPlugin(/@angular(\\|\/)core(\\|\/)(fesm5|bundles)/, path_1.default.resolve(__dirname, '..')),
|
|
99
|
-
(0, create_fork_ts_checker_plugin_1.default)(tsLoaderOptions),
|
|
100
|
-
],
|
|
101
|
-
};
|
|
102
|
-
}
|
|
103
|
-
exports.webpack = webpack;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function (source: string): string;
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* By the time this file was added the repository for angular2-template-loader received no updates in 3 years
|
|
4
|
-
* This is just a copy of https://github.com/TheLarkInn/angular2-template-loader/blob/master/index.js in order
|
|
5
|
-
* to fix a bug that prevents Storybook from updating raw-loader > ^1.0.0
|
|
6
|
-
*
|
|
7
|
-
* As suggested in https://github.com/storybookjs/storybook/issues/7877#issuecomment-536556755 this code was
|
|
8
|
-
* modified to be compatible with newer versions of raw-loader as well as backwards compatible with raw-loader ^1.0.0
|
|
9
|
-
*/
|
|
10
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
-
// using: regex, capture groups, and capture group variables.
|
|
12
|
-
const templateUrlRegex = /templateUrl\s*:(\s*['"`](.*?)['"`]\s*([,}]))/gm;
|
|
13
|
-
const stylesRegex = /styleUrls *:(\s*\[[^\]]*?\])/g;
|
|
14
|
-
const stringRegex = /(['`"])((?:[^\\]\\\1|.)*?)\1/g;
|
|
15
|
-
const replaceStringsWithRequires = (string) => {
|
|
16
|
-
return string.replace(stringRegex, (match, quote, url) => {
|
|
17
|
-
let newUrl = url;
|
|
18
|
-
if (url.charAt(0) !== '.') {
|
|
19
|
-
newUrl = `./${url}`;
|
|
20
|
-
}
|
|
21
|
-
const requireString = `(require('${newUrl}').default || require('${newUrl}'))`;
|
|
22
|
-
// without the length check an empty style file will throw
|
|
23
|
-
// "Expected 'styles' to be an array of strings"
|
|
24
|
-
return `${requireString}.length ? ${requireString} : ''`;
|
|
25
|
-
});
|
|
26
|
-
};
|
|
27
|
-
function default_1(source) {
|
|
28
|
-
const styleProperty = 'styles';
|
|
29
|
-
const templateProperty = 'template';
|
|
30
|
-
return source
|
|
31
|
-
.replace(templateUrlRegex, (_, templateUrlString) => {
|
|
32
|
-
// replace: templateUrl: './path/to/template.html'
|
|
33
|
-
// with: template: require('./path/to/template.html')
|
|
34
|
-
// or: templateUrl: require('./path/to/template.html')
|
|
35
|
-
// if `keepUrl` query parameter is set to true.
|
|
36
|
-
return `${templateProperty}:${replaceStringsWithRequires(templateUrlString)}`;
|
|
37
|
-
})
|
|
38
|
-
.replace(stylesRegex, (_, styleUrlsString) => {
|
|
39
|
-
// replace: stylesUrl: ['./foo.css', "./baz.css", "./index.component.css"]
|
|
40
|
-
// with: styles: [require('./foo.css'), require("./baz.css"), require("./index.component.css")]
|
|
41
|
-
// or: styleUrls: [require('./foo.css'), require("./baz.css"), require("./index.component.css")]
|
|
42
|
-
// if `keepUrl` query parameter is set to true.
|
|
43
|
-
return `${styleProperty}:${replaceStringsWithRequires(styleUrlsString)}`;
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
exports.default = default_1;
|
|
@@ -1,28 +0,0 @@
|
|
|
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
|
-
const fs_1 = __importDefault(require("fs"));
|
|
7
|
-
const path_1 = __importDefault(require("path"));
|
|
8
|
-
const node_logger_1 = require("@storybook/node-logger");
|
|
9
|
-
function resolveTsConfig(tsConfigPath) {
|
|
10
|
-
if (fs_1.default.existsSync(tsConfigPath)) {
|
|
11
|
-
node_logger_1.logger.info('=> Found custom tsconfig.json');
|
|
12
|
-
return tsConfigPath;
|
|
13
|
-
}
|
|
14
|
-
return undefined;
|
|
15
|
-
}
|
|
16
|
-
function default_1(configDir) {
|
|
17
|
-
const tsLoaderOptions = {
|
|
18
|
-
transpileOnly: true,
|
|
19
|
-
compilerOptions: {
|
|
20
|
-
emitDecoratorMetadata: true,
|
|
21
|
-
},
|
|
22
|
-
};
|
|
23
|
-
const configFilePath = resolveTsConfig(path_1.default.resolve(configDir, 'tsconfig.json'));
|
|
24
|
-
if (configFilePath)
|
|
25
|
-
tsLoaderOptions.configFile = configFilePath;
|
|
26
|
-
return tsLoaderOptions;
|
|
27
|
-
}
|
|
28
|
-
exports.default = default_1;
|
package/types-6-0.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './dist/types/client/preview/types-6-0.d';
|
package/types-7-0.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './dist/types/client/preview/types-7-0.d';
|