Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
executable file
·
69 lines (59 loc) · 2.03 KB

File metadata and controls

executable file
·
69 lines (59 loc) · 2.03 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/usr/bin/env node
// Copyright 2018 The Emscripten Authors. All rights reserved.
// Emscripten is available under two separate licenses, the MIT license and the
// University of Illinois/NCSA Open Source License. Both these licenses can be
// found in the LICENSE file.
//
// Preprocessor tool. This is a wrapper for the 'preprocess' function which
// allows it to be called as a standalone tool.
//
// Parameters:
// setting file. Can specify 'settings.js' here, alternatively create a temp
// file with modified settings and supply the filename here.
// input file This is the file that will be processed by the preprocessor
'use strict';
import * as fs from 'fs';
import * as path from 'path';
import * as vm from 'vm';
import assert from 'assert';
import * as url from 'url';
const args = process.argv.slice(2);
const debug = false;
// Anything needed by the script that we load below must be added to the
// global object. These, for example, are all needed by parseTools.js.
global.vm = vm;
global.assert = assert;
global.print = (x) => {
process.stdout.write(x + '\n');
};
global.printErr = (x) => {
process.stderr.write(x + '\n');
};
function find(filename) {
const dirname = url.fileURLToPath(new URL('.', import.meta.url));
const prefixes = [process.cwd(), path.join(dirname, '..', 'src')];
for (let i = 0; i < prefixes.length; ++i) {
const combined = path.join(prefixes[i], filename);
if (fs.existsSync(combined)) {
return combined;
}
}
return filename;
}
global.read = (filename) => {
const absolute = find(filename);
return fs.readFileSync(absolute).toString();
};
global.load = (f) => {
(0, eval)(read(f) + '//# sourceURL=' + find(f));
};
assert(args.length >= 2);
const settingsFile = args[0];
const inputFile = args[1];
const expandMacros = args.includes('--expandMacros');
load(settingsFile);
load('utility.js');
load('modules.js');
load('parseTools.js');
const output = expandMacros ? processMacros(preprocess(inputFile)) : preprocess(inputFile);
process.stdout.write(output);
Morty Proxy This is a proxified and sanitized view of the page, visit original site.