@weapp-tailwindcss/cli 1.0.4 → 1.0.6

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
@@ -14,6 +14,7 @@ const postcssrc = require('gulp-postcss');
14
14
  const createSass = require('gulp-sass');
15
15
  const rename = require('gulp-rename');
16
16
  const less = require('gulp-less');
17
+ const postcssScssParser = require('postcss-scss');
17
18
  const cosmiconfig = require('cosmiconfig');
18
19
 
19
20
  function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
@@ -29,6 +30,7 @@ const postcssrc__default = /*#__PURE__*/_interopDefaultCompat(postcssrc);
29
30
  const createSass__default = /*#__PURE__*/_interopDefaultCompat(createSass);
30
31
  const rename__default = /*#__PURE__*/_interopDefaultCompat(rename);
31
32
  const less__default = /*#__PURE__*/_interopDefaultCompat(less);
33
+ const postcssScssParser__default = /*#__PURE__*/_interopDefaultCompat(postcssScssParser);
32
34
 
33
35
  function isPlainObject$2(value) {
34
36
  if (value === null || typeof value !== "object") {
@@ -86,7 +88,7 @@ function createDefu(merger) {
86
88
  }
87
89
  const defu = createDefu();
88
90
 
89
- const version = "1.0.4";
91
+ const version = "1.0.6";
90
92
 
91
93
  const debug = createDebug__default("weapp-tw-cli");
92
94
 
@@ -608,12 +610,25 @@ async function getTasks(options) {
608
610
  const enableTs = Boolean(typescriptOptions);
609
611
  let sass;
610
612
  if (enableSass) {
613
+ if (!localPkg.isPackageExists("sass")) {
614
+ throw new Error("\u8BF7\u5148\u6267\u884C npm / yarn / pnpm \u547D\u4EE4\u5B89\u88C5 `sass` \u540E\u91CD\u8BD5!");
615
+ }
611
616
  const sassLib = await import('sass');
612
617
  sass = createSass__default(sassLib);
613
618
  }
614
619
  let ts;
620
+ let gulpTs;
615
621
  if (enableTs) {
622
+ if (!localPkg.isPackageExists("typescript")) {
623
+ throw new Error("\u8BF7\u5148\u6267\u884C npm / yarn / pnpm \u547D\u4EE4\u5B89\u88C5 `typescript` \u540E\u91CD\u8BD5!");
624
+ }
616
625
  ts = (await import('gulp-typescript')).default;
626
+ if (typeof typescriptOptions !== "boolean") {
627
+ gulpTs = ts.createProject(
628
+ typescriptOptions.tsConfigFileName ?? "tsconfig.json",
629
+ typescriptOptions.settings
630
+ );
631
+ }
617
632
  }
618
633
  const { transformJs, transformWxml, transformWxss } = gulp.createPlugins(weappTailwindcssOptions);
619
634
  const outDirGlobs = [`!${outDir}/**/*`, `!./${outDir}/**/*`];
@@ -639,16 +654,9 @@ async function getTasks(options) {
639
654
  globsSet.add(src);
640
655
  const isTs = isTsLang(x);
641
656
  const loadTs = enableTs && isTs;
642
- let gulpTs;
643
- if (enableTs && typeof typescriptOptions !== "boolean") {
644
- gulpTs = ts.createProject(
645
- typescriptOptions.tsConfigFileName ?? "tsconfig.json",
646
- typeof typescriptOptions === "boolean" ? {} : typescriptOptions
647
- );
648
- }
649
657
  return function JsTask() {
650
658
  const pipes = [];
651
- if (loadTs) {
659
+ if (loadTs && gulpTs) {
652
660
  pipes.push(gulpTs());
653
661
  }
654
662
  pipes.push(transformJs({
@@ -716,7 +724,17 @@ async function getTasks(options) {
716
724
  if (postcssOptions) {
717
725
  pipes.push(postcssrc__default(postcssOptions?.plugins, postcssOptions?.options));
718
726
  }
719
- pipes.push(transformWxss());
727
+ if (x === "scss") {
728
+ pipes.push(transformWxss({
729
+ postcssOptions: {
730
+ options: {
731
+ parser: postcssScssParser__default
732
+ }
733
+ }
734
+ }));
735
+ } else {
736
+ pipes.push(transformWxss());
737
+ }
720
738
  if (loadSass || loadLess) {
721
739
  pipes.push(rename__default({
722
740
  extname: ".wxss"
package/dist/index.mjs CHANGED
@@ -5,13 +5,14 @@ import fs, { ensureDirSync } from 'fs-extra';
5
5
  import gulp from 'gulp';
6
6
  import loadPostcssConfig from 'postcss-load-config';
7
7
  import pc from 'picocolors';
8
- import { getPackageInfo } from 'local-pkg';
8
+ import { isPackageExists, getPackageInfo } from 'local-pkg';
9
9
  import createDebug from 'debug';
10
10
  import { createPlugins } from 'weapp-tailwindcss/gulp';
11
11
  import postcssrc from 'gulp-postcss';
12
12
  import createSass from 'gulp-sass';
13
13
  import rename from 'gulp-rename';
14
14
  import less from 'gulp-less';
15
+ import postcssScssParser from 'postcss-scss';
15
16
  import { cosmiconfigSync } from 'cosmiconfig';
16
17
 
17
18
  function isPlainObject$2(value) {
@@ -70,7 +71,7 @@ function createDefu(merger) {
70
71
  }
71
72
  const defu = createDefu();
72
73
 
73
- const version = "1.0.4";
74
+ const version = "1.0.6";
74
75
 
75
76
  const debug = createDebug("weapp-tw-cli");
76
77
 
@@ -592,12 +593,25 @@ async function getTasks(options) {
592
593
  const enableTs = Boolean(typescriptOptions);
593
594
  let sass;
594
595
  if (enableSass) {
596
+ if (!isPackageExists("sass")) {
597
+ throw new Error("\u8BF7\u5148\u6267\u884C npm / yarn / pnpm \u547D\u4EE4\u5B89\u88C5 `sass` \u540E\u91CD\u8BD5!");
598
+ }
595
599
  const sassLib = await import('sass');
596
600
  sass = createSass(sassLib);
597
601
  }
598
602
  let ts;
603
+ let gulpTs;
599
604
  if (enableTs) {
605
+ if (!isPackageExists("typescript")) {
606
+ throw new Error("\u8BF7\u5148\u6267\u884C npm / yarn / pnpm \u547D\u4EE4\u5B89\u88C5 `typescript` \u540E\u91CD\u8BD5!");
607
+ }
600
608
  ts = (await import('gulp-typescript')).default;
609
+ if (typeof typescriptOptions !== "boolean") {
610
+ gulpTs = ts.createProject(
611
+ typescriptOptions.tsConfigFileName ?? "tsconfig.json",
612
+ typescriptOptions.settings
613
+ );
614
+ }
601
615
  }
602
616
  const { transformJs, transformWxml, transformWxss } = createPlugins(weappTailwindcssOptions);
603
617
  const outDirGlobs = [`!${outDir}/**/*`, `!./${outDir}/**/*`];
@@ -623,16 +637,9 @@ async function getTasks(options) {
623
637
  globsSet.add(src);
624
638
  const isTs = isTsLang(x);
625
639
  const loadTs = enableTs && isTs;
626
- let gulpTs;
627
- if (enableTs && typeof typescriptOptions !== "boolean") {
628
- gulpTs = ts.createProject(
629
- typescriptOptions.tsConfigFileName ?? "tsconfig.json",
630
- typeof typescriptOptions === "boolean" ? {} : typescriptOptions
631
- );
632
- }
633
640
  return function JsTask() {
634
641
  const pipes = [];
635
- if (loadTs) {
642
+ if (loadTs && gulpTs) {
636
643
  pipes.push(gulpTs());
637
644
  }
638
645
  pipes.push(transformJs({
@@ -700,7 +707,17 @@ async function getTasks(options) {
700
707
  if (postcssOptions) {
701
708
  pipes.push(postcssrc(postcssOptions?.plugins, postcssOptions?.options));
702
709
  }
703
- pipes.push(transformWxss());
710
+ if (x === "scss") {
711
+ pipes.push(transformWxss({
712
+ postcssOptions: {
713
+ options: {
714
+ parser: postcssScssParser
715
+ }
716
+ }
717
+ }));
718
+ } else {
719
+ pipes.push(transformWxss());
720
+ }
704
721
  if (loadSass || loadLess) {
705
722
  pipes.push(rename({
706
723
  extname: ".wxss"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@weapp-tailwindcss/cli",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "description": "The cli of weapp-tailwindcss",
5
5
  "author": "SonOfMagic <qq1324318532@gmail.com>",
6
6
  "license": "MIT",
@@ -68,7 +68,8 @@
68
68
  "local-pkg": "^0.5.0",
69
69
  "picocolors": "^1.0.1",
70
70
  "postcss": "^8.4.39",
71
- "postcss-load-config": "^6.0.1"
71
+ "postcss-load-config": "^6.0.1",
72
+ "postcss-scss": "^4.0.9"
72
73
  },
73
74
  "publishConfig": {
74
75
  "access": "public",