-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GH-2595: The d.ts export should append .js file extensions in import …
…statements (#2598) * d.ts exports emit type imports including file extension * respect existing file extension * add test * fix fileExtension() * fix xt framework * respect bare imports * add test
- Loading branch information
mmews-n4
authored
Jan 23, 2024
1 parent
fa8bd23
commit 3d420f1
Showing
19 changed files
with
155 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
tests/org.eclipse.n4js.spec.tests/xt-tests/dts-export/imports/BareImport.n4js.xt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* Copyright (c) 2021 NumberFour AG. | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
* | ||
* Contributors: | ||
* NumberFour AG - Initial API and implementation | ||
*/ | ||
|
||
/* XPECT_SETUP org.eclipse.n4js.spec.tests.SpecXtTest | ||
Workspace { | ||
Project "TestProject" { | ||
Folder "src" { | ||
ThisFile {} | ||
File "BareImportMe.js" { } | ||
} | ||
} | ||
} | ||
File "BareImportMe.js" { | ||
export public class CP {} | ||
} | ||
GENERATE_DTS | ||
END_SETUP */ | ||
|
||
|
||
|
||
import "BareImportMe"; | ||
|
||
|
||
|
||
/* XPECT generated_dts --- | ||
import './BareImportMe.js' | ||
--- */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 70 additions & 0 deletions
70
tests/org.eclipse.n4js.spec.tests/xt-tests/dts-export/imports/ImportWithExtension.n4js.xt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
/* | ||
* Copyright (c) 2021 NumberFour AG. | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
* | ||
* Contributors: | ||
* NumberFour AG - Initial API and implementation | ||
*/ | ||
|
||
/* XPECT_SETUP org.eclipse.n4js.spec.tests.SpecXtTest | ||
Workspace { | ||
Project "TestProject" { | ||
Folder "src" { | ||
ThisFile {} | ||
} | ||
DEPENDS_ON "ImportMe" | ||
} | ||
Project "ImportMe" { | ||
Folder "src" { | ||
File "index.n4js" { } | ||
} | ||
File "package.json" {} | ||
} | ||
} | ||
File "index.n4js" { | ||
export public class CP {} | ||
} | ||
File "package.json" { | ||
{ | ||
"name": "ImportMe", | ||
"version": "1.0.0", | ||
"type": "module", | ||
"types": "src-gen/index.d.ts", | ||
"scripts": {}, | ||
"n4js": { | ||
"vendorId": "VENDOR", | ||
"vendorName": "VENDOR_NAME", | ||
"projectType": "library", | ||
"output": "src-gen", | ||
"generator": { "d.ts": true }, | ||
"sources": { | ||
"source": ["./src"] | ||
} | ||
}, | ||
"dependencies": { | ||
"n4js-runtime": "" | ||
} | ||
} | ||
} | ||
GENERATE_DTS | ||
END_SETUP */ | ||
|
||
|
||
import * as TS from "ImportMe"; | ||
|
||
export public class CPX extends TS.CP {} | ||
|
||
|
||
/* XPECT generated_dts --- | ||
import type * as TS from 'ImportMe' | ||
export class CPX extends TS.CP {} | ||
--- */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters