@es-pkg/compile 1.0.3 → 1.0.4

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/README.md CHANGED
@@ -29,4 +29,4 @@
29
29
 
30
30
  #### default
31
31
 
32
- * default(done:`Undertaker.TaskCallback`): `void` | `EventEmitter`<`DefaultEventMap`\> | `internal.Stream` | `"child_process".ChildProcess` | `asyncDone.Observable`<`any`\> | `PromiseLike`<`any`\>
32
+ * default(done:`Undertaker.TaskCallback`): `void` | `EventEmitter`<`DefaultEventMap`\> | `internal.Stream` | `PromiseLike`<`any`\> | `"child_process".ChildProcess` | `asyncDone.Observable`<`any`\>
package/cjs/index.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ /// <reference types="undertaker" />
2
+ declare const _default: import("undertaker").TaskFunction;
3
+ export default _default;
package/cjs/index.js ADDED
@@ -0,0 +1,190 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var gulp = require('@es-pkg/gulp');
6
+ var utils = require('@es-pkg/utils');
7
+ var config = require('@es-pkg/config');
8
+ var rollup = require('rollup');
9
+ var resolve = require('@rollup/plugin-node-resolve');
10
+ var commonjs = require('@rollup/plugin-commonjs');
11
+ var typescript = require('@rollup/plugin-typescript');
12
+ var json = require('@rollup/plugin-json');
13
+ var postcss = require('rollup-plugin-postcss');
14
+ var autoprefixer = require('autoprefixer');
15
+ var cssnano = require('cssnano');
16
+ var path = require('node:path');
17
+ var fs = require('node:fs');
18
+
19
+ const clean = () => {
20
+ utils.log(`清除 ${config.relativeToApp(config.config.es)} & ${config.relativeToApp(config.config.cjs)} 目录---开始`);
21
+ const promises = [
22
+ utils.remove(config.config.publishDir, true),
23
+ utils.remove(config.config.es, true),
24
+ utils.remove(config.config.cjs, true),
25
+ utils.remove(config.config.iife, true),
26
+ ];
27
+ return Promise.all(promises).then(res => {
28
+ utils.log(`清除 ${config.relativeToApp(config.config.es)} & ${config.relativeToApp(config.config.cjs)} 目录---结束`);
29
+ });
30
+ };
31
+ function getPostcss(extract) {
32
+ return postcss({
33
+ // 处理 Less(需安装 less)
34
+ extensions: ['.less', '.scss', '.sass'], // 识别 less 扩展名
35
+ // 为不同类型的文件指定对应的编译器(关键修改)
36
+ use: {
37
+ "stylus": ['sass'],
38
+ 'less': ['less'], //.less 文件用 less 编译
39
+ 'sass': ['sass'] //.sass 文件用 sass 编译(缩进语法)
40
+ },
41
+ // 配置 PostCSS 插件(自动前缀、压缩)
42
+ plugins: [
43
+ autoprefixer({ overrideBrowserslist: config.config.css.browserslist }),
44
+ cssnano() // 生产环境压缩 CSS
45
+ ],
46
+ // 输出配置:提取为单独的 CSS 文件(推荐)
47
+ extract, // 提取到 ${name}.min.css
48
+ // 可选:不提取,嵌入到 JS 中(通过 import 会生成 style 标签)
49
+ // extract: false
50
+ });
51
+ }
52
+ const name = utils.getValidPkgName(config.pkg.name);
53
+ // 1. 配置输入选项
54
+ function getInputOptions(isIIFE, declarationDir) {
55
+ function isNodeModule(id) {
56
+ // 获取模块绝对路径
57
+ try {
58
+ const resolved = require.resolve(id, { paths: [process.cwd()] });
59
+ return resolved.includes('node_modules');
60
+ }
61
+ catch {
62
+ // 无法 resolve 的,认为是本地模块
63
+ return false;
64
+ }
65
+ }
66
+ return ({
67
+ input: config.shallowInputs,
68
+ external: id => {
69
+ // 排除本地相对路径和绝对路径,别名映射到本地也不会 external
70
+ if (id.startsWith('.') || path.isAbsolute(id))
71
+ return false;
72
+ // node_modules 下的模块才 external
73
+ return isNodeModule(id);
74
+ },
75
+ plugins: [
76
+ json(),
77
+ isIIFE && resolve(), // 解析 node_modules
78
+ commonjs(), // 转换 CommonJS 模块
79
+ typescript({
80
+ tsconfig: config.resolveApp('tsconfig.json'), // 可选,指定 tsconfig
81
+ compilerOptions: {
82
+ noImplicitAny: true,
83
+ isolatedModules: false,
84
+ declaration: !!declarationDir,
85
+ allowImportingTsExtensions: false,
86
+ declarationDir,
87
+ noEmit: false,
88
+ emitDeclarationOnly: !!declarationDir,
89
+ esModuleInterop: true,
90
+ resolveJsonModule: true,
91
+ skipLibCheck: true,
92
+ removeComments: false,
93
+ rootDir: config.resolveApp('src'), // ✅ 指定源代码根目录
94
+ }
95
+ }),
96
+ getPostcss(config.config.css.extract)
97
+ ].filter(Boolean)
98
+ });
99
+ }
100
+ async function buildExtraCss() {
101
+ const extras = config.config.css.extra;
102
+ if (!extras?.length)
103
+ return;
104
+ const srcRoot = config.resolveApp('src');
105
+ const esRoot = config.resolveApp(config.config.es);
106
+ const tasks = extras.map(async (v) => {
107
+ try {
108
+ const absPath = config.resolveApp(v); // 源文件绝对路径
109
+ const relativePath = path.relative(srcRoot, absPath); // 相对于 src 的路径
110
+ const dirname = path.dirname(relativePath); // 相对目录
111
+ const filename = path.basename(v, path.extname(v)); // 文件名去掉扩展名
112
+ // rollup 打包
113
+ const bundle = await rollup.rollup({
114
+ input: [v],
115
+ plugins: getPostcss(path.join(dirname, `${filename}.min.css`))
116
+ });
117
+ await bundle.write({
118
+ dir: config.config.es,
119
+ format: 'es',
120
+ sourcemap: false,
121
+ preserveModules: true,
122
+ preserveModulesRoot: srcRoot
123
+ });
124
+ // 删除生成的 JS 文件
125
+ const jsFile = path.join(esRoot, dirname, `${filename}${path.extname(v)}.js`);
126
+ if (fs.existsSync(jsFile))
127
+ fs.unlinkSync(jsFile);
128
+ // 复制到其他目标目录
129
+ [config.config.cjs, config.config.iife].forEach(targetRoot => {
130
+ const dest = path.join(config.resolveApp(targetRoot), dirname, `${filename}.min.css`);
131
+ fs.mkdirSync(path.dirname(dest), { recursive: true });
132
+ fs.copyFileSync(path.join(esRoot, dirname, `${filename}.min.css`), dest);
133
+ });
134
+ utils.log.success(`✅ 编译完成: ${v}`);
135
+ }
136
+ catch (err) {
137
+ utils.log.error(`❌ 编译失败: ${v}`, err);
138
+ }
139
+ });
140
+ await Promise.all(tasks);
141
+ utils.log.success('✅ 所有额外 CSS 编译完成');
142
+ }
143
+ async function build() {
144
+ // 2. 配置输出选项
145
+ let outputOptions = [
146
+ {
147
+ dir: config.config.es,
148
+ format: 'es', // 输出 ES Module
149
+ sourcemap: false,
150
+ preserveModules: true,
151
+ preserveModulesRoot: config.resolveApp('src'), // ✅ 指定源代码根目录
152
+ },
153
+ {
154
+ dir: config.config.cjs,
155
+ format: 'cjs', // 输出 COMMONJS
156
+ sourcemap: false,
157
+ preserveModules: true,
158
+ preserveModulesRoot: config.resolveApp('src'), // ✅ 指定源代码根目录
159
+ exports: "named",
160
+ },
161
+ {
162
+ dir: config.config.iife,
163
+ format: 'iife', // 输出 iife
164
+ sourcemap: false,
165
+ exports: "named",
166
+ name: utils.toPascalCase(name)
167
+ }
168
+ ];
169
+ if (!config.config.iife) {
170
+ outputOptions = outputOptions.filter(op => op.format !== 'iife');
171
+ }
172
+ for (const output of outputOptions) {
173
+ // 3. 调用 rollup 打包
174
+ const bundle = await rollup.rollup(getInputOptions(output.format === 'iife'));
175
+ // 4. 写入文件
176
+ await bundle.write(output);
177
+ }
178
+ {
179
+ const bundle = await rollup.rollup(getInputOptions(false, config.config.es));
180
+ await bundle.write(outputOptions[0]);
181
+ }
182
+ await buildExtraCss();
183
+ utils.log.success('✅ Build complete!');
184
+ }
185
+ const copyTds = () => {
186
+ return gulp.src([`${config.config.es}/**/*.d.ts`]).pipe(gulp.dest(config.config.cjs));
187
+ };
188
+ var index = gulp.series(clean, build, copyTds);
189
+
190
+ exports.default = index;
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@es-pkg/compile",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "组件打包工具",
5
- "main": "src/index.ts",
5
+ "main": "cjs/index.js",
6
6
  "keywords": [
7
7
  "package",
8
8
  "es-pkg"
@@ -21,13 +21,14 @@
21
21
  "author": "pan",
22
22
  "license": "ISC",
23
23
  "dependencies": {
24
- "gulp-autoprefixer": "^8.0.0",
25
- "gulp-babel": "^8.0.0",
26
- "gulp-sass": "^5.1.0",
27
- "gulp-less": "^5.0.0",
28
- "gulp-typescript": "^6.0.0-alpha.1",
29
- "gulp-plumber": "latest",
30
- "gulp-rename": "latest",
24
+ "@rollup/plugin-commonjs": "^29.0.0",
25
+ "@rollup/plugin-node-resolve": "^16.0.3",
26
+ "rollup": "^4.52.5",
27
+ "rollup-plugin-postcss": "^4.0.2",
28
+ "@rollup/plugin-typescript": "^12.3.0",
29
+ "@rollup/plugin-json": "^6.1.0",
30
+ "autoprefixer": "^10.4.21",
31
+ "cssnano": "latest",
31
32
  "sass": "^1.53.0",
32
33
  "@es-pkg/gulp": "latest",
33
34
  "@es-pkg/gulp-logger": "latest",
@@ -38,8 +39,10 @@
38
39
  "access": "public",
39
40
  "registry": "https://registry.npmjs.org"
40
41
  },
42
+ "module": "src/index.ts",
41
43
  "types": "src/index.ts",
42
44
  "files": [
43
- "src"
45
+ "src",
46
+ "cjs"
44
47
  ]
45
48
  }
