diff --git a/lib/changes/dedentLines.js b/lib/changes/dedentLines.js index dcea20d..2515f73 100755 --- a/lib/changes/dedentLines.js +++ b/lib/changes/dedentLines.js @@ -1,5 +1,5 @@ // @flow -import { type Change } from 'slate'; +import { type Editor } from 'slate-react'; import type Options from '../options'; @@ -23,22 +23,22 @@ function firstDifferentCharacter(a: string, b: string): number { */ function dedentLines( opts: Options, - change: Change, + editor: Editor, // Indent to remove indent: string -): Change { - const { value } = change; +): Editor { + const { value } = editor; const { document, selection } = value; const lines = document - .getBlocksAtRange(selection) + .getLeafBlocksAtRange(selection) .filter(node => node.type === opts.lineType); - return lines.reduce((c, line) => { + return lines.reduce((editor, line) => { // Remove a level of indent from the start of line const textNode = line.nodes.first(); const lengthToRemove = firstDifferentCharacter(textNode.text, indent); - return c.removeTextByKey(textNode.key, 0, lengthToRemove); - }, change); + return editor.removeTextByKey(textNode.key, 0, lengthToRemove); + }, editor); } export default dedentLines; diff --git a/lib/changes/indentLines.js b/lib/changes/indentLines.js index f292dc8..8d6803f 100755 --- a/lib/changes/indentLines.js +++ b/lib/changes/indentLines.js @@ -1,5 +1,5 @@ // @flow -import { type Change } from 'slate'; +import { type Editor } from 'slate-react'; import type Options from '../options'; @@ -8,21 +8,21 @@ import type Options from '../options'; */ function indentLines( opts: Options, - change: Change, + editor: Editor, // Indent to add indent: string -): Change { - const { value } = change; +): Editor { + const { value } = editor; const { document, selection } = value; const lines = document - .getBlocksAtRange(selection) + .getLeafBlocksAtRange(selection) .filter(node => node.type === opts.lineType); - return lines.reduce((c, line) => { + return lines.reduce((editor, line) => { // Insert an indent at start of line const text = line.nodes.first(); - return c.insertTextByKey(text.key, 0, indent); - }, change); + return editor.insertTextByKey(text.key, 0, indent); + }, editor); } export default indentLines; diff --git a/lib/changes/toggleCodeBlock.js b/lib/changes/toggleCodeBlock.js index 39c0b0b..1fd32cf 100644 --- a/lib/changes/toggleCodeBlock.js +++ b/lib/changes/toggleCodeBlock.js @@ -1,5 +1,5 @@ // @flow -import { type Change } from 'slate'; +import { type Editor } from 'slate-react'; import type Options from '../options'; import { isInCodeBlock } from '../utils'; @@ -12,14 +12,14 @@ import unwrapCodeBlock from './unwrapCodeBlock'; */ function toggleCodeBlock( opts: Options, - change: Change, + editor: Editor, // When toggling a code block off, type to convert to type: string -): Change { - if (isInCodeBlock(opts, change.value)) { - return unwrapCodeBlock(opts, change, type); +): Editor { + if (isInCodeBlock(opts, editor.value)) { + return unwrapCodeBlock(opts, editor, type); } - return wrapCodeBlock(opts, change); + return wrapCodeBlock(opts, editor); } export default toggleCodeBlock; diff --git a/lib/changes/unwrapCodeBlock.js b/lib/changes/unwrapCodeBlock.js index 3b5bbda..eb5a61a 100644 --- a/lib/changes/unwrapCodeBlock.js +++ b/lib/changes/unwrapCodeBlock.js @@ -1,5 +1,5 @@ // @flow -import { type Change } from 'slate'; +import { type Editor } from 'slate-react'; import type Options from '../options'; import { getCurrentCode } from '../utils'; @@ -9,19 +9,19 @@ import unwrapCodeBlockByKey from './unwrapCodeBlockByKey'; /** * Convert a code block to a normal block. */ -function unwrapCodeBlock(opts: Options, change: Change, type: string): Change { - const { value } = change; +function unwrapCodeBlock(opts: Options, editor: Editor, type: string): Editor { + const { value } = editor; const codeBlock = getCurrentCode(opts, value); if (!codeBlock) { - return change; + return editor; } // Convert to paragraph - unwrapCodeBlockByKey(opts, change, codeBlock.key, type); + unwrapCodeBlockByKey(opts, editor, codeBlock.key, type); - return change; + return editor; } export default unwrapCodeBlock; diff --git a/lib/changes/unwrapCodeBlockByKey.js b/lib/changes/unwrapCodeBlockByKey.js index 9eb848d..27b0a08 100755 --- a/lib/changes/unwrapCodeBlockByKey.js +++ b/lib/changes/unwrapCodeBlockByKey.js @@ -1,5 +1,5 @@ // @flow -import { type Change } from 'slate'; +import { type Editor } from 'slate-react'; import type Options from '../options'; @@ -8,11 +8,11 @@ import type Options from '../options'; */ function unwrapCodeBlockByKey( opts: Options, - change: Change, + editor: Editor, key: string, type: string -): Change { - const { value } = change; +): Editor { + const { value } = editor; const { document } = value; // Get the code block @@ -26,12 +26,14 @@ function unwrapCodeBlockByKey( // change lines into paragraph codeBlock.nodes.forEach(line => - change - .setNodeByKey(line.key, { type }, { normalize: false }) - .unwrapNodeByKey(line.key, { normalize: false }) + editor.withoutNormalizing(() => { + editor + .setNodeByKey(line.key, { type }) + .unwrapNodeByKey(line.key); + }) ); - return change; + return editor; } export default unwrapCodeBlockByKey; diff --git a/lib/changes/wrapCodeBlock.js b/lib/changes/wrapCodeBlock.js index 5f0561c..a34b4bf 100755 --- a/lib/changes/wrapCodeBlock.js +++ b/lib/changes/wrapCodeBlock.js @@ -1,5 +1,5 @@ // @flow -import { type Change } from 'slate'; +import { type Editor } from 'slate-react'; import type Options from '../options'; @@ -8,19 +8,19 @@ import wrapCodeBlockByKey from './wrapCodeBlockByKey'; /** * Wrap current block into a code block. */ -function wrapCodeBlock(opts: Options, change: Change): Change { - const { value } = change; +function wrapCodeBlock(opts: Options, editor: Editor): Editor { + const { value } = editor; const { startBlock, selection } = value; // Convert to code block - wrapCodeBlockByKey(opts, change, startBlock.key); + wrapCodeBlockByKey(opts, editor, startBlock.key); // Move selection back in the block - change - .moveToStartOfNode(change.value.document.getDescendant(startBlock.key)) + editor + .moveToStartOfNode(editor.value.document.getDescendant(startBlock.key)) .moveTo(selection.start.offset); - return change; + return editor; } export default wrapCodeBlock; diff --git a/lib/changes/wrapCodeBlockByKey.js b/lib/changes/wrapCodeBlockByKey.js index a76118e..ebf49aa 100755 --- a/lib/changes/wrapCodeBlockByKey.js +++ b/lib/changes/wrapCodeBlockByKey.js @@ -1,5 +1,5 @@ // @flow -import { type Change } from 'slate'; +import { type Editor } from 'slate-react'; import type Options from '../options'; import { deserializeCode } from '../utils'; @@ -9,33 +9,37 @@ import { deserializeCode } from '../utils'; */ function wrapCodeBlockByKey( opts: Options, - change: Change, + editor: Editor, key: string -): Change { - const { value } = change; +): Editor { + const { value } = editor; const { document } = value; const startBlock = document.getDescendant(key); const text = startBlock.text; - // Remove all child - startBlock.nodes.forEach(node => { - change.removeNodeByKey(node.key, { normalize: false }); + editor.withoutNormalizing(() => { + // Remove all child + startBlock.nodes.forEach(node => { + editor.removeNodeByKey(node.key); + }); }); - // Insert new text - const toInsert = deserializeCode(opts, text); + // Insert new text + const toInsert = deserializeCode(opts, text); - toInsert.nodes.forEach((node, i) => { - change.insertNodeByKey(startBlock.key, i, node, { normalize: false }); + editor.withoutNormalizing(() => { + toInsert.nodes.forEach((node, i) => { + editor.insertNodeByKey(startBlock.key, i, node); + }); }); // Set node type - change.setNodeByKey(startBlock.key, { + editor.setNodeByKey(startBlock.key, { type: opts.containerType }); - return change; + return editor; } export default wrapCodeBlockByKey; diff --git a/lib/handlers/onArrow.js b/lib/handlers/onArrow.js new file mode 100755 index 0000000..fd614e5 --- /dev/null +++ b/lib/handlers/onArrow.js @@ -0,0 +1,52 @@ +// @flow + +import { Block, Text } from 'slate' +import { type Editor } from 'slate-react' +import { isKeyHotkey } from 'is-hotkey' + +import { getCurrentCode } from '../utils' +import { unwrapCodeBlock } from '../changes' +import type Options from '../options' + +const isArrowDown = isKeyHotkey('arrowdown') +const isArrowUp = isKeyHotkey('arrowup') + +/** + * User pressed arrow down or up in an editor and on last or first line of code + * block respectively: + * Append or prepend an exit block + */ +function onArrow( + opts: Options, + event: *, + editor: Editor, + next: * +): void | Editor { + const { value } = editor; + if (value.selection.isExpanded) { + return next(); + } + + const { selection, startText, document } = value; + + const currentLine = value.startBlock; + const nextBlock = document.getNextBlock(currentLine.key); + const prevBlock = document.getPreviousBlock(currentLine.key); + if (isArrowUp(event) && currentLine.type === opts.lineType && !prevBlock) { + event.preventDefault(); + editor.moveToStartOfDocument().splitBlock(10).setBlocks({ + type: opts.exitBlockType, + text: '', + isVoid: false, + }) + editor.moveToStartOfDocument(); + return unwrapCodeBlock(opts, editor, opts.exitBlockType); + } else if (isArrowDown(event) && currentLine.type === opts.lineType && !nextBlock) { + event.preventDefault(); + return opts.resolvedOnExit(editor); + } + + return next(); +} + +export default onArrow; diff --git a/lib/handlers/onBackspace.js b/lib/handlers/onBackspace.js index 368f224..c00444f 100755 --- a/lib/handlers/onBackspace.js +++ b/lib/handlers/onBackspace.js @@ -1,6 +1,6 @@ // @flow -import { type Change } from 'slate'; +import { type Editor } from 'slate-react'; import endsWith from 'ends-with'; import { getCurrentIndent, getCurrentCode } from '../utils'; @@ -13,12 +13,12 @@ import type Options from '../options'; function onBackspace( opts: Options, event: *, - change: Change, - editor: * -): void | Change { - const { value } = change; + editor: Editor, + next: * +): void | Editor { + const { value } = editor; if (value.selection.isExpanded) { - return undefined; + return next(); } const { selection, startText } = value; @@ -34,7 +34,7 @@ function onBackspace( // Remove indent event.preventDefault(); - return change.deleteBackward(indent.length).focus(); + return editor.deleteBackward(indent.length).focus(); } else if (opts.exitBlockType) { // Otherwise check if we are in an empty code container... const currentCode = getCurrentCode(opts, value); @@ -48,12 +48,15 @@ function onBackspace( if (isStartOfCode && isEmpty) { event.preventDefault(); // Convert it to default exit type - return change - .setBlocks(opts.exitBlockType, { normalize: false }) - .unwrapNodeByKey(currentLine.key); + editor.withoutNormalizing(() => { + editor + .setBlocks(opts.exitBlockType) + .unwrapNodeByKey(currentLine.key); + }); + return editor } } - return undefined; + return next(); } export default onBackspace; diff --git a/lib/handlers/onEnter.js b/lib/handlers/onEnter.js index 0240e59..a0159bc 100755 --- a/lib/handlers/onEnter.js +++ b/lib/handlers/onEnter.js @@ -1,5 +1,5 @@ // @flow -import { type Change } from 'slate'; +import { type Editor } from 'slate-react'; import { getIndent } from '../utils'; import type Options from '../options'; @@ -11,12 +11,12 @@ import type Options from '../options'; function onEnter( opts: Options, event: *, - change: Change, - editor: * -): void | Change { - const { value } = change; + editor: Editor, + next: * +): void | Editor { + const { value } = editor; if (!value.selection.isCollapsed) { - return undefined; + return next(); } event.preventDefault(); @@ -25,7 +25,7 @@ function onEnter( const currentLineText = startBlock.text; const indent = getIndent(currentLineText, ''); - return change + return editor .splitBlock() .insertText(indent) .focus(); diff --git a/lib/handlers/onKeyDown.js b/lib/handlers/onKeyDown.js index 9959a58..99c3244 100755 --- a/lib/handlers/onKeyDown.js +++ b/lib/handlers/onKeyDown.js @@ -1,6 +1,6 @@ // @flow import { isKeyHotkey } from 'is-hotkey'; -import { type Change } from 'slate'; +import { type Editor } from 'slate-react'; import { getCurrentCode } from '../utils'; import type Options from '../options'; @@ -11,6 +11,7 @@ import onEnter from './onEnter'; import onModEnter from './onModEnter'; import onBackspace from './onBackspace'; import onSelectAll from './onSelectAll'; +import onArrow from './onArrow'; const isModA = isKeyHotkey('mod+a'); const isShiftTab = isKeyHotkey('shift+tab'); @@ -18,6 +19,8 @@ const isTab = isKeyHotkey('tab'); const isModEnter = isKeyHotkey('mod+enter'); const isEnter = isKeyHotkey('enter'); const isBackspace = isKeyHotkey('backspace'); +const isArrowUp = isKeyHotkey('arrowup'); +const isArrowDown = isKeyHotkey('arrowdown'); /** * User is pressing a key in the editor @@ -25,19 +28,19 @@ const isBackspace = isKeyHotkey('backspace'); function onKeyDown( opts: Options, event: *, - change: Change, - editor: * -): void | Change { - const { value } = change; + editor: Editor, + next: * +): void | Editor { + const { value } = editor; const currentCode = getCurrentCode(opts, value); // Inside code ? if (!currentCode) { - return undefined; + return next(); } // Add opts in the argument list - const args = [opts, event, change, editor]; + const args = [opts, event, editor, next]; // Select all the code in the block (Mod+a) if (opts.selectAll && isModA(event)) { @@ -57,8 +60,11 @@ function onKeyDown( } else if (isBackspace(event)) { // User is pressing Backspace return onBackspace(...args); + } else if (isArrowDown(event) || isArrowUp(event)) { + // User is pressing arrow + return onArrow(...args); } - return undefined; + return next(); } export default onKeyDown; diff --git a/lib/handlers/onModEnter.js b/lib/handlers/onModEnter.js index 001df77..0a67bf7 100755 --- a/lib/handlers/onModEnter.js +++ b/lib/handlers/onModEnter.js @@ -1,5 +1,5 @@ // @flow -import { type Change } from 'slate'; +import { type Editor } from 'slate-react'; import type Options from '../options'; @@ -10,18 +10,18 @@ import type Options from '../options'; function onModEnter( opts: Options, event: *, - change: Change, - editor: * -): void | Change { - const { value } = change; + editor: Editor, + next: * +): void | Editor { + const { value } = editor; if (!value.selection.isCollapsed) { - return undefined; + return next(); } event.preventDefault(); // Exit the code block - return opts.resolvedOnExit(change); + return opts.resolvedOnExit(editor); } export default onModEnter; diff --git a/lib/handlers/onPaste.js b/lib/handlers/onPaste.js index 4cd384b..4810be6 100644 --- a/lib/handlers/onPaste.js +++ b/lib/handlers/onPaste.js @@ -1,8 +1,10 @@ // @flow -import { Document, type Change } from 'slate'; -import { getEventTransfer } from 'slate-react'; -import { getCurrentCode, deserializeCode } from '../utils'; -import type Options from '../options'; +import { Document } from 'slate' +import { type Editor } from 'slate-react'; +import { getEventTransfer } from 'slate-react' + +import { getCurrentCode, deserializeCode } from '../utils' +import type Options from '../options' /** * User is pasting content, insert it as text @@ -10,17 +12,17 @@ import type Options from '../options'; function onPaste( opts: Options, event: *, - change: Change, - editor: * -): void | Change { - const { value } = change; + editor: Editor, + next: *, +): void | Editor { + const { value } = editor; const data = getEventTransfer(event); const currentCode = getCurrentCode(opts, value); // Only handle paste when selection is completely a code block const { endBlock } = value; if (!currentCode || !currentCode.hasDescendant(endBlock.key)) { - return undefined; + return next(); } // Convert to text if needed @@ -39,7 +41,7 @@ function onPaste( const fragment = Document.create({ nodes: lines }); - return change.insertFragment(fragment); + return editor.insertFragment(fragment); } export default onPaste; diff --git a/lib/handlers/onSelectAll.js b/lib/handlers/onSelectAll.js index dbd3dd1..33d4f3f 100644 --- a/lib/handlers/onSelectAll.js +++ b/lib/handlers/onSelectAll.js @@ -1,5 +1,5 @@ // @flow -import { type Change } from 'slate'; +import { type Editor } from 'slate'; import { getCurrentCode } from '../utils'; import type Options from '../options'; @@ -10,14 +10,14 @@ import type Options from '../options'; function onSelectAll( opts: Options, event: *, - change: Change, - editor: * -): void | Change { - const { value } = change; + editor: Editor, + next: * +): void | Editor { + const { value } = editor; event.preventDefault(); const currentCode = getCurrentCode(opts, value); - return change + return editor .moveToStartOfNode(currentCode.getFirstText()) .moveFocusToEndOfNode(currentCode.getLastText()); } diff --git a/lib/handlers/onShiftTab.js b/lib/handlers/onShiftTab.js index 07f8f1b..3986fb1 100644 --- a/lib/handlers/onShiftTab.js +++ b/lib/handlers/onShiftTab.js @@ -1,5 +1,5 @@ // @flow -import { type Change } from 'slate'; +import { type Editor } from 'slate-react'; import { getCurrentIndent } from '../utils'; import { dedentLines } from '../changes'; import type Options from '../options'; @@ -11,17 +11,17 @@ import type Options from '../options'; function onShiftTab( opts: Options, event: *, - change: Change, - editor: * -): void | Change { - const { value } = change; + editor: Editor, + next: * +): void | Editor { + const { value } = editor; event.preventDefault(); event.stopPropagation(); const indent = getCurrentIndent(opts, value); // We dedent all selected lines - return dedentLines(opts, change, indent); + return dedentLines(opts, editor, indent); } export default onShiftTab; diff --git a/lib/handlers/onTab.js b/lib/handlers/onTab.js index 7655ec5..06a02c6 100755 --- a/lib/handlers/onTab.js +++ b/lib/handlers/onTab.js @@ -1,5 +1,5 @@ // @flow -import { type Change } from 'slate'; +import { type Editor } from 'slate-react'; import { getCurrentIndent } from '../utils'; import { indentLines } from '../changes'; @@ -13,10 +13,10 @@ import type Options from '../options'; function onTab( opts: Options, event: *, - change: Change, - editor: * -): void | Change { - const { value } = change; + editor: Editor, + next: * +): void | Editor { + const { value } = editor; event.preventDefault(); event.stopPropagation(); @@ -27,11 +27,11 @@ function onTab( // Selection is collapsed, we just insert an indent at cursor if (isCollapsed) { - return change.insertText(indent).focus(); + return editor.insertText(indent).focus(); } // We indent all selected lines - return indentLines(opts, change, indent); + return indentLines(opts, editor, indent); } export default onTab; diff --git a/lib/index.js b/lib/index.js index 0e0f7fe..9b5be48 100644 --- a/lib/index.js +++ b/lib/index.js @@ -1,13 +1,20 @@ // @flow -import Options, { type OptionsFormat } from './options'; -import { onKeyDown, onPaste } from './handlers'; -import core from './core'; +import { KeyUtils } from 'slate' + +import { onKeyDown, onPaste } from './handlers' +import Options, { type OptionsFormat } from './options' +import core from './core' + +let keyCtr = 0 /** * A Slate plugin to handle keyboard events in code blocks. */ function EditCode(optsParam?: OptionsFormat = {}): Object { + // Remove when sharing slate + KeyUtils.setGenerator(() => `slateCodeBlock${keyCtr++}`) + const opts = new Options(optsParam); const corePlugin = core(opts); diff --git a/lib/options.js b/lib/options.js index a877626..8721dac 100755 --- a/lib/options.js +++ b/lib/options.js @@ -1,5 +1,6 @@ // @flow -import { type Change, type Value, Block, Text } from 'slate'; +import { type Value, Block, Text } from 'slate'; +import { type Editor } from 'slate-react' import { Record } from 'immutable'; const DEFAULTS = { @@ -22,29 +23,27 @@ class Options extends Record(DEFAULTS) { selectAll: boolean; allowMarks: boolean; getIndent: ?(Value) => string; - onExit: ?(Change) => ?Change; + onExit: ?(Editor) => ?Editor; - resolvedOnExit(change: Change): ?Change { + resolvedOnExit(editor: Editor): ?Editor { if (this.onExit) { // Custom onExit option - return this.onExit(change); + return this.onExit(editor); } // Default behavior: insert an exit block - const range = change.value.selection; + const range = editor.value.selection; const exitBlock = Block.create({ type: this.exitBlockType, nodes: [Text.create()] }); - change.deleteAtRange(range, { normalize: false }); - change.insertBlockAtRange(change.value.selection, exitBlock, { - normalize: false + editor.withoutNormalizing(() => { + editor.insertBlockAtRange(editor.value.selection, exitBlock); + // Exit the code block + editor.unwrapNodeByKey(exitBlock.key); }); - // Exit the code block - change.unwrapNodeByKey(exitBlock.key); - - return change.moveToStartOfNode(exitBlock); + return editor.moveToStartOfNode(exitBlock); } } @@ -65,7 +64,7 @@ export type OptionsFormat = { getIndent?: Value => string, // Custom exit handler // exitBlockType option is useless if onExit is provided - onExit?: Change => Change + onExit?: Editor => Editor }; export default Options; diff --git a/lib/utils/deserializeCode.js b/lib/utils/deserializeCode.js index be563dc..bead210 100755 --- a/lib/utils/deserializeCode.js +++ b/lib/utils/deserializeCode.js @@ -23,7 +23,7 @@ function deserializeCode(opts: Options, text: string): Block { const code = Block.create({ type: opts.containerType, nodes: lines - }); + }) return code; } diff --git a/lib/utils/getIndent.js b/lib/utils/getIndent.js index 362e6d9..5e0ab1b 100644 --- a/lib/utils/getIndent.js +++ b/lib/utils/getIndent.js @@ -1,7 +1,7 @@ // @flow import detectIndent from 'detect-indent'; -const DEFAULT_INDENTATION = ' '; +const DEFAULT_INDENTATION = ' '; /** * Detect indentation in a text diff --git a/lib/validation/schema.js b/lib/validation/schema.js index c788435..12cf341 100755 --- a/lib/validation/schema.js +++ b/lib/validation/schema.js @@ -1,16 +1,17 @@ // @flow -import { Block, type Change, type Node } from 'slate'; +import { Block, KeyUtils, type Node } from 'slate' import { CHILD_TYPE_INVALID, CHILD_OBJECT_INVALID, PARENT_TYPE_INVALID, PARENT_OBJECT_INVALID -} from 'slate-schema-violations'; -import { List } from 'immutable'; +} from 'slate-schema-violations' +import { type Editor } from 'slate-react' +import { List } from 'immutable' -import type Options from '../options'; -import { deserializeCode } from '../utils'; +import { deserializeCode } from '../utils' +import type Options from '../options' /** * Create a schema definition with rules to normalize code blocks @@ -20,11 +21,11 @@ function schema(opts: Options): Object { blocks: { [opts.containerType]: { nodes: [{ match: [{ type: opts.lineType }] }], - normalize(change: Change, error: Object) { + normalize(editor: Editor, error: Object) { switch (error.code) { case CHILD_OBJECT_INVALID: case CHILD_TYPE_INVALID: - return onlyLine(opts, change, error); + return onlyLine(opts, editor, error); default: return undefined; } @@ -33,11 +34,11 @@ function schema(opts: Options): Object { [opts.lineType]: { nodes: [{ match: [{ object: 'text', min: 1 }] }], parent: { type: opts.containerType }, - normalize(change: Change, error: Object) { + normalize(editor: Editor, error: Object) { switch (error.code) { case PARENT_OBJECT_INVALID: case PARENT_TYPE_INVALID: - return noOrphanLine(opts, change, error); + return noOrphanLine(opts, editor, error); default: return undefined; } @@ -75,7 +76,7 @@ function getSuccessiveNodes( /** * A rule that ensure code blocks only contain lines of code, and no marks */ -function onlyLine(opts: Options, change: Change, error: Object) { +function onlyLine(opts: Options, editor: Editor, error: Object) { const isNotLine = n => n.type !== opts.lineType; const nonLineGroups = getSuccessiveNodes(error.node.nodes, isNotLine); @@ -86,53 +87,52 @@ function onlyLine(opts: Options, change: Change, error: Object) { // Insert them in place of the invalid node const first = nonLineGroup.first(); - const parent = change.value.document.getParent(first.key); + const parent = editor.value.document.getParent(first.key); const invalidNodeIndex = parent.nodes.indexOf(first); - codeLines.forEach((codeLine, index) => { - change.insertNodeByKey( - parent.key, - invalidNodeIndex + index, - codeLine, - { - normalize: false - } - ); + editor.withoutNormalizing(() => { + codeLines.forEach((codeLine, index) => { + editor.insertNodeByKey( + parent.key, + invalidNodeIndex + index, + codeLine, + ); + }); }); // Remove the block - nonLineGroup.forEach(n => - change.removeNodeByKey(n.key, { normalize: false }) - ); + editor.withoutNormalizing(() => { + nonLineGroup.forEach(n => + editor.removeNodeByKey(n.key) + ); + }); }); - return change; + return editor; } /** * A rule that ensure code lines are always children * of a code block. */ -function noOrphanLine(opts: Options, change: Change, error: Object): ?Change { +function noOrphanLine(opts: Options, editor: Editor, error: Object): ?Editor { const { parent } = error; const isLine = n => n.type === opts.lineType; const linesGroup = getSuccessiveNodes(parent.nodes, isLine); - linesGroup.forEach(group => { - const container = Block.create({ type: opts.containerType, nodes: [] }); - const firstLineIndex = parent.nodes.indexOf(group.first()); + editor.withoutNormalizing(() => { + linesGroup.forEach(group => { + const container = Block.create({ type: opts.containerType, nodes: [] }); + const firstLineIndex = parent.nodes.indexOf(group.first()); - change.insertNodeByKey(parent.key, firstLineIndex, container, { - normalize: false - }); + editor.insertNodeByKey(parent.key, firstLineIndex, container); - group.forEach((line, index) => - change.moveNodeByKey(line.key, container.key, index, { - normalize: false - }) - ); + group.forEach((line, index) => + editor.moveNodeByKey(line.key, container.key, index) + ); + }); }); } diff --git a/package.json b/package.json index 3bdca24..fe80fb3 100644 --- a/package.json +++ b/package.json @@ -1,9 +1,9 @@ { - "name": "slate-code-block", + "name": "@tildepage/slate-code-block", "description": "A Slate plugin to handle code blocks editing. Fork from GitbookIO/slate-edit-code", - "version": "0.16.0", + "version": "0.1.0", "license": "Apache-2.0", - "repository": "git://github.com/linonetwo/slate-edit-code.git", + "repository": "git://github.com/cdunn/slate-edit-code.git", "main": "./dist/index.js", "dependencies": { "detect-indent": "^5.0.0", @@ -13,7 +13,7 @@ }, "peerDependencies": { "immutable": "^3.8.2", - "slate": "^0.40.2", + "slate": "^0.42.0", "slate-react": "^0.18.5", "slate-schema-violations": "^0.1.39" }, @@ -37,13 +37,13 @@ "http-server": "^0.9.0", "immutable": "^3.8.1", "mocha": "^3.0.1", + "prettier": "^1.13.3", "react": "^15.3.0", "react-dom": "^15.3.0", - "prettier": "^1.13.3", - "slate": "^0.40.2", + "slate": "^0.44.0", "slate-hyperprint": "^2.2.4", - "slate-hyperscript": "^0.10.2", - "slate-react": "^0.18.5", + "slate-hyperscript": "^0.11.0", + "slate-react": "^0.21.0", "slate-schema-violations": "^0.1.39" }, "scripts": { diff --git a/tests/all.js b/tests/all.js index add74b2..5a2b684 100644 --- a/tests/all.js +++ b/tests/all.js @@ -8,19 +8,17 @@ import hyperprint from 'slate-hyperprint'; import EditCode from '../lib'; const PLUGIN = EditCode(); -const SCHEMA = Slate.Schema.create({ - plugins: [PLUGIN] -}); function deserializeValue(value) { - return Slate.Value.fromJSON( + return new Slate.Editor({ + plugins: [PLUGIN], + value: Slate.Value.fromJSON( { - document: value.document, - selection: value.selection, - schema: SCHEMA - }, - { normalize: false } - ); + selection: value.selection, + document: value.document, + } + ) + }); } describe('slate-edit-code', () => { @@ -39,9 +37,7 @@ describe('slate-edit-code', () => { const runChange = require(path.resolve(dir, 'change.js')).default; - const valueInput = deserializeValue(input); - - const newChange = runChange(PLUGIN, valueInput.change()); + const newChange = runChange(PLUGIN, deserializeValue(input)); if (expected) { const newDoc = hyperprint(newChange.value.document, { diff --git a/tests/backspace-empty-code/change.js b/tests/backspace-empty-code/change.js index b0fda62..233c668 100644 --- a/tests/backspace-empty-code/change.js +++ b/tests/backspace-empty-code/change.js @@ -1,5 +1,5 @@ import simulateKey from '../simulate-key'; -export default function(plugin, change) { - return plugin.onKeyDown(simulateKey('backspace'), change, {}); +export default function(plugin, editor) { + return plugin.onKeyDown(simulateKey('backspace'), editor, () => {}); } diff --git a/tests/backspace-empty-code/expected.js b/tests/backspace-empty-code/expected.js index 4a51d8f..19313e4 100644 --- a/tests/backspace-empty-code/expected.js +++ b/tests/backspace-empty-code/expected.js @@ -4,7 +4,9 @@ import hyperscript from '../hyperscript'; export default ( - + + + ); diff --git a/tests/backspace-start/change.js b/tests/backspace-start/change.js index b0fda62..233c668 100644 --- a/tests/backspace-start/change.js +++ b/tests/backspace-start/change.js @@ -1,5 +1,5 @@ import simulateKey from '../simulate-key'; -export default function(plugin, change) { - return plugin.onKeyDown(simulateKey('backspace'), change, {}); +export default function(plugin, editor) { + return plugin.onKeyDown(simulateKey('backspace'), editor, () => {}); } diff --git a/tests/enter-end-offset/change.js b/tests/enter-end-offset/change.js index e7784fe..41620f6 100644 --- a/tests/enter-end-offset/change.js +++ b/tests/enter-end-offset/change.js @@ -1,5 +1,5 @@ import simulateKey from '../simulate-key'; -export default function(plugin, change) { - return plugin.onKeyDown(simulateKey('enter'), change, {}); +export default function(plugin, editor) { + return plugin.onKeyDown(simulateKey('enter'), editor, () => {}); } diff --git a/tests/enter-end-offset/expected.js b/tests/enter-end-offset/expected.js index 5ea47e6..2b6d8fe 100644 --- a/tests/enter-end-offset/expected.js +++ b/tests/enter-end-offset/expected.js @@ -6,7 +6,9 @@ export default ( Some code - + + + diff --git a/tests/enter-mid-offset/change.js b/tests/enter-mid-offset/change.js index e7784fe..41620f6 100644 --- a/tests/enter-mid-offset/change.js +++ b/tests/enter-mid-offset/change.js @@ -1,5 +1,5 @@ import simulateKey from '../simulate-key'; -export default function(plugin, change) { - return plugin.onKeyDown(simulateKey('enter'), change, {}); +export default function(plugin, editor) { + return plugin.onKeyDown(simulateKey('enter'), editor, () => {}); } diff --git a/tests/enter-start-offset/change.js b/tests/enter-start-offset/change.js index e7784fe..41620f6 100644 --- a/tests/enter-start-offset/change.js +++ b/tests/enter-start-offset/change.js @@ -1,5 +1,5 @@ import simulateKey from '../simulate-key'; -export default function(plugin, change) { - return plugin.onKeyDown(simulateKey('enter'), change, {}); +export default function(plugin, editor) { + return plugin.onKeyDown(simulateKey('enter'), editor, () => {}); } diff --git a/tests/enter-start-offset/expected.js b/tests/enter-start-offset/expected.js index 5e8210d..081c891 100644 --- a/tests/enter-start-offset/expected.js +++ b/tests/enter-start-offset/expected.js @@ -5,7 +5,9 @@ export default ( - + + + Some code diff --git a/tests/enter-with-indent/change.js b/tests/enter-with-indent/change.js index e7784fe..41620f6 100644 --- a/tests/enter-with-indent/change.js +++ b/tests/enter-with-indent/change.js @@ -1,5 +1,5 @@ import simulateKey from '../simulate-key'; -export default function(plugin, change) { - return plugin.onKeyDown(simulateKey('enter'), change, {}); +export default function(plugin, editor) { + return plugin.onKeyDown(simulateKey('enter'), editor, () => {}); } diff --git a/tests/isincodeblock-true/change.js b/tests/isincodeblock-true/change.js index a7d858a..2a82ee2 100644 --- a/tests/isincodeblock-true/change.js +++ b/tests/isincodeblock-true/change.js @@ -1,7 +1,7 @@ import assert from 'assert'; -export default function(plugin, change) { - assert.equal(plugin.utils.isInCodeBlock(change.value), true); +export default function(plugin, editor) { + assert.equal(plugin.utils.isInCodeBlock(editor.value), true); - return change; + return editor; } diff --git a/tests/on-exit-block/change.js b/tests/on-exit-block/change.js index 2c92007..3266b38 100644 --- a/tests/on-exit-block/change.js +++ b/tests/on-exit-block/change.js @@ -1,5 +1,5 @@ import simulateKey from '../simulate-key'; -export default function(plugin, change) { - return plugin.onKeyDown(simulateKey('mod+enter'), change, {}); +export default function(plugin, editor) { + return plugin.onKeyDown(simulateKey('mod+enter'), editor, () => {}); } diff --git a/tests/on-exit-block/expected.js b/tests/on-exit-block/expected.js index 29e84ff..2587025 100644 --- a/tests/on-exit-block/expected.js +++ b/tests/on-exit-block/expected.js @@ -7,7 +7,9 @@ export default ( Li - + + + ne 1 diff --git a/tests/paste-middle/change.js b/tests/paste-middle/change.js index 6c92a00..0b99376 100644 --- a/tests/paste-middle/change.js +++ b/tests/paste-middle/change.js @@ -1,4 +1,4 @@ -export default function(plugin, change) { +export default function(plugin, editor) { return plugin.onPaste( { preventDefault() {}, @@ -9,7 +9,7 @@ export default function(plugin, change) { getData: () => 'Yes\nNo\nQuestion?' } }, - change, - {} + editor, + () => {} ); } diff --git a/tests/schema-multiline-text/change.js b/tests/schema-multiline-text/change.js index d841688..484f4cb 100644 --- a/tests/schema-multiline-text/change.js +++ b/tests/schema-multiline-text/change.js @@ -1,6 +1,5 @@ import Slate from 'slate'; -export default function(plugin, change) { - const schema = new Slate.Schema(plugin.schema); - return change.normalize(schema); +export default function(plugin, editor) { + return editor.normalize(); } diff --git a/tests/schema-no-marks/change.js b/tests/schema-no-marks/change.js index d841688..484f4cb 100644 --- a/tests/schema-no-marks/change.js +++ b/tests/schema-no-marks/change.js @@ -1,6 +1,5 @@ import Slate from 'slate'; -export default function(plugin, change) { - const schema = new Slate.Schema(plugin.schema); - return change.normalize(schema); +export default function(plugin, editor) { + return editor.normalize(); } diff --git a/tests/schema-no-multiple-orphan-lines/change.js b/tests/schema-no-multiple-orphan-lines/change.js index d841688..484f4cb 100644 --- a/tests/schema-no-multiple-orphan-lines/change.js +++ b/tests/schema-no-multiple-orphan-lines/change.js @@ -1,6 +1,5 @@ import Slate from 'slate'; -export default function(plugin, change) { - const schema = new Slate.Schema(plugin.schema); - return change.normalize(schema); +export default function(plugin, editor) { + return editor.normalize(); } diff --git a/tests/schema-no-orphan-lines-wrapped/change.js b/tests/schema-no-orphan-lines-wrapped/change.js index d841688..484f4cb 100644 --- a/tests/schema-no-orphan-lines-wrapped/change.js +++ b/tests/schema-no-orphan-lines-wrapped/change.js @@ -1,6 +1,5 @@ import Slate from 'slate'; -export default function(plugin, change) { - const schema = new Slate.Schema(plugin.schema); - return change.normalize(schema); +export default function(plugin, editor) { + return editor.normalize(); } diff --git a/tests/schema-no-single-orphan-line/change.js b/tests/schema-no-single-orphan-line/change.js index d841688..484f4cb 100644 --- a/tests/schema-no-single-orphan-line/change.js +++ b/tests/schema-no-single-orphan-line/change.js @@ -1,6 +1,5 @@ import Slate from 'slate'; -export default function(plugin, change) { - const schema = new Slate.Schema(plugin.schema); - return change.normalize(schema); +export default function(plugin, editor) { + return editor.normalize(); } diff --git a/tests/schema-only-lines-empty/change.js b/tests/schema-only-lines-empty/change.js index d841688..484f4cb 100644 --- a/tests/schema-only-lines-empty/change.js +++ b/tests/schema-only-lines-empty/change.js @@ -1,6 +1,5 @@ import Slate from 'slate'; -export default function(plugin, change) { - const schema = new Slate.Schema(plugin.schema); - return change.normalize(schema); +export default function(plugin, editor) { + return editor.normalize(); } diff --git a/tests/schema-only-lines-empty/expected.js b/tests/schema-only-lines-empty/expected.js index 6432ff2..96cbf92 100644 --- a/tests/schema-only-lines-empty/expected.js +++ b/tests/schema-only-lines-empty/expected.js @@ -5,7 +5,9 @@ export default ( - + + + diff --git a/tests/schema-only-lines/change.js b/tests/schema-only-lines/change.js index d841688..484f4cb 100644 --- a/tests/schema-only-lines/change.js +++ b/tests/schema-only-lines/change.js @@ -1,6 +1,5 @@ import Slate from 'slate'; -export default function(plugin, change) { - const schema = new Slate.Schema(plugin.schema); - return change.normalize(schema); +export default function(plugin, editor) { + return editor.normalize(); } diff --git a/tests/schema-only-lines/expected.js b/tests/schema-only-lines/expected.js index 083217b..40add3c 100644 --- a/tests/schema-only-lines/expected.js +++ b/tests/schema-only-lines/expected.js @@ -5,7 +5,9 @@ export default ( - + + + Hello invalid World diff --git a/tests/schema-only-text-join/change.js b/tests/schema-only-text-join/change.js index d841688..484f4cb 100644 --- a/tests/schema-only-text-join/change.js +++ b/tests/schema-only-text-join/change.js @@ -1,6 +1,5 @@ import Slate from 'slate'; -export default function(plugin, change) { - const schema = new Slate.Schema(plugin.schema); - return change.normalize(schema); +export default function(plugin, editor) { + return editor.normalize(); } diff --git a/tests/schema-only-text-with-blocks/change.js b/tests/schema-only-text-with-blocks/change.js index d841688..484f4cb 100644 --- a/tests/schema-only-text-with-blocks/change.js +++ b/tests/schema-only-text-with-blocks/change.js @@ -1,6 +1,5 @@ import Slate from 'slate'; -export default function(plugin, change) { - const schema = new Slate.Schema(plugin.schema); - return change.normalize(schema); +export default function(plugin, editor) { + return editor.normalize(); } diff --git a/tests/schema-only-text/change.js b/tests/schema-only-text/change.js index d841688..c7a934e 100644 --- a/tests/schema-only-text/change.js +++ b/tests/schema-only-text/change.js @@ -1,6 +1,6 @@ import Slate from 'slate'; +import { Editor } from 'slate-react'; -export default function(plugin, change) { - const schema = new Slate.Schema(plugin.schema); - return change.normalize(schema); +export default function(plugin, editor) { + return editor.normalize(); } diff --git a/tests/schema-only-text/expected.js b/tests/schema-only-text/expected.js index 050b97f..81b3379 100644 --- a/tests/schema-only-text/expected.js +++ b/tests/schema-only-text/expected.js @@ -5,8 +5,12 @@ export default ( - - + + + + + + diff --git a/tests/schema-single-text/change.js b/tests/schema-single-text/change.js index d841688..484f4cb 100644 --- a/tests/schema-single-text/change.js +++ b/tests/schema-single-text/change.js @@ -1,6 +1,5 @@ import Slate from 'slate'; -export default function(plugin, change) { - const schema = new Slate.Schema(plugin.schema); - return change.normalize(schema); +export default function(plugin, editor) { + return editor.normalize(); } diff --git a/tests/select-all/change.js b/tests/select-all/change.js index 7a50eab..3c1ec07 100644 --- a/tests/select-all/change.js +++ b/tests/select-all/change.js @@ -1,5 +1,5 @@ import simulateKey from '../simulate-key'; -export default function(plugin, change) { - return plugin.onKeyDown(simulateKey('mod+a'), change, {}); +export default function(plugin, editor) { + return plugin.onKeyDown(simulateKey('mod+a'), editor, () => {}); } diff --git a/tests/shift-tab-middle-offset/change.js b/tests/shift-tab-middle-offset/change.js index e3e8214..b15f80a 100644 --- a/tests/shift-tab-middle-offset/change.js +++ b/tests/shift-tab-middle-offset/change.js @@ -1,5 +1,5 @@ import simulateKey from '../simulate-key'; -export default function(plugin, change) { - return plugin.onKeyDown(simulateKey('shift+tab'), change, {}); +export default function(plugin, editor) { + return plugin.onKeyDown(simulateKey('shift+tab'), editor, () => {}); } diff --git a/tests/shift-tab-multilines/change.js b/tests/shift-tab-multilines/change.js index e3e8214..b15f80a 100644 --- a/tests/shift-tab-multilines/change.js +++ b/tests/shift-tab-multilines/change.js @@ -1,5 +1,5 @@ import simulateKey from '../simulate-key'; -export default function(plugin, change) { - return plugin.onKeyDown(simulateKey('shift+tab'), change, {}); +export default function(plugin, editor) { + return plugin.onKeyDown(simulateKey('shift+tab'), editor, () => {}); } diff --git a/tests/tab-middle-offset/change.js b/tests/tab-middle-offset/change.js index a4cd043..87b288b 100644 --- a/tests/tab-middle-offset/change.js +++ b/tests/tab-middle-offset/change.js @@ -1,5 +1,5 @@ import simulateKey from '../simulate-key'; -export default function(plugin, change) { - return plugin.onKeyDown(simulateKey('tab'), change, {}); +export default function(plugin, editor) { + return plugin.onKeyDown(simulateKey('tab'), editor, () => {}); } diff --git a/tests/tab-multilines/change.js b/tests/tab-multilines/change.js index a4cd043..87b288b 100644 --- a/tests/tab-multilines/change.js +++ b/tests/tab-multilines/change.js @@ -1,5 +1,5 @@ import simulateKey from '../simulate-key'; -export default function(plugin, change) { - return plugin.onKeyDown(simulateKey('tab'), change, {}); +export default function(plugin, editor) { + return plugin.onKeyDown(simulateKey('tab'), editor, () => {}); } diff --git a/tests/tab-start-offset/change.js b/tests/tab-start-offset/change.js index b33dc18..3048ee5 100644 --- a/tests/tab-start-offset/change.js +++ b/tests/tab-start-offset/change.js @@ -1,12 +1,12 @@ import simulateKey from '../simulate-key'; -export default function(plugin, change) { - const { value } = change; +export default function(plugin, editor) { + const { value } = editor; const block = value.document.findDescendant( node => node.type == 'code_block' ); - change.moveToStartOfNode(block).moveTo(0); + editor.moveToStartOfNode(block).moveTo(0); - return plugin.onKeyDown(simulateKey('tab'), change, {}); + return plugin.onKeyDown(simulateKey('tab'), editor, () => {}); } diff --git a/tests/togglecodeblock-code/change.js b/tests/togglecodeblock-code/change.js index e17ce3d..62ade8b 100644 --- a/tests/togglecodeblock-code/change.js +++ b/tests/togglecodeblock-code/change.js @@ -1,3 +1,3 @@ -export default function(plugin, change) { - return plugin.changes.toggleCodeBlock(change, 'paragraph'); +export default function(plugin, editor) { + return plugin.changes.toggleCodeBlock(editor, 'paragraph'); } diff --git a/tests/togglecodeblock-normal/change.js b/tests/togglecodeblock-normal/change.js index e17ce3d..62ade8b 100644 --- a/tests/togglecodeblock-normal/change.js +++ b/tests/togglecodeblock-normal/change.js @@ -1,3 +1,3 @@ -export default function(plugin, change) { - return plugin.changes.toggleCodeBlock(change, 'paragraph'); +export default function(plugin, editor) { + return plugin.changes.toggleCodeBlock(editor, 'paragraph'); } diff --git a/tests/unwrapcodeblock-multi-lines/change.js b/tests/unwrapcodeblock-multi-lines/change.js index a01f0cd..def3e34 100644 --- a/tests/unwrapcodeblock-multi-lines/change.js +++ b/tests/unwrapcodeblock-multi-lines/change.js @@ -1,3 +1,3 @@ -export default function(plugin, change) { - return plugin.changes.unwrapCodeBlock(change, 'paragraph'); +export default function(plugin, editor) { + return plugin.changes.unwrapCodeBlock(editor, 'paragraph'); } diff --git a/tests/unwrapcodeblock-normal/change.js b/tests/unwrapcodeblock-normal/change.js index a01f0cd..def3e34 100644 --- a/tests/unwrapcodeblock-normal/change.js +++ b/tests/unwrapcodeblock-normal/change.js @@ -1,3 +1,3 @@ -export default function(plugin, change) { - return plugin.changes.unwrapCodeBlock(change, 'paragraph'); +export default function(plugin, editor) { + return plugin.changes.unwrapCodeBlock(editor, 'paragraph'); } diff --git a/tests/unwrapcodeblock-selection/change.js b/tests/unwrapcodeblock-selection/change.js index 0aa0661..dc07b9a 100644 --- a/tests/unwrapcodeblock-selection/change.js +++ b/tests/unwrapcodeblock-selection/change.js @@ -1,5 +1,5 @@ -export default function(plugin, change) { - const newValue = plugin.changes.unwrapCodeBlock(change, 'paragraph'); +export default function(plugin, editor) { + const newValue = plugin.changes.unwrapCodeBlock(editor, 'paragraph'); return newValue; } diff --git a/tests/wrapcodeblock-normal/change.js b/tests/wrapcodeblock-normal/change.js index 4110111..5a20f89 100644 --- a/tests/wrapcodeblock-normal/change.js +++ b/tests/wrapcodeblock-normal/change.js @@ -1,3 +1,3 @@ -export default function(plugin, change) { - return plugin.changes.wrapCodeBlock(change); +export default function(plugin, editor) { + return plugin.changes.wrapCodeBlock(editor); } diff --git a/tests/wrapcodeblock-selection/change.js b/tests/wrapcodeblock-selection/change.js index 2e3f837..d78a6ca 100755 --- a/tests/wrapcodeblock-selection/change.js +++ b/tests/wrapcodeblock-selection/change.js @@ -1,9 +1,9 @@ import assert from 'assert'; -export default function(plugin, change) { - plugin.changes.wrapCodeBlock(change); +export default function(plugin, editor) { + plugin.changes.wrapCodeBlock(editor); - assert.equal(change.value.selection.start.offset, 5); + assert.equal(editor.value.selection.start.offset, 5); - return change; + return editor; } diff --git a/tests/wrapcodeblock-with-inline/change.js b/tests/wrapcodeblock-with-inline/change.js index 4110111..5a20f89 100644 --- a/tests/wrapcodeblock-with-inline/change.js +++ b/tests/wrapcodeblock-with-inline/change.js @@ -1,3 +1,3 @@ -export default function(plugin, change) { - return plugin.changes.wrapCodeBlock(change); +export default function(plugin, editor) { + return plugin.changes.wrapCodeBlock(editor); } diff --git a/yarn.lock b/yarn.lock index b4698bc..f285ef0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -254,7 +254,8 @@ are-we-there-yet@~1.1.2: argparse@^1.0.7: version "1.0.10" - resolved "http://registry.npm.taobao.org/argparse/download/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" + resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" + integrity sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg== dependencies: sprintf-js "~1.0.2" @@ -281,7 +282,8 @@ array-filter@~0.0.0: array-find-index@^1.0.1: version "1.0.2" - resolved "http://registry.npm.taobao.org/array-find-index/download/array-find-index-1.0.2.tgz#df010aa1287e164bbda6f9723b0a96a1ec4187a1" + resolved "https://registry.yarnpkg.com/array-find-index/-/array-find-index-1.0.2.tgz#df010aa1287e164bbda6f9723b0a96a1ec4187a1" + integrity sha1-3wEKoSh+Fku9pvlyOwqWoexBh6E= array-includes@^3.0.3: version "3.0.3" @@ -1265,7 +1267,8 @@ buffer@^4.1.0: builtin-modules@^1.0.0: version "1.1.1" - resolved "http://registry.npm.taobao.org/builtin-modules/download/builtin-modules-1.1.1.tgz#270f076c5a72c02f5b65a47df94c5fe3a278892f" + resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-1.1.1.tgz#270f076c5a72c02f5b65a47df94c5fe3a278892f" + integrity sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8= builtin-status-codes@^3.0.0: version "3.0.0" @@ -1287,7 +1290,8 @@ callsites@^0.2.0: camelcase-keys@^4.0.0: version "4.2.0" - resolved "http://registry.npm.taobao.org/camelcase-keys/download/camelcase-keys-4.2.0.tgz#a2aa5fb1af688758259c32c141426d78923b9b77" + resolved "https://registry.yarnpkg.com/camelcase-keys/-/camelcase-keys-4.2.0.tgz#a2aa5fb1af688758259c32c141426d78923b9b77" + integrity sha1-oqpfsa9oh1glnDLBQUJteJI7m3c= dependencies: camelcase "^4.1.0" map-obj "^2.0.0" @@ -1295,7 +1299,8 @@ camelcase-keys@^4.0.0: camelcase@^4.1.0: version "4.1.0" - resolved "http://registry.npm.taobao.org/camelcase/download/camelcase-4.1.0.tgz#d545635be1e33c542649c69173e5de6acfae34dd" + resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-4.1.0.tgz#d545635be1e33c542649c69173e5de6acfae34dd" + integrity sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0= chalk@^1.1.3: version "1.1.3" @@ -1531,7 +1536,8 @@ crypto-browserify@^3.0.0: currently-unhandled@^0.4.1: version "0.4.1" - resolved "http://registry.npm.taobao.org/currently-unhandled/download/currently-unhandled-0.4.1.tgz#988df33feab191ef799a61369dd76c17adf957ea" + resolved "https://registry.yarnpkg.com/currently-unhandled/-/currently-unhandled-0.4.1.tgz#988df33feab191ef799a61369dd76c17adf957ea" + integrity sha1-mI3zP+qxke95mmE2nddsF635V+o= dependencies: array-find-index "^1.0.1" @@ -1563,14 +1569,16 @@ debug@^3.1.0: decamelize-keys@^1.0.0: version "1.1.0" - resolved "http://registry.npm.taobao.org/decamelize-keys/download/decamelize-keys-1.1.0.tgz#d171a87933252807eb3cb61dc1c1445d078df2d9" + resolved "https://registry.yarnpkg.com/decamelize-keys/-/decamelize-keys-1.1.0.tgz#d171a87933252807eb3cb61dc1c1445d078df2d9" + integrity sha1-0XGoeTMlKAfrPLYdwcFEXQeN8tk= dependencies: decamelize "^1.1.0" map-obj "^1.0.0" decamelize@^1.1.0: version "1.2.0" - resolved "http://registry.npm.taobao.org/decamelize/download/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" + resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" + integrity sha1-9lNNFRSCabIDUue+4m9QH5oZEpA= deep-extend@^0.6.0: version "0.6.0" @@ -1932,7 +1940,8 @@ espree@^3.5.4: esprima@^4.0.0: version "4.0.1" - resolved "http://registry.npm.taobao.org/esprima/download/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" + resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" + integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== esquery@^1.0.0: version "1.0.1" @@ -2075,7 +2084,8 @@ find-up@^1.0.0: find-up@^2.0.0: version "2.1.0" - resolved "http://registry.npm.taobao.org/find-up/download/find-up-2.1.0.tgz#45d1b7e506c717ddd482775a2b77920a3c0c57a7" + resolved "https://registry.yarnpkg.com/find-up/-/find-up-2.1.0.tgz#45d1b7e506c717ddd482775a2b77920a3c0c57a7" + integrity sha1-RdG35QbHF93UgndaK3eSCjwMV6c= dependencies: locate-path "^2.0.0" @@ -2158,9 +2168,10 @@ get-document@1: version "1.0.0" resolved "http://registry.npm.taobao.org/get-document/download/get-document-1.0.0.tgz#4821bce66f1c24cb0331602be6cb6b12c4f01c4b" -get-own-enumerable-property-symbols@^2.0.1: - version "2.0.1" - resolved "http://registry.npm.taobao.org/get-own-enumerable-property-symbols/download/get-own-enumerable-property-symbols-2.0.1.tgz#5c4ad87f2834c4b9b4e84549dc1e0650fb38c24b" +get-own-enumerable-property-symbols@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/get-own-enumerable-property-symbols/-/get-own-enumerable-property-symbols-3.0.0.tgz#b877b49a5c16aefac3655f2ed2ea5b684df8d203" + integrity sha512-CIJYJC4GGF06TakLg8z4GQKvDsx9EMspVxOYih7LerEL/WosUnFIww45CGfxfeKHqlg3twgUrYRT1O3WQqjGCg== get-stdin@^5.0.1: version "5.0.1" @@ -2263,7 +2274,12 @@ graceful-fs@4.1.2: version "4.1.2" resolved "http://registry.npm.taobao.org/graceful-fs/download/graceful-fs-4.1.2.tgz#fe2239b7574972e67e41f808823f9bfa4a991e37" -graceful-fs@^4.1.2, graceful-fs@^4.1.4: +graceful-fs@^4.1.2: + version "4.1.15" + resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.15.tgz#ffb703e1066e8a0eeaa4c8b80ba9253eeefbfb00" + integrity sha512-6uHUhOPEBgQ24HM+r6b/QwWfZq+yiFcipKFrOFiBEnWdy5sdzYoi+pJeQaPI5qOLRFqWmAXUPQNsielzdLoecA== + +graceful-fs@^4.1.4: version "4.1.11" resolved "http://registry.npm.taobao.org/graceful-fs/download/graceful-fs-4.1.11.tgz#0e8bdfe4d1ddb8854d64e04ea7c00e2a026e5658" @@ -2338,7 +2354,8 @@ home-or-tmp@^2.0.0: hosted-git-info@^2.1.4: version "2.7.1" - resolved "http://registry.npm.taobao.org/hosted-git-info/download/hosted-git-info-2.7.1.tgz#97f236977bd6e125408930ff6de3eec6281ec047" + resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.7.1.tgz#97f236977bd6e125408930ff6de3eec6281ec047" + integrity sha512-7T/BxH19zbcCTa8XkMlbK5lTo1WtgkFi3GvdWEyNuc4Vex7/9Dqbnpsf4JMydcfj9HCg4zUWFTL3Za6lapg5/w== htmlescape@^1.1.0: version "1.1.1" @@ -2399,7 +2416,8 @@ imurmurhash@^0.1.4: indent-string@^3.0.0, indent-string@^3.2.0: version "3.2.0" - resolved "http://registry.npm.taobao.org/indent-string/download/indent-string-3.2.0.tgz#4a5fd6d27cc332f37e5419a504dbb837105c9289" + resolved "https://registry.yarnpkg.com/indent-string/-/indent-string-3.2.0.tgz#4a5fd6d27cc332f37e5419a504dbb837105c9289" + integrity sha1-Sl/W0nzDMvN+VBmlBNu4NxBckok= indexof@0.0.1: version "0.0.1" @@ -2472,7 +2490,8 @@ invariant@^2.2.0, invariant@^2.2.2: is-arrayish@^0.2.1: version "0.2.1" - resolved "http://registry.npm.taobao.org/is-arrayish/download/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d" + resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d" + integrity sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0= is-arrow-function@^2.0.3: version "2.0.3" @@ -2496,7 +2515,8 @@ is-buffer@^1.1.0, is-buffer@^1.1.5: is-builtin-module@^1.0.0: version "1.0.0" - resolved "http://registry.npm.taobao.org/is-builtin-module/download/is-builtin-module-1.0.0.tgz#540572d34f7ac3119f8f76c30cbc1b1e037affbe" + resolved "https://registry.yarnpkg.com/is-builtin-module/-/is-builtin-module-1.0.0.tgz#540572d34f7ac3119f8f76c30cbc1b1e037affbe" + integrity sha1-VAVy0096wxGfj3bDDLwbHgN6/74= dependencies: builtin-modules "^1.0.0" @@ -2568,6 +2588,11 @@ is-glob@^2.0.0, is-glob@^2.0.1: dependencies: is-extglob "^1.0.0" +is-hotkey@0.1.4: + version "0.1.4" + resolved "https://registry.yarnpkg.com/is-hotkey/-/is-hotkey-0.1.4.tgz#c34d2c85d6ec8d09a871dcf71931c8067a824c7d" + integrity sha512-Py+aW4r5mBBY18TGzGz286/gKS+fCQ0Hee3qkaiSmEPiD0PqFpe0wuA3l7rTOUKyeXl8Mxf3XzJxIoTlSv+kxA== + is-hotkey@^0.1.3: version "0.1.3" resolved "http://registry.npm.taobao.org/is-hotkey/download/is-hotkey-0.1.3.tgz#8a129eec16f3941bd4f37191e02b9c3e91950549" @@ -2592,7 +2617,8 @@ is-number@^4.0.0: is-obj@^1.0.1: version "1.0.1" - resolved "http://registry.npm.taobao.org/is-obj/download/is-obj-1.0.1.tgz#3e4729ac1f5fde025cd7d83a896dab9f4f67db0f" + resolved "https://registry.yarnpkg.com/is-obj/-/is-obj-1.0.1.tgz#3e4729ac1f5fde025cd7d83a896dab9f4f67db0f" + integrity sha1-PkcprB9f3gJc19g6iW2rn09n2w8= is-path-cwd@^1.0.0: version "1.0.0" @@ -2612,11 +2638,13 @@ is-path-inside@^1.0.0: is-plain-obj@^1.1.0: version "1.1.0" - resolved "http://registry.npm.taobao.org/is-plain-obj/download/is-plain-obj-1.1.0.tgz#71a50c8429dfca773c92a390a4a03b39fcd51d3e" + resolved "https://registry.yarnpkg.com/is-plain-obj/-/is-plain-obj-1.1.0.tgz#71a50c8429dfca773c92a390a4a03b39fcd51d3e" + integrity sha1-caUMhCnfync8kqOQpKA7OfzVHT4= is-plain-object@^2.0.4: version "2.0.4" - resolved "http://registry.npm.taobao.org/is-plain-object/download/is-plain-object-2.0.4.tgz#2c163b3fafb1b606d9d17928f05c2a1c38e07677" + resolved "https://registry.yarnpkg.com/is-plain-object/-/is-plain-object-2.0.4.tgz#2c163b3fafb1b606d9d17928f05c2a1c38e07677" + integrity sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og== dependencies: isobject "^3.0.1" @@ -2640,7 +2668,8 @@ is-regex@^1.0.3, is-regex@^1.0.4: is-regexp@^1.0.0: version "1.0.0" - resolved "http://registry.npm.taobao.org/is-regexp/download/is-regexp-1.0.0.tgz#fd2d883545c46bac5a633e7b9a09e87fa2cb5069" + resolved "https://registry.yarnpkg.com/is-regexp/-/is-regexp-1.0.0.tgz#fd2d883545c46bac5a633e7b9a09e87fa2cb5069" + integrity sha1-/S2INUXEa6xaYz57mgnof6LLUGk= is-resolvable@^1.0.0: version "1.1.0" @@ -2682,7 +2711,8 @@ isobject@^2.0.0: isobject@^3.0.1: version "3.0.1" - resolved "http://registry.npm.taobao.org/isobject/download/isobject-3.0.1.tgz#4e431e92b11a9731636aa1f9c8d1ccbcfdab78df" + resolved "https://registry.yarnpkg.com/isobject/-/isobject-3.0.1.tgz#4e431e92b11a9731636aa1f9c8d1ccbcfdab78df" + integrity sha1-TkMekrEalzFjaqH5yNHMvP2reN8= isomorphic-base64@^1.0.2: version "1.0.2" @@ -2707,7 +2737,7 @@ js-tokens@^3.0.0, js-tokens@^3.0.2: version "4.0.0" resolved "http://registry.npm.taobao.org/js-tokens/download/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" -js-yaml@^3.10.0, js-yaml@^3.9.1: +js-yaml@^3.12.0, js-yaml@^3.9.1: version "3.12.0" resolved "http://registry.npm.taobao.org/js-yaml/download/js-yaml-3.12.0.tgz#eaed656ec8344f10f527c6bfa1b6e2244de167d1" dependencies: @@ -2728,7 +2758,8 @@ jsesc@~0.5.0: json-parse-better-errors@^1.0.1: version "1.0.2" - resolved "http://registry.npm.taobao.org/json-parse-better-errors/download/json-parse-better-errors-1.0.2.tgz#bb867cfb3450e69107c131d1c514bab3dc8bcaa9" + resolved "https://registry.yarnpkg.com/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz#bb867cfb3450e69107c131d1c514bab3dc8bcaa9" + integrity sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw== json-schema-traverse@^0.3.0: version "0.3.1" @@ -2806,7 +2837,8 @@ load-json-file@^2.0.0: load-json-file@^4.0.0: version "4.0.0" - resolved "http://registry.npm.taobao.org/load-json-file/download/load-json-file-4.0.0.tgz#2f5f45ab91e33216234fd53adab668eb4ec0993b" + resolved "https://registry.yarnpkg.com/load-json-file/-/load-json-file-4.0.0.tgz#2f5f45ab91e33216234fd53adab668eb4ec0993b" + integrity sha1-L19Fq5HjMhYjT9U62rZo607AmTs= dependencies: graceful-fs "^4.1.2" parse-json "^4.0.0" @@ -2815,7 +2847,8 @@ load-json-file@^4.0.0: locate-path@^2.0.0: version "2.0.0" - resolved "http://registry.npm.taobao.org/locate-path/download/locate-path-2.0.0.tgz#2b568b265eec944c6d9c0de9c3dbbbca0354cd8e" + resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-2.0.0.tgz#2b568b265eec944c6d9c0de9c3dbbbca0354cd8e" + integrity sha1-K1aLJl7slExtnA3pw9u7ygNUzY4= dependencies: p-locate "^2.0.0" path-exists "^3.0.0" @@ -2883,7 +2916,8 @@ loose-envify@^1.0.0, loose-envify@^1.1.0, loose-envify@^1.3.1: loud-rejection@^1.0.0: version "1.6.0" - resolved "http://registry.npm.taobao.org/loud-rejection/download/loud-rejection-1.6.0.tgz#5b46f80147edee578870f086d04821cf998e551f" + resolved "https://registry.yarnpkg.com/loud-rejection/-/loud-rejection-1.6.0.tgz#5b46f80147edee578870f086d04821cf998e551f" + integrity sha1-W0b4AUft7leIcPCG0Eghz5mOVR8= dependencies: currently-unhandled "^0.4.1" signal-exit "^3.0.0" @@ -2897,11 +2931,13 @@ lru-cache@^4.0.1: map-obj@^1.0.0: version "1.0.1" - resolved "http://registry.npm.taobao.org/map-obj/download/map-obj-1.0.1.tgz#d933ceb9205d82bdcf4886f6742bdc2b4dea146d" + resolved "https://registry.yarnpkg.com/map-obj/-/map-obj-1.0.1.tgz#d933ceb9205d82bdcf4886f6742bdc2b4dea146d" + integrity sha1-2TPOuSBdgr3PSIb2dCvcK03qFG0= map-obj@^2.0.0: version "2.0.0" - resolved "http://registry.npm.taobao.org/map-obj/download/map-obj-2.0.0.tgz#a65cd29087a92598b8791257a523e021222ac1f9" + resolved "https://registry.yarnpkg.com/map-obj/-/map-obj-2.0.0.tgz#a65cd29087a92598b8791257a523e021222ac1f9" + integrity sha1-plzSkIepJZi4eRJXpSPgISIqwfk= math-random@^1.0.1: version "1.0.1" @@ -2918,19 +2954,20 @@ memoize-one@^4.0.0: version "4.0.0" resolved "http://registry.npm.taobao.org/memoize-one/download/memoize-one-4.0.0.tgz#fc5e2f1427a216676a62ec652cf7398cfad123db" -meow@^4.0.0: - version "4.0.1" - resolved "http://registry.npm.taobao.org/meow/download/meow-4.0.1.tgz#d48598f6f4b1472f35bf6317a95945ace347f975" +meow@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/meow/-/meow-5.0.0.tgz#dfc73d63a9afc714a5e371760eb5c88b91078aa4" + integrity sha512-CbTqYU17ABaLefO8vCU153ZZlprKYWDljcndKKDCFcYQITzWCXZAVk4QMFZPgvzrnUQ3uItnIE/LoUOwrT15Ig== dependencies: camelcase-keys "^4.0.0" decamelize-keys "^1.0.0" loud-rejection "^1.0.0" - minimist "^1.1.3" minimist-options "^3.0.1" normalize-package-data "^2.3.4" read-pkg-up "^3.0.0" redent "^2.0.0" trim-newlines "^2.0.0" + yargs-parser "^10.0.0" micromatch@^2.1.5: version "2.3.11" @@ -2985,7 +3022,8 @@ minimalistic-crypto-utils@^1.0.0, minimalistic-crypto-utils@^1.0.1: minimist-options@^3.0.1: version "3.0.2" - resolved "http://registry.npm.taobao.org/minimist-options/download/minimist-options-3.0.2.tgz#fba4c8191339e13ecf4d61beb03f070103f3d954" + resolved "https://registry.yarnpkg.com/minimist-options/-/minimist-options-3.0.2.tgz#fba4c8191339e13ecf4d61beb03f070103f3d954" + integrity sha512-FyBrT/d0d4+uiZRbqznPXqw3IpZZG3gl3wKWiX784FycUKVwBt0uLBFkQrtE4tZOrgo78nZp2jnKz3L65T5LdQ== dependencies: arrify "^1.0.1" is-plain-obj "^1.1.0" @@ -2994,7 +3032,7 @@ minimist@0.0.8: version "0.0.8" resolved "http://registry.npm.taobao.org/minimist/download/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" -minimist@^1.1.0, minimist@^1.1.3, minimist@^1.2.0: +minimist@^1.1.0, minimist@^1.2.0: version "1.2.0" resolved "http://registry.npm.taobao.org/minimist/download/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284" @@ -3113,7 +3151,8 @@ nopt@^4.0.1: normalize-package-data@^2.3.2, normalize-package-data@^2.3.4: version "2.4.0" - resolved "http://registry.npm.taobao.org/normalize-package-data/download/normalize-package-data-2.4.0.tgz#12f95a307d58352075a04907b84ac8be98ac012f" + resolved "https://registry.yarnpkg.com/normalize-package-data/-/normalize-package-data-2.4.0.tgz#12f95a307d58352075a04907b84ac8be98ac012f" + integrity sha512-9jjUFbTPfEy3R/ad/2oNbKtW9Hgovl5O1FvFWKkKblNXoN/Oou6+9+KKohPK13Yc3/TyunyWhJp6gvRNR/PPAw== dependencies: hosted-git-info "^2.1.4" is-builtin-module "^1.0.0" @@ -3241,19 +3280,22 @@ output-file-sync@^1.1.2: p-limit@^1.1.0: version "1.3.0" - resolved "http://registry.npm.taobao.org/p-limit/download/p-limit-1.3.0.tgz#b86bd5f0c25690911c7590fcbfc2010d54b3ccb8" + resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-1.3.0.tgz#b86bd5f0c25690911c7590fcbfc2010d54b3ccb8" + integrity sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q== dependencies: p-try "^1.0.0" p-locate@^2.0.0: version "2.0.0" - resolved "http://registry.npm.taobao.org/p-locate/download/p-locate-2.0.0.tgz#20a0103b222a70c8fd39cc2e580680f3dde5ec43" + resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-2.0.0.tgz#20a0103b222a70c8fd39cc2e580680f3dde5ec43" + integrity sha1-IKAQOyIqcMj9OcwuWAaA893l7EM= dependencies: p-limit "^1.1.0" p-try@^1.0.0: version "1.0.0" - resolved "http://registry.npm.taobao.org/p-try/download/p-try-1.0.0.tgz#cbc79cdbaf8fd4228e13f621f2b1a237c1b207b3" + resolved "https://registry.yarnpkg.com/p-try/-/p-try-1.0.0.tgz#cbc79cdbaf8fd4228e13f621f2b1a237c1b207b3" + integrity sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M= pako@~0.2.0: version "0.2.9" @@ -3292,7 +3334,8 @@ parse-json@^2.2.0: parse-json@^4.0.0: version "4.0.0" - resolved "http://registry.npm.taobao.org/parse-json/download/parse-json-4.0.0.tgz#be35f5425be1f7f6c747184f98a788cb99477ee0" + resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-4.0.0.tgz#be35f5425be1f7f6c747184f98a788cb99477ee0" + integrity sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA= dependencies: error-ex "^1.3.1" json-parse-better-errors "^1.0.1" @@ -3309,7 +3352,8 @@ path-exists@^2.0.0: path-exists@^3.0.0: version "3.0.0" - resolved "http://registry.npm.taobao.org/path-exists/download/path-exists-3.0.0.tgz#ce0ebeaa5f78cb18925ea7d810d7b59b010fd515" + resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-3.0.0.tgz#ce0ebeaa5f78cb18925ea7d810d7b59b010fd515" + integrity sha1-zg6+ql94yxiSXqfYENe1mwEP1RU= path-is-absolute@^1.0.0, path-is-absolute@^1.0.1: version "1.0.1" @@ -3335,7 +3379,8 @@ path-type@^2.0.0: path-type@^3.0.0: version "3.0.0" - resolved "http://registry.npm.taobao.org/path-type/download/path-type-3.0.0.tgz#cef31dc8e0a1a3bb0d105c0cd97cf3bf47f4e36f" + resolved "https://registry.yarnpkg.com/path-type/-/path-type-3.0.0.tgz#cef31dc8e0a1a3bb0d105c0cd97cf3bf47f4e36f" + integrity sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg== dependencies: pify "^3.0.0" @@ -3355,7 +3400,8 @@ pify@^2.0.0: pify@^3.0.0: version "3.0.0" - resolved "http://registry.npm.taobao.org/pify/download/pify-3.0.0.tgz#e5a4acd2c101fdf3d9a4d07f0dbc4db49dd28176" + resolved "https://registry.yarnpkg.com/pify/-/pify-3.0.0.tgz#e5a4acd2c101fdf3d9a4d07f0dbc4db49dd28176" + integrity sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY= pinkie-promise@^2.0.0: version "2.0.1" @@ -3392,9 +3438,10 @@ preserve@^0.2.0: version "0.2.0" resolved "http://registry.npm.taobao.org/preserve/download/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b" -prettier@1.6.1: - version "1.6.1" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.6.1.tgz#850f411a3116226193e32ea5acfc21c0f9a76d7d" +prettier@1.13.6: + version "1.13.6" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.13.6.tgz#00ae0b777ad92f81a9e7a1df2f0470b6dab0cb44" + integrity sha512-p5eqCNiohWZN++7aJXUVj0JgLqHCPLf9GLIcLBHGNWs4Y9FJOPs6+KNO2WT0udJIQJTbeZFrJkjzjcb8fkAYYQ== prettier@^1.13.3: version "1.14.2" @@ -3496,7 +3543,8 @@ querystring@0.2.0: quick-lru@^1.0.0: version "1.1.0" - resolved "http://registry.npm.taobao.org/quick-lru/download/quick-lru-1.1.0.tgz#4360b17c61136ad38078397ff11416e186dcfbb8" + resolved "https://registry.yarnpkg.com/quick-lru/-/quick-lru-1.1.0.tgz#4360b17c61136ad38078397ff11416e186dcfbb8" + integrity sha1-Q2CxfGETatOAeDl/8RQW4Ybc+7g= randomatic@^3.0.0: version "3.1.0" @@ -3566,7 +3614,8 @@ read-pkg-up@^2.0.0: read-pkg-up@^3.0.0: version "3.0.0" - resolved "http://registry.npm.taobao.org/read-pkg-up/download/read-pkg-up-3.0.0.tgz#3ed496685dba0f8fe118d0691dc51f4a1ff96f07" + resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-3.0.0.tgz#3ed496685dba0f8fe118d0691dc51f4a1ff96f07" + integrity sha1-PtSWaF26D4/hGNBpHcUfSh/5bwc= dependencies: find-up "^2.0.0" read-pkg "^3.0.0" @@ -3581,7 +3630,8 @@ read-pkg@^2.0.0: read-pkg@^3.0.0: version "3.0.0" - resolved "http://registry.npm.taobao.org/read-pkg/download/read-pkg-3.0.0.tgz#9cbc686978fee65d16c00e2b19c237fcf6e38389" + resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-3.0.0.tgz#9cbc686978fee65d16c00e2b19c237fcf6e38389" + integrity sha1-nLxoaXj+5l0WwA4rGcI3/Pbjg4k= dependencies: load-json-file "^4.0.0" normalize-package-data "^2.3.2" @@ -3621,7 +3671,8 @@ readdirp@^2.0.0: redent@^2.0.0: version "2.0.0" - resolved "http://registry.npm.taobao.org/redent/download/redent-2.0.0.tgz#c1b2007b42d57eb1389079b3c8333639d5e1ccaa" + resolved "https://registry.yarnpkg.com/redent/-/redent-2.0.0.tgz#c1b2007b42d57eb1389079b3c8333639d5e1ccaa" + integrity sha1-wbIAe0LVfrE4kHmzyDM2OdXhzKo= dependencies: indent-string "^3.0.0" strip-indent "^2.0.0" @@ -3769,7 +3820,12 @@ selection-is-backward@^1.0.0: version "1.0.0" resolved "http://registry.npm.taobao.org/selection-is-backward/download/selection-is-backward-1.0.0.tgz#97a54633188a511aba6419fc5c1fa91b467e6be1" -"semver@2 || 3 || 4 || 5", semver@^5.3.0: +"semver@2 || 3 || 4 || 5": + version "5.6.0" + resolved "https://registry.yarnpkg.com/semver/-/semver-5.6.0.tgz#7e74256fbaa49c75aa7c7a205cc22799cac80004" + integrity sha512-RS9R6R35NYgQn++fkDWaOmqGoj4Ek9gGs+DPxNUZKuwE183xjJroKvyo1IzVFeXvUrvmALy6FWD5xrdJT25gMg== + +semver@^5.3.0: version "5.5.1" resolved "http://registry.npm.taobao.org/semver/download/semver-5.5.1.tgz#7dfdd8814bdb7cabc7be0fb1d734cfb66c940477" @@ -3820,7 +3876,8 @@ shell-quote@^1.6.1: signal-exit@^3.0.0, signal-exit@^3.0.2: version "3.0.2" - resolved "http://registry.npm.taobao.org/signal-exit/download/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d" + resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d" + integrity sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0= simple-concat@^1.0.0: version "1.0.0" @@ -3830,9 +3887,10 @@ slash@^1.0.0: version "1.0.0" resolved "http://registry.npm.taobao.org/slash/download/slash-1.0.0.tgz#c41f2f6c39fc16d1cd17ad4b5d896114ae470d55" -slate-base64-serializer@^0.2.63: - version "0.2.63" - resolved "http://registry.npm.taobao.org/slate-base64-serializer/download/slate-base64-serializer-0.2.63.tgz#b086dfce5145c29b8465dc54ff5493b726ddca07" +slate-base64-serializer@^0.2.91: + version "0.2.91" + resolved "https://registry.yarnpkg.com/slate-base64-serializer/-/slate-base64-serializer-0.2.91.tgz#d66fe202288dedc6cf0189f20c36fce695d54580" + integrity sha512-kZIklWhDurFmFEWJjIao0rg3d+oDLhMqENne57lpYcKCM/DWAVK8Ohx9KlaamX87hEr6moUtkqbJ9PyTFXoZlg== dependencies: isomorphic-base64 "^1.0.2" @@ -3842,45 +3900,52 @@ slate-dev-environment@^0.2.0: dependencies: is-in-browser "^1.1.3" -slate-dev-warning@^0.0.1: - version "0.0.1" - resolved "http://registry.npm.taobao.org/slate-dev-warning/download/slate-dev-warning-0.0.1.tgz#f6c36731babea5e301b5bd504fe64911dd24200a" - -slate-hotkeys@^0.2.3: - version "0.2.3" - resolved "http://registry.npm.taobao.org/slate-hotkeys/download/slate-hotkeys-0.2.3.tgz#843a467421c643b4a1a3c240957c8adcfa99deb3" +slate-hotkeys@^0.2.7: + version "0.2.7" + resolved "https://registry.yarnpkg.com/slate-hotkeys/-/slate-hotkeys-0.2.7.tgz#a5b613ced4af931b2d74a206f985ee2c63f3b0f9" + integrity sha512-k6iaR24w15CSM24jbi6My4WD2ePw4Byn8x3ARz3UtKrfSEO4F8Er/aPxegLhBujNE9u041uBMGeua44rlhemkw== dependencies: - is-hotkey "^0.1.3" + is-hotkey "0.1.4" slate-dev-environment "^0.2.0" slate-hyperprint@^2.2.4: - version "2.2.4" - resolved "http://registry.npm.taobao.org/slate-hyperprint/download/slate-hyperprint-2.2.4.tgz#879a421b78d0d82eba07b74b90bac1ccea3f399e" + version "2.2.6" + resolved "https://registry.yarnpkg.com/slate-hyperprint/-/slate-hyperprint-2.2.6.tgz#5c616be1a2f36ec49af261a3a052782e9d90152a" + integrity sha512-1tWNkef6QNagq28YMUweByQx9N8LgwBmbecy6Xx5fyuq4R/zcCET46sDTVidBPwE6sSJsPvxGJCAC6cQavEGyw== dependencies: indent-string "^3.2.0" is-plain-object "^2.0.4" - js-yaml "^3.10.0" - meow "^4.0.0" - prettier "1.6.1" + js-yaml "^3.12.0" + meow "^5.0.0" + prettier "1.13.6" stringify-object "^3.2.2" -slate-hyperscript@^0.10.2: - version "0.10.2" - resolved "http://registry.npm.taobao.org/slate-hyperscript/download/slate-hyperscript-0.10.2.tgz#b47b2605d9a98b6e9467007b8d5c240dda0d683b" +slate-hyperscript@^0.11.0: + version "0.11.21" + resolved "https://registry.yarnpkg.com/slate-hyperscript/-/slate-hyperscript-0.11.21.tgz#ce960ab17daef81cb6d243426dc06566ac6907e9" + integrity sha512-dgh1lXygL7CJKW+JeQEMPhwfsItLRW7rV4IKWfyP9nh/bE8U3yp7EssZKaOpKuZ6Q0+L2Z68SQcNWwUYxmLYwg== dependencies: is-plain-object "^2.0.4" -slate-plain-serializer@^0.6.2: - version "0.6.2" - resolved "http://registry.npm.taobao.org/slate-plain-serializer/download/slate-plain-serializer-0.6.2.tgz#8d406f9523d7ba219d14bf300d30d7e093430247" +slate-plain-serializer@^0.6.30: + version "0.6.30" + resolved "https://registry.yarnpkg.com/slate-plain-serializer/-/slate-plain-serializer-0.6.30.tgz#2a18aac879988eacf7ef370d735c1aff2d70131b" + integrity sha512-+Zz2VaYhshXztavHXYKfA7MT/w4sQHxe9X3a9uTqP/N5nIHswln82UdGZSDXPtI7XnBbU/depxhQPTPhUxOE8Q== + +slate-prop-types@^0.5.21: + version "0.5.21" + resolved "https://registry.yarnpkg.com/slate-prop-types/-/slate-prop-types-0.5.21.tgz#996e0b2a219d7c7da0e127f6d31b2fb19b688ae7" + integrity sha512-fYp+12rofb4sp3/V0l5w9ji9M4f+UbtbyIIDWcfKjFMjmBh6ViksbG3gB334bErS79rwtq0LzNF5sVSUuP5kgg== -slate-prop-types@^0.4.61: - version "0.4.61" - resolved "http://registry.npm.taobao.org/slate-prop-types/download/slate-prop-types-0.4.61.tgz#141c109bed81b130dd03ab86dd7541b28d6d962a" +slate-react-placeholder@^0.1.9: + version "0.1.9" + resolved "https://registry.yarnpkg.com/slate-react-placeholder/-/slate-react-placeholder-0.1.9.tgz#683aaa4542c91b55552c51e4649d76ca778e14fb" + integrity sha512-Y4AB8QG0PK7jsCAkFfh4jX7+qLR2VIs5JbVuqorRPUcbA6iQk/gm0CylaUEEFCVEf6JiCd6yAwjRm38xSQQsmw== -slate-react@^0.18.5: - version "0.18.5" - resolved "http://registry.npm.taobao.org/slate-react/download/slate-react-0.18.5.tgz#089ae30cd19b7600a9b528b5ab0525038b500142" +slate-react@^0.21.0: + version "0.21.12" + resolved "https://registry.yarnpkg.com/slate-react/-/slate-react-0.21.12.tgz#e3bee253324167ebb5185a6587c5450558575c23" + integrity sha512-eTdHQrAUKt2ep/HjuWn1cCEzs16xJw0owHdku76PVoezaxHpOGxRTBVppjQzy57eAOIngdo0LkdiT4c9BpO19A== dependencies: debug "^3.1.0" get-window "^1.1.1" @@ -3890,27 +3955,31 @@ slate-react@^0.18.5: prop-types "^15.5.8" react-immutable-proptypes "^2.1.0" selection-is-backward "^1.0.0" - slate-base64-serializer "^0.2.63" + slate-base64-serializer "^0.2.91" slate-dev-environment "^0.2.0" - slate-dev-warning "^0.0.1" - slate-hotkeys "^0.2.3" - slate-plain-serializer "^0.6.2" - slate-prop-types "^0.4.61" + slate-hotkeys "^0.2.7" + slate-plain-serializer "^0.6.30" + slate-prop-types "^0.5.21" + slate-react-placeholder "^0.1.9" + tiny-invariant "^1.0.1" + tiny-warning "^0.0.3" slate-schema-violations@^0.1.39: version "0.1.39" resolved "http://registry.npm.taobao.org/slate-schema-violations/download/slate-schema-violations-0.1.39.tgz#854ab5624136419cef4c803b1823acabe11f1c15" -slate@^0.40.2: - version "0.40.2" - resolved "http://registry.npm.taobao.org/slate/download/slate-0.40.2.tgz#3adbd4bb66c16208b2dc3f0900b1857ea7912cb0" +slate@^0.44.0: + version "0.44.6" + resolved "https://registry.yarnpkg.com/slate/-/slate-0.44.6.tgz#47ab3127641bc1faa3e5a5b01bfab8861843c82e" + integrity sha512-Q5DASlX7tUXrAaQFb5AliZjAeuXkI1oVq3HM8A/mb4qClwpSpuKq/uOcA3855bFzAOXSjUM/kESK3M3oiIHnNA== dependencies: debug "^3.1.0" direction "^0.1.5" esrever "^0.2.0" is-plain-object "^2.0.4" lodash "^4.17.4" - slate-dev-warning "^0.0.1" + tiny-invariant "^1.0.1" + tiny-warning "^0.0.3" type-of "^2.0.1" slice-ansi@1.0.0: @@ -3930,30 +3999,35 @@ source-map@^0.5.0, source-map@^0.5.6, source-map@^0.5.7, source-map@~0.5.3: resolved "http://registry.npm.taobao.org/source-map/download/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc" spdx-correct@^3.0.0: - version "3.0.0" - resolved "http://registry.npm.taobao.org/spdx-correct/download/spdx-correct-3.0.0.tgz#05a5b4d7153a195bc92c3c425b69f3b2a9524c82" + version "3.0.2" + resolved "https://registry.yarnpkg.com/spdx-correct/-/spdx-correct-3.0.2.tgz#19bb409e91b47b1ad54159243f7312a858db3c2e" + integrity sha512-q9hedtzyXHr5S0A1vEPoK/7l8NpfkFYTq6iCY+Pno2ZbdZR6WexZFtqeVGkGxW3TEJMN914Z55EnAGMmenlIQQ== dependencies: spdx-expression-parse "^3.0.0" spdx-license-ids "^3.0.0" spdx-exceptions@^2.1.0: - version "2.1.0" - resolved "http://registry.npm.taobao.org/spdx-exceptions/download/spdx-exceptions-2.1.0.tgz#2c7ae61056c714a5b9b9b2b2af7d311ef5c78fe9" + version "2.2.0" + resolved "https://registry.yarnpkg.com/spdx-exceptions/-/spdx-exceptions-2.2.0.tgz#2ea450aee74f2a89bfb94519c07fcd6f41322977" + integrity sha512-2XQACfElKi9SlVb1CYadKDXvoajPgBVPn/gOQLrTvHdElaVhr7ZEbqJaRnJLVNeaI4cMEAgVCeBMKF6MWRDCRA== spdx-expression-parse@^3.0.0: version "3.0.0" - resolved "http://registry.npm.taobao.org/spdx-expression-parse/download/spdx-expression-parse-3.0.0.tgz#99e119b7a5da00e05491c9fa338b7904823b41d0" + resolved "https://registry.yarnpkg.com/spdx-expression-parse/-/spdx-expression-parse-3.0.0.tgz#99e119b7a5da00e05491c9fa338b7904823b41d0" + integrity sha512-Yg6D3XpRD4kkOmTpdgbUiEJFKghJH03fiC1OPll5h/0sO6neh2jqRDVHOQ4o/LMea0tgCkbMgea5ip/e+MkWyg== dependencies: spdx-exceptions "^2.1.0" spdx-license-ids "^3.0.0" spdx-license-ids@^3.0.0: - version "3.0.0" - resolved "http://registry.npm.taobao.org/spdx-license-ids/download/spdx-license-ids-3.0.0.tgz#7a7cd28470cc6d3a1cfe6d66886f6bc430d3ac87" + version "3.0.2" + resolved "https://registry.yarnpkg.com/spdx-license-ids/-/spdx-license-ids-3.0.2.tgz#a59efc09784c2a5bada13cfeaf5c75dd214044d2" + integrity sha512-qky9CVt0lVIECkEsYbNILVnPvycuEBkXoMFLRWsREkomQLevYhtRKC+R91a5TOAQ3bCMjikRwhyaRqj1VYatYg== sprintf-js@~1.0.2: version "1.0.3" - resolved "http://registry.npm.taobao.org/sprintf-js/download/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" + resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" + integrity sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw= stream-browserify@^2.0.0: version "2.0.1" @@ -4012,10 +4086,11 @@ string_decoder@~1.1.1: safe-buffer "~5.1.0" stringify-object@^3.2.2: - version "3.2.2" - resolved "http://registry.npm.taobao.org/stringify-object/download/stringify-object-3.2.2.tgz#9853052e5a88fb605a44cd27445aa257ad7ffbcd" + version "3.3.0" + resolved "https://registry.yarnpkg.com/stringify-object/-/stringify-object-3.3.0.tgz#703065aefca19300d3ce88af4f5b3956d7556629" + integrity sha512-rHqiFh1elqCQ9WPLIC8I0Q/g/wj5J1eMkyoiD6eoQApWHP0FtlK7rqnhmabL5VUY9JQCcqwwvlOaSuutekgyrw== dependencies: - get-own-enumerable-property-symbols "^2.0.1" + get-own-enumerable-property-symbols "^3.0.0" is-obj "^1.0.1" is-regexp "^1.0.0" @@ -4033,11 +4108,13 @@ strip-ansi@^4.0.0: strip-bom@^3.0.0: version "3.0.0" - resolved "http://registry.npm.taobao.org/strip-bom/download/strip-bom-3.0.0.tgz#2334c18e9c759f7bdd56fdef7e9ae3d588e68ed3" + resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-3.0.0.tgz#2334c18e9c759f7bdd56fdef7e9ae3d588e68ed3" + integrity sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM= strip-indent@^2.0.0: version "2.0.0" - resolved "http://registry.npm.taobao.org/strip-indent/download/strip-indent-2.0.0.tgz#5ef8db295d01e6ed6cbf7aab96998d7822527b68" + resolved "https://registry.yarnpkg.com/strip-indent/-/strip-indent-2.0.0.tgz#5ef8db295d01e6ed6cbf7aab96998d7822527b68" + integrity sha1-XvjbKV0B5u1sv3qrlpmNeCJSe2g= strip-json-comments@~2.0.1: version "2.0.1" @@ -4115,6 +4192,16 @@ timers-browserify@^1.0.1: dependencies: process "~0.11.0" +tiny-invariant@^1.0.1: + version "1.0.3" + resolved "https://registry.yarnpkg.com/tiny-invariant/-/tiny-invariant-1.0.3.tgz#91efaaa0269ccb6271f0296aeedb05fc3e067b7a" + integrity sha512-ytQx8T4DL8PjlX53yYzcIC0WhIZbpR0p1qcYjw2pHu3w6UtgWwFJQ/02cnhOnBBhlFx/edUIfcagCaQSe3KMWg== + +tiny-warning@^0.0.3: + version "0.0.3" + resolved "https://registry.yarnpkg.com/tiny-warning/-/tiny-warning-0.0.3.tgz#1807eb4c5f81784a6354d58ea1d5024f18c6c81f" + integrity sha512-r0SSA5Y5IWERF9Xh++tFPx0jITBgGggOsRLDWWew6YRw/C2dr4uNO1fw1vanrBmHsICmPyMLNBZboTlxUmUuaA== + tmatch@^2.0.1: version "2.0.1" resolved "http://registry.npm.taobao.org/tmatch/download/tmatch-2.0.1.tgz#0c56246f33f30da1b8d3d72895abaf16660f38cf" @@ -4139,7 +4226,8 @@ to-fast-properties@^2.0.0: trim-newlines@^2.0.0: version "2.0.0" - resolved "http://registry.npm.taobao.org/trim-newlines/download/trim-newlines-2.0.0.tgz#b403d0b91be50c331dfc4b82eeceb22c3de16d20" + resolved "https://registry.yarnpkg.com/trim-newlines/-/trim-newlines-2.0.0.tgz#b403d0b91be50c331dfc4b82eeceb22c3de16d20" + integrity sha1-tAPQuRvlDDMd/EuC7s6yLD3hbSA= trim-right@^1.0.1: version "1.0.1" @@ -4229,7 +4317,8 @@ v8flags@^2.1.1: validate-npm-package-license@^3.0.1: version "3.0.4" - resolved "http://registry.npm.taobao.org/validate-npm-package-license/download/validate-npm-package-license-3.0.4.tgz#fc91f6b9c7ba15c857f4cb2c5defeec39d4f410a" + resolved "https://registry.yarnpkg.com/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz#fc91f6b9c7ba15c857f4cb2c5defeec39d4f410a" + integrity sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew== dependencies: spdx-correct "^3.0.0" spdx-expression-parse "^3.0.0" @@ -4293,3 +4382,10 @@ yallist@^2.1.2: yallist@^3.0.0, yallist@^3.0.2: version "3.0.2" resolved "http://registry.npm.taobao.org/yallist/download/yallist-3.0.2.tgz#8452b4bb7e83c7c188d8041c1a837c773d6d8bb9" + +yargs-parser@^10.0.0: + version "10.1.0" + resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-10.1.0.tgz#7202265b89f7e9e9f2e5765e0fe735a905edbaa8" + integrity sha512-VCIyR1wJoEBZUqk5PA+oOBF6ypbwh5aNB3I50guxAL/quggdfs4TtNHQrSazFA3fYZ+tEqfs0zIGlv0c/rgjbQ== + dependencies: + camelcase "^4.1.0"