weapp-vite 1.2.0 → 1.2.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.
@@ -1,5 +1,9 @@
1
+ // src/logger.ts
2
+ import logger from "@weapp-core/logger";
3
+ var logger_default = logger;
4
+
1
5
  // package.json
2
- var version = "1.2.0";
6
+ var version = "1.2.1";
3
7
 
4
8
  // src/constants.ts
5
9
  var VERSION = version;
@@ -46,7 +50,7 @@ function createDebugger(namespace) {
46
50
  // src/entry.ts
47
51
  import process from "node:process";
48
52
  import { defu as defu2 } from "@weapp-core/shared";
49
- import klaw from "klaw";
53
+ import { fdir as Fdir } from "fdir";
50
54
  import mm from "micromatch";
51
55
  import path3 from "pathe";
52
56
 
@@ -230,21 +234,15 @@ async function getEntries(options) {
230
234
  type: "subPackageEntry"
231
235
  });
232
236
  }
233
- for await (const file of klaw(
234
- path3.join(root, subPackageRoot),
235
- {
236
- filter
237
- }
238
- )) {
239
- if (file.stats.isFile()) {
240
- if (/\.wxml$/.test(file.path)) {
241
- const entry = getWxmlEntry(file.path, formatPath);
242
- if (entry) {
243
- if (entry.type === "component") {
244
- componentEntries.push(entry);
245
- } else if (entry.type === "page") {
246
- pageEntries.push(entry);
247
- }
237
+ const files = await new Fdir().withFullPaths().filter(filter).crawl(path3.join(root, subPackageRoot)).withPromise();
238
+ for (const file of files) {
239
+ if (/\.wxml$/.test(file)) {
240
+ const entry = getWxmlEntry(file, formatPath);
241
+ if (entry) {
242
+ if (entry.type === "component") {
243
+ componentEntries.push(entry);
244
+ } else if (entry.type === "page") {
245
+ pageEntries.push(entry);
248
246
  }
249
247
  }
250
248
  }
@@ -274,21 +272,15 @@ async function getEntries(options) {
274
272
  );
275
273
  const pageEntries = [];
276
274
  const componentEntries = [];
277
- for await (const file of klaw(
278
- path3.join(root, srcRoot),
279
- {
280
- filter
281
- }
282
- )) {
283
- if (file.stats.isFile()) {
284
- if (/\.wxml$/.test(file.path)) {
285
- const entry = getWxmlEntry(file.path, formatPath);
286
- if (entry) {
287
- if (entry.type === "component") {
288
- componentEntries.push(entry);
289
- } else if (entry.type === "page") {
290
- pageEntries.push(entry);
291
- }
275
+ const files = await new Fdir().withFullPaths().filter(filter).crawl(path3.join(root, srcRoot)).withPromise();
276
+ for (const file of files) {
277
+ if (/\.wxml$/.test(file)) {
278
+ const entry = getWxmlEntry(file, formatPath);
279
+ if (entry) {
280
+ if (entry.type === "component") {
281
+ componentEntries.push(entry);
282
+ } else if (entry.type === "page") {
283
+ pageEntries.push(entry);
292
284
  }
293
285
  }
294
286
  }
@@ -298,7 +290,6 @@ async function getEntries(options) {
298
290
  pages: pageEntries,
299
291
  components: componentEntries,
300
292
  subPackages: subPackageDeps
301
- // walkPathsSet,
302
293
  };
303
294
  }
304
295
  }
@@ -558,12 +549,6 @@ var CompilerContext = class _CompilerContext {
558
549
  get mpDistRoot() {
559
550
  return this.projectConfig.miniprogramRoot || this.projectConfig.srcMiniprogramRoot || "";
560
551
  }
561
- // get weappConfig() {
562
- // return this.inlineConfig.weapp
563
- // }
564
- // get inlineSubPackageConfig() {
565
- // return this.weappConfig?.subPackage
566
- // }
567
552
  forkSubPackage(subPackage) {
568
553
  const ctx = new _CompilerContext({
569
554
  cwd: this.cwd,
@@ -727,6 +712,7 @@ var CompilerContext = class _CompilerContext {
727
712
  exclude: ["node_modules/**", this.mpDistRoot ? path5.join(this.mpDistRoot, "**") : "dist/**"]
728
713
  }
729
714
  },
715
+ logLevel: "info",
730
716
  plugins: [
731
717
  tsconfigPaths()
732
718
  ],
@@ -784,11 +770,14 @@ var CompilerContext = class _CompilerContext {
784
770
  strict: false,
785
771
  entryFileNames: "[name].js"
786
772
  }
773
+ // logLevel: 'silent',
787
774
  },
788
775
  assetsDir: "."
789
- }
776
+ },
777
+ logLevel: "error"
790
778
  });
791
779
  }
780
+ logger_default.success(`${dep} \u4F9D\u8D56\u5904\u7406\u5B8C\u6210!`);
792
781
  }
793
782
  }
794
783
  }
@@ -798,6 +787,7 @@ var CompilerContext = class _CompilerContext {
798
787
  };
799
788
 
800
789
  export {
790
+ logger_default,
801
791
  VERSION,
802
792
  CompilerContext
803
793
  };
package/dist/cli.cjs CHANGED
@@ -33,7 +33,7 @@ var import_cac = require("cac");
33
33
  var import_weapp_ide_cli = require("weapp-ide-cli");
34
34
 
35
35
  // package.json
36
- var version = "1.2.0";
36
+ var version = "1.2.1";
37
37
 
38
38
  // src/constants.ts
39
39
  var VERSION = version;
@@ -60,6 +60,10 @@ function getWeappWatchOptions() {
60
60
  };
61
61
  }
62
62
 
63
+ // src/logger.ts
64
+ var import_logger = __toESM(require("@weapp-core/logger"), 1);
65
+ var logger_default = import_logger.default;
66
+
63
67
  // src/plugins/index.ts
64
68
  var import_shared3 = require("@weapp-core/shared");
65
69
  var import_fast_glob = __toESM(require("fast-glob"), 1);
@@ -80,7 +84,7 @@ function createDebugger(namespace) {
80
84
  // src/entry.ts
81
85
  var import_node_process = __toESM(require("process"), 1);
82
86
  var import_shared2 = require("@weapp-core/shared");
83
- var import_klaw = __toESM(require("klaw"), 1);
87
+ var import_fdir = require("fdir");
84
88
  var import_micromatch = __toESM(require("micromatch"), 1);
85
89
  var import_pathe3 = __toESM(require("pathe"), 1);
86
90
 
@@ -264,21 +268,15 @@ async function getEntries(options) {
264
268
  type: "subPackageEntry"
265
269
  });
266
270
  }
