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 | Object.defineProperty(exports, "__esModule", { value: true });
|
12 | exports.getTransforms = exports.indexHtmlTransformFactory = exports.customWebpackConfigTransformFactory = void 0;
|
13 | const path = require("node:path");
|
14 | const core_1 = require("@angular-devkit/core");
|
15 | const common_1 = require("@angular-builders/common");
|
16 | const custom_webpack_builder_1 = require("./custom-webpack-builder");
|
17 | const customWebpackConfigTransformFactory = (options, { workspaceRoot, target, logger }) => browserWebpackConfig => {
|
18 | return custom_webpack_builder_1.CustomWebpackBuilder.buildWebpackConfig((0, core_1.normalize)(workspaceRoot), options.customWebpackConfig, browserWebpackConfig, options, target, logger);
|
19 | };
|
20 | exports.customWebpackConfigTransformFactory = customWebpackConfigTransformFactory;
|
21 | const indexHtmlTransformFactory = (options, { workspaceRoot, target, logger }) => {
|
22 | if (!options.indexTransform)
|
23 | return null;
|
24 | const transformPath = path.join((0, core_1.getSystemPath)((0, core_1.normalize)(workspaceRoot)), options.indexTransform);
|
25 | const tsConfig = path.join((0, core_1.getSystemPath)((0, core_1.normalize)(workspaceRoot)), options.tsConfig);
|
26 | return (indexHtml) => __awaiter(void 0, void 0, void 0, function* () {
|
27 | const transform = yield (0, common_1.loadModule)(transformPath, tsConfig, logger);
|
28 | return transform(target, indexHtml);
|
29 | });
|
30 | };
|
31 | exports.indexHtmlTransformFactory = indexHtmlTransformFactory;
|
32 | const getTransforms = (options, context) => ({
|
33 | webpackConfiguration: (0, exports.customWebpackConfigTransformFactory)(options, context),
|
34 | indexHtml: (0, exports.indexHtmlTransformFactory)(options, context),
|
35 | });
|
36 | exports.getTransforms = getTransforms;
|
37 |
|
\ | No newline at end of file |