element-plus/build/utils/gulp.ts
jeremywu 16f069ebbe
Revert "build!: simplify build & support native esm import (#3900)" (#3945)
* Revert "build!: simplify build & support native esm import (#3900)"

This reverts commit fb94222bb4.

* remove module

* Fix linter

* Add @element-plus/icons as dependency

* update pnpm lock file

* temporary lock element-plus at 1.1.0-beta.20
2021-10-20 09:42:32 +08:00

18 lines
544 B
TypeScript

import through2 from 'through2'
import { pathRewriter } from './pkg'
import type { TaskFunction } from 'gulp'
import type { Module } from '../info'
export const withTaskName = <T extends TaskFunction>(name: string, fn: T) =>
Object.assign(fn, { displayName: name })
export const gulpPathRewriter = (module: Module) => {
const rewriter = pathRewriter(module, true)
return through2.obj((file, _, cb) => {
const contents: string = file.contents.toString()
file.contents = Buffer.from(rewriter(contents))
cb(null, file)
})
}