@analogjs/vite-plugin-angular 3.0.0-alpha.41 → 3.0.0-alpha.43

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.
Files changed (37) hide show
  1. package/package.json +1 -1
  2. package/src/lib/angular-jit-plugin.js +1 -1
  3. package/src/lib/angular-vite-plugin.d.ts +3 -77
  4. package/src/lib/angular-vite-plugin.js +77 -1012
  5. package/src/lib/angular-vite-plugin.js.map +1 -1
  6. package/src/lib/compilation-api/compilation-api-plugin.d.ts +29 -0
  7. package/src/lib/compilation-api/compilation-api-plugin.js +468 -0
  8. package/src/lib/compilation-api/compilation-api-plugin.js.map +1 -0
  9. package/src/lib/compilation-api/index.d.ts +1 -0
  10. package/src/lib/compilation-api/index.js +1 -0
  11. package/src/lib/compiler/compile.js +2 -2
  12. package/src/lib/compiler/defer.js +1 -1
  13. package/src/lib/compiler/js-emitter.js +1 -1
  14. package/src/lib/encapsulation-plugin.d.ts +13 -0
  15. package/src/lib/encapsulation-plugin.js +48 -0
  16. package/src/lib/encapsulation-plugin.js.map +1 -0
  17. package/src/lib/fast-compile-plugin.js +2 -28
  18. package/src/lib/fast-compile-plugin.js.map +1 -1
  19. package/src/lib/host.js +1 -1
  20. package/src/lib/stylesheet-registry.js +1 -1
  21. package/src/lib/tailwind-plugin.d.ts +34 -0
  22. package/src/lib/tailwind-plugin.js +116 -0
  23. package/src/lib/tailwind-plugin.js.map +1 -0
  24. package/src/lib/template-class-binding-guard-plugin.d.ts +30 -0
  25. package/src/lib/template-class-binding-guard-plugin.js +237 -0
  26. package/src/lib/template-class-binding-guard-plugin.js.map +1 -0
  27. package/src/lib/utils/compilation-shared.d.ts +58 -0
  28. package/src/lib/utils/compilation-shared.js +133 -0
  29. package/src/lib/utils/compilation-shared.js.map +1 -0
  30. package/src/lib/utils/tsconfig-resolver.d.ts +28 -0
  31. package/src/lib/utils/tsconfig-resolver.js +191 -0
  32. package/src/lib/utils/tsconfig-resolver.js.map +1 -0
  33. package/src/lib/utils/virtual-resources.js +4 -31
  34. package/src/lib/utils/virtual-resources.js.map +1 -1
  35. package/src/lib/virtual-modules-plugin.d.ts +5 -0
  36. package/src/lib/virtual-modules-plugin.js +50 -0
  37. package/src/lib/virtual-modules-plugin.js.map +1 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@analogjs/vite-plugin-angular",
3
- "version": "3.0.0-alpha.41",
3
+ "version": "3.0.0-alpha.43",
4
4
  "description": "Vite Plugin for Angular",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -1,8 +1,8 @@
1
1
  import { debugStyles } from "./utils/debug.js";
2
2
  import { isTailwindReferenceError } from "./utils/tailwind-reference.js";
3
3
  import { shouldPreprocessTestCss } from "./utils/virtual-resources.js";
4
- import { createHash } from "node:crypto";
5
4
  import { preprocessCSS } from "vite";
5
+ import { createHash } from "node:crypto";
6
6
  //#region packages/vite-plugin-angular/src/lib/angular-jit-plugin.ts
