@ryanatkn/gro 0.129.8 → 0.129.10
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/package.js +3 -3
- package/package.json +4 -2
- package/src/lib/package.ts +3 -3
- package/dist/args.test.d.ts +0 -2
- package/dist/args.test.d.ts.map +0 -1
- package/dist/args.test.js +0 -43
- package/dist/changelog.test.d.ts +0 -2
- package/dist/changelog.test.d.ts.map +0 -1
- package/dist/changelog.test.js +0 -118
- package/dist/config.test.d.ts +0 -2
- package/dist/config.test.d.ts.map +0 -1
- package/dist/config.test.js +0 -64
- package/dist/esbuild_plugin_svelte.test.d.ts +0 -2
- package/dist/esbuild_plugin_svelte.test.d.ts.map +0 -1
- package/dist/esbuild_plugin_svelte.test.js +0 -74
- package/dist/format_file.test.d.ts +0 -2
- package/dist/format_file.test.d.ts.map +0 -1
- package/dist/format_file.test.js +0 -16
- package/dist/gen.test.d.ts +0 -2
- package/dist/gen.test.d.ts.map +0 -1
- package/dist/gen.test.js +0 -248
- package/dist/git.test.d.ts +0 -2
- package/dist/git.test.d.ts.map +0 -1
- package/dist/git.test.js +0 -21
- package/dist/hash.test.d.ts +0 -2
- package/dist/hash.test.d.ts.map +0 -1
- package/dist/hash.test.js +0 -25
- package/dist/input_path.test.d.ts +0 -2
- package/dist/input_path.test.d.ts.map +0 -1
- package/dist/input_path.test.js +0 -205
- package/dist/loader.test.d.ts +0 -2
- package/dist/loader.test.d.ts.map +0 -1
- package/dist/loader.test.js +0 -41
- package/dist/module.test.d.ts +0 -2
- package/dist/module.test.d.ts.map +0 -1
- package/dist/module.test.js +0 -41
- package/dist/modules.test.d.ts +0 -2
- package/dist/modules.test.d.ts.map +0 -1
- package/dist/modules.test.js +0 -58
- package/dist/package_json.test.d.ts +0 -2
- package/dist/package_json.test.d.ts.map +0 -1
- package/dist/package_json.test.js +0 -84
- package/dist/paths.test.d.ts +0 -2
- package/dist/paths.test.d.ts.map +0 -1
- package/dist/paths.test.js +0 -51
- package/dist/plugin.test.d.ts +0 -2
- package/dist/plugin.test.d.ts.map +0 -1
- package/dist/plugin.test.js +0 -54
- package/dist/resolve_node_specifier.test.d.ts +0 -2
- package/dist/resolve_node_specifier.test.d.ts.map +0 -1
- package/dist/resolve_node_specifier.test.js +0 -21
- package/dist/resolve_specifier.test.d.ts +0 -2
- package/dist/resolve_specifier.test.d.ts.map +0 -1
- package/dist/resolve_specifier.test.js +0 -66
- package/dist/run_gen.test.d.ts +0 -2
- package/dist/run_gen.test.d.ts.map +0 -1
- package/dist/run_gen.test.js +0 -178
- package/dist/run_task.test.d.ts +0 -2
- package/dist/run_task.test.d.ts.map +0 -1
- package/dist/run_task.test.js +0 -64
- package/dist/search_fs.test.d.ts +0 -2
- package/dist/search_fs.test.d.ts.map +0 -1
- package/dist/search_fs.test.js +0 -48
- package/dist/src_json.test.d.ts +0 -2
- package/dist/src_json.test.d.ts.map +0 -1
- package/dist/src_json.test.js +0 -39
- package/dist/task.test.d.ts +0 -2
- package/dist/task.test.d.ts.map +0 -1
- package/dist/task.test.js +0 -46
- package/dist/throttle.test.d.ts +0 -2
- package/dist/throttle.test.d.ts.map +0 -1
- package/dist/throttle.test.js +0 -49
- package/src/lib/args.test.ts +0 -59
- package/src/lib/changelog.test.ts +0 -138
- package/src/lib/config.test.ts +0 -71
- package/src/lib/esbuild_plugin_svelte.test.ts +0 -88
- package/src/lib/format_file.test.ts +0 -20
- package/src/lib/gen.test.ts +0 -306
- package/src/lib/git.test.ts +0 -34
- package/src/lib/hash.test.ts +0 -33
- package/src/lib/input_path.test.ts +0 -230
- package/src/lib/loader.test.ts +0 -49
- package/src/lib/module.test.ts +0 -46
- package/src/lib/modules.test.ts +0 -63
- package/src/lib/package_json.test.ts +0 -101
- package/src/lib/paths.test.ts +0 -77
- package/src/lib/plugin.test.ts +0 -57
- package/src/lib/resolve_node_specifier.test.ts +0 -31
- package/src/lib/resolve_specifier.test.ts +0 -76
- package/src/lib/run_gen.test.ts +0 -196
- package/src/lib/run_task.test.ts +0 -86
- package/src/lib/search_fs.test.ts +0 -56
- package/src/lib/src_json.test.ts +0 -49
- package/src/lib/task.test.ts +0 -84
- package/src/lib/throttle.test.ts +0 -52
package/dist/search_fs.test.js
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { test } from 'uvu';
|
|
2
|
-
import * as assert from 'uvu/assert';
|
|
3
|
-
import { resolve } from 'node:path';
|
|
4
|
-
import { search_fs } from './search_fs.js';
|
|
5
|
-
test('search_fs basic behavior', () => {
|
|
6
|
-
const ignored_path = 'test1.foo.ts';
|
|
7
|
-
let has_ignored_path = false;
|
|
8
|
-
const result = search_fs('./src/fixtures', {
|
|
9
|
-
filter: (path) => {
|
|
10
|
-
if (!has_ignored_path)
|
|
11
|
-
has_ignored_path = path.endsWith(ignored_path);
|
|
12
|
-
return !path.endsWith(ignored_path);
|
|
13
|
-
},
|
|
14
|
-
sort: (a, b) => a.path.localeCompare(b.path) * -1,
|
|
15
|
-
});
|
|
16
|
-
assert.ok(has_ignored_path); // makes sure the test isn't wrong
|
|
17
|
-
const expected_files = [
|
|
18
|
-
'test2.foo.ts',
|
|
19
|
-
'test_ts.ts',
|
|
20
|
-
'test_task_module.task_fixture.ts',
|
|
21
|
-
'test_js.js',
|
|
22
|
-
'test_invalid_task_module.ts',
|
|
23
|
-
'test_file.other.ext',
|
|
24
|
-
'test_failing_task_module.ts',
|
|
25
|
-
'some_test_side_effect.ts',
|
|
26
|
-
'some_test_json.json',
|
|
27
|
-
'some_test_exports3.ts',
|
|
28
|
-
'some_test_exports2.ts',
|
|
29
|
-
'some_test_exports.ts',
|
|
30
|
-
'modules/some_test_ts.ts',
|
|
31
|
-
'modules/Some_Test_Svelte.svelte',
|
|
32
|
-
'modules/some_test_svelte_ts.svelte.ts',
|
|
33
|
-
'modules/some_test_svelte_js.svelte.js',
|
|
34
|
-
'modules/some_test_server.ts',
|
|
35
|
-
'modules/some_test_json.json',
|
|
36
|
-
'modules/some_test_js.js',
|
|
37
|
-
'modules/some_test_css.css',
|
|
38
|
-
'changelog_example.md',
|
|
39
|
-
'changelog_cache.json',
|
|
40
|
-
'baz2/test2.baz.ts',
|
|
41
|
-
'baz1/test1.baz.ts',
|
|
42
|
-
'bar2/test2.bar.ts',
|
|
43
|
-
'bar1/test1.bar.ts',
|
|
44
|
-
];
|
|
45
|
-
assert.equal(result.map((f) => f.path), expected_files);
|
|
46
|
-
assert.equal(result.map((f) => f.id), expected_files.map((f) => resolve(`src/fixtures/${f}`)));
|
|
47
|
-
});
|
|
48
|
-
test.run();
|
package/dist/src_json.test.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"src_json.test.d.ts","sourceRoot":"","sources":["../../../src/lib/src_json.test.ts"],"names":[],"mappings":""}
|
package/dist/src_json.test.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { test } from 'uvu';
|
|
2
|
-
import * as assert from 'uvu/assert';
|
|
3
|
-
import { to_src_modules } from './src_json.js';
|
|
4
|
-
import { to_package_exports } from './package_json.js';
|
|
5
|
-
import { paths } from './paths.js';
|
|
6
|
-
test('to_package_modules', () => {
|
|
7
|
-
assert.equal(to_src_modules(to_package_exports([
|
|
8
|
-
'fixtures/modules/some_test_css.css',
|
|
9
|
-
'fixtures/modules/Some_Test_Svelte.svelte',
|
|
10
|
-
'fixtures/modules/some_test_ts.ts',
|
|
11
|
-
'fixtures/modules/some_test_json.json',
|
|
12
|
-
]), undefined, paths.source), {
|
|
13
|
-
'./package.json': { path: 'package.json', declarations: [] },
|
|
14
|
-
'./fixtures/modules/some_test_css.css': {
|
|
15
|
-
path: 'fixtures/modules/some_test_css.css',
|
|
16
|
-
declarations: [],
|
|
17
|
-
},
|
|
18
|
-
'./fixtures/modules/some_test_json.json': {
|
|
19
|
-
path: 'fixtures/modules/some_test_json.json',
|
|
20
|
-
declarations: [],
|
|
21
|
-
},
|
|
22
|
-
'./fixtures/modules/Some_Test_Svelte.svelte': {
|
|
23
|
-
path: 'fixtures/modules/Some_Test_Svelte.svelte',
|
|
24
|
-
declarations: [],
|
|
25
|
-
},
|
|
26
|
-
'./fixtures/modules/some_test_ts.js': {
|
|
27
|
-
path: 'fixtures/modules/some_test_ts.ts',
|
|
28
|
-
declarations: [
|
|
29
|
-
{ name: 'a', kind: 'variable' },
|
|
30
|
-
{ name: 'some_test_ts', kind: 'variable' },
|
|
31
|
-
{ name: 'some_test_fn', kind: 'function' },
|
|
32
|
-
{ name: 'Some_Test_Type', kind: 'type' },
|
|
33
|
-
{ name: 'Some_Test_Interface', kind: 'type' },
|
|
34
|
-
{ name: 'Some_Test_Class', kind: 'class' },
|
|
35
|
-
],
|
|
36
|
-
},
|
|
37
|
-
});
|
|
38
|
-
});
|
|
39
|
-
test.run();
|
package/dist/task.test.d.ts
DELETED
package/dist/task.test.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"task.test.d.ts","sourceRoot":"","sources":["../../../src/lib/task.test.ts"],"names":[],"mappings":""}
|
package/dist/task.test.js
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { test } from 'uvu';
|
|
2
|
-
import * as assert from 'uvu/assert';
|
|
3
|
-
import { resolve } from 'node:path';
|
|
4
|
-
import { is_task_path, to_task_name, validate_task_module, find_tasks, load_tasks } from './task.js';
|
|
5
|
-
import * as actual_test_task_module from './test.task.js';
|
|
6
|
-
import { create_empty_config } from './config.js';
|
|
7
|
-
test('is_task_path basic behavior', () => {
|
|
8
|
-
assert.ok(is_task_path('foo.task.ts'));
|
|
9
|
-
assert.ok(is_task_path('foo.task.js'));
|
|
10
|
-
assert.ok(!is_task_path('foo.ts'));
|
|
11
|
-
assert.ok(is_task_path('bar/baz/foo.task.ts'));
|
|
12
|
-
assert.ok(!is_task_path('bar/baz/foo.ts'));
|
|
13
|
-
});
|
|
14
|
-
test('to_task_name basic behavior', () => {
|
|
15
|
-
assert.is(to_task_name('foo.task.ts', process.cwd(), '', ''), 'foo');
|
|
16
|
-
assert.is(to_task_name('bar/baz/foo.task.ts', process.cwd(), '', ''), 'bar/baz/foo');
|
|
17
|
-
assert.is(to_task_name('a/b/c/foo.task.ts', 'a/b/c', '', ''), 'foo');
|
|
18
|
-
assert.is(to_task_name('a/b/c/foo.task.ts', 'a', '', ''), 'b/c/foo');
|
|
19
|
-
assert.is(to_task_name('a/b/c/foo.task.ts', 'a/b', '', ''), 'c/foo');
|
|
20
|
-
assert.is(to_task_name('/a/b/c/foo.task.ts', '/a/b', '/a/b', '/a/b/d'), '../c/foo');
|
|
21
|
-
assert.is(to_task_name('/a/b/c/foo.task.ts', '/a/b', '/a/b', '/a/b'), 'c/foo');
|
|
22
|
-
assert.is(to_task_name('/a/b/c/foo.task.ts', '/a/b', '/a/b', '/a/b/c'), 'foo');
|
|
23
|
-
assert.is(to_task_name('/a/b/d/foo.task.js', '/a/b/d', '/a/b/d/foo', '/a/c'), '../b/d/foo');
|
|
24
|
-
assert.is(to_task_name('/a/node_modules/b/c/foo.task.js', '/a/node_modules/b/c', '/a/node_modules/b/c/foo', '/a'), 'foo');
|
|
25
|
-
assert.is(to_task_name('/a/node_modules/b/c/foo.task.js', '/a/node_modules/b/c/', // compared to the above, adds a trailing slash here
|
|
26
|
-
'/a/node_modules/b/c/foo', '/a'), 'foo');
|
|
27
|
-
assert.is(to_task_name('/a/node_modules/b/c/foo.task.js', '/a/node_modules/b/c', '/a/node_modules/b/c/foo', '/a/'), 'foo');
|
|
28
|
-
assert.is(to_task_name(resolve('a/b'), resolve('b'), '', ''), resolve('a/b'), 'falls back to the id when unresolved');
|
|
29
|
-
});
|
|
30
|
-
// TODO if we import directly, svelte-package generates types in `src/fixtures`
|
|
31
|
-
const test_task_module = await import('../fixtures/' + 'test_task_module.task_fixture'); // eslint-disable-line no-useless-concat
|
|
32
|
-
const test_invalid_task_module = await import('../fixtures/' + 'test_invalid_task_module.js'); // eslint-disable-line no-useless-concat
|
|
33
|
-
test('validate_task_module basic behavior', () => {
|
|
34
|
-
assert.ok(validate_task_module(test_task_module));
|
|
35
|
-
assert.ok(!validate_task_module(test_invalid_task_module));
|
|
36
|
-
assert.ok(!validate_task_module({ task: { run: {} } }));
|
|
37
|
-
});
|
|
38
|
-
test('load_tasks basic behavior', async () => {
|
|
39
|
-
const found = find_tasks([resolve('src/lib/test'), resolve('src/lib/test.task.ts')], [resolve('src/lib')], create_empty_config());
|
|
40
|
-
assert.ok(found.ok);
|
|
41
|
-
const result = await load_tasks(found.value);
|
|
42
|
-
assert.ok(result.ok);
|
|
43
|
-
assert.is(result.value.modules.length, 1);
|
|
44
|
-
assert.is(result.value.modules[0].mod, actual_test_task_module);
|
|
45
|
-
});
|
|
46
|
-
test.run();
|
package/dist/throttle.test.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"throttle.test.d.ts","sourceRoot":"","sources":["../../../src/lib/throttle.test.ts"],"names":[],"mappings":""}
|
package/dist/throttle.test.js
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { wait } from '@ryanatkn/belt/async.js';
|
|
2
|
-
import { test } from 'uvu';
|
|
3
|
-
import * as assert from 'uvu/assert';
|
|
4
|
-
import { throttle } from './throttle.js';
|
|
5
|
-
test('throttles calls to a function', async () => {
|
|
6
|
-
const results = [];
|
|
7
|
-
const fn = throttle(async (name) => {
|
|
8
|
-
results.push(name + '_run');
|
|
9
|
-
await wait();
|
|
10
|
-
results.push(name + '_done');
|
|
11
|
-
});
|
|
12
|
-
const promise_a = fn('a');
|
|
13
|
-
const promise_b = fn('b'); // discarded
|
|
14
|
-
const promise_c = fn('c'); // discarded
|
|
15
|
-
const promise_d = fn('d');
|
|
16
|
-
assert.ok(promise_a !== promise_b);
|
|
17
|
-
assert.is(promise_b, promise_c);
|
|
18
|
-
assert.is(promise_b, promise_d);
|
|
19
|
-
assert.equal(results, ['a_run']);
|
|
20
|
-
await promise_a;
|
|
21
|
-
assert.equal(results, ['a_run', 'a_done']);
|
|
22
|
-
await promise_b;
|
|
23
|
-
assert.equal(results, ['a_run', 'a_done', 'd_run', 'd_done']);
|
|
24
|
-
const promise_e = fn('e'); // discarded
|
|
25
|
-
const promise_f = fn('f');
|
|
26
|
-
assert.ok(promise_d !== promise_e);
|
|
27
|
-
assert.is(promise_e, promise_f);
|
|
28
|
-
assert.equal(results, ['a_run', 'a_done', 'd_run', 'd_done']); // delayed
|
|
29
|
-
await wait();
|
|
30
|
-
assert.equal(results, ['a_run', 'a_done', 'd_run', 'd_done', 'f_run']);
|
|
31
|
-
await promise_e;
|
|
32
|
-
assert.equal(results, ['a_run', 'a_done', 'd_run', 'd_done', 'f_run', 'f_done']);
|
|
33
|
-
const promise_g = fn('g');
|
|
34
|
-
assert.equal(results, ['a_run', 'a_done', 'd_run', 'd_done', 'f_run', 'f_done']); // delayed
|
|
35
|
-
await wait();
|
|
36
|
-
assert.equal(results, ['a_run', 'a_done', 'd_run', 'd_done', 'f_run', 'f_done', 'g_run']);
|
|
37
|
-
await promise_g;
|
|
38
|
-
assert.equal(results, [
|
|
39
|
-
'a_run',
|
|
40
|
-
'a_done',
|
|
41
|
-
'd_run',
|
|
42
|
-
'd_done',
|
|
43
|
-
'f_run',
|
|
44
|
-
'f_done',
|
|
45
|
-
'g_run',
|
|
46
|
-
'g_done',
|
|
47
|
-
]);
|
|
48
|
-
});
|
|
49
|
-
test.run();
|
package/src/lib/args.test.ts
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import mri from 'mri';
|
|
2
|
-
import {suite} from 'uvu';
|
|
3
|
-
import * as assert from 'uvu/assert';
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
serialize_args,
|
|
7
|
-
to_forwarded_args,
|
|
8
|
-
to_forwarded_args_by_command,
|
|
9
|
-
to_raw_rest_args,
|
|
10
|
-
} from './args.js';
|
|
11
|
-
|
|
12
|
-
/* test__serialize_args */
|
|
13
|
-
const test__serialize_args = suite('serialize_args');
|
|
14
|
-
|
|
15
|
-
test__serialize_args('basic behavior', () => {
|
|
16
|
-
const raw = ['a', '-i', '1', 'b', 'c', '-i', '-i', 'three'];
|
|
17
|
-
const parsed = mri(raw);
|
|
18
|
-
assert.equal(parsed, {_: ['a', 'b', 'c'], i: [1, true, 'three']});
|
|
19
|
-
const serialized = serialize_args(parsed);
|
|
20
|
-
assert.equal(serialized, ['a', 'b', 'c', '-i', '1', '-i', '-i', 'three']); // sorted
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
test__serialize_args.run();
|
|
24
|
-
/* test__serialize_args */
|
|
25
|
-
|
|
26
|
-
/* test__to_forwarded_args_by_command */
|
|
27
|
-
const test__to_forwarded_args_by_command = suite('to_forwarded_args_by_command');
|
|
28
|
-
|
|
29
|
-
test__to_forwarded_args_by_command('basic behavior', () => {
|
|
30
|
-
const raw_rest_args = to_raw_rest_args(
|
|
31
|
-
(
|
|
32
|
-
'gro taskname a b c --d -e 1 -- -- ' +
|
|
33
|
-
'eslint a --b c -- ' +
|
|
34
|
-
'gro a --a -- ' +
|
|
35
|
-
'tsc -b -- ' +
|
|
36
|
-
'gro b -t2 t2a --t2 t2b --t222 2 -- -- -- ' +
|
|
37
|
-
'groc --m --n nn -- ' +
|
|
38
|
-
'gro d -b a --c 4 -- ' +
|
|
39
|
-
'gro d -b a --c 5 -- '
|
|
40
|
-
).split(' '),
|
|
41
|
-
);
|
|
42
|
-
assert.equal(to_forwarded_args_by_command(raw_rest_args), {
|
|
43
|
-
eslint: {_: ['a'], b: 'c'},
|
|
44
|
-
'gro a': {a: true},
|
|
45
|
-
tsc: {b: true},
|
|
46
|
-
'gro b': {'2': 't2a', t: true, t2: 't2b', t222: 2},
|
|
47
|
-
groc: {m: true, n: 'nn'},
|
|
48
|
-
'gro d': {b: 'a', c: 5},
|
|
49
|
-
});
|
|
50
|
-
assert.equal(to_forwarded_args('gro b', raw_rest_args), {
|
|
51
|
-
'2': 't2a',
|
|
52
|
-
t: true,
|
|
53
|
-
t2: 't2b',
|
|
54
|
-
t222: 2,
|
|
55
|
-
});
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
test__to_forwarded_args_by_command.run();
|
|
59
|
-
/* test__to_forwarded_args_by_command */
|
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
import {test} from 'uvu';
|
|
2
|
-
import * as assert from 'uvu/assert';
|
|
3
|
-
import {Logger} from '@ryanatkn/belt/log.js';
|
|
4
|
-
import {readFile, writeFile} from 'node:fs/promises';
|
|
5
|
-
import type {Fetch_Value_Cache} from '@ryanatkn/belt/fetch.js';
|
|
6
|
-
|
|
7
|
-
import {update_changelog} from './changelog.js';
|
|
8
|
-
import {load_from_env} from './env.js';
|
|
9
|
-
|
|
10
|
-
const log = new Logger();
|
|
11
|
-
|
|
12
|
-
const token = load_from_env('GITHUB_TOKEN_SECRET');
|
|
13
|
-
if (!token) {
|
|
14
|
-
log.warn('the env var GITHUB_TOKEN_SECRET was not found, so API calls with be unauthorized');
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const fixture_path = 'src/fixtures/changelog_example.md';
|
|
18
|
-
|
|
19
|
-
// TODO ideally this is just a ts file, but there's a problem where building outputs a `.d.ts` file
|
|
20
|
-
// when importing from src/fixtures (fix in SvelteKit/Vite/tsconfig?) and I want to keep it in src/fixtures
|
|
21
|
-
const changelog_cache_fixture: Fetch_Value_Cache = new Map(
|
|
22
|
-
JSON.parse(await readFile('src/fixtures/changelog_cache.json', 'utf8')),
|
|
23
|
-
);
|
|
24
|
-
|
|
25
|
-
test('update_changelog', async () => {
|
|
26
|
-
const original = await readFile(fixture_path, 'utf8');
|
|
27
|
-
const result = await update_changelog(
|
|
28
|
-
'ryanatkn',
|
|
29
|
-
'gro',
|
|
30
|
-
fixture_path,
|
|
31
|
-
token,
|
|
32
|
-
log,
|
|
33
|
-
changelog_cache_fixture,
|
|
34
|
-
);
|
|
35
|
-
const updated = await readFile(fixture_path, 'utf8');
|
|
36
|
-
await writeFile(fixture_path, original, 'utf8');
|
|
37
|
-
assert.ok(result);
|
|
38
|
-
assert.is(
|
|
39
|
-
updated,
|
|
40
|
-
`# @ryanatkn/gro
|
|
41
|
-
|
|
42
|
-
## 0.6.0
|
|
43
|
-
|
|
44
|
-
### Minor Changes
|
|
45
|
-
|
|
46
|
-
- duplicate 1 ([#429](https://github.com/ryanatkn/gro/pull/429))
|
|
47
|
-
- duplicate 2 ([#429](https://github.com/ryanatkn/gro/pull/429))
|
|
48
|
-
- abc ([#437](https://github.com/ryanatkn/gro/pull/437))
|
|
49
|
-
|
|
50
|
-
- 123
|
|
51
|
-
- 123
|
|
52
|
-
- 123
|
|
53
|
-
|
|
54
|
-
### Patch Changes
|
|
55
|
-
|
|
56
|
-
- abc ([5e94cd4](https://github.com/ryanatkn/gro/commit/5e94cd4))
|
|
57
|
-
|
|
58
|
-
## 0.5.2
|
|
59
|
-
|
|
60
|
-
### Patch Changes
|
|
61
|
-
|
|
62
|
-
- abc ([e345eaa](https://github.com/ryanatkn/gro/commit/e345eaa))
|
|
63
|
-
|
|
64
|
-
## 0.5.1
|
|
65
|
-
|
|
66
|
-
### Patch Changes
|
|
67
|
-
|
|
68
|
-
- abc ([094279d](https://github.com/ryanatkn/gro/commit/094279d))
|
|
69
|
-
|
|
70
|
-
## 0.5.0
|
|
71
|
-
|
|
72
|
-
### Minor Changes
|
|
73
|
-
|
|
74
|
-
- abc ([f6133f7](https://github.com/ryanatkn/gro/commit/f6133f7))
|
|
75
|
-
|
|
76
|
-
## 0.4.3
|
|
77
|
-
|
|
78
|
-
### Patch Changes
|
|
79
|
-
|
|
80
|
-
- abc ([54b65ec](https://github.com/ryanatkn/gro/commit/54b65ec))
|
|
81
|
-
|
|
82
|
-
## 0.4.2
|
|
83
|
-
|
|
84
|
-
### Patch Changes
|
|
85
|
-
|
|
86
|
-
- abc ([80365d0](https://github.com/ryanatkn/gro/commit/80365d0))
|
|
87
|
-
|
|
88
|
-
## 0.4.1
|
|
89
|
-
|
|
90
|
-
### Patch Changes
|
|
91
|
-
|
|
92
|
-
- abc ([3d84dfd](https://github.com/ryanatkn/gro/commit/3d84dfd))
|
|
93
|
-
- abc ([fc64b77](https://github.com/ryanatkn/gro/commit/fc64b77))
|
|
94
|
-
|
|
95
|
-
## 0.4.0
|
|
96
|
-
|
|
97
|
-
### Minor Changes
|
|
98
|
-
|
|
99
|
-
- abc ([#434](https://github.com/ryanatkn/gro/pull/434))
|
|
100
|
-
- 123
|
|
101
|
-
- 123
|
|
102
|
-
|
|
103
|
-
### Patch Changes
|
|
104
|
-
|
|
105
|
-
- abc ([#434](https://github.com/ryanatkn/gro/pull/434))
|
|
106
|
-
|
|
107
|
-
## 0.3.1
|
|
108
|
-
|
|
109
|
-
- e
|
|
110
|
-
|
|
111
|
-
## 0.3.0
|
|
112
|
-
|
|
113
|
-
- b2
|
|
114
|
-
- c2
|
|
115
|
-
- d2
|
|
116
|
-
|
|
117
|
-
## 0.2.0
|
|
118
|
-
|
|
119
|
-
- a2
|
|
120
|
-
|
|
121
|
-
## 0.1.2
|
|
122
|
-
|
|
123
|
-
- e
|
|
124
|
-
|
|
125
|
-
## 0.1.1
|
|
126
|
-
|
|
127
|
-
- b
|
|
128
|
-
- c
|
|
129
|
-
- d
|
|
130
|
-
|
|
131
|
-
## 0.1.0
|
|
132
|
-
|
|
133
|
-
- a
|
|
134
|
-
`,
|
|
135
|
-
);
|
|
136
|
-
});
|
|
137
|
-
|
|
138
|
-
test.run();
|
package/src/lib/config.test.ts
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import {test} from 'uvu';
|
|
2
|
-
import * as assert from 'uvu/assert';
|
|
3
|
-
|
|
4
|
-
import {DEFAULT_SEARCH_EXCLUDER, load_config} from './config.js';
|
|
5
|
-
|
|
6
|
-
test('load_config', async () => {
|
|
7
|
-
const config = await load_config();
|
|
8
|
-
assert.ok(config);
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
test('DEFAULT_SEARCH_EXCLUDER', () => {
|
|
12
|
-
const assert_includes = (path: string, exclude: boolean) => {
|
|
13
|
-
const m = `should ${exclude ? 'exclude' : 'include '}: ${path}`;
|
|
14
|
-
const b = (v: boolean) => (exclude ? !v : v);
|
|
15
|
-
assert.ok(b(DEFAULT_SEARCH_EXCLUDER.test(`a/${path}/c`)), m);
|
|
16
|
-
assert.ok(b(DEFAULT_SEARCH_EXCLUDER.test(`a/${path}/c/d.js`)), m);
|
|
17
|
-
assert.ok(b(DEFAULT_SEARCH_EXCLUDER.test(`a/${path}/c/d.e.js`)), m);
|
|
18
|
-
assert.ok(b(DEFAULT_SEARCH_EXCLUDER.test(`a/${path}/`)), m);
|
|
19
|
-
assert.ok(b(DEFAULT_SEARCH_EXCLUDER.test(`a/${path}`)), m);
|
|
20
|
-
assert.ok(b(DEFAULT_SEARCH_EXCLUDER.test(`/a/${path}/c`)), m);
|
|
21
|
-
assert.ok(b(DEFAULT_SEARCH_EXCLUDER.test(`/a/${path}/c/d.js`)), m);
|
|
22
|
-
assert.ok(b(DEFAULT_SEARCH_EXCLUDER.test(`/a/${path}/c/d.e.js`)), m);
|
|
23
|
-
assert.ok(b(DEFAULT_SEARCH_EXCLUDER.test(`/a/${path}/`)), m);
|
|
24
|
-
assert.ok(b(DEFAULT_SEARCH_EXCLUDER.test(`/a/${path}`)), m);
|
|
25
|
-
assert.ok(b(DEFAULT_SEARCH_EXCLUDER.test(`/${path}/a`)), m);
|
|
26
|
-
assert.ok(b(DEFAULT_SEARCH_EXCLUDER.test(`/${path}/a/b.js`)), m);
|
|
27
|
-
assert.ok(b(DEFAULT_SEARCH_EXCLUDER.test(`/${path}/a/b.e.js`)), m);
|
|
28
|
-
assert.ok(b(DEFAULT_SEARCH_EXCLUDER.test(`/${path}/`)), m);
|
|
29
|
-
assert.ok(b(DEFAULT_SEARCH_EXCLUDER.test(`/${path}`)), m);
|
|
30
|
-
assert.ok(b(DEFAULT_SEARCH_EXCLUDER.test(`./${path}/a`)), m);
|
|
31
|
-
assert.ok(b(DEFAULT_SEARCH_EXCLUDER.test(`./${path}/a/b.js`)), m);
|
|
32
|
-
assert.ok(b(DEFAULT_SEARCH_EXCLUDER.test(`./${path}/a/b.c.js`)), m);
|
|
33
|
-
assert.ok(b(DEFAULT_SEARCH_EXCLUDER.test(`./${path}/`)), m);
|
|
34
|
-
assert.ok(b(DEFAULT_SEARCH_EXCLUDER.test(`./${path}`)), m);
|
|
35
|
-
assert.ok(b(DEFAULT_SEARCH_EXCLUDER.test(`${path}/a`)), m);
|
|
36
|
-
assert.ok(b(DEFAULT_SEARCH_EXCLUDER.test(`${path}/a/b.js`)), m);
|
|
37
|
-
assert.ok(b(DEFAULT_SEARCH_EXCLUDER.test(`${path}/a/b.c.js`)), m);
|
|
38
|
-
assert.ok(b(DEFAULT_SEARCH_EXCLUDER.test(`${path}/`)), m);
|
|
39
|
-
assert.ok(b(DEFAULT_SEARCH_EXCLUDER.test(path)), m);
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
assert_includes('node_modules', false);
|
|
43
|
-
assert_includes('dist', false);
|
|
44
|
-
assert_includes('build', false);
|
|
45
|
-
assert_includes('.git', false);
|
|
46
|
-
assert_includes('.gro', false);
|
|
47
|
-
assert_includes('.svelte-kit', false);
|
|
48
|
-
|
|
49
|
-
assert_includes('a', true);
|
|
50
|
-
assert_includes('nodemodules', true);
|
|
51
|
-
|
|
52
|
-
// Special exception for `gro/dist/`, but not `gro/build/` etc because they're not usecases.
|
|
53
|
-
assert_includes('gro/build', false);
|
|
54
|
-
assert_includes('gro/buildE', true);
|
|
55
|
-
assert_includes('groE/build', false);
|
|
56
|
-
assert_includes('gro/dist', true);
|
|
57
|
-
assert_includes('node_modules/gro/dist', true);
|
|
58
|
-
assert_includes('node_modules/@someuser/gro/dist', true);
|
|
59
|
-
assert_includes('node_modules/@someuser/foo/gro/dist', false);
|
|
60
|
-
assert_includes('gro/distE', true);
|
|
61
|
-
assert_includes('groE/dist', false);
|
|
62
|
-
assert_includes('Egro/dist', false);
|
|
63
|
-
assert_includes('Ebuild', true);
|
|
64
|
-
assert_includes('buildE', true);
|
|
65
|
-
assert_includes('grobuild', true);
|
|
66
|
-
assert_includes('distE', true);
|
|
67
|
-
assert_includes('Edist', true);
|
|
68
|
-
assert_includes('grodist', true);
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
test.run();
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import {test} from 'uvu';
|
|
2
|
-
import * as assert from 'uvu/assert';
|
|
3
|
-
import * as esbuild from 'esbuild';
|
|
4
|
-
import {readFile, rm} from 'node:fs/promises';
|
|
5
|
-
|
|
6
|
-
import {esbuild_plugin_svelte} from './esbuild_plugin_svelte.js';
|
|
7
|
-
|
|
8
|
-
test('build for the client', async () => {
|
|
9
|
-
const outfile = './src/fixtures/modules/some_test_server_bundle_DELETEME.js';
|
|
10
|
-
const built = await esbuild.build({
|
|
11
|
-
entryPoints: ['./src/fixtures/modules/some_test_server.ts'],
|
|
12
|
-
plugins: [esbuild_plugin_svelte()],
|
|
13
|
-
outfile,
|
|
14
|
-
format: 'esm',
|
|
15
|
-
platform: 'node',
|
|
16
|
-
packages: 'external',
|
|
17
|
-
bundle: true,
|
|
18
|
-
target: 'esnext',
|
|
19
|
-
});
|
|
20
|
-
assert.is(built.errors.length, 0);
|
|
21
|
-
assert.is(built.warnings.length, 0);
|
|
22
|
-
|
|
23
|
-
const built_output = await readFile(outfile, 'utf8');
|
|
24
|
-
assert.is(
|
|
25
|
-
built_output,
|
|
26
|
-
`// src/fixtures/modules/some_test_svelte_ts.svelte.ts
|
|
27
|
-
import * as $ from "svelte/internal/client";
|
|
28
|
-
var Some_Test_Svelte_Ts = class {
|
|
29
|
-
#a = $.source("ok");
|
|
30
|
-
get a() {
|
|
31
|
-
return $.get(this.#a);
|
|
32
|
-
}
|
|
33
|
-
set a(value) {
|
|
34
|
-
$.set(this.#a, $.proxy(value));
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
// src/fixtures/modules/some_test_server.ts
|
|
39
|
-
var some_test_server = "some_test_server";
|
|
40
|
-
var Rexported_Some_Test_Svelte_Ts = Some_Test_Svelte_Ts;
|
|
41
|
-
export {
|
|
42
|
-
Rexported_Some_Test_Svelte_Ts,
|
|
43
|
-
some_test_server
|
|
44
|
-
};
|
|
45
|
-
`,
|
|
46
|
-
);
|
|
47
|
-
|
|
48
|
-
await rm(outfile); // TODO could be cleaner
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
test('build for the server', async () => {
|
|
52
|
-
const outfile = './src/fixtures/modules/some_test_client_bundle_DELETEME.js';
|
|
53
|
-
const built = await esbuild.build({
|
|
54
|
-
entryPoints: ['./src/fixtures/modules/some_test_server.ts'],
|
|
55
|
-
plugins: [esbuild_plugin_svelte({svelte_compile_module_options: {generate: 'server'}})],
|
|
56
|
-
outfile,
|
|
57
|
-
format: 'esm',
|
|
58
|
-
platform: 'node',
|
|
59
|
-
packages: 'external',
|
|
60
|
-
bundle: true,
|
|
61
|
-
target: 'esnext',
|
|
62
|
-
});
|
|
63
|
-
assert.is(built.errors.length, 0);
|
|
64
|
-
assert.is(built.warnings.length, 0);
|
|
65
|
-
|
|
66
|
-
const built_output = await readFile(outfile, 'utf8');
|
|
67
|
-
assert.is(
|
|
68
|
-
built_output,
|
|
69
|
-
`// src/fixtures/modules/some_test_svelte_ts.svelte.ts
|
|
70
|
-
import * as $ from "svelte/internal/server";
|
|
71
|
-
var Some_Test_Svelte_Ts = class {
|
|
72
|
-
a = "ok";
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
// src/fixtures/modules/some_test_server.ts
|
|
76
|
-
var some_test_server = "some_test_server";
|
|
77
|
-
var Rexported_Some_Test_Svelte_Ts = Some_Test_Svelte_Ts;
|
|
78
|
-
export {
|
|
79
|
-
Rexported_Some_Test_Svelte_Ts,
|
|
80
|
-
some_test_server
|
|
81
|
-
};
|
|
82
|
-
`,
|
|
83
|
-
);
|
|
84
|
-
|
|
85
|
-
await rm(outfile); // TODO could be cleaner
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
test.run();
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import {test} from 'uvu';
|
|
2
|
-
import * as assert from 'uvu/assert';
|
|
3
|
-
|
|
4
|
-
import {format_file} from './format_file.js';
|
|
5
|
-
|
|
6
|
-
test('format ts', async () => {
|
|
7
|
-
const ts_unformatted = 'hey (1)';
|
|
8
|
-
const ts_formatted = 'hey(1);\n';
|
|
9
|
-
assert.is(await format_file(ts_unformatted, {filepath: 'foo.ts'}), ts_formatted);
|
|
10
|
-
assert.is(await format_file(ts_unformatted, {parser: 'typescript'}), ts_formatted);
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
test('format svelte', async () => {
|
|
14
|
-
const svelte_unformatted = '<style>a{color: red}</style>';
|
|
15
|
-
const svelte_formatted = '<style>\n\ta {\n\t\tcolor: red;\n\t}\n</style>\n';
|
|
16
|
-
assert.is(await format_file(svelte_unformatted, {filepath: 'foo.svelte'}), svelte_formatted);
|
|
17
|
-
assert.is(await format_file(svelte_unformatted, {parser: 'svelte'}), svelte_formatted);
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
test.run();
|