package/src/index.ts CHANGED
@@ -1,30 +1,17 @@
1
- import gulp, {series, parallel} from "@es-pkg/gulp";
2
- import logger from "@es-pkg/gulp-logger";
3
- import plumber from "gulp-plumber"
4
- import ts from "gulp-typescript"
5
- import typescript from "typescript"
6
- import babel from "gulp-babel"
7
- import gulpSass from "gulp-sass";
8
- import gulpLess from "gulp-less";
9
- import rename from "gulp-rename";
10
- import autoPreFixer from "gulp-autoprefixer"
11
- import Sass from "sass";
12
- import {remove, log} from "@es-pkg/utils";
13
- import {config, getIncludeFiles, relativeToApp, resolveApp} from "@es-pkg/config";
14
- import path from "path";
15
-
16
- const sass = gulpSass(Sass)
17
- const include = getIncludeFiles()
18
-
19
- function getMatchFiles(callback: (path: string) => (string[]) | string, contains: boolean = true) {
20
- return include.flatMap(item => {
21
- if (contains && !item.isDirectory) {
22
- return [item.path]
23
- }
24
- const res = callback(item.path);
25
- return Array.isArray(res) ? res : [res]
26
- })
27
- }
1
+ import gulp, {series} from "@es-pkg/gulp";
2
+ import {remove, log, getValidPkgName, toPascalCase} from "@es-pkg/utils";
3
+ import {config, shallowInputs, pkg, relativeToApp, resolveApp} from "@es-pkg/config";
4
+ import {OutputOptions, rollup, RollupOptions} from 'rollup';
5
+ import resolve from '@rollup/plugin-node-resolve';
6
+ import commonjs from '@rollup/plugin-commonjs';
7
+ import typescript from '@rollup/plugin-typescript';
8
+ import json from '@rollup/plugin-json';
9
+ import postcss from 'rollup-plugin-postcss';
10
+ import autoprefixer from 'autoprefixer';
11
+ import cssnano from 'cssnano';
12
+ import path from 'node:path';
13
+ import fs from 'node:fs'
14
+ import {builtinModules} from 'node:module';
28
15
 
