vite-plugin-taro 0.5.14 → 0.6.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.
- package/dist/node/plugins/client/client-taro.d.ts +2 -2
- package/dist/node/plugins/conditional/conditional-directives.d.ts +2 -2
- package/dist/node/plugins/h5/plugins.d.ts +2 -2
- package/dist/node/plugins/h5/resolver/module-resolver.d.ts +2 -2
- package/dist/node/plugins/h5/transform-app.d.ts +2 -2
- package/dist/node/plugins/h5/transform-app.js +2 -2
- package/dist/node/plugins/wx/dev/create-style-capture.d.ts +16 -4
- package/dist/node/plugins/wx/dev/create-style-capture.js +101 -53
- package/dist/node/plugins/wx/dev/dev-host.d.ts +2 -2
- package/dist/node/plugins/wx/dev/dev-host.js +13 -3
- package/dist/node/plugins/wx/dev/plugins.d.ts +2 -2
- package/dist/node/plugins/wx/dev/wx-dev-options.d.ts +2 -2
- package/dist/node/plugins/wx/output/files.d.ts +2 -2
- package/dist/node/plugins/wx/output/json.d.ts +3 -3
- package/dist/node/plugins/wx/output/json.js +1 -1
- package/dist/node/plugins/wx/output/templates.d.ts +2 -2
- package/dist/node/plugins/wx/plugins.d.ts +2 -2
- package/dist/node/plugins/wx/render/transport.js +1 -1
- package/dist/node/plugins/wx/resolve/resolver.d.ts +2 -2
- package/dist/node/plugins/wx/resolve/specialize-bootstrap.d.ts +2 -2
- package/dist/node/plugins/wx/resolve/specialize-bootstrap.js +1 -1
- package/dist/node/plugins/wx/resolve/specialize-page-capsule.d.ts +2 -2
- package/dist/node/plugins/wx/resolve/specialize-page-capsule.js +2 -2
- package/dist/node/utils/project-config.d.ts +2 -2
- package/dist/node/vpt.d.ts +4 -0
- package/dist/node/{vite-plugin.js → vpt.js} +1 -1
- package/dist/options.d.ts +65 -13
- package/dist/runtime/h5/app.js +2 -2
- package/dist/runtime/wx/amphibious/bootstrap.js +1 -1
- package/dist/runtime/wx/amphibious/transport.js +1 -1
- package/dist/runtime/wx/capsule/page.js +1 -1
- package/dist/vite.d.ts +2 -2
- package/dist/vite.js +1 -1
- package/package.json +3 -3
- package/src/node/plugins/client/client-taro.ts +3 -3
- package/src/node/plugins/conditional/conditional-directives.ts +3 -3
- package/src/node/plugins/h5/plugins.ts +3 -3
- package/src/node/plugins/h5/resolver/module-resolver.ts +2 -2
- package/src/node/plugins/h5/transform-app.ts +5 -5
- package/src/node/plugins/wx/dev/create-style-capture.ts +126 -57
- package/src/node/plugins/wx/dev/dev-host.ts +16 -5
- package/src/node/plugins/wx/dev/plugins.ts +2 -5
- package/src/node/plugins/wx/dev/wx-dev-options.ts +2 -2
- package/src/node/plugins/wx/output/files.ts +2 -2
- package/src/node/plugins/wx/output/json.ts +8 -8
- package/src/node/plugins/wx/output/templates.ts +3 -3
- package/src/node/plugins/wx/plugins.ts +3 -3
- package/src/node/plugins/wx/render/transport.ts +1 -1
- package/src/node/plugins/wx/resolve/resolver.ts +5 -5
- package/src/node/plugins/wx/resolve/specialize-bootstrap.ts +3 -3
- package/src/node/plugins/wx/resolve/specialize-page-capsule.ts +4 -4
- package/src/node/utils/project-config.ts +2 -2
- package/src/node/{vite-plugin.ts → vpt.ts} +2 -2
- package/src/options.ts +71 -13
- package/src/runtime/h5/app.ts +4 -4
- package/src/runtime/wx/amphibious/bootstrap.ts +2 -2
- package/src/runtime/wx/amphibious/transport.ts +2 -4
- package/src/runtime/wx/capsule/page.ts +3 -8
- package/src/vite.ts +2 -2
- package/dist/node/vite-plugin.d.ts +0 -4
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Rolldown } from 'vite'
|
|
2
|
-
import type {
|
|
2
|
+
import type { VptJsonObject, VptOptions, VptPageOption } from '../../../../options.ts'
|
|
3
3
|
import { createAppConfig } from '../../../utils/project-config.ts'
|
|
4
4
|
import type { GeneratedSubpackage } from '../placement/placer.ts'
|
|
5
5
|
import { isGeneratedSubpackageFile } from '../placement/plan.ts'
|
|
@@ -11,7 +11,7 @@ export function createJsonAssets({
|
|
|
11
11
|
subpackages,
|
|
12
12
|
nativeComponents
|
|
13
13
|
}: {
|
|
14
|
-
options:
|
|
14
|
+
options: VptOptions
|
|
15
15
|
subpackages: readonly GeneratedSubpackage[]
|
|
16
16
|
nativeComponents: readonly { name: string; componentPath: string }[]
|
|
17
17
|
}): Rolldown.EmittedAsset[] {
|
|
@@ -29,15 +29,15 @@ export function createJsonAssets({
|
|
|
29
29
|
? [createJsonAsset('project.private.config.json', options.projectPrivateConfigJson)]
|
|
30
30
|
: []),
|
|
31
31
|
|
|
32
|
-
createJsonAsset('sitemap.json', options.sitemapJson)
|
|
32
|
+
...(options.sitemapJson ? [createJsonAsset('sitemap.json', options.sitemapJson)] : [])
|
|
33
33
|
]
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
/** Creates Page JSON with generated Taro and native component registrations. */
|
|
37
37
|
function createPageJson(
|
|
38
|
-
page:
|
|
38
|
+
page: VptPageOption,
|
|
39
39
|
nativeComponents: readonly { name: string; componentPath: string }[]
|
|
40
|
-
):
|
|
40
|
+
): VptJsonObject {
|
|
41
41
|
const usingComponents = isJsonObject(page.config.usingComponents) ? page.config.usingComponents : {}
|
|
42
42
|
|
|
43
43
|
// Cross-package components require a placeholder while WeChat downloads their generated subpackage. Paths are
|
|
@@ -60,17 +60,17 @@ function createPageJson(
|
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
/** Tests whether a configured JSON value can be merged as an object. */
|
|
63
|
-
function isJsonObject(value: unknown): value is
|
|
63
|
+
function isJsonObject(value: unknown): value is VptJsonObject {
|
|
64
64
|
return typeof value === 'object' && value !== null && !Array.isArray(value)
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
/** Serializes one native JSON object with stable formatting. */
|
|
68
|
-
export function renderJson(value:
|
|
68
|
+
export function renderJson(value: VptJsonObject): string {
|
|
69
69
|
return `${JSON.stringify(value, null, 4)}\n`
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
/** Creates one native JSON asset. */
|
|
73
|
-
function createJsonAsset(fileName: string, value:
|
|
73
|
+
function createJsonAsset(fileName: string, value: VptJsonObject): Rolldown.EmittedAsset {
|
|
74
74
|
return {
|
|
75
75
|
type: 'asset',
|
|
76
76
|
fileName,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { recursiveMerge } from '@tarojs/helper'
|
|
2
2
|
import { Weapp as WxPlatform } from '@tarojs/plugin-platform-weapp'
|
|
3
3
|
import type { Rolldown } from 'vite'
|
|
4
|
-
import type {
|
|
4
|
+
import type { VptJsonObject, VptOptions } from '../../../../options.ts'
|
|
5
5
|
import { normalizeModuleId } from '../../../utils/modules.ts'
|
|
6
6
|
import { packageRequire } from '../../../utils/packages.ts'
|
|
7
7
|
import { renderJson } from './json.ts'
|
|
@@ -19,7 +19,7 @@ const taroComponentsModulePath = packageRequire.resolve('@tarojs/plugin-platform
|
|
|
19
19
|
/** Creates Taro's shared WeChat templates and native WXML/WXSS companions for every Page. */
|
|
20
20
|
export function createTemplateAssets(
|
|
21
21
|
bundle: Rolldown.OutputBundle,
|
|
22
|
-
options:
|
|
22
|
+
options: VptOptions,
|
|
23
23
|
nativeComponents: readonly {
|
|
24
24
|
name: string
|
|
25
25
|
fields: readonly string[]
|
|
@@ -121,7 +121,7 @@ function toDashed(value: string): string {
|
|
|
121
121
|
}
|
|
122
122
|
|
|
123
123
|
/** Creates the recursive component configuration expected by Taro's templates. */
|
|
124
|
-
function createComponentJson():
|
|
124
|
+
function createComponentJson(): VptJsonObject {
|
|
125
125
|
return {
|
|
126
126
|
component: true,
|
|
127
127
|
styleIsolation: 'apply-shared',
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Plugin, PluginOption } from 'vite'
|
|
2
|
-
import type {
|
|
2
|
+
import type { VptOptions } from '../../../options.ts'
|
|
3
3
|
import { esTarget } from '../../utils/constant.ts'
|
|
4
4
|
import { packageRequire } from '../../utils/packages.ts'
|
|
5
5
|
import { clientTaroNativeId } from '../client/constant.ts'
|
|
@@ -18,7 +18,7 @@ import { createWxStylePlugins } from './styles/plugins.ts'
|
|
|
18
18
|
type WxResolver = ReturnType<typeof createResolver>
|
|
19
19
|
|
|
20
20
|
/** Creates the complete plugin set for the wx target. */
|
|
21
|
-
export function createWxTargetPlugins(options:
|
|
21
|
+
export function createWxTargetPlugins(options: VptOptions): PluginOption[] {
|
|
22
22
|
const resolver = createResolver(options)
|
|
23
23
|
|
|
24
24
|
// Reuse the resolver instance's ordered application subset. Rolldown's complete input also contains bootstrap, transport,
|
|
@@ -31,7 +31,7 @@ export function createWxTargetPlugins(options: VitePluginTaroOptions): PluginOpt
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
/** Configures the complete wx target build pipeline. */
|
|
34
|
-
function createWxPlugin(options:
|
|
34
|
+
function createWxPlugin(options: VptOptions, resolver: WxResolver): Plugin {
|
|
35
35
|
const placer = createPlacer()
|
|
36
36
|
|
|
37
37
|
return {
|
|
@@ -4,7 +4,7 @@ import type { Rolldown } from 'vite'
|
|
|
4
4
|
import { type AstTransformResult, replaceWithAst } from '../../../utils/transform.ts'
|
|
5
5
|
import { getWxExecutionKind } from '../module.ts'
|
|
6
6
|
|
|
7
|
-
const transportPlaceholder = '
|
|
7
|
+
const transportPlaceholder = '__VPT_TRANSPORT__'
|
|
8
8
|
const moduleIdParameter = 'moduleId'
|
|
9
9
|
const exportBindingParameter = 'exportBinding'
|
|
10
10
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { normalizePath } from 'vite'
|
|
2
|
-
import type {
|
|
2
|
+
import type { VptOptions, VptPageOption } from '../../../../options.ts'
|
|
3
3
|
import { normalizeModuleId, resolveAppComponentPath, resolvePageComponentPath } from '../../../utils/modules.ts'
|
|
4
4
|
import { createAppConfig } from '../../../utils/project-config.ts'
|
|
5
5
|
import { appComponentId } from '../../client/constant.ts'
|
|
@@ -25,7 +25,7 @@ import { specializePageCapsule } from './specialize-page-capsule.ts'
|
|
|
25
25
|
type PrivateIdResolver = (importer: string | undefined, projectRoot: string) => string
|
|
26
26
|
|
|
27
27
|
/** Creates the resolver and source specializer for the wx module graph. */
|
|
28
|
-
export function createResolver(options:
|
|
28
|
+
export function createResolver(options: VptOptions) {
|
|
29
29
|
const normalizedBootstrapPath = normalizePath(bootstrapPath)
|
|
30
30
|
const normalizedPageCapsulePath = normalizePath(pageCapsulePath)
|
|
31
31
|
|
|
@@ -87,7 +87,7 @@ export function createResolver(options: VitePluginTaroOptions) {
|
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
/** Declares output entries and the ordered application subset that can own user styles. */
|
|
90
|
-
function createEntryGraph(pages: readonly
|
|
90
|
+
function createEntryGraph(pages: readonly VptPageOption[]) {
|
|
91
91
|
const pageEntries = pages.map((page) => {
|
|
92
92
|
return {
|
|
93
93
|
capsuleId: createRouteModuleId({ moduleId: pageCapsulePath, pagePath: page.path }),
|
|
@@ -128,8 +128,8 @@ function requireConfiguredPage({
|
|
|
128
128
|
pageByPath
|
|
129
129
|
}: {
|
|
130
130
|
moduleId: string | undefined
|
|
131
|
-
pageByPath: ReadonlyMap<string,
|
|
132
|
-
}):
|
|
131
|
+
pageByPath: ReadonlyMap<string, VptPageOption>
|
|
132
|
+
}): VptPageOption {
|
|
133
133
|
const queryIndex = moduleId?.indexOf('?') ?? -1
|
|
134
134
|
const pagePath = queryIndex === -1 ? undefined : new URLSearchParams(moduleId?.slice(queryIndex + 1)).get('route')
|
|
135
135
|
const page = pagePath ? pageByPath.get(pagePath) : undefined
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { types } from '@babel/core'
|
|
2
|
-
import type {
|
|
2
|
+
import type { VptJsonObject } from '../../../../options.ts'
|
|
3
3
|
import { type AstTransformResult, replaceWithAst } from '../../../utils/transform.ts'
|
|
4
4
|
|
|
5
|
-
const appConfigPlaceholder = '
|
|
5
|
+
const appConfigPlaceholder = '__VPT_APP_CONFIG__'
|
|
6
6
|
|
|
7
7
|
/** Specializes the amphibious bootstrap with the shared App configuration. */
|
|
8
8
|
export function specializeBootstrap({
|
|
@@ -13,7 +13,7 @@ export function specializeBootstrap({
|
|
|
13
13
|
}: {
|
|
14
14
|
code: string
|
|
15
15
|
id: string
|
|
16
|
-
appConfig:
|
|
16
|
+
appConfig: VptJsonObject
|
|
17
17
|
sourcemap?: boolean
|
|
18
18
|
}): Promise<AstTransformResult> {
|
|
19
19
|
return replaceWithAst(
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { types } from '@babel/core'
|
|
2
|
-
import type {
|
|
2
|
+
import type { VptPageOption } from '../../../../options.ts'
|
|
3
3
|
import { type AstTransformResult, replaceWithAst } from '../../../utils/transform.ts'
|
|
4
4
|
|
|
5
|
-
const pagePathPlaceholder = '
|
|
6
|
-
const pageConfigPlaceholder = '
|
|
5
|
+
const pagePathPlaceholder = '__VPT_PAGE_PATH__'
|
|
6
|
+
const pageConfigPlaceholder = '__VPT_PAGE_CONFIG__'
|
|
7
7
|
|
|
8
8
|
/** Specializes the Page capsule for one configured route. */
|
|
9
9
|
export function specializePageCapsule({
|
|
@@ -14,7 +14,7 @@ export function specializePageCapsule({
|
|
|
14
14
|
}: {
|
|
15
15
|
code: string
|
|
16
16
|
id: string
|
|
17
|
-
page:
|
|
17
|
+
page: VptPageOption
|
|
18
18
|
sourcemap?: boolean
|
|
19
19
|
}): Promise<AstTransformResult> {
|
|
20
20
|
return replaceWithAst(
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { VptJsonObject, VptOptions } from '../../options.ts'
|
|
2
2
|
|
|
3
3
|
/** Creates shared App configuration with configured Page order as the authoritative value. */
|
|
4
|
-
export function createAppConfig(options:
|
|
4
|
+
export function createAppConfig(options: VptOptions): VptJsonObject {
|
|
5
5
|
const { subPackages: _subPackages, subpackages: _subpackages, ...appJson } = options.appJson
|
|
6
6
|
return {
|
|
7
7
|
...appJson,
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import react from '@vitejs/plugin-react'
|
|
2
2
|
import type { PluginOption } from 'vite'
|
|
3
|
-
import type {
|
|
3
|
+
import type { VptOptions } from '../options.ts'
|
|
4
4
|
import { createClientTaroPlugin } from './plugins/client/client-taro.ts'
|
|
5
5
|
import { createConditionalDirectivePlugin } from './plugins/conditional/conditional-directives.ts'
|
|
6
6
|
import { createH5TargetPlugins } from './plugins/h5/plugins.ts'
|
|
7
7
|
import { createWxTargetPlugins } from './plugins/wx/plugins.ts'
|
|
8
8
|
|
|
9
9
|
/** Creates the Vite plugins for one Taro target. */
|
|
10
|
-
export default function
|
|
10
|
+
export default function vpt(options: VptOptions): PluginOption[] {
|
|
11
11
|
return [
|
|
12
12
|
createConditionalDirectivePlugin(options.target),
|
|
13
13
|
createClientTaroPlugin(options.target),
|
package/src/options.ts
CHANGED
|
@@ -1,24 +1,82 @@
|
|
|
1
1
|
/** A JSON object used by generated target configs. */
|
|
2
|
-
export type
|
|
2
|
+
export type VptJsonObject = Record<string, unknown>
|
|
3
3
|
|
|
4
4
|
/** Build target handled by this plugin. */
|
|
5
|
-
export type
|
|
5
|
+
export type VptTarget = 'wx' | 'h5'
|
|
6
6
|
|
|
7
7
|
/** Configures one Taro page. */
|
|
8
|
-
export type
|
|
9
|
-
/**
|
|
8
|
+
export type VptPageOption = {
|
|
9
|
+
/**
|
|
10
|
+
* Taro route and output path without a file extension.
|
|
11
|
+
*
|
|
12
|
+
* The plugin resolves the page component from `src/${path}.tsx`, relative to the Vite project root. For example,
|
|
13
|
+
* `pages/home/index` resolves to `src/pages/home/index.tsx` and is emitted under `pages/home/index` for `wx`.
|
|
14
|
+
*/
|
|
10
15
|
path: string
|
|
11
16
|
|
|
12
|
-
|
|
17
|
+
/**
|
|
18
|
+
* Target-independent Taro page configuration.
|
|
19
|
+
*
|
|
20
|
+
* For `wx`, these values form the generated `<path>.json`; the plugin augments `usingComponents` with its generated
|
|
21
|
+
* component registrations. For `h5`, the values are added to the corresponding Taro router entry.
|
|
22
|
+
*/
|
|
23
|
+
config: VptJsonObject
|
|
13
24
|
}
|
|
14
25
|
|
|
15
|
-
/** Configures
|
|
16
|
-
export interface
|
|
17
|
-
|
|
26
|
+
/** Configures vpt for one build target. */
|
|
27
|
+
export interface VptOptions {
|
|
28
|
+
/**
|
|
29
|
+
* Platform produced by the current Vite invocation.
|
|
30
|
+
*
|
|
31
|
+
* Use `wx` to emit a WeChat Mini Program or `h5` to emit a browser application. The selected target controls Taro
|
|
32
|
+
* module resolution, conditional compilation, runtime bootstrapping, style processing, and output generation.
|
|
33
|
+
*/
|
|
34
|
+
target: VptTarget
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Source module that default-exports the root React application component.
|
|
38
|
+
*
|
|
39
|
+
* Relative paths are resolved from Vite's project root, for example `src/app.tsx`. The component wraps the active
|
|
40
|
+
* page through its `children` prop and is the appropriate place to import application-wide styles.
|
|
41
|
+
*/
|
|
18
42
|
app: string
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Complete ordered list of application pages.
|
|
46
|
+
*
|
|
47
|
+
* The declared order becomes the `pages` order in the generated `app.json`, the H5 route order, and the Page order
|
|
48
|
+
* in the application style cascade. Each Page source is resolved according to its `path`.
|
|
49
|
+
*/
|
|
50
|
+
pages: VptPageOption[]
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Target-independent Taro application configuration.
|
|
54
|
+
*
|
|
55
|
+
* For `wx`, these values form the generated `app.json`. For `h5`, they configure the Taro application and router.
|
|
56
|
+
* The plugin always derives `pages` from {@link pages}; caller-provided `pages`, `subPackages`, and `subpackages`
|
|
57
|
+
* values are discarded because the build pipeline owns page order and generated package placement.
|
|
58
|
+
*/
|
|
59
|
+
appJson: VptJsonObject
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* WeChat DevTools project configuration written to `project.config.json` without merging.
|
|
63
|
+
*
|
|
64
|
+
* This option is required so one configuration shape can be shared between targets, but it is only emitted for a
|
|
65
|
+
* `wx` build and is ignored for `h5`.
|
|
66
|
+
*/
|
|
67
|
+
projectConfigJson: VptJsonObject
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Local WeChat DevTools overrides written to `project.private.config.json` without merging.
|
|
71
|
+
*
|
|
72
|
+
* The file is emitted only when this value is provided for a `wx` build. It is ignored for `h5`.
|
|
73
|
+
*/
|
|
74
|
+
projectPrivateConfigJson?: VptJsonObject
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* WeChat Mini Program indexing rules written to `sitemap.json` without merging.
|
|
78
|
+
*
|
|
79
|
+
* The file is emitted only when this value is provided for a `wx` build. It is ignored for `h5`.
|
|
80
|
+
*/
|
|
81
|
+
sitemapJson?: VptJsonObject
|
|
24
82
|
}
|
package/src/runtime/h5/app.ts
CHANGED
|
@@ -8,16 +8,16 @@ import ReactDOM from 'react-dom/client'
|
|
|
8
8
|
// @ts-expect-error: The H5 build resolves this private App component.
|
|
9
9
|
import AppComponent from '\0vpt:app-component'
|
|
10
10
|
|
|
11
|
-
declare const
|
|
12
|
-
declare const
|
|
11
|
+
declare const __VPT_H5_APP_CONFIG__: SpaRouterConfig
|
|
12
|
+
declare const __VPT_H5_ROUTES__: Route[]
|
|
13
13
|
|
|
14
14
|
const browserWindow = window as unknown as Window &
|
|
15
15
|
typeof window & {
|
|
16
16
|
__taroAppConfig: SpaRouterConfig
|
|
17
17
|
}
|
|
18
|
-
const config =
|
|
18
|
+
const config = __VPT_H5_APP_CONFIG__
|
|
19
19
|
browserWindow.__taroAppConfig = config
|
|
20
|
-
config.routes =
|
|
20
|
+
config.routes = __VPT_H5_ROUTES__
|
|
21
21
|
const app = createReactApp(AppComponent, React, ReactDOM, config)
|
|
22
22
|
const history = createHashHistory({ window: browserWindow })
|
|
23
23
|
handleAppMount(config, history)
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
import '../systemjs/system-core.js'
|
|
3
3
|
import { transport } from './transport.ts'
|
|
4
4
|
|
|
5
|
-
declare const
|
|
5
|
+
declare const __VPT_APP_CONFIG__: Record<string, unknown>
|
|
6
6
|
|
|
7
7
|
/** Shares one App configuration object between the specialized bootstrap and App capsule. */
|
|
8
|
-
export const appConfig =
|
|
8
|
+
export const appConfig = __VPT_APP_CONFIG__
|
|
9
9
|
|
|
10
10
|
// WX has no modulepreload transport. Genuine application import() boundaries retain System.import() and may load
|
|
11
11
|
// asynchronous subpackage or top-level-await graphs through this identity wrapper.
|
|
@@ -2,9 +2,7 @@
|
|
|
2
2
|
// amphibious boundary that publishes native namespaces to SystemJS without re-evaluating their module bodies.
|
|
3
3
|
|
|
4
4
|
/** Materialized from the preliminary output graph before Rolldown finalizes content hashes. */
|
|
5
|
-
declare const
|
|
6
|
-
moduleId: string
|
|
7
|
-
) => System.Registration | PromiseLike<System.Registration>
|
|
5
|
+
declare const __VPT_TRANSPORT__: (moduleId: string) => System.Registration | PromiseLike<System.Registration>
|
|
8
6
|
|
|
9
7
|
/** Dispatches to one generated literal require and bridges amphibious CommonJS namespaces inline. */
|
|
10
|
-
export const transport =
|
|
8
|
+
export const transport = __VPT_TRANSPORT__
|
|
@@ -5,14 +5,9 @@ import './app.ts'
|
|
|
5
5
|
import PageComponent from '\0vpt:page-component'
|
|
6
6
|
import { createPageConfig } from './taro-runtime.ts'
|
|
7
7
|
|
|
8
|
-
declare const
|
|
9
|
-
declare const
|
|
8
|
+
declare const __VPT_PAGE_PATH__: string
|
|
9
|
+
declare const __VPT_PAGE_CONFIG__: Record<string, unknown>
|
|
10
10
|
|
|
11
|
-
const config = createPageConfig(
|
|
12
|
-
PageComponent,
|
|
13
|
-
__VITE_PLUGIN_TARO_PAGE_PATH__,
|
|
14
|
-
{ root: { cn: [] } },
|
|
15
|
-
__VITE_PLUGIN_TARO_PAGE_CONFIG__
|
|
16
|
-
)
|
|
11
|
+
const config = createPageConfig(PageComponent, __VPT_PAGE_PATH__, { root: { cn: [] } }, __VPT_PAGE_CONFIG__)
|
|
17
12
|
|
|
18
13
|
export default config
|
package/src/vite.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default } from './node/
|
|
2
|
-
export type {
|
|
1
|
+
export { default } from './node/vpt.ts'
|
|
2
|
+
export type { VptJsonObject, VptOptions, VptPageOption, VptTarget } from './options.ts'
|