Просмотр исходного кода

Merge pull request #8951 from weseek/148445-148447-upgrade-remark-growi-directive

imprv: Upgrade unified
Yuki Takei 1 год назад
Родитель
Сommit
e30bfa613c

+ 8 - 0
apps/app/next.config.js

@@ -48,6 +48,14 @@ const getTranspilePackages = () => {
     'emoticon',
     'direction', // for hast-util-select
     'bcp-47-match', // for hast-util-select
+    'parse-entities',
+    'character-reference-invalid',
+    'is-hexadecimal',
+    'is-alphabetical',
+    'is-alphanumerical',
+    'github-slugger',
+    'html-url-attributes',
+    'estree-util-is-identifier-name',
     ...listPrefixedPackages(['remark-', 'rehype-', 'hast-', 'mdast-', 'micromark-', 'unist-']),
   ];
 

+ 14 - 14
apps/app/package.json

@@ -121,7 +121,7 @@
     "extensible-custom-error": "^0.0.7",
     "form-data": "^4.0.0",
     "graceful-fs": "^4.1.11",
-    "hast-util-select": "^5.0.5",
+    "hast-util-select": "^6.0.2",
     "helmet": "^4.6.0",
     "http-errors": "^2.0.0",
     "i18next": "^23.10.1",
@@ -171,7 +171,7 @@
     "react-error-boundary": "^3.1.4",
     "react-i18next": "^14.1.0",
     "react-image-crop": "^8.3.0",
-    "react-markdown": "^8.0.7",
+    "react-markdown": "^9.0.1",
     "react-multiline-clamp": "^2.0.0",
     "react-scroll": "^1.8.7",
     "react-stickynode": "^4.1.1",
@@ -180,18 +180,18 @@
     "reactstrap": "^9.2.2",
     "reconnecting-websocket": "^4.4.0",
     "redis": "^3.0.2",
-    "rehype-katex": "^6.0.2",
-    "rehype-raw": "^6.1.1",
-    "rehype-sanitize": "^5.0.1",
-    "rehype-slug": "^5.0.1",
+    "rehype-katex": "^7.0.0",
+    "rehype-raw": "^7.0.0",
+    "rehype-sanitize": "^6.0.0",
+    "rehype-slug": "^6.0.0",
     "rehype-toc": "^3.0.2",
-    "remark-breaks": "^3.0.2",
-    "remark-emoji": "^3.0.2",
-    "remark-frontmatter": "^4.0.1",
-    "remark-gfm": "^3.0.1",
-    "remark-math": "^5.1.1",
-    "remark-toc": "^8.0.1",
-    "remark-wiki-link": "^1.0.4",
+    "remark-breaks": "^4.0.0",
+    "remark-emoji": "^5.0.0",
+    "remark-frontmatter": "^5.0.0",
+    "remark-gfm": "^4.0.0",
+    "remark-math": "^6.0.0",
+    "remark-toc": "^9.0.0",
+    "remark-wiki-link": "^2.0.1",
     "sanitize-filename": "^1.6.3",
     "socket.io": "^4.7.5",
     "stream-to-promise": "^3.0.0",
@@ -273,7 +273,7 @@
     "react-hotkeys": "^2.0.0",
     "react-input-autosize": "^3.0.0",
     "react-toastify": "^9.1.3",
-    "rehype-rewrite": "^3.0.6",
+    "rehype-rewrite": "^4.0.2",
     "replacestream": "^4.0.3",
     "sass": "^1.53.0",
     "simple-load-script": "^1.0.2",

+ 12 - 12
packages/presentation/package.json

@@ -46,19 +46,19 @@
     "@marp-team/marpit": "^2.6.1",
     "@types/reveal.js": "^4.4.1",
     "eslint-plugin-regex": "^1.8.0",
