@ryanatkn/gro 0.129.7 → 0.129.9
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 +3 -2
- package/src/lib/package.ts +3 -3
- 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/package.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// generated by src/lib/package.gen.ts
|
|
2
2
|
export const package_json = {
|
|
3
3
|
name: '@ryanatkn/gro',
|
|
4
|
-
version: '0.129.
|
|
4
|
+
version: '0.129.9',
|
|
5
5
|
description: 'task runner and toolkit extending SvelteKit',
|
|
6
6
|
motto: 'generate, run, optimize',
|
|
7
7
|
glyph: '🌰',
|
|
@@ -82,7 +82,7 @@ export const package_json = {
|
|
|
82
82
|
overrides: [{ files: 'package.json', options: { useTabs: false } }],
|
|
83
83
|
},
|
|
84
84
|
sideEffects: ['**/*.css'],
|
|
85
|
-
files: ['dist', 'src/lib'],
|
|
85
|
+
files: ['dist', 'src/lib/**/*.ts', '!src/lib/**/*.test.*'],
|
|
86
86
|
exports: {
|
|
87
87
|
'.': { types: './dist/index.d.ts', default: './dist/index.js' },
|
|
88
88
|
'./package.json': './package.json',
|
|
@@ -266,7 +266,7 @@ export const package_json = {
|
|
|
266
266
|
};
|
|
267
267
|
export const src_json = {
|
|
268
268
|
name: '@ryanatkn/gro',
|
|
269
|
-
version: '0.129.
|
|
269
|
+
version: '0.129.9',
|
|
270
270
|
modules: {
|
|
271
271
|
'.': {
|
|
272
272
|
path: 'index.ts',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ryanatkn/gro",
|
|
3
|
-
"version": "0.129.
|
|
3
|
+
"version": "0.129.9",
|
|
4
4
|
"description": "task runner and toolkit extending SvelteKit",
|
|
5
5
|
"motto": "generate, run, optimize",
|
|
6
6
|
"glyph": "🌰",
|
|
@@ -108,7 +108,8 @@
|
|
|
108
108
|
],
|
|
109
109
|
"files": [
|
|
110
110
|
"dist",
|
|
111
|
-
"src/lib"
|
|
111
|
+
"src/lib/**/*.ts",
|
|
112
|
+
"!src/lib/**/*.test.*"
|
|
112
113
|
],
|
|
113
114
|
"exports": {
|
|
114
115
|
".": {
|
package/src/lib/package.ts
CHANGED
|
@@ -5,7 +5,7 @@ import type {Src_Json} from './src_json.js';
|
|
|
5
5
|
|
|
6
6
|
export const package_json = {
|
|
7
7
|
name: '@ryanatkn/gro',
|
|
8
|
-
version: '0.129.
|
|
8
|
+
version: '0.129.9',
|
|
9
9
|
description: 'task runner and toolkit extending SvelteKit',
|
|
10
10
|
motto: 'generate, run, optimize',
|
|
11
11
|
glyph: '🌰',
|
|
@@ -87,7 +87,7 @@ export const package_json = {
|
|
|
87
87
|
overrides: [{files: 'package.json', options: {useTabs: false}}],
|
|
88
88
|
},
|
|
89
89
|
sideEffects: ['**/*.css'],
|
|
90
|
-
files: ['dist', 'src/lib'],
|
|
90
|
+
files: ['dist', 'src/lib/**/*.ts', '!src/lib/**/*.test.*'],
|
|
91
91
|
exports: {
|
|
92
92
|
'.': {types: './dist/index.d.ts', default: './dist/index.js'},
|
|
93
93
|
'./package.json': './package.json',
|
|
@@ -272,7 +272,7 @@ export const package_json = {
|
|
|
272
272
|
|
|
273
273
|
export const src_json = {
|
|
274
274
|
name: '@ryanatkn/gro',
|
|
275
|
-
version: '0.129.
|
|
275
|
+
version: '0.129.9',
|
|
276
276
|
modules: {
|
|
277
277
|
'.': {
|
|
278
278
|
path: 'index.ts',
|
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();
|