Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dpck/bundle
The Source Code For The Bundle Logic To Prepare Temp Files.
https://github.com/dpck/bundle
Last synced: about 1 month ago
JSON representation
The Source Code For The Bundle Logic To Prepare Temp Files.
- Host: GitHub
- URL: https://github.com/dpck/bundle
- Owner: dpck
- License: mit
- Created: 2019-02-08T16:28:19.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2019-09-14T17:31:00.000Z (over 5 years ago)
- Last Synced: 2024-11-25T12:02:14.748Z (about 1 month ago)
- Language: JavaScript
- Homepage: https://artd.eco/depack
- Size: 91.8 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# @depack/bundle
[![npm version](https://badge.fury.io/js/%40depack%2Fbundle.svg)](https://npmjs.org/package/@depack/bundle)
`@depack/bundle` is The Source Code For The Bundle Logic To Prepare Temp Files. Because Google Closure Compiler cannot import _JSX_ files, we create a temp directory to put them in there, and also allow to update `preact` to `@externs/preact` in the temp as well, so that _Preact_ can be referenced separately from the compiled code.
```sh
yarn add @depack/bundle
```## Table Of Contents
- [Table Of Contents](#table-of-contents)
- [API](#api)
- [`async generateTemp(entry: string, config?: TempConfig)`](#async-generatetempentry-stringconfig-tempconfig-void)
* [`TempConfig`](#type-tempconfig)
- [Copyright](#copyright)## API
The package is available by importing its default function:
```js
import generateTemp from '@depack/bundle'
```##
async generateTemp(
`entry: string,`
`config?: TempConfig,`): void
Generates a temp directory for the given entry file and transpiles JSX files that are references in it. Any JS files will also be placed in the TEMP dir if there is a single JSX file found. This is because references to JSX files need to be updated in JS files to point to the temp dir.
If the required file's path is higher than the current dir, the bundler will check if belongs to a linked package, and generate temp files in `temp/node_modules` dir rather than pollute the filesystem above CWD.
__`TempConfig`__: Options for generating the temp directory.
Name
Type & Description
Default
tempDir
string
depack-temp
The directory in which to place temp files.
preact
boolean
false
Whether to addimport { h } from 'preact'
automatically at the top of each JSX file.
preactExtern
boolean
false
Whether to addimport { h } from '@externs/preact'
automatically at the top of each JSX file, and rename preact imports into@externs/preact
imports. See https://www.npmjs.com/package/@externs/preact.
## Copyright
© Art Deco for Depack 2019
Tech Nation Visa Sucks