@weapp-tailwindcss/cli 1.0.1 → 1.0.2

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.
package/dist/index.cjs CHANGED
@@ -1,5 +1,6 @@
1
1
  'use strict';
2
2
 
3
+ const process = require('node:process');
3
4
  const commander = require('commander');
4
5
  const path = require('node:path');
5
6
  const fs = require('fs-extra');
@@ -19,6 +20,7 @@ const cosmiconfig = require('cosmiconfig');
19
20
 
20
21
  function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
21
22
 
23
+ const process__default = /*#__PURE__*/_interopDefaultCompat(process);
22
24
  const path__default = /*#__PURE__*/_interopDefaultCompat(path);
23
25
  const fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
24
26
  const gulp__default = /*#__PURE__*/_interopDefaultCompat(gulp$1);
@@ -88,7 +90,7 @@ function createDefu(merger) {
88
90
  }
89
91
  const defu = createDefu();
90
92
 
91
- const version = "1.0.1";
93
+ const version = "1.0.2";
92
94
 
93
95
  const debug = createDebug__default("weapp-tw-cli");
94
96
 
@@ -530,7 +532,7 @@ async function getTasks(options) {
530
532
  preprocessorOptions
531
533
  } = options;
532
534
  const globsSet = new GlobsSet();
533
- const base = srcBase ? srcBase + "/" : "";
535
+ const base = srcBase ? `${srcBase}/` : "";
534
536
  const enableSass = Boolean(preprocessorOptions?.sass);
535
537
  const enableLess = Boolean(preprocessorOptions?.less);