267
- for await (const file of (0, import_klaw.default)(
268
- import_pathe3.default.join(root, subPackageRoot),
269
- {
270
- filter
271
- }
272
- )) {
273
- if (file.stats.isFile()) {
274
- if (/\.wxml$/.test(file.path)) {
275
- const entry = getWxmlEntry(file.path, formatPath);
276
- if (entry) {
277
- if (entry.type === "component") {
278
- componentEntries.push(entry);
279
- } else if (entry.type === "page") {
280
- pageEntries.push(entry);
281
- }
271
+ const files = await new import_fdir.fdir().withFullPaths().filter(filter).crawl(import_pathe3.default.join(root, subPackageRoot)).withPromise();
272
+ for (const file of files) {
273
+ if (/\.wxml$/.test(file)) {
274
+ const entry = getWxmlEntry(file, formatPath);
275
+ if (entry) {
276
+ if (entry.type === "component") {
277
+ componentEntries.push(entry);
278
+ } else if (entry.type === "page") {
279
+ pageEntries.push(entry);
282
280
  }
283
281
  }
284
282
  }
@@ -308,21 +306,15 @@ async function getEntries(options) {
308
306
  );
309
307
  const pageEntries = [];
310
308
  const componentEntries = [];
311
- for await (const file of (0, import_klaw.default)(
312
- import_pathe3.default.join(root, srcRoot),
313
- {
314
- filter
315
- }
316
- )) {
317
- if (file.stats.isFile()) {
318
- if (/\.wxml$/.test(file.path)) {
319
- const entry = getWxmlEntry(file.path, formatPath);
320
- if (entry) {
321
- if (entry.type === "component") {
322
- componentEntries.push(entry);
323
- } else if (entry.type === "page") {
324
- pageEntries.push(entry);
325
- }
309
+ const files = await new import_fdir.fdir().withFullPaths().filter(filter).crawl(import_pathe3.default.join(root, srcRoot)).withPromise();
310
+ for (const file of files) {
311
+ if (/\.wxml$/.test(file)) {
312
+ const entry = getWxmlEntry(file, formatPath);
313
+ if (entry) {
314
+ if (entry.type === "component") {
315
+ componentEntries.push(entry);
316
+ } else if (entry.type === "page") {
317
+ pageEntries.push(entry);
326
318
  }
327
319
  }
328
320
  }
@@ -332,7 +324,6 @@ async function getEntries(options) {
332
324
  pages: pageEntries,
333
325
  components: componentEntries,
334
326
  subPackages: subPackageDeps
335
- // walkPathsSet,
336
327
  };
337
328
  }
338
329
  }
@@ -592,12 +583,6 @@ var CompilerContext = class _CompilerContext {
592
583
  get mpDistRoot() {
593
584
  return this.projectConfig.miniprogramRoot || this.projectConfig.srcMiniprogramRoot || "";
594
585
  }
595
- // get weappConfig() {
596
- // return this.inlineConfig.weapp
597
- // }
598
- // get inlineSubPackageConfig() {
599
- // return this.weappConfig?.subPackage
600
- // }
601
586
  forkSubPackage(subPackage) {
602
587
  const ctx = new _CompilerContext({
603
588
  cwd: this.cwd,
@@ -761,6 +746,7 @@ var CompilerContext = class _CompilerContext {
761
746
  exclude: ["node_modules/**", this.mpDistRoot ? import_pathe5.default.join(this.mpDistRoot, "**") : "dist/**"]
762
747
  }
763
748
  },
749
+ logLevel: "info",
764
750
  plugins: [
765
751
  (0, import_vite_tsconfig_paths.default)()
766
752
  ],
@@ -818,11 +804,14 @@ var CompilerContext = class _CompilerContext {
818
804
  strict: false,
819
805
  entryFileNames: "[name].js"
820
806
  }
807
+ // logLevel: 'silent',
821
808
  },
822
809
  assetsDir: "."
823
- }
810
+ },
811
+ logLevel: "error"
824
812
  });
825
813
  }
814
+ logger_default.success(`${dep} \u4F9D\u8D56\u5904\u7406\u5B8C\u6210!`);
826
815
  }
827
816
  }
828
817
  }
@@ -831,10 +820,6 @@ var CompilerContext = class _CompilerContext {
831
820
  }
832
821
  };
833
822
 
834
- // src/logger.ts
835
- var import_logger = __toESM(require("@weapp-core/logger"), 1);
836
- var logger_default = import_logger.default;
837
-
838
823
  // src/cli.ts
839
824
  var cli = (0, import_cac.cac)("weapp-vite");
840
825
  function filterDuplicateOptions(options) {
package/dist/cli.mjs CHANGED
@@ -1,7 +1,8 @@
1
1
  import {
2
2
  CompilerContext,
3
- VERSION
4
- } from "./chunk-3EHL3BIF.mjs";
3
+ VERSION,
4
+ logger_default
5
+ } from "./chunk-5SFYACIL.mjs";
5
6
  import "./chunk-444MQSSG.mjs";
6
7
 
7
8
  // src/cli.ts
@@ -9,12 +10,6 @@ import process from "node:process";
9
10
  import { initConfig } from "@weapp-core/init";
10
11
  import { cac } from "cac";
11
12
  import { parse } from "weapp-ide-cli";
12
-
13
- // src/logger.ts
14
- import logger from "@weapp-core/logger";
15
- var logger_default = logger;
16
-
17
- // src/cli.ts
18
13
  var cli = cac("weapp-vite");
19
14
  function filterDuplicateOptions(options) {
20
15
  for (const [key, value] of Object.entries(options)) {
package/dist/index.cjs CHANGED
@@ -59,6 +59,10 @@ function getWeappWatchOptions() {
59
59
  };
60
60
  }
61
61
 
62
+ // src/logger.ts
63
+ var import_logger = __toESM(require("@weapp-core/logger"), 1);
64
+ var logger_default = import_logger.default;
65
+
62
66
  // src/plugins/index.ts
63
67
  var import_shared3 = require("@weapp-core/shared");
64
68
  var import_fast_glob = __toESM(require("fast-glob"), 1);
@@ -82,7 +86,7 @@ function createDebugger(namespace) {
82
86
  // src/entry.ts
83
87
  var import_node_process = __toESM(require("process"), 1);
84
88
  var import_shared2 = require("@weapp-core/shared");
85
- var import_klaw = __toESM(require("klaw"), 1);
89
+ var import_fdir = require("fdir");
86
90
  var import_micromatch = __toESM(require("micromatch"), 1);
87
91
  var import_pathe3 = __toESM(require("pathe"), 1);
88
92
 
@@ -266,21 +270,15 @@ async function getEntries(options) {
266
270
  type: "subPackageEntry"
267
271
  });
268
272
  }
269
- for await (const file of (0, import_klaw.default)(
270
- import_pathe3.default.join(root, subPackageRoot),
271
- {
272
- filter
273
- }
274
- )) {
275
- if (file.stats.isFile()) {
276
- if (/\.wxml$/.test(file.path)) {
277
- const entry = getWxmlEntry(file.path, formatPath);
278
- if (entry) {
279
- if (entry.type === "component") {
280
- componentEntries.push(entry);
281
- } else if (entry.type === "page") {
282
- pageEntries.push(entry);
283
- }
273
+ const files = await new import_fdir.fdir().withFullPaths().filter(filter).crawl(import_pathe3.default.join(root, subPackageRoot)).withPromise();
274
+ for (const file of files) {
275
+ if (/\.wxml$/.test(file)) {
276
+ const entry = getWxmlEntry(file, formatPath);
277
+ if (entry) {
278
+ if (entry.type === "component") {
279
+ componentEntries.push(entry);
280
+ } else if (entry.type === "page") {
281
+ pageEntries.push(entry);
284
282
  }
285
283
  }
286
284
  }
@@ -310,21 +308,15 @@ async function getEntries(options) {
310
308
  );
311
309
  const pageEntries = [];
312
310
  const componentEntries = [];
313
- for await (const file of (0, import_klaw.default)(
314
- import_pathe3.default.join(root, srcRoot),
315
- {
316
- filter
317
- }
318
- )) {
319
- if (file.stats.isFile()) {
320
- if (/\.wxml$/.test(file.path)) {
321
- const entry = getWxmlEntry(file.path, formatPath);
322
- if (entry) {
323
- if (entry.type === "component") {
324
- componentEntries.push(entry);
325
- } else if (entry.type === "page") {
326
- pageEntries.push(entry);
327
- }
311
+ const files = await new import_fdir.fdir().withFullPaths().filter(filter).crawl(import_pathe3.default.join(root, srcRoot)).withPromise();
312
+ for (const file of files) {
313
+ if (/\.wxml$/.test(file)) {
314
+ const entry = getWxmlEntry(file, formatPath);
315
+ if (entry) {
316
+ if (entry.type === "component") {
317
+ componentEntries.push(entry);
318
+ } else if (entry.type === "page") {
319
+ pageEntries.push(entry);
328
320
  }
329
321
  }
330
322
  }
@@ -334,7 +326,6 @@ async function getEntries(options) {
334
326
  pages: pageEntries,
335
327
  components: componentEntries,
336
328
  subPackages: subPackageDeps
337
- // walkPathsSet,
338
329
  };
339
330
  }
340
331
  }
@@ -594,12 +585,6 @@ var CompilerContext = class _CompilerContext {
594
585
  get mpDistRoot() {
595
586
  return this.projectConfig.miniprogramRoot || this.projectConfig.srcMiniprogramRoot || "";
596
587
  }
597
- // get weappConfig() {
598
- // return this.inlineConfig.weapp
599
- // }
600
- // get inlineSubPackageConfig() {
601
- // return this.weappConfig?.subPackage
602
- // }
603
588
  forkSubPackage(subPackage) {
604
589
  const ctx = new _CompilerContext({
605
590
  cwd: this.cwd,
@@ -763,6 +748,7 @@ var CompilerContext = class _CompilerContext {
763
748
  exclude: ["node_modules/**", this.mpDistRoot ? import_pathe5.default.join(this.mpDistRoot, "**") : "dist/**"]
764
749
  }
765
750
  },
751
+ logLevel: "info",
766
752
  plugins: [
767
753
  (0, import_vite_tsconfig_paths.default)()
768
754
  ],
@@ -820,11 +806,14 @@ var CompilerContext = class _CompilerContext {
820
806
  strict: false,
821
807
  entryFileNames: "[name].js"
822
808
  }
809
+ // logLevel: 'silent',
823
810
  },
824
811
  assetsDir: "."
825
- }
812
+ },
813
+ logLevel: "error"
826
814
  });
827
815
  }
816
+ logger_default.success(`${dep} \u4F9D\u8D56\u5904\u7406\u5B8C\u6210!`);
828
817
  }
829
818
  }
830
819
  }
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  CompilerContext
3
- } from "./chunk-3EHL3BIF.mjs";
3
+ } from "./chunk-5SFYACIL.mjs";
4
4
  import "./chunk-444MQSSG.mjs";
5
5
  export {
6
6
  CompilerContext
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "weapp-vite",
3
3
  "type": "module",
4
- "version": "1.2.0",
4
+ "version": "1.2.1",
5
5
  "description": "weapp-vite 一个现代化的小程序打包工具",
6
6
  "author": "ice breaker <1324318532@qq.com>",
7
7
  "license": "MIT",
@@ -54,18 +54,18 @@
54
54
  "chokidar": "^3.6.0",
55
55
  "debug": "^4.3.7",
56
56
  "fast-glob": "^3.3.2",
57
+ "fdir": "^6.3.0",
57
58
  "fs-extra": "^11.2.0",
58
59
  "htmlparser2": "^9.1.0",
59
- "klaw": "^4.1.0",
60
60
  "magic-string": "^0.30.11",
61
61
  "micromatch": "^4.0.8",
62
62
  "pathe": "^1.1.2",
63
63
  "picocolors": "^1.1.0",
64
64
  "pkg-types": "^1.2.0",
65
65
  "vite-tsconfig-paths": "^5.0.1",
66
+ "@weapp-core/init": "^1.0.4",
66
67
  "@weapp-core/logger": "^1.0.1",
67
68
  "@weapp-core/shared": "^1.0.1",
68
- "@weapp-core/init": "^1.0.4",
69
69
  "weapp-ide-cli": "^2.0.5"
70
70
  },
71
71
  "publishConfig": {