@nx/angular-rspack 20.8.2 → 20.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/config/config-utils/browser-config.d.ts +4 -0
- package/dist/lib/config/config-utils/browser-config.d.ts.map +1 -0
- package/dist/lib/config/config-utils/browser-config.js +68 -0
- package/dist/lib/config/config-utils/common-config.d.ts +3 -0
- package/dist/lib/config/config-utils/common-config.d.ts.map +1 -0
- package/dist/lib/config/config-utils/common-config.js +111 -0
- package/dist/lib/config/config-utils/dev-server-config-utils.d.ts +4 -0
- package/dist/lib/config/config-utils/dev-server-config-utils.d.ts.map +1 -0
- package/dist/lib/config/config-utils/dev-server-config-utils.js +255 -0
- package/dist/lib/config/{entry-points.d.ts → config-utils/entry-points.d.ts} +1 -1
- package/dist/lib/config/config-utils/entry-points.d.ts.map +1 -0
- package/dist/lib/config/config-utils/helpers.d.ts +13 -0
- package/dist/lib/config/config-utils/helpers.d.ts.map +1 -0
- package/dist/lib/config/{helpers.js → config-utils/helpers.js} +33 -0
- package/dist/lib/config/config-utils/optimization-config.d.ts +5 -0
- package/dist/lib/config/config-utils/optimization-config.d.ts.map +1 -0
- package/dist/lib/config/config-utils/optimization-config.js +67 -0
- package/dist/lib/config/config-utils/server-config.d.ts +4 -0
- package/dist/lib/config/config-utils/server-config.d.ts.map +1 -0
- package/dist/lib/config/config-utils/server-config.js +87 -0
- package/dist/lib/config/config-utils/sourcemap-utils.d.ts +7 -0
- package/dist/lib/config/config-utils/sourcemap-utils.d.ts.map +1 -0
- package/dist/lib/config/config-utils/sourcemap-utils.js +48 -0
- package/dist/lib/config/config-utils/style-config-utils.d.ts +7 -0
- package/dist/lib/config/config-utils/style-config-utils.d.ts.map +1 -0
- package/dist/lib/config/config-utils/style-config-utils.js +353 -0
- package/dist/lib/config/config-utils/user-defined-config-helpers.d.ts +78 -0
- package/dist/lib/config/config-utils/user-defined-config-helpers.d.ts.map +1 -0
- package/dist/lib/config/config-utils/user-defined-config-helpers.js +23 -0
- package/dist/lib/config/create-config.d.ts +2 -75
- package/dist/lib/config/create-config.d.ts.map +1 -1
- package/dist/lib/config/create-config.js +17 -473
- package/dist/lib/index.d.ts +4 -0
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/index.js +9 -0
- package/dist/lib/models/angular-rspack-plugin-options.d.ts +41 -4
- package/dist/lib/models/angular-rspack-plugin-options.d.ts.map +1 -1
- package/dist/lib/models/normalize-options.d.ts.map +1 -1
- package/dist/lib/models/normalize-options.js +53 -54
- package/dist/lib/models/unsupported-options.d.ts +0 -7
- package/dist/lib/models/unsupported-options.d.ts.map +1 -1
- package/dist/lib/models/unsupported-options.js +0 -4
- package/dist/lib/plugins/angular-rspack-plugin.d.ts.map +1 -1
- package/dist/lib/plugins/angular-rspack-plugin.js +0 -7
- package/dist/lib/plugins/angular-ssr-dev-server.d.ts +2 -2
- package/dist/lib/plugins/angular-ssr-dev-server.d.ts.map +1 -1
- package/dist/lib/plugins/angular-ssr-dev-server.js +19 -9
- package/dist/lib/plugins/index-html-plugin.d.ts.map +1 -1
- package/dist/lib/plugins/index-html-plugin.js +2 -7
- package/dist/lib/plugins/loaders/platform-server-exports.loader.d.ts +5 -0
- package/dist/lib/plugins/loaders/platform-server-exports.loader.d.ts.map +1 -0
- package/dist/lib/plugins/loaders/platform-server-exports.loader.js +18 -0
- package/dist/lib/plugins/ng-rspack.d.ts.map +1 -1
- package/dist/lib/plugins/ng-rspack.js +3 -3
- package/dist/lib/plugins/prerender-plugin.d.ts +8 -0
- package/dist/lib/plugins/prerender-plugin.d.ts.map +1 -0
- package/dist/lib/plugins/prerender-plugin.js +154 -0
- package/dist/lib/plugins/tools/render-worker.d.ts +31 -0
- package/dist/lib/plugins/tools/render-worker.d.ts.map +1 -0
- package/dist/lib/plugins/tools/render-worker.js +103 -0
- package/dist/lib/plugins/tools/routes-extractor-worker.d.ts +21 -0
- package/dist/lib/plugins/tools/routes-extractor-worker.d.ts.map +1 -0
- package/dist/lib/plugins/tools/routes-extractor-worker.js +46 -0
- package/dist/lib/plugins/tools/worker-pool.d.ts +13 -0
- package/dist/lib/plugins/tools/worker-pool.d.ts.map +1 -0
- package/dist/lib/plugins/tools/worker-pool.js +26 -0
- package/dist/lib/utils/index-file/add-body-script.d.ts +2 -0
- package/dist/lib/utils/index-file/add-body-script.d.ts.map +1 -0
- package/dist/lib/utils/index-file/add-body-script.js +15 -0
- package/dist/lib/utils/index-file/get-index-output-file.d.ts +3 -0
- package/dist/lib/utils/index-file/get-index-output-file.d.ts.map +1 -0
- package/dist/lib/utils/index-file/get-index-output-file.js +10 -0
- package/dist/lib/utils/max-workers.d.ts +2 -0
- package/dist/lib/utils/max-workers.d.ts.map +1 -0
- package/dist/lib/utils/max-workers.js +21 -0
- package/dist/lib/utils/postcss-cli-resources.d.ts +22 -0
- package/dist/lib/utils/postcss-cli-resources.d.ts.map +1 -0
- package/dist/lib/utils/postcss-cli-resources.js +158 -0
- package/dist/lib/utils/postcss-configuration.d.ts +18 -0
- package/dist/lib/utils/postcss-configuration.d.ts.map +1 -0
- package/dist/lib/utils/postcss-configuration.js +89 -0
- package/package.json +19 -5
- package/dist/lib/config/dev-server-config-utils.d.ts +0 -4
- package/dist/lib/config/dev-server-config-utils.d.ts.map +0 -1
- package/dist/lib/config/dev-server-config-utils.js +0 -107
- package/dist/lib/config/entry-points.d.ts.map +0 -1
- package/dist/lib/config/helpers.d.ts +0 -14
- package/dist/lib/config/helpers.d.ts.map +0 -1
- package/dist/lib/config/style-config-utils.d.ts +0 -22
- package/dist/lib/config/style-config-utils.d.ts.map +0 -1
- package/dist/lib/config/style-config-utils.js +0 -202
- package/dist/lib/utils/tailwind.d.ts +0 -2
- package/dist/lib/utils/tailwind.d.ts.map +0 -1
- package/dist/lib/utils/tailwind.js +0 -31
- /package/dist/lib/config/{entry-points.js → config-utils/entry-points.js} +0 -0
|
@@ -1,202 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getStyleLoaders = getStyleLoaders;
|
|
4
|
-
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const core_1 = require("@rspack/core");
|
|
6
|
-
const node_path_1 = require("node:path");
|
|
7
|
-
const tailwind_1 = require("../utils/tailwind");
|
|
8
|
-
/**
|
|
9
|
-
* Returns an array of style loaders for sass and less. Both loader´s are always returned
|
|
10
|
-
*
|
|
11
|
-
* @param stylePreprocessorOptions
|
|
12
|
-
* @param sourceMap
|
|
13
|
-
*/
|
|
14
|
-
async function getStyleLoaders(buildOptions) {
|
|
15
|
-
const cssSourceMap = buildOptions.sourceMap.styles;
|
|
16
|
-
const includePaths = buildOptions.stylePreprocessorOptions?.includePaths?.map((p) => (0, node_path_1.resolve)(devkit_1.workspaceRoot, p)) ?? [];
|
|
17
|
-
const extraPostcssPlugins = [];
|
|
18
|
-
// Attempt to setup Tailwind CSS
|
|
19
|
-
// Only load Tailwind CSS plugin if configuration file was found.
|
|
20
|
-
// This acts as a guard to ensure the project actually wants to use Tailwind CSS.
|
|
21
|
-
// The package may be unknowningly present due to a third-party transitive package dependency.
|
|
22
|
-
const tailwindConfigPath = await (0, tailwind_1.findTailwindConfigurationFile)(devkit_1.workspaceRoot, buildOptions.root);
|
|
23
|
-
if (tailwindConfigPath) {
|
|
24
|
-
let tailwindPackagePath;
|
|
25
|
-
try {
|
|
26
|
-
tailwindPackagePath = require.resolve('tailwindcss', {
|
|
27
|
-
paths: [devkit_1.workspaceRoot, buildOptions.root],
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
catch {
|
|
31
|
-
const relativeTailwindConfigPath = (0, node_path_1.relative)(devkit_1.workspaceRoot, tailwindConfigPath);
|
|
32
|
-
console.warn(`Tailwind CSS configuration file found (${relativeTailwindConfigPath})` +
|
|
33
|
-
` but the 'tailwindcss' package is not installed.` +
|
|
34
|
-
` To enable Tailwind CSS, please install the 'tailwindcss' package.`);
|
|
35
|
-
}
|
|
36
|
-
if (tailwindPackagePath) {
|
|
37
|
-
extraPostcssPlugins.push(require(tailwindPackagePath)({ config: tailwindConfigPath }));
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
const autoprefixer = require('autoprefixer');
|
|
41
|
-
const postcssOptionsCreator = (inlineSourcemaps) => {
|
|
42
|
-
const optionGenerator = () => ({
|
|
43
|
-
map: inlineSourcemaps
|
|
44
|
-
? {
|
|
45
|
-
inline: true,
|
|
46
|
-
annotation: false,
|
|
47
|
-
}
|
|
48
|
-
: undefined,
|
|
49
|
-
plugins: [
|
|
50
|
-
...extraPostcssPlugins,
|
|
51
|
-
autoprefixer({
|
|
52
|
-
ignoreUnknownVersions: true,
|
|
53
|
-
overrideBrowserslist: buildOptions.supportedBrowsers,
|
|
54
|
-
}),
|
|
55
|
-
],
|
|
56
|
-
});
|
|
57
|
-
// postcss-loader fails when trying to determine configuration files for data URIs
|
|
58
|
-
optionGenerator.config = false;
|
|
59
|
-
return optionGenerator;
|
|
60
|
-
};
|
|
61
|
-
let componentsSourceMap = !!cssSourceMap;
|
|
62
|
-
if (cssSourceMap) {
|
|
63
|
-
// TODO: use below once we support optimization granular options
|
|
64
|
-
// if (buildOptions.optimization.styles.minify) {
|
|
65
|
-
if (buildOptions.optimization) {
|
|
66
|
-
// Never use component css sourcemap when style optimizations are on.
|
|
67
|
-
// It will just increase bundle size without offering good debug experience.
|
|
68
|
-
console.warn('Components styles sourcemaps are not generated when styles optimization is enabled.');
|
|
69
|
-
componentsSourceMap = false;
|
|
70
|
-
}
|
|
71
|
-
else if (buildOptions.sourceMap.hidden) {
|
|
72
|
-
// Inline all sourcemap types except hidden ones, which are the same as no sourcemaps
|
|
73
|
-
// for component css.
|
|
74
|
-
console.warn('Components styles sourcemaps are not generated when sourcemaps are hidden.');
|
|
75
|
-
componentsSourceMap = false;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
const postCss = require('postcss');
|
|
79
|
-
const postCssLoaderPath = require.resolve('postcss-loader');
|
|
80
|
-
const componentStyleLoaders = [
|
|
81
|
-
{
|
|
82
|
-
loader: require.resolve('css-loader'),
|
|
83
|
-
options: {
|
|
84
|
-
url: false,
|
|
85
|
-
sourceMap: componentsSourceMap,
|
|
86
|
-
importLoaders: 1,
|
|
87
|
-
exportType: 'string',
|
|
88
|
-
esModule: false,
|
|
89
|
-
},
|
|
90
|
-
},
|
|
91
|
-
{
|
|
92
|
-
loader: postCssLoaderPath,
|
|
93
|
-
options: {
|
|
94
|
-
implementation: postCss,
|
|
95
|
-
postcssOptions: postcssOptionsCreator(componentsSourceMap),
|
|
96
|
-
},
|
|
97
|
-
},
|
|
98
|
-
];
|
|
99
|
-
const globalStyleLoaders = [
|
|
100
|
-
{
|
|
101
|
-
loader: core_1.CssExtractRspackPlugin.loader,
|
|
102
|
-
},
|
|
103
|
-
{
|
|
104
|
-
loader: require.resolve('css-loader'),
|
|
105
|
-
options: {
|
|
106
|
-
url: false,
|
|
107
|
-
sourceMap: !!cssSourceMap,
|
|
108
|
-
importLoaders: 1,
|
|
109
|
-
},
|
|
110
|
-
},
|
|
111
|
-
{
|
|
112
|
-
loader: postCssLoaderPath,
|
|
113
|
-
options: {
|
|
114
|
-
implementation: postCss,
|
|
115
|
-
postcssOptions: postcssOptionsCreator(false),
|
|
116
|
-
sourceMap: !!cssSourceMap,
|
|
117
|
-
},
|
|
118
|
-
},
|
|
119
|
-
];
|
|
120
|
-
const styleLanguages = [
|
|
121
|
-
{
|
|
122
|
-
extensions: ['css'],
|
|
123
|
-
use: [],
|
|
124
|
-
},
|
|
125
|
-
{
|
|
126
|
-
extensions: ['scss'],
|
|
127
|
-
use: [
|
|
128
|
-
{
|
|
129
|
-
loader: require.resolve('resolve-url-loader'),
|
|
130
|
-
options: {
|
|
131
|
-
sourceMap: cssSourceMap,
|
|
132
|
-
},
|
|
133
|
-
},
|
|
134
|
-
{
|
|
135
|
-
loader: require.resolve('sass-loader'),
|
|
136
|
-
options: getSassLoaderOptions(includePaths, buildOptions.stylePreprocessorOptions?.sass),
|
|
137
|
-
},
|
|
138
|
-
],
|
|
139
|
-
},
|
|
140
|
-
{
|
|
141
|
-
extensions: ['sass'],
|
|
142
|
-
use: [
|
|
143
|
-
{
|
|
144
|
-
loader: require.resolve('resolve-url-loader'),
|
|
145
|
-
options: {
|
|
146
|
-
sourceMap: cssSourceMap,
|
|
147
|
-
},
|
|
148
|
-
},
|
|
149
|
-
{
|
|
150
|
-
loader: require.resolve('sass-loader'),
|
|
151
|
-
options: getSassLoaderOptions(includePaths, buildOptions.stylePreprocessorOptions?.sass),
|
|
152
|
-
},
|
|
153
|
-
],
|
|
154
|
-
},
|
|
155
|
-
{
|
|
156
|
-
extensions: ['less'],
|
|
157
|
-
use: [
|
|
158
|
-
{
|
|
159
|
-
loader: require.resolve('less-loader'),
|
|
160
|
-
options: {
|
|
161
|
-
sourceMap: cssSourceMap,
|
|
162
|
-
lessOptions: {
|
|
163
|
-
javascriptEnabled: true,
|
|
164
|
-
paths: includePaths,
|
|
165
|
-
},
|
|
166
|
-
},
|
|
167
|
-
},
|
|
168
|
-
],
|
|
169
|
-
},
|
|
170
|
-
];
|
|
171
|
-
return styleLanguages.map(({ extensions, use }) => ({
|
|
172
|
-
test: new RegExp(`\\.(?:${extensions.join('|')})$`, 'i'),
|
|
173
|
-
rules: [
|
|
174
|
-
// Setup processing rules for global and component styles
|
|
175
|
-
{
|
|
176
|
-
oneOf: [
|
|
177
|
-
// Global styles are only defined global styles
|
|
178
|
-
{
|
|
179
|
-
use: globalStyleLoaders,
|
|
180
|
-
resourceQuery: /\?ngGlobalStyle/,
|
|
181
|
-
},
|
|
182
|
-
// Component styles are all styles except defined global styles
|
|
183
|
-
{
|
|
184
|
-
use: componentStyleLoaders,
|
|
185
|
-
resourceQuery: /\?ngResource/,
|
|
186
|
-
},
|
|
187
|
-
],
|
|
188
|
-
},
|
|
189
|
-
{ use },
|
|
190
|
-
],
|
|
191
|
-
}));
|
|
192
|
-
}
|
|
193
|
-
function getSassLoaderOptions(includePaths, sassOptions) {
|
|
194
|
-
return {
|
|
195
|
-
api: 'modern-compiler',
|
|
196
|
-
sourceMap: true,
|
|
197
|
-
sourceMapIncludeSources: true,
|
|
198
|
-
implementation: require.resolve('sass-embedded'),
|
|
199
|
-
includePaths,
|
|
200
|
-
...(sassOptions ?? {}),
|
|
201
|
-
};
|
|
202
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tailwind.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/tailwind.ts"],"names":[],"mappings":"AAUA,wBAAsB,6BAA6B,CACjD,aAAa,EAAE,MAAM,EACrB,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAsB7B"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.findTailwindConfigurationFile = findTailwindConfigurationFile;
|
|
4
|
-
const promises_1 = require("node:fs/promises");
|
|
5
|
-
const node_path_1 = require("node:path");
|
|
6
|
-
const tailwindConfigFiles = [
|
|
7
|
-
'tailwind.config.js',
|
|
8
|
-
'tailwind.config.cjs',
|
|
9
|
-
'tailwind.config.mjs',
|
|
10
|
-
'tailwind.config.ts',
|
|
11
|
-
];
|
|
12
|
-
async function findTailwindConfigurationFile(workspaceRoot, projectRoot) {
|
|
13
|
-
try {
|
|
14
|
-
const dirEntries = [projectRoot, workspaceRoot].map((root) => (0, promises_1.readdir)(root, { withFileTypes: false }).then((entries) => ({
|
|
15
|
-
root,
|
|
16
|
-
files: new Set(entries),
|
|
17
|
-
})));
|
|
18
|
-
// A configuration file can exist in the project or workspace root
|
|
19
|
-
for (const { root, files } of await Promise.all(dirEntries)) {
|
|
20
|
-
for (const potentialConfig of tailwindConfigFiles) {
|
|
21
|
-
if (files.has(potentialConfig)) {
|
|
22
|
-
return (0, node_path_1.join)(root, potentialConfig);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
catch {
|
|
28
|
-
// ignore
|
|
29
|
-
}
|
|
30
|
-
return undefined;
|
|
31
|
-
}
|
|
File without changes
|