536
538
  if (typescriptOptions === true) {
@@ -547,18 +549,18 @@ async function getTasks(options) {
547
549
  sass = createSass__default(sassLib);
548
550
  }
549
551
  const { transformJs, transformWxml, transformWxss } = gulp.createPlugins(weappTailwindcssOptions);
552
+ const outDirGlobs = [`!${outDir}/**/*`, `!./${outDir}/**/*`];
550
553
  function getGlobs(type) {
551
554
  const globs = [];
552
555
  if (typeof include === "function") {
553
556
  globs.push(...include(type).map((x) => x));
554
557
  }
555
558
  if (typeof exclude === "function") {
556
- globs.push(...exclude(type).map((x) => "!" + x));
559
+ globs.push(...exclude(type).map((x) => `!${x}`));
557
560
  } else if (Array.isArray(exclude)) {
558
- globs.push(...exclude.map((x) => "!" + x));
561
+ globs.push(...exclude.map((x) => `!${x}`));
559
562
  }
560
- globs.push(`!${outDir}/**/*`);
561
- globs.push(`!./${outDir}/**/*`);
563
+ globs.push(...outDirGlobs);
562
564
  return globs;
563
565
  }
564
566
  function getJsTasks() {
@@ -689,7 +691,7 @@ async function getTasks(options) {
689
691
  });
690
692
  globsSet.add(globs);
691
693
  return promisify(
692
- gulp__default.src(globs, { cwd, since: gulp__default.lastRun(copyOthers) }).pipe(
694
+ gulp__default.src([...globs, ...outDirGlobs], { cwd, since: gulp__default.lastRun(copyOthers) }).pipe(
693
695
  gulp__default.dest(outDir, {
694
696
  cwd
695
697
  })
@@ -774,7 +776,7 @@ async function createBuilder(options) {
774
776
  if (clean) {
775
777
  debug("del start");
776
778
  const { deleteAsync } = await import('del');
777
- const patterns = [outDir + "/**"];
779
+ const patterns = [`${outDir}/**`];
778
780
  await deleteAsync(patterns, { cwd, ignore: defaultNodeModulesDirs });
779
781
  debug("del end");
780
782
  }
@@ -797,16 +799,16 @@ async function createBuilder(options) {
797
799
  cb(error);
798
800
  }
799
801
  });
800
- watcher.on("change", function(path2) {
802
+ watcher.on("change", (path2) => {
801
803
  console.log(`${pc__default.green("changed")} ${path2}`);
802
804
  });
803
- watcher.on("add", function(path2) {
805
+ watcher.on("add", (path2) => {
804
806
  console.log(`${pc__default.green("add")} ${path2}`);
805
807
  });
806
- watcher.on("unlink", function(path2) {
808
+ watcher.on("unlink", (path2) => {
807
809
  console.log(`${pc__default.green("remove")} ${path2}`);
808
810
  });
809
- watcher.on("ready", async function() {
811
+ watcher.on("ready", async () => {
810
812
  const meta = await localPkg.getPackageInfo("weapp-tailwindcss");
811
813
  let weappTwVersionStr = "";
812
814
  if (meta) {
@@ -917,7 +919,7 @@ function updatePackageJson(options) {
917
919
  function initConfig(options) {
918
920
  const { lang, root } = defu(options, {
919
921
  lang: "js",
920
- root: process.cwd()
922
+ root: process__default.cwd()
921
923
  });
922
924
  const configFilename = `weapp-tw.config.${lang ?? "js"}`;
923
925
  const configPath = path__default.resolve(root, configFilename);
@@ -954,7 +956,7 @@ module.exports = config
954
956
  }
955
957
 
956
958
  function createCli() {
957
- const cwd = process.cwd();
959
+ const cwd = process__default.cwd();
958
960
  const program = new commander.Command();
959
961
  const configLoader = createConfigLoader(cwd);
960
962
  const userDefinedConfig = configLoader.search(cwd);
package/dist/index.d.cts CHANGED
@@ -139,11 +139,11 @@ declare function watch(options?: Partial<BuildOptions>): Promise<{
139
139
  globsSet: GlobsSet;
140
140
  }>;
141
141
 
142
- type WeappTwCosmiconfigResult = {
142
+ interface WeappTwCosmiconfigResult {
143
143
  config: BuildOptions;
144
144
  filepath: string;
145
145
  isEmpty?: boolean;
146
- };
146
+ }
147
147
  declare function createConfigLoader(root: string): {
148
148
  search: (searchFrom?: string) => WeappTwCosmiconfigResult | undefined;
149
149
  load: (filepath: string) => cosmiconfig.CosmiconfigResult;
package/dist/index.d.mts CHANGED
@@ -139,11 +139,11 @@ declare function watch(options?: Partial<BuildOptions>): Promise<{
139
139
  globsSet: GlobsSet;
140
140
  }>;
141
141
 
142
- type WeappTwCosmiconfigResult = {
142
+ interface WeappTwCosmiconfigResult {
143
143
  config: BuildOptions;
144
144
  filepath: string;
145
145
  isEmpty?: boolean;
146
- };
146
+ }
147
147
  declare function createConfigLoader(root: string): {
148
148
  search: (searchFrom?: string) => WeappTwCosmiconfigResult | undefined;
149
149
  load: (filepath: string) => cosmiconfig.CosmiconfigResult;
package/dist/index.d.ts CHANGED
@@ -139,11 +139,11 @@ declare function watch(options?: Partial<BuildOptions>): Promise<{
139
139
  globsSet: GlobsSet;
140
140
  }>;
141
141
 
142
- type WeappTwCosmiconfigResult = {
142
+ interface WeappTwCosmiconfigResult {
143
143
  config: BuildOptions;
144
144
  filepath: string;
145
145
  isEmpty?: boolean;
146
- };
146
+ }
147
147
  declare function createConfigLoader(root: string): {
148
148
  search: (searchFrom?: string) => WeappTwCosmiconfigResult | undefined;
149
149
  load: (filepath: string) => cosmiconfig.CosmiconfigResult;
package/dist/index.mjs CHANGED
@@ -1,3 +1,4 @@
1
+ import process from 'node:process';
1
2
  import { Command } from 'commander';
2
3
  import path from 'node:path';
3
4
  import fs, { ensureDirSync } from 'fs-extra';
@@ -71,7 +72,7 @@ function createDefu(merger) {
71
72
  }
72
73
  const defu = createDefu();
73
74
 
74
- const version = "1.0.1";
75
+ const version = "1.0.2";
75
76
 
76
77
  const debug = createDebug("weapp-tw-cli");
77
78
 
@@ -513,7 +514,7 @@ async function getTasks(options) {
513
514
  preprocessorOptions
514
515
  } = options;
515
516
  const globsSet = new GlobsSet();
516
- const base = srcBase ? srcBase + "/" : "";
517
+ const base = srcBase ? `${srcBase}/` : "";
517
518
  const enableSass = Boolean(preprocessorOptions?.sass);
518
519
  const enableLess = Boolean(preprocessorOptions?.less);
519
520
  if (typescriptOptions === true) {
@@ -530,18 +531,18 @@ async function getTasks(options) {
530
531
  sass = createSass(sassLib);
531
532
  }
532
533
  const { transformJs, transformWxml, transformWxss } = createPlugins(weappTailwindcssOptions);
534
+ const outDirGlobs = [`!${outDir}/**/*`, `!./${outDir}/**/*`];
533
535
  function getGlobs(type) {
534
536
  const globs = [];
535
537
  if (typeof include === "function") {
536
538
  globs.push(...include(type).map((x) => x));
537
539
  }
538
540
  if (typeof exclude === "function") {
539
- globs.push(...exclude(type).map((x) => "!" + x));
541
+ globs.push(...exclude(type).map((x) => `!${x}`));
540
542
  } else if (Array.isArray(exclude)) {
541
- globs.push(...exclude.map((x) => "!" + x));
543
+ globs.push(...exclude.map((x) => `!${x}`));
542
544
  }
543
- globs.push(`!${outDir}/**/*`);
544
- globs.push(`!./${outDir}/**/*`);
545
+ globs.push(...outDirGlobs);
545
546
  return globs;
546
547
  }
547
548
  function getJsTasks() {
@@ -672,7 +673,7 @@ async function getTasks(options) {
672
673
  });
673
674
  globsSet.add(globs);
674
675
  return promisify(
675
- gulp.src(globs, { cwd, since: gulp.lastRun(copyOthers) }).pipe(
676
+ gulp.src([...globs, ...outDirGlobs], { cwd, since: gulp.lastRun(copyOthers) }).pipe(
676
677
  gulp.dest(outDir, {
677
678
  cwd
678
679
  })
@@ -757,7 +758,7 @@ async function createBuilder(options) {
757
758
  if (clean) {
758
759
  debug("del start");
759
760
  const { deleteAsync } = await import('del');
760
- const patterns = [outDir + "/**"];
761
+ const patterns = [`${outDir}/**`];
761
762
  await deleteAsync(patterns, { cwd, ignore: defaultNodeModulesDirs });
762
763
  debug("del end");
763
764
  }
@@ -780,16 +781,16 @@ async function createBuilder(options) {
780
781
  cb(error);
781
782
  }
782
783
  });
783
- watcher.on("change", function(path2) {
784
+ watcher.on("change", (path2) => {
784
785
  console.log(`${pc.green("changed")} ${path2}`);
785
786
  });
786
- watcher.on("add", function(path2) {
787
+ watcher.on("add", (path2) => {
787
788
  console.log(`${pc.green("add")} ${path2}`);
788
789
  });
789
- watcher.on("unlink", function(path2) {
790
+ watcher.on("unlink", (path2) => {
790
791
  console.log(`${pc.green("remove")} ${path2}`);
791
792
  });
792
- watcher.on("ready", async function() {
793
+ watcher.on("ready", async () => {
793
794
  const meta = await getPackageInfo("weapp-tailwindcss");
794
795
  let weappTwVersionStr = "";
795
796
  if (meta) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@weapp-tailwindcss/cli",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "The cli of weapp-tailwindcss",
5
5
  "keywords": [
6
6
  "weapp",
@@ -53,7 +53,7 @@
53
53
  "less": "*",
54
54
  "sass": "*",
55
55
  "typescript": "*",
56
- "weapp-tailwindcss": "3.2.0"
56
+ "weapp-tailwindcss": "3.2.1"
57
57
  },
58
58
  "peerDependenciesMeta": {
59
59
  "less": {