vite-plugin-taro 0.2.0 → 0.2.2
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 +6 -6
- package/README.zh.md +6 -6
- package/dist/shim/h5.d.ts +4 -0
- package/dist/shim/wx.d.ts +4 -0
- package/dist/virtual/api.d.ts +3 -0
- package/dist/virtual/components.d.ts +1 -0
- package/dist/vite/constants.d.ts +4 -0
- package/dist/vite/plugins.d.ts +8 -0
- package/dist/vite/tailwindcss.d.ts +3 -0
- package/dist/vite/targets/h5.d.ts +31 -0
- package/dist/vite/targets/h5.js +0 -2
- package/dist/vite/targets/wx.d.ts +74 -0
- package/dist/vite/targets/wx.js +0 -2
- package/dist/vite/types.d.ts +38 -0
- package/dist/vite/utils.d.ts +25 -0
- package/dist/vite/virtual-modules.d.ts +3 -0
- package/dist/vite/vite-plugin-taro.d.ts +7 -0
- package/dist/vite.d.ts +2 -0
- package/package.json +8 -7
- package/src/vite/targets/h5.ts +0 -2
- package/src/vite/targets/wx.ts +0 -2
package/README.md
CHANGED
|
@@ -71,7 +71,7 @@ npm run build:h5
|
|
|
71
71
|
# Preview the built H5 app
|
|
72
72
|
npm run preview:h5
|
|
73
73
|
|
|
74
|
-
# Typecheck with
|
|
74
|
+
# Typecheck with tsc
|
|
75
75
|
npm run typecheck
|
|
76
76
|
```
|
|
77
77
|
|
|
@@ -102,11 +102,11 @@ For existing apps or custom project layouts, follow the steps below to wire the
|
|
|
102
102
|
npm install -D vite-plugin-taro
|
|
103
103
|
```
|
|
104
104
|
|
|
105
|
-
Your app must also provide Vite 8, React 19, React DOM 19,
|
|
105
|
+
Your app must also provide Vite 8, React 19, React DOM 19, TypeScript 7, and Node/React type packages. If your app does not already have them, install the missing packages:
|
|
106
106
|
|
|
107
107
|
```sh
|
|
108
108
|
npm install react react-dom
|
|
109
|
-
npm install -D vite @
|
|
109
|
+
npm install -D vite typescript@rc @types/node @types/react @types/react-dom cross-env
|
|
110
110
|
```
|
|
111
111
|
|
|
112
112
|
You should NOT have direct dependencies on `@tarojs/*` packages anymore. Remove them if you have.
|
|
@@ -286,7 +286,7 @@ Use the same scripts generated by `create-vite-taro`:
|
|
|
286
286
|
"build:wx": "cross-env NODE_ENV=production VITE_PLUGIN_TARO_TARGET=wx vite build",
|
|
287
287
|
"build:h5": "cross-env NODE_ENV=production VITE_PLUGIN_TARO_TARGET=h5 vite build",
|
|
288
288
|
"preview:h5": "cross-env NODE_ENV=production VITE_PLUGIN_TARO_TARGET=h5 vite preview --outDir dist/h5",
|
|
289
|
-
"typecheck": "
|
|
289
|
+
"typecheck": "tsc -b"
|
|
290
290
|
}
|
|
291
291
|
}
|
|
292
292
|
```
|
|
@@ -299,7 +299,7 @@ npm run dev:h5 # Start the H5 dev server
|
|
|
299
299
|
npm run build:wx # Build dist/wx
|
|
300
300
|
npm run build:h5 # Build dist/h5
|
|
301
301
|
npm run preview:h5 # Preview dist/h5
|
|
302
|
-
npm run typecheck # Typecheck with
|
|
302
|
+
npm run typecheck # Typecheck with tsc
|
|
303
303
|
```
|
|
304
304
|
|
|
305
305
|
Open the generated `dist/wx` directory in WeChat DevTools.
|
|
@@ -485,7 +485,7 @@ Common scripts:
|
|
|
485
485
|
| --- | --- |
|
|
486
486
|
| `pnpm prepare:taro` | Regenerate the patched React 19 Taro packages from upstream npm tarballs and local patch files. |
|
|
487
487
|
| `pnpm build:plugin` | Build `packages/vite-plugin-taro` into `dist`. |
|
|
488
|
-
| `pnpm typecheck` | Typecheck the plugin and sample app with `
|
|
488
|
+
| `pnpm typecheck` | Typecheck the plugin and sample app with `tsc`. |
|
|
489
489
|
| `pnpm lint` | Run Biome checks. |
|
|
490
490
|
| `pnpm format` | Apply Biome formatting. |
|
|
491
491
|
| `pnpm dev:sample:wx` | Build the sample WeChat Mini Program in watch mode. Build the plugin first. |
|
package/README.zh.md
CHANGED
|
@@ -71,7 +71,7 @@ npm run build:h5
|
|
|
71
71
|
# 预览构建后的 H5 应用
|
|
72
72
|
npm run preview:h5
|
|
73
73
|
|
|
74
|
-
# 使用
|
|
74
|
+
# 使用 tsc 进行类型检查
|
|
75
75
|
npm run typecheck
|
|
76
76
|
```
|
|
77
77
|
|
|
@@ -102,11 +102,11 @@ import { Text, View } from 'virtual:taro/components'
|
|
|
102
102
|
npm install -D vite-plugin-taro
|
|
103
103
|
```
|
|
104
104
|
|
|
105
|
-
你的应用还必须提供 Vite 8、React 19、React DOM 19、TypeScript
|
|
105
|
+
你的应用还必须提供 Vite 8、React 19、React DOM 19、TypeScript 7,以及 Node/React 类型包。如果应用尚未安装它们,请安装缺失的包:
|
|
106
106
|
|
|
107
107
|
```sh
|
|
108
108
|
npm install react react-dom
|
|
109
|
-
npm install -D vite @
|
|
109
|
+
npm install -D vite typescript@rc @types/node @types/react @types/react-dom cross-env
|
|
110
110
|
```
|
|
111
111
|
|
|
112
112
|
你不应再直接依赖任何 `@tarojs/*` 包。如果已经依赖,请将它们移除。
|
|
@@ -286,7 +286,7 @@ export default function IndexPage() {
|
|
|
286
286
|
"build:wx": "cross-env NODE_ENV=production VITE_PLUGIN_TARO_TARGET=wx vite build",
|
|
287
287
|
"build:h5": "cross-env NODE_ENV=production VITE_PLUGIN_TARO_TARGET=h5 vite build",
|
|
288
288
|
"preview:h5": "cross-env NODE_ENV=production VITE_PLUGIN_TARO_TARGET=h5 vite preview --outDir dist/h5",
|
|
289
|
-
"typecheck": "
|
|
289
|
+
"typecheck": "tsc -b"
|
|
290
290
|
}
|
|
291
291
|
}
|
|
292
292
|
```
|
|
@@ -299,7 +299,7 @@ npm run dev:h5 # 启动 H5 开发服务器
|
|
|
299
299
|
npm run build:wx # 构建 dist/wx
|
|
300
300
|
npm run build:h5 # 构建 dist/h5
|
|
301
301
|
npm run preview:h5 # 预览 dist/h5
|
|
302
|
-
npm run typecheck # 使用
|
|
302
|
+
npm run typecheck # 使用 tsc 进行类型检查
|
|
303
303
|
```
|
|
304
304
|
|
|
305
305
|
在微信开发者工具中打开生成的 `dist/wx` 目录。
|
|
@@ -485,7 +485,7 @@ pnpm typecheck
|
|
|
485
485
|
| --- | --- |
|
|
486
486
|
| `pnpm prepare:taro` | 从上游 npm tarball 和本地 patch 文件重新生成打过补丁的 React 19 Taro 包。 |
|
|
487
487
|
| `pnpm build:plugin` | 将 `packages/vite-plugin-taro` 构建到 `dist`。 |
|
|
488
|
-
| `pnpm typecheck` | 使用 `
|
|
488
|
+
| `pnpm typecheck` | 使用 `tsc` 对插件和示例应用进行类型检查。 |
|
|
489
489
|
| `pnpm lint` | 运行 Biome 检查。 |
|
|
490
490
|
| `pnpm format` | 应用 Biome 格式化。 |
|
|
491
491
|
| `pnpm dev:sample:wx` | 以 watch 模式构建微信小程序示例。请先构建插件。 |
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import '@tarojs/plugin-platform-h5/dist/runtime';
|
|
2
|
+
export { createReactApp } from '@tarojs/plugin-framework-react/dist/runtime';
|
|
3
|
+
export { createBrowserHistory, createHashHistory, createRouter, handleAppMount } from '@tarojs/router';
|
|
4
|
+
export { window } from '@tarojs/runtime';
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import '@tarojs/plugin-platform-weapp/dist/runtime.js';
|
|
2
|
+
export { createReactApp } from '@tarojs/plugin-framework-react/dist/runtime';
|
|
3
|
+
export { default as ReactDOM } from '@tarojs/react';
|
|
4
|
+
export { createPageConfig, createRecursiveComponentConfig } from '@tarojs/runtime';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@tarojs/components';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Plugin } from 'vite';
|
|
2
|
+
import type { VitePluginTaroBuildContext } from './types.ts';
|
|
3
|
+
/**
|
|
4
|
+
* Applies Taro-style conditional compilation comments before Vite parses source files.
|
|
5
|
+
*
|
|
6
|
+
* Mirrors Taro's CSS #ifdef/#ifndef handling, generalized before Vite parses code.
|
|
7
|
+
*/
|
|
8
|
+
export declare function createVitePluginTaroConditionalDirectivePlugin(context: VitePluginTaroBuildContext): Plugin;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { HtmlTagDescriptor, PluginOption, UserConfig } from 'vite';
|
|
2
|
+
import type { VitePluginTaroBuildContext } from '../types.ts';
|
|
3
|
+
/**
|
|
4
|
+
* Checks whether an id belongs to an H5 virtual module.
|
|
5
|
+
*/
|
|
6
|
+
export declare function isH5VirtualModuleId(id: string): boolean;
|
|
7
|
+
/**
|
|
8
|
+
* Loads generated source for H5 virtual modules.
|
|
9
|
+
*/
|
|
10
|
+
export declare function loadH5VirtualModule(cleanId: string, context: VitePluginTaroBuildContext): string | undefined;
|
|
11
|
+
/**
|
|
12
|
+
* Configures the Vite pieces needed for Taro H5 resolve/runtime behavior.
|
|
13
|
+
*/
|
|
14
|
+
export declare function createH5ViteConfig(): UserConfig;
|
|
15
|
+
/**
|
|
16
|
+
* Creates H5-only support plugins used before the target emitter runs.
|
|
17
|
+
*
|
|
18
|
+
* https://github.com/NervJS/taro/blob/f0e5c39d5f04290db975670411e23c3a396e15f8/packages/taro-platform-h5/src/program.ts#L219-L249
|
|
19
|
+
*/
|
|
20
|
+
export declare function createH5SupportPlugins(): PluginOption[];
|
|
21
|
+
/**
|
|
22
|
+
* Injects vite-plugin-taro's generated Web entry into Vite's HTML shell.
|
|
23
|
+
*/
|
|
24
|
+
export declare function createWebIndexHtmlTags(context: VitePluginTaroBuildContext): HtmlTagDescriptor[] | undefined;
|
|
25
|
+
/**
|
|
26
|
+
* Builds the generated Web entry around Taro's official Web router/runtime APIs.
|
|
27
|
+
* Base Taro CSS is imported before the app; component CSS order is handled by rewriteStencilStyleInsertion.
|
|
28
|
+
*
|
|
29
|
+
* https://github.com/NervJS/taro/blob/f0e5c39d5f04290db975670411e23c3a396e15f8/packages/taro-loader/src/h5.ts#L120-L150
|
|
30
|
+
*/
|
|
31
|
+
export declare function createWebEntry(context: VitePluginTaroBuildContext): string;
|
package/dist/vite/targets/h5.js
CHANGED
|
@@ -119,8 +119,6 @@ function createH5TaroDefines() {
|
|
|
119
119
|
'process.env.SUPPORT_TARO_POLYFILL': JSON.stringify('disabled'),
|
|
120
120
|
'process.env.TARO_ENV': JSON.stringify('h5'),
|
|
121
121
|
'process.env.TARO_PLATFORM': JSON.stringify('web'),
|
|
122
|
-
IS_H5: 'true',
|
|
123
|
-
IS_WEAPP: 'false',
|
|
124
122
|
'process.env.SUPPORT_DINGTALK_NAVIGATE': JSON.stringify('disabled'),
|
|
125
123
|
DEPRECATED_ADAPTER_COMPONENT: 'false'
|
|
126
124
|
};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import type { UserConfig } from 'vite';
|
|
2
|
+
import type { VitePluginTaroBuildContext, VitePluginTaroPageOption } from '../types.ts';
|
|
3
|
+
/**
|
|
4
|
+
* Checks whether an id belongs to a wx virtual module.
|
|
5
|
+
*/
|
|
6
|
+
export declare function isWxVirtualModuleId(id: string): boolean;
|
|
7
|
+
export declare function loadWxVirtualModule(cleanId: string, context: VitePluginTaroBuildContext): string | undefined;
|
|
8
|
+
/**
|
|
9
|
+
* Configures wx target entry, output, and chunk layout.
|
|
10
|
+
*/
|
|
11
|
+
export declare function createWxViteConfig(context: VitePluginTaroBuildContext): UserConfig;
|
|
12
|
+
type WechatAssetSource = string | Uint8Array;
|
|
13
|
+
type WechatBundleModule = {
|
|
14
|
+
renderedExports?: string[];
|
|
15
|
+
};
|
|
16
|
+
type WechatBundleItem = {
|
|
17
|
+
type: 'asset' | 'chunk';
|
|
18
|
+
source?: WechatAssetSource;
|
|
19
|
+
modules?: Record<string, WechatBundleModule>;
|
|
20
|
+
};
|
|
21
|
+
type WechatBundle = Record<string, WechatBundleItem>;
|
|
22
|
+
type WechatChunkEmitter = {
|
|
23
|
+
emitFile(chunk: {
|
|
24
|
+
type: 'chunk';
|
|
25
|
+
id: string;
|
|
26
|
+
fileName: string;
|
|
27
|
+
implicitlyLoadedAfterOneOf: string[];
|
|
28
|
+
}): string;
|
|
29
|
+
};
|
|
30
|
+
type WechatAssetEmitter = {
|
|
31
|
+
emitFile(asset: {
|
|
32
|
+
type: 'asset';
|
|
33
|
+
fileName: string;
|
|
34
|
+
source: WechatAssetSource;
|
|
35
|
+
}): string;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Emits page and component chunks like Taro Webpack's MiniPlugin generated entries.
|
|
39
|
+
*
|
|
40
|
+
* https://github.com/NervJS/taro/blob/f0e5c39d5f04290db975670411e23c3a396e15f8/packages/taro-webpack5-runner/src/plugins/MiniPlugin.ts#L228-L243
|
|
41
|
+
* https://github.com/NervJS/taro/blob/f0e5c39d5f04290db975670411e23c3a396e15f8/packages/taro-webpack5-runner/src/plugins/MiniPlugin.ts#L743-L777
|
|
42
|
+
* https://github.com/NervJS/taro/blob/f0e5c39d5f04290db975670411e23c3a396e15f8/packages/taro-webpack5-runner/src/plugins/TaroSingleEntryPlugin.ts#L18-L38
|
|
43
|
+
*/
|
|
44
|
+
export declare function emitWechatImplicitChunksForVirtualApp(emitter: WechatChunkEmitter, context: VitePluginTaroBuildContext, cleanId: string): void;
|
|
45
|
+
/**
|
|
46
|
+
* Builds the generated WeChat app entry that registers Taro's React App config.
|
|
47
|
+
* vite-plugin-taro omits Taro's generated pxTransform initialization because styles are handled by Tailwind.
|
|
48
|
+
*
|
|
49
|
+
* https://github.com/NervJS/taro/blob/f0e5c39d5f04290db975670411e23c3a396e15f8/packages/taro-loader/src/app.ts#L54-L63
|
|
50
|
+
*/
|
|
51
|
+
export declare function createWxAppEntry(context: VitePluginTaroBuildContext): string;
|
|
52
|
+
/**
|
|
53
|
+
* Builds a generated WeChat page entry that registers Taro's Page config.
|
|
54
|
+
*
|
|
55
|
+
* https://github.com/NervJS/taro/blob/f0e5c39d5f04290db975670411e23c3a396e15f8/packages/taro-loader/src/page.ts#L52-L78
|
|
56
|
+
*/
|
|
57
|
+
export declare function createWxPageEntry(pageOption: VitePluginTaroPageOption): string;
|
|
58
|
+
/**
|
|
59
|
+
* Builds the generated JS companion for comp.wxml/comp.json. Without it WeChat
|
|
60
|
+
* can load recursive markup, but it will not have Taro's properties or `eh` event
|
|
61
|
+
* dispatch method.
|
|
62
|
+
*
|
|
63
|
+
* https://github.com/NervJS/taro/blob/f0e5c39d5f04290db975670411e23c3a396e15f8/packages/taro-webpack5-runner/src/template/comp.ts#L1-L4
|
|
64
|
+
*/
|
|
65
|
+
export declare function createWxCompEntry(): string;
|
|
66
|
+
/**
|
|
67
|
+
* Creates Taro-style Mini Program template/config/style companion files.
|
|
68
|
+
*
|
|
69
|
+
* https://github.com/NervJS/taro/blob/f0e5c39d5f04290db975670411e23c3a396e15f8/packages/taro-platform-weapp/src/program.ts#L33-L55
|
|
70
|
+
* https://github.com/NervJS/taro/blob/f0e5c39d5f04290db975670411e23c3a396e15f8/packages/taro-webpack5-runner/src/plugins/MiniPlugin.ts#L1198-L1311
|
|
71
|
+
* https://github.com/NervJS/taro/blob/f0e5c39d5f04290db975670411e23c3a396e15f8/packages/taro-webpack5-runner/src/plugins/MiniPlugin.ts#L1346-L1390
|
|
72
|
+
*/
|
|
73
|
+
export declare function emitWechatAssets(emitter: WechatAssetEmitter, bundle: WechatBundle, context: VitePluginTaroBuildContext): void;
|
|
74
|
+
export {};
|
package/dist/vite/targets/wx.js
CHANGED
|
@@ -88,8 +88,6 @@ function createWechatTaroDefines() {
|
|
|
88
88
|
'process.env.TARO_ENV': JSON.stringify('weapp'),
|
|
89
89
|
'process.env.TARO_PLATFORM': JSON.stringify('mini'),
|
|
90
90
|
'process.env.TARO_VERSION': JSON.stringify(taroVersion),
|
|
91
|
-
IS_H5: 'false',
|
|
92
|
-
IS_WEAPP: 'true',
|
|
93
91
|
ENABLE_ADJACENT_HTML: 'false',
|
|
94
92
|
ENABLE_CLONE_NODE: 'false',
|
|
95
93
|
ENABLE_CONTAINS: 'false',
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/** Plain JSON object emitted into Mini Program/Web config payloads. */
|
|
2
|
+
export type JsonObject = Record<string, unknown>;
|
|
3
|
+
/** Build target handled by this plugin. */
|
|
4
|
+
export type VitePluginTaroTarget = 'wx' | 'h5';
|
|
5
|
+
/** Describes one React-backed page shared by WeChat Mini Program and Web builds. */
|
|
6
|
+
export type VitePluginTaroPageOption = {
|
|
7
|
+
/**
|
|
8
|
+
* Page route and output path, without file extension.
|
|
9
|
+
* Example: "pages/index/index" emits pages/index/index.{js,json,wxml,wxss}
|
|
10
|
+
* for WeChat and becomes the Web router path.
|
|
11
|
+
*/
|
|
12
|
+
path: string;
|
|
13
|
+
/** Page JSON config merged into WeChat JSON and Web route config. */
|
|
14
|
+
config: JsonObject;
|
|
15
|
+
};
|
|
16
|
+
/** Required build inputs for the custom Vite/Rolldown Taro renderer plugin. */
|
|
17
|
+
export interface VitePluginTaroOptions {
|
|
18
|
+
/** Active target for this Vite invocation. */
|
|
19
|
+
target: VitePluginTaroTarget;
|
|
20
|
+
/** Source file that default-exports the root React app component. */
|
|
21
|
+
app: string;
|
|
22
|
+
/** Ordered page list; also becomes app.json.pages and Web route order. */
|
|
23
|
+
pages: VitePluginTaroPageOption[];
|
|
24
|
+
/** Base app.json content. Its pages field is overwritten from options.pages. */
|
|
25
|
+
appJson: JsonObject;
|
|
26
|
+
/** project.config.json content emitted at the Mini Program root. */
|
|
27
|
+
projectConfigJson: JsonObject;
|
|
28
|
+
/** sitemap.json content emitted at the Mini Program root. */
|
|
29
|
+
sitemapJson: JsonObject;
|
|
30
|
+
}
|
|
31
|
+
export type VitePluginTaroBuildContext = {
|
|
32
|
+
target: VitePluginTaroTarget;
|
|
33
|
+
appComponentImport: string;
|
|
34
|
+
pages: VitePluginTaroPageOption[];
|
|
35
|
+
appConfig: JsonObject;
|
|
36
|
+
projectConfigJson: JsonObject;
|
|
37
|
+
sitemapJson: JsonObject;
|
|
38
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Derives a page component import from a Taro-style page path.
|
|
3
|
+
*
|
|
4
|
+
* https://github.com/NervJS/taro/blob/f0e5c39d5f04290db975670411e23c3a396e15f8/packages/taro-webpack5-runner/src/plugins/MiniPlugin.ts#L660-L668
|
|
5
|
+
* https://github.com/NervJS/taro/blob/f0e5c39d5f04290db975670411e23c3a396e15f8/packages/taro-webpack5-runner/src/utils/app.ts#L74-L90
|
|
6
|
+
* https://github.com/NervJS/taro/blob/f0e5c39d5f04290db975670411e23c3a396e15f8/packages/taro-loader/src/h5.ts#L12-L21
|
|
7
|
+
*/
|
|
8
|
+
export declare function createPageComponentImport(pagePath: string): string;
|
|
9
|
+
/**
|
|
10
|
+
* Converts a local file path into a Vite file-system import specifier.
|
|
11
|
+
*
|
|
12
|
+
* Rolldown does not reliably resolve raw Windows absolute paths from virtual
|
|
13
|
+
* module source, so generated imports use Vite's /@fs/ prefix instead.
|
|
14
|
+
*/
|
|
15
|
+
export declare function toImportPath(filePath: string): string;
|
|
16
|
+
/**
|
|
17
|
+
* Removes Rollup/Vite's internal virtual-module prefix before ID comparisons.
|
|
18
|
+
*/
|
|
19
|
+
export declare function stripVirtualPrefix(id: string): string;
|
|
20
|
+
/**
|
|
21
|
+
* Uses Taro-style slash normalization, plus Vite query-string stripping for module IDs.
|
|
22
|
+
*
|
|
23
|
+
* https://github.com/NervJS/taro/blob/f0e5c39d5f04290db975670411e23c3a396e15f8/packages/taro-helper/src/utils.ts#L32-L34
|
|
24
|
+
*/
|
|
25
|
+
export declare function normalizeModuleId(id: string): string;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { PluginOption } from 'vite';
|
|
2
|
+
import type { VitePluginTaroOptions } from './types.ts';
|
|
3
|
+
/**
|
|
4
|
+
* Creates the Vite/Rolldown plugin that emits either WeChat Mini Program files
|
|
5
|
+
* or a Taro Web app using the official Taro runtime packages.
|
|
6
|
+
*/
|
|
7
|
+
export default function vitePluginTaro(options: VitePluginTaroOptions): PluginOption[];
|
package/dist/vite.d.ts
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vite-plugin-taro",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"author": "sep2",
|
|
5
5
|
"description": "Vite 8 plugin for building one React/Taro codebase for WeChat Mini Program and H5 targets.",
|
|
6
6
|
"type": "module",
|
|
@@ -15,9 +15,10 @@
|
|
|
15
15
|
"homepage": "https://github.com/sep2/vite-plugin-taro/tree/main/packages/vite-plugin-taro#readme",
|
|
16
16
|
"main": "./dist/vite.js",
|
|
17
17
|
"module": "./dist/vite.js",
|
|
18
|
+
"types": "./dist/vite.d.ts",
|
|
18
19
|
"exports": {
|
|
19
20
|
".": {
|
|
20
|
-
"types": "./
|
|
21
|
+
"types": "./dist/vite.d.ts",
|
|
21
22
|
"import": "./dist/vite.js",
|
|
22
23
|
"default": "./dist/vite.js"
|
|
23
24
|
},
|
|
@@ -64,8 +65,8 @@
|
|
|
64
65
|
"babel-plugin-transform-taroapi": "^4.2.0",
|
|
65
66
|
"tailwindcss": "^4.3.1",
|
|
66
67
|
"weapp-tailwindcss": "^5.0.13",
|
|
67
|
-
"@tarojs/plugin-framework-react": "npm:vite-plugin-taro-plugin-framework-react@0.2.
|
|
68
|
-
"@tarojs/react": "npm:vite-plugin-taro-react@0.2.
|
|
68
|
+
"@tarojs/plugin-framework-react": "npm:vite-plugin-taro-plugin-framework-react@0.2.2",
|
|
69
|
+
"@tarojs/react": "npm:vite-plugin-taro-react@0.2.2"
|
|
69
70
|
},
|
|
70
71
|
"peerDependencies": {
|
|
71
72
|
"react": "^19.0.0",
|
|
@@ -75,11 +76,11 @@
|
|
|
75
76
|
"devDependencies": {
|
|
76
77
|
"@types/babel__core": "^7.20.5",
|
|
77
78
|
"@types/node": "^26.0.0",
|
|
78
|
-
"
|
|
79
|
+
"typescript": "^7.0.1-rc",
|
|
79
80
|
"vite": "^8.0.16"
|
|
80
81
|
},
|
|
81
82
|
"scripts": {
|
|
82
|
-
"build": "node ../../scripts/sync-plugin-readme.ts && node ../../scripts/clean-directory.ts dist &&
|
|
83
|
-
"typecheck": "
|
|
83
|
+
"build": "node ../../scripts/sync-plugin-readme.ts && node ../../scripts/clean-directory.ts dist && tsc --project tsconfig.json",
|
|
84
|
+
"typecheck": "tsc --project tsconfig.json --noEmit"
|
|
84
85
|
}
|
|
85
86
|
}
|
package/src/vite/targets/h5.ts
CHANGED
|
@@ -140,8 +140,6 @@ function createH5TaroDefines(): Record<string, string> {
|
|
|
140
140
|
'process.env.SUPPORT_TARO_POLYFILL': JSON.stringify('disabled'),
|
|
141
141
|
'process.env.TARO_ENV': JSON.stringify('h5'),
|
|
142
142
|
'process.env.TARO_PLATFORM': JSON.stringify('web'),
|
|
143
|
-
IS_H5: 'true',
|
|
144
|
-
IS_WEAPP: 'false',
|
|
145
143
|
'process.env.SUPPORT_DINGTALK_NAVIGATE': JSON.stringify('disabled'),
|
|
146
144
|
DEPRECATED_ADAPTER_COMPONENT: 'false'
|
|
147
145
|
}
|
package/src/vite/targets/wx.ts
CHANGED
|
@@ -99,8 +99,6 @@ function createWechatTaroDefines(): Record<string, string> {
|
|
|
99
99
|
'process.env.TARO_ENV': JSON.stringify('weapp'),
|
|
100
100
|
'process.env.TARO_PLATFORM': JSON.stringify('mini'),
|
|
101
101
|
'process.env.TARO_VERSION': JSON.stringify(taroVersion),
|
|
102
|
-
IS_H5: 'false',
|
|
103
|
-
IS_WEAPP: 'true',
|
|
104
102
|
ENABLE_ADJACENT_HTML: 'false',
|
|
105
103
|
ENABLE_CLONE_NODE: 'false',
|
|
106
104
|
ENABLE_CONTAINS: 'false',
|