@blotch/rsbuild-plugin-angular-lynx 0.0.0-stage → 22.2.0

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 (76) hide show
  1. package/README.md +37 -2
  2. package/dist/angular-rebuild-coordinator.d.ts +70 -0
  3. package/dist/angular-rebuild-coordinator.test.d.ts +1 -0
  4. package/dist/angular-webpack-plugin.d.ts +127 -0
  5. package/dist/angular-webpack-plugin.test.d.ts +1 -0
  6. package/dist/angular.d.ts +31 -0
  7. package/dist/build-schema-source-file-cache.d.ts +20 -0
  8. package/dist/build-schema-source-file-cache.test.d.ts +1 -0
  9. package/dist/component-styles-cache.d.ts +43 -0
  10. package/dist/component-styles-cache.test.d.ts +1 -0
  11. package/dist/css.d.ts +13 -0
  12. package/dist/css.test.d.ts +1 -0
  13. package/dist/entry.d.ts +11 -0
  14. package/dist/entry.test.d.ts +1 -0
  15. package/dist/generator.d.ts +2 -0
  16. package/dist/generator.test.d.ts +1 -0
  17. package/dist/index.d.ts +1 -0
  18. package/dist/index.js +1510 -0
  19. package/dist/index.js.LICENSE.txt +7 -0
  20. package/dist/is-lynx-unknown-element-message.d.ts +12 -0
  21. package/dist/is-lynx-unknown-element-message.test.d.ts +1 -0
  22. package/dist/layers.d.ts +12 -0
  23. package/dist/layers.test.d.ts +1 -0
  24. package/dist/loaders/ignore-css-loader.d.ts +7 -0
  25. package/dist/loaders/ignore-css-loader.js +7 -0
  26. package/dist/loaders/ignore-css-loader.test.d.ts +1 -0
  27. package/dist/loaders/thread-globals-loader.d.ts +8 -0
  28. package/dist/loaders/thread-globals-loader.js +6 -0
  29. package/dist/loaders/thread-globals-loader.test.d.ts +1 -0
  30. package/dist/logger/dev-logger-middleware.d.ts +12 -0
  31. package/dist/logger/dev-logger-middleware.test.d.ts +1 -0
  32. package/dist/logger/dev-logger.d.ts +2 -0
  33. package/dist/logger/dev-logger.test.d.ts +1 -0
  34. package/dist/lynx-diagnostics.d.ts +38 -0
  35. package/dist/lynx-diagnostics.test.d.ts +1 -0
  36. package/dist/lynx-process-eval-result-runtime-module.d.ts +21 -0
  37. package/dist/lynx-process-eval-result-runtime-module.test.d.ts +1 -0
  38. package/dist/plugin-angular-lynx.d.ts +3 -0
  39. package/dist/plugin-angular-lynx.test.d.ts +1 -0
  40. package/dist/polyfills.js +122 -0
  41. package/dist/seed-compilation-source-files.d.ts +22 -0
  42. package/dist/seed-compilation-source-files.test.d.ts +1 -0
  43. package/dist/split-chunks.d.ts +3 -0
  44. package/dist/split-chunks.test.d.ts +1 -0
  45. package/dist/tailwind.d.ts +2 -0
  46. package/dist/tailwind.test.d.ts +1 -0
  47. package/dist/transform-module.d.ts +31 -0
  48. package/dist/transform-module.test.d.ts +1 -0
  49. package/dist/utils/angular/angular-config.d.ts +3 -0
  50. package/dist/utils/angular/angular-config.test.d.ts +1 -0
  51. package/dist/utils/angular/component-scope-id.d.ts +12 -0
  52. package/dist/utils/angular/component-scope-id.test.d.ts +1 -0
  53. package/dist/utils/angular/component-style-bundler.d.ts +19 -0
  54. package/dist/utils/angular/component-style-bundler.test.d.ts +1 -0
  55. package/dist/utils/angular/env.d.ts +2 -0
  56. package/dist/utils/angular/env.test.d.ts +1 -0
  57. package/dist/utils/angular/find-up.d.ts +8 -0
  58. package/dist/utils/angular/find-up.test.d.ts +1 -0
  59. package/dist/utils/angular/normalize-cache.d.ts +22 -0
  60. package/dist/utils/angular/normalize-cache.test.d.ts +1 -0
  61. package/dist/utils/angular/options.d.ts +82 -0
  62. package/dist/utils/angular/options.test.d.ts +1 -0
  63. package/dist/utils/angular/read-workspace.d.ts +7 -0
  64. package/dist/utils/angular/read-workspace.test.d.ts +1 -0
  65. package/dist/utils/angular/resolve-pages.d.ts +13 -0
  66. package/dist/utils/angular/resolve-pages.test.d.ts +1 -0
  67. package/dist/utils/inject-lynx-schema.d.ts +10 -0
  68. package/dist/utils/inject-lynx-schema.test.d.ts +1 -0
  69. package/dist/utils/options.d.ts +31 -0
  70. package/dist/utils/options.test.d.ts +1 -0
  71. package/dist/utils/strip-template-whitespace.d.ts +34 -0
  72. package/dist/utils/strip-template-whitespace.test.d.ts +1 -0
  73. package/dist/worklet-transform.d.ts +7 -0
  74. package/dist/worklet-transform.test.d.ts +1 -0
  75. package/package.json +73 -4
  76. package/patch/patch-angular-build.cjs +27 -0
