vite-plugin-react-native 0.0.4 → 1.0.1

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/index.d.cts CHANGED
@@ -1,5 +1,83 @@
1
- import { Plugin } from 'vite';
1
+ import { AliasOptions, Plugin } from 'vite';
2
+
3
+ declare function flowRemoveTypesPlugin(): {
4
+ name: string;
5
+ transform: {
6
+ filter: {
7
+ code: RegExp;
8
+ };
9
+ handler: (code: string) => {
10
+ code: string;
11
+ };
12
+ };
13
+ };
14
+ declare function stripFlowTypes(code: string): string;
15
+ declare function treeshakeFixPlugin(): {
16
+ name: string;
17
+ transform: {
18
+ handler: (_code: string, id: string) => {
19
+ moduleSideEffects: string;
20
+ } | null;
21
+ };
22
+ };
23
+ declare function transformCssInteropDoctorCheck(code: string, id: string): {
24
+ code: string;
25
+ map: null;
26
+ changed: boolean;
27
+ };
28
+ declare function transformReanimatedWebUtils(code: string, id: string, isProduction: boolean): {
29
+ code: string;
30
+ map: null;
31
+ changed: boolean;
32
+ };
33
+
34
+ /** Vite 配置:别名、define、build、optimizeDeps */
35
+
36
+ type AliasEntry = {
37
+ find: string | RegExp;
38
+ replacement: string;
39
+ };
40
+ declare function normalizeUserAlias(alias: AliasOptions): AliasEntry[];
41
+ declare function buildResolveAlias(options: {
42
+ userAliasArray: AliasEntry[];
43
+ routerDomEntry: string | null;
44
+ }): AliasEntry[];
45
+
46
+ /** 常量与工具:扩展名、optimizeDeps 列表、去重、Vite 版本、动态 include */
47
+ declare const RESOLVE_EXTENSIONS: readonly [".web.mjs", ".web.js", ".web.ts", ".web.tsx", ".web.jsx", ".mjs", ".js", ".ts", ".tsx", ".jsx", ".json"];
48
+ declare const MODULE_TYPES: {
49
+ readonly '.js': "jsx";
50
+ readonly '.mjs': "jsx";
51
+ readonly '.cjs': "jsx";
52
+ readonly '.flow': "jsx";
53
+ };
54
+ declare const TREESHAKE_SAFE_PRESET: {
55
+ annotations: boolean;
56
+ invalidImportSideEffects: boolean;
57
+ manualPureFunctions: string[];
58
+ moduleSideEffects: boolean;
59
+ propertyReadSideEffects: "always";
60
+ unknownGlobalSideEffects: boolean;
61
+ propertyWriteSideEffects: "always";
62
+ };
63
+ declare const CORE_OPTIMIZE_DEPS_INCLUDE: readonly ["react", "react-dom", "react/jsx-runtime", "react/jsx-dev-runtime", "react-native-web"];
64
+ declare const OPTIONAL_OPTIMIZE_DEPS_INCLUDE: readonly ["hoist-non-react-statics", "invariant", "react-native-reanimated", "react-native-css-interop", "react-native-i18njs", "@react-native/normalize-colors", "inline-style-prefixer", "inline-style-prefixer/lib/plugins/crossFade", "css-in-js-utils"];
65
+ type RequireLike = {
66
+ resolve: (id: string, options?: {
67
+ paths?: string[];
68
+ }) => string;
69
+ };
70
+ declare function uniqueStrings(values: Array<string | undefined>): string[];
71
+ /** 从项目解析的 Vite 主版本号,用于判断是否使用 rolldownOptions(Vite 8+) */
72
+ declare function getViteMajorVersion(projectRoot: string, require: RequireLike): number;
73
+ /**
74
+ * 仅包含项目已安装的依赖,避免 optimizeDeps.include 里未安装的包导致解析失败。
75
+ * 核心列表 + 可选列表中在 package.json 里出现的项。
76
+ */
77
+ declare function getInstalledOptimizeDepsInclude(projectRoot: string, routerDomEntry: string | null): string[];
78
+
79
+ /** Vite 插件:React Native Web 兼容(别名、虚拟模块、Flow、optimizeDeps) */
2
80
 
3
81
  declare function reactNative(): Plugin;
4
82
 