29
16
  const clean = () => {
30
17
  log(`清除 ${relativeToApp(config.es)} & ${relativeToApp(config.cjs)} 目录---开始`);
@@ -39,152 +26,185 @@ const clean = () => {
39
26
  })
40
27
  }
41
28
 
29
+ function getPostcss(extract?: string | boolean) {
30
+ return postcss({
31
+ // 处理 Less(需安装 less)
32
+ extensions: ['.less', '.scss', '.sass'], // 识别 less 扩展名
33
+ // 为不同类型的文件指定对应的编译器(关键修改)
34
+ use: {
35
+ "stylus": ['sass'],
36
+ 'less': ['less'], //.less 文件用 less 编译
37
+ 'sass': ['sass'] //.sass 文件用 sass 编译(缩进语法)
38
+ },
42
39
 
43
- const cssPreprocess = () => {
44
- const copy = (dest: string) => {
45
- return () => gulp.src(
46
- getMatchFiles((path) => [`${path}/**/*.scss`, `${path}/**/*.less`], false)
47
- ).pipe(logger({
48
- before: `copyPreprocessCSS...`,
49
- after: 'copyPreprocessCSS complete!',
50
- showChange: true
51
- })).pipe(gulp.dest(dest))
52
- }
53
- const compilePreprocess = (extname: string, dest: string) => {
54
- return () => gulp.src(
55
- getMatchFiles((path) => `${path}/**/*.${extname}`, false)
56
- )
57
- .pipe(extname === 'less'
58
- ? gulpLess()
59
- : sass({outputStyle: 'compressed'}).on('error', sass.logError))
60
- .pipe(autoPreFixer())
61
- .pipe(rename((path) => {
62
- path.extname = ".min.css"
63
- }))
64
- .pipe(plumber())
65
- .pipe(gulp.dest(dest));
66
- }
67
- const compile = (dest: string) => {
68
- return parallel(compilePreprocess('scss', dest), compilePreprocess('less', dest))
69
- }
70
- return parallel(copy(config.es), copy(config.cjs), compile(config.cjs), compile(config.es))
71
- }
40
+ // 配置 PostCSS 插件(自动前缀、压缩)
41
+ plugins: [
42
+ autoprefixer({overrideBrowserslist: config.css.browserslist}),
43
+ cssnano() // 生产环境压缩 CSS
44
+ ],
72
45
 
46
+ // 输出配置:提取为单独的 CSS 文件(推荐)
47
+ extract, // 提取到 ${name}.min.css
73
48
 
74
- const copyScssToLib = () => {
75
- return gulp.src(
76
- getMatchFiles((path) => [`${path}/**/*.scss`, `${path}/**/*.less`], false)
77
- )
78
- .pipe(logger({
79
- before: 'copyScssToLib...',
80
- after: 'copyScssToLib complete!',
81
- extname: '.scss',
82
- showChange: true
83
- }))
84
- .pipe(gulp.dest(config.cjs));
49
+ // 可选:不提取,嵌入到 JS 中(通过 import 会生成 style 标签)
50
+ // extract: false
51
+ })
85
52
  }
86
- const compileEs = () => {
87
- const tsConfig = typescript.readConfigFile(resolveApp('tsconfig.json'), typescript.sys.readFile);
88
- if (tsConfig.error) {
89
- console.log(tsConfig.error.messageText);
90
- }
91
- const compile = (src: string[], target: string) => {
92
- return gulp.src(src)
93
- .pipe(logger({
94
- before: 'generate ...es ...',
95
- after: 'generate ...es complete!',
96
- extname: '.ts',
97
- showChange: false,
98
- }))
99
- .pipe(ts({
100
- "jsx": "react",
101
- "noImplicitAny": true,
102
- ...tsConfig.config.compilerOptions,
103
- "module": "esnext",
104
- "target": "esnext",
105
- "newLine": 'crlf',
106
- "allowImportingTsExtensions": false,
107
- "baseUrl": "./",
108
- "isolatedModules": false,
109
- "removeComments": false,
110
- "declaration": true,
111
- "noEmit": false,
112
- "esModuleInterop": true,
113
- "resolveJsonModule": true,
114
- "skipLibCheck": true,
115
- "moduleResolution": 'node',
116
- }))
117
- .on('error', (e) => {
118
- console.error(e)
119
- throw e;
120
- })
121
- .pipe(logger({
122
- before: 'writing to es...',
123
- after: 'write complete!',
124
- extname: '.ts',
125
- showChange: true,
126
- display: 'name'
127
- }))
128
- .pipe(plumber())
129
- .pipe(gulp.dest(target))
130
- .pipe(gulp.src(config.include.map(item => `${item}/**/*.json`)))
131
- .pipe(gulp.dest(target));
53
+
54
+ const name = getValidPkgName(pkg.name);
55
+
56
+ // 1. 配置输入选项
57
+ function getInputOptions(isIIFE?: boolean, declarationDir?: string): RollupOptions {
58
+ function isNodeModule(id: string) {
59
+ // 获取模块绝对路径
60
+ try {
61
+ const resolved = require.resolve(id, {paths: [process.cwd()]});
62
+ return resolved.includes('node_modules');
63
+ } catch {
64
+ // 无法 resolve 的,认为是本地模块
65
+ return false;
66
+ }
132
67
  }
133
68
 
134
- const tasks = include.map((item) => {
135
- const isDirectory = item.isDirectory;
136
- return () => compile(isDirectory ? [
137
- `${item.path}/**/*.{ts,tsx}`,
138
- `!${item.path}/**/__test__/!**`,
139
- `${config.typings}/**/*.ts`,
140
- ] : [item.path],
141
- isDirectory && include.length > 1 ?
142
- path.join(config.es, relativeToApp(item.path))
143
- : config.es
144
- )
69
+ return ({
70
+ input: shallowInputs.filter(item => !item.endsWith('.d.ts')),
71
+ external: id => {
72
+ // Node 内置模块或者 npm 包都 external
73
+ if (builtinModules.includes(id)) return true;
74
+ // 排除本地相对路径和绝对路径,别名映射到本地也不会 external
75
+ if (id.startsWith('.') || path.isAbsolute(id)) return false;
76
+ // node_modules 下的模块才 external
77
+ return isNodeModule(id);
78
+ },
79
+ plugins: [
80
+ json(),
81
+ isIIFE && resolve(), // 解析 node_modules
82
+ commonjs(), // 转换 CommonJS 模块
83
+ typescript({
84
+ tsconfig: resolveApp('tsconfig.json'), // 可选,指定 tsconfig
85
+ compilerOptions: {
86
+ noImplicitAny: true,
87
+ isolatedModules: false,
88
+ declaration: !!declarationDir,
89
+ allowImportingTsExtensions: false,
90
+ declarationDir,
91
+ noEmit: false,
92
+ emitDeclarationOnly: !!declarationDir,
93
+ esModuleInterop: true,
94
+ resolveJsonModule: true,
95
+ skipLibCheck: true,
96
+ removeComments: false,
97
+ rootDir: resolveApp('src'), // ✅ 指定源代码根目录
98
+ }
99
+ }),
100
+ getPostcss(config.css.extract)
101
+ ].filter(Boolean)
145
102
  })
146
- return series(tasks)
147
103
  }
148
- const copyTds = () => {
149
- return gulp.src([
150
- `${config.es}/**/*.d.ts`,
151
- ]).pipe(gulp.dest(config.cjs));
104
+
105
+ async function buildExtraCss() {
106
+ const extras = config.css.extra;
107
+ if (!extras?.length) return;
108
+
109
+ const srcRoot = resolveApp('src');
110
+ const esRoot = resolveApp(config.es);
111
+
112
+ const tasks = extras.map(async (v) => {
113
+ try {
114
+ const absPath = resolveApp(v); // 源文件绝对路径
115
+ const relativePath = path.relative(srcRoot, absPath); // 相对于 src 的路径
116
+ const dirname = path.dirname(relativePath); // 相对目录
117
+ const filename = path.basename(v, path.extname(v)); // 文件名去掉扩展名
118
+
119
+ // rollup 打包
120
+ const bundle = await rollup({
121
+ input: [v],
122
+ plugins: getPostcss(path.join(dirname, `${filename}.min.css`))
123
+ });
124
+
125
+ await bundle.write({
126
+ dir: config.es,
127
+ format: 'es',
128
+ sourcemap: false,
129
+ preserveModules: true,
130
+ preserveModulesRoot: srcRoot
131
+ });
132
+
133
+ // 删除生成的 JS 文件
134
+ const jsFile = path.join(esRoot, dirname, `${filename}${path.extname(v)}.js`);
135
+ if (fs.existsSync(jsFile)) fs.unlinkSync(jsFile);
136
+
137
+ // 复制到其他目标目录
138
+ [config.cjs, config.iife].forEach(targetRoot => {
139
+ const dest = path.join(resolveApp(targetRoot), dirname, `${filename}.min.css`);
140
+ fs.mkdirSync(path.dirname(dest), {recursive: true});
141
+ fs.copyFileSync(
142
+ path.join(esRoot, dirname, `${filename}.min.css`),
143
+ dest
144
+ );
145
+ });
146
+
147
+ log.success(`✅ 编译完成: ${v}`);
148
+ } catch (err) {
149
+ log.error(`❌ 编译失败: ${v}`, err);
150
+ }
151
+ });
152
+
153
+ await Promise.all(tasks);
154
+ log.success('✅ 所有额外 CSS 编译完成');
152
155
  }
153
- const compileLib = () => {
154
- return gulp.src([`${config.es}/**/*.js`])
155
- .pipe(logger({
156
- before: 'Starting transform ...',
157
- after: 'transform complete!',
158
- extname: '.js',
159
- showChange: true
160
- }))
161
- .pipe(babel({
162
- "presets": [
163
- [
164
- "@babel/preset-env",
165
- {
166
- "targets": {
167
- "chrome": "58",
168
- "ie": "9"
169
- }
170
- }
171
- ],
172
- [
173
- "@babel/preset-react"
174
- ]
175
- ],
176
- "plugins": ["@babel/plugin-transform-runtime"]
177
- }))
178
- .pipe(plumber())
179
- .pipe(logger({
180
- before: 'write js ---> ...',
181
- after: 'write js ---> complete!',
182
- extname: '.js',
183
- showChange: true
184
- }))
185
- .pipe(gulp.dest(config.cjs))
156
+
157
+ async function build() {
158
+
159
+ // 2. 配置输出选项
160
+ let outputOptions: OutputOptions[] = [
161
+ {
162
+ dir: config.es,
163
+ format: 'es', // 输出 ES Module
164
+ sourcemap: false,
165
+ preserveModules: true,
166
+ preserveModulesRoot: resolveApp('src'), // ✅ 指定源代码根目录
167
+ },
168
+ {
169
+ dir: config.cjs,
170
+ format: 'cjs', // 输出 COMMONJS
171
+ sourcemap: false,
172
+ preserveModules: true,
173
+ preserveModulesRoot: resolveApp('src'), // ✅ 指定源代码根目录
174
+ exports: "named",
175
+ },
176
+ {
177
+ dir: config.iife,
178
+ format: 'iife', // 输出 iife
179
+ sourcemap: false,
180
+ exports: "named",
181
+ name: toPascalCase(name)
182
+ }
183
+ ];
184
+ if (!config.iife) {
185
+ outputOptions = outputOptions.filter(op => op.format !== 'iife')
186
+ }
187
+
188
+ for (const output of outputOptions) {
189
+ // 3. 调用 rollup 打包
190
+ const bundle = await rollup(getInputOptions(output.format === 'iife'));
191
+ // 4. 写入文件
192
+ await bundle.write(output);
193
+ }
194
+ {
195
+ const bundle = await rollup(getInputOptions(false, config.es));
196
+ await bundle.write(outputOptions[0]);
197
+ }
198
+ await buildExtraCss();
199
+ log.success('✅ Build complete!');
186
200
  }
187
201
 
188
- const compileEsAndLib = series(compileEs(), copyTds, compileLib)
189
202
 
190
- export default series(clean, parallel(cssPreprocess(), copyScssToLib, compileEsAndLib))
203
+ const copySrcTds = () => {
204
+ return gulp.src(config.include.map(t=>`${t}/**/*.d.ts`)).pipe(gulp.dest(config.es));
205
+ }
206
+
207
+ const copyTds = () => {
208
+ return gulp.src([`${config.es}/**/*.d.ts`]).pipe(gulp.dest(config.cjs));
209
+ }
210
+ export default series(clean, build, copySrcTds, copyTds)