@handlewithcare/react-prosemirror 2.8.0-tiptap.10 → 2.8.0-tiptap.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/dist/cjs/tiptap/tiptapNodeView.js +26 -13
  2. package/dist/esm/tiptap/tiptapNodeView.js +27 -14
  3. package/dist/tsconfig.tsbuildinfo +1 -1
  4. package/dist/types/constants.d.ts +1 -1
  5. package/dist/types/props.d.ts +26 -26
  6. package/package.json +1 -1
  7. package/dist/esm/@jest/pattern/src/__tests__/TestPathPatterns.test.js +0 -241
  8. package/dist/esm/@swc/cli/lib/swc/__tests__/compile.test.js +0 -19
  9. package/dist/esm/@swc/cli/lib/swc/__tests__/options.test.js +0 -315
  10. package/dist/esm/@swc/cli/lib/swc/__tests__/sources.test.js +0 -161
  11. package/dist/esm/@uiw/react-codemirror/src/__tests__/index.test.js +0 -111
  12. package/dist/esm/cheerio/src/__tests__/deprecated.spec.js +0 -249
  13. package/dist/esm/cheerio/src/__tests__/xml.spec.js +0 -55
  14. package/dist/esm/components/__tests__/ProseMirror.composition.test.js +0 -395
  15. package/dist/esm/components/__tests__/ProseMirror.domchange.test.js +0 -266
  16. package/dist/esm/components/__tests__/ProseMirror.draw-decoration.test.js +0 -968
  17. package/dist/esm/components/__tests__/ProseMirror.draw.test.js +0 -335
  18. package/dist/esm/components/__tests__/ProseMirror.mobile.test.js +0 -54
  19. package/dist/esm/components/__tests__/ProseMirror.node-view.test.js +0 -553
  20. package/dist/esm/components/__tests__/ProseMirror.selection.test.js +0 -440
  21. package/dist/esm/components/__tests__/ProseMirror.test.js +0 -324
  22. package/dist/esm/contexts/__tests__/DeferredLayoutEffects.test.js +0 -98
  23. package/dist/esm/hooks/__tests__/useEditorEffect.test.js +0 -134
  24. package/dist/esm/jsx-ast-utils/__tests__/helper.js +0 -83
  25. package/dist/esm/jsx-ast-utils/__tests__/src/elementType-test.js +0 -76
  26. package/dist/esm/jsx-ast-utils/__tests__/src/eventHandlers-test.js +0 -98
  27. package/dist/esm/jsx-ast-utils/__tests__/src/getProp-parser-test.js +0 -188
  28. package/dist/esm/jsx-ast-utils/__tests__/src/getProp-test.js +0 -119
  29. package/dist/esm/jsx-ast-utils/__tests__/src/getPropLiteralValue-babelparser-test.js +0 -393
  30. package/dist/esm/jsx-ast-utils/__tests__/src/getPropLiteralValue-flowparser-test.js +0 -379
  31. package/dist/esm/jsx-ast-utils/__tests__/src/getPropValue-babelparser-test.js +0 -925
  32. package/dist/esm/jsx-ast-utils/__tests__/src/getPropValue-flowparser-test.js +0 -700
  33. package/dist/esm/jsx-ast-utils/__tests__/src/hasProp-test.js +0 -350
  34. package/dist/esm/jsx-ast-utils/__tests__/src/index-test.js +0 -24
  35. package/dist/esm/jsx-ast-utils/__tests__/src/propName-test.js +0 -37
  36. package/dist/esm/plugins/__tests__/reactKeys.test.js +0 -77
  37. package/dist/esm/tsconfig-paths/lib/__tests__/config-loader.test.d.js +0 -1
  38. package/dist/esm/tsconfig-paths/lib/__tests__/config-loader.test.js +0 -97
  39. package/dist/esm/tsconfig-paths/lib/__tests__/data/match-path-data.d.js +0 -1
  40. package/dist/esm/tsconfig-paths/lib/__tests__/data/match-path-data.js +0 -319
  41. package/dist/esm/tsconfig-paths/lib/__tests__/filesystem.test.d.js +0 -1
  42. package/dist/esm/tsconfig-paths/lib/__tests__/filesystem.test.js +0 -62
  43. package/dist/esm/tsconfig-paths/lib/__tests__/mapping-entry.test.d.js +0 -1
  44. package/dist/esm/tsconfig-paths/lib/__tests__/mapping-entry.test.js +0 -80
  45. package/dist/esm/tsconfig-paths/lib/__tests__/match-path-async.test.d.js +0 -1
  46. package/dist/esm/tsconfig-paths/lib/__tests__/match-path-async.test.js +0 -22
  47. package/dist/esm/tsconfig-paths/lib/__tests__/match-path-sync.test.d.js +0 -1
  48. package/dist/esm/tsconfig-paths/lib/__tests__/match-path-sync.test.js +0 -20
  49. package/dist/esm/tsconfig-paths/lib/__tests__/try-path.test.d.js +0 -1
  50. package/dist/esm/tsconfig-paths/lib/__tests__/try-path.test.js +0 -219
  51. package/dist/esm/tsconfig-paths/lib/__tests__/tsconfig-loader.test.d.js +0 -1
  52. package/dist/esm/tsconfig-paths/lib/__tests__/tsconfig-loader.test.js +0 -323
  53. package/dist/esm/tsconfig-paths/src/__tests__/config-loader.test.js +0 -89
  54. package/dist/esm/tsconfig-paths/src/__tests__/data/match-path-data.js +0 -314
  55. package/dist/esm/tsconfig-paths/src/__tests__/filesystem.test.js +0 -58
  56. package/dist/esm/tsconfig-paths/src/__tests__/mapping-entry.test.js +0 -76
  57. package/dist/esm/tsconfig-paths/src/__tests__/match-path-async.test.js +0 -12
  58. package/dist/esm/tsconfig-paths/src/__tests__/match-path-sync.test.js +0 -10
  59. package/dist/esm/tsconfig-paths/src/__tests__/try-path.test.js +0 -214
  60. package/dist/esm/tsconfig-paths/src/__tests__/tsconfig-loader.test.js +0 -296
