| 1 | import type { NodePathscip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath# } from "@babel/traverse"scip-typescript npm @babel/traverse 7.20.13 src/`index.ts`/; |
| 2 | import type * as tscip-typescript npm @babel/types 7.20.7 src/`index.ts`/ from "@babel/types"scip-typescript npm @babel/types 7.20.7 src/`index.ts`/; |
| 3 | |
| 4 | /** |
| 5 | * A small utility to check if a file qualifies as a module. |
| 6 | */ |
| 7 | export default function isModulescip-typescript npm @babel/helper-module-imports 7.18.6 src/`is-module.ts`/isModule().(pathscip-typescript npm @babel/helper-module-imports 7.18.6 src/`is-module.ts`/isModule().(path): NodePathscip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath#<tscip-typescript npm @babel/types 7.20.7 src/`index.ts`/.Programscip-typescript npm @babel/types 7.20.7 src/ast-types/generated/`index.ts`/Program#>) { |
| 8 | const { sourceTypescip-typescript npm @babel/types 7.20.7 src/ast-types/generated/`index.ts`/Program#sourceType. } = pathscip-typescript npm @babel/helper-module-imports 7.18.6 src/`is-module.ts`/isModule().(path).nodescip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath#node.; |
| 9 | if (sourceType !== "module" && sourceType !== "script") { |
| 10 | throw pathscip-typescript npm @babel/helper-module-imports 7.18.6 src/`is-module.ts`/isModule().(path).buildCodeFrameErrorscip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath#buildCodeFrameError().( |
| 11 | `Unknown sourceType "${sourceType}", cannot transform.`, |
| 12 | ); |
| 13 | } |
| 14 | |
| 15 | return pathscip-typescript npm @babel/helper-module-imports 7.18.6 src/`is-module.ts`/isModule().(path).nodescip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath#node..sourceTypescip-typescript npm @babel/types 7.20.7 src/ast-types/generated/`index.ts`/Program#sourceType. === "module"; |
| 16 | } |