@angular-builders/custom-webpack 13.0.1-beta.2 → 14.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
@@ -11,6 +11,7 @@ Allow customizing build configuration without ejecting webpack configuration (`n
11
11
  <details>
12
12
  <summary>Click to expand</summary>
13
13
 
14
+ - [Version 13](https://github.com/just-jeb/angular-builders/blob/13.x.x/packages/custom-webpack/README.md)
14
15
  - [Version 12](https://github.com/just-jeb/angular-builders/blob/12.x.x/packages/custom-webpack/README.md)
15
16
  - [Version 11](https://github.com/just-jeb/angular-builders/blob/11.x.x/packages/custom-webpack/README.md)
16
17
  - [Version 10](https://github.com/just-jeb/angular-builders/blob/10.x.x/packages/custom-webpack/README.md)
@@ -24,7 +25,7 @@ Allow customizing build configuration without ejecting webpack configuration (`n
24
25
 
25
26
  ## Prerequisites:
26
27
 
27
- - [Angular CLI 13](https://www.npmjs.com/package/@angular/cli)
28
+ - [Angular CLI 14](https://www.npmjs.com/package/@angular/cli)
28
29
 
29
30
  # Usage
30
31
 
@@ -287,7 +288,7 @@ The following properties are available:
287
288
  - `replaceDuplicatePlugins`: Defaults to `false`. If `true`, the plugins in custom webpack config will replace the corresponding plugins in default Angular CLI webpack configuration. If `false`, the [default behavior](#merging-plugins-configuration) will be applied.
288
289
  **Note that if `true`, this option will override `mergeRules` for `plugins` field.**
289
290
 
290
- Webpack configuration can be also written in TypeScript. In this case, it is the application's `tsConfig` file which will be use by `tsnode` for `customWebpackConfig.ts` execution. Given the following example:
291
+ Webpack configuration can be also written in TypeScript. In this case, it is the application's `tsConfig` file which will be used by `tsnode` for `customWebpackConfig.ts` execution. Given the following example:
291
292
 
292
293
  ```ts
293
294
  // extra-webpack.config.ts
@@ -494,6 +495,15 @@ In the example we add a paragraph with build configuration to your `index.html`.
494
495
 
495
496
  Full example [here](../../examples/custom-webpack/full-cycle-app).
496
497
 
498
+ # ES Modules (ESM) Support
499
+
500
+ Custom Webpack builder fully supports ESM.
501
+
502
+ - If your app has `"type": "module"` both `custom-webpack.js` and `index-transform.js` will be treated as ES modules, unless you change their file extension to `.cjs`. In that case they'll be treated as CommonJS Modules. [Example](../../examples/custom-webpack/sanity-app-esm).
503
+ - For `"type": "commonjs"` (or unspecified type) both `custom-webpack.js` and `index-transform.js` will be treated as CommonJS modules unless you change their file extension to `.mjs`. In that case they'll be treated as ES Modules. [Example](../../examples/custom-webpack/sanity-app).
504
+ - If you want to use TS config in ESM app, you must set the loader to `ts-node/esm` when running `ng build`. Also, in that case `tsconfig.json` for `ts-node` no longer defaults to `tsConfig` from the `browser` target - you have to specify it manually via environment variable. [Example](../../examples/custom-webpack/sanity-app-esm/package.json#L10).
505
+ _Note that tsconfig paths are not supported in TS configs within ESM apps. That is because [tsconfig-paths](https://github.com/dividab/tsconfig-paths) do not support ESM._
506
+
497
507
  # Further Reading
498
508
 
499
509
  - [Customizing Angular CLI build - an alternative to ng eject](https://medium.com/angular-in-depth/customizing-angular-cli-build-an-alternative-to-ng-eject-v2-c655768b48cc)
@@ -29,7 +29,37 @@
29
29
  "type": "array",
30
30
  "default": [],
31
31
  "items": {
32
- "$ref": "#/definitions/extraEntryPoint"
32
+ "oneOf": [
33
+ {
34
+ "type": "object",
35
+ "properties": {
36
+ "input": {
37
+ "type": "string",
38
+ "description": "The file to include.",
39
+ "pattern": "\\.[cm]?jsx?$"
40
+ },
41
+ "bundleName": {
42
+ "type": "string",
43
+ "pattern": "^[\\w\\-.]*$",
44
+ "description": "The bundle name for this extra entry point."
45
+ },
46
+ "inject": {
47
+ "type": "boolean",
48
+ "description": "If the bundle will be referenced in the HTML file.",
49
+ "default": true
50
+ }
51
+ },
52
+ "additionalProperties": false,
53
+ "required": [
54
+ "input"
55
+ ]
56
+ },
57
+ {
58
+ "type": "string",
59
+ "description": "The file to include.",
60
+ "pattern": "\\.[cm]?jsx?$"
61
+ }
62
+ ]
33
63
  }
34
64
  },
35
65
  "styles": {
@@ -37,7 +67,37 @@
37
67
  "type": "array",
38
68
  "default": [],
39
69
  "items": {
40
- "$ref": "#/definitions/extraEntryPoint"
70
+ "oneOf": [
71
+ {
72
+ "type": "object",
73
+ "properties": {
74
+ "input": {
75
+ "type": "string",
76
+ "description": "The file to include.",
77
+ "pattern": "\\.(?:css|scss|sass|less|styl)$"
78
+ },
79
+ "bundleName": {
80
+ "type": "string",
81
+ "pattern": "^[\\w\\-.]*$",
82
+ "description": "The bundle name for this extra entry point."
83
+ },
84
+ "inject": {
85
+ "type": "boolean",
86
+ "description": "If the bundle will be referenced in the HTML file.",
87
+ "default": true
88
+ }
89
+ },
90
+ "additionalProperties": false,
91
+ "required": [
92
+ "input"
93
+ ]
94
+ },
95
+ {
96
+ "type": "string",
97
+ "description": "The file to include.",
98
+ "pattern": "\\.(?:css|scss|sass|less|styl)$"
99
+ }
100
+ ]
41
101
  }
42
102
  },
43
103
  "inlineStyleLanguage": {
@@ -142,12 +202,11 @@
142
202
  },
143
203
  "outputPath": {
144
204
  "type": "string",
145
- "description": "The full path for the new output directory, relative to the current workspace.\n\nBy default, writes output to a folder named dist/ in the current project."
205
+ "description": "The full path for the new output directory, relative to the current workspace.\nBy default, writes output to a folder named dist/ in the current project."
146
206
  },
147
207
  "resourcesOutputPath": {
148
208
  "type": "string",
149
- "description": "The path where style resources will be placed, relative to outputPath.",
150
- "default": ""
209
+ "description": "The path where style resources will be placed, relative to outputPath."
151
210
  },
152
211
  "aot": {
153
212
  "type": "boolean",
@@ -229,6 +288,16 @@
229
288
  ],
230
289
  "default": "warning"
231
290
  },
291
+ "i18nDuplicateTranslation": {
292
+ "type": "string",
293
+ "description": "How to handle duplicate translations for i18n.",
294
+ "enum": [
295
+ "warning",
296
+ "error",
297
+ "ignore"
298
+ ],
299
+ "default": "warning"
300
+ },
232
301
  "localize": {
233
302
  "description": "Translate the bundles in one or more locales.",
234
303
  "oneOf": [
@@ -281,15 +350,9 @@
281
350
  "description": "Extract all licenses in a separate file.",
282
351
  "default": true
283
352
  },
284
- "showCircularDependencies": {
285
- "type": "boolean",
286
- "description": "Show circular dependency warnings on builds.",
287
- "default": false,
288
- "x-deprecated": "The recommended method to detect circular dependencies in project code is to use either a lint rule or other external tooling."
289
- },
290
353
  "buildOptimizer": {
291
354
  "type": "boolean",
292
- "description": "Enables '@angular-devkit/build-optimizer' optimizations when using the 'aot' option.",
355
+ "description": "Enables advanced build optimizations when using the 'aot' option.",
293
356
  "default": true
294
357
  },
295
358
  "namedChunks": {
@@ -496,37 +559,6 @@
496
559
  }
497
560
  ]
498
561
  },
499
- "extraEntryPoint": {
500
- "oneOf": [
501
- {
502
- "type": "object",
503
- "properties": {
504
- "input": {
505
- "type": "string",
506
- "description": "The file to include."
507
- },
508
- "bundleName": {
509
- "type": "string",
510
- "pattern": "^[\\w\\-.]*$",
511
- "description": "The bundle name for this extra entry point."
512
- },
513
- "inject": {
514
- "type": "boolean",
515
- "description": "If the bundle will be referenced in the HTML file.",
516
- "default": true
517
- }
518
- },
519
- "additionalProperties": false,
520
- "required": [
521
- "input"
522
- ]
523
- },
524
- {
525
- "type": "string",
526
- "description": "The file to include."
527
- }
528
- ]
529
- },
530
562
  "budget": {
531
563
  "type": "object",
532
564
  "properties": {
@@ -1,4 +1,4 @@
1
- import { Path, logging } from '@angular-devkit/core';
1
+ import { logging, Path } from '@angular-devkit/core';
2
2
  import { Configuration } from 'webpack';
3
3
  import { CustomWebpackBuilderConfig } from './custom-webpack-builder-config';
4
4
  import { TargetOptions } from './type-definition';
@@ -11,8 +11,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.CustomWebpackBuilder = exports.defaultWebpackConfigPath = void 0;
13
13
  const core_1 = require("@angular-devkit/core");
14
- const webpack_config_merger_1 = require("./webpack-config-merger");
15
14
  const utils_1 = require("./utils");
15
+ const webpack_config_merger_1 = require("./webpack-config-merger");
16
16
  exports.defaultWebpackConfigPath = 'webpack.config.js';
17
17
  class CustomWebpackBuilder {
18
18
  static buildWebpackConfig(root, config, baseWebpackConfig, buildOptions, targetOptions, logger) {
@@ -23,7 +23,7 @@ class CustomWebpackBuilder {
23
23
  const webpackConfigPath = config.path || exports.defaultWebpackConfigPath;
24
24
  const path = `${(0, core_1.getSystemPath)(root)}/${webpackConfigPath}`;
25
25
  const tsConfig = `${(0, core_1.getSystemPath)(root)}/${buildOptions.tsConfig}`;
26
- const configOrFactoryOrPromise = resolveCustomWebpackConfig(path, tsConfig, logger);
26
+ const configOrFactoryOrPromise = yield resolveCustomWebpackConfig(path, tsConfig, logger);
27
27
  if (typeof configOrFactoryOrPromise === 'function') {
28
28
  // That exported function can be synchronous either
29
29
  // asynchronous. Given the following example:
@@ -43,13 +43,9 @@ class CustomWebpackBuilder {
43
43
  }
44
44
  exports.CustomWebpackBuilder = CustomWebpackBuilder;
45
45
  function resolveCustomWebpackConfig(path, tsConfig, logger) {
46
- (0, utils_1.tsNodeRegister)(path, tsConfig, logger);
47
- const customWebpackConfig = require(path);
48
- // If the user provides a configuration in TS file
49
- // then there are 2 cases for exporing an object. The first one is:
50
- // `module.exports = { ... }`. And the second one is:
51
- // `export default { ... }`. The ESM format is compiled into:
52
- // `{ default: { ... } }`
53
- return customWebpackConfig.default || customWebpackConfig;
46
+ return __awaiter(this, void 0, void 0, function* () {
47
+ (0, utils_1.tsNodeRegister)(path, tsConfig, logger);
48
+ return (0, utils_1.loadModule)(path);
49
+ });
54
50
  }
55
51
  //# sourceMappingURL=custom-webpack-builder.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"custom-webpack-builder.js","sourceRoot":"","sources":["../src/custom-webpack-builder.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+CAAoE;AAGpE,mEAAuD;AAEvD,mCAAyC;AAI5B,QAAA,wBAAwB,GAAG,mBAAmB,CAAC;AAgB5D,MAAa,oBAAoB;IAC/B,MAAM,CAAO,kBAAkB,CAC7B,IAAU,EACV,MAAkC,EA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AgB,EAChB,MAAyB;;QAEzB,IAAA,sBAAc,EAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;QAEvC,OAAO,IAAA,kBAAU,EAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;CAAA"}
@@ -1,2 +1,3 @@
1
- declare const _default: import("@angular-devkit/architect/src/internal").Builder<import("@angular-devkit/build-angular/src/builders/dev-server/schema").Schema & import("@angular-devkit/core").JsonObject>;
1
+ import { json } from '@angular-devkit/core';
2
+ declare const _default: import("@angular-devkit/architect/src/internal").Builder<import("@angular-devkit/build-angular/src/builders/dev-server/schema").Schema & json.JsonObject>;
2
3
  export default _default;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/dev-server/index.ts"],"names":[],"mappings":";;AAAA,yDAA0D;AAC1D,iEAAiG;AACjG,wEAAwE;AAExE,kBAAe,IAAA,yBAAa,EAC1B,IAAA,oDAA0B,EAAC,uCAAuB,CAAC,CACpD,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/dev-server/index.ts"],"names":[],"mappings":";;AAAA,yDAA0D;AAC1D,iEAAiG;AAEjG,wEAAwE;AAExE,kBAAe,IAAA,yBAAa,EAC1B,IAAA,oDAA0B,EAAC,uCAAuB,CAAC,CACpD,CAAC"}
@@ -75,7 +75,7 @@
75
75
  },
76
76
  "servePath": {
77
77
  "type": "string",
78
- "description": "The pathname where the app will be served."
78
+ "description": "The pathname where the application will be served."
79
79
  },
80
80
  "disableHostCheck": {
81
81
  "type": "boolean",
@@ -1,2 +1,3 @@
1
- declare const _default: import("@angular-devkit/architect/src/internal").Builder<import("@angular-devkit/build-angular/src/builders/extract-i18n/schema").Schema & import("@angular-devkit/core").JsonObject>;
1
+ import { json } from '@angular-devkit/core';
2
+ declare const _default: import("@angular-devkit/architect/src/internal").Builder<import("@angular-devkit/build-angular/src/builders/extract-i18n/schema").Schema & json.JsonObject>;
2
3
  export default _default;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/extract-i18n/index.ts"],"names":[],"mappings":";;AAAA,yDAA0D;AAC1D,iEAGuC;AACvC,wEAAwE;AAExE,kBAAe,IAAA,yBAAa,EAC1B,IAAA,oDAA0B,EAAC,yCAAyB,CAAC,CACtD,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/extract-i18n/index.ts"],"names":[],"mappings":";;AAAA,yDAA0D;AAC1D,iEAGuC;AAEvC,wEAAwE;AAExE,kBAAe,IAAA,yBAAa,EAC1B,IAAA,oDAA0B,EAAC,yCAAyB,CAAC,CACtD,CAAC"}
package/dist/index.js CHANGED
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[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);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;GAEG;AACH,4CAA0B;AAC1B,0CAAwB;AACxB,2CAAyB;AACzB,+CAA6B;AAC7B,iDAA+B;AAC/B,wDAAsC;AACtC,4DAA0C"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;;GAEG;AACH,4CAA0B;AAC1B,0CAAwB;AACxB,2CAAyB;AACzB,+CAA6B;AAC7B,iDAA+B;AAC/B,wDAAsC;AACtC,4DAA0C"}
@@ -33,7 +33,37 @@
33
33
  "type": "array",
34
34
  "default": [],
35
35
  "items": {
36
- "$ref": "#/definitions/extraEntryPoint"
36
+ "oneOf": [
37
+ {
38
+ "type": "object",
39
+ "properties": {
40
+ "input": {
41
+ "type": "string",
42
+ "description": "The file to include.",
43
+ "pattern": "\\.[cm]?jsx?$"
44
+ },
45
+ "bundleName": {
46
+ "type": "string",
47
+ "pattern": "^[\\w\\-.]*$",
48
+ "description": "The bundle name for this extra entry point."
49
+ },
50
+ "inject": {
51
+ "type": "boolean",
52
+ "description": "If the bundle will be referenced in the HTML file.",
53
+ "default": true
54
+ }
55
+ },
56
+ "additionalProperties": false,
57
+ "required": [
58
+ "input"
59
+ ]
60
+ },
61
+ {
62
+ "type": "string",
63
+ "description": "The file to include.",
64
+ "pattern": "\\.[cm]?jsx?$"
65
+ }
66
+ ]
37
67
  }
38
68
  },
39
69
  "styles": {
@@ -41,7 +71,37 @@
41
71
  "type": "array",
42
72
  "default": [],
43
73
  "items": {
44
- "$ref": "#/definitions/extraEntryPoint"
74
+ "oneOf": [
75
+ {
76
+ "type": "object",
77
+ "properties": {
78
+ "input": {
79
+ "type": "string",
80
+ "description": "The file to include.",
81
+ "pattern": "\\.(?:css|scss|sass|less|styl)$"
82
+ },
83
+ "bundleName": {
84
+ "type": "string",
85
+ "pattern": "^[\\w\\-.]*$",
86
+ "description": "The bundle name for this extra entry point."
87
+ },
88
+ "inject": {
89
+ "type": "boolean",
90
+ "description": "If the bundle will be referenced in the HTML file.",
91
+ "default": true
92
+ }
93
+ },
94
+ "additionalProperties": false,
95
+ "required": [
96
+ "input"
97
+ ]
98
+ },
99
+ {
100
+ "type": "string",
101
+ "description": "The file to include.",
102
+ "pattern": "\\.(?:css|scss|sass|less|styl)$"
103
+ }
104
+ ]
45
105
  }
46
106
  },
47
107
  "inlineStyleLanguage": {
@@ -75,7 +135,7 @@
75
135
  "items": {
76
136
  "type": "string"
77
137
  },
78
- "description": "Globs of files to include, relative to workspace or project root. \nThere are 2 special cases:\n - when a path to directory is provided, all spec files ending \".spec.@(ts|tsx)\" will be included\n - when a path to a file is provided, and a matching spec file exists it will be included instead"
138
+ "description": "Globs of files to include, relative to workspace or project root. \nThere are 2 special cases:\n - when a path to directory is provided, all spec files ending \".spec.@(ts|tsx)\" will be included\n - when a path to a file is provided, and a matching spec file exists it will be included instead."
79
139
  },
80
140
  "sourceMap": {
81
141
  "description": "Output source maps for scripts and styles. For more information, see https://angular.io/guide/workspace-config#source-map-configuration.",
@@ -267,37 +327,6 @@
267
327
  "type": "string"
268
328
  }
269
329
  ]
270
- },
271
- "extraEntryPoint": {
272
- "oneOf": [
273
- {
274
- "type": "object",
275
- "properties": {
276
- "input": {
277
- "type": "string",
278
- "description": "The file to include."
279
- },
280
- "bundleName": {
281
- "type": "string",
282
- "pattern": "^[\\w\\-.]*$",
283
- "description": "The bundle name for this extra entry point."
284
- },
285
- "inject": {
286
- "type": "boolean",
287
- "description": "If the bundle will be referenced in the HTML file.",
288
- "default": true
289
- }
290
- },
291
- "additionalProperties": false,
292
- "required": [
293
- "input"
294
- ]
295
- },
296
- {
297
- "type": "string",
298
- "description": "The file to include."
299
- }
300
- ]
301
330
  }
302
331
  },
303
332
  "$id": "BuildCustomWebpackKarmaSchema"
@@ -79,8 +79,7 @@
79
79
  },
80
80
  "resourcesOutputPath": {
81
81
  "type": "string",
82
- "description": "The path where style resources will be placed, relative to outputPath.",
83
- "default": ""
82
+ "description": "The path where style resources will be placed, relative to outputPath."
84
83
  },
85
84
  "sourceMap": {
86
85
  "description": "Output source maps for scripts and styles. For more information, see https://angular.io/guide/workspace-config#source-map-configuration.",
@@ -142,6 +141,16 @@
142
141
  ],
143
142
  "default": "warning"
144
143
  },
144
+ "i18nDuplicateTranslation": {
145
+ "type": "string",
146
+ "description": "How to handle duplicate translations for i18n.",
147
+ "enum": [
148
+ "warning",
149
+ "error",
150
+ "ignore"
151
+ ],
152
+ "default": "warning"
153
+ },
145
154
  "localize": {
146
155
  "description": "Translate the bundles in one or more locales.",
147
156
  "oneOf": [
@@ -185,12 +194,6 @@
185
194
  "description": "Extract all licenses in a separate file, in the case of production builds only.",
186
195
  "default": true
187
196
  },
188
- "showCircularDependencies": {
189
- "type": "boolean",
190
- "description": "Show circular dependency warnings on builds.",
191
- "default": false,
192
- "x-deprecated": "The recommended method to detect circular dependencies in project code is to use either a lint rule or other external tooling."
193
- },
194
197
  "namedChunks": {
195
198
  "type": "boolean",
196
199
  "description": "Use file name for lazy loaded chunks.",
@@ -21,9 +21,10 @@ const indexHtmlTransformFactory = ({ indexTransform, tsConfig }, { workspaceRoot
21
21
  if (!indexTransform)
22
22
  return null;
23
23
  (0, utils_1.tsNodeRegister)(indexTransform, `${(0, core_1.getSystemPath)((0, core_1.normalize)(workspaceRoot))}/${tsConfig}`, logger);
24
- const indexModule = require(`${(0, core_1.getSystemPath)((0, core_1.normalize)(workspaceRoot))}/${indexTransform}`);
25
- const transform = indexModule.default || indexModule;
26
- return (indexHtml) => __awaiter(void 0, void 0, void 0, function* () { return transform(target, indexHtml); });
24
+ return (indexHtml) => __awaiter(void 0, void 0, void 0, function* () {
25
+ const transform = yield (0, utils_1.loadModule)(`${(0, core_1.getSystemPath)((0, core_1.normalize)(workspaceRoot))}/${indexTransform}`);
26
+ return transform(target, indexHtml);
27
+ });
27
28
  };
28
29
  exports.indexHtmlTransformFactory = indexHtmlTransformFactory;
29
30
  const getTransforms = (options, context) => ({
@@ -1 +1 @@
1
- {"version":3,"file":"transform-factories.js","sourceRoot":"","sources":["../src/transform-factories.ts"],"names":[],"mappings":";;;;;;;;;;;;AAGA,+CAAgE;AAEhE,qEAAgE;AAEhE,mCAAyC;AAElC,MAAM,mCAAmC,GAI9C,CAAC,OAAO,EAAE,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,CAC/C,oBAAoB,CAAC,EAAE;IACrB,OAAO,6CAAoB,CAAC,kBAAkB,CAC5C,IAAA,gBAAS,EAAC,aAAa,CAAC,EACx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-node if file extension is TypeScript
6
6
  */
7
7
  export declare function tsNodeRegister(file: string, tsConfig: string, logger: logging.LoggerApi): void;
8
+ /**
9
+ * Loads CJS and ESM modules based on extension
10
+ * @param path path to the module
11
+ * @returns
12
+ */
13
+ export declare function loadModule<T>(path: string): Promise<T>;
package/dist/utils.js CHANGED
@@ -1,6 +1,17 @@
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
11
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.tsNodeRegister = void 0;
12
+ exports.loadModule = exports.tsNodeRegister = void 0;
13
+ const path_1 = require("path");
14
+ const url_1 = require("url");
4
15
  const _tsNodeRegister = (() => {
5
16
  let lastTsConfig;
6
17
  return (tsConfig, logger) => {
@@ -44,4 +55,70 @@ function tsNodeRegister(file = '', tsConfig, logger) {
44
55
  }
45
56
  }
46
57
  exports.tsNodeRegister = tsNodeRegister;
58
+ /**
59
+ * This uses a dynamic import to load a module which may be ESM.
60
+ * CommonJS code can load ESM code via a dynamic import. Unfortunately, TypeScript
61
+ * will currently, unconditionally downlevel dynamic import into a require call.
62
+ * require calls cannot load ESM code and will result in a runtime error. To workaround
63
+ * this, a Function constructor is used to prevent TypeScript from changing the dynamic import.
64
+ * Once TypeScript provides support for keeping the dynamic import this workaround can
65
+ * be dropped.
66
+ *
67
+ * @param modulePath The path of the module to load.
68
+ * @returns A Promise that resolves to the dynamically imported module.
69
+ */
70
+ function loadEsmModule(modulePath) {
71
+ return new Function('modulePath', `return import(modulePath);`)(modulePath);
72
+ }
73
+ /**
74
+ * Loads CJS and ESM modules based on extension
75
+ * @param path path to the module
76
+ * @returns
77
+ */
78
+ function loadModule(path) {
79
+ return __awaiter(this, void 0, void 0, function* () {
80
+ switch ((0, path_1.extname)(path)) {
81
+ case '.mjs':
82
+ // Load the ESM configuration file using the TypeScript dynamic import workaround.
83
+ // Once TypeScript provides support for keeping the dynamic import this workaround can be
84
+ // changed to a direct dynamic import.
85
+ return (yield loadEsmModule((0, url_1.pathToFileURL)(path))).default;
86
+ case '.cjs':
87
+ return require(path);
88
+ case '.ts':
89
+ try {
90
+ // If it's a TS file then there are 2 cases for exporing an object.
91
+ // The first one is `export blah`, transpiled into `module.exports = { blah} `.
92
+ // The second is `export default blah`, transpiled into `{ default: { ... } }`.
93
+ return require(path).default || require(path);
94
+ }
95
+ catch (e) {
96
+ if (e.code === 'ERR_REQUIRE_ESM') {
97
+ // Load the ESM configuration file using the TypeScript dynamic import workaround.
98
+ // Once TypeScript provides support for keeping the dynamic import this workaround can be
99
+ // changed to a direct dynamic import.
100
+ return (yield loadEsmModule((0, url_1.pathToFileURL)(path))).default;
101
+ }
102
+ throw e;
103
+ }
104
+ //.js
105
+ default:
106
+ // The file could be either CommonJS or ESM.
107
+ // CommonJS is tried first then ESM if loading fails.
108
+ try {
109
+ return require(path);
110
+ }
111
+ catch (e) {
112
+ if (e.code === 'ERR_REQUIRE_ESM') {
113
+ // Load the ESM configuration file using the TypeScript dynamic import workaround.
114
+ // Once TypeScript provides support for keeping the dynamic import this workaround can be
115
+ // changed to a direct dynamic import.
116
+ return (yield loadEsmModule((0, url_1.pathToFileURL)(path))).default;
117
+ }
118
+ throw e;
119
+ }
120
+ }
121
+ });
122
+ }
123
+ exports.loadModule = loadModule;
47
124
  //# sourceMappingURL=utils.js.map
package/dist/utils.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";;;AAEA,MAA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1
  {
2
2
  "name": "@angular-builders/custom-webpack",
3
- "version": "13.0.1-beta.2",
3
+ "version": "14.0.0-beta.0",
4
4
  "description": "Custom webpack 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": ">=12.20.0"
21
+ "node": "^14.15.0 || >=16.10.0"
22
22
  },
23
23
  "keywords": [
24
24
  "cli",
@@ -40,18 +40,21 @@
40
40
  },
41
41
  "builders": "builders.json",
42
42
  "dependencies": {
43
- "@angular-devkit/architect": ">=0.1300.0 < 0.1400.0",
44
- "@angular-devkit/build-angular": "^13.0.0",
45
- "@angular-devkit/core": "^13.0.0",
43
+ "@angular-devkit/architect": ">=0.1400.0 < 0.1500.0",
44
+ "@angular-devkit/build-angular": "^14.0.0",
45
+ "@angular-devkit/core": "^14.0.0",
46
46
  "lodash": "^4.17.15",
47
47
  "ts-node": "^10.0.0",
48
48
  "tsconfig-paths": "^3.9.0",
49
49
  "webpack-merge": "^5.7.3"
50
50
  },
51
+ "peerDependencies": {
52
+ "@angular/compiler-cli": "^14.0.0"
53
+ },
51
54
  "devDependencies": {
52
- "jest": "^27.4.7",
55
+ "jest": "28.1.0",
53
56
  "rimraf": "^3.0.2",
54
- "typescript": "^4.5.4"
57
+ "typescript": "4.6.4"
55
58
  },
56
- "gitHead": "e974d6362e233a00ff7e1e776ea9e7306eb89765"
59
+ "gitHead": "d12c683da0d6f577165367fe6c92250cae44ef58"
57
60
  }