@tuya-sat/micro-dev-loader 2.1.0 → 2.1.1
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.
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var tslib = require('tslib');
|
|
6
6
|
var theme = require('../../node_modules/antd/dist/theme.js');
|
|
7
7
|
var HtmlWebpackPlugin = require('html-webpack-plugin');
|
|
8
8
|
var cheerio = require('cheerio');
|
|
@@ -34,7 +34,7 @@ class ThemePlugin {
|
|
|
34
34
|
compilation.hooks.processAssets.tapAsync({
|
|
35
35
|
name: this.pluginName,
|
|
36
36
|
stage: compiler.webpack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL,
|
|
37
|
-
}, (assets, callback) =>
|
|
37
|
+
}, (assets, callback) => tslib.__awaiter(this, void 0, void 0, function* () {
|
|
38
38
|
const [pathname] = Object.entries(assets).find(([pathname]) => {
|
|
39
39
|
return /\/light\.[\s\S]+?\.css$/.test(pathname);
|
|
40
40
|
});
|
|
@@ -56,10 +56,10 @@ class ThemePlugin {
|
|
|
56
56
|
const reg = /(?<=\/)light.([\s\S]+?).css$/;
|
|
57
57
|
const href = $(this).attr("href");
|
|
58
58
|
if (reg.test(href)) {
|
|
59
|
-
$(this).attr("id", "default-theme-css");
|
|
60
|
-
$(`<link href="${href}" rel="stylesheet/light" id="light-theme-css">`).insertBefore($(this));
|
|
61
|
-
$(`<link href="${href.replace(reg, darkCssFileName)}" rel="stylesheet/dark" id="dark-theme-css">`).insertBefore($(this));
|
|
62
|
-
$(`<link href="${href.replace(reg, lessFileName)}" rel="stylesheet/less">`).insertBefore(firstJs);
|
|
59
|
+
$(this).attr("id", "micro-default-theme-css");
|
|
60
|
+
$(`<link href="${href}" rel="stylesheet/light" id="micro-light-theme-css">`).insertBefore($(this));
|
|
61
|
+
$(`<link href="${href.replace(reg, darkCssFileName)}" rel="stylesheet/dark" id="micro-dark-theme-css">`).insertBefore($(this));
|
|
62
|
+
$(`<link href="${href.replace(reg, lessFileName)}" rel="stylesheet/less" id="micro-theme-less">`).insertBefore(firstJs);
|
|
63
63
|
}
|
|
64
64
|
});
|
|
65
65
|
data.html = $.html();
|
|
@@ -71,7 +71,7 @@ class ThemePlugin {
|
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
73
|
getBundledLessFile() {
|
|
74
|
-
return
|
|
74
|
+
return tslib.__awaiter(this, void 0, void 0, function* () {
|
|
75
75
|
let fakefile = "";
|
|
76
76
|
const cwd = process.cwd();
|
|
77
77
|
this.lessFiles.forEach((file) => {
|
|
@@ -83,7 +83,7 @@ class ThemePlugin {
|
|
|
83
83
|
});
|
|
84
84
|
}
|
|
85
85
|
runCssbundle() {
|
|
86
|
-
return
|
|
86
|
+
return tslib.__awaiter(this, void 0, void 0, function* () {
|
|
87
87
|
const lessTasks = this.lessFiles.map((file) => {
|
|
88
88
|
let bufferString = fse__default["default"].readFileSync(file, "utf-8");
|
|
89
89
|
return less__default["default"].render(bufferString, {
|
|
@@ -144,7 +144,7 @@ class HandleImport extends less.FileManager {
|
|
|
144
144
|
const _super = Object.create(null, {
|
|
145
145
|
loadFile: { get: () => super.loadFile }
|
|
146
146
|
});
|
|
147
|
-
return
|
|
147
|
+
return tslib.__awaiter(this, void 0, void 0, function* () {
|
|
148
148
|
if (filename.startsWith("~")) {
|
|
149
149
|
return _super.loadFile.call(this, filename.replace("~", ""), currentDirectory, options, environment);
|
|
150
150
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tuya-sat/micro-dev-loader",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.1",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"scripts": {
|
|
@@ -22,7 +22,8 @@
|
|
|
22
22
|
"less": "4.1.2",
|
|
23
23
|
"less-bundle-promise": "1.0.11",
|
|
24
24
|
"loader-utils": "3.2.0",
|
|
25
|
-
"path": "0.12.7"
|
|
25
|
+
"path": "0.12.7",
|
|
26
|
+
"tslib": "^2.3.1"
|
|
26
27
|
},
|
|
27
28
|
"devDependencies": {
|
|
28
29
|
"@rollup/plugin-commonjs": "21.0.2",
|