Skip to content

(export) - JavaScript

export statements, including re-exports

clojure
(export source?)

Where:

  1. source: module source string for re-exports (the "mod" in export { a } from "mod") *

Matching:

  1. named exports, e.g. export const x = 1
  2. default exports, e.g. export default function() {}
  3. re-exports, e.g. export { a } from "mod"
  4. namespace re-exports, e.g. export * from "mod"

Behavior

  • When a source filter is provided, only re-exports with a from clause are matched.

Examples

Find modules that re-export from a deprecated package.

clojure
(export /legacy-lib/)

Selects in lines { 1 } but not in { 2, 3 }:

typescript
export { createStore } from "legacy-lib"
export { createStore } from "modern-lib"
export const version = 1

Locate all export statements before converting a module to default export only.

clojure
(export)

Selects in lines { 1, 2 } but not in { 3 }:

typescript
export const a = 1
export default function() {}
const local = 1

Audit star re-exports from a package during dependency cleanup.

clojure
(export "@company/ui")

Selects in lines { 1, 2 } but not in { 3 }:

typescript
export * from "@company/ui"
export { Button } from "@company/ui"
export * from "@company/icons"

Arguments

source

  1. Identifier: shorthand for (str)
  2. String: shorthand for (str)
  3. Pattern: shorthand for (str)
  4. (str)
  5. (:into)
  6. (:nearest)
  7. (:and)
  8. (:or)
  9. (:not)
  10. (:text)
  11. (:kind)
  12. (:replace)
  13. (:replace-in)
  14. (:capture)

Copyright © 2022-present Semantic Works, Inc.