@ng-doc/builder 21.0.5 → 21.1.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.
@@ -7,6 +7,7 @@ const rxjs_1 = require("rxjs");
7
7
  const operators_1 = require("rxjs/operators");
8
8
  const build_ng_doc_1 = require("../engine/build-ng-doc");
9
9
  const transform_index_html_1 = require("../engine/transform-index-html");
10
+ const variables_1 = require("../engine/variables");
10
11
  const create_builder_context_1 = require("../helpers/create-builder-context");
11
12
  /**
12
13
  * Attach NgDocWebpackPlugin before Angular Plugins
@@ -22,6 +23,10 @@ async function runBrowser(options, context) {
22
23
  ? await context.getTargetOptions(browserTarget)
23
24
  : options;
24
25
  const builderContext = (0, create_builder_context_1.createBuilderContext)(targetOptions, context, options.ngDoc?.config);
26
+ // In a one-shot build there is nothing to watch, and the file watcher would
27
+ // crawl the whole workspace only to be torn down right after the first build,
28
+ // potentially keeping the process alive (see #333)
29
+ variables_1.GLOBALS.watch = !!options.watch;
25
30
  const runner = (0, build_ng_doc_1.buildNgDoc)(builderContext);
26
31
  await (0, rxjs_1.firstValueFrom)(runner.pipe((0, operators_1.first)()));
27
32
  return (0, rxjs_1.firstValueFrom)((0, architect_1.fromAsyncIterable)((0, build_angular_1.buildApplication)(options, context, { indexHtmlTransformer: transform_index_html_1.transformIndexHtml })));
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../libs/builder/application/index.ts"],"names":[],"mappings":";;AAsBA,gCAqBC;AA3CD,yDAMmC;AACnC,iEAAiE;AACjE,+BAAkD;AAClD,8CAAuC;AAEvC,yDAAoD;AACpD,yEAAoE;AACpE,8EAAyE;AAGzE;;;;;GAKG;AACI,KAAK,UAAU,UAAU,CAAC,OAAoB,EAAE,OAAuB;IAC5E,MAAM,aAAa,GAAkB,OAAO,CAAC,WAAW;QACtD,CAAC,CAAC,IAAA,kCAAsB,EAAC,OAAO,CAAC,WAAW,CAAC;QAC7C,CAAC,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C9D,aAAa,EACb,OAAO,EACP,OAAO,CAAC,KAAK,EAAE,MAAM,CACtB,CAAC;IAEF,4EAA4E;IAC5E,8EAA8E;IAC9E,mDAAmD;IACnD,mBAAO,CAAC,KAAK,GAAG,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC;IAEhC,MAAM,MAAM,GAAqB,IAAA,yBAAU,EAAC,cAAc,CAAC,CAAC;IAE5D,MAAM,IAAA,qBAAc,EAAC,MAAM,CAAC,IAAI,CAAC,IAAA,iBAAK,GAAE,CAAC,CAAC,CAAC;IAE3C,OAAO,IAAA,qBAAc,EACnB,IAAA,6BAAiB,EACf,IAAA,gCAAgB,EAAC,OAAc,EAAE,OAAO,EAAE,EAAE,oBAAoB,EAAE,yCAAkB,EAAE,CAAC,CACxF,CACF,CAAC;AACJ,CAAC;AAED,6DAA6D;AAC7D,aAAa;AACb,kBAAe,IAAA,yBAAa,EAAC,UAAU,CAAC,CAAC"}
@@ -52,6 +52,14 @@
52
52
  "type": "object",
53
53
  "additionalProperties": false,
54
54
  "properties": {
55
+ "allowedHosts": {
56
+ "description": "A list of hostnames that are allowed to access the server-side application. For more information, see https://angular.dev/best-practices/security#preventing-server-side-request-forgery-ssrf.",
57
+ "type": "array",
58
+ "uniqueItems": true,
59
+ "items": {
60
+ "type": "string"
61
+ }
62
+ },
55
63
  "autoCsp": {
56
64
  "description": "Enables automatic generation of a hash-based Strict Content Security Policy (https://web.dev/articles/strict-csp#choose-hash) based on scripts in index.html. Will default to true once we are out of experimental/preview phases.",
57
65
  "default": false,
@@ -634,8 +642,8 @@
634
642
  "type": "string",
635
643
  "description": "The server entry-point that when executed will spawn the web server."
636
644
  },
637
- "experimentalPlatform": {
638
- "description": "Specifies the platform for which the server bundle is generated. This affects the APIs and modules available in the server-side code. \n\n- `node`: (Default) Generates a bundle optimized for Node.js environments. \n- `neutral`: Generates a platform-neutral bundle suitable for environments like edge workers, and other serverless platforms. This option avoids using Node.js-specific APIs, making the bundle more portable. \n\nPlease note that this feature does not provide polyfills for Node.js modules. Additionally, it is experimental, and the schematics may undergo changes in future versions.",
645
+ "platform": {
646
+ "description": "Specifies the platform for which the server bundle is generated. This affects the APIs and modules available in the server-side code. \n\n- `node`: (Default) Generates a bundle optimized for Node.js environments. \n- `neutral`: Generates a platform-neutral bundle suitable for environments like edge workers, and other serverless platforms. This option avoids using Node.js-specific APIs, making the bundle more portable. \n\nPlease note that this feature does not provide polyfills for Node.js modules.",
639
647
  "default": "node",
640
648
  "enum": [
641
649
  "node",
@@ -14,9 +14,15 @@ let WATCHER = null;
14
14
  * @param dir
15
15
  */
