https://github.com/hamlim/rgkp
pkgr 🤔
https://github.com/hamlim/rgkp
Last synced: about 1 year ago
JSON representation
pkgr 🤔
- Host: GitHub
- URL: https://github.com/hamlim/rgkp
- Owner: hamlim
- Created: 2020-11-01T21:39:32.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2020-11-09T01:59:17.000Z (over 5 years ago)
- Last Synced: 2025-04-05T00:47:47.736Z (about 1 year ago)
- Language: TypeScript
- Size: 34.3 MB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# rgkp
Transform a collection of source files into a browser compatible collection of
files.
## Install and Run
```sh
yarn add -D rgkp
```
```sh
yarn rgkp ./src/application.tsx
```
## Usage via Node:
```tsx
import rgkp, { RgkpConfig } from 'rgkp'
rgkp({
source: 'path/to/file.tsx',
// Optional
// Function to return `@babel/parser`'s `parse` options
// Will be merged with `'sourceType': 'module'`
resolveBabelParseOptions({ filename, content }) {
return {
plugins: ['jsx', 'typescript'],
}
},
// Optional
// Function to return the file extension for any ambiguous imports
// e.g. `import './Counter'`
// Will be called with `source` which is the full filepath to the file importing the ambiguous file
// and with `imported`, the import specifier encountered
resolveAmbiguousImportedFileExtension({ source, imported }) {
return `.tsx`
},
// Optional
// Function to resolve the NPM dependencies of a project to URL's
// Note: Many of the defaults here _may_ not be what you want!
resolveAmbiguousDependencies(packageJSON) {
return {
react: `https://unpkg.com/react@16.14.0/umd/react.production.min.js`,
}
},
})
```