5
- export { reactNative };
83
+ export { CORE_OPTIMIZE_DEPS_INCLUDE, MODULE_TYPES, OPTIONAL_OPTIMIZE_DEPS_INCLUDE, RESOLVE_EXTENSIONS, TREESHAKE_SAFE_PRESET, buildResolveAlias, flowRemoveTypesPlugin, getInstalledOptimizeDepsInclude, getViteMajorVersion, normalizeUserAlias, reactNative, stripFlowTypes, transformCssInteropDoctorCheck, transformReanimatedWebUtils, treeshakeFixPlugin, uniqueStrings };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,83 @@
1
- import { Plugin } from 'vite';
1
+ import { AliasOptions, Plugin } from 'vite';
2
+
3
+ declare function flowRemoveTypesPlugin(): {
4
+ name: string;
5
+ transform: {
6
+ filter: {
7
+ code: RegExp;
8
+ };
9
+ handler: (code: string) => {
10
+ code: string;
11
+ };
12
+ };
13
+ };
14
+ declare function stripFlowTypes(code: string): string;
15
+ declare function treeshakeFixPlugin(): {
16
+ name: string;
17
+ transform: {
18
+ handler: (_code: string, id: string) => {
19
+ moduleSideEffects: string;
20
+ } | null;
21
+ };
22
+ };
23
+ declare function transformCssInteropDoctorCheck(code: string, id: string): {
24
+ code: string;
25
+ map: null;
26
+ changed: boolean;
27
+ };
28
+ declare function transformReanimatedWebUtils(code: string, id: string, isProduction: boolean): {
29
+ code: string;
30
+ map: null;
31
+ changed: boolean;
32
+ };
33
+
34
+ /** Vite 配置:别名、define、build、optimizeDeps */
35
+
36
+ type AliasEntry = {
37
+ find: string | RegExp;
38
+ replacement: string;
39
+ };
40
+ declare function normalizeUserAlias(alias: AliasOptions): AliasEntry[];
41
+ declare function buildResolveAlias(options: {
42
+ userAliasArray: AliasEntry[];
43
+ routerDomEntry: string | null;
44
+ }): AliasEntry[];
45
+
46
+ /** 常量与工具:扩展名、optimizeDeps 列表、去重、Vite 版本、动态 include */
47
+ declare const RESOLVE_EXTENSIONS: readonly [".web.mjs", ".web.js", ".web.ts", ".web.tsx", ".web.jsx", ".mjs", ".js", ".ts", ".tsx", ".jsx", ".json"];
48
+ declare const MODULE_TYPES: {
49
+ readonly '.js': "jsx";
50
+ readonly '.mjs': "jsx";
51
+ readonly '.cjs': "jsx";
52
+ readonly '.flow': "jsx";
53
+ };
54
+ declare const TREESHAKE_SAFE_PRESET: {
55
+ annotations: boolean;
56
+ invalidImportSideEffects: boolean;
57
+ manualPureFunctions: string[];
58
+ moduleSideEffects: boolean;
59
+ propertyReadSideEffects: "always";
60
+ unknownGlobalSideEffects: boolean;
61
+ propertyWriteSideEffects: "always";
62
+ };
63
+ declare const CORE_OPTIMIZE_DEPS_INCLUDE: readonly ["react", "react-dom", "react/jsx-runtime", "react/jsx-dev-runtime", "react-native-web"];
64
+ declare const OPTIONAL_OPTIMIZE_DEPS_INCLUDE: readonly ["hoist-non-react-statics", "invariant", "react-native-reanimated", "react-native-css-interop", "react-native-i18njs", "@react-native/normalize-colors", "inline-style-prefixer", "inline-style-prefixer/lib/plugins/crossFade", "css-in-js-utils"];
65
+ type RequireLike = {
66
+ resolve: (id: string, options?: {
67
+ paths?: string[];
68
+ }) => string;
69
+ };
70
+ declare function uniqueStrings(values: Array<string | undefined>): string[];
71
+ /** 从项目解析的 Vite 主版本号,用于判断是否使用 rolldownOptions(Vite 8+) */
72
+ declare function getViteMajorVersion(projectRoot: string, require: RequireLike): number;
73
+ /**
74
+ * 仅包含项目已安装的依赖,避免 optimizeDeps.include 里未安装的包导致解析失败。
75
+ * 核心列表 + 可选列表中在 package.json 里出现的项。
76
+ */
77
+ declare function getInstalledOptimizeDepsInclude(projectRoot: string, routerDomEntry: string | null): string[];
78
+
79
+ /** Vite 插件:React Native Web 兼容(别名、虚拟模块、Flow、optimizeDeps) */
2
80
 
3
81
  declare function reactNative(): Plugin;
4
82
 
5
- export { reactNative };
83
+ export { CORE_OPTIMIZE_DEPS_INCLUDE, MODULE_TYPES, OPTIONAL_OPTIMIZE_DEPS_INCLUDE, RESOLVE_EXTENSIONS, TREESHAKE_SAFE_PRESET, buildResolveAlias, flowRemoveTypesPlugin, getInstalledOptimizeDepsInclude, getViteMajorVersion, normalizeUserAlias, reactNative, stripFlowTypes, transformCssInteropDoctorCheck, transformReanimatedWebUtils, treeshakeFixPlugin, uniqueStrings };