@shikijs/core 3.9.2 → 3.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.mjs +22 -1
  2. package/package.json +2 -2
package/dist/index.mjs CHANGED
@@ -475,11 +475,32 @@ const builtInTransformers = [
475
475
  /* @__PURE__ */ transformerDecorations()
476
476
  ];
477
477
  function getTransformers(options) {
478
+ const transformers = sortTransformersByEnforcement(options.transformers || []);
478
479
  return [
479
- ...options.transformers || [],
480
+ ...transformers.pre,
481
+ ...transformers.normal,
482
+ ...transformers.post,
480
483
  ...builtInTransformers
481
484
  ];
482
485
  }
486
+ function sortTransformersByEnforcement(transformers) {
487
+ const pre = [];
488
+ const post = [];
489
+ const normal = [];
490
+ for (const transformer of transformers) {
491
+ switch (transformer.enforce) {
492
+ case "pre":
493
+ pre.push(transformer);
494
+ break;
495
+ case "post":
496
+ post.push(transformer);
497
+ break;
498
+ default:
499
+ normal.push(transformer);
500
+ }
501
+ }
502
+ return { pre, post, normal };
503
+ }
483
504
 
484
505
  // src/colors.ts
485
506
  var namedColors = [
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@shikijs/core",
3
3
  "type": "module",
4
- "version": "3.9.2",
4
+ "version": "3.11.0",
5
5
  "description": "Core of Shiki",
6
6
  "author": "Pine Wu <octref@gmail.com>; Anthony Fu <anthonyfu117@hotmail.com>",
7
7
  "license": "MIT",
@@ -39,7 +39,7 @@
39
39
  "@shikijs/vscode-textmate": "^10.0.2",
40
40
  "@types/hast": "^3.0.4",
41
41
  "hast-util-to-html": "^9.0.5",
42
- "@shikijs/types": "3.9.2"
42
+ "@shikijs/types": "3.11.0"
43
43
  },
44
44
  "scripts": {
45
45
  "build": "unbuild",