1.4.1 • Published 1 year ago

reexport v1.4.1

Weekly downloads
-
License
Apache-2.0
Repository
-
Last release
1 year ago

reexport

Experimental utility to automate reexporting TypeScript in index.ts files. Primary target is TypeScript but it should work for any language with // comments.

Insert comment instructions // @reexport glob/pattern/*.tsx in place where you want to reexport such files and this utility will reexport all matching files.

https://user-images.githubusercontent.com/316435/204151619-0606e4d0-df19-4000-b475-dcdc72e3b101.mov

Usage

Your index.ts looking like this:

// @reexport ./*.{ts,tsx}

With directory like this:

./index.ts
./Alice.tsx
./Bob.ts

Running this:

npx reexport ./index.ts

Will generate this:

// @reexport ./*.{ts,tsx}
export * from './Alice'
export * from './Bob'
// @end-reexport

Installation

npm install reexport

CLI usage

npm i -g reexport

reexport "./src/**/index.{ts,tsx}"

NPX usage

npx reexport "./src/**/index.{ts,tsx}"

Node.js usage

import { reexport } from 'reexport'

reexport({ files: ['./index.ts'], watch: true })

Features

  • watch mode --watch
  • glob matching reexport "**/index.{ts,tsx},something.js"
  • verbose mode -v | more verbose -vv | even more verbose -vvv

Custom reexport outputs

Define outptu pattern after colon (:) symbol.

Available variables

Examples

// @reexport ./*.{ts,tsx}:export * from './$TS_PATH'
export * from './Alice'
export * from './Bob'
// @end-reexport

const things = {
	// @reexport ./*.{ts,tsx}:	$SAFE_NAME: () => import('./$TS_PATH'),
	Alice: () => import('./Alice'),
	Bob: () => import('./Bob'),
	// @end-reexport
}
1.4.1

1 year ago

1.4.0

1 year ago

1.3.1

1 year ago

1.3.0

1 year ago

1.2.0

1 year ago

1.1.0

1 year ago

1.0.0

1 year ago