@nx/web 23.1.0 → 23.1.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.
|
@@ -8,9 +8,6 @@ const pc = tslib_1.__importStar(require("picocolors"));
|
|
|
8
8
|
const devkit_1 = require("@nx/devkit");
|
|
9
9
|
const fs_1 = require("fs");
|
|
10
10
|
const path_1 = require("path");
|
|
11
|
-
const package_json_1 = require("nx/src/utils/package-json");
|
|
12
|
-
const client_1 = require("nx/src/daemon/client/client");
|
|
13
|
-
const utils_1 = require("nx/src/tasks-runner/utils");
|
|
14
11
|
const internal_2 = require("@nx/js/internal");
|
|
15
12
|
const detect_port_1 = tslib_1.__importDefault(require("detect-port"));
|
|
16
13
|
function getHttpServerArgs(options) {
|
|
@@ -79,7 +76,7 @@ function getBuildTargetOutputPath(options, context) {
|
|
|
79
76
|
const buildTarget = project.data.targets[target.target];
|
|
80
77
|
outputPath = buildTarget.outputs?.[0];
|
|
81
78
|
if (outputPath) {
|
|
82
|
-
outputPath = (0,
|
|
79
|
+
outputPath = (0, internal_1.interpolate)(outputPath, {
|
|
83
80
|
projectName: project.data.name,
|
|
84
81
|
projectRoot: project.data.root,
|
|
85
82
|
});
|
|
@@ -96,7 +93,7 @@ function getBuildTargetOutputPath(options, context) {
|
|
|
96
93
|
return outputPath;
|
|
97
94
|
}
|
|
98
95
|
function createFileWatcher(project, changeHandler) {
|
|
99
|
-
return
|
|
96
|
+
return internal_1.daemonClient.registerFileWatcher({
|
|
100
97
|
watchProjects: project ? [project] : 'all',
|
|
101
98
|
includeGlobalWorkspaceFiles: true,
|
|
102
99
|
includeDependencies: true,
|
|
@@ -159,12 +156,12 @@ async function* fileServerExecutor(options, context) {
|
|
|
159
156
|
}
|
|
160
157
|
}
|
|
161
158
|
};
|
|
162
|
-
if (!
|
|
159
|
+
if (!internal_1.daemonClient.enabled() && options.watch) {
|
|
163
160
|
devkit_1.output.warn({
|
|
164
161
|
title: 'Nx Daemon is not enabled. Static server is not watching for changes.',
|
|
165
162
|
});
|
|
166
163
|
}
|
|
167
|
-
if (
|
|
164
|
+
if (internal_1.daemonClient.enabled() && options.watch) {
|
|
168
165
|
disposeWatch = await createFileWatcher(context.projectName, run);
|
|
169
166
|
}
|
|
170
167
|
// perform initial run
|
|
@@ -182,7 +179,7 @@ async function* fileServerExecutor(options, context) {
|
|
|
182
179
|
options.proxyUrl ??= `http${options.ssl ? 's' : ''}://localhost:${port}?`;
|
|
183
180
|
}
|
|
184
181
|
const args = getHttpServerArgs(options);
|
|
185
|
-
const { path: pathToHttpServerPkgJson, packageJson } = (0,
|
|
182
|
+
const { path: pathToHttpServerPkgJson, packageJson } = (0, internal_1.readModulePackageJson)('http-server', module.paths);
|
|
186
183
|
const pathToHttpServerBin = packageJson.bin['http-server'];
|
|
187
184
|
const pathToHttpServer = (0, path_1.resolve)(pathToHttpServerPkgJson.replace('package.json', ''), pathToHttpServerBin);
|
|
188
185
|
// detect port as close to when used to prevent port being used by another process
|
|
@@ -213,8 +213,13 @@ async function applicationGeneratorInternal(host, schema) {
|
|
|
213
213
|
await setupBundler(host, options);
|
|
214
214
|
}
|
|
215
215
|
createApplicationFiles(host, options);
|
|
216
|
+
let enableTypedLinting = false;
|
|
216
217
|
if (options.linter === 'eslint') {
|
|
217
218
|
const { lintProjectGenerator } = (0, devkit_1.ensurePackage)('@nx/eslint', versions_1.nxVersion);
|
|
219
|
+
// CommonJS `require` instead of dynamic ESM `import`: `ensurePackage`
|
|
220
|
+
// exposes the temp install via `Module._initPaths`, which ESM ignores.
|
|
221
|
+
const { isTypedLintingEnabled, addIgnoresToLintConfig, } = require('@nx/eslint/internal');
|
|
222
|
+
enableTypedLinting = isTypedLintingEnabled(options);
|
|
218
223
|
const lintTask = await lintProjectGenerator(host, {
|
|
219
224
|
linter: options.linter,
|
|
220
225
|
project: options.projectName,
|
|
@@ -223,15 +228,12 @@ async function applicationGeneratorInternal(host, schema) {
|
|
|
223
228
|
],
|
|
224
229
|
unitTestRunner: options.unitTestRunner,
|
|
225
230
|
skipFormat: true,
|
|
226
|
-
|
|
231
|
+
enableTypedLinting,
|
|
227
232
|
addPlugin: options.addPlugin,
|
|
228
233
|
});
|
|
229
234
|
tasks.push(lintTask);
|
|
230
235
|
// Add out-tsc ignore pattern when using TS solution setup
|
|
231
236
|
if (options.isUsingTsSolutionConfig) {
|
|
232
|
-
// CommonJS `require` instead of dynamic ESM `import` — `ensurePackage`
|
|
233
|
-
// exposes the temp install via `Module._initPaths`, which ESM ignores.
|
|
234
|
-
const { addIgnoresToLintConfig, } = require('@nx/eslint/internal');
|
|
235
237
|
addIgnoresToLintConfig(host, options.appProjectRoot, ['**/out-tsc']);
|
|
236
238
|
}
|
|
237
239
|
}
|
|
@@ -263,7 +265,7 @@ async function applicationGeneratorInternal(host, schema) {
|
|
|
263
265
|
if (options.bundler !== 'vite' && options.unitTestRunner === 'vitest') {
|
|
264
266
|
const { createOrEditViteConfig } = (0, devkit_1.ensurePackage)('@nx/vite', versions_1.nxVersion);
|
|
265
267
|
(0, devkit_1.ensurePackage)('@nx/vitest', versions_1.nxVersion);
|
|
266
|
-
// CommonJS `require` instead of dynamic ESM `import
|
|
268
|
+
// CommonJS `require` instead of dynamic ESM `import`: `ensurePackage`
|
|
267
269
|
// exposes the temp install via `Module._initPaths`, which ESM ignores.
|
|
268
270
|
const { configurationGenerator, } = require('@nx/vitest/generators');
|
|
269
271
|
const vitestTask = await configurationGenerator(host, {
|
|
@@ -351,6 +353,7 @@ async function applicationGeneratorInternal(host, schema) {
|
|
|
351
353
|
baseUrl: e2eWebServerInfo.e2eWebServerAddress,
|
|
352
354
|
directory: 'src',
|
|
353
355
|
skipFormat: true,
|
|
356
|
+
enableTypedLinting,
|
|
354
357
|
webServerCommands: {
|
|
355
358
|
default: e2eWebServerInfo.e2eWebServerCommand,
|
|
356
359
|
production: e2eWebServerInfo.e2eCiWebServerCommand,
|
|
@@ -392,7 +395,7 @@ async function applicationGeneratorInternal(host, schema) {
|
|
|
392
395
|
directory: 'src',
|
|
393
396
|
js: false,
|
|
394
397
|
linter: options.linter,
|
|
395
|
-
|
|
398
|
+
enableTypedLinting,
|
|
396
399
|
webServerCommand: e2eWebServerInfo.e2eCiWebServerCommand,
|
|
397
400
|
webServerAddress: e2eWebServerInfo.e2eCiBaseUrl,
|
|
398
401
|
addPlugin: options.addPlugin,
|
|
@@ -13,6 +13,10 @@ export interface Schema {
|
|
|
13
13
|
inSourceTests?: boolean;
|
|
14
14
|
e2eTestRunner?: 'cypress' | 'playwright' | 'none';
|
|
15
15
|
linter?: Linter | LinterType;
|
|
16
|
+
enableTypedLinting?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* @deprecated Use `enableTypedLinting` instead. This option will be removed in Nx v24.
|
|
19
|
+
*/
|
|
16
20
|
setParserOptionsProject?: boolean;
|
|
17
21
|
strict?: boolean;
|
|
18
22
|
addPlugin?: boolean;
|
|
@@ -92,11 +92,17 @@
|
|
|
92
92
|
"type": "string",
|
|
93
93
|
"description": "Add tags to the application (used for linting)"
|
|
94
94
|
},
|
|
95
|
-
"
|
|
95
|
+
"enableTypedLinting": {
|
|
96
96
|
"type": "boolean",
|
|
97
|
-
"description": "Whether
|
|
97
|
+
"description": "Whether to enable typed linting. For flat configs, this configures the recommended `parserOptions.projectService` and `tsconfigRootDir`. For legacy `.eslintrc` configs, this configures `parserOptions.project`. We do not enable this by default for lint performance reasons.",
|
|
98
98
|
"default": false
|
|
99
99
|
},
|
|
100
|
+
"setParserOptionsProject": {
|
|
101
|
+
"type": "boolean",
|
|
102
|
+
"description": "Deprecated alias for `enableTypedLinting`.",
|
|
103
|
+
"default": false,
|
|
104
|
+
"x-deprecated": "Use `enableTypedLinting` instead. This option will be removed in Nx v24."
|
|
105
|
+
},
|
|
100
106
|
"strict": {
|
|
101
107
|
"type": "boolean",
|
|
102
108
|
"description": "Creates an application with strict mode and strict type checking.",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/web",
|
|
3
|
-
"version": "23.1.
|
|
3
|
+
"version": "23.1.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"files": [
|
|
@@ -79,20 +79,20 @@
|
|
|
79
79
|
"http-server": "^14.1.0",
|
|
80
80
|
"picocolors": "^1.1.0",
|
|
81
81
|
"tslib": "^2.3.0",
|
|
82
|
-
"@nx/devkit": "23.1.
|
|
83
|
-
"@nx/js": "23.1.
|
|
82
|
+
"@nx/devkit": "23.1.2",
|
|
83
|
+
"@nx/js": "23.1.2"
|
|
84
84
|
},
|
|
85
85
|
"devDependencies": {
|
|
86
|
-
"nx": "23.1.
|
|
87
|
-
"@nx/vitest": "23.1.
|
|
86
|
+
"nx": "23.1.2",
|
|
87
|
+
"@nx/vitest": "23.1.2"
|
|
88
88
|
},
|
|
89
89
|
"peerDependencies": {
|
|
90
|
-
"@nx/cypress": "23.1.
|
|
91
|
-
"@nx/
|
|
92
|
-
"@nx/
|
|
93
|
-
"@nx/
|
|
94
|
-
"@nx/
|
|
95
|
-
"@nx/webpack": "23.1.
|
|
90
|
+
"@nx/cypress": "23.1.2",
|
|
91
|
+
"@nx/eslint": "23.1.2",
|
|
92
|
+
"@nx/jest": "23.1.2",
|
|
93
|
+
"@nx/playwright": "23.1.2",
|
|
94
|
+
"@nx/vite": "23.1.2",
|
|
95
|
+
"@nx/webpack": "23.1.2"
|
|
96
96
|
},
|
|
97
97
|
"peerDependenciesMeta": {
|
|
98
98
|
"@nx/cypress": {
|