@handlewithcare/react-prosemirror 2.8.0-tiptap.10 → 2.8.0-tiptap.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/tiptap/TiptapEditorView.js +2 -1
- package/dist/cjs/tiptap/tiptapNodeView.js +26 -13
- package/dist/esm/tiptap/TiptapEditorView.js +2 -1
- package/dist/esm/tiptap/tiptapNodeView.js +27 -14
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/constants.d.ts +1 -1
- package/dist/types/props.d.ts +26 -26
- package/dist/types/tiptap/TiptapEditorView.d.ts +2 -1
- package/package.json +1 -1
- package/dist/esm/@jest/pattern/src/__tests__/TestPathPatterns.test.js +0 -241
- package/dist/esm/@swc/cli/lib/swc/__tests__/compile.test.js +0 -19
- package/dist/esm/@swc/cli/lib/swc/__tests__/options.test.js +0 -315
- package/dist/esm/@swc/cli/lib/swc/__tests__/sources.test.js +0 -161
- package/dist/esm/@uiw/react-codemirror/src/__tests__/index.test.js +0 -111
- package/dist/esm/cheerio/src/__tests__/deprecated.spec.js +0 -249
- package/dist/esm/cheerio/src/__tests__/xml.spec.js +0 -55
- package/dist/esm/components/__tests__/ProseMirror.composition.test.js +0 -395
- package/dist/esm/components/__tests__/ProseMirror.domchange.test.js +0 -266
- package/dist/esm/components/__tests__/ProseMirror.draw-decoration.test.js +0 -968
- package/dist/esm/components/__tests__/ProseMirror.draw.test.js +0 -335
- package/dist/esm/components/__tests__/ProseMirror.mobile.test.js +0 -54
- package/dist/esm/components/__tests__/ProseMirror.node-view.test.js +0 -553
- package/dist/esm/components/__tests__/ProseMirror.selection.test.js +0 -440
- package/dist/esm/components/__tests__/ProseMirror.test.js +0 -324
- package/dist/esm/contexts/__tests__/DeferredLayoutEffects.test.js +0 -98
- package/dist/esm/hooks/__tests__/useEditorEffect.test.js +0 -134
- package/dist/esm/jsx-ast-utils/__tests__/helper.js +0 -83
- package/dist/esm/jsx-ast-utils/__tests__/src/elementType-test.js +0 -76
- package/dist/esm/jsx-ast-utils/__tests__/src/eventHandlers-test.js +0 -98
- package/dist/esm/jsx-ast-utils/__tests__/src/getProp-parser-test.js +0 -188
- package/dist/esm/jsx-ast-utils/__tests__/src/getProp-test.js +0 -119
- package/dist/esm/jsx-ast-utils/__tests__/src/getPropLiteralValue-babelparser-test.js +0 -393
- package/dist/esm/jsx-ast-utils/__tests__/src/getPropLiteralValue-flowparser-test.js +0 -379
- package/dist/esm/jsx-ast-utils/__tests__/src/getPropValue-babelparser-test.js +0 -925
- package/dist/esm/jsx-ast-utils/__tests__/src/getPropValue-flowparser-test.js +0 -700
- package/dist/esm/jsx-ast-utils/__tests__/src/hasProp-test.js +0 -350
- package/dist/esm/jsx-ast-utils/__tests__/src/index-test.js +0 -24
- package/dist/esm/jsx-ast-utils/__tests__/src/propName-test.js +0 -37
- package/dist/esm/plugins/__tests__/reactKeys.test.js +0 -77
- package/dist/esm/tsconfig-paths/lib/__tests__/config-loader.test.d.js +0 -1
- package/dist/esm/tsconfig-paths/lib/__tests__/config-loader.test.js +0 -97
- package/dist/esm/tsconfig-paths/lib/__tests__/data/match-path-data.d.js +0 -1
- package/dist/esm/tsconfig-paths/lib/__tests__/data/match-path-data.js +0 -319
- package/dist/esm/tsconfig-paths/lib/__tests__/filesystem.test.d.js +0 -1
- package/dist/esm/tsconfig-paths/lib/__tests__/filesystem.test.js +0 -62
- package/dist/esm/tsconfig-paths/lib/__tests__/mapping-entry.test.d.js +0 -1
- package/dist/esm/tsconfig-paths/lib/__tests__/mapping-entry.test.js +0 -80
- package/dist/esm/tsconfig-paths/lib/__tests__/match-path-async.test.d.js +0 -1
- package/dist/esm/tsconfig-paths/lib/__tests__/match-path-async.test.js +0 -22
- package/dist/esm/tsconfig-paths/lib/__tests__/match-path-sync.test.d.js +0 -1
- package/dist/esm/tsconfig-paths/lib/__tests__/match-path-sync.test.js +0 -20
- package/dist/esm/tsconfig-paths/lib/__tests__/try-path.test.d.js +0 -1
- package/dist/esm/tsconfig-paths/lib/__tests__/try-path.test.js +0 -219
- package/dist/esm/tsconfig-paths/lib/__tests__/tsconfig-loader.test.d.js +0 -1
- package/dist/esm/tsconfig-paths/lib/__tests__/tsconfig-loader.test.js +0 -323
- package/dist/esm/tsconfig-paths/src/__tests__/config-loader.test.js +0 -89
- package/dist/esm/tsconfig-paths/src/__tests__/data/match-path-data.js +0 -314
- package/dist/esm/tsconfig-paths/src/__tests__/filesystem.test.js +0 -58
- package/dist/esm/tsconfig-paths/src/__tests__/mapping-entry.test.js +0 -76
- package/dist/esm/tsconfig-paths/src/__tests__/match-path-async.test.js +0 -12
- package/dist/esm/tsconfig-paths/src/__tests__/match-path-sync.test.js +0 -10
- package/dist/esm/tsconfig-paths/src/__tests__/try-path.test.js +0 -214
- package/dist/esm/tsconfig-paths/src/__tests__/tsconfig-loader.test.js +0 -296
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Schema } from "prosemirror-model";
|
|
2
2
|
import { EditorState } from "prosemirror-state";
|
|
3
|
-
export declare const EMPTY_SCHEMA: Schema<"
|
|
3
|
+
export declare const EMPTY_SCHEMA: Schema<"text" | "doc", any>;
|
|
4
4
|
export declare const EMPTY_STATE: EditorState;
|
package/dist/types/props.d.ts
CHANGED
|
@@ -904,19 +904,19 @@ export declare function mergeReactProps(a: HTMLProps<HTMLElement>, b: HTMLProps<
|
|
|
904
904
|
suppressContentEditableWarning?: boolean | undefined;
|
|
905
905
|
suppressHydrationWarning?: boolean | undefined;
|
|
906
906
|
accessKey?: string | undefined;
|
|
907
|
-
autoCapitalize?: "
|
|
907
|
+
autoCapitalize?: "none" | (string & {}) | "off" | "on" | "sentences" | "words" | "characters" | undefined;
|
|
908
908
|
autoFocus?: boolean | undefined;
|
|
909
|
-
contentEditable?: (boolean | "
|
|
909
|
+
contentEditable?: (boolean | "true" | "false") | "inherit" | "plaintext-only" | undefined;
|
|
910
910
|
contextMenu?: string | undefined;
|
|
911
911
|
dir?: string | undefined;
|
|
912
|
-
draggable?: (boolean | "
|
|
913
|
-
enterKeyHint?: "enter" | "done" | "go" | "next" | "previous" | "
|
|
912
|
+
draggable?: (boolean | "true" | "false") | undefined;
|
|
913
|
+
enterKeyHint?: "search" | "enter" | "done" | "go" | "next" | "previous" | "send" | undefined;
|
|
914
914
|
hidden?: boolean | undefined;
|
|
915
915
|
id?: string | undefined;
|
|
916
916
|
lang?: string | undefined;
|
|
917
917
|
nonce?: string | undefined;
|
|
918
918
|
slot?: string | undefined;
|
|
919
|
-
spellCheck?: (boolean | "
|
|
919
|
+
spellCheck?: (boolean | "true" | "false") | undefined;
|
|
920
920
|
tabIndex?: number | undefined;
|
|
921
921
|
title?: string | undefined;
|
|
922
922
|
translate?: "yes" | "no" | undefined;
|
|
@@ -944,57 +944,57 @@ export declare function mergeReactProps(a: HTMLProps<HTMLElement>, b: HTMLProps<
|
|
|
944
944
|
results?: number | undefined;
|
|
945
945
|
security?: string | undefined;
|
|
946
946
|
unselectable?: "off" | "on" | undefined;
|
|
947
|
-
inputMode?: "
|
|
947
|
+
inputMode?: "search" | "text" | "none" | "email" | "tel" | "url" | "numeric" | "decimal" | undefined;
|
|
948
948
|
is?: string | undefined;
|
|
949
949
|
exportparts?: string | undefined;
|
|
950
950
|
part?: string | undefined;
|
|
951
951
|
"aria-activedescendant"?: string | undefined;
|
|
952
|
-
"aria-atomic"?: (boolean | "
|
|
953
|
-
"aria-autocomplete"?: "
|
|
952
|
+
"aria-atomic"?: (boolean | "true" | "false") | undefined;
|
|
953
|
+
"aria-autocomplete"?: "list" | "none" | "both" | "inline" | undefined;
|
|
954
954
|
"aria-braillelabel"?: string | undefined;
|
|
955
955
|
"aria-brailleroledescription"?: string | undefined;
|
|
956
|
-
"aria-busy"?: (boolean | "
|
|
957
|
-
"aria-checked"?: boolean | "
|
|
956
|
+
"aria-busy"?: (boolean | "true" | "false") | undefined;
|
|
957
|
+
"aria-checked"?: boolean | "true" | "false" | "mixed" | undefined;
|
|
958
958
|
"aria-colcount"?: number | undefined;
|
|
959
959
|
"aria-colindex"?: number | undefined;
|
|
960
960
|
"aria-colindextext"?: string | undefined;
|
|
961
961
|
"aria-colspan"?: number | undefined;
|
|
962
962
|
"aria-controls"?: string | undefined;
|
|
963
|
-
"aria-current"?: boolean | "
|
|
963
|
+
"aria-current"?: boolean | "time" | "step" | "date" | "true" | "false" | "page" | "location" | undefined;
|
|
964
964
|
"aria-describedby"?: string | undefined;
|
|
965
965
|
"aria-description"?: string | undefined;
|
|
966
966
|
"aria-details"?: string | undefined;
|
|
967
|
-
"aria-disabled"?: (boolean | "
|
|
968
|
-
"aria-dropeffect"?: "
|
|
967
|
+
"aria-disabled"?: (boolean | "true" | "false") | undefined;
|
|
968
|
+
"aria-dropeffect"?: "copy" | "link" | "none" | "move" | "execute" | "popup" | undefined;
|
|
969
969
|
"aria-errormessage"?: string | undefined;
|
|
970
|
-
"aria-expanded"?: (boolean | "
|
|
970
|
+
"aria-expanded"?: (boolean | "true" | "false") | undefined;
|
|
971
971
|
"aria-flowto"?: string | undefined;
|
|
972
|
-
"aria-grabbed"?: (boolean | "
|
|
973
|
-
"aria-haspopup"?: boolean | "
|
|
974
|
-
"aria-hidden"?: (boolean | "
|
|
975
|
-
"aria-invalid"?: boolean | "
|
|
972
|
+
"aria-grabbed"?: (boolean | "true" | "false") | undefined;
|
|
973
|
+
"aria-haspopup"?: boolean | "dialog" | "menu" | "grid" | "listbox" | "tree" | "true" | "false" | undefined;
|
|
974
|
+
"aria-hidden"?: (boolean | "true" | "false") | undefined;
|
|
975
|
+
"aria-invalid"?: boolean | "true" | "false" | "grammar" | "spelling" | undefined;
|
|
976
976
|
"aria-keyshortcuts"?: string | undefined;
|
|
977
977
|
"aria-label"?: string | undefined;
|
|
978
978
|
"aria-labelledby"?: string | undefined;
|
|
979
979
|
"aria-level"?: number | undefined;
|
|
980
980
|
"aria-live"?: "off" | "assertive" | "polite" | undefined;
|
|
981
|
-
"aria-modal"?: (boolean | "
|
|
982
|
-
"aria-multiline"?: (boolean | "
|
|
983
|
-
"aria-multiselectable"?: (boolean | "
|
|
981
|
+
"aria-modal"?: (boolean | "true" | "false") | undefined;
|
|
982
|
+
"aria-multiline"?: (boolean | "true" | "false") | undefined;
|
|
983
|
+
"aria-multiselectable"?: (boolean | "true" | "false") | undefined;
|
|
984
984
|
"aria-orientation"?: "horizontal" | "vertical" | undefined;
|
|
985
985
|
"aria-owns"?: string | undefined;
|
|
986
986
|
"aria-placeholder"?: string | undefined;
|
|
987
987
|
"aria-posinset"?: number | undefined;
|
|
988
|
-
"aria-pressed"?: boolean | "
|
|
989
|
-
"aria-readonly"?: (boolean | "
|
|
990
|
-
"aria-relevant"?: "text" | "
|
|
991
|
-
"aria-required"?: (boolean | "
|
|
988
|
+
"aria-pressed"?: boolean | "true" | "false" | "mixed" | undefined;
|
|
989
|
+
"aria-readonly"?: (boolean | "true" | "false") | undefined;
|
|
990
|
+
"aria-relevant"?: "text" | "all" | "additions" | "additions removals" | "additions text" | "removals" | "removals additions" | "removals text" | "text additions" | "text removals" | undefined;
|
|
991
|
+
"aria-required"?: (boolean | "true" | "false") | undefined;
|
|
992
992
|
"aria-roledescription"?: string | undefined;
|
|
993
993
|
"aria-rowcount"?: number | undefined;
|
|
994
994
|
"aria-rowindex"?: number | undefined;
|
|
995
995
|
"aria-rowindextext"?: string | undefined;
|
|
996
996
|
"aria-rowspan"?: number | undefined;
|
|
997
|
-
"aria-selected"?: (boolean | "
|
|
997
|
+
"aria-selected"?: (boolean | "true" | "false") | undefined;
|
|
998
998
|
"aria-setsize"?: number | undefined;
|
|
999
999
|
"aria-sort"?: "none" | "ascending" | "descending" | "other" | undefined;
|
|
1000
1000
|
"aria-valuemax"?: number | undefined;
|
|
@@ -5,9 +5,10 @@ interface Props {
|
|
|
5
5
|
editor: Editor;
|
|
6
6
|
nodeViews?: Record<string, ComponentType<NodeViewComponentProps>>;
|
|
7
7
|
children?: ReactNode;
|
|
8
|
+
static?: boolean;
|
|
8
9
|
}
|
|
9
10
|
/**
|
|
10
11
|
* Render a Tiptap-compatible React ProseMirror editor.
|
|
11
12
|
*/
|
|
12
|
-
export declare function TiptapEditorView({ editor, nodeViews, children }: Props): React.JSX.Element;
|
|
13
|
+
export declare function TiptapEditorView({ editor, nodeViews, children, static: isStatic, }: Props): React.JSX.Element;
|
|
13
14
|
export {};
|
package/package.json
CHANGED
|
@@ -1,241 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/ import * as path from 'path';
|
|
7
|
-
import { TestPathPatterns, TestPathPatternsExecutor } from '../TestPathPatterns';
|
|
8
|
-
const mockSep = jest.fn();
|
|
9
|
-
const mockIsAbsolute = jest.fn();
|
|
10
|
-
const mockRelative = jest.fn();
|
|
11
|
-
jest.mock('path', ()=>{
|
|
12
|
-
const actualPath = jest.requireActual('path');
|
|
13
|
-
return {
|
|
14
|
-
...actualPath,
|
|
15
|
-
isAbsolute (p) {
|
|
16
|
-
return mockIsAbsolute(p) || actualPath.isAbsolute(p);
|
|
17
|
-
},
|
|
18
|
-
relative (from, to) {
|
|
19
|
-
return mockRelative(from, to) || actualPath.relative(from, to);
|
|
20
|
-
},
|
|
21
|
-
get sep () {
|
|
22
|
-
return mockSep() || actualPath.sep;
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
});
|
|
26
|
-
const forcePosix = ()=>{
|
|
27
|
-
mockSep.mockReturnValue(path.posix.sep);
|
|
28
|
-
mockIsAbsolute.mockImplementation(path.posix.isAbsolute);
|
|
29
|
-
mockRelative.mockImplementation(path.posix.relative);
|
|
30
|
-
};
|
|
31
|
-
const forceWindows = ()=>{
|
|
32
|
-
mockSep.mockReturnValue(path.win32.sep);
|
|
33
|
-
mockIsAbsolute.mockImplementation(path.win32.isAbsolute);
|
|
34
|
-
mockRelative.mockImplementation(path.win32.relative);
|
|
35
|
-
};
|
|
36
|
-
beforeEach(()=>{
|
|
37
|
-
jest.resetAllMocks();
|
|
38
|
-
forcePosix();
|
|
39
|
-
});
|
|
40
|
-
const config = {
|
|
41
|
-
rootDir: ''
|
|
42
|
-
};
|
|
43
|
-
const testPathPatternsLikeTests = (makePatterns)=>{
|
|
44
|
-
describe('isSet', ()=>{
|
|
45
|
-
it('returns false if no patterns specified', ()=>{
|
|
46
|
-
const testPathPatterns = makePatterns([], config);
|
|
47
|
-
expect(testPathPatterns.isSet()).toBe(false);
|
|
48
|
-
});
|
|
49
|
-
it('returns true if patterns specified', ()=>{
|
|
50
|
-
const testPathPatterns = makePatterns([
|
|
51
|
-
'a'
|
|
52
|
-
], config);
|
|
53
|
-
expect(testPathPatterns.isSet()).toBe(true);
|
|
54
|
-
});
|
|
55
|
-
});
|
|
56
|
-
describe('isValid', ()=>{
|
|
57
|
-
it('succeeds for empty patterns', ()=>{
|
|
58
|
-
const testPathPatterns = makePatterns([], config);
|
|
59
|
-
expect(testPathPatterns.isValid()).toBe(true);
|
|
60
|
-
});
|
|
61
|
-
it('succeeds for valid patterns', ()=>{
|
|
62
|
-
const testPathPatterns = makePatterns([
|
|
63
|
-
'abc+',
|
|
64
|
-
'z.*'
|
|
65
|
-
], config);
|
|
66
|
-
expect(testPathPatterns.isValid()).toBe(true);
|
|
67
|
-
});
|
|
68
|
-
it('fails for at least one invalid pattern', ()=>{
|
|
69
|
-
const testPathPatterns = makePatterns([
|
|
70
|
-
'abc+',
|
|
71
|
-
'(',
|
|
72
|
-
'z.*'
|
|
73
|
-
], config);
|
|
74
|
-
expect(testPathPatterns.isValid()).toBe(false);
|
|
75
|
-
});
|
|
76
|
-
});
|
|
77
|
-
describe('toPretty', ()=>{
|
|
78
|
-
it('renders a human-readable string', ()=>{
|
|
79
|
-
const testPathPatterns = makePatterns([
|
|
80
|
-
'a/b',
|
|
81
|
-
'c/d'
|
|
82
|
-
], config);
|
|
83
|
-
expect(testPathPatterns.toPretty()).toMatchSnapshot();
|
|
84
|
-
});
|
|
85
|
-
});
|
|
86
|
-
};
|
|
87
|
-
describe('TestPathPatterns', ()=>{
|
|
88
|
-
testPathPatternsLikeTests((patterns, _)=>new TestPathPatterns(patterns));
|
|
89
|
-
});
|
|
90
|
-
describe('TestPathPatternsExecutor', ()=>{
|
|
91
|
-
const makeExecutor = (patterns, options)=>new TestPathPatternsExecutor(new TestPathPatterns(patterns), options);
|
|
92
|
-
testPathPatternsLikeTests(makeExecutor);
|
|
93
|
-
describe('isMatch', ()=>{
|
|
94
|
-
it('returns true with no patterns', ()=>{
|
|
95
|
-
const testPathPatterns = makeExecutor([], config);
|
|
96
|
-
expect(testPathPatterns.isMatch('/a/b')).toBe(true);
|
|
97
|
-
});
|
|
98
|
-
it('returns true for same path', ()=>{
|
|
99
|
-
const testPathPatterns = makeExecutor([
|
|
100
|
-
'/a/b'
|
|
101
|
-
], config);
|
|
102
|
-
expect(testPathPatterns.isMatch('/a/b')).toBe(true);
|
|
103
|
-
});
|
|
104
|
-
it('returns true for same path with case insensitive', ()=>{
|
|
105
|
-
const testPathPatternsUpper = makeExecutor([
|
|
106
|
-
'/A/B'
|
|
107
|
-
], config);
|
|
108
|
-
expect(testPathPatternsUpper.isMatch('/a/b')).toBe(true);
|
|
109
|
-
expect(testPathPatternsUpper.isMatch('/A/B')).toBe(true);
|
|
110
|
-
const testPathPatternsLower = makeExecutor([
|
|
111
|
-
'/a/b'
|
|
112
|
-
], config);
|
|
113
|
-
expect(testPathPatternsLower.isMatch('/A/B')).toBe(true);
|
|
114
|
-
expect(testPathPatternsLower.isMatch('/a/b')).toBe(true);
|
|
115
|
-
});
|
|
116
|
-
it('returns true for contained path', ()=>{
|
|
117
|
-
const testPathPatterns = makeExecutor([
|
|
118
|
-
'b/c'
|
|
119
|
-
], config);
|
|
120
|
-
expect(testPathPatterns.isMatch('/a/b/c/d')).toBe(true);
|
|
121
|
-
});
|
|
122
|
-
it('returns true for explicit relative path', ()=>{
|
|
123
|
-
const testPathPatterns = makeExecutor([
|
|
124
|
-
'./b/c'
|
|
125
|
-
], {
|
|
126
|
-
rootDir: '/a'
|
|
127
|
-
});
|
|
128
|
-
expect(testPathPatterns.isMatch('/a/b/c')).toBe(true);
|
|
129
|
-
});
|
|
130
|
-
it('returns true for explicit relative path for Windows with ./', ()=>{
|
|
131
|
-
forceWindows();
|
|
132
|
-
const testPathPatterns = makeExecutor([
|
|
133
|
-
'./b/c'
|
|
134
|
-
], {
|
|
135
|
-
rootDir: 'C:\\a'
|
|
136
|
-
});
|
|
137
|
-
expect(testPathPatterns.isMatch('C:\\a\\b\\c')).toBe(true);
|
|
138
|
-
});
|
|
139
|
-
it('returns true for explicit relative path for Windows with .\\', ()=>{
|
|
140
|
-
forceWindows();
|
|
141
|
-
const testPathPatterns = makeExecutor([
|
|
142
|
-
'.\\b\\c'
|
|
143
|
-
], {
|
|
144
|
-
rootDir: 'C:\\a'
|
|
145
|
-
});
|
|
146
|
-
expect(testPathPatterns.isMatch('C:\\a\\b\\c')).toBe(true);
|
|
147
|
-
});
|
|
148
|
-
it('returns true for partial file match', ()=>{
|
|
149
|
-
const testPathPatterns = makeExecutor([
|
|
150
|
-
'aaa'
|
|
151
|
-
], config);
|
|
152
|
-
expect(testPathPatterns.isMatch('/foo/..aaa..')).toBe(true);
|
|
153
|
-
expect(testPathPatterns.isMatch('/foo/..aaa')).toBe(true);
|
|
154
|
-
expect(testPathPatterns.isMatch('/foo/aaa..')).toBe(true);
|
|
155
|
-
});
|
|
156
|
-
it('returns true for path suffix', ()=>{
|
|
157
|
-
const testPathPatterns = makeExecutor([
|
|
158
|
-
'c/d'
|
|
159
|
-
], config);
|
|
160
|
-
expect(testPathPatterns.isMatch('/a/b/c/d')).toBe(true);
|
|
161
|
-
});
|
|
162
|
-
it('returns true if regex matches', ()=>{
|
|
163
|
-
const testPathPatterns = makeExecutor([
|
|
164
|
-
'ab*c?'
|
|
165
|
-
], config);
|
|
166
|
-
expect(testPathPatterns.isMatch('/foo/a')).toBe(true);
|
|
167
|
-
expect(testPathPatterns.isMatch('/foo/ab')).toBe(true);
|
|
168
|
-
expect(testPathPatterns.isMatch('/foo/abb')).toBe(true);
|
|
169
|
-
expect(testPathPatterns.isMatch('/foo/ac')).toBe(true);
|
|
170
|
-
expect(testPathPatterns.isMatch('/foo/abc')).toBe(true);
|
|
171
|
-
expect(testPathPatterns.isMatch('/foo/abbc')).toBe(true);
|
|
172
|
-
expect(testPathPatterns.isMatch('/foo/bc')).toBe(false);
|
|
173
|
-
});
|
|
174
|
-
it('returns true only if matches relative path', ()=>{
|
|
175
|
-
const rootDir = '/home/myuser/';
|
|
176
|
-
const testPathPatterns = makeExecutor([
|
|
177
|
-
'home'
|
|
178
|
-
], {
|
|
179
|
-
rootDir
|
|
180
|
-
});
|
|
181
|
-
expect(testPathPatterns.isMatch(path.relative(rootDir, '/home/myuser/LoginPage.js'))).toBe(false);
|
|
182
|
-
expect(testPathPatterns.isMatch(path.relative(rootDir, '/home/myuser/HomePage.js'))).toBe(true);
|
|
183
|
-
});
|
|
184
|
-
it('matches absolute paths regardless of rootDir', ()=>{
|
|
185
|
-
forcePosix();
|
|
186
|
-
const testPathPatterns = makeExecutor([
|
|
187
|
-
'/a/b'
|
|
188
|
-
], {
|
|
189
|
-
rootDir: '/foo/bar'
|
|
190
|
-
});
|
|
191
|
-
expect(testPathPatterns.isMatch('/a/b')).toBe(true);
|
|
192
|
-
});
|
|
193
|
-
it('matches absolute paths for Windows', ()=>{
|
|
194
|
-
forceWindows();
|
|
195
|
-
const testPathPatterns = makeExecutor([
|
|
196
|
-
'C:\\a\\b'
|
|
197
|
-
], {
|
|
198
|
-
rootDir: 'C:\\foo\\bar'
|
|
199
|
-
});
|
|
200
|
-
expect(testPathPatterns.isMatch('C:\\a\\b')).toBe(true);
|
|
201
|
-
});
|
|
202
|
-
it('returns true if match any paths', ()=>{
|
|
203
|
-
const testPathPatterns = makeExecutor([
|
|
204
|
-
'a/b',
|
|
205
|
-
'c/d'
|
|
206
|
-
], config);
|
|
207
|
-
expect(testPathPatterns.isMatch('/foo/a/b')).toBe(true);
|
|
208
|
-
expect(testPathPatterns.isMatch('/foo/c/d')).toBe(true);
|
|
209
|
-
expect(testPathPatterns.isMatch('/foo/a')).toBe(false);
|
|
210
|
-
expect(testPathPatterns.isMatch('/foo/b/c')).toBe(false);
|
|
211
|
-
});
|
|
212
|
-
it('does not normalize Windows paths on POSIX', ()=>{
|
|
213
|
-
forcePosix();
|
|
214
|
-
const testPathPatterns = makeExecutor([
|
|
215
|
-
'a\\z',
|
|
216
|
-
'a\\\\z'
|
|
217
|
-
], config);
|
|
218
|
-
expect(testPathPatterns.isMatch('/foo/a/z')).toBe(false);
|
|
219
|
-
});
|
|
220
|
-
it('normalizes paths for Windows', ()=>{
|
|
221
|
-
forceWindows();
|
|
222
|
-
const testPathPatterns = makeExecutor([
|
|
223
|
-
'a/b'
|
|
224
|
-
], config);
|
|
225
|
-
expect(testPathPatterns.isMatch('C:\\foo\\a\\b')).toBe(true);
|
|
226
|
-
});
|
|
227
|
-
it('matches absolute path with absPath', ()=>{
|
|
228
|
-
const pattern = '^/home/app/';
|
|
229
|
-
const rootDir = '/home/app';
|
|
230
|
-
const absolutePath = '/home/app/packages/';
|
|
231
|
-
const testPathPatterns = makeExecutor([
|
|
232
|
-
pattern
|
|
233
|
-
], {
|
|
234
|
-
rootDir
|
|
235
|
-
});
|
|
236
|
-
const relativePath = path.relative(rootDir, absolutePath);
|
|
237
|
-
expect(testPathPatterns.isMatch(relativePath)).toBe(false);
|
|
238
|
-
expect(testPathPatterns.isMatch(absolutePath)).toBe(true);
|
|
239
|
-
});
|
|
240
|
-
});
|
|
241
|
-
});
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
const _core = require("@swc/core");
|
|
6
|
-
const _compile = require("../compile");
|
|
7
|
-
jest.mock("@swc/core");
|
|
8
|
-
describe("compile", ()=>{
|
|
9
|
-
it("compile with sync transform", async ()=>{
|
|
10
|
-
const options = {};
|
|
11
|
-
await (0, _compile.compile)("test.ts", options, true, undefined);
|
|
12
|
-
expect(_core.transformFileSync).toHaveBeenCalledWith("test.ts", options);
|
|
13
|
-
});
|
|
14
|
-
it("compile with async transform", async ()=>{
|
|
15
|
-
const options = {};
|
|
16
|
-
await (0, _compile.compile)("test.ts", options, false, undefined);
|
|
17
|
-
expect(_core.transformFile).toHaveBeenCalledWith("test.ts", options);
|
|
18
|
-
});
|
|
19
|
-
}); //# sourceMappingURL=compile.test.js.map
|