Files
Alex Rickabaugh 4f9ee3c056 refactor: add g3-only and 3p-only markers to replace specific g3 patches
Replace specific file patches applied during google3 sync with generic comment-based mechanisms.

By adding `// g3-only` prefix comments to g3-specific exports and declarations, and appending `// 3p-only` context to `@internal` tags, we enable generic tooling to handle these modifications during the sync process.

Additionally, wrap 3rd-party-only imports and exports (which should be stripped in google3) with `// 3p-only-start` and `// 3p-only-end` comment markers.

This reduces the need for maintaining custom file-specific patches in google3.

Also, add a comprehensive guide to these sync comment markers in `contributing-docs/google-markers.md` to assist external contributors.

Specifically:
- Add `// 3p-only` context to `@internal` in `directives.ts` for `foreignImports` and `deferredImports`.
- Add `// g3-only` commented exports in `core.ts`.
- Add `// g3-only-start`/`// g3-only-end` commented global declaration block in `zone.ts`.
- Wrap 3p-only imports in `fake_navigation.ts` with `// 3p-only-start` and `// 3p-only-end`.
- Wrap 3p-only exports in `compiler-cli/index.ts` with `// 3p-only-start` and `// 3p-only-end`.
- Add `// g3-only` and `// 3p-only` markers to `shared.ts` for `setDisabledStateDefault` configuration.
- Add `// g3-only` and `// 3p-only` markers to `feature_detection.ts` for semver dependency.
- Add `// g3-only` and `// 3p-only` markers to `domino_adapter.ts` for domino import path.
- Add `// 3p-only` marker to `ng_dev_mode` import in `event_dispatcher.ts`.
- Add `// g3-only` and `// 3p-only` markers to `MOUSE_SPECIAL_SUPPORT` in `event_contract_defines.ts`.
- Add `// g3-only` and `// 3p-only` markers to `BrowserModule` imports in `module.ts` (animations) and `browser.ts` (testing).
- Add `// 3p-only` marker to `goog.d.ts` reference tags in `util.ts` (platform-browser), `types.d.ts`, `ng_i18n_closure_mode.ts`, `tokens.ts`, and `global_utils.ts`.
- Wrap `Default` enum value of `ChangeDetectionStrategy` in `constants.ts` with `// 3p-only-start` and `// 3p-only-end`.
- Add `// g3-only` and `// 3p-only` markers to `LEGACY_OPTIONAL_CHAINING_DEFAULT` in `legacy_optional_chaining_default.ts` and `legacyOptionalChaining` in `directive.ts`.
- Add `// g3-only` and `// 3p-only` markers to `DEFAULT_PARAMS_INHERITANCE_STRATEGY` in `router_state.ts`.
- Add `// g3-only` and `// 3p-only` (and block variants) markers to `@mcp-b/webmcp-types` imports in `declare_tool.ts`, `provide_tools.ts`, and `types.ts`.
- Add `contributing-docs/google-markers.md` guide.

TAG=agy
CONV=cd09a4f3-869a-4f41-949b-c91f1b8f1c51
2026-05-26 16:09:37 -07:00

100 lines
3.3 KiB
TypeScript

/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import {NodeJSFileSystem, setFileSystem} from './src/ngtsc/file_system';
export {VERSION} from './src/version';
export * from './src/ngtsc/transform/jit';
export * from './src/transformers/api';
export * from './src/transformers/entry_points';
export * from './src/perform_compile';
// TODO(tbosch): remove this once usages in G3 are changed to `CompilerOptions`
export {CompilerOptions as AngularCompilerOptions} from './src/transformers/api';
// 3p-only-start
// Internal exports needed for packages relying on the compiler-cli.
// TODO: Remove this when the CLI has switched to the private entry-point.
export * from './private/tooling';
export * from './private/hybrid_analysis';
// Exposed as they are needed for relying on the `linker`.
export * from './src/ngtsc/logging';
export * from './src/ngtsc/file_system';
// 3p-only-end
// Exports for dealing with the `ngtsc` program.
export {NgTscPlugin, PluginCompilerHost} from './src/ngtsc/tsc_plugin';
export {NgtscProgram} from './src/ngtsc/program';
export {OptimizeFor} from './src/ngtsc/typecheck/api';
// Explicit exports for language service
export {getAngularDecorators} from './src/ngtsc/annotations';
export {
NgCompiler,
type NgCompilerOptions,
type CompilationTicket,
freshCompilationTicket,
incrementalFromCompilerTicket,
resourceChangeTicket,
} from './src/ngtsc/core';
export {type NgCompilerAdapter} from './src/ngtsc/core/api';
export {Reference} from './src/ngtsc/imports';
export {
type DirectiveMeta,
type InputMapping,
isExternalResource,
MetaKind,
type PipeMeta,
type Resource,
} from './src/ngtsc/metadata';
export {
type DeclarationNode,
isNamedClassDeclaration,
type ReflectionHost,
type ClassDeclaration,
} from './src/ngtsc/reflection';
export {isFatalDiagnosticError} from './src/ngtsc/diagnostics';
export {PerfPhase} from './src/ngtsc/perf';
export {type FileUpdate, InliningMode, type ProgramDriver} from './src/ngtsc/program_driver';
export {TrackedIncrementalBuildStrategy} from './src/ngtsc/incremental';
export {isShim} from './src/ngtsc/shims';
export {getRootDirs} from './src/ngtsc/util/src/typescript';
export * from './src/ngtsc/typecheck/api';
// **Note**: Explicit named exports to make this file work with CJS/ESM interop without
// needing to use a default import. NodeJS will expose named CJS exports as named ESM exports.
// TODO(devversion): Remove these duplicate exports once devmode&prodmode is combined/ESM.
export {ConsoleLogger, Logger, LogLevel} from './src/ngtsc/logging';
export {
NodeJSFileSystem,
absoluteFrom,
absoluteFromSourceFile,
resolve,
type FileStats,
type PathSegment,
type PathString,
getSourceFileOrError,
type FileSystem,
type AbsoluteFsPath,
NgtscCompilerHost,
getFileSystem,
setFileSystem,
isLocalRelativePath,
} from './src/ngtsc/file_system';
// Export documentation entities for Angular-internal API doc generation.
export * from './src/ngtsc/docs';
// Exposed for usage in 1P Angular plugin.
export {isLocalCompilationDiagnostics, ErrorCode, ngErrorCode} from './src/ngtsc/diagnostics';
setFileSystem(new NodeJSFileSystem());