Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat; KTL-1138: add method to generate a link to the playground #192

Merged
merged 3 commits into from
Nov 1, 2023

Conversation

zoobestik
Copy link
Contributor

@zoobestik zoobestik commented Oct 12, 2023

import { generateCrosslink } from 'kotlin-playground/dist/crosslink';

const link1 = generateCrosslink('println("Hello!")');
// or
const link2 = generateCrosslink('println("Hello!")', {
    targetPlatform: 'JAVA',
    compilerVersion: '1.5.21',
});

@zoobestik zoobestik force-pushed the ktl-1138-generate-link branch 2 times, most recently from 347a7e5 to c7562a8 Compare October 12, 2023 19:21
/**
* Use instead of @escape-string-regexp
*/
export function escapeRegExp(str) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved to separated file, cause tree shaking isn't working. 😞

@zoobestik zoobestik requested review from krutilov and nikpachoo and removed request for krutilov October 16, 2023 15:16
const output = decodeURIComponent(link.substring(prefix.length));
const payload = JSON.parse(decompressFromBase64(output));

expect(payload).toEqual(expected);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So great to see this test here 👏 👏 👏

@zoobestik zoobestik merged commit 857cc77 into master Nov 1, 2023
2 checks passed
@zoobestik zoobestik deleted the ktl-1138-generate-link branch November 1, 2023 11:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants