@angular-builders/custom-esbuild 19.1.0-beta.2 → 20.0.0-beta.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 CHANGED
@@ -24,13 +24,15 @@ Allow customizing ESBuild configuration
24
24
  <details>
25
25
  <summary>Click to expand</summary>
26
26
 
27
+ - [Version 19](https://github.com/just-jeb/angular-builders/blob/19.x.x/packages/custom-esbuild/README.md)
28
+ - [Version 18](https://github.com/just-jeb/angular-builders/blob/18.x.x/packages/custom-esbuild/README.md)
27
29
  - [Version 17](https://github.com/just-jeb/angular-builders/blob/17.x.x/packages/custom-esbuild/README.md)
28
30
 
29
31
  </details>
30
32
 
31
33
  ## Prerequisites:
32
34
 
33
- - [Angular CLI 18](https://www.npmjs.com/package/@angular/cli)
35
+ - [Angular CLI 20](https://www.npmjs.com/package/@angular/cli)
34
36
 
35
37
  # Usage
36
38
 
@@ -118,7 +120,7 @@ Builder options:
118
120
 
119
121
  In the above example, we specify the list of `plugins` that should implement the ESBuild plugin schema. These plugins are custom user plugins and are added to the original ESBuild Angular configuration. Additionally, the `indexHtmlTransformer` property is used to specify the path to the file that exports the function used to modify the `index.html`.
120
122
 
121
- The plugin file can export either a single plugin or a list of plugins. If a plugin accepts configuration then the config should be provided in `angular.json`:
123
+ The plugin file can export either a single plugin, a list of plugins or a factory function that returns a plugin or list of plugins. If a plugin accepts configuration then the config should be provided in `angular.json`:
122
124
 
123
125
  ```ts
124
126
  // esbuild/plugins.ts
@@ -143,13 +145,13 @@ import type { Plugin, PluginBuild } from 'esbuild';
143
145
 
144
146
  function defineEnv(pluginOptions: { stage: string }): Plugin {
145
147
  return {
146
- name: 'define-env',
148
+ name: 'define-env',
147
149
  setup(build: PluginBuild) {
148
150
  const buildOptions = build.initialOptions;
149
151
  buildOptions.define.stage = JSON.stringify(pluginOptions.stage);
150
152
  },
151
153
  };
152
- };
154
+ }
153
155
 
154
156
  export default defineEnv;
155
157
  ```
@@ -180,6 +182,25 @@ const updateExternalPlugin: Plugin = {
180
182
  export default [defineTextPlugin, updateExternalPlugin];
181
183
  ```
182
184
 
185
+ Or:
186
+
187
+ ```ts
188
+ // esbuild/plugins.ts
189
+ import type { Plugin, PluginBuild } from 'esbuild';
190
+ import type { ApplicationBuilderOptions } from '@angular-devkit/build-angular';
191
+ import type { Target } from '@angular-devkit/architect';
192
+
193
+ export default (builderOptions: ApplicationBuilderOptions, target: Target): Plugin => {
194
+ return {
195
+ name: 'define-text',
196
+ setup(build: PluginBuild) {
197
+ const options = build.initialOptions;
198
+ options.define.currentProject = JSON.stringify(target.project);
199
+ },
200
+ };
201
+ };
202
+ ```
203
+
183
204
  ## Custom ESBuild `dev-server`
184
205
 
185
206
  The `@angular-builders/custom-esbuild:dev-server` is an enhanced version of the `@angular-devkit/build-angular:dev-server` builder that allows the specification of `middlewares` (Vite's `Connect` functions). It also obtains `plugins` and `indexHtmlTransformer` from the `:application` configuration to run the Vite server with all the necessary configuration applied.
@@ -239,7 +260,7 @@ It is useful when you want to transform your `index.html` according to the build
239
260
  `index-html-transformer.js`:
240
261
 
241
262
  ```js
242
- module.exports = (indexHtml) => {
263
+ module.exports = indexHtml => {
243
264
  const i = indexHtml.indexOf('</body>');
244
265
  const content = `<p>Dynamically inserted content</p>`;
245
266
  return `${indexHtml.slice(0, i)}
@@ -2,7 +2,7 @@ import { BuilderContext } from '@angular-devkit/architect';
2
2
  import { json } from '@angular-devkit/core';
3
3
  import { CustomEsbuildApplicationSchema } from '../custom-esbuild-schema';
4
4
  export declare function buildCustomEsbuildApplication(options: CustomEsbuildApplicationSchema, context: BuilderContext): import("rxjs").Observable<import("@angular-devkit/architect").BuilderOutput>;
5
- declare const _default: import("@angular-devkit/architect").Builder<json.JsonObject & import("@angular-devkit/build-angular").ApplicationBuilderOptions & {
5
+ declare const _default: import("@angular-devkit/architect").Builder<json.JsonObject & import("@angular/build").ApplicationBuilderOptions & {
6
6
  plugins?: string[];
7
7
  indexHtmlTransformer?: string;
8
8
  }>;
@@ -1,18 +1,42 @@
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
- };
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 () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
11
35
  Object.defineProperty(exports, "__esModule", { value: true });
12
36
  exports.buildCustomEsbuildApplication = buildCustomEsbuildApplication;
13
- const path = require("node:path");
37
+ const path = __importStar(require("node:path"));
14
38
  const architect_1 = require("@angular-devkit/architect");
15
- const build_angular_1 = require("@angular-devkit/build-angular");
39
+ const build_1 = require("@angular/build");
16
40
  const core_1 = require("@angular-devkit/core");
17
41
  const rxjs_1 = require("rxjs");
18
42
  const load_plugins_1 = require("../load-plugins");
@@ -20,13 +44,13 @@ const load_index_html_transformer_1 = require("../load-index-html-transformer");
20
44
  function buildCustomEsbuildApplication(options, context) {
21
45
  const workspaceRoot = (0, core_1.getSystemPath)((0, core_1.normalize)(context.workspaceRoot));
22
46
  const tsConfig = path.join(workspaceRoot, options.tsConfig);
23
- return (0, rxjs_1.defer)(() => __awaiter(this, void 0, void 0, function* () {
24
- const codePlugins = yield (0, load_plugins_1.loadPlugins)(options.plugins, workspaceRoot, tsConfig, context.logger);
47
+ return (0, rxjs_1.defer)(async () => {
48
+ const codePlugins = await (0, load_plugins_1.loadPlugins)(options.plugins, workspaceRoot, tsConfig, context.logger, options, context.target);
25
49
  const indexHtmlTransformer = options.indexHtmlTransformer
26
- ? yield (0, load_index_html_transformer_1.loadIndexHtmlTransformer)(path.join(workspaceRoot, options.indexHtmlTransformer), tsConfig, context.logger, context.target)
50
+ ? await (0, load_index_html_transformer_1.loadIndexHtmlTransformer)(path.join(workspaceRoot, options.indexHtmlTransformer), tsConfig, context.logger, context.target)
27
51
  : undefined;
28
52
  return { codePlugins, indexHtmlTransformer };
29
- })).pipe((0, rxjs_1.switchMap)(extensions => (0, build_angular_1.buildApplication)(options, context, extensions)));
53
+ }).pipe((0, rxjs_1.switchMap)(extensions => (0, build_1.buildApplication)(options, context, extensions)));
30
54
  }
31
55
  exports.default = (0, architect_1.createBuilder)(buildCustomEsbuildApplication);
32
56
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/application/index.ts"],"names":[],"m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;AAC1E,0CAAkD;AAClD,+CAAsE;AACtE,+BAAwC;AAExC,kDAA8C;AAE9C,gFAA0E;AAE1E,SAAgB,6BAA6B,CAC3C,OAAuC,EACvC,OAAuB;IAEvB,MAAM,aAAa,GAAG,IAAA,oBAAa,EAAC,IAAA,gBAAS,EAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC;IACtE,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IAE5D,OAAO,IAAA,YAAK,EAAC,KAAK,IAAI,EAAE;QACtB,MAAM,WAAW,GAAG,MAAM,IAAA,0BAAW,EACnC,OAAO,CAAC,OAAO,EACf,aAAa,EACb,QAAQ,EACR,OAAO,CAAC,MAAM,EACd,OAAO,EACP,OAAO,CAAC,MAAM,CACf,CAAC;QAEF,MAAM,oBAAoB,GAAG,OAAO,CAAC,oBAAoB;YACvD,CAAC,CAAC,MAAM,IAAA,sDAAwB,EAC5B,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,OAAO,CAAC,oBAAoB,CAAC,EACtD,QAAQ,EACR,OAAO,CAAC,MAAM,EACd,OAAO,CAAC,MAAM,CACf;YACH,CAAC,CAAC,SAAS,CAAC;QAEd,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAE,CAAC;IAC/C,CAAC,CAAC,CAAC,IAAI,CAAC,IAAA,gBAAS,EAAC,UAAU,CAAC,EAAE,CAAC,IAAA,wBAAgB,EAAC,OAAO,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC;AACnF,CAAC;AAED,kBAAe,IAAA,yBAAa,EAC1B,6BAA6B,CAC9B,CAAC"}
@@ -308,6 +308,13 @@
308
308
  "type": "string"
309
309
  }
310
310
  },
311
+ "conditions": {
312
+ "description": "Custom package resolution conditions used to resolve conditional exports/imports. Defaults to ['module', 'development'/'production']. The following special conditions are always present if the requirements are satisfied: 'default', 'import', 'require', 'browser', 'node'.",
313
+ "type": "array",
314
+ "items": {
315
+ "type": "string"
316
+ }
317
+ },
311
318
  "fileReplacements": {
312
319
  "description": "Replace compilation source files with other compilation source files in the build.",
313
320
  "type": "array",
@@ -387,6 +394,11 @@
387
394
  "type": "boolean",
388
395
  "description": "Resolve vendor packages source maps.",
389
396
  "default": false
397
+ },
398
+ "sourcesContent": {
399
+ "type": "boolean",
400
+ "description": "Output original source content for files within the source map.",
401
+ "default": true
390
402
  }
391
403
  },
392
404
  "additionalProperties": false
@@ -679,9 +691,6 @@
679
691
  },
680
692
  "additionalProperties": false,
681
693
  "required": [
682
- "outputPath",
683
- "index",
684
- "browser",
685
694
  "tsConfig"
686
695
  ],
687
696
  "definitions": {
@@ -1,4 +1,4 @@
1
- import { ApplicationBuilderOptions, DevServerBuilderOptions } from '@angular-devkit/build-angular';
1
+ import { ApplicationBuilderOptions, DevServerBuilderOptions } from '@angular/build';
2
2
  export type PluginConfig = string | {
3
3
  path: string;
4
4
  options?: Record<string, unknown>;
@@ -1,5 +1,5 @@
1
1
  import { BuilderContext } from '@angular-devkit/architect';
2
- import { DevServerBuilderOptions, DevServerBuilderOutput } from '@angular-devkit/build-angular';
2
+ import { DevServerBuilderOptions, DevServerBuilderOutput } from '@angular/build';
3
3
  import { json } from '@angular-devkit/core';
4
4
  import { Observable } from 'rxjs';
5
5
  import { CustomEsbuildDevServerSchema } from '../custom-esbuild-schema';
@@ -1,18 +1,42 @@
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
- };
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 () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
11
35
  Object.defineProperty(exports, "__esModule", { value: true });
12
36
  exports.executeCustomDevServerBuilder = executeCustomDevServerBuilder;
13
- const path = require("node:path");
37
+ const path = __importStar(require("node:path"));
14
38
  const architect_1 = require("@angular-devkit/architect");
15
- const build_angular_1 = require("@angular-devkit/build-angular");
39
+ const build_1 = require("@angular/build");
16
40
  const core_1 = require("@angular-devkit/core");
17
41
  const rxjs_1 = require("rxjs");
18
42
  const common_1 = require("@angular-builders/common");
@@ -21,31 +45,26 @@ const patch_builder_context_1 = require("./patch-builder-context");
21
45
  const load_index_html_transformer_1 = require("../load-index-html-transformer");
22
46
  function executeCustomDevServerBuilder(options, context) {
23
47
  const buildTarget = (0, architect_1.targetFromTargetString)(options.buildTarget);
24
- function getBuildTargetOptions() {
25
- return __awaiter(this, void 0, void 0, function* () {
26
- return (yield context.getTargetOptions(buildTarget));
27
- });
48
+ async function getBuildTargetOptions() {
49
+ return (await context.getTargetOptions(buildTarget));
28
50
  }
29
51
  const workspaceRoot = (0, core_1.getSystemPath)((0, core_1.normalize)(context.workspaceRoot));
30
- return (0, rxjs_1.from)(getBuildTargetOptions()).pipe((0, rxjs_1.switchMap)((buildOptions) => __awaiter(this, void 0, void 0, function* () {
52
+ return (0, rxjs_1.from)(getBuildTargetOptions()).pipe((0, rxjs_1.switchMap)(async (buildOptions) => {
31
53
  const tsConfig = path.join(workspaceRoot, buildOptions.tsConfig);
32
54
  const middleware = [];
33
55
  // Not using `Promise.all` preserves the order of middlewares as they
34
56
  // are declared in the configuration list.
35
57
  for (const middlewarePath of options.middlewares || []) {
36
58
  // https://github.com/angular/angular-cli/pull/26212/files#diff-a99020cbdb97d20b2bc686bcb64b31942107d56db06fd880171b0a86f7859e6eR52
37
- middleware.push(yield (0, common_1.loadModule)(path.join(workspaceRoot, middlewarePath), tsConfig, context.logger));
59
+ middleware.push(await (0, common_1.loadModule)(path.join(workspaceRoot, middlewarePath), tsConfig, context.logger));
38
60
  }
39
- const buildPlugins = yield (0, load_plugins_1.loadPlugins)(buildOptions.plugins, workspaceRoot, tsConfig, context.logger);
61
+ const buildPlugins = await (0, load_plugins_1.loadPlugins)(buildOptions.plugins, workspaceRoot, tsConfig, context.logger, options, context.target);
40
62
  const indexHtmlTransformer = buildOptions.indexHtmlTransformer
41
- ? yield (0, load_index_html_transformer_1.loadIndexHtmlTransformer)(path.join(workspaceRoot, buildOptions.indexHtmlTransformer), tsConfig, context.logger, context.target)
63
+ ? await (0, load_index_html_transformer_1.loadIndexHtmlTransformer)(path.join(workspaceRoot, buildOptions.indexHtmlTransformer), tsConfig, context.logger, context.target)
42
64
  : undefined;
43
65
  (0, patch_builder_context_1.patchBuilderContext)(context, buildTarget);
44
- return {
45
- transforms: { indexHtml: indexHtmlTransformer },
46
- extensions: { middleware, buildPlugins },
47
- };
48
- })), (0, rxjs_1.switchMap)(({ transforms, extensions }) => (0, build_angular_1.executeDevServerBuilder)(options, context, transforms, extensions)));
66
+ return { middleware, buildPlugins, indexHtmlTransformer };
67
+ }), (0, rxjs_1.switchMap)((extensions) => (0, build_1.executeDevServerBuilder)(options, context, extensions)));
49
68
  }
50
69
  exports.default = (0, architect_1.createBuilder)(executeCustomDevServerBuilder);
51
70
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/dev-server/index.ts"],"names":[],"mappings":";;;;;;;;;;;AAoBA,sEA4DC;AAhFD,kCAAkC;AAClC,yDAAkG;AAClG,iEAIuC;AACvC,+CAAsE;AACtE,+BAAmD;AACnD,qDAAsD;AAGtD,kDAA8C;AAC9C,mEAA8D;AAK9D,gFAA0E;AAE1E,SAAgB,6BAA6B,CAC3C,OAAqC,EACrC,OAAuB;IAEvB,MAAM,WAAW,GAAG,IAAA,kCAAsB,EAAC,OAAO,CAAC,WAAW,CAAC,CAAC;IAEhE,SAAe,qBAAqB;;YAClC,OAAO,CAAC,MAAM,OAAO,CAAC,gBAAgB,CACpC,WAAW,CACZ,CAA8C,CAAC;QAClD,CAAC;KAAA;IAED,MAAM,aAAa,GAAG,IAAA,oBAAa,EAAC,IAAA,gBAAS,EAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC;IAEtE,OAAO,IAAA,WAAI,EAAC,qBAAqB,EAAE,CAAC,CAAC,IAAI,CACvC,IAAA,gBAAS,EAAC,CAAM,YAAY,EAAC,EAAE;QAC7B,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,YAAY,CAAC,QAAQ,CAAC,CAAC;QAEjE,MAAM,UAAU,GAAiB,EAAE,CAAC;QAEpC,qEAAqE;QACrE,0CAA0C;QAC1C,KAAK,MAAM,cAA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AY,CAAC,oBAAoB,CAAC,EAC3D,QAAQ,EACR,OAAO,CAAC,MAAM,EACd,OAAO,CAAC,MAAM,CACf;YACH,CAAC,CAAC,SAAS,CAAC;QAEd,IAAA,2CAAmB,EAAC,OAAO,EAAE,WAAW,CAAC,CAAC;QAE1C,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,oBAAoB,EAAE,CAAC;IAC5D,CAAC,CAAC,EACF,IAAA,gBAAS,EAAC,CAAC,UAAU,EAAE,EAAE,CACvB,IAAA,+BAAuB,EAAC,OAAO,EAAE,OAAO,EAAE,UAAU,CAAC,CACtD,CACF,CAAC;AACJ,CAAC;AAED,kBAAe,IAAA,yBAAa,EAC1B,6BAA6B,CAC9B,CAAC"}
@@ -1,18 +1,9 @@
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.patchBuilderContext = patchBuilderContext;
13
4
  const executorToBuilderMap = new Map([
14
- ['@angular-builders/custom-esbuild', '@angular-devkit/build-angular:application'],
15
- ['@angular-builders/custom-esbuild:application', '@angular-devkit/build-angular:application'],
5
+ ['@angular-builders/custom-esbuild', '@angular/build:application'],
6
+ ['@angular-builders/custom-esbuild:application', '@angular/build:application'],
16
7
  ]);
17
8
  function cleanBuildTargetOptions(options) {
18
9
  delete options.plugins;
@@ -22,27 +13,27 @@ function cleanBuildTargetOptions(options) {
22
13
  function patchBuilderContext(context, buildTarget) {
23
14
  const originalGetBuilderNameForTarget = context.getBuilderNameForTarget;
24
15
  // We have to patch `getBuilderNameForTarget` because Angular CLI checks
25
- // whether the runnable target is `@angular-devkit/build-angular:application`
16
+ // whether the runnable target is `@angular/build:application`
26
17
  // and then defines the server to run. If the `builderName` (returned by
27
- // `context.getBuilderNameForTarget`) is not an `@angular-devkit/build-angular:application`,
18
+ // `context.getBuilderNameForTarget`) is not an `@angular/build:application`,
28
19
  // then it will use the Webpack server for the `dev-server target`. By patching
29
20
  // the return value, Angular will use the Vite server for the `dev-server` target.
30
- context.getBuilderNameForTarget = (target) => __awaiter(this, void 0, void 0, function* () {
31
- const builderName = yield originalGetBuilderNameForTarget(target);
21
+ context.getBuilderNameForTarget = async (target) => {
22
+ const builderName = await originalGetBuilderNameForTarget(target);
32
23
  if (executorToBuilderMap.has(builderName)) {
33
24
  return executorToBuilderMap.get(builderName);
34
25
  }
35
26
  return builderName;
36
- });
27
+ };
37
28
  const originalGetTargetOptions = context.getTargetOptions;
38
- context.getTargetOptions = (target) => __awaiter(this, void 0, void 0, function* () {
39
- const options = yield originalGetTargetOptions(target);
29
+ context.getTargetOptions = async (target) => {
30
+ const options = await originalGetTargetOptions(target);
40
31
  if (target.project === buildTarget.project &&
41
32
  target.target === buildTarget.target &&
42
33
  target.configuration === buildTarget.configuration) {
43
34
  cleanBuildTargetOptions(options);
44
35
  }
45
36
  return options;
46
- });
37
+ };
47
38
  }
48
39
  //# sourceMappingURL=patch-builder-context.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"patch-builder-context.js","sourceRoot":"","sources":["../../src/dev-server/patch-builder-context.ts"],"names":[],"mappings":";;;;;;;;;;;AAaA,kDAiCC;AA5CD,MAAM,oBAAoB,GAAG,IAAI,GAAG,CAAiB;IACnD,CAAC,kCAAkC,EAAE,2CAA2C,CAAC;IACjF,CAAC,8CAA8C,EAAE,2CAA2C,CAAC;CAC9F,CAAC,CAAC;AAEH,SAAS,uBAAuB,CAAC,OAAY;IAC3C,OAAO,OAAO,CAAC,OAAO,CAAC;IACvB,OAAO,OAAO,CAAC,oBAAoB,CAAC;IACpC,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,SAAgB,mBAAmB,CAAC,OAAuB,EAAE,WAAmB;IAC9E,MAAM,+BAA+B,GAAG,OAAO,CAAC,uBAAuB,CAAC;IAExE,wEAAwE;IACxE,6EAA6E;IAC7E,wEAAwE;IACxE,4FAA4F;IAC5F,+EAA+E;IAC/E,kFAAkF;IAClF,OAAO,CAAC,uBAAuB,GAAG,CAAM,MAAM,EAAC,EAAE;QAC/C,MAAM,WAAW,GAAG,MAAM,+BAA+B,CAAC,MAAM,CAAC,CAAC;QAElE,IAAI,oBAAoB,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE,CAAC;YAC1C,OAAO,oBAAoB,CAAC,GAAG,CAAC,WAAW,CAAE,CAAC;QAChD,CAAC;QAED,OAAO,WAAW,CAAC;IACrB,CAAC,CAAA,CAAC;IAEF,MAAM,wBAAwB,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAC1D,OAAO,CAAC,gBAAgB,GAAG,CAAM,MAAM,EAAC,EAAE;QACxC,MAAM,OAAO,GAAG,MAAM,wBAAwB,CAAC,MAAM,CAAC,CAAC;QAEvD,IACE,MAAM,CAAC,OAAO,KAAK,WAAW,CAAC,OAAO;YACtC,MAAM,CAAC,MAAM,KAAK,WAAW,CAAC,MAAM;YACpC,MAAM,CAAC,aAAa,KAAK,WAAW,CAAC,aAAa,EAClD,CAAC;YACD,uBAAuB,CAAC,OAAO,CAAC,CAAC;QACnC,CAAC;QAED,OAAO,OAAO,CAAC;IACjB,CAAC,CAAA,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"patch-builder-context.js","sourceRoot":"","sources":["../../src/dev-server/patch-builder-context.ts"],"names":[],"mappings":";;AAaA,kDAiCC;AA5CD,MAAM,oBAAoB,GAAG,IAAI,GAAG,CAAiB;IACnD,CAAC,kCAAkC,EAAE,4BAA4B,CAAC;IAClE,CAAC,8CAA8C,EAAE,4BAA4B,CAAC;CAC/E,CAAC,CAAC;AAEH,SAAS,uBAAuB,CAAC,OAAY;IAC3C,OAAO,OAAO,CAAC,OAAO,CAAC;IACvB,OAAO,OAAO,CAAC,oBAAoB,CAAC;IACpC,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,SAAgB,mBAAmB,CAAC,OAAuB,EAAE,WAAmB;IAC9E,MAAM,+BAA+B,GAAG,OAAO,CAAC,uBAAuB,CAAC;IAExE,wEAAwE;IACxE,8DAA8D;IAC9D,wEAAwE;IACxE,6EAA6E;IAC7E,+EAA+E;IAC/E,kFAAkF;IAClF,OAAO,CAAC,uBAAuB,GAAG,KAAK,EAAC,MAAM,EAAC,EAAE;QAC/C,MAAM,WAAW,GAAG,MAAM,+BAA+B,CAAC,MAAM,CAAC,CAAC;QAElE,IAAI,oBAAoB,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE,CAAC;YAC1C,OAAO,oBAAoB,CAAC,GAAG,CAAC,WAAW,CAAE,CAAC;QAChD,CAAC;QAED,OAAO,WAAW,CAAC;IACrB,CAAC,CAAC;IAEF,MAAM,wBAAwB,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAC1D,OAAO,CAAC,gBAAgB,GAAG,KAAK,EAAC,MAAM,EAAC,EAAE;QACxC,MAAM,OAAO,GAAG,MAAM,wBAAwB,CAAC,MAAM,CAAC,CAAC;QAEvD,IACE,MAAM,CAAC,OAAO,KAAK,WAAW,CAAC,OAAO;YACtC,MAAM,CAAC,MAAM,KAAK,WAAW,CAAC,MAAM;YACpC,MAAM,CAAC,aAAa,KAAK,WAAW,CAAC,aAAa,EAClD,CAAC;YACD,uBAAuB,CAAC,OAAO,CAAC,CAAC;QACnC,CAAC;QAED,OAAO,OAAO,CAAC;IACjB,CAAC,CAAC;AACJ,CAAC"}
@@ -36,6 +36,23 @@
36
36
  "type": "string",
37
37
  "description": "SSL certificate to use for serving HTTPS."
38
38
  },
39
+ "allowedHosts": {
40
+ "description": "The hosts that the development server will respond to. This option sets the Vite option of the same name. For further details: https://vite.dev/config/server-options.html#server-allowedhosts",
41
+ "default": [],
42
+ "oneOf": [
43
+ {
44
+ "type": "array",
45
+ "description": "A list of hosts that the development server will respond to.",
46
+ "items": {
47
+ "type": "string"
48
+ }
49
+ },
50
+ {
51
+ "type": "boolean",
52
+ "description": "Indicates that all hosts are allowed. This is not recommended and a security risk."
53
+ }
54
+ ]
55
+ },
39
56
  "headers": {
40
57
  "type": "object",
41
58
  "description": "Custom HTTP headers to be added to all responses.",
@@ -61,30 +78,13 @@
61
78
  "description": "Whether to reload the page on change, using live-reload.",
62
79
  "default": true
63
80
  },
64
- "publicHost": {
65
- "type": "string",
66
- "description": "The URL that the browser client (or live-reload client, if enabled) should use to connect to the development server. Use for a complex dev server setup, such as one with reverse proxies. This option has no effect when using the 'application' or other esbuild-based builders."
67
- },
68
- "allowedHosts": {
69
- "type": "array",
70
- "description": "List of hosts that are allowed to access the dev server.",
71
- "default": [],
72
- "items": {
73
- "type": "string"
74
- }
75
- },
76
81
  "servePath": {
77
82
  "type": "string",
78
83
  "description": "The pathname where the application will be served."
79
84
  },
80
- "disableHostCheck": {
81
- "type": "boolean",
82
- "description": "Don't verify connected clients are part of allowed hosts.",
83
- "default": false
84
- },
85
85
  "hmr": {
86
86
  "type": "boolean",
87
- "description": "Enable hot module replacement."
87
+ "description": "Enable hot module replacement. Defaults to the value of 'liveReload'. Currently, only global and component stylesheets are supported."
88
88
  },
89
89
  "watch": {
90
90
  "type": "boolean",
@@ -108,13 +108,9 @@
108
108
  }
109
109
  ]
110
110
  },
111
- "forceEsbuild": {
112
- "type": "boolean",
113
- "description": "Force the development server to use the 'browser-esbuild' builder when building.",
114
- "default": false
115
- },
116
111
  "prebundle": {
117
- "description": "Enable and control the Vite-based development server's prebundling capabilities. To enable prebundling, the Angular CLI cache must also be enabled. This option has no effect when using the 'browser' or other Webpack-based builders.",
112
+ "description": "Enable and control the Vite-based development server's prebundling capabilities. To enable prebundling, the Angular CLI cache must also be enabled.",
113
+ "default": true,
118
114
  "oneOf": [
119
115
  {
120
116
  "type": "boolean"
@@ -123,7 +119,7 @@
123
119
  "type": "object",
124
120
  "properties": {
125
121
  "exclude": {
126
- "description": "List of package imports that should not be prebundled by the development server. The packages will be bundled into the application code itself.",
122
+ "description": "List of package imports that should not be prebundled by the development server. The packages will be bundled into the application code itself. Note: specifying `@foo/bar` marks all paths within the `@foo/bar` package as excluded, including sub-paths like `@foo/bar/baz`.",
127
123
  "type": "array",
128
124
  "items": {
129
125
  "type": "string"
@@ -1,4 +1,4 @@
1
1
  import { logging } from '@angular-devkit/core';
2
2
  import { Target } from '@angular-devkit/architect';
3
- import type { IndexHtmlTransform } from '@angular/build/src/utils/index-file/index-html-generator';
3
+ import type { IndexHtmlTransform } from '@angular/build/private';
4
4
  export declare function loadIndexHtmlTransformer(indexHtmlTransformerPath: string, tsConfig: string, logger: logging.LoggerApi, target: Target): Promise<IndexHtmlTransform>;
@@ -1,20 +1,9 @@
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.loadIndexHtmlTransformer = loadIndexHtmlTransformer;
13
4
  const common_1 = require("@angular-builders/common");
14
- function loadIndexHtmlTransformer(indexHtmlTransformerPath, tsConfig, logger, target) {
15
- return __awaiter(this, void 0, void 0, function* () {
16
- const transformer = yield (0, common_1.loadModule)(indexHtmlTransformerPath, tsConfig, logger);
17
- return (indexHtml) => transformer(indexHtml, target);
18
- });
5
+ async function loadIndexHtmlTransformer(indexHtmlTransformerPath, tsConfig, logger, target) {
6
+ const transformer = await (0, common_1.loadModule)(indexHtmlTransformerPath, tsConfig, logger);
7
+ return (indexHtml) => transformer(indexHtml, target);
19
8
  }
20
9
  //# sourceMappingURL=load-index-html-transformer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"load-index-html-transformer.js","sourceRoot":"","sources":["../src/load-index-html-transformer.ts"],"names":[],"mappings":";;;;;;;;;;;AAKA,4DAYC;AAjBD,qDAAsD;AAKtD,SAAsB,wBAAwB,CAC5C,wBAAgC,EAChC,QAAgB,EAChB,MAAyB,EACzB,MAAc;;QAEd,MAAM,WAAW,GAAG,MAAM,IAAA,mBAAU,EAClC,wBAAwB,EACxB,QAAQ,EACR,MAAM,CACP,CAAC;QACF,OAAO,CAAC,SAAiB,EAAE,EAAE,CAAC,WAAW,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;IAC/D,CAAC;CAAA"}
1
+ {"version":3,"file":"load-index-html-transformer.js","sourceRoot":"","sources":["../src/load-index-html-transformer.ts"],"names":[],"mappings":";;AAKA,4DAYC;AAjBD,qDAAsD;AAK/C,KAAK,UAAU,wBAAwB,CAC5C,wBAAgC,EAChC,QAAgB,EAChB,MAAyB,EACzB,MAAc;IAEd,MAAM,WAAW,GAAG,MAAM,IAAA,mBAAU,EAClC,wBAAwB,EACxB,QAAQ,EACR,MAAM,CACP,CAAC;IACF,OAAO,CAAC,SAAiB,EAAE,EAAE,CAAC,WAAW,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;AAC/D,CAAC"}
@@ -1,4 +1,5 @@
1
1
  import type { Plugin } from 'esbuild';
2
2
  import type { logging } from '@angular-devkit/core';
3
- import { PluginConfig } from './custom-esbuild-schema';
4
- export declare function loadPlugins(pluginConfig: PluginConfig[] | undefined, workspaceRoot: string, tsConfig: string, logger: logging.LoggerApi): Promise<Plugin[]>;
3
+ import { CustomEsbuildApplicationSchema, CustomEsbuildDevServerSchema, PluginConfig } from './custom-esbuild-schema';
4
+ import { Target } from '@angular-devkit/architect';
5
+ export declare function loadPlugins(pluginConfig: PluginConfig[] | undefined, workspaceRoot: string, tsConfig: string, logger: logging.LoggerApi, builderOptions: CustomEsbuildApplicationSchema | CustomEsbuildDevServerSchema, target: Target): Promise<Plugin[]>;
@@ -1,29 +1,57 @@
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
- };
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 () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
11
35
  Object.defineProperty(exports, "__esModule", { value: true });
12
36
  exports.loadPlugins = loadPlugins;
13
- const path = require("node:path");
37
+ const path = __importStar(require("node:path"));
14
38
  const common_1 = require("@angular-builders/common");
15
- function loadPlugins(pluginConfig, workspaceRoot, tsConfig, logger) {
16
- return __awaiter(this, void 0, void 0, function* () {
17
- const plugins = yield Promise.all((pluginConfig || []).map((pluginConfig) => __awaiter(this, void 0, void 0, function* () {
18
- if (typeof pluginConfig === 'string') {
19
- return (0, common_1.loadModule)(path.join(workspaceRoot, pluginConfig), tsConfig, logger);
39
+ async function loadPlugins(pluginConfig, workspaceRoot, tsConfig, logger, builderOptions, target) {
40
+ const plugins = await Promise.all((pluginConfig || []).map(async (pluginConfig) => {
41
+ if (typeof pluginConfig === 'string') {
42
+ const pluginsOrFactory = await (0, common_1.loadModule)(path.join(workspaceRoot, pluginConfig), tsConfig, logger);
43
+ if (typeof pluginsOrFactory === 'function') {
44
+ return pluginsOrFactory(builderOptions, target);
20
45
  }
21
46
  else {
22
- const pluginFactory = yield (0, common_1.loadModule)(path.join(workspaceRoot, pluginConfig.path), tsConfig, logger);
23
- return pluginFactory(pluginConfig.options);
47
+ return pluginsOrFactory;
24
48
  }
25
- })));
26
- return plugins.flat();
27
- });
49
+ }
50
+ else {
51
+ const pluginFactory = await (0, common_1.loadModule)(path.join(workspaceRoot, pluginConfig.path), tsConfig, logger);
52
+ return pluginFactory(pluginConfig.options, builderOptions, target);
53
+ }
54
+ }));
55
+ return plugins.flat();
28
56
  }
29
57
  //# sourceMappingURL=load-plugins.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"load-plugins.js","sourceRoot":"","sources":["../src/load-plugins.ts"],"names":[],"mappings":";;;;;;;;;;;AAMA,kCAoBC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mBAAU,EAOvC,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,YAAY,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;YAC5D,IAAI,OAAO,gBAAgB,KAAK,UAAU,EAAE,CAAC;gBAC3C,OAAO,gBAAgB,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC;YAClD,CAAC;iBAAM,CAAC;gBACN,OAAO,gBAAgB,CAAC;YAC1B,CAAC;QACH,CAAC;aAAM,CAAC;YACN,MAAM,aAAa,GAAG,MAAM,IAAA,mBAAU,EACpC,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,YAAY,CAAC,IAAI,CAAC,EAC3C,QAAQ,EACR,MAAM,CACP,CAAC;YACF,OAAO,aAAa,CAAC,YAAY,CAAC,OAAO,EAAE,cAAc,EAAE,MAAM,CAAC,CAAC;QACrE,CAAC;IACH,CAAC,CAAC,CACH,CAAC;IAEF,OAAO,OAAO,CAAC,IAAI,EAAE,CAAC;AACxB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular-builders/custom-esbuild",
3
- "version": "19.1.0-beta.2",
3
+ "version": "20.0.0-beta.0",
4
4
  "description": "Custom esbuild builders for Angular build facade. Allow to modify Angular build configuration without ejecting it",
5
5
  "main": "dist/index.js",
6
6
  "files": [
@@ -18,7 +18,7 @@
18
18
  "author": "JeB Barabanov",
19
19
  "license": "MIT",
20
20
  "engines": {
21
- "node": "^18.19.1 || ^20.11.1 || >=22.0.0"
21
+ "node": "^20.19.0 || ^22.12.0 || >=24.0.0"
22
22
  },
23
23
  "keywords": [
24
24
  "cli",
@@ -40,21 +40,20 @@
40
40
  },
41
41
  "builders": "builders.json",
42
42
  "dependencies": {
43
- "@angular-builders/common": "3.0.1-beta.0",
44
- "@angular-devkit/architect": ">=0.1900.0 < 0.2000.0",
45
- "@angular-devkit/build-angular": "^19.0.0",
46
- "@angular-devkit/core": "^19.0.0"
43
+ "@angular-builders/common": "4.0.0-beta.0",
44
+ "@angular-devkit/architect": ">=0.2000.0 < 0.2100.0",
45
+ "@angular-devkit/core": "^20.0.0",
46
+ "@angular/build": "^20.0.0"
47
47
  },
48
48
  "peerDependencies": {
49
- "@angular/compiler-cli": "^19.0.0"
49
+ "@angular/compiler-cli": "^20.0.0"
50
50
  },
51
51
  "devDependencies": {
52
- "@angular/build": "^19.0.0",
53
52
  "esbuild": "0.25.1",
54
53
  "jest": "29.7.0",
55
54
  "rimraf": "^5.0.0",
56
55
  "ts-node": "^10.0.0",
57
56
  "typescript": "5.8.3"
58
57
  },
59
- "gitHead": "9e0f7779a4e1440831c0791383037ecda66065e3"
58
+ "gitHead": "24bf96d532eea5f526136bbcab12b66f3210b61a"
60
59
  }