@beatbax/engine 0.1.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/dist/.tsbuildinfo +1 -0
- package/dist/audio/bufferedRenderer.d.ts +32 -0
- package/dist/audio/bufferedRenderer.d.ts.map +1 -0
- package/dist/audio/bufferedRenderer.js +309 -0
- package/dist/audio/bufferedRenderer.js.map +1 -0
- package/dist/audio/pcmRenderer.d.ts +25 -0
- package/dist/audio/pcmRenderer.d.ts.map +1 -0
- package/dist/audio/pcmRenderer.js +1288 -0
- package/dist/audio/pcmRenderer.js.map +1 -0
- package/dist/audio/playback.d.ts +57 -0
- package/dist/audio/playback.d.ts.map +1 -0
- package/dist/audio/playback.js +794 -0
- package/dist/audio/playback.js.map +1 -0
- package/dist/chips/gameboy/apu.d.ts +9 -0
- package/dist/chips/gameboy/apu.d.ts.map +1 -0
- package/dist/chips/gameboy/apu.js +27 -0
- package/dist/chips/gameboy/apu.js.map +1 -0
- package/dist/chips/gameboy/noise.d.ts +6 -0
- package/dist/chips/gameboy/noise.d.ts.map +1 -0
- package/dist/chips/gameboy/noise.js +155 -0
- package/dist/chips/gameboy/noise.js.map +1 -0
- package/dist/chips/gameboy/packet.d.ts +3 -0
- package/dist/chips/gameboy/packet.d.ts.map +1 -0
- package/dist/chips/gameboy/packet.js +3 -0
- package/dist/chips/gameboy/packet.js.map +1 -0
- package/dist/chips/gameboy/periodTables.d.ts +16 -0
- package/dist/chips/gameboy/periodTables.d.ts.map +1 -0
- package/dist/chips/gameboy/periodTables.js +29 -0
- package/dist/chips/gameboy/periodTables.js.map +1 -0
- package/dist/chips/gameboy/pulse.d.ts +12 -0
- package/dist/chips/gameboy/pulse.d.ts.map +1 -0
- package/dist/chips/gameboy/pulse.js +275 -0
- package/dist/chips/gameboy/pulse.js.map +1 -0
- package/dist/chips/gameboy/wave.d.ts +8 -0
- package/dist/chips/gameboy/wave.d.ts.map +1 -0
- package/dist/chips/gameboy/wave.js +146 -0
- package/dist/chips/gameboy/wave.js.map +1 -0
- package/dist/effects/index.d.ts +7 -0
- package/dist/effects/index.d.ts.map +1 -0
- package/dist/effects/index.js +1028 -0
- package/dist/effects/index.js.map +1 -0
- package/dist/effects/types.d.ts +8 -0
- package/dist/effects/types.d.ts.map +1 -0
- package/dist/effects/types.js +2 -0
- package/dist/effects/types.js.map +1 -0
- package/dist/expand/refExpander.d.ts +14 -0
- package/dist/expand/refExpander.d.ts.map +1 -0
- package/dist/expand/refExpander.js +130 -0
- package/dist/expand/refExpander.js.map +1 -0
- package/dist/export/index.d.ts +5 -0
- package/dist/export/index.d.ts.map +1 -0
- package/dist/export/index.js +5 -0
- package/dist/export/index.js.map +1 -0
- package/dist/export/jsonExport.d.ts +9 -0
- package/dist/export/jsonExport.d.ts.map +1 -0
- package/dist/export/jsonExport.js +184 -0
- package/dist/export/jsonExport.js.map +1 -0
- package/dist/export/midiExport.d.ts +9 -0
- package/dist/export/midiExport.d.ts.map +1 -0
- package/dist/export/midiExport.js +390 -0
- package/dist/export/midiExport.js.map +1 -0
- package/dist/export/ugeWriter.d.ts +33 -0
- package/dist/export/ugeWriter.d.ts.map +1 -0
- package/dist/export/ugeWriter.js +1997 -0
- package/dist/export/ugeWriter.js.map +1 -0
- package/dist/export/wavWriter.d.ts +24 -0
- package/dist/export/wavWriter.d.ts.map +1 -0
- package/dist/export/wavWriter.js +126 -0
- package/dist/export/wavWriter.js.map +1 -0
- package/dist/import/index.d.ts +5 -0
- package/dist/import/index.d.ts.map +1 -0
- package/dist/import/index.js +8 -0
- package/dist/import/index.js.map +1 -0
- package/dist/import/remoteCache.d.ts +60 -0
- package/dist/import/remoteCache.d.ts.map +1 -0
- package/dist/import/remoteCache.js +194 -0
- package/dist/import/remoteCache.js.map +1 -0
- package/dist/import/uge/uge.reader.d.ts +27 -0
- package/dist/import/uge/uge.reader.d.ts.map +1 -0
- package/dist/import/uge/uge.reader.js +545 -0
- package/dist/import/uge/uge.reader.js.map +1 -0
- package/dist/import/urlUtils.d.ts +50 -0
- package/dist/import/urlUtils.d.ts.map +1 -0
- package/dist/import/urlUtils.js +87 -0
- package/dist/import/urlUtils.js.map +1 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +318 -0
- package/dist/index.js.map +1 -0
- package/dist/instruments/instrumentState.d.ts +15 -0
- package/dist/instruments/instrumentState.d.ts.map +1 -0
- package/dist/instruments/instrumentState.js +24 -0
- package/dist/instruments/instrumentState.js.map +1 -0
- package/dist/parser/ast.d.ts +22 -0
- package/dist/parser/ast.d.ts.map +1 -0
- package/dist/parser/ast.js +5 -0
- package/dist/parser/ast.js.map +1 -0
- package/dist/parser/index.d.ts +14 -0
- package/dist/parser/index.d.ts.map +1 -0
- package/dist/parser/index.js +10 -0
- package/dist/parser/index.js.map +1 -0
- package/dist/parser/peggy/generated/parser.d.ts +8 -0
- package/dist/parser/peggy/generated/parser.d.ts.map +1 -0
- package/dist/parser/peggy/generated/parser.js +6269 -0
- package/dist/parser/peggy/generated/parser.js.map +1 -0
- package/dist/parser/peggy/index.d.ts +3 -0
- package/dist/parser/peggy/index.d.ts.map +1 -0
- package/dist/parser/peggy/index.js +555 -0
- package/dist/parser/peggy/index.js.map +1 -0
- package/dist/parser/structured.d.ts +16 -0
- package/dist/parser/structured.d.ts.map +1 -0
- package/dist/parser/structured.js +232 -0
- package/dist/parser/structured.js.map +1 -0
- package/dist/parser/tokenizer.d.ts +12 -0
- package/dist/parser/tokenizer.d.ts.map +1 -0
- package/dist/parser/tokenizer.js +14 -0
- package/dist/parser/tokenizer.js.map +1 -0
- package/dist/patterns/expand.d.ts +32 -0
- package/dist/patterns/expand.d.ts.map +1 -0
- package/dist/patterns/expand.js +184 -0
- package/dist/patterns/expand.js.map +1 -0
- package/dist/patterns/index.d.ts +2 -0
- package/dist/patterns/index.d.ts.map +1 -0
- package/dist/patterns/index.js +2 -0
- package/dist/patterns/index.js.map +1 -0
- package/dist/scheduler/index.d.ts +6 -0
- package/dist/scheduler/index.d.ts.map +1 -0
- package/dist/scheduler/index.js +9 -0
- package/dist/scheduler/index.js.map +1 -0
- package/dist/scheduler/tickScheduler.d.ts +27 -0
- package/dist/scheduler/tickScheduler.d.ts.map +1 -0
- package/dist/scheduler/tickScheduler.js +74 -0
- package/dist/scheduler/tickScheduler.js.map +1 -0
- package/dist/sequences/expand.d.ts +14 -0
- package/dist/sequences/expand.d.ts.map +1 -0
- package/dist/sequences/expand.js +137 -0
- package/dist/sequences/expand.js.map +1 -0
- package/dist/song/importResolver.browser.d.ts +29 -0
- package/dist/song/importResolver.browser.d.ts.map +1 -0
- package/dist/song/importResolver.browser.js +168 -0
- package/dist/song/importResolver.browser.js.map +1 -0
- package/dist/song/importResolver.d.ts +40 -0
- package/dist/song/importResolver.d.ts.map +1 -0
- package/dist/song/importResolver.js +445 -0
- package/dist/song/importResolver.js.map +1 -0
- package/dist/song/index.browser.d.ts +9 -0
- package/dist/song/index.browser.d.ts.map +1 -0
- package/dist/song/index.browser.js +7 -0
- package/dist/song/index.browser.js.map +1 -0
- package/dist/song/index.d.ts +8 -0
- package/dist/song/index.d.ts.map +1 -0
- package/dist/song/index.js +6 -0
- package/dist/song/index.js.map +1 -0
- package/dist/song/resolver.browser.d.ts +50 -0
- package/dist/song/resolver.browser.d.ts.map +1 -0
- package/dist/song/resolver.browser.js +536 -0
- package/dist/song/resolver.browser.js.map +1 -0
- package/dist/song/resolver.d.ts +20 -0
- package/dist/song/resolver.d.ts.map +1 -0
- package/dist/song/resolver.js +540 -0
- package/dist/song/resolver.js.map +1 -0
- package/dist/song/songModel.d.ts +34 -0
- package/dist/song/songModel.d.ts.map +1 -0
- package/dist/song/songModel.js +2 -0
- package/dist/song/songModel.js.map +1 -0
- package/dist/tests/refExpander.test.d.ts +2 -0
- package/dist/tests/refExpander.test.d.ts.map +1 -0
- package/dist/tests/refExpander.test.js +37 -0
- package/dist/tests/refExpander.test.js.map +1 -0
- package/dist/util/diag.d.ts +16 -0
- package/dist/util/diag.d.ts.map +1 -0
- package/dist/util/diag.js +29 -0
- package/dist/util/diag.js.map +1 -0
- package/package.json +84 -0
|
@@ -0,0 +1,445 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Import resolution for .ins files.
|
|
3
|
+
* Handles loading, caching, cycle detection, and merging of instrument definitions.
|
|
4
|
+
* Supports both local file imports and remote HTTP(S) imports.
|
|
5
|
+
*/
|
|
6
|
+
import { parse } from '../parser/index.js';
|
|
7
|
+
import * as path from 'path';
|
|
8
|
+
import * as fs from 'fs';
|
|
9
|
+
import { isRemoteImport, isLocalImport, extractLocalPath } from '../import/urlUtils.js';
|
|
10
|
+
import { RemoteInstrumentCache } from '../import/remoteCache.js';
|
|
11
|
+
/**
|
|
12
|
+
* Validate an import path for security vulnerabilities.
|
|
13
|
+
* Rejects paths with:
|
|
14
|
+
* - Parent directory traversal (..) segments (for local paths)
|
|
15
|
+
* - Absolute paths (unless explicitly allowed, for local paths)
|
|
16
|
+
* - Missing local: prefix for file imports
|
|
17
|
+
* Remote URLs (http://, https://, github:) are allowed and validated separately.
|
|
18
|
+
* @throws Error if the path is invalid
|
|
19
|
+
*/
|
|
20
|
+
function validateImportPath(importSource, allowAbsolutePaths = false) {
|
|
21
|
+
// Remote imports are handled separately
|
|
22
|
+
if (isRemoteImport(importSource)) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
// Local imports must have local: prefix
|
|
26
|
+
if (!isLocalImport(importSource)) {
|
|
27
|
+
throw new Error(`Invalid import path "${importSource}": local file imports must use "local:" prefix. ` +
|
|
28
|
+
`Use "local:${importSource}" instead. Remote imports should use "https://" or "github:" prefix.`);
|
|
29
|
+
}
|
|
30
|
+
// Extract the actual path from local: prefix
|
|
31
|
+
const actualPath = extractLocalPath(importSource);
|
|
32
|
+
// Normalize path separators for consistent checking
|
|
33
|
+
const normalized = actualPath.replace(/\\/g, '/');
|
|
34
|
+
// Check for parent directory traversal (..) as a path segment
|
|
35
|
+
// This regex matches ".." when it's:
|
|
36
|
+
// - At the start followed by / or end: ^\.\.(/|$)
|
|
37
|
+
// - Preceded by / and followed by / or end: /\.\.(/|$)
|
|
38
|
+
// This allows filenames containing ".." like "file..txt" but blocks path traversal
|
|
39
|
+
if (/(^|\/)\.\.($|\/)/.test(normalized)) {
|
|
40
|
+
throw new Error(`Invalid import path "${importSource}": path traversal using ".." is not allowed for security reasons`);
|
|
41
|
+
}
|
|
42
|
+
// Check for absolute paths
|
|
43
|
+
if (!allowAbsolutePaths) {
|
|
44
|
+
// Check for Unix-style absolute paths
|
|
45
|
+
if (normalized.startsWith('/')) {
|
|
46
|
+
throw new Error(`Invalid import path "${importSource}": absolute paths are not allowed for security reasons`);
|
|
47
|
+
}
|
|
48
|
+
// Check for Windows-style absolute paths (C:, D:, etc.)
|
|
49
|
+
if (/^[a-zA-Z]:/.test(normalized)) {
|
|
50
|
+
throw new Error(`Invalid import path "${importSource}": absolute paths are not allowed for security reasons`);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Validate that a resolved path is within allowed directories.
|
|
56
|
+
* Ensures the resolved path is under the base directory or one of the search paths.
|
|
57
|
+
*/
|
|
58
|
+
function validateResolvedPath(resolvedPath, allowedDirs, importSource, pathLib) {
|
|
59
|
+
if (allowedDirs.length === 0) {
|
|
60
|
+
return; // No restrictions if no allowed directories specified
|
|
61
|
+
}
|
|
62
|
+
const normalizedResolved = pathLib.normalize(resolvedPath);
|
|
63
|
+
for (const allowedDir of allowedDirs) {
|
|
64
|
+
const normalizedAllowed = pathLib.normalize(allowedDir);
|
|
65
|
+
const relative = pathLib.relative(normalizedAllowed, normalizedResolved);
|
|
66
|
+
// If relative path doesn't start with .., it's within the allowed directory
|
|
67
|
+
if (!relative.startsWith('..') && !pathLib.isAbsolute(relative)) {
|
|
68
|
+
return; // Valid - within allowed directory
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
throw new Error(`Security violation: import path "${importSource}" resolves to "${resolvedPath}" ` +
|
|
72
|
+
`which is outside the allowed directories`);
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Resolve a relative import path to an absolute path.
|
|
76
|
+
*/
|
|
77
|
+
function resolveImportPath(importSource, baseFilePath, searchPaths = [], options = {}) {
|
|
78
|
+
const fileExists = options.fileExists;
|
|
79
|
+
// Validate import path for security vulnerabilities
|
|
80
|
+
validateImportPath(importSource, options.allowAbsolutePaths || false);
|
|
81
|
+
// Extract the actual file path from local: prefix
|
|
82
|
+
const actualPath = extractLocalPath(importSource);
|
|
83
|
+
const checkExists = fileExists || ((p) => {
|
|
84
|
+
try {
|
|
85
|
+
return fs.existsSync(p);
|
|
86
|
+
}
|
|
87
|
+
catch {
|
|
88
|
+
return false;
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
// Use posix paths when a custom fileExists is provided (testing mode)
|
|
92
|
+
const pathLib = fileExists ? path.posix : path;
|
|
93
|
+
// Build list of allowed directories for validation
|
|
94
|
+
const allowedDirs = [];
|
|
95
|
+
if (baseFilePath) {
|
|
96
|
+
const baseDir = pathLib.dirname(baseFilePath);
|
|
97
|
+
// Normalize to absolute path for proper validation
|
|
98
|
+
const absoluteBaseDir = pathLib.isAbsolute(baseDir) ? baseDir : pathLib.resolve(baseDir);
|
|
99
|
+
allowedDirs.push(absoluteBaseDir);
|
|
100
|
+
}
|
|
101
|
+
// Also normalize search paths to absolute
|
|
102
|
+
for (const searchPath of searchPaths) {
|
|
103
|
+
const absoluteSearchPath = pathLib.isAbsolute(searchPath) ? searchPath : pathLib.resolve(searchPath);
|
|
104
|
+
allowedDirs.push(absoluteSearchPath);
|
|
105
|
+
}
|
|
106
|
+
// If we have a base file path, try resolving relative to it first
|
|
107
|
+
if (baseFilePath) {
|
|
108
|
+
const baseDir = pathLib.dirname(baseFilePath);
|
|
109
|
+
const resolved = pathLib.resolve(baseDir, actualPath);
|
|
110
|
+
// Validate that resolved path is within allowed directories
|
|
111
|
+
validateResolvedPath(resolved, allowedDirs, importSource, pathLib);
|
|
112
|
+
if (checkExists(resolved)) {
|
|
113
|
+
return resolved;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
// Try search paths
|
|
117
|
+
for (const searchPath of searchPaths) {
|
|
118
|
+
const resolved = pathLib.resolve(searchPath, actualPath);
|
|
119
|
+
// Validate that resolved path is within allowed directories
|
|
120
|
+
validateResolvedPath(resolved, allowedDirs, importSource, pathLib);
|
|
121
|
+
if (checkExists(resolved)) {
|
|
122
|
+
return resolved;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
return null;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Validate that an AST contains only allowed node types for .ins files.
|
|
129
|
+
*/
|
|
130
|
+
function validateInsFile(ast, filePath) {
|
|
131
|
+
// .ins files should only contain instrument definitions and imports
|
|
132
|
+
// Check for disallowed nodes
|
|
133
|
+
const disallowed = [];
|
|
134
|
+
// Playback/structure directives
|
|
135
|
+
if (Object.keys(ast.pats || {}).length > 0)
|
|
136
|
+
disallowed.push('patterns');
|
|
137
|
+
if (Object.keys(ast.seqs || {}).length > 0)
|
|
138
|
+
disallowed.push('sequences');
|
|
139
|
+
if ((ast.channels || []).length > 0)
|
|
140
|
+
disallowed.push('channels');
|
|
141
|
+
if (ast.arranges && Object.keys(ast.arranges).length > 0)
|
|
142
|
+
disallowed.push('arranges');
|
|
143
|
+
if (ast.play !== undefined)
|
|
144
|
+
disallowed.push('play');
|
|
145
|
+
// Top-level scalar directives (should not be in .ins files)
|
|
146
|
+
if (ast.chip !== undefined)
|
|
147
|
+
disallowed.push('chip');
|
|
148
|
+
if (ast.bpm !== undefined)
|
|
149
|
+
disallowed.push('bpm');
|
|
150
|
+
if (ast.volume !== undefined)
|
|
151
|
+
disallowed.push('volume');
|
|
152
|
+
// Metadata
|
|
153
|
+
if (ast.metadata !== undefined && Object.keys(ast.metadata).length > 0) {
|
|
154
|
+
disallowed.push('metadata');
|
|
155
|
+
}
|
|
156
|
+
// Effect definitions
|
|
157
|
+
if (ast.effects && Object.keys(ast.effects).length > 0)
|
|
158
|
+
disallowed.push('effects');
|
|
159
|
+
// Pattern events and structured patterns
|
|
160
|
+
if (ast.patternEvents && Object.keys(ast.patternEvents).length > 0) {
|
|
161
|
+
disallowed.push('patternEvents');
|
|
162
|
+
}
|
|
163
|
+
if (ast.sequenceItems && Object.keys(ast.sequenceItems).length > 0) {
|
|
164
|
+
disallowed.push('sequenceItems');
|
|
165
|
+
}
|
|
166
|
+
// Check for any other non-standard properties that might be added
|
|
167
|
+
const allowedKeys = new Set([
|
|
168
|
+
'insts', 'imports', 'pats', 'seqs', 'channels', 'arranges', 'play',
|
|
169
|
+
'chip', 'bpm', 'volume', 'metadata', 'effects', 'patternEvents', 'sequenceItems'
|
|
170
|
+
]);
|
|
171
|
+
for (const key of Object.keys(ast)) {
|
|
172
|
+
if (!allowedKeys.has(key) && key !== 'insts' && key !== 'imports') {
|
|
173
|
+
disallowed.push(`unknown property '${key}'`);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
if (disallowed.length > 0) {
|
|
177
|
+
throw new Error(`Invalid .ins file "${filePath}": .ins files may only contain "inst" and "import" declarations. ` +
|
|
178
|
+
`Found: ${disallowed.join(', ')}`);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Load and parse an import file (local or remote).
|
|
183
|
+
*/
|
|
184
|
+
async function loadImportFile(importSource, ctx) {
|
|
185
|
+
// Handle remote imports
|
|
186
|
+
if (isRemoteImport(importSource)) {
|
|
187
|
+
return await loadRemoteImportFile(importSource, ctx);
|
|
188
|
+
}
|
|
189
|
+
// Check if this is a local import in browser context
|
|
190
|
+
if (isLocalImport(importSource) && typeof window !== 'undefined') {
|
|
191
|
+
throw new Error(`Local imports are not supported in the browser for security reasons. ` +
|
|
192
|
+
`Import "${importSource}" cannot be loaded. ` +
|
|
193
|
+
`Use remote imports (https:// or github:) instead, or run in CLI for local file access.`);
|
|
194
|
+
}
|
|
195
|
+
// Resolve local file path
|
|
196
|
+
const absolutePath = resolveImportPath(importSource, ctx.options.baseFilePath, ctx.options.searchPaths || [], ctx.options);
|
|
197
|
+
if (!absolutePath) {
|
|
198
|
+
throw new Error(`Import file not found: "${importSource}"` +
|
|
199
|
+
(ctx.options.baseFilePath ? ` (imported from "${ctx.options.baseFilePath}")` : ''));
|
|
200
|
+
}
|
|
201
|
+
// Check cache first
|
|
202
|
+
if (ctx.cache[absolutePath]) {
|
|
203
|
+
return ctx.cache[absolutePath];
|
|
204
|
+
}
|
|
205
|
+
// Check for import cycles
|
|
206
|
+
if (ctx.importStack.includes(absolutePath)) {
|
|
207
|
+
const cycle = [...ctx.importStack, absolutePath].join(' -> ');
|
|
208
|
+
throw new Error(`Import cycle detected: ${cycle}`);
|
|
209
|
+
}
|
|
210
|
+
// Read file
|
|
211
|
+
let source;
|
|
212
|
+
try {
|
|
213
|
+
if (ctx.options.readFile) {
|
|
214
|
+
source = ctx.options.readFile(absolutePath);
|
|
215
|
+
}
|
|
216
|
+
else {
|
|
217
|
+
source = fs.readFileSync(absolutePath, 'utf-8');
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
catch (err) {
|
|
221
|
+
throw new Error(`Failed to read import file "${absolutePath}": ${err}`);
|
|
222
|
+
}
|
|
223
|
+
// Parse file
|
|
224
|
+
let ast;
|
|
225
|
+
try {
|
|
226
|
+
ast = parse(source);
|
|
227
|
+
}
|
|
228
|
+
catch (err) {
|
|
229
|
+
throw new Error(`Failed to parse import file "${absolutePath}": ${err}`);
|
|
230
|
+
}
|
|
231
|
+
// Validate that this is a valid .ins file
|
|
232
|
+
validateInsFile(ast, absolutePath);
|
|
233
|
+
// Add to import stack for cycle detection
|
|
234
|
+
ctx.importStack.push(absolutePath);
|
|
235
|
+
// Recursively process imports in this file
|
|
236
|
+
// Create a new context with updated baseFilePath so nested imports resolve relative to this .ins file
|
|
237
|
+
const nestedCtx = {
|
|
238
|
+
...ctx,
|
|
239
|
+
options: { ...ctx.options, baseFilePath: absolutePath }
|
|
240
|
+
};
|
|
241
|
+
const mergedInsts = await processImports(ast, absolutePath, nestedCtx);
|
|
242
|
+
// Merge this file's instruments (they override imported ones - last-win)
|
|
243
|
+
const finalInsts = mergeInstruments(mergedInsts, ast.insts || {}, absolutePath, ctx);
|
|
244
|
+
// Remove from import stack
|
|
245
|
+
ctx.importStack.pop();
|
|
246
|
+
// Cache the result
|
|
247
|
+
ctx.cache[absolutePath] = finalInsts;
|
|
248
|
+
return finalInsts;
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* Load and parse a remote import file.
|
|
252
|
+
*/
|
|
253
|
+
async function loadRemoteImportFile(url, ctx) {
|
|
254
|
+
// Check for import cycles (use URL as identifier)
|
|
255
|
+
if (ctx.importStack.includes(url)) {
|
|
256
|
+
const cycle = [...ctx.importStack, url].join(' -> ');
|
|
257
|
+
throw new Error(`Import cycle detected: ${cycle}`);
|
|
258
|
+
}
|
|
259
|
+
// Get or create remote cache
|
|
260
|
+
if (!ctx.remoteCache) {
|
|
261
|
+
ctx.remoteCache = new RemoteInstrumentCache(ctx.options.remoteOptions);
|
|
262
|
+
}
|
|
263
|
+
// Add to import stack
|
|
264
|
+
ctx.importStack.push(url);
|
|
265
|
+
try {
|
|
266
|
+
// Fetch from remote cache (handles caching internally)
|
|
267
|
+
const instruments = await ctx.remoteCache.fetch(url);
|
|
268
|
+
// Note: Remote .ins files cannot have nested imports for security reasons
|
|
269
|
+
// The RemoteInstrumentCache already validates that the file only contains instruments
|
|
270
|
+
return instruments;
|
|
271
|
+
}
|
|
272
|
+
finally {
|
|
273
|
+
// Remove from import stack
|
|
274
|
+
ctx.importStack.pop();
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* Merge instrument maps with last-win semantics.
|
|
279
|
+
*/
|
|
280
|
+
function mergeInstruments(base, override, sourcePath, ctx) {
|
|
281
|
+
const result = { ...base };
|
|
282
|
+
for (const [name, inst] of Object.entries(override)) {
|
|
283
|
+
if (result[name] !== undefined) {
|
|
284
|
+
const message = `Instrument "${name}" from "${sourcePath}" overrides previously defined instrument`;
|
|
285
|
+
if (ctx.options.strictMode) {
|
|
286
|
+
throw new Error(message);
|
|
287
|
+
}
|
|
288
|
+
else if (ctx.options.onWarn) {
|
|
289
|
+
ctx.options.onWarn(message);
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
result[name] = inst;
|
|
293
|
+
}
|
|
294
|
+
return result;
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* Process all imports in an AST and return merged instruments.
|
|
298
|
+
*/
|
|
299
|
+
async function processImports(ast, baseFilePath, ctx) {
|
|
300
|
+
let mergedInsts = {};
|
|
301
|
+
if (!ast.imports || ast.imports.length === 0) {
|
|
302
|
+
return mergedInsts;
|
|
303
|
+
}
|
|
304
|
+
for (const imp of ast.imports) {
|
|
305
|
+
const importedInsts = await loadImportFile(imp.source, ctx);
|
|
306
|
+
// Merge imported instruments (later imports override earlier ones)
|
|
307
|
+
mergedInsts = mergeInstruments(mergedInsts, importedInsts, imp.source, ctx);
|
|
308
|
+
}
|
|
309
|
+
return mergedInsts;
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* Resolve all imports in an AST and merge them into the instrument table.
|
|
313
|
+
* Returns a new AST with merged instruments.
|
|
314
|
+
* Supports both local file imports and remote HTTP(S) imports.
|
|
315
|
+
*/
|
|
316
|
+
export async function resolveImports(ast, options = {}) {
|
|
317
|
+
const ctx = {
|
|
318
|
+
importStack: [],
|
|
319
|
+
cache: {},
|
|
320
|
+
options,
|
|
321
|
+
remoteCache: options.remoteCache,
|
|
322
|
+
};
|
|
323
|
+
// Process imports
|
|
324
|
+
const importedInsts = await processImports(ast, options.baseFilePath, ctx);
|
|
325
|
+
// Merge imported instruments with local instruments (local overrides imported)
|
|
326
|
+
const finalInsts = mergeInstruments(importedInsts, ast.insts || {}, options.baseFilePath || '<main>', ctx);
|
|
327
|
+
// Return new AST with merged instruments and cleared imports
|
|
328
|
+
// (imports are already resolved, so we don't want to resolve them again)
|
|
329
|
+
return {
|
|
330
|
+
...ast,
|
|
331
|
+
insts: finalInsts,
|
|
332
|
+
imports: [], // Clear imports to prevent double-resolution
|
|
333
|
+
};
|
|
334
|
+
}
|
|
335
|
+
/**
|
|
336
|
+
* Synchronous wrapper for resolveImports for backward compatibility.
|
|
337
|
+
* Does not support remote imports - throws an error if remote imports are encountered.
|
|
338
|
+
* @deprecated Use resolveImports (async) instead
|
|
339
|
+
*/
|
|
340
|
+
export function resolveImportsSync(ast, options = {}) {
|
|
341
|
+
// Check if AST contains remote imports
|
|
342
|
+
if (ast.imports && ast.imports.some(imp => isRemoteImport(imp.source))) {
|
|
343
|
+
throw new Error('Remote imports require async resolution. Use resolveImports() instead of resolveImportsSync().');
|
|
344
|
+
}
|
|
345
|
+
// Use a synchronous implementation for local imports only
|
|
346
|
+
const ctx = {
|
|
347
|
+
importStack: [],
|
|
348
|
+
cache: {},
|
|
349
|
+
options,
|
|
350
|
+
};
|
|
351
|
+
// Process imports synchronously
|
|
352
|
+
const importedInsts = processImportsSync(ast, options.baseFilePath, ctx);
|
|
353
|
+
// Merge imported instruments with local instruments
|
|
354
|
+
const finalInsts = mergeInstruments(importedInsts, ast.insts || {}, options.baseFilePath || '<main>', ctx);
|
|
355
|
+
return {
|
|
356
|
+
...ast,
|
|
357
|
+
insts: finalInsts,
|
|
358
|
+
};
|
|
359
|
+
}
|
|
360
|
+
/**
|
|
361
|
+
* Synchronous version of processImports (local files only).
|
|
362
|
+
*/
|
|
363
|
+
function processImportsSync(ast, baseFilePath, ctx) {
|
|
364
|
+
let mergedInsts = {};
|
|
365
|
+
if (!ast.imports || ast.imports.length === 0) {
|
|
366
|
+
return mergedInsts;
|
|
367
|
+
}
|
|
368
|
+
for (const imp of ast.imports) {
|
|
369
|
+
if (isRemoteImport(imp.source)) {
|
|
370
|
+
throw new Error(`Remote import "${imp.source}" requires async resolution. Use resolveImports() instead.`);
|
|
371
|
+
}
|
|
372
|
+
const importedInsts = loadImportFileSync(imp.source, ctx);
|
|
373
|
+
mergedInsts = mergeInstruments(mergedInsts, importedInsts, imp.source, ctx);
|
|
374
|
+
}
|
|
375
|
+
return mergedInsts;
|
|
376
|
+
}
|
|
377
|
+
/**
|
|
378
|
+
* Synchronous version of loadImportFile (local files only).
|
|
379
|
+
*/
|
|
380
|
+
function loadImportFileSync(importSource, ctx) {
|
|
381
|
+
if (isRemoteImport(importSource)) {
|
|
382
|
+
throw new Error(`Remote import "${importSource}" requires async resolution.`);
|
|
383
|
+
}
|
|
384
|
+
// Check if this is a local import in browser context
|
|
385
|
+
if (isLocalImport(importSource) && typeof window !== 'undefined') {
|
|
386
|
+
throw new Error(`Local imports are not supported in the browser for security reasons. ` +
|
|
387
|
+
`Import "${importSource}" cannot be loaded. ` +
|
|
388
|
+
`Use remote imports (https:// or github:) instead, or run in CLI for local file access.`);
|
|
389
|
+
}
|
|
390
|
+
// Resolve local file path
|
|
391
|
+
const absolutePath = resolveImportPath(importSource, ctx.options.baseFilePath, ctx.options.searchPaths || [], ctx.options);
|
|
392
|
+
if (!absolutePath) {
|
|
393
|
+
throw new Error(`Import file not found: "${importSource}"` +
|
|
394
|
+
(ctx.options.baseFilePath ? ` (imported from "${ctx.options.baseFilePath}")` : ''));
|
|
395
|
+
}
|
|
396
|
+
// Check cache first
|
|
397
|
+
if (ctx.cache[absolutePath]) {
|
|
398
|
+
return ctx.cache[absolutePath];
|
|
399
|
+
}
|
|
400
|
+
// Check for import cycles
|
|
401
|
+
if (ctx.importStack.includes(absolutePath)) {
|
|
402
|
+
const cycle = [...ctx.importStack, absolutePath].join(' -> ');
|
|
403
|
+
throw new Error(`Import cycle detected: ${cycle}`);
|
|
404
|
+
}
|
|
405
|
+
// Read file
|
|
406
|
+
let source;
|
|
407
|
+
try {
|
|
408
|
+
if (ctx.options.readFile) {
|
|
409
|
+
source = ctx.options.readFile(absolutePath);
|
|
410
|
+
}
|
|
411
|
+
else {
|
|
412
|
+
source = fs.readFileSync(absolutePath, 'utf-8');
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
catch (err) {
|
|
416
|
+
throw new Error(`Failed to read import file "${absolutePath}": ${err}`);
|
|
417
|
+
}
|
|
418
|
+
// Parse file
|
|
419
|
+
let ast;
|
|
420
|
+
try {
|
|
421
|
+
ast = parse(source);
|
|
422
|
+
}
|
|
423
|
+
catch (err) {
|
|
424
|
+
throw new Error(`Failed to parse import file "${absolutePath}": ${err}`);
|
|
425
|
+
}
|
|
426
|
+
// Validate that this is a valid .ins file
|
|
427
|
+
validateInsFile(ast, absolutePath);
|
|
428
|
+
// Add to import stack for cycle detection
|
|
429
|
+
ctx.importStack.push(absolutePath);
|
|
430
|
+
// Recursively process imports in this file
|
|
431
|
+
// Create a new context with updated baseFilePath so nested imports resolve relative to this .ins file
|
|
432
|
+
const nestedCtx = {
|
|
433
|
+
...ctx,
|
|
434
|
+
options: { ...ctx.options, baseFilePath: absolutePath }
|
|
435
|
+
};
|
|
436
|
+
const mergedInsts = processImportsSync(ast, absolutePath, nestedCtx);
|
|
437
|
+
// Merge this file's instruments (they override imported ones - last-win)
|
|
438
|
+
const finalInsts = mergeInstruments(mergedInsts, ast.insts || {}, absolutePath, ctx);
|
|
439
|
+
// Remove from import stack
|
|
440
|
+
ctx.importStack.pop();
|
|
441
|
+
// Cache the result
|
|
442
|
+
ctx.cache[absolutePath] = finalInsts;
|
|
443
|
+
return finalInsts;
|
|
444
|
+
}
|
|
445
|
+
//# sourceMappingURL=importResolver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"importResolver.js","sourceRoot":"","sources":["../../src/song/importResolver.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,KA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
|
+
export { resolveSong, resolveSongAsync, isPanEmpty, parseEffectParams, parseEffectsInline } from './resolver.browser.js';
|
|
6
|
+
export { resolveImports, resolveImportsSync } from './importResolver.browser.js';
|
|
7
|
+
export type { ImportResolverOptions } from './importResolver.browser.js';
|
|
8
|
+
export type { SongModel, ChannelModel, ChannelEvent } from './songModel.js';
|
|
9
|
+
//# sourceMappingURL=index.browser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.browser.d.ts","sourceRoot":"","sources":["../../src/song/index.browser.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,UAAU,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AACzH,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACjF,YAAY,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACzE,YAAY,EAAE,SAAS,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Song module exports (Browser version)
|
|
3
|
+
* Uses browser-safe import resolver that doesn't depend on Node.js built-ins
|
|
4
|
+
*/
|
|
5
|
+
export { resolveSong, resolveSongAsync, isPanEmpty, parseEffectParams, parseEffectsInline } from './resolver.browser.js';
|
|
6
|
+
export { resolveImports, resolveImportsSync } from './importResolver.browser.js';
|
|
7
|
+
//# sourceMappingURL=index.browser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.browser.js","sourceRoot":"","sources":["../../src/song/index.browser.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,UAAU,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AACzH,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Song module exports
|
|
3
|
+
*/
|
|
4
|
+
export { resolveSong, resolveSongAsync, isPanEmpty, parseEffectParams, parseEffectsInline } from './resolver.js';
|
|
5
|
+
export { resolveImports, resolveImportsSync } from './importResolver.js';
|
|
6
|
+
export type { ImportResolverOptions } from './importResolver.js';
|
|
7
|
+
export type { SongModel, ChannelModel, ChannelEvent } from './songModel.js';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/song/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,UAAU,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACjH,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzE,YAAY,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AACjE,YAAY,EAAE,SAAS,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/song/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,UAAU,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACjH,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { AST } from '../parser/ast.js';
|
|
2
|
+
import { SongModel } from './songModel.js';
|
|
3
|
+
export declare function isPanEmpty(pan: any): boolean;
|
|
4
|
+
export declare function parseEffectParams(paramsStr: string | undefined): Array<string | number>;
|
|
5
|
+
export declare function parseEffectsInline(str: string): {
|
|
6
|
+
effects: {
|
|
7
|
+
type: string;
|
|
8
|
+
params: Array<string | number>;
|
|
9
|
+
paramsStr?: string;
|
|
10
|
+
}[];
|
|
11
|
+
pan: any;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Resolve an AST into a SongModel (ISM), expanding sequences and resolving
|
|
15
|
+
* instrument overrides according to the language expansion pipeline.
|
|
16
|
+
*
|
|
17
|
+
* Note: This function does not support remote imports in the browser.
|
|
18
|
+
* Use resolveSongAsync() instead for remote imports.
|
|
19
|
+
*/
|
|
20
|
+
export declare function resolveSong(ast: AST, opts?: {
|
|
21
|
+
filename?: string;
|
|
22
|
+
searchPaths?: string[];
|
|
23
|
+
strictInstruments?: boolean;
|
|
24
|
+
onWarn?: (d: {
|
|
25
|
+
component: string;
|
|
26
|
+
message: string;
|
|
27
|
+
file?: string;
|
|
28
|
+
loc?: any;
|
|
29
|
+
}) => void;
|
|
30
|
+
}): SongModel;
|
|
31
|
+
/**
|
|
32
|
+
* Async version of resolveSong that supports remote imports.
|
|
33
|
+
* Use this when your AST may contain remote imports (http://, https://, github:).
|
|
34
|
+
*/
|
|
35
|
+
export declare function resolveSongAsync(ast: AST, opts?: {
|
|
36
|
+
filename?: string;
|
|
37
|
+
searchPaths?: string[];
|
|
38
|
+
strictInstruments?: boolean;
|
|
39
|
+
onWarn?: (d: {
|
|
40
|
+
component: string;
|
|
41
|
+
message: string;
|
|
42
|
+
file?: string;
|
|
43
|
+
loc?: any;
|
|
44
|
+
}) => void;
|
|
45
|
+
}): Promise<SongModel>;
|
|
46
|
+
declare const _default: {
|
|
47
|
+
resolveSong: typeof resolveSong;
|
|
48
|
+
};
|
|
49
|
+
export default _default;
|
|
50
|
+
//# sourceMappingURL=resolver.browser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolver.browser.d.ts","sourceRoot":"","sources":["../../src/song/resolver.browser.ts"],"names":[],"mappings":"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