-
Notifications
You must be signed in to change notification settings - Fork 246
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(rosetta): hoist imports above fixtures (#2211)
When `import` statements are used in a code example, they must be hoisted at the top of the fixture (if any fixture is used), as they otherwise may occur at locations where such statements are illegal (they are only accepted at the top-level scope). Additionaly, added some (hidden) comments to highlight where the hoisted imports begin and end, as well as where the snipped code begins and ends in an attempt to make the "complete source code" a little easier to navigate, especially in the context of larger fixtures. --- By submitting this pull request, I confirm that my contribution is made under the terms of the [Apache 2.0 license]. [Apache 2.0 license]: https://www.apache.org/licenses/LICENSE-2.0
- Loading branch information
1 parent
f91505f
commit 66e2ac8
Showing
9 changed files
with
202 additions
and
53 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { Assembly, SchemaVersion } from '@jsii/spec'; | ||
|
||
export function fakeAssembly(parts: Partial<Assembly>): Assembly { | ||
return { | ||
schema: SchemaVersion.LATEST, | ||
name: 'test-assembly', | ||
description: 'A fake assembly used for tests', | ||
homepage: '', | ||
repository: { directory: '', type: '', url: '' }, | ||
author: { email: '', name: '', organization: false, roles: [], url: '' }, | ||
fingerprint: '<NONE>', | ||
version: '0.0.0-use.local', | ||
jsiiVersion: '0.0.0-use.local', | ||
license: 'UNLICENSED', | ||
...parts, | ||
}; | ||
} |
7 changes: 6 additions & 1 deletion
7
packages/jsii-rosetta/test/jsii/fixtures/rosetta/explicit.ts-fixture
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 |
---|---|---|
@@ -1,2 +1,7 @@ | ||
// This is a fixture | ||
/// here | ||
|
||
// This is a wrapper so that `import` statements are invalid if included in | ||
// the code example that'll be inlined at the `here` marker. | ||
(function () { | ||
/// here | ||
})() |
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