SnowLuma v2.4.2 source snapshot
Dev Build / cleanup (push) Waiting to run
Dev Build / typecheck (push) Waiting to run
Publish MCP to npm / Build, test, and publish MCP (push) Waiting to run
Publish SDK to npm / Build, test, and publish SDK (push) Waiting to run
Sync action catalog to docs / sync (push) Waiting to run
Publish UI to npm / Build and publish UI (push) Waiting to run
Build and Release / preflight (push) Waiting to run
Dev Build / cleanup (push) Waiting to run
Dev Build / typecheck (push) Waiting to run
Publish MCP to npm / Build, test, and publish MCP (push) Waiting to run
Publish SDK to npm / Build, test, and publish SDK (push) Waiting to run
Sync action catalog to docs / sync (push) Waiting to run
Publish UI to npm / Build and publish UI (push) Waiting to run
Build and Release / preflight (push) Waiting to run
This commit is contained in:
commit
fa9c73363d
1367 files changed
+355735
No files matched your search
@@ -0,0 +1,24 @@
|
||||
import ts from 'typescript';
|
||||
import { ProtobufCompiler } from '../../src/compiler/compiler';
|
||||
import { packageName } from '../../src/package';
|
||||
|
||||
export const imports = `import { protobuf_encode, protobuf_decode } from '${packageName}';`;
|
||||
|
||||
export function run(body: string): any {
|
||||
const compiler = new ProtobufCompiler();
|
||||
const source = imports + '\n' + body;
|
||||
const transformed = compiler.compile(source, 'test-entry.ts') ?? source;
|
||||
const js = ts.transpileModule(transformed, {
|
||||
compilerOptions: { target: ts.ScriptTarget.ES2022, module: ts.ModuleKind.CommonJS },
|
||||
}).outputText;
|
||||
const exports = {};
|
||||
new Function('exports', 'require', js)(exports, () => ({
|
||||
protobuf_encode() {
|
||||
throw new Error('Uncompiled encode');
|
||||
},
|
||||
protobuf_decode() {
|
||||
throw new Error('Uncompiled decode');
|
||||
},
|
||||
}));
|
||||
return exports;
|
||||
}
|
||||
Reference in new issue
Block a user