@kamilio/wire 0.1.22 → 0.1.23
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 +7 -2
- package/dist/adapters/root.d.ts +5 -0
- package/dist/adapters/root.d.ts.map +1 -1
- package/dist/adapters/root.js +40 -4
- package/dist/adapters/root.js.map +1 -1
- package/dist/cli.js +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/executable.d.ts.map +1 -1
- package/dist/executable.js +2 -1
- package/dist/executable.js.map +1 -1
- package/node_modules/@xmldom/xmldom/CHANGELOG.md +1132 -0
- package/node_modules/@xmldom/xmldom/LICENSE +8 -0
- package/node_modules/@xmldom/xmldom/SECURITY.md +50 -0
- package/node_modules/@xmldom/xmldom/index.d.ts +1843 -0
- package/node_modules/@xmldom/xmldom/lib/.eslintrc.yml +3 -0
- package/node_modules/@xmldom/xmldom/lib/conventions.js +429 -0
- package/node_modules/@xmldom/xmldom/lib/dom-parser.js +591 -0
- package/node_modules/@xmldom/xmldom/lib/dom.js +3759 -0
- package/node_modules/@xmldom/xmldom/lib/entities.js +2171 -0
- package/node_modules/@xmldom/xmldom/lib/errors.js +205 -0
- package/node_modules/@xmldom/xmldom/lib/grammar.js +559 -0
- package/node_modules/@xmldom/xmldom/lib/index.js +41 -0
- package/node_modules/@xmldom/xmldom/lib/sax.js +983 -0
- package/node_modules/@xmldom/xmldom/package.json +77 -0
- package/node_modules/@xmldom/xmldom/readme.md +366 -0
- package/node_modules/marked/LICENSE.md +44 -0
- package/node_modules/marked/README.md +107 -0
- package/node_modules/marked/bin/main.js +284 -0
- package/node_modules/marked/bin/marked.js +16 -0
- package/node_modules/marked/lib/marked.d.ts +759 -0
- package/node_modules/marked/lib/marked.esm.js +72 -0
- package/node_modules/marked/lib/marked.esm.js.map +7 -0
- package/node_modules/marked/lib/marked.umd.js +74 -0
- package/node_modules/marked/lib/marked.umd.js.map +7 -0
- package/node_modules/marked/man/marked.1 +113 -0
- package/node_modules/marked/man/marked.1.md +93 -0
- package/node_modules/marked/package.json +103 -0
- package/node_modules/provider-asana/dist/asana-markdown.d.ts +5 -0
- package/node_modules/provider-asana/dist/asana-markdown.d.ts.map +1 -0
- package/node_modules/provider-asana/dist/asana-markdown.js +127 -0
- package/node_modules/provider-asana/dist/asana-markdown.js.map +1 -0
- package/node_modules/provider-asana/dist/asana-task.d.ts +9 -4
- package/node_modules/provider-asana/dist/asana-task.d.ts.map +1 -1
- package/node_modules/provider-asana/dist/asana-task.js +92 -12
- package/node_modules/provider-asana/dist/asana-task.js.map +1 -1
- package/node_modules/provider-asana/dist/index.d.ts +1 -1
- package/node_modules/provider-asana/dist/index.d.ts.map +1 -1
- package/node_modules/provider-asana/dist/index.js +1 -1
- package/node_modules/provider-asana/dist/index.js.map +1 -1
- package/node_modules/provider-asana/package.json +2 -0
- package/node_modules/provider-asana/src/asana-markdown.ts +113 -0
- package/node_modules/provider-asana/src/asana-task.ts +80 -12
- package/node_modules/provider-asana/src/index.ts +1 -1
- package/package.json +12 -6
- package/src/adapters/root.ts +42 -4
- package/src/cli.ts +1 -1
- package/src/executable.ts +2 -1
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Marked CLI
|
|
5
|
+
* Copyright (c) 2018+, MarkedJS. (MIT License)
|
|
6
|
+
* Copyright (c) 2011-2018, Christopher Jeffrey. (MIT License)
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { promises } from 'node:fs';
|
|
10
|
+
import { dirname, resolve } from 'node:path';
|
|
11
|
+
import { homedir } from 'node:os';
|
|
12
|
+
import { createRequire } from 'node:module';
|
|
13
|
+
import { pathToFileURL } from 'node:url';
|
|
14
|
+
import { marked } from '../lib/marked.esm.js';
|
|
15
|
+
|
|
16
|
+
const { access, readFile, writeFile } = promises;
|
|
17
|
+
const require = createRequire(import.meta.url);
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @param {Process} nodeProcess inject process so it can be mocked in tests.
|
|
21
|
+
*/
|
|
22
|
+
export async function main(nodeProcess) {
|
|
23
|
+
/**
|
|
24
|
+
* Man Page
|
|
25
|
+
*/
|
|
26
|
+
async function help() {
|
|
27
|
+
const { spawn } = await import('child_process');
|
|
28
|
+
const { fileURLToPath } = await import('url');
|
|
29
|
+
|
|
30
|
+
const options = {
|
|
31
|
+
cwd: nodeProcess.cwd(),
|
|
32
|
+
env: nodeProcess.env,
|
|
33
|
+
stdio: 'inherit',
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
37
|
+
const helpText = await readFile(resolve(__dirname, '../man/marked.1.md'), 'utf8');
|
|
38
|
+
|
|
39
|
+
await new Promise(res => {
|
|
40
|
+
const manProcess = spawn('man', [resolve(__dirname, '../man/marked.1')], options);
|
|
41
|
+
nodeProcess.on('SIGINT', () => {
|
|
42
|
+
manProcess.kill('SIGINT');
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
manProcess.on('error', () => {
|
|
46
|
+
console.log(helpText);
|
|
47
|
+
})
|
|
48
|
+
.on('close', res);
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
async function version() {
|
|
53
|
+
const pkg = require('../package.json');
|
|
54
|
+
console.log(pkg.version);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Main
|
|
59
|
+
*/
|
|
60
|
+
async function start(argv) {
|
|
61
|
+
const files = [];
|
|
62
|
+
const options = {};
|
|
63
|
+
let input;
|
|
64
|
+
let output;
|
|
65
|
+
let string;
|
|
66
|
+
let arg;
|
|
67
|
+
let tokens;
|
|
68
|
+
let config;
|
|
69
|
+
let opt;
|
|
70
|
+
let noclobber;
|
|
71
|
+
|
|
72
|
+
function getArg() {
|
|
73
|
+
let arg = argv.shift();
|
|
74
|
+
|
|
75
|
+
if (arg.indexOf('--') === 0) {
|
|
76
|
+
// e.g. --opt
|
|
77
|
+
arg = arg.split('=');
|
|
78
|
+
if (arg.length > 1) {
|
|
79
|
+
// e.g. --opt=val
|
|
80
|
+
argv.unshift(arg.slice(1).join('='));
|
|
81
|
+
}
|
|
82
|
+
arg = arg[0];
|
|
83
|
+
} else if (arg[0] === '-') {
|
|
84
|
+
if (arg.length > 2) {
|
|
85
|
+
// e.g. -abc
|
|
86
|
+
argv = arg.substring(1).split('').map(function(ch) {
|
|
87
|
+
return '-' + ch;
|
|
88
|
+
}).concat(argv);
|
|
89
|
+
arg = argv.shift();
|
|
90
|
+
} else {
|
|
91
|
+
// e.g. -a
|
|
92
|
+
}
|
|
93
|
+
} else {
|
|
94
|
+
// e.g. foo
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
return arg;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
while (argv.length) {
|
|
101
|
+
arg = getArg();
|
|
102
|
+
switch (arg) {
|
|
103
|
+
case '-o':
|
|
104
|
+
case '--output':
|
|
105
|
+
output = argv.shift();
|
|
106
|
+
break;
|
|
107
|
+
case '-i':
|
|
108
|
+
case '--input':
|
|
109
|
+
input = argv.shift();
|
|
110
|
+
break;
|
|
111
|
+
case '-s':
|
|
112
|
+
case '--string':
|
|
113
|
+
string = argv.shift();
|
|
114
|
+
break;
|
|
115
|
+
case '-t':
|
|
116
|
+
case '--tokens':
|
|
117
|
+
tokens = true;
|
|
118
|
+
break;
|
|
119
|
+
case '-c':
|
|
120
|
+
case '--config':
|
|
121
|
+
config = argv.shift();
|
|
122
|
+
break;
|
|
123
|
+
case '-n':
|
|
124
|
+
case '--no-clobber':
|
|
125
|
+
noclobber = true;
|
|
126
|
+
break;
|
|
127
|
+
case '-h':
|
|
128
|
+
case '--help':
|
|
129
|
+
return await help();
|
|
130
|
+
case '-v':
|
|
131
|
+
case '--version':
|
|
132
|
+
return await version();
|
|
133
|
+
default:
|
|
134
|
+
if (arg.indexOf('--') === 0) {
|
|
135
|
+
opt = camelize(arg.replace(/^--(no-)?/, ''));
|
|
136
|
+
if (!(opt in marked.defaults)) {
|
|
137
|
+
continue;
|
|
138
|
+
}
|
|
139
|
+
if (arg.indexOf('--no-') === 0) {
|
|
140
|
+
options[opt] = typeof marked.defaults[opt] !== 'boolean'
|
|
141
|
+
? null
|
|
142
|
+
: false;
|
|
143
|
+
} else {
|
|
144
|
+
options[opt] = typeof marked.defaults[opt] !== 'boolean'
|
|
145
|
+
? argv.shift()
|
|
146
|
+
: true;
|
|
147
|
+
}
|
|
148
|
+
} else {
|
|
149
|
+
files.push(arg);
|
|
150
|
+
}
|
|
151
|
+
break;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
async function getData() {
|
|
156
|
+
if (string) {
|
|
157
|
+
return string;
|
|
158
|
+
}
|
|
159
|
+
if (!input) {
|
|
160
|
+
if (files.length === 0) {
|
|
161
|
+
return await getStdin();
|
|
162
|
+
}
|
|
163
|
+
input = files.pop();
|
|
164
|
+
}
|
|
165
|
+
return await readFile(input, 'utf8');
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
function resolveFile(file) {
|
|
169
|
+
return resolve(file.replace(/^~/, homedir));
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
function fileExists(file) {
|
|
173
|
+
return access(resolveFile(file)).then(() => true, () => false);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
async function runConfig(file) {
|
|
177
|
+
const configFile = resolveFile(file);
|
|
178
|
+
let markedConfig;
|
|
179
|
+
try {
|
|
180
|
+
// try require for json
|
|
181
|
+
markedConfig = require(configFile);
|
|
182
|
+
} catch(err) {
|
|
183
|
+
if (err.code !== 'ERR_REQUIRE_ESM') {
|
|
184
|
+
throw err;
|
|
185
|
+
}
|
|
186
|
+
// must import esm
|
|
187
|
+
markedConfig = await import(pathToFileURL(configFile).href);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
if (markedConfig.default) {
|
|
191
|
+
markedConfig = markedConfig.default;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
if (typeof markedConfig === 'function') {
|
|
195
|
+
markedConfig(marked);
|
|
196
|
+
} else {
|
|
197
|
+
marked.use(markedConfig);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
const data = await getData();
|
|
202
|
+
|
|
203
|
+
if (config) {
|
|
204
|
+
if (!await fileExists(config)) {
|
|
205
|
+
throw Error(`Cannot load config file '${config}'`);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
await runConfig(config);
|
|
209
|
+
} else {
|
|
210
|
+
const defaultConfig = [
|
|
211
|
+
'~/.marked.json',
|
|
212
|
+
'~/.marked.js',
|
|
213
|
+
'~/.marked/index.js',
|
|
214
|
+
];
|
|
215
|
+
|
|
216
|
+
for (const configFile of defaultConfig) {
|
|
217
|
+
if (await fileExists(configFile)) {
|
|
218
|
+
await runConfig(configFile);
|
|
219
|
+
break;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
const html = tokens
|
|
225
|
+
? JSON.stringify(marked.lexer(data, options), null, 2)
|
|
226
|
+
: await marked.parse(data, options);
|
|
227
|
+
|
|
228
|
+
if (output) {
|
|
229
|
+
if (noclobber && await fileExists(output)) {
|
|
230
|
+
throw Error('marked: output file \'' + output + '\' already exists, disable the \'-n\' / \'--no-clobber\' flag to overwrite\n');
|
|
231
|
+
}
|
|
232
|
+
return await writeFile(output, html);
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
nodeProcess.stdout.write(html + '\n');
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* Helpers
|
|
240
|
+
*/
|
|
241
|
+
function getStdin() {
|
|
242
|
+
return new Promise((resolve, reject) => {
|
|
243
|
+
const stdin = nodeProcess.stdin;
|
|
244
|
+
let buff = '';
|
|
245
|
+
|
|
246
|
+
stdin.setEncoding('utf8');
|
|
247
|
+
|
|
248
|
+
stdin.on('data', function(data) {
|
|
249
|
+
buff += data;
|
|
250
|
+
});
|
|
251
|
+
|
|
252
|
+
stdin.on('error', function(err) {
|
|
253
|
+
reject(err);
|
|
254
|
+
});
|
|
255
|
+
|
|
256
|
+
stdin.on('end', function() {
|
|
257
|
+
resolve(buff);
|
|
258
|
+
});
|
|
259
|
+
|
|
260
|
+
stdin.resume();
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
/**
|
|
265
|
+
* @param {string} text
|
|
266
|
+
*/
|
|
267
|
+
function camelize(text) {
|
|
268
|
+
return text.replace(/(\w)-(\w)/g, function(_, a, b) {
|
|
269
|
+
return a + b.toUpperCase();
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
try {
|
|
274
|
+
await start(nodeProcess.argv.slice());
|
|
275
|
+
nodeProcess.exit(0);
|
|
276
|
+
} catch(err) {
|
|
277
|
+
if (err.code === 'ENOENT') {
|
|
278
|
+
nodeProcess.stderr.write('marked: ' + err.path + ': No such file or directory');
|
|
279
|
+
} else {
|
|
280
|
+
nodeProcess.stderr.write(err.message);
|
|
281
|
+
}
|
|
282
|
+
return nodeProcess.exit(1);
|
|
283
|
+
}
|
|
284
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Marked CLI
|
|
5
|
+
* Copyright (c) 2018+, MarkedJS. (MIT License)
|
|
6
|
+
* Copyright (c) 2011-2018, Christopher Jeffrey. (MIT License)
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { main } from './main.js';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Expose / Entry Point
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
process.title = 'marked';
|
|
16
|
+
main(process);
|