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: use ember-shiki in dummy app #404

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
"ember-perf-timeline": "^2.0.0",
"ember-qunit": "^7.0.0",
"ember-resolver": "^11.0.1",
"ember-shiki": "^0.3.0",
"ember-source": "~5.2.0",
"ember-source-channel-url": "^3.0.0",
"ember-template-lint": "^5.11.2",
Expand Down
7 changes: 4 additions & 3 deletions tests/dummy/app/components/code-snippet.hbs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<pre><code>
{{~ this.snippet ~}}
</code></pre>
<CodeBlock
@code={{this.snippet}}
@language={{this.language}}
/>
10 changes: 9 additions & 1 deletion tests/dummy/app/components/code-snippet.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@ import snippets from '../snippets';

export default class extends Component {
get snippet() {
return snippets[this.args.name]?.content;
const snippet = snippets[this.args.name]?.content.split('\n');
const indentAmount = snippet[0].length - snippet[0].trimStart().length;

return snippet.map((line) => line.substring(indentAmount)).join('\n');
}

get language() {
const filenameParts = snippets[this.args.name]?.source.split('.');
return filenameParts[filenameParts.length - 1];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
@estimateHeight={{40}}
@containerSelector="body" as |item index|
>
<NumberSlide @isDynamic={{true}} @item={{item}} @index={{index}} />
<NumberSlide @isDynamic={{true}} @item={{item}} @index={{index}} />
</VerticalCollection>
{{! END-SNIPPET }}
</div>
Expand Down
9 changes: 9 additions & 0 deletions tests/dummy/app/styles/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -218,3 +218,12 @@ img.auto-size {
vertical-item {
display: block;
}

pre {
--ember-shiki-font-size: 12px;

/* Override Bootstrap defaults */
border: 0;
background-color: transparent;
padding: 0;
}
5 changes: 4 additions & 1 deletion tests/dummy/config/environment.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ module.exports = function (environment) {
APP: {
// Here you can pass flags/options to your application instance
// when it is created
}
},
'ember-shiki': {
defaultThemes: ['github-dark'],
},
};

// debugging
Expand Down
107 changes: 102 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1044,7 +1044,7 @@
debug "^4.1.0"
globals "^11.1.0"

"@babel/types@^7.22.15", "@babel/types@^7.22.17", "@babel/types@^7.22.5", "@babel/types@^7.4.4", "@babel/types@^7.7.2":
"@babel/types@^7.12.13", "@babel/types@^7.22.15", "@babel/types@^7.22.17", "@babel/types@^7.22.5", "@babel/types@^7.4.4", "@babel/types@^7.7.2":
version "7.22.17"
resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.22.17.tgz#f753352c4610ffddf9c8bc6823f9ff03e2303eee"
integrity sha512-YSQPHLFtQNE5xN9tHuZnzu8vPr61wVTBZdfv1meex1NBosa4iT05k/Jw06ddJugi4bk7The/oSwQGFcksmEJQg==
Expand Down Expand Up @@ -1273,6 +1273,15 @@
ember-cli-version-checker "^5.1.2"
semver "^7.3.5"

"@embroider/addon-shim@^1.8.4", "@embroider/addon-shim@^1.8.6":
version "1.8.6"
resolved "https://registry.yarnpkg.com/@embroider/addon-shim/-/addon-shim-1.8.6.tgz#b676991b4fa32c3a98dc7db7dc6cd655029c3f09"
integrity sha512-siC9kP78uucEbpDcVyxjkwa76pcs5rVzDVpWO4PDc9EAXRX+pzmUuSTLAK3GztUwx7/PWhz1BenAivqdSvSgfg==
dependencies:
"@embroider/shared-internals" "^2.2.3"
broccoli-funnel "^3.0.8"
semver "^7.3.8"

"@embroider/macros@^1.0.0", "@embroider/macros@^1.10.0", "@embroider/macros@^1.8.3":
version "1.13.1"
resolved "https://registry.yarnpkg.com/@embroider/macros/-/macros-1.13.1.tgz#aee17e5af0e0086bd36873bdb4e49ea346bab3fa"
Expand All @@ -1287,7 +1296,7 @@
resolve "^1.20.0"
semver "^7.3.2"

"@embroider/[email protected]", "@embroider/shared-internals@^2.0.0":
"@embroider/[email protected]", "@embroider/shared-internals@^2.0.0", "@embroider/shared-internals@^2.2.3":
version "2.4.0"
resolved "https://registry.yarnpkg.com/@embroider/shared-internals/-/shared-internals-2.4.0.tgz#0e9fdb0b2df9bad45fab8c54cbb70d8a2cbf01fc"
integrity sha512-pFE05ebenWMC9XAPRjadYCXXb6VmqjkhYN5uqkhPo+VUmMHnx7sZYYxqGjxfVuhC/ghS/BNlOffOCXDOoE7k7g==
Expand Down Expand Up @@ -2422,6 +2431,11 @@ ansi-regex@^5.0.1:
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304"
integrity sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==

ansi-sequence-parser@^1.1.0:
version "1.1.1"
resolved "https://registry.yarnpkg.com/ansi-sequence-parser/-/ansi-sequence-parser-1.1.1.tgz#e0aa1cdcbc8f8bb0b5bca625aac41f5f056973cf"
integrity sha512-vJXt3yiaUL4UU546s3rPXlsry/RnM730G1+HkpKE012AN0sx1eOrxSu95oKDIonskeLTijMgqWZ3uDEe3NFvyg==

ansi-styles@^3.0.0, ansi-styles@^3.2.0, ansi-styles@^3.2.1:
version "3.2.1"
resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d"
Expand All @@ -2436,7 +2450,7 @@ ansi-styles@^4.0.0, ansi-styles@^4.1.0:
dependencies:
color-convert "^2.0.1"

ansi-to-html@^0.6.6:
ansi-to-html@^0.6.15, ansi-to-html@^0.6.6:
version "0.6.15"
resolved "https://registry.yarnpkg.com/ansi-to-html/-/ansi-to-html-0.6.15.tgz#ac6ad4798a00f6aa045535d7f6a9cb9294eebea7"
integrity sha512-28ijx2aHJGdzbs+O5SNQF65r6rrKYnkuwTYm8lZlChuoJ9P1vVzIpWO20sQTqTPDXYp6NFwk326vApTtLVFXpQ==
Expand Down Expand Up @@ -4777,6 +4791,22 @@ ember-cli-typescript@^2.0.2:
stagehand "^1.0.0"
walk-sync "^1.0.0"

ember-cli-typescript@^5.0.0:
version "5.2.1"
resolved "https://registry.yarnpkg.com/ember-cli-typescript/-/ember-cli-typescript-5.2.1.tgz#553030f1ce3e8958b8e4fc34909acd1218cb35f2"
integrity sha512-qqp5TAIuPHxHiGXJKL+78Euyhy0zSKQMovPh8sJpN/ZBYx0H90pONufHR3anaMcp1snVfx4B+mb9+7ijOik8ZA==
dependencies:
ansi-to-html "^0.6.15"
broccoli-stew "^3.0.0"
debug "^4.0.0"
execa "^4.0.0"
fs-extra "^9.0.1"
resolve "^1.5.0"
rsvp "^4.8.1"
semver "^7.3.2"
stagehand "^1.0.0"
walk-sync "^2.2.0"

ember-cli-version-checker@^2.1.0:
version "2.2.0"
resolved "https://registry.yarnpkg.com/ember-cli-version-checker/-/ember-cli-version-checker-2.2.0.tgz#47771b731fe0962705e27c8199a9e3825709f3b3"
Expand Down Expand Up @@ -4904,7 +4934,7 @@ ember-cli@~5.2.0:
workerpool "^6.4.0"
yam "^1.0.0"

ember-compatibility-helpers@^1.1.2, ember-compatibility-helpers@^1.2.1:
ember-compatibility-helpers@^1.1.2, ember-compatibility-helpers@^1.2.0, ember-compatibility-helpers@^1.2.1:
version "1.2.6"
resolved "https://registry.yarnpkg.com/ember-compatibility-helpers/-/ember-compatibility-helpers-1.2.6.tgz#603579ab2fb14be567ef944da3fc2d355f779cd8"
integrity sha512-2UBUa5SAuPg8/kRVaiOfTwlXdeVweal1zdNPibwItrhR0IvPrXpaqwJDlEZnWKEoB+h33V0JIfiWleSG6hGkkA==
Expand All @@ -4915,6 +4945,19 @@ ember-compatibility-helpers@^1.1.2, ember-compatibility-helpers@^1.2.1:
fs-extra "^9.1.0"
semver "^5.4.1"

ember-concurrency@^3.1.1:
version "3.1.1"
resolved "https://registry.yarnpkg.com/ember-concurrency/-/ember-concurrency-3.1.1.tgz#7f55ba4bfa4f42cfb23f8cb70aa3c6ef224e9500"
integrity sha512-doXFYYfy1C7jez+jDDlfahTp03QdjXeSY/W3Zbnx/q3UNJ9g10Shf2d7M/HvWo/TC22eU+6dPLIpqd/6q4pR+Q==
dependencies:
"@babel/helper-plugin-utils" "^7.12.13"
"@babel/types" "^7.12.13"
"@glimmer/tracking" "^1.1.2"
ember-cli-babel "^7.26.11"
ember-cli-babel-plugin-helpers "^1.1.1"
ember-cli-htmlbars "^6.2.0"
ember-compatibility-helpers "^1.2.0"

ember-data@~4.12.0:
version "4.12.3"
resolved "https://registry.yarnpkg.com/ember-data/-/ember-data-4.12.3.tgz#9e4b4ac00a552f411cf96702a3076dd568f188c1"
Expand Down Expand Up @@ -4944,6 +4987,15 @@ ember-env-macros@^0.3.1:
resolved "https://registry.yarnpkg.com/ember-env-macros/-/ember-env-macros-0.3.2.tgz#2e0d1e7e5c2c5fffaebd335871f39055e170fc03"
integrity sha512-cLG5zAiLJtGkDxxupYQRqee+KQwTp/3kHhaz07l3GvnNBCnKsttKJdpU9d9evoDzDL7sfnuW2a7xn62I8HAJSw==

ember-functions-as-helper-polyfill@^2.1.2:
version "2.1.2"
resolved "https://registry.yarnpkg.com/ember-functions-as-helper-polyfill/-/ember-functions-as-helper-polyfill-2.1.2.tgz#5f7a7c7f87b87d4df785c53d1ee0810693c89b6b"
integrity sha512-yvW6xykvZEIYzzwlrC/g9yu6LtLkkj5F+ho6U+BDxN1uREMgoMOZnji7sSILn5ITVpaJ055DPcO+utEFD7IZOA==
dependencies:
ember-cli-babel "^7.26.11"
ember-cli-typescript "^5.0.0"
ember-cli-version-checker "^5.1.2"

ember-inflector@^4.0.2:
version "4.0.2"
resolved "https://registry.yarnpkg.com/ember-inflector/-/ember-inflector-4.0.2.tgz#4494f1a5f61c1aca7702d59d54024cc92211d8ec"
Expand All @@ -4959,6 +5011,15 @@ ember-load-initializers@^2.1.2:
ember-cli-babel "^7.13.0"
ember-cli-typescript "^2.0.2"

ember-modifier@^4.1.0:
version "4.1.0"
resolved "https://registry.yarnpkg.com/ember-modifier/-/ember-modifier-4.1.0.tgz#cb91efbf8ca4ff4a1a859767afa42dddba5a2bbd"
integrity sha512-YFCNpEYj6jdyy3EjslRb2ehNiDvaOrXTilR9+ngq+iUqSHYto2zKV0rleiA1XJQ27ELM1q8RihT29U6Lq5EyqQ==
dependencies:
"@embroider/addon-shim" "^1.8.4"
ember-cli-normalize-entity-name "^1.0.0"
ember-cli-string-utils "^1.1.0"

ember-perf-timeline@^2.0.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/ember-perf-timeline/-/ember-perf-timeline-2.1.0.tgz#9eea6786ee018c94cac1cfd960b41cd0a383af55"
Expand Down Expand Up @@ -5010,6 +5071,17 @@ ember-router-generator@^2.0.0:
"@babel/traverse" "^7.4.5"
recast "^0.18.1"

ember-shiki@^0.3.0:
version "0.3.0"
resolved "https://registry.yarnpkg.com/ember-shiki/-/ember-shiki-0.3.0.tgz#57a92d0c397ef5261c11e99b39337b1cd1a9a46b"
integrity sha512-rX61cltjBtQqxJlWyj61CE/y10wrrzukHACRGPLd4NbNQH2hqrrjT3nBf5uYAOZK6SnEd4eI+QZvpqIXKQyWwA==
dependencies:
"@embroider/addon-shim" "^1.8.6"
ember-concurrency "^3.1.1"
ember-functions-as-helper-polyfill "^2.1.2"
ember-modifier "^4.1.0"
shiki "^0.14.3"

ember-source-channel-url@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/ember-source-channel-url/-/ember-source-channel-url-3.0.0.tgz#bcd5be72c63fa0b8c390b3121783b462063e2a1b"
Expand Down Expand Up @@ -6243,7 +6315,7 @@ fs-extra@^8.0.0, fs-extra@^8.0.1, fs-extra@^8.1.0:
jsonfile "^4.0.0"
universalify "^0.1.0"

fs-extra@^9.1.0:
fs-extra@^9.0.1, fs-extra@^9.1.0:
version "9.1.0"
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-9.1.0.tgz#5954460c764a8da2094ba3554bf839e6b9a7c86d"
integrity sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==
Expand Down Expand Up @@ -7778,6 +7850,11 @@ json5@^2.1.1, json5@^2.1.2, json5@^2.2.3:
resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.3.tgz#78cd6f1a19bdc12b73db5ad0c61efd66c1e29283"
integrity sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==

jsonc-parser@^3.2.0:
version "3.2.0"
resolved "https://registry.yarnpkg.com/jsonc-parser/-/jsonc-parser-3.2.0.tgz#31ff3f4c2b9793f89c67212627c51c6394f88e76"
integrity sha512-gfFQZrcTc8CnKXp6Y4/CBT3fTc0OVuDofpre4aEeEpSBPV5X5v4+Vmx+8snU7RLPrNHPKSgLxGo9YuQzz20o+w==

jsonfile@^2.1.0:
version "2.4.0"
resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-2.4.0.tgz#3736a2b428b87bbda0cc83b53fa3d633a35c2ae8"
Expand Down Expand Up @@ -10578,6 +10655,16 @@ shellwords@^0.1.1:
resolved "https://registry.yarnpkg.com/shellwords/-/shellwords-0.1.1.tgz#d6b9181c1a48d397324c84871efbcfc73fc0654b"
integrity sha512-vFwSUfQvqybiICwZY5+DAWIPLKsWO31Q91JSKl3UYv+K5c2QRPzn0qzec6QPu1Qc9eHYItiP3NdJqNVqetYAww==

shiki@^0.14.3:
version "0.14.4"
resolved "https://registry.yarnpkg.com/shiki/-/shiki-0.14.4.tgz#2454969b466a5f75067d0f2fa0d7426d32881b20"
integrity sha512-IXCRip2IQzKwxArNNq1S+On4KPML3Yyn8Zzs/xRgcgOWIr8ntIK3IKzjFPfjy/7kt9ZMjc+FItfqHRBg8b6tNQ==
dependencies:
ansi-sequence-parser "^1.1.0"
jsonc-parser "^3.2.0"
vscode-oniguruma "^1.7.0"
vscode-textmate "^8.0.0"

side-channel@^1.0.4:
version "1.0.4"
resolved "https://registry.yarnpkg.com/side-channel/-/side-channel-1.0.4.tgz#efce5c8fdc104ee751b25c58d4290011fa5ea2cf"
Expand Down Expand Up @@ -11865,6 +11952,16 @@ vm2@^3.9.17:
acorn "^8.7.0"
acorn-walk "^8.2.0"

vscode-oniguruma@^1.7.0:
version "1.7.0"
resolved "https://registry.yarnpkg.com/vscode-oniguruma/-/vscode-oniguruma-1.7.0.tgz#439bfad8fe71abd7798338d1cd3dc53a8beea94b"
integrity sha512-L9WMGRfrjOhgHSdOYgCt/yRMsXzLDJSL7BPrOZt73gU0iWO4mpqzqQzOz5srxqTvMBaR0XZTSrVWo4j55Rc6cA==

vscode-textmate@^8.0.0:
version "8.0.0"
resolved "https://registry.yarnpkg.com/vscode-textmate/-/vscode-textmate-8.0.0.tgz#2c7a3b1163ef0441097e0b5d6389cd5504b59e5d"
integrity sha512-AFbieoL7a5LMqcnOF04ji+rpXadgOXnZsxQr//r83kLPr7biP7am3g9zbaZIaBGwBRWeSvoMD4mgPdX3e4NWBg==

walk-sync@^0.2.5:
version "0.2.7"
resolved "https://registry.yarnpkg.com/walk-sync/-/walk-sync-0.2.7.tgz#b49be4ee6867657aeb736978b56a29d10fa39969"
Expand Down
Loading