Skip to content

Commit

Permalink
Merge pull request #281 from alibaba/feat-rollup
Browse files Browse the repository at this point in the history
Update rollup middleware to support string import and series mode
  • Loading branch information
soulwu authored Nov 26, 2021
2 parents a332354 + 77b9199 commit 3c3595a
Show file tree
Hide file tree
Showing 43 changed files with 3,709 additions and 924 deletions.
47 changes: 45 additions & 2 deletions packages/middleware-rollup/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
## 使用说明

### 安装

```shell
npm i -D @dawnjs/dn-middleware-rollup
```
Expand Down Expand Up @@ -112,6 +113,13 @@ module.exports = {

开启打包分析功能,会产出打包内容的体积等信息,主要用于打包体积调优过程

### `parallel`

类型:`boolean`<br>
默认值:`false`

开启并行打包模式

### `entry`

类型:`string | string[]`<br>
Expand Down Expand Up @@ -142,7 +150,7 @@ _说明:当配置为 `"browser"` 时,可通过 `.browserslistrc` 指定目
类型:`string` | `Object`<br>
默认值:

指定输出文件路径和文件名,对于多entry的项目,可以传入entry名与输出名的Map
指定输出文件路径和文件名,对于多 entry 的项目,可以传入 entry 名与输出名的 Map

_说明:输出文件的最终文件名由多个条件与配置项组合后形成,详细说明请查看[输出文件名说明](#输出文件名说明)_

Expand Down Expand Up @@ -472,7 +480,14 @@ _说明:会检查当前依赖的 `react` 版本是否支持 `jsxRuntime`,如
类型:`Object`<br>
默认值:

透传给 `node-sass` 的选项,详细说明请查看[相关文档](https://github.com/sass/node-sass#options)
透传给 [`sass`](https://github.com/sass/dart-sass#javascript-api) 或 [`node-sass`](https://github.com/sass/node-sass#options) 的选项

### `postcssImport`

类型:`Object`<br>
默认值:

额外的 `postcss-import` 配置项,详细说明请查看[相关文档](https://github.com/postcss/postcss-import#options)

### `autoprefixer`

Expand All @@ -481,6 +496,20 @@ _说明:会检查当前依赖的 `react` 版本是否支持 `jsxRuntime`,如

额外的 `autoprefixer` 配置项,详细说明请查看[相关文档](https://github.com/postcss/autoprefixer#options)

### `postcssPresetEnv`

类型:`Object`<br>
默认值:

额外的 `postcss-preset-env` 配置项,详细说明请查看[相关文档](https://github.com/csstools/postcss-preset-env#options)

### `postcss`

类型:`Object`<br>
默认值:

额外的 `rollup-plugin-postcss` 配置项,详细说明请查看[相关文档](https://github.com/egoist/rollup-plugin-postcss#options)

### `nodeResolve`

类型:`Object`<br>
Expand Down Expand Up @@ -571,6 +600,20 @@ _说明:如果是已加入到 `peerDependencies` 或 `dependencies` 中的依

开启对 `WebAssembly` 模块的打包支持。当配置成对象时,作为 `@rollup/plugin-wasm` 的配置项,详细说明请查看[相关文档](https://github.com/rollup/plugins/tree/master/packages/wasm#options)

### `string`

类型:`Object`<br>
默认值:`{ include: "**/*.txt" }`

透传给 `rollup-plugin-string` ,详细说明请查看[相关文档](https://github.com/TrySound/rollup-plugin-string#usage)

### `svgr`

类型:`Object`<br>
默认值:

透传给 `@svgr/rollup` ,详细说明请查看[相关文档](https://react-svgr.com/docs/rollup/#passing-options)

## 其他

### 输出文件名说明
Expand Down
5 changes: 5 additions & 0 deletions packages/middleware-rollup/examples/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
!package-lock.json
build
lib
es
dist
2 changes: 2 additions & 0 deletions packages/middleware-rollup/examples/basic/.browserslistrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
last 2 versions
IE 10
34 changes: 34 additions & 0 deletions packages/middleware-rollup/examples/basic/.dawn/pipe.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
dev:
- name: '@dawnjs/dn-middleware-lint'
noEmit: true
- name: '@dawnjs/dn-middleware-clean'
target:
- dist
- lib
- es
- name: $local
location: ../../lib/index.js
watch: true
entry: ./src/index.tsx
lint: true
esm: false
cjs: false

test:
- name: '@dawnjs/dn-middleware-lint'

build:
- name: '@dawnjs/dn-middleware-clean'
target:
- dist
- lib
- es
- name: $local
location: ../../lib/index.js
entry: ./src/index.tsx
# esm: false
# cjs: false
# umd:
# minFile: false
# parallel: true
analysis: true
2 changes: 2 additions & 0 deletions packages/middleware-rollup/examples/basic/.dawn/rc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
registry: https://registry.npmmirror.com/
server: https://alibaba.github.io/dawn
4 changes: 4 additions & 0 deletions packages/middleware-rollup/examples/basic/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules
dist
es
lib
5 changes: 5 additions & 0 deletions packages/middleware-rollup/examples/basic/.eslintrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Do not modify "extends" & "rules".

extends: '@dawnjs/eslint-config-dawn/typescript-react'
parserOptions:
project: ./tsconfig.json
2 changes: 2 additions & 0 deletions packages/middleware-rollup/examples/basic/.prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/** !!DO NOT MODIFY THIS FILE!! */
module.exports = require('@dawnjs/eslint-config-dawn/prettierrc');
10 changes: 10 additions & 0 deletions packages/middleware-rollup/examples/basic/declaration.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
declare module "*.module.css";
declare module "*.module.less";
declare module "*.module.scss";
declare module "*.txt";
declare module "*.yml";
declare module "*.png";
declare module "*.jpg";
declare module "*.jpeg";
declare module "*.gif";
declare module "*.svg";
Loading

0 comments on commit 3c3595a

Please sign in to comment.