@ryanatkn/gro 0.129.9 → 0.129.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 (156) hide show
  1. package/dist/args.d.ts.map +1 -1
  2. package/dist/build.task.d.ts.map +1 -1
  3. package/dist/changelog.d.ts.map +1 -1
  4. package/dist/changeset.task.d.ts.map +1 -1
  5. package/dist/changeset_helpers.d.ts.map +1 -1
  6. package/dist/check.task.d.ts.map +1 -1
  7. package/dist/clean.task.d.ts.map +1 -1
  8. package/dist/clean_fs.d.ts.map +1 -1
  9. package/dist/cli.d.ts.map +1 -1
  10. package/dist/commit.task.d.ts.map +1 -1
  11. package/dist/config.d.ts.map +1 -1
  12. package/dist/deploy.task.d.ts.map +1 -1
  13. package/dist/dev.task.d.ts.map +1 -1
  14. package/dist/env.d.ts.map +1 -1
  15. package/dist/esbuild_helpers.d.ts.map +1 -1
  16. package/dist/esbuild_plugin_external_worker.d.ts.map +1 -1
  17. package/dist/esbuild_plugin_svelte.d.ts.map +1 -1
  18. package/dist/esbuild_plugin_sveltekit_local_imports.d.ts.map +1 -1
  19. package/dist/esbuild_plugin_sveltekit_shim_alias.d.ts.map +1 -1
  20. package/dist/esbuild_plugin_sveltekit_shim_app.d.ts.map +1 -1
  21. package/dist/esbuild_plugin_sveltekit_shim_env.d.ts.map +1 -1
  22. package/dist/format.task.d.ts.map +1 -1
  23. package/dist/format_directory.d.ts.map +1 -1
  24. package/dist/format_file.d.ts.map +1 -1
  25. package/dist/fs.d.ts.map +1 -1
  26. package/dist/gen.d.ts.map +1 -1
  27. package/dist/gen.task.d.ts.map +1 -1
  28. package/dist/git.d.ts.map +1 -1
  29. package/dist/github.d.ts.map +1 -1
  30. package/dist/gro.config.default.d.ts.map +1 -1
  31. package/dist/gro.d.ts.map +1 -1
  32. package/dist/gro_helpers.d.ts.map +1 -1
  33. package/dist/gro_plugin_gen.d.ts.map +1 -1
  34. package/dist/gro_plugin_server.d.ts.map +1 -1
  35. package/dist/gro_plugin_sveltekit_app.d.ts.map +1 -1
  36. package/dist/gro_plugin_sveltekit_library.d.ts.map +1 -1
  37. package/dist/hash.d.ts.map +1 -1
  38. package/dist/index.d.ts.map +1 -1
  39. package/dist/input_path.d.ts.map +1 -1
  40. package/dist/invoke.d.ts.map +1 -1
  41. package/dist/invoke_task.d.ts.map +1 -1
  42. package/dist/lint.task.d.ts.map +1 -1
  43. package/dist/loader.d.ts.map +1 -1
  44. package/dist/module.d.ts.map +1 -1
  45. package/dist/modules.d.ts.map +1 -1
  46. package/dist/package.d.ts.map +1 -1
  47. package/dist/package.gen.d.ts.map +1 -1
  48. package/dist/package.js +3 -3
  49. package/dist/package_json.d.ts.map +1 -1
  50. package/dist/package_meta.d.ts.map +1 -1
  51. package/dist/path.d.ts.map +1 -1
  52. package/dist/path_constants.d.ts.map +1 -1
  53. package/dist/paths.d.ts.map +1 -1
  54. package/dist/plugin.d.ts.map +1 -1
  55. package/dist/publish.task.d.ts.map +1 -1
  56. package/dist/register.d.ts.map +1 -1
  57. package/dist/reinstall.task.d.ts.map +1 -1
  58. package/dist/release.task.d.ts.map +1 -1
  59. package/dist/resolve.task.d.ts.map +1 -1
  60. package/dist/resolve_node_specifier.d.ts.map +1 -1
  61. package/dist/resolve_specifier.d.ts.map +1 -1
  62. package/dist/run.task.d.ts.map +1 -1
  63. package/dist/run_gen.d.ts.map +1 -1
  64. package/dist/run_task.d.ts.map +1 -1
  65. package/dist/search_fs.d.ts.map +1 -1
  66. package/dist/src_json.d.ts.map +1 -1
  67. package/dist/svelte_helpers.d.ts.map +1 -1
  68. package/dist/sveltekit_config.d.ts.map +1 -1
  69. package/dist/sveltekit_config_global.d.ts.map +1 -1
  70. package/dist/sveltekit_helpers.d.ts.map +1 -1
  71. package/dist/sveltekit_shim_app.d.ts.map +1 -1
  72. package/dist/sveltekit_shim_app_environment.d.ts.map +1 -1
  73. package/dist/sveltekit_shim_app_forms.d.ts.map +1 -1
  74. package/dist/sveltekit_shim_app_navigation.d.ts.map +1 -1
  75. package/dist/sveltekit_shim_app_paths.d.ts.map +1 -1
  76. package/dist/sveltekit_shim_app_stores.d.ts.map +1 -1
  77. package/dist/sveltekit_shim_env.d.ts.map +1 -1
  78. package/dist/sync.task.d.ts.map +1 -1
  79. package/dist/task.d.ts.map +1 -1
  80. package/dist/task_logging.d.ts.map +1 -1
  81. package/dist/test.task.d.ts.map +1 -1
  82. package/dist/throttle.d.ts.map +1 -1
  83. package/dist/typecheck.task.d.ts.map +1 -1
  84. package/dist/upgrade.task.d.ts.map +1 -1
  85. package/dist/watch_dir.d.ts.map +1 -1
  86. package/package.json +3 -2
  87. package/src/lib/package.ts +3 -3
  88. package/dist/args.test.d.ts +0 -2
  89. package/dist/args.test.d.ts.map +0 -1
  90. package/dist/args.test.js +0 -43
  91. package/dist/changelog.test.d.ts +0 -2
  92. package/dist/changelog.test.d.ts.map +0 -1
  93. package/dist/changelog.test.js +0 -118
  94. package/dist/config.test.d.ts +0 -2
  95. package/dist/config.test.d.ts.map +0 -1
  96. package/dist/config.test.js +0 -64
  97. package/dist/esbuild_plugin_svelte.test.d.ts +0 -2
  98. package/dist/esbuild_plugin_svelte.test.d.ts.map +0 -1
  99. package/dist/esbuild_plugin_svelte.test.js +0 -74
  100. package/dist/format_file.test.d.ts +0 -2
  101. package/dist/format_file.test.d.ts.map +0 -1
  102. package/dist/format_file.test.js +0 -16
  103. package/dist/gen.test.d.ts +0 -2
  104. package/dist/gen.test.d.ts.map +0 -1
  105. package/dist/gen.test.js +0 -248
  106. package/dist/git.test.d.ts +0 -2
  107. package/dist/git.test.d.ts.map +0 -1
  108. package/dist/git.test.js +0 -21
  109. package/dist/hash.test.d.ts +0 -2
  110. package/dist/hash.test.d.ts.map +0 -1
  111. package/dist/hash.test.js +0 -25
  112. package/dist/input_path.test.d.ts +0 -2
  113. package/dist/input_path.test.d.ts.map +0 -1
  114. package/dist/input_path.test.js +0 -205
  115. package/dist/loader.test.d.ts +0 -2
  116. package/dist/loader.test.d.ts.map +0 -1
  117. package/dist/loader.test.js +0 -41
  118. package/dist/module.test.d.ts +0 -2
  119. package/dist/module.test.d.ts.map +0 -1
  120. package/dist/module.test.js +0 -41
  121. package/dist/modules.test.d.ts +0 -2
  122. package/dist/modules.test.d.ts.map +0 -1
  123. package/dist/modules.test.js +0 -58
  124. package/dist/package_json.test.d.ts +0 -2
  125. package/dist/package_json.test.d.ts.map +0 -1
  126. package/dist/package_json.test.js +0 -84
  127. package/dist/paths.test.d.ts +0 -2
  128. package/dist/paths.test.d.ts.map +0 -1
  129. package/dist/paths.test.js +0 -51
  130. package/dist/plugin.test.d.ts +0 -2
  131. package/dist/plugin.test.d.ts.map +0 -1
  132. package/dist/plugin.test.js +0 -54
  133. package/dist/resolve_node_specifier.test.d.ts +0 -2
  134. package/dist/resolve_node_specifier.test.d.ts.map +0 -1
  135. package/dist/resolve_node_specifier.test.js +0 -21
  136. package/dist/resolve_specifier.test.d.ts +0 -2
  137. package/dist/resolve_specifier.test.d.ts.map +0 -1
  138. package/dist/resolve_specifier.test.js +0 -66
  139. package/dist/run_gen.test.d.ts +0 -2
  140. package/dist/run_gen.test.d.ts.map +0 -1
  141. package/dist/run_gen.test.js +0 -178
  142. package/dist/run_task.test.d.ts +0 -2
  143. package/dist/run_task.test.d.ts.map +0 -1
  144. package/dist/run_task.test.js +0 -64
  145. package/dist/search_fs.test.d.ts +0 -2
  146. package/dist/search_fs.test.d.ts.map +0 -1
  147. package/dist/search_fs.test.js +0 -48
  148. package/dist/src_json.test.d.ts +0 -2
  149. package/dist/src_json.test.d.ts.map +0 -1
  150. package/dist/src_json.test.js +0 -39
  151. package/dist/task.test.d.ts +0 -2
  152. package/dist/task.test.d.ts.map +0 -1
  153. package/dist/task.test.js +0 -46
  154. package/dist/throttle.test.d.ts +0 -2
  155. package/dist/throttle.test.d.ts.map +0 -1
  156. package/dist/throttle.test.js +0 -49