7
7
  function jitPlugin({ inlineStylesExtension }) {
8
8
  let config;
@@ -6,13 +6,9 @@ import { type DebugOption } from "./utils/debug.js";
6
6
  import { FileReplacement } from "./plugins/file-replacements.plugin.js";
7
7
  import { AnalogStylesheetRegistry } from "./stylesheet-registry.js";
8
8
  import { AngularStylePipelineOptions } from "./style-pipeline.js";
9
- export declare enum DiagnosticModes {
10
- None = 0,
11
- Option = 1,
12
- Syntactic = 2,
13
- Semantic = 4,
14
- All = 7
15
- }
9
+ export { DiagnosticModes, injectViteIgnoreForHmrMetadata, isIgnoredHmrFile, toAngularCompilationFileReplacements, mapTemplateUpdatesToFiles, refreshStylesheetRegistryForFile, describeStylesheetContent, isTestWatchMode } from "./utils/compilation-shared.js";
10
+ export { findStaticClassAndBoundClassConflicts, findBoundClassAndNgClassConflicts } from "./template-class-binding-guard-plugin.js";
11
+ export { buildStylePreprocessor } from "./tailwind-plugin.js";
16
12
  export interface PluginOptions {
17
13
  tsconfig?: string | (() => string);
18
14
  workspaceRoot?: string;
@@ -156,59 +152,15 @@ export interface PluginOptions {
156
152
  prefixes?: string[];
157
153
  };
158
154
  }
159
- export declare function normalizeIncludeGlob(workspaceRoot: string, glob: string): string;
160
155
  export declare function evictDeletedFileMetadata(file: string, { removeActiveGraphMetadata, removeStyleOwnerMetadata, classNamesMap, fileTransformMap }: {
161
156
  removeActiveGraphMetadata: (file: string) => void;
162
157
  removeStyleOwnerMetadata: (file: string) => void;
163
158
  classNamesMap: Map<string, string>;
164
159
  fileTransformMap: Map<string, string>;
165
160
  }): void;
166
- export declare function injectViteIgnoreForHmrMetadata(code: string): string;
167
- export declare function isIgnoredHmrFile(file: string): boolean;
168
- /**
169
- * Builds a resolved stylePreprocessor function from plugin options.
170
- *
171
- * When `tailwindCss` is configured, creates an injector that prepends
172
- * `@reference "<rootStylesheet>"` into component CSS that uses Tailwind
173
- * utilities. Uses absolute paths because Angular's externalRuntimeStyles
174
- * serves component CSS as virtual modules (hash-based IDs) with no
175
- * meaningful directory — relative paths can't resolve from a hash.
176
- *
177
- * If both `tailwindCss` and `stylePreprocessor` are provided, they are
178
- * chained: Tailwind reference injection runs first, then the user's
179
- * custom preprocessor.
180
- */
181
- export declare function buildStylePreprocessor(options?: PluginOptions): StylePreprocessor | undefined;
182
161
  export declare function angular(options?: PluginOptions): Plugin[];
183
162
  export declare function createFsWatcherCacheInvalidator(invalidateFsCaches: () => void, invalidateTsconfigCaches: () => void, performCompilation: () => Promise<void>): () => Promise<void>;
184
163
  /**
185
- * Convert Analog/Angular CLI-style file replacements into the flat record
186
- * expected by `AngularHostOptions.fileReplacements`.
187
- *
188
- * Only browser replacements (`{ replace, with }`) are converted. SSR-only
189
- * replacements (`{ replace, ssr }`) are left for the Vite runtime plugin to
190
- * handle — they should not be baked into the Angular compilation host because
191
- * that would apply them to both browser and server builds.
192
- *
193
- * Relative paths are resolved against `workspaceRoot` so that the host
194
- * receives the same absolute paths it would get from the Angular CLI.
195
- */
196
- export declare function toAngularCompilationFileReplacements(replacements: FileReplacement[], workspaceRoot: string): Record<string, string> | undefined;
197
- /**
198
- * Map Angular's `templateUpdates` (keyed by `encodedFilePath@ClassName`)
199
- * back to absolute file paths with their associated HMR code and component
200
- * class name.
201
- *
202
- * Angular's private Compilation API emits template update keys in the form
203
- * `encodeURIComponent(relativePath + '@' + className)`. We decode and resolve
204
- * them so the caller can look up updates by the same normalized absolute path
205
- * used elsewhere in the plugin (`outputFiles`, `classNames`, etc.).
206
- */
207
- export declare function mapTemplateUpdatesToFiles(templateUpdates: ReadonlyMap<string, string> | undefined): Map<string, {
208
- className: string;
209
- code: string;
210
- }>;
211
- /**
212
164
  * Returns every live Vite module that can legitimately represent a changed
213
165
  * Angular resource file.
214
166
  *
@@ -222,27 +174,7 @@ export declare function mapTemplateUpdatesToFiles(templateUpdates: ReadonlyMap<s
222
174
  */
223
175
  export declare function getModulesForChangedFile(server: ViteDevServer, file: string, eventModules?: readonly ModuleNode[], stylesheetRegistry?: AnalogStylesheetRegistry): Promise<ModuleNode[]>;
224
176
  export declare function isModuleForChangedResource(mod: ModuleNode, changedFile: string, stylesheetRegistry?: AnalogStylesheetRegistry): boolean;
225
- /**
226
- * Refreshes any already-served stylesheet records that map back to a changed
227
- * source file.
228
- *
229
- * This is the critical bridge for externalized Angular component styles during
230
- * HMR. Angular's resource watcher can notice that `/src/...component.css`
231
- * changed before Angular recompilation has had a chance to repopulate the
232
- * stylesheet registry. If we emit a CSS update against the existing virtual
233
- * stylesheet id without first refreshing the registry content, the browser gets
234
- * a hot update containing stale CSS. By rewriting the existing served records
235
- * from disk up front, HMR always pushes the latest source content.
236
- */
237
- export declare function refreshStylesheetRegistryForFile(file: string, stylesheetRegistry?: AnalogStylesheetRegistry, stylePreprocessor?: StylePreprocessor): void;
238
177
  export declare function findComponentStylesheetWrapperModules(server: ViteDevServer, changedFile: string, directModule: ModuleNode, fileModules: ModuleNode[], stylesheetRegistry?: AnalogStylesheetRegistry): Promise<ModuleNode[]>;
239
- interface TemplateClassBindingIssue {
240
- line: number;
241
- column: number;
242
- snippet: string;
243
- }
244
- export declare function findStaticClassAndBoundClassConflicts(template: string): TemplateClassBindingIssue[];
245
- export declare function findBoundClassAndNgClassConflicts(template: string): TemplateClassBindingIssue[];
246
178
  export declare function findTemplateOwnerModules(server: ViteDevServer, resourceFile: string): ModuleNode[];
247
179
  export declare function getFileMetadata(program: ts.BuilderProgram, angularCompiler?: NgtscProgram["compiler"], hmrEnabled?: boolean, disableTypeChecking?: boolean): (file: string) => {
248
180
  errors?: string[];
@@ -250,9 +182,3 @@ export declare function getFileMetadata(program: ts.BuilderProgram, angularCompi
250
182
  hmrUpdateCode?: string | null;
251
183
  hmrEligible?: boolean;
252
184
  };
253
- /**
254
- * Checks for vitest run from the command line
255
- * @returns boolean
256
- */
257
- export declare function isTestWatchMode(args?: string[]): boolean;
258
- export {};