@angular-builders/custom-esbuild 17.1.3-beta.1 → 18.0.0-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.
- package/README.md +11 -23
- package/dist/application/index.d.ts +2 -6
- package/dist/application/schema.json +2 -2
- package/package.json +8 -8
- package/LICENSE +0 -21
package/README.md
CHANGED
|
@@ -30,7 +30,7 @@ Allow customizing ESBuild configuration
|
|
|
30
30
|
|
|
31
31
|
## Prerequisites:
|
|
32
32
|
|
|
33
|
-
- [Angular CLI
|
|
33
|
+
- [Angular CLI 18](https://www.npmjs.com/package/@angular/cli)
|
|
34
34
|
|
|
35
35
|
# Usage
|
|
36
36
|
|
|
@@ -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
|
-
(
|
|
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
|
-
|
|
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 = (
|
|
217
|
+
module.exports = (indexHtml) => {
|
|
225
218
|
const i = indexHtml.indexOf('</body>');
|
|
226
|
-
const
|
|
219
|
+
const content = `<p>Dynamically inserted content</p>`;
|
|
227
220
|
return `${indexHtml.slice(0, i)}
|
|
228
|
-
${
|
|
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
|
-
|
|
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
|
|
231
|
+
const content = `<p>Dynamically inserted content</p>`;
|
|
244
232
|
return `${indexHtml.slice(0, i)}
|
|
245
|
-
${
|
|
233
|
+
${content}
|
|
246
234
|
${indexHtml.slice(i)}`;
|
|
247
235
|
};
|
|
248
236
|
```
|
|
249
237
|
|
|
250
|
-
In the example we add a paragraph with
|
|
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
|
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import { BuilderContext } from '@angular-devkit/architect';
|
|
2
|
-
import { json } from '@angular-devkit/core';
|
|
3
2
|
import { CustomEsbuildApplicationSchema } from '../custom-esbuild-schema';
|
|
4
|
-
export declare function buildCustomEsbuildApplication(options: CustomEsbuildApplicationSchema, context: BuilderContext): import("rxjs").Observable<
|
|
5
|
-
declare const _default: import("@angular-devkit/architect/src/internal").Builder<
|
|
6
|
-
plugins?: string[];
|
|
7
|
-
indexHtmlTransformer?: string;
|
|
8
|
-
}>;
|
|
3
|
+
export declare function buildCustomEsbuildApplication(options: CustomEsbuildApplicationSchema, context: BuilderContext): import("rxjs").Observable<any>;
|
|
4
|
+
declare const _default: import("@angular-devkit/architect/src/internal").Builder<any>;
|
|
9
5
|
export default _default;
|
|
@@ -615,14 +615,14 @@
|
|
|
615
615
|
},
|
|
616
616
|
"output": {
|
|
617
617
|
"type": "string",
|
|
618
|
+
"default": "",
|
|
618
619
|
"description": "Absolute path within the output."
|
|
619
620
|
}
|
|
620
621
|
},
|
|
621
622
|
"additionalProperties": false,
|
|
622
623
|
"required": [
|
|
623
624
|
"glob",
|
|
624
|
-
"input"
|
|
625
|
-
"output"
|
|
625
|
+
"input"
|
|
626
626
|
]
|
|
627
627
|
},
|
|
628
628
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular-builders/custom-esbuild",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "18.0.0-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,20 +39,20 @@
|
|
|
39
39
|
},
|
|
40
40
|
"builders": "builders.json",
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@angular-builders/common": "
|
|
43
|
-
"@angular-devkit/architect": ">=0.
|
|
44
|
-
"@angular-devkit/build-angular": "^
|
|
45
|
-
"@angular-devkit/core": "^
|
|
42
|
+
"@angular-builders/common": "workspace:*",
|
|
43
|
+
"@angular-devkit/architect": ">=0.1800.0 < 0.1900.0",
|
|
44
|
+
"@angular-devkit/build-angular": "^18.0.0",
|
|
45
|
+
"@angular-devkit/core": "^18.0.0"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
|
-
"@angular/compiler-cli": "^
|
|
48
|
+
"@angular/compiler-cli": "^18.0.0"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
+
"@angular/build": "^18.0.0",
|
|
51
52
|
"esbuild": "0.20.2",
|
|
52
53
|
"jest": "29.7.0",
|
|
53
54
|
"rimraf": "^5.0.0",
|
|
54
55
|
"ts-node": "^10.0.0",
|
|
55
56
|
"typescript": "5.4.5"
|
|
56
|
-
}
|
|
57
|
-
"gitHead": "87bbc86d04e86b6f6da53f317bce9b7e6503d981"
|
|
57
|
+
}
|
|
58
58
|
}
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2018 Evgeny Barabanov
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|