16
16
  function watch(path, dir) {
17
+ // One-shot builds don't need to react to file changes, so the watcher
18
+ // is not started at all to let the process exit as soon as the build is done
19
+ if (!builder_1.GLOBALS.watch) {
20
+ return rxjs_1.NEVER;
21
+ }
17
22
  path = (0, path_1.resolve)(path);
18
23
  if (!WATCHER) {
19
24
  let unsubscribe = () => { };
25
+ let disposed = false;
20
26
  WATCHER = new rxjs_1.Observable((subscriber) => {
21
27
  watcher
22
28
  .subscribe(builder_1.GLOBALS.workspaceRoot, (err, events) => {
@@ -27,8 +33,20 @@ function watch(path, dir) {
27
33
  }
28
34
  subscriber.next(events);
29
35
  }, { ignore: ['node_modules'] })
30
- .then((unsub) => (unsubscribe = unsub.unsubscribe));
36
+ .then((unsub) => {
37
+ // The teardown may run before this promise resolves (e.g. a one-shot build
38
+ // that finishes while the watcher is still crawling the workspace);
39
+ // in that case the subscription must be closed here, otherwise it keeps
40
+ // the process alive forever (see #333)
41
+ if (disposed) {
42
+ unsub.unsubscribe();
43
+ }
44
+ else {
45
+ unsubscribe = unsub.unsubscribe;
46
+ }
47
+ });
31
48
  return () => {
49
+ disposed = true;
32
50
  unsubscribe();
33
51
  WATCHER = null;
34
52
  };
@@ -1 +1 @@
1
- {"version":3,"file":"watch.js","sourceRoot":"","sources":["../../../../../../libs/builder/engine/core/watcher/watch.ts"],"names":[],"mappings":";;AAaA,sBAuCC;;AApDD,6CAA0C;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,EAAE;gBACd,2EAA2E;gBAC3E,oEAAoE;gBACpE,wEAAwE;gBACxE,uCAAuC;gBACvC,IAAI,QAAQ,EAAE,CAAC;oBACb,KAAK,CAAC,WAAW,EAAE,CAAC;gBACtB,CAAC;qBAAM,CAAC;oBACN,WAAW,GAAG,KAAK,CAAC,WAAW,CAAC;gBAClC,CAAC;YACH,CAAC,CAAC,CAAC;YAEL,OAAO,GAAG,EAAE;gBACV,QAAQ,GAAG,IAAI,CAAC;gBAChB,WAAW,EAAE,CAAC;gBACd,OAAO,GAAG,IAAI,CAAC;YACjB,CAAC,CAAC;QACJ,CAAC,CAAC,CAAC,IAAI,CAAC,IAAA,iBAAK,GAAE,CAAC,CAAC;IACnB,CAAC;IAED,OAAO,OAAO,CAAC,IAAI,CACjB,IAAA,eAAG,EAAC,CAAC,MAAM,EAAE,EAAE,CACb,MAAM,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE;QACtB,OAAO,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IACvE,CAAC,CAAC,CACH,EACD,IAAA,kBAAM,EAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CACtC,CAAC;AACJ,CAAC"}
@@ -1,5 +1,6 @@
1
1
  export declare const GLOBALS: {
2
2
  workspaceRoot: string;
3
+ watch: boolean;
3
4
  relative: (p: string) => string;
4
5
  };
5
6
  export declare const PAGE_NAME: string;
@@ -5,6 +5,7 @@ const tslib_1 = require("tslib");
5
5
  const path = tslib_1.__importStar(require("path"));
6
6
  exports.GLOBALS = {
7
7
  workspaceRoot: '',
8
+ watch: true,
8
9
  relative: (p) => path.relative(exports.GLOBALS.workspaceRoot, p),
9
10
  };
10
11
  exports.PAGE_NAME = 'ng-doc.page.ts';
@@ -1 +1 @@
1
- {"version":3,"file":"variables.js","sourceRoot":"","sources":["../../../../libs/builder/engine/variables.ts"],"names":[],"mappings":";;;;AAAA,mDAA6B;AAEhB,QAAA,OAAO,GAAG;IACtB,aAAa,EAAE,EAAE;IACjB,QAAQ,EAAE,CAAC,CAAS,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,eAAO,CAAC,aAAa,EAAE,CAAC,CAAC;CAChE,CAAC;AACW,QAAA,SAAS,GAAW,gBAAgB,CAAC;AACrC,QAAA,aAAa,GAAW,oBAAoB,CAAC;AAC7C,QAAA,QAAQ,GAAW,eAAe,CAAC;AAEnC,QAAA,YAAY,GAAW,MAAM,iBAAS,EAAE,CAAC;AACzC,QAAA,gBAAgB,GAAW,MAAM,qBAAa,EAAE,CAAC;AACjD,QAAA,WAAW,GAAW,MAAM,gBAAQ,EAAE,CAAC;AACvC,QAAA,UAAU,GAAW,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;AACpD,QAAA,cAAc,GAAW,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC"}
1
+ {"version":3,"file":"variables.js","sourceRoot":"","sources":["../../../../libs/builder/engine/variables.ts"],"names":[],"mappings":";;;;AAAA,mDAA6B;AAEhB,QAAA,OAAO,GAAG;IACrB,aAAa,EAAE,EAAE;IACjB,KAAK,EAAE,IAAI;IACX,QAAQ,EAAE,CAAC,CAAS,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,eAAO,CAAC,aAAa,EAAE,CAAC,CAAC;CACjE,CAAC;AACW,QAAA,SAAS,GAAW,gBAAgB,CAAC;AACrC,QAAA,aAAa,GAAW,oBAAoB,CAAC;AAC7C,QAAA,QAAQ,GAAW,eAAe,CAAC;AAEnC,QAAA,YAAY,GAAW,MAAM,iBAAS,EAAE,CAAC;AACzC,QAAA,gBAAgB,GAAW,MAAM,qBAAa,EAAE,CAAC;AACjD,QAAA,WAAW,GAAW,MAAM,gBAAQ,EAAE,CAAC;AACvC,QAAA,UAAU,GAAW,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;AACpD,QAAA,cAAc,GAAW,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC"}
@@ -1,6 +1,7 @@
1
1
  export interface NgDocSchema {
2
2
  buildTarget: string;
3
3
  main: string;
4
+ watch?: boolean;
4
5
  ngDoc: {
5
6
  config: string;
6
7
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ng-doc/builder",
3
- "version": "21.0.5",
3
+ "version": "21.1.0",
4
4
  "type": "commonjs",
5
5
  "builders": "./builders.json",
6
6
  "schematics": "./schematics/collection.json",
@@ -11,10 +11,10 @@
11
11
  ]
12
12
  },
13
13
  "dependencies": {
14
- "@ng-doc/core": "21.0.5",
15
- "@ng-doc/utils": "21.0.5",
16
- "@angular-devkit/architect": ">=0.2100.0 < 0.2200.0",
17
- "@angular-devkit/build-angular": ">=21.0.0 < 22.0.0",
14
+ "@ng-doc/core": "21.1.0",
15
+ "@ng-doc/utils": "21.1.0",
16
+ "@angular-devkit/architect": ">=0.2200.0 < 0.2300.0",
17
+ "@angular-devkit/build-angular": ">=22.0.0 < 23.0.0",
18
18
  "minimatch": "9.0.1",
19
19
  "rxjs": "^7.0.0",
20
20
  "ts-morph": "22.0.0",
@@ -42,7 +42,7 @@
42
42
  },
43
43
  "overrides": {
44
44
  "nunjucks": {
45
- "chokidar": "^4.0.0"
45
+ "chokidar": "^5.0.0"
46
46
  }
47
47
  },
48
48
  "types": "./index.d.ts",