fix(javascript): centralize module syntax and separate erased type dependencies
This commit is contained in:
@@ -25,11 +25,18 @@ describe("native module syntax observations", () => {
|
||||
item.expression,
|
||||
);
|
||||
});
|
||||
it("excludes erased TypeScript imports/exports and bundler inference", () => {
|
||||
it("excludes whole type declarations and retains inline type dependency syntax", () => {
|
||||
const result = collectWebModuleImports(
|
||||
'import type {T} from "types"; import {type X} from "also-types"; export type {T} from "export-types"; export {type Y} from "only-types"; import {type T, value} from "mixed"; __webpack_require__.e(4); __vitePreload(() => 1, ["chunk.js"]);',
|
||||
);
|
||||
expect(result.imports.map((item) => item.specifier)).toEqual(["mixed"]);
|
||||
expect(result.imports.map((item) => item.specifier)).toEqual([
|
||||
"also-types",
|
||||
"only-types",
|
||||
"mixed",
|
||||
]);
|
||||
expect(result.diagnostics).toContain(
|
||||
"Compiler options are unavailable; inline type-only imports or re-exports may preserve a module side-effect dependency.",
|
||||
);
|
||||
});
|
||||
it("uses UTF-16 source locations after astral characters", () => {
|
||||
const source = 'const emoji = "😀";\nimport "./x.js";';
|
||||
|
||||
Reference in New Issue
Block a user