@open-wxa/wxa-runner-core 0.5.0 → 0.7.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/index.d.mts +26 -8
- package/dist/index.d.ts +26 -8
- package/dist/index.js +316 -87
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +310 -81
- package/dist/index.mjs.map +1 -1
- package/dist/runtime/frame.js +50 -1
- package/dist/runtime/frame.js.map +1 -1
- package/dist/runtime/host.js +32 -12
- package/dist/runtime/host.js.map +1 -1
- package/dist/runtime/worker.js +42 -0
- package/dist/runtime/worker.js.map +1 -0
- package/dist/{setup-Cv340Lvj.d.mts → setup-DZ5FeKay.d.mts} +2 -1
- package/dist/{setup-Cv340Lvj.d.ts → setup-DZ5FeKay.d.ts} +2 -1
- package/dist/setup.d.mts +1 -1
- package/dist/setup.d.ts +1 -1
- package/dist/test-api.d.mts +2 -2
- package/dist/test-api.d.ts +2 -2
- package/dist/{testApi-nKsjjEhz.d.ts → testApi-BLozOgCt.d.ts} +1 -1
- package/dist/{testApi-DO2FyR78.d.mts → testApi-CnZOLyWw.d.mts} +1 -1
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ResolvedBaseLib } from '@open-wxa/wxa-runner-extractor';
|
|
2
|
-
import { D as DeviceProfile } from './setup-
|
|
3
|
-
export { A as ApiContext, a as ApiHandler, b as ApiResult, c as AppInfo, M as MockConfig, d as MockRequest, e as MockResponse, f as MockValue, N as NetworkConfig, R as RouteHandler, S as SetupApi, g as SetupConfig, h as SetupContext, i as SetupDefinition } from './setup-
|
|
4
|
-
export { F as FrameError, P as PageSnapshot, R as RecordedRequest, W as WxaTestApi } from './testApi-
|
|
2
|
+
import { D as DeviceProfile } from './setup-DZ5FeKay.mjs';
|
|
3
|
+
export { A as ApiContext, a as ApiHandler, b as ApiResult, c as AppInfo, M as MockConfig, d as MockRequest, e as MockResponse, f as MockValue, N as NetworkConfig, R as RouteHandler, S as SetupApi, g as SetupConfig, h as SetupContext, i as SetupDefinition } from './setup-DZ5FeKay.mjs';
|
|
4
|
+
export { F as FrameError, P as PageSnapshot, R as RecordedRequest, W as WxaTestApi } from './testApi-CnZOLyWw.mjs';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* 小程序项目结构解析
|
|
@@ -32,8 +32,10 @@ interface AppJson {
|
|
|
32
32
|
}>;
|
|
33
33
|
subpackages?: AppJson['subPackages'];
|
|
34
34
|
usingComponents?: Record<string, string>;
|
|
35
|
+
/** isSubpackage:Worker 代码作为分包,业务先调 wx.preDownloadSubpackage({ packageType: 'workers' }) 再创建 Worker */
|
|
35
36
|
workers?: string | {
|
|
36
37
|
path: string;
|
|
38
|
+
isSubpackage?: boolean;
|
|
37
39
|
};
|
|
38
40
|
[key: string]: any;
|
|
39
41
|
}
|
|
@@ -58,6 +60,8 @@ declare class MiniProgram {
|
|
|
58
60
|
pages: string[];
|
|
59
61
|
independent?: boolean;
|
|
60
62
|
}[];
|
|
63
|
+
/** Worker 代码所在目录,不带首尾的 /;没有配置 workers 时为 null */
|
|
64
|
+
workersDir(app: AppJson): string | null;
|
|
61
65
|
/** 主包页面 + 分包页面(带 root 前缀) */
|
|
62
66
|
allPages(app: AppJson): string[];
|
|
63
67
|
/** 读取并预处理页面/组件 json,id 不带扩展名 */
|
|
@@ -73,7 +77,7 @@ declare class MiniProgram {
|
|
|
73
77
|
components: string[];
|
|
74
78
|
};
|
|
75
79
|
/** 列出代码根目录下指定扩展名的文件,返回 posix 风格的相对路径 */
|
|
76
|
-
listFiles(extensions: string[]
|
|
80
|
+
listFiles(extensions: string[]): string[];
|
|
77
81
|
exists(relPath: string): boolean;
|
|
78
82
|
readText(relPath: string): string;
|
|
79
83
|
private isInIndependentSubPackage;
|
|
@@ -93,6 +97,8 @@ declare class MiniProgram {
|
|
|
93
97
|
* 2. wcsc 的公共样式运行时 + app.wxss,与每个页面/组件的 __wxAppCode__ wxss(pageStyles)
|
|
94
98
|
* 两部分在热更新时分别下发
|
|
95
99
|
* 样式和模板里的 env(safe-area-inset-*) 改写成 CSS 变量,见 rewriteSafeAreaInsets
|
|
100
|
+
*
|
|
101
|
+
* Worker:workers 目录下的 JS 不进逻辑层,同样包装成 define 脚本,由 Worker 入口(server/html.ts 的 workerScript)加载
|
|
96
102
|
*/
|
|
97
103
|
|
|
98
104
|
interface BuildResult {
|
|
@@ -100,6 +106,8 @@ interface BuildResult {
|
|
|
100
106
|
wxConfig: Record<string, any>;
|
|
101
107
|
/** 所有 JS 模块 id(如 "pages/index/index.js"),逻辑层按此顺序加载 define 脚本 */
|
|
102
108
|
modules: string[];
|
|
109
|
+
/** workers 目录下的 JS 模块 id,Worker 按此顺序加载 define 脚本 */
|
|
110
|
+
workerModules: string[];
|
|
103
111
|
/** 逻辑层的 $gwx 与 __wxAppCode__ json/wxml,不含 require */
|
|
104
112
|
serviceTemplates: string;
|
|
105
113
|
serviceBootstrap: string;
|
|
@@ -154,14 +162,15 @@ declare class AppBuilder {
|
|
|
154
162
|
* /__wxa__/setup.js 编译后的 setup 文件
|
|
155
163
|
* /__wxa__/appservice.html 逻辑层
|
|
156
164
|
* /__wxa__/webview/<page>.html 渲染层(路径与页面一致,wxml 里的相对资源路径因此能正确解析)
|
|
157
|
-
* /__wxa__/module/<file>.js 单个业务 JS
|
|
165
|
+
* /__wxa__/module/<file>.js 单个业务 JS 模块(含 workers 目录下的)
|
|
166
|
+
* /__wxa__/worker.js?id= Worker 的入口
|
|
158
167
|
* /__wxa__/service-templates.js、page-templates.js 两层的模板(热更新时重新下发)
|
|
159
168
|
* /__wxa__/page-styles.js 渲染层的样式(热更新时重新下发)
|
|
160
169
|
* /__baselib__/* 官方基础库
|
|
161
170
|
* /__wxa__/proxy?url= 网络代理
|
|
162
171
|
* /__wxa__/tmp 临时文件:POST ?type=png 保存,返回可直接访问的地址(GET 支持分段请求);对该地址 HEAD 查大小、DELETE 删除
|
|
163
172
|
* /__wxa__/region/<kind> 地区选择器用的行政区划数据(districts / streets),取自本机开发者工具
|
|
164
|
-
* /__wxa__/api/*
|
|
173
|
+
* /__wxa__/api/* --devtools-login:wx.login 的 code、手机号,服务市场、插件的请求转发,只允许本机访问
|
|
165
174
|
* /__wxa__/ws 文件变化通知:热更新(hot)或整页刷新(reload)
|
|
166
175
|
* 其余路径 小程序目录下的静态资源
|
|
167
176
|
*/
|
|
@@ -183,7 +192,12 @@ interface DevServerOptions {
|
|
|
183
192
|
setup?: string | false;
|
|
184
193
|
/** 浏览器端运行时(host.js / frame.js)所在目录,默认取构建产物 */
|
|
185
194
|
runtimeDir?: string;
|
|
186
|
-
/**
|
|
195
|
+
/**
|
|
196
|
+
* 借本机微信开发者工具的登录态访问微信后台:真实的 wx.login code 和手机号、服务市场、插件。
|
|
197
|
+
* 要先登录开发者工具,会真实请求微信
|
|
198
|
+
*/
|
|
199
|
+
devtoolsLogin?: boolean;
|
|
200
|
+
/** @deprecated 改名为 devtoolsLogin */
|
|
187
201
|
realLogin?: boolean;
|
|
188
202
|
logger?: Pick<Console, 'log' | 'warn' | 'error'>;
|
|
189
203
|
}
|
|
@@ -205,8 +219,10 @@ declare class DevServer {
|
|
|
205
219
|
private address;
|
|
206
220
|
/** 运行时生成的临时文件(canvas 导出、拍照等),随服务器进程存在 */
|
|
207
221
|
private readonly tempFiles;
|
|
208
|
-
|
|
222
|
+
private readonly devtoolsLogin;
|
|
223
|
+
/** 开启 --devtools-login 时才有 */
|
|
209
224
|
private readonly ticketSource;
|
|
225
|
+
private readonly plugins;
|
|
210
226
|
constructor(options: DevServerOptions);
|
|
211
227
|
get url(): string;
|
|
212
228
|
start(): Promise<string>;
|
|
@@ -214,6 +230,8 @@ declare class DevServer {
|
|
|
214
230
|
private createApp;
|
|
215
231
|
/** 先编译一遍 setup:编译错误随 app-info 交给宿主显示,而不是让浏览器 import 失败 */
|
|
216
232
|
private setupInfo;
|
|
233
|
+
/** 构建结果并入这次打开小程序时决定用的插件 */
|
|
234
|
+
private currentBuild;
|
|
217
235
|
/** 需要构建结果的路由;构建失败时返回错误文本 */
|
|
218
236
|
private withBuild;
|
|
219
237
|
private runtimeDir;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ResolvedBaseLib } from '@open-wxa/wxa-runner-extractor';
|
|
2
|
-
import { D as DeviceProfile } from './setup-
|
|
3
|
-
export { A as ApiContext, a as ApiHandler, b as ApiResult, c as AppInfo, M as MockConfig, d as MockRequest, e as MockResponse, f as MockValue, N as NetworkConfig, R as RouteHandler, S as SetupApi, g as SetupConfig, h as SetupContext, i as SetupDefinition } from './setup-
|
|
4
|
-
export { F as FrameError, P as PageSnapshot, R as RecordedRequest, W as WxaTestApi } from './testApi-
|
|
2
|
+
import { D as DeviceProfile } from './setup-DZ5FeKay.js';
|
|
3
|
+
export { A as ApiContext, a as ApiHandler, b as ApiResult, c as AppInfo, M as MockConfig, d as MockRequest, e as MockResponse, f as MockValue, N as NetworkConfig, R as RouteHandler, S as SetupApi, g as SetupConfig, h as SetupContext, i as SetupDefinition } from './setup-DZ5FeKay.js';
|
|
4
|
+
export { F as FrameError, P as PageSnapshot, R as RecordedRequest, W as WxaTestApi } from './testApi-BLozOgCt.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* 小程序项目结构解析
|
|
@@ -32,8 +32,10 @@ interface AppJson {
|
|
|
32
32
|
}>;
|
|
33
33
|
subpackages?: AppJson['subPackages'];
|
|
34
34
|
usingComponents?: Record<string, string>;
|
|
35
|
+
/** isSubpackage:Worker 代码作为分包,业务先调 wx.preDownloadSubpackage({ packageType: 'workers' }) 再创建 Worker */
|
|
35
36
|
workers?: string | {
|
|
36
37
|
path: string;
|
|
38
|
+
isSubpackage?: boolean;
|
|
37
39
|
};
|
|
38
40
|
[key: string]: any;
|
|
39
41
|
}
|
|
@@ -58,6 +60,8 @@ declare class MiniProgram {
|
|
|
58
60
|
pages: string[];
|
|
59
61
|
independent?: boolean;
|
|
60
62
|
}[];
|
|
63
|
+
/** Worker 代码所在目录,不带首尾的 /;没有配置 workers 时为 null */
|
|
64
|
+
workersDir(app: AppJson): string | null;
|
|
61
65
|
/** 主包页面 + 分包页面(带 root 前缀) */
|
|
62
66
|
allPages(app: AppJson): string[];
|
|
63
67
|
/** 读取并预处理页面/组件 json,id 不带扩展名 */
|
|
@@ -73,7 +77,7 @@ declare class MiniProgram {
|
|
|
73
77
|
components: string[];
|
|
74
78
|
};
|
|
75
79
|
/** 列出代码根目录下指定扩展名的文件,返回 posix 风格的相对路径 */
|
|
76
|
-
listFiles(extensions: string[]
|
|
80
|
+
listFiles(extensions: string[]): string[];
|
|
77
81
|
exists(relPath: string): boolean;
|
|
78
82
|
readText(relPath: string): string;
|
|
79
83
|
private isInIndependentSubPackage;
|
|
@@ -93,6 +97,8 @@ declare class MiniProgram {
|
|
|
93
97
|
* 2. wcsc 的公共样式运行时 + app.wxss,与每个页面/组件的 __wxAppCode__ wxss(pageStyles)
|
|
94
98
|
* 两部分在热更新时分别下发
|
|
95
99
|
* 样式和模板里的 env(safe-area-inset-*) 改写成 CSS 变量,见 rewriteSafeAreaInsets
|
|
100
|
+
*
|
|
101
|
+
* Worker:workers 目录下的 JS 不进逻辑层,同样包装成 define 脚本,由 Worker 入口(server/html.ts 的 workerScript)加载
|
|
96
102
|
*/
|
|
97
103
|
|
|
98
104
|
interface BuildResult {
|
|
@@ -100,6 +106,8 @@ interface BuildResult {
|
|
|
100
106
|
wxConfig: Record<string, any>;
|
|
101
107
|
/** 所有 JS 模块 id(如 "pages/index/index.js"),逻辑层按此顺序加载 define 脚本 */
|
|
102
108
|
modules: string[];
|
|
109
|
+
/** workers 目录下的 JS 模块 id,Worker 按此顺序加载 define 脚本 */
|
|
110
|
+
workerModules: string[];
|
|
103
111
|
/** 逻辑层的 $gwx 与 __wxAppCode__ json/wxml,不含 require */
|
|
104
112
|
serviceTemplates: string;
|
|
105
113
|
serviceBootstrap: string;
|
|
@@ -154,14 +162,15 @@ declare class AppBuilder {
|
|
|
154
162
|
* /__wxa__/setup.js 编译后的 setup 文件
|
|
155
163
|
* /__wxa__/appservice.html 逻辑层
|
|
156
164
|
* /__wxa__/webview/<page>.html 渲染层(路径与页面一致,wxml 里的相对资源路径因此能正确解析)
|
|
157
|
-
* /__wxa__/module/<file>.js 单个业务 JS
|
|
165
|
+
* /__wxa__/module/<file>.js 单个业务 JS 模块(含 workers 目录下的)
|
|
166
|
+
* /__wxa__/worker.js?id= Worker 的入口
|
|
158
167
|
* /__wxa__/service-templates.js、page-templates.js 两层的模板(热更新时重新下发)
|
|
159
168
|
* /__wxa__/page-styles.js 渲染层的样式(热更新时重新下发)
|
|
160
169
|
* /__baselib__/* 官方基础库
|
|
161
170
|
* /__wxa__/proxy?url= 网络代理
|
|
162
171
|
* /__wxa__/tmp 临时文件:POST ?type=png 保存,返回可直接访问的地址(GET 支持分段请求);对该地址 HEAD 查大小、DELETE 删除
|
|
163
172
|
* /__wxa__/region/<kind> 地区选择器用的行政区划数据(districts / streets),取自本机开发者工具
|
|
164
|
-
* /__wxa__/api/*
|
|
173
|
+
* /__wxa__/api/* --devtools-login:wx.login 的 code、手机号,服务市场、插件的请求转发,只允许本机访问
|
|
165
174
|
* /__wxa__/ws 文件变化通知:热更新(hot)或整页刷新(reload)
|
|
166
175
|
* 其余路径 小程序目录下的静态资源
|
|
167
176
|
*/
|
|
@@ -183,7 +192,12 @@ interface DevServerOptions {
|
|
|
183
192
|
setup?: string | false;
|
|
184
193
|
/** 浏览器端运行时(host.js / frame.js)所在目录,默认取构建产物 */
|
|
185
194
|
runtimeDir?: string;
|
|
186
|
-
/**
|
|
195
|
+
/**
|
|
196
|
+
* 借本机微信开发者工具的登录态访问微信后台:真实的 wx.login code 和手机号、服务市场、插件。
|
|
197
|
+
* 要先登录开发者工具,会真实请求微信
|
|
198
|
+
*/
|
|
199
|
+
devtoolsLogin?: boolean;
|
|
200
|
+
/** @deprecated 改名为 devtoolsLogin */
|
|
187
201
|
realLogin?: boolean;
|
|
188
202
|
logger?: Pick<Console, 'log' | 'warn' | 'error'>;
|
|
189
203
|
}
|
|
@@ -205,8 +219,10 @@ declare class DevServer {
|
|
|
205
219
|
private address;
|
|
206
220
|
/** 运行时生成的临时文件(canvas 导出、拍照等),随服务器进程存在 */
|
|
207
221
|
private readonly tempFiles;
|
|
208
|
-
|
|
222
|
+
private readonly devtoolsLogin;
|
|
223
|
+
/** 开启 --devtools-login 时才有 */
|
|
209
224
|
private readonly ticketSource;
|
|
225
|
+
private readonly plugins;
|
|
210
226
|
constructor(options: DevServerOptions);
|
|
211
227
|
get url(): string;
|
|
212
228
|
start(): Promise<string>;
|
|
@@ -214,6 +230,8 @@ declare class DevServer {
|
|
|
214
230
|
private createApp;
|
|
215
231
|
/** 先编译一遍 setup:编译错误随 app-info 交给宿主显示,而不是让浏览器 import 失败 */
|
|
216
232
|
private setupInfo;
|
|
233
|
+
/** 构建结果并入这次打开小程序时决定用的插件 */
|
|
234
|
+
private currentBuild;
|
|
217
235
|
/** 需要构建结果的路由;构建失败时返回错误文本 */
|
|
218
236
|
private withBuild;
|
|
219
237
|
private runtimeDir;
|