@tuya-sat/micro-script 3.0.21-beta.5 → 3.0.21-beta.6
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.
|
@@ -1,27 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
2
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
3
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
4
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -47,10 +24,10 @@ const webpack_manifest_plugin_1 = require("webpack-manifest-plugin");
|
|
|
47
24
|
const webpack_stats_plugin_1 = require("webpack-stats-plugin");
|
|
48
25
|
const micro_dev_loader_1 = require("@tuya-sat/micro-dev-loader");
|
|
49
26
|
const path_1 = __importDefault(require("path"));
|
|
50
|
-
const
|
|
27
|
+
const utils_1 = require("../utils");
|
|
51
28
|
const index_1 = require("@tuya-sat/micro-dev-loader/dist/less/utils/index");
|
|
52
29
|
const paths_1 = __importDefault(require("./paths"));
|
|
53
|
-
const
|
|
30
|
+
const utils_2 = require("../utils");
|
|
54
31
|
const toArray = (value) => {
|
|
55
32
|
return Array.isArray(value) ? value : [value];
|
|
56
33
|
};
|
|
@@ -68,7 +45,7 @@ function getCommonConfig({ isDev, isBuild, }) {
|
|
|
68
45
|
const devMicroTheme = (0, exports.validateMicroTheme)();
|
|
69
46
|
const enableThemeCompile = isDev
|
|
70
47
|
? !!devMicroTheme
|
|
71
|
-
: (0,
|
|
48
|
+
: (0, utils_2.getAnnotations)()['sdf.feat:colorTheme'];
|
|
72
49
|
//获取style处理的loader
|
|
73
50
|
const getStyleLoaders = (extraLoader = []) => {
|
|
74
51
|
extraLoader = toArray(extraLoader);
|
|
@@ -94,6 +71,7 @@ function getCommonConfig({ isDev, isBuild, }) {
|
|
|
94
71
|
return loaders;
|
|
95
72
|
};
|
|
96
73
|
let { multiApps, debuggerConfig: { isMainApp }, } = require(paths_1.default.microConfig);
|
|
74
|
+
(0, utils_1.processMultiApps)(multiApps);
|
|
97
75
|
const multiAppsWebpackConfig = {
|
|
98
76
|
plugins: [],
|
|
99
77
|
entry: {},
|
|
@@ -136,7 +114,7 @@ function getCommonConfig({ isDev, isBuild, }) {
|
|
|
136
114
|
? enableThemeCompile
|
|
137
115
|
? (0, index_1.getLessOptions)(devMicroTheme)
|
|
138
116
|
: {}
|
|
139
|
-
: (0,
|
|
117
|
+
: (0, utils_2.getAnnotations)()['sdf.feat:colorTheme']
|
|
140
118
|
? (0, index_1.getLessOptions)(index_1.LIGHT_THEME)
|
|
141
119
|
: {})), { javascriptEnabled: true }),
|
|
142
120
|
},
|
|
@@ -242,15 +220,9 @@ function getCommonConfig({ isDev, isBuild, }) {
|
|
|
242
220
|
};
|
|
243
221
|
return baseConfig;
|
|
244
222
|
}
|
|
245
|
-
if ((0,
|
|
246
|
-
if (!multiApps) {
|
|
247
|
-
multiApps = [];
|
|
248
|
-
fs.readdirSync(path_1.default.join(process.cwd(), 'apps')).forEach((dir) => {
|
|
249
|
-
multiApps = [...multiApps, { name: dir }];
|
|
250
|
-
});
|
|
251
|
-
}
|
|
223
|
+
if ((0, utils_2.isMonorepo)() || (multiApps && multiApps.length > 0)) {
|
|
252
224
|
multiApps.forEach((app) => {
|
|
253
|
-
if ((0,
|
|
225
|
+
if ((0, utils_2.isMonorepo)()) {
|
|
254
226
|
multiAppsWebpackConfig.entry[app.name] = `${path_1.default.join(process.cwd(), 'node_modules/.micro')}/${app.name}/index.tsx`;
|
|
255
227
|
}
|
|
256
228
|
else {
|
|
@@ -36,12 +36,7 @@ const utils_1 = require("../../utils");
|
|
|
36
36
|
function mockSaasInfo(app, microPort) {
|
|
37
37
|
let { multiApps, debuggerConfig: { isMainApp }, } = require(paths_1.default.microConfig);
|
|
38
38
|
const idsMap = new Map();
|
|
39
|
-
|
|
40
|
-
multiApps = [];
|
|
41
|
-
fs_extra_1.default.readdirSync(path.join(process.cwd(), 'apps')).forEach((dir) => {
|
|
42
|
-
multiApps = [...multiApps, { name: dir }];
|
|
43
|
-
});
|
|
44
|
-
}
|
|
39
|
+
(0, utils_1.processMultiApps)(multiApps);
|
|
45
40
|
multiApps === null || multiApps === void 0 ? void 0 : multiApps.forEach((app) => {
|
|
46
41
|
idsMap.set(app.name, { entry_id: (0, uuid_1.v4)(), oem_micro_app_id: (0, uid_1.uid)(16) });
|
|
47
42
|
});
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1,2 +1,8 @@
|
|
|
1
1
|
export declare const getAnnotations: () => any;
|
|
2
2
|
export declare const isMonorepo: () => boolean;
|
|
3
|
+
export declare type IMultiApp = {
|
|
4
|
+
name: string;
|
|
5
|
+
dir?: string;
|
|
6
|
+
htmlContentHash?: boolean;
|
|
7
|
+
};
|
|
8
|
+
export declare const processMultiApps: (multiApps: IMultiApp[]) => void;
|
package/dist/utils/index.js
CHANGED
|
@@ -26,7 +26,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.isMonorepo = exports.getAnnotations = void 0;
|
|
29
|
+
exports.processMultiApps = exports.isMonorepo = exports.getAnnotations = void 0;
|
|
30
30
|
const micro_utils_1 = require("@tuya-sat/micro-utils");
|
|
31
31
|
const path = __importStar(require("path"));
|
|
32
32
|
const paths_1 = __importDefault(require("../config/paths"));
|
|
@@ -52,3 +52,12 @@ const isMonorepo = () => {
|
|
|
52
52
|
return false;
|
|
53
53
|
};
|
|
54
54
|
exports.isMonorepo = isMonorepo;
|
|
55
|
+
const processMultiApps = (multiApps) => {
|
|
56
|
+
if (!multiApps && (0, exports.isMonorepo)()) {
|
|
57
|
+
multiApps = [];
|
|
58
|
+
fs_extra_1.default.readdirSync(path.join(process.cwd(), 'apps')).forEach((dir) => {
|
|
59
|
+
multiApps = [...multiApps, { name: dir }];
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
exports.processMultiApps = processMultiApps;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tuya-sat/micro-script",
|
|
3
|
-
"version": "3.0.21-beta.
|
|
3
|
+
"version": "3.0.21-beta.6",
|
|
4
4
|
"bin": "./dist/bin/cli.js",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"license": "MIT",
|
|
@@ -23,9 +23,9 @@
|
|
|
23
23
|
"@babel/preset-typescript": "7.16.7",
|
|
24
24
|
"@babel/traverse": "^7.20.13",
|
|
25
25
|
"@pmmmwh/react-refresh-webpack-plugin": "0.5.4",
|
|
26
|
-
"@tuya-sat/micro-dev-loader": "3.0.21-beta.
|
|
27
|
-
"@tuya-sat/micro-dev-proxy": "3.0.21-beta.
|
|
28
|
-
"@tuya-sat/micro-utils": "3.0.21-beta.
|
|
26
|
+
"@tuya-sat/micro-dev-loader": "3.0.21-beta.6",
|
|
27
|
+
"@tuya-sat/micro-dev-proxy": "3.0.21-beta.6",
|
|
28
|
+
"@tuya-sat/micro-utils": "3.0.21-beta.6",
|
|
29
29
|
"@types/kill-port": "^2.0.0",
|
|
30
30
|
"babel-loader": "8.2.4",
|
|
31
31
|
"babel-plugin-import": "1.13.3",
|