@tuya-sat/micro-script 3.3.2 → 3.3.3
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/config/webpack.common.d.ts +2 -1
- package/dist/config/webpack.common.js +2 -1
- package/dist/config/webpack.config.d.ts +1 -1
- package/dist/config/webpack.config.js +2 -2
- package/dist/module/bundleServer.d.ts +1 -1
- package/dist/module/bundleServer.js +2 -2
- package/dist/scripts/startInMain.js +1 -1
- package/dist/template/main-app/utils.ts +2 -2
- package/package.json +4 -4
|
@@ -2,8 +2,9 @@ import { Configuration } from 'webpack';
|
|
|
2
2
|
import { ThemeCat } from '@tuya-sat/micro-dev-loader/dist/less/utils/index';
|
|
3
3
|
declare type ThemeEnv = ThemeCat | undefined;
|
|
4
4
|
export declare const validateMicroTheme: () => ThemeEnv;
|
|
5
|
-
export default function getCommonConfig({ isDev, isBuild, }: {
|
|
5
|
+
export default function getCommonConfig({ isDev, isBuild, port, }: {
|
|
6
6
|
isDev: boolean;
|
|
7
7
|
isBuild: boolean;
|
|
8
|
+
port?: number;
|
|
8
9
|
}): Configuration;
|
|
9
10
|
export {};
|
|
@@ -64,7 +64,7 @@ const validateMicroTheme = () => {
|
|
|
64
64
|
return microTheme;
|
|
65
65
|
};
|
|
66
66
|
exports.validateMicroTheme = validateMicroTheme;
|
|
67
|
-
function getCommonConfig({ isDev, isBuild, }) {
|
|
67
|
+
function getCommonConfig({ isDev, isBuild, port, }) {
|
|
68
68
|
const { name: packageName } = require(paths_1.default.appPkg);
|
|
69
69
|
const devMicroTheme = (0, exports.validateMicroTheme)();
|
|
70
70
|
const enableThemeCompile = isDev
|
|
@@ -105,6 +105,7 @@ function getCommonConfig({ isDev, isBuild, }) {
|
|
|
105
105
|
const baseConfig = {
|
|
106
106
|
mode: isBuild ? 'production' : 'development',
|
|
107
107
|
output: {
|
|
108
|
+
publicPath: isDev && isMainApp && port ? `http://0.0.0.0/${port}/` : undefined,
|
|
108
109
|
filename: isBuild
|
|
109
110
|
? 'static/js/[name].[contenthash:8].js'
|
|
110
111
|
: 'static/js/[name].bundle.js',
|
|
@@ -8,7 +8,7 @@ const paths_1 = __importDefault(require("./paths"));
|
|
|
8
8
|
const framework_1 = __importDefault(require("../framework"));
|
|
9
9
|
const webpack_common_1 = __importDefault(require("./webpack.common"));
|
|
10
10
|
const utils_1 = require("../utils");
|
|
11
|
-
exports.default = () => {
|
|
11
|
+
exports.default = (port) => {
|
|
12
12
|
const isBuild = process.env.NODE_ENV === 'production';
|
|
13
13
|
const isDev = process.env.NODE_ENV === 'development';
|
|
14
14
|
//框架的webpack配置
|
|
@@ -18,7 +18,7 @@ exports.default = () => {
|
|
|
18
18
|
isBuild,
|
|
19
19
|
});
|
|
20
20
|
//公用的webpack配置
|
|
21
|
-
const commonConfig = (0, webpack_common_1.default)({ isDev, isBuild });
|
|
21
|
+
const commonConfig = (0, webpack_common_1.default)({ port, isDev, isBuild });
|
|
22
22
|
const baseConfig = (0, webpack_merge_1.merge)(frameworkConfig, commonConfig);
|
|
23
23
|
//额外的webpack结合function
|
|
24
24
|
const webpackCombineFunction = require(paths_1.default.microConfig).webpack;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import webpack, { Compiler } from 'webpack';
|
|
2
2
|
import { Configuration } from 'webpack-dev-server';
|
|
3
3
|
export declare type CustomDevServer = (value: Configuration) => typeof value;
|
|
4
|
-
export declare function createServerCompiler(): webpack.Compiler;
|
|
4
|
+
export declare function createServerCompiler(port?: number): webpack.Compiler;
|
|
5
5
|
export declare function runBundleServer({ port, compiler, internalDevConfig, }: {
|
|
6
6
|
port: number;
|
|
7
7
|
compiler: Compiler;
|
|
@@ -33,8 +33,8 @@ const webpack_config_1 = __importDefault(require("../config/webpack.config"));
|
|
|
33
33
|
const options_1 = __importDefault(require("./options"));
|
|
34
34
|
const onceFactory_1 = require("../utils/onceFactory");
|
|
35
35
|
const promiser_1 = require("../utils/promiser");
|
|
36
|
-
function createServerCompiler() {
|
|
37
|
-
const config = Object.assign(Object.assign({}, (0, webpack_config_1.default)()), {
|
|
36
|
+
function createServerCompiler(port) {
|
|
37
|
+
const config = Object.assign(Object.assign({}, (0, webpack_config_1.default)(port)), {
|
|
38
38
|
//下面所有配置都是为了精简terminal输出
|
|
39
39
|
infrastructureLogging: {
|
|
40
40
|
level: 'warn',
|
|
@@ -31,7 +31,7 @@ const template_1 = __importDefault(require("../template"));
|
|
|
31
31
|
port: bundledServerPort + 1,
|
|
32
32
|
stopPort: bundledServerPort + 100,
|
|
33
33
|
});
|
|
34
|
-
const compiler = (0, bundleServer_1.createServerCompiler)();
|
|
34
|
+
const compiler = (0, bundleServer_1.createServerCompiler)(bundledServerPort);
|
|
35
35
|
yield (0, bundleServer_1.runBundleServer)({
|
|
36
36
|
port: bundledServerPort,
|
|
37
37
|
compiler,
|
|
@@ -49,9 +49,9 @@ export const reWriteUI = () => {
|
|
|
49
49
|
bindCmp(result, nav, 'nav');
|
|
50
50
|
|
|
51
51
|
const layout = (require as any).context(
|
|
52
|
-
'../../src
|
|
52
|
+
'../../src',
|
|
53
53
|
true,
|
|
54
|
-
|
|
54
|
+
/\.\/layout\/.*\.([tj]sx?)$/
|
|
55
55
|
);
|
|
56
56
|
bindCmp(result, layout, 'layout');
|
|
57
57
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tuya-sat/micro-script",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.3",
|
|
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.3.
|
|
27
|
-
"@tuya-sat/micro-dev-proxy": "3.3.
|
|
28
|
-
"@tuya-sat/micro-utils": "3.3.
|
|
26
|
+
"@tuya-sat/micro-dev-loader": "3.3.3",
|
|
27
|
+
"@tuya-sat/micro-dev-proxy": "3.3.3",
|
|
28
|
+
"@tuya-sat/micro-utils": "3.3.3",
|
|
29
29
|
"@types/kill-port": "^2.0.0",
|
|
30
30
|
"babel-loader": "8.2.4",
|
|
31
31
|
"babel-plugin-import": "1.13.3",
|