-    "hast-util-sanitize": "^4.1.0",
-    "hast-util-select": "^5.0.5",
-    "mdast-util-frontmatter": "^1.0.0",
-    "mdast-util-gfm": "^2.0.1",
-    "mdast-util-to-markdown": "^1.3.0",
-    "react-markdown": "^8.0.7",
-    "remark-frontmatter": "^4.0.1",
-    "remark-parse": "^10.0.0",
-    "remark-stringify": "^10.0.0",
+    "hast-util-sanitize": "^5.0.1",
+    "hast-util-select": "^6.0.2",
+    "mdast-util-frontmatter": "^2.0.1",
+    "mdast-util-gfm": "^3.0.0",
+    "mdast-util-to-markdown": "^2.1.0",
+    "react-markdown": "^9.0.1",
+    "remark-frontmatter": "^5.0.0",
+    "remark-parse": "^11.0.0",
+    "remark-stringify": "^11.0.0",
     "reveal.js": "^4.4.0",
-    "unified": "^10.1.2",
-    "unist-util-find-after": "^4.0.0",
-    "unist-util-visit": "^4.0.0"
+    "unified": "^11.0.0",
+    "unist-util-find-after": "^5.0.0",
+    "unist-util-visit": "^5.0.0"
   },
   "peerDependencies": {
     "next": "^14",

+ 1 - 1
packages/presentation/src/client/components/GrowiSlides.tsx

@@ -1,5 +1,5 @@
 import Head from 'next/head';
-import { ReactMarkdown } from 'react-markdown/lib/react-markdown';
+import ReactMarkdown from 'react-markdown';
 
 import type { PresentationOptions } from '../consts';
 import { MARP_CONTAINER_CLASS_NAME, presentationMarpit, slideMarpit } from '../services/growi-marpit';

+ 4 - 4
packages/remark-attachment-refs/package.json

@@ -49,7 +49,7 @@
     "@growi/ui": "link:../ui",
     "axios": "^0.24.0",
     "bunyan": "^1.8.15",
-    "hast-util-select": "^5.0.5",
+    "hast-util-select": "^6.0.2",
     "mongoose": "^6.11.3",
     "swr": "^2.0.3",
     "universal-bunyan": "^0.9.2"
@@ -57,11 +57,11 @@
   "devDependencies": {
     "csstype": "^3.0.2",
     "eslint-plugin-regex": "^1.8.0",
-    "hast-util-sanitize": "^4.1.0",
+    "hast-util-sanitize": "^5.0.1",
     "hast-util-select": "^5.0.5",
     "npm-run-all": "^4.1.5",
-    "unified": "^10.1.2",
-    "unist-util-visit": "^4.0.0"
+    "unified": "^11.0.0",
+    "unist-util-visit": "^5.0.0"
   },
   "peerDependencies": {
     "react": "^18.2.0",

+ 3 - 3
packages/remark-drawio/package.json

@@ -33,11 +33,11 @@
   "dependencies": {},
   "devDependencies": {
     "eslint-plugin-regex": "^1.8.0",
-    "hast-util-sanitize": "^4.1.0",
+    "hast-util-sanitize": "^5.0.1",
     "pako": "^2.1.0",
     "throttle-debounce": "^5.0.0",
-    "unified": "^10.1.2",
-    "unist-util-visit": "^4.0.0"
+    "unified": "^11.0.0",
+    "unist-util-visit": "^5.0.0"
   },
   "peerDependencies": {
     "react": "^18.2.0",

+ 15 - 15
packages/remark-growi-directive/package.json

@@ -28,33 +28,33 @@
     "lint:fix": "yarn eslint \"**/*.{cjs, js,jsx,ts,tsx}\" --fix"
   },
   "dependencies": {
-    "@types/mdast": "^3.0.0",
-    "@types/unist": "^2.0.0",
-    "mdast-util-to-markdown": "^1.3.0",
-    "micromark-factory-space": "^1.0.0",
-    "micromark-factory-whitespace": "^1.0.0",
-    "micromark-util-character": "^1.0.0",
-    "micromark-util-symbol": "^1.0.0",
-    "micromark-util-types": "^1.0.0",
+    "@types/mdast": "^4.0.0",
+    "@types/unist": "^3.0.0",
+    "mdast-util-to-markdown": "^2.1.0",
+    "micromark-factory-space": "^2.0.0",
+    "micromark-factory-whitespace": "^2.0.0",
+    "micromark-util-character": "^2.1.0",
+    "micromark-util-symbol": "^2.0.0",
+    "micromark-util-types": "^2.0.0",
     "parse-entities": "^4.0.0",
     "stringify-entities": "^4.0.0",
-    "unified": "^10.0.0",
-    "unist-util-visit-parents": "^5.0.0",
+    "unified": "^11.0.0",
+    "unist-util-visit-parents": "^6.0.0",
     "uvu": "^0.5.0"
   },
   "devDependencies": {
     "@types/tape": "^4.0.0",
-    "c8": "^7.0.0",
+    "c8": "^8.0.0",
     "html-void-elements": "^2.0.0",
     "is-hidden": "^2.0.0",
-    "mdast-util-from-markdown": "^1.0.0",
-    "micromark": "^3.0.0",
-    "remark": "^14.0.0",
+    "mdast-util-from-markdown": "^2.0.1",
+    "micromark": "^4.0.0",
+    "remark": "^15.0.1",
     "rimraf": "^3.0.0",
     "tape": "^5.0.0",
     "to-vfile": "^7.0.0",
     "type-coverage": "^2.0.0",
-    "unist-util-remove-position": "^4.0.0"
+    "unist-util-remove-position": "^5.0.0"
   },
   "typeCoverage": {
     "atLeast": 100,

+ 12 - 14
packages/remark-growi-directive/src/mdast-util-growi-directive/index.js

@@ -6,17 +6,15 @@
  * @typedef {import('mdast-util-from-markdown').Extension} FromMarkdownExtension
  * @typedef {import('mdast-util-from-markdown').CompileContext} CompileContext
  * @typedef {import('mdast-util-from-markdown').Token} Token
- * @typedef {import('mdast-util-to-markdown/lib/types.js').Handle} ToMarkdownHandle
- * @typedef {import('mdast-util-to-markdown/lib/types.js').Context} Context
- * @typedef {import('mdast-util-to-markdown/lib/types.js').Options} ToMarkdownExtension
+ * @typedef {import('mdast-util-to-markdown').Handle} ToMarkdownHandle
+ * @typedef {import('mdast-util-to-markdown').Context} Context
+ * @typedef {import('mdast-util-to-markdown').Options} ToMarkdownExtension
+ *
  * @typedef {import('./complex-types').LeafDirective} LeafDirective
  * @typedef {import('./complex-types').TextDirective} TextDirective
  * @typedef {LeafDirective|TextDirective} Directive
  */
 
-import { checkQuote } from 'mdast-util-to-markdown/lib/util/check-quote.js';
-import { containerPhrasing } from 'mdast-util-to-markdown/lib/util/container-phrasing.js';
-import { track } from 'mdast-util-to-markdown/lib/util/track.js';
 import { parseEntities } from 'parse-entities';
 import { stringifyEntitiesLight } from 'stringify-entities';
 
@@ -110,14 +108,14 @@ function exitName(token) {
 
 /** @type {FromMarkdownHandle} */
 function enterAttributes() {
-  this.setData('directiveAttributes', []);
+  this.data.directiveAttributes = [];
   this.buffer(); // Capture EOLs
 }
 
 /** @type {FromMarkdownHandle} */
 function exitAttributeValue(token) {
   const list = /** @type {Array.<[string, string]>} */ (
-    this.getData('directiveAttributes')
+    this.data.directiveAttributes
   );
   list[list.length - 1][1] = parseEntities(this.sliceSerialize(token));
 }
@@ -125,7 +123,7 @@ function exitAttributeValue(token) {
 /** @type {FromMarkdownHandle} */
 function exitAttributeName(token) {
   const list = /** @type {Array.<[string, string]>} */ (
-    this.getData('directiveAttributes')
+    this.data.directiveAttributes
   );
 
   // Attribute names in CommonMark are significantly limited, so character
@@ -136,7 +134,7 @@ function exitAttributeName(token) {
 /** @type {FromMarkdownHandle} */
 function exitAttributes() {
   const list = /** @type {Array.<[string, string]>} */ (
-    this.getData('directiveAttributes')
+    this.data.directiveAttributes
   );
   /** @type {Record.<string, string>} */
   const cleaned = {};
@@ -148,7 +146,7 @@ function exitAttributes() {
     cleaned[attribute[0]] = attribute[1];
   }
 
-  this.setData('directiveAttributes');
+  this.data.directiveAttributes = [];
   this.resume(); // Drop EOLs
   const node = /** @type {Directive} */ (this.stack[this.stack.length - 1]);
   node.attributes = cleaned;
@@ -164,7 +162,7 @@ function exit(token) {
  * @param {Directive} node
  */
 function handleDirective(node, _, context, safeOptions) {
-  const tracker = track(safeOptions);
+  const tracker = context.createTracker(safeOptions);
   const sequence = fence(node);
   const exit = context.enter(node.type);
   let value = tracker.move(sequence + (node.name || ''));
@@ -176,7 +174,7 @@ function handleDirective(node, _, context, safeOptions) {
     const subexit = context.enter(`${node.type}Label`);
     value += tracker.move('[');
     value += tracker.move(
-      containerPhrasing(label, context, {
+      context.containerPhrasing(label, {
         ...tracker.current(),
         before: value,
         after: ']',
@@ -204,7 +202,7 @@ function peekDirective() {
  * @returns {string}
  */
 function attributes(node, context) {
-  const quote = checkQuote(context);
+  const quote = context.options.quote || '"';
   const subset = node.type === DirectiveType.Text ? [quote] : [quote, '\n', '\r'];
   const attrs = node.attributes || {};
   /** @type {Array.<string>} */

+ 1 - 2
packages/remark-growi-directive/src/micromark-extension-growi-directive/lib/directive-leaf.js

@@ -6,8 +6,7 @@
 
 import { factorySpace } from 'micromark-factory-space';
 import { markdownLineEnding } from 'micromark-util-character';
-import { codes } from 'micromark-util-symbol/codes.js';
-import { types } from 'micromark-util-symbol/types.js';
+import { codes, types } from 'micromark-util-symbol';
 import { ok as assert } from 'uvu/assert';
 
 import { factoryAttributes } from './factory-attributes.js';

+ 1 - 2
packages/remark-growi-directive/src/micromark-extension-growi-directive/lib/directive-text.js

@@ -5,8 +5,7 @@
  * @typedef {import('micromark-util-types').State} State
  */
 
-import { codes } from 'micromark-util-symbol/codes.js';
-import { types } from 'micromark-util-symbol/types.js';
+import { codes, types } from 'micromark-util-symbol';
 import { ok as assert } from 'uvu/assert';
 
 import { factoryAttributes } from './factory-attributes.js';

+ 1 - 2
packages/remark-growi-directive/src/micromark-extension-growi-directive/lib/factory-attributes.js

@@ -11,8 +11,7 @@ import {
   markdownLineEndingOrSpace,
   markdownSpace,
 } from 'micromark-util-character';
-import { codes } from 'micromark-util-symbol/codes.js';
-import { types } from 'micromark-util-symbol/types.js';
+import { codes, types } from 'micromark-util-symbol';
 import { ok as assert } from 'uvu/assert';
 
 import { markdownLineEndingOrSpaceOrComma, factoryAttributesDevider } from '../../micromark-factory-attributes-devider/index.js';

+ 1 - 3
packages/remark-growi-directive/src/micromark-extension-growi-directive/lib/factory-label.js

@@ -5,9 +5,7 @@
  */
 
 import { markdownLineEnding } from 'micromark-util-character';
-import { codes } from 'micromark-util-symbol/codes.js';
-import { constants } from 'micromark-util-symbol/constants.js';
-import { types } from 'micromark-util-symbol/types.js';
+import { codes, constants, types } from 'micromark-util-symbol';
 import { ok as assert } from 'uvu/assert';
 
 // This is a fork of:

+ 1 - 1
packages/remark-growi-directive/src/micromark-extension-growi-directive/lib/factory-name.js

@@ -5,7 +5,7 @@
  */
 
 import { asciiAlpha, asciiAlphanumeric } from 'micromark-util-character';
-import { codes } from 'micromark-util-symbol/codes.js';
+import { codes } from 'micromark-util-symbol';
 
 /**
  * @this {TokenizeContext}

+ 1 - 1
packages/remark-growi-directive/src/micromark-extension-growi-directive/lib/syntax.js

@@ -2,7 +2,7 @@
  * @typedef {import('micromark-util-types').Extension} Extension
  */
 
-import { codes } from 'micromark-util-symbol/codes.js';
+import { codes } from 'micromark-util-symbol';
 
 import { directiveLeaf } from './directive-leaf.js';
 import { directiveText } from './directive-text.js';

+ 1 - 1
packages/remark-growi-directive/src/micromark-factory-attributes-devider/index.js

@@ -4,7 +4,7 @@
  */
 import { factorySpace } from 'micromark-factory-space';
 import { markdownLineEnding, markdownSpace } from 'micromark-util-character';
-import { codes } from 'micromark-util-symbol/codes.js';
+import { codes } from 'micromark-util-symbol';
 
 export function markdownLineEndingOrSpaceOrComma(code) {
   return code !== null && (code < codes.nul || code === codes.space || code === codes.comma);

+ 23 - 28
packages/remark-growi-directive/test/mdast-util-growi-directive.test.js

@@ -87,14 +87,15 @@ test('markdown -> mdast', (t) => {
     'should support directives (leaf)',
   );
 
+  let tree = fromMarkdown('x $a[b *c*\nd]', {
+    extensions: [directive()],
+    mdastExtensions: [directiveFromMarkdown],
+  });
+
+  removePosition(tree, { force: true });
+
   t.deepEqual(
-    removePosition(
-      fromMarkdown('x $a[b *c*\nd]', {
-        extensions: [directive()],
-        mdastExtensions: [directiveFromMarkdown],
-      }),
-      true,
-    ),
+    tree,
     {
       type: 'root',
       children: [
@@ -119,22 +120,15 @@ test('markdown -> mdast', (t) => {
     'should support content in a label',
   );
 
-  const hoge = removePosition(
-    fromMarkdown('x $a(#b.c.d e=f g="h&amp;i&unknown;j")', {
-      extensions: [directive()],
-      mdastExtensions: [directiveFromMarkdown],
-    }),
-    true,
-  );
+  tree = fromMarkdown('x $a(#b.c.d e=f g="h&amp;i&unknown;j")', {
+    extensions: [directive()],
+    mdastExtensions: [directiveFromMarkdown],
+  });
+
+  removePosition(tree, { force: true });
 
   t.deepEqual(
-    removePosition(
-      fromMarkdown('x $a(#b.c.d e=f g="h&amp;i&unknown;j")', {
-        extensions: [directive()],
-        mdastExtensions: [directiveFromMarkdown],
-      }),
-      true,
-    ),
+    tree,
     {
       type: 'root',
       children: [
@@ -157,14 +151,15 @@ test('markdown -> mdast', (t) => {
     'should support attributes',
   );
 
+  tree = fromMarkdown('$a(b\nc="d\ne")', {
+    extensions: [directive()],
+    mdastExtensions: [directiveFromMarkdown],
+  });
+
+  removePosition(tree, { force: true });
+
   t.deepEqual(
-    removePosition(
-      fromMarkdown('$a(b\nc="d\ne")', {
-        extensions: [directive()],
-        mdastExtensions: [directiveFromMarkdown],
-      }),
-      true,
-    ),
+    tree,
     {
       type: 'root',
       children: [

+ 4 - 4
packages/remark-lsx/package.json

@@ -44,10 +44,10 @@
   },
   "devDependencies": {
     "eslint-plugin-regex": "^1.8.0",
-    "hast-util-sanitize": "^4.1.0",
-    "hast-util-select": "^5.0.5",
-    "unified": "^10.1.2",
-    "unist-util-visit": "^4.0.0"
+    "hast-util-sanitize": "^5.0.1",
+    "hast-util-select": "^6.0.2",
+    "unified": "^11.0.0",
+    "unist-util-visit": "^5.0.0"
   },
   "peerDependencies": {
     "next": "^14",

Разница между файлами не показана из-за своего большого размера
+ 436 - 288
yarn.lock


Некоторые файлы не были показаны из-за большого количества измененных файлов