@nx/angular 0.0.0-pr-30418-4e2b721 → 0.0.0-pr-3-ec41644
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/generators.json +0 -5
- package/migrations.json +0 -163
- package/package.json +8 -10
- package/src/builders/dev-server/schema.json +3 -3
- package/src/generators/application/lib/normalize-options.js +1 -1
- package/src/generators/host/host.js +1 -1
- package/src/generators/library/lib/normalize-options.js +1 -1
- package/src/generators/ngrx-feature-store/schema.d.ts +1 -1
- package/src/generators/remote/remote.js +1 -1
- package/src/generators/setup-ssr/files/v19+/application-builder/ngmodule-src/app/__rootModuleFileName__ +2 -2
- package/src/generators/setup-ssr/files/v19+/application-builder/server/__serverFileName__ +1 -1
- package/src/generators/setup-ssr/files/v19+/application-builder/standalone-src/app/app.config.server.ts__tpl__ +2 -2
- package/src/generators/setup-ssr/files/v19+/application-builder-common-engine/server/__serverFileName__ +0 -2
- package/src/generators/setup-ssr/lib/generate-files.js +1 -12
- package/src/generators/utils/ensure-angular-dependencies.js +1 -0
- package/src/utils/backward-compatible-versions.js +0 -2
- package/src/utils/versions.d.ts +6 -7
- package/src/utils/versions.js +7 -8
- package/src/generators/convert-to-rspack/convert-to-rspack.d.ts +0 -4
- package/src/generators/convert-to-rspack/convert-to-rspack.js +0 -318
- package/src/generators/convert-to-rspack/lib/create-config.d.ts +0 -2
- package/src/generators/convert-to-rspack/lib/create-config.js +0 -48
- package/src/generators/convert-to-rspack/lib/get-custom-webpack-config.d.ts +0 -6
- package/src/generators/convert-to-rspack/lib/get-custom-webpack-config.js +0 -75
- package/src/generators/convert-to-rspack/lib/update-tsconfig.d.ts +0 -2
- package/src/generators/convert-to-rspack/lib/update-tsconfig.js +0 -14
- package/src/generators/convert-to-rspack/lib/validate-supported-executor.d.ts +0 -2
- package/src/generators/convert-to-rspack/lib/validate-supported-executor.js +0 -14
- package/src/generators/convert-to-rspack/schema.d.ts +0 -5
- package/src/generators/convert-to-rspack/schema.json +0 -30
- package/src/migrations/update-20-5-0/update-angular-cli.d.ts +0 -3
- package/src/migrations/update-20-5-0/update-angular-cli.js +0 -23
package/generators.json
CHANGED
|
@@ -38,11 +38,6 @@
|
|
|
38
38
|
"schema": "./src/generators/convert-to-application-executor/schema.json",
|
|
39
39
|
"description": "Converts projects to use the `@nx/angular:application` executor or the `@angular-devkit/build-angular:application` builder."
|
|
40
40
|
},
|
|
41
|
-
"convert-to-rspack": {
|
|
42
|
-
"factory": "./src/generators/convert-to-rspack/convert-to-rspack",
|
|
43
|
-
"schema": "./src/generators/convert-to-rspack/schema.json",
|
|
44
|
-
"description": "Converts Angular Webpack projects to use Rspack."
|
|
45
|
-
},
|
|
46
41
|
"directive": {
|
|
47
42
|
"factory": "./src/generators/directive/directive",
|
|
48
43
|
"schema": "./src/generators/directive/schema.json",
|
package/migrations.json
CHANGED
|
@@ -347,15 +347,6 @@
|
|
|
347
347
|
},
|
|
348
348
|
"description": "Update the @angular/cli package version to ~19.1.0.",
|
|
349
349
|
"factory": "./src/migrations/update-20-4-0/update-angular-cli"
|
|
350
|
-
},
|
|
351
|
-
"update-angular-cli-version-19-2-0": {
|
|
352
|
-
"cli": "nx",
|
|
353
|
-
"version": "20.5.0-beta.5",
|
|
354
|
-
"requires": {
|
|
355
|
-
"@angular/core": ">=19.2.0"
|
|
356
|
-
},
|
|
357
|
-
"description": "Update the @angular/cli package version to ~19.2.0.",
|
|
358
|
-
"factory": "./src/migrations/update-20-5-0/update-angular-cli"
|
|
359
350
|
}
|
|
360
351
|
},
|
|
361
352
|
"packageJsonUpdates": {
|
|
@@ -1058,22 +1049,6 @@
|
|
|
1058
1049
|
"@angular-eslint/utils": {
|
|
1059
1050
|
"version": "^18.0.1",
|
|
1060
1051
|
"alwaysAddToPackageJson": false
|
|
1061
|
-
},
|
|
1062
|
-
"@angular-eslint/schematics": {
|
|
1063
|
-
"version": "^18.0.1",
|
|
1064
|
-
"alwaysAddToPackageJson": false
|
|
1065
|
-
},
|
|
1066
|
-
"@angular-eslint/test-utils": {
|
|
1067
|
-
"version": "^18.0.1",
|
|
1068
|
-
"alwaysAddToPackageJson": false
|
|
1069
|
-
},
|
|
1070
|
-
"@angular-eslint/builder": {
|
|
1071
|
-
"version": "^18.0.1",
|
|
1072
|
-
"alwaysAddToPackageJson": false
|
|
1073
|
-
},
|
|
1074
|
-
"@angular-eslint/bundled-angular-compiler": {
|
|
1075
|
-
"version": "^18.0.1",
|
|
1076
|
-
"alwaysAddToPackageJson": false
|
|
1077
1052
|
}
|
|
1078
1053
|
}
|
|
1079
1054
|
},
|
|
@@ -1393,22 +1368,6 @@
|
|
|
1393
1368
|
"@angular-eslint/utils": {
|
|
1394
1369
|
"version": "^19.0.0",
|
|
1395
1370
|
"alwaysAddToPackageJson": false
|
|
1396
|
-
},
|
|
1397
|
-
"@angular-eslint/schematics": {
|
|
1398
|
-
"version": "^19.0.0",
|
|
1399
|
-
"alwaysAddToPackageJson": false
|
|
1400
|
-
},
|
|
1401
|
-
"@angular-eslint/test-utils": {
|
|
1402
|
-
"version": "^19.0.0",
|
|
1403
|
-
"alwaysAddToPackageJson": false
|
|
1404
|
-
},
|
|
1405
|
-
"@angular-eslint/builder": {
|
|
1406
|
-
"version": "^19.0.0",
|
|
1407
|
-
"alwaysAddToPackageJson": false
|
|
1408
|
-
},
|
|
1409
|
-
"@angular-eslint/bundled-angular-compiler": {
|
|
1410
|
-
"version": "^19.0.0",
|
|
1411
|
-
"alwaysAddToPackageJson": false
|
|
1412
1371
|
}
|
|
1413
1372
|
}
|
|
1414
1373
|
},
|
|
@@ -1451,22 +1410,6 @@
|
|
|
1451
1410
|
"@angular-eslint/utils": {
|
|
1452
1411
|
"version": "^19.0.2",
|
|
1453
1412
|
"alwaysAddToPackageJson": false
|
|
1454
|
-
},
|
|
1455
|
-
"@angular-eslint/schematics": {
|
|
1456
|
-
"version": "^19.0.2",
|
|
1457
|
-
"alwaysAddToPackageJson": false
|
|
1458
|
-
},
|
|
1459
|
-
"@angular-eslint/test-utils": {
|
|
1460
|
-
"version": "^19.0.2",
|
|
1461
|
-
"alwaysAddToPackageJson": false
|
|
1462
|
-
},
|
|
1463
|
-
"@angular-eslint/builder": {
|
|
1464
|
-
"version": "^19.0.2",
|
|
1465
|
-
"alwaysAddToPackageJson": false
|
|
1466
|
-
},
|
|
1467
|
-
"@angular-eslint/bundled-angular-compiler": {
|
|
1468
|
-
"version": "^19.0.2",
|
|
1469
|
-
"alwaysAddToPackageJson": false
|
|
1470
1413
|
}
|
|
1471
1414
|
}
|
|
1472
1415
|
},
|
|
@@ -1542,112 +1485,6 @@
|
|
|
1542
1485
|
"alwaysAddToPackageJson": false
|
|
1543
1486
|
}
|
|
1544
1487
|
}
|
|
1545
|
-
},
|
|
1546
|
-
"20.5.0": {
|
|
1547
|
-
"version": "20.5.0-beta.5",
|
|
1548
|
-
"x-prompt": "Do you want to update the Angular version to v19.2?",
|
|
1549
|
-
"requires": {
|
|
1550
|
-
"@angular/core": ">=19.1.0 <19.2.0"
|
|
1551
|
-
},
|
|
1552
|
-
"packages": {
|
|
1553
|
-
"@angular-devkit/build-angular": {
|
|
1554
|
-
"version": "~19.2.0",
|
|
1555
|
-
"alwaysAddToPackageJson": false
|
|
1556
|
-
},
|
|
1557
|
-
"@angular-devkit/core": {
|
|
1558
|
-
"version": "~19.2.0",
|
|
1559
|
-
"alwaysAddToPackageJson": false
|
|
1560
|
-
},
|
|
1561
|
-
"@angular-devkit/schematics": {
|
|
1562
|
-
"version": "~19.2.0",
|
|
1563
|
-
"alwaysAddToPackageJson": false
|
|
1564
|
-
},
|
|
1565
|
-
"@angular/build": {
|
|
1566
|
-
"version": "~19.2.0",
|
|
1567
|
-
"alwaysAddToPackageJson": false
|
|
1568
|
-
},
|
|
1569
|
-
"@angular/pwa": {
|
|
1570
|
-
"version": "~19.2.0",
|
|
1571
|
-
"alwaysAddToPackageJson": false
|
|
1572
|
-
},
|
|
1573
|
-
"@angular/ssr": {
|
|
1574
|
-
"version": "~19.2.0",
|
|
1575
|
-
"alwaysAddToPackageJson": false
|
|
1576
|
-
},
|
|
1577
|
-
"@schematics/angular": {
|
|
1578
|
-
"version": "~19.2.0",
|
|
1579
|
-
"alwaysAddToPackageJson": false
|
|
1580
|
-
},
|
|
1581
|
-
"@angular-devkit/architect": {
|
|
1582
|
-
"version": "~0.1902.0",
|
|
1583
|
-
"alwaysAddToPackageJson": false
|
|
1584
|
-
},
|
|
1585
|
-
"@angular-devkit/build-webpack": {
|
|
1586
|
-
"version": "~0.1902.0",
|
|
1587
|
-
"alwaysAddToPackageJson": false
|
|
1588
|
-
},
|
|
1589
|
-
"@angular/core": {
|
|
1590
|
-
"version": "~19.2.0",
|
|
1591
|
-
"alwaysAddToPackageJson": true
|
|
1592
|
-
},
|
|
1593
|
-
"@angular/material": {
|
|
1594
|
-
"version": "~19.2.1",
|
|
1595
|
-
"alwaysAddToPackageJson": false
|
|
1596
|
-
},
|
|
1597
|
-
"@angular/cdk": {
|
|
1598
|
-
"version": "~19.2.1",
|
|
1599
|
-
"alwaysAddToPackageJson": false
|
|
1600
|
-
},
|
|
1601
|
-
"ng-packagr": {
|
|
1602
|
-
"version": "~19.2.0",
|
|
1603
|
-
"alwaysAddToPackageJson": false
|
|
1604
|
-
}
|
|
1605
|
-
}
|
|
1606
|
-
},
|
|
1607
|
-
"20.5.0-angular-eslint": {
|
|
1608
|
-
"version": "20.5.0-rc.1",
|
|
1609
|
-
"requires": {
|
|
1610
|
-
"eslint": "^8.57.0 || ^9.0.0",
|
|
1611
|
-
"@angular/core": ">= 19.0.0 < 20.0.0"
|
|
1612
|
-
},
|
|
1613
|
-
"packages": {
|
|
1614
|
-
"angular-eslint": {
|
|
1615
|
-
"version": "^19.2.0",
|
|
1616
|
-
"alwaysAddToPackageJson": false
|
|
1617
|
-
},
|
|
1618
|
-
"@angular-eslint/eslint-plugin": {
|
|
1619
|
-
"version": "^19.2.0",
|
|
1620
|
-
"alwaysAddToPackageJson": false
|
|
1621
|
-
},
|
|
1622
|
-
"@angular-eslint/eslint-plugin-template": {
|
|
1623
|
-
"version": "^19.2.0",
|
|
1624
|
-
"alwaysAddToPackageJson": false
|
|
1625
|
-
},
|
|
1626
|
-
"@angular-eslint/template-parser": {
|
|
1627
|
-
"version": "^19.2.0",
|
|
1628
|
-
"alwaysAddToPackageJson": false
|
|
1629
|
-
},
|
|
1630
|
-
"@angular-eslint/utils": {
|
|
1631
|
-
"version": "^19.2.0",
|
|
1632
|
-
"alwaysAddToPackageJson": false
|
|
1633
|
-
},
|
|
1634
|
-
"@angular-eslint/schematics": {
|
|
1635
|
-
"version": "^19.2.0",
|
|
1636
|
-
"alwaysAddToPackageJson": false
|
|
1637
|
-
},
|
|
1638
|
-
"@angular-eslint/test-utils": {
|
|
1639
|
-
"version": "^19.2.0",
|
|
1640
|
-
"alwaysAddToPackageJson": false
|
|
1641
|
-
},
|
|
1642
|
-
"@angular-eslint/builder": {
|
|
1643
|
-
"version": "^19.2.0",
|
|
1644
|
-
"alwaysAddToPackageJson": false
|
|
1645
|
-
},
|
|
1646
|
-
"@angular-eslint/bundled-angular-compiler": {
|
|
1647
|
-
"version": "^19.2.0",
|
|
1648
|
-
"alwaysAddToPackageJson": false
|
|
1649
|
-
}
|
|
1650
|
-
}
|
|
1651
1488
|
}
|
|
1652
1489
|
}
|
|
1653
1490
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/angular",
|
|
3
|
-
"version": "0.0.0-pr-
|
|
3
|
+
"version": "0.0.0-pr-3-ec41644",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The Nx Plugin for Angular contains executors, generators, and utilities for managing Angular applications and libraries within an Nx workspace. It provides: \n\n- Integration with libraries such as Storybook, Jest, ESLint, Tailwind CSS, Playwright and Cypress. \n\n- Generators to help scaffold code quickly (like: Micro Frontends, Libraries, both internal to your codebase and publishable to npm) \n\n- Single Component Application Modules (SCAMs) \n\n- NgRx helpers. \n\n- Utilities for automatic workspace refactoring.",
|
|
6
6
|
"repository": {
|
|
@@ -65,21 +65,19 @@
|
|
|
65
65
|
"dependencies": {
|
|
66
66
|
"@phenomnomnominal/tsquery": "~5.0.1",
|
|
67
67
|
"@typescript-eslint/type-utils": "^8.0.0",
|
|
68
|
-
"enquirer": "~2.3.6",
|
|
69
68
|
"picocolors": "^1.1.0",
|
|
70
69
|
"magic-string": "~0.30.2",
|
|
71
70
|
"minimatch": "9.0.3",
|
|
72
71
|
"semver": "^7.5.3",
|
|
73
72
|
"tslib": "^2.3.0",
|
|
74
73
|
"webpack-merge": "^5.8.0",
|
|
75
|
-
"@nx/devkit": "0.0.0-pr-
|
|
76
|
-
"@nx/js": "0.0.0-pr-
|
|
77
|
-
"@nx/eslint": "0.0.0-pr-
|
|
78
|
-
"@nx/webpack": "0.0.0-pr-
|
|
79
|
-
"@nx/
|
|
80
|
-
"@nx/
|
|
81
|
-
"@nx/
|
|
82
|
-
"@nx/workspace": "0.0.0-pr-30418-4e2b721",
|
|
74
|
+
"@nx/devkit": "0.0.0-pr-3-ec41644",
|
|
75
|
+
"@nx/js": "0.0.0-pr-3-ec41644",
|
|
76
|
+
"@nx/eslint": "0.0.0-pr-3-ec41644",
|
|
77
|
+
"@nx/webpack": "0.0.0-pr-3-ec41644",
|
|
78
|
+
"@nx/module-federation": "0.0.0-pr-3-ec41644",
|
|
79
|
+
"@nx/web": "0.0.0-pr-3-ec41644",
|
|
80
|
+
"@nx/workspace": "0.0.0-pr-3-ec41644",
|
|
83
81
|
"piscina": "^4.4.0"
|
|
84
82
|
},
|
|
85
83
|
"peerDependencies": {
|
|
@@ -78,11 +78,11 @@
|
|
|
78
78
|
},
|
|
79
79
|
"publicHost": {
|
|
80
80
|
"type": "string",
|
|
81
|
-
"description": "The URL that the browser client (or live-reload client, if enabled) should use to connect to the development server. Use for a complex dev server setup, such as one with reverse proxies.
|
|
81
|
+
"description": "The URL that the browser client (or live-reload client, if enabled) should use to connect to the development server. Use for a complex dev server setup, such as one with reverse proxies."
|
|
82
82
|
},
|
|
83
83
|
"allowedHosts": {
|
|
84
84
|
"type": "array",
|
|
85
|
-
"description": "List of hosts that are allowed to access the dev server.
|
|
85
|
+
"description": "List of hosts that are allowed to access the dev server.",
|
|
86
86
|
"default": [],
|
|
87
87
|
"items": {
|
|
88
88
|
"type": "string"
|
|
@@ -94,7 +94,7 @@
|
|
|
94
94
|
},
|
|
95
95
|
"disableHostCheck": {
|
|
96
96
|
"type": "boolean",
|
|
97
|
-
"description": "Don't verify connected clients are part of allowed hosts.
|
|
97
|
+
"description": "Don't verify connected clients are part of allowed hosts.",
|
|
98
98
|
"default": false
|
|
99
99
|
},
|
|
100
100
|
"hmr": {
|
|
@@ -6,7 +6,7 @@ const project_name_and_root_utils_1 = require("@nx/devkit/src/generators/project
|
|
|
6
6
|
const eslint_1 = require("@nx/eslint");
|
|
7
7
|
const test_runners_1 = require("../../../utils/test-runners");
|
|
8
8
|
async function normalizeOptions(host, options) {
|
|
9
|
-
await (0, project_name_and_root_utils_1.
|
|
9
|
+
await (0, project_name_and_root_utils_1.ensureProjectName)(host, options, 'application');
|
|
10
10
|
const { projectName: appProjectName, projectRoot: appProjectRoot } = await (0, project_name_and_root_utils_1.determineProjectNameAndRootOptions)(host, {
|
|
11
11
|
name: options.name,
|
|
12
12
|
projectType: 'application',
|
|
@@ -39,7 +39,7 @@ async function host(tree, schema) {
|
|
|
39
39
|
}
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
|
-
await (0, project_name_and_root_utils_1.
|
|
42
|
+
await (0, project_name_and_root_utils_1.ensureProjectName)(tree, options, 'application');
|
|
43
43
|
const { projectName: hostProjectName, projectRoot: appRoot } = await (0, project_name_and_root_utils_1.determineProjectNameAndRootOptions)(tree, {
|
|
44
44
|
name: options.name,
|
|
45
45
|
projectType: 'application',
|
|
@@ -22,7 +22,7 @@ async function normalizeOptions(host, schema) {
|
|
|
22
22
|
skipModule: schema.skipModule || schema.standalone,
|
|
23
23
|
...schema,
|
|
24
24
|
};
|
|
25
|
-
await (0, project_name_and_root_utils_1.
|
|
25
|
+
await (0, project_name_and_root_utils_1.ensureProjectName)(host, options, 'library');
|
|
26
26
|
const { projectName, names: projectNames, projectRoot, importPath, } = await (0, project_name_and_root_utils_1.determineProjectNameAndRootOptions)(host, {
|
|
27
27
|
name: options.name,
|
|
28
28
|
projectType: 'library',
|
|
@@ -18,7 +18,7 @@ async function remote(tree, schema) {
|
|
|
18
18
|
if (options.host && !projects.has(options.host)) {
|
|
19
19
|
throw new Error(`The name of the application to be used as the host app does not exist. (${options.host})`);
|
|
20
20
|
}
|
|
21
|
-
await (0, project_name_and_root_utils_1.
|
|
21
|
+
await (0, project_name_and_root_utils_1.ensureProjectName)(tree, options, 'application');
|
|
22
22
|
const { projectName: remoteProjectName } = await (0, project_name_and_root_utils_1.determineProjectNameAndRootOptions)(tree, {
|
|
23
23
|
name: options.name,
|
|
24
24
|
projectType: 'application',
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { NgModule } from '@angular/core';
|
|
2
2
|
import { ServerModule } from '@angular/platform-server';<% if(serverRouting) { %>
|
|
3
|
-
import {
|
|
3
|
+
import { provideServerRoutesConfig } from '@angular/ssr';<% } %>
|
|
4
4
|
import { AppComponent } from './app.component';
|
|
5
5
|
import { AppModule } from './app.module';<% if(serverRouting) { %>
|
|
6
6
|
import { serverRoutes } from './app.routes.server';<% } %>
|
|
7
7
|
|
|
8
8
|
@NgModule({
|
|
9
9
|
imports: [AppModule, ServerModule],<% if(serverRouting) { %>
|
|
10
|
-
providers: [
|
|
10
|
+
providers: [provideServerRoutesConfig(serverRoutes)],<% } %>
|
|
11
11
|
bootstrap: [AppComponent],
|
|
12
12
|
})
|
|
13
13
|
export class <%= rootModuleClassName %> {}
|
|
@@ -61,6 +61,6 @@ if (isMainModule(import.meta.url)) {
|
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
/**
|
|
64
|
-
*
|
|
64
|
+
* The request handler used by the Angular CLI (dev-server and during build).
|
|
65
65
|
*/
|
|
66
66
|
export const reqHandler = createNodeRequestHandler(app);
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { mergeApplicationConfig, ApplicationConfig } from '@angular/core';
|
|
2
2
|
import { provideServerRendering } from '@angular/platform-server';<% if(serverRouting) { %>
|
|
3
|
-
import {
|
|
3
|
+
import { provideServerRoutesConfig } from '@angular/ssr';<% } %>
|
|
4
4
|
import { appConfig } from './app.config';<% if(serverRouting) { %>
|
|
5
5
|
import { serverRoutes } from './app.routes.server';<% } %>
|
|
6
6
|
|
|
7
7
|
const serverConfig: ApplicationConfig = {
|
|
8
8
|
providers: [
|
|
9
9
|
provideServerRendering()<% if(serverRouting) { %>,
|
|
10
|
-
|
|
10
|
+
provideServerRoutesConfig(serverRoutes)<% } %>
|
|
11
11
|
]
|
|
12
12
|
};
|
|
13
13
|
|
|
@@ -4,7 +4,6 @@ exports.generateSSRFiles = generateSSRFiles;
|
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const path_1 = require("path");
|
|
6
6
|
const version_utils_1 = require("../../utils/version-utils");
|
|
7
|
-
const semver_1 = require("semver");
|
|
8
7
|
function generateSSRFiles(tree, options) {
|
|
9
8
|
const project = (0, devkit_1.readProjectConfiguration)(tree, options.project);
|
|
10
9
|
if (project.targets.server ||
|
|
@@ -25,17 +24,7 @@ function generateSSRFiles(tree, options) {
|
|
|
25
24
|
pathToFiles = (0, path_1.join)(baseFilesPath, 'pre-v19', options.standalone ? 'standalone-src' : 'ngmodule-src');
|
|
26
25
|
}
|
|
27
26
|
const sourceRoot = project.sourceRoot ?? (0, devkit_1.joinPathFragments)(project.root, 'src');
|
|
28
|
-
|
|
29
|
-
const cleanedSsrVersion = ssrVersion
|
|
30
|
-
? (0, semver_1.clean)(ssrVersion) ?? (0, semver_1.coerce)(ssrVersion).version
|
|
31
|
-
: null;
|
|
32
|
-
(0, devkit_1.generateFiles)(tree, pathToFiles, sourceRoot, {
|
|
33
|
-
...options,
|
|
34
|
-
provideServerRoutingFn: !cleanedSsrVersion || (0, semver_1.gte)(cleanedSsrVersion, '19.2.0')
|
|
35
|
-
? 'provideServerRouting'
|
|
36
|
-
: 'provideServerRoutesConfig',
|
|
37
|
-
tpl: '',
|
|
38
|
-
});
|
|
27
|
+
(0, devkit_1.generateFiles)(tree, pathToFiles, sourceRoot, { ...options, tpl: '' });
|
|
39
28
|
if (angularMajorVersion >= 19 && !options.serverRouting) {
|
|
40
29
|
tree.delete((0, devkit_1.joinPathFragments)(sourceRoot, 'app/app.routes.server.ts'));
|
|
41
30
|
}
|
|
@@ -19,6 +19,7 @@ function ensureAngularDependencies(tree) {
|
|
|
19
19
|
const rxjsVersion = (0, version_utils_1.getInstalledPackageVersion)(tree, 'rxjs') ?? pkgVersions.rxjsVersion;
|
|
20
20
|
const tsLibVersion = (0, version_utils_1.getInstalledPackageVersion)(tree, 'tslib') ?? pkgVersions.tsLibVersion;
|
|
21
21
|
const zoneJsVersion = (0, version_utils_1.getInstalledPackageVersion)(tree, 'zone.js') ?? pkgVersions.zoneJsVersion;
|
|
22
|
+
dependencies['@angular/animations'] = angularVersion;
|
|
22
23
|
dependencies['@angular/common'] = angularVersion;
|
|
23
24
|
dependencies['@angular/compiler'] = angularVersion;
|
|
24
25
|
dependencies['@angular/core'] = angularVersion;
|
|
@@ -6,7 +6,6 @@ exports.backwardCompatibleVersions = {
|
|
|
6
6
|
angularVersion: '~17.3.0',
|
|
7
7
|
angularDevkitVersion: '~17.3.0',
|
|
8
8
|
ngPackagrVersion: '~17.3.0',
|
|
9
|
-
angularRspackVersion: '~20.6.1',
|
|
10
9
|
ngrxVersion: '~17.0.0',
|
|
11
10
|
rxjsVersion: '~7.8.0',
|
|
12
11
|
zoneJsVersion: '~0.14.3',
|
|
@@ -34,7 +33,6 @@ exports.backwardCompatibleVersions = {
|
|
|
34
33
|
angularVersion: '~18.2.0',
|
|
35
34
|
angularDevkitVersion: '~18.2.0',
|
|
36
35
|
ngPackagrVersion: '~18.2.0',
|
|
37
|
-
angularRspackVersion: '~20.6.1',
|
|
38
36
|
ngrxVersion: '~18.0.2',
|
|
39
37
|
rxjsVersion: '~7.8.0',
|
|
40
38
|
zoneJsVersion: '~0.14.3',
|
package/src/utils/versions.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
export declare const nxVersion: any;
|
|
2
|
-
export declare const angularVersion = "~19.
|
|
3
|
-
export declare const angularDevkitVersion = "~19.
|
|
4
|
-
export declare const ngPackagrVersion = "~19.
|
|
5
|
-
export declare const angularRspackVersion = "~20.6.1";
|
|
2
|
+
export declare const angularVersion = "~19.1.0";
|
|
3
|
+
export declare const angularDevkitVersion = "~19.1.0";
|
|
4
|
+
export declare const ngPackagrVersion = "~19.1.0";
|
|
6
5
|
export declare const ngrxVersion = "^19.0.0";
|
|
7
6
|
export declare const rxjsVersion = "~7.8.0";
|
|
8
7
|
export declare const zoneJsVersion = "~0.15.0";
|
|
@@ -13,9 +12,9 @@ export declare const typesCorsVersion = "~2.8.5";
|
|
|
13
12
|
export declare const expressVersion = "^4.21.2";
|
|
14
13
|
export declare const typesExpressVersion = "^4.17.21";
|
|
15
14
|
export declare const browserSyncVersion = "^3.0.0";
|
|
16
|
-
export declare const moduleFederationNodeVersion = "^2.6.
|
|
17
|
-
export declare const moduleFederationEnhancedVersion = "^0.
|
|
18
|
-
export declare const angularEslintVersion = "^19.2
|
|
15
|
+
export declare const moduleFederationNodeVersion = "^2.6.21";
|
|
16
|
+
export declare const moduleFederationEnhancedVersion = "^0.8.8";
|
|
17
|
+
export declare const angularEslintVersion = "^19.0.2";
|
|
19
18
|
export declare const typescriptEslintVersion = "^7.16.0";
|
|
20
19
|
export declare const tailwindVersion = "^3.0.2";
|
|
21
20
|
export declare const postcssVersion = "^8.4.5";
|
package/src/utils/versions.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.jsoncEslintParserVersion = exports.jasmineMarblesVersion = exports.typesNodeVersion = exports.jestPresetAngularVersion = exports.tsNodeVersion = exports.autoprefixerVersion = exports.postcssUrlVersion = exports.postcssVersion = exports.tailwindVersion = exports.typescriptEslintVersion = exports.angularEslintVersion = exports.moduleFederationEnhancedVersion = exports.moduleFederationNodeVersion = exports.browserSyncVersion = exports.typesExpressVersion = exports.expressVersion = exports.typesCorsVersion = exports.corsVersion = exports.tsLibVersion = exports.angularJsVersion = exports.zoneJsVersion = exports.rxjsVersion = exports.ngrxVersion = exports.
|
|
3
|
+
exports.jsoncEslintParserVersion = exports.jasmineMarblesVersion = exports.typesNodeVersion = exports.jestPresetAngularVersion = exports.tsNodeVersion = exports.autoprefixerVersion = exports.postcssUrlVersion = exports.postcssVersion = exports.tailwindVersion = exports.typescriptEslintVersion = exports.angularEslintVersion = exports.moduleFederationEnhancedVersion = exports.moduleFederationNodeVersion = exports.browserSyncVersion = exports.typesExpressVersion = exports.expressVersion = exports.typesCorsVersion = exports.corsVersion = exports.tsLibVersion = exports.angularJsVersion = exports.zoneJsVersion = exports.rxjsVersion = exports.ngrxVersion = exports.ngPackagrVersion = exports.angularDevkitVersion = exports.angularVersion = exports.nxVersion = void 0;
|
|
4
4
|
exports.nxVersion = require('../../package.json').version;
|
|
5
|
-
exports.angularVersion = '~19.
|
|
6
|
-
exports.angularDevkitVersion = '~19.
|
|
7
|
-
exports.ngPackagrVersion = '~19.
|
|
8
|
-
exports.angularRspackVersion = '~20.6.1';
|
|
5
|
+
exports.angularVersion = '~19.1.0';
|
|
6
|
+
exports.angularDevkitVersion = '~19.1.0';
|
|
7
|
+
exports.ngPackagrVersion = '~19.1.0';
|
|
9
8
|
exports.ngrxVersion = '^19.0.0';
|
|
10
9
|
exports.rxjsVersion = '~7.8.0';
|
|
11
10
|
exports.zoneJsVersion = '~0.15.0';
|
|
@@ -16,9 +15,9 @@ exports.typesCorsVersion = '~2.8.5';
|
|
|
16
15
|
exports.expressVersion = '^4.21.2';
|
|
17
16
|
exports.typesExpressVersion = '^4.17.21';
|
|
18
17
|
exports.browserSyncVersion = '^3.0.0';
|
|
19
|
-
exports.moduleFederationNodeVersion = '^2.6.
|
|
20
|
-
exports.moduleFederationEnhancedVersion = '^0.
|
|
21
|
-
exports.angularEslintVersion = '^19.2
|
|
18
|
+
exports.moduleFederationNodeVersion = '^2.6.21';
|
|
19
|
+
exports.moduleFederationEnhancedVersion = '^0.8.8';
|
|
20
|
+
exports.angularEslintVersion = '^19.0.2';
|
|
22
21
|
exports.typescriptEslintVersion = '^7.16.0';
|
|
23
22
|
exports.tailwindVersion = '^3.0.2';
|
|
24
23
|
exports.postcssVersion = '^8.4.5';
|
|
@@ -1,318 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.convertToRspack = convertToRspack;
|
|
4
|
-
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const versions_1 = require("../../utils/versions");
|
|
6
|
-
const create_config_1 = require("./lib/create-config");
|
|
7
|
-
const get_custom_webpack_config_1 = require("./lib/get-custom-webpack-config");
|
|
8
|
-
const update_tsconfig_1 = require("./lib/update-tsconfig");
|
|
9
|
-
const validate_supported_executor_1 = require("./lib/validate-supported-executor");
|
|
10
|
-
const posix_1 = require("path/posix");
|
|
11
|
-
const path_1 = require("path");
|
|
12
|
-
const executor_options_utils_1 = require("@nx/devkit/src/generators/executor-options-utils");
|
|
13
|
-
const enquirer_1 = require("enquirer");
|
|
14
|
-
const SUPPORTED_EXECUTORS = [
|
|
15
|
-
'@angular-devkit/build-angular:browser',
|
|
16
|
-
'@angular-devkit/build-angular:dev-server',
|
|
17
|
-
'@nx/angular:webpack-browser',
|
|
18
|
-
'@nx/angular:dev-server',
|
|
19
|
-
'@nx/angular:module-federation-dev-server',
|
|
20
|
-
];
|
|
21
|
-
const RENAMED_OPTIONS = {
|
|
22
|
-
main: 'browser',
|
|
23
|
-
ngswConfigPath: 'serviceWorker',
|
|
24
|
-
};
|
|
25
|
-
const REMOVED_OPTIONS = [
|
|
26
|
-
'publicHost',
|
|
27
|
-
'disableHostCheck',
|
|
28
|
-
'resourcesOutputPath',
|
|
29
|
-
'routesFile',
|
|
30
|
-
'routes',
|
|
31
|
-
'discoverRoutes',
|
|
32
|
-
'appModuleBundle',
|
|
33
|
-
'inputIndexPath',
|
|
34
|
-
'outputIndexPath',
|
|
35
|
-
'buildOptimizer',
|
|
36
|
-
'deployUrl',
|
|
37
|
-
'buildTarget',
|
|
38
|
-
'browserTarget',
|
|
39
|
-
];
|
|
40
|
-
function normalizeFromProjectRoot(tree, path, projectRoot) {
|
|
41
|
-
if (projectRoot === '.') {
|
|
42
|
-
if (!path.startsWith('./')) {
|
|
43
|
-
return `./${path}`;
|
|
44
|
-
}
|
|
45
|
-
else {
|
|
46
|
-
return path;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
else if (path.startsWith(projectRoot)) {
|
|
50
|
-
return path.replace(projectRoot, '.');
|
|
51
|
-
}
|
|
52
|
-
else if (!path.startsWith('./')) {
|
|
53
|
-
if (tree.exists(path)) {
|
|
54
|
-
const pathWithWorkspaceRoot = (0, devkit_1.joinPathFragments)(devkit_1.workspaceRoot, path);
|
|
55
|
-
const projectRootWithWorkspaceRoot = (0, devkit_1.joinPathFragments)(devkit_1.workspaceRoot, projectRoot);
|
|
56
|
-
return (0, path_1.relative)(projectRootWithWorkspaceRoot, pathWithWorkspaceRoot);
|
|
57
|
-
}
|
|
58
|
-
return `./${path}`;
|
|
59
|
-
}
|
|
60
|
-
return path;
|
|
61
|
-
}
|
|
62
|
-
const defaultNormalizer = (tree, path, root) => normalizeFromProjectRoot(tree, path, root);
|
|
63
|
-
const PATH_NORMALIZER = {
|
|
64
|
-
index: (tree, path, root) => {
|
|
65
|
-
if (typeof path === 'string') {
|
|
66
|
-
return normalizeFromProjectRoot(tree, path, root);
|
|
67
|
-
}
|
|
68
|
-
return {
|
|
69
|
-
input: normalizeFromProjectRoot(tree, path.input, root),
|
|
70
|
-
output: path.output ?? 'index.html',
|
|
71
|
-
};
|
|
72
|
-
},
|
|
73
|
-
indexHtmlTransformer: defaultNormalizer,
|
|
74
|
-
main: defaultNormalizer,
|
|
75
|
-
server: defaultNormalizer,
|
|
76
|
-
tsConfig: defaultNormalizer,
|
|
77
|
-
outputPath: (tree, path, root) => {
|
|
78
|
-
const relativePathFromWorkspaceRoot = (0, path_1.relative)((0, devkit_1.joinPathFragments)(devkit_1.workspaceRoot, root), devkit_1.workspaceRoot);
|
|
79
|
-
return (0, devkit_1.joinPathFragments)(relativePathFromWorkspaceRoot, path);
|
|
80
|
-
},
|
|
81
|
-
proxyConfig: defaultNormalizer,
|
|
82
|
-
polyfills: (tree, paths, root) => {
|
|
83
|
-
const normalizedPaths = [];
|
|
84
|
-
const normalizeFn = (path) => {
|
|
85
|
-
try {
|
|
86
|
-
const resolvedPath = require.resolve(path, {
|
|
87
|
-
paths: [(0, posix_1.join)(devkit_1.workspaceRoot, 'node_modules')],
|
|
88
|
-
});
|
|
89
|
-
normalizedPaths.push(path);
|
|
90
|
-
}
|
|
91
|
-
catch {
|
|
92
|
-
normalizedPaths.push(normalizeFromProjectRoot(tree, path, root));
|
|
93
|
-
}
|
|
94
|
-
};
|
|
95
|
-
if (typeof paths === 'string') {
|
|
96
|
-
normalizeFn(paths);
|
|
97
|
-
}
|
|
98
|
-
else {
|
|
99
|
-
for (const path of paths) {
|
|
100
|
-
normalizeFn(path);
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
return normalizedPaths;
|
|
104
|
-
},
|
|
105
|
-
styles: (tree, paths, root) => {
|
|
106
|
-
const normalizedPaths = [];
|
|
107
|
-
for (const path of paths) {
|
|
108
|
-
if (typeof path === 'string') {
|
|
109
|
-
normalizedPaths.push(normalizeFromProjectRoot(tree, path, root));
|
|
110
|
-
}
|
|
111
|
-
else {
|
|
112
|
-
normalizedPaths.push({
|
|
113
|
-
input: normalizeFromProjectRoot(tree, path.input, root),
|
|
114
|
-
bundleName: path.bundleName,
|
|
115
|
-
inject: path.inject ?? true,
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
return normalizedPaths;
|
|
120
|
-
},
|
|
121
|
-
scripts: (tree, paths, root) => {
|
|
122
|
-
const normalizedPaths = [];
|
|
123
|
-
for (const path of paths) {
|
|
124
|
-
if (typeof path === 'string') {
|
|
125
|
-
normalizedPaths.push(normalizeFromProjectRoot(tree, path, root));
|
|
126
|
-
}
|
|
127
|
-
else {
|
|
128
|
-
normalizedPaths.push({
|
|
129
|
-
input: normalizeFromProjectRoot(tree, path.input, root),
|
|
130
|
-
bundleName: path.bundleName,
|
|
131
|
-
inject: path.inject ?? true,
|
|
132
|
-
});
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
return normalizedPaths;
|
|
136
|
-
},
|
|
137
|
-
assets: (tree, paths, root) => {
|
|
138
|
-
const normalizedPaths = [];
|
|
139
|
-
for (const path of paths) {
|
|
140
|
-
if (typeof path === 'string') {
|
|
141
|
-
normalizedPaths.push(normalizeFromProjectRoot(tree, path, root));
|
|
142
|
-
}
|
|
143
|
-
else {
|
|
144
|
-
normalizedPaths.push({
|
|
145
|
-
...path,
|
|
146
|
-
input: normalizeFromProjectRoot(tree, path.input, root),
|
|
147
|
-
});
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
return normalizedPaths;
|
|
151
|
-
},
|
|
152
|
-
fileReplacements: (tree, paths, root) => {
|
|
153
|
-
const normalizedPaths = [];
|
|
154
|
-
for (const path of paths) {
|
|
155
|
-
normalizedPaths.push({
|
|
156
|
-
replace: normalizeFromProjectRoot(tree, 'src' in path ? path.src : path.replace, root),
|
|
157
|
-
with: normalizeFromProjectRoot(tree, 'replaceWith' in path ? path.replaceWith : path.with, root),
|
|
158
|
-
});
|
|
159
|
-
}
|
|
160
|
-
return normalizedPaths;
|
|
161
|
-
},
|
|
162
|
-
};
|
|
163
|
-
function handleBuildTargetOptions(tree, options, newConfigurationOptions, root) {
|
|
164
|
-
let customWebpackConfigPath;
|
|
165
|
-
if (!options || Object.keys(options).length === 0) {
|
|
166
|
-
return customWebpackConfigPath;
|
|
167
|
-
}
|
|
168
|
-
if (options.customWebpackConfig) {
|
|
169
|
-
customWebpackConfigPath = options.customWebpackConfig.path;
|
|
170
|
-
delete options.customWebpackConfig;
|
|
171
|
-
}
|
|
172
|
-
if (options.outputs) {
|
|
173
|
-
// handled by the Rspack inference plugin
|
|
174
|
-
delete options.outputs;
|
|
175
|
-
}
|
|
176
|
-
for (const [key, value] of Object.entries(options)) {
|
|
177
|
-
let optionName = key;
|
|
178
|
-
let optionValue = key in PATH_NORMALIZER ? PATH_NORMALIZER[key](tree, value, root) : value;
|
|
179
|
-
if (REMOVED_OPTIONS.includes(key)) {
|
|
180
|
-
continue;
|
|
181
|
-
}
|
|
182
|
-
if (key in RENAMED_OPTIONS) {
|
|
183
|
-
optionName = RENAMED_OPTIONS[key];
|
|
184
|
-
}
|
|
185
|
-
newConfigurationOptions[optionName] = optionValue;
|
|
186
|
-
}
|
|
187
|
-
if (typeof newConfigurationOptions.polyfills === 'string') {
|
|
188
|
-
newConfigurationOptions.polyfills = [newConfigurationOptions.polyfills];
|
|
189
|
-
}
|
|
190
|
-
let outputPath = newConfigurationOptions.outputPath;
|
|
191
|
-
if (typeof outputPath === 'string') {
|
|
192
|
-
if (!/\/browser\/?$/.test(outputPath)) {
|
|
193
|
-
console.warn(`The output location of the browser build has been updated from "${outputPath}" to ` +
|
|
194
|
-
`"${(0, posix_1.join)(outputPath, 'browser')}". ` +
|
|
195
|
-
'You might need to adjust your deployment pipeline or, as an alternative, ' +
|
|
196
|
-
'set outputPath.browser to "" in order to maintain the previous functionality.');
|
|
197
|
-
}
|
|
198
|
-
else {
|
|
199
|
-
outputPath = outputPath.replace(/\/browser\/?$/, '');
|
|
200
|
-
}
|
|
201
|
-
newConfigurationOptions['outputPath'] = {
|
|
202
|
-
base: outputPath,
|
|
203
|
-
};
|
|
204
|
-
if (typeof newConfigurationOptions.resourcesOutputPath === 'string') {
|
|
205
|
-
const media = newConfigurationOptions.resourcesOutputPath.replaceAll('/', '');
|
|
206
|
-
if (media && media !== 'media') {
|
|
207
|
-
newConfigurationOptions['outputPath'] = {
|
|
208
|
-
base: outputPath,
|
|
209
|
-
media,
|
|
210
|
-
};
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
return customWebpackConfigPath;
|
|
215
|
-
}
|
|
216
|
-
function handleDevServerTargetOptions(tree, options, newConfigurationOptions, root) {
|
|
217
|
-
for (const [key, value] of Object.entries(options)) {
|
|
218
|
-
let optionName = key;
|
|
219
|
-
let optionValue = key in PATH_NORMALIZER ? PATH_NORMALIZER[key](tree, value, root) : value;
|
|
220
|
-
if (REMOVED_OPTIONS.includes(key)) {
|
|
221
|
-
continue;
|
|
222
|
-
}
|
|
223
|
-
if (key in RENAMED_OPTIONS) {
|
|
224
|
-
optionName = RENAMED_OPTIONS[key];
|
|
225
|
-
}
|
|
226
|
-
newConfigurationOptions[optionName] = optionValue;
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
async function getProjectToConvert(tree) {
|
|
230
|
-
const projects = new Set();
|
|
231
|
-
for (const executor of SUPPORTED_EXECUTORS) {
|
|
232
|
-
(0, executor_options_utils_1.forEachExecutorOptions)(tree, executor, (_, project) => {
|
|
233
|
-
projects.add(project);
|
|
234
|
-
});
|
|
235
|
-
}
|
|
236
|
-
const { project } = await (0, enquirer_1.prompt)({
|
|
237
|
-
type: 'select',
|
|
238
|
-
name: 'project',
|
|
239
|
-
message: 'Which project would you like to convert to rspack?',
|
|
240
|
-
choices: Array.from(projects),
|
|
241
|
-
});
|
|
242
|
-
return project;
|
|
243
|
-
}
|
|
244
|
-
async function convertToRspack(tree, schema) {
|
|
245
|
-
let { project: projectName } = schema;
|
|
246
|
-
if (!projectName) {
|
|
247
|
-
projectName = await getProjectToConvert(tree);
|
|
248
|
-
}
|
|
249
|
-
const project = (0, devkit_1.readProjectConfiguration)(tree, projectName);
|
|
250
|
-
const tasks = [];
|
|
251
|
-
const createConfigOptions = {
|
|
252
|
-
root: project.root,
|
|
253
|
-
};
|
|
254
|
-
const configurationOptions = {};
|
|
255
|
-
const buildTargetNames = [];
|
|
256
|
-
const serveTargetNames = [];
|
|
257
|
-
let customWebpackConfigPath;
|
|
258
|
-
(0, validate_supported_executor_1.validateSupportedBuildExecutor)(Object.values(project.targets));
|
|
259
|
-
for (const [targetName, target] of Object.entries(project.targets)) {
|
|
260
|
-
if (target.executor === '@angular-devkit/build-angular:browser' ||
|
|
261
|
-
target.executor === '@nx/angular:webpack-browser') {
|
|
262
|
-
customWebpackConfigPath = handleBuildTargetOptions(tree, target.options, createConfigOptions, project.root);
|
|
263
|
-
if (target.configurations) {
|
|
264
|
-
for (const [configurationName, configuration] of Object.entries(target.configurations)) {
|
|
265
|
-
configurationOptions[configurationName] = {};
|
|
266
|
-
handleBuildTargetOptions(tree, configuration, configurationOptions[configurationName], project.root);
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
buildTargetNames.push(targetName);
|
|
270
|
-
}
|
|
271
|
-
else if (target.executor === '@angular-devkit/build-angular:dev-server' ||
|
|
272
|
-
target.executor === '@nx/angular:dev-server' ||
|
|
273
|
-
target.executor === '@nx/angular:module-federation-dev-server') {
|
|
274
|
-
createConfigOptions.devServer = {};
|
|
275
|
-
if (target.options) {
|
|
276
|
-
handleDevServerTargetOptions(tree, target.options, createConfigOptions.devServer, project.root);
|
|
277
|
-
}
|
|
278
|
-
if (target.configurations) {
|
|
279
|
-
for (const [configurationName, configuration] of Object.entries(target.configurations)) {
|
|
280
|
-
configurationOptions[configurationName] ??= {};
|
|
281
|
-
configurationOptions[configurationName].devServer ??= {};
|
|
282
|
-
handleDevServerTargetOptions(tree, configuration, configurationOptions[configurationName].devServer, project.root);
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
serveTargetNames.push(targetName);
|
|
287
|
-
}
|
|
288
|
-
const customWebpackConfigInfo = customWebpackConfigPath
|
|
289
|
-
? await (0, get_custom_webpack_config_1.getCustomWebpackConfig)(tree, project.root, customWebpackConfigPath)
|
|
290
|
-
: undefined;
|
|
291
|
-
(0, create_config_1.createConfig)(tree, createConfigOptions, configurationOptions, customWebpackConfigInfo?.normalizedPathToCustomWebpackConfig, customWebpackConfigInfo?.isWebpackConfigFunction);
|
|
292
|
-
(0, update_tsconfig_1.updateTsconfig)(tree, project.root);
|
|
293
|
-
for (const targetName of [...buildTargetNames, ...serveTargetNames]) {
|
|
294
|
-
delete project.targets[targetName];
|
|
295
|
-
}
|
|
296
|
-
(0, devkit_1.updateProjectConfiguration)(tree, projectName, project);
|
|
297
|
-
const { rspackInitGenerator } = (0, devkit_1.ensurePackage)('@nx/rspack', versions_1.nxVersion);
|
|
298
|
-
await rspackInitGenerator(tree, {
|
|
299
|
-
addPlugin: true,
|
|
300
|
-
});
|
|
301
|
-
// This is needed to prevent a circular execution of the build target
|
|
302
|
-
const rootPkgJson = (0, devkit_1.readJson)(tree, 'package.json');
|
|
303
|
-
if (rootPkgJson.scripts?.build === 'nx build') {
|
|
304
|
-
delete rootPkgJson.scripts.build;
|
|
305
|
-
(0, devkit_1.writeJson)(tree, 'package.json', rootPkgJson);
|
|
306
|
-
}
|
|
307
|
-
if (!schema.skipInstall) {
|
|
308
|
-
const installTask = (0, devkit_1.addDependenciesToPackageJson)(tree, {}, {
|
|
309
|
-
'@nx/angular-rspack': versions_1.angularRspackVersion,
|
|
310
|
-
});
|
|
311
|
-
tasks.push(installTask);
|
|
312
|
-
}
|
|
313
|
-
if (!schema.skipFormat) {
|
|
314
|
-
await (0, devkit_1.formatFiles)(tree);
|
|
315
|
-
}
|
|
316
|
-
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
317
|
-
}
|
|
318
|
-
exports.default = convertToRspack;
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createConfig = createConfig;
|
|
4
|
-
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
function createConfig(tree, opts, configurationOptions = {}, existingWebpackConfigPath, isExistingWebpackConfigFunction) {
|
|
6
|
-
const { root, ...createConfigOptions } = opts;
|
|
7
|
-
const hasConfigurations = Object.keys(configurationOptions).length > 0;
|
|
8
|
-
const expandedConfigurationOptions = hasConfigurations
|
|
9
|
-
? Object.entries(configurationOptions)
|
|
10
|
-
.map(([configurationName, configurationOptions]) => {
|
|
11
|
-
return `
|
|
12
|
-
${configurationName}: {
|
|
13
|
-
options: {
|
|
14
|
-
${JSON.stringify(configurationOptions, undefined, 2).slice(1, -1)}
|
|
15
|
-
}
|
|
16
|
-
}`;
|
|
17
|
-
})
|
|
18
|
-
.join(',\n')
|
|
19
|
-
: '';
|
|
20
|
-
const configContents = `
|
|
21
|
-
import { createConfig }from '@nx/angular-rspack';
|
|
22
|
-
${existingWebpackConfigPath
|
|
23
|
-
? `import baseWebpackConfig from '${existingWebpackConfigPath}';
|
|
24
|
-
${isExistingWebpackConfigFunction
|
|
25
|
-
? ''
|
|
26
|
-
: `import webpackMerge from 'webpack-merge';`}`
|
|
27
|
-
: ''}
|
|
28
|
-
|
|
29
|
-
${existingWebpackConfigPath ? 'const baseConfig = ' : 'export default '}createConfig({
|
|
30
|
-
options: {
|
|
31
|
-
root: __dirname,
|
|
32
|
-
${JSON.stringify(createConfigOptions, undefined, 2).slice(1, -1)}
|
|
33
|
-
}
|
|
34
|
-
}${hasConfigurations ? `, {${expandedConfigurationOptions}}` : ''});
|
|
35
|
-
${existingWebpackConfigPath
|
|
36
|
-
? `
|
|
37
|
-
export default ${isExistingWebpackConfigFunction
|
|
38
|
-
? `async function (env, argv) {
|
|
39
|
-
const oldConfig = await baseWebpackConfig;
|
|
40
|
-
const browserConfig = baseConfig[0];
|
|
41
|
-
return oldConfig(browserConfig);
|
|
42
|
-
}`
|
|
43
|
-
: 'webpackMerge(baseConfig[0], baseWebpackConfig);'}
|
|
44
|
-
`
|
|
45
|
-
: ''}
|
|
46
|
-
`;
|
|
47
|
-
tree.write((0, devkit_1.joinPathFragments)(root, 'rspack.config.ts'), configContents);
|
|
48
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { Tree } from '@nx/devkit';
|
|
2
|
-
export declare function getCustomWebpackConfig(tree: Tree, projectRoot: string, pathToCustomWebpackConfig: string): Promise<{
|
|
3
|
-
isWebpackConfigFunction: boolean;
|
|
4
|
-
normalizedPathToCustomWebpackConfig: string;
|
|
5
|
-
}>;
|
|
6
|
-
export declare function convertWebpackConfigToUseNxModuleFederationPlugin(webpackConfigContents: string): string;
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getCustomWebpackConfig = getCustomWebpackConfig;
|
|
4
|
-
exports.convertWebpackConfigToUseNxModuleFederationPlugin = convertWebpackConfigToUseNxModuleFederationPlugin;
|
|
5
|
-
const devkit_1 = require("@nx/devkit");
|
|
6
|
-
const config_utils_1 = require("@nx/devkit/src/utils/config-utils");
|
|
7
|
-
const path_1 = require("path");
|
|
8
|
-
const tsquery_1 = require("@phenomnomnominal/tsquery");
|
|
9
|
-
const FILE_EXTENSION_REGEX = /\.[^.]+$/;
|
|
10
|
-
async function getCustomWebpackConfig(tree, projectRoot, pathToCustomWebpackConfig) {
|
|
11
|
-
const webpackConfigContents = tree.read(pathToCustomWebpackConfig, 'utf-8');
|
|
12
|
-
if (webpackConfigContents.includes('@nx/module-federation/angular') &&
|
|
13
|
-
webpackConfigContents.includes('withModuleFederation')) {
|
|
14
|
-
tree.write(pathToCustomWebpackConfig, convertWebpackConfigToUseNxModuleFederationPlugin(webpackConfigContents));
|
|
15
|
-
return {
|
|
16
|
-
isWebpackConfigFunction: false,
|
|
17
|
-
normalizedPathToCustomWebpackConfig: `./${(0, path_1.relative)(projectRoot, pathToCustomWebpackConfig).replace(FILE_EXTENSION_REGEX, '')}`,
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
const configFile = await (0, config_utils_1.loadConfigFile)((0, path_1.join)(tree.root, pathToCustomWebpackConfig));
|
|
21
|
-
const webpackConfig = 'default' in configFile ? configFile.default : configFile;
|
|
22
|
-
return {
|
|
23
|
-
isWebpackConfigFunction: typeof webpackConfig === 'function',
|
|
24
|
-
normalizedPathToCustomWebpackConfig: `./${(0, path_1.relative)(projectRoot, pathToCustomWebpackConfig).replace(FILE_EXTENSION_REGEX, '')}`,
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
function convertWebpackConfigToUseNxModuleFederationPlugin(webpackConfigContents) {
|
|
28
|
-
let newWebpackConfigContents = webpackConfigContents;
|
|
29
|
-
let ast = tsquery_1.tsquery.ast(webpackConfigContents);
|
|
30
|
-
const withModuleFederationImportNodes = (0, tsquery_1.tsquery)(ast, 'ImportDeclaration:has(StringLiteral[value=@nx/module-federation/angular])');
|
|
31
|
-
if (withModuleFederationImportNodes.length > 0) {
|
|
32
|
-
const withModuleFederationImportNode = withModuleFederationImportNodes[0];
|
|
33
|
-
newWebpackConfigContents = `${webpackConfigContents.slice(0, withModuleFederationImportNode.getStart())}import { NxModuleFederationPlugin } from '@nx/module-federation/rspack';${webpackConfigContents.slice(withModuleFederationImportNode.getEnd())}`;
|
|
34
|
-
ast = tsquery_1.tsquery.ast(newWebpackConfigContents);
|
|
35
|
-
const exportedWithModuleFederationNodes = (0, tsquery_1.tsquery)(ast, 'ExportAssignment:has(CallExpression > Identifier[name=withModuleFederation])');
|
|
36
|
-
if (exportedWithModuleFederationNodes.length > 0) {
|
|
37
|
-
const exportedWithModuleFederationNode = exportedWithModuleFederationNodes[0];
|
|
38
|
-
newWebpackConfigContents = `${newWebpackConfigContents.slice(0, exportedWithModuleFederationNode.getStart())}${newWebpackConfigContents.slice(exportedWithModuleFederationNode.getEnd())}
|
|
39
|
-
export default {
|
|
40
|
-
plugins: [
|
|
41
|
-
new NxModuleFederationPlugin(config, {
|
|
42
|
-
dts: false,
|
|
43
|
-
}),
|
|
44
|
-
]
|
|
45
|
-
}
|
|
46
|
-
`;
|
|
47
|
-
}
|
|
48
|
-
else {
|
|
49
|
-
devkit_1.logger.warn("Could not find 'export default withModuleFederation' in the webpack config file. Skipping conversion.");
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
const withModuleFederationRequireNodes = (0, tsquery_1.tsquery)(ast, 'VariableStatement:has(CallExpression > Identifier[name=withModuleFederation], StringLiteral[value=@nx/module-federation/angular])');
|
|
53
|
-
if (withModuleFederationRequireNodes.length > 0) {
|
|
54
|
-
const withModuleFederationRequireNode = withModuleFederationRequireNodes[0];
|
|
55
|
-
newWebpackConfigContents = `${webpackConfigContents.slice(0, withModuleFederationRequireNode.getStart())}const { NxModuleFederationPlugin } = require('@nx/module-federation/rspack');${webpackConfigContents.slice(withModuleFederationRequireNode.getEnd())}`;
|
|
56
|
-
ast = tsquery_1.tsquery.ast(newWebpackConfigContents);
|
|
57
|
-
const exportedWithModuleFederationNodes = (0, tsquery_1.tsquery)(ast, 'ExpressionStatement:has(BinaryExpression > PropertyAccessExpression:has(Identifier[name=module], Identifier[name=exports]), CallExpression:has(Identifier[name=withModuleFederation]))');
|
|
58
|
-
if (exportedWithModuleFederationNodes.length > 0) {
|
|
59
|
-
const exportedWithModuleFederationNode = exportedWithModuleFederationNodes[0];
|
|
60
|
-
newWebpackConfigContents = `${newWebpackConfigContents.slice(0, exportedWithModuleFederationNode.getStart())}${newWebpackConfigContents.slice(exportedWithModuleFederationNode.getEnd())}
|
|
61
|
-
module.exports = {
|
|
62
|
-
plugins: [
|
|
63
|
-
new NxModuleFederationPlugin({ config }, {
|
|
64
|
-
dts: false,
|
|
65
|
-
}),
|
|
66
|
-
]
|
|
67
|
-
}
|
|
68
|
-
`;
|
|
69
|
-
}
|
|
70
|
-
else {
|
|
71
|
-
devkit_1.logger.warn("Could not find 'module.exports = withModuleFederation' in the webpack config file. Skipping conversion.");
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
return newWebpackConfigContents;
|
|
75
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.updateTsconfig = updateTsconfig;
|
|
4
|
-
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
function updateTsconfig(tree, projectRoot) {
|
|
6
|
-
const tsconfigPath = (0, devkit_1.joinPathFragments)(projectRoot, 'tsconfig.json');
|
|
7
|
-
const tsconfig = (0, devkit_1.readJson)(tree, tsconfigPath);
|
|
8
|
-
tsconfig['ts-node'] = {
|
|
9
|
-
compilerOptions: {
|
|
10
|
-
module: 'CommonJS',
|
|
11
|
-
},
|
|
12
|
-
};
|
|
13
|
-
(0, devkit_1.writeJson)(tree, tsconfigPath, tsconfig);
|
|
14
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.validateSupportedBuildExecutor = validateSupportedBuildExecutor;
|
|
4
|
-
const SUPPORTED_BUILD_EXECUTORS = [
|
|
5
|
-
'@angular-devkit/build-angular:browser',
|
|
6
|
-
'@nx/angular:webpack-browser',
|
|
7
|
-
];
|
|
8
|
-
function validateSupportedBuildExecutor(targets) {
|
|
9
|
-
const executorsUsedByProject = targets.map((target) => target.executor);
|
|
10
|
-
if (!executorsUsedByProject.some((executor) => SUPPORTED_BUILD_EXECUTORS.includes(executor))) {
|
|
11
|
-
throw new Error('The project does not use a supported build executor. Please use one of the following executors: ' +
|
|
12
|
-
SUPPORTED_BUILD_EXECUTORS.join(', '));
|
|
13
|
-
}
|
|
14
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://json-schema.org/schema",
|
|
3
|
-
"$id": "GeneratorNxApp",
|
|
4
|
-
"title": "Creates an Angular application.",
|
|
5
|
-
"description": "Creates an Angular application.",
|
|
6
|
-
"type": "object",
|
|
7
|
-
"cli": "nx",
|
|
8
|
-
"properties": {
|
|
9
|
-
"project": {
|
|
10
|
-
"type": "string",
|
|
11
|
-
"aliases": ["name", "projectName"],
|
|
12
|
-
"description": "Project for which to convert to rspack.",
|
|
13
|
-
"$default": {
|
|
14
|
-
"$source": "argv",
|
|
15
|
-
"index": 0
|
|
16
|
-
},
|
|
17
|
-
"x-priority": "important"
|
|
18
|
-
},
|
|
19
|
-
"skipFormat": {
|
|
20
|
-
"description": "Skip formatting files.",
|
|
21
|
-
"type": "boolean",
|
|
22
|
-
"default": false
|
|
23
|
-
},
|
|
24
|
-
"skipInstall": {
|
|
25
|
-
"description": "Skip installing dependencies.",
|
|
26
|
-
"type": "boolean",
|
|
27
|
-
"default": false
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.angularCliVersion = void 0;
|
|
4
|
-
exports.default = default_1;
|
|
5
|
-
const devkit_1 = require("@nx/devkit");
|
|
6
|
-
exports.angularCliVersion = '~19.2.0';
|
|
7
|
-
async function default_1(tree) {
|
|
8
|
-
let shouldFormat = false;
|
|
9
|
-
(0, devkit_1.updateJson)(tree, 'package.json', (json) => {
|
|
10
|
-
if (json.devDependencies?.['@angular/cli']) {
|
|
11
|
-
json.devDependencies['@angular/cli'] = exports.angularCliVersion;
|
|
12
|
-
shouldFormat = true;
|
|
13
|
-
}
|
|
14
|
-
else if (json.dependencies?.['@angular/cli']) {
|
|
15
|
-
json.dependencies['@angular/cli'] = exports.angularCliVersion;
|
|
16
|
-
shouldFormat = true;
|
|
17
|
-
}
|
|
18
|
-
return json;
|
|
19
|
-
});
|
|
20
|
-
if (shouldFormat) {
|
|
21
|
-
await (0, devkit_1.formatFiles)(tree);
|
|
22
|
-
}
|
|
23
|
-
}
|