@weapp-tailwindcss/react-native 0.3.5 → 0.3.6
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/dist/babel.d.cts +6 -0
- package/dist/babel.d.ts +1 -1
- package/dist/compiler.d.cts +7 -0
- package/dist/env.d.cts +10 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +7 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/metro-BdsKKvRn.d.cts +63 -0
- package/dist/metro-transformer.d.cts +2 -0
- package/dist/metro.d.cts +2 -0
- package/dist/{runtime-BivP43Uy.cjs → runtime-CbkbHrPb.cjs} +2 -1
- package/dist/runtime-D4ZGX6yk.d.cts +42 -0
- package/dist/{runtime-BzHdtM5_.js → runtime-DuvYZu4P.js} +2 -1
- package/dist/{runtime-Bm9mAKDC.d.ts → runtime-YHlnn5ip.d.ts} +8 -3
- package/dist/runtime.cjs +1 -1
- package/dist/runtime.d.cts +3 -0
- package/dist/runtime.d.ts +1 -1
- package/dist/runtime.js +1 -1
- package/dist/tailwind-CfKLPJuW.d.cts +13 -0
- package/dist/tailwind.d.cts +2 -0
- package/dist/types-CxNMLBiF.d.cts +20 -0
- package/package.json +69 -28
package/dist/babel.d.cts
ADDED
package/dist/babel.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { PluginObject, PluginPass } from "@babel/core";
|
|
2
1
|
import * as t from "@babel/types";
|
|
2
|
+
import { PluginObject, PluginPass } from "@babel/core";
|
|
3
3
|
export interface WeappReactNativeBabelOptions {
|
|
4
4
|
classNameSet?: Iterable<string> | undefined;
|
|
5
5
|
/** Metro 生成的 token -> StyleSheet ID lookup。 */
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { a as NativeStyleManifest, t as CompileNativeStylesheetOptions } from "./types-CxNMLBiF.cjs";
|
|
2
|
+
import { baseClassName } from "@weapp-tailwindcss/postcss/native";
|
|
3
|
+
export declare function addNativeVariantRules(manifest: NativeStyleManifest, candidates: Iterable<string>): void;
|
|
4
|
+
/** 为 manifest 生成稳定的 StyleSheet ID 和 Babel 静态 lookup。 */
|
|
5
|
+
export declare function finalizeNativeManifest(manifest: NativeStyleManifest): NativeStyleManifest;
|
|
6
|
+
export declare function compileNativeStylesheet(css: string, options?: CompileNativeStylesheetOptions): NativeStyleManifest;
|
|
7
|
+
export { baseClassName };
|
package/dist/env.d.cts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** 供业务组件复用的 React Native className 属性。 */
|
|
2
|
+
export interface NativeClassNameProps {
|
|
3
|
+
className?: string | undefined;
|
|
4
|
+
}
|
|
5
|
+
declare module 'react-native' {
|
|
6
|
+
interface ViewProps extends NativeClassNameProps {}
|
|
7
|
+
interface TextProps extends NativeClassNameProps {}
|
|
8
|
+
interface ImageProps extends NativeClassNameProps {}
|
|
9
|
+
interface ScrollViewProps extends NativeClassNameProps {}
|
|
10
|
+
}
|
package/dist/index.cjs
CHANGED
|
@@ -2,7 +2,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
2
2
|
const require_babel = require("./babel.cjs");
|
|
3
3
|
const require_compiler = require("./compiler.cjs");
|
|
4
4
|
const require_metro = require("./metro-kaKzXOAU.cjs");
|
|
5
|
-
const require_runtime = require("./runtime-
|
|
5
|
+
const require_runtime = require("./runtime-CbkbHrPb.cjs");
|
|
6
6
|
const require_tailwind = require("./tailwind-CVspvWID.cjs");
|
|
7
7
|
exports.VIRTUAL_MANIFEST_MODULE = require_metro.VIRTUAL_MANIFEST_MODULE;
|
|
8
8
|
exports.babelPlugin = require_babel;
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import weappReactNativeBabel from "./babel.cjs";
|
|
2
|
+
import { a as NativeStyleManifest, i as NativePlatform, n as NativeCompilerWarning, o as NativeStyleRule, r as NativeManifestPublication, t as CompileNativeStylesheetOptions } from "./types-CxNMLBiF.cjs";
|
|
3
|
+
import { compileNativeStylesheet } from "./compiler.cjs";
|
|
4
|
+
import { d as getRegisteredSnapshotByPath, f as getRegisteredSnapshotByProjectRoot, h as getVirtualModuleCodeAsync, m as getVirtualModuleCode, o as withWeappTailwindcss, r as VIRTUAL_MANIFEST_MODULE, s as getRegisteredManifest, u as getRegisteredSnapshot } from "./metro-BdsKKvRn.cjs";
|
|
5
|
+
import { a as getStaticStyle, c as setStyleSheetFactory, d as NativeStyleEnvironment, f as NativeStyleRuntime, i as getPublication, l as tw, n as createNativeStyleRuntime, o as setEnvironment, p as NativeStyleValue, r as getManifest, s as setManifest, t as composeStyle, u as NativeClassValue } from "./runtime-D4ZGX6yk.cjs";
|
|
6
|
+
import { n as generateNativeStylesheet } from "./tailwind-CfKLPJuW.cjs";
|
|
7
|
+
export { type CompileNativeStylesheetOptions, type NativeClassValue, type NativeCompilerWarning, type NativeManifestPublication, type NativePlatform, type NativeStyleEnvironment, type NativeStyleManifest, type NativeStyleRule, type NativeStyleRuntime, type NativeStyleValue, VIRTUAL_MANIFEST_MODULE, weappReactNativeBabel as babelPlugin, compileNativeStylesheet, composeStyle, createNativeStyleRuntime, generateNativeStylesheet, getManifest, getPublication, getRegisteredManifest, getRegisteredSnapshot, getRegisteredSnapshotByPath, getRegisteredSnapshotByProjectRoot, getStaticStyle, getVirtualModuleCode, getVirtualModuleCodeAsync, setEnvironment, setManifest, setStyleSheetFactory, tw, withWeappTailwindcss };
|
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,6 @@ import weappReactNativeBabel from "./babel.js";
|
|
|
2
2
|
import { a as NativeStyleManifest, i as NativePlatform, n as NativeCompilerWarning, o as NativeStyleRule, r as NativeManifestPublication, t as CompileNativeStylesheetOptions } from "./types-CxNMLBiF.js";
|
|
3
3
|
import { compileNativeStylesheet } from "./compiler.js";
|
|
4
4
|
import { d as getRegisteredSnapshotByPath, f as getRegisteredSnapshotByProjectRoot, h as getVirtualModuleCodeAsync, m as getVirtualModuleCode, o as withWeappTailwindcss, r as VIRTUAL_MANIFEST_MODULE, s as getRegisteredManifest, u as getRegisteredSnapshot } from "./metro-ahmChgsA.js";
|
|
5
|
-
import { a as getStaticStyle, c as setStyleSheetFactory, d as NativeStyleEnvironment, f as NativeStyleRuntime, i as getPublication, l as tw, n as createNativeStyleRuntime, o as setEnvironment, p as NativeStyleValue, r as getManifest, s as setManifest, t as composeStyle, u as NativeClassValue } from "./runtime-
|
|
5
|
+
import { a as getStaticStyle, c as setStyleSheetFactory, d as NativeStyleEnvironment, f as NativeStyleRuntime, i as getPublication, l as tw, n as createNativeStyleRuntime, o as setEnvironment, p as NativeStyleValue, r as getManifest, s as setManifest, t as composeStyle, u as NativeClassValue } from "./runtime-YHlnn5ip.js";
|
|
6
6
|
import { n as generateNativeStylesheet } from "./tailwind-4T0v_pRK.js";
|
|
7
7
|
export { type CompileNativeStylesheetOptions, type NativeClassValue, type NativeCompilerWarning, type NativeManifestPublication, type NativePlatform, type NativeStyleEnvironment, type NativeStyleManifest, type NativeStyleRule, type NativeStyleRuntime, type NativeStyleValue, VIRTUAL_MANIFEST_MODULE, weappReactNativeBabel as babelPlugin, compileNativeStylesheet, composeStyle, createNativeStyleRuntime, generateNativeStylesheet, getManifest, getPublication, getRegisteredManifest, getRegisteredSnapshot, getRegisteredSnapshotByPath, getRegisteredSnapshotByProjectRoot, getStaticStyle, getVirtualModuleCode, getVirtualModuleCodeAsync, setEnvironment, setManifest, setStyleSheetFactory, tw, withWeappTailwindcss };
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import weappReactNativeBabel from "./babel.js";
|
|
2
2
|
import { compileNativeStylesheet } from "./compiler.js";
|
|
3
3
|
import { c as getRegisteredSnapshotByPath, d as getVirtualModuleCode, f as getVirtualModuleCodeAsync, i as getRegisteredManifest, l as getRegisteredSnapshotByProjectRoot, r as withWeappTailwindcss, s as getRegisteredSnapshot, t as VIRTUAL_MANIFEST_MODULE } from "./metro-OMh6z1jy.js";
|
|
4
|
-
import { a as getStaticStyle, c as setStyleSheetFactory, i as getPublication, l as tw, n as createNativeStyleRuntime, o as setEnvironment, r as getManifest, s as setManifest, t as composeStyle } from "./runtime-
|
|
4
|
+
import { a as getStaticStyle, c as setStyleSheetFactory, i as getPublication, l as tw, n as createNativeStyleRuntime, o as setEnvironment, r as getManifest, s as setManifest, t as composeStyle } from "./runtime-DuvYZu4P.js";
|
|
5
5
|
import { t as generateNativeStylesheet } from "./tailwind-B1Gl9P_t.js";
|
|
6
6
|
export { VIRTUAL_MANIFEST_MODULE, weappReactNativeBabel as babelPlugin, compileNativeStylesheet, composeStyle, createNativeStyleRuntime, generateNativeStylesheet, getManifest, getPublication, getRegisteredManifest, getRegisteredSnapshot, getRegisteredSnapshotByPath, getRegisteredSnapshotByProjectRoot, getStaticStyle, getVirtualModuleCode, getVirtualModuleCodeAsync, setEnvironment, setManifest, setStyleSheetFactory, tw, withWeappTailwindcss };
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { a as NativeStyleManifest, r as NativeManifestPublication } from "./types-CxNMLBiF.cjs";
|
|
2
|
+
interface NativeManifestSnapshot {
|
|
3
|
+
version: number;
|
|
4
|
+
manifest: NativeStyleManifest;
|
|
5
|
+
manifestJson: string;
|
|
6
|
+
virtualPath: string;
|
|
7
|
+
publication?: NativeManifestPublication;
|
|
8
|
+
}
|
|
9
|
+
interface RegisteredManifest {
|
|
10
|
+
readonly version: number;
|
|
11
|
+
readonly manifest: NativeManifestSnapshot['manifest'];
|
|
12
|
+
snapshot: NativeManifestSnapshot;
|
|
13
|
+
projectRoot: string;
|
|
14
|
+
virtualPath: string;
|
|
15
|
+
manifestPath: string;
|
|
16
|
+
manifestReadyPath: string;
|
|
17
|
+
ready: Promise<void>;
|
|
18
|
+
refresh: () => Promise<void>;
|
|
19
|
+
}
|
|
20
|
+
declare function getRegisteredVirtualModule(filename: string): Readonly<RegisteredManifest> | undefined;
|
|
21
|
+
declare function getRegisteredSnapshot(id: string): Promise<NativeManifestSnapshot | undefined>;
|
|
22
|
+
/** 文件路径与项目根目录查询均选择最近注册的入口,不能混用两个实例的身份。 */
|
|
23
|
+
declare function getRegisteredSnapshotByPath(filename: string): Promise<NativeManifestSnapshot | undefined>;
|
|
24
|
+
declare function getRegisteredSnapshotByProjectRoot(projectRoot: string): Promise<NativeManifestSnapshot | undefined>;
|
|
25
|
+
declare function getRegisteredManifest(id: string): Promise<NativeStyleManifest | undefined>;
|
|
26
|
+
declare function getRegisteredManifestByPath(filename: string): Promise<NativeStyleManifest | undefined>;
|
|
27
|
+
declare function getRegisteredManifestByProjectRoot(projectRoot: string): Promise<NativeStyleManifest | undefined>;
|
|
28
|
+
/** 同步读取最近快照供诊断;只有异步入口会等待当前发布成功。 */
|
|
29
|
+
declare function getVirtualModuleCode(filename: string): string | undefined;
|
|
30
|
+
declare function getVirtualModuleCodeAsync(filename: string): Promise<string | undefined>;
|
|
31
|
+
declare const VIRTUAL_MANIFEST_MODULE = "@weapp-tailwindcss/react-native/virtual";
|
|
32
|
+
interface MetroConfigLike {
|
|
33
|
+
resolver?: {
|
|
34
|
+
extraNodeModules?: Record<string, string>;
|
|
35
|
+
sourceExts?: string[];
|
|
36
|
+
resolveRequest?: (context: unknown, moduleName: string, platform?: string) => unknown;
|
|
37
|
+
[key: string]: unknown;
|
|
38
|
+
};
|
|
39
|
+
transformer?: Record<string, unknown>;
|
|
40
|
+
transformerPath?: string;
|
|
41
|
+
watchFolders?: string[];
|
|
42
|
+
server?: Record<string, unknown>;
|
|
43
|
+
[key: string]: unknown;
|
|
44
|
+
}
|
|
45
|
+
interface WeappReactNativeMetroOptions {
|
|
46
|
+
projectRoot?: string | undefined;
|
|
47
|
+
input?: string | undefined;
|
|
48
|
+
css?: string | undefined;
|
|
49
|
+
manifest?: NativeStyleManifest | undefined;
|
|
50
|
+
classSet?: Iterable<string> | undefined;
|
|
51
|
+
sourceGlobs?: string[] | undefined;
|
|
52
|
+
watchFiles?: string[] | undefined;
|
|
53
|
+
}
|
|
54
|
+
interface NativeManifestPaths {
|
|
55
|
+
manifestPath: string;
|
|
56
|
+
manifestReadyPath: string;
|
|
57
|
+
}
|
|
58
|
+
/** 为 Metro worker 提供不依赖进程内 registry 的 manifest 入口。 */
|
|
59
|
+
declare function getManifestPathsForProjectRoot(projectRoot: string): NativeManifestPaths;
|
|
60
|
+
declare function withWeappTailwindcss<T extends MetroConfigLike>(config: T, options?: WeappReactNativeMetroOptions): T & MetroConfigLike;
|
|
61
|
+
declare function withWeappTailwindcss<T extends MetroConfigLike>(config: Promise<T> | (() => T | Promise<T>), options?: WeappReactNativeMetroOptions): Promise<T & MetroConfigLike>;
|
|
62
|
+
declare function withWeappTailwindcss<T extends MetroConfigLike>(config: T | Promise<T> | (() => T | Promise<T>), options?: WeappReactNativeMetroOptions): (T & MetroConfigLike) | Promise<T & MetroConfigLike>;
|
|
63
|
+
export { getManifestPathsForProjectRoot as a, getRegisteredManifestByPath as c, getRegisteredSnapshotByPath as d, getRegisteredSnapshotByProjectRoot as f, getVirtualModuleCodeAsync as h, WeappReactNativeMetroOptions as i, getRegisteredManifestByProjectRoot as l, getVirtualModuleCode as m, NativeManifestPaths as n, withWeappTailwindcss as o, getRegisteredVirtualModule as p, VIRTUAL_MANIFEST_MODULE as r, getRegisteredManifest as s, MetroConfigLike as t, getRegisteredSnapshot as u };
|
package/dist/metro.d.cts
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as getManifestPathsForProjectRoot, c as getRegisteredManifestByPath, d as getRegisteredSnapshotByPath, f as getRegisteredSnapshotByProjectRoot, h as getVirtualModuleCodeAsync, i as WeappReactNativeMetroOptions, l as getRegisteredManifestByProjectRoot, m as getVirtualModuleCode, n as NativeManifestPaths, o as withWeappTailwindcss, p as getRegisteredVirtualModule, r as VIRTUAL_MANIFEST_MODULE, s as getRegisteredManifest, t as MetroConfigLike, u as getRegisteredSnapshot } from "./metro-BdsKKvRn.cjs";
|
|
2
|
+
export { MetroConfigLike, NativeManifestPaths, VIRTUAL_MANIFEST_MODULE, WeappReactNativeMetroOptions, getManifestPathsForProjectRoot, getRegisteredManifest, getRegisteredManifestByPath, getRegisteredManifestByProjectRoot, getRegisteredSnapshot, getRegisteredSnapshotByPath, getRegisteredSnapshotByProjectRoot, getRegisteredVirtualModule, getVirtualModuleCode, getVirtualModuleCodeAsync, withWeappTailwindcss };
|
|
@@ -170,7 +170,8 @@ let styleSheetFactory;
|
|
|
170
170
|
let styleSheetFlattener;
|
|
171
171
|
let styleSheetRevision = 0;
|
|
172
172
|
function resolveRegisteredStyle(value) {
|
|
173
|
-
|
|
173
|
+
const resolved = styleSheetFlattener?.(value);
|
|
174
|
+
return resolved && typeof resolved === "object" && !Array.isArray(resolved) ? resolved : void 0;
|
|
174
175
|
}
|
|
175
176
|
function createStyleSheet(manifest) {
|
|
176
177
|
const revision = styleSheetRevision;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { a as NativeStyleManifest, i as NativePlatform, r as NativeManifestPublication } from "./types-CxNMLBiF.cjs";
|
|
2
|
+
type FalsyStyle = undefined | null | false | '';
|
|
3
|
+
type RegisteredStyle<T> = number & {
|
|
4
|
+
__registeredStyleBrand: T;
|
|
5
|
+
};
|
|
6
|
+
interface RecursiveStyleArray<T> extends Array<T | ReadonlyArray<T> | RecursiveStyleArray<T>> {}
|
|
7
|
+
type StyleRecord = Record<string, unknown>;
|
|
8
|
+
interface NativeStyleEnvironment {
|
|
9
|
+
colorScheme?: 'light' | 'dark' | undefined;
|
|
10
|
+
platform?: NativePlatform | undefined;
|
|
11
|
+
/** 未在当前元素指定字号时,调用方可显式传入已知的继承字号。 */
|
|
12
|
+
fontSize?: number | undefined;
|
|
13
|
+
/** 当前元素没有文字颜色时,调用方可显式提供已知的继承颜色。 */
|
|
14
|
+
color?: string | undefined;
|
|
15
|
+
}
|
|
16
|
+
type NativeClassValue = string | false | null | undefined | NativeClassValue[] | Record<string, boolean>;
|
|
17
|
+
type NativeStyleValue = StyleRecord | RegisteredStyle<StyleRecord> | RecursiveStyleArray<StyleRecord | RegisteredStyle<StyleRecord> | FalsyStyle> | FalsyStyle;
|
|
18
|
+
interface NativeStyleRuntime {
|
|
19
|
+
tw: (value: NativeClassValue, environment?: NativeStyleEnvironment) => NativeStyleValue;
|
|
20
|
+
getStaticStyle: (ids: readonly string[], environment?: NativeStyleEnvironment) => NativeStyleValue;
|
|
21
|
+
composeStyle: <const InlineStyle>(tailwindStyle: NativeStyleValue, inlineStyle: InlineStyle) => [NativeStyleValue, InlineStyle] | [NativeStyleValue, InlineStyle, NativeStyleValue];
|
|
22
|
+
setManifest: (manifest: NativeStyleManifest, publication?: NativeManifestPublication) => void;
|
|
23
|
+
setEnvironment: (environment: NativeStyleEnvironment) => void;
|
|
24
|
+
getManifest: () => NativeStyleManifest | undefined;
|
|
25
|
+
getPublication: () => NativeManifestPublication | undefined;
|
|
26
|
+
}
|
|
27
|
+
interface StyleValue {
|
|
28
|
+
[key: string]: unknown;
|
|
29
|
+
}
|
|
30
|
+
type StyleSheetFactory = (value: Record<string, StyleValue>) => Record<string, NativeStyleValue>;
|
|
31
|
+
type StyleSheetFlattener = (value: NativeStyleValue) => unknown;
|
|
32
|
+
declare function createNativeStyleRuntime(initialManifest?: NativeStyleManifest, initialPublication?: NativeManifestPublication): NativeStyleRuntime;
|
|
33
|
+
declare function setManifest(manifest: NativeStyleManifest, publication?: NativeManifestPublication): void;
|
|
34
|
+
/** 由 Expo virtual module 注入,避免 runtime 引入 Node-only 的 require shim。 */
|
|
35
|
+
declare function setStyleSheetFactory(factory: StyleSheetFactory, flatten?: StyleSheetFlattener): void;
|
|
36
|
+
declare function setEnvironment(environment: NativeStyleEnvironment): void;
|
|
37
|
+
declare function getManifest(): NativeStyleManifest | undefined;
|
|
38
|
+
declare function getPublication(): NativeManifestPublication | undefined;
|
|
39
|
+
declare function tw(value: NativeClassValue, environment?: NativeStyleEnvironment): NativeStyleValue;
|
|
40
|
+
declare function getStaticStyle(ids: readonly string[], environment?: NativeStyleEnvironment): NativeStyleValue;
|
|
41
|
+
declare function composeStyle<const InlineStyle>(tailwindStyle: NativeStyleValue, inlineStyle: InlineStyle): [NativeStyleValue, InlineStyle] | [NativeStyleValue, InlineStyle, NativeStyleValue];
|
|
42
|
+
export { getStaticStyle as a, setStyleSheetFactory as c, NativeStyleEnvironment as d, NativeStyleRuntime as f, getPublication as i, tw as l, createNativeStyleRuntime as n, setEnvironment as o, NativeStyleValue as p, getManifest as r, setManifest as s, composeStyle as t, NativeClassValue as u };
|
|
@@ -170,7 +170,8 @@ let styleSheetFactory;
|
|
|
170
170
|
let styleSheetFlattener;
|
|
171
171
|
let styleSheetRevision = 0;
|
|
172
172
|
function resolveRegisteredStyle(value) {
|
|
173
|
-
|
|
173
|
+
const resolved = styleSheetFlattener?.(value);
|
|
174
|
+
return resolved && typeof resolved === "object" && !Array.isArray(resolved) ? resolved : void 0;
|
|
174
175
|
}
|
|
175
176
|
function createStyleSheet(manifest) {
|
|
176
177
|
const revision = styleSheetRevision;
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { a as NativeStyleManifest, i as NativePlatform, r as NativeManifestPublication } from "./types-CxNMLBiF.js";
|
|
2
|
-
|
|
2
|
+
type FalsyStyle = undefined | null | false | '';
|
|
3
|
+
type RegisteredStyle<T> = number & {
|
|
4
|
+
__registeredStyleBrand: T;
|
|
5
|
+
};
|
|
6
|
+
interface RecursiveStyleArray<T> extends Array<T | ReadonlyArray<T> | RecursiveStyleArray<T>> {}
|
|
7
|
+
type StyleRecord = Record<string, unknown>;
|
|
3
8
|
interface NativeStyleEnvironment {
|
|
4
9
|
colorScheme?: 'light' | 'dark' | undefined;
|
|
5
10
|
platform?: NativePlatform | undefined;
|
|
@@ -9,7 +14,7 @@ interface NativeStyleEnvironment {
|
|
|
9
14
|
color?: string | undefined;
|
|
10
15
|
}
|
|
11
16
|
type NativeClassValue = string | false | null | undefined | NativeClassValue[] | Record<string, boolean>;
|
|
12
|
-
type NativeStyleValue =
|
|
17
|
+
type NativeStyleValue = StyleRecord | RegisteredStyle<StyleRecord> | RecursiveStyleArray<StyleRecord | RegisteredStyle<StyleRecord> | FalsyStyle> | FalsyStyle;
|
|
13
18
|
interface NativeStyleRuntime {
|
|
14
19
|
tw: (value: NativeClassValue, environment?: NativeStyleEnvironment) => NativeStyleValue;
|
|
15
20
|
getStaticStyle: (ids: readonly string[], environment?: NativeStyleEnvironment) => NativeStyleValue;
|
|
@@ -23,7 +28,7 @@ interface StyleValue {
|
|
|
23
28
|
[key: string]: unknown;
|
|
24
29
|
}
|
|
25
30
|
type StyleSheetFactory = (value: Record<string, StyleValue>) => Record<string, NativeStyleValue>;
|
|
26
|
-
type StyleSheetFlattener = (value: NativeStyleValue) =>
|
|
31
|
+
type StyleSheetFlattener = (value: NativeStyleValue) => unknown;
|
|
27
32
|
declare function createNativeStyleRuntime(initialManifest?: NativeStyleManifest, initialPublication?: NativeManifestPublication): NativeStyleRuntime;
|
|
28
33
|
declare function setManifest(manifest: NativeStyleManifest, publication?: NativeManifestPublication): void;
|
|
29
34
|
/** 由 Expo virtual module 注入,避免 runtime 引入 Node-only 的 require shim。 */
|
package/dist/runtime.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_runtime = require("./runtime-
|
|
2
|
+
const require_runtime = require("./runtime-CbkbHrPb.cjs");
|
|
3
3
|
exports.composeStyle = require_runtime.composeStyle;
|
|
4
4
|
exports.createNativeStyleRuntime = require_runtime.createNativeStyleRuntime;
|
|
5
5
|
exports.getManifest = require_runtime.getManifest;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { a as NativeStyleManifest, i as NativePlatform, r as NativeManifestPublication } from "./types-CxNMLBiF.cjs";
|
|
2
|
+
import { a as getStaticStyle, c as setStyleSheetFactory, d as NativeStyleEnvironment, i as getPublication, l as tw, n as createNativeStyleRuntime, o as setEnvironment, p as NativeStyleValue, r as getManifest, s as setManifest, t as composeStyle, u as NativeClassValue } from "./runtime-D4ZGX6yk.cjs";
|
|
3
|
+
export { type NativeClassValue, type NativeManifestPublication, type NativePlatform, type NativeStyleEnvironment, type NativeStyleManifest, type NativeStyleValue, composeStyle, createNativeStyleRuntime, getManifest, getPublication, getStaticStyle, setEnvironment, setManifest, setStyleSheetFactory, tw };
|
package/dist/runtime.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { a as NativeStyleManifest, i as NativePlatform, r as NativeManifestPublication } from "./types-CxNMLBiF.js";
|
|
2
|
-
import { a as getStaticStyle, c as setStyleSheetFactory, d as NativeStyleEnvironment, i as getPublication, l as tw, n as createNativeStyleRuntime, o as setEnvironment, p as NativeStyleValue, r as getManifest, s as setManifest, t as composeStyle, u as NativeClassValue } from "./runtime-
|
|
2
|
+
import { a as getStaticStyle, c as setStyleSheetFactory, d as NativeStyleEnvironment, i as getPublication, l as tw, n as createNativeStyleRuntime, o as setEnvironment, p as NativeStyleValue, r as getManifest, s as setManifest, t as composeStyle, u as NativeClassValue } from "./runtime-YHlnn5ip.js";
|
|
3
3
|
export { type NativeClassValue, type NativeManifestPublication, type NativePlatform, type NativeStyleEnvironment, type NativeStyleManifest, type NativeStyleValue, composeStyle, createNativeStyleRuntime, getManifest, getPublication, getStaticStyle, setEnvironment, setManifest, setStyleSheetFactory, tw };
|
package/dist/runtime.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as composeStyle, n as createNativeStyleRuntime, r as getManifest, i as getPublication, a as getStaticStyle, o as setEnvironment, s as setManifest, c as setStyleSheetFactory, l as tw } from "./runtime-
|
|
1
|
+
export { t as composeStyle, n as createNativeStyleRuntime, r as getManifest, i as getPublication, a as getStaticStyle, o as setEnvironment, s as setManifest, c as setStyleSheetFactory, l as tw } from "./runtime-DuvYZu4P.js";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { a as NativeStyleManifest, t as CompileNativeStylesheetOptions } from "./types-CxNMLBiF.cjs";
|
|
2
|
+
import { TailwindV4SourceOptions } from "weapp-tailwindcss/generator";
|
|
3
|
+
interface GenerateNativeStylesheetOptions extends Omit<TailwindV4SourceOptions, 'projectRoot' | 'cssEntries'>, Pick<CompileNativeStylesheetOptions, 'boxShadow'> {
|
|
4
|
+
/** Tailwind source 扫描根目录;用于 workspace 示例和 Metro 项目。 */
|
|
5
|
+
projectRoot?: string | undefined;
|
|
6
|
+
/** Tailwind CSS 入口文件;相对路径会按 projectRoot 解析。 */
|
|
7
|
+
cssEntries?: string[] | undefined;
|
|
8
|
+
candidates?: Iterable<string> | undefined;
|
|
9
|
+
sourceGlobs?: string[] | undefined;
|
|
10
|
+
}
|
|
11
|
+
/** 生成应用使用的原生样式;需要分层诊断时使用 generateNativeStylesheetEvidence。 */
|
|
12
|
+
declare function generateNativeStylesheet(options?: GenerateNativeStylesheetOptions): Promise<NativeStyleManifest>;
|
|
13
|
+
export { generateNativeStylesheet as n, GenerateNativeStylesheetOptions as t };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { CompileNativeStylesheetOptions, NativeCompilerWarning, NativeCompilerWarning as NativeCompilerWarning$1, NativePlatform, NativeStyleRule, NativeStyleRule as NativeStyleRule$1 } from "@weapp-tailwindcss/postcss/native";
|
|
2
|
+
/** 同一轮 Metro 发布的便携身份,不包含构建机器的文件路径。 */
|
|
3
|
+
interface NativeManifestPublication {
|
|
4
|
+
revision: string;
|
|
5
|
+
manifestSha256: string;
|
|
6
|
+
}
|
|
7
|
+
interface NativeStyleManifest {
|
|
8
|
+
version: 1;
|
|
9
|
+
classSet: string[];
|
|
10
|
+
rules: Record<string, NativeStyleRule[]>;
|
|
11
|
+
/** 可直接交给 StyleSheet.create 的稳定规则表。 */
|
|
12
|
+
styleSheet?: Record<string, Record<string, unknown>>;
|
|
13
|
+
/** styleSheet 规则的条件和优先级元数据。 */
|
|
14
|
+
styleEntries?: Record<string, NativeStyleRule>;
|
|
15
|
+
/** 每个 class token 对应的静态 style ID,Babel 编译结果直接使用它。 */
|
|
16
|
+
staticLookup?: Record<string, string[]>;
|
|
17
|
+
variables: Record<string, string>;
|
|
18
|
+
warnings: NativeCompilerWarning[];
|
|
19
|
+
}
|
|
20
|
+
export { NativeStyleManifest as a, NativePlatform as i, NativeCompilerWarning$1 as n, NativeStyleRule$1 as o, NativeManifestPublication as r, CompileNativeStylesheetOptions as t };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@weapp-tailwindcss/react-native",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.3.
|
|
4
|
+
"version": "0.3.6",
|
|
5
5
|
"description": "Tailwind CSS compiler and Expo Metro integration for cross-platform React Native apps. 面向跨端 React Native 应用的 Tailwind CSS 编译器与 Expo Metro 集成。",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"homepage": "https://tw.weapp.dev/docs/quick-start/react-native-expo",
|
|
@@ -13,44 +13,84 @@
|
|
|
13
13
|
"sideEffects": true,
|
|
14
14
|
"exports": {
|
|
15
15
|
".": {
|
|
16
|
-
"
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
"import": {
|
|
17
|
+
"types": "./dist/index.d.ts",
|
|
18
|
+
"default": "./dist/index.js"
|
|
19
|
+
},
|
|
20
|
+
"require": {
|
|
21
|
+
"types": "./dist/index.d.cts",
|
|
22
|
+
"default": "./dist/index.cjs"
|
|
23
|
+
}
|
|
19
24
|
},
|
|
20
25
|
"./compiler": {
|
|
21
|
-
"
|
|
22
|
-
|
|
23
|
-
|
|
26
|
+
"import": {
|
|
27
|
+
"types": "./dist/compiler.d.ts",
|
|
28
|
+
"default": "./dist/compiler.js"
|
|
29
|
+
},
|
|
30
|
+
"require": {
|
|
31
|
+
"types": "./dist/compiler.d.cts",
|
|
32
|
+
"default": "./dist/compiler.cjs"
|
|
33
|
+
}
|
|
24
34
|
},
|
|
25
35
|
"./tailwind": {
|
|
26
|
-
"
|
|
27
|
-
|
|
28
|
-
|
|
36
|
+
"import": {
|
|
37
|
+
"types": "./dist/tailwind.d.ts",
|
|
38
|
+
"default": "./dist/tailwind.js"
|
|
39
|
+
},
|
|
40
|
+
"require": {
|
|
41
|
+
"types": "./dist/tailwind.d.cts",
|
|
42
|
+
"default": "./dist/tailwind.cjs"
|
|
43
|
+
}
|
|
29
44
|
},
|
|
30
45
|
"./babel": {
|
|
31
|
-
"
|
|
32
|
-
|
|
33
|
-
|
|
46
|
+
"import": {
|
|
47
|
+
"types": "./dist/babel.d.ts",
|
|
48
|
+
"default": "./dist/babel.js"
|
|
49
|
+
},
|
|
50
|
+
"require": {
|
|
51
|
+
"types": "./dist/babel.d.cts",
|
|
52
|
+
"default": "./dist/babel.cjs"
|
|
53
|
+
}
|
|
34
54
|
},
|
|
35
55
|
"./metro": {
|
|
36
|
-
"
|
|
37
|
-
|
|
38
|
-
|
|
56
|
+
"import": {
|
|
57
|
+
"types": "./dist/metro.d.ts",
|
|
58
|
+
"default": "./dist/metro.js"
|
|
59
|
+
},
|
|
60
|
+
"require": {
|
|
61
|
+
"types": "./dist/metro.d.cts",
|
|
62
|
+
"default": "./dist/metro.cjs"
|
|
63
|
+
}
|
|
39
64
|
},
|
|
40
65
|
"./runtime": {
|
|
41
|
-
"
|
|
42
|
-
|
|
43
|
-
|
|
66
|
+
"import": {
|
|
67
|
+
"types": "./dist/runtime.d.ts",
|
|
68
|
+
"default": "./dist/runtime.js"
|
|
69
|
+
},
|
|
70
|
+
"require": {
|
|
71
|
+
"types": "./dist/runtime.d.cts",
|
|
72
|
+
"default": "./dist/runtime.cjs"
|
|
73
|
+
}
|
|
44
74
|
},
|
|
45
75
|
"./env": {
|
|
46
|
-
"
|
|
47
|
-
|
|
48
|
-
|
|
76
|
+
"import": {
|
|
77
|
+
"types": "./dist/env.d.ts",
|
|
78
|
+
"default": "./dist/env.js"
|
|
79
|
+
},
|
|
80
|
+
"require": {
|
|
81
|
+
"types": "./dist/env.d.cts",
|
|
82
|
+
"default": "./dist/env.cjs"
|
|
83
|
+
}
|
|
49
84
|
},
|
|
50
85
|
"./metro-transformer": {
|
|
51
|
-
"
|
|
52
|
-
|
|
53
|
-
|
|
86
|
+
"import": {
|
|
87
|
+
"types": "./dist/metro-transformer.d.ts",
|
|
88
|
+
"default": "./dist/metro-transformer.js"
|
|
89
|
+
},
|
|
90
|
+
"require": {
|
|
91
|
+
"types": "./dist/metro-transformer.d.cts",
|
|
92
|
+
"default": "./dist/metro-transformer.cjs"
|
|
93
|
+
}
|
|
54
94
|
},
|
|
55
95
|
"./package.json": "./package.json"
|
|
56
96
|
},
|
|
@@ -92,8 +132,9 @@
|
|
|
92
132
|
},
|
|
93
133
|
"dependencies": {
|
|
94
134
|
"@babel/types": "^8.0.8",
|
|
95
|
-
"@
|
|
96
|
-
"weapp-tailwindcss": "
|
|
135
|
+
"@types/convert-source-map": "^2.0.3",
|
|
136
|
+
"@weapp-tailwindcss/postcss": "4.0.1",
|
|
137
|
+
"weapp-tailwindcss": "5.7.1"
|
|
97
138
|
},
|
|
98
139
|
"devDependencies": {
|
|
99
140
|
"@babel/core": "^7.29.7",
|
|
@@ -103,7 +144,7 @@
|
|
|
103
144
|
"vitest": "~5.1.0"
|
|
104
145
|
},
|
|
105
146
|
"scripts": {
|
|
106
|
-
"build": "tsdown",
|
|
147
|
+
"build": "tsdown && tsx ../../tools/weapp-tailwindcss-scripts/src/duplicate-cjs-declarations.ts . --only-defaults --default=babel",
|
|
107
148
|
"test": "vitest run",
|
|
108
149
|
"typecheck": "tsc -p tsconfig.typecheck.json --pretty false",
|
|
109
150
|
"bench": "vitest bench",
|