-
-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
It seems like the v2 branch doesn't have those files (and I don't see if they are generated either). So, before the launch, we need to fix the code where we use them:
Line 7 in b260bfb
| import components from "prismjs/components.json" with { type: "json" }; |
Line 7 in b260bfb
| let components = await (await fetch("https://dev.prismjs.com/components.json")).json(); |
Line 7 in b260bfb
| let components = await (await fetch("https://dev.prismjs.com/components.json")).json(); |
website/assets/theme-switcher.js
Line 1 in b260bfb
| let components = await (await fetch("https://dev.prismjs.com/components.json")).json(); |
Lines 111 to 121 in b260bfb
| components.json (25 kB) | |
| | local 5.45ms ± 13% 138smp | |
| | PrismJS@master 4.92ms ± 2% 145smp | |
| | RunDevelopment@greedy-fix 5.62ms ± 4% 128smp | |
| package-lock.json (189 kB) | |
| | local 117.75ms ± 27% 27smp | |
| | PrismJS@master 121.40ms ± 32% 29smp | |
| | RunDevelopment@greedy-fix 190.79ms ± 41% 20smp | |
| ``` | |
| A case starts with its key (here `json`) and is followed by all of its files (here `components.json` and `package-lock.json`). Under each file, the results for local and all remotes are shown. To explain the meaning of the values, let's pick a single line: |
Line 44 in b260bfb
| **All language names must match the names from the definition in `components.json`.** |
Line 397 in b260bfb
| 2. Edit [`components.json`](https://github.com/PrismJS/prism/blob/master/components.json) to register the new language by adding it to the `languages` object. (Please note that all language entries are sorted alphabetically by title.) |
Line 409 in b260bfb
| _Note:_ Any changes made to `components.json` require a rebuild (see step 3). |
Line 415 in b260bfb
| _Note:_ You have to reload the test page to apply changes made to `prism-foo-bar.js` but you don't have to rebuild Prism itself. However, if you change `components.json` (e.g. because you added a dependency) then these changes will not show up on the test page until you rebuild Prism. |
Line 433 in b260bfb
| Aliases also have to be registered in `components.json` by adding the `alias` property to the language entry. In this example, the updated entry will look like this: |
Line 519 in b260bfb
| You declare a dependency by adding a property to the entry of your language or plugin in the [`components.json`](https://github.com/PrismJS/prism/blob/master/components.json) file. The name of the property will be dependency kind and its value will be the component id of the dependee. If multiple languages or plugins are depended upon then you can also declare an array of component ids. |
Metadata
Metadata
Assignees
Labels
No labels