-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revamp CJS and ESM bundling with Rollup (extracted from #4261).
To create this commit, I first squashed all of @rosskevin's commits from new bundling strategy discussed in that PR. Once that was done, I rebased against origin/release-2.5.0 and fixed the conflicts. There are a few additional changes I'd like to make after this, but I wanted to preserve @rosskevin's intentions as much as possible in this commit, since it still has his name attached to it.
- Loading branch information
Showing
34 changed files
with
253 additions
and
272 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
# fs | ||
.DS_Store | ||
.rpt2_cache | ||
|
||
# Logs | ||
logs | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import nodeResolve from 'rollup-plugin-node-resolve'; | ||
import typescriptPlugin from 'rollup-plugin-typescript2'; | ||
import typescript from 'typescript'; | ||
import path from 'path'; | ||
|
||
// treat as externals not relative and not absolute paths | ||
const external = id => !id.startsWith('.') && !id.startsWith('/'); | ||
|
||
const extensions = ['.ts', '.tsx']; | ||
const input = './src/index.ts'; | ||
|
||
export default pkg => { | ||
const projectDir = path.join(__filename, '..'); | ||
console.info(`Building project esm ${projectDir}`); | ||
const tsconfig = `${projectDir}/tsconfig.json`; | ||
return { | ||
input, | ||
external, | ||
output: { | ||
file: pkg.module, | ||
format: 'esm', | ||
sourcemap: true, | ||
}, | ||
plugins: [ | ||
nodeResolve({ extensions }), | ||
typescriptPlugin({ typescript, tsconfig }), | ||
], | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
module.exports = { | ||
transform: { | ||
'.(ts|tsx)': 'ts-jest', | ||
}, | ||
|
||
moduleFileExtensions: ['ts', 'tsx', 'js', 'json'], | ||
testURL: 'http://localhost', | ||
|
||
testMatch: ['<rootDir>/src/**/__tests__/*.ts'], | ||
testPathIgnorePatterns: [ | ||
'/node_modules/', | ||
'/lib/', | ||
'<rootDir>/lib/', | ||
// '<rootDir>/../*/lib/', | ||
], | ||
|
||
// moduleNameMapper: { | ||
// '(apollo-boost|apollo-cache-inmemory|apollo-cache|apollo-client|apollo-utilities|graphql-anywhere)(.*)': | ||
// '<rootDir>/../$1/src/$2', | ||
// }, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
module.exports = { | ||
rootDir: '.', | ||
projects: ['<rootDir>/packages/*'], | ||
|
||
// moduleNameMapper: { | ||
// '(apollo-boost|apollo-cache-inmemory|apollo-cache|apollo-client|apollo-utilities|graphql-anywhere)(.*)': | ||
// '<rootDir>/packages/$1/src/$2', | ||
// }, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
const pkg = require('../../config/jest.config.settings'); | ||
|
||
module.exports = { | ||
...pkg, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
const pkg = require('../../config/jest.config.settings'); | ||
|
||
module.exports = { | ||
...pkg, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.