Skip to content

Commit

Permalink
feat!: drop code-gen utils (genImport and genDynamicImport)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: code-gen utils moved to https://github.com/unjs/knitwork
  • Loading branch information
pi0 committed Jan 25, 2022
1 parent 3f4e844 commit 42583e1
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 125 deletions.
41 changes: 0 additions & 41 deletions README.md
Expand Up @@ -375,47 +375,6 @@ console.log(transformModule(`console.log(import.meta.url)`), { url: 'test.mjs' }
Options are same as `evalModule`.
## Code Generation
Utilities to generate JavaScript code for ESM syntax.
### `genImport`
Generate a static import statement.
```js
import { genImport } from 'mlly'

// import { foo } from "pkg"
console.log(genImport('pkg', 'foo'))

// import { a, b } from "pkg"
console.log(genImport('pkg', 'foo'))

// import { foo as bar } from "pkg"
console.log(genImport('pkg', { name: 'foo', as: 'bar' }))
```
### `genDynamicImport`
Generate a dynamic import statement.
```js
import { genDynamicImport } from 'mlly'

// () => import("pkg")
console.log(genDynamicImport('pkg'))

// () => import("pkg").then(m => m.default || m)
console.log(genDynamicImport('pkg', { interopDefault: true }))

// import("pkg")
console.log(genDynamicImport('pkg', { wrapper: false }))

// () => import("pkg" /* webpackChunkName: "pkg" */)
console.log(genDynamicImport('pkg', { comment: 'webpackChunkName: "pkg"' }))
```
## Other Utils
### `fileURLToPath`
Expand Down
47 changes: 0 additions & 47 deletions src/gen.ts

This file was deleted.

1 change: 0 additions & 1 deletion src/index.ts
@@ -1,7 +1,6 @@
export * from './analyze'
export * from './cjs'
export * from './eval'
export * from './gen'
export * from './resolve'
export * from './syntax'
export * from './utils'
36 changes: 0 additions & 36 deletions test/gen.test.mjs

This file was deleted.

0 comments on commit 42583e1

Please sign in to comment.