Skip to content

Commit

Permalink
refactor(@angular/build): move generic Angular tools into separate so…
Browse files Browse the repository at this point in the history
…urce directory

The Angular compiler code that is not specific to esbuild has been moved
into a separate `tools` subdirectory. This allows for potential reuse internal
reuse outside of the Angular esbuild plugin.
  • Loading branch information
clydin authored and alan-agius4 committed Jun 21, 2024
1 parent 8b6ae4c commit db1a6ae
Show file tree
Hide file tree
Showing 16 changed files with 22 additions and 22 deletions.
2 changes: 1 addition & 1 deletion packages/angular/build/src/private.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export { transformSupportedBrowsersToTargets } from './tools/esbuild/utils';
export { SassWorkerImplementation } from './tools/sass/sass-service';

export { SourceFileCache } from './tools/esbuild/angular/source-file-cache';
export { createJitResourceTransformer } from './tools/esbuild/angular/jit-resource-transformer';
export { createJitResourceTransformer } from './tools/angular/transformers/jit-resource-transformer';
export { JavaScriptTransformer } from './tools/esbuild/javascript-transformer';
export { createCompilerPlugin } from './tools/esbuild/angular/compiler-plugin';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
import type ng from '@angular/compiler-cli';
import type { PartialMessage } from 'esbuild';
import type ts from 'typescript';
import { loadEsmModule } from '../../../../utils/load-esm';
import { profileAsync, profileSync } from '../../profiling';
import { loadEsmModule } from '../../../utils/load-esm';
import { convertTypeScriptDiagnostic } from '../../esbuild/angular/diagnostics';
import { profileAsync, profileSync } from '../../esbuild/profiling';
import type { AngularHostOptions } from '../angular-host';
import { convertTypeScriptDiagnostic } from '../diagnostics';

export interface EmitFileResult {
filename: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
import type ng from '@angular/compiler-cli';
import assert from 'node:assert';
import ts from 'typescript';
import { profileAsync, profileSync } from '../../profiling';
import { profileAsync, profileSync } from '../../esbuild/profiling';
import {
AngularHostOptions,
createAngularCompilerHost,
ensureSourceFileVersions,
} from '../angular-host';
import { createWorkerTransformer } from '../web-worker-transformer';
import { replaceBootstrap } from '../transformers/jit-bootstrap-transformer';
import { createWorkerTransformer } from '../transformers/web-worker-transformer';
import { AngularCompilation, DiagnosticModes, EmitFileResult } from './angular-compilation';
import { replaceBootstrap } from './jit-bootstrap-transformer';

class AngularCompilationState {
constructor(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* found in the LICENSE file at https://angular.dev/license
*/

import { useParallelTs } from '../../../../utils/environment-options';
import { useParallelTs } from '../../../utils/environment-options';
import type { AngularCompilation } from './angular-compilation';

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
import type ng from '@angular/compiler-cli';
import assert from 'node:assert';
import ts from 'typescript';
import { profileSync } from '../../profiling';
import { profileSync } from '../../esbuild/profiling';
import { AngularHostOptions, createAngularCompilerHost } from '../angular-host';
import { createJitResourceTransformer } from '../jit-resource-transformer';
import { createWorkerTransformer } from '../web-worker-transformer';
import { createJitResourceTransformer } from '../transformers/jit-resource-transformer';
import { createWorkerTransformer } from '../transformers/web-worker-transformer';
import { AngularCompilation, DiagnosticModes, EmitFileResult } from './angular-compilation';

class JitCompilationState {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import type { PartialMessage } from 'esbuild';
import assert from 'node:assert';
import { randomUUID } from 'node:crypto';
import { type MessagePort, receiveMessageOnPort } from 'node:worker_threads';
import { SourceFileCache } from '../source-file-cache';
import { SourceFileCache } from '../../esbuild/angular/source-file-cache';
import type { AngularCompilation, DiagnosticModes } from './angular-compilation';
import { AotCompilation } from './aot-compilation';
import { JitCompilation } from './jit-compilation';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

import ts from 'typescript';
import { generateJitFileUri, generateJitInlineUri } from './uri';
import { generateJitFileUri, generateJitInlineUri } from '../uri';

/**
* Creates a TypeScript Transformer to transform Angular Component resource references into
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,17 @@ import type {
import assert from 'node:assert';
import * as path from 'node:path';
import { maxWorkers, useTypeChecking } from '../../../utils/environment-options';
import { JavaScriptTransformer } from '../javascript-transformer';
import { LoadResultCache, createCachedLoad } from '../load-result-cache';
import { logCumulativeDurations, profileAsync, resetCumulativeDurations } from '../profiling';
import { BundleStylesheetOptions } from '../stylesheets/bundle-options';
import { AngularHostOptions } from './angular-host';
import { AngularHostOptions } from '../../angular/angular-host';
import {
AngularCompilation,
DiagnosticModes,
NoopCompilation,
createAngularCompilation,
} from './compilation';
} from '../../angular/compilation';
import { JavaScriptTransformer } from '../javascript-transformer';
import { LoadResultCache, createCachedLoad } from '../load-result-cache';
import { logCumulativeDurations, profileAsync, resetCumulativeDurations } from '../profiling';
import { BundleStylesheetOptions } from '../stylesheets/bundle-options';
import { SharedTSCompilationState, getSharedCompilationState } from './compilation-state';
import { ComponentStylesheetBundler } from './component-stylesheets';
import { FileReferenceTracker } from './file-reference-tracker';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
import type { Metafile, OutputFile, PluginBuild } from 'esbuild';
import { readFile } from 'node:fs/promises';
import { dirname, join, relative } from 'node:path';
import { LoadResultCache, createCachedLoad } from '../load-result-cache';
import { ComponentStylesheetBundler } from './component-stylesheets';
import {
JIT_NAMESPACE_REGEXP,
JIT_STYLE_NAMESPACE,
JIT_TEMPLATE_NAMESPACE,
parseJitUri,
} from './uri';
} from '../../angular/uri';
import { LoadResultCache, createCachedLoad } from '../load-result-cache';
import { ComponentStylesheetBundler } from './component-stylesheets';

/**
* Loads/extracts the contents from a load callback Angular JIT entry.
Expand Down

0 comments on commit db1a6ae

Please sign in to comment.