@nx/webpack 23.0.0-beta.22 → 23.0.0-beta.24
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/{app-plugin.d.ts → dist/app-plugin.d.ts} +0 -1
- package/{index.d.ts → dist/index.d.ts} +0 -1
- package/dist/internal.d.ts +8 -0
- package/dist/internal.js +26 -0
- package/{plugin.d.ts → dist/plugin.d.ts} +0 -1
- package/{src → dist/src}/executors/dev-server/dev-server.impl.d.ts +0 -1
- package/{src → dist/src}/executors/dev-server/dev-server.impl.js +4 -4
- package/{src → dist/src}/executors/dev-server/lib/get-dev-server-config.d.ts +0 -1
- package/{src → dist/src}/executors/dev-server/lib/serve-path.d.ts +0 -1
- package/{src → dist/src}/executors/ssr-dev-server/lib/wait-until-server-is-listening.d.ts +0 -1
- package/{src → dist/src}/executors/ssr-dev-server/ssr-dev-server.impl.d.ts +0 -1
- package/{src → dist/src}/executors/webpack/lib/normalize-options.d.ts +0 -1
- package/{src → dist/src}/executors/webpack/lib/run-webpack.d.ts +1 -2
- package/{src → dist/src}/executors/webpack/lib/run-webpack.js +3 -3
- package/{src → dist/src}/executors/webpack/webpack.impl.d.ts +0 -1
- package/{src → dist/src}/generators/configuration/configuration.d.ts +0 -1
- package/{src → dist/src}/generators/configuration/configuration.js +2 -0
- package/{src → dist/src}/generators/convert-config-to-webpack-plugin/convert-config-to-webpack-plugin.d.ts +0 -1
- package/{src → dist/src}/generators/convert-config-to-webpack-plugin/convert-config-to-webpack-plugin.js +2 -0
- package/{src → dist/src}/generators/convert-config-to-webpack-plugin/lib/extract-webpack-options.d.ts +0 -1
- package/{src → dist/src}/generators/convert-config-to-webpack-plugin/lib/normalize-path-options.d.ts +0 -1
- package/{src → dist/src}/generators/convert-config-to-webpack-plugin/lib/utils.d.ts +0 -1
- package/{src → dist/src}/generators/convert-config-to-webpack-plugin/lib/validate-project.d.ts +0 -1
- package/{src → dist/src}/generators/convert-to-inferred/convert-to-inferred.d.ts +0 -1
- package/{src → dist/src}/generators/convert-to-inferred/convert-to-inferred.js +1 -0
- package/{src → dist/src}/generators/convert-to-inferred/utils/ast.d.ts +0 -1
- package/{src → dist/src}/generators/convert-to-inferred/utils/build-post-target-transformer.d.ts +0 -1
- package/{src → dist/src}/generators/convert-to-inferred/utils/index.d.ts +0 -1
- package/{src → dist/src}/generators/convert-to-inferred/utils/serve-post-target-transformer.d.ts +0 -1
- package/{src → dist/src}/generators/convert-to-inferred/utils/types.d.ts +0 -1
- package/{src → dist/src}/generators/init/init.d.ts +0 -1
- package/{src → dist/src}/generators/init/init.js +8 -1
- package/{src → dist/src}/generators/init/schema.json +1 -1
- package/{src → dist/src}/migrations/update-21-0-0/remove-isolated-config.d.ts +0 -1
- package/{src → dist/src}/migrations/update-22-0-0/remove-deprecated-options.d.ts +0 -1
- package/dist/src/migrations/update-23-0-0/migrate-create-nodes-v2-to-create-nodes.d.ts +9 -0
- package/dist/src/migrations/update-23-0-0/migrate-create-nodes-v2-to-create-nodes.js +134 -0
- package/dist/src/migrations/update-23-0-0/migrate-create-nodes-v2-to-create-nodes.md +25 -0
- package/{src → dist/src}/migrations/update-23-0-0/remove-nx-tsconfig-paths-webpack-plugin-import.d.ts +0 -1
- package/dist/src/migrations/update-23-0-0/rewrite-internal-subpath-imports.d.ts +3 -0
- package/dist/src/migrations/update-23-0-0/rewrite-internal-subpath-imports.js +225 -0
- package/{src → dist/src}/plugins/generate-package-json-plugin.d.ts +0 -1
- package/{src → dist/src}/plugins/nx-typescript-webpack-plugin/nx-tsconfig-paths-webpack-plugin.d.ts +0 -1
- package/{src → dist/src}/plugins/nx-webpack-plugin/lib/apply-base-config.d.ts +0 -1
- package/{src → dist/src}/plugins/nx-webpack-plugin/lib/apply-web-config.d.ts +0 -1
- package/{src → dist/src}/plugins/nx-webpack-plugin/lib/compiler-loaders.d.ts +0 -1
- package/{src → dist/src}/plugins/nx-webpack-plugin/lib/get-terser-ecma-version.d.ts +0 -1
- package/{src → dist/src}/plugins/nx-webpack-plugin/lib/instantiate-script-plugins.d.ts +0 -1
- package/{src → dist/src}/plugins/nx-webpack-plugin/lib/normalize-options.d.ts +0 -1
- package/{src → dist/src}/plugins/nx-webpack-plugin/lib/stylesheet-loaders.d.ts +0 -1
- package/{src → dist/src}/plugins/nx-webpack-plugin/lib/utils.d.ts +0 -1
- package/{src → dist/src}/plugins/nx-webpack-plugin/nx-app-webpack-plugin-options.d.ts +0 -1
- package/{src → dist/src}/plugins/nx-webpack-plugin/nx-app-webpack-plugin.d.ts +0 -1
- package/{src → dist/src}/plugins/plugin.d.ts +3 -4
- package/{src → dist/src}/plugins/plugin.js +3 -3
- package/{src → dist/src}/plugins/stats-json-plugin.d.ts +0 -1
- package/{src → dist/src}/plugins/use-legacy-nx-plugin/use-legacy-nx-plugin.d.ts +0 -1
- package/{src → dist/src}/plugins/webpack-nx-build-coordination-plugin.d.ts +0 -1
- package/{src → dist/src}/plugins/write-index-html-plugin.d.ts +0 -1
- package/{src → dist/src}/utils/config.d.ts +12 -1
- package/{src → dist/src}/utils/config.js +15 -0
- package/{src → dist/src}/utils/create-copy-plugin.d.ts +0 -1
- package/{src → dist/src}/utils/deprecation.d.ts +3 -1
- package/{src → dist/src}/utils/deprecation.js +31 -1
- package/{src → dist/src}/utils/e2e-web-server-info-utils.d.ts +0 -1
- package/{src → dist/src}/utils/ensure-dependencies.d.ts +0 -1
- package/{src → dist/src}/utils/ensure-dependencies.js +1 -1
- package/{src → dist/src}/utils/fs.d.ts +0 -1
- package/{src → dist/src}/utils/get-client-environment.d.ts +0 -1
- package/{src → dist/src}/utils/get-css-module-local-ident.d.ts +0 -1
- package/{src → dist/src}/utils/has-plugin.d.ts +0 -1
- package/{src → dist/src}/utils/hash-format.d.ts +0 -1
- package/{src → dist/src}/utils/models.d.ts +0 -1
- package/{src → dist/src}/utils/run-webpack.d.ts +0 -1
- package/dist/src/utils/versions.d.ts +12 -0
- package/dist/src/utils/versions.js +24 -0
- package/dist/src/utils/web-babel-loader.d.ts +1 -0
- package/{src → dist/src}/utils/web-babel-loader.js +2 -0
- package/{src → dist/src}/utils/webpack/interpolate-env-variables-to-index.d.ts +0 -1
- package/{src → dist/src}/utils/webpack/normalize-entry.d.ts +0 -1
- package/{src → dist/src}/utils/webpack/package-chunk-sort.d.ts +0 -1
- package/{src → dist/src}/utils/webpack/plugins/postcss-cli-resources.d.ts +0 -1
- package/{src → dist/src}/utils/webpack/plugins/scripts-webpack-plugin.d.ts +0 -1
- package/{src → dist/src}/utils/webpack/read-webpack-options.d.ts +0 -1
- package/{src → dist/src}/utils/webpack/resolve-user-defined-webpack-config.d.ts +0 -1
- package/{src → dist/src}/utils/with-nx.d.ts +4 -1
- package/{src → dist/src}/utils/with-nx.js +6 -0
- package/{src → dist/src}/utils/with-web.d.ts +4 -1
- package/{src → dist/src}/utils/with-web.js +6 -0
- package/{tsconfig-paths-plugin.d.ts → dist/tsconfig-paths-plugin.d.ts} +0 -1
- package/executors.json +6 -6
- package/generators.json +8 -8
- package/migrations.json +36 -5
- package/package.json +78 -9
- package/app-plugin.d.ts.map +0 -1
- package/index.d.ts.map +0 -1
- package/plugin.d.ts.map +0 -1
- package/src/executors/dev-server/dev-server.impl.d.ts.map +0 -1
- package/src/executors/dev-server/lib/get-dev-server-config.d.ts.map +0 -1
- package/src/executors/dev-server/lib/serve-path.d.ts.map +0 -1
- package/src/executors/ssr-dev-server/lib/wait-until-server-is-listening.d.ts.map +0 -1
- package/src/executors/ssr-dev-server/ssr-dev-server.impl.d.ts.map +0 -1
- package/src/executors/webpack/lib/normalize-options.d.ts.map +0 -1
- package/src/executors/webpack/lib/run-webpack.d.ts.map +0 -1
- package/src/executors/webpack/webpack.impl.d.ts.map +0 -1
- package/src/generators/configuration/configuration.d.ts.map +0 -1
- package/src/generators/convert-config-to-webpack-plugin/convert-config-to-webpack-plugin.d.ts.map +0 -1
- package/src/generators/convert-config-to-webpack-plugin/lib/extract-webpack-options.d.ts.map +0 -1
- package/src/generators/convert-config-to-webpack-plugin/lib/normalize-path-options.d.ts.map +0 -1
- package/src/generators/convert-config-to-webpack-plugin/lib/utils.d.ts.map +0 -1
- package/src/generators/convert-config-to-webpack-plugin/lib/validate-project.d.ts.map +0 -1
- package/src/generators/convert-to-inferred/convert-to-inferred.d.ts.map +0 -1
- package/src/generators/convert-to-inferred/utils/ast.d.ts.map +0 -1
- package/src/generators/convert-to-inferred/utils/build-post-target-transformer.d.ts.map +0 -1
- package/src/generators/convert-to-inferred/utils/index.d.ts.map +0 -1
- package/src/generators/convert-to-inferred/utils/serve-post-target-transformer.d.ts.map +0 -1
- package/src/generators/convert-to-inferred/utils/types.d.ts.map +0 -1
- package/src/generators/init/init.d.ts.map +0 -1
- package/src/migrations/update-21-0-0/remove-isolated-config.d.ts.map +0 -1
- package/src/migrations/update-22-0-0/remove-deprecated-options.d.ts.map +0 -1
- package/src/migrations/update-23-0-0/remove-nx-tsconfig-paths-webpack-plugin-import.d.ts.map +0 -1
- package/src/plugins/generate-package-json-plugin.d.ts.map +0 -1
- package/src/plugins/nx-typescript-webpack-plugin/nx-tsconfig-paths-webpack-plugin.d.ts.map +0 -1
- package/src/plugins/nx-webpack-plugin/lib/apply-base-config.d.ts.map +0 -1
- package/src/plugins/nx-webpack-plugin/lib/apply-web-config.d.ts.map +0 -1
- package/src/plugins/nx-webpack-plugin/lib/compiler-loaders.d.ts.map +0 -1
- package/src/plugins/nx-webpack-plugin/lib/get-terser-ecma-version.d.ts.map +0 -1
- package/src/plugins/nx-webpack-plugin/lib/instantiate-script-plugins.d.ts.map +0 -1
- package/src/plugins/nx-webpack-plugin/lib/normalize-options.d.ts.map +0 -1
- package/src/plugins/nx-webpack-plugin/lib/stylesheet-loaders.d.ts.map +0 -1
- package/src/plugins/nx-webpack-plugin/lib/utils.d.ts.map +0 -1
- package/src/plugins/nx-webpack-plugin/nx-app-webpack-plugin-options.d.ts.map +0 -1
- package/src/plugins/nx-webpack-plugin/nx-app-webpack-plugin.d.ts.map +0 -1
- package/src/plugins/plugin.d.ts.map +0 -1
- package/src/plugins/stats-json-plugin.d.ts.map +0 -1
- package/src/plugins/use-legacy-nx-plugin/use-legacy-nx-plugin.d.ts.map +0 -1
- package/src/plugins/webpack-nx-build-coordination-plugin.d.ts.map +0 -1
- package/src/plugins/write-index-html-plugin.d.ts.map +0 -1
- package/src/utils/config.d.ts.map +0 -1
- package/src/utils/create-copy-plugin.d.ts.map +0 -1
- package/src/utils/deprecation.d.ts.map +0 -1
- package/src/utils/e2e-web-server-info-utils.d.ts.map +0 -1
- package/src/utils/ensure-dependencies.d.ts.map +0 -1
- package/src/utils/fs.d.ts.map +0 -1
- package/src/utils/get-client-environment.d.ts.map +0 -1
- package/src/utils/get-css-module-local-ident.d.ts.map +0 -1
- package/src/utils/has-plugin.d.ts.map +0 -1
- package/src/utils/hash-format.d.ts.map +0 -1
- package/src/utils/models.d.ts.map +0 -1
- package/src/utils/run-webpack.d.ts.map +0 -1
- package/src/utils/versions.d.ts +0 -8
- package/src/utils/versions.d.ts.map +0 -1
- package/src/utils/versions.js +0 -11
- package/src/utils/web-babel-loader.d.ts +0 -1
- package/src/utils/web-babel-loader.d.ts.map +0 -1
- package/src/utils/webpack/interpolate-env-variables-to-index.d.ts.map +0 -1
- package/src/utils/webpack/normalize-entry.d.ts.map +0 -1
- package/src/utils/webpack/package-chunk-sort.d.ts.map +0 -1
- package/src/utils/webpack/plugins/postcss-cli-resources.d.ts.map +0 -1
- package/src/utils/webpack/plugins/scripts-webpack-plugin.d.ts.map +0 -1
- package/src/utils/webpack/read-webpack-options.d.ts.map +0 -1
- package/src/utils/webpack/resolve-user-defined-webpack-config.d.ts.map +0 -1
- package/src/utils/with-nx.d.ts.map +0 -1
- package/src/utils/with-web.d.ts.map +0 -1
- package/tsconfig-paths-plugin.d.ts.map +0 -1
- /package/{LICENSE → dist/LICENSE} +0 -0
- /package/{app-plugin.js → dist/app-plugin.js} +0 -0
- /package/{index.js → dist/index.js} +0 -0
- /package/{plugin.js → dist/plugin.js} +0 -0
- /package/{src → dist/src}/executors/dev-server/lib/get-dev-server-config.js +0 -0
- /package/{src → dist/src}/executors/dev-server/lib/serve-path.js +0 -0
- /package/{src → dist/src}/executors/dev-server/schema.d.ts +0 -0
- /package/{src → dist/src}/executors/dev-server/schema.json +0 -0
- /package/{src → dist/src}/executors/ssr-dev-server/lib/wait-until-server-is-listening.js +0 -0
- /package/{src → dist/src}/executors/ssr-dev-server/schema.d.ts +0 -0
- /package/{src → dist/src}/executors/ssr-dev-server/schema.json +0 -0
- /package/{src → dist/src}/executors/ssr-dev-server/ssr-dev-server.impl.js +0 -0
- /package/{src → dist/src}/executors/webpack/lib/normalize-options.js +0 -0
- /package/{src → dist/src}/executors/webpack/schema.d.ts +0 -0
- /package/{src → dist/src}/executors/webpack/schema.json +0 -0
- /package/{src → dist/src}/executors/webpack/webpack.impl.js +0 -0
- /package/{src → dist/src}/generators/configuration/schema.d.ts +0 -0
- /package/{src → dist/src}/generators/configuration/schema.json +0 -0
- /package/{src → dist/src}/generators/convert-config-to-webpack-plugin/lib/extract-webpack-options.js +0 -0
- /package/{src → dist/src}/generators/convert-config-to-webpack-plugin/lib/normalize-path-options.js +0 -0
- /package/{src → dist/src}/generators/convert-config-to-webpack-plugin/lib/utils.js +0 -0
- /package/{src → dist/src}/generators/convert-config-to-webpack-plugin/lib/validate-project.js +0 -0
- /package/{src → dist/src}/generators/convert-config-to-webpack-plugin/schema.json +0 -0
- /package/{src → dist/src}/generators/convert-to-inferred/schema.json +0 -0
- /package/{src → dist/src}/generators/convert-to-inferred/utils/ast.js +0 -0
- /package/{src → dist/src}/generators/convert-to-inferred/utils/build-post-target-transformer.js +0 -0
- /package/{src → dist/src}/generators/convert-to-inferred/utils/index.js +0 -0
- /package/{src → dist/src}/generators/convert-to-inferred/utils/serve-post-target-transformer.js +0 -0
- /package/{src → dist/src}/generators/convert-to-inferred/utils/types.js +0 -0
- /package/{src → dist/src}/generators/init/schema.d.ts +0 -0
- /package/{src → dist/src}/migrations/update-21-0-0/remove-isolated-config.js +0 -0
- /package/{src → dist/src}/migrations/update-21-0-0/remove-isolated-config.md +0 -0
- /package/{src → dist/src}/migrations/update-22-0-0/remove-deprecated-options.js +0 -0
- /package/{src → dist/src}/migrations/update-23-0-0/remove-nx-tsconfig-paths-webpack-plugin-import.js +0 -0
- /package/{src → dist/src}/migrations/update-23-0-0/remove-nx-tsconfig-paths-webpack-plugin-import.md +0 -0
- /package/{src → dist/src}/plugins/generate-package-json-plugin.js +0 -0
- /package/{src → dist/src}/plugins/nx-typescript-webpack-plugin/nx-tsconfig-paths-webpack-plugin.js +0 -0
- /package/{src → dist/src}/plugins/nx-webpack-plugin/lib/apply-base-config.js +0 -0
- /package/{src → dist/src}/plugins/nx-webpack-plugin/lib/apply-web-config.js +0 -0
- /package/{src → dist/src}/plugins/nx-webpack-plugin/lib/compiler-loaders.js +0 -0
- /package/{src → dist/src}/plugins/nx-webpack-plugin/lib/get-terser-ecma-version.js +0 -0
- /package/{src → dist/src}/plugins/nx-webpack-plugin/lib/instantiate-script-plugins.js +0 -0
- /package/{src → dist/src}/plugins/nx-webpack-plugin/lib/normalize-options.js +0 -0
- /package/{src → dist/src}/plugins/nx-webpack-plugin/lib/stylesheet-loaders.js +0 -0
- /package/{src → dist/src}/plugins/nx-webpack-plugin/lib/utils.js +0 -0
- /package/{src → dist/src}/plugins/nx-webpack-plugin/nx-app-webpack-plugin-options.js +0 -0
- /package/{src → dist/src}/plugins/nx-webpack-plugin/nx-app-webpack-plugin.js +0 -0
- /package/{src → dist/src}/plugins/stats-json-plugin.js +0 -0
- /package/{src → dist/src}/plugins/use-legacy-nx-plugin/use-legacy-nx-plugin.js +0 -0
- /package/{src → dist/src}/plugins/webpack-nx-build-coordination-plugin.js +0 -0
- /package/{src → dist/src}/plugins/write-index-html-plugin.js +0 -0
- /package/{src → dist/src}/utils/create-copy-plugin.js +0 -0
- /package/{src → dist/src}/utils/e2e-web-server-info-utils.js +0 -0
- /package/{src → dist/src}/utils/fs.js +0 -0
- /package/{src → dist/src}/utils/get-client-environment.js +0 -0
- /package/{src → dist/src}/utils/get-css-module-local-ident.js +0 -0
- /package/{src → dist/src}/utils/has-plugin.js +0 -0
- /package/{src → dist/src}/utils/hash-format.js +0 -0
- /package/{src → dist/src}/utils/models.js +0 -0
- /package/{src → dist/src}/utils/run-webpack.js +0 -0
- /package/{src → dist/src}/utils/webpack/deprecated-less-loader.js +0 -0
- /package/{src → dist/src}/utils/webpack/interpolate-env-variables-to-index.js +0 -0
- /package/{src → dist/src}/utils/webpack/normalize-entry.js +0 -0
- /package/{src → dist/src}/utils/webpack/package-chunk-sort.js +0 -0
- /package/{src → dist/src}/utils/webpack/plugins/postcss-cli-resources.js +0 -0
- /package/{src → dist/src}/utils/webpack/plugins/scripts-webpack-plugin.js +0 -0
- /package/{src → dist/src}/utils/webpack/read-webpack-options.js +0 -0
- /package/{src → dist/src}/utils/webpack/resolve-user-defined-webpack-config.js +0 -0
- /package/{tsconfig-paths-plugin.js → dist/tsconfig-paths-plugin.js} +0 -0
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = rewriteInternalSubpathImports;
|
|
4
|
+
exports.rewriteSubpathImports = rewriteSubpathImports;
|
|
5
|
+
const devkit_1 = require("@nx/devkit");
|
|
6
|
+
const TS_EXTENSIONS = ['.ts', '.tsx', '.cts', '.mts'];
|
|
7
|
+
const FROM_PREFIX = '@nx/webpack/src/';
|
|
8
|
+
const TO_PUBLIC = '@nx/webpack';
|
|
9
|
+
const TO_INTERNAL = '@nx/webpack/internal';
|
|
10
|
+
// Symbols exported from `@nx/webpack`'s public entry (packages/webpack/index.ts).
|
|
11
|
+
// A named import/export of one of these from `@nx/webpack/src/*` is routed to
|
|
12
|
+
// the public `@nx/webpack` entry; everything else goes to `@nx/webpack/internal`.
|
|
13
|
+
const PUBLIC_SYMBOLS = new Set([
|
|
14
|
+
'AssetGlobPattern',
|
|
15
|
+
'AsyncNxComposableWebpackPlugin',
|
|
16
|
+
'FileReplacement',
|
|
17
|
+
'MergedOptions',
|
|
18
|
+
'NormalizedWebpackExecutorOptions',
|
|
19
|
+
'NxComposableWebpackPlugin',
|
|
20
|
+
'NxWebpackExecutionContext',
|
|
21
|
+
'NxWebpackPlugin',
|
|
22
|
+
'WebDevServerOptions',
|
|
23
|
+
'WebpackExecutorEvent',
|
|
24
|
+
'WebpackExecutorOptions',
|
|
25
|
+
'WithNxOptions',
|
|
26
|
+
'WithWebOptions',
|
|
27
|
+
'composePlugins',
|
|
28
|
+
'composePluginsSync',
|
|
29
|
+
'configurationGenerator',
|
|
30
|
+
'convertConfigToWebpackPluginGenerator',
|
|
31
|
+
'createCopyPlugin',
|
|
32
|
+
'devServerExecutor',
|
|
33
|
+
'getCSSModuleLocalIdent',
|
|
34
|
+
'getWebpackE2EWebServerInfo',
|
|
35
|
+
'isNxWebpackComposablePlugin',
|
|
36
|
+
'normalizeOptions',
|
|
37
|
+
'normalizePluginPath',
|
|
38
|
+
'nxWebpackComposablePlugin',
|
|
39
|
+
'useLegacyNxPlugin',
|
|
40
|
+
'webpackExecutor',
|
|
41
|
+
'webpackInitGenerator',
|
|
42
|
+
'webpackProjectGenerator',
|
|
43
|
+
'withNx',
|
|
44
|
+
'withWeb',
|
|
45
|
+
]);
|
|
46
|
+
// Methods on `jest` and `vi` that take a module specifier as their first arg.
|
|
47
|
+
const MOCK_HELPER_METHODS = new Set([
|
|
48
|
+
'mock',
|
|
49
|
+
'unmock',
|
|
50
|
+
'doMock',
|
|
51
|
+
'dontMock',
|
|
52
|
+
'requireActual',
|
|
53
|
+
'requireMock',
|
|
54
|
+
'importActual',
|
|
55
|
+
'importMock',
|
|
56
|
+
]);
|
|
57
|
+
let ts;
|
|
58
|
+
async function rewriteInternalSubpathImports(tree) {
|
|
59
|
+
let touchedCount = 0;
|
|
60
|
+
(0, devkit_1.visitNotIgnoredFiles)(tree, '.', (filePath) => {
|
|
61
|
+
if (!TS_EXTENSIONS.some((ext) => filePath.endsWith(ext))) {
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
const original = tree.read(filePath, 'utf-8');
|
|
65
|
+
if (!original || !original.includes(FROM_PREFIX)) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
const updated = rewriteSubpathImports(original);
|
|
69
|
+
if (updated !== original) {
|
|
70
|
+
tree.write(filePath, updated);
|
|
71
|
+
touchedCount += 1;
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
if (touchedCount > 0) {
|
|
75
|
+
devkit_1.logger.info(`Rewrote @nx/webpack/src/* imports in ${touchedCount} file(s) ` +
|
|
76
|
+
`(public symbols to @nx/webpack, internals to @nx/webpack/internal).`);
|
|
77
|
+
}
|
|
78
|
+
await (0, devkit_1.formatFiles)(tree);
|
|
79
|
+
}
|
|
80
|
+
function rewriteSubpathImports(source) {
|
|
81
|
+
ts ??= (0, devkit_1.ensurePackage)('typescript', '*');
|
|
82
|
+
const sourceFile = ts.createSourceFile('tmp.ts', source, ts.ScriptTarget.Latest,
|
|
83
|
+
/* setParentNodes */ true, ts.ScriptKind.TSX);
|
|
84
|
+
const changes = [];
|
|
85
|
+
for (const stmt of sourceFile.statements) {
|
|
86
|
+
if (ts.isImportDeclaration(stmt)) {
|
|
87
|
+
collectImportRewrite(sourceFile, stmt, changes);
|
|
88
|
+
}
|
|
89
|
+
else if (ts.isExportDeclaration(stmt)) {
|
|
90
|
+
collectExportRewrite(sourceFile, stmt, changes);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
collectCallExpressionRewrites(sourceFile, changes);
|
|
94
|
+
return changes.length > 0 ? (0, devkit_1.applyChangesToString)(source, changes) : source;
|
|
95
|
+
}
|
|
96
|
+
function isSubpathSpecifier(node) {
|
|
97
|
+
return ts.isStringLiteral(node) && node.text.startsWith(FROM_PREFIX);
|
|
98
|
+
}
|
|
99
|
+
function collectImportRewrite(sourceFile, stmt, changes) {
|
|
100
|
+
if (!isSubpathSpecifier(stmt.moduleSpecifier)) {
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
const clause = stmt.importClause;
|
|
104
|
+
// Pure named imports (`import { a, b } from '...'`) can be split by symbol.
|
|
105
|
+
// A default or namespace import grabs the whole module, so it can't be
|
|
106
|
+
// split — route it wholesale to the internal entry.
|
|
107
|
+
if (clause &&
|
|
108
|
+
!clause.name &&
|
|
109
|
+
clause.namedBindings &&
|
|
110
|
+
ts.isNamedImports(clause.namedBindings)) {
|
|
111
|
+
rewriteNamedDeclaration(sourceFile, stmt, stmt.moduleSpecifier, clause.isTypeOnly, clause.namedBindings.elements, 'import', changes);
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
replaceSpecifier(sourceFile, stmt.moduleSpecifier, TO_INTERNAL, changes);
|
|
115
|
+
}
|
|
116
|
+
function collectExportRewrite(sourceFile, stmt, changes) {
|
|
117
|
+
if (!stmt.moduleSpecifier || !isSubpathSpecifier(stmt.moduleSpecifier)) {
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
// `export { a, b } from '...'` can be split; `export * from '...'` cannot.
|
|
121
|
+
if (stmt.exportClause && ts.isNamedExports(stmt.exportClause)) {
|
|
122
|
+
rewriteNamedDeclaration(sourceFile, stmt, stmt.moduleSpecifier, stmt.isTypeOnly, stmt.exportClause.elements, 'export', changes);
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
replaceSpecifier(sourceFile, stmt.moduleSpecifier, TO_INTERNAL, changes);
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Partition the named bindings of an import/export declaration into the ones
|
|
129
|
+
* that resolve to `@nx/webpack`'s public entry and the ones that don't. If both
|
|
130
|
+
* groups are non-empty, the single declaration is split into two.
|
|
131
|
+
*/
|
|
132
|
+
function rewriteNamedDeclaration(sourceFile, decl, specifier, isTypeOnly, elements, keyword, changes) {
|
|
133
|
+
const publicEls = [];
|
|
134
|
+
const internalEls = [];
|
|
135
|
+
for (const el of elements) {
|
|
136
|
+
// `propertyName` is the original name in `orig as alias`; fall back to
|
|
137
|
+
// `name` for the plain `orig` form.
|
|
138
|
+
const importedName = (el.propertyName ?? el.name).text;
|
|
139
|
+
(PUBLIC_SYMBOLS.has(importedName) ? publicEls : internalEls).push(el);
|
|
140
|
+
}
|
|
141
|
+
if (publicEls.length === 0) {
|
|
142
|
+
replaceSpecifier(sourceFile, specifier, TO_INTERNAL, changes);
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
if (internalEls.length === 0) {
|
|
146
|
+
replaceSpecifier(sourceFile, specifier, TO_PUBLIC, changes);
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
// Mixed — replace the whole declaration with one statement per target.
|
|
150
|
+
const quote = sourceFile.text.charAt(specifier.getStart(sourceFile));
|
|
151
|
+
const start = decl.getStart(sourceFile);
|
|
152
|
+
const end = decl.getEnd();
|
|
153
|
+
const semicolon = sourceFile.text.charAt(end - 1) === ';' ? ';' : '';
|
|
154
|
+
const prefix = isTypeOnly ? `${keyword} type` : keyword;
|
|
155
|
+
const render = (els, target) => `${prefix} { ${els
|
|
156
|
+
.map((el) => el.getText(sourceFile))
|
|
157
|
+
.join(', ')} } from ${quote}${target}${quote}${semicolon}`;
|
|
158
|
+
changes.push({ type: devkit_1.ChangeType.Delete, start, length: end - start }, {
|
|
159
|
+
type: devkit_1.ChangeType.Insert,
|
|
160
|
+
index: start,
|
|
161
|
+
text: `${render(publicEls, TO_PUBLIC)}\n${render(internalEls, TO_INTERNAL)}`,
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
function collectCallExpressionRewrites(sourceFile, changes) {
|
|
165
|
+
const visit = (node) => {
|
|
166
|
+
if (ts.isCallExpression(node) &&
|
|
167
|
+
shouldRewriteCallExpression(node) &&
|
|
168
|
+
node.arguments.length >= 1 &&
|
|
169
|
+
isSubpathSpecifier(node.arguments[0])) {
|
|
170
|
+
// `require(...)`, dynamic `import(...)` and `jest.mock(...)` reference
|
|
171
|
+
// the module as a whole and can't be symbol-split, so they go to the
|
|
172
|
+
// internal entry.
|
|
173
|
+
replaceSpecifier(sourceFile, node.arguments[0], TO_INTERNAL, changes);
|
|
174
|
+
}
|
|
175
|
+
else if (ts.isImportTypeNode(node)) {
|
|
176
|
+
// `typeof import('...')` parses as an `ImportTypeNode`, not a
|
|
177
|
+
// CallExpression — its argument is `LiteralTypeNode<StringLiteral>`.
|
|
178
|
+
// The whole module is referenced, so it can't be symbol-split.
|
|
179
|
+
const literal = getImportTypeStringLiteral(node);
|
|
180
|
+
if (literal && literal.text.startsWith(FROM_PREFIX)) {
|
|
181
|
+
replaceSpecifier(sourceFile, literal, TO_INTERNAL, changes);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
ts.forEachChild(node, visit);
|
|
185
|
+
};
|
|
186
|
+
visit(sourceFile);
|
|
187
|
+
}
|
|
188
|
+
function getImportTypeStringLiteral(node) {
|
|
189
|
+
const arg = node.argument;
|
|
190
|
+
if (arg && ts.isLiteralTypeNode(arg) && ts.isStringLiteral(arg.literal)) {
|
|
191
|
+
return arg.literal;
|
|
192
|
+
}
|
|
193
|
+
return undefined;
|
|
194
|
+
}
|
|
195
|
+
function shouldRewriteCallExpression(call) {
|
|
196
|
+
const callee = call.expression;
|
|
197
|
+
// `require('...')`
|
|
198
|
+
if (ts.isIdentifier(callee) && callee.text === 'require')
|
|
199
|
+
return true;
|
|
200
|
+
// dynamic `import('...')` (runtime form parses as a CallExpression whose
|
|
201
|
+
// callee is the `import` keyword). The `typeof import('...')` type-position
|
|
202
|
+
// form is an `ImportTypeNode` (handled in `collectCallExpressionRewrites`).
|
|
203
|
+
if (callee.kind === ts.SyntaxKind.ImportKeyword)
|
|
204
|
+
return true;
|
|
205
|
+
// `jest.mock(...)` / `vi.mock(...)` and friends.
|
|
206
|
+
if (ts.isPropertyAccessExpression(callee)) {
|
|
207
|
+
const obj = callee.expression;
|
|
208
|
+
if (ts.isIdentifier(obj) &&
|
|
209
|
+
(obj.text === 'jest' || obj.text === 'vi') &&
|
|
210
|
+
MOCK_HELPER_METHODS.has(callee.name.text)) {
|
|
211
|
+
return true;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
return false;
|
|
215
|
+
}
|
|
216
|
+
function replaceSpecifier(sourceFile, literal, target, changes) {
|
|
217
|
+
const start = literal.getStart(sourceFile);
|
|
218
|
+
const end = literal.getEnd();
|
|
219
|
+
const quote = sourceFile.text.charAt(start);
|
|
220
|
+
changes.push({ type: devkit_1.ChangeType.Delete, start, length: end - start }, {
|
|
221
|
+
type: devkit_1.ChangeType.Insert,
|
|
222
|
+
index: start,
|
|
223
|
+
text: `${quote}${target}${quote}`,
|
|
224
|
+
});
|
|
225
|
+
}
|
package/{src → dist/src}/plugins/nx-typescript-webpack-plugin/nx-tsconfig-paths-webpack-plugin.d.ts
RENAMED
|
@@ -6,4 +6,3 @@ export declare class NxTsconfigPathsWebpackPlugin {
|
|
|
6
6
|
apply(compiler: Compiler): void;
|
|
7
7
|
handleBuildLibsFromSource(config: Partial<WebpackOptionsNormalized | Configuration>, options: NormalizedNxAppWebpackPluginOptions): void;
|
|
8
8
|
}
|
|
9
|
-
//# sourceMappingURL=nx-tsconfig-paths-webpack-plugin.d.ts.map
|
|
@@ -3,4 +3,3 @@ import { NormalizedNxAppWebpackPluginOptions } from '../nx-app-webpack-plugin-op
|
|
|
3
3
|
export declare function applyBaseConfig(options: NormalizedNxAppWebpackPluginOptions, config?: Partial<WebpackOptionsNormalized | Configuration>, { useNormalizedEntry, }?: {
|
|
4
4
|
useNormalizedEntry?: boolean;
|
|
5
5
|
}): void;
|
|
6
|
-
//# sourceMappingURL=apply-base-config.d.ts.map
|
|
@@ -3,4 +3,3 @@ import { NormalizedNxAppWebpackPluginOptions } from '../nx-app-webpack-plugin-op
|
|
|
3
3
|
export declare function applyWebConfig(options: NormalizedNxAppWebpackPluginOptions, config?: Partial<WebpackOptionsNormalized | Configuration>, { useNormalizedEntry, }?: {
|
|
4
4
|
useNormalizedEntry?: boolean;
|
|
5
5
|
}): void;
|
|
6
|
-
//# sourceMappingURL=apply-web-config.d.ts.map
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import { WebpackPluginInstance } from 'webpack';
|
|
2
2
|
import { NormalizedNxAppWebpackPluginOptions } from '../nx-app-webpack-plugin-options';
|
|
3
3
|
export declare function instantiateScriptPlugins(options: NormalizedNxAppWebpackPluginOptions): WebpackPluginInstance[];
|
|
4
|
-
//# sourceMappingURL=instantiate-script-plugins.d.ts.map
|
|
@@ -2,4 +2,3 @@ import { AssetGlobPattern, FileReplacement, NormalizedNxAppWebpackPluginOptions,
|
|
|
2
2
|
export declare function normalizeOptions(options: NxAppWebpackPluginOptions): NormalizedNxAppWebpackPluginOptions;
|
|
3
3
|
export declare function normalizeAssets(assets: any[], root: string, sourceRoot: string, projectRoot: string, resolveRelativePathsToProjectRoot?: boolean): AssetGlobPattern[];
|
|
4
4
|
export declare function normalizeFileReplacements(root: string, fileReplacements: FileReplacement[]): FileReplacement[];
|
|
5
|
-
//# sourceMappingURL=normalize-options.d.ts.map
|
|
@@ -24,4 +24,3 @@ export declare function getAllTransitiveDeps(graph: ProjectGraph, targetName: st
|
|
|
24
24
|
* @returns A list of all non-buildable libraries that the project depends on, including transitive dependencies.
|
|
25
25
|
*/
|
|
26
26
|
export declare function getNonBuildableLibs(graph: ProjectGraph, projectName: string): (string | RegExp)[];
|
|
27
|
-
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CreateDependencies,
|
|
1
|
+
import { CreateDependencies, CreateNodes } from '@nx/devkit';
|
|
2
2
|
export interface WebpackPluginOptions {
|
|
3
3
|
buildTargetName?: string;
|
|
4
4
|
serveTargetName?: string;
|
|
@@ -11,6 +11,5 @@ export interface WebpackPluginOptions {
|
|
|
11
11
|
* @deprecated The 'createDependencies' function is now a no-op. This functionality is included in 'createNodesV2'.
|
|
12
12
|
*/
|
|
13
13
|
export declare const createDependencies: CreateDependencies;
|
|
14
|
-
export declare const createNodes:
|
|
15
|
-
export declare const createNodesV2:
|
|
16
|
-
//# sourceMappingURL=plugin.d.ts.map
|
|
14
|
+
export declare const createNodes: CreateNodes<WebpackPluginOptions>;
|
|
15
|
+
export declare const createNodesV2: CreateNodes<WebpackPluginOptions>;
|
|
@@ -88,7 +88,7 @@ async function createWebpackTargets(configFilePath, projectRoot, options, contex
|
|
|
88
88
|
const targets = {};
|
|
89
89
|
targets[options.buildTargetName] = {
|
|
90
90
|
command: `webpack-cli build`,
|
|
91
|
-
options: { cwd: projectRoot,
|
|
91
|
+
options: { cwd: projectRoot, env: { NODE_ENV: 'production' } },
|
|
92
92
|
cache: true,
|
|
93
93
|
dependsOn: [`^${options.buildTargetName}`],
|
|
94
94
|
inputs: 'production' in namedInputs
|
|
@@ -128,7 +128,7 @@ async function createWebpackTargets(configFilePath, projectRoot, options, contex
|
|
|
128
128
|
command: `webpack-cli serve`,
|
|
129
129
|
options: {
|
|
130
130
|
cwd: projectRoot,
|
|
131
|
-
|
|
131
|
+
env: { NODE_ENV: 'development' },
|
|
132
132
|
},
|
|
133
133
|
metadata: {
|
|
134
134
|
technologies: ['webpack'],
|
|
@@ -148,7 +148,7 @@ async function createWebpackTargets(configFilePath, projectRoot, options, contex
|
|
|
148
148
|
command: `webpack-cli serve`,
|
|
149
149
|
options: {
|
|
150
150
|
cwd: projectRoot,
|
|
151
|
-
|
|
151
|
+
env: { NODE_ENV: 'production' },
|
|
152
152
|
},
|
|
153
153
|
metadata: {
|
|
154
154
|
technologies: ['webpack'],
|
|
@@ -29,4 +29,3 @@ module.exports = async () => ({
|
|
|
29
29
|
export declare function useLegacyNxPlugin(fn: (config: Configuration, ctx: NxWebpackExecutionContext) => Promise<Configuration>, executorOptions: NxAppWebpackPluginOptions): Promise<{
|
|
30
30
|
apply(compiler: Compiler): void;
|
|
31
31
|
}>;
|
|
32
|
-
//# sourceMappingURL=use-legacy-nx-plugin.d.ts.map
|
|
@@ -14,10 +14,21 @@ export interface NxComposableWebpackPlugin {
|
|
|
14
14
|
export interface AsyncNxComposableWebpackPlugin {
|
|
15
15
|
(config: Configuration, ctx: NxWebpackExecutionContext): Configuration | Promise<Configuration>;
|
|
16
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* @deprecated Will be removed in Nx v24. Use `NxAppWebpackPlugin` from
|
|
19
|
+
* `@nx/webpack/app-plugin` in a standard webpack config and run
|
|
20
|
+
* `nx g @nx/webpack:convert-to-inferred`. See
|
|
21
|
+
* https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.
|
|
22
|
+
*/
|
|
17
23
|
export declare function composePlugins(...plugins: (NxComposableWebpackPlugin | AsyncNxComposableWebpackPlugin | Promise<NxComposableWebpackPlugin | AsyncNxComposableWebpackPlugin>)[]): ((config: Configuration, ctx: NxWebpackExecutionContext) => Promise<Configuration>) & {
|
|
18
24
|
nxWebpackComposablePlugin: boolean;
|
|
19
25
|
};
|
|
26
|
+
/**
|
|
27
|
+
* @deprecated Will be removed in Nx v24. Use `NxAppWebpackPlugin` from
|
|
28
|
+
* `@nx/webpack/app-plugin` in a standard webpack config and run
|
|
29
|
+
* `nx g @nx/webpack:convert-to-inferred`. See
|
|
30
|
+
* https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.
|
|
31
|
+
*/
|
|
20
32
|
export declare function composePluginsSync(...plugins: NxComposableWebpackPlugin[]): ((config: Configuration, ctx: NxWebpackExecutionContext) => Configuration) & {
|
|
21
33
|
nxWebpackComposablePlugin: boolean;
|
|
22
34
|
};
|
|
23
|
-
//# sourceMappingURL=config.d.ts.map
|
|
@@ -7,11 +7,19 @@ exports.composePluginsSync = composePluginsSync;
|
|
|
7
7
|
const devkit_1 = require("@nx/devkit");
|
|
8
8
|
const internal_1 = require("@nx/js/internal");
|
|
9
9
|
const configuration_1 = require("nx/src/config/configuration");
|
|
10
|
+
const deprecation_1 = require("./deprecation");
|
|
10
11
|
exports.nxWebpackComposablePlugin = 'nxWebpackComposablePlugin';
|
|
11
12
|
function isNxWebpackComposablePlugin(a) {
|
|
12
13
|
return a?.[exports.nxWebpackComposablePlugin] === true;
|
|
13
14
|
}
|
|
15
|
+
/**
|
|
16
|
+
* @deprecated Will be removed in Nx v24. Use `NxAppWebpackPlugin` from
|
|
17
|
+
* `@nx/webpack/app-plugin` in a standard webpack config and run
|
|
18
|
+
* `nx g @nx/webpack:convert-to-inferred`. See
|
|
19
|
+
* https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.
|
|
20
|
+
*/
|
|
14
21
|
function composePlugins(...plugins) {
|
|
22
|
+
(0, deprecation_1.warnWebpackComposeHelpersDeprecation)();
|
|
15
23
|
return Object.assign(async function combined(config, ctx) {
|
|
16
24
|
// Webpack may be calling us as a standard config function.
|
|
17
25
|
// Build up Nx context from environment variables.
|
|
@@ -31,7 +39,14 @@ function composePlugins(...plugins) {
|
|
|
31
39
|
[exports.nxWebpackComposablePlugin]: true,
|
|
32
40
|
});
|
|
33
41
|
}
|
|
42
|
+
/**
|
|
43
|
+
* @deprecated Will be removed in Nx v24. Use `NxAppWebpackPlugin` from
|
|
44
|
+
* `@nx/webpack/app-plugin` in a standard webpack config and run
|
|
45
|
+
* `nx g @nx/webpack:convert-to-inferred`. See
|
|
46
|
+
* https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.
|
|
47
|
+
*/
|
|
34
48
|
function composePluginsSync(...plugins) {
|
|
49
|
+
(0, deprecation_1.warnWebpackComposeHelpersDeprecation)();
|
|
35
50
|
return Object.assign(function combined(config, ctx) {
|
|
36
51
|
for (const plugin of plugins) {
|
|
37
52
|
config = plugin(config, ctx);
|
|
@@ -3,4 +3,6 @@ export declare const WEBPACK_DEV_SERVER_EXECUTOR_DEPRECATION_MESSAGE = "The `@nx
|
|
|
3
3
|
export declare function warnWebpackExecutorDeprecation(): void;
|
|
4
4
|
export declare function warnWebpackDevServerExecutorDeprecation(): void;
|
|
5
5
|
export declare function warnWebpackExecutorGenerating(): void;
|
|
6
|
-
|
|
6
|
+
export declare const WEBPACK_COMPOSE_HELPERS_DEPRECATION_MESSAGE = "The `composePlugins`, `withNx`, and `withWeb` config helpers from `@nx/webpack` are deprecated and will be removed in Nx v24. They produce an Nx-specific config function that only runs under the `@nx/webpack:webpack` executor. Migrate to a standard webpack config that uses `NxAppWebpackPlugin` (from `@nx/webpack/app-plugin`) under the inferred `@nx/webpack/plugin` by running `nx g @nx/webpack:convert-to-inferred`. See https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.";
|
|
7
|
+
export declare function suppressWebpackComposeHelperWarnings<T>(fn: () => T): T;
|
|
8
|
+
export declare function warnWebpackComposeHelpersDeprecation(): void;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WEBPACK_DEV_SERVER_EXECUTOR_DEPRECATION_MESSAGE = exports.WEBPACK_EXECUTOR_DEPRECATION_MESSAGE = void 0;
|
|
3
|
+
exports.WEBPACK_COMPOSE_HELPERS_DEPRECATION_MESSAGE = exports.WEBPACK_DEV_SERVER_EXECUTOR_DEPRECATION_MESSAGE = exports.WEBPACK_EXECUTOR_DEPRECATION_MESSAGE = void 0;
|
|
4
4
|
exports.warnWebpackExecutorDeprecation = warnWebpackExecutorDeprecation;
|
|
5
5
|
exports.warnWebpackDevServerExecutorDeprecation = warnWebpackDevServerExecutorDeprecation;
|
|
6
6
|
exports.warnWebpackExecutorGenerating = warnWebpackExecutorGenerating;
|
|
7
|
+
exports.suppressWebpackComposeHelperWarnings = suppressWebpackComposeHelperWarnings;
|
|
8
|
+
exports.warnWebpackComposeHelpersDeprecation = warnWebpackComposeHelpersDeprecation;
|
|
7
9
|
const devkit_1 = require("@nx/devkit");
|
|
8
10
|
// TODO(v24): Remove the @nx/webpack:webpack and @nx/webpack:dev-server
|
|
9
11
|
// executors. The inferred plugin (@nx/webpack/plugin) and the
|
|
@@ -23,3 +25,31 @@ function warnWebpackDevServerExecutorDeprecation() {
|
|
|
23
25
|
function warnWebpackExecutorGenerating() {
|
|
24
26
|
devkit_1.logger.warn('Generating targets that use the deprecated `@nx/webpack:webpack` and `@nx/webpack:dev-server` executors. These executors will be removed in Nx v24. Run `nx g @nx/webpack:convert-to-inferred` next to migrate these targets to the `@nx/webpack/plugin` inferred plugin and prevent future generators from emitting executor targets. See https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.');
|
|
25
27
|
}
|
|
28
|
+
// TODO(v24): Remove the composePlugins/withNx/withWeb config helpers. They emit
|
|
29
|
+
// an Nx-specific config function that only runs under the @nx/webpack:webpack
|
|
30
|
+
// executor; the inferred @nx/webpack/plugin works with standard webpack configs
|
|
31
|
+
// built around NxAppWebpackPlugin instead.
|
|
32
|
+
exports.WEBPACK_COMPOSE_HELPERS_DEPRECATION_MESSAGE = 'The `composePlugins`, `withNx`, and `withWeb` config helpers from `@nx/webpack` are deprecated and will be removed in Nx v24. They produce an Nx-specific config function that only runs under the `@nx/webpack:webpack` executor. Migrate to a standard webpack config that uses `NxAppWebpackPlugin` (from `@nx/webpack/app-plugin`) under the inferred `@nx/webpack/plugin` by running `nx g @nx/webpack:convert-to-inferred`. See https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.';
|
|
33
|
+
let composeHelpersWarned = false;
|
|
34
|
+
let suppressDepth = 0;
|
|
35
|
+
// Nx-internal entry points compose these helpers themselves (e.g. the rspack
|
|
36
|
+
// executor, the storybook/component-testing presets). They wrap their
|
|
37
|
+
// synchronous composition in this so the warning fires only for user-authored
|
|
38
|
+
// configs, not for users who never touched the compose helpers.
|
|
39
|
+
function suppressWebpackComposeHelperWarnings(fn) {
|
|
40
|
+
suppressDepth++;
|
|
41
|
+
try {
|
|
42
|
+
return fn();
|
|
43
|
+
}
|
|
44
|
+
finally {
|
|
45
|
+
suppressDepth--;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
// Warn once per process so a `composePlugins(withNx(), withWeb())` chain logs a
|
|
49
|
+
// single line, not one per helper, and HMR reloads don't repeat it.
|
|
50
|
+
function warnWebpackComposeHelpersDeprecation() {
|
|
51
|
+
if (suppressDepth > 0 || composeHelpersWarned)
|
|
52
|
+
return;
|
|
53
|
+
composeHelpersWarned = true;
|
|
54
|
+
devkit_1.logger.warn(exports.WEBPACK_COMPOSE_HELPERS_DEPRECATION_MESSAGE);
|
|
55
|
+
}
|
|
@@ -1,3 +1,2 @@
|
|
|
1
1
|
import { type Tree } from '@nx/devkit';
|
|
2
2
|
export declare function getWebpackE2EWebServerInfo(tree: Tree, projectName: string, configFilePath: string, isPluginBeingAdded: boolean, e2ePortOverride?: number): Promise<import("@nx/devkit/internal").E2EWebServerDetails>;
|
|
3
|
-
//# sourceMappingURL=e2e-web-server-info-utils.d.ts.map
|
|
@@ -21,6 +21,6 @@ function ensureDependencies(tree, options) {
|
|
|
21
21
|
devDependencies['@svgr/webpack'] = versions_1.svgrWebpackVersion;
|
|
22
22
|
devDependencies['react-refresh'] = versions_1.reactRefreshVersion;
|
|
23
23
|
}
|
|
24
|
-
tasks.push((0, devkit_1.addDependenciesToPackageJson)(tree, {}, devDependencies));
|
|
24
|
+
tasks.push((0, devkit_1.addDependenciesToPackageJson)(tree, {}, devDependencies, undefined, true));
|
|
25
25
|
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
26
26
|
}
|
|
@@ -4,4 +4,3 @@ export declare function findAllNodeModules(from: string, root?: string): string[
|
|
|
4
4
|
* Delete an output directory, but error out if it's the root of the project.
|
|
5
5
|
*/
|
|
6
6
|
export declare function deleteOutputDir(root: string, outputPath: string): void;
|
|
7
|
-
//# sourceMappingURL=fs.d.ts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type Tree } from '@nx/devkit';
|
|
2
|
+
export declare const nxVersion: any;
|
|
3
|
+
export declare const swcLoaderVersion = "0.1.15";
|
|
4
|
+
export declare const tsLibVersion = "^2.3.0";
|
|
5
|
+
export declare const minSupportedWebpackVersion = "5.0.0";
|
|
6
|
+
export declare const webpackVersion = "^5.101.3";
|
|
7
|
+
export declare const webpackDevServerVersion = "^5.2.1";
|
|
8
|
+
export declare const webpackCliVersion = "^7.0.0";
|
|
9
|
+
export declare const reactRefreshWebpackPluginVersion = "^0.5.7";
|
|
10
|
+
export declare const svgrWebpackVersion = "^8.0.1";
|
|
11
|
+
export declare const reactRefreshVersion = "^0.10.0";
|
|
12
|
+
export declare function assertSupportedWebpackVersion(tree: Tree): void;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.reactRefreshVersion = exports.svgrWebpackVersion = exports.reactRefreshWebpackPluginVersion = exports.webpackCliVersion = exports.webpackDevServerVersion = exports.webpackVersion = exports.minSupportedWebpackVersion = exports.tsLibVersion = exports.swcLoaderVersion = exports.nxVersion = void 0;
|
|
4
|
+
exports.assertSupportedWebpackVersion = assertSupportedWebpackVersion;
|
|
5
|
+
const path_1 = require("path");
|
|
6
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
7
|
+
exports.nxVersion = require((0, path_1.join)('@nx/webpack', 'package.json')).version;
|
|
8
|
+
exports.swcLoaderVersion = '0.1.15';
|
|
9
|
+
exports.tsLibVersion = '^2.3.0';
|
|
10
|
+
// Floor for the generator-level support check. The plugin's runtime code uses
|
|
11
|
+
// webpack 5-only APIs (e.g. `ids.HashedModuleIdsPlugin`, `webpack.sources`,
|
|
12
|
+
// `experiments.cacheUnaffected`), so webpack 5 is the supported floor.
|
|
13
|
+
exports.minSupportedWebpackVersion = '5.0.0';
|
|
14
|
+
// Fresh-install versions written when the package is not already present.
|
|
15
|
+
exports.webpackVersion = '^5.101.3';
|
|
16
|
+
exports.webpackDevServerVersion = '^5.2.1';
|
|
17
|
+
exports.webpackCliVersion = '^7.0.0';
|
|
18
|
+
// React apps
|
|
19
|
+
exports.reactRefreshWebpackPluginVersion = '^0.5.7';
|
|
20
|
+
exports.svgrWebpackVersion = '^8.0.1';
|
|
21
|
+
exports.reactRefreshVersion = '^0.10.0';
|
|
22
|
+
function assertSupportedWebpackVersion(tree) {
|
|
23
|
+
(0, internal_1.assertSupportedPackageVersion)(tree, 'webpack', exports.minSupportedWebpackVersion);
|
|
24
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|