@tuya-sat/micro-dev-loader 3.0.2 → 3.0.4
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.ts +1 -1
- package/dist/index.js +3 -3
- package/dist/less/plugin/dark.variable.less +3 -12
- package/dist/less/plugin/file.js +4 -3
- package/dist/plugins/locales/index.d.ts +9 -0
- package/dist/plugins/theme/index.js +3 -8
- package/package.json +4 -4
- package/dist/less/utils/patch.d.ts +0 -2
- package/dist/less/utils/patch.js +0 -28
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -4,9 +4,9 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var index = require('./plugins/theme/index.js');
|
|
6
6
|
|
|
7
|
-
const filterCssVariableLoader = require.resolve(
|
|
8
|
-
const changeAntdGlobalImport = require.resolve(
|
|
9
|
-
const changeTuyaSatComponentImport = require.resolve(
|
|
7
|
+
const filterCssVariableLoader = require.resolve('./loader/filterCssVariableLoader');
|
|
8
|
+
const changeAntdGlobalImport = require.resolve('./loader/changeAntdGlobalImport');
|
|
9
|
+
const changeTuyaSatComponentImport = require.resolve('./loader/changeTuyaSatComponentImport');
|
|
10
10
|
|
|
11
11
|
exports.ThemePlugin = index["default"];
|
|
12
12
|
exports.changeAntdGlobalImport = changeAntdGlobalImport;
|
|
@@ -564,7 +564,7 @@ html {
|
|
|
564
564
|
// ---
|
|
565
565
|
@anchor-bg: transparent;
|
|
566
566
|
@anchor-border-color: @border-color-split;
|
|
567
|
-
@anchor-link-top: 7px;
|
|
567
|
+
@anchor-link-top: 7px;
|
|
568
568
|
@anchor-link-left: 16px;
|
|
569
569
|
@anchor-link-padding: @anchor-link-top 0 @anchor-link-top @anchor-link-left;
|
|
570
570
|
|
|
@@ -616,7 +616,7 @@ html {
|
|
|
616
616
|
@modal-header-title-line-height: 22px;
|
|
617
617
|
@modal-header-title-font-size: @font-size-lg;
|
|
618
618
|
@modal-header-border-color-split: @border-color-split;
|
|
619
|
-
@modal-header-close-size:
|
|
619
|
+
@modal-header-close-size: 56px;
|
|
620
620
|
@modal-content-bg: @component-background;
|
|
621
621
|
@modal-heading-color: @heading-color;
|
|
622
622
|
@modal-close-color: @text-color-secondary;
|
|
@@ -629,7 +629,6 @@ html {
|
|
|
629
629
|
@modal-mask-bg: fade(@black, 45%);
|
|
630
630
|
@modal-confirm-body-padding: 32px 32px 24px;
|
|
631
631
|
@modal-confirm-title-font-size: @font-size-lg;
|
|
632
|
-
@modal-border-radius: @border-radius-base;
|
|
633
632
|
|
|
634
633
|
// Progress
|
|
635
634
|
// --
|
|
@@ -928,7 +927,7 @@ html {
|
|
|
928
927
|
@breadcrumb-font-size: @font-size-base;
|
|
929
928
|
@breadcrumb-icon-font-size: @font-size-base;
|
|
930
929
|
@breadcrumb-link-color: @text-color-secondary;
|
|
931
|
-
@breadcrumb-link-color-hover: @
|
|
930
|
+
@breadcrumb-link-color-hover: @primary-5;
|
|
932
931
|
@breadcrumb-separator-color: @text-color-secondary;
|
|
933
932
|
@breadcrumb-separator-margin: 0 @padding-xs;
|
|
934
933
|
|
|
@@ -1419,11 +1418,3 @@ html {
|
|
|
1419
1418
|
// Mentions
|
|
1420
1419
|
// ---
|
|
1421
1420
|
@mentions-dropdown-bg: @popover-background;
|
|
1422
|
-
|
|
1423
|
-
// Segmented
|
|
1424
|
-
// ---
|
|
1425
|
-
@segmented-bg: fade(@black, 25%);
|
|
1426
|
-
@segmented-hover-bg: fade(@black, 45%);
|
|
1427
|
-
@segmented-selected-bg: #333333;
|
|
1428
|
-
@segmented-label-color: fade(@white, 65%);
|
|
1429
|
-
@segmented-label-hover-color: fade(@white, 85%);
|
package/dist/less/plugin/file.js
CHANGED
|
@@ -4,18 +4,19 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var tslib = require('tslib');
|
|
6
6
|
var path = require('path');
|
|
7
|
+
var fse = require('fs-extra');
|
|
7
8
|
var less = require('less');
|
|
8
|
-
var patch = require('../utils/patch.js');
|
|
9
9
|
|
|
10
10
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
11
11
|
|
|
12
12
|
var path__default = /*#__PURE__*/_interopDefaultLegacy(path);
|
|
13
|
+
var fse__default = /*#__PURE__*/_interopDefaultLegacy(fse);
|
|
13
14
|
|
|
14
15
|
class HandleImport extends less.FileManager {
|
|
15
16
|
constructor() {
|
|
16
17
|
super(...arguments);
|
|
17
18
|
this.interceptReg = /antd\/(es|lib)\/style\/themes\/variable\.less$/;
|
|
18
|
-
this.darkVariableContent =
|
|
19
|
+
this.darkVariableContent = fse__default["default"].readFileSync(require.resolve("./dark.variable.less"), "utf-8");
|
|
19
20
|
}
|
|
20
21
|
loadFile(filename, currentDirectory, options, environment) {
|
|
21
22
|
const _super = Object.create(null, {
|
|
@@ -24,7 +25,7 @@ class HandleImport extends less.FileManager {
|
|
|
24
25
|
return tslib.__awaiter(this, void 0, void 0, function* () {
|
|
25
26
|
if (filename.startsWith("~")) {
|
|
26
27
|
let filenamed = filename.replace("~", "");
|
|
27
|
-
const fullPath = require.resolve(filenamed
|
|
28
|
+
const fullPath = require.resolve(filenamed);
|
|
28
29
|
if (this.interceptReg.test(fullPath)) {
|
|
29
30
|
return {
|
|
30
31
|
filename: fullPath,
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Compiler } from "webpack";
|
|
2
|
+
export default class LocalsPlugin {
|
|
3
|
+
private localesOriginPath;
|
|
4
|
+
private localesTargetPath;
|
|
5
|
+
private pluginName;
|
|
6
|
+
private localesFiles;
|
|
7
|
+
constructor(localesOriginPath?: string, localesTargetPath?: string);
|
|
8
|
+
apply(compiler: Compiler): void;
|
|
9
|
+
}
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var tslib = require('tslib');
|
|
6
|
-
var crypto = require('crypto');
|
|
7
6
|
var HtmlWebpackPlugin = require('html-webpack-plugin');
|
|
8
7
|
var cheerio = require('cheerio');
|
|
9
8
|
var less = require('less');
|
|
@@ -35,13 +34,9 @@ class ThemePlugin {
|
|
|
35
34
|
name: this.pluginName,
|
|
36
35
|
stage: compiler.webpack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL,
|
|
37
36
|
}, (assets, callback) => tslib.__awaiter(this, void 0, void 0, function* () {
|
|
38
|
-
const
|
|
37
|
+
const [pathname] = Object.entries(assets).find(([pathname]) => {
|
|
39
38
|
return /\/light\.[\s\S]+?\.css$/.test(pathname);
|
|
40
39
|
});
|
|
41
|
-
if (!lightAsset) {
|
|
42
|
-
return callback();
|
|
43
|
-
}
|
|
44
|
-
const [pathname] = lightAsset;
|
|
45
40
|
const chunk = compilation.namedChunks.get("light");
|
|
46
41
|
compilation.chunkGraph.getChunkModules(chunk).forEach((item) => {
|
|
47
42
|
this.lessFiles.push(item.nameForCondition());
|
|
@@ -50,8 +45,8 @@ class ThemePlugin {
|
|
|
50
45
|
return new RawSource(this.filterCssVarible(source.source().toString())[0]);
|
|
51
46
|
});
|
|
52
47
|
const [content, storeHtmlVariable] = yield this.runCssbundle();
|
|
53
|
-
const
|
|
54
|
-
const darkCssFileName = `dark.${
|
|
48
|
+
const { contenthash } = compilation.assetsInfo.get(pathname);
|
|
49
|
+
const darkCssFileName = `dark.${contenthash}.css`;
|
|
55
50
|
compilation.emitAsset(`${this.stylePath}/${darkCssFileName}`, new RawSource(content));
|
|
56
51
|
HtmlWebpackPlugin__default["default"].getHooks(compilation).beforeAssetTagGeneration.tapAsync(this.pluginName, (data, cb) => {
|
|
57
52
|
HtmlWebpackPlugin__default["default"].getHooks(compilation).beforeEmit.tapAsync(this.pluginName, (data, cb) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tuya-sat/micro-dev-loader",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.4",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"scripts": {
|
|
@@ -14,17 +14,17 @@
|
|
|
14
14
|
"@babel/generator": "7.17.7",
|
|
15
15
|
"@babel/plugin-syntax-typescript": "7.16.7",
|
|
16
16
|
"@babel/template": "7.16.7",
|
|
17
|
-
"@tuya-sat/micro-utils": "3.0.
|
|
17
|
+
"@tuya-sat/micro-utils": "3.0.4",
|
|
18
18
|
"cheerio": "1.0.0-rc.10",
|
|
19
19
|
"ejs": "3.1.6",
|
|
20
20
|
"fs-extra": "10.0.1",
|
|
21
21
|
"html-webpack-plugin": "5.5.0",
|
|
22
|
+
"jiti": "1.14.0",
|
|
22
23
|
"less": "4.1.2",
|
|
23
24
|
"less-bundle-promise": "1.0.11",
|
|
24
25
|
"loader-utils": "3.2.0",
|
|
25
26
|
"path": "0.12.7",
|
|
26
27
|
"postcss": "8.4.12",
|
|
27
|
-
"semver": "7.3.5",
|
|
28
28
|
"tslib": "2.3.1"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"rollup-plugin-typescript2": "0.31.2",
|
|
40
40
|
"ts-jest": "27.1.3",
|
|
41
41
|
"typescript": "4.6.2",
|
|
42
|
-
"webpack": "5.
|
|
42
|
+
"webpack": "5.75.0"
|
|
43
43
|
},
|
|
44
44
|
"keywords": [
|
|
45
45
|
"saturn-project",
|
package/dist/less/utils/patch.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var path = require('path');
|
|
6
|
-
var semver = require('semver');
|
|
7
|
-
var fse = require('fs-extra');
|
|
8
|
-
|
|
9
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
10
|
-
|
|
11
|
-
var path__default = /*#__PURE__*/_interopDefaultLegacy(path);
|
|
12
|
-
var fse__default = /*#__PURE__*/_interopDefaultLegacy(fse);
|
|
13
|
-
|
|
14
|
-
function patchLessForAntd(version, content) {
|
|
15
|
-
if (semver.gte(version, "4.20.6")) {
|
|
16
|
-
return `${content}@anchor-link-top: 4px;\n`;
|
|
17
|
-
}
|
|
18
|
-
return content;
|
|
19
|
-
}
|
|
20
|
-
function getDarkLessContent() {
|
|
21
|
-
const antdPkgPath = require.resolve('antd/package.json', { paths: [process.cwd()] });
|
|
22
|
-
const { version } = fse__default["default"].readJSONSync(antdPkgPath);
|
|
23
|
-
const originDarkVariableContent = fse__default["default"].readFileSync(path__default["default"].join(__dirname, '../plugin/dark.variable.less'), "utf-8");
|
|
24
|
-
return patchLessForAntd(version, originDarkVariableContent);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
exports.getDarkLessContent = getDarkLessContent;
|
|
28
|
-
exports.patchLessForAntd = patchLessForAntd;
|