@mui/internal-markdown 1.0.25 → 2.0.1

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.
@@ -1,8 +1,6 @@
1
1
  const importModuleRegexp =
2
2
  /^\s*import (?:["'\s]*(?:[\w*{}\n, ]+)from\s*)?["'\s]*([^"'{}$\s]+)["'\s].*/gm;
3
3
 
4
- function extractImports(code) {
4
+ export default function extractImports(code) {
5
5
  return (code.match(importModuleRegexp) || []).map((x) => x.replace(importModuleRegexp, '$1'));
6
6
  }
7
-
8
- module.exports = extractImports;
package/index.mjs ADDED
@@ -0,0 +1 @@
1
+ export { createRender, getHeaders, getTitle, renderMarkdown } from './parseMarkdown.mjs';
@@ -1,7 +1,7 @@
1
- const { promises: fs, readdirSync, statSync } = require('fs');
2
- const path = require('path');
3
- const prepareMarkdown = require('./prepareMarkdown');
4
- const extractImports = require('./extractImports');
1
+ import { promises as fs, readdirSync, statSync } from 'fs';
2
+ import path from 'path';
3
+ import prepareMarkdown from './prepareMarkdown.mjs';
4
+ import extractImports from './extractImports.mjs';
5
5
 
6
6
  const notEnglishMarkdownRegExp = /-([a-z]{2})\.md$/;
7
7
 
@@ -59,7 +59,7 @@ function findComponents(packages) {
59
59
  /**
60
60
  * @type {import('webpack').loader.Loader}
61
61
  */
62
- module.exports = async function demoLoader() {
62
+ export default async function demoLoader() {
63
63
  const englishFilepath = this.resourcePath;
64
64
  const options = this.getOptions();
65
65
 
@@ -636,4 +636,4 @@ ${Array.from(componentModuleIDs)
636
636
  `;
637
637
 
638
638
  return transformed;
639
- };
639
+ }
package/package.json CHANGED
@@ -1,14 +1,19 @@
1
1
  {
2
2
  "name": "@mui/internal-markdown",
3
- "version": "1.0.25",
3
+ "version": "2.0.1",
4
4
  "author": "MUI Team",
5
5
  "description": "MUI markdown parser. This is an internal package not meant for general use.",
6
- "main": "./index.js",
7
- "types": "./index.d.ts",
6
+ "main": "./index.mjs",
7
+ "browser": "./index.mjs",
8
+ "types": "./index.d.mts",
8
9
  "exports": {
9
- ".": "./index.js",
10
- "./loader": "./loader.js",
11
- "./prism": "./prism.js"
10
+ ".": "./index.mjs",
11
+ "./loader": "./loader.mjs",
12
+ "./prism": {
13
+ "types": "./prism.d.mts",
14
+ "require": "./prism.cjs",
15
+ "import": "./prism.mjs"
16
+ }
12
17
  },
13
18
  "repository": {
14
19
  "type": "git",
@@ -16,9 +21,9 @@
16
21
  "directory": "packages/markdown"
17
22
  },
18
23
  "dependencies": {
19
- "@babel/runtime": "^7.26.0",
24
+ "@babel/runtime": "^7.26.9",
20
25
  "lodash": "^4.17.21",
21
- "marked": "^15.0.6",
26
+ "marked": "^15.0.7",
22
27
  "prismjs": "^1.29.0"
23
28
  },
24
29
  "devDependencies": {
@@ -1,6 +1,6 @@
1
- const { marked } = require('marked');
2
- const textToHash = require('./textToHash');
3
- const prism = require('./prism');
1
+ import { marked } from 'marked';
2
+ import textToHash from './textToHash.mjs';
3
+ import prism from './prism.mjs';
4
4
 
5
5
  /**
6
6
  * Option used by `marked` the library parsing markdown.
@@ -486,7 +486,7 @@ function createRender(context) {
486
486
  return render;
487
487
  }
488
488
 
489
- module.exports = {
489
+ export {
490
490
  createRender,
491
491
  getContents,
492
492
  getDescription,
@@ -1,8 +1,8 @@
1
1
  /* eslint-disable no-irregular-whitespace */
2
- const fs = require('fs');
3
- const path = require('path');
4
- const kebabCase = require('lodash/kebabCase');
5
- const {
2
+ import fs from 'fs';
3
+ import path from 'path';
4
+ import kebabCase from 'lodash/kebabCase.js';
5
+ import {
6
6
  createRender,
7
7
  getContents,
8
8
  getDescription,
@@ -10,7 +10,7 @@ const {
10
10
  getFeatureList,
11
11
  getHeaders,
12
12
  getTitle,
13
- } = require('./parseMarkdown');
13
+ } from './parseMarkdown.mjs';
14
14
 
15
15
  const BaseUIReexportedComponents = ['ClickAwayListener', 'NoSsr', 'Portal', 'TextareaAutosize'];
16
16
 
@@ -267,4 +267,4 @@ ${headers.hooks
267
267
  return { docs };
268
268
  }
269
269
 
270
- module.exports = prepareMarkdown;
270
+ export default prepareMarkdown;
package/prism.mjs ADDED
@@ -0,0 +1,3 @@
1
+ import prism from './prism.cjs';
2
+
3
+ export default prism;
@@ -14,7 +14,7 @@ function makeUnique(hash, unique, i = 1) {
14
14
  * @param {Record<string, boolean>} [unique] - Ensures that each output is unique in `unique`
15
15
  * @returns {string} that is safe to use in fragment links
16
16
  */
17
- function textToHash(text, unique = {}) {
17
+ export default function textToHash(text, unique = {}) {
18
18
  return makeUnique(
19
19
  encodeURI(
20
20
  text
@@ -32,5 +32,3 @@ function textToHash(text, unique = {}) {
32
32
  unique,
33
33
  );
34
34
  }
35
-
36
- module.exports = textToHash;
package/index.js DELETED
@@ -1,3 +0,0 @@
1
- const { createRender, getHeaders, getTitle, renderMarkdown } = require('./parseMarkdown');
2
-
3
- module.exports = { createRender, getHeaders, getTitle, renderMarkdown };
File without changes
File without changes
File without changes