Skip to content
This repository has been archived by the owner on Apr 29, 2021. It is now read-only.

Commit

Permalink
使用 rollup 来进行打包
Browse files Browse the repository at this point in the history
  • Loading branch information
feichao93 committed Jul 14, 2018
1 parent bb14ddd commit 7c3994c
Show file tree
Hide file tree
Showing 8 changed files with 107 additions and 26 deletions.
2 changes: 1 addition & 1 deletion .gitignore
@@ -1,4 +1,4 @@
node_modules
lib
dist
.idea
coverage
9 changes: 9 additions & 0 deletions babel.config.js
@@ -0,0 +1,9 @@
const { BABEL_ENV } = process.env

module.exports = {
plugins: [
BABEL_ENV !== 'es' && '@babel/plugin-transform-modules-commonjs',
'@babel/plugin-proposal-class-properties',
'@babel/plugin-syntax-object-rest-spread',
].filter(Boolean),
}
28 changes: 8 additions & 20 deletions package.json
Expand Up @@ -4,10 +4,9 @@
"description": "Just a little-saga.",
"version": "0.4.0-SNAPSHOT",
"scripts": {
"start": "babel --watch src -d lib",
"build": "babel src -d lib",
"build": "cross-env BABEL_ENV=es rollup -c -i src/index.js -o dist/little-saga.js",
"test": "jest --coverage && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js",
"prepublishOnly": "rimraf lib/ && npm run-script build"
"prepublishOnly": "rimraf dist/ && npm run-script build"
},
"author": {
"name": "Shi Feichao",
Expand All @@ -16,30 +15,16 @@
"engines": {
"node": ">=8.3"
},
"main": "lib/index.js",
"main": "dist/little-saga.js",
"typings": "./little-saga.d.ts",
"files": [
"docs/",
"lib/",
"dist/",
".editorconfig",
".gitignore",
"little-saga.d.ts",
"package.json",
"readme.md"
],
"prettier": {
"printWidth": 100,
"semi": false,
"singleQuote": true,
"trailingComma": "all"
},
"babel": {
"plugins": [
"@babel/plugin-transform-modules-commonjs",
"@babel/plugin-proposal-class-properties",
"@babel/plugin-syntax-object-rest-spread"
]
},
"jest": {
"testRegex": "(/__tests__/.*|\\.(test|spec))\\.jsx?$",
"moduleFileExtensions": [
Expand All @@ -57,11 +42,14 @@
"babel-core": "7.0.0-bridge.0",
"babel-jest": "^23.4.0",
"coveralls": "^3.0.2",
"cross-env": "^5.2.0",
"husky": "^1.0.0-rc.9",
"jest": "^23.4.0",
"lint-staged": "^7.2.0",
"prettier": "1.13.7",
"rimraf": "^2.6.2"
"rimraf": "^2.6.2",
"rollup": "^0.62.0",
"rollup-plugin-babel": "4.0.0-beta.7"
},
"dependencies": {
"@types/node": "^10.5.2"
Expand Down
6 changes: 6 additions & 0 deletions prettier.config.js
@@ -0,0 +1,6 @@
module.exports = {
printWidth: 100,
semi: false,
singleQuote: true,
trailingComma: 'all',
}
11 changes: 11 additions & 0 deletions rollup.config.js
@@ -0,0 +1,11 @@
import babel from 'rollup-plugin-babel'

const config = {
output: {
file: 'little-saga.js',
format: 'cjs',
},
plugins: [babel({})],
}

export default config
2 changes: 1 addition & 1 deletion src/internal-utils.js
@@ -1,5 +1,5 @@
import { always, is, noop } from './utils'
import { TASK_CANCEL } from './index'
import { TASK_CANCEL } from './symbols'

export function makeMatcher(pattern) {
if (pattern === '*' || pattern === undefined) {
Expand Down
4 changes: 3 additions & 1 deletion src/sagaHelpers.js
@@ -1,4 +1,6 @@
import { io, delay, buffers } from './index'
import io from './io'
import { delay } from './utils'
import * as buffers from './channel-utils/buffers'

export function takeEvery(patternOrChannel, worker, ...args) {
return io.fork(function*() {
Expand Down
71 changes: 68 additions & 3 deletions yarn.lock
Expand Up @@ -80,6 +80,13 @@
dependencies:
"@babel/types" "7.0.0-beta.53"

"@babel/helper-module-imports@7.0.0-beta.51":
version "7.0.0-beta.51"
resolved "http://registry.npm.taobao.org/@babel/helper-module-imports/download/@babel/helper-module-imports-7.0.0-beta.51.tgz#ce00428045fbb7d5ebc0ea7bf835789f15366ab2"
dependencies:
"@babel/types" "7.0.0-beta.51"
lodash "^4.17.5"

"@babel/helper-module-imports@7.0.0-beta.53":
version "7.0.0-beta.53"
resolved "http://registry.npm.taobao.org/@babel/helper-module-imports/download/@babel/helper-module-imports-7.0.0-beta.53.tgz#e735e6aa30a504b0f9d85c38a6d470a9f4aa81d9"
Expand Down Expand Up @@ -214,6 +221,14 @@
invariant "^2.2.0"
lodash "^4.17.5"

"@babel/types@7.0.0-beta.51":
version "7.0.0-beta.51"
resolved "http://registry.npm.taobao.org/@babel/types/download/@babel/types-7.0.0-beta.51.tgz#d802b7b543b5836c778aa691797abf00f3d97ea9"
dependencies:
esutils "^2.0.2"
lodash "^4.17.5"
to-fast-properties "^2.0.0"

"@babel/types@7.0.0-beta.53":
version "7.0.0-beta.53"
resolved "http://registry.npm.taobao.org/@babel/types/download/@babel/types-7.0.0-beta.53.tgz#19a461c0da515595dfb6740b4b45dc7bb0e6b375"
Expand All @@ -228,7 +243,11 @@
dependencies:
any-observable "^0.3.0"

"@types/node@^10.5.2":
"@types/estree@0.0.39":
version "0.0.39"
resolved "http://registry.npm.taobao.org/@types/estree/download/@types/estree-0.0.39.tgz#e177e699ee1b8c22d23174caaa7422644389509f"

"@types/node@*", "@types/node@^10.5.2":
version "10.5.2"
resolved "http://registry.npm.taobao.org/@types/node/download/@types/node-10.5.2.tgz#f19f05314d5421fe37e74153254201a7bf00a707"

Expand Down Expand Up @@ -908,6 +927,13 @@ coveralls@^3.0.2:
minimist "^1.2.0"
request "^2.85.0"

cross-env@^5.2.0:
version "5.2.0"
resolved "http://registry.npm.taobao.org/cross-env/download/cross-env-5.2.0.tgz#6ecd4c015d5773e614039ee529076669b9d126f2"
dependencies:
cross-spawn "^6.0.5"
is-windows "^1.0.0"

cross-spawn@^5.0.1:
version "5.1.0"
resolved "http://registry.npm.taobao.org/cross-spawn/download/cross-spawn-5.1.0.tgz#e8bd0efee58fcff6f8f94510a0a554bbfa235449"
Expand All @@ -916,6 +942,16 @@ cross-spawn@^5.0.1:
shebang-command "^1.2.0"
which "^1.2.9"

cross-spawn@^6.0.5:
version "6.0.5"
resolved "http://registry.npm.taobao.org/cross-spawn/download/cross-spawn-6.0.5.tgz#4a5ec7c64dfae22c3a14124dbacdee846d80cbc4"
dependencies:
nice-try "^1.0.4"
path-key "^2.0.1"
semver "^5.5.0"
shebang-command "^1.2.0"
which "^1.2.9"

cryptiles@2.x.x:
version "2.0.5"
resolved "http://registry.npm.taobao.org/cryptiles/download/cryptiles-2.0.5.tgz#3bdfecdc608147c1c67202fa291e7dca59eaa3b8"
Expand Down Expand Up @@ -1113,6 +1149,10 @@ estraverse@^4.2.0:
version "4.2.0"
resolved "http://registry.npm.taobao.org/estraverse/download/estraverse-4.2.0.tgz#0dee3fed31fcd469618ce7342099fc1afa0bdb13"

estree-walker@^0.5.2:
version "0.5.2"
resolved "http://registry.npm.taobao.org/estree-walker/download/estree-walker-0.5.2.tgz#d3850be7529c9580d815600b53126515e146dd39"

esutils@^2.0.2:
version "2.0.2"
resolved "http://registry.npm.taobao.org/esutils/download/esutils-2.0.2.tgz#0abf4f1caa5bcb1f7a9d8acc6dea4faaa04bac9b"
Expand Down Expand Up @@ -1927,7 +1967,7 @@ is-utf8@^0.2.0:
version "0.2.1"
resolved "http://registry.npm.taobao.org/is-utf8/download/is-utf8-0.2.1.tgz#4b0da1442104d1b336340e80797e865cf39f7d72"

is-windows@^1.0.2:
is-windows@^1.0.0, is-windows@^1.0.2:
version "1.0.2"
resolved "http://registry.npm.taobao.org/is-windows/download/is-windows-1.0.2.tgz#d1850eb9791ecd18e6182ce12a30f396634bb19d"

Expand Down Expand Up @@ -2779,6 +2819,10 @@ needle@^2.2.0:
iconv-lite "^0.4.4"
sax "^1.2.4"

nice-try@^1.0.4:
version "1.0.4"
resolved "http://registry.npm.taobao.org/nice-try/download/nice-try-1.0.4.tgz#d93962f6c52f2c1558c0fbda6d512819f1efe1c4"

node-int64@^0.4.0:
version "0.4.0"
resolved "http://registry.npm.taobao.org/node-int64/download/node-int64-0.4.0.tgz#87a9065cdb355d3182d8f94ce11188b825c68a3b"
Expand Down Expand Up @@ -3083,7 +3127,7 @@ path-is-inside@^1.0.2:
version "1.0.2"
resolved "http://registry.npm.taobao.org/path-is-inside/download/path-is-inside-1.0.2.tgz#365417dede44430d1c11af61027facf074bdfc53"

path-key@^2.0.0:
path-key@^2.0.0, path-key@^2.0.1:
version "2.0.1"
resolved "http://registry.npm.taobao.org/path-key/download/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40"

Expand Down Expand Up @@ -3461,6 +3505,27 @@ rimraf@2, rimraf@^2.5.1, rimraf@^2.5.4, rimraf@^2.6.1, rimraf@^2.6.2:
dependencies:
glob "^7.0.5"

rollup-plugin-babel@4.0.0-beta.7:
version "4.0.0-beta.7"
resolved "http://registry.npm.taobao.org/rollup-plugin-babel/download/rollup-plugin-babel-4.0.0-beta.7.tgz#8c38a685f8009fc6fbf1d31597cb3c5f8060caf5"
dependencies:
"@babel/helper-module-imports" "7.0.0-beta.51"
rollup-pluginutils "^2.3.0"

rollup-pluginutils@^2.3.0:
version "2.3.0"
resolved "http://registry.npm.taobao.org/rollup-pluginutils/download/rollup-pluginutils-2.3.0.tgz#478ace04bd7f6da2e724356ca798214884738fc4"
dependencies:
estree-walker "^0.5.2"
micromatch "^2.3.11"

rollup@^0.62.0:
version "0.62.0"
resolved "http://registry.npm.taobao.org/rollup/download/rollup-0.62.0.tgz#4ca8b3c9582195dc9341ff8a1375f58319b95bfc"
dependencies:
"@types/estree" "0.0.39"
"@types/node" "*"

run-node@^1.0.0:
version "1.0.0"
resolved "http://registry.npm.taobao.org/run-node/download/run-node-1.0.0.tgz#46b50b946a2aa2d4947ae1d886e9856fd9cabe5e"
Expand Down

0 comments on commit 7c3994c

Please sign in to comment.