@tuya-sat/micro-dev-loader 2.1.0 → 2.1.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.
@@ -2,8 +2,8 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var tslib_es6 = require('../../node_modules/tslib/tslib.es6.js');
6
- var theme = require('../../node_modules/antd/dist/theme.js');
5
+ var tslib = require('tslib');
6
+ var theme = require('antd/dist/theme');
7
7
  var HtmlWebpackPlugin = require('html-webpack-plugin');
8
8
  var cheerio = require('cheerio');
9
9
  var less = require('less');
@@ -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) => tslib_es6.__awaiter(this, void 0, void 0, function* () {
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 tslib_es6.__awaiter(this, void 0, void 0, function* () {
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,13 +83,13 @@ class ThemePlugin {
83
83
  });
84
84
  }
85
85
  runCssbundle() {
86
- return tslib_es6.__awaiter(this, void 0, void 0, function* () {
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, {
90
90
  filename: file,
91
91
  javascriptEnabled: true,
92
- modifyVars: theme["default"].getThemeVariables({
92
+ modifyVars: theme.getThemeVariables({
93
93
  dark: true,
94
94
  }),
95
95
  plugins: [createHandleImportPlugin()],
@@ -112,8 +112,8 @@ class ThemePlugin {
112
112
  return jsSrc;
113
113
  }
114
114
  getLessVarible() {
115
- let antdLightVarible = theme["default"].getThemeVariables();
116
- let antdDarkVarible = theme["default"].getThemeVariables({ dark: true });
115
+ let antdLightVarible = theme.getThemeVariables();
116
+ let antdDarkVarible = theme.getThemeVariables({ dark: true });
117
117
  delete antdDarkVarible.hack;
118
118
  delete antdLightVarible.hack;
119
119
  const { dark, light } = this.customLessVarible;
@@ -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 tslib_es6.__awaiter(this, void 0, void 0, function* () {
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.0",
3
+ "version": "2.1.3",
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",