@nx/angular-rspack 0.0.0-pr-32422-a3285be
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +22 -0
- package/README.md +98 -0
- package/README.md__tpl__ +48 -0
- 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 +83 -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 +144 -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 +258 -0
- package/dist/lib/config/config-utils/entry-points.d.ts +9 -0
- package/dist/lib/config/config-utils/entry-points.d.ts.map +1 -0
- package/dist/lib/config/config-utils/entry-points.js +36 -0
- package/dist/lib/config/config-utils/get-stats-options.d.ts +3 -0
- package/dist/lib/config/config-utils/get-stats-options.d.ts.map +1 -0
- package/dist/lib/config/config-utils/get-stats-options.js +39 -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/config-utils/helpers.js +106 -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 +69 -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 +92 -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 +73 -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 +11 -0
- package/dist/lib/config/create-config.d.ts.map +1 -0
- package/dist/lib/config/create-config.js +35 -0
- package/dist/lib/config/i18n/create-i18n-options.d.ts +6 -0
- package/dist/lib/config/i18n/create-i18n-options.d.ts.map +1 -0
- package/dist/lib/config/i18n/create-i18n-options.js +124 -0
- package/dist/lib/index.d.ts +7 -0
- package/dist/lib/index.d.ts.map +1 -0
- package/dist/lib/index.js +14 -0
- package/dist/lib/models/angular-rspack-plugin-options.d.ts +344 -0
- package/dist/lib/models/angular-rspack-plugin-options.d.ts.map +1 -0
- package/dist/lib/models/angular-rspack-plugin-options.js +2 -0
- package/dist/lib/models/augmented-compilation.d.ts +13 -0
- package/dist/lib/models/augmented-compilation.d.ts.map +1 -0
- package/dist/lib/models/augmented-compilation.js +4 -0
- package/dist/lib/models/i18n.d.ts +33 -0
- package/dist/lib/models/i18n.d.ts.map +1 -0
- package/dist/lib/models/i18n.js +41 -0
- package/dist/lib/models/index.d.ts +5 -0
- package/dist/lib/models/index.d.ts.map +1 -0
- package/dist/lib/models/index.js +7 -0
- package/dist/lib/models/normalize-options.d.ts +16 -0
- package/dist/lib/models/normalize-options.d.ts.map +1 -0
- package/dist/lib/models/normalize-options.js +424 -0
- package/dist/lib/plugins/angular-rspack-plugin.d.ts +9 -0
- package/dist/lib/plugins/angular-rspack-plugin.d.ts.map +1 -0
- package/dist/lib/plugins/angular-rspack-plugin.js +234 -0
- package/dist/lib/plugins/angular-ssr-dev-server.d.ts +8 -0
- package/dist/lib/plugins/angular-ssr-dev-server.d.ts.map +1 -0
- package/dist/lib/plugins/angular-ssr-dev-server.js +62 -0
- package/dist/lib/plugins/any-component-style-budget-checker-plugin.d.ts +19 -0
- package/dist/lib/plugins/any-component-style-budget-checker-plugin.d.ts.map +1 -0
- package/dist/lib/plugins/any-component-style-budget-checker-plugin.js +64 -0
- package/dist/lib/plugins/client/ssr-reload-client.d.ts +2 -0
- package/dist/lib/plugins/client/ssr-reload-client.d.ts.map +1 -0
- package/dist/lib/plugins/client/ssr-reload-client.js +15 -0
- package/dist/lib/plugins/i18n-inline-plugin.d.ts +8 -0
- package/dist/lib/plugins/i18n-inline-plugin.d.ts.map +1 -0
- package/dist/lib/plugins/i18n-inline-plugin.js +201 -0
- package/dist/lib/plugins/index-html-plugin.d.ts +21 -0
- package/dist/lib/plugins/index-html-plugin.d.ts.map +1 -0
- package/dist/lib/plugins/index-html-plugin.js +107 -0
- package/dist/lib/plugins/loaders/angular-partial-transform.loader.d.ts +3 -0
- package/dist/lib/plugins/loaders/angular-partial-transform.loader.d.ts.map +1 -0
- package/dist/lib/plugins/loaders/angular-partial-transform.loader.js +39 -0
- package/dist/lib/plugins/loaders/angular-transform.loader.d.ts +7 -0
- package/dist/lib/plugins/loaders/angular-transform.loader.d.ts.map +1 -0
- package/dist/lib/plugins/loaders/angular-transform.loader.js +40 -0
- package/dist/lib/plugins/loaders/hmr-accept-loader.d.ts +11 -0
- package/dist/lib/plugins/loaders/hmr-accept-loader.d.ts.map +1 -0
- package/dist/lib/plugins/loaders/hmr-accept-loader.js +24 -0
- package/dist/lib/plugins/loaders/hmr-accept.d.ts +9 -0
- package/dist/lib/plugins/loaders/hmr-accept.d.ts.map +1 -0
- package/dist/lib/plugins/loaders/hmr-accept.js +183 -0
- 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 +13 -0
- package/dist/lib/plugins/ng-rspack.d.ts.map +1 -0
- package/dist/lib/plugins/ng-rspack.js +134 -0
- 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 +216 -0
- package/dist/lib/plugins/progress-plugin.d.ts +12 -0
- package/dist/lib/plugins/progress-plugin.d.ts.map +1 -0
- package/dist/lib/plugins/progress-plugin.js +36 -0
- package/dist/lib/plugins/rxjs-esm-resolution.d.ts +5 -0
- package/dist/lib/plugins/rxjs-esm-resolution.d.ts.map +1 -0
- package/dist/lib/plugins/rxjs-esm-resolution.js +15 -0
- package/dist/lib/plugins/server/ssr-reload-server.d.ts +6 -0
- package/dist/lib/plugins/server/ssr-reload-server.d.ts.map +1 -0
- package/dist/lib/plugins/server/ssr-reload-server.js +21 -0
- package/dist/lib/plugins/stats-json-plugin.d.ts +14 -0
- package/dist/lib/plugins/stats-json-plugin.d.ts.map +1 -0
- package/dist/lib/plugins/stats-json-plugin.js +69 -0
- package/dist/lib/plugins/suppress-js-for-css-chunks-plugin.d.ts +5 -0
- package/dist/lib/plugins/suppress-js-for-css-chunks-plugin.d.ts.map +1 -0
- package/dist/lib/plugins/suppress-js-for-css-chunks-plugin.js +34 -0
- package/dist/lib/plugins/tools/dev-tools-ignore-plugin.d.ts +17 -0
- package/dist/lib/plugins/tools/dev-tools-ignore-plugin.d.ts.map +1 -0
- package/dist/lib/plugins/tools/dev-tools-ignore-plugin.js +57 -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 +105 -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 +48 -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 +23 -0
- package/dist/lib/plugins/transfer-size-plugin.d.ts +12 -0
- package/dist/lib/plugins/transfer-size-plugin.d.ts.map +1 -0
- package/dist/lib/plugins/transfer-size-plugin.js +49 -0
- package/dist/lib/plugins/watch-file-logs-plugin.d.ts +12 -0
- package/dist/lib/plugins/watch-file-logs-plugin.d.ts.map +1 -0
- package/dist/lib/plugins/watch-file-logs-plugin.js +27 -0
- package/dist/lib/utils/async-chunks.d.ts +17 -0
- package/dist/lib/utils/async-chunks.d.ts.map +1 -0
- package/dist/lib/utils/async-chunks.js +44 -0
- package/dist/lib/utils/color.d.ts +11 -0
- package/dist/lib/utils/color.d.ts.map +1 -0
- package/dist/lib/utils/color.js +41 -0
- package/dist/lib/utils/find-project-for-path.d.ts +16 -0
- package/dist/lib/utils/find-project-for-path.d.ts.map +1 -0
- package/dist/lib/utils/find-project-for-path.js +42 -0
- package/dist/lib/utils/get-locale-base-href.d.ts +3 -0
- package/dist/lib/utils/get-locale-base-href.d.ts.map +1 -0
- package/dist/lib/utils/get-locale-base-href.js +17 -0
- package/dist/lib/utils/graph.d.ts +3 -0
- package/dist/lib/utils/graph.d.ts.map +1 -0
- package/dist/lib/utils/graph.js +25 -0
- package/dist/lib/utils/i18n.d.ts +4 -0
- package/dist/lib/utils/i18n.d.ts.map +1 -0
- package/dist/lib/utils/i18n.js +25 -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/add-event-dispatch-contract.d.ts +9 -0
- package/dist/lib/utils/index-file/add-event-dispatch-contract.d.ts.map +1 -0
- package/dist/lib/utils/index-file/add-event-dispatch-contract.js +27 -0
- package/dist/lib/utils/index-file/get-index-input-file.d.ts +3 -0
- package/dist/lib/utils/index-file/get-index-input-file.d.ts.map +1 -0
- package/dist/lib/utils/index-file/get-index-input-file.js +9 -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/index-file/html-rewriting-stream.d.ts +16 -0
- package/dist/lib/utils/index-file/html-rewriting-stream.d.ts.map +1 -0
- package/dist/lib/utils/index-file/html-rewriting-stream.js +27 -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/misc-helpers.d.ts +7 -0
- package/dist/lib/utils/misc-helpers.d.ts.map +1 -0
- package/dist/lib/utils/misc-helpers.js +34 -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 +159 -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 +92 -0
- package/dist/lib/utils/rspack-diagnostics.d.ts +4 -0
- package/dist/lib/utils/rspack-diagnostics.d.ts.map +1 -0
- package/dist/lib/utils/rspack-diagnostics.js +22 -0
- package/dist/lib/utils/spinner.d.ts +21 -0
- package/dist/lib/utils/spinner.d.ts.map +1 -0
- package/dist/lib/utils/spinner.js +54 -0
- package/dist/lib/utils/stats.d.ts +35 -0
- package/dist/lib/utils/stats.d.ts.map +1 -0
- package/dist/lib/utils/stats.js +313 -0
- package/dist/lib/utils/tty.d.ts +9 -0
- package/dist/lib/utils/tty.d.ts.map +1 -0
- package/dist/lib/utils/tty.js +22 -0
- package/dist/lib/utils/url-join.d.ts +9 -0
- package/dist/lib/utils/url-join.d.ts.map +1 -0
- package/dist/lib/utils/url-join.js +17 -0
- package/package.json +150 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
|
+
*/
|
|
8
|
+
import type { Plugin } from 'postcss';
|
|
9
|
+
export interface PostcssCliResourcesOptions {
|
|
10
|
+
baseHref?: string;
|
|
11
|
+
deployUrl?: string;
|
|
12
|
+
resourcesOutputPath?: string;
|
|
13
|
+
rebaseRootRelative?: boolean;
|
|
14
|
+
/** CSS is extracted to a `.css` or is embedded in a `.js` file. */
|
|
15
|
+
extracted?: boolean;
|
|
16
|
+
filename: (resourcePath: string) => string;
|
|
17
|
+
loader: import('@rspack/core').LoaderContext<unknown>;
|
|
18
|
+
emitFile: boolean;
|
|
19
|
+
}
|
|
20
|
+
export declare const postcss = true;
|
|
21
|
+
export default function (options?: PostcssCliResourcesOptions): Plugin;
|
|
22
|
+
//# sourceMappingURL=postcss-cli-resources.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"postcss-cli-resources.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/postcss-cli-resources.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH,OAAO,KAAK,EAAe,MAAM,EAAE,MAAM,SAAS,CAAC;AAgBnD,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAE7B,mEAAmE;IACnE,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,MAAM,CAAC;IAC3C,MAAM,EAAE,OAAO,cAAc,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;IACtD,QAAQ,EAAE,OAAO,CAAC;CACnB;AAcD,eAAO,MAAM,OAAO,OAAO,CAAC;AAE5B,MAAM,CAAC,OAAO,WAAW,OAAO,CAAC,EAAE,0BAA0B,GAAG,MAAM,CAyKrE"}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5
|
+
*
|
|
6
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.postcss = void 0;
|
|
11
|
+
exports.default = default_1;
|
|
12
|
+
const tslib_1 = require("tslib");
|
|
13
|
+
const loader_utils_1 = require("loader-utils");
|
|
14
|
+
const path = tslib_1.__importStar(require("node:path"));
|
|
15
|
+
const misc_helpers_1 = require("./misc-helpers");
|
|
16
|
+
function wrapUrl(url) {
|
|
17
|
+
let wrappedUrl;
|
|
18
|
+
const hasSingleQuotes = url.indexOf("'") >= 0;
|
|
19
|
+
if (hasSingleQuotes) {
|
|
20
|
+
wrappedUrl = `"${url}"`;
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
wrappedUrl = `'${url}'`;
|
|
24
|
+
}
|
|
25
|
+
return `url(${wrappedUrl})`;
|
|
26
|
+
}
|
|
27
|
+
async function resolve(file, base, resolver) {
|
|
28
|
+
try {
|
|
29
|
+
return await resolver('./' + file, base);
|
|
30
|
+
}
|
|
31
|
+
catch {
|
|
32
|
+
return resolver(file, base);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
exports.postcss = true;
|
|
36
|
+
function default_1(options) {
|
|
37
|
+
if (!options) {
|
|
38
|
+
throw new Error('No options were specified to "postcss-cli-resources".');
|
|
39
|
+
}
|
|
40
|
+
const { deployUrl = '', resourcesOutputPath = '', filename, loader, emitFile, extracted, } = options;
|
|
41
|
+
const process = async (inputUrl, context, resourceCache) => {
|
|
42
|
+
// If root-relative, absolute or protocol relative url, leave as is
|
|
43
|
+
if (/^((?:\w+:)?\/\/|data:|chrome:|#)/.test(inputUrl)) {
|
|
44
|
+
return inputUrl;
|
|
45
|
+
}
|
|
46
|
+
if (/^\//.test(inputUrl)) {
|
|
47
|
+
return inputUrl;
|
|
48
|
+
}
|
|
49
|
+
// If starts with a caret, remove and return remainder
|
|
50
|
+
// this supports bypassing asset processing
|
|
51
|
+
if (inputUrl.startsWith('^')) {
|
|
52
|
+
return inputUrl.slice(1);
|
|
53
|
+
}
|
|
54
|
+
const cacheKey = path.resolve(context, inputUrl);
|
|
55
|
+
const cachedUrl = resourceCache.get(cacheKey);
|
|
56
|
+
if (cachedUrl) {
|
|
57
|
+
return cachedUrl;
|
|
58
|
+
}
|
|
59
|
+
if (inputUrl.startsWith('~')) {
|
|
60
|
+
inputUrl = inputUrl.slice(1);
|
|
61
|
+
}
|
|
62
|
+
const normalizedUrl = inputUrl.replace(/\\/g, '/');
|
|
63
|
+
const parsedUrl = new URL(normalizedUrl, 'file:///');
|
|
64
|
+
const { pathname, hash, search } = parsedUrl;
|
|
65
|
+
const resolver = (file, base) => new Promise((resolve, reject) => {
|
|
66
|
+
loader.resolve(base, decodeURI(file), (err, result) => {
|
|
67
|
+
if (err) {
|
|
68
|
+
reject(err);
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
resolve(result);
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
const result = await resolve(pathname, context, resolver);
|
|
75
|
+
return new Promise((resolve, reject) => {
|
|
76
|
+
loader.fs.readFile(result, (err, content) => {
|
|
77
|
+
if (err) {
|
|
78
|
+
reject(err);
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
let outputPath = (0, loader_utils_1.interpolateName)(
|
|
82
|
+
// TODO: Revisit. Previously due to lack of type safety, this object
|
|
83
|
+
// was fine, but in practice it doesn't match the type of the loader context.
|
|
84
|
+
{ resourcePath: result }, filename(result), {
|
|
85
|
+
content,
|
|
86
|
+
context: loader.context || loader.rootContext,
|
|
87
|
+
}).replace(/\\|\//g, '-');
|
|
88
|
+
if (resourcesOutputPath) {
|
|
89
|
+
outputPath = path.posix.join(resourcesOutputPath, outputPath);
|
|
90
|
+
}
|
|
91
|
+
loader.addDependency(result);
|
|
92
|
+
if (emitFile) {
|
|
93
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
94
|
+
loader.emitFile(outputPath, content, undefined, {
|
|
95
|
+
sourceFilename: result,
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
let outputUrl = outputPath.replace(/\\/g, '/');
|
|
99
|
+
if (hash || search) {
|
|
100
|
+
outputUrl = outputUrl + (search || '') + (hash || '');
|
|
101
|
+
}
|
|
102
|
+
if (deployUrl && !extracted) {
|
|
103
|
+
outputUrl = new URL(outputUrl, deployUrl).href;
|
|
104
|
+
}
|
|
105
|
+
resourceCache.set(cacheKey, outputUrl);
|
|
106
|
+
resolve(outputUrl);
|
|
107
|
+
});
|
|
108
|
+
});
|
|
109
|
+
};
|
|
110
|
+
const resourceCache = new Map();
|
|
111
|
+
const processed = Symbol('postcss-cli-resources');
|
|
112
|
+
return {
|
|
113
|
+
postcssPlugin: 'postcss-cli-resources',
|
|
114
|
+
async Declaration(decl) {
|
|
115
|
+
if (!decl.value.includes('url') || processed in decl) {
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
const value = decl.value;
|
|
119
|
+
const urlRegex = /url(?:\(\s*(['"]?))(.*?)(?:\1\s*\))/g;
|
|
120
|
+
const segments = [];
|
|
121
|
+
let match;
|
|
122
|
+
let lastIndex = 0;
|
|
123
|
+
let modified = false;
|
|
124
|
+
// We want to load it relative to the file that imports
|
|
125
|
+
const inputFile = decl.source && decl.source.input.file;
|
|
126
|
+
const context = (inputFile && path.dirname(inputFile)) || loader.context;
|
|
127
|
+
while ((match = urlRegex.exec(value))) {
|
|
128
|
+
const originalUrl = match[2];
|
|
129
|
+
let processedUrl;
|
|
130
|
+
try {
|
|
131
|
+
processedUrl = await process(originalUrl, context ?? '', resourceCache);
|
|
132
|
+
}
|
|
133
|
+
catch (err) {
|
|
134
|
+
(0, misc_helpers_1.assertIsError)(err);
|
|
135
|
+
loader.emitError(decl.error(err.message, { word: originalUrl }));
|
|
136
|
+
continue;
|
|
137
|
+
}
|
|
138
|
+
if (lastIndex < match.index) {
|
|
139
|
+
segments.push(value.slice(lastIndex, match.index));
|
|
140
|
+
}
|
|
141
|
+
if (!processedUrl || originalUrl === processedUrl) {
|
|
142
|
+
segments.push(match[0]);
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
segments.push(wrapUrl(processedUrl));
|
|
146
|
+
modified = true;
|
|
147
|
+
}
|
|
148
|
+
lastIndex = match.index + match[0].length;
|
|
149
|
+
}
|
|
150
|
+
if (lastIndex < value.length) {
|
|
151
|
+
segments.push(value.slice(lastIndex));
|
|
152
|
+
}
|
|
153
|
+
if (modified) {
|
|
154
|
+
decl.value = segments.join('');
|
|
155
|
+
}
|
|
156
|
+
decl[processed] = true;
|
|
157
|
+
},
|
|
158
|
+
};
|
|
159
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
|
+
*/
|
|
8
|
+
export interface PostcssConfiguration {
|
|
9
|
+
plugins: [name: string, options?: object | string][];
|
|
10
|
+
}
|
|
11
|
+
export interface SearchDirectory {
|
|
12
|
+
root: string;
|
|
13
|
+
files: Set<string>;
|
|
14
|
+
}
|
|
15
|
+
export declare function generateSearchDirectories(roots: string[]): Promise<SearchDirectory[]>;
|
|
16
|
+
export declare function findTailwindConfiguration(searchDirectories: SearchDirectory[]): string | undefined;
|
|
17
|
+
export declare function loadPostcssConfiguration(searchDirectories: SearchDirectory[]): Promise<PostcssConfiguration | undefined>;
|
|
18
|
+
//# sourceMappingURL=postcss-configuration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"postcss-configuration.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/postcss-configuration.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC;CACtD;AAoBD,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CACpB;AAED,wBAAsB,yBAAyB,CAC7C,KAAK,EAAE,MAAM,EAAE,GACd,OAAO,CAAC,eAAe,EAAE,CAAC,CAW5B;AAiBD,wBAAgB,yBAAyB,CACvC,iBAAiB,EAAE,eAAe,EAAE,GACnC,MAAM,GAAG,SAAS,CAEpB;AAWD,wBAAsB,wBAAwB,CAC5C,iBAAiB,EAAE,eAAe,EAAE,GACnC,OAAO,CAAC,oBAAoB,GAAG,SAAS,CAAC,CAoD3C"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5
|
+
*
|
|
6
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.generateSearchDirectories = generateSearchDirectories;
|
|
11
|
+
exports.findTailwindConfiguration = findTailwindConfiguration;
|
|
12
|
+
exports.loadPostcssConfiguration = loadPostcssConfiguration;
|
|
13
|
+
const promises_1 = require("node:fs/promises");
|
|
14
|
+
const node_path_1 = require("node:path");
|
|
15
|
+
const postcssConfigurationFiles = [
|
|
16
|
+
'postcss.config.json',
|
|
17
|
+
'.postcssrc.json',
|
|
18
|
+
'postcss.config.js',
|
|
19
|
+
];
|
|
20
|
+
const tailwindConfigFiles = [
|
|
21
|
+
'tailwind.config.js',
|
|
22
|
+
'tailwind.config.cjs',
|
|
23
|
+
'tailwind.config.mjs',
|
|
24
|
+
'tailwind.config.ts',
|
|
25
|
+
];
|
|
26
|
+
async function generateSearchDirectories(roots) {
|
|
27
|
+
return await Promise.all(roots.map((root) => (0, promises_1.readdir)(root, { withFileTypes: true }).then((entries) => ({
|
|
28
|
+
root,
|
|
29
|
+
files: new Set(entries.filter((entry) => entry.isFile()).map((entry) => entry.name)),
|
|
30
|
+
}))));
|
|
31
|
+
}
|
|
32
|
+
function findFile(searchDirectories, potentialFiles) {
|
|
33
|
+
for (const { root, files } of searchDirectories) {
|
|
34
|
+
for (const potential of potentialFiles) {
|
|
35
|
+
if (files.has(potential)) {
|
|
36
|
+
return (0, node_path_1.join)(root, potential);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return undefined;
|
|
41
|
+
}
|
|
42
|
+
function findTailwindConfiguration(searchDirectories) {
|
|
43
|
+
return findFile(searchDirectories, tailwindConfigFiles);
|
|
44
|
+
}
|
|
45
|
+
async function readPostcssConfiguration(configurationFile) {
|
|
46
|
+
const data = await (0, promises_1.readFile)(configurationFile, 'utf-8');
|
|
47
|
+
const config = JSON.parse(data);
|
|
48
|
+
return config;
|
|
49
|
+
}
|
|
50
|
+
async function loadPostcssConfiguration(searchDirectories) {
|
|
51
|
+
const configPath = findFile(searchDirectories, postcssConfigurationFiles);
|
|
52
|
+
if (!configPath) {
|
|
53
|
+
return undefined;
|
|
54
|
+
}
|
|
55
|
+
const raw = configPath.endsWith('.js')
|
|
56
|
+
? require(configPath)
|
|
57
|
+
: await readPostcssConfiguration(configPath);
|
|
58
|
+
// If no plugins are defined, consider it equivalent to no configuration
|
|
59
|
+
if (!raw.plugins || typeof raw.plugins !== 'object') {
|
|
60
|
+
return undefined;
|
|
61
|
+
}
|
|
62
|
+
// Normalize plugin array form
|
|
63
|
+
if (Array.isArray(raw.plugins)) {
|
|
64
|
+
if (raw.plugins.length < 1) {
|
|
65
|
+
return undefined;
|
|
66
|
+
}
|
|
67
|
+
const config = { plugins: [] };
|
|
68
|
+
for (const element of raw.plugins) {
|
|
69
|
+
if (typeof element === 'string') {
|
|
70
|
+
config.plugins.push([element]);
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
config.plugins.push(element);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return config;
|
|
77
|
+
}
|
|
78
|
+
// Normalize plugin object map form
|
|
79
|
+
const entries = Object.entries(raw.plugins);
|
|
80
|
+
if (entries.length < 1) {
|
|
81
|
+
return undefined;
|
|
82
|
+
}
|
|
83
|
+
const config = { plugins: [] };
|
|
84
|
+
for (const [name, options] of entries) {
|
|
85
|
+
if (!options ||
|
|
86
|
+
(typeof options !== 'object' && typeof options !== 'string')) {
|
|
87
|
+
continue;
|
|
88
|
+
}
|
|
89
|
+
config.plugins.push([name, options]);
|
|
90
|
+
}
|
|
91
|
+
return config;
|
|
92
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Compilation, RspackError } from '@rspack/core';
|
|
2
|
+
export declare function addError(compilation: Compilation, messageOrError: RspackError | string): void;
|
|
3
|
+
export declare function addWarning(compilation: Compilation, messageOrError: RspackError | string): void;
|
|
4
|
+
//# sourceMappingURL=rspack-diagnostics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rspack-diagnostics.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/rspack-diagnostics.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE7D,wBAAgB,QAAQ,CACtB,WAAW,EAAE,WAAW,EACxB,cAAc,EAAE,WAAW,GAAG,MAAM,GACnC,IAAI,CAUN;AAED,wBAAgB,UAAU,CACxB,WAAW,EAAE,WAAW,EACxB,cAAc,EAAE,WAAW,GAAG,MAAM,GACnC,IAAI,CAUN"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addError = addError;
|
|
4
|
+
exports.addWarning = addWarning;
|
|
5
|
+
function addError(compilation, messageOrError) {
|
|
6
|
+
const error = new compilation.compiler.rspack.WebpackError(typeof messageOrError === 'string' ? messageOrError : messageOrError.message);
|
|
7
|
+
if (typeof messageOrError !== 'string') {
|
|
8
|
+
if (messageOrError.hideStack) {
|
|
9
|
+
error.hideStack = true;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
compilation.errors.push(error);
|
|
13
|
+
}
|
|
14
|
+
function addWarning(compilation, messageOrError) {
|
|
15
|
+
const warning = new compilation.compiler.rspack.WebpackError(typeof messageOrError === 'string' ? messageOrError : messageOrError.message);
|
|
16
|
+
if (typeof messageOrError !== 'string') {
|
|
17
|
+
if (messageOrError.hideStack) {
|
|
18
|
+
warning.hideStack = true;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
compilation.warnings.push(warning);
|
|
22
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
|
+
*/
|
|
8
|
+
export declare class Spinner {
|
|
9
|
+
#private;
|
|
10
|
+
private readonly spinner;
|
|
11
|
+
/** When false, only fail messages will be displayed. */
|
|
12
|
+
enabled: boolean;
|
|
13
|
+
constructor(text?: string);
|
|
14
|
+
set text(text: string);
|
|
15
|
+
get isSpinning(): boolean;
|
|
16
|
+
succeed(text?: string): void;
|
|
17
|
+
fail(text?: string): void;
|
|
18
|
+
stop(): void;
|
|
19
|
+
start(text?: string): void;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=spinner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spinner.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/spinner.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH,qBAAa,OAAO;;IAClB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAU;IAElC,wDAAwD;IACxD,OAAO,UAAQ;gBAGH,IAAI,CAAC,EAAE,MAAM;IAWzB,IAAI,IAAI,CAAC,IAAI,EAAE,MAAM,EAEpB;IAED,IAAI,UAAU,IAAI,OAAO,CAExB;IAED,OAAO,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI;IAM5B,IAAI,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI;IAIzB,IAAI,IAAI,IAAI;IAIZ,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI;CAK3B"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5
|
+
*
|
|
6
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
8
|
+
*/
|
|
9
|
+
var _Spinner_isTTY;
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
exports.Spinner = void 0;
|
|
12
|
+
const tslib_1 = require("tslib");
|
|
13
|
+
const ora_1 = tslib_1.__importDefault(require("ora"));
|
|
14
|
+
const color_1 = require("./color");
|
|
15
|
+
const tty_1 = require("./tty");
|
|
16
|
+
class Spinner {
|
|
17
|
+
constructor(text) {
|
|
18
|
+
/** When false, only fail messages will be displayed. */
|
|
19
|
+
this.enabled = true;
|
|
20
|
+
_Spinner_isTTY.set(this, (0, tty_1.isTTY)());
|
|
21
|
+
this.spinner = (0, ora_1.default)({
|
|
22
|
+
text: text === undefined ? undefined : text + '\n',
|
|
23
|
+
// The below 2 options are needed because otherwise CTRL+C will be delayed
|
|
24
|
+
// when the underlying process is sync.
|
|
25
|
+
hideCursor: false,
|
|
26
|
+
discardStdin: false,
|
|
27
|
+
isEnabled: tslib_1.__classPrivateFieldGet(this, _Spinner_isTTY, "f"),
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
set text(text) {
|
|
31
|
+
this.spinner.text = text;
|
|
32
|
+
}
|
|
33
|
+
get isSpinning() {
|
|
34
|
+
return this.spinner.isSpinning || !tslib_1.__classPrivateFieldGet(this, _Spinner_isTTY, "f");
|
|
35
|
+
}
|
|
36
|
+
succeed(text) {
|
|
37
|
+
if (this.enabled) {
|
|
38
|
+
this.spinner.succeed(text);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
fail(text) {
|
|
42
|
+
this.spinner.fail(text && color_1.colors.redBright(text));
|
|
43
|
+
}
|
|
44
|
+
stop() {
|
|
45
|
+
this.spinner.stop();
|
|
46
|
+
}
|
|
47
|
+
start(text) {
|
|
48
|
+
if (this.enabled) {
|
|
49
|
+
this.spinner.start(text);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
exports.Spinner = Spinner;
|
|
54
|
+
_Spinner_isTTY = new WeakMap();
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
|
+
*/
|
|
8
|
+
import { BudgetCalculatorResult } from '@angular/build/private';
|
|
9
|
+
import { Configuration, StatsCompilation, Stats, StatsOptions } from '@rspack/core';
|
|
10
|
+
import { NormalizedAngularRspackPluginOptions, NormalizedEntryPoint, ScriptOrStyleEntry } from '../models/angular-rspack-plugin-options';
|
|
11
|
+
export interface RspackLoggingCallback {
|
|
12
|
+
(stats: Stats, config: Configuration): void;
|
|
13
|
+
}
|
|
14
|
+
export type RspackStatsOptions = Exclude<Configuration['stats'], string | boolean | undefined>;
|
|
15
|
+
export declare function normalizeExtraEntryPoints(extraEntryPoints: ScriptOrStyleEntry[], defaultBundleName: string): NormalizedEntryPoint[];
|
|
16
|
+
export declare function statsWarningsToString(json: StatsCompilation, statsConfig: RspackStatsOptions): string;
|
|
17
|
+
export declare function statsErrorsToString(json: StatsCompilation, statsConfig: RspackStatsOptions): string;
|
|
18
|
+
export declare function statsHasErrors(json: StatsCompilation): boolean;
|
|
19
|
+
export declare function statsHasWarnings(json: StatsCompilation): boolean;
|
|
20
|
+
export declare function createRspackLoggingCallback(options: NormalizedAngularRspackPluginOptions): (stats: any, config: any) => void;
|
|
21
|
+
export interface BuildEventStats {
|
|
22
|
+
aot: boolean;
|
|
23
|
+
optimization: boolean;
|
|
24
|
+
allChunksCount: number;
|
|
25
|
+
lazyChunksCount: number;
|
|
26
|
+
initialChunksCount: number;
|
|
27
|
+
changedChunksCount?: number;
|
|
28
|
+
durationInMs: number;
|
|
29
|
+
cssSizeInBytes: number;
|
|
30
|
+
jsSizeInBytes: number;
|
|
31
|
+
ngComponentCount: number;
|
|
32
|
+
}
|
|
33
|
+
export declare function generateBuildEventStats(rspackStats: StatsCompilation, options: NormalizedAngularRspackPluginOptions): BuildEventStats;
|
|
34
|
+
export declare function rspackStatsLogger(stats: Stats, statOptions: StatsOptions, budgetFailures?: BudgetCalculatorResult[]): void;
|
|
35
|
+
//# sourceMappingURL=stats.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stats.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/stats.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,sBAAsB,EAGvB,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,KAAK,EACL,YAAY,EACb,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,oCAAoC,EACpC,oBAAoB,EACpB,kBAAkB,EACnB,MAAM,yCAAyC,CAAC;AAMjD,MAAM,WAAW,qBAAqB;IACpC,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,aAAa,GAAG,IAAI,CAAC;CAC7C;AAED,MAAM,MAAM,kBAAkB,GAAG,OAAO,CACtC,aAAa,CAAC,OAAO,CAAC,EACtB,MAAM,GAAG,OAAO,GAAG,SAAS,CAC7B,CAAC;AAEF,wBAAgB,yBAAyB,CACvC,gBAAgB,EAAE,kBAAkB,EAAE,EACtC,iBAAiB,EAAE,MAAM,GACxB,oBAAoB,EAAE,CAmBxB;AAgID,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,gBAAgB,EACtB,WAAW,EAAE,kBAAkB,GAC9B,MAAM,CAsDR;AAED,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,gBAAgB,EACtB,WAAW,EAAE,kBAAkB,GAC9B,MAAM,CA4DR;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAI9D;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAIhE;AAED,wBAAgB,2BAA2B,CACzC,OAAO,EAAE,oCAAoC,IAQrC,UAAK,EAAE,WAAM,UActB;AAED,MAAM,WAAW,eAAe;IAC9B,GAAG,EAAE,OAAO,CAAC;IACb,YAAY,EAAE,OAAO,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB,eAAe,EAAE,MAAM,CAAC;IACxB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAED,wBAAgB,uBAAuB,CACrC,WAAW,EAAE,gBAAgB,EAC7B,OAAO,EAAE,oCAAoC,GAC5C,eAAe,CAoDjB;AAED,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,KAAK,EACZ,WAAW,EAAE,YAAY,EACzB,cAAc,CAAC,EAAE,sBAAsB,EAAE,GACxC,IAAI,CAgBN"}
|