glass-easel-miniprogram-webpack-plugin 0.14.1 → 0.15.0

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.
Files changed (3) hide show
  1. package/index.js +3 -9
  2. package/index.ts +2 -8
  3. package/package.json +7 -7
package/index.js CHANGED
@@ -41,11 +41,10 @@ const node_fs_1 = require("node:fs");
41
41
  const path = __importStar(require("node:path"));
42
42
  const webpack_1 = require("webpack");
43
43
  const chalk_1 = __importDefault(require("chalk"));
44
+ const chokidar_1 = __importDefault(require("chokidar"));
44
45
  const glass_easel_template_compiler_1 = require("glass-easel-template-compiler");
45
46
  const helpers_1 = require("./helpers");
46
47
  // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
47
- const chokidar = require('chokidar');
48
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
49
48
  const { RawSource } = require('webpack-sources');
50
49
  // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
51
50
  const VirtualModulesPlugin = require('webpack-virtual-modules');
@@ -305,8 +304,7 @@ class GlassEaselMiniprogramWebpackPlugin {
305
304
  // await readdirp(codeRoot, handleFile)
306
305
  yield new Promise((resolve, reject) => {
307
306
  const promises = [];
308
- /* eslint-disable @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call */
309
- const watcher = chokidar.watch(codeRoot, { ignoreInitial: false });
307
+ const watcher = chokidar_1.default.watch(codeRoot, { ignoreInitial: false });
310
308
  watcher
311
309
  .on('add', (p) => {
312
310
  const normalized = normalizePath(p);
@@ -322,7 +320,6 @@ class GlassEaselMiniprogramWebpackPlugin {
322
320
  .on('ready', () => {
323
321
  Promise.all(promises)
324
322
  .then(() => {
325
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return
326
323
  if (!enableWatch)
327
324
  return watcher.close();
328
325
  return null;
@@ -330,7 +327,6 @@ class GlassEaselMiniprogramWebpackPlugin {
330
327
  .then(resolve)
331
328
  .catch(reject);
332
329
  });
333
- /* eslint-enable @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call */
334
330
  });
335
331
  });
336
332
  // init component list before run
@@ -542,9 +538,7 @@ class GlassEaselMiniprogramWebpackPlugin {
542
538
  `;
543
539
  const entryFooter = `
544
540
  var registerGlobalEventListener = function (backend) {
545
- backend.onEvent((target, type, detail, options) => {
546
- glassEasel.triggerEvent(target, type, detail, options)
547
- })
541
+ backend.onEvent(glassEasel.triggerEvent)
548
542
  }
549
543
  exports.registerGlobalEventListener = registerGlobalEventListener
550
544
  `;
package/index.ts CHANGED
@@ -4,6 +4,7 @@ import { promises as fs } from 'node:fs'
4
4
  import * as path from 'node:path'
5
5
  import { NormalModule, type Compiler, type WebpackPluginInstance } from 'webpack'
6
6
  import chalk from 'chalk'
7
+ import chokidar from 'chokidar'
7
8
  import { TmplGroup } from 'glass-easel-template-compiler'
8
9
  import { escapeJsString } from './helpers'
9
10
 
@@ -24,8 +25,6 @@ type Warning = {
24
25
  endColumn: number
25
26
  }
26
27
 
27
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
28
- const chokidar = require('chokidar')
29
28
  // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
30
29
  const { RawSource } = require('webpack-sources')
31
30
  // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
@@ -356,7 +355,6 @@ export class GlassEaselMiniprogramWebpackPlugin implements WebpackPluginInstance
356
355
  // await readdirp(codeRoot, handleFile)
357
356
  await new Promise((resolve, reject) => {
358
357
  const promises: Promise<void>[] = []
359
- /* eslint-disable @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call */
360
358
  const watcher = chokidar.watch(codeRoot, { ignoreInitial: false })
361
359
  watcher
362
360
  .on('add', (p: string) => {
@@ -372,14 +370,12 @@ export class GlassEaselMiniprogramWebpackPlugin implements WebpackPluginInstance
372
370
  .on('ready', () => {
373
371
  Promise.all(promises)
374
372
  .then(() => {
375
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return
376
373
  if (!enableWatch) return watcher.close()
377
374
  return null
378
375
  })
379
376
  .then(resolve)
380
377
  .catch(reject)
381
378
  })
382
- /* eslint-enable @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call */
383
379
  })
384
380
  }
385
381
 
@@ -601,9 +597,7 @@ export class GlassEaselMiniprogramWebpackPlugin implements WebpackPluginInstance
601
597
  `
602
598
  const entryFooter = `
603
599
  var registerGlobalEventListener = function (backend) {
604
- backend.onEvent((target, type, detail, options) => {
605
- glassEasel.triggerEvent(target, type, detail, options)
606
- })
600
+ backend.onEvent(glassEasel.triggerEvent)
607
601
  }
608
602
  exports.registerGlobalEventListener = registerGlobalEventListener
609
603
  `
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "glass-easel-miniprogram-webpack-plugin",
3
3
  "description": "The webpack plugin of the glass-easel project for MiniProgram file structure",
4
- "version": "0.14.1",
4
+ "version": "0.15.0",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/wechat-miniprogram/glass-easel.git"
@@ -17,18 +17,18 @@
17
17
  "homepage": "https://github.com/wechat-miniprogram/glass-easel",
18
18
  "main": "index.js",
19
19
  "peerDependencies": {
20
- "webpack": "^5.85.0",
21
- "glass-easel": "0.14.1",
22
- "glass-easel-miniprogram-adapter": "0.14.1"
20
+ "webpack": "^5.101.3",
21
+ "glass-easel": "0.15.0",
22
+ "glass-easel-miniprogram-adapter": "0.15.0"
23
23
  },
24
24
  "dependencies": {
25
25
  "chalk": "4",
26
- "chokidar": "^3.5.3",
26
+ "chokidar": "^4.0.3",
27
27
  "source-map": "^0.7.4",
28
28
  "webpack-sources": "^3.2.1",
29
29
  "webpack-virtual-modules": "^0.5.0",
30
- "glass-easel-stylesheet-compiler": "0.14.1",
31
- "glass-easel-template-compiler": "0.14.1"
30
+ "glass-easel-stylesheet-compiler": "0.15.0",
31
+ "glass-easel-template-compiler": "0.15.0"
32
32
  },
33
33
  "scripts": {
34
34
  "build": "tsc -p .",