@angular-builders/custom-esbuild 17.1.3-beta.0 → 17.1.3-beta.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.
Files changed (2) hide show
  1. package/README.md +10 -22
  2. package/package.json +4 -4
package/README.md CHANGED
@@ -187,19 +187,12 @@ The `@angular-builders/custom-esbuild:dev-server` is an enhanced version of the
187
187
  Since Angular 8, `index.html` is not generated as part of the build. If you want to modify your `index.html`, you should use the `indexHtmlTransformer` option. `indexHtmlTransformer` is a path (relative to the workspace root) to a `.js` or `.ts` file that exports a transformation function for `index.html`. If `indexHtmlTransformer` is written in TypeScript, the application's `tsConfig` file will be used by `tsnode` for its execution:
188
188
 
189
189
  ```typescript
190
- (options: TargetOptions, indexHtmlContent: string) => string | Promise<string>;
190
+ (indexHtmlContent: string) => string | Promise<string>;
191
191
  ```
192
192
 
193
- or, in other words, the function receives target options and original `index.html` content (generated by Angular CLI) and returns a new content as `string` or `Promise<string>`.
194
- `TargetOptions` follows `target` definition from [this](https://github.com/angular/angular-cli/blob/master/packages/angular_devkit/architect/src/input-schema.json) schema and looks like this:
193
+ or, in other words, the function receives target options and original `index.html` content (generated by Angular CLI) and returns a new content as `string` or `Promise<string>`.
195
194
 
196
- ```typescript
197
- export interface Target {
198
- configuration?: string;
199
- project: string;
200
- target: string;
201
- }
202
- ```
195
+ The `indexHtmlTransformer` function signature is defined [here](https://github.com/angular/angular-cli/blob/7cedcc815c2b4ccdb354a89959fa9f19dc08e9fa/packages/angular/build/src/utils/index-file/index-html-generator.ts#L47).
203
196
 
204
197
  It is useful when you want to transform your `index.html` according to the build options.
205
198
 
@@ -221,11 +214,11 @@ It is useful when you want to transform your `index.html` according to the build
221
214
  `index-html-transformer.js`:
222
215
 
223
216
  ```js
224
- module.exports = (targetOptions, indexHtml) => {
217
+ module.exports = (indexHtml) => {
225
218
  const i = indexHtml.indexOf('</body>');
226
- const config = `<p>Configuration: ${targetOptions.configuration}</p>`;
219
+ const content = `<p>Dynamically inserted content</p>`;
227
220
  return `${indexHtml.slice(0, i)}
228
- ${config}
221
+ ${content}
229
222
  ${indexHtml.slice(i)}`;
230
223
  };
231
224
  ```
@@ -233,21 +226,16 @@ module.exports = (targetOptions, indexHtml) => {
233
226
  Alternatively, using TypeScript:
234
227
 
235
228
  ```ts
236
- import { Target } from '@angular-devkit/architect/src/input-schema';
237
- import { json } from '@angular-devkit/core';
238
-
239
- type TargetOptions = json.JsonObject & Target;
240
-
241
- export default (targetOptions: TargetOptions, indexHtml: string) => {
229
+ export default (indexHtml: string) => {
242
230
  const i = indexHtml.indexOf('</body>');
243
- const config = `<p>Configuration: ${targetOptions.configuration}</p>`;
231
+ const content = `<p>Dynamically inserted content</p>`;
244
232
  return `${indexHtml.slice(0, i)}
245
- ${config}
233
+ ${content}
246
234
  ${indexHtml.slice(i)}`;
247
235
  };
248
236
  ```
249
237
 
250
- In the example we add a paragraph with build configuration to your `index.html`. It is a very simple example without any asynchronous code but you can also return a `Promise` from this function.
238
+ In the example we add a paragraph with an example content to your `index.html`. It is a very simple example without any asynchronous code but you can also return a `Promise` from this function.
251
239
 
252
240
  # ES Modules (ESM) Support
253
241
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular-builders/custom-esbuild",
3
- "version": "17.1.3-beta.0",
3
+ "version": "17.1.3-beta.2",
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": [
@@ -39,7 +39,7 @@
39
39
  },
40
40
  "builders": "builders.json",
41
41
  "dependencies": {
42
- "@angular-builders/common": "1.0.3-beta.0",
42
+ "@angular-builders/common": "1.0.3-beta.1",
43
43
  "@angular-devkit/architect": ">=0.1701.0 < 0.1800.0",
44
44
  "@angular-devkit/build-angular": "^17.1.0",
45
45
  "@angular-devkit/core": "^17.1.0"
@@ -52,7 +52,7 @@
52
52
  "jest": "29.7.0",
53
53
  "rimraf": "^5.0.0",
54
54
  "ts-node": "^10.0.0",
55
- "typescript": "5.4.4"
55
+ "typescript": "5.4.5"
56
56
  },
57
- "gitHead": "b1690d2bd6a6584d9844988359214ad0d45a6baf"
57
+ "gitHead": "ab6ec5af02c207a8e2d6afa12030f405e41d4df0"
58
58
  }