@dimina/compiler 1.0.17 → 1.1.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/README.md +2 -0
- package/dist/bin/index.cjs +10 -8
- package/dist/bin/index.js +6 -4
- package/dist/{compatibility-DnN63SVV.cjs → compatibility-CzIJUgPs.cjs} +94 -4
- package/dist/{compatibility-DbP7rQJN.js → compatibility-DdxfVhcK.js} +89 -5
- package/dist/core/logic-compiler.cjs +16 -18
- package/dist/core/logic-compiler.js +13 -16
- package/dist/core/style-compiler.cjs +61 -53
- package/dist/core/style-compiler.js +52 -45
- package/dist/core/view-compiler.cjs +202 -88
- package/dist/core/view-compiler.js +196 -84
- package/dist/{env-BWsUjuZE.cjs → env-B4U3zZUm.cjs} +182 -63
- package/dist/{env-iShlMOS1.js → env-OH3--qg8.js} +159 -26
- package/dist/index.cjs +113 -23
- package/dist/index.js +108 -19
- package/dist/rolldown-runtime-D6vf50IK.cjs +28 -0
- package/package.json +8 -4
package/README.md
CHANGED
package/dist/bin/index.cjs
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
const
|
|
2
|
+
const require_rolldown_runtime = require("../rolldown-runtime-D6vf50IK.cjs");
|
|
3
3
|
const require_index = require("../index.cjs");
|
|
4
4
|
let node_path = require("node:path");
|
|
5
|
-
node_path =
|
|
5
|
+
node_path = require_rolldown_runtime.__toESM(node_path, 1);
|
|
6
6
|
let node_process = require("node:process");
|
|
7
|
-
node_process =
|
|
7
|
+
node_process = require_rolldown_runtime.__toESM(node_process, 1);
|
|
8
8
|
let chokidar = require("chokidar");
|
|
9
|
-
chokidar =
|
|
9
|
+
chokidar = require_rolldown_runtime.__toESM(chokidar, 1);
|
|
10
10
|
let commander = require("commander");
|
|
11
11
|
var package_default = {
|
|
12
12
|
name: "@dimina/compiler",
|
|
13
|
-
version: "1.0
|
|
13
|
+
version: "1.1.0",
|
|
14
14
|
description: "星河编译工具",
|
|
15
15
|
main: "./dist/index.cjs",
|
|
16
16
|
module: "./dist/index.js",
|
|
@@ -49,6 +49,7 @@ var package_default = {
|
|
|
49
49
|
},
|
|
50
50
|
author: "doslin",
|
|
51
51
|
license: "Apache-2.0",
|
|
52
|
+
engines: { "node": ">=20" },
|
|
52
53
|
keywords: [
|
|
53
54
|
"dimina",
|
|
54
55
|
"compiler",
|
|
@@ -58,7 +59,8 @@ var package_default = {
|
|
|
58
59
|
],
|
|
59
60
|
dependencies: {
|
|
60
61
|
"@vue/compiler-sfc": "^3.5.39",
|
|
61
|
-
"
|
|
62
|
+
"@vue/shared": "^3.5.39",
|
|
63
|
+
"autoprefixer": "^10.5.3",
|
|
62
64
|
"cheerio": "^1.2.0",
|
|
63
65
|
"chokidar": "^4.0.3",
|
|
64
66
|
"commander": "^14.0.3",
|
|
@@ -68,9 +70,9 @@ var package_default = {
|
|
|
68
70
|
"less": "^4.6.7",
|
|
69
71
|
"listr2": "^9.0.5",
|
|
70
72
|
"magic-string": "^0.30.21",
|
|
71
|
-
"oxc-parser": "^0.
|
|
73
|
+
"oxc-parser": "^0.139.0",
|
|
72
74
|
"oxc-walker": "^1.0.0",
|
|
73
|
-
"postcss": "^8.5.
|
|
75
|
+
"postcss": "^8.5.19",
|
|
74
76
|
"postcss-selector-parser": "^7.1.4",
|
|
75
77
|
"sass": "^1.101.0",
|
|
76
78
|
"source-map-js": "^1.2.1"
|
package/dist/bin/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import chokidar from "chokidar";
|
|
|
6
6
|
import { program } from "commander";
|
|
7
7
|
var package_default = {
|
|
8
8
|
name: "@dimina/compiler",
|
|
9
|
-
version: "1.0
|
|
9
|
+
version: "1.1.0",
|
|
10
10
|
description: "星河编译工具",
|
|
11
11
|
main: "./dist/index.cjs",
|
|
12
12
|
module: "./dist/index.js",
|
|
@@ -45,6 +45,7 @@ var package_default = {
|
|
|
45
45
|
},
|
|
46
46
|
author: "doslin",
|
|
47
47
|
license: "Apache-2.0",
|
|
48
|
+
engines: { "node": ">=20" },
|
|
48
49
|
keywords: [
|
|
49
50
|
"dimina",
|
|
50
51
|
"compiler",
|
|
@@ -54,7 +55,8 @@ var package_default = {
|
|
|
54
55
|
],
|
|
55
56
|
dependencies: {
|
|
56
57
|
"@vue/compiler-sfc": "^3.5.39",
|
|
57
|
-
"
|
|
58
|
+
"@vue/shared": "^3.5.39",
|
|
59
|
+
"autoprefixer": "^10.5.3",
|
|
58
60
|
"cheerio": "^1.2.0",
|
|
59
61
|
"chokidar": "^4.0.3",
|
|
60
62
|
"commander": "^14.0.3",
|
|
@@ -64,9 +66,9 @@ var package_default = {
|
|
|
64
66
|
"less": "^4.6.7",
|
|
65
67
|
"listr2": "^9.0.5",
|
|
66
68
|
"magic-string": "^0.30.21",
|
|
67
|
-
"oxc-parser": "^0.
|
|
69
|
+
"oxc-parser": "^0.139.0",
|
|
68
70
|
"oxc-walker": "^1.0.0",
|
|
69
|
-
"postcss": "^8.5.
|
|
71
|
+
"postcss": "^8.5.19",
|
|
70
72
|
"postcss-selector-parser": "^7.1.4",
|
|
71
73
|
"sass": "^1.101.0",
|
|
72
74
|
"source-map-js": "^1.2.1"
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
const require_env = require("./env-
|
|
1
|
+
const require_env = require("./env-B4U3zZUm.cjs");
|
|
2
|
+
let node_worker_threads = require("node:worker_threads");
|
|
2
3
|
let htmlparser2 = require("htmlparser2");
|
|
4
|
+
let _vue_shared = require("@vue/shared");
|
|
3
5
|
//#region src/common/compatibility-reference.js
|
|
4
6
|
var supportedBuiltinComponents = [
|
|
5
7
|
"block",
|
|
@@ -51,6 +53,39 @@ var supportedWxApis = [
|
|
|
51
53
|
"getSystemInfoSync",
|
|
52
54
|
"getSystemInfoAsync",
|
|
53
55
|
"getSystemInfo",
|
|
56
|
+
"getAppBaseInfo",
|
|
57
|
+
"getDeviceInfo",
|
|
58
|
+
"onThemeChange",
|
|
59
|
+
"offThemeChange",
|
|
60
|
+
"openBluetoothAdapter",
|
|
61
|
+
"closeBluetoothAdapter",
|
|
62
|
+
"getBluetoothAdapterState",
|
|
63
|
+
"startBluetoothDevicesDiscovery",
|
|
64
|
+
"stopBluetoothDevicesDiscovery",
|
|
65
|
+
"getBluetoothDevices",
|
|
66
|
+
"getConnectedBluetoothDevices",
|
|
67
|
+
"onBluetoothAdapterStateChange",
|
|
68
|
+
"offBluetoothAdapterStateChange",
|
|
69
|
+
"onBluetoothDeviceFound",
|
|
70
|
+
"offBluetoothDeviceFound",
|
|
71
|
+
"createBLEConnection",
|
|
72
|
+
"closeBLEConnection",
|
|
73
|
+
"getBLEDeviceServices",
|
|
74
|
+
"getBLEDeviceCharacteristics",
|
|
75
|
+
"readBLECharacteristicValue",
|
|
76
|
+
"writeBLECharacteristicValue",
|
|
77
|
+
"notifyBLECharacteristicValueChange",
|
|
78
|
+
"getBLEDeviceRSSI",
|
|
79
|
+
"setBLEMTU",
|
|
80
|
+
"getBLEMTU",
|
|
81
|
+
"onBLEConnectionStateChange",
|
|
82
|
+
"offBLEConnectionStateChange",
|
|
83
|
+
"onBLECharacteristicValueChange",
|
|
84
|
+
"offBLECharacteristicValueChange",
|
|
85
|
+
"onBLEMTUChange",
|
|
86
|
+
"offBLEMTUChange",
|
|
87
|
+
"isBluetoothDevicePaired",
|
|
88
|
+
"makeBluetoothPair",
|
|
54
89
|
"reLaunch",
|
|
55
90
|
"redirectTo",
|
|
56
91
|
"navigateTo",
|
|
@@ -65,6 +100,9 @@ var supportedWxApis = [
|
|
|
65
100
|
"setNavigationBarColor",
|
|
66
101
|
"pageScrollTo",
|
|
67
102
|
"getMenuButtonBoundingClientRect",
|
|
103
|
+
"onMenuButtonBoundingClientRectWeightChange",
|
|
104
|
+
"offMenuButtonBoundingClientRectWeightChange",
|
|
105
|
+
"nextTick",
|
|
68
106
|
"createAnimation",
|
|
69
107
|
"createCanvasContext",
|
|
70
108
|
"createOffscreenCanvas",
|
|
@@ -74,6 +112,46 @@ var supportedWxApis = [
|
|
|
74
112
|
"request",
|
|
75
113
|
"downloadFile",
|
|
76
114
|
"uploadFile",
|
|
115
|
+
"startLocalServiceDiscovery",
|
|
116
|
+
"stopLocalServiceDiscovery",
|
|
117
|
+
"onLocalServiceDiscoveryStop",
|
|
118
|
+
"offLocalServiceDiscoveryStop",
|
|
119
|
+
"onLocalServiceFound",
|
|
120
|
+
"offLocalServiceFound",
|
|
121
|
+
"onLocalServiceLost",
|
|
122
|
+
"offLocalServiceLost",
|
|
123
|
+
"onLocalServiceResolveFail",
|
|
124
|
+
"offLocalServiceResolveFail",
|
|
125
|
+
"createUDPSocket",
|
|
126
|
+
"UDPSocket.bind",
|
|
127
|
+
"UDPSocket.close",
|
|
128
|
+
"UDPSocket.connect",
|
|
129
|
+
"UDPSocket.send",
|
|
130
|
+
"UDPSocket.write",
|
|
131
|
+
"UDPSocket.setTTL",
|
|
132
|
+
"UDPSocket.onClose",
|
|
133
|
+
"UDPSocket.offClose",
|
|
134
|
+
"UDPSocket.onError",
|
|
135
|
+
"UDPSocket.offError",
|
|
136
|
+
"UDPSocket.onListening",
|
|
137
|
+
"UDPSocket.offListening",
|
|
138
|
+
"UDPSocket.onMessage",
|
|
139
|
+
"UDPSocket.offMessage",
|
|
140
|
+
"createTCPSocket",
|
|
141
|
+
"TCPSocket.bindWifi",
|
|
142
|
+
"TCPSocket.close",
|
|
143
|
+
"TCPSocket.connect",
|
|
144
|
+
"TCPSocket.write",
|
|
145
|
+
"TCPSocket.onBindWifi",
|
|
146
|
+
"TCPSocket.offBindWifi",
|
|
147
|
+
"TCPSocket.onClose",
|
|
148
|
+
"TCPSocket.offClose",
|
|
149
|
+
"TCPSocket.onConnect",
|
|
150
|
+
"TCPSocket.offConnect",
|
|
151
|
+
"TCPSocket.onError",
|
|
152
|
+
"TCPSocket.offError",
|
|
153
|
+
"TCPSocket.onMessage",
|
|
154
|
+
"TCPSocket.offMessage",
|
|
77
155
|
"setStorageSync",
|
|
78
156
|
"getStorageSync",
|
|
79
157
|
"removeStorageSync",
|
|
@@ -106,6 +184,7 @@ var supportedWxApis = [
|
|
|
106
184
|
//#region src/common/compatibility.js
|
|
107
185
|
var cachedReference = null;
|
|
108
186
|
var warnedItems = /* @__PURE__ */ new Set();
|
|
187
|
+
var pendingWarnings = [];
|
|
109
188
|
function loadReference() {
|
|
110
189
|
if (cachedReference) return cachedReference;
|
|
111
190
|
cachedReference = {
|
|
@@ -129,7 +208,8 @@ function warnUnsupportedWxApi(apiName, filePath, line) {
|
|
|
129
208
|
}
|
|
130
209
|
function warnUnsupportedComponent(tagName, filePath, line) {
|
|
131
210
|
const { supportedBuiltinComponents } = loadReference();
|
|
132
|
-
if (!tagName || supportedBuiltinComponents.has(tagName) || require_env.getViewScriptTags().includes(tagName)) return;
|
|
211
|
+
if (!tagName || supportedBuiltinComponents.has(tagName) || require_env.tagWhiteList.includes(tagName) || require_env.getViewScriptTags().includes(tagName)) return;
|
|
212
|
+
if (!require_env.miniProgramBuiltinTags.has(tagName) && (0, _vue_shared.isHTMLTag)(tagName)) return;
|
|
133
213
|
const location = formatLocation(filePath, line);
|
|
134
214
|
warnOnce("component", tagName, location, `[compat] Unsupported or undeclared component: <${tagName}>${location}`);
|
|
135
215
|
}
|
|
@@ -141,7 +221,7 @@ function checkTemplateCompatibility(content, filePath, components = {}) {
|
|
|
141
221
|
warnUnsupportedComponent(tagName, filePath, getLineByIndex(content, parser.startIndex));
|
|
142
222
|
},
|
|
143
223
|
onerror(error) {
|
|
144
|
-
|
|
224
|
+
warnOnce("parse", filePath, error.message, `[compat] Failed to parse template for compatibility diagnostics: ${filePath} ${error.message}`);
|
|
145
225
|
}
|
|
146
226
|
}, {
|
|
147
227
|
xmlMode: true,
|
|
@@ -166,7 +246,11 @@ function warnOnce(type, name, location, message) {
|
|
|
166
246
|
const key = `${type}:${name}:${location}`;
|
|
167
247
|
if (warnedItems.has(key)) return;
|
|
168
248
|
warnedItems.add(key);
|
|
169
|
-
console.warn(message);
|
|
249
|
+
if (node_worker_threads.isMainThread) console.warn(message);
|
|
250
|
+
else pendingWarnings.push(message);
|
|
251
|
+
}
|
|
252
|
+
function takeCompatibilityWarnings() {
|
|
253
|
+
return pendingWarnings.splice(0);
|
|
170
254
|
}
|
|
171
255
|
//#endregion
|
|
172
256
|
Object.defineProperty(exports, "checkTemplateCompatibility", {
|
|
@@ -181,6 +265,12 @@ Object.defineProperty(exports, "getWxMemberName", {
|
|
|
181
265
|
return getWxMemberName;
|
|
182
266
|
}
|
|
183
267
|
});
|
|
268
|
+
Object.defineProperty(exports, "takeCompatibilityWarnings", {
|
|
269
|
+
enumerable: true,
|
|
270
|
+
get: function() {
|
|
271
|
+
return takeCompatibilityWarnings;
|
|
272
|
+
}
|
|
273
|
+
});
|
|
184
274
|
Object.defineProperty(exports, "warnUnsupportedWxApi", {
|
|
185
275
|
enumerable: true,
|
|
186
276
|
get: function() {
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { C as tagWhiteList, S as miniProgramBuiltinTags, m as getViewScriptTags } from "./env-OH3--qg8.js";
|
|
2
|
+
import { isMainThread } from "node:worker_threads";
|
|
2
3
|
import { Parser } from "htmlparser2";
|
|
4
|
+
import { isHTMLTag } from "@vue/shared";
|
|
3
5
|
//#region src/common/compatibility-reference.js
|
|
4
6
|
var supportedBuiltinComponents = [
|
|
5
7
|
"block",
|
|
@@ -51,6 +53,39 @@ var supportedWxApis = [
|
|
|
51
53
|
"getSystemInfoSync",
|
|
52
54
|
"getSystemInfoAsync",
|
|
53
55
|
"getSystemInfo",
|
|
56
|
+
"getAppBaseInfo",
|
|
57
|
+
"getDeviceInfo",
|
|
58
|
+
"onThemeChange",
|
|
59
|
+
"offThemeChange",
|
|
60
|
+
"openBluetoothAdapter",
|
|
61
|
+
"closeBluetoothAdapter",
|
|
62
|
+
"getBluetoothAdapterState",
|
|
63
|
+
"startBluetoothDevicesDiscovery",
|
|
64
|
+
"stopBluetoothDevicesDiscovery",
|
|
65
|
+
"getBluetoothDevices",
|
|
66
|
+
"getConnectedBluetoothDevices",
|
|
67
|
+
"onBluetoothAdapterStateChange",
|
|
68
|
+
"offBluetoothAdapterStateChange",
|
|
69
|
+
"onBluetoothDeviceFound",
|
|
70
|
+
"offBluetoothDeviceFound",
|
|
71
|
+
"createBLEConnection",
|
|
72
|
+
"closeBLEConnection",
|
|
73
|
+
"getBLEDeviceServices",
|
|
74
|
+
"getBLEDeviceCharacteristics",
|
|
75
|
+
"readBLECharacteristicValue",
|
|
76
|
+
"writeBLECharacteristicValue",
|
|
77
|
+
"notifyBLECharacteristicValueChange",
|
|
78
|
+
"getBLEDeviceRSSI",
|
|
79
|
+
"setBLEMTU",
|
|
80
|
+
"getBLEMTU",
|
|
81
|
+
"onBLEConnectionStateChange",
|
|
82
|
+
"offBLEConnectionStateChange",
|
|
83
|
+
"onBLECharacteristicValueChange",
|
|
84
|
+
"offBLECharacteristicValueChange",
|
|
85
|
+
"onBLEMTUChange",
|
|
86
|
+
"offBLEMTUChange",
|
|
87
|
+
"isBluetoothDevicePaired",
|
|
88
|
+
"makeBluetoothPair",
|
|
54
89
|
"reLaunch",
|
|
55
90
|
"redirectTo",
|
|
56
91
|
"navigateTo",
|
|
@@ -65,6 +100,9 @@ var supportedWxApis = [
|
|
|
65
100
|
"setNavigationBarColor",
|
|
66
101
|
"pageScrollTo",
|
|
67
102
|
"getMenuButtonBoundingClientRect",
|
|
103
|
+
"onMenuButtonBoundingClientRectWeightChange",
|
|
104
|
+
"offMenuButtonBoundingClientRectWeightChange",
|
|
105
|
+
"nextTick",
|
|
68
106
|
"createAnimation",
|
|
69
107
|
"createCanvasContext",
|
|
70
108
|
"createOffscreenCanvas",
|
|
@@ -74,6 +112,46 @@ var supportedWxApis = [
|
|
|
74
112
|
"request",
|
|
75
113
|
"downloadFile",
|
|
76
114
|
"uploadFile",
|
|
115
|
+
"startLocalServiceDiscovery",
|
|
116
|
+
"stopLocalServiceDiscovery",
|
|
117
|
+
"onLocalServiceDiscoveryStop",
|
|
118
|
+
"offLocalServiceDiscoveryStop",
|
|
119
|
+
"onLocalServiceFound",
|
|
120
|
+
"offLocalServiceFound",
|
|
121
|
+
"onLocalServiceLost",
|
|
122
|
+
"offLocalServiceLost",
|
|
123
|
+
"onLocalServiceResolveFail",
|
|
124
|
+
"offLocalServiceResolveFail",
|
|
125
|
+
"createUDPSocket",
|
|
126
|
+
"UDPSocket.bind",
|
|
127
|
+
"UDPSocket.close",
|
|
128
|
+
"UDPSocket.connect",
|
|
129
|
+
"UDPSocket.send",
|
|
130
|
+
"UDPSocket.write",
|
|
131
|
+
"UDPSocket.setTTL",
|
|
132
|
+
"UDPSocket.onClose",
|
|
133
|
+
"UDPSocket.offClose",
|
|
134
|
+
"UDPSocket.onError",
|
|
135
|
+
"UDPSocket.offError",
|
|
136
|
+
"UDPSocket.onListening",
|
|
137
|
+
"UDPSocket.offListening",
|
|
138
|
+
"UDPSocket.onMessage",
|
|
139
|
+
"UDPSocket.offMessage",
|
|
140
|
+
"createTCPSocket",
|
|
141
|
+
"TCPSocket.bindWifi",
|
|
142
|
+
"TCPSocket.close",
|
|
143
|
+
"TCPSocket.connect",
|
|
144
|
+
"TCPSocket.write",
|
|
145
|
+
"TCPSocket.onBindWifi",
|
|
146
|
+
"TCPSocket.offBindWifi",
|
|
147
|
+
"TCPSocket.onClose",
|
|
148
|
+
"TCPSocket.offClose",
|
|
149
|
+
"TCPSocket.onConnect",
|
|
150
|
+
"TCPSocket.offConnect",
|
|
151
|
+
"TCPSocket.onError",
|
|
152
|
+
"TCPSocket.offError",
|
|
153
|
+
"TCPSocket.onMessage",
|
|
154
|
+
"TCPSocket.offMessage",
|
|
77
155
|
"setStorageSync",
|
|
78
156
|
"getStorageSync",
|
|
79
157
|
"removeStorageSync",
|
|
@@ -106,6 +184,7 @@ var supportedWxApis = [
|
|
|
106
184
|
//#region src/common/compatibility.js
|
|
107
185
|
var cachedReference = null;
|
|
108
186
|
var warnedItems = /* @__PURE__ */ new Set();
|
|
187
|
+
var pendingWarnings = [];
|
|
109
188
|
function loadReference() {
|
|
110
189
|
if (cachedReference) return cachedReference;
|
|
111
190
|
cachedReference = {
|
|
@@ -129,7 +208,8 @@ function warnUnsupportedWxApi(apiName, filePath, line) {
|
|
|
129
208
|
}
|
|
130
209
|
function warnUnsupportedComponent(tagName, filePath, line) {
|
|
131
210
|
const { supportedBuiltinComponents } = loadReference();
|
|
132
|
-
if (!tagName || supportedBuiltinComponents.has(tagName) || getViewScriptTags().includes(tagName)) return;
|
|
211
|
+
if (!tagName || supportedBuiltinComponents.has(tagName) || tagWhiteList.includes(tagName) || getViewScriptTags().includes(tagName)) return;
|
|
212
|
+
if (!miniProgramBuiltinTags.has(tagName) && isHTMLTag(tagName)) return;
|
|
133
213
|
const location = formatLocation(filePath, line);
|
|
134
214
|
warnOnce("component", tagName, location, `[compat] Unsupported or undeclared component: <${tagName}>${location}`);
|
|
135
215
|
}
|
|
@@ -141,7 +221,7 @@ function checkTemplateCompatibility(content, filePath, components = {}) {
|
|
|
141
221
|
warnUnsupportedComponent(tagName, filePath, getLineByIndex(content, parser.startIndex));
|
|
142
222
|
},
|
|
143
223
|
onerror(error) {
|
|
144
|
-
|
|
224
|
+
warnOnce("parse", filePath, error.message, `[compat] Failed to parse template for compatibility diagnostics: ${filePath} ${error.message}`);
|
|
145
225
|
}
|
|
146
226
|
}, {
|
|
147
227
|
xmlMode: true,
|
|
@@ -166,7 +246,11 @@ function warnOnce(type, name, location, message) {
|
|
|
166
246
|
const key = `${type}:${name}:${location}`;
|
|
167
247
|
if (warnedItems.has(key)) return;
|
|
168
248
|
warnedItems.add(key);
|
|
169
|
-
console.warn(message);
|
|
249
|
+
if (isMainThread) console.warn(message);
|
|
250
|
+
else pendingWarnings.push(message);
|
|
251
|
+
}
|
|
252
|
+
function takeCompatibilityWarnings() {
|
|
253
|
+
return pendingWarnings.splice(0);
|
|
170
254
|
}
|
|
171
255
|
//#endregion
|
|
172
|
-
export { getWxMemberName as n,
|
|
256
|
+
export { warnUnsupportedWxApi as i, getWxMemberName as n, takeCompatibilityWarnings as r, checkTemplateCompatibility as t };
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const
|
|
3
|
-
const
|
|
2
|
+
const require_rolldown_runtime = require("../rolldown-runtime-D6vf50IK.cjs");
|
|
3
|
+
const require_env = require("../env-B4U3zZUm.cjs");
|
|
4
|
+
const require_compatibility = require("../compatibility-CzIJUgPs.cjs");
|
|
4
5
|
let node_path = require("node:path");
|
|
5
6
|
let node_worker_threads = require("node:worker_threads");
|
|
6
7
|
let node_fs = require("node:fs");
|
|
7
|
-
node_fs =
|
|
8
|
+
node_fs = require_rolldown_runtime.__toESM(node_fs, 1);
|
|
8
9
|
let oxc_parser = require("oxc-parser");
|
|
9
10
|
let oxc_walker = require("oxc-walker");
|
|
10
11
|
let magic_string = require("magic-string");
|
|
11
|
-
magic_string =
|
|
12
|
+
magic_string = require_rolldown_runtime.__toESM(magic_string, 1);
|
|
12
13
|
let esbuild = require("esbuild");
|
|
13
14
|
let source_map_js = require("source-map-js");
|
|
14
15
|
//#region src/core/sourcemap.js
|
|
@@ -119,7 +120,10 @@ if (!node_worker_threads.isMainThread) node_worker_threads.parentPort.on("messag
|
|
|
119
120
|
}
|
|
120
121
|
await writeCompileRes(mainCompileRes, null);
|
|
121
122
|
processedModules.clear();
|
|
122
|
-
node_worker_threads.parentPort.postMessage({
|
|
123
|
+
node_worker_threads.parentPort.postMessage({
|
|
124
|
+
success: true,
|
|
125
|
+
compatibilityWarnings: require_compatibility.takeCompatibilityWarnings()
|
|
126
|
+
});
|
|
123
127
|
} catch (error) {
|
|
124
128
|
processedModules.clear();
|
|
125
129
|
node_worker_threads.parentPort.postMessage({
|
|
@@ -167,18 +171,10 @@ async function compileJS(pages, root, mainCompileRes, progress) {
|
|
|
167
171
|
}
|
|
168
172
|
return compileRes;
|
|
169
173
|
}
|
|
170
|
-
async function buildJSByPath(packageName, module, compileRes, mainCompileRes, addExtra,
|
|
174
|
+
async function buildJSByPath(packageName, module, compileRes, mainCompileRes, addExtra, activePaths = /* @__PURE__ */ new Set(), putMain = false) {
|
|
171
175
|
const currentPath = module.path;
|
|
172
|
-
if (
|
|
173
|
-
|
|
174
|
-
return;
|
|
175
|
-
}
|
|
176
|
-
if (depthChain.length > 20) {
|
|
177
|
-
console.warn("[logic]", `检测到深度依赖: ${[...depthChain, currentPath].join(" -> ")}`);
|
|
178
|
-
return;
|
|
179
|
-
}
|
|
180
|
-
depthChain = [...depthChain, currentPath];
|
|
181
|
-
if (!module.path) return;
|
|
176
|
+
if (!currentPath) return;
|
|
177
|
+
if (activePaths.has(currentPath)) return;
|
|
182
178
|
if (require_env.hasCompileInfo(module.path, compileRes, mainCompileRes)) return;
|
|
183
179
|
const compileInfo = {
|
|
184
180
|
path: module.path,
|
|
@@ -208,6 +204,7 @@ async function buildJSByPath(packageName, module, compileRes, mainCompileRes, ad
|
|
|
208
204
|
}).program;
|
|
209
205
|
const s = new magic_string.default(sourceCode);
|
|
210
206
|
const extraInfo = { path: module.path };
|
|
207
|
+
activePaths.add(currentPath);
|
|
211
208
|
if (module.component) extraInfo.component = true;
|
|
212
209
|
if (module.usingComponents) {
|
|
213
210
|
const componentsObj = {};
|
|
@@ -223,7 +220,7 @@ async function buildJSByPath(packageName, module, compileRes, mainCompileRes, ad
|
|
|
223
220
|
} else toMainSubPackage = false;
|
|
224
221
|
const componentModule = require_env.getComponent(path);
|
|
225
222
|
if (!componentModule) continue;
|
|
226
|
-
await buildJSByPath(packageName, componentModule, compileRes, mainCompileRes, true,
|
|
223
|
+
await buildJSByPath(packageName, componentModule, compileRes, mainCompileRes, true, activePaths, putMain || toMainSubPackage);
|
|
227
224
|
componentsObj[name] = path;
|
|
228
225
|
}
|
|
229
226
|
extraInfo.usingComponents = componentsObj;
|
|
@@ -308,7 +305,7 @@ async function buildJSByPath(packageName, module, compileRes, mainCompileRes, ad
|
|
|
308
305
|
}
|
|
309
306
|
}
|
|
310
307
|
} });
|
|
311
|
-
for (const depId of dependenciesToProcess) await buildJSByPath(packageName, { path: depId }, compileRes, mainCompileRes, false,
|
|
308
|
+
for (const depId of dependenciesToProcess) await buildJSByPath(packageName, { path: depId }, compileRes, mainCompileRes, false, activePaths, putMain);
|
|
312
309
|
for (const replacement of pathReplacements.reverse()) s.overwrite(replacement.start, replacement.end, `'${replacement.newValue}'`);
|
|
313
310
|
const modifiedCode = s.toString();
|
|
314
311
|
let preEsbuildMap = null;
|
|
@@ -344,6 +341,7 @@ async function buildJSByPath(packageName, module, compileRes, mainCompileRes, ad
|
|
|
344
341
|
compileInfo.code = modifiedCode;
|
|
345
342
|
}
|
|
346
343
|
processedModules.add(packageName + currentPath);
|
|
344
|
+
activePaths.delete(currentPath);
|
|
347
345
|
}
|
|
348
346
|
function isLocalAssetString(value) {
|
|
349
347
|
return typeof value === "string" && !value.startsWith("http") && !value.startsWith("//") && (value.startsWith("/") || value.startsWith("./") || value.startsWith("../")) && /\.(?:png|jpe?g|gif|svg)(?:\?.*)?$/.test(value);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as getWxMemberName, r as
|
|
1
|
+
import { _ as resolveAppAlias, a as getComponent, d as getTargetPath, g as resetStoreInfo, h as getWorkPath, n as getAppId, o as getContentByPath, s as getNpmResolver, t as getAppConfigInfo, x as hasCompileInfo, y as collectAssets } from "../env-OH3--qg8.js";
|
|
2
|
+
import { i as warnUnsupportedWxApi, n as getWxMemberName, r as takeCompatibilityWarnings } from "../compatibility-DdxfVhcK.js";
|
|
3
3
|
import { resolve, sep } from "node:path";
|
|
4
4
|
import { isMainThread, parentPort } from "node:worker_threads";
|
|
5
5
|
import fs from "node:fs";
|
|
@@ -116,7 +116,10 @@ if (!isMainThread) parentPort.on("message", async ({ pages, storeInfo, sourcemap
|
|
|
116
116
|
}
|
|
117
117
|
await writeCompileRes(mainCompileRes, null);
|
|
118
118
|
processedModules.clear();
|
|
119
|
-
parentPort.postMessage({
|
|
119
|
+
parentPort.postMessage({
|
|
120
|
+
success: true,
|
|
121
|
+
compatibilityWarnings: takeCompatibilityWarnings()
|
|
122
|
+
});
|
|
120
123
|
} catch (error) {
|
|
121
124
|
processedModules.clear();
|
|
122
125
|
parentPort.postMessage({
|
|
@@ -164,18 +167,10 @@ async function compileJS(pages, root, mainCompileRes, progress) {
|
|
|
164
167
|
}
|
|
165
168
|
return compileRes;
|
|
166
169
|
}
|
|
167
|
-
async function buildJSByPath(packageName, module, compileRes, mainCompileRes, addExtra,
|
|
170
|
+
async function buildJSByPath(packageName, module, compileRes, mainCompileRes, addExtra, activePaths = /* @__PURE__ */ new Set(), putMain = false) {
|
|
168
171
|
const currentPath = module.path;
|
|
169
|
-
if (
|
|
170
|
-
|
|
171
|
-
return;
|
|
172
|
-
}
|
|
173
|
-
if (depthChain.length > 20) {
|
|
174
|
-
console.warn("[logic]", `检测到深度依赖: ${[...depthChain, currentPath].join(" -> ")}`);
|
|
175
|
-
return;
|
|
176
|
-
}
|
|
177
|
-
depthChain = [...depthChain, currentPath];
|
|
178
|
-
if (!module.path) return;
|
|
172
|
+
if (!currentPath) return;
|
|
173
|
+
if (activePaths.has(currentPath)) return;
|
|
179
174
|
if (hasCompileInfo(module.path, compileRes, mainCompileRes)) return;
|
|
180
175
|
const compileInfo = {
|
|
181
176
|
path: module.path,
|
|
@@ -205,6 +200,7 @@ async function buildJSByPath(packageName, module, compileRes, mainCompileRes, ad
|
|
|
205
200
|
}).program;
|
|
206
201
|
const s = new MagicString(sourceCode);
|
|
207
202
|
const extraInfo = { path: module.path };
|
|
203
|
+
activePaths.add(currentPath);
|
|
208
204
|
if (module.component) extraInfo.component = true;
|
|
209
205
|
if (module.usingComponents) {
|
|
210
206
|
const componentsObj = {};
|
|
@@ -220,7 +216,7 @@ async function buildJSByPath(packageName, module, compileRes, mainCompileRes, ad
|
|
|
220
216
|
} else toMainSubPackage = false;
|
|
221
217
|
const componentModule = getComponent(path);
|
|
222
218
|
if (!componentModule) continue;
|
|
223
|
-
await buildJSByPath(packageName, componentModule, compileRes, mainCompileRes, true,
|
|
219
|
+
await buildJSByPath(packageName, componentModule, compileRes, mainCompileRes, true, activePaths, putMain || toMainSubPackage);
|
|
224
220
|
componentsObj[name] = path;
|
|
225
221
|
}
|
|
226
222
|
extraInfo.usingComponents = componentsObj;
|
|
@@ -305,7 +301,7 @@ async function buildJSByPath(packageName, module, compileRes, mainCompileRes, ad
|
|
|
305
301
|
}
|
|
306
302
|
}
|
|
307
303
|
} });
|
|
308
|
-
for (const depId of dependenciesToProcess) await buildJSByPath(packageName, { path: depId }, compileRes, mainCompileRes, false,
|
|
304
|
+
for (const depId of dependenciesToProcess) await buildJSByPath(packageName, { path: depId }, compileRes, mainCompileRes, false, activePaths, putMain);
|
|
309
305
|
for (const replacement of pathReplacements.reverse()) s.overwrite(replacement.start, replacement.end, `'${replacement.newValue}'`);
|
|
310
306
|
const modifiedCode = s.toString();
|
|
311
307
|
let preEsbuildMap = null;
|
|
@@ -341,6 +337,7 @@ async function buildJSByPath(packageName, module, compileRes, mainCompileRes, ad
|
|
|
341
337
|
compileInfo.code = modifiedCode;
|
|
342
338
|
}
|
|
343
339
|
processedModules.add(packageName + currentPath);
|
|
340
|
+
activePaths.delete(currentPath);
|
|
344
341
|
}
|
|
345
342
|
function isLocalAssetString(value) {
|
|
346
343
|
return typeof value === "string" && !value.startsWith("http") && !value.startsWith("//") && (value.startsWith("/") || value.startsWith("./") || value.startsWith("../")) && /\.(?:png|jpe?g|gif|svg)(?:\?.*)?$/.test(value);
|