@blotch/rsbuild-plugin-angular-lynx 22.2.2 → 22.2.4
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 +2 -1
- package/dist/544.js +21 -0
- package/dist/angular-rebuild-coordinator.d.ts +1 -1
- package/dist/angular.d.ts +3 -2
- package/dist/background-entry.d.ts +96 -0
- package/dist/client/background-hot-updates.d.ts +50 -0
- package/dist/client/background-hot-updates.js +77 -0
- package/dist/client/background-hot-updates.test.d.ts +1 -0
- package/dist/client/css-hot-update.cjs +9 -0
- package/dist/client/css-hot-update.d.ts +44 -0
- package/dist/client/css-hot-update.js +42 -0
- package/dist/client/css-hot-update.test.d.ts +1 -0
- package/dist/client/hmr-background.js +16 -0
- package/dist/client/hmr-main-thread.js +9 -0
- package/dist/client/hmr-protocol.d.ts +74 -0
- package/dist/client/main-thread-hot-updates.d.ts +40 -0
- package/dist/client/main-thread-hot-updates.js +78 -0
- package/dist/client/main-thread-hot-updates.test.d.ts +1 -0
- package/dist/client/testing/test-context.d.ts +16 -0
- package/dist/component-styles-cache.d.ts +5 -35
- package/dist/component-styles.d.ts +73 -0
- package/dist/component-styles.test.d.ts +1 -0
- package/dist/cross-thread-transform.d.ts +38 -0
- package/dist/cross-thread-transform.test.d.ts +1 -0
- package/dist/css.d.ts +2 -2
- package/dist/entry.d.ts +23 -2
- package/dist/hot-updates.d.ts +67 -0
- package/dist/hot-updates.test.d.ts +1 -0
- package/dist/index.js +2559 -173
- package/dist/layers.d.ts +6 -4
- package/dist/logger/dev-logger-middleware.d.ts +13 -7
- package/dist/logger/dev-logger.d.ts +13 -0
- package/dist/polyfills.js +56 -0
- package/dist/polyfills.test.d.ts +1 -0
- package/dist/pure-classes.d.ts +27 -0
- package/dist/pure-classes.test.d.ts +1 -0
- package/dist/resolve.d.ts +19 -0
- package/dist/resolve.test.d.ts +1 -0
- package/dist/split-chunks.d.ts +2 -2
- package/dist/styles/blur-view.css +16 -0
- package/dist/tailwind-v4/calc.d.ts +18 -0
- package/dist/tailwind-v4/calc.test.d.ts +1 -0
- package/dist/tailwind-v4/colors.d.ts +6 -0
- package/dist/tailwind-v4/colors.test.d.ts +1 -0
- package/dist/tailwind-v4/declarations.d.ts +39 -0
- package/dist/tailwind-v4/declarations.test.d.ts +1 -0
- package/dist/tailwind-v4/index.d.ts +23 -0
- package/dist/tailwind-v4/index.test.d.ts +1 -0
- package/dist/tailwind-v4/lynx-properties.d.ts +20 -0
- package/dist/tailwind-v4/selectors.d.ts +6 -0
- package/dist/tailwind-v4/selectors.test.d.ts +1 -0
- package/dist/tailwind-v4/structure.d.ts +51 -0
- package/dist/tailwind-v4/structure.test.d.ts +1 -0
- package/dist/tailwind-v4/variables.d.ts +20 -0
- package/dist/tailwind-v4/variables.test.d.ts +1 -0
- package/dist/tailwind.d.ts +14 -0
- package/dist/transform-module.d.ts +43 -17
- package/dist/utils/angular/component-scope-id.d.ts +5 -3
- package/dist/utils/options.d.ts +40 -1
- package/package.json +5 -2
- package/dist/loaders/thread-globals-loader.d.ts +0 -8
- package/dist/loaders/thread-globals-loader.js +0 -6
- /package/dist/{loaders/thread-globals-loader.test.d.ts → background-entry.test.d.ts} +0 -0
package/dist/layers.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import type { RsbuildPluginAPI } from '@lynx-js/rspeedy';
|
|
2
2
|
/**
|
|
3
|
-
* Webpack layer names for the dual-thread build. Each entry is
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
3
|
+
* Webpack layer names for the dual-thread build. Each entry is split into two
|
|
4
|
+
* webpack entries with different layers (entry.ts), and every module an entry
|
|
5
|
+
* reaches stays in its layer. The layer determines which SWC target (ES2015 vs
|
|
6
|
+
* ES2019), which `__MAIN_THREAD__` value and which thread-specific
|
|
7
|
+
* configuration (CSS extraction vs ignore, AMD wrapping vs plain) applies to
|
|
8
|
+
* the module.
|
|
7
9
|
*/
|
|
8
10
|
export declare const LAYERS: {
|
|
9
11
|
BACKGROUND: string;
|
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
import type { IncomingMessage, ServerResponse } from 'node:http';
|
|
2
|
-
export declare const formatArg: (arg: unknown) => string;
|
|
3
|
-
export declare const getLogFilePath: () => string;
|
|
4
2
|
/**
|
|
5
|
-
*
|
|
6
|
-
*
|
|
3
|
+
* Connect-style middleware that receives log batches from on-device and
|
|
4
|
+
* writes them to a log file. Rspeedy's TUI uses the alternate screen buffer,
|
|
5
|
+
* so stdout writes are hidden — a file + `tail -f` is more reliable.
|
|
7
6
|
*/
|
|
7
|
+
/** The dev server path the app posts its log entries to. */
|
|
8
|
+
export declare const DEV_LOGS_PATH = "/__dev_logs";
|
|
9
|
+
export declare const formatArg: (arg: unknown) => string;
|
|
8
10
|
/**
|
|
9
|
-
* Creates a connect-style middleware that handles POST /__dev_logs
|
|
10
|
-
* Other requests are passed through to the next
|
|
11
|
+
* Creates a connect-style middleware that handles POST /__dev_logs and writes
|
|
12
|
+
* the entries to `logFilePath`. Other requests are passed through to the next
|
|
13
|
+
* middleware.
|
|
14
|
+
*
|
|
15
|
+
* The file is created, or emptied, right away: each dev server start begins a
|
|
16
|
+
* fresh log, and `tail -f` can follow it before the first entry arrives.
|
|
11
17
|
*/
|
|
12
|
-
export declare const createDevLoggerMiddleware: () => ((req: IncomingMessage, res: ServerResponse, next: () => void) => void);
|
|
18
|
+
export declare const createDevLoggerMiddleware: (logFilePath: string) => ((req: IncomingMessage, res: ServerResponse, next: () => void) => void);
|
|
@@ -1,2 +1,15 @@
|
|
|
1
1
|
import type { RsbuildPluginAPI } from '@lynx-js/rspeedy';
|
|
2
|
+
/**
|
|
3
|
+
* Receives `LynxLogger` entries from the app on the dev server itself, and
|
|
4
|
+
* writes them to `.dev-logs`. Also injects __DEV_LOG_URL__ at compile time so
|
|
5
|
+
* the runtime knows where to POST logs (rspack's __webpack_public_path__ isn't
|
|
6
|
+
* accessible as a globalThis property in Lynx's JS environment).
|
|
7
|
+
*
|
|
8
|
+
* The endpoint is a middleware on the dev server, at the origin the app loads
|
|
9
|
+
* its bundle from, rather than a server of its own on a port next to it. The
|
|
10
|
+
* phone can already reach that origin, and its port is the one rspeedy
|
|
11
|
+
* resolved: a second server had to guess its port when the bundle was
|
|
12
|
+
* compiled, and when that port was taken it moved to another one while the
|
|
13
|
+
* app kept posting to the first, so the logs were lost.
|
|
14
|
+
*/
|
|
2
15
|
export declare const applyDevLogger: (api: RsbuildPluginAPI) => void;
|
package/dist/polyfills.js
CHANGED
|
@@ -40,6 +40,62 @@ if ("u" < typeof AbortController) {
|
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
42
|
if ('function' != typeof Object.hasOwn) Object.hasOwn = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
43
|
+
const definePolyfillOverride = (proto, name, value)=>{
|
|
44
|
+
Object.defineProperty(proto, name, {
|
|
45
|
+
value,
|
|
46
|
+
writable: true,
|
|
47
|
+
configurable: true,
|
|
48
|
+
enumerable: false
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
const definePolyfill = (proto, name, value)=>{
|
|
52
|
+
if (proto && 'function' != typeof proto[name]) definePolyfillOverride(proto, name, value);
|
|
53
|
+
};
|
|
54
|
+
const relativeIndex = function(index) {
|
|
55
|
+
const length = this.length;
|
|
56
|
+
let n = Math.trunc(Number(index)) || 0;
|
|
57
|
+
if (n < 0) n += length;
|
|
58
|
+
if (n < 0 || n >= length) return;
|
|
59
|
+
return 'string' == typeof this ? this.charAt(n) : this[n];
|
|
60
|
+
};
|
|
61
|
+
definePolyfill(Array.prototype, 'at', relativeIndex);
|
|
62
|
+
definePolyfill(String.prototype, 'at', function(index) {
|
|
63
|
+
return relativeIndex.call(String(this), index);
|
|
64
|
+
});
|
|
65
|
+
if ('function' == typeof Int8Array) definePolyfill(Object.getPrototypeOf(Int8Array.prototype), 'at', relativeIndex);
|
|
66
|
+
definePolyfill(Array.prototype, 'findLastIndex', function(predicate, thisArg) {
|
|
67
|
+
for(let i = this.length - 1; i >= 0; i--)if (predicate.call(thisArg, this[i], i, this)) return i;
|
|
68
|
+
return -1;
|
|
69
|
+
});
|
|
70
|
+
definePolyfill(Array.prototype, 'findLast', function(predicate, thisArg) {
|
|
71
|
+
for(let i = this.length - 1; i >= 0; i--)if (predicate.call(thisArg, this[i], i, this)) return this[i];
|
|
72
|
+
});
|
|
73
|
+
definePolyfill(String.prototype, 'replaceAll', function(search, replacement) {
|
|
74
|
+
const subject = String(this);
|
|
75
|
+
if (search instanceof RegExp) {
|
|
76
|
+
if (!search.global) throw new TypeError('replaceAll must be called with a global RegExp');
|
|
77
|
+
return subject.replace(search, replacement);
|
|
78
|
+
}
|
|
79
|
+
const needle = String(search);
|
|
80
|
+
const pattern = new RegExp(needle.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'), 'g');
|
|
81
|
+
return subject.replace(pattern, replacement);
|
|
82
|
+
});
|
|
83
|
+
if ("u" < typeof Intl) definePolyfillOverride(Number.prototype, 'toLocaleString', function(_locales, options) {
|
|
84
|
+
const value = Number(this);
|
|
85
|
+
if (Number.isNaN(value)) return 'NaN';
|
|
86
|
+
if (!Number.isFinite(value)) return value > 0 ? '∞' : '-∞';
|
|
87
|
+
const opts = options || {};
|
|
88
|
+
const min = opts.minimumFractionDigits ?? 0;
|
|
89
|
+
const max = Math.max(min, opts.maximumFractionDigits ?? Math.max(min, 3));
|
|
90
|
+
const fixed = Math.abs(value).toFixed(max);
|
|
91
|
+
const dot = fixed.indexOf('.');
|
|
92
|
+
let integer = dot < 0 ? fixed : fixed.slice(0, dot);
|
|
93
|
+
let fraction = dot < 0 ? '' : fixed.slice(dot + 1).replace(/0+$/, '');
|
|
94
|
+
while(fraction.length < min)fraction += '0';
|
|
95
|
+
if (false !== opts.useGrouping) integer = integer.replace(/\B(?=(\d{3})+(?!\d))/g, ',');
|
|
96
|
+
const sign = value < 0 && 0 !== Number(fixed) ? '-' : '';
|
|
97
|
+
return sign + integer + (fraction ? `.${fraction}` : '');
|
|
98
|
+
});
|
|
43
99
|
if ('function' != typeof Promise.allSettled) Promise.allSettled = (promises)=>Promise.all(Array.from(promises, (p)=>Promise.resolve(p).then((value)=>({
|
|
44
100
|
status: 'fulfilled',
|
|
45
101
|
value
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wraps each top-level class with private or static members in a pure IIFE,
|
|
3
|
+
* so a bundler can drop the classes nothing uses.
|
|
4
|
+
*
|
|
5
|
+
* The background layer compiles to ES2015 (layers.ts), so SWC lowers private
|
|
6
|
+
* and static class fields. A class declaration keeps its own statement, but the
|
|
7
|
+
* class expressions that bundled libraries are written in (`var X = class
|
|
8
|
+
* {…}`) become a sequence that assigns each private field's `WeakMap` to an
|
|
9
|
+
* outer variable: `var X = (_a = new WeakMap(), class {…})`. The assignment
|
|
10
|
+
* counts as a side effect, so rspack keeps every such class, and every import
|
|
11
|
+
* it uses, even when nothing uses the class. The runtime's own classes are
|
|
12
|
+
* like that (it uses `#private` fields throughout), which kept Angular's
|
|
13
|
+
* renderer and change detection in the background bundle.
|
|
14
|
+
*
|
|
15
|
+
* Angular's build already wraps a class whose static members are Angular's
|
|
16
|
+
* own (`ɵcmp`, `ɵfac` and so on) in `/*#__PURE__*\/ (() => {…})()`; this does
|
|
17
|
+
* the same for the rest. Inside the IIFE, the lowering's assignments are local
|
|
18
|
+
* and the call is marked pure. A class whose static members could have side
|
|
19
|
+
* effects of their own (anything but literals, functions and new collections)
|
|
20
|
+
* is left alone.
|
|
21
|
+
*
|
|
22
|
+
* @param code - The module's code, before SWC lowers it (and, for a `.ts`
|
|
23
|
+
* file, strips its types).
|
|
24
|
+
* @param filename - The module's path, for the parser.
|
|
25
|
+
* @returns The transformed code, or `code` itself when nothing applies.
|
|
26
|
+
*/
|
|
27
|
+
export declare const wrapPureClasses: (code: string, filename: string) => string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { RsbuildPluginAPI } from '@lynx-js/rspeedy';
|
|
2
|
+
/**
|
|
3
|
+
* Resolves `import`s to a package's ES module build.
|
|
4
|
+
*
|
|
5
|
+
* The Lynx build engine resolves every request with the conditions `lynx`,
|
|
6
|
+
* `import`, `require` and `browser`, whether it comes from an `import` or a
|
|
7
|
+
* `require()`. A package whose `exports` list `require` before any of the
|
|
8
|
+
* others then resolves to its CommonJS build even from an `import`. rxjs is
|
|
9
|
+
* one (`types`, `node`, `require`, `es2015`, `default`), and Angular and the
|
|
10
|
+
* runtime import it everywhere. CommonJS can't be tree-shaken, so every app
|
|
11
|
+
* carried all of rxjs on both threads, about 130 kB of each bundle, when the
|
|
12
|
+
* background thread uses `Subject` alone.
|
|
13
|
+
*
|
|
14
|
+
* So `import`s get the engine's conditions without `require`, and with
|
|
15
|
+
* `module` after `import`, as webpack's defaults have them (tslib's ES module
|
|
16
|
+
* build is behind `module`). A `require()` still resolves with all of the
|
|
17
|
+
* engine's conditions.
|
|
18
|
+
*/
|
|
19
|
+
export declare const applyResolve: (api: RsbuildPluginAPI) => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/split-chunks.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { RsbuildPluginAPI } from '@lynx-js/rspeedy';
|
|
2
|
-
import type {
|
|
3
|
-
export declare const applySplitChunksRule: (api: RsbuildPluginAPI, options:
|
|
2
|
+
import type { NormalizedPluginAngularLynxOptions } from './utils/options.js';
|
|
3
|
+
export declare const applySplitChunksRule: (api: RsbuildPluginAPI, options: NormalizedPluginAngularLynxOptions) => void;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The look of iOS's blur-view materials on Android, where Lynx's blur-view
|
|
3
|
+
* only blurs. On Android the runtime sets these variables inline on every
|
|
4
|
+
* blur-view (see android-blur-material.ts in @blotch/angular-lynx); iOS leaves
|
|
5
|
+
* them unset, so the fallbacks apply there and change nothing.
|
|
6
|
+
*
|
|
7
|
+
* The type selector is what lets the app restyle a blur-view: it loses to any
|
|
8
|
+
* class, id or inline style, so `bg-white/30` or `shadow-none` still wins.
|
|
9
|
+
* The build adds this file to the native bundle first, so an app's own
|
|
10
|
+
* `blur-view` rule comes later and wins too. Web draws its materials itself.
|
|
11
|
+
*/
|
|
12
|
+
blur-view {
|
|
13
|
+
background-color: var(--angular-lynx-blur-background, transparent);
|
|
14
|
+
background-image: var(--angular-lynx-blur-background-image, none);
|
|
15
|
+
box-shadow: var(--angular-lynx-blur-box-shadow, none);
|
|
16
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Folds every `calc()` in a value whose terms are all constants, such as the
|
|
3
|
+
* `calc(45deg * -1)` and `calc(calc(1 / 2 * 100%) * -1)` Tailwind writes for
|
|
4
|
+
* negative and fractional transforms, into a single value (`-45deg`, `-50%`).
|
|
5
|
+
*
|
|
6
|
+
* Lynx evaluates `calc()` in lengths, but not everywhere a transform function
|
|
7
|
+
* takes an angle, a number or a percentage, so the transform values are
|
|
8
|
+
* folded before they reach it. A `calc()` with `var()` or mixed units stays
|
|
9
|
+
* as it is. So does `infinity`, which Lynx doesn't read.
|
|
10
|
+
*/
|
|
11
|
+
export declare const foldCalc: (value: string) => string;
|
|
12
|
+
/**
|
|
13
|
+
* Replaces a number written with an exponent of 7 or more, with the stand-in
|
|
14
|
+
* for `infinity`. In a production build Tailwind minifies with Lightning CSS,
|
|
15
|
+
* which folds `rounded-full`'s `calc(infinity * 1px)` to the largest float,
|
|
16
|
+
* `3.40282e38px`, and Lynx doesn't read an exponent.
|
|
17
|
+
*/
|
|
18
|
+
export declare const clampHugeNumbers: (value: string) => string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rewrites every color function in a declaration value that it can evaluate
|
|
3
|
+
* statically. A function with `var()`, `calc()` or another dynamic part stays
|
|
4
|
+
* as it is: Lynx drops it, as before.
|
|
5
|
+
*/
|
|
6
|
+
export declare const lowerColors: (value: string, channelVariables?: ReadonlySet<string>) => string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { Root, Rule } from 'postcss';
|
|
2
|
+
/**
|
|
3
|
+
* Rewrites the declarations Tailwind CSS 4 writes into ones Lynx reads. Each
|
|
4
|
+
* rewrite keeps what the declaration means on the web, so the web preview
|
|
5
|
+
* and the native app keep matching.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* The single `transform` the `translate-*`, `rotate-*`, `scale-*`, `skew-*`
|
|
9
|
+
* and `rotate-{x,y,z}-*` utilities all write, composed from the variables
|
|
10
|
+
* each of them sets.
|
|
11
|
+
*
|
|
12
|
+
* Tailwind 4 writes the `translate`, `rotate` and `scale` properties, which
|
|
13
|
+
* Lynx doesn't have, so the utilities would do nothing on device. Lynx's own
|
|
14
|
+
* Tailwind 3 preset composes the same way. The order is the one CSS applies
|
|
15
|
+
* the individual properties in: translate, rotate, scale, then `transform`.
|
|
16
|
+
*/
|
|
17
|
+
export declare const COMPOSED_TRANSFORM: string;
|
|
18
|
+
/**
|
|
19
|
+
* The starting values of the variables {@link COMPOSED_TRANSFORM} reads that
|
|
20
|
+
* must be set for it to parse. The others have empty fallbacks.
|
|
21
|
+
*/
|
|
22
|
+
export declare const TRANSFORM_DEFAULTS: ReadonlyMap<string, string>;
|
|
23
|
+
/** What lowering a rule's declarations found, for the defaults rule. */
|
|
24
|
+
export type LoweredRule = {
|
|
25
|
+
/** Whether the rule now writes {@link COMPOSED_TRANSFORM}. */
|
|
26
|
+
readonly composesTransform: boolean;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Lowers every declaration of one rule. Works on the rule as a whole because
|
|
30
|
+
* the transform properties collapse into one declaration. `channelVariables`
|
|
31
|
+
* are the colors the stylesheet gives a `-rgb` channel variable (see
|
|
32
|
+
* colors.ts).
|
|
33
|
+
*/
|
|
34
|
+
export declare const lowerDeclarations: (rule: Rule, channelVariables?: ReadonlySet<string>) => LoweredRule;
|
|
35
|
+
/**
|
|
36
|
+
* Lowers the values of the transform variables, once the variables in them
|
|
37
|
+
* are resolved (see variables.ts): `calc(0.25rem * 2)` folds to `0.5rem`.
|
|
38
|
+
*/
|
|
39
|
+
export declare const lowerTransformVariables: (root: Root) => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { PluginCreator, Root, Rule } from 'postcss';
|
|
2
|
+
/**
|
|
3
|
+
* A PostCSS plugin that makes the CSS Tailwind CSS 4 writes work on Lynx. It
|
|
4
|
+
* runs after `@tailwindcss/postcss`, and only on the stylesheets Tailwind
|
|
5
|
+
* compiled, so every other stylesheet reaches Lynx as it was written.
|
|
6
|
+
*
|
|
7
|
+
* Tailwind 4 writes CSS for current browsers: cascade layers, `@property`,
|
|
8
|
+
* nesting, `oklch()` colors, `color-mix()`, logical properties and the
|
|
9
|
+
* individual `translate`/`rotate`/`scale` properties. Lynx reads none of
|
|
10
|
+
* them, and mostly drops them without a warning, while Lynx for Web passes
|
|
11
|
+
* them to the browser, so the web preview looks right and the app doesn't.
|
|
12
|
+
* Lynx's Tailwind preset avoids this for Tailwind 3 by changing the
|
|
13
|
+
* utilities; Tailwind 4 has no switch to turn its core utilities off, so this
|
|
14
|
+
* rewrites its output instead, into CSS with the same meaning that Lynx
|
|
15
|
+
* reads, on native and on the web alike. See
|
|
16
|
+
* investigations/lynx-vs-web-differences.md for what Lynx does with each.
|
|
17
|
+
*/
|
|
18
|
+
export declare const tailwindForLynx: PluginCreator<void>;
|
|
19
|
+
/**
|
|
20
|
+
* Lowers a stylesheet Tailwind 4 compiled. `createRule` makes the rule that
|
|
21
|
+
* holds the variables' starting values.
|
|
22
|
+
*/
|
|
23
|
+
export declare const lowerForLynx: (root: Root, createRule: (selector: string) => Rule) => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Every CSS property Lynx has, from the definitions its CSS engine is
|
|
3
|
+
* generated from (lynx-family/lynx, tools/css_generator/css_defines, as of
|
|
4
|
+
* October 2026). Add a property here when Lynx adds one.
|
|
5
|
+
*
|
|
6
|
+
* Tailwind CSS 4 has no way to turn a core utility off, and it generates
|
|
7
|
+
* every class it finds in the source, even a word in a string such as
|
|
8
|
+
* `uppercase`. Lynx drops a property it doesn't have, with a build warning,
|
|
9
|
+
* but Lynx for Web passes it to the browser, so the web preview would show
|
|
10
|
+
* styles the app never gets. Tailwind 3 avoided this with the Lynx preset's
|
|
11
|
+
* list of core plugins.
|
|
12
|
+
*/
|
|
13
|
+
export declare const LYNX_PROPERTIES: ReadonlySet<string>;
|
|
14
|
+
/**
|
|
15
|
+
* The keywords each of Lynx's keyword-only properties takes, from the same
|
|
16
|
+
* definitions. Tailwind 4 writes values Lynx doesn't have for some of them
|
|
17
|
+
* (`display: inline`, `position: static`, `white-space: pre`), which Lynx drops and
|
|
18
|
+
* the web preview would apply; the Lynx preset left those utilities out.
|
|
19
|
+
*/
|
|
20
|
+
export declare const LYNX_KEYWORDS: ReadonlyMap<string, ReadonlySet<string>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { Container, Root } from 'postcss';
|
|
2
|
+
/**
|
|
3
|
+
* Unwraps the CSS structure Tailwind CSS 4 writes and Lynx can't read:
|
|
4
|
+
* nesting, `@layer` blocks and `@property` registrations.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Moves nested rules and at-rules out to the top level, the way Sass does:
|
|
8
|
+
* `.a { &:hover { … } }` becomes `.a:hover { … }`, and
|
|
9
|
+
* `.a { @media (…) { … } }` becomes `@media (…) { .a { … } }`.
|
|
10
|
+
*
|
|
11
|
+
* Tailwind 4 writes its variants nested (`hover:`, `md:`, the `@supports`
|
|
12
|
+
* fallback of an opacity modifier). Lynx's CSS parser reads a nested rule as
|
|
13
|
+
* a descendant selector and never sees the `&`, and Lynx for Web throws on
|
|
14
|
+
* it, so neither applies them. A production build already arrives flattened
|
|
15
|
+
* (Tailwind minifies with Lightning CSS); a development build doesn't.
|
|
16
|
+
*/
|
|
17
|
+
export declare const flattenNesting: (root: Root) => void;
|
|
18
|
+
/**
|
|
19
|
+
* Replaces every `@layer` block with its contents and drops `@layer`
|
|
20
|
+
* statements.
|
|
21
|
+
*
|
|
22
|
+
* Lynx ignores a rule inside `@layer`, on native and on the web, so none of
|
|
23
|
+
* Tailwind 4's CSS would apply. Tailwind writes its layers in cascade order
|
|
24
|
+
* (theme, base, components, utilities), so keeping the source order keeps
|
|
25
|
+
* the cascade between them.
|
|
26
|
+
*/
|
|
27
|
+
export declare const unwrapLayers: (container: Container) => void;
|
|
28
|
+
/**
|
|
29
|
+
* Removes the `@property` registrations and returns the custom properties
|
|
30
|
+
* that have an initial value, with that value.
|
|
31
|
+
*
|
|
32
|
+
* Lynx has no `@property`, so a variable Tailwind registers with an initial
|
|
33
|
+
* value (`--tw-border-style: solid`, `--tw-translate-x: 0`) is unset until a
|
|
34
|
+
* utility sets it, and every value that reads it breaks: `border` draws no
|
|
35
|
+
* border. A registration without an initial value is left out on purpose: the
|
|
36
|
+
* variable stays unset, so the `var()` fallbacks Tailwind writes apply.
|
|
37
|
+
*/
|
|
38
|
+
export declare const takePropertyRegistrations: (root: Root) => Map<string, string>;
|
|
39
|
+
/**
|
|
40
|
+
* Removes the rules and at-rules the steps above left empty, such as a
|
|
41
|
+
* nested rule's parent that held only nested rules.
|
|
42
|
+
*/
|
|
43
|
+
export declare const removeEmptyContainers: (container: Container) => void;
|
|
44
|
+
/**
|
|
45
|
+
* Writes out the `from` and `to` keyframes an animation leaves implied.
|
|
46
|
+
*
|
|
47
|
+
* Lynx doesn't play an animation that lacks either, and Tailwind's `spin`
|
|
48
|
+
* has only `to`, `ping` no `from`, and `pulse` neither, so `animate-spin`
|
|
49
|
+
* did nothing on device.
|
|
50
|
+
*/
|
|
51
|
+
export declare const completeKeyframes: (root: Root) => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Root } from 'postcss';
|
|
2
|
+
/**
|
|
3
|
+
* Resolves the `var()` references that Lynx can't, inside the custom
|
|
4
|
+
* properties Tailwind CSS 4 sets.
|
|
5
|
+
*
|
|
6
|
+
* Lynx substitutes a `var()` that a custom property's value holds directly
|
|
7
|
+
* (`--tw-gradient-from: var(--color-red-500)`), but not one inside another
|
|
8
|
+
* function: `--tw-translate-x: calc(var(--spacing) * 2)` and
|
|
9
|
+
* `--tw-blur: blur(var(--blur-sm))` leave the property invalid, so the
|
|
10
|
+
* utility does nothing on device. That holds even when the variable is set
|
|
11
|
+
* in the same rule or the `var()` has a fallback.
|
|
12
|
+
*
|
|
13
|
+
* Each such reference becomes a value this stylesheet already knows: the
|
|
14
|
+
* variable's declaration in the same rule, else its theme value (the
|
|
15
|
+
* `:root` rule Tailwind writes), else the reference's fallback, else the
|
|
16
|
+
* initial value Tailwind registered with `@property`. Only a variable set by
|
|
17
|
+
* another utility on the same element, such as `ring-offset-2`'s width under
|
|
18
|
+
* `ring-2`, loses its effect, since the value is now fixed.
|
|
19
|
+
*/
|
|
20
|
+
export declare const resolveNestedVariables: (root: Root, registrations: ReadonlyMap<string, string>) => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/tailwind.d.ts
CHANGED
|
@@ -1,2 +1,16 @@
|
|
|
1
1
|
import type { RsbuildPluginAPI } from '@lynx-js/rspeedy';
|
|
2
|
+
/**
|
|
3
|
+
* Sets Tailwind CSS up for the app, either version:
|
|
4
|
+
*
|
|
5
|
+
* - **Tailwind 3** runs when the app has a `tailwind.config.*`, the way
|
|
6
|
+
* Angular CLI sets it up. Its config uses `@lynx-js/tailwind-preset`.
|
|
7
|
+
* - **Tailwind 4** runs when the app's PostCSS config lists
|
|
8
|
+
* `@tailwindcss/postcss` (`.postcssrc.json`, which `ng add` writes as
|
|
9
|
+
* Angular CLI's own Tailwind setup does). Rsbuild loads that config itself.
|
|
10
|
+
*
|
|
11
|
+
* Either way, a PostCSS plugin added after Tailwind rewrites the CSS
|
|
12
|
+
* Tailwind 4 writes into CSS Lynx reads (see tailwind-v4/index.ts). It only
|
|
13
|
+
* touches the stylesheets Tailwind 4 compiled, so it adds nothing to a
|
|
14
|
+
* Tailwind 3 build or a build without Tailwind.
|
|
15
|
+
*/
|
|
2
16
|
export declare const applyTailwind: (api: RsbuildPluginAPI) => void;
|
|
@@ -1,4 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* The stylesheets extracted from one module's components (see
|
|
3
|
+
* component-styles.ts), written as CSS files.
|
|
4
|
+
*/
|
|
5
|
+
export type ModuleStylesheets = {
|
|
6
|
+
/** The CSS files, in the order the module's components declare them. */
|
|
7
|
+
imports: string[];
|
|
8
|
+
/** Each Emulated component's class name and the scope ID its CSS uses. */
|
|
9
|
+
scopes: Array<{
|
|
10
|
+
className: string;
|
|
11
|
+
scopeId: string;
|
|
12
|
+
}>;
|
|
13
|
+
};
|
|
2
14
|
/**
|
|
3
15
|
* Transforms the Angular-compiled JS for a single component module before rspack
|
|
4
16
|
* bundles it. This is the per-module half of the AngularLynx pipeline, extracted
|
|
@@ -6,26 +18,40 @@ import type { ComponentScopeInfo, ComponentStylesEntry } from './component-style
|
|
|
6
18
|
* string→string function (no rspack loader context, no compilation cache).
|
|
7
19
|
*
|
|
8
20
|
* It applies, in order:
|
|
9
|
-
* 1. Prepends `import "<
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
21
|
+
* 1. Prepends `import "<component.css>"` statements for the stylesheets
|
|
22
|
+
* extracted from the module's components (resolved relative to the
|
|
23
|
+
* component file).
|
|
24
|
+
* 2. Appends a `Component.ɵcmp.id = '<scopeId>'` assignment for each
|
|
25
|
+
* Emulated component, which ties its scoped CSS to its renderer.
|
|
13
26
|
* 3. Runs the worklet ("main thread" directive) transform over the result.
|
|
27
|
+
* 4. Runs the cross-thread transform (cross-thread-transform.ts), which gives
|
|
28
|
+
* module-level background functions and refs IDs that match on both
|
|
29
|
+
* threads.
|
|
30
|
+
* 5. In a development build with hot updates (`hot` is set), makes the
|
|
31
|
+
* module take them (hot-updates.ts): an entry module re-bootstraps the
|
|
32
|
+
* app, and a module that defines components updates them in place when
|
|
33
|
+
* only their templates or styles changed. Other modules pass their
|
|
34
|
+
* updates on to the modules that import them.
|
|
14
35
|
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
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.
|
|
36
|
+
* The hot update clients apply each update on both threads (see client/).
|
|
37
|
+
* Before they did, only the background thread took hot updates, so a
|
|
38
|
+
* self-accepting entry (which an earlier version had) re-bootstrapped the
|
|
39
|
+
* background thread's copy of the app while the main thread, which draws the
|
|
40
|
+
* screen, kept running the old code.
|
|
25
41
|
*/
|
|
26
42
|
export declare const buildTransformedCode: (params: {
|
|
27
43
|
code: string;
|
|
28
44
|
resourcePath: string;
|
|
29
|
-
|
|
30
|
-
|
|
45
|
+
stylesheets: ModuleStylesheets | undefined;
|
|
46
|
+
/** The project root, which cross-thread IDs are relative to. */
|
|
47
|
+
root: string;
|
|
48
|
+
/**
|
|
49
|
+
* Set in a development build with hot updates. `entry` says whether the
|
|
50
|
+
* module is one of the app's entries, and `source` reads its TypeScript
|
|
51
|
+
* source.
|
|
52
|
+
*/
|
|
53
|
+
hot?: {
|
|
54
|
+
entry: boolean;
|
|
55
|
+
source: () => string;
|
|
56
|
+
};
|
|
31
57
|
}) => string;
|
|
@@ -5,8 +5,10 @@
|
|
|
5
5
|
* (for "Lynx") differentiates these from Angular's default 'ng' prefix IDs,
|
|
6
6
|
* preventing collisions if browser-Angular scope IDs leak into shared code.
|
|
7
7
|
* This ID appears in:
|
|
8
|
-
* - CSS
|
|
9
|
-
*
|
|
10
|
-
* -
|
|
8
|
+
* - the component's compiled CSS: `.title._ngcontent-l<hash>`,
|
|
9
|
+
* `._nghost-l<hash>` (see component-styles.ts)
|
|
10
|
+
* - ɵcmp.id: set by the loader (see transform-module.ts)
|
|
11
|
+
* - the `_ngcontent-l<hash>` and `_nghost-l<hash>` classes that
|
|
12
|
+
* EmulatedLynxRenderer adds to the component's elements
|
|
11
13
|
*/
|
|
12
14
|
export declare const generateComponentScopeId: (className: string, containingFile: string) => string;
|
package/dist/utils/options.d.ts
CHANGED
|
@@ -2,14 +2,29 @@ export type PluginAngularLynxOptions = {
|
|
|
2
2
|
customCSSInheritanceList?: string[] | undefined;
|
|
3
3
|
debugInfoOutside?: boolean;
|
|
4
4
|
defaultDisplayLinear?: boolean;
|
|
5
|
+
/**
|
|
6
|
+
* Make `overflow: visible` the default for every element, as on the web.
|
|
7
|
+
* With `false`, elements clip their children unless they set `overflow`,
|
|
8
|
+
* Lynx's older default.
|
|
9
|
+
*/
|
|
5
10
|
defaultOverflowVisible?: boolean;
|
|
6
11
|
enableA11y?: boolean;
|
|
7
12
|
enableAccessibilityElement?: boolean;
|
|
8
13
|
enableCSSInheritance?: boolean;
|
|
9
14
|
enableCSSInvalidation?: boolean;
|
|
10
15
|
enableCSSSelector?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* @deprecated Has no effect, and never did: it was never passed to Lynx.
|
|
18
|
+
* Lynx's template plugin and React Lynx dropped it too. Will be removed in
|
|
19
|
+
* a future release.
|
|
20
|
+
*/
|
|
11
21
|
enableICU?: boolean;
|
|
12
22
|
enableNewGesture?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* @deprecated Has no effect, and never did: it was never passed to Lynx.
|
|
25
|
+
* Lynx's template plugin and React Lynx dropped it too. Will be removed in
|
|
26
|
+
* a future release.
|
|
27
|
+
*/
|
|
13
28
|
enableParallelElement?: boolean;
|
|
14
29
|
enableRemoveCSSScope?: boolean;
|
|
15
30
|
enableSSR?: boolean;
|
|
@@ -23,9 +38,33 @@ export type PluginAngularLynxOptions = {
|
|
|
23
38
|
* When omitted, uses `source.entry` from lynx.config.ts (single or multi-entry).
|
|
24
39
|
*/
|
|
25
40
|
pages?: string[] | 'all' | undefined;
|
|
41
|
+
/**
|
|
42
|
+
* @deprecated Has no effect, and never did: it was never passed to Lynx.
|
|
43
|
+
* Lynx's template plugin and React Lynx dropped it too. Will be removed in
|
|
44
|
+
* a future release.
|
|
45
|
+
*/
|
|
26
46
|
pipelineSchedulerConfig?: number;
|
|
27
47
|
removeDescendantSelectorScope?: boolean;
|
|
28
48
|
targetSdkVersion?: string;
|
|
29
49
|
experimental_isLazyBundle?: boolean;
|
|
30
50
|
};
|
|
31
|
-
|
|
51
|
+
/**
|
|
52
|
+
* Options the plugin still accepts, so existing `lynx.config.ts` files keep
|
|
53
|
+
* type-checking, but ignores. They were declared and given defaults but never
|
|
54
|
+
* passed to Lynx, and `@lynx-js/template-webpack-plugin` 0.9 removed them
|
|
55
|
+
* (lynx-family/lynx-stack#1705, #1800), so there's nothing to pass them to:
|
|
56
|
+
*
|
|
57
|
+
* - `enableParallelElement` and `pipelineSchedulerConfig` turn on Lynx's
|
|
58
|
+
* experimental parallel element resolution, which React Lynx turned off for
|
|
59
|
+
* stability.
|
|
60
|
+
* - `enableICU` binds a host-provided ICU service (`LynxServiceI18nProtocol`
|
|
61
|
+
* on iOS, `ICURegister` on Android) into the JS context. Lynx Explorer and
|
|
62
|
+
* the apps `ng build --platform` makes don't provide one.
|
|
63
|
+
*/
|
|
64
|
+
export declare const DEPRECATED_OPTIONS: readonly ["enableICU", "enableParallelElement", "pipelineSchedulerConfig"];
|
|
65
|
+
type DeprecatedOption = (typeof DEPRECATED_OPTIONS)[number];
|
|
66
|
+
export type NormalizedPluginAngularLynxOptions = Required<Omit<PluginAngularLynxOptions, DeprecatedOption>>;
|
|
67
|
+
/** The deprecated options `options` sets, to warn about. */
|
|
68
|
+
export declare const deprecatedOptionsIn: (options?: Partial<PluginAngularLynxOptions>) => DeprecatedOption[];
|
|
69
|
+
export declare const normalizeOptions: (options?: Partial<PluginAngularLynxOptions>) => NormalizedPluginAngularLynxOptions;
|
|
70
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blotch/rsbuild-plugin-angular-lynx",
|
|
3
|
-
"version": "22.2.
|
|
3
|
+
"version": "22.2.4",
|
|
4
4
|
"description": "Rsbuild plugin for building AngularLynx applications",
|
|
5
5
|
"homepage": "https://github.com/Blotch-Smart-Frames/AngularLynx#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"@lynx-js/runtime-wrapper-webpack-plugin": "^0.2.4",
|
|
46
46
|
"@lynx-js/template-webpack-plugin": "^0.16.2",
|
|
47
47
|
"@lynx-js/webpack-runtime-globals": "^0.0.8",
|
|
48
|
-
"
|
|
48
|
+
"postcss-value-parser": "^4.2.0",
|
|
49
49
|
"tiny-invariant": "^1.3.3"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
@@ -54,7 +54,10 @@
|
|
|
54
54
|
"@rsbuild/core": "^2.2.9",
|
|
55
55
|
"@rslib/core": "^0.21.4",
|
|
56
56
|
"@rspack/core": "^2.2.8",
|
|
57
|
+
"@tailwindcss/postcss": "^4.3.3",
|
|
57
58
|
"@types/node": "^25.6.2",
|
|
59
|
+
"postcss": "^8.5.6",
|
|
60
|
+
"tailwindcss": "^4.3.3",
|
|
58
61
|
"type-fest": "^5.6.0",
|
|
59
62
|
"typescript": "^6.0.3"
|
|
60
63
|
},
|
|
@@ -1,8 +0,0 @@
|
|
|
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;
|