Skip to content

Correctly parse CLI arguments#3949

Merged
DmitrySharabin merged 1 commit intosimplifyfrom
fix-argv
May 29, 2025
Merged

Correctly parse CLI arguments#3949
DmitrySharabin merged 1 commit intosimplifyfrom
fix-argv

Conversation

@DmitrySharabin
Copy link
Member

@DmitrySharabin DmitrySharabin commented May 29, 2025

TIL we can test specified languages instead of all of them via CLI arguments, and it turned out it was broken after we updated packages. Now, it's fixed.

It makes testing so much easier 😅

@github-actions
Copy link

No JS Changes

Generated by 🚫 dangerJS against 07f0f9b

@DmitrySharabin DmitrySharabin requested a review from LeaVerou May 29, 2025 09:59
@DmitrySharabin DmitrySharabin merged commit 3935b1a into simplify May 29, 2025
2 checks passed
@DmitrySharabin DmitrySharabin deleted the fix-argv branch May 29, 2025 18:59
DmitrySharabin added a commit that referenced this pull request Jun 24, 2025
Was fixed in #3949 (in the `simplify` branch). Move it here to make testing easier.
DmitrySharabin added a commit that referenced this pull request Jun 24, 2025
Was fixed in #3949 (in the `simplify` branch). Move it here to make testing easier.
DmitrySharabin added a commit that referenced this pull request Jul 11, 2025
* Place plugin docs along with their source code (#3930)

* [autoloader] Fix script name in the docs

* [normalize-whitespace] Don't consider demo as a plugin

* Generate `file-sizes.json` during the build (#3946)

* Exclude plugins' `demo.js` files from type checking

* Fix path to the core entry point in `components.json`

* Move and rename themes (#3947)

- Move themes to the `src` folder and remove the `prism-` prefix
- Adjust the build process accordingly
- Adjust themes' metadata:
    - Remove broken links
    - Add/update authors' full names
    - Update GitHub handles
    - Use Markdown-style links
    - In `components.json`, fix theme ids and add Lea Verou as the owner to the prism, dark, and funky themes

* Update themes' docs (#3958)

So that they follow the structure (we can parse and use on the website):

```
/**
 * <title>
 *
 * <description>
 *
 * @author <name> (<GitHub_username>)
 */
```

Between the data chunks, there should be at least one empty line.

* Move `combineCallbacks` to its own module (#3963)

* Move the `Token` class under the `classes` folder

* Move all utils for working with iterables to a separate module

Remove unused utils

* Simplify hooks

* Move the `Prism` class, add Prism singleton

* Simplify the `Prism` class

Move to separate modules:
- `highlightAll()`
- `highlightElement()`
- `highlight()`
- `stringify()`

* Correctly parse CLI arguments (#3972)

Was fixed in #3949 (in the `simplify` branch). Move it here to make testing easier.

* Simplify the `Prism` class even more

- Move `tokenize()`, `_matchGrammar()` (and related code), and `resolve()` to separate modules.
- Ditch the `tokenize` symbol in favor of the `$tokenize` special property. Since symbols are excluded from the `for…in` loop, and `$tokenize` is not a symbol, to preserve the previous behavior, we need to handle it in `_matchGrammar` explicitly.
- Switch from `[tokenize]` to `$tokenize` in languages.

---
Co-authored-by: Dmitry Sharabin <dmitrysharabin@gmail.com>

* Ditch the `rest` symbol in favor of the `$rest` special property

* Move language utils to `util/` and separate them out

* Remove known plugins + type safety

* Move `documentReady` to async utils

* Make the global bundle of Prism v2 work the same way as Prism v1 does

Now, the user can include Prism the way they used to (except v2 now uses the Autoloader plugin under the hood, so more languages can be highlighted right out of the box):

```html
<link rel="stylesheet" href="themes/prism.css" />
<script src="prism.js"></script>
```

Besides, they have access to the Prism instance via `globalThis`.

* Move Prism config to a separate file and fix the build options of the global bundle

Co-Authored-By: Dmitry Sharabin <dmitrysharabin@gmail.com>

* Fix some code after merging

---------

Co-authored-by: Lea Verou <lea@verou.me>
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