Skip to content

Commit

Permalink
chore(buble): Move to Typescript (#231)
Browse files Browse the repository at this point in the history
  • Loading branch information
NotWoods authored Feb 28, 2020
1 parent 8a59c9a commit d8c6ebe
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 10 deletions.
4 changes: 2 additions & 2 deletions packages/buble/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

# @rollup/plugin-buble

🍣 A Rollup which converts ES2015+ code with the Bublé compiler.
🍣 A Rollup plugin which converts ES2015+ code with the Bublé compiler.

## Requirements

Expand Down Expand Up @@ -49,7 +49,7 @@ Then call `rollup` either via the [CLI](https://www.rollupjs.org/guide/en/#comma
Type: `Object`<br>
Default: `{ modules: false }`

Specifies additional [transform options](https://buble.surge.sh/guide/) for the Bublé compiler
Specifies additional [transform options](https://buble.surge.sh/guide/) for the Bublé compiler.

### `exclude`

Expand Down
20 changes: 16 additions & 4 deletions packages/buble/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,28 +11,31 @@
"homepage": "https://github.com/rollup/plugins/tree/master/packages/buble/#readme",
"bugs": "https://github.com/rollup/plugins/issues",
"main": "dist/rollup-plugin-buble.cjs.js",
"engines": {
"node": ">= 8.0.0"
},
"scripts": {
"build": "rollup -c",
"ci:coverage": "nyc pnpm run test && nyc report --reporter=text-lcov > coverage.lcov",
"ci:lint": "pnpm run build && pnpm run lint",
"ci:lint:commits": "commitlint --from=${CIRCLE_BRANCH} --to=${CIRCLE_SHA1}",
"ci:test": "pnpm run test -- --verbose && pnpm run test:ts",
"ci:test": "pnpm run test -- --verbose",
"lint": "pnpm run lint:js && pnpm run lint:docs && pnpm run lint:package",
"lint:docs": "prettier --single-quote --write README.md",
"lint:js": "eslint --fix --cache src test types --ext .js,.ts",
"lint:package": "prettier --write package.json --plugin=prettier-plugin-package",
"prebuild": "del-cli dist",
"prepare": "pnpm run build",
"prepublishOnly": "pnpm run lint && pnpm run test && pnpm run test:ts",
"prepublishOnly": "pnpm run lint && pnpm run test",
"pretest": "pnpm run build",
"test": "ava",
"test:ts": "tsc types/index.d.ts test/types.ts --noEmit"
},
"files": [
"dist",
"src",
"types",
"README.md"
"README.md",
"LICENSE"
],
"keywords": [
"rollup",
Expand All @@ -51,14 +54,23 @@
"buble": "^0.19.8"
},
"devDependencies": {
"@rollup/plugin-typescript": "^3.0.0",
"del-cli": "^3.0.0",
"rollup": "^1.27.14",
"source-map": "^0.7.3",
"typescript": "^3.7.4"
},
"ava": {
"compileEnhancements": false,
"extensions": [
"ts"
],
"require": [
"ts-node/register"
],
"files": [
"!**/fixtures/**",
"!**/output/**",
"!**/helpers/**",
"!**/recipes/**",
"!**/types.ts"
Expand Down
12 changes: 9 additions & 3 deletions packages/buble/rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
import typescript from '@rollup/plugin-typescript';

import pkg from './package.json';

export default {
input: 'src/index.js',
output: [{ format: 'es', file: pkg.module }, { format: 'cjs', file: pkg.main }],
external: ['buble', 'rollup-pluginutils']
input: 'src/index.ts',
output: [
{ format: 'es', file: pkg.module },
{ format: 'cjs', file: pkg.main }
],
external: Object.keys(pkg.dependencies),
plugins: [typescript()]
};
5 changes: 4 additions & 1 deletion packages/buble/src/index.js → packages/buble/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import { transform } from 'buble';
import { Plugin } from 'rollup';
import { createFilter } from '@rollup/pluginutils';

export default function buble(options = {}) {
import { RollupBubleOptions } from '../types';

export default function buble(options: RollupBubleOptions = {}): Plugin {
const filter = createFilter(options.include, options.exclude);
const transformOptions = { ...options, transforms: { ...options.transforms, modules: false } };

Expand Down
13 changes: 13 additions & 0 deletions packages/buble/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"lib": ["es6"],
"module": "esnext",
"allowJs": true
},
"include": [
"src/**/*",
"types/**/*",
"typings-test.js"
]
}
2 changes: 2 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit d8c6ebe

Please sign in to comment.