package/dist/gen.test.js DELETED
@@ -1,248 +0,0 @@
1
- import { test } from 'uvu';
2
- import * as assert from 'uvu/assert';
3
- import { resolve } from 'node:path';
4
- import { to_gen_result, find_genfiles, validate_gen_module } from './gen.js';
5
- import { paths } from './paths.js';
6
- import { create_empty_config } from './config.js';
7
- const origin_id = resolve('src/foo.gen.ts');
8
- test('to_gen_result plain string', () => {
9
- assert.equal(to_gen_result(origin_id, '/**/'), {
10
- origin_id,
11
- files: [{ id: resolve('src/foo.ts'), content: '/**/', origin_id, format: true }],
12
- });
13
- });
14
- test('to_gen_result object with a content string', () => {
15
- assert.equal(to_gen_result(origin_id, { content: '/**/' }), {
16
- origin_id,
17
- files: [{ id: resolve('src/foo.ts'), content: '/**/', origin_id, format: true }],
18
- });
19
- });
20
- test('to_gen_result fail with an unresolved id', () => {
21
- assert.throws(() => to_gen_result('src/foo.ts', { content: '/**/' }));
22
- });
23
- test('to_gen_result fail with a build id', () => {
24
- assert.throws(() => to_gen_result(resolve('.gro/foo.js'), { content: '/**/' }));
25
- });
26
- test('to_gen_result fail with an empty id', () => {
27
- assert.throws(() => to_gen_result('', { content: '/**/' }));
28
- });
29
- test('to_gen_result custom file name', () => {
30
- assert.equal(to_gen_result(origin_id, {
31
- filename: 'fooz.ts',
32
- content: '/**/',
33
- }), {
34
- origin_id,
35
- files: [{ id: resolve('src/fooz.ts'), content: '/**/', origin_id, format: true }],
36
- });
37
- });
38
- test('to_gen_result custom file name that matches the default file name', () => {
39
- assert.equal(to_gen_result(origin_id, {
40
- filename: 'foo.ts',
41
- content: '/**/',
42
- }), {
43
- origin_id,
44
- files: [{ id: resolve('src/foo.ts'), content: '/**/', origin_id, format: true }],
45
- });
46
- });
47
- test('to_gen_result fail when custom file name explicitly matches the origin', () => {
48
- assert.throws(() => {
49
- to_gen_result(origin_id, {
50
- filename: 'foo.gen.ts',
51
- content: '/**/',
52
- });
53
- });
54
- });
55
- test('to_gen_result fail when file name implicitly matches the origin', () => {
56
- assert.throws(() => {
57
- to_gen_result(resolve('src/foo.ts'), { content: '/**/' });
58
- });
59
- });
60
- test('to_gen_result fail with an empty file name', () => {
61
- assert.throws(() => to_gen_result(origin_id, { filename: '', content: '/**/' }));
62
- });
63
- test('to_gen_result additional file name parts', () => {
64
- assert.equal(to_gen_result(resolve('src/foo.bar.gen.ts'), { content: '/**/' }), {
65
- origin_id: resolve('src/foo.bar.gen.ts'),
66
- files: [
67
- {
68
- id: resolve('src/foo.bar.ts'),
69
- content: '/**/',
70
- origin_id: resolve('src/foo.bar.gen.ts'),
71
- format: true,
72
- },
73
- ],
74
- });
75
- });
76
- test('to_gen_result js', () => {
77
- assert.equal(to_gen_result(origin_id, {
78
- filename: 'foo.js',
79
- content: '/**/',
80
- }), {
81
- origin_id,
82
- files: [{ id: resolve('src/foo.js'), content: '/**/', origin_id, format: true }],
83
- });
84
- });
85
- test('to_gen_result implicit custom file extension', () => {
86
- assert.equal(to_gen_result(resolve('src/foo.gen.json.ts'), '[/**/]'), {
87
- origin_id: resolve('src/foo.gen.json.ts'),
88
- files: [
89
- {
90
- id: resolve('src/foo.json'),
91
- content: '[/**/]',
92
- origin_id: resolve('src/foo.gen.json.ts'),
93
- format: true,
94
- },
95
- ],
96
- });
97
- });
98
- test('to_gen_result implicit empty file extension', () => {
99
- assert.equal(to_gen_result(resolve('src/foo.gen..ts'), '[/**/]'), {
100
- origin_id: resolve('src/foo.gen..ts'),
101
- files: [
102
- {
103
- id: resolve('src/foo'),
104
- content: '[/**/]',
105
- origin_id: resolve('src/foo.gen..ts'),
106
- format: true,
107
- },
108
- ],
109
- });
110
- });
111
- test('to_gen_result implicit custom file extension with additional file name parts', () => {
112
- assert.equal(to_gen_result(resolve('src/foo.bar.gen.json.ts'), { content: '[/**/]' }), {
113
- origin_id: resolve('src/foo.bar.gen.json.ts'),
114
- files: [
115
- {
116
- id: resolve('src/foo.bar.json'),
117
- content: '[/**/]',
118
- origin_id: resolve('src/foo.bar.gen.json.ts'),
119
- format: true,
120
- },
121
- ],
122
- });
123
- });
124
- test('to_gen_result implicit custom file extension with many dots in between', () => {
125
- assert.equal(to_gen_result(resolve('src/foo...gen.ts'), '[/**/]'), {
126
- origin_id: resolve('src/foo...gen.ts'),
127
- files: [
128
- {
129
- id: resolve('src/foo...ts'),
130
- content: '[/**/]',
131
- origin_id: resolve('src/foo...gen.ts'),
132
- format: true,
133
- },
134
- ],
135
- });
136
- });
137
- test('to_gen_result fail with two parts following the .gen. pattern in the file name', () => {
138
- // This just ensures consistent file names - maybe loosen the restriction?
139
- // You can still implicitly name files like this,
140
- // but you have to move ".bar" before ".gen".
141
- assert.throws(() => to_gen_result(resolve('src/foo.gen.bar.json.ts'), '/**/'));
142
- });
143
- test('to_gen_result fail implicit file extension ending with a dot', () => {
144
- // This just ensures consistent file names - maybe loosen the restriction?
145
- // This one is more restrictive than the above,
146
- // because to have a file ending with a dot
147
- // you have to use an explicit file name.
148
- assert.throws(() => to_gen_result(resolve('src/foo.gen...ts'), '[/**/]'));
149
- });
150
- test('to_gen_result fail without a .gen. pattern in the file name', () => {
151
- assert.throws(() => {
152
- to_gen_result(resolve('src/foo.ts'), '/**/');
153
- });
154
- });
155
- test('to_gen_result fail without a .gen. pattern in a file name that has multiple other patterns', () => {
156
- assert.throws(() => {
157
- to_gen_result(resolve('src/foo.bar.baz.ts'), '/**/');
158
- });
159
- });
160
- test('to_gen_result fail with two .gen. patterns in the file name', () => {
161
- assert.throws(() => to_gen_result(resolve('src/lib/gen.gen.ts'), '/**/'));
162
- assert.throws(() => to_gen_result(resolve('src/foo.gen.gen.ts'), '/**/'));
163
- assert.throws(() => to_gen_result(resolve('src/foo.gen.bar.gen.ts'), '/**/'));
164
- assert.throws(() => to_gen_result(resolve('src/foo.gen.bar.gen.baz.ts'), '/**/'));
165
- });
166
- test('to_gen_result explicit custom file extension', () => {
167
- assert.equal(to_gen_result(origin_id, {
168
- filename: 'foo.json',
169
- content: '[/**/]',
170
- }), {
171
- origin_id,
172
- files: [{ id: resolve('src/foo.json'), content: '[/**/]', origin_id, format: true }],
173
- });
174
- });
175
- test('to_gen_result explicit custom empty file extension', () => {
176
- assert.equal(to_gen_result(origin_id, {
177
- filename: 'foo',
178
- content: '[/**/]',
179
- }), {
180
- origin_id,
181
- files: [{ id: resolve('src/foo'), content: '[/**/]', origin_id, format: true }],
182
- });
183
- });
184
- test('to_gen_result explicit custom file extension ending with a dot', () => {
185
- assert.equal(to_gen_result(origin_id, {
186
- filename: 'foo.',
187
- content: '[/**/]',
188
- }), {
189
- origin_id,
190
- files: [{ id: resolve('src/foo.'), content: '[/**/]', origin_id, format: true }],
191
- });
192
- });
193
- test('to_gen_result simple array of raw files', () => {
194
- assert.equal(to_gen_result(origin_id, [{ content: '/*1*/' }, { filename: 'foo2.ts', content: '/*2*/' }]), {
195
- origin_id,
196
- files: [
197
- { id: resolve('src/foo.ts'), content: '/*1*/', origin_id, format: true },
198
- { id: resolve('src/foo2.ts'), content: '/*2*/', origin_id, format: true },
199
- ],
200
- });
201
- });
202
- test('to_gen_result complex array of raw files', () => {
203
- assert.equal(to_gen_result(origin_id, [
204
- { content: '/*1*/' },
205
- { filename: 'foo2.ts', content: '/*2*/' },
206
- { filename: 'foo3.ts', content: '/*3*/' },
207
- { filename: 'foo4.ts', content: '/*4*/' },
208
- { filename: 'foo5.json', content: '[/*5*/]' },
209
- ]), {
210
- origin_id,
211
- files: [
212
- { id: resolve('src/foo.ts'), content: '/*1*/', origin_id, format: true },
213
- { id: resolve('src/foo2.ts'), content: '/*2*/', origin_id, format: true },
214
- { id: resolve('src/foo3.ts'), content: '/*3*/', origin_id, format: true },
215
- { id: resolve('src/foo4.ts'), content: '/*4*/', origin_id, format: true },
216
- { id: resolve('src/foo5.json'), content: '[/*5*/]', origin_id, format: true },
217
- ],
218
- });
219
- });
220
- test('to_gen_result fail with duplicate names because of omissions', () => {
221
- assert.throws(() => {
222
- to_gen_result(origin_id, [{ content: '/*1*/' }, { content: '/*2*/' }]);
223
- });
224
- });
225
- test('to_gen_result fail with duplicate explicit names', () => {
226
- assert.throws(() => {
227
- to_gen_result(origin_id, [
228
- { filename: 'foo.ts', content: '/*1*/' },
229
- { filename: 'foo.ts', content: '/*2*/' },
230
- ]);
231
- });
232
- });
233
- test('to_gen_result fail with duplicate explicit and implicit names', () => {
234
- assert.throws(() => {
235
- to_gen_result(origin_id, [{ content: '/*1*/' }, { filename: 'foo.ts', content: '/*2*/' }]);
236
- });
237
- });
238
- test('validate_gen_module basic behavior', () => {
239
- assert.ok(validate_gen_module({ gen: Function.prototype }));
240
- assert.ok(!validate_gen_module({ gen: {} }));
241
- assert.ok(!validate_gen_module({ task: { run: {} } }));
242
- });
243
- test('find_genfiles_result finds gen modules in a directory', () => {
244
- const find_genfiles_result = find_genfiles(['../docs'], [paths.lib], create_empty_config());
245
- assert.ok(find_genfiles_result.ok);
246
- assert.ok(find_genfiles_result.value.resolved_input_paths.length);
247
- });
248
- test.run();
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=git.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"git.test.d.ts","sourceRoot":"","sources":["../../../src/lib/git.test.ts"],"names":[],"mappings":""}
package/dist/git.test.js DELETED
@@ -1,21 +0,0 @@
1
- import { test } from 'uvu';
2
- import * as assert from 'uvu/assert';
3
- import { git_check_clean_workspace, git_check_fully_staged_workspace, git_current_branch_first_commit_hash, git_current_branch_name, git_current_commit_hash, } from './git.js';
4
- test('git_current_branch_name', async () => {
5
- const branch_name = await git_current_branch_name();
6
- assert.ok(branch_name);
7
- });
8
- test('git_check_clean_workspace', async () => {
9
- await git_check_clean_workspace();
10
- });
11
- test('git_check_fully_staged_workspace', async () => {
12
- await git_check_fully_staged_workspace();
13
- });
14
- test('git_current_commit_hash', async () => {
15
- await git_current_commit_hash();
16
- });
17
- test('git_current_branch_first_commit_hash', async () => {
18
- const first_commit_hash = await git_current_branch_first_commit_hash();
19
- assert.ok(first_commit_hash);
20
- });
21
- test.run();
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=hash.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"hash.test.d.ts","sourceRoot":"","sources":["../../../src/lib/hash.test.ts"],"names":[],"mappings":""}
package/dist/hash.test.js DELETED
@@ -1,25 +0,0 @@
1
- import { suite } from 'uvu';
2
- import * as assert from 'uvu/assert';
3
- import { webcrypto } from 'node:crypto';
4
- import { to_hash } from './hash.js';
5
- /* test__to_hash */
6
- const test__to_hash = suite('to_hash');
7
- test__to_hash('turns a buffer into a string', async () => {
8
- assert.type(await to_hash(Buffer.from('hey')), 'string');
9
- });
10
- test__to_hash('returns the same value given the same input', async () => {
11
- assert.is(await to_hash(Buffer.from('hey')), await to_hash(Buffer.from('hey')));
12
- });
13
- test__to_hash('checks against an implementation copied from MDN', async () => {
14
- const data = Buffer.from('some_test_string');
15
- assert.is(await to_hash_from_mdn_example(data), await to_hash(data));
16
- });
17
- test__to_hash.run();
18
- /* test__to_hash */
19
- /**
20
- * Copied from https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/digest
21
- * and compared against our implementation for extra assurances, because cryptography.
22
- */
23
- const to_hash_from_mdn_example = async (data) => Array.from(new Uint8Array(await webcrypto.subtle.digest('SHA-256', data)))
24
- .map((h) => h.toString(16).padStart(2, '0'))
25
- .join('');
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=input_path.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"input_path.test.d.ts","sourceRoot":"","sources":["../../../src/lib/input_path.test.ts"],"names":[],"mappings":""}
@@ -1,205 +0,0 @@
1
- import { test } from 'uvu';
2
- import * as assert from 'uvu/assert';
3
- import { resolve } from 'node:path';
4
- import { to_input_path, to_input_paths, resolve_input_files, get_possible_paths, } from './input_path.js';
5
- import { GRO_DIST_DIR, paths } from './paths.js';
6
- test('to_input_path', () => {
7
- assert.is(to_input_path(resolve('foo.ts')), resolve('foo.ts'));
8
- assert.is(to_input_path('./foo.ts'), resolve('foo.ts'));
9
- assert.is(to_input_path('foo.ts'), 'foo.ts');
10
- assert.is(to_input_path('gro/foo'), GRO_DIST_DIR + 'foo');
11
- // trailing slashes are preserved:
12
- assert.is(to_input_path(resolve('foo/bar/')), resolve('foo/bar/'));
13
- assert.is(to_input_path('./foo/bar/'), resolve('foo/bar/'));
14
- assert.is(to_input_path('foo/bar/'), 'foo/bar/');
15
- });
16
- test('to_input_paths', () => {
17
- assert.equal(to_input_paths([resolve('foo/bar.ts'), './baz', 'foo']), [
18
- resolve('foo/bar.ts'),
19
- resolve('baz'),
20
- 'foo',
21
- ]);
22
- });
23
- test('get_possible_paths with an implicit relative path', () => {
24
- const input_path = 'src/foo/bar';
25
- assert.equal(get_possible_paths(input_path, [resolve('src/foo'), resolve('src/baz'), resolve('src'), resolve('.')], ['.ext.ts']), [
26
- {
27
- id: resolve('src/foo/src/foo/bar'),
28
- input_path: 'src/foo/bar',
29
- root_dir: resolve('src/foo'),
30
- },
31
- {
32
- id: resolve('src/foo/src/foo/bar.ext.ts'),
33
- input_path: 'src/foo/bar',
34
- root_dir: resolve('src/foo'),
35
- },
36
- {
37
- id: resolve('src/baz/src/foo/bar'),
38
- input_path: 'src/foo/bar',
39
- root_dir: resolve('src/baz'),
40
- },
41
- {
42
- id: resolve('src/baz/src/foo/bar.ext.ts'),
43
- input_path: 'src/foo/bar',
44
- root_dir: resolve('src/baz'),
45
- },
46
- {
47
- id: resolve('src/src/foo/bar'),
48
- input_path: 'src/foo/bar',
49
- root_dir: resolve('src'),
50
- },
51
- {
52
- id: resolve('src/src/foo/bar.ext.ts'),
53
- input_path: 'src/foo/bar',
54
- root_dir: resolve('src'),
55
- },
56
- {
57
- id: resolve('src/foo/bar'),
58
- input_path: 'src/foo/bar',
59
- root_dir: resolve('.'),
60
- },
61
- {
62
- id: resolve('src/foo/bar.ext.ts'),
63
- input_path: 'src/foo/bar',
64
- root_dir: resolve('.'),
65
- },
66
- ]);
67
- });
68
- test('get_possible_paths in the gro directory', () => {
69
- const input_path = resolve('src/foo/bar');
70
- assert.equal(get_possible_paths(input_path, [], ['.ext.ts']), [
71
- { id: input_path, input_path: resolve('src/foo/bar'), root_dir: resolve('src/foo') },
72
- { id: input_path + '.ext.ts', input_path: resolve('src/foo/bar'), root_dir: resolve('src/foo') },
73
- ]);
74
- });
75
- test('get_possible_paths does not repeat the extension', () => {
76
- const input_path = resolve('src/foo/bar.ext.ts');
77
- assert.equal(get_possible_paths(input_path, [], ['.ext.ts']), [
78
- { id: input_path, input_path: resolve('src/foo/bar.ext.ts'), root_dir: resolve('src/foo') },
79
- ]);
80
- });
81
- test('get_possible_paths does not repeat with the same root directory', () => {
82
- const input_path = resolve('src/foo/bar.ext.ts');
83
- assert.equal(get_possible_paths(input_path, [paths.root, paths.root], ['.ext.ts']), [
84
- { id: input_path, input_path: resolve('src/foo/bar.ext.ts'), root_dir: resolve('src/foo') },
85
- ]);
86
- });
87
- test('get_possible_paths implied to be a directory by trailing slash', () => {
88
- const input_path = resolve('src/foo/bar') + '/';
89
- assert.equal(get_possible_paths(input_path, [], ['.ext.ts']), [
90
- { id: input_path, input_path: resolve('src/foo/bar') + '/', root_dir: resolve('src/foo') },
91
- ]);
92
- });
93
- test('resolve_input_files', () => {
94
- const test_files = {
95
- 'fake/test1.ext.ts': [
96
- { id: 'fake/test1.ext.ts', path: 'fake/test1.ext.ts', is_directory: false },
97
- ],
98
- 'fake/test2.ext.ts': [
99
- { id: 'fake/test2.ext.ts', path: 'fake/test2.ext.ts', is_directory: false },
100
- ],
101
- 'fake/test3': [
102
- { id: 'fake/test3', path: 'fake/test3', is_directory: true },
103
- { id: 'a.ts', path: 'a.ts', is_directory: false },
104
- { id: 'b.ts', path: 'b.ts', is_directory: false },
105
- ],
106
- // duplicate
107
- 'fake/': [
108
- { id: 'fake/test3', path: 'fake/test3', is_directory: true },
109
- { id: 'test3/a.ts', path: 'test3/a.ts', is_directory: false },
110
- ],
111
- // duplicate and not
112
- fake: [
113
- { id: 'fake/test3', path: 'fake/test3', is_directory: true },
114
- { id: 'test3/a.ts', path: 'test3/a.ts', is_directory: false },
115
- { id: 'test3/c.ts', path: 'test3/c.ts', is_directory: false },
116
- ],
117
- 'fake/nomatches': [{ id: 'fake/nomatches', path: 'fake/nomatches', is_directory: true }],
118
- fake2: [{ id: 'test.ext.ts', path: 'test.ext.ts', is_directory: false }],
119
- };
120
- const a = {
121
- id: 'fake/test1.ext.ts',
122
- is_directory: false,
123
- input_path: 'fake/test1.ext.ts',
124
- root_dir: process.cwd(),
125
- };
126
- const b = {
127
- id: 'fake/test2.ext.ts',
128
- is_directory: false,
129
- input_path: 'fake/test2',
130
- root_dir: process.cwd(),
131
- };
132
- const c = {
133
- id: 'fake/test3',
134
- is_directory: true,
135
- input_path: 'fake/test3',
136
- root_dir: process.cwd(),
137
- };
138
- const d = {
139
- id: 'fake',
140
- is_directory: true,
141
- input_path: 'fake',
142
- root_dir: process.cwd(),
143
- };
144
- const e = {
145
- id: 'fake/nomatches',
146
- is_directory: true,
147
- input_path: 'fake/nomatches',
148
- root_dir: process.cwd(),
149
- };
150
- // These two have the same id from different directory input paths.
151
- const f = {
152
- id: 'fake2',
153
- is_directory: true,
154
- input_path: 'fake2',
155
- root_dir: process.cwd(),
156
- };
157
- const g = {
158
- id: 'fake2',
159
- is_directory: true,
160
- input_path: './fake2/',
161
- root_dir: process.cwd(),
162
- };
163
- // These two have the same id from different file input paths.
164
- const h = {
165
- id: 'fake3/test.ext.ts',
166
- is_directory: false,
167
- input_path: 'fake3/test.ext.ts',
168
- root_dir: process.cwd(),
169
- };
170
- const i = {
171
- id: 'fake3/test.ext.ts',
172
- is_directory: false,
173
- input_path: 'fake3/test',
174
- root_dir: process.cwd(),
175
- };
176
- const result = resolve_input_files([a, b, c, d, e, f, g, h, i], (dir) => test_files[dir]);
177
- const resolved_input_files = [
178
- { id: a.id, input_path: a.input_path, resolved_input_path: a },
179
- { id: b.id, input_path: b.input_path, resolved_input_path: b },
180
- { id: 'fake/test3/a.ts', input_path: c.input_path, resolved_input_path: c },
181
- { id: 'fake/test3/b.ts', input_path: c.input_path, resolved_input_path: c },
182
- { id: 'fake/test3/c.ts', input_path: d.input_path, resolved_input_path: d },
183
- { id: 'fake2/test.ext.ts', input_path: f.input_path, resolved_input_path: f },
184
- { id: 'fake3/test.ext.ts', input_path: h.input_path, resolved_input_path: h },
185
- ];
186
- assert.equal(result, {
187
- resolved_input_files,
188
- resolved_input_files_by_root_dir: new Map([
189
- [
190
- process.cwd(),
191
- [
192
- { id: 'fake/test1.ext.ts', input_path: a.input_path, resolved_input_path: a },
193
- { id: 'fake/test2.ext.ts', input_path: b.input_path, resolved_input_path: b },
194
- { id: 'fake/test3/a.ts', input_path: c.input_path, resolved_input_path: c },
195
- { id: 'fake/test3/b.ts', input_path: c.input_path, resolved_input_path: c },
196
- { id: 'fake/test3/c.ts', input_path: d.input_path, resolved_input_path: d },
197
- { id: 'fake2/test.ext.ts', input_path: f.input_path, resolved_input_path: f },
198
- { id: 'fake3/test.ext.ts', input_path: h.input_path, resolved_input_path: h },
199
- ],
200
- ],
201
- ]),
202
- input_directories_with_no_files: [e.input_path],
203
- });
204
- });
205
- test.run();
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=loader.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"loader.test.d.ts","sourceRoot":"","sources":["../../../src/lib/loader.test.ts"],"names":[],"mappings":""}
@@ -1,41 +0,0 @@
1
- import { test } from 'uvu';
2
- import * as assert from 'uvu/assert';
3
- import { resolve } from 'node:path';
4
- test('import js', async () => {
5
- const imported = await import(resolve('src/fixtures/modules/some_test_ts.js'));
6
- assert.ok(imported);
7
- assert.is(imported.a, 'ok');
8
- });
9
- test('import ts', async () => {
10
- const imported = await import(resolve('src/fixtures/modules/some_test_ts.ts'));
11
- assert.ok(imported);
12
- assert.is(imported.a, 'ok');
13
- });
14
- test('import json', async () => {
15
- const imported = await import(resolve('src/fixtures/modules/some_test_json.json'));
16
- assert.ok(imported);
17
- assert.is(imported.default.a, 'ok');
18
- });
19
- test('import css as a no-op', async () => {
20
- const imported = await import(resolve('src/fixtures/modules/some_test_css.css'));
21
- assert.is(typeof imported.default, 'string');
22
- assert.ok(imported);
23
- });
24
- test('import svelte', async () => {
25
- const imported = await import(resolve('src/fixtures/modules/Some_Test_Svelte.svelte'));
26
- assert.ok(imported);
27
- assert.is(imported.a, 'ok');
28
- });
29
- test('import svelte.js', async () => {
30
- const imported = await import(resolve('src/fixtures/modules/some_test_svelte_js.svelte.js'));
31
- assert.ok(imported.Some_Test_Svelte_Js);
32
- const instance = new imported.Some_Test_Svelte_Js();
33
- assert.is(instance.a, 'ok');
34
- });
35
- test('import svelte.ts', async () => {
36
- const imported = await import(resolve('src/fixtures/modules/some_test_svelte_ts.svelte.ts'));
37
- assert.ok(imported.Some_Test_Svelte_Ts);
38
- const instance = new imported.Some_Test_Svelte_Ts();
39
- assert.is(instance.a, 'ok');
40
- });
41
- test.run();
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=module.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"module.test.d.ts","sourceRoot":"","sources":["../../../src/lib/module.test.ts"],"names":[],"mappings":""}
@@ -1,41 +0,0 @@
1
- import { suite } from 'uvu';
2
- import * as assert from 'uvu/assert';
3
- import { is_external_module } from './module.js';
4
- /* test__is_external_module */
5
- const test__is_external_module = suite('is_external_module');
6
- test__is_external_module('internal browser module patterns', () => {
7
- assert.is(is_external_module('./foo'), false);
8
- assert.is(is_external_module('./foo.js'), false);
9
- assert.is(is_external_module('../foo'), false);
10
- assert.is(is_external_module('../foo.js'), false);
11
- assert.is(is_external_module('../../../foo'), false);
12
- assert.is(is_external_module('../../../foo.js'), false);
13
- assert.is(is_external_module('/foo'), false);
14
- assert.is(is_external_module('/foo.js'), false);
15
- assert.is(is_external_module('src/foo'), false);
16
- assert.is(is_external_module('src/foo.js'), false);
17
- assert.is(is_external_module('$lib/foo'), false);
18
- assert.is(is_external_module('$lib/foo.js'), false);
19
- assert.is(is_external_module('./foo/bar/baz'), false);
20
- assert.is(is_external_module('./foo/bar/baz.js'), false);
21
- assert.is(is_external_module('../foo/bar/baz'), false);
22
- assert.is(is_external_module('../foo/bar/baz.js'), false);
23
- assert.is(is_external_module('../../../foo/bar/baz'), false);
24
- assert.is(is_external_module('../../../foo/bar/baz.js'), false);
25
- assert.is(is_external_module('/foo/bar/baz'), false);
26
- assert.is(is_external_module('/foo/bar/baz.js'), false);
27
- assert.is(is_external_module('src/foo/bar/baz'), false);
28
- assert.is(is_external_module('src/foo/bar/baz.js'), false);
29
- assert.is(is_external_module('$lib/foo/bar/baz'), false);
30
- assert.is(is_external_module('$lib/foo/bar/baz.js'), false);
31
- });
32
- test__is_external_module('external browser module patterns', () => {
33
- assert.is(is_external_module('foo'), true);
34
- assert.is(is_external_module('foo.js'), true);
35
- assert.is(is_external_module('foo/bar/baz'), true);
36
- assert.is(is_external_module('foo/bar/baz.js'), true);
37
- assert.is(is_external_module('@foo/bar/baz'), true);
38
- assert.is(is_external_module('@foo/bar/baz.js'), true);
39
- });
40
- test__is_external_module.run();
41
- /* test__is_external_module */
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=modules.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"modules.test.d.ts","sourceRoot":"","sources":["../../../src/lib/modules.test.ts"],"names":[],"mappings":""}