@nx/web 0.0.0-pr-22179-271588f
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/LICENSE +22 -0
- package/README.md +68 -0
- package/babel.d.ts +1 -0
- package/babel.js +6 -0
- package/executors.json +16 -0
- package/generators.json +25 -0
- package/index.d.ts +3 -0
- package/index.js +9 -0
- package/migrations.json +51 -0
- package/package.json +45 -0
- package/src/executors/file-server/compat.d.ts +2 -0
- package/src/executors/file-server/compat.js +5 -0
- package/src/executors/file-server/file-server.impl.d.ts +8 -0
- package/src/executors/file-server/file-server.impl.js +210 -0
- package/src/executors/file-server/schema.d.ts +20 -0
- package/src/executors/file-server/schema.json +98 -0
- package/src/generators/application/application.d.ts +5 -0
- package/src/generators/application/application.js +353 -0
- package/src/generators/application/files/app-vite/.babelrc__tmpl__ +5 -0
- package/src/generators/application/files/app-vite/index.html__tmpl__ +16 -0
- package/src/generators/application/files/app-vite/public/favicon.ico +0 -0
- package/src/generators/application/files/app-vite/src/app/app.element.__style__ +424 -0
- package/src/generators/application/files/app-vite/src/app/app.element.spec.ts__tmpl__ +21 -0
- package/src/generators/application/files/app-vite/src/app/app.element.ts__tmpl__ +409 -0
- package/src/generators/application/files/app-vite/src/assets/.gitkeep +0 -0
- package/src/generators/application/files/app-vite/src/main.ts__tmpl__ +1 -0
- package/src/generators/application/files/app-vite/src/styles.__style__ +1 -0
- package/src/generators/application/files/app-vite/tsconfig.app.json +9 -0
- package/src/generators/application/files/app-vite/tsconfig.json__tmpl__ +27 -0
- package/src/generators/application/files/app-webpack/src/app/app.element.__style__ +424 -0
- package/src/generators/application/files/app-webpack/src/app/app.element.spec.ts__tmpl__ +21 -0
- package/src/generators/application/files/app-webpack/src/app/app.element.ts__tmpl__ +409 -0
- package/src/generators/application/files/app-webpack/src/assets/.gitkeep +0 -0
- package/src/generators/application/files/app-webpack/src/favicon.ico +0 -0
- package/src/generators/application/files/app-webpack/src/index.html +14 -0
- package/src/generators/application/files/app-webpack/src/main.ts__tmpl__ +1 -0
- package/src/generators/application/files/app-webpack/src/styles.__style__ +1 -0
- package/src/generators/application/files/app-webpack/tsconfig.app.json +9 -0
- package/src/generators/application/files/app-webpack/tsconfig.json +10 -0
- package/src/generators/application/files/app-webpack/webpack.config.js__tmpl__ +39 -0
- package/src/generators/application/schema.d.ts +21 -0
- package/src/generators/application/schema.json +113 -0
- package/src/generators/init/init.d.ts +4 -0
- package/src/generators/init/init.js +23 -0
- package/src/generators/init/schema.d.ts +5 -0
- package/src/generators/init/schema.json +28 -0
- package/src/generators/static-serve/schema.json +24 -0
- package/src/generators/static-serve/static-serve-configuration.d.ts +8 -0
- package/src/generators/static-serve/static-serve-configuration.js +73 -0
- package/src/migrations/update-15-0-0/add-babel-inputs.d.ts +2 -0
- package/src/migrations/update-15-0-0/add-babel-inputs.js +9 -0
- package/src/migrations/update-15-0-0/update-rollup-executor.d.ts +2 -0
- package/src/migrations/update-15-0-0/update-rollup-executor.js +33 -0
- package/src/migrations/update-15-5-4/update-babel-preset.d.ts +2 -0
- package/src/migrations/update-15-5-4/update-babel-preset.js +32 -0
- package/src/migrations/update-15-9-1/add-dropped-dependencies.d.ts +2 -0
- package/src/migrations/update-15-9-1/add-dropped-dependencies.js +35 -0
- package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.d.ts +2 -0
- package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.js +9 -0
- package/src/migrations/update-16-0-0-update-executors/update-16-0-0-update-executors.d.ts +2 -0
- package/src/migrations/update-16-0-0-update-executors/update-16-0-0-update-executors.js +34 -0
- package/src/plugins/webpack-nx-build-coordination-plugin.d.ts +1 -0
- package/src/plugins/webpack-nx-build-coordination-plugin.js +5 -0
- package/src/utils/fs.d.ts +1 -0
- package/src/utils/fs.js +4 -0
- package/src/utils/has-webpack-plugin.d.ts +2 -0
- package/src/utils/has-webpack-plugin.js +11 -0
- package/src/utils/normalize.d.ts +1 -0
- package/src/utils/normalize.js +4 -0
- package/src/utils/versions.d.ts +4 -0
- package/src/utils/versions.js +7 -0
- package/src/utils/wait-for-port-open.d.ts +5 -0
- package/src/utils/wait-for-port-open.js +45 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/schema",
|
|
3
|
+
"$id": "NxWebInit",
|
|
4
|
+
"cli": "nx",
|
|
5
|
+
"title": "Init Web Plugin",
|
|
6
|
+
"description": "Init Web Plugin.",
|
|
7
|
+
"type": "object",
|
|
8
|
+
"properties": {
|
|
9
|
+
"skipFormat": {
|
|
10
|
+
"description": "Skip formatting files",
|
|
11
|
+
"type": "boolean",
|
|
12
|
+
"default": false
|
|
13
|
+
},
|
|
14
|
+
"skipPackageJson": {
|
|
15
|
+
"description": "Do not add dependencies to `package.json`.",
|
|
16
|
+
"type": "boolean",
|
|
17
|
+
"default": false,
|
|
18
|
+
"x-priority": "internal"
|
|
19
|
+
},
|
|
20
|
+
"keepExistingVersions": {
|
|
21
|
+
"type": "boolean",
|
|
22
|
+
"x-priority": "internal",
|
|
23
|
+
"description": "Keep existing dependencies versions",
|
|
24
|
+
"default": false
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"required": []
|
|
28
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/schema",
|
|
3
|
+
"$id": "NxWebStaticServe",
|
|
4
|
+
"cli": "nx",
|
|
5
|
+
"title": "Static Serve Configuration",
|
|
6
|
+
"description": "Add a new serve target to serve a build apps static files. This allows for faster serving of the static build files by reusing the case. Helpful when reserving the app over and over again like in e2e tests.",
|
|
7
|
+
"type": "object",
|
|
8
|
+
"properties": {
|
|
9
|
+
"buildTarget": {
|
|
10
|
+
"type": "string",
|
|
11
|
+
"description": "Name of the build target to serve"
|
|
12
|
+
},
|
|
13
|
+
"outputPath": {
|
|
14
|
+
"type": "string",
|
|
15
|
+
"description": "Path to the directory of the built files. This is only needed if buildTarget doesn't specify an outputPath executor option."
|
|
16
|
+
},
|
|
17
|
+
"targetName": {
|
|
18
|
+
"type": "string",
|
|
19
|
+
"description": "Name of the serve target to add. Defaults to 'serve-static'.",
|
|
20
|
+
"default": "serve-static"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"required": ["buildTarget"]
|
|
24
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Tree } from '@nx/devkit';
|
|
2
|
+
interface WebStaticServeSchema {
|
|
3
|
+
buildTarget: string;
|
|
4
|
+
outputPath?: string;
|
|
5
|
+
targetName?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function webStaticServeGenerator(tree: Tree, options: WebStaticServeSchema): void;
|
|
8
|
+
export default webStaticServeGenerator;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.webStaticServeGenerator = void 0;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
function webStaticServeGenerator(tree, options) {
|
|
6
|
+
const opts = normalizeOptions(tree, options);
|
|
7
|
+
addStaticConfig(tree, opts);
|
|
8
|
+
}
|
|
9
|
+
exports.webStaticServeGenerator = webStaticServeGenerator;
|
|
10
|
+
function normalizeOptions(tree, options) {
|
|
11
|
+
const target = (0, devkit_1.parseTargetString)(options.buildTarget);
|
|
12
|
+
const opts = {
|
|
13
|
+
...options,
|
|
14
|
+
targetName: options.targetName || 'serve-static',
|
|
15
|
+
projectName: target.project,
|
|
16
|
+
};
|
|
17
|
+
const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, target.project);
|
|
18
|
+
const buildTargetConfig = projectConfig?.targets?.[target.target];
|
|
19
|
+
if (!buildTargetConfig) {
|
|
20
|
+
throw new Error((0, devkit_1.stripIndents) `Unable to read the target configuration for the provided build target, ${opts.buildTarget}
|
|
21
|
+
Are you sure this target exists?`);
|
|
22
|
+
}
|
|
23
|
+
if (projectConfig.targets[opts.targetName]) {
|
|
24
|
+
throw new Error((0, devkit_1.stripIndents) `Project ${target.project} already has a '${opts.targetName}' target configured.
|
|
25
|
+
Either rename or remove the existing '${opts.targetName}' target and try again.
|
|
26
|
+
Optionally, you can provide a different name with the --target-name option other than '${opts.targetName}'`);
|
|
27
|
+
}
|
|
28
|
+
// NOTE: @nx/web:file-server only looks for the outputPath option
|
|
29
|
+
if (!buildTargetConfig.options?.outputPath && !opts.outputPath) {
|
|
30
|
+
// attempt to find the suiteable path from the outputs
|
|
31
|
+
let maybeOutputValue;
|
|
32
|
+
for (const o of buildTargetConfig?.outputs || []) {
|
|
33
|
+
const isInterpolatedOutput = o.trim().startsWith('{options.');
|
|
34
|
+
if (!isInterpolatedOutput) {
|
|
35
|
+
continue;
|
|
36
|
+
}
|
|
37
|
+
const noBracketParts = o.replace(/[{}]/g, '').split('.');
|
|
38
|
+
if (noBracketParts.length === 2 && noBracketParts?.[1]) {
|
|
39
|
+
const key = noBracketParts[1].trim();
|
|
40
|
+
const value = buildTargetConfig.options?.[key];
|
|
41
|
+
if (value) {
|
|
42
|
+
maybeOutputValue = value;
|
|
43
|
+
break;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
// NOTE: outputDir is the storybook option.
|
|
48
|
+
opts.outputPath = buildTargetConfig.options?.outputDir || maybeOutputValue;
|
|
49
|
+
if (opts.outputPath) {
|
|
50
|
+
devkit_1.logger.warn(`Automatically detected the output path to be ${opts.outputPath}.
|
|
51
|
+
If this is incorrect, the update the staticFilePath option in the ${target.project}:${opts.targetName} target configuration`);
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
devkit_1.logger.warn((0, devkit_1.stripIndents) `${opts.buildTarget} did not have an outputPath property set and --output-path was not provided.
|
|
55
|
+
Without either options, the static serve will most likely be unable to serve your project.
|
|
56
|
+
It's recommend to provide a --output-path option in this case.`);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return opts;
|
|
60
|
+
}
|
|
61
|
+
function addStaticConfig(tree, opts) {
|
|
62
|
+
const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, opts.projectName);
|
|
63
|
+
const staticServeOptions = {
|
|
64
|
+
executor: '@nx/web:file-server',
|
|
65
|
+
options: {
|
|
66
|
+
buildTarget: opts.buildTarget,
|
|
67
|
+
staticFilePath: opts.outputPath,
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
projectConfig.targets[opts.targetName] = staticServeOptions;
|
|
71
|
+
(0, devkit_1.updateProjectConfiguration)(tree, opts.projectName, projectConfig);
|
|
72
|
+
}
|
|
73
|
+
exports.default = webStaticServeGenerator;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const devkit_1 = require("@nx/devkit");
|
|
4
|
+
const add_babel_inputs_1 = require("@nx/js/src/utils/add-babel-inputs");
|
|
5
|
+
async function default_1(tree) {
|
|
6
|
+
(0, add_babel_inputs_1.addBabelInputs)(tree);
|
|
7
|
+
await (0, devkit_1.formatFiles)(tree);
|
|
8
|
+
}
|
|
9
|
+
exports.default = default_1;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const devkit_1 = require("@nx/devkit");
|
|
4
|
+
async function update(host) {
|
|
5
|
+
const projects = (0, devkit_1.getProjects)(host);
|
|
6
|
+
for (const [name, config] of projects.entries()) {
|
|
7
|
+
let updated = false;
|
|
8
|
+
if (config?.targets?.build?.executor === '@nrwl/web:rollup') {
|
|
9
|
+
config.targets.build.executor = '@nrwl/rollup:rollup';
|
|
10
|
+
updated = true;
|
|
11
|
+
}
|
|
12
|
+
if (config?.targets?.build?.options?.formats?.includes('umd')) {
|
|
13
|
+
config.targets.build.options.formats =
|
|
14
|
+
config.targets.build.options.formats.reduce((acc, x) => {
|
|
15
|
+
const format = x === 'umd' ? 'cjs' : x;
|
|
16
|
+
if (format === 'cjs') {
|
|
17
|
+
if (!acc.includes('cjs'))
|
|
18
|
+
acc.push(format);
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
acc.push(format);
|
|
22
|
+
}
|
|
23
|
+
return acc;
|
|
24
|
+
}, []);
|
|
25
|
+
updated = true;
|
|
26
|
+
}
|
|
27
|
+
if (updated) {
|
|
28
|
+
(0, devkit_1.updateProjectConfiguration)(host, name, config);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
await (0, devkit_1.formatFiles)(host);
|
|
32
|
+
}
|
|
33
|
+
exports.default = update;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const devkit_1 = require("@nx/devkit");
|
|
4
|
+
const versions_1 = require("../../utils/versions");
|
|
5
|
+
/* Updates @nrwl/web/babel to @nrwl/js/babel because web package is no longer necessary to use webpack/rollup + babel. */
|
|
6
|
+
async function update(tree) {
|
|
7
|
+
// Add `@nrwl/js` in case it was missing before.
|
|
8
|
+
(0, devkit_1.addDependenciesToPackageJson)(tree, {}, {
|
|
9
|
+
'@nrwl/js': versions_1.nxVersion,
|
|
10
|
+
});
|
|
11
|
+
const projects = (0, devkit_1.getProjects)(tree);
|
|
12
|
+
projects.forEach((config, name) => {
|
|
13
|
+
const babelrcPath = (0, devkit_1.joinPathFragments)(config.root, '.babelrc');
|
|
14
|
+
if (!tree.exists(babelrcPath))
|
|
15
|
+
return;
|
|
16
|
+
const babelrc = (0, devkit_1.readJson)(tree, babelrcPath);
|
|
17
|
+
const idx = babelrc?.presets?.findIndex((p) => typeof p === 'string'
|
|
18
|
+
? p === '@nrwl/web/babel'
|
|
19
|
+
: p[0] === '@nrwl/web/babel');
|
|
20
|
+
if (idx === -1)
|
|
21
|
+
return;
|
|
22
|
+
const preset = babelrc.presets[idx];
|
|
23
|
+
if (typeof preset === 'string') {
|
|
24
|
+
babelrc.presets.splice(idx, 1, '@nrwl/js/babel');
|
|
25
|
+
}
|
|
26
|
+
else if (Array.isArray(preset)) {
|
|
27
|
+
babelrc.presets.splice(idx, 1, ['@nrwl/js/babel', preset[1]]);
|
|
28
|
+
}
|
|
29
|
+
(0, devkit_1.writeJson)(tree, babelrcPath, babelrc);
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
exports.default = update;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const devkit_1 = require("@nx/devkit");
|
|
4
|
+
async function addDroppedDependencies(tree) {
|
|
5
|
+
const devDependencies = {};
|
|
6
|
+
const droppedDependencies = [
|
|
7
|
+
'@nrwl/linter',
|
|
8
|
+
'@nrwl/cypress',
|
|
9
|
+
'@nrwl/jest',
|
|
10
|
+
'@nrwl/rollup',
|
|
11
|
+
];
|
|
12
|
+
const projects = (0, devkit_1.getProjects)(tree);
|
|
13
|
+
for (const [_, projectConfiguration] of projects) {
|
|
14
|
+
for (const [_, targetConfiguration] of Object.entries(projectConfiguration.targets ?? {})) {
|
|
15
|
+
for (const droppedDependency of droppedDependencies) {
|
|
16
|
+
if (targetConfiguration?.['executor']?.startsWith(droppedDependency + ':')) {
|
|
17
|
+
devDependencies[droppedDependency] = devkit_1.NX_VERSION;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
23
|
+
for (const [_, targetConfiguration] of Object.entries(nxJson?.targetDefaults ?? {})) {
|
|
24
|
+
for (const droppedDependency of droppedDependencies) {
|
|
25
|
+
if (targetConfiguration?.['executor']?.startsWith(droppedDependency + ':')) {
|
|
26
|
+
devDependencies[droppedDependency] = devkit_1.NX_VERSION;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
if (Object.keys(devDependencies).length > 0) {
|
|
31
|
+
(0, devkit_1.addDependenciesToPackageJson)(tree, {}, devDependencies);
|
|
32
|
+
}
|
|
33
|
+
await (0, devkit_1.formatFiles)(tree);
|
|
34
|
+
}
|
|
35
|
+
exports.default = addDroppedDependencies;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const devkit_1 = require("@nx/devkit");
|
|
4
|
+
const replace_package_1 = require("@nx/devkit/src/utils/replace-package");
|
|
5
|
+
async function replacePackage(tree) {
|
|
6
|
+
await (0, replace_package_1.replaceNrwlPackageWithNxPackage)(tree, '@nrwl/web', '@nx/web');
|
|
7
|
+
await (0, devkit_1.formatFiles)(tree);
|
|
8
|
+
}
|
|
9
|
+
exports.default = replacePackage;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const devkit_1 = require("@nx/devkit");
|
|
4
|
+
const versions_1 = require("../../utils/versions");
|
|
5
|
+
async function update(host) {
|
|
6
|
+
const projects = (0, devkit_1.getProjects)(host);
|
|
7
|
+
const deps = {};
|
|
8
|
+
for (const [name, config] of projects.entries()) {
|
|
9
|
+
let updated = false;
|
|
10
|
+
// webpack
|
|
11
|
+
if (config?.targets?.build?.executor === '@nrwl/web:webpack') {
|
|
12
|
+
config.targets.build.executor = '@nx/webpack:webpack';
|
|
13
|
+
deps['@nx/webpack'] = versions_1.nxVersion;
|
|
14
|
+
updated = true;
|
|
15
|
+
}
|
|
16
|
+
if (config?.targets?.serve?.executor === '@nrwl/web:dev-server') {
|
|
17
|
+
config.targets.serve.executor = '@nx/webpack:dev-server';
|
|
18
|
+
deps['@nx/webpack'] = versions_1.nxVersion;
|
|
19
|
+
updated = true;
|
|
20
|
+
}
|
|
21
|
+
// rollup
|
|
22
|
+
if (config?.targets?.build?.executor === '@nrwl/web:rollup') {
|
|
23
|
+
config.targets.build.executor = '@nx/rollup:rollup';
|
|
24
|
+
deps['@nx/rollup'] = versions_1.nxVersion;
|
|
25
|
+
updated = true;
|
|
26
|
+
}
|
|
27
|
+
if (updated) {
|
|
28
|
+
(0, devkit_1.updateProjectConfiguration)(host, name, config);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
await (0, devkit_1.formatFiles)(host);
|
|
32
|
+
return (0, devkit_1.addDependenciesToPackageJson)(host, {}, deps);
|
|
33
|
+
}
|
|
34
|
+
exports.default = update;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { WebpackNxBuildCoordinationPlugin } from '@nx/webpack/src/plugins/webpack-nx-build-coordination-plugin';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WebpackNxBuildCoordinationPlugin = void 0;
|
|
4
|
+
var webpack_nx_build_coordination_plugin_1 = require("@nx/webpack/src/plugins/webpack-nx-build-coordination-plugin");
|
|
5
|
+
Object.defineProperty(exports, "WebpackNxBuildCoordinationPlugin", { enumerable: true, get: function () { return webpack_nx_build_coordination_plugin_1.WebpackNxBuildCoordinationPlugin; } });
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@nx/webpack/src/utils/fs';
|
package/src/utils/fs.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.hasWebpackPlugin = void 0;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
function hasWebpackPlugin(tree) {
|
|
6
|
+
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
7
|
+
return !!nxJson.plugins?.some((p) => typeof p === 'string'
|
|
8
|
+
? p === '@nx/webpack/plugin'
|
|
9
|
+
: p.plugin === '@nx/webpack/plugin');
|
|
10
|
+
}
|
|
11
|
+
exports.hasWebpackPlugin = hasWebpackPlugin;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@nx/webpack/src/executors/webpack/lib/normalize-options';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.tsLibVersion = exports.typesNodeVersion = exports.swcLoaderVersion = exports.nxVersion = void 0;
|
|
4
|
+
exports.nxVersion = require('../../package.json').version;
|
|
5
|
+
exports.swcLoaderVersion = '0.1.15';
|
|
6
|
+
exports.typesNodeVersion = '18.16.9';
|
|
7
|
+
exports.tsLibVersion = '^2.3.0';
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.waitForPortOpen = void 0;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const net = require("net");
|
|
6
|
+
function waitForPortOpen(port, options = {}) {
|
|
7
|
+
const host = options.host ?? '127.0.0.1';
|
|
8
|
+
const allowedErrorCodes = ['ECONNREFUSED', 'ECONNRESET', 'ETIMEDOUT'];
|
|
9
|
+
return new Promise((resolve, reject) => {
|
|
10
|
+
const checkPort = (retries = options.retries ?? 120) => {
|
|
11
|
+
const client = new net.Socket();
|
|
12
|
+
const cleanupClient = () => {
|
|
13
|
+
client.removeAllListeners('connect');
|
|
14
|
+
client.removeAllListeners('error');
|
|
15
|
+
client.end();
|
|
16
|
+
client.destroy();
|
|
17
|
+
client.unref();
|
|
18
|
+
};
|
|
19
|
+
client.once('connect', () => {
|
|
20
|
+
cleanupClient();
|
|
21
|
+
resolve();
|
|
22
|
+
});
|
|
23
|
+
client.once('error', (err) => {
|
|
24
|
+
if (retries === 0 || !allowedErrorCodes.includes(err['code'])) {
|
|
25
|
+
if (process.env['NX_VERBOSE_LOGGING'] === 'true') {
|
|
26
|
+
devkit_1.logger.info(`Error connecting on ${host}:${port}: ${err['code'] || err}`);
|
|
27
|
+
}
|
|
28
|
+
cleanupClient();
|
|
29
|
+
reject(err);
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
setTimeout(() => checkPort(retries - 1), options.retryDelay ?? 1000);
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
// Node will use IPv6 if it is available, but this can cause issues if the server is only listening on IPv4.
|
|
36
|
+
// Hard-coding to look on 127.0.0.1 to avoid using the IPv6 loopback address "::1".
|
|
37
|
+
if (process.env['NX_VERBOSE_LOGGING'] === 'true') {
|
|
38
|
+
devkit_1.logger.info(`Connecting on ${host}:${port}`);
|
|
39
|
+
}
|
|
40
|
+
client.connect({ port, host });
|
|
41
|
+
};
|
|
42
|
+
checkPort();
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
exports.waitForPortOpen = waitForPortOpen;
|