@open-wxa/wxa-runner-core 0.9.0 → 0.10.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.mts +34 -2
- package/dist/index.d.ts +34 -2
- package/dist/index.js +373 -166
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +373 -166
- package/dist/index.mjs.map +1 -1
- package/dist/runtime/frame.js +90 -77
- package/dist/runtime/frame.js.map +1 -1
- package/dist/runtime/host.js +81 -48
- package/dist/runtime/host.js.map +1 -1
- package/package.json +6 -3
package/dist/index.d.mts
CHANGED
|
@@ -4,6 +4,31 @@ import { D as DeviceProfile, F as ForwardConsole } from './setup-Bac8XdhR.mjs';
|
|
|
4
4
|
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-Bac8XdhR.mjs';
|
|
5
5
|
export { F as FrameError, P as PageSnapshot, R as RecordedRequest, W as WxaTestApi } from './testApi-DHuEW5Cl.mjs';
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* 样式预处理:project.config.json 的 setting.useCompilerPlugins 开启 less / sass 时,
|
|
9
|
+
* 按开发者工具(summer 编译器的 summer-less、summer-sass 插件)的规则把 .less / .scss / .sass 编译成同名的 .wxss
|
|
10
|
+
*
|
|
11
|
+
* - 同一路径有多种源文件时,预处理文件覆盖 .wxss;less 和 sass 都开启时,在 useCompilerPlugins 里排在后面的优先,.scss 优先于 .sass
|
|
12
|
+
* - 除公共文件本身外,每个 .less 先引用小程序根目录的 app.less(lessSetting.commonUseFilePath),
|
|
13
|
+
* 每个 .scss / .sass 先 @use global.scss 或 global.sass(sassSetting);公共文件不存在时跳过
|
|
14
|
+
* - @import "x.wxss"; 原样保留,由 wcsc 处理
|
|
15
|
+
* - 编译器优先用项目里安装的 less / sass,没装时用 wxa-runner 自带的(开发者工具也自带编译器)
|
|
16
|
+
*
|
|
17
|
+
* wcsc 只接收文件路径、自己从磁盘读文件:和 WxmlMirror 一样,把编译结果和原有的 .wxss 写进临时目录,让 wcsc 在这里编译。
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
type StylePluginName = 'less' | 'sass';
|
|
21
|
+
interface StyleSetting {
|
|
22
|
+
/** 开启的样式插件,按 useCompilerPlugins 里的顺序 */
|
|
23
|
+
plugins: StylePluginName[];
|
|
24
|
+
/** ["less", { globalVars }] 写法给出的 less 全局变量 */
|
|
25
|
+
lessGlobalVars: Record<string, string>;
|
|
26
|
+
/** 相对小程序根目录 */
|
|
27
|
+
lessCommonFile: string;
|
|
28
|
+
sassCommonFile: string;
|
|
29
|
+
scssCommonFile: string;
|
|
30
|
+
}
|
|
31
|
+
|
|
7
32
|
/**
|
|
8
33
|
* 小程序项目结构解析
|
|
9
34
|
*
|
|
@@ -11,6 +36,7 @@ export { F as FrameError, P as PageSnapshot, R as RecordedRequest, W as WxaTestA
|
|
|
11
36
|
* - app.json 的全局 usingComponents 展开到每个页面和组件(miniprogram_npm 内除外)
|
|
12
37
|
* - 每个页面/组件 json 都保证有 usingComponents 字段
|
|
13
38
|
*/
|
|
39
|
+
|
|
14
40
|
interface AppJson {
|
|
15
41
|
pages: string[];
|
|
16
42
|
entryPagePath?: string;
|
|
@@ -54,6 +80,8 @@ declare class MiniProgram {
|
|
|
54
80
|
readonly root: string;
|
|
55
81
|
readonly appid: string;
|
|
56
82
|
constructor(projectPath: string);
|
|
83
|
+
/** project.config.json 里与 less / sass 编译插件有关的设置;每次重新读取,开发中修改了也能生效 */
|
|
84
|
+
get styleSetting(): StyleSetting;
|
|
57
85
|
readAppJson(): AppJson;
|
|
58
86
|
subPackages(app: AppJson): {
|
|
59
87
|
[key: string]: any;
|
|
@@ -99,7 +127,8 @@ declare class MiniProgram {
|
|
|
99
127
|
*
|
|
100
128
|
* 渲染层(page-frame):
|
|
101
129
|
* 1. 完整版 $gwx(wcc -cc)与每个页面/组件的 __wxAppCode__ json / wxml(pageTemplates)
|
|
102
|
-
* 2. wcsc 的公共样式运行时 + app.wxss,与每个页面/组件的 __wxAppCode__ wxss(pageStyles
|
|
130
|
+
* 2. wcsc 的公共样式运行时 + app.wxss,与每个页面/组件的 __wxAppCode__ wxss(pageStyles)。
|
|
131
|
+
* 开启 less / sass 编译插件时,先把 .less / .scss / .sass 编译成 .wxss(见 StyleMirror)
|
|
103
132
|
* 两部分在热更新时分别下发
|
|
104
133
|
* 样式和模板里的 env(safe-area-inset-*) 改写成 CSS 变量,见 rewriteSafeAreaInsets
|
|
105
134
|
*
|
|
@@ -141,10 +170,12 @@ declare class AppBuilder {
|
|
|
141
170
|
private wxssCache;
|
|
142
171
|
/** 设置了 wxmlTransform 时才有 */
|
|
143
172
|
private readonly wxmlMirror;
|
|
173
|
+
/** 开启了 less / sass 编译插件时才有;插件设置变了就换一个 */
|
|
174
|
+
private styleMirror;
|
|
144
175
|
constructor(project: MiniProgram, options?: AppBuilderOptions);
|
|
145
176
|
/** wxmlTransform 的镜像目录;没有设置转换或还没编译过时为 null */
|
|
146
177
|
get wxmlMirrorDir(): string | null;
|
|
147
|
-
/** 删除 wxmlTransform
|
|
178
|
+
/** 删除 wxmlTransform 和样式预处理的镜像目录,开发服务器关闭时调用 */
|
|
148
179
|
dispose(): void;
|
|
149
180
|
/** 根据变化的文件标记需要重新构建的部分;返回 true 表示需要刷新 */
|
|
150
181
|
invalidate(changedFiles?: string[]): boolean;
|
|
@@ -164,6 +195,7 @@ declare class AppBuilder {
|
|
|
164
195
|
private compileTemplates;
|
|
165
196
|
/** 与开发者工具一致,项目里的 wxss 全部交给 wcsc:被 @import 的文件(如 uni-app 的 common/main.wxss)也要在列表里 */
|
|
166
197
|
private compileStyles;
|
|
198
|
+
private currentStyleMirror;
|
|
167
199
|
/** $gwx 加上各页面、组件的 json / wxml 注册;逻辑层用裁剪版 $gwx,渲染层用完整版 */
|
|
168
200
|
private createTemplates;
|
|
169
201
|
private createServiceBootstrap;
|
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,31 @@ import { D as DeviceProfile, F as ForwardConsole } from './setup-Bac8XdhR.js';
|
|
|
4
4
|
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-Bac8XdhR.js';
|
|
5
5
|
export { F as FrameError, P as PageSnapshot, R as RecordedRequest, W as WxaTestApi } from './testApi-BOZSXSnV.js';
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* 样式预处理:project.config.json 的 setting.useCompilerPlugins 开启 less / sass 时,
|
|
9
|
+
* 按开发者工具(summer 编译器的 summer-less、summer-sass 插件)的规则把 .less / .scss / .sass 编译成同名的 .wxss
|
|
10
|
+
*
|
|
11
|
+
* - 同一路径有多种源文件时,预处理文件覆盖 .wxss;less 和 sass 都开启时,在 useCompilerPlugins 里排在后面的优先,.scss 优先于 .sass
|
|
12
|
+
* - 除公共文件本身外,每个 .less 先引用小程序根目录的 app.less(lessSetting.commonUseFilePath),
|
|
13
|
+
* 每个 .scss / .sass 先 @use global.scss 或 global.sass(sassSetting);公共文件不存在时跳过
|
|
14
|
+
* - @import "x.wxss"; 原样保留,由 wcsc 处理
|
|
15
|
+
* - 编译器优先用项目里安装的 less / sass,没装时用 wxa-runner 自带的(开发者工具也自带编译器)
|
|
16
|
+
*
|
|
17
|
+
* wcsc 只接收文件路径、自己从磁盘读文件:和 WxmlMirror 一样,把编译结果和原有的 .wxss 写进临时目录,让 wcsc 在这里编译。
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
type StylePluginName = 'less' | 'sass';
|
|
21
|
+
interface StyleSetting {
|
|
22
|
+
/** 开启的样式插件,按 useCompilerPlugins 里的顺序 */
|
|
23
|
+
plugins: StylePluginName[];
|
|
24
|
+
/** ["less", { globalVars }] 写法给出的 less 全局变量 */
|
|
25
|
+
lessGlobalVars: Record<string, string>;
|
|
26
|
+
/** 相对小程序根目录 */
|
|
27
|
+
lessCommonFile: string;
|
|
28
|
+
sassCommonFile: string;
|
|
29
|
+
scssCommonFile: string;
|
|
30
|
+
}
|
|
31
|
+
|
|
7
32
|
/**
|
|
8
33
|
* 小程序项目结构解析
|
|
9
34
|
*
|
|
@@ -11,6 +36,7 @@ export { F as FrameError, P as PageSnapshot, R as RecordedRequest, W as WxaTestA
|
|
|
11
36
|
* - app.json 的全局 usingComponents 展开到每个页面和组件(miniprogram_npm 内除外)
|
|
12
37
|
* - 每个页面/组件 json 都保证有 usingComponents 字段
|
|
13
38
|
*/
|
|
39
|
+
|
|
14
40
|
interface AppJson {
|
|
15
41
|
pages: string[];
|
|
16
42
|
entryPagePath?: string;
|
|
@@ -54,6 +80,8 @@ declare class MiniProgram {
|
|
|
54
80
|
readonly root: string;
|
|
55
81
|
readonly appid: string;
|
|
56
82
|
constructor(projectPath: string);
|
|
83
|
+
/** project.config.json 里与 less / sass 编译插件有关的设置;每次重新读取,开发中修改了也能生效 */
|
|
84
|
+
get styleSetting(): StyleSetting;
|
|
57
85
|
readAppJson(): AppJson;
|
|
58
86
|
subPackages(app: AppJson): {
|
|
59
87
|
[key: string]: any;
|
|
@@ -99,7 +127,8 @@ declare class MiniProgram {
|
|
|
99
127
|
*
|
|
100
128
|
* 渲染层(page-frame):
|
|
101
129
|
* 1. 完整版 $gwx(wcc -cc)与每个页面/组件的 __wxAppCode__ json / wxml(pageTemplates)
|
|
102
|
-
* 2. wcsc 的公共样式运行时 + app.wxss,与每个页面/组件的 __wxAppCode__ wxss(pageStyles
|
|
130
|
+
* 2. wcsc 的公共样式运行时 + app.wxss,与每个页面/组件的 __wxAppCode__ wxss(pageStyles)。
|
|
131
|
+
* 开启 less / sass 编译插件时,先把 .less / .scss / .sass 编译成 .wxss(见 StyleMirror)
|
|
103
132
|
* 两部分在热更新时分别下发
|
|
104
133
|
* 样式和模板里的 env(safe-area-inset-*) 改写成 CSS 变量,见 rewriteSafeAreaInsets
|
|
105
134
|
*
|
|
@@ -141,10 +170,12 @@ declare class AppBuilder {
|
|
|
141
170
|
private wxssCache;
|
|
142
171
|
/** 设置了 wxmlTransform 时才有 */
|
|
143
172
|
private readonly wxmlMirror;
|
|
173
|
+
/** 开启了 less / sass 编译插件时才有;插件设置变了就换一个 */
|
|
174
|
+
private styleMirror;
|
|
144
175
|
constructor(project: MiniProgram, options?: AppBuilderOptions);
|
|
145
176
|
/** wxmlTransform 的镜像目录;没有设置转换或还没编译过时为 null */
|
|
146
177
|
get wxmlMirrorDir(): string | null;
|
|
147
|
-
/** 删除 wxmlTransform
|
|
178
|
+
/** 删除 wxmlTransform 和样式预处理的镜像目录,开发服务器关闭时调用 */
|
|
148
179
|
dispose(): void;
|
|
149
180
|
/** 根据变化的文件标记需要重新构建的部分;返回 true 表示需要刷新 */
|
|
150
181
|
invalidate(changedFiles?: string[]): boolean;
|
|
@@ -164,6 +195,7 @@ declare class AppBuilder {
|
|
|
164
195
|
private compileTemplates;
|
|
165
196
|
/** 与开发者工具一致,项目里的 wxss 全部交给 wcsc:被 @import 的文件(如 uni-app 的 common/main.wxss)也要在列表里 */
|
|
166
197
|
private compileStyles;
|
|
198
|
+
private currentStyleMirror;
|
|
167
199
|
/** $gwx 加上各页面、组件的 json / wxml 注册;逻辑层用裁剪版 $gwx,渲染层用完整版 */
|
|
168
200
|
private createTemplates;
|
|
169
201
|
private createServiceBootstrap;
|