@@ -0,0 +1,7 @@
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
+ */
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Returns true for Angular template diagnostic messages that are expected noise
3
+ * for Lynx native elements and should not be shown to the user:
4
+ *
5
+ * - "is not a known element" — suppressed by sourceFileCache schema injection but may
6
+ * still appear for files not in the tsconfig file list
7
+ * - "isn't a known property of" — Lynx element stubs don't declare @Input() for every
8
+ * platform-specific attribute (src, item-key, scroll-orientation, etc.) so Angular
9
+ * reports these as unknown property bindings on the stub components; the renderer
10
+ * handles them at runtime via setAttribute
11
+ */
12
+ export declare const isLynxUnknownElementMessage: (text: string | undefined) => boolean;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,12 @@
1
+ import type { RsbuildPluginAPI } from '@lynx-js/rspeedy';
2
+ /**
3
+ * Webpack layer names for the dual-thread build. Each entry is duplicated
4
+ * into two webpack entries with different layers — the layer determines which
5
+ * SWC target (ES2015 vs ES2019) and which thread-specific configuration
6
+ * (CSS extraction vs ignore, AMD wrapping vs plain) applies to the module.
7
+ */
8
+ export declare const LAYERS: {
9
+ BACKGROUND: string;
10
+ MAIN_THREAD: string;
11
+ };
12
+ export declare const applyLayers: (api: RsbuildPluginAPI) => void;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,7 @@
1
+ import type { Rspack } from '@rsbuild/core';
2
+ /**
3
+ * Must be a regular function expression (not arrow) — webpack invokes loaders
4
+ * via .call(loaderContext, source), which arrow functions cannot receive.
5
+ */
6
+ declare const ignoreCssLoader: (this: Rspack.LoaderContext, source: string) => string;
7
+ export default ignoreCssLoader;
@@ -0,0 +1,7 @@
1
+ const ignoreCssLoader = function(source) {
2
+ this.cacheable(true);
3
+ if (source.includes('___CSS_LOADER_EXPORT___')) return 'export {}';
4
+ return source;
5
+ };
6
+ const ignore_css_loader = ignoreCssLoader;
7
+ export default ignore_css_loader;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,8 @@
1
+ import type { Rspack } from '@rsbuild/core';
2
+ /**
3
+ * Prepends `globalThis["__MAIN_THREAD__"]=<value>;` to every module in the layer.
4
+ * Replaces the BannerPlugin approach — injections happen per-module during
5
+ * compilation instead of per-chunk after bundling.
6
+ */
7
+ declare const threadGlobalsLoader: (this: Rspack.LoaderContext, source: string) => string;
8
+ export default threadGlobalsLoader;
@@ -0,0 +1,6 @@
1
+ const threadGlobalsLoader = function(source) {
2
+ const options = this.getOptions();
3
+ return `globalThis["__MAIN_THREAD__"]=${options.isMainThread};\n${source}`;
4
+ };
5
+ const thread_globals_loader = threadGlobalsLoader;
6
+ export default thread_globals_loader;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,12 @@
1
+ import type { IncomingMessage, ServerResponse } from 'node:http';
2
+ export declare const formatArg: (arg: unknown) => string;
3
+ export declare const getLogFilePath: () => string;
4
+ /**
5
+ * Creates a connect-style middleware that handles POST /__dev_logs.
6
+ * Other requests are passed through to the next middleware.
7
+ */
8
+ /**
9
+ * Creates a connect-style middleware that handles POST /__dev_logs.
10
+ * Other requests are passed through to the next middleware.
11
+ */
12
+ export declare const createDevLoggerMiddleware: () => ((req: IncomingMessage, res: ServerResponse, next: () => void) => void);
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ import type { RsbuildPluginAPI } from '@lynx-js/rspeedy';
2
+ export declare const applyDevLogger: (api: RsbuildPluginAPI) => void;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,38 @@
1
+ export type LynxDiagnosticCategory = 'html-element' | 'structural' | 'css';
2
+ export type LynxDiagnostic = {
3
+ file: string;
4
+ message: string;
5
+ category: LynxDiagnosticCategory;
6
+ };
7
+ /**
8
+ * Scans Angular AOT-compiled output for HTML elements used in templates.
9
+ *
10
+ * Angular's compiler emits ɵɵelementStart(idx, "tag") and ɵɵelement(idx, "tag")
11
+ * for every template element. We regex-match these to detect HTML element usage
12
+ * that will silently fall back to <view> at runtime.
13
+ */
14
+ export declare const scanCompiledOutputForHtmlElements: (fileCache: Map<string, string | Uint8Array>) => LynxDiagnostic[];
15
+ /**
16
+ * Scans component source files for patterns that are unsupported in Lynx:
17
+ * - ViewEncapsulation.ShadowDom (silently falls back to None)
18
+ */
19
+ export declare const scanSourcesForUnsupportedPatterns: (fileNames: readonly string[]) => LynxDiagnostic[];
20
+ /**
21
+ * Scans the AOT compiled output for structural issues:
22
+ * - <list-item> used without a <list> parent in the same component
23
+ *
24
+ * Uses the same ɵɵelementStart/ɵɵelement pattern as HTML element detection
25
+ * to identify element usage in compiled templates.
26
+ */
27
+ export declare const scanCompiledOutputForStructuralIssues: (fileCache: Map<string, string | Uint8Array>) => LynxDiagnostic[];
28
+ /**
29
+ * Scans component source files for CSS properties not supported in Lynx.
30
+ *
31
+ * Extracts inline styles from @Component decorators and resolves external
32
+ * styleUrls, then checks each property declaration against the unsupported list.
33
+ */
34
+ export declare const scanSourcesForUnsupportedCss: (fileNames: readonly string[]) => LynxDiagnostic[];
35
+ /**
36
+ * Logs Lynx-specific diagnostics to the console, grouped by category.
37
+ */
38
+ export declare const reportLynxDiagnostics: (diagnostics: LynxDiagnostic[]) => void;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,21 @@
1
+ import type { RuntimeModule, rspack } from '@rspack/core';
2
+ type LynxProcessEvalResultRuntimeModule = new () => RuntimeModule;
3
+ /**
4
+ * Webpack RuntimeModule that installs async chunk modules into webpack's registry
5
+ * after Lynx's native runtime evaluates them. This is the final step in the lazy
6
+ * loading chain:
7
+ *
8
+ * loadComponent() → import() → __webpack_require__.e(chunkId)
9
+ * → ensureChunkHandlers.require → lynx.requireModuleAsync(url, callback)
10
+ * → native fetches chunk .js, evaluates AMD IIFE → returns {ids, modules}
11
+ * → callback fires → externalInstallChunk({ids, modules})
12
+ * → module factories registered in __webpack_require__.m
13
+ * → import() promise resolves → Angular Router renders the component
14
+ *
15
+ * The lynxProcessEvalResult function is called by the native runtime when it has
16
+ * already fetched and pre-evaluated a lazy bundle. It receives the chunk result
17
+ * (containing module IDs and factory functions), installs them, then requires
18
+ * modules in dependency order so side effects execute correctly.
19
+ */
20
+ export declare const createLynxProcessEvalResultRuntimeModule: (webpack: typeof rspack) => LynxProcessEvalResultRuntimeModule;
21
+ export {};
@@ -0,0 +1,3 @@
1
+ import type { RsbuildPlugin } from '@lynx-js/rspeedy';
2
+ import { type PluginAngularLynxOptions } from './utils/options.js';
3
+ export declare const pluginAngularLynx: (options?: PluginAngularLynxOptions) => RsbuildPlugin;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,122 @@
1
+ if ("u" < typeof AbortController) {
2
+ class LynxAbortSignal {
3
+ constructor(){
4
+ this.aborted = false;
5
+ this.reason = void 0;
6
+ this._listeners = [];
7
+ }
8
+ addEventListener(type, listener) {
9
+ if ('abort' === type) this._listeners.push(listener);
10
+ }
11
+ removeEventListener(type, listener) {
12
+ if ('abort' === type) this._listeners = this._listeners.filter((l)=>l !== listener);
13
+ }
14
+ dispatchEvent(event) {
15
+ if ('abort' === event.type) for (const listener of this._listeners.slice())listener(event);
16
+ return true;
17
+ }
18
+ throwIfAborted() {
19
+ if (this.aborted) throw this.reason;
20
+ }
21
+ }
22
+ globalThis.AbortSignal = LynxAbortSignal;
23
+ globalThis.AbortController = class {
24
+ constructor(){
25
+ this.signal = new LynxAbortSignal();
26
+ }
27
+ abort(reason) {
28
+ if (this.signal.aborted) return;
29
+ this.signal.aborted = true;
30
+ if (void 0 === reason) {
31
+ const err = new Error('This operation was aborted');
32
+ err.name = 'AbortError';
33
+ reason = err;
34
+ }
35
+ this.signal.reason = reason;
36
+ this.signal.dispatchEvent({
37
+ type: 'abort'
38
+ });
39
+ }
40
+ };
41
+ }
42
+ if ('function' != typeof Object.hasOwn) Object.hasOwn = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
43
+ if ('function' != typeof Promise.allSettled) Promise.allSettled = (promises)=>Promise.all(Array.from(promises, (p)=>Promise.resolve(p).then((value)=>({
44
+ status: 'fulfilled',
45
+ value
46
+ }), (reason)=>({
47
+ status: 'rejected',
48
+ reason
49
+ }))));
50
+ if ("u" < typeof performance) globalThis.performance = void 0;
51
+ if ("u" < typeof queueMicrotask) {
52
+ globalThis.queueMicrotaskPromiseCache = Promise.resolve();
53
+ globalThis.queueMicrotask = (cb)=>globalThis.queueMicrotaskPromiseCache.then(cb);
54
+ }
55
+ if ("u" < typeof Node) try {
56
+ class LynxNode {
57
+ }
58
+ Object.assign(LynxNode, {
59
+ ELEMENT_NODE: 1,
60
+ ATTRIBUTE_NODE: 2,
61
+ TEXT_NODE: 3,
62
+ CDATA_SECTION_NODE: 4,
63
+ PROCESSING_INSTRUCTION_NODE: 7,
64
+ COMMENT_NODE: 8,
65
+ DOCUMENT_NODE: 9,
66
+ DOCUMENT_TYPE_NODE: 10,
67
+ DOCUMENT_FRAGMENT_NODE: 11,
68
+ DOCUMENT_POSITION_DISCONNECTED: 1,
69
+ DOCUMENT_POSITION_PRECEDING: 2,
70
+ DOCUMENT_POSITION_FOLLOWING: 4,
71
+ DOCUMENT_POSITION_CONTAINS: 8,
72
+ DOCUMENT_POSITION_CONTAINED_BY: 16,
73
+ DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: 32
74
+ });
75
+ globalThis.Node = LynxNode;
76
+ } catch {}
77
+ try {
78
+ if ("u" < typeof document) globalThis.document = {
79
+ defaultView: globalThis,
80
+ querySelector: ()=>null
81
+ };
82
+ } catch {}
83
+ try {
84
+ if ("u" < typeof window) globalThis.window = globalThis;
85
+ } catch {}
86
+ try {
87
+ if ("u" < typeof navigator) globalThis.navigator = {
88
+ userAgent: ''
89
+ };
90
+ } catch {}
91
+ try {
92
+ if (void 0 === globalThis.location) globalThis.location = {
93
+ href: 'lynx://app/',
94
+ protocol: 'lynx:',
95
+ host: 'app',
96
+ hostname: 'app',
97
+ port: '',
98
+ pathname: '/',
99
+ search: '',
100
+ hash: '',
101
+ origin: 'lynx://app',
102
+ assign: ()=>{},
103
+ reload: ()=>{},
104
+ replace: ()=>{},
105
+ toString: ()=>'lynx://app/'
106
+ };
107
+ } catch {}
108
+ try {
109
+ if (void 0 === globalThis.history) globalThis.history = {
110
+ length: 1,
111
+ state: null,
112
+ scrollRestoration: 'auto',
113
+ back: ()=>{},
114
+ forward: ()=>{},
115
+ go: ()=>{},
116
+ pushState: ()=>{},
117
+ replaceState: ()=>{}
118
+ };
119
+ } catch {}
120
+ if ('function' != typeof globalThis.addEventListener) globalThis.addEventListener = ()=>{};
121
+ if ('function' != typeof globalThis.removeEventListener) globalThis.removeEventListener = ()=>{};
122
+ export { };
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Copies pre-transformed SourceFiles into an Angular compilation's own
3
+ * source-file cache so its compiler host serves them instead of reading the
4
+ * original files from disk.
5
+ *
6
+ * Why this exists: up to Angular 22.1 the cache was handed over through
7
+ * `AngularHostOptions.sourceFileCache` on `compilation.initialize()`. In 22.2,
8
+ * `@angular/build` moved ownership of the cache onto the compilation itself
9
+ * (`TypeScriptCompilation#sourceFiles`, a protected `Map`) and passes it to
10
+ * `createAngularCompilerHost()` directly, so the host option no longer exists.
11
+ * Seeding that map before `initialize()` is the equivalent hook.
12
+ *
13
+ * Only in-process compilations (`AotCompilation` / `JitCompilation`) own such a
14
+ * map. `ParallelCompilation` runs the compiler in a worker thread with a cache
15
+ * that lives in the worker, so there is nothing to seed — the same as before
16
+ * 22.2, where the worker ignored `hostOptions.sourceFileCache` entirely. Callers
17
+ * get `false` back in that case so the miss is observable rather than silent.
18
+ *
19
+ * The compilation is typed structurally because `sourceFiles` is `protected`
20
+ * on `@angular/build`'s class and not part of its public surface.
21
+ */
22
+ export declare const seedCompilationSourceFiles: (compilation: object, sourceFileCache: ReadonlyMap<string, unknown>) => boolean;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,3 @@
1
+ import type { RsbuildPluginAPI } from '@lynx-js/rspeedy';
2
+ import type { PluginAngularLynxOptions } from './utils/options.js';
3
+ export declare const applySplitChunksRule: (api: RsbuildPluginAPI, options: Required<PluginAngularLynxOptions>) => void;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ import type { RsbuildPluginAPI } from '@lynx-js/rspeedy';
2
+ export declare const applyTailwind: (api: RsbuildPluginAPI) => void;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,31 @@
1
+ import type { ComponentScopeInfo, ComponentStylesEntry } from './component-styles-cache.js';
2
+ /**
3
+ * Transforms the Angular-compiled JS for a single component module before rspack
4
+ * bundles it. This is the per-module half of the AngularLynx pipeline, extracted
5
+ * from angular.ts's `api.transform` hook so it can be unit-tested as a pure
6
+ * string→string function (no rspack loader context, no compilation cache).
7
+ *
8
+ * It applies, in order:
9
+ * 1. Prepends `import "<scoped.css>"` statements for the component's scoped
10
+ * stylesheets (resolved relative to the component file).
11
+ * 2. Appends the `Component.ɵcmp.id = '<scopeId>'` assignment that ties the CSS
12
+ * files (whose filenames carry the same scope ID) to the runtime component.
13
+ * 3. Runs the worklet ("main thread" directive) transform over the result.
14
+ *
15
+ * It deliberately does NOT make the bootstrap entry accept its own hot
16
+ * updates (`module.hot.accept()`), which an earlier version did. On Lynx the
17
+ * screen is drawn by the Angular app on the main thread, but webpack HMR only
18
+ * runs on the background thread: nothing loads the main-thread hot-update
19
+ * chunk. A self-accepting entry let the background thread apply the update
20
+ * and re-bootstrap its own copy of the app, so HMR reported success and the
21
+ * main thread kept rendering the old code until a manual reload. With no
22
+ * module accepting, the update aborts and the Lynx HMR client
23
+ * (`@lynx-js/webpack-dev-transport`) falls back to a full `Page.reload`, which
24
+ * re-runs both threads with the new bundle.
25
+ */
26
+ export declare const buildTransformedCode: (params: {
27
+ code: string;
28
+ resourcePath: string;
29
+ componentStyles: Pick<ComponentStylesEntry, "imports"> | undefined;
30
+ scopeInfo: ComponentScopeInfo | undefined;
31
+ }) => string;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,3 @@
1
+ import type { RsbuildPluginAPI } from '@lynx-js/rspeedy';
2
+ import type { NormalizedOptions } from './options.js';
3
+ export declare const applyAngularConfig: (api: RsbuildPluginAPI, buildOptions: NormalizedOptions) => void;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Generates a deterministic CSS scope ID for ViewEncapsulation.Emulated.
3
+ * Uses className + file path to ensure uniqueness — two components with the
4
+ * same class name in different files get different IDs. The 'l' prefix
5
+ * (for "Lynx") differentiates these from Angular's default 'ng' prefix IDs,
6
+ * preventing collisions if browser-Angular scope IDs leak into shared code.
7
+ * This ID appears in:
8
+ * - CSS filenames: `...__scoped_l<hash>.css`
9
+ * - ɵcmp.id: patched at the end of angular.ts transform
10
+ * - _nghost-l<hash> class: added by EmulatedLynxRenderer.selectRootElement()
11
+ */
12
+ export declare const generateComponentScopeId: (className: string, containingFile: string) => string;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,19 @@
1
+ import { ComponentStylesheetBundler } from '@angular/build/src/tools/esbuild/angular/component-stylesheets';
2
+ import type { NormalizedOptions } from './options.js';
3
+ /**
4
+ * Creates an Angular `ComponentStylesheetBundler` configured for the current workspace.
5
+ *
6
+ * Angular's AOT compilation extracts component `styles`/`styleUrl` into separate virtual
7
+ * style files that must be bundled independently. This bundler handles that step — it is
8
+ * invoked by the Angular compilation pipeline whenever a component references inline or
9
+ * external styles, producing CSS that is then injected back into the component's JS output.
10
+ *
11
+ * Several options available on `ComponentStylesheetBundler` (Sass preprocessor, Tailwind,
12
+ * PostCSS, symlink preservation, public path) are intentionally left commented out. They are
13
+ * not yet wired into the plugin's normalized option set and will need to be enabled as the
14
+ * plugin matures.
15
+ *
16
+ * @param options - Normalized Angular build options derived from the workspace's `angular.json`.
17
+ * @returns A configured `ComponentStylesheetBundler` ready for use in the compilation pipeline.
18
+ */
19
+ export declare const createComponentStyleBundler: (options: NormalizedOptions) => ComponentStylesheetBundler;
@@ -0,0 +1,2 @@
1
+ export declare const maxWorkers: number;
2
+ export declare const useTypeChecking: boolean;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,8 @@
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 const findUp: (names: string | string[], from: string) => string | null;
@@ -0,0 +1 @@
1
+ export {};
@@ -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
+ export type NormalizedCachedOptions = {
9
+ /**
10
+ * Whether disk cache is enabled.
11
+ */
12
+ enabled: boolean;
13
+ /**
14
+ * Disk cache path. Example: `/.angular/cache/v12.0.0`.
15
+ */
16
+ path: string;
17
+ /**
18
+ * Disk cache base path. Example: `/.angular/cache`.
19
+ */
20
+ basePath: string;
21
+ };
22
+ export declare const normalizeCacheOptions: (projectMetadata: unknown, workspaceRoot: string) => NormalizedCachedOptions;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,82 @@
1
+ import type { OutputHashing } from '@angular-devkit/build-angular';
2
+ import type { workspaces } from '@angular-devkit/core';
3
+ import type { TargetDefinition } from '@angular-devkit/core/src/workspace/definitions';
4
+ import { type NormalizedCachedOptions } from './normalize-cache.js';
5
+ /**
6
+ * Normalizes angular.json's `sourceMap` field which accepts two shapes:
7
+ *
8
+ * - Boolean (`true` / `false`) — applies the same setting to scripts, styles,
9
+ * hidden, and vendor sourcemaps.
10
+ * - Object (`{ scripts, styles, hidden, vendor }`) — fine-grained control
11
+ * used by production builds that want script maps but not vendor or
12
+ * stylesheet maps for bundle-size reasons.
13
+ *
14
+ * Downstream consumers (the JavaScriptTransformer, the rspack devtool option,
15
+ * and the diagnostic reporters) all expect the object shape, so we expand the
16
+ * boolean into the equivalent uniform-object form here.
17
+ */
18
+ export declare const normalizeSourceMaps: (sourceMap: any) => any;
19
+ /**
20
+ * Normalizes angular.json's `optimization` field which accepts three shapes:
21
+ *
22
+ * - `undefined` / `true` — enable everything (the default for production).
23
+ * - `false` — disable everything (typical for dev builds).
24
+ * - Object — granular control over scripts/styles/fonts subsections, where
25
+ * each subsection can itself be a boolean or a config object.
26
+ *
27
+ * The double-nested shape is messy: `{ styles: true }` means "minify styles
28
+ * with the default config" while `{ styles: { minify: false, inlineCritical: true } }`
29
+ * means "use these exact style settings". This function flattens both forms
30
+ * into a single canonical `{ scripts, styles, fonts }` object that all
31
+ * downstream code can rely on without re-doing the shape check.
32
+ *
33
+ * Note: `inlineCritical` is included in the default style config even though
34
+ * Lynx doesn't have a concept of "above-the-fold critical CSS" — leaving it
35
+ * mirrored from Angular's default keeps the option surface compatible with
36
+ * Angular's own builder so users can copy/paste angular.json snippets.
37
+ */
38
+ export declare const normalizeOptimization: (optimization?: boolean | Record<string, any> | undefined) => any;
39
+ export type NormalizedI18nOptions = {
40
+ sourceLocale: string;
41
+ hasDefinedSourceLocale: boolean;
42
+ };
43
+ export type NormalizedOptions = {
44
+ tsconfig: string;
45
+ aot: boolean;
46
+ optimizationOptions: {
47
+ scripts: boolean;
48
+ styles: any;
49
+ fonts: any;
50
+ };
51
+ sourcemapOptions: {
52
+ vendor: any;
53
+ hidden: any;
54
+ scripts: any;
55
+ styles: any;
56
+ };
57
+ fileReplacements: Record<string, string> | undefined;
58
+ polyfills?: string[];
59
+ index: string;
60
+ browser: string;
61
+ advancedOptimizations: boolean;
62
+ outputPath: string | undefined;
63
+ workspaceRoot: string;
64
+ outputNames: {
65
+ bundles: string;
66
+ media: string;
67
+ };
68
+ cacheOptions: NormalizedCachedOptions;
69
+ inlineStyleLanguage: string | undefined;
70
+ outputHashing: OutputHashing;
71
+ styles: string[];
72
+ i18n: NormalizedI18nOptions;
73
+ i18nMissingTranslation: 'error' | 'warning' | 'ignore';
74
+ };
75
+ export declare const readTarget: (project: workspaces.ProjectDefinition, target?: string) => TargetDefinition | undefined;
76
+ export declare const readBuildOptions: (project: workspaces.ProjectDefinition, basePath: string, configurationName?: string) => Promise<NormalizedOptions>;
77
+ /**
78
+ * Normalizes the `i18n` section from angular.json's project definition.
79
+ * Angular supports `sourceLocale` as either a string ('en-US') or an object
80
+ * ({ code: 'en-US' }). We extract the locale code either way.
81
+ */
82
+ export declare const normalizeI18nOptions: (raw: unknown) => NormalizedI18nOptions;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,7 @@
1
+ import { workspaces } from '@angular-devkit/core';
2
+ export type AngularWorkspace = {
3
+ workspace: workspaces.WorkspaceDefinition;
4
+ basePath: string;
5
+ };
6
+ export declare const getAngularWorkspace: () => Promise<AngularWorkspace>;
7
+ export declare const getProjectByCwd: (workspace: workspaces.WorkspaceDefinition, basePath: string) => string | null;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,13 @@
1
+ import type { workspaces } from '@angular-devkit/core';
2
+ export type ResolvedPage = {
3
+ name: string;
4
+ browser: string;
5
+ };
6
+ /**
7
+ * Resolves angular.json projects into entry points for multi-page builds.
8
+ *
9
+ * When `pages` is `'all'`, every project with `projectType: 'application'` is
10
+ * included. When it's a `string[]`, only those named projects are used.
11
+ * Each project's `architect.build.options.browser` field becomes the entry path.
12
+ */
13
+ export declare const resolvePages: (workspace: workspaces.WorkspaceDefinition, basePath: string, pages: string[] | "all") => ResolvedPage[];
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Injects CUSTOM_ELEMENTS_SCHEMA into every @Component decorator in a TypeScript
3
+ * source file that doesn't already declare a schema.
4
+ *
5
+ * This is applied via the Angular compiler's sourceFileCache before compilation,
6
+ * so Angular's template type-checker never sees unknown Lynx element errors
7
+ * (<view>, <text>, <scroll-view>, etc.) without the user having to declare
8
+ * schemas manually in every component.
9
+ */
10
+ export declare const injectLynxSchema: (source: string) => string;
@@ -0,0 +1 @@
1
+ export {};