@@ -1,314 +0,0 @@
1
- import { join, dirname } from "path";
2
- import { removeExtension } from "../../filesystem";
3
- const defaultExtensionsWhenRunningInTsNode = [
4
- ".js",
5
- ".json",
6
- ".node",
7
- ".ts",
8
- ".tsx"
9
- ];
10
- export const tests = [
11
- {
12
- name: "should locate path that matches with star and exists",
13
- absoluteBaseUrl: "/root/",
14
- paths: {
15
- "lib/*": [
16
- "location/*"
17
- ]
18
- },
19
- existingFiles: [
20
- join("/root", "location", "mylib", "index.ts")
21
- ],
22
- requestedModule: "lib/mylib",
23
- expectedPath: dirname(join("/root", "location", "mylib", "index.ts")),
24
- extensions: defaultExtensionsWhenRunningInTsNode
25
- },
26
- {
27
- name: "should resolve to correct path when many are specified",
28
- absoluteBaseUrl: "/root/",
29
- paths: {
30
- "lib/*": [
31
- "foo1/*",
32
- "foo2/*",
33
- "location/*",
34
- "foo3/*"
35
- ]
36
- },
37
- existingFiles: [
38
- join("/root", "location", "mylib", "index.ts")
39
- ],
40
- requestedModule: "lib/mylib",
41
- extensions: [
42
- ".ts"
43
- ],
44
- expectedPath: dirname(join("/root", "location", "mylib", "index.ts"))
45
- },
46
- {
47
- name: "should locate path that matches with star and prioritize pattern with longest prefix",
48
- absoluteBaseUrl: "/root/",
49
- paths: {
50
- "*": [
51
- "location/*"
52
- ],
53
- "lib/*": [
54
- "location/*"
55
- ]
56
- },
57
- existingFiles: [
58
- join("/root", "location", "lib", "mylib", "index.ts"),
59
- join("/root", "location", "mylib", "index.ts")
60
- ],
61
- requestedModule: "lib/mylib",
62
- expectedPath: dirname(join("/root", "location", "mylib", "index.ts")),
63
- extensions: defaultExtensionsWhenRunningInTsNode
64
- },
65
- {
66
- name: "should locate path that matches with star and exists with extension",
67
- absoluteBaseUrl: "/root/",
68
- paths: {
69
- "lib/*": [
70
- "location/*"
71
- ]
72
- },
73
- existingFiles: [
74
- join("/root", "location", "mylib.myext")
75
- ],
76
- requestedModule: "lib/mylib",
77
- extensions: [
78
- ".js",
79
- ".myext"
80
- ],
81
- expectedPath: removeExtension(join("/root", "location", "mylib.myext"))
82
- },
83
- {
84
- name: "should resolve request with extension specified",
85
- absoluteBaseUrl: "/root/",
86
- paths: {
87
- "lib/*": [
88
- "location/*"
89
- ]
90
- },
91
- existingFiles: [
92
- join("/root", "location", "test.jpg")
93
- ],
94
- requestedModule: "lib/test.jpg",
95
- expectedPath: join("/root", "location", "test.jpg"),
96
- extensions: defaultExtensionsWhenRunningInTsNode
97
- },
98
- {
99
- name: "should locate path that matches without star and exists",
100
- absoluteBaseUrl: "/root/",
101
- paths: {
102
- "lib/foo": [
103
- "location/foo"
104
- ]
105
- },
106
- existingFiles: [
107
- join("/root", "location", "foo.ts")
108
- ],
109
- requestedModule: "lib/foo",
110
- expectedPath: removeExtension(join("/root", "location", "foo.ts")),
111
- extensions: defaultExtensionsWhenRunningInTsNode
112
- },
113
- {
114
- name: "should resolve to parent folder when filename is in subfolder",
115
- absoluteBaseUrl: "/root/",
116
- paths: {
117
- "lib/*": [
118
- "location/*"
119
- ]
120
- },
121
- existingFiles: [
122
- join("/root", "location", "mylib", "index.ts")
123
- ],
124
- requestedModule: "lib/mylib",
125
- expectedPath: dirname(join("/root", "location", "mylib", "index.ts")),
126
- extensions: defaultExtensionsWhenRunningInTsNode
127
- },
128
- {
129
- name: "should resolve from main field in package.json",
130
- absoluteBaseUrl: "/root/",
131
- paths: {
132
- "lib/*": [
133
- "location/*"
134
- ]
135
- },
136
- existingFiles: [
137
- join("/root", "location", "mylib", "kalle.ts")
138
- ],
139
- packageJson: {
140
- main: "./kalle.ts"
141
- },
142
- requestedModule: "lib/mylib",
143
- expectedPath: join("/root", "location", "mylib", "kalle.ts"),
144
- extensions: defaultExtensionsWhenRunningInTsNode
145
- },
146
- {
147
- name: "should resolve from main field in package.json (js)",
148
- absoluteBaseUrl: "/root",
149
- paths: {
150
- "lib/*": [
151
- "location/*"
152
- ]
153
- },
154
- existingFiles: [
155
- join("/root", "location", "mylib.js", "kalle.js")
156
- ],
157
- packageJson: {
158
- main: "./kalle.js"
159
- },
160
- requestedModule: "lib/mylib.js",
161
- extensions: [
162
- ".ts",
163
- ".js"
164
- ],
165
- expectedPath: join("/root", "location", "mylib.js", "kalle.js")
166
- },
167
- {
168
- name: "should resolve from list of fields by priority in package.json",
169
- absoluteBaseUrl: "/root/",
170
- paths: {
171
- "lib/*": [
172
- "location/*"
173
- ]
174
- },
175
- mainFields: [
176
- "missing",
177
- "browser",
178
- "main"
179
- ],
180
- packageJson: {
181
- main: "./main.js",
182
- browser: "./browser.js"
183
- },
184
- existingFiles: [
185
- join("/root", "location", "mylibjs", "main.js"),
186
- join("/root", "location", "mylibjs", "browser.js")
187
- ],
188
- extensions: [
189
- ".ts",
190
- ".js"
191
- ],
192
- requestedModule: "lib/mylibjs",
193
- expectedPath: join("/root", "location", "mylibjs", "browser.js")
194
- },
195
- {
196
- name: "should ignore field mappings to missing files in package.json",
197
- absoluteBaseUrl: "/root/",
198
- paths: {
199
- "lib/*": [
200
- "location/*"
201
- ]
202
- },
203
- mainFields: [
204
- "browser",
205
- "main"
206
- ],
207
- existingFiles: [
208
- join("/root", "location", "mylibjs", "kalle.js")
209
- ],
210
- requestedModule: "lib/mylibjs",
211
- packageJson: {
212
- main: "./kalle.js",
213
- browser: "./nope.js"
214
- },
215
- extensions: [
216
- ".ts",
217
- ".js"
218
- ],
219
- expectedPath: join("/root", "location", "mylibjs", "kalle.js")
220
- },
221
- {
222
- name: "should ignore advanced field mappings in package.json",
223
- absoluteBaseUrl: "/root/",
224
- paths: {
225
- "lib/*": [
226
- "location/*"
227
- ]
228
- },
229
- existingFiles: [
230
- join("/root", "location", "mylibjs", "kalle.js"),
231
- join("/root", "location", "mylibjs", "browser.js")
232
- ],
233
- requestedModule: "lib/mylibjs",
234
- packageJson: {
235
- main: "./kalle.js",
236
- browser: {
237
- mylibjs: "./browser.js",
238
- "./kalle.js": "./browser.js"
239
- }
240
- },
241
- extensions: [
242
- ".ts",
243
- ".js"
244
- ],
245
- expectedPath: join("/root", "location", "mylibjs", "kalle.js")
246
- },
247
- {
248
- name: "should resolve to with the help of baseUrl when not explicitly set",
249
- absoluteBaseUrl: "/root/",
250
- paths: {},
251
- existingFiles: [
252
- join("/root", "mylib", "index.ts")
253
- ],
254
- requestedModule: "mylib",
255
- expectedPath: dirname(join("/root", "mylib", "index.ts")),
256
- extensions: defaultExtensionsWhenRunningInTsNode
257
- },
258
- {
259
- name: "should not resolve with the help of baseUrl when asked not to",
260
- absoluteBaseUrl: "/root/",
261
- paths: {},
262
- addMatchAll: false,
263
- existingFiles: [
264
- join("/root", "mylib", "index.ts")
265
- ],
266
- requestedModule: "mylib",
267
- expectedPath: undefined,
268
- extensions: defaultExtensionsWhenRunningInTsNode
269
- },
270
- {
271
- name: "should not locate path that does not match",
272
- absoluteBaseUrl: "/root/",
273
- paths: {
274
- "lib/*": [
275
- "location/*"
276
- ]
277
- },
278
- existingFiles: [
279
- join("root", "location", "mylib")
280
- ],
281
- requestedModule: "mylib",
282
- expectedPath: undefined,
283
- extensions: defaultExtensionsWhenRunningInTsNode
284
- },
285
- {
286
- name: "should not resolve typings file (index.d.ts)",
287
- absoluteBaseUrl: "/root/",
288
- paths: {
289
- "lib/*": [
290
- "location/*"
291
- ]
292
- },
293
- existingFiles: [
294
- join("/root", "location", "mylib", "index.d.ts")
295
- ],
296
- requestedModule: "lib/mylib",
297
- expectedPath: undefined,
298
- extensions: defaultExtensionsWhenRunningInTsNode
299
- },
300
- {
301
- name: "should resolve main file with cjs file extension",
302
- absoluteBaseUrl: "/root/",
303
- paths: {},
304
- existingFiles: [
305
- join("/root", "mylib", "index.cjs")
306
- ],
307
- packageJson: {
308
- main: "./index.cjs"
309
- },
310
- requestedModule: "mylib",
311
- expectedPath: join("/root", "mylib", "index.cjs"),
312
- extensions: defaultExtensionsWhenRunningInTsNode
313
- }
314
- ];
@@ -1,58 +0,0 @@
1
- import * as Filesystem from "../filesystem";
2
- import * as path from "path";
3
- describe("filesystem", ()=>{
4
- const fileThatExists = path.join(__dirname, "../../package.json");
5
- const fileThatNotExists = path.join(__dirname, "../../package2.json");
6
- it("should find file that exists, sync", ()=>{
7
- const result = Filesystem.fileExistsSync(fileThatExists);
8
- // assert.equal(result, true);
9
- expect(result).toBe(true);
10
- });
11
- it("should not find file that not exists, sync", ()=>{
12
- const result = Filesystem.fileExistsSync(fileThatNotExists);
13
- // assert.equal(result, false);
14
- expect(result).toBe(false);
15
- });
16
- it("should find file that exists, async", (done)=>{
17
- Filesystem.fileExistsAsync(fileThatExists, (_err, result)=>{
18
- try {
19
- // assert.equal(result, true);
20
- expect(result).toBe(true);
21
- done();
22
- } catch (error) {
23
- done(error);
24
- }
25
- });
26
- });
27
- it("should not find file that not exists, async", (done)=>{
28
- Filesystem.fileExistsAsync(fileThatNotExists, (_err, result)=>{
29
- try {
30
- // assert.equal(result, false);
31
- expect(result).toBe(false);
32
- done();
33
- } catch (error) {
34
- done(error);
35
- }
36
- });
37
- });
38
- it("should load json, sync", ()=>{
39
- const result = Filesystem.readJsonFromDiskSync(fileThatExists);
40
- // assert.isOk(result);
41
- expect(result);
42
- // assert.equal(result.main, "lib/index.js");
43
- expect(result.main).toBe("lib/index.js");
44
- });
45
- it("should load json, async", (done)=>{
46
- Filesystem.readJsonFromDiskAsync(fileThatExists, (_err, result)=>{
47
- try {
48
- // assert.isOk(result); // Asserts that object is truthy.
49
- expect(result).toBeTruthy();
50
- // assert.equal(result.main, "lib/index.js");
51
- expect(result.main).toBe("lib/index.js");
52
- done();
53
- } catch (error) {
54
- done(error);
55
- }
56
- });
57
- });
58
- });
@@ -1,76 +0,0 @@
1
- import { getAbsoluteMappingEntries } from "../mapping-entry";
2
- import { join } from "path";
3
- describe("mapping-entry", ()=>{
4
- it("should change to absolute paths and sort in longest prefix order", ()=>{
5
- const result = getAbsoluteMappingEntries("/absolute/base/url", {
6
- "*": [
7
- "/foo1",
8
- "/foo2"
9
- ],
10
- "longest/pre/fix/*": [
11
- "/foo2/bar"
12
- ],
13
- "pre/fix/*": [
14
- "/foo3"
15
- ]
16
- }, true);
17
- // assert.deepEqual(result, [
18
- // {
19
- // pattern: "longest/pre/fix/*",
20
- // paths: [join("/absolute", "base", "url", "foo2", "bar")],
21
- // },
22
- // {
23
- // pattern: "pre/fix/*",
24
- // paths: [join("/absolute", "base", "url", "foo3")],
25
- // },
26
- // {
27
- // pattern: "*",
28
- // paths: [
29
- // join("/absolute", "base", "url", "foo1"),
30
- // join("/absolute", "base", "url", "foo2"),
31
- // ],
32
- // },
33
- // ]);
34
- expect(result).toEqual([
35
- {
36
- pattern: "longest/pre/fix/*",
37
- paths: [
38
- join("/absolute", "base", "url", "foo2", "bar")
39
- ]
40
- },
41
- {
42
- pattern: "pre/fix/*",
43
- paths: [
44
- join("/absolute", "base", "url", "foo3")
45
- ]
46
- },
47
- {
48
- pattern: "*",
49
- paths: [
50
- join("/absolute", "base", "url", "foo1"),
51
- join("/absolute", "base", "url", "foo2")
52
- ]
53
- }
54
- ]);
55
- });
56
- it("should should add a match-all pattern when requested", ()=>{
57
- let result = getAbsoluteMappingEntries("/absolute/base/url", {}, true);
58
- // assert.deepEqual(result, [
59
- // {
60
- // pattern: "*",
61
- // paths: [join("/absolute", "base", "url", "*")],
62
- // },
63
- // ]);
64
- expect(result).toEqual([
65
- {
66
- pattern: "*",
67
- paths: [
68
- join("/absolute", "base", "url", "*")
69
- ]
70
- }
71
- ]);
72
- result = getAbsoluteMappingEntries("/absolute/base/url", {}, false);
73
- // assert.deepEqual(result, []);
74
- expect(result).toEqual([]);
75
- });
76
- });
@@ -1,12 +0,0 @@
1
- import { createMatchPathAsync } from "../match-path-async";
2
- import * as Tests from "./data/match-path-data";
3
- describe("match-path-async", ()=>{
4
- Tests.tests.forEach((t)=>it(t.name, (done)=>{
5
- const matchPath = createMatchPathAsync(t.absoluteBaseUrl, t.paths, t.mainFields, t.addMatchAll);
6
- matchPath(t.requestedModule, (_path, callback)=>callback(undefined, t.packageJson), (path, callback)=>callback(undefined, t.existingFiles.indexOf(path) !== -1), t.extensions, (_err, result)=>{
7
- // assert.equal(result, t.expectedPath);
8
- expect(result).toBe(t.expectedPath);
9
- done();
10
- });
11
- }));
12
- });
@@ -1,10 +0,0 @@
1
- import { createMatchPath } from "../match-path-sync";
2
- import * as Tests from "./data/match-path-data";
3
- describe("match-path-sync", ()=>{
4
- Tests.tests.forEach((t)=>it(t.name, ()=>{
5
- const matchPath = createMatchPath(t.absoluteBaseUrl, t.paths, t.mainFields, t.addMatchAll);
6
- const result = matchPath(t.requestedModule, (_)=>t.packageJson, (name)=>t.existingFiles.indexOf(name) !== -1, t.extensions);
7
- // assert.equal(result, t.expectedPath);
8
- expect(result).toBe(t.expectedPath);
9
- }));
10
- });
@@ -1,214 +0,0 @@
1
- import { getPathsToTry } from "../try-path";
2
- import { join } from "path";
3
- describe("mapping-entry", ()=>{
4
- const abosolutePathMappings = [
5
- {
6
- pattern: "longest/pre/fix/*",
7
- paths: [
8
- join("/absolute", "base", "url", "foo2", "bar")
9
- ]
10
- },
11
- {
12
- pattern: "pre/fix/*",
13
- paths: [
14
- join("/absolute", "base", "url", "foo3")
15
- ]
16
- },
17
- {
18
- pattern: "*",
19
- paths: [
20
- join("/absolute", "base", "url", "foo1")
21
- ]
22
- }
23
- ];
24
- const abosolutePathMappingsStarstWithSlash = [
25
- {
26
- pattern: "/opt/*",
27
- paths: [
28
- join("/absolute", "src", "aws-layer")
29
- ]
30
- },
31
- {
32
- pattern: "*",
33
- paths: [
34
- join("/absolute", "src")
35
- ]
36
- }
37
- ];
38
- it("should return no paths for relative requested module", ()=>{
39
- const result = getPathsToTry([
40
- ".ts",
41
- "tsx"
42
- ], abosolutePathMappings, "./requested-module");
43
- // assert.deepEqual(result, undefined);
44
- expect(result).toBeUndefined();
45
- });
46
- it("should return no paths if no pattern match the requested module", ()=>{
47
- const result = getPathsToTry([
48
- ".ts",
49
- "tsx"
50
- ], [
51
- {
52
- pattern: "longest/pre/fix/*",
53
- paths: [
54
- join("/absolute", "base", "url", "foo2", "bar")
55
- ]
56
- },
57
- {
58
- pattern: "pre/fix/*",
59
- paths: [
60
- join("/absolute", "base", "url", "foo3")
61
- ]
62
- }
63
- ], "requested-module");
64
- expect(result).toBeUndefined();
65
- });
66
- it("should get all paths that matches requested module", ()=>{
67
- const result = getPathsToTry([
68
- ".ts",
69
- ".tsx"
70
- ], abosolutePathMappings, "longest/pre/fix/requested-module");
71
- // assert.deepEqual(result, [
72
- // // "longest/pre/fix/*"
73
- // { type: "file", path: join("/absolute", "base", "url", "foo2", "bar") },
74
- // {
75
- // type: "extension",
76
- // path: join("/absolute", "base", "url", "foo2", "bar.ts"),
77
- // },
78
- // {
79
- // type: "extension",
80
- // path: join("/absolute", "base", "url", "foo2", "bar.tsx"),
81
- // },
82
- // {
83
- // type: "package",
84
- // path: join("/absolute", "base", "url", "foo2", "bar", "package.json"),
85
- // },
86
- // {
87
- // type: "index",
88
- // path: join("/absolute", "base", "url", "foo2", "bar", "index.ts"),
89
- // },
90
- // {
91
- // type: "index",
92
- // path: join("/absolute", "base", "url", "foo2", "bar", "index.tsx"),
93
- // },
94
- // // "*"
95
- // { type: "file", path: join("/absolute", "base", "url", "foo1") },
96
- // { type: "extension", path: join("/absolute", "base", "url", "foo1.ts") },
97
- // { type: "extension", path: join("/absolute", "base", "url", "foo1.tsx") },
98
- // {
99
- // type: "package",
100
- // path: join("/absolute", "base", "url", "foo1", "package.json"),
101
- // },
102
- // {
103
- // type: "index",
104
- // path: join("/absolute", "base", "url", "foo1", "index.ts"),
105
- // },
106
- // {
107
- // type: "index",
108
- // path: join("/absolute", "base", "url", "foo1", "index.tsx"),
109
- // },
110
- // ]);
111
- expect(result).toEqual([
112
- // "longest/pre/fix/*"
113
- {
114
- type: "file",
115
- path: join("/absolute", "base", "url", "foo2", "bar")
116
- },
117
- {
118
- type: "extension",
119
- path: join("/absolute", "base", "url", "foo2", "bar.ts")
120
- },
121
- {
122
- type: "extension",
123
- path: join("/absolute", "base", "url", "foo2", "bar.tsx")
124
- },
125
- {
126
- type: "package",
127
- path: join("/absolute", "base", "url", "foo2", "bar", "package.json")
128
- },
129
- {
130
- type: "index",
131
- path: join("/absolute", "base", "url", "foo2", "bar", "index.ts")
132
- },
133
- {
134
- type: "index",
135
- path: join("/absolute", "base", "url", "foo2", "bar", "index.tsx")
136
- },
137
- // "*"
138
- {
139
- type: "file",
140
- path: join("/absolute", "base", "url", "foo1")
141
- },
142
- {
143
- type: "extension",
144
- path: join("/absolute", "base", "url", "foo1.ts")
145
- },
146
- {
147
- type: "extension",
148
- path: join("/absolute", "base", "url", "foo1.tsx")
149
- },
150
- {
151
- type: "package",
152
- path: join("/absolute", "base", "url", "foo1", "package.json")
153
- },
154
- {
155
- type: "index",
156
- path: join("/absolute", "base", "url", "foo1", "index.ts")
157
- },
158
- {
159
- type: "index",
160
- path: join("/absolute", "base", "url", "foo1", "index.tsx")
161
- }
162
- ]);
163
- });
164
- it("should resolve paths starting with a slash", ()=>{
165
- const result = getPathsToTry([
166
- ".ts"
167
- ], abosolutePathMappingsStarstWithSlash, "/opt/utils");
168
- expect(result).toEqual([
169
- // "opt/*"
170
- {
171
- path: join("/absolute", "src", "aws-layer"),
172
- type: "file"
173
- },
174
- {
175
- path: join("/absolute", "src", "aws-layer.ts"),
176
- type: "extension"
177
- },
178
- {
179
- path: join("/absolute", "src", "aws-layer", "package.json"),
180
- type: "package"
181
- },
182
- {
183
- path: join("/absolute", "src", "aws-layer", "index.ts"),
184
- type: "index"
185
- },
186
- // "*"
187
- {
188
- path: join("/absolute", "src"),
189
- type: "file"
190
- },
191
- {
192
- path: join("/absolute", "src.ts"),
193
- type: "extension"
194
- },
195
- {
196
- path: join("/absolute", "src", "package.json"),
197
- type: "package"
198
- },
199
- {
200
- path: join("/absolute", "src", "index.ts"),
201
- type: "index"
202
- }
203
- ]);
204
- });
205
- }); // describe("match-star", () => {
206
- // it("should match star in last position", () => {
207
- // const result = matchStar("lib/*", "lib/mylib");
208
- // assert.equal(result, "mylib");
209
- // });
210
- // it("should match star in first position", () => {
211
- // const result = matchStar("*/lib", "mylib/lib");
212
- // assert.equal(result, "mylib");
213
- // });
214
- // });