@loozo/angular-launch 0.0.3 → 0.0.5

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.
@@ -0,0 +1,153 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema",
3
+ "$comment": "Generated by scripts/builder-schemas.mjs from the @angular/build 22.2.2 dev-server schema plus the Launch options. Do not edit. The @angular/build schema portions are distributed under this license:\n\nThe MIT License\n\nCopyright (c) 2010-2026 Google LLC. https://angular.dev/license\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.",
4
+ "title": "Dev Server Target",
5
+ "description": "Dev Server target options for Build Facade.",
6
+ "type": "object",
7
+ "properties": {
8
+ "buildTarget": {
9
+ "type": "string",
10
+ "description": "A target using @loozo/angular-launch:application, as project:target[:configuration]. Launch options come from it.",
11
+ "pattern": "^[^:\\s]*:[^:\\s]*(:[^\\s]+)?$"
12
+ },
13
+ "port": {
14
+ "type": "number",
15
+ "description": "Port to listen on.",
16
+ "default": 4200
17
+ },
18
+ "host": {
19
+ "type": "string",
20
+ "description": "Host to listen on.",
21
+ "default": "localhost"
22
+ },
23
+ "proxyConfig": {
24
+ "type": "string",
25
+ "description": "Proxy configuration file. For more information, see https://angular.dev/tools/cli/serve#proxying-to-a-backend-server."
26
+ },
27
+ "ssl": {
28
+ "type": "boolean",
29
+ "description": "Serve using HTTPS.",
30
+ "default": false
31
+ },
32
+ "sslKey": {
33
+ "type": "string",
34
+ "description": "SSL key to use for serving HTTPS."
35
+ },
36
+ "sslCert": {
37
+ "type": "string",
38
+ "description": "SSL certificate to use for serving HTTPS."
39
+ },
40
+ "allowedHosts": {
41
+ "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",
42
+ "default": [],
43
+ "oneOf": [
44
+ {
45
+ "type": "array",
46
+ "description": "A list of hosts that the development server will respond to.",
47
+ "items": {
48
+ "type": "string"
49
+ }
50
+ },
51
+ {
52
+ "type": "boolean",
53
+ "description": "Indicates that all hosts are allowed. This is not recommended and a security risk."
54
+ }
55
+ ]
56
+ },
57
+ "define": {
58
+ "description": "Defines global identifiers that will be replaced with a specified constant value when found in any JavaScript or TypeScript code including libraries. The value will be used directly. String values must be put in quotes. Identifiers within Angular metadata such as Component Decorators will not be replaced.",
59
+ "type": "object",
60
+ "additionalProperties": {
61
+ "type": "string"
62
+ }
63
+ },
64
+ "headers": {
65
+ "type": "object",
66
+ "description": "Custom HTTP headers to be added to all responses.",
67
+ "propertyNames": {
68
+ "pattern": "^[-_A-Za-z0-9]+$"
69
+ },
70
+ "additionalProperties": {
71
+ "type": "string"
72
+ }
73
+ },
74
+ "open": {
75
+ "type": "boolean",
76
+ "description": "Opens the url in default browser.",
77
+ "default": false,
78
+ "alias": "o"
79
+ },
80
+ "verbose": {
81
+ "type": "boolean",
82
+ "description": "Adds more details to output logging."
83
+ },
84
+ "liveReload": {
85
+ "type": "boolean",
86
+ "description": "Whether to reload the page on change, using live-reload.",
87
+ "default": true
88
+ },
89
+ "servePath": {
90
+ "type": "string",
91
+ "description": "The pathname where the application will be served."
92
+ },
93
+ "hmr": {
94
+ "type": "boolean",
95
+ "description": "Enable hot module replacement. Defaults to the value of 'liveReload'. Currently, only global and component stylesheets are supported."
96
+ },
97
+ "watch": {
98
+ "type": "boolean",
99
+ "description": "Rebuild on change.",
100
+ "default": true
101
+ },
102
+ "poll": {
103
+ "description": "Watch by polling every this many milliseconds. Defaults to 1000 when omitted. false adds no default, so Angular's own configuration applies, including a poll on the build target.",
104
+ "oneOf": [
105
+ {
106
+ "type": "number",
107
+ "exclusiveMinimum": 0
108
+ },
109
+ {
110
+ "const": false
111
+ }
112
+ ]
113
+ },
114
+ "inspect": {
115
+ "default": false,
116
+ "description": "Activate debugging inspector. This option only has an effect when 'SSR' or 'SSG' are enabled.",
117
+ "oneOf": [
118
+ {
119
+ "type": "string",
120
+ "description": "Activate the inspector on host and port in the format of `[[host:]port]`. See the security warning in https://nodejs.org/docs/latest-v22.x/api/cli.html#warning-binding-inspector-to-a-public-ipport-combination-is-insecure regarding the host parameter usage."
121
+ },
122
+ {
123
+ "type": "boolean"
124
+ }
125
+ ]
126
+ },
127
+ "prebundle": {
128
+ "description": "Enable and control the Vite-based development server's prebundling capabilities. To enable prebundling, the Angular CLI cache must also be enabled.",
129
+ "default": true,
130
+ "oneOf": [
131
+ {
132
+ "type": "boolean"
133
+ },
134
+ {
135
+ "type": "object",
136
+ "properties": {
137
+ "exclude": {
138
+ "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`.",
139
+ "type": "array",
140
+ "items": {
141
+ "type": "string"
142
+ }
143
+ }
144
+ },
145
+ "additionalProperties": false,
146
+ "required": ["exclude"]
147
+ }
148
+ ]
149
+ }
150
+ },
151
+ "additionalProperties": false,
152
+ "required": ["buildTarget"]
153
+ }
@@ -17,9 +17,9 @@ import { type ApplicationBinding, type Registry } from "./dispatch.js";
17
17
  *
18
18
  * For intercepted calls, Angular's `REQUEST_CONTEXT` must be the {@link RequestScope}
19
19
  * created for Angular's `REQUEST`, or the calls fail with `INTERNAL`. A generated-client
20
- * call outside `/_rpc/` on the current request's origin fails with `INVALID_INPUT`, as
21
- * does any intercepted call with a query string, fragment, URL credentials, a method
22
- * other than `POST`, a non-JSON content type, its own `Authorization`,
20
+ * call outside `/_rpc/` on the current request's origin fails with `INVALID_INPUT` with no
21
+ * issues, as does any intercepted call with a query string, fragment, URL credentials, a
22
+ * method other than `POST`, a non-JSON content type, its own `Authorization`,
23
23
  * `Proxy-Authorization` or `Cookie` header, or its own credentials setting.
24
24
  *
25
25
  * Without a live request, as during prerendering, calls from generated clients and
package/server/backend.js CHANGED
@@ -2,7 +2,7 @@ import { inject, InjectionToken, REQUEST, REQUEST_CONTEXT, makeEnvironmentProvid
2
2
  import { FetchBackend, HttpBackend, HttpErrorResponse, HttpResponse } from "@angular/common/http";
3
3
  import { Observable } from "rxjs";
4
4
  import { RPC_CALL } from "../generated.js";
5
- import { dispatch, failure, isJsonMediaType, assertBoundScope, } from "./dispatch.js";
5
+ import { dispatch, failure, invalidInput, isJsonMediaType, assertBoundScope, } from "./dispatch.js";
6
6
  const renderFaults = new InjectionToken("Launch render faults");
7
7
  /**
8
8
  * Provides the server-rendering transport that runs RPC calls in-process with the
@@ -21,9 +21,9 @@ const renderFaults = new InjectionToken("Launch render faults");
21
21
  *
22
22
  * For intercepted calls, Angular's `REQUEST_CONTEXT` must be the {@link RequestScope}
23
23
  * created for Angular's `REQUEST`, or the calls fail with `INTERNAL`. A generated-client
24
- * call outside `/_rpc/` on the current request's origin fails with `INVALID_INPUT`, as
25
- * does any intercepted call with a query string, fragment, URL credentials, a method
26
- * other than `POST`, a non-JSON content type, its own `Authorization`,
24
+ * call outside `/_rpc/` on the current request's origin fails with `INVALID_INPUT` with no
25
+ * issues, as does any intercepted call with a query string, fragment, URL credentials, a
26
+ * method other than `POST`, a non-JSON content type, its own `Authorization`,
27
27
  * `Proxy-Authorization` or `Cookie` header, or its own credentials setting.
28
28
  *
29
29
  * Without a live request, as during prerendering, calls from generated clients and
@@ -105,23 +105,34 @@ export function provideLaunchServer(registry, application) {
105
105
  request.method !== "POST" ||
106
106
  !isJsonMediaType(contentType) ||
107
107
  authOverride) {
108
- deliver(failure("INVALID_INPUT"));
108
+ deliver(invalidInput());
109
109
  return;
110
110
  }
111
111
  let envelope;
112
112
  try {
113
113
  const body = request.serializeBody();
114
114
  if (typeof body !== "string") {
115
- deliver(failure("INVALID_INPUT"));
115
+ deliver(invalidInput());
116
116
  return;
117
117
  }
118
118
  envelope = JSON.parse(body);
119
119
  }
120
120
  catch {
121
- deliver(failure("INVALID_INPUT"));
121
+ deliver(invalidInput());
122
122
  return;
123
123
  }
124
- void dispatch(registry, target.pathname, envelope, context, application, nativeRequest, "rendering").then(deliver);
124
+ // Aborts when the page request does, or when HttpClient unsubscribes first.
125
+ const call = new AbortController();
126
+ let settled = false;
127
+ void dispatch(registry, target.pathname, envelope, context, application, nativeRequest, "rendering", AbortSignal.any([nativeRequest.signal, call.signal])).then((reply) => {
128
+ settled = true;
129
+ deliver(reply);
130
+ });
131
+ return () => {
132
+ if (!settled) {
133
+ call.abort(new DOMException("RPC call aborted", "AbortError"));
134
+ }
135
+ };
125
136
  });
126
137
  },
127
138
  };