xhs-mp-compiler-cli 1.5.0-beta.7 → 1.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.
- package/dist/index.js +1 -2
- package/dist/packs/mp-pack/index.js +4 -1
- package/dist/packs/webpack/dev-server/index.js +2 -2
- package/dist/packs/webpack/index.js +3 -0
- package/dist/presets/configs/miniprogram/assets/assetsEntryPlugin.js +2 -2
- package/dist/types/index.d.ts +1 -0
- package/package.json +6 -6
- package/dist/packs/webpack/dev-server/lib/openChrome.applescript +0 -78
package/dist/index.js
CHANGED
|
@@ -189,11 +189,10 @@ class Compiler extends events_1.default {
|
|
|
189
189
|
const distDir = this.getDistDir(entryType);
|
|
190
190
|
const cacheDir = this.getCacheDir(entryType);
|
|
191
191
|
const compilerType = this.getCompilerType(entryType);
|
|
192
|
-
|
|
192
|
+
compilerType === constant_config_1.COMPILER_TYPE.legacy_dev || compilerType === constant_config_1.COMPILER_TYPE.legacy_build
|
|
193
193
|
? 'webpack'
|
|
194
194
|
: 'mp-pack';
|
|
195
195
|
const options = {
|
|
196
|
-
packMode,
|
|
197
196
|
projectPath: this.project.projectPath,
|
|
198
197
|
appMode: this.project.appMode,
|
|
199
198
|
extJsonPath: this.project.extJsonDir,
|
|
@@ -8,12 +8,15 @@ const presets_1 = require("../../presets");
|
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
9
|
const xhs_mp_pack_1 = require("xhs-mp-pack");
|
|
10
10
|
const apm_1 = require("../../utils/apm");
|
|
11
|
+
const const_1 = __importDefault(require("../../utils/const"));
|
|
12
|
+
const { PACK_MODE } = const_1.default;
|
|
11
13
|
const createCompiler = (startConfig) => {
|
|
12
|
-
const {
|
|
14
|
+
// const {action, enableDevServer} = startConfig
|
|
13
15
|
const mppack = new xhs_mp_pack_1.MPPack(startConfig);
|
|
14
16
|
const compilerOptions = {
|
|
15
17
|
project: mppack.project,
|
|
16
18
|
packSetting: mppack.packSetting,
|
|
19
|
+
packMode: PACK_MODE.MPPACK,
|
|
17
20
|
// 注入apm模块
|
|
18
21
|
reporter: (0, apm_1.createReporter)(mppack.project, startConfig.mpUploadOptions)
|
|
19
22
|
};
|
|
@@ -19,14 +19,14 @@ const openBrowser_1 = __importDefault(require("./lib/openBrowser"));
|
|
|
19
19
|
const presets_1 = require("../../../presets");
|
|
20
20
|
const devServer = (config) => __awaiter(void 0, void 0, void 0, function* () {
|
|
21
21
|
const { packSetting } = config;
|
|
22
|
-
const {
|
|
22
|
+
const { distDir } = packSetting;
|
|
23
23
|
const webpackConfigs = (0, presets_1.createConfigs)(config);
|
|
24
24
|
const compiler = (0, webpack_1.default)(webpackConfigs);
|
|
25
25
|
const host = 'localhost';
|
|
26
26
|
const devServerConfig = {
|
|
27
27
|
open: false,
|
|
28
28
|
historyApiFallback: true,
|
|
29
|
-
port:
|
|
29
|
+
port: 1388,
|
|
30
30
|
hot: false,
|
|
31
31
|
static: [
|
|
32
32
|
// emulator entry 地址
|
|
@@ -15,6 +15,8 @@ const xhs_mp_project_1 = require("xhs-mp-project");
|
|
|
15
15
|
const xhs_mp_pack_1 = require("xhs-mp-pack");
|
|
16
16
|
const webpack_1 = require("./webpack");
|
|
17
17
|
const apm_1 = require("../../utils/apm");
|
|
18
|
+
const const_1 = __importDefault(require("../../utils/const"));
|
|
19
|
+
const { PACK_MODE } = const_1.default;
|
|
18
20
|
// 防御编程
|
|
19
21
|
const handleVersion = (startConfig) => {
|
|
20
22
|
let { action, enableV1 = true, enableV2 = false, enableVDom = false } = startConfig;
|
|
@@ -77,6 +79,7 @@ const createCompiler = (startConfig) => {
|
|
|
77
79
|
const compilerOptions = {
|
|
78
80
|
project: project,
|
|
79
81
|
packSetting: mppackSetting,
|
|
82
|
+
packMode: PACK_MODE.WEBPACK,
|
|
80
83
|
// 注入apm模块
|
|
81
84
|
reporter: (0, apm_1.createReporter)(project, startConfig.mpUploadOptions)
|
|
82
85
|
};
|
|
@@ -87,7 +87,7 @@ class XhsAssetsPlugin {
|
|
|
87
87
|
});
|
|
88
88
|
}
|
|
89
89
|
emitAppJson(compilation, appJSON) {
|
|
90
|
-
const { project, packSetting } = this.options;
|
|
90
|
+
const { project, packSetting, packMode } = this.options;
|
|
91
91
|
const { compilePkgs = [const_1.default.MAIN_PKG] } = packSetting;
|
|
92
92
|
// const { mainPkg, subPkgs } = packSetting.getCompilePkgsForEntries()
|
|
93
93
|
// 先删除,用户配置的默认不生效
|
|
@@ -109,7 +109,7 @@ class XhsAssetsPlugin {
|
|
|
109
109
|
this.emitJson(compilation, 'v1/app.json', appJsonSource);
|
|
110
110
|
}
|
|
111
111
|
// 独立分包的 app.json
|
|
112
|
-
const subPkgs = project.getSubPackages()
|
|
112
|
+
const subPkgs = project.getSubPackages();
|
|
113
113
|
subPkgs.forEach(subPkg => {
|
|
114
114
|
if (subPkg === null || subPkg === void 0 ? void 0 : subPkg.independent) {
|
|
115
115
|
if (packSetting.enableV2) {
|
package/dist/types/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "xhs-mp-compiler-cli",
|
|
3
|
-
"version": "1.5.0
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"description": "xhs mp command tool.",
|
|
5
5
|
"preferGlobal": true,
|
|
6
6
|
"category": "esm",
|
|
@@ -82,11 +82,11 @@
|
|
|
82
82
|
"webpack-bundle-analyzer": "^4.4.0",
|
|
83
83
|
"webpack-chain": "^6.5.1",
|
|
84
84
|
"webpack-sources": "^3.2.2",
|
|
85
|
-
"xhs-mp-compiler-ml-loader": "1.5.0
|
|
86
|
-
"xhs-mp-compiler-utils": "1.3.0
|
|
87
|
-
"xhs-mp-pack": "^1.3.0
|
|
88
|
-
"xhs-mp-project": "^1.3.0
|
|
89
|
-
"xhs-mp-utils": "^1.5.0
|
|
85
|
+
"xhs-mp-compiler-ml-loader": "1.5.0",
|
|
86
|
+
"xhs-mp-compiler-utils": "1.3.0",
|
|
87
|
+
"xhs-mp-pack": "^1.3.0",
|
|
88
|
+
"xhs-mp-project": "^1.3.0",
|
|
89
|
+
"xhs-mp-utils": "^1.5.0"
|
|
90
90
|
},
|
|
91
91
|
"devDependencies": {
|
|
92
92
|
"@types/babel__generator": "7.6.3",
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
property targetTab: null
|
|
2
|
-
property targetTabIndex: -1
|
|
3
|
-
property targetWindow: null
|
|
4
|
-
|
|
5
|
-
on run argv
|
|
6
|
-
set theURL to item 1 of argv
|
|
7
|
-
|
|
8
|
-
with timeout of 2 seconds
|
|
9
|
-
tell application "Chrome"
|
|
10
|
-
|
|
11
|
-
if (count every window) = 0 then
|
|
12
|
-
make new window
|
|
13
|
-
end if
|
|
14
|
-
|
|
15
|
-
-- 1: Looking for tab running debugger
|
|
16
|
-
-- then, Reload debugging tab if found
|
|
17
|
-
-- then return
|
|
18
|
-
set found to my lookupTabWithUrl(theURL)
|
|
19
|
-
if found then
|
|
20
|
-
set targetWindow's active tab index to targetTabIndex
|
|
21
|
-
tell targetTab to reload
|
|
22
|
-
tell targetWindow to activate
|
|
23
|
-
set index of targetWindow to 1
|
|
24
|
-
return
|
|
25
|
-
end if
|
|
26
|
-
|
|
27
|
-
-- 2: Looking for Empty tab
|
|
28
|
-
-- In case debugging tab was not found
|
|
29
|
-
-- We try to find an empty tab instead
|
|
30
|
-
set found to my lookupTabWithUrl("chrome://newtab/")
|
|
31
|
-
if found then
|
|
32
|
-
set targetWindow's active tab index to targetTabIndex
|
|
33
|
-
set URL of targetTab to theURL
|
|
34
|
-
tell targetWindow to activate
|
|
35
|
-
return
|
|
36
|
-
end if
|
|
37
|
-
|
|
38
|
-
-- 3: Create new tab
|
|
39
|
-
-- both debugging and empty tab were not found
|
|
40
|
-
-- make a new tab with url
|
|
41
|
-
tell window 1
|
|
42
|
-
activate
|
|
43
|
-
make new tab with properties {URL:theURL}
|
|
44
|
-
end tell
|
|
45
|
-
end tell
|
|
46
|
-
end timeout
|
|
47
|
-
end run
|
|
48
|
-
|
|
49
|
-
-- Function:
|
|
50
|
-
-- Lookup tab with given url
|
|
51
|
-
-- if found, store tab, index, and window in properties
|
|
52
|
-
-- (properties were declared on top of file)
|
|
53
|
-
on lookupTabWithUrl(lookupUrl)
|
|
54
|
-
tell application "Chrome"
|
|
55
|
-
-- Find a tab with the given url
|
|
56
|
-
set found to false
|
|
57
|
-
set theTabIndex to -1
|
|
58
|
-
repeat with theWindow in every window
|
|
59
|
-
set theTabIndex to 0
|
|
60
|
-
repeat with theTab in every tab of theWindow
|
|
61
|
-
set theTabIndex to theTabIndex + 1
|
|
62
|
-
if (theTab's URL as string) contains lookupUrl then
|
|
63
|
-
-- assign tab, tab index, and window to properties
|
|
64
|
-
set targetTab to theTab
|
|
65
|
-
set targetTabIndex to theTabIndex
|
|
66
|
-
set targetWindow to theWindow
|
|
67
|
-
set found to true
|
|
68
|
-
exit repeat
|
|
69
|
-
end if
|
|
70
|
-
end repeat
|
|
71
|
-
|
|
72
|
-
if found then
|
|
73
|
-
exit repeat
|
|
74
|
-
end if
|
|
75
|
-
end repeat
|
|
76
|
-
end tell
|
|
77
|
-
return found
|
|
78
|
-
end lookupTabWithUrl
|