vite-plugin-taro 0.4.2 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,6 @@
1
+ import type { InputOptions } from 'rolldown';
2
+ type DevMode = NonNullable<NonNullable<InputOptions['experimental']>['devMode']>;
3
+ type DevModeOptions = Exclude<DevMode, boolean>;
4
+ /** Installs the custom WX runtime while restoring Rolldown's common runtime base. */
5
+ export declare function createWxDevMode(devMode: DevMode | undefined, implement: string): DevModeOptions;
6
+ export {};
@@ -0,0 +1,9 @@
1
+ /** Installs the custom WX runtime while restoring Rolldown's common runtime base. */
2
+ export function createWxDevMode(devMode, implement) {
3
+ return {
4
+ ...(typeof devMode === 'object' ? devMode : {}),
5
+ implement,
6
+ lazy: false,
7
+ skipCommonRuntimeInjection: false
8
+ };
9
+ }
@@ -5,6 +5,7 @@ import { dev, viteReporterPlugin } from 'rolldown/experimental';
5
5
  import { once } from '../../../utils/once.js';
6
6
  import { resolvePackageFile } from '../../../utils/packages.js';
7
7
  import { appShellFileName } from '../module.js';
8
+ import { createWxDevMode } from './create-wx-dev-mode.js';
8
9
  import { emptyOutputDirectory } from './empty-output-directory.js';
9
10
  import { hmrControlPath, hmrInfoFileName, hmrPatchesFileName, renderHmrInfo, renderInitialHmrPatches, writeHmrFile } from './hmr-files.js';
10
11
  import { PatchPublisher } from './patch-publisher.js';
@@ -185,13 +186,7 @@ export async function createWxDevHost({ server, options }) {
185
186
  sourcemap: false
186
187
  });
187
188
  rolldownOptions.experimental ??= {};
188
- rolldownOptions.experimental.devMode = {
189
- ...(typeof rolldownOptions.experimental.devMode === 'object'
190
- ? rolldownOptions.experimental.devMode
191
- : {}),
192
- implement: await bundleRuntimeSource(),
193
- lazy: false
194
- };
189
+ rolldownOptions.experimental.devMode = createWxDevMode(rolldownOptions.experimental.devMode, await bundleRuntimeSource());
195
190
  const emptyOutputDirectoryPlugin = {
196
191
  name: 'vpt:wx-empty-output-directory',
197
192
  renderStart: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite-plugin-taro",
3
- "version": "0.4.2",
3
+ "version": "0.5.0",
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",
@@ -71,16 +71,16 @@
71
71
  "picocolors": "^1.1.1",
72
72
  "react-reconciler": "0.33.0",
73
73
  "react-refresh": "^0.18.0",
74
- "rolldown": "~1.2.2",
74
+ "rolldown": "1.2.3",
75
75
  "tailwindcss": "^4.3.3",
76
76
  "weapp-tailwindcss": "^5.2.11",
77
- "@tarojs/plugin-framework-react": "npm:vite-plugin-taro-plugin-framework-react@0.4.2",
78
- "@tarojs/react": "npm:vite-plugin-taro-react@0.4.2"
77
+ "@tarojs/plugin-framework-react": "npm:vite-plugin-taro-plugin-framework-react@0.5.0",
78
+ "@tarojs/react": "npm:vite-plugin-taro-react@0.5.0"
79
79
  },
80
80
  "peerDependencies": {
81
81
  "react": "^19.0.0",
82
82
  "react-dom": "^19.0.0",
83
- "vite": "^8.2.0"
83
+ "vite": "8.2.1"
84
84
  },
85
85
  "devDependencies": {
86
86
  "@types/babel__core": "^7.20.5",
@@ -90,7 +90,7 @@
90
90
  "@types/react-dom": "^19.2.3",
91
91
  "@types/react-refresh": "^0.14.7",
92
92
  "typescript": "^7.0.2",
93
- "vite": "^8.2.0"
93
+ "vite": "8.2.1"
94
94
  },
95
95
  "scripts": {
96
96
  "build": "node ../../scripts/sync-plugin-readme.ts && node ../../scripts/clean-directory.ts dist && tsc --project tsconfig.build.json",
@@ -0,0 +1,14 @@
1
+ import type { InputOptions } from 'rolldown'
2
+
3
+ type DevMode = NonNullable<NonNullable<InputOptions['experimental']>['devMode']>
4
+ type DevModeOptions = Exclude<DevMode, boolean>
5
+
6
+ /** Installs the custom WX runtime while restoring Rolldown's common runtime base. */
7
+ export function createWxDevMode(devMode: DevMode | undefined, implement: string): DevModeOptions {
8
+ return {
9
+ ...(typeof devMode === 'object' ? devMode : {}),
10
+ implement,
11
+ lazy: false,
12
+ skipCommonRuntimeInjection: false
13
+ }
14
+ }
@@ -9,6 +9,7 @@ import type { VitePluginTaroOptions } from '../../../../options.ts'
9
9
  import { once } from '../../../utils/once.ts'
10
10
  import { resolvePackageFile } from '../../../utils/packages.ts'
11
11
  import { appShellFileName } from '../module.ts'
12
+ import { createWxDevMode } from './create-wx-dev-mode.ts'
12
13
  import { emptyOutputDirectory } from './empty-output-directory.ts'
13
14
  import {
14
15
  type HmrInfo,
@@ -245,13 +246,10 @@ export async function createWxDevHost({
245
246
  })
246
247
 
247
248
  rolldownOptions.experimental ??= {}
248
- rolldownOptions.experimental.devMode = {
249
- ...(typeof rolldownOptions.experimental.devMode === 'object'
250
- ? rolldownOptions.experimental.devMode
251
- : {}),
252
- implement: await bundleRuntimeSource(),
253
- lazy: false
254
- }
249
+ rolldownOptions.experimental.devMode = createWxDevMode(
250
+ rolldownOptions.experimental.devMode,
251
+ await bundleRuntimeSource()
252
+ )
255
253
 
256
254
  const emptyOutputDirectoryPlugin: Plugin = {
257
255
  name: 'vpt:wx-empty-output-directory',