lyrics-structure 1.0.0
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/README.md +35 -0
- package/index.ts +147 -0
- package/package.json +20 -0
- package/test.ts +173 -0
- package/tsconfig.json +113 -0
package/README.md
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Lyrics Structure
|
|
2
|
+
|
|
3
|
+
A utility library for structuring and formatting song lyrics and text content.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- Split text into natural sections based on structure
|
|
8
|
+
- Process bracketed content while maintaining structure
|
|
9
|
+
- Intelligent text segmentation for readability
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import { getParts, getSlideParts } from 'lyrics-structure';
|
|
15
|
+
|
|
16
|
+
// Split text into parts based on bracketed content
|
|
17
|
+
const parts = getParts(text);
|
|
18
|
+
|
|
19
|
+
// Split text into natural sections for presentation
|
|
20
|
+
const slideParts = getSlideParts(text, maxLinesPerSlide);
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Implementation
|
|
24
|
+
|
|
25
|
+
This library is used in the Stage app ([stage.loha.dev](https://stage.loha.dev)) for lyrics display and presentation.
|
|
26
|
+
|
|
27
|
+
## Installation
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
npm install lyrics-structure
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## License
|
|
34
|
+
|
|
35
|
+
ISC
|
package/index.ts
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Splits text into parts based on bracketed content while maintaining its structure.
|
|
3
|
+
* Does not consider line length or formatting.
|
|
4
|
+
*
|
|
5
|
+
* @param text - The input text to be split into parts
|
|
6
|
+
* @returns An array of content strings
|
|
7
|
+
*/
|
|
8
|
+
export const getParts = (text?: string): string[] => {
|
|
9
|
+
if (!text) return [];
|
|
10
|
+
|
|
11
|
+
// Process parts in brackets and create a map
|
|
12
|
+
const partsMap = new Map<string, string>();
|
|
13
|
+
|
|
14
|
+
// First pass: extract all content with closing tags
|
|
15
|
+
const cleanedText = text.replace(
|
|
16
|
+
/\[(.*?)\]([\s\S]*?)\[\/\1\]/g,
|
|
17
|
+
(match, key, content) => {
|
|
18
|
+
if (!partsMap.has(key)) {
|
|
19
|
+
partsMap.set(key, content.trim());
|
|
20
|
+
}
|
|
21
|
+
return `[${key}]`;
|
|
22
|
+
},
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
// Second pass: handle validation and solo tags that should reuse content
|
|
26
|
+
const processedText = cleanedText.replace(
|
|
27
|
+
/\[([^\]]+)\](?!\s*\[\/)(?!\s*\])/g, // Match tags that don't have a closing tag after them
|
|
28
|
+
(match, key) => {
|
|
29
|
+
if (partsMap.has(key)) {
|
|
30
|
+
return match; // Keep the reference if we already have content for this key
|
|
31
|
+
} else {
|
|
32
|
+
console.warn(`Warning: Tag [${key}] has no content and was not previously defined`);
|
|
33
|
+
return ''; // Remove invalid tags
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
const result: string[] = [];
|
|
39
|
+
const parts = processedText
|
|
40
|
+
.trim()
|
|
41
|
+
.split(/\[([^\]]+)\]/)
|
|
42
|
+
.filter(Boolean);
|
|
43
|
+
|
|
44
|
+
parts.forEach((part) => {
|
|
45
|
+
if (partsMap.has(part)) {
|
|
46
|
+
// Add the stored part content
|
|
47
|
+
result.push(partsMap.get(part)!);
|
|
48
|
+
} else if (part.trim()) {
|
|
49
|
+
// Add non-bracketed content
|
|
50
|
+
result.push(part.trim());
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
return result;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Splits text into natural sections based on text structure.
|
|
59
|
+
* Works with plain text without requiring markdown or special formatting.
|
|
60
|
+
*
|
|
61
|
+
* @param text - The input text to be split into sections
|
|
62
|
+
* @param maxLinesPerSlide - Maximum number of lines to include in a single slide (default: 6)
|
|
63
|
+
* @returns An array of content sections
|
|
64
|
+
*/
|
|
65
|
+
export const getSlideParts = (text?: string, maxLinesPerSlide: number = 6): string[] => {
|
|
66
|
+
if (!text) return [];
|
|
67
|
+
|
|
68
|
+
// Extract bracketed content first
|
|
69
|
+
const basicParts = getParts(text);
|
|
70
|
+
const result: string[] = [];
|
|
71
|
+
|
|
72
|
+
basicParts.forEach(part => {
|
|
73
|
+
// Check if content has line breaks that should be respected
|
|
74
|
+
const lines = part.split('\n').filter(line => line.trim().length > 0);
|
|
75
|
+
|
|
76
|
+
// If we have multiple lines and more than maxLinesPerSlide, create slides based on line count
|
|
77
|
+
if (lines.length > 1) {
|
|
78
|
+
if (lines.length > maxLinesPerSlide) {
|
|
79
|
+
// Break into multiple slides based on maxLinesPerSlide
|
|
80
|
+
let currentSlide: string[] = [];
|
|
81
|
+
|
|
82
|
+
lines.forEach(line => {
|
|
83
|
+
if (currentSlide.length >= maxLinesPerSlide) {
|
|
84
|
+
result.push(currentSlide.join('\n'));
|
|
85
|
+
currentSlide = [];
|
|
86
|
+
}
|
|
87
|
+
currentSlide.push(line);
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
// Add the final slide if it exists
|
|
91
|
+
if (currentSlide.length > 0) {
|
|
92
|
+
result.push(currentSlide.join('\n'));
|
|
93
|
+
}
|
|
94
|
+
} else {
|
|
95
|
+
// Split by natural paragraph breaks (empty lines)
|
|
96
|
+
const paragraphs = part.split(/\n\s*\n/)
|
|
97
|
+
.filter(p => p.trim().length > 0)
|
|
98
|
+
.map(p => p.trim());
|
|
99
|
+
|
|
100
|
+
// If we have multiple paragraphs, use those as natural breaks
|
|
101
|
+
if (paragraphs.length > 1) {
|
|
102
|
+
result.push(...paragraphs);
|
|
103
|
+
} else {
|
|
104
|
+
// Just use the whole part as a single slide
|
|
105
|
+
result.push(part);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
} else {
|
|
109
|
+
// For single large paragraphs (no line breaks), try to find natural sentence groups
|
|
110
|
+
const sentences = part.split(/(?<=[.!?])\s+/)
|
|
111
|
+
.filter(s => s.trim().length > 0);
|
|
112
|
+
|
|
113
|
+
// Group sentences into reasonable chunks
|
|
114
|
+
const sentenceGroups: string[] = [];
|
|
115
|
+
let currentGroup: string[] = [];
|
|
116
|
+
let currentLength = 0;
|
|
117
|
+
|
|
118
|
+
sentences.forEach(sentence => {
|
|
119
|
+
// Natural breakpoint based on content and length
|
|
120
|
+
// Group 3-5 sentences together or until we reach ~300 chars
|
|
121
|
+
if (currentGroup.length >= 4 || currentLength > 250) {
|
|
122
|
+
sentenceGroups.push(currentGroup.join(' '));
|
|
123
|
+
currentGroup = [];
|
|
124
|
+
currentLength = 0;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
currentGroup.push(sentence);
|
|
128
|
+
currentLength += sentence.length;
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
// Add the last group if it exists
|
|
132
|
+
if (currentGroup.length > 0) {
|
|
133
|
+
sentenceGroups.push(currentGroup.join(' '));
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// If we created multiple groups, use them
|
|
137
|
+
if (sentenceGroups.length > 1) {
|
|
138
|
+
result.push(...sentenceGroups);
|
|
139
|
+
} else {
|
|
140
|
+
// Otherwise just use the whole part
|
|
141
|
+
result.push(part);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
return result;
|
|
147
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "lyrics-structure",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"main": "index.js",
|
|
5
|
+
"types": "dist/index.d.ts",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"test": "npx ts-node test.ts",
|
|
8
|
+
"build": "tsc"
|
|
9
|
+
},
|
|
10
|
+
"keywords": [],
|
|
11
|
+
"author": "",
|
|
12
|
+
"license": "ISC",
|
|
13
|
+
"type": "commonjs",
|
|
14
|
+
"description": "",
|
|
15
|
+
"devDependencies": {
|
|
16
|
+
"@types/node": "^22.13.10",
|
|
17
|
+
"ts-node": "^10.9.2",
|
|
18
|
+
"typescript": "^5.8.2"
|
|
19
|
+
}
|
|
20
|
+
}
|
package/test.ts
ADDED
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import * as assert from 'assert';
|
|
2
|
+
import { getParts, getSlideParts } from './index';
|
|
3
|
+
|
|
4
|
+
// Test data
|
|
5
|
+
const lyricsSample = `
|
|
6
|
+
[verse1]
|
|
7
|
+
I still hear your voice when you sleep next to me
|
|
8
|
+
I still feel your touch in my dreams
|
|
9
|
+
Forgive me my weakness, but I don't know why
|
|
10
|
+
Without you it's hard to survive
|
|
11
|
+
[/verse1]
|
|
12
|
+
|
|
13
|
+
[chorus]
|
|
14
|
+
'Cause every time we touch, I get this feeling
|
|
15
|
+
And every time we kiss, I swear I could fly
|
|
16
|
+
Can't you feel my heart beat fast?
|
|
17
|
+
I want this to last
|
|
18
|
+
Need you by my side
|
|
19
|
+
[/chorus]
|
|
20
|
+
|
|
21
|
+
[verse2]
|
|
22
|
+
Your arms are my castle, your heart is my sky
|
|
23
|
+
They wipe away tears that I cry
|
|
24
|
+
The good and the bad times, we've been through them all
|
|
25
|
+
You make me rise when I fall
|
|
26
|
+
[/verse2]
|
|
27
|
+
|
|
28
|
+
[chorus]
|
|
29
|
+
`;
|
|
30
|
+
|
|
31
|
+
const bibleSample = `
|
|
32
|
+
In the beginning God created the heavens and the earth. Now the earth was formless and empty, darkness was over the surface of the deep, and the Spirit of God was hovering over the waters.
|
|
33
|
+
|
|
34
|
+
And God said, "Let there be light," and there was light. God saw that the light was good, and he separated the light from the darkness. God called the light "day," and the darkness he called "night." And there was evening, and there was morning—the first day.
|
|
35
|
+
|
|
36
|
+
[psalm23]
|
|
37
|
+
The LORD is my shepherd, I lack nothing.
|
|
38
|
+
He makes me lie down in green pastures,
|
|
39
|
+
he leads me beside quiet waters,
|
|
40
|
+
he refreshes my soul.
|
|
41
|
+
[/psalm23]
|
|
42
|
+
|
|
43
|
+
five
|
|
44
|
+
short
|
|
45
|
+
lines
|
|
46
|
+
should
|
|
47
|
+
be one slide
|
|
48
|
+
|
|
49
|
+
very long line that should be split into two lines but has been sent on one line intead
|
|
50
|
+
`;
|
|
51
|
+
|
|
52
|
+
console.log('Running tests for text processing functions...');
|
|
53
|
+
|
|
54
|
+
// Test getParts with lyrics
|
|
55
|
+
console.log('\n----- Testing getParts with lyrics -----');
|
|
56
|
+
const lyricsParts = getParts(lyricsSample);
|
|
57
|
+
console.log(`Found ${lyricsParts.length} parts`);
|
|
58
|
+
lyricsParts.forEach((part, i) => {
|
|
59
|
+
console.log(`\nPart ${i + 1}:`);
|
|
60
|
+
console.log(part);
|
|
61
|
+
});
|
|
62
|
+
assert.strictEqual(lyricsParts.length, 4, 'Should extract 4 parts from lyrics (verse1, chorus, verse2, repeated chorus)');
|
|
63
|
+
|
|
64
|
+
// Test that the repeated chorus matches the original chorus
|
|
65
|
+
const chorusContent = lyricsParts[1]; // First chorus (index 1)
|
|
66
|
+
const repeatedChorus = lyricsParts[3]; // Last part (index 3) should be repeated chorus
|
|
67
|
+
console.log('\nVerifying repeated chorus:');
|
|
68
|
+
console.log(`Original chorus: "${chorusContent.substring(0, 20)}..."`);
|
|
69
|
+
console.log(`Repeated chorus: "${repeatedChorus.substring(0, 20)}..."`);
|
|
70
|
+
assert.strictEqual(repeatedChorus, chorusContent, 'Repeated chorus should match the original chorus content');
|
|
71
|
+
|
|
72
|
+
// Test getParts with Bible verses
|
|
73
|
+
console.log('\n----- Testing getParts with Bible verses -----');
|
|
74
|
+
const bibleParts = getParts(bibleSample);
|
|
75
|
+
console.log(`Found ${bibleParts.length} parts`);
|
|
76
|
+
bibleParts.forEach((part, i) => {
|
|
77
|
+
console.log(`\nPart ${i + 1}:`);
|
|
78
|
+
console.log(part);
|
|
79
|
+
});
|
|
80
|
+
assert.strictEqual(bibleParts.length, 3, 'Should extract 3 parts from Bible verses (main text, psalm23, and the "five short lines" section)');
|
|
81
|
+
|
|
82
|
+
// Test getSlideParts with lyrics
|
|
83
|
+
console.log('\n----- Testing getSlideParts with lyrics -----');
|
|
84
|
+
const lyricsSlides = getSlideParts(lyricsSample);
|
|
85
|
+
console.log(`Found ${lyricsSlides.length} slides`);
|
|
86
|
+
lyricsSlides.forEach((slide, i) => {
|
|
87
|
+
console.log(`\nSlide ${i + 1}:`);
|
|
88
|
+
console.log(slide);
|
|
89
|
+
});
|
|
90
|
+
// This should now include the repeated chorus
|
|
91
|
+
assert.strictEqual(lyricsSlides.length, 4, 'Should have 4 slides including the repeated chorus');
|
|
92
|
+
|
|
93
|
+
// Test getSlideParts with Bible verses (default maxLinesPerSlide: 6)
|
|
94
|
+
console.log('\n----- Testing getSlideParts with Bible verses (default maxLinesPerSlide) -----');
|
|
95
|
+
const bibleSlides = getSlideParts(bibleSample);
|
|
96
|
+
console.log(`Found ${bibleSlides.length} slides`);
|
|
97
|
+
bibleSlides.forEach((slide, i) => {
|
|
98
|
+
console.log(`\nSlide ${i + 1} (${slide.length} characters):`);
|
|
99
|
+
console.log('-'.repeat(40));
|
|
100
|
+
console.log(slide);
|
|
101
|
+
console.log('-'.repeat(40));
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
// Test getSlideParts with Bible verses and custom maxLinesPerSlide = 2
|
|
105
|
+
console.log('\n----- Testing getSlideParts with Bible verses (maxLinesPerSlide: 2) -----');
|
|
106
|
+
const bibleSlidesTighter = getSlideParts(bibleSample, 2);
|
|
107
|
+
console.log(`Found ${bibleSlidesTighter.length} slides (with maxLinesPerSlide: 2)`);
|
|
108
|
+
bibleSlidesTighter.forEach((slide, i) => {
|
|
109
|
+
console.log(`\nSlide ${i + 1} (${slide.length} characters):`);
|
|
110
|
+
console.log('-'.repeat(40));
|
|
111
|
+
console.log(slide);
|
|
112
|
+
console.log('-'.repeat(40));
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
// Test handling of long lines that need to be split
|
|
116
|
+
console.log('\n----- Testing getSlideParts with long lines -----');
|
|
117
|
+
const longLineText = `
|
|
118
|
+
This is a normal line.
|
|
119
|
+
This is another normal line.
|
|
120
|
+
very long line that should be split into two lines but has been sent on one line instead and should be handled properly by the getSlideParts function for better readability
|
|
121
|
+
Last normal line.
|
|
122
|
+
`;
|
|
123
|
+
|
|
124
|
+
const longLineSlides = getSlideParts(longLineText);
|
|
125
|
+
console.log(`Found ${longLineSlides.length} slides for long line text`);
|
|
126
|
+
longLineSlides.forEach((slide, i) => {
|
|
127
|
+
console.log(`\nSlide ${i + 1}:`);
|
|
128
|
+
console.log('-'.repeat(40));
|
|
129
|
+
console.log(slide);
|
|
130
|
+
console.log('-'.repeat(40));
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
// Test edge cases
|
|
134
|
+
console.log('\n----- Testing edge cases -----');
|
|
135
|
+
|
|
136
|
+
// Empty string
|
|
137
|
+
const emptyResult = getSlideParts('');
|
|
138
|
+
console.log(`Empty string produced ${emptyResult.length} slides`);
|
|
139
|
+
assert.strictEqual(emptyResult.length, 0, 'Empty string should produce 0 slides');
|
|
140
|
+
|
|
141
|
+
// Single line
|
|
142
|
+
const singleLineResult = getSlideParts('Just one line');
|
|
143
|
+
console.log(`Single line produced ${singleLineResult.length} slides`);
|
|
144
|
+
console.log(singleLineResult[0]);
|
|
145
|
+
assert.strictEqual(singleLineResult.length, 1, 'Single line should produce 1 slide');
|
|
146
|
+
assert.strictEqual(singleLineResult[0], 'Just one line', 'Content should match input');
|
|
147
|
+
|
|
148
|
+
// Nested tags
|
|
149
|
+
const nestedTagsText = `
|
|
150
|
+
[outer]
|
|
151
|
+
Some text
|
|
152
|
+
[inner]
|
|
153
|
+
Nested content
|
|
154
|
+
[/inner]
|
|
155
|
+
More outer text
|
|
156
|
+
[/outer]
|
|
157
|
+
`;
|
|
158
|
+
|
|
159
|
+
const nestedParts = getParts(nestedTagsText);
|
|
160
|
+
console.log('\nNested tags test:');
|
|
161
|
+
console.log(`Found ${nestedParts.length} parts`);
|
|
162
|
+
nestedParts.forEach((part, i) => {
|
|
163
|
+
console.log(`Part ${i + 1}: ${part}`);
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
// Test with maxLinesPerSlide = 1 (extreme case)
|
|
167
|
+
console.log('\n----- Testing with maxLinesPerSlide = 1 -----');
|
|
168
|
+
const extremeSlides = getSlideParts(bibleSample, 1);
|
|
169
|
+
console.log(`Found ${extremeSlides.length} slides with maxLinesPerSlide = 1`);
|
|
170
|
+
assert.ok(extremeSlides.length > bibleSlides.length, 'Setting maxLinesPerSlide = 1 should produce more slides');
|
|
171
|
+
|
|
172
|
+
console.log('\nAll tests completed successfully!');
|
|
173
|
+
console.log('\nAll additional tests completed successfully!');
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
/* Visit https://aka.ms/tsconfig to read more about this file */
|
|
4
|
+
|
|
5
|
+
/* Projects */
|
|
6
|
+
// "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
|
|
7
|
+
// "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
|
|
8
|
+
// "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
|
|
9
|
+
// "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
|
|
10
|
+
// "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
|
|
11
|
+
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
|
|
12
|
+
|
|
13
|
+
/* Language and Environment */
|
|
14
|
+
"target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
|
|
15
|
+
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
|
|
16
|
+
// "jsx": "preserve", /* Specify what JSX code is generated. */
|
|
17
|
+
// "libReplacement": true, /* Enable lib replacement. */
|
|
18
|
+
// "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */
|
|
19
|
+
// "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
|
|
20
|
+
// "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
|
|
21
|
+
// "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
|
|
22
|
+
// "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */
|
|
23
|
+
// "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */
|
|
24
|
+
// "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
|
|
25
|
+
// "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
|
|
26
|
+
// "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
|
|
27
|
+
|
|
28
|
+
/* Modules */
|
|
29
|
+
"module": "commonjs", /* Specify what module code is generated. */
|
|
30
|
+
// "rootDir": "./", /* Specify the root folder within your source files. */
|
|
31
|
+
// "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */
|
|
32
|
+
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
|
|
33
|
+
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
|
|
34
|
+
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
|
|
35
|
+
// "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
|
|
36
|
+
// "types": [], /* Specify type package names to be included without being referenced in a source file. */
|
|
37
|
+
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
|
38
|
+
// "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
|
|
39
|
+
// "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */
|
|
40
|
+
// "rewriteRelativeImportExtensions": true, /* Rewrite '.ts', '.tsx', '.mts', and '.cts' file extensions in relative import paths to their JavaScript equivalent in output files. */
|
|
41
|
+
// "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */
|
|
42
|
+
// "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */
|
|
43
|
+
// "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */
|
|
44
|
+
// "noUncheckedSideEffectImports": true, /* Check side effect imports. */
|
|
45
|
+
// "resolveJsonModule": true, /* Enable importing .json files. */
|
|
46
|
+
// "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */
|
|
47
|
+
// "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
|
|
48
|
+
|
|
49
|
+
/* JavaScript Support */
|
|
50
|
+
// "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
|
|
51
|
+
// "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
|
|
52
|
+
// "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
|
|
53
|
+
|
|
54
|
+
/* Emit */
|
|
55
|
+
"declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
|
|
56
|
+
// "declarationMap": true, /* Create sourcemaps for d.ts files. */
|
|
57
|
+
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
|
|
58
|
+
// "sourceMap": true, /* Create source map files for emitted JavaScript files. */
|
|
59
|
+
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
|
|
60
|
+
// "noEmit": true, /* Disable emitting files from a compilation. */
|
|
61
|
+
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
|
|
62
|
+
"outDir": "./dist", /* Specify an output folder for all emitted files. */
|
|
63
|
+
// "removeComments": true, /* Disable emitting comments. */
|
|
64
|
+
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
|
|
65
|
+
// "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
|
|
66
|
+
// "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
|
|
67
|
+
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
|
|
68
|
+
// "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
|
|
69
|
+
// "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
|
|
70
|
+
// "newLine": "crlf", /* Set the newline character for emitting files. */
|
|
71
|
+
// "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
|
|
72
|
+
// "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
|
|
73
|
+
// "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
|
|
74
|
+
// "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
|
|
75
|
+
// "declarationDir": "./", /* Specify the output directory for generated declaration files. */
|
|
76
|
+
|
|
77
|
+
/* Interop Constraints */
|
|
78
|
+
// "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
|
|
79
|
+
// "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */
|
|
80
|
+
// "isolatedDeclarations": true, /* Require sufficient annotation on exports so other tools can trivially generate declaration files. */
|
|
81
|
+
// "erasableSyntaxOnly": true, /* Do not allow runtime constructs that are not part of ECMAScript. */
|
|
82
|
+
// "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
|
|
83
|
+
"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
|
|
84
|
+
// "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
|
|
85
|
+
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
|
|
86
|
+
|
|
87
|
+
/* Type Checking */
|
|
88
|
+
"strict": true, /* Enable all strict type-checking options. */
|
|
89
|
+
// "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
|
|
90
|
+
// "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
|
|
91
|
+
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
|
|
92
|
+
// "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
|
|
93
|
+
// "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
|
|
94
|
+
// "strictBuiltinIteratorReturn": true, /* Built-in iterators are instantiated with a 'TReturn' type of 'undefined' instead of 'any'. */
|
|
95
|
+
// "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
|
|
96
|
+
// "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
|
|
97
|
+
// "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
|
|
98
|
+
// "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
|
|
99
|
+
// "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
|
|
100
|
+
// "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
|
|
101
|
+
// "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
|
|
102
|
+
// "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
|
|
103
|
+
// "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
|
|
104
|
+
// "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
|
|
105
|
+
// "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
|
|
106
|
+
// "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
|
|
107
|
+
// "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
|
|
108
|
+
|
|
109
|
+
/* Completeness */
|
|
110
|
+
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
|
|
111
|
+
"skipLibCheck": true /* Skip type checking all .d.ts files. */
|
|
112
|
+
}
|
|
113
|
+
}
|