@nx/angular-rspack-compiler 0.0.0-pr-32490-e4fdfa9 → 0.0.0-pr-32868-a65a4a2

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/README.md CHANGED
@@ -22,7 +22,7 @@
22
22
 
23
23
  # Nx: Smart Repos · Fast Builds
24
24
 
25
- An AI-first build platform that connects everything from your editor to CI. Helping you deliver fast, without breaking things.
25
+ Get to green PRs in half the time. Nx optimizes your builds, scales your CI, and fixes failed PRs. Built for developers and AI agents.
26
26
 
27
27
  # @nx/angular-rspack-compiler
28
28
 
package/README.md__tpl__ CHANGED
@@ -11,7 +11,7 @@
11
11
 
12
12
  # Nx: Smart Repos · Fast Builds
13
13
 
14
- An AI-first build platform that connects everything from your editor to CI. Helping you deliver fast, without breaking things.
14
+ Get to green PRs in half the time. Nx optimizes your builds, scales your CI, and fixes failed PRs. Built for developers and AI agents.
15
15
 
16
16
  # @nx/angular-rspack-compiler
17
17
 
@@ -1,7 +1,14 @@
1
1
  import { RsbuildConfig } from '@rsbuild/core';
2
2
  import * as ts from 'typescript';
3
3
  import { InlineStyleLanguage, FileReplacement, type Sass } from '../models';
4
- import { ComponentStylesheetBundler } from '@angular/build/src/tools/esbuild/angular/component-stylesheets';
4
+ import { ComponentStylesheetBundler } from '@angular/build/private';
5
+ export interface StylesheetTransformResult {
6
+ contents: string;
7
+ outputFiles?: Array<{
8
+ path: string;
9
+ text: string;
10
+ }>;
11
+ }
5
12
  export interface SetupCompilationOptions {
6
13
  root: string;
7
14
  tsConfig: string;
@@ -19,5 +26,5 @@ export declare function setupCompilation(config: Pick<RsbuildConfig, 'mode' | 's
19
26
  compilerOptions: import("@angular/compiler-cli").AngularCompilerOptions;
20
27
  componentStylesheetBundler: ComponentStylesheetBundler;
21
28
  }>;
22
- export declare function styleTransform(componentStylesheetBundler: ComponentStylesheetBundler): (styles: string, containingFile: string, stylesheetFile?: string) => Promise<string>;
29
+ export declare function styleTransform(componentStylesheetBundler: ComponentStylesheetBundler): (styles: string, containingFile: string, stylesheetFile?: string) => Promise<StylesheetTransformResult>;
23
30
  //# sourceMappingURL=setup-compilation.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"setup-compilation.d.ts","sourceRoot":"","sources":["../../src/compilation/setup-compilation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AACjC,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,KAAK,IAAI,EAAE,MAAM,WAAW,CAAC;AAE5E,OAAO,EACL,0BAA0B,EAE3B,MAAM,gEAAgE,CAAC;AAIxE,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,OAAO,CAAC;IACb,mBAAmB,EAAE,mBAAmB,CAAC;IACzC,gBAAgB,EAAE,KAAK,CAAC,eAAe,CAAC,CAAC;IACzC,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,IAAI,CAAC,EAAE,IAAI,CAAC;CACb;AAED,eAAO,MAAM,2BAA2B,EAAE,EAAE,CAAC,eAc5C,CAAC;AAEF,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,IAAI,CAAC,aAAa,EAAE,MAAM,GAAG,QAAQ,CAAC,EAC9C,OAAO,EAAE,uBAAuB;;;;GAiDjC;AAED,wBAAgB,cAAc,CAC5B,0BAA0B,EAAE,0BAA0B,IAGpD,QAAQ,MAAM,EACd,gBAAgB,MAAM,EACtB,iBAAiB,MAAM,qBAgC1B"}
1
+ {"version":3,"file":"setup-compilation.d.ts","sourceRoot":"","sources":["../../src/compilation/setup-compilation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AACjC,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,KAAK,IAAI,EAAE,MAAM,WAAW,CAAC;AAE5E,OAAO,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AAIpE,MAAM,WAAW,yBAAyB;IACxC,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACrD;AAED,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,OAAO,CAAC;IACb,mBAAmB,EAAE,mBAAmB,CAAC;IACzC,gBAAgB,EAAE,KAAK,CAAC,eAAe,CAAC,CAAC;IACzC,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,IAAI,CAAC,EAAE,IAAI,CAAC;CACb;AAED,eAAO,MAAM,2BAA2B,EAAE,EAAE,CAAC,eAc5C,CAAC;AAEF,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,IAAI,CAAC,aAAa,EAAE,MAAM,GAAG,QAAQ,CAAC,EAC9C,OAAO,EAAE,uBAAuB;;;;GAiDjC;AAED,wBAAgB,cAAc,CAC5B,0BAA0B,EAAE,0BAA0B,IAGpD,QAAQ,MAAM,EACd,gBAAgB,MAAM,EACtB,iBAAiB,MAAM,KACtB,OAAO,CAAC,yBAAyB,CAAC,CAoCtC"}
@@ -4,9 +4,9 @@ exports.DEFAULT_NG_COMPILER_OPTIONS = void 0;
4
4
  exports.setupCompilation = setupCompilation;
5
5
  exports.styleTransform = styleTransform;
6
6
  const utils_1 = require("../utils");
7
- const component_stylesheets_1 = require("@angular/build/src/tools/esbuild/angular/component-stylesheets");
8
- const targets_from_browsers_1 = require("../utils/targets-from-browsers");
9
7
  const private_1 = require("@angular/build/private");
8
+ const targets_from_browsers_1 = require("../utils/targets-from-browsers");
9
+ const private_2 = require("@angular/build/private");
10
10
  exports.DEFAULT_NG_COMPILER_OPTIONS = {
11
11
  suppressOutputPathCheck: true,
12
12
  outDir: undefined,
@@ -35,7 +35,7 @@ async function setupCompilation(config, options) {
35
35
  : {}),
36
36
  });
37
37
  const compilerOptions = tsCompilerOptions;
38
- const componentStylesheetBundler = new component_stylesheets_1.ComponentStylesheetBundler({
38
+ const componentStylesheetBundler = new private_1.ComponentStylesheetBundler({
39
39
  workspaceRoot: options.root,
40
40
  optimization: config.mode === 'production',
41
41
  cacheOptions: { path: '', basePath: '', enabled: false },
@@ -45,7 +45,7 @@ async function setupCompilation(config, options) {
45
45
  media: `media/${config.mode === 'production' ? '[name]-[hash]' : '[name]'}`,
46
46
  },
47
47
  sourcemap: false,
48
- target: (0, targets_from_browsers_1.transformSupportedBrowsersToTargets)((0, private_1.getSupportedBrowsers)(options.root, {
48
+ target: (0, targets_from_browsers_1.transformSupportedBrowsersToTargets)((0, private_2.getSupportedBrowsers)(options.root, {
49
49
  warn: (message) => console.warn(message),
50
50
  })),
51
51
  includePaths: options.includePaths,
@@ -72,11 +72,15 @@ function styleTransform(componentStylesheetBundler) {
72
72
  console.error('Failed to compile styles. Continuing execution ignoring failing stylesheet...', error.text);
73
73
  }
74
74
  }
75
- return stylesheetResult.contents;
75
+ // Return both contents and outputFiles
76
+ return {
77
+ contents: stylesheetResult.contents,
78
+ outputFiles: stylesheetResult.outputFiles,
79
+ };
76
80
  }
77
81
  catch (e) {
78
82
  console.error('Failed to compile styles. Continuing execution ignoring failing stylesheet...', e);
79
- return '';
83
+ return { contents: '', outputFiles: undefined };
80
84
  }
81
85
  };
82
86
  }
@@ -1,5 +1,11 @@
1
1
  import type { RsbuildConfig } from '@rsbuild/core';
2
2
  import { AngularCompilation, SourceFileCache } from '../models';
3
3
  import { SetupCompilationOptions } from './setup-compilation';
4
- export declare function setupCompilationWithAngularCompilation(config: Pick<RsbuildConfig, 'source'>, options: SetupCompilationOptions, sourceFileCache?: SourceFileCache, angularCompilation?: AngularCompilation, modifiedFiles?: Set<string>): Promise<AngularCompilation>;
4
+ export declare function setupCompilationWithAngularCompilation(config: Pick<RsbuildConfig, 'source'>, options: SetupCompilationOptions, sourceFileCache?: SourceFileCache, angularCompilation?: AngularCompilation, modifiedFiles?: Set<string>): Promise<{
5
+ angularCompilation: AngularCompilation;
6
+ collectedStylesheetAssets: {
7
+ path: string;
8
+ text: string;
9
+ }[];
10
+ }>;
5
11
  //# sourceMappingURL=setup-with-angular-compilation.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"setup-with-angular-compilation.d.ts","sourceRoot":"","sources":["../../src/compilation/setup-with-angular-compilation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAGL,kBAAkB,EAClB,eAAe,EAChB,MAAM,WAAW,CAAC;AACnB,OAAO,EAGL,uBAAuB,EACxB,MAAM,qBAAqB,CAAC;AAE7B,wBAAsB,sCAAsC,CAC1D,MAAM,EAAE,IAAI,CAAC,aAAa,EAAE,QAAQ,CAAC,EACrC,OAAO,EAAE,uBAAuB,EAChC,eAAe,CAAC,EAAE,eAAe,EACjC,kBAAkB,CAAC,EAAE,kBAAkB,EACvC,aAAa,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,+BAoC5B"}
1
+ {"version":3,"file":"setup-with-angular-compilation.d.ts","sourceRoot":"","sources":["../../src/compilation/setup-with-angular-compilation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAEL,kBAAkB,EAClB,eAAe,EAChB,MAAM,WAAW,CAAC;AACnB,OAAO,EAGL,uBAAuB,EAExB,MAAM,qBAAqB,CAAC;AAE7B,wBAAsB,sCAAsC,CAC1D,MAAM,EAAE,IAAI,CAAC,aAAa,EAAE,QAAQ,CAAC,EACrC,OAAO,EAAE,uBAAuB,EAChC,eAAe,CAAC,EAAE,eAAe,EACjC,kBAAkB,CAAC,EAAE,kBAAkB,EACvC,aAAa,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC;;;cAkBoB,MAAM;cAAQ,MAAM;;GA4CpE"}
@@ -5,20 +5,31 @@ const models_1 = require("../models");
5
5
  const setup_compilation_1 = require("./setup-compilation");
6
6
  async function setupCompilationWithAngularCompilation(config, options, sourceFileCache, angularCompilation, modifiedFiles) {
7
7
  const { rootNames, compilerOptions, componentStylesheetBundler } = await (0, setup_compilation_1.setupCompilation)(config, options);
8
- angularCompilation ?? (angularCompilation = options.aot
9
- ? new models_1.AotCompilation(options.hasServer === false)
10
- : new models_1.JitCompilation(options.hasServer === false));
8
+ angularCompilation ?? (angularCompilation = await (0, models_1.createAngularCompilation)(!options.aot, options.hasServer, false));
11
9
  modifiedFiles ?? (modifiedFiles = new Set(rootNames));
12
10
  const fileReplacements = options.fileReplacements.reduce((r, f) => {
13
11
  r[f.replace] = f.with;
14
12
  return r;
15
13
  }, {});
14
+ // Store collected stylesheet output files
15
+ const collectedStylesheetAssets = [];
16
+ // Create a wrapper around styleTransform to collect outputFiles
17
+ const transformFn = (0, setup_compilation_1.styleTransform)(componentStylesheetBundler);
18
+ const wrappedTransformStylesheet = async (styles, containingFile, stylesheetFile) => {
19
+ const result = await transformFn(styles, containingFile, stylesheetFile);
20
+ // Collect outputFiles if present
21
+ if (result.outputFiles && result.outputFiles.length > 0) {
22
+ collectedStylesheetAssets.push(...result.outputFiles);
23
+ }
24
+ // Return just the contents string as expected by Angular compilation
25
+ return result.contents;
26
+ };
16
27
  try {
17
28
  const { referencedFiles } = await angularCompilation.initialize(config.source?.tsconfigPath ?? options.tsConfig, {
18
29
  sourceFileCache,
19
30
  fileReplacements,
20
31
  modifiedFiles,
21
- transformStylesheet: (0, setup_compilation_1.styleTransform)(componentStylesheetBundler),
32
+ transformStylesheet: wrappedTransformStylesheet,
22
33
  processWebWorker(workerFile) {
23
34
  return workerFile;
24
35
  },
@@ -30,5 +41,8 @@ async function setupCompilationWithAngularCompilation(config, options, sourceFil
30
41
  catch (e) {
31
42
  console.error('Failed to initialize Angular Compilation', e);
32
43
  }
33
- return angularCompilation;
44
+ return {
45
+ angularCompilation,
46
+ collectedStylesheetAssets,
47
+ };
34
48
  }
@@ -1,10 +1,5 @@
1
- import { JavaScriptTransformer } from '@angular/build/private';
2
- import { ParallelCompilation } from '@angular/build/src/tools/angular/compilation/parallel-compilation';
3
- import { AotCompilation } from '@angular/build/src/tools/angular/compilation/aot-compilation';
4
- import { JitCompilation } from '@angular/build/src/tools/angular/compilation/jit-compilation';
5
- import { AngularCompilation } from '@angular/build/src/tools/angular/compilation/angular-compilation';
6
- import { SourceFileCache } from '@angular/build/private';
7
- export { ParallelCompilation, JavaScriptTransformer, SourceFileCache, AotCompilation, JitCompilation, AngularCompilation, };
1
+ import { JavaScriptTransformer, SourceFileCache, AngularCompilation, createAngularCompilation } from '@angular/build/private';
2
+ export { JavaScriptTransformer, SourceFileCache, AngularCompilation, createAngularCompilation, };
8
3
  export * from './inline-style-language';
9
4
  export * from './file-replacement';
10
5
  export * from './style-preprocessor-options';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/models/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,mEAAmE,CAAC;AACxG,OAAO,EAAE,cAAc,EAAE,MAAM,8DAA8D,CAAC;AAC9F,OAAO,EAAE,cAAc,EAAE,MAAM,8DAA8D,CAAC;AAC9F,OAAO,EAAE,kBAAkB,EAAE,MAAM,kEAAkE,CAAC;AACtG,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,OAAO,EACL,mBAAmB,EACnB,qBAAqB,EACrB,eAAe,EACf,cAAc,EACd,cAAc,EACd,kBAAkB,GACnB,CAAC;AAEF,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC;AACnC,cAAc,8BAA8B,CAAC;AAE7C,oBAAY,eAAe;IACzB,IAAI,IAAI;IACR,MAAM,IAAS;IACf,SAAS,IAAS;IAClB,QAAQ,IAAS;IACjB,GAAG,IAAgC;CACpC;AAED,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC;CACrC;AAED,MAAM,WAAW,cAAc;IAC7B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC;IACpC,KAAK,CAAC,EAAE,WAAW,EAAE,CAAC;IACtB,MAAM,CAAC,EAAE,KAAK,CAAC;CAChB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/models/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,eAAe,EACf,kBAAkB,EAClB,wBAAwB,EACzB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EACL,qBAAqB,EACrB,eAAe,EACf,kBAAkB,EAClB,wBAAwB,GACzB,CAAC;AAEF,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC;AACnC,cAAc,8BAA8B,CAAC;AAE7C,oBAAY,eAAe;IACzB,IAAI,IAAI;IACR,MAAM,IAAS;IACf,SAAS,IAAS;IAClB,QAAQ,IAAS;IACjB,GAAG,IAAgC;CACpC;AAED,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC;CACrC;AAED,MAAM,WAAW,cAAc;IAC7B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC;IACpC,KAAK,CAAC,EAAE,WAAW,EAAE,CAAC;IACtB,MAAM,CAAC,EAAE,KAAK,CAAC;CAChB"}
@@ -1,19 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DiagnosticModes = exports.AngularCompilation = exports.JitCompilation = exports.AotCompilation = exports.SourceFileCache = exports.JavaScriptTransformer = exports.ParallelCompilation = void 0;
3
+ exports.DiagnosticModes = exports.createAngularCompilation = exports.SourceFileCache = exports.JavaScriptTransformer = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const private_1 = require("@angular/build/private");
6
6
  Object.defineProperty(exports, "JavaScriptTransformer", { enumerable: true, get: function () { return private_1.JavaScriptTransformer; } });
7
- const parallel_compilation_1 = require("@angular/build/src/tools/angular/compilation/parallel-compilation");
8
- Object.defineProperty(exports, "ParallelCompilation", { enumerable: true, get: function () { return parallel_compilation_1.ParallelCompilation; } });
9
- const aot_compilation_1 = require("@angular/build/src/tools/angular/compilation/aot-compilation");
10
- Object.defineProperty(exports, "AotCompilation", { enumerable: true, get: function () { return aot_compilation_1.AotCompilation; } });
11
- const jit_compilation_1 = require("@angular/build/src/tools/angular/compilation/jit-compilation");
12
- Object.defineProperty(exports, "JitCompilation", { enumerable: true, get: function () { return jit_compilation_1.JitCompilation; } });
13
- const angular_compilation_1 = require("@angular/build/src/tools/angular/compilation/angular-compilation");
14
- Object.defineProperty(exports, "AngularCompilation", { enumerable: true, get: function () { return angular_compilation_1.AngularCompilation; } });
15
- const private_2 = require("@angular/build/private");
16
- Object.defineProperty(exports, "SourceFileCache", { enumerable: true, get: function () { return private_2.SourceFileCache; } });
7
+ Object.defineProperty(exports, "SourceFileCache", { enumerable: true, get: function () { return private_1.SourceFileCache; } });
8
+ Object.defineProperty(exports, "createAngularCompilation", { enumerable: true, get: function () { return private_1.createAngularCompilation; } });
17
9
  tslib_1.__exportStar(require("./inline-style-language"), exports);
18
10
  tslib_1.__exportStar(require("./file-replacement"), exports);
19
11
  tslib_1.__exportStar(require("./style-preprocessor-options"), exports);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@nx/angular-rspack-compiler",
3
3
  "private": false,
4
- "version": "0.0.0-pr-32490-e4fdfa9",
4
+ "version": "0.0.0-pr-32868-a65a4a2",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -34,11 +34,12 @@
34
34
  }
35
35
  },
36
36
  "dependencies": {
37
- "@angular/build": "~20.1.0",
37
+ "@angular/build": ">=19.0.0 <21.0.0",
38
38
  "sass-embedded": "^1.79.3",
39
+ "semver": "^7.6.3",
39
40
  "ts-morph": "^24.0.0",
40
41
  "tslib": "^2.3.0",
41
- "typescript": "5.8.3"
42
+ "typescript": "~5.9.2"
42
43
  },
43
44
  "devDependencies": {
44
45
  "jsonc-eslint-parser": "^2.4.0",
@@ -0,0 +1,83 @@
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
+ /**
9
+ * @fileoverview
10
+ * Private exports intended only for use with the @angular-devkit/build-angular package.
11
+ * All exports are not supported for external use, do not provide SemVer guarantees, and
12
+ * their existence may change in any future version.
13
+ */
14
+ import { createAngularCompilation } from './tools/angular/compilation';
15
+ import { CompilerPluginOptions } from './tools/esbuild/angular/compiler-plugin';
16
+ import { BundleStylesheetOptions } from './tools/esbuild/stylesheets/bundle-options';
17
+
18
+ export { buildApplicationInternal } from './builders/application';
19
+ export type { ApplicationBuilderInternalOptions } from './builders/application/options';
20
+ export {
21
+ type Result,
22
+ type ResultFile,
23
+ ResultKind,
24
+ } from './builders/application/results';
25
+ export { serveWithVite } from './builders/dev-server/vite-server';
26
+ export * from './tools/babel/plugins';
27
+ export type { ExternalResultMetadata } from './tools/esbuild/bundler-execution-result';
28
+ export { emitFilesToDisk } from './tools/esbuild/utils';
29
+ export { transformSupportedBrowsersToTargets } from './tools/esbuild/utils';
30
+ export { SassWorkerImplementation } from './tools/sass/sass-service';
31
+ export { SourceFileCache } from './tools/esbuild/angular/source-file-cache';
32
+ export { createJitResourceTransformer } from './tools/angular/transformers/jit-resource-transformer';
33
+ export { JavaScriptTransformer } from './tools/esbuild/javascript-transformer';
34
+
35
+ export declare function createCompilerPlugin(
36
+ pluginOptions: CompilerPluginOptions & {
37
+ browserOnlyBuild?: boolean;
38
+ noopTypeScriptCompilation?: boolean;
39
+ },
40
+ styleOptions: BundleStylesheetOptions & {
41
+ inlineStyleLanguage: string;
42
+ }
43
+ ): import('esbuild').Plugin;
44
+
45
+ export type { AngularCompilation } from './tools/angular/compilation';
46
+ export { createAngularCompilation };
47
+ export { ComponentStylesheetBundler } from './tools/esbuild/angular/component-stylesheets';
48
+ export * from './utils/bundle-calculator';
49
+ export { checkPort } from './utils/check-port';
50
+ export { deleteOutputDir } from './utils/delete-output-dir';
51
+ export {
52
+ type I18nOptions,
53
+ createI18nOptions,
54
+ loadTranslations,
55
+ } from './utils/i18n-options';
56
+ export {
57
+ IndexHtmlGenerator,
58
+ type IndexHtmlGeneratorOptions,
59
+ type IndexHtmlGeneratorProcessOptions,
60
+ type IndexHtmlTransform,
61
+ } from './utils/index-file/index-html-generator';
62
+ export type { FileInfo } from './utils/index-file/augment-index-html';
63
+ export {
64
+ type InlineCriticalCssProcessOptions,
65
+ InlineCriticalCssProcessor,
66
+ type InlineCriticalCssProcessorOptions,
67
+ } from './utils/index-file/inline-critical-css';
68
+ export { loadProxyConfiguration } from './utils/load-proxy-config';
69
+ export {
70
+ type TranslationLoader,
71
+ createTranslationLoader,
72
+ } from './utils/load-translations';
73
+ export { purgeStaleBuildCache } from './utils/purge-cache';
74
+ export { augmentAppWithServiceWorker } from './utils/service-worker';
75
+ export { type BundleStats, generateBuildStatsTable } from './utils/stats-table';
76
+ export { getSupportedBrowsers } from './utils/supported-browsers';
77
+ export { assertCompatibleAngularVersion } from './utils/version';
78
+ export { findTests, getTestEntrypoints } from './builders/karma/find-tests';
79
+ export {
80
+ findTailwindConfiguration,
81
+ generateSearchDirectories,
82
+ loadPostcssConfiguration,
83
+ } from './utils/postcss-configuration';
@@ -0,0 +1,299 @@
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 __createBinding =
10
+ (this && this.__createBinding) ||
11
+ (Object.create
12
+ ? function (o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ var desc = Object.getOwnPropertyDescriptor(m, k);
15
+ if (
16
+ !desc ||
17
+ ('get' in desc ? !m.__esModule : desc.writable || desc.configurable)
18
+ ) {
19
+ desc = {
20
+ enumerable: true,
21
+ get: function () {
22
+ return m[k];
23
+ },
24
+ };
25
+ }
26
+ Object.defineProperty(o, k2, desc);
27
+ }
28
+ : function (o, m, k, k2) {
29
+ if (k2 === undefined) k2 = k;
30
+ o[k2] = m[k];
31
+ });
32
+ var __exportStar =
33
+ (this && this.__exportStar) ||
34
+ function (m, exports) {
35
+ for (var p in m)
36
+ if (p !== 'default' && !Object.prototype.hasOwnProperty.call(exports, p))
37
+ __createBinding(exports, m, p);
38
+ };
39
+ Object.defineProperty(exports, '__esModule', { value: true });
40
+ exports.loadPostcssConfiguration =
41
+ exports.generateSearchDirectories =
42
+ exports.findTailwindConfiguration =
43
+ exports.getTestEntrypoints =
44
+ exports.findTests =
45
+ exports.assertCompatibleAngularVersion =
46
+ exports.getSupportedBrowsers =
47
+ exports.generateBuildStatsTable =
48
+ exports.augmentAppWithServiceWorker =
49
+ exports.purgeStaleBuildCache =
50
+ exports.createTranslationLoader =
51
+ exports.loadProxyConfiguration =
52
+ exports.InlineCriticalCssProcessor =
53
+ exports.IndexHtmlGenerator =
54
+ exports.loadTranslations =
55
+ exports.createI18nOptions =
56
+ exports.deleteOutputDir =
57
+ exports.checkPort =
58
+ exports.ComponentStylesheetBundler =
59
+ exports.createAngularCompilation =
60
+ exports.JavaScriptTransformer =
61
+ exports.createJitResourceTransformer =
62
+ exports.SourceFileCache =
63
+ exports.SassWorkerImplementation =
64
+ exports.transformSupportedBrowsersToTargets =
65
+ exports.emitFilesToDisk =
66
+ exports.serveWithVite =
67
+ exports.ResultKind =
68
+ exports.buildApplicationInternal =
69
+ void 0;
70
+ exports.createCompilerPlugin = createCompilerPlugin;
71
+ /**
72
+ * @fileoverview
73
+ * Private exports intended only for use with the @angular-devkit/build-angular package.
74
+ * All exports are not supported for external use, do not provide SemVer guarantees, and
75
+ * their existence may change in any future version.
76
+ */
77
+ const compilation_1 = require('./tools/angular/compilation');
78
+ Object.defineProperty(exports, 'createAngularCompilation', {
79
+ enumerable: true,
80
+ get: function () {
81
+ return compilation_1.createAngularCompilation;
82
+ },
83
+ });
84
+ const compiler_plugin_1 = require('./tools/esbuild/angular/compiler-plugin');
85
+ const component_stylesheets_1 = require('./tools/esbuild/angular/component-stylesheets');
86
+ // Builders
87
+ var application_1 = require('./builders/application');
88
+ Object.defineProperty(exports, 'buildApplicationInternal', {
89
+ enumerable: true,
90
+ get: function () {
91
+ return application_1.buildApplicationInternal;
92
+ },
93
+ });
94
+ var results_1 = require('./builders/application/results');
95
+ Object.defineProperty(exports, 'ResultKind', {
96
+ enumerable: true,
97
+ get: function () {
98
+ return results_1.ResultKind;
99
+ },
100
+ });
101
+ var vite_server_1 = require('./builders/dev-server/vite-server');
102
+ Object.defineProperty(exports, 'serveWithVite', {
103
+ enumerable: true,
104
+ get: function () {
105
+ return vite_server_1.serveWithVite;
106
+ },
107
+ });
108
+ // Tools
109
+ __exportStar(require('./tools/babel/plugins'), exports);
110
+ var utils_1 = require('./tools/esbuild/utils');
111
+ Object.defineProperty(exports, 'emitFilesToDisk', {
112
+ enumerable: true,
113
+ get: function () {
114
+ return utils_1.emitFilesToDisk;
115
+ },
116
+ });
117
+ var utils_2 = require('./tools/esbuild/utils');
118
+ Object.defineProperty(exports, 'transformSupportedBrowsersToTargets', {
119
+ enumerable: true,
120
+ get: function () {
121
+ return utils_2.transformSupportedBrowsersToTargets;
122
+ },
123
+ });
124
+ var sass_service_1 = require('./tools/sass/sass-service');
125
+ Object.defineProperty(exports, 'SassWorkerImplementation', {
126
+ enumerable: true,
127
+ get: function () {
128
+ return sass_service_1.SassWorkerImplementation;
129
+ },
130
+ });
131
+ var source_file_cache_1 = require('./tools/esbuild/angular/source-file-cache');
132
+ Object.defineProperty(exports, 'SourceFileCache', {
133
+ enumerable: true,
134
+ get: function () {
135
+ return source_file_cache_1.SourceFileCache;
136
+ },
137
+ });
138
+ var jit_resource_transformer_1 = require('./tools/angular/transformers/jit-resource-transformer');
139
+ Object.defineProperty(exports, 'createJitResourceTransformer', {
140
+ enumerable: true,
141
+ get: function () {
142
+ return jit_resource_transformer_1.createJitResourceTransformer;
143
+ },
144
+ });
145
+ var javascript_transformer_1 = require('./tools/esbuild/javascript-transformer');
146
+ Object.defineProperty(exports, 'JavaScriptTransformer', {
147
+ enumerable: true,
148
+ get: function () {
149
+ return javascript_transformer_1.JavaScriptTransformer;
150
+ },
151
+ });
152
+ function createCompilerPlugin(pluginOptions, styleOptions) {
153
+ return (0, compiler_plugin_1.createCompilerPlugin)(
154
+ pluginOptions,
155
+ pluginOptions.noopTypeScriptCompilation
156
+ ? new compilation_1.NoopCompilation()
157
+ : () =>
158
+ (0, compilation_1.createAngularCompilation)(
159
+ !!pluginOptions.jit,
160
+ !!pluginOptions.browserOnlyBuild
161
+ ),
162
+ new component_stylesheets_1.ComponentStylesheetBundler(
163
+ styleOptions,
164
+ styleOptions.inlineStyleLanguage,
165
+ pluginOptions.incremental
166
+ )
167
+ );
168
+ }
169
+ var component_stylesheets_2 = require('./tools/esbuild/angular/component-stylesheets');
170
+ Object.defineProperty(exports, 'ComponentStylesheetBundler', {
171
+ enumerable: true,
172
+ get: function () {
173
+ return component_stylesheets_2.ComponentStylesheetBundler;
174
+ },
175
+ });
176
+ // Utilities
177
+ __exportStar(require('./utils/bundle-calculator'), exports);
178
+ var check_port_1 = require('./utils/check-port');
179
+ Object.defineProperty(exports, 'checkPort', {
180
+ enumerable: true,
181
+ get: function () {
182
+ return check_port_1.checkPort;
183
+ },
184
+ });
185
+ var delete_output_dir_1 = require('./utils/delete-output-dir');
186
+ Object.defineProperty(exports, 'deleteOutputDir', {
187
+ enumerable: true,
188
+ get: function () {
189
+ return delete_output_dir_1.deleteOutputDir;
190
+ },
191
+ });
192
+ var i18n_options_1 = require('./utils/i18n-options');
193
+ Object.defineProperty(exports, 'createI18nOptions', {
194
+ enumerable: true,
195
+ get: function () {
196
+ return i18n_options_1.createI18nOptions;
197
+ },
198
+ });
199
+ Object.defineProperty(exports, 'loadTranslations', {
200
+ enumerable: true,
201
+ get: function () {
202
+ return i18n_options_1.loadTranslations;
203
+ },
204
+ });
205
+ var index_html_generator_1 = require('./utils/index-file/index-html-generator');
206
+ Object.defineProperty(exports, 'IndexHtmlGenerator', {
207
+ enumerable: true,
208
+ get: function () {
209
+ return index_html_generator_1.IndexHtmlGenerator;
210
+ },
211
+ });
212
+ var inline_critical_css_1 = require('./utils/index-file/inline-critical-css');
213
+ Object.defineProperty(exports, 'InlineCriticalCssProcessor', {
214
+ enumerable: true,
215
+ get: function () {
216
+ return inline_critical_css_1.InlineCriticalCssProcessor;
217
+ },
218
+ });
219
+ var load_proxy_config_1 = require('./utils/load-proxy-config');
220
+ Object.defineProperty(exports, 'loadProxyConfiguration', {
221
+ enumerable: true,
222
+ get: function () {
223
+ return load_proxy_config_1.loadProxyConfiguration;
224
+ },
225
+ });
226
+ var load_translations_1 = require('./utils/load-translations');
227
+ Object.defineProperty(exports, 'createTranslationLoader', {
228
+ enumerable: true,
229
+ get: function () {
230
+ return load_translations_1.createTranslationLoader;
231
+ },
232
+ });
233
+ var purge_cache_1 = require('./utils/purge-cache');
234
+ Object.defineProperty(exports, 'purgeStaleBuildCache', {
235
+ enumerable: true,
236
+ get: function () {
237
+ return purge_cache_1.purgeStaleBuildCache;
238
+ },
239
+ });
240
+ var service_worker_1 = require('./utils/service-worker');
241
+ Object.defineProperty(exports, 'augmentAppWithServiceWorker', {
242
+ enumerable: true,
243
+ get: function () {
244
+ return service_worker_1.augmentAppWithServiceWorker;
245
+ },
246
+ });
247
+ var stats_table_1 = require('./utils/stats-table');
248
+ Object.defineProperty(exports, 'generateBuildStatsTable', {
249
+ enumerable: true,
250
+ get: function () {
251
+ return stats_table_1.generateBuildStatsTable;
252
+ },
253
+ });
254
+ var supported_browsers_1 = require('./utils/supported-browsers');
255
+ Object.defineProperty(exports, 'getSupportedBrowsers', {
256
+ enumerable: true,
257
+ get: function () {
258
+ return supported_browsers_1.getSupportedBrowsers;
259
+ },
260
+ });
261
+ var version_1 = require('./utils/version');
262
+ Object.defineProperty(exports, 'assertCompatibleAngularVersion', {
263
+ enumerable: true,
264
+ get: function () {
265
+ return version_1.assertCompatibleAngularVersion;
266
+ },
267
+ });
268
+ var find_tests_1 = require('./builders/karma/find-tests');
269
+ Object.defineProperty(exports, 'findTests', {
270
+ enumerable: true,
271
+ get: function () {
272
+ return find_tests_1.findTests;
273
+ },
274
+ });
275
+ Object.defineProperty(exports, 'getTestEntrypoints', {
276
+ enumerable: true,
277
+ get: function () {
278
+ return find_tests_1.getTestEntrypoints;
279
+ },
280
+ });
281
+ var postcss_configuration_1 = require('./utils/postcss-configuration');
282
+ Object.defineProperty(exports, 'findTailwindConfiguration', {
283
+ enumerable: true,
284
+ get: function () {
285
+ return postcss_configuration_1.findTailwindConfiguration;
286
+ },
287
+ });
288
+ Object.defineProperty(exports, 'generateSearchDirectories', {
289
+ enumerable: true,
290
+ get: function () {
291
+ return postcss_configuration_1.generateSearchDirectories;
292
+ },
293
+ });
294
+ Object.defineProperty(exports, 'loadPostcssConfiguration', {
295
+ enumerable: true,
296
+ get: function () {
297
+ return postcss_configuration_1.loadPostcssConfiguration;
298
+ },
299
+ });
@@ -1,4 +1,6 @@
1
- const { readFileSync, writeFileSync } = require('fs');
1
+ const { readFileSync, renameSync } = require('fs');
2
+ const { gte, coerce } = require('semver');
3
+ const { dirname, join } = require('path');
2
4
 
3
5
  function main() {
4
6
  const angularBuildPackageJson = require.resolve(
@@ -7,23 +9,19 @@ function main() {
7
9
  const fileContentsJson = JSON.parse(
8
10
  readFileSync(angularBuildPackageJson, 'utf8')
9
11
  );
10
- fileContentsJson.exports[
11
- './src/tools/angular/compilation/parallel-compilation'
12
- ] = './src/tools/angular/compilation/parallel-compilation.js';
13
- fileContentsJson.exports[
14
- './src/tools/angular/compilation/angular-compilation'
15
- ] = './src/tools/angular/compilation/angular-compilation.js';
16
- fileContentsJson.exports['./src/tools/angular/compilation/jit-compilation'] =
17
- './src/tools/angular/compilation/jit-compilation.js';
18
- fileContentsJson.exports['./src/tools/angular/compilation/aot-compilation'] =
19
- './src/tools/angular/compilation/aot-compilation.js';
20
- fileContentsJson.exports[
21
- './src/tools/esbuild/angular/component-stylesheets'
22
- ] = './src/tools/esbuild/angular/component-stylesheets.js';
12
+ if (gte(coerce(fileContentsJson.version), '20.2.0')) {
13
+ return;
14
+ }
23
15
 
24
- writeFileSync(
25
- angularBuildPackageJson,
26
- JSON.stringify(fileContentsJson, null, 2)
16
+ const angularBuildDirectory = dirname(angularBuildPackageJson);
17
+ const angularBuildSrcDirectory = join(angularBuildDirectory, 'src');
18
+ renameSync(
19
+ join(__dirname, 'files', 'private.d.ts.txt'),
20
+ join(angularBuildSrcDirectory, 'private.d.ts')
21
+ );
22
+ renameSync(
23
+ join(__dirname, 'files', 'private.js.txt'),
24
+ join(angularBuildSrcDirectory, 'private.js')
27
25
  );
28
26
  }
29
27