@ohos-ports/nx-web 0.0.0-stage → 23.3.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.
Files changed (69) hide show
  1. package/README.md +66 -2
  2. package/dist/LICENSE +22 -0
  3. package/dist/babel.d.ts +1 -0
  4. package/dist/babel.js +8 -0
  5. package/dist/index.d.ts +3 -0
  6. package/dist/index.js +9 -0
  7. package/dist/internal.d.ts +2 -0
  8. package/dist/internal.js +11 -0
  9. package/dist/src/executors/file-server/compat.d.ts +2 -0
  10. package/dist/src/executors/file-server/compat.js +6 -0
  11. package/dist/src/executors/file-server/file-server.impl.d.ts +8 -0
  12. package/dist/src/executors/file-server/file-server.impl.js +231 -0
  13. package/dist/src/executors/file-server/schema.d.ts +20 -0
  14. package/dist/src/executors/file-server/schema.json +107 -0
  15. package/dist/src/generators/application/application.d.ts +5 -0
  16. package/dist/src/generators/application/application.js +521 -0
  17. package/dist/src/generators/application/files/app-vite/.babelrc__tmpl__ +5 -0
  18. package/dist/src/generators/application/files/app-vite/index.html__tmpl__ +16 -0
  19. package/dist/src/generators/application/files/app-vite/public/favicon.ico +0 -0
  20. package/dist/src/generators/application/files/app-vite/src/app/app.element.__style__ +424 -0
  21. package/dist/src/generators/application/files/app-vite/src/app/app.element.spec.ts__tmpl__ +21 -0
  22. package/dist/src/generators/application/files/app-vite/src/app/app.element.ts__tmpl__ +409 -0
  23. package/dist/src/generators/application/files/app-vite/src/assets/.gitkeep +0 -0
  24. package/dist/src/generators/application/files/app-vite/src/main.ts__tmpl__ +1 -0
  25. package/dist/src/generators/application/files/app-vite/src/styles.__style__ +1 -0
  26. package/dist/src/generators/application/files/app-vite/tsconfig.app.json +9 -0
  27. package/dist/src/generators/application/files/app-vite/tsconfig.json__tmpl__ +27 -0
  28. package/dist/src/generators/application/files/app-webpack/src/app/app.element.__style__ +424 -0
  29. package/dist/src/generators/application/files/app-webpack/src/app/app.element.spec.ts__tmpl__ +21 -0
  30. package/dist/src/generators/application/files/app-webpack/src/app/app.element.ts__tmpl__ +409 -0
  31. package/dist/src/generators/application/files/app-webpack/src/assets/.gitkeep +0 -0
  32. package/dist/src/generators/application/files/app-webpack/src/favicon.ico +0 -0
  33. package/dist/src/generators/application/files/app-webpack/src/index.html +14 -0
  34. package/dist/src/generators/application/files/app-webpack/src/main.ts__tmpl__ +1 -0
  35. package/dist/src/generators/application/files/app-webpack/src/styles.__style__ +1 -0
  36. package/dist/src/generators/application/files/app-webpack/tsconfig.app.json +9 -0
  37. package/dist/src/generators/application/files/app-webpack/tsconfig.json +10 -0
  38. package/dist/src/generators/application/files/app-webpack/webpack.config.js__tmpl__ +41 -0
  39. package/dist/src/generators/application/schema.d.ts +26 -0
  40. package/dist/src/generators/application/schema.json +125 -0
  41. package/dist/src/generators/init/init.d.ts +4 -0
  42. package/dist/src/generators/init/init.js +22 -0
  43. package/dist/src/generators/init/schema.d.ts +5 -0
  44. package/dist/src/generators/init/schema.json +28 -0
  45. package/dist/src/generators/static-serve/schema.json +33 -0
  46. package/dist/src/generators/static-serve/static-serve-configuration.d.ts +10 -0
  47. package/dist/src/generators/static-serve/static-serve-configuration.js +85 -0
  48. package/dist/src/migrations/update-23-0-0/rewrite-internal-subpath-imports.d.ts +3 -0
  49. package/dist/src/migrations/update-23-0-0/rewrite-internal-subpath-imports.js +197 -0
  50. package/dist/src/plugins/webpack-nx-build-coordination-plugin.d.ts +1 -0
  51. package/dist/src/plugins/webpack-nx-build-coordination-plugin.js +5 -0
  52. package/dist/src/utils/fs.d.ts +1 -0
  53. package/dist/src/utils/fs.js +7 -0
  54. package/dist/src/utils/has-vite-plugin.d.ts +2 -0
  55. package/dist/src/utils/has-vite-plugin.js +10 -0
  56. package/dist/src/utils/has-webpack-plugin.d.ts +2 -0
  57. package/dist/src/utils/has-webpack-plugin.js +10 -0
  58. package/dist/src/utils/normalize.d.ts +1 -0
  59. package/dist/src/utils/normalize.js +6 -0
  60. package/dist/src/utils/versions.d.ts +4 -0
  61. package/dist/src/utils/versions.js +8 -0
  62. package/dist/src/utils/wait-for-port-open.d.ts +5 -0
  63. package/dist/src/utils/wait-for-port-open.js +45 -0
  64. package/dist/typings/style.d.ts +5 -0
  65. package/executors.json +16 -0
  66. package/generators.json +25 -0
  67. package/migrations.json +10 -0
  68. package/package.json +126 -4
  69. package/scripts/consumer-compat.js +134 -0
package/README.md CHANGED
@@ -1,3 +1,67 @@
1
- # Temporary Holding Version
1
+ <p style="text-align: center;">
2
+ <picture>
3
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-dark.svg">
4
+ <img alt="Nx - Smart Monorepos · Fast Builds" src="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-light.svg" width="100%">
5
+ </picture>
6
+ </p>
7
+
8
+ <div style="text-align: center;">
9
+
10
+ [![License](https://img.shields.io/npm/l/@nx/workspace.svg?style=flat-square)](<>)
11
+ [![NPM Version](https://badge.fury.io/js/nx.svg)](https://www.npmjs.com/package/nx)
12
+ [![Semantic Release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=flat-square)](<>)
13
+ [![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)
14
+ [![Join us on the Official Nx Discord Server](https://img.shields.io/discord/1143497901675401286?label=discord)](https://go.nx.dev/community)
15
+ [![Hours saved](https://img.shields.io/endpoint?url=https%3A%2F%2Fstaging.nx.app%2Fnx-cloud%2Fbadge%2F62d013ea0852fe0a2df74438%2Fhours-saved.json)](https://nx.dev/nx-cloud)
16
+
17
+ </div>
18
+
19
+
20
+ <hr>
21
+
22
+ # Nx: Smart Monorepos · Fast Builds
23
+
24
+ Get to green PRs in half the time. Nx optimizes your builds, scales your CI, and fixes failed PRs. Built for developers and AI agents.
25
+
26
+ This package is a [Web plugin for Nx](https://nx.dev/nx-api/web).
27
+
28
+ ## Getting Started
29
+
30
+ ### Creating an Nx Workspace
31
+
32
+ **Using `npx`**
33
+
34
+ ```bash
35
+ npx create-nx-workspace
36
+ ```
37
+
38
+ **Using `npm init`**
39
+
40
+ ```bash
41
+ npm init nx-workspace
42
+ ```
43
+
44
+ **Using `yarn create`**
45
+
46
+ ```bash
47
+ yarn create nx-workspace
48
+ ```
49
+
50
+ ### Adding Nx to an Existing Repository
51
+
52
+ Run:
53
+
54
+ ```bash
55
+ npx nx@latest init
56
+ ```
57
+
58
+ ## Documentation & Resources
59
+
60
+ - [Nx.Dev: Documentation, Guides, Tutorials](https://nx.dev)
61
+ - [Intro to Nx](https://nx.dev/getting-started/intro)
62
+ - [Official Nx YouTube Channel](https://www.youtube.com/@NxDevtools)
63
+ - [Blog Posts About Nx](https://nx.dev/blog)
64
+
65
+ <p style="text-align: center;"><a href="https://nx.dev/#learning-materials" target="_blank" rel="noreferrer"><img src="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-courses-and-videos.svg"
66
+ width="100%" alt="Nx - Smart Monorepos · Fast Builds"></a></p>
2
67
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
package/dist/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ (The MIT License)
2
+
3
+ Copyright (c) 2017-2026 Narwhal Technologies Inc.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ 'Software'), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1 @@
1
+ export {};
package/dist/babel.js ADDED
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const nxJsBabelPreset = require('@nx/js/babel');
4
+ /** @deprecated Use `@nx/js/babel`. */
5
+ module.exports = function (api, options = {}) {
6
+ console.warn('`@nx/web/babel` has been deprecated. Use `@nx/js/babel` instead in your .babelrc files.');
7
+ return nxJsBabelPreset(api, options);
8
+ };
@@ -0,0 +1,3 @@
1
+ export { webInitGenerator } from './src/generators/init/init';
2
+ export { applicationGenerator } from './src/generators/application/application';
3
+ export { webStaticServeGenerator } from './src/generators/static-serve/static-serve-configuration';
package/dist/index.js ADDED
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.webStaticServeGenerator = exports.applicationGenerator = exports.webInitGenerator = void 0;
4
+ var init_1 = require("./src/generators/init/init");
5
+ Object.defineProperty(exports, "webInitGenerator", { enumerable: true, get: function () { return init_1.webInitGenerator; } });
6
+ var application_1 = require("./src/generators/application/application");
7
+ Object.defineProperty(exports, "applicationGenerator", { enumerable: true, get: function () { return application_1.applicationGenerator; } });
8
+ var static_serve_configuration_1 = require("./src/generators/static-serve/static-serve-configuration");
9
+ Object.defineProperty(exports, "webStaticServeGenerator", { enumerable: true, get: function () { return static_serve_configuration_1.webStaticServeGenerator; } });
@@ -0,0 +1,2 @@
1
+ export { waitForPortOpen } from './src/utils/wait-for-port-open';
2
+ export { default as fileServerExecutor } from './src/executors/file-server/file-server.impl';
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fileServerExecutor = exports.waitForPortOpen = void 0;
4
+ const tslib_1 = require("tslib");
5
+ // Curated internal API surface for other first-party Nx plugins (e.g. @nx/react,
6
+ // @nx/angular, @nx/rspack, @nx/next, @nx/remix, @nx/module-federation). Prefer
7
+ // this over deep `@nx/web/src/*` imports — those are not part of the public API.
8
+ var wait_for_port_open_1 = require("./src/utils/wait-for-port-open");
9
+ Object.defineProperty(exports, "waitForPortOpen", { enumerable: true, get: function () { return wait_for_port_open_1.waitForPortOpen; } });
10
+ var file_server_impl_1 = require("./src/executors/file-server/file-server.impl");
11
+ Object.defineProperty(exports, "fileServerExecutor", { enumerable: true, get: function () { return tslib_1.__importDefault(file_server_impl_1).default; } });
@@ -0,0 +1,2 @@
1
+ declare const _default: any;
2
+ export default _default;
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const devkit_1 = require("@ohos-ports/nx-devkit");
5
+ const file_server_impl_1 = tslib_1.__importDefault(require("./file-server.impl"));
6
+ exports.default = (0, devkit_1.convertNxExecutor)(file_server_impl_1.default);
@@ -0,0 +1,8 @@
1
+ import { ExecutorContext } from '@ohos-ports/nx-devkit';
2
+ import { Schema } from './schema';
3
+ export default function fileServerExecutor(options: Schema, context: ExecutorContext): AsyncGenerator<{
4
+ success: boolean;
5
+ baseUrl: string;
6
+ }, {
7
+ success: boolean;
8
+ }, unknown>;
@@ -0,0 +1,231 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = fileServerExecutor;
4
+ const tslib_1 = require("tslib");
5
+ const internal_1 = require("@ohos-ports/nx-devkit/internal");
6
+ const child_process_1 = require("child_process");
7
+ const pc = tslib_1.__importStar(require("picocolors"));
8
+ const devkit_1 = require("@ohos-ports/nx-devkit");
9
+ const fs_1 = require("fs");
10
+ const path_1 = require("path");
11
+ const internal_2 = require("@nx/js/internal");
12
+ const detect_port_1 = tslib_1.__importDefault(require("detect-port"));
13
+ function getHttpServerArgs(options) {
14
+ const { buildTarget, parallel, host, proxyUrl, ssl, sslCert, sslKey, proxyOptions, watch, spa, cacheSeconds, ...rest } = options;
15
+ const args = [`-c${options.cacheSeconds}`];
16
+ for (const [key, value] of Object.entries(rest)) {
17
+ if (typeof value === 'boolean' && value) {
18
+ args.push(`--${key}`);
19
+ }
20
+ else if (typeof value === 'string') {
21
+ args.push(`--${key}=${value}`);
22
+ }
23
+ }
24
+ if (host) {
25
+ args.push(`-a=${host}`);
26
+ }
27
+ if (ssl) {
28
+ args.push(`-S`);
29
+ }
30
+ if (sslCert) {
31
+ args.push(`-C=${sslCert}`);
32
+ }
33
+ if (sslKey) {
34
+ args.push(`-K=${sslKey}`);
35
+ }
36
+ if (proxyUrl) {
37
+ args.push(`-P=${proxyUrl}`);
38
+ }
39
+ if (proxyOptions) {
40
+ Object.keys(options.proxyOptions).forEach((key) => {
41
+ args.push(`--proxy-options.${key}=${options.proxyOptions[key]}`);
42
+ });
43
+ }
44
+ return args;
45
+ }
46
+ function getBuildTargetCommand(options, context) {
47
+ const target = (0, devkit_1.parseTargetString)(options.buildTarget, context);
48
+ const cmd = ['nx', 'run'];
49
+ if (target.configuration) {
50
+ cmd.push(`${target.project}:${target.target}:${target.configuration}`);
51
+ }
52
+ else {
53
+ cmd.push(`${target.project}:${target.target}`);
54
+ }
55
+ if (options.parallel) {
56
+ cmd.push(`--parallel`);
57
+ }
58
+ if (options.maxParallel) {
59
+ cmd.push(`--maxParallel=${options.maxParallel}`);
60
+ }
61
+ return cmd;
62
+ }
63
+ function getBuildTargetOutputPath(options, context) {
64
+ if (options.staticFilePath) {
65
+ return options.staticFilePath;
66
+ }
67
+ let outputPath;
68
+ try {
69
+ const target = (0, devkit_1.parseTargetString)(options.buildTarget, context);
70
+ const buildOptions = (0, devkit_1.readTargetOptions)(target, context);
71
+ if (buildOptions?.outputPath) {
72
+ outputPath = buildOptions.outputPath;
73
+ }
74
+ else {
75
+ const project = context.projectGraph.nodes[context.projectName];
76
+ const buildTarget = project.data.targets[target.target];
77
+ outputPath = buildTarget.outputs?.[0];
78
+ if (outputPath) {
79
+ outputPath = (0, internal_1.interpolate)(outputPath, {
80
+ projectName: project.data.name,
81
+ projectRoot: project.data.root,
82
+ });
83
+ outputPath = (0, internal_2.stripGlobToBaseDir)(outputPath);
84
+ }
85
+ }
86
+ }
87
+ catch (e) {
88
+ throw new Error(`Invalid buildTarget: ${options.buildTarget}`);
89
+ }
90
+ if (!outputPath) {
91
+ throw new Error(`Unable to get the outputPath from buildTarget ${options.buildTarget}. Make sure ${options.buildTarget} has an outputPath property or manually provide an staticFilePath property`);
92
+ }
93
+ return outputPath;
94
+ }
95
+ function createFileWatcher(project, changeHandler) {
96
+ return internal_1.daemonClient.registerFileWatcher({
97
+ watchProjects: project ? [project] : 'all',
98
+ includeGlobalWorkspaceFiles: true,
99
+ includeDependencies: true,
100
+ }, async (error, val) => {
101
+ if (error === 'reconnecting') {
102
+ // Silent - daemon restarts automatically on lockfile changes
103
+ return;
104
+ }
105
+ else if (error === 'reconnected') {
106
+ // Silent - reconnection succeeded
107
+ return;
108
+ }
109
+ else if (error === 'closed') {
110
+ throw new Error('Failed to reconnect to daemon after multiple attempts');
111
+ }
112
+ else if (error) {
113
+ throw new Error(`Watch error: ${error?.message ?? 'Unknown'}`);
114
+ }
115
+ else if (val?.changedFiles.length > 0) {
116
+ changeHandler();
117
+ }
118
+ });
119
+ }
120
+ async function* fileServerExecutor(options, context) {
121
+ if (!options.buildTarget && !options.staticFilePath) {
122
+ throw new Error("You must set either 'buildTarget' or 'staticFilePath'.");
123
+ }
124
+ if (options.watch && !options.buildTarget) {
125
+ throw new Error("Watch error: You can only specify 'watch' when 'buildTarget' is set.");
126
+ }
127
+ let running = false;
128
+ let disposeWatch;
129
+ if (options.buildTarget) {
130
+ // Run the build target through the workspace package manager so workspaces
131
+ // that pin a non-npm manager (e.g. devEngines.packageManager) don't fail.
132
+ const pmc = (0, devkit_1.getPackageManagerCommand)();
133
+ const run = () => {
134
+ if (!running) {
135
+ running = true;
136
+ /**
137
+ * Expose a variable to the build target to know if it's being run by the serve-static executor
138
+ * This is useful because a config might need to change if it's being run by serve-static without the user's input
139
+ * or if being ran by another executor (eg. E2E tests)
140
+ * */
141
+ process.env.NX_SERVE_STATIC_BUILD_RUNNING = 'true';
142
+ try {
143
+ const args = getBuildTargetCommand(options, context);
144
+ (0, child_process_1.execFileSync)(pmc.exec, args, {
145
+ stdio: [0, 1, 2],
146
+ shell: true,
147
+ windowsHide: true,
148
+ });
149
+ }
150
+ catch {
151
+ throw new Error(`Build target failed: ${pc.bold(options.buildTarget)}`);
152
+ }
153
+ finally {
154
+ process.env.NX_SERVE_STATIC_BUILD_RUNNING = undefined;
155
+ running = false;
156
+ }
157
+ }
158
+ };
159
+ if (!internal_1.daemonClient.enabled() && options.watch) {
160
+ devkit_1.output.warn({
161
+ title: 'Nx Daemon is not enabled. Static server is not watching for changes.',
162
+ });
163
+ }
164
+ if (internal_1.daemonClient.enabled() && options.watch) {
165
+ disposeWatch = await createFileWatcher(context.projectName, run);
166
+ }
167
+ // perform initial run
168
+ run();
169
+ }
170
+ const port = await (0, detect_port_1.default)(options.port || 8080);
171
+ const outputPath = getBuildTargetOutputPath(options, context);
172
+ if (options.spa) {
173
+ const src = (0, path_1.join)(outputPath, 'index.html');
174
+ const dst = (0, path_1.join)(outputPath, '404.html');
175
+ // See: https://github.com/http-party/http-server#magic-files
176
+ (0, fs_1.copyFileSync)(src, dst);
177
+ // We also need to ensure the proxyUrl is set, otherwise the browser will continue to throw a 404 error
178
+ // This can cause unexpected behaviors and failures especially in automated test suites
179
+ options.proxyUrl ??= `http${options.ssl ? 's' : ''}://localhost:${port}?`;
180
+ }
181
+ const args = getHttpServerArgs(options);
182
+ const { path: pathToHttpServerPkgJson, packageJson } = (0, internal_1.readModulePackageJson)('http-server', module.paths);
183
+ const pathToHttpServerBin = packageJson.bin['http-server'];
184
+ const pathToHttpServer = (0, path_1.resolve)(pathToHttpServerPkgJson.replace('package.json', ''), pathToHttpServerBin);
185
+ // detect port as close to when used to prevent port being used by another process
186
+ // when running in parallel
187
+ args.push(`-p=${port}`);
188
+ const serve = (0, child_process_1.fork)(pathToHttpServer, [outputPath, ...args], {
189
+ stdio: 'pipe',
190
+ cwd: context.root,
191
+ env: {
192
+ FORCE_COLOR: 'true',
193
+ ...process.env,
194
+ },
195
+ });
196
+ const processExitListener = () => {
197
+ serve.kill();
198
+ if (disposeWatch) {
199
+ disposeWatch();
200
+ }
201
+ if (options.spa) {
202
+ (0, fs_1.unlinkSync)((0, path_1.join)(outputPath, '404.html'));
203
+ }
204
+ };
205
+ process.on('exit', processExitListener);
206
+ process.on('SIGTERM', processExitListener);
207
+ serve.stdout.on('data', (chunk) => {
208
+ if (chunk.toString().indexOf('GET') === -1) {
209
+ process.stdout.write(chunk);
210
+ }
211
+ });
212
+ serve.stderr.on('data', (chunk) => {
213
+ process.stderr.write(chunk);
214
+ });
215
+ yield {
216
+ success: true,
217
+ baseUrl: `${options.ssl ? 'https' : 'http'}://${options.host}:${port}`,
218
+ };
219
+ return new Promise((res) => {
220
+ serve.on('exit', (code, signal) => {
221
+ if (code === null)
222
+ code = (0, internal_1.signalToCode)(signal);
223
+ if (code == 0) {
224
+ res({ success: true });
225
+ }
226
+ else {
227
+ res({ success: false });
228
+ }
229
+ });
230
+ });
231
+ }
@@ -0,0 +1,20 @@
1
+ export interface Schema {
2
+ host?: string;
3
+ port?: number;
4
+ ssl?: boolean;
5
+ sslKey?: string;
6
+ sslCert?: string;
7
+ proxyUrl?: string;
8
+ buildTarget?: string;
9
+ parallel: boolean;
10
+ maxParallel?: number;
11
+ withDeps: boolean;
12
+ proxyOptions?: object;
13
+ watch?: boolean;
14
+ spa: boolean;
15
+ staticFilePath?: string;
16
+ cors?: boolean;
17
+ gzip?: boolean;
18
+ brotli?: boolean;
19
+ cacheSeconds?: number;
20
+ }
@@ -0,0 +1,107 @@
1
+ {
2
+ "version": 2,
3
+ "continuous": true,
4
+ "outputCapture": "direct-nodejs",
5
+ "title": "File Server",
6
+ "description": "Serve a web application from a folder. This executor is a wrapper around the [http-server](https://www.npmjs.com/package/http-server) package.",
7
+ "type": "object",
8
+ "cli": "nx",
9
+ "properties": {
10
+ "buildTarget": {
11
+ "type": "string",
12
+ "description": "Target which builds the application."
13
+ },
14
+ "parallel": {
15
+ "type": "boolean",
16
+ "description": "Build the target in parallel.",
17
+ "default": true
18
+ },
19
+ "maxParallel": {
20
+ "type": "number",
21
+ "description": "Max number of parallel jobs."
22
+ },
23
+ "port": {
24
+ "type": "number",
25
+ "description": "Port to listen on.",
26
+ "default": 4200
27
+ },
28
+ "host": {
29
+ "type": "string",
30
+ "description": "Host to listen on.",
31
+ "default": "localhost"
32
+ },
33
+ "ssl": {
34
+ "type": "boolean",
35
+ "description": "Serve using `HTTPS`.",
36
+ "default": false
37
+ },
38
+ "sslKey": {
39
+ "type": "string",
40
+ "description": "SSL key to use for serving `HTTPS`."
41
+ },
42
+ "sslCert": {
43
+ "type": "string",
44
+ "description": "SSL certificate to use for serving `HTTPS`."
45
+ },
46
+ "proxyUrl": {
47
+ "type": "string",
48
+ "description": "URL to proxy unhandled requests to. _Note: If the 'spa' flag is set to true, manually setting this value will override the catch-all redirect functionality from http-server which may lead to unexpected behavior._"
49
+ },
50
+ "proxyOptions": {
51
+ "type": "object",
52
+ "description": "Options for the proxy used by `http-server`.",
53
+ "default": {},
54
+ "properties": {
55
+ "secure": {
56
+ "type": "boolean",
57
+ "default": false
58
+ }
59
+ },
60
+ "additionalProperties": true
61
+ },
62
+ "watch": {
63
+ "type": "boolean",
64
+ "description": "Watch for file changes.",
65
+ "default": true
66
+ },
67
+ "spa": {
68
+ "type": "boolean",
69
+ "description": "Redirect 404 errors to index.html (useful for SPA's)",
70
+ "default": false,
71
+ "x-priority": "important"
72
+ },
73
+ "staticFilePath": {
74
+ "type": "string",
75
+ "description": "Path where the build artifacts are located. If not provided then it will be infered from the buildTarget executor options as outputPath"
76
+ },
77
+ "cors": {
78
+ "oneOf": [
79
+ {
80
+ "type": "boolean"
81
+ },
82
+ {
83
+ "type": "string"
84
+ }
85
+ ],
86
+ "description": "Enable CORS",
87
+ "default": true
88
+ },
89
+ "gzip": {
90
+ "type": "boolean",
91
+ "description": "Enable gzip compression",
92
+ "default": false
93
+ },
94
+ "brotli": {
95
+ "type": "boolean",
96
+ "description": "Enable brotli compression",
97
+ "default": false
98
+ },
99
+ "cacheSeconds": {
100
+ "type": "number",
101
+ "description": "Set cache time (in seconds) for cache-control max-age header. To disable caching, use -1. Caching defaults to disabled.",
102
+ "default": -1
103
+ }
104
+ },
105
+ "additionalProperties": true,
106
+ "examplesFile": "../../../docs/file-server-examples.md"
107
+ }
@@ -0,0 +1,5 @@
1
+ import { GeneratorCallback, Tree } from '@ohos-ports/nx-devkit';
2
+ import { Schema } from './schema';
3
+ export declare function applicationGenerator(host: Tree, schema: Schema): Promise<GeneratorCallback>;
4
+ export declare function applicationGeneratorInternal(host: Tree, schema: Schema): Promise<GeneratorCallback>;
5
+ export default applicationGenerator;