@tuya-sat/micro-dev-loader 2.3.0 → 2.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.
@@ -25,7 +25,7 @@ class HandleImport extends less.FileManager {
25
25
  return tslib.__awaiter(this, void 0, void 0, function* () {
26
26
  if (filename.startsWith("~")) {
27
27
  let filenamed = filename.replace("~", "");
28
- const fullPath = require.resolve(filenamed);
28
+ const fullPath = require.resolve(filenamed, { paths: [currentDirectory] });
29
29
  if (this.interceptReg.test(fullPath)) {
30
30
  return {
31
31
  filename: fullPath,
@@ -3,6 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var tslib = require('tslib');
6
+ var crypto = require('crypto');
6
7
  var HtmlWebpackPlugin = require('html-webpack-plugin');
7
8
  var cheerio = require('cheerio');
8
9
  var less = require('less');
@@ -45,8 +46,8 @@ class ThemePlugin {
45
46
  return new RawSource(this.filterCssVarible(source.source().toString())[0]);
46
47
  });
47
48
  const [content, storeHtmlVariable] = yield this.runCssbundle();
48
- const { contenthash } = compilation.assetsInfo.get(pathname);
49
- const darkCssFileName = `dark.${contenthash}.css`;
49
+ const darkHash = crypto.createHash("sha256").update(content).digest("hex").substring(0, 8);
50
+ const darkCssFileName = `dark.${darkHash}.css`;
50
51
  compilation.emitAsset(`${this.stylePath}/${darkCssFileName}`, new RawSource(content));
51
52
  HtmlWebpackPlugin__default["default"].getHooks(compilation).beforeAssetTagGeneration.tapAsync(this.pluginName, (data, cb) => {
52
53
  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": "2.3.0",
3
+ "version": "2.3.3",
4
4
  "main": "dist/index.js",
5
5
  "license": "MIT",
6
6
  "scripts": {
@@ -14,7 +14,7 @@
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": "2.3.0",
17
+ "@tuya-sat/micro-utils": "2.3.3",
18
18
  "cheerio": "1.0.0-rc.10",
19
19
  "ejs": "3.1.6",
20
20
  "fs-extra